pdf.worker.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828
  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. })(this, function() {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  42. var _util = __w_pdfjs_require__(2);
  43. var _primitives = __w_pdfjs_require__(5);
  44. var _pdf_manager = __w_pdfjs_require__(6);
  45. var _cleanup_helper = __w_pdfjs_require__(66);
  46. var _writer = __w_pdfjs_require__(72);
  47. var _is_node = __w_pdfjs_require__(4);
  48. var _message_handler = __w_pdfjs_require__(100);
  49. var _worker_stream = __w_pdfjs_require__(101);
  50. var _core_utils = __w_pdfjs_require__(8);
  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 && data[0] === 255);
  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.13.216';
  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 (let i = 0; i < cachedChunks.length; i++) {
  187. newPdfManager.sendProgressiveData(cachedChunks[i]);
  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 ({
  212. value,
  213. done
  214. }) {
  215. try {
  216. ensureNotTerminated();
  217. if (done) {
  218. if (!newPdfManager) {
  219. flushChunks();
  220. }
  221. cancelXHRs = null;
  222. return;
  223. }
  224. loaded += (0, _util.arrayByteLength)(value);
  225. if (!fullRequest.isStreamingSupported) {
  226. handler.send("DocProgress", {
  227. loaded,
  228. total: Math.max(loaded, fullRequest.contentLength || 0)
  229. });
  230. }
  231. if (newPdfManager) {
  232. newPdfManager.sendProgressiveData(value);
  233. } else {
  234. cachedChunks.push(value);
  235. }
  236. fullRequest.read().then(readChunk, reject);
  237. } catch (e) {
  238. reject(e);
  239. }
  240. };
  241. fullRequest.read().then(readChunk, reject);
  242. });
  243. readPromise.catch(function (e) {
  244. pdfManagerCapability.reject(e);
  245. cancelXHRs = null;
  246. });
  247. cancelXHRs = function (reason) {
  248. pdfStream.cancelAllRequests(reason);
  249. };
  250. return pdfManagerCapability.promise;
  251. }
  252. function setupDoc(data) {
  253. function onSuccess(doc) {
  254. ensureNotTerminated();
  255. handler.send("GetDoc", {
  256. pdfInfo: doc
  257. });
  258. }
  259. function onFailure(ex) {
  260. ensureNotTerminated();
  261. if (ex instanceof _util.PasswordException) {
  262. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  263. startWorkerTask(task);
  264. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  265. password
  266. }) {
  267. finishWorkerTask(task);
  268. pdfManager.updatePassword(password);
  269. pdfManagerReady();
  270. }).catch(function () {
  271. finishWorkerTask(task);
  272. handler.send("DocException", ex);
  273. });
  274. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  275. handler.send("DocException", ex);
  276. } else {
  277. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  278. }
  279. }
  280. function pdfManagerReady() {
  281. ensureNotTerminated();
  282. loadDocument(false).then(onSuccess, function (reason) {
  283. ensureNotTerminated();
  284. if (!(reason instanceof _core_utils.XRefParseException)) {
  285. onFailure(reason);
  286. return;
  287. }
  288. pdfManager.requestLoadedStream();
  289. pdfManager.onLoadedStream().then(function () {
  290. ensureNotTerminated();
  291. loadDocument(true).then(onSuccess, onFailure);
  292. });
  293. });
  294. }
  295. ensureNotTerminated();
  296. const evaluatorOptions = {
  297. maxImageSize: data.maxImageSize,
  298. disableFontFace: data.disableFontFace,
  299. ignoreErrors: data.ignoreErrors,
  300. isEvalSupported: data.isEvalSupported,
  301. fontExtraProperties: data.fontExtraProperties,
  302. useSystemFonts: data.useSystemFonts,
  303. cMapUrl: data.cMapUrl,
  304. standardFontDataUrl: data.standardFontDataUrl
  305. };
  306. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  307. if (terminated) {
  308. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  309. throw new Error("Worker was terminated");
  310. }
  311. pdfManager = newPdfManager;
  312. pdfManager.onLoadedStream().then(function (stream) {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function wphSetupGetPage(data) {
  320. return pdfManager.getPage(data.pageIndex).then(function (page) {
  321. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  322. return {
  323. rotate,
  324. ref,
  325. userUnit,
  326. view
  327. };
  328. });
  329. });
  330. });
  331. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  332. const pageRef = _primitives.Ref.get(data.num, data.gen);
  333. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  334. });
  335. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  336. return pdfManager.ensureCatalog("destinations");
  337. });
  338. handler.on("GetDestination", function wphSetupGetDestination(data) {
  339. return pdfManager.ensureCatalog("getDestination", [data.id]);
  340. });
  341. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  342. return pdfManager.ensureCatalog("pageLabels");
  343. });
  344. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  345. return pdfManager.ensureCatalog("pageLayout");
  346. });
  347. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  348. return pdfManager.ensureCatalog("pageMode");
  349. });
  350. handler.on("GetViewerPreferences", function (data) {
  351. return pdfManager.ensureCatalog("viewerPreferences");
  352. });
  353. handler.on("GetOpenAction", function (data) {
  354. return pdfManager.ensureCatalog("openAction");
  355. });
  356. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  357. return pdfManager.ensureCatalog("attachments");
  358. });
  359. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  360. return pdfManager.ensureCatalog("javaScript");
  361. });
  362. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  363. return pdfManager.ensureCatalog("jsActions");
  364. });
  365. handler.on("GetPageJSActions", function ({
  366. pageIndex
  367. }) {
  368. return pdfManager.getPage(pageIndex).then(function (page) {
  369. return pdfManager.ensure(page, "jsActions");
  370. });
  371. });
  372. handler.on("GetOutline", function wphSetupGetOutline(data) {
  373. return pdfManager.ensureCatalog("documentOutline");
  374. });
  375. handler.on("GetOptionalContentConfig", function (data) {
  376. return pdfManager.ensureCatalog("optionalContentConfig");
  377. });
  378. handler.on("GetPermissions", function (data) {
  379. return pdfManager.ensureCatalog("permissions");
  380. });
  381. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  382. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  383. });
  384. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  385. return pdfManager.ensureCatalog("markInfo");
  386. });
  387. handler.on("GetData", function wphSetupGetData(data) {
  388. pdfManager.requestLoadedStream();
  389. return pdfManager.onLoadedStream().then(function (stream) {
  390. return stream.bytes;
  391. });
  392. });
  393. handler.on("GetAnnotations", function ({
  394. pageIndex,
  395. intent
  396. }) {
  397. return pdfManager.getPage(pageIndex).then(function (page) {
  398. return page.getAnnotationsData(intent);
  399. });
  400. });
  401. handler.on("GetFieldObjects", function (data) {
  402. return pdfManager.ensureDoc("fieldObjects");
  403. });
  404. handler.on("HasJSActions", function (data) {
  405. return pdfManager.ensureDoc("hasJSActions");
  406. });
  407. handler.on("GetCalculationOrderIds", function (data) {
  408. return pdfManager.ensureDoc("calculationOrderIds");
  409. });
  410. handler.on("SaveDocument", function ({
  411. isPureXfa,
  412. numPages,
  413. annotationStorage,
  414. filename
  415. }) {
  416. pdfManager.requestLoadedStream();
  417. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  418. if (isPureXfa) {
  419. promises.push(pdfManager.serializeXfaData(annotationStorage));
  420. } else {
  421. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  422. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  423. const task = new WorkerTask(`Save: page ${pageIndex}`);
  424. return page.save(handler, task, annotationStorage).finally(function () {
  425. finishWorkerTask(task);
  426. });
  427. }));
  428. }
  429. }
  430. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  431. let newRefs = [];
  432. let xfaData = null;
  433. if (isPureXfa) {
  434. xfaData = refs[0];
  435. if (!xfaData) {
  436. return stream.bytes;
  437. }
  438. } else {
  439. for (const ref of refs) {
  440. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  441. }
  442. if (newRefs.length === 0) {
  443. return stream.bytes;
  444. }
  445. }
  446. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  447. let xfaDatasetsRef = null;
  448. let hasXfaDatasetsEntry = false;
  449. if (Array.isArray(xfa)) {
  450. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  451. if (xfa[i] === "datasets") {
  452. xfaDatasetsRef = xfa[i + 1];
  453. acroFormRef = null;
  454. hasXfaDatasetsEntry = true;
  455. }
  456. }
  457. if (xfaDatasetsRef === null) {
  458. xfaDatasetsRef = xref.getNewRef();
  459. }
  460. } else if (xfa) {
  461. acroFormRef = null;
  462. (0, _util.warn)("Unsupported XFA type.");
  463. }
  464. let newXrefInfo = Object.create(null);
  465. if (xref.trailer) {
  466. const infoObj = Object.create(null);
  467. const xrefInfo = xref.trailer.get("Info") || null;
  468. if (xrefInfo instanceof _primitives.Dict) {
  469. xrefInfo.forEach((key, value) => {
  470. if (typeof value === "string") {
  471. infoObj[key] = (0, _util.stringToPDFString)(value);
  472. }
  473. });
  474. }
  475. newXrefInfo = {
  476. rootRef: xref.trailer.getRaw("Root") || null,
  477. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  478. newRef: xref.getNewRef(),
  479. infoRef: xref.trailer.getRaw("Info") || null,
  480. info: infoObj,
  481. fileIds: xref.trailer.get("ID") || null,
  482. startXRef,
  483. filename
  484. };
  485. }
  486. xref.resetNewRef();
  487. return (0, _writer.incrementalUpdate)({
  488. originalData: stream.bytes,
  489. xrefInfo: newXrefInfo,
  490. newRefs,
  491. xref,
  492. hasXfa: !!xfa,
  493. xfaDatasetsRef,
  494. hasXfaDatasetsEntry,
  495. acroFormRef,
  496. acroForm,
  497. xfaData
  498. });
  499. });
  500. });
  501. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  502. const pageIndex = data.pageIndex;
  503. pdfManager.getPage(pageIndex).then(function (page) {
  504. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  505. startWorkerTask(task);
  506. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  507. page.getOperatorList({
  508. handler,
  509. sink,
  510. task,
  511. intent: data.intent,
  512. cacheKey: data.cacheKey,
  513. annotationStorage: data.annotationStorage
  514. }).then(function (operatorListInfo) {
  515. finishWorkerTask(task);
  516. if (start) {
  517. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  518. }
  519. sink.close();
  520. }, function (reason) {
  521. finishWorkerTask(task);
  522. if (task.terminated) {
  523. return;
  524. }
  525. handler.send("UnsupportedFeature", {
  526. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  527. });
  528. sink.error(reason);
  529. });
  530. });
  531. });
  532. handler.on("GetTextContent", function wphExtractText(data, sink) {
  533. const pageIndex = data.pageIndex;
  534. pdfManager.getPage(pageIndex).then(function (page) {
  535. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  536. startWorkerTask(task);
  537. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  538. page.extractTextContent({
  539. handler,
  540. task,
  541. sink,
  542. includeMarkedContent: data.includeMarkedContent,
  543. combineTextItems: data.combineTextItems
  544. }).then(function () {
  545. finishWorkerTask(task);
  546. if (start) {
  547. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  548. }
  549. sink.close();
  550. }, function (reason) {
  551. finishWorkerTask(task);
  552. if (task.terminated) {
  553. return;
  554. }
  555. sink.error(reason);
  556. });
  557. });
  558. });
  559. handler.on("GetStructTree", function wphGetStructTree(data) {
  560. return pdfManager.getPage(data.pageIndex).then(function (page) {
  561. return pdfManager.ensure(page, "getStructTree");
  562. });
  563. });
  564. handler.on("FontFallback", function (data) {
  565. return pdfManager.fontFallback(data.id, handler);
  566. });
  567. handler.on("Cleanup", function wphCleanup(data) {
  568. return pdfManager.cleanup(true);
  569. });
  570. handler.on("Terminate", function wphTerminate(data) {
  571. terminated = true;
  572. const waitOn = [];
  573. if (pdfManager) {
  574. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  575. const cleanupPromise = pdfManager.cleanup();
  576. waitOn.push(cleanupPromise);
  577. pdfManager = null;
  578. } else {
  579. (0, _cleanup_helper.clearGlobalCaches)();
  580. }
  581. if (cancelXHRs) {
  582. cancelXHRs(new _util.AbortException("Worker was terminated."));
  583. }
  584. for (const task of WorkerTasks) {
  585. waitOn.push(task.finished);
  586. task.terminate();
  587. }
  588. return Promise.all(waitOn).then(function () {
  589. handler.destroy();
  590. handler = null;
  591. });
  592. });
  593. handler.on("Ready", function wphReady(data) {
  594. setupDoc(docParams);
  595. docParams = null;
  596. });
  597. return workerHandlerName;
  598. }
  599. static initializeFromPort(port) {
  600. const handler = new _message_handler.MessageHandler("worker", "main", port);
  601. WorkerMessageHandler.setup(handler, port);
  602. handler.send("ready", null);
  603. }
  604. }
  605. exports.WorkerMessageHandler = WorkerMessageHandler;
  606. function isMessagePort(maybePort) {
  607. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  608. }
  609. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  610. WorkerMessageHandler.initializeFromPort(self);
  611. }
  612. /***/ }),
  613. /* 2 */
  614. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  615. Object.defineProperty(exports, "__esModule", ({
  616. value: true
  617. }));
  618. 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.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = 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.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  619. exports.arrayByteLength = arrayByteLength;
  620. exports.arraysToBytes = arraysToBytes;
  621. exports.assert = assert;
  622. exports.bytesToString = bytesToString;
  623. exports.createPromiseCapability = createPromiseCapability;
  624. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  625. exports.escapeString = escapeString;
  626. exports.getModificationDate = getModificationDate;
  627. exports.getVerbosityLevel = getVerbosityLevel;
  628. exports.info = info;
  629. exports.isArrayBuffer = isArrayBuffer;
  630. exports.isArrayEqual = isArrayEqual;
  631. exports.isAscii = isAscii;
  632. exports.isSameOrigin = isSameOrigin;
  633. exports.objectFromMap = objectFromMap;
  634. exports.objectSize = objectSize;
  635. exports.setVerbosityLevel = setVerbosityLevel;
  636. exports.shadow = shadow;
  637. exports.string32 = string32;
  638. exports.stringToBytes = stringToBytes;
  639. exports.stringToPDFString = stringToPDFString;
  640. exports.stringToUTF16BEString = stringToUTF16BEString;
  641. exports.stringToUTF8String = stringToUTF8String;
  642. exports.unreachable = unreachable;
  643. exports.utf8StringToString = utf8StringToString;
  644. exports.warn = warn;
  645. __w_pdfjs_require__(3);
  646. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  647. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  648. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  649. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  650. const RenderingIntentFlag = {
  651. ANY: 0x01,
  652. DISPLAY: 0x02,
  653. PRINT: 0x04,
  654. ANNOTATIONS_FORMS: 0x10,
  655. ANNOTATIONS_STORAGE: 0x20,
  656. ANNOTATIONS_DISABLE: 0x40,
  657. OPLIST: 0x100
  658. };
  659. exports.RenderingIntentFlag = RenderingIntentFlag;
  660. const AnnotationMode = {
  661. DISABLE: 0,
  662. ENABLE: 1,
  663. ENABLE_FORMS: 2,
  664. ENABLE_STORAGE: 3
  665. };
  666. exports.AnnotationMode = AnnotationMode;
  667. const PermissionFlag = {
  668. PRINT: 0x04,
  669. MODIFY_CONTENTS: 0x08,
  670. COPY: 0x10,
  671. MODIFY_ANNOTATIONS: 0x20,
  672. FILL_INTERACTIVE_FORMS: 0x100,
  673. COPY_FOR_ACCESSIBILITY: 0x200,
  674. ASSEMBLE: 0x400,
  675. PRINT_HIGH_QUALITY: 0x800
  676. };
  677. exports.PermissionFlag = PermissionFlag;
  678. const TextRenderingMode = {
  679. FILL: 0,
  680. STROKE: 1,
  681. FILL_STROKE: 2,
  682. INVISIBLE: 3,
  683. FILL_ADD_TO_PATH: 4,
  684. STROKE_ADD_TO_PATH: 5,
  685. FILL_STROKE_ADD_TO_PATH: 6,
  686. ADD_TO_PATH: 7,
  687. FILL_STROKE_MASK: 3,
  688. ADD_TO_PATH_FLAG: 4
  689. };
  690. exports.TextRenderingMode = TextRenderingMode;
  691. const ImageKind = {
  692. GRAYSCALE_1BPP: 1,
  693. RGB_24BPP: 2,
  694. RGBA_32BPP: 3
  695. };
  696. exports.ImageKind = ImageKind;
  697. const AnnotationType = {
  698. TEXT: 1,
  699. LINK: 2,
  700. FREETEXT: 3,
  701. LINE: 4,
  702. SQUARE: 5,
  703. CIRCLE: 6,
  704. POLYGON: 7,
  705. POLYLINE: 8,
  706. HIGHLIGHT: 9,
  707. UNDERLINE: 10,
  708. SQUIGGLY: 11,
  709. STRIKEOUT: 12,
  710. STAMP: 13,
  711. CARET: 14,
  712. INK: 15,
  713. POPUP: 16,
  714. FILEATTACHMENT: 17,
  715. SOUND: 18,
  716. MOVIE: 19,
  717. WIDGET: 20,
  718. SCREEN: 21,
  719. PRINTERMARK: 22,
  720. TRAPNET: 23,
  721. WATERMARK: 24,
  722. THREED: 25,
  723. REDACT: 26
  724. };
  725. exports.AnnotationType = AnnotationType;
  726. const AnnotationStateModelType = {
  727. MARKED: "Marked",
  728. REVIEW: "Review"
  729. };
  730. exports.AnnotationStateModelType = AnnotationStateModelType;
  731. const AnnotationMarkedState = {
  732. MARKED: "Marked",
  733. UNMARKED: "Unmarked"
  734. };
  735. exports.AnnotationMarkedState = AnnotationMarkedState;
  736. const AnnotationReviewState = {
  737. ACCEPTED: "Accepted",
  738. REJECTED: "Rejected",
  739. CANCELLED: "Cancelled",
  740. COMPLETED: "Completed",
  741. NONE: "None"
  742. };
  743. exports.AnnotationReviewState = AnnotationReviewState;
  744. const AnnotationReplyType = {
  745. GROUP: "Group",
  746. REPLY: "R"
  747. };
  748. exports.AnnotationReplyType = AnnotationReplyType;
  749. const AnnotationFlag = {
  750. INVISIBLE: 0x01,
  751. HIDDEN: 0x02,
  752. PRINT: 0x04,
  753. NOZOOM: 0x08,
  754. NOROTATE: 0x10,
  755. NOVIEW: 0x20,
  756. READONLY: 0x40,
  757. LOCKED: 0x80,
  758. TOGGLENOVIEW: 0x100,
  759. LOCKEDCONTENTS: 0x200
  760. };
  761. exports.AnnotationFlag = AnnotationFlag;
  762. const AnnotationFieldFlag = {
  763. READONLY: 0x0000001,
  764. REQUIRED: 0x0000002,
  765. NOEXPORT: 0x0000004,
  766. MULTILINE: 0x0001000,
  767. PASSWORD: 0x0002000,
  768. NOTOGGLETOOFF: 0x0004000,
  769. RADIO: 0x0008000,
  770. PUSHBUTTON: 0x0010000,
  771. COMBO: 0x0020000,
  772. EDIT: 0x0040000,
  773. SORT: 0x0080000,
  774. FILESELECT: 0x0100000,
  775. MULTISELECT: 0x0200000,
  776. DONOTSPELLCHECK: 0x0400000,
  777. DONOTSCROLL: 0x0800000,
  778. COMB: 0x1000000,
  779. RICHTEXT: 0x2000000,
  780. RADIOSINUNISON: 0x2000000,
  781. COMMITONSELCHANGE: 0x4000000
  782. };
  783. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  784. const AnnotationBorderStyleType = {
  785. SOLID: 1,
  786. DASHED: 2,
  787. BEVELED: 3,
  788. INSET: 4,
  789. UNDERLINE: 5
  790. };
  791. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  792. const AnnotationActionEventType = {
  793. E: "Mouse Enter",
  794. X: "Mouse Exit",
  795. D: "Mouse Down",
  796. U: "Mouse Up",
  797. Fo: "Focus",
  798. Bl: "Blur",
  799. PO: "PageOpen",
  800. PC: "PageClose",
  801. PV: "PageVisible",
  802. PI: "PageInvisible",
  803. K: "Keystroke",
  804. F: "Format",
  805. V: "Validate",
  806. C: "Calculate"
  807. };
  808. exports.AnnotationActionEventType = AnnotationActionEventType;
  809. const DocumentActionEventType = {
  810. WC: "WillClose",
  811. WS: "WillSave",
  812. DS: "DidSave",
  813. WP: "WillPrint",
  814. DP: "DidPrint"
  815. };
  816. exports.DocumentActionEventType = DocumentActionEventType;
  817. const PageActionEventType = {
  818. O: "PageOpen",
  819. C: "PageClose"
  820. };
  821. exports.PageActionEventType = PageActionEventType;
  822. const StreamType = {
  823. UNKNOWN: "UNKNOWN",
  824. FLATE: "FLATE",
  825. LZW: "LZW",
  826. DCT: "DCT",
  827. JPX: "JPX",
  828. JBIG: "JBIG",
  829. A85: "A85",
  830. AHX: "AHX",
  831. CCF: "CCF",
  832. RLX: "RLX"
  833. };
  834. exports.StreamType = StreamType;
  835. const FontType = {
  836. UNKNOWN: "UNKNOWN",
  837. TYPE1: "TYPE1",
  838. TYPE1STANDARD: "TYPE1STANDARD",
  839. TYPE1C: "TYPE1C",
  840. CIDFONTTYPE0: "CIDFONTTYPE0",
  841. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  842. TRUETYPE: "TRUETYPE",
  843. CIDFONTTYPE2: "CIDFONTTYPE2",
  844. TYPE3: "TYPE3",
  845. OPENTYPE: "OPENTYPE",
  846. TYPE0: "TYPE0",
  847. MMTYPE1: "MMTYPE1"
  848. };
  849. exports.FontType = FontType;
  850. const VerbosityLevel = {
  851. ERRORS: 0,
  852. WARNINGS: 1,
  853. INFOS: 5
  854. };
  855. exports.VerbosityLevel = VerbosityLevel;
  856. const CMapCompressionType = {
  857. NONE: 0,
  858. BINARY: 1,
  859. STREAM: 2
  860. };
  861. exports.CMapCompressionType = CMapCompressionType;
  862. const OPS = {
  863. dependency: 1,
  864. setLineWidth: 2,
  865. setLineCap: 3,
  866. setLineJoin: 4,
  867. setMiterLimit: 5,
  868. setDash: 6,
  869. setRenderingIntent: 7,
  870. setFlatness: 8,
  871. setGState: 9,
  872. save: 10,
  873. restore: 11,
  874. transform: 12,
  875. moveTo: 13,
  876. lineTo: 14,
  877. curveTo: 15,
  878. curveTo2: 16,
  879. curveTo3: 17,
  880. closePath: 18,
  881. rectangle: 19,
  882. stroke: 20,
  883. closeStroke: 21,
  884. fill: 22,
  885. eoFill: 23,
  886. fillStroke: 24,
  887. eoFillStroke: 25,
  888. closeFillStroke: 26,
  889. closeEOFillStroke: 27,
  890. endPath: 28,
  891. clip: 29,
  892. eoClip: 30,
  893. beginText: 31,
  894. endText: 32,
  895. setCharSpacing: 33,
  896. setWordSpacing: 34,
  897. setHScale: 35,
  898. setLeading: 36,
  899. setFont: 37,
  900. setTextRenderingMode: 38,
  901. setTextRise: 39,
  902. moveText: 40,
  903. setLeadingMoveText: 41,
  904. setTextMatrix: 42,
  905. nextLine: 43,
  906. showText: 44,
  907. showSpacedText: 45,
  908. nextLineShowText: 46,
  909. nextLineSetSpacingShowText: 47,
  910. setCharWidth: 48,
  911. setCharWidthAndBounds: 49,
  912. setStrokeColorSpace: 50,
  913. setFillColorSpace: 51,
  914. setStrokeColor: 52,
  915. setStrokeColorN: 53,
  916. setFillColor: 54,
  917. setFillColorN: 55,
  918. setStrokeGray: 56,
  919. setFillGray: 57,
  920. setStrokeRGBColor: 58,
  921. setFillRGBColor: 59,
  922. setStrokeCMYKColor: 60,
  923. setFillCMYKColor: 61,
  924. shadingFill: 62,
  925. beginInlineImage: 63,
  926. beginImageData: 64,
  927. endInlineImage: 65,
  928. paintXObject: 66,
  929. markPoint: 67,
  930. markPointProps: 68,
  931. beginMarkedContent: 69,
  932. beginMarkedContentProps: 70,
  933. endMarkedContent: 71,
  934. beginCompat: 72,
  935. endCompat: 73,
  936. paintFormXObjectBegin: 74,
  937. paintFormXObjectEnd: 75,
  938. beginGroup: 76,
  939. endGroup: 77,
  940. beginAnnotations: 78,
  941. endAnnotations: 79,
  942. beginAnnotation: 80,
  943. endAnnotation: 81,
  944. paintJpegXObject: 82,
  945. paintImageMaskXObject: 83,
  946. paintImageMaskXObjectGroup: 84,
  947. paintImageXObject: 85,
  948. paintInlineImageXObject: 86,
  949. paintInlineImageXObjectGroup: 87,
  950. paintImageXObjectRepeat: 88,
  951. paintImageMaskXObjectRepeat: 89,
  952. paintSolidColorImageMask: 90,
  953. constructPath: 91
  954. };
  955. exports.OPS = OPS;
  956. const UNSUPPORTED_FEATURES = {
  957. unknown: "unknown",
  958. forms: "forms",
  959. javaScript: "javaScript",
  960. signatures: "signatures",
  961. smask: "smask",
  962. shadingPattern: "shadingPattern",
  963. font: "font",
  964. errorTilingPattern: "errorTilingPattern",
  965. errorExtGState: "errorExtGState",
  966. errorXObject: "errorXObject",
  967. errorFontLoadType3: "errorFontLoadType3",
  968. errorFontState: "errorFontState",
  969. errorFontMissing: "errorFontMissing",
  970. errorFontTranslate: "errorFontTranslate",
  971. errorColorSpace: "errorColorSpace",
  972. errorOperatorList: "errorOperatorList",
  973. errorFontToUnicode: "errorFontToUnicode",
  974. errorFontLoadNative: "errorFontLoadNative",
  975. errorFontBuildPath: "errorFontBuildPath",
  976. errorFontGetPath: "errorFontGetPath",
  977. errorMarkedContent: "errorMarkedContent",
  978. errorContentSubStream: "errorContentSubStream"
  979. };
  980. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  981. const PasswordResponses = {
  982. NEED_PASSWORD: 1,
  983. INCORRECT_PASSWORD: 2
  984. };
  985. exports.PasswordResponses = PasswordResponses;
  986. let verbosity = VerbosityLevel.WARNINGS;
  987. function setVerbosityLevel(level) {
  988. if (Number.isInteger(level)) {
  989. verbosity = level;
  990. }
  991. }
  992. function getVerbosityLevel() {
  993. return verbosity;
  994. }
  995. function info(msg) {
  996. if (verbosity >= VerbosityLevel.INFOS) {
  997. console.log(`Info: ${msg}`);
  998. }
  999. }
  1000. function warn(msg) {
  1001. if (verbosity >= VerbosityLevel.WARNINGS) {
  1002. console.log(`Warning: ${msg}`);
  1003. }
  1004. }
  1005. function unreachable(msg) {
  1006. throw new Error(msg);
  1007. }
  1008. function assert(cond, msg) {
  1009. if (!cond) {
  1010. unreachable(msg);
  1011. }
  1012. }
  1013. function isSameOrigin(baseUrl, otherUrl) {
  1014. let base;
  1015. try {
  1016. base = new URL(baseUrl);
  1017. if (!base.origin || base.origin === "null") {
  1018. return false;
  1019. }
  1020. } catch (e) {
  1021. return false;
  1022. }
  1023. const other = new URL(otherUrl, base);
  1024. return base.origin === other.origin;
  1025. }
  1026. function _isValidProtocol(url) {
  1027. if (!url) {
  1028. return false;
  1029. }
  1030. switch (url.protocol) {
  1031. case "http:":
  1032. case "https:":
  1033. case "ftp:":
  1034. case "mailto:":
  1035. case "tel:":
  1036. return true;
  1037. default:
  1038. return false;
  1039. }
  1040. }
  1041. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1042. if (!url) {
  1043. return null;
  1044. }
  1045. try {
  1046. if (options && typeof url === "string") {
  1047. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1048. const dots = url.match(/\./g);
  1049. if (dots && dots.length >= 2) {
  1050. url = `http://${url}`;
  1051. }
  1052. }
  1053. if (options.tryConvertEncoding) {
  1054. try {
  1055. url = stringToUTF8String(url);
  1056. } catch (ex) {}
  1057. }
  1058. }
  1059. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1060. if (_isValidProtocol(absoluteUrl)) {
  1061. return absoluteUrl;
  1062. }
  1063. } catch (ex) {}
  1064. return null;
  1065. }
  1066. function shadow(obj, prop, value) {
  1067. Object.defineProperty(obj, prop, {
  1068. value,
  1069. enumerable: true,
  1070. configurable: true,
  1071. writable: false
  1072. });
  1073. return value;
  1074. }
  1075. const BaseException = function BaseExceptionClosure() {
  1076. function BaseException(message, name) {
  1077. if (this.constructor === BaseException) {
  1078. unreachable("Cannot initialize BaseException.");
  1079. }
  1080. this.message = message;
  1081. this.name = name;
  1082. }
  1083. BaseException.prototype = new Error();
  1084. BaseException.constructor = BaseException;
  1085. return BaseException;
  1086. }();
  1087. exports.BaseException = BaseException;
  1088. class PasswordException extends BaseException {
  1089. constructor(msg, code) {
  1090. super(msg, "PasswordException");
  1091. this.code = code;
  1092. }
  1093. }
  1094. exports.PasswordException = PasswordException;
  1095. class UnknownErrorException extends BaseException {
  1096. constructor(msg, details) {
  1097. super(msg, "UnknownErrorException");
  1098. this.details = details;
  1099. }
  1100. }
  1101. exports.UnknownErrorException = UnknownErrorException;
  1102. class InvalidPDFException extends BaseException {
  1103. constructor(msg) {
  1104. super(msg, "InvalidPDFException");
  1105. }
  1106. }
  1107. exports.InvalidPDFException = InvalidPDFException;
  1108. class MissingPDFException extends BaseException {
  1109. constructor(msg) {
  1110. super(msg, "MissingPDFException");
  1111. }
  1112. }
  1113. exports.MissingPDFException = MissingPDFException;
  1114. class UnexpectedResponseException extends BaseException {
  1115. constructor(msg, status) {
  1116. super(msg, "UnexpectedResponseException");
  1117. this.status = status;
  1118. }
  1119. }
  1120. exports.UnexpectedResponseException = UnexpectedResponseException;
  1121. class FormatError extends BaseException {
  1122. constructor(msg) {
  1123. super(msg, "FormatError");
  1124. }
  1125. }
  1126. exports.FormatError = FormatError;
  1127. class AbortException extends BaseException {
  1128. constructor(msg) {
  1129. super(msg, "AbortException");
  1130. }
  1131. }
  1132. exports.AbortException = AbortException;
  1133. function bytesToString(bytes) {
  1134. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1135. unreachable("Invalid argument for bytesToString");
  1136. }
  1137. const length = bytes.length;
  1138. const MAX_ARGUMENT_COUNT = 8192;
  1139. if (length < MAX_ARGUMENT_COUNT) {
  1140. return String.fromCharCode.apply(null, bytes);
  1141. }
  1142. const strBuf = [];
  1143. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1144. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1145. const chunk = bytes.subarray(i, chunkEnd);
  1146. strBuf.push(String.fromCharCode.apply(null, chunk));
  1147. }
  1148. return strBuf.join("");
  1149. }
  1150. function stringToBytes(str) {
  1151. if (typeof str !== "string") {
  1152. unreachable("Invalid argument for stringToBytes");
  1153. }
  1154. const length = str.length;
  1155. const bytes = new Uint8Array(length);
  1156. for (let i = 0; i < length; ++i) {
  1157. bytes[i] = str.charCodeAt(i) & 0xff;
  1158. }
  1159. return bytes;
  1160. }
  1161. function arrayByteLength(arr) {
  1162. if (arr.length !== undefined) {
  1163. return arr.length;
  1164. }
  1165. if (arr.byteLength !== undefined) {
  1166. return arr.byteLength;
  1167. }
  1168. unreachable("Invalid argument for arrayByteLength");
  1169. }
  1170. function arraysToBytes(arr) {
  1171. const length = arr.length;
  1172. if (length === 1 && arr[0] instanceof Uint8Array) {
  1173. return arr[0];
  1174. }
  1175. let resultLength = 0;
  1176. for (let i = 0; i < length; i++) {
  1177. resultLength += arrayByteLength(arr[i]);
  1178. }
  1179. let pos = 0;
  1180. const data = new Uint8Array(resultLength);
  1181. for (let i = 0; i < length; i++) {
  1182. let item = arr[i];
  1183. if (!(item instanceof Uint8Array)) {
  1184. if (typeof item === "string") {
  1185. item = stringToBytes(item);
  1186. } else {
  1187. item = new Uint8Array(item);
  1188. }
  1189. }
  1190. const itemLength = item.byteLength;
  1191. data.set(item, pos);
  1192. pos += itemLength;
  1193. }
  1194. return data;
  1195. }
  1196. function string32(value) {
  1197. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1198. }
  1199. function objectSize(obj) {
  1200. return Object.keys(obj).length;
  1201. }
  1202. function objectFromMap(map) {
  1203. const obj = Object.create(null);
  1204. for (const [key, value] of map) {
  1205. obj[key] = value;
  1206. }
  1207. return obj;
  1208. }
  1209. function isLittleEndian() {
  1210. const buffer8 = new Uint8Array(4);
  1211. buffer8[0] = 1;
  1212. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1213. return view32[0] === 1;
  1214. }
  1215. const IsLittleEndianCached = {
  1216. get value() {
  1217. return shadow(this, "value", isLittleEndian());
  1218. }
  1219. };
  1220. exports.IsLittleEndianCached = IsLittleEndianCached;
  1221. function isEvalSupported() {
  1222. try {
  1223. new Function("");
  1224. return true;
  1225. } catch (e) {
  1226. return false;
  1227. }
  1228. }
  1229. const IsEvalSupportedCached = {
  1230. get value() {
  1231. return shadow(this, "value", isEvalSupported());
  1232. }
  1233. };
  1234. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1235. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1236. class Util {
  1237. static makeHexColor(r, g, b) {
  1238. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1239. }
  1240. static transform(m1, m2) {
  1241. 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]];
  1242. }
  1243. static applyTransform(p, m) {
  1244. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1245. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1246. return [xt, yt];
  1247. }
  1248. static applyInverseTransform(p, m) {
  1249. const d = m[0] * m[3] - m[1] * m[2];
  1250. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1251. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1252. return [xt, yt];
  1253. }
  1254. static getAxialAlignedBoundingBox(r, m) {
  1255. const p1 = Util.applyTransform(r, m);
  1256. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1257. const p3 = Util.applyTransform([r[0], r[3]], m);
  1258. const p4 = Util.applyTransform([r[2], r[1]], m);
  1259. 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])];
  1260. }
  1261. static inverseTransform(m) {
  1262. const d = m[0] * m[3] - m[1] * m[2];
  1263. 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];
  1264. }
  1265. static apply3dTransform(m, v) {
  1266. 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]];
  1267. }
  1268. static singularValueDecompose2dScale(m) {
  1269. const transpose = [m[0], m[2], m[1], m[3]];
  1270. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1271. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1272. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1273. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1274. const first = (a + d) / 2;
  1275. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1276. const sx = first + second || 1;
  1277. const sy = first - second || 1;
  1278. return [Math.sqrt(sx), Math.sqrt(sy)];
  1279. }
  1280. static normalizeRect(rect) {
  1281. const r = rect.slice(0);
  1282. if (rect[0] > rect[2]) {
  1283. r[0] = rect[2];
  1284. r[2] = rect[0];
  1285. }
  1286. if (rect[1] > rect[3]) {
  1287. r[1] = rect[3];
  1288. r[3] = rect[1];
  1289. }
  1290. return r;
  1291. }
  1292. static intersect(rect1, rect2) {
  1293. function compare(a, b) {
  1294. return a - b;
  1295. }
  1296. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1297. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1298. const result = [];
  1299. rect1 = Util.normalizeRect(rect1);
  1300. rect2 = Util.normalizeRect(rect2);
  1301. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1302. result[0] = orderedX[1];
  1303. result[2] = orderedX[2];
  1304. } else {
  1305. return null;
  1306. }
  1307. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1308. result[1] = orderedY[1];
  1309. result[3] = orderedY[2];
  1310. } else {
  1311. return null;
  1312. }
  1313. return result;
  1314. }
  1315. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1316. const tvalues = [],
  1317. bounds = [[], []];
  1318. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1319. for (let i = 0; i < 2; ++i) {
  1320. if (i === 0) {
  1321. b = 6 * x0 - 12 * x1 + 6 * x2;
  1322. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1323. c = 3 * x1 - 3 * x0;
  1324. } else {
  1325. b = 6 * y0 - 12 * y1 + 6 * y2;
  1326. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1327. c = 3 * y1 - 3 * y0;
  1328. }
  1329. if (Math.abs(a) < 1e-12) {
  1330. if (Math.abs(b) < 1e-12) {
  1331. continue;
  1332. }
  1333. t = -c / b;
  1334. if (0 < t && t < 1) {
  1335. tvalues.push(t);
  1336. }
  1337. continue;
  1338. }
  1339. b2ac = b * b - 4 * c * a;
  1340. sqrtb2ac = Math.sqrt(b2ac);
  1341. if (b2ac < 0) {
  1342. continue;
  1343. }
  1344. t1 = (-b + sqrtb2ac) / (2 * a);
  1345. if (0 < t1 && t1 < 1) {
  1346. tvalues.push(t1);
  1347. }
  1348. t2 = (-b - sqrtb2ac) / (2 * a);
  1349. if (0 < t2 && t2 < 1) {
  1350. tvalues.push(t2);
  1351. }
  1352. }
  1353. let j = tvalues.length,
  1354. mt;
  1355. const jlen = j;
  1356. while (j--) {
  1357. t = tvalues[j];
  1358. mt = 1 - t;
  1359. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1360. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1361. }
  1362. bounds[0][jlen] = x0;
  1363. bounds[1][jlen] = y0;
  1364. bounds[0][jlen + 1] = x3;
  1365. bounds[1][jlen + 1] = y3;
  1366. bounds[0].length = bounds[1].length = jlen + 2;
  1367. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1368. }
  1369. }
  1370. exports.Util = Util;
  1371. 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];
  1372. function stringToPDFString(str) {
  1373. if (str[0] >= "\xEF") {
  1374. let encoding;
  1375. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1376. encoding = "utf-16be";
  1377. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1378. encoding = "utf-16le";
  1379. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1380. encoding = "utf-8";
  1381. }
  1382. if (encoding) {
  1383. try {
  1384. const decoder = new TextDecoder(encoding, {
  1385. fatal: true
  1386. });
  1387. const buffer = stringToBytes(str);
  1388. return decoder.decode(buffer);
  1389. } catch (ex) {
  1390. warn(`stringToPDFString: "${ex}".`);
  1391. }
  1392. }
  1393. }
  1394. const strBuf = [];
  1395. for (let i = 0, ii = str.length; i < ii; i++) {
  1396. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1397. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1398. }
  1399. return strBuf.join("");
  1400. }
  1401. function escapeString(str) {
  1402. return str.replace(/([()\\\n\r])/g, match => {
  1403. if (match === "\n") {
  1404. return "\\n";
  1405. } else if (match === "\r") {
  1406. return "\\r";
  1407. }
  1408. return `\\${match}`;
  1409. });
  1410. }
  1411. function isAscii(str) {
  1412. return /^[\x00-\x7F]*$/.test(str);
  1413. }
  1414. function stringToUTF16BEString(str) {
  1415. const buf = ["\xFE\xFF"];
  1416. for (let i = 0, ii = str.length; i < ii; i++) {
  1417. const char = str.charCodeAt(i);
  1418. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1419. }
  1420. return buf.join("");
  1421. }
  1422. function stringToUTF8String(str) {
  1423. return decodeURIComponent(escape(str));
  1424. }
  1425. function utf8StringToString(str) {
  1426. return unescape(encodeURIComponent(str));
  1427. }
  1428. function isArrayBuffer(v) {
  1429. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1430. }
  1431. function isArrayEqual(arr1, arr2) {
  1432. if (arr1.length !== arr2.length) {
  1433. return false;
  1434. }
  1435. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1436. if (arr1[i] !== arr2[i]) {
  1437. return false;
  1438. }
  1439. }
  1440. return true;
  1441. }
  1442. function getModificationDate(date = new Date()) {
  1443. 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")];
  1444. return buffer.join("");
  1445. }
  1446. function createPromiseCapability() {
  1447. const capability = Object.create(null);
  1448. let isSettled = false;
  1449. Object.defineProperty(capability, "settled", {
  1450. get() {
  1451. return isSettled;
  1452. }
  1453. });
  1454. capability.promise = new Promise(function (resolve, reject) {
  1455. capability.resolve = function (data) {
  1456. isSettled = true;
  1457. resolve(data);
  1458. };
  1459. capability.reject = function (reason) {
  1460. isSettled = true;
  1461. reject(reason);
  1462. };
  1463. });
  1464. return capability;
  1465. }
  1466. /***/ }),
  1467. /* 3 */
  1468. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1469. var _is_node = __w_pdfjs_require__(4);
  1470. ;
  1471. /***/ }),
  1472. /* 4 */
  1473. /***/ ((__unused_webpack_module, exports) => {
  1474. Object.defineProperty(exports, "__esModule", ({
  1475. value: true
  1476. }));
  1477. exports.isNodeJS = void 0;
  1478. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1479. exports.isNodeJS = isNodeJS;
  1480. /***/ }),
  1481. /* 5 */
  1482. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1483. Object.defineProperty(exports, "__esModule", ({
  1484. value: true
  1485. }));
  1486. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1487. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1488. exports.isCmd = isCmd;
  1489. exports.isDict = isDict;
  1490. exports.isName = isName;
  1491. exports.isRefsEqual = isRefsEqual;
  1492. var _util = __w_pdfjs_require__(2);
  1493. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1494. exports.CIRCULAR_REF = CIRCULAR_REF;
  1495. const EOF = Symbol("EOF");
  1496. exports.EOF = EOF;
  1497. const Name = function NameClosure() {
  1498. let nameCache = Object.create(null);
  1499. class Name {
  1500. constructor(name) {
  1501. this.name = name;
  1502. }
  1503. static get(name) {
  1504. const nameValue = nameCache[name];
  1505. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1506. }
  1507. static _clearCache() {
  1508. nameCache = Object.create(null);
  1509. }
  1510. }
  1511. return Name;
  1512. }();
  1513. exports.Name = Name;
  1514. const Cmd = function CmdClosure() {
  1515. let cmdCache = Object.create(null);
  1516. class Cmd {
  1517. constructor(cmd) {
  1518. this.cmd = cmd;
  1519. }
  1520. static get(cmd) {
  1521. const cmdValue = cmdCache[cmd];
  1522. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1523. }
  1524. static _clearCache() {
  1525. cmdCache = Object.create(null);
  1526. }
  1527. }
  1528. return Cmd;
  1529. }();
  1530. exports.Cmd = Cmd;
  1531. const nonSerializable = function nonSerializableClosure() {
  1532. return nonSerializable;
  1533. };
  1534. class Dict {
  1535. constructor(xref = null) {
  1536. this._map = Object.create(null);
  1537. this.xref = xref;
  1538. this.objId = null;
  1539. this.suppressEncryption = false;
  1540. this.__nonSerializable__ = nonSerializable;
  1541. }
  1542. assignXref(newXref) {
  1543. this.xref = newXref;
  1544. }
  1545. get size() {
  1546. return Object.keys(this._map).length;
  1547. }
  1548. get(key1, key2, key3) {
  1549. let value = this._map[key1];
  1550. if (value === undefined && key2 !== undefined) {
  1551. value = this._map[key2];
  1552. if (value === undefined && key3 !== undefined) {
  1553. value = this._map[key3];
  1554. }
  1555. }
  1556. if (value instanceof Ref && this.xref) {
  1557. return this.xref.fetch(value, this.suppressEncryption);
  1558. }
  1559. return value;
  1560. }
  1561. async getAsync(key1, key2, key3) {
  1562. let value = this._map[key1];
  1563. if (value === undefined && key2 !== undefined) {
  1564. value = this._map[key2];
  1565. if (value === undefined && key3 !== undefined) {
  1566. value = this._map[key3];
  1567. }
  1568. }
  1569. if (value instanceof Ref && this.xref) {
  1570. return this.xref.fetchAsync(value, this.suppressEncryption);
  1571. }
  1572. return value;
  1573. }
  1574. getArray(key1, key2, key3) {
  1575. let value = this._map[key1];
  1576. if (value === undefined && key2 !== undefined) {
  1577. value = this._map[key2];
  1578. if (value === undefined && key3 !== undefined) {
  1579. value = this._map[key3];
  1580. }
  1581. }
  1582. if (value instanceof Ref && this.xref) {
  1583. value = this.xref.fetch(value, this.suppressEncryption);
  1584. }
  1585. if (Array.isArray(value)) {
  1586. value = value.slice();
  1587. for (let i = 0, ii = value.length; i < ii; i++) {
  1588. if (value[i] instanceof Ref && this.xref) {
  1589. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1590. }
  1591. }
  1592. }
  1593. return value;
  1594. }
  1595. getRaw(key) {
  1596. return this._map[key];
  1597. }
  1598. getKeys() {
  1599. return Object.keys(this._map);
  1600. }
  1601. getRawValues() {
  1602. return Object.values(this._map);
  1603. }
  1604. set(key, value) {
  1605. this._map[key] = value;
  1606. }
  1607. has(key) {
  1608. return this._map[key] !== undefined;
  1609. }
  1610. forEach(callback) {
  1611. for (const key in this._map) {
  1612. callback(key, this.get(key));
  1613. }
  1614. }
  1615. static get empty() {
  1616. const emptyDict = new Dict(null);
  1617. emptyDict.set = (key, value) => {
  1618. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1619. };
  1620. return (0, _util.shadow)(this, "empty", emptyDict);
  1621. }
  1622. static merge({
  1623. xref,
  1624. dictArray,
  1625. mergeSubDicts = false
  1626. }) {
  1627. const mergedDict = new Dict(xref),
  1628. properties = new Map();
  1629. for (const dict of dictArray) {
  1630. if (!(dict instanceof Dict)) {
  1631. continue;
  1632. }
  1633. for (const [key, value] of Object.entries(dict._map)) {
  1634. let property = properties.get(key);
  1635. if (property === undefined) {
  1636. property = [];
  1637. properties.set(key, property);
  1638. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1639. continue;
  1640. }
  1641. property.push(value);
  1642. }
  1643. }
  1644. for (const [name, values] of properties) {
  1645. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1646. mergedDict._map[name] = values[0];
  1647. continue;
  1648. }
  1649. const subDict = new Dict(xref);
  1650. for (const dict of values) {
  1651. for (const [key, value] of Object.entries(dict._map)) {
  1652. if (subDict._map[key] === undefined) {
  1653. subDict._map[key] = value;
  1654. }
  1655. }
  1656. }
  1657. if (subDict.size > 0) {
  1658. mergedDict._map[name] = subDict;
  1659. }
  1660. }
  1661. properties.clear();
  1662. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1663. }
  1664. }
  1665. exports.Dict = Dict;
  1666. const Ref = function RefClosure() {
  1667. let refCache = Object.create(null);
  1668. class Ref {
  1669. constructor(num, gen) {
  1670. this.num = num;
  1671. this.gen = gen;
  1672. }
  1673. toString() {
  1674. if (this.gen === 0) {
  1675. return `${this.num}R`;
  1676. }
  1677. return `${this.num}R${this.gen}`;
  1678. }
  1679. static get(num, gen) {
  1680. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1681. const refValue = refCache[key];
  1682. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1683. }
  1684. static _clearCache() {
  1685. refCache = Object.create(null);
  1686. }
  1687. }
  1688. return Ref;
  1689. }();
  1690. exports.Ref = Ref;
  1691. class RefSet {
  1692. constructor(parent = null) {
  1693. this._set = new Set(parent && parent._set);
  1694. }
  1695. has(ref) {
  1696. return this._set.has(ref.toString());
  1697. }
  1698. put(ref) {
  1699. this._set.add(ref.toString());
  1700. }
  1701. remove(ref) {
  1702. this._set.delete(ref.toString());
  1703. }
  1704. forEach(callback) {
  1705. for (const ref of this._set.values()) {
  1706. callback(ref);
  1707. }
  1708. }
  1709. clear() {
  1710. this._set.clear();
  1711. }
  1712. }
  1713. exports.RefSet = RefSet;
  1714. class RefSetCache {
  1715. constructor() {
  1716. this._map = new Map();
  1717. }
  1718. get size() {
  1719. return this._map.size;
  1720. }
  1721. get(ref) {
  1722. return this._map.get(ref.toString());
  1723. }
  1724. has(ref) {
  1725. return this._map.has(ref.toString());
  1726. }
  1727. put(ref, obj) {
  1728. this._map.set(ref.toString(), obj);
  1729. }
  1730. putAlias(ref, aliasRef) {
  1731. this._map.set(ref.toString(), this.get(aliasRef));
  1732. }
  1733. forEach(callback) {
  1734. for (const value of this._map.values()) {
  1735. callback(value);
  1736. }
  1737. }
  1738. clear() {
  1739. this._map.clear();
  1740. }
  1741. }
  1742. exports.RefSetCache = RefSetCache;
  1743. function isName(v, name) {
  1744. return v instanceof Name && (name === undefined || v.name === name);
  1745. }
  1746. function isCmd(v, cmd) {
  1747. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1748. }
  1749. function isDict(v, type) {
  1750. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1751. }
  1752. function isRefsEqual(v1, v2) {
  1753. return v1.num === v2.num && v1.gen === v2.gen;
  1754. }
  1755. function clearPrimitiveCaches() {
  1756. Cmd._clearCache();
  1757. Name._clearCache();
  1758. Ref._clearCache();
  1759. }
  1760. /***/ }),
  1761. /* 6 */
  1762. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1763. Object.defineProperty(exports, "__esModule", ({
  1764. value: true
  1765. }));
  1766. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1767. var _util = __w_pdfjs_require__(2);
  1768. var _chunked_stream = __w_pdfjs_require__(7);
  1769. var _core_utils = __w_pdfjs_require__(8);
  1770. var _document = __w_pdfjs_require__(11);
  1771. var _stream = __w_pdfjs_require__(10);
  1772. function parseDocBaseUrl(url) {
  1773. if (url) {
  1774. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1775. if (absoluteUrl) {
  1776. return absoluteUrl.href;
  1777. }
  1778. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1779. }
  1780. return null;
  1781. }
  1782. class BasePdfManager {
  1783. constructor() {
  1784. if (this.constructor === BasePdfManager) {
  1785. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1786. }
  1787. }
  1788. get docId() {
  1789. return this._docId;
  1790. }
  1791. get password() {
  1792. return this._password;
  1793. }
  1794. get docBaseUrl() {
  1795. return this._docBaseUrl;
  1796. }
  1797. onLoadedStream() {
  1798. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1799. }
  1800. ensureDoc(prop, args) {
  1801. return this.ensure(this.pdfDocument, prop, args);
  1802. }
  1803. ensureXRef(prop, args) {
  1804. return this.ensure(this.pdfDocument.xref, prop, args);
  1805. }
  1806. ensureCatalog(prop, args) {
  1807. return this.ensure(this.pdfDocument.catalog, prop, args);
  1808. }
  1809. getPage(pageIndex) {
  1810. return this.pdfDocument.getPage(pageIndex);
  1811. }
  1812. fontFallback(id, handler) {
  1813. return this.pdfDocument.fontFallback(id, handler);
  1814. }
  1815. loadXfaFonts(handler, task) {
  1816. return this.pdfDocument.loadXfaFonts(handler, task);
  1817. }
  1818. loadXfaImages() {
  1819. return this.pdfDocument.loadXfaImages();
  1820. }
  1821. serializeXfaData(annotationStorage) {
  1822. return this.pdfDocument.serializeXfaData(annotationStorage);
  1823. }
  1824. cleanup(manuallyTriggered = false) {
  1825. return this.pdfDocument.cleanup(manuallyTriggered);
  1826. }
  1827. async ensure(obj, prop, args) {
  1828. (0, _util.unreachable)("Abstract method `ensure` called");
  1829. }
  1830. requestRange(begin, end) {
  1831. (0, _util.unreachable)("Abstract method `requestRange` called");
  1832. }
  1833. requestLoadedStream() {
  1834. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1835. }
  1836. sendProgressiveData(chunk) {
  1837. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1838. }
  1839. updatePassword(password) {
  1840. this._password = password;
  1841. }
  1842. terminate(reason) {
  1843. (0, _util.unreachable)("Abstract method `terminate` called");
  1844. }
  1845. }
  1846. class LocalPdfManager extends BasePdfManager {
  1847. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  1848. super();
  1849. this._docId = docId;
  1850. this._password = password;
  1851. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1852. this.msgHandler = msgHandler;
  1853. this.evaluatorOptions = evaluatorOptions;
  1854. this.enableXfa = enableXfa;
  1855. const stream = new _stream.Stream(data);
  1856. this.pdfDocument = new _document.PDFDocument(this, stream);
  1857. this._loadedStreamPromise = Promise.resolve(stream);
  1858. }
  1859. async ensure(obj, prop, args) {
  1860. const value = obj[prop];
  1861. if (typeof value === "function") {
  1862. return value.apply(obj, args);
  1863. }
  1864. return value;
  1865. }
  1866. requestRange(begin, end) {
  1867. return Promise.resolve();
  1868. }
  1869. requestLoadedStream() {}
  1870. onLoadedStream() {
  1871. return this._loadedStreamPromise;
  1872. }
  1873. terminate(reason) {}
  1874. }
  1875. exports.LocalPdfManager = LocalPdfManager;
  1876. class NetworkPdfManager extends BasePdfManager {
  1877. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1878. super();
  1879. this._docId = docId;
  1880. this._password = args.password;
  1881. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1882. this.msgHandler = args.msgHandler;
  1883. this.evaluatorOptions = evaluatorOptions;
  1884. this.enableXfa = enableXfa;
  1885. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1886. msgHandler: args.msgHandler,
  1887. length: args.length,
  1888. disableAutoFetch: args.disableAutoFetch,
  1889. rangeChunkSize: args.rangeChunkSize
  1890. });
  1891. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1892. }
  1893. async ensure(obj, prop, args) {
  1894. try {
  1895. const value = obj[prop];
  1896. if (typeof value === "function") {
  1897. return value.apply(obj, args);
  1898. }
  1899. return value;
  1900. } catch (ex) {
  1901. if (!(ex instanceof _core_utils.MissingDataException)) {
  1902. throw ex;
  1903. }
  1904. await this.requestRange(ex.begin, ex.end);
  1905. return this.ensure(obj, prop, args);
  1906. }
  1907. }
  1908. requestRange(begin, end) {
  1909. return this.streamManager.requestRange(begin, end);
  1910. }
  1911. requestLoadedStream() {
  1912. this.streamManager.requestAllChunks();
  1913. }
  1914. sendProgressiveData(chunk) {
  1915. this.streamManager.onReceiveData({
  1916. chunk
  1917. });
  1918. }
  1919. onLoadedStream() {
  1920. return this.streamManager.onLoadedStream();
  1921. }
  1922. terminate(reason) {
  1923. this.streamManager.abort(reason);
  1924. }
  1925. }
  1926. exports.NetworkPdfManager = NetworkPdfManager;
  1927. /***/ }),
  1928. /* 7 */
  1929. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1930. Object.defineProperty(exports, "__esModule", ({
  1931. value: true
  1932. }));
  1933. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1934. var _util = __w_pdfjs_require__(2);
  1935. var _core_utils = __w_pdfjs_require__(8);
  1936. var _stream = __w_pdfjs_require__(10);
  1937. class ChunkedStream extends _stream.Stream {
  1938. constructor(length, chunkSize, manager) {
  1939. super(new Uint8Array(length), 0, length, null);
  1940. this.chunkSize = chunkSize;
  1941. this._loadedChunks = new Set();
  1942. this.numChunks = Math.ceil(length / chunkSize);
  1943. this.manager = manager;
  1944. this.progressiveDataLength = 0;
  1945. this.lastSuccessfulEnsureByteChunk = -1;
  1946. }
  1947. getMissingChunks() {
  1948. const chunks = [];
  1949. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1950. if (!this._loadedChunks.has(chunk)) {
  1951. chunks.push(chunk);
  1952. }
  1953. }
  1954. return chunks;
  1955. }
  1956. get numChunksLoaded() {
  1957. return this._loadedChunks.size;
  1958. }
  1959. get isDataLoaded() {
  1960. return this.numChunksLoaded === this.numChunks;
  1961. }
  1962. onReceiveData(begin, chunk) {
  1963. const chunkSize = this.chunkSize;
  1964. if (begin % chunkSize !== 0) {
  1965. throw new Error(`Bad begin offset: ${begin}`);
  1966. }
  1967. const end = begin + chunk.byteLength;
  1968. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1969. throw new Error(`Bad end offset: ${end}`);
  1970. }
  1971. this.bytes.set(new Uint8Array(chunk), begin);
  1972. const beginChunk = Math.floor(begin / chunkSize);
  1973. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1974. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1975. this._loadedChunks.add(curChunk);
  1976. }
  1977. }
  1978. onReceiveProgressiveData(data) {
  1979. let position = this.progressiveDataLength;
  1980. const beginChunk = Math.floor(position / this.chunkSize);
  1981. this.bytes.set(new Uint8Array(data), position);
  1982. position += data.byteLength;
  1983. this.progressiveDataLength = position;
  1984. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1985. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1986. this._loadedChunks.add(curChunk);
  1987. }
  1988. }
  1989. ensureByte(pos) {
  1990. if (pos < this.progressiveDataLength) {
  1991. return;
  1992. }
  1993. const chunk = Math.floor(pos / this.chunkSize);
  1994. if (chunk > this.numChunks) {
  1995. return;
  1996. }
  1997. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1998. return;
  1999. }
  2000. if (!this._loadedChunks.has(chunk)) {
  2001. throw new _core_utils.MissingDataException(pos, pos + 1);
  2002. }
  2003. this.lastSuccessfulEnsureByteChunk = chunk;
  2004. }
  2005. ensureRange(begin, end) {
  2006. if (begin >= end) {
  2007. return;
  2008. }
  2009. if (end <= this.progressiveDataLength) {
  2010. return;
  2011. }
  2012. const beginChunk = Math.floor(begin / this.chunkSize);
  2013. if (beginChunk > this.numChunks) {
  2014. return;
  2015. }
  2016. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2017. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2018. if (!this._loadedChunks.has(chunk)) {
  2019. throw new _core_utils.MissingDataException(begin, end);
  2020. }
  2021. }
  2022. }
  2023. nextEmptyChunk(beginChunk) {
  2024. const numChunks = this.numChunks;
  2025. for (let i = 0; i < numChunks; ++i) {
  2026. const chunk = (beginChunk + i) % numChunks;
  2027. if (!this._loadedChunks.has(chunk)) {
  2028. return chunk;
  2029. }
  2030. }
  2031. return null;
  2032. }
  2033. hasChunk(chunk) {
  2034. return this._loadedChunks.has(chunk);
  2035. }
  2036. getByte() {
  2037. const pos = this.pos;
  2038. if (pos >= this.end) {
  2039. return -1;
  2040. }
  2041. if (pos >= this.progressiveDataLength) {
  2042. this.ensureByte(pos);
  2043. }
  2044. return this.bytes[this.pos++];
  2045. }
  2046. getBytes(length, forceClamped = false) {
  2047. const bytes = this.bytes;
  2048. const pos = this.pos;
  2049. const strEnd = this.end;
  2050. if (!length) {
  2051. if (strEnd > this.progressiveDataLength) {
  2052. this.ensureRange(pos, strEnd);
  2053. }
  2054. const subarray = bytes.subarray(pos, strEnd);
  2055. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2056. }
  2057. let end = pos + length;
  2058. if (end > strEnd) {
  2059. end = strEnd;
  2060. }
  2061. if (end > this.progressiveDataLength) {
  2062. this.ensureRange(pos, end);
  2063. }
  2064. this.pos = end;
  2065. const subarray = bytes.subarray(pos, end);
  2066. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2067. }
  2068. getByteRange(begin, end) {
  2069. if (begin < 0) {
  2070. begin = 0;
  2071. }
  2072. if (end > this.end) {
  2073. end = this.end;
  2074. }
  2075. if (end > this.progressiveDataLength) {
  2076. this.ensureRange(begin, end);
  2077. }
  2078. return this.bytes.subarray(begin, end);
  2079. }
  2080. makeSubStream(start, length, dict = null) {
  2081. if (length) {
  2082. if (start + length > this.progressiveDataLength) {
  2083. this.ensureRange(start, start + length);
  2084. }
  2085. } else {
  2086. if (start >= this.progressiveDataLength) {
  2087. this.ensureByte(start);
  2088. }
  2089. }
  2090. function ChunkedStreamSubstream() {}
  2091. ChunkedStreamSubstream.prototype = Object.create(this);
  2092. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2093. const chunkSize = this.chunkSize;
  2094. const beginChunk = Math.floor(this.start / chunkSize);
  2095. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2096. const missingChunks = [];
  2097. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2098. if (!this._loadedChunks.has(chunk)) {
  2099. missingChunks.push(chunk);
  2100. }
  2101. }
  2102. return missingChunks;
  2103. };
  2104. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2105. get() {
  2106. if (this.numChunksLoaded === this.numChunks) {
  2107. return true;
  2108. }
  2109. return this.getMissingChunks().length === 0;
  2110. },
  2111. configurable: true
  2112. });
  2113. const subStream = new ChunkedStreamSubstream();
  2114. subStream.pos = subStream.start = start;
  2115. subStream.end = start + length || this.end;
  2116. subStream.dict = dict;
  2117. return subStream;
  2118. }
  2119. getBaseStreams() {
  2120. return [this];
  2121. }
  2122. }
  2123. exports.ChunkedStream = ChunkedStream;
  2124. class ChunkedStreamManager {
  2125. constructor(pdfNetworkStream, args) {
  2126. this.length = args.length;
  2127. this.chunkSize = args.rangeChunkSize;
  2128. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2129. this.pdfNetworkStream = pdfNetworkStream;
  2130. this.disableAutoFetch = args.disableAutoFetch;
  2131. this.msgHandler = args.msgHandler;
  2132. this.currRequestId = 0;
  2133. this._chunksNeededByRequest = new Map();
  2134. this._requestsByChunk = new Map();
  2135. this._promisesByRequest = new Map();
  2136. this.progressiveDataLength = 0;
  2137. this.aborted = false;
  2138. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2139. }
  2140. onLoadedStream() {
  2141. return this._loadedStreamCapability.promise;
  2142. }
  2143. sendRequest(begin, end) {
  2144. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2145. if (!rangeReader.isStreamingSupported) {
  2146. rangeReader.onProgress = this.onProgress.bind(this);
  2147. }
  2148. let chunks = [],
  2149. loaded = 0;
  2150. return new Promise((resolve, reject) => {
  2151. const readChunk = chunk => {
  2152. try {
  2153. if (!chunk.done) {
  2154. const data = chunk.value;
  2155. chunks.push(data);
  2156. loaded += (0, _util.arrayByteLength)(data);
  2157. if (rangeReader.isStreamingSupported) {
  2158. this.onProgress({
  2159. loaded
  2160. });
  2161. }
  2162. rangeReader.read().then(readChunk, reject);
  2163. return;
  2164. }
  2165. const chunkData = (0, _util.arraysToBytes)(chunks);
  2166. chunks = null;
  2167. resolve(chunkData);
  2168. } catch (e) {
  2169. reject(e);
  2170. }
  2171. };
  2172. rangeReader.read().then(readChunk, reject);
  2173. }).then(data => {
  2174. if (this.aborted) {
  2175. return;
  2176. }
  2177. this.onReceiveData({
  2178. chunk: data,
  2179. begin
  2180. });
  2181. });
  2182. }
  2183. requestAllChunks() {
  2184. const missingChunks = this.stream.getMissingChunks();
  2185. this._requestChunks(missingChunks);
  2186. return this._loadedStreamCapability.promise;
  2187. }
  2188. _requestChunks(chunks) {
  2189. const requestId = this.currRequestId++;
  2190. const chunksNeeded = new Set();
  2191. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2192. for (const chunk of chunks) {
  2193. if (!this.stream.hasChunk(chunk)) {
  2194. chunksNeeded.add(chunk);
  2195. }
  2196. }
  2197. if (chunksNeeded.size === 0) {
  2198. return Promise.resolve();
  2199. }
  2200. const capability = (0, _util.createPromiseCapability)();
  2201. this._promisesByRequest.set(requestId, capability);
  2202. const chunksToRequest = [];
  2203. for (const chunk of chunksNeeded) {
  2204. let requestIds = this._requestsByChunk.get(chunk);
  2205. if (!requestIds) {
  2206. requestIds = [];
  2207. this._requestsByChunk.set(chunk, requestIds);
  2208. chunksToRequest.push(chunk);
  2209. }
  2210. requestIds.push(requestId);
  2211. }
  2212. if (chunksToRequest.length > 0) {
  2213. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2214. for (const groupedChunk of groupedChunksToRequest) {
  2215. const begin = groupedChunk.beginChunk * this.chunkSize;
  2216. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2217. this.sendRequest(begin, end).catch(capability.reject);
  2218. }
  2219. }
  2220. return capability.promise.catch(reason => {
  2221. if (this.aborted) {
  2222. return;
  2223. }
  2224. throw reason;
  2225. });
  2226. }
  2227. getStream() {
  2228. return this.stream;
  2229. }
  2230. requestRange(begin, end) {
  2231. end = Math.min(end, this.length);
  2232. const beginChunk = this.getBeginChunk(begin);
  2233. const endChunk = this.getEndChunk(end);
  2234. const chunks = [];
  2235. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2236. chunks.push(chunk);
  2237. }
  2238. return this._requestChunks(chunks);
  2239. }
  2240. requestRanges(ranges = []) {
  2241. const chunksToRequest = [];
  2242. for (const range of ranges) {
  2243. const beginChunk = this.getBeginChunk(range.begin);
  2244. const endChunk = this.getEndChunk(range.end);
  2245. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2246. if (!chunksToRequest.includes(chunk)) {
  2247. chunksToRequest.push(chunk);
  2248. }
  2249. }
  2250. }
  2251. chunksToRequest.sort(function (a, b) {
  2252. return a - b;
  2253. });
  2254. return this._requestChunks(chunksToRequest);
  2255. }
  2256. groupChunks(chunks) {
  2257. const groupedChunks = [];
  2258. let beginChunk = -1;
  2259. let prevChunk = -1;
  2260. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2261. const chunk = chunks[i];
  2262. if (beginChunk < 0) {
  2263. beginChunk = chunk;
  2264. }
  2265. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2266. groupedChunks.push({
  2267. beginChunk,
  2268. endChunk: prevChunk + 1
  2269. });
  2270. beginChunk = chunk;
  2271. }
  2272. if (i + 1 === chunks.length) {
  2273. groupedChunks.push({
  2274. beginChunk,
  2275. endChunk: chunk + 1
  2276. });
  2277. }
  2278. prevChunk = chunk;
  2279. }
  2280. return groupedChunks;
  2281. }
  2282. onProgress(args) {
  2283. this.msgHandler.send("DocProgress", {
  2284. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2285. total: this.length
  2286. });
  2287. }
  2288. onReceiveData(args) {
  2289. const chunk = args.chunk;
  2290. const isProgressive = args.begin === undefined;
  2291. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2292. const end = begin + chunk.byteLength;
  2293. const beginChunk = Math.floor(begin / this.chunkSize);
  2294. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2295. if (isProgressive) {
  2296. this.stream.onReceiveProgressiveData(chunk);
  2297. this.progressiveDataLength = end;
  2298. } else {
  2299. this.stream.onReceiveData(begin, chunk);
  2300. }
  2301. if (this.stream.isDataLoaded) {
  2302. this._loadedStreamCapability.resolve(this.stream);
  2303. }
  2304. const loadedRequests = [];
  2305. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2306. const requestIds = this._requestsByChunk.get(curChunk);
  2307. if (!requestIds) {
  2308. continue;
  2309. }
  2310. this._requestsByChunk.delete(curChunk);
  2311. for (const requestId of requestIds) {
  2312. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2313. if (chunksNeeded.has(curChunk)) {
  2314. chunksNeeded.delete(curChunk);
  2315. }
  2316. if (chunksNeeded.size > 0) {
  2317. continue;
  2318. }
  2319. loadedRequests.push(requestId);
  2320. }
  2321. }
  2322. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2323. let nextEmptyChunk;
  2324. if (this.stream.numChunksLoaded === 1) {
  2325. const lastChunk = this.stream.numChunks - 1;
  2326. if (!this.stream.hasChunk(lastChunk)) {
  2327. nextEmptyChunk = lastChunk;
  2328. }
  2329. } else {
  2330. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2331. }
  2332. if (Number.isInteger(nextEmptyChunk)) {
  2333. this._requestChunks([nextEmptyChunk]);
  2334. }
  2335. }
  2336. for (const requestId of loadedRequests) {
  2337. const capability = this._promisesByRequest.get(requestId);
  2338. this._promisesByRequest.delete(requestId);
  2339. capability.resolve();
  2340. }
  2341. this.msgHandler.send("DocProgress", {
  2342. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2343. total: this.length
  2344. });
  2345. }
  2346. onError(err) {
  2347. this._loadedStreamCapability.reject(err);
  2348. }
  2349. getBeginChunk(begin) {
  2350. return Math.floor(begin / this.chunkSize);
  2351. }
  2352. getEndChunk(end) {
  2353. return Math.floor((end - 1) / this.chunkSize) + 1;
  2354. }
  2355. abort(reason) {
  2356. this.aborted = true;
  2357. if (this.pdfNetworkStream) {
  2358. this.pdfNetworkStream.cancelAllRequests(reason);
  2359. }
  2360. for (const capability of this._promisesByRequest.values()) {
  2361. capability.reject(reason);
  2362. }
  2363. }
  2364. }
  2365. exports.ChunkedStreamManager = ChunkedStreamManager;
  2366. /***/ }),
  2367. /* 8 */
  2368. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2369. Object.defineProperty(exports, "__esModule", ({
  2370. value: true
  2371. }));
  2372. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  2373. exports.collectActions = collectActions;
  2374. exports.encodeToXmlString = encodeToXmlString;
  2375. exports.escapePDFName = escapePDFName;
  2376. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2377. exports.getInheritableProperty = getInheritableProperty;
  2378. exports.getLookupTableFactory = getLookupTableFactory;
  2379. exports.isWhiteSpace = isWhiteSpace;
  2380. exports.log2 = log2;
  2381. exports.parseXFAPath = parseXFAPath;
  2382. exports.readInt8 = readInt8;
  2383. exports.readUint16 = readUint16;
  2384. exports.readUint32 = readUint32;
  2385. exports.recoverJsURL = recoverJsURL;
  2386. exports.toRomanNumerals = toRomanNumerals;
  2387. exports.validateCSSFont = validateCSSFont;
  2388. var _util = __w_pdfjs_require__(2);
  2389. var _primitives = __w_pdfjs_require__(5);
  2390. var _base_stream = __w_pdfjs_require__(9);
  2391. function getLookupTableFactory(initializer) {
  2392. let lookup;
  2393. return function () {
  2394. if (initializer) {
  2395. lookup = Object.create(null);
  2396. initializer(lookup);
  2397. initializer = null;
  2398. }
  2399. return lookup;
  2400. };
  2401. }
  2402. function getArrayLookupTableFactory(initializer) {
  2403. let lookup;
  2404. return function () {
  2405. if (initializer) {
  2406. let arr = initializer();
  2407. initializer = null;
  2408. lookup = Object.create(null);
  2409. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2410. lookup[arr[i]] = arr[i + 1];
  2411. }
  2412. arr = null;
  2413. }
  2414. return lookup;
  2415. };
  2416. }
  2417. class MissingDataException extends _util.BaseException {
  2418. constructor(begin, end) {
  2419. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  2420. this.begin = begin;
  2421. this.end = end;
  2422. }
  2423. }
  2424. exports.MissingDataException = MissingDataException;
  2425. class ParserEOFException extends _util.BaseException {
  2426. constructor(msg) {
  2427. super(msg, "ParserEOFException");
  2428. }
  2429. }
  2430. exports.ParserEOFException = ParserEOFException;
  2431. class XRefEntryException extends _util.BaseException {
  2432. constructor(msg) {
  2433. super(msg, "XRefEntryException");
  2434. }
  2435. }
  2436. exports.XRefEntryException = XRefEntryException;
  2437. class XRefParseException extends _util.BaseException {
  2438. constructor(msg) {
  2439. super(msg, "XRefParseException");
  2440. }
  2441. }
  2442. exports.XRefParseException = XRefParseException;
  2443. class DocStats {
  2444. constructor(handler) {
  2445. this._handler = handler;
  2446. this._streamTypes = new Set();
  2447. this._fontTypes = new Set();
  2448. }
  2449. _send() {
  2450. const streamTypes = Object.create(null),
  2451. fontTypes = Object.create(null);
  2452. for (const type of this._streamTypes) {
  2453. streamTypes[type] = true;
  2454. }
  2455. for (const type of this._fontTypes) {
  2456. fontTypes[type] = true;
  2457. }
  2458. this._handler.send("DocStats", {
  2459. streamTypes,
  2460. fontTypes
  2461. });
  2462. }
  2463. addStreamType(type) {
  2464. if (this._streamTypes.has(type)) {
  2465. return;
  2466. }
  2467. this._streamTypes.add(type);
  2468. this._send();
  2469. }
  2470. addFontType(type) {
  2471. if (this._fontTypes.has(type)) {
  2472. return;
  2473. }
  2474. this._fontTypes.add(type);
  2475. this._send();
  2476. }
  2477. }
  2478. exports.DocStats = DocStats;
  2479. function getInheritableProperty({
  2480. dict,
  2481. key,
  2482. getArray = false,
  2483. stopWhenFound = true
  2484. }) {
  2485. let values;
  2486. const visited = new _primitives.RefSet();
  2487. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2488. if (dict.objId) {
  2489. visited.put(dict.objId);
  2490. }
  2491. const value = getArray ? dict.getArray(key) : dict.get(key);
  2492. if (value !== undefined) {
  2493. if (stopWhenFound) {
  2494. return value;
  2495. }
  2496. if (!values) {
  2497. values = [];
  2498. }
  2499. values.push(value);
  2500. }
  2501. dict = dict.get("Parent");
  2502. }
  2503. return values;
  2504. }
  2505. 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"];
  2506. function toRomanNumerals(number, lowerCase = false) {
  2507. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2508. const romanBuf = [];
  2509. let pos;
  2510. while (number >= 1000) {
  2511. number -= 1000;
  2512. romanBuf.push("M");
  2513. }
  2514. pos = number / 100 | 0;
  2515. number %= 100;
  2516. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2517. pos = number / 10 | 0;
  2518. number %= 10;
  2519. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2520. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2521. const romanStr = romanBuf.join("");
  2522. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2523. }
  2524. function log2(x) {
  2525. if (x <= 0) {
  2526. return 0;
  2527. }
  2528. return Math.ceil(Math.log2(x));
  2529. }
  2530. function readInt8(data, offset) {
  2531. return data[offset] << 24 >> 24;
  2532. }
  2533. function readUint16(data, offset) {
  2534. return data[offset] << 8 | data[offset + 1];
  2535. }
  2536. function readUint32(data, offset) {
  2537. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2538. }
  2539. function isWhiteSpace(ch) {
  2540. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2541. }
  2542. function parseXFAPath(path) {
  2543. const positionPattern = /(.+)\[(\d+)\]$/;
  2544. return path.split(".").map(component => {
  2545. const m = component.match(positionPattern);
  2546. if (m) {
  2547. return {
  2548. name: m[1],
  2549. pos: parseInt(m[2], 10)
  2550. };
  2551. }
  2552. return {
  2553. name: component,
  2554. pos: 0
  2555. };
  2556. });
  2557. }
  2558. function escapePDFName(str) {
  2559. const buffer = [];
  2560. let start = 0;
  2561. for (let i = 0, ii = str.length; i < ii; i++) {
  2562. const char = str.charCodeAt(i);
  2563. 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) {
  2564. if (start < i) {
  2565. buffer.push(str.substring(start, i));
  2566. }
  2567. buffer.push(`#${char.toString(16)}`);
  2568. start = i + 1;
  2569. }
  2570. }
  2571. if (buffer.length === 0) {
  2572. return str;
  2573. }
  2574. if (start < str.length) {
  2575. buffer.push(str.substring(start, str.length));
  2576. }
  2577. return buffer.join("");
  2578. }
  2579. function _collectJS(entry, xref, list, parents) {
  2580. if (!entry) {
  2581. return;
  2582. }
  2583. let parent = null;
  2584. if (entry instanceof _primitives.Ref) {
  2585. if (parents.has(entry)) {
  2586. return;
  2587. }
  2588. parent = entry;
  2589. parents.put(parent);
  2590. entry = xref.fetch(entry);
  2591. }
  2592. if (Array.isArray(entry)) {
  2593. for (const element of entry) {
  2594. _collectJS(element, xref, list, parents);
  2595. }
  2596. } else if (entry instanceof _primitives.Dict) {
  2597. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2598. const js = entry.get("JS");
  2599. let code;
  2600. if (js instanceof _base_stream.BaseStream) {
  2601. code = js.getString();
  2602. } else if (typeof js === "string") {
  2603. code = js;
  2604. }
  2605. code = code && (0, _util.stringToPDFString)(code);
  2606. if (code) {
  2607. list.push(code);
  2608. }
  2609. }
  2610. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2611. }
  2612. if (parent) {
  2613. parents.remove(parent);
  2614. }
  2615. }
  2616. function collectActions(xref, dict, eventType) {
  2617. const actions = Object.create(null);
  2618. const additionalActionsDicts = getInheritableProperty({
  2619. dict,
  2620. key: "AA",
  2621. stopWhenFound: false
  2622. });
  2623. if (additionalActionsDicts) {
  2624. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2625. const additionalActions = additionalActionsDicts[i];
  2626. if (!(additionalActions instanceof _primitives.Dict)) {
  2627. continue;
  2628. }
  2629. for (const key of additionalActions.getKeys()) {
  2630. const action = eventType[key];
  2631. if (!action) {
  2632. continue;
  2633. }
  2634. const actionDict = additionalActions.getRaw(key);
  2635. const parents = new _primitives.RefSet();
  2636. const list = [];
  2637. _collectJS(actionDict, xref, list, parents);
  2638. if (list.length > 0) {
  2639. actions[action] = list;
  2640. }
  2641. }
  2642. }
  2643. }
  2644. if (dict.has("A")) {
  2645. const actionDict = dict.get("A");
  2646. const parents = new _primitives.RefSet();
  2647. const list = [];
  2648. _collectJS(actionDict, xref, list, parents);
  2649. if (list.length > 0) {
  2650. actions.Action = list;
  2651. }
  2652. }
  2653. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2654. }
  2655. const XMLEntities = {
  2656. 0x3c: "&lt;",
  2657. 0x3e: "&gt;",
  2658. 0x26: "&amp;",
  2659. 0x22: "&quot;",
  2660. 0x27: "&apos;"
  2661. };
  2662. function encodeToXmlString(str) {
  2663. const buffer = [];
  2664. let start = 0;
  2665. for (let i = 0, ii = str.length; i < ii; i++) {
  2666. const char = str.codePointAt(i);
  2667. if (0x20 <= char && char <= 0x7e) {
  2668. const entity = XMLEntities[char];
  2669. if (entity) {
  2670. if (start < i) {
  2671. buffer.push(str.substring(start, i));
  2672. }
  2673. buffer.push(entity);
  2674. start = i + 1;
  2675. }
  2676. } else {
  2677. if (start < i) {
  2678. buffer.push(str.substring(start, i));
  2679. }
  2680. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2681. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2682. i++;
  2683. }
  2684. start = i + 1;
  2685. }
  2686. }
  2687. if (buffer.length === 0) {
  2688. return str;
  2689. }
  2690. if (start < str.length) {
  2691. buffer.push(str.substring(start, str.length));
  2692. }
  2693. return buffer.join("");
  2694. }
  2695. function validateCSSFont(cssFontInfo) {
  2696. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2697. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2698. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2699. const {
  2700. fontFamily,
  2701. fontWeight,
  2702. italicAngle
  2703. } = cssFontInfo;
  2704. if (/^".*"$/.test(fontFamily)) {
  2705. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2706. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2707. return false;
  2708. }
  2709. } else if (/^'.*'$/.test(fontFamily)) {
  2710. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2711. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2712. return false;
  2713. }
  2714. } else {
  2715. for (const ident of fontFamily.split(/[ \t]+/)) {
  2716. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2717. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2718. return false;
  2719. }
  2720. }
  2721. }
  2722. const weight = fontWeight ? fontWeight.toString() : "";
  2723. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2724. const angle = parseFloat(italicAngle);
  2725. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2726. return true;
  2727. }
  2728. function recoverJsURL(str) {
  2729. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2730. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2731. const jsUrl = regex.exec(str);
  2732. if (jsUrl && jsUrl[2]) {
  2733. const url = jsUrl[2];
  2734. let newWindow = false;
  2735. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2736. newWindow = true;
  2737. }
  2738. return {
  2739. url,
  2740. newWindow
  2741. };
  2742. }
  2743. return null;
  2744. }
  2745. /***/ }),
  2746. /* 9 */
  2747. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2748. Object.defineProperty(exports, "__esModule", ({
  2749. value: true
  2750. }));
  2751. exports.BaseStream = void 0;
  2752. var _util = __w_pdfjs_require__(2);
  2753. class BaseStream {
  2754. constructor() {
  2755. if (this.constructor === BaseStream) {
  2756. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2757. }
  2758. }
  2759. get length() {
  2760. (0, _util.unreachable)("Abstract getter `length` accessed");
  2761. }
  2762. get isEmpty() {
  2763. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2764. }
  2765. get isDataLoaded() {
  2766. return (0, _util.shadow)(this, "isDataLoaded", true);
  2767. }
  2768. getByte() {
  2769. (0, _util.unreachable)("Abstract method `getByte` called");
  2770. }
  2771. getBytes(length, forceClamped = false) {
  2772. (0, _util.unreachable)("Abstract method `getBytes` called");
  2773. }
  2774. peekByte() {
  2775. const peekedByte = this.getByte();
  2776. if (peekedByte !== -1) {
  2777. this.pos--;
  2778. }
  2779. return peekedByte;
  2780. }
  2781. peekBytes(length, forceClamped = false) {
  2782. const bytes = this.getBytes(length, forceClamped);
  2783. this.pos -= bytes.length;
  2784. return bytes;
  2785. }
  2786. getUint16() {
  2787. const b0 = this.getByte();
  2788. const b1 = this.getByte();
  2789. if (b0 === -1 || b1 === -1) {
  2790. return -1;
  2791. }
  2792. return (b0 << 8) + b1;
  2793. }
  2794. getInt32() {
  2795. const b0 = this.getByte();
  2796. const b1 = this.getByte();
  2797. const b2 = this.getByte();
  2798. const b3 = this.getByte();
  2799. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2800. }
  2801. getByteRange(begin, end) {
  2802. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2803. }
  2804. getString(length) {
  2805. return (0, _util.bytesToString)(this.getBytes(length, false));
  2806. }
  2807. skip(n) {
  2808. this.pos += n || 1;
  2809. }
  2810. reset() {
  2811. (0, _util.unreachable)("Abstract method `reset` called");
  2812. }
  2813. moveStart() {
  2814. (0, _util.unreachable)("Abstract method `moveStart` called");
  2815. }
  2816. makeSubStream(start, length, dict = null) {
  2817. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2818. }
  2819. getBaseStreams() {
  2820. return null;
  2821. }
  2822. }
  2823. exports.BaseStream = BaseStream;
  2824. /***/ }),
  2825. /* 10 */
  2826. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2827. Object.defineProperty(exports, "__esModule", ({
  2828. value: true
  2829. }));
  2830. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2831. var _base_stream = __w_pdfjs_require__(9);
  2832. var _util = __w_pdfjs_require__(2);
  2833. class Stream extends _base_stream.BaseStream {
  2834. constructor(arrayBuffer, start, length, dict) {
  2835. super();
  2836. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2837. this.start = start || 0;
  2838. this.pos = this.start;
  2839. this.end = start + length || this.bytes.length;
  2840. this.dict = dict;
  2841. }
  2842. get length() {
  2843. return this.end - this.start;
  2844. }
  2845. get isEmpty() {
  2846. return this.length === 0;
  2847. }
  2848. getByte() {
  2849. if (this.pos >= this.end) {
  2850. return -1;
  2851. }
  2852. return this.bytes[this.pos++];
  2853. }
  2854. getBytes(length, forceClamped = false) {
  2855. const bytes = this.bytes;
  2856. const pos = this.pos;
  2857. const strEnd = this.end;
  2858. if (!length) {
  2859. const subarray = bytes.subarray(pos, strEnd);
  2860. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2861. }
  2862. let end = pos + length;
  2863. if (end > strEnd) {
  2864. end = strEnd;
  2865. }
  2866. this.pos = end;
  2867. const subarray = bytes.subarray(pos, end);
  2868. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2869. }
  2870. getByteRange(begin, end) {
  2871. if (begin < 0) {
  2872. begin = 0;
  2873. }
  2874. if (end > this.end) {
  2875. end = this.end;
  2876. }
  2877. return this.bytes.subarray(begin, end);
  2878. }
  2879. reset() {
  2880. this.pos = this.start;
  2881. }
  2882. moveStart() {
  2883. this.start = this.pos;
  2884. }
  2885. makeSubStream(start, length, dict = null) {
  2886. return new Stream(this.bytes.buffer, start, length, dict);
  2887. }
  2888. }
  2889. exports.Stream = Stream;
  2890. class StringStream extends Stream {
  2891. constructor(str) {
  2892. super((0, _util.stringToBytes)(str));
  2893. }
  2894. }
  2895. exports.StringStream = StringStream;
  2896. class NullStream extends Stream {
  2897. constructor() {
  2898. super(new Uint8Array(0));
  2899. }
  2900. }
  2901. exports.NullStream = NullStream;
  2902. /***/ }),
  2903. /* 11 */
  2904. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2905. Object.defineProperty(exports, "__esModule", ({
  2906. value: true
  2907. }));
  2908. exports.Page = exports.PDFDocument = void 0;
  2909. var _util = __w_pdfjs_require__(2);
  2910. var _core_utils = __w_pdfjs_require__(8);
  2911. var _primitives = __w_pdfjs_require__(5);
  2912. var _xfa_fonts = __w_pdfjs_require__(12);
  2913. var _stream = __w_pdfjs_require__(10);
  2914. var _annotation = __w_pdfjs_require__(22);
  2915. var _base_stream = __w_pdfjs_require__(9);
  2916. var _crypto = __w_pdfjs_require__(73);
  2917. var _catalog = __w_pdfjs_require__(64);
  2918. var _cleanup_helper = __w_pdfjs_require__(66);
  2919. var _parser = __w_pdfjs_require__(27);
  2920. var _object_loader = __w_pdfjs_require__(71);
  2921. var _operator_list = __w_pdfjs_require__(62);
  2922. var _evaluator = __w_pdfjs_require__(25);
  2923. var _decode_stream = __w_pdfjs_require__(29);
  2924. var _struct_tree = __w_pdfjs_require__(70);
  2925. var _factory = __w_pdfjs_require__(75);
  2926. var _xref = __w_pdfjs_require__(99);
  2927. const DEFAULT_USER_UNIT = 1.0;
  2928. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2929. class Page {
  2930. constructor({
  2931. pdfManager,
  2932. xref,
  2933. pageIndex,
  2934. pageDict,
  2935. ref,
  2936. globalIdFactory,
  2937. fontCache,
  2938. builtInCMapCache,
  2939. standardFontDataCache,
  2940. globalImageCache,
  2941. nonBlendModesSet,
  2942. xfaFactory
  2943. }) {
  2944. this.pdfManager = pdfManager;
  2945. this.pageIndex = pageIndex;
  2946. this.pageDict = pageDict;
  2947. this.xref = xref;
  2948. this.ref = ref;
  2949. this.fontCache = fontCache;
  2950. this.builtInCMapCache = builtInCMapCache;
  2951. this.standardFontDataCache = standardFontDataCache;
  2952. this.globalImageCache = globalImageCache;
  2953. this.nonBlendModesSet = nonBlendModesSet;
  2954. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2955. this.resourcesPromise = null;
  2956. this.xfaFactory = xfaFactory;
  2957. const idCounters = {
  2958. obj: 0
  2959. };
  2960. this._localIdFactory = class extends globalIdFactory {
  2961. static createObjId() {
  2962. return `p${pageIndex}_${++idCounters.obj}`;
  2963. }
  2964. static getPageObjId() {
  2965. return `page${ref.toString()}`;
  2966. }
  2967. };
  2968. }
  2969. _getInheritableProperty(key, getArray = false) {
  2970. const value = (0, _core_utils.getInheritableProperty)({
  2971. dict: this.pageDict,
  2972. key,
  2973. getArray,
  2974. stopWhenFound: false
  2975. });
  2976. if (!Array.isArray(value)) {
  2977. return value;
  2978. }
  2979. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  2980. return value[0];
  2981. }
  2982. return _primitives.Dict.merge({
  2983. xref: this.xref,
  2984. dictArray: value
  2985. });
  2986. }
  2987. get content() {
  2988. return this.pageDict.getArray("Contents");
  2989. }
  2990. get resources() {
  2991. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2992. }
  2993. _getBoundingBox(name) {
  2994. if (this.xfaData) {
  2995. return this.xfaData.bbox;
  2996. }
  2997. const box = this._getInheritableProperty(name, true);
  2998. if (Array.isArray(box) && box.length === 4) {
  2999. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3000. return box;
  3001. }
  3002. (0, _util.warn)(`Empty /${name} entry.`);
  3003. }
  3004. return null;
  3005. }
  3006. get mediaBox() {
  3007. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3008. }
  3009. get cropBox() {
  3010. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3011. }
  3012. get userUnit() {
  3013. let obj = this.pageDict.get("UserUnit");
  3014. if (typeof obj !== "number" || obj <= 0) {
  3015. obj = DEFAULT_USER_UNIT;
  3016. }
  3017. return (0, _util.shadow)(this, "userUnit", obj);
  3018. }
  3019. get view() {
  3020. const {
  3021. cropBox,
  3022. mediaBox
  3023. } = this;
  3024. let view;
  3025. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3026. view = mediaBox;
  3027. } else {
  3028. const box = _util.Util.intersect(cropBox, mediaBox);
  3029. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3030. view = box;
  3031. } else {
  3032. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3033. }
  3034. }
  3035. return (0, _util.shadow)(this, "view", view || mediaBox);
  3036. }
  3037. get rotate() {
  3038. let rotate = this._getInheritableProperty("Rotate") || 0;
  3039. if (rotate % 90 !== 0) {
  3040. rotate = 0;
  3041. } else if (rotate >= 360) {
  3042. rotate %= 360;
  3043. } else if (rotate < 0) {
  3044. rotate = (rotate % 360 + 360) % 360;
  3045. }
  3046. return (0, _util.shadow)(this, "rotate", rotate);
  3047. }
  3048. _onSubStreamError(handler, reason, objId) {
  3049. if (this.evaluatorOptions.ignoreErrors) {
  3050. handler.send("UnsupportedFeature", {
  3051. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3052. });
  3053. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3054. return;
  3055. }
  3056. throw reason;
  3057. }
  3058. getContentStream(handler) {
  3059. return this.pdfManager.ensure(this, "content").then(content => {
  3060. if (content instanceof _base_stream.BaseStream) {
  3061. return content;
  3062. }
  3063. if (Array.isArray(content)) {
  3064. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3065. }
  3066. return new _stream.NullStream();
  3067. });
  3068. }
  3069. get xfaData() {
  3070. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3071. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3072. } : null);
  3073. }
  3074. save(handler, task, annotationStorage) {
  3075. const partialEvaluator = new _evaluator.PartialEvaluator({
  3076. xref: this.xref,
  3077. handler,
  3078. pageIndex: this.pageIndex,
  3079. idFactory: this._localIdFactory,
  3080. fontCache: this.fontCache,
  3081. builtInCMapCache: this.builtInCMapCache,
  3082. standardFontDataCache: this.standardFontDataCache,
  3083. globalImageCache: this.globalImageCache,
  3084. options: this.evaluatorOptions
  3085. });
  3086. return this._parsedAnnotations.then(function (annotations) {
  3087. const newRefsPromises = [];
  3088. for (const annotation of annotations) {
  3089. if (!annotation.mustBePrinted(annotationStorage)) {
  3090. continue;
  3091. }
  3092. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3093. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3094. return null;
  3095. }));
  3096. }
  3097. return Promise.all(newRefsPromises);
  3098. });
  3099. }
  3100. loadResources(keys) {
  3101. if (!this.resourcesPromise) {
  3102. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3103. }
  3104. return this.resourcesPromise.then(() => {
  3105. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3106. return objectLoader.load();
  3107. });
  3108. }
  3109. getOperatorList({
  3110. handler,
  3111. sink,
  3112. task,
  3113. intent,
  3114. cacheKey,
  3115. annotationStorage = null
  3116. }) {
  3117. const contentStreamPromise = this.getContentStream(handler);
  3118. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3119. const partialEvaluator = new _evaluator.PartialEvaluator({
  3120. xref: this.xref,
  3121. handler,
  3122. pageIndex: this.pageIndex,
  3123. idFactory: this._localIdFactory,
  3124. fontCache: this.fontCache,
  3125. builtInCMapCache: this.builtInCMapCache,
  3126. standardFontDataCache: this.standardFontDataCache,
  3127. globalImageCache: this.globalImageCache,
  3128. options: this.evaluatorOptions
  3129. });
  3130. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3131. const pageListPromise = dataPromises.then(([contentStream]) => {
  3132. const opList = new _operator_list.OperatorList(intent, sink);
  3133. handler.send("StartRenderPage", {
  3134. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3135. pageIndex: this.pageIndex,
  3136. cacheKey
  3137. });
  3138. return partialEvaluator.getOperatorList({
  3139. stream: contentStream,
  3140. task,
  3141. resources: this.resources,
  3142. operatorList: opList
  3143. }).then(function () {
  3144. return opList;
  3145. });
  3146. });
  3147. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  3148. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3149. pageOpList.flush(true);
  3150. return {
  3151. length: pageOpList.totalLength
  3152. };
  3153. }
  3154. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3155. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3156. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3157. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3158. const opListPromises = [];
  3159. for (const annotation of annotations) {
  3160. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3161. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3162. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3163. return null;
  3164. }));
  3165. }
  3166. }
  3167. return Promise.all(opListPromises).then(function (opLists) {
  3168. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3169. for (const opList of opLists) {
  3170. pageOpList.addOpList(opList);
  3171. }
  3172. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3173. pageOpList.flush(true);
  3174. return {
  3175. length: pageOpList.totalLength
  3176. };
  3177. });
  3178. });
  3179. }
  3180. extractTextContent({
  3181. handler,
  3182. task,
  3183. includeMarkedContent,
  3184. sink,
  3185. combineTextItems
  3186. }) {
  3187. const contentStreamPromise = this.getContentStream(handler);
  3188. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3189. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3190. return dataPromises.then(([contentStream]) => {
  3191. const partialEvaluator = new _evaluator.PartialEvaluator({
  3192. xref: this.xref,
  3193. handler,
  3194. pageIndex: this.pageIndex,
  3195. idFactory: this._localIdFactory,
  3196. fontCache: this.fontCache,
  3197. builtInCMapCache: this.builtInCMapCache,
  3198. standardFontDataCache: this.standardFontDataCache,
  3199. globalImageCache: this.globalImageCache,
  3200. options: this.evaluatorOptions
  3201. });
  3202. return partialEvaluator.getTextContent({
  3203. stream: contentStream,
  3204. task,
  3205. resources: this.resources,
  3206. includeMarkedContent,
  3207. combineTextItems,
  3208. sink,
  3209. viewBox: this.view
  3210. });
  3211. });
  3212. }
  3213. async getStructTree() {
  3214. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3215. if (!structTreeRoot) {
  3216. return null;
  3217. }
  3218. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3219. return structTree.serializable;
  3220. }
  3221. _parseStructTree(structTreeRoot) {
  3222. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3223. tree.parse();
  3224. return tree;
  3225. }
  3226. getAnnotationsData(intent) {
  3227. return this._parsedAnnotations.then(function (annotations) {
  3228. const annotationsData = [];
  3229. if (annotations.length === 0) {
  3230. return annotationsData;
  3231. }
  3232. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3233. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3234. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3235. for (const annotation of annotations) {
  3236. if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
  3237. annotationsData.push(annotation.data);
  3238. }
  3239. }
  3240. return annotationsData;
  3241. });
  3242. }
  3243. get annotations() {
  3244. const annots = this._getInheritableProperty("Annots");
  3245. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3246. }
  3247. get _parsedAnnotations() {
  3248. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3249. const annotationPromises = [];
  3250. for (const annotationRef of this.annotations) {
  3251. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3252. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3253. return null;
  3254. }));
  3255. }
  3256. return Promise.all(annotationPromises).then(function (annotations) {
  3257. return annotations.filter(annotation => !!annotation);
  3258. });
  3259. });
  3260. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3261. }
  3262. get jsActions() {
  3263. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3264. return (0, _util.shadow)(this, "jsActions", actions);
  3265. }
  3266. }
  3267. exports.Page = Page;
  3268. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3269. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3270. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3271. const FINGERPRINT_FIRST_BYTES = 1024;
  3272. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3273. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3274. function find(stream, signature, limit = 1024, backwards = false) {
  3275. const signatureLength = signature.length;
  3276. const scanBytes = stream.peekBytes(limit);
  3277. const scanLength = scanBytes.length - signatureLength;
  3278. if (scanLength <= 0) {
  3279. return false;
  3280. }
  3281. if (backwards) {
  3282. const signatureEnd = signatureLength - 1;
  3283. let pos = scanBytes.length - 1;
  3284. while (pos >= signatureEnd) {
  3285. let j = 0;
  3286. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3287. j++;
  3288. }
  3289. if (j >= signatureLength) {
  3290. stream.pos += pos - signatureEnd;
  3291. return true;
  3292. }
  3293. pos--;
  3294. }
  3295. } else {
  3296. let pos = 0;
  3297. while (pos <= scanLength) {
  3298. let j = 0;
  3299. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3300. j++;
  3301. }
  3302. if (j >= signatureLength) {
  3303. stream.pos += pos;
  3304. return true;
  3305. }
  3306. pos++;
  3307. }
  3308. }
  3309. return false;
  3310. }
  3311. class PDFDocument {
  3312. constructor(pdfManager, arg) {
  3313. let stream;
  3314. if (arg instanceof _base_stream.BaseStream) {
  3315. stream = arg;
  3316. } else if ((0, _util.isArrayBuffer)(arg)) {
  3317. stream = new _stream.Stream(arg);
  3318. } else {
  3319. throw new Error("PDFDocument: Unknown argument type");
  3320. }
  3321. if (stream.length <= 0) {
  3322. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3323. }
  3324. this.pdfManager = pdfManager;
  3325. this.stream = stream;
  3326. this.xref = new _xref.XRef(stream, pdfManager);
  3327. this._pagePromises = new Map();
  3328. this._version = null;
  3329. const idCounters = {
  3330. font: 0
  3331. };
  3332. this._globalIdFactory = class {
  3333. static getDocId() {
  3334. return `g_${pdfManager.docId}`;
  3335. }
  3336. static createFontId() {
  3337. return `f${++idCounters.font}`;
  3338. }
  3339. static createObjId() {
  3340. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3341. }
  3342. static getPageObjId() {
  3343. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3344. }
  3345. };
  3346. }
  3347. parse(recoveryMode) {
  3348. this.xref.parse(recoveryMode);
  3349. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3350. if (this.catalog.version) {
  3351. this._version = this.catalog.version;
  3352. }
  3353. }
  3354. get linearization() {
  3355. let linearization = null;
  3356. try {
  3357. linearization = _parser.Linearization.create(this.stream);
  3358. } catch (err) {
  3359. if (err instanceof _core_utils.MissingDataException) {
  3360. throw err;
  3361. }
  3362. (0, _util.info)(err);
  3363. }
  3364. return (0, _util.shadow)(this, "linearization", linearization);
  3365. }
  3366. get startXRef() {
  3367. const stream = this.stream;
  3368. let startXRef = 0;
  3369. if (this.linearization) {
  3370. stream.reset();
  3371. if (find(stream, ENDOBJ_SIGNATURE)) {
  3372. startXRef = stream.pos + 6 - stream.start;
  3373. }
  3374. } else {
  3375. const step = 1024;
  3376. const startXRefLength = STARTXREF_SIGNATURE.length;
  3377. let found = false,
  3378. pos = stream.end;
  3379. while (!found && pos > 0) {
  3380. pos -= step - startXRefLength;
  3381. if (pos < 0) {
  3382. pos = 0;
  3383. }
  3384. stream.pos = pos;
  3385. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3386. }
  3387. if (found) {
  3388. stream.skip(9);
  3389. let ch;
  3390. do {
  3391. ch = stream.getByte();
  3392. } while ((0, _core_utils.isWhiteSpace)(ch));
  3393. let str = "";
  3394. while (ch >= 0x20 && ch <= 0x39) {
  3395. str += String.fromCharCode(ch);
  3396. ch = stream.getByte();
  3397. }
  3398. startXRef = parseInt(str, 10);
  3399. if (isNaN(startXRef)) {
  3400. startXRef = 0;
  3401. }
  3402. }
  3403. }
  3404. return (0, _util.shadow)(this, "startXRef", startXRef);
  3405. }
  3406. checkHeader() {
  3407. const stream = this.stream;
  3408. stream.reset();
  3409. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3410. return;
  3411. }
  3412. stream.moveStart();
  3413. const MAX_PDF_VERSION_LENGTH = 12;
  3414. let version = "",
  3415. ch;
  3416. while ((ch = stream.getByte()) > 0x20) {
  3417. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3418. break;
  3419. }
  3420. version += String.fromCharCode(ch);
  3421. }
  3422. if (!this._version) {
  3423. this._version = version.substring(5);
  3424. }
  3425. }
  3426. parseStartXRef() {
  3427. this.xref.setStartXRef(this.startXRef);
  3428. }
  3429. get numPages() {
  3430. let num = 0;
  3431. if (this.catalog.hasActualNumPages) {
  3432. num = this.catalog.numPages;
  3433. } else if (this.xfaFactory) {
  3434. num = this.xfaFactory.getNumPages();
  3435. } else if (this.linearization) {
  3436. num = this.linearization.numPages;
  3437. } else {
  3438. num = this.catalog.numPages;
  3439. }
  3440. return (0, _util.shadow)(this, "numPages", num);
  3441. }
  3442. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3443. const RECURSION_LIMIT = 10;
  3444. if (!Array.isArray(fields)) {
  3445. return false;
  3446. }
  3447. return fields.every(field => {
  3448. field = this.xref.fetchIfRef(field);
  3449. if (!(field instanceof _primitives.Dict)) {
  3450. return false;
  3451. }
  3452. if (field.has("Kids")) {
  3453. if (++recursionDepth > RECURSION_LIMIT) {
  3454. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3455. return false;
  3456. }
  3457. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3458. }
  3459. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3460. const rectangle = field.get("Rect");
  3461. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3462. return isSignature && isInvisible;
  3463. });
  3464. }
  3465. get xfaData() {
  3466. const acroForm = this.catalog.acroForm;
  3467. if (!acroForm) {
  3468. return null;
  3469. }
  3470. const xfa = acroForm.get("XFA");
  3471. const entries = {
  3472. "xdp:xdp": "",
  3473. template: "",
  3474. datasets: "",
  3475. config: "",
  3476. connectionSet: "",
  3477. localeSet: "",
  3478. stylesheet: "",
  3479. "/xdp:xdp": ""
  3480. };
  3481. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3482. try {
  3483. entries["xdp:xdp"] = (0, _util.stringToUTF8String)(xfa.getString());
  3484. return entries;
  3485. } catch (_) {
  3486. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3487. return null;
  3488. }
  3489. }
  3490. if (!Array.isArray(xfa) || xfa.length === 0) {
  3491. return null;
  3492. }
  3493. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3494. let name;
  3495. if (i === 0) {
  3496. name = "xdp:xdp";
  3497. } else if (i === ii - 2) {
  3498. name = "/xdp:xdp";
  3499. } else {
  3500. name = xfa[i];
  3501. }
  3502. if (!entries.hasOwnProperty(name)) {
  3503. continue;
  3504. }
  3505. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3506. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3507. continue;
  3508. }
  3509. try {
  3510. entries[name] = (0, _util.stringToUTF8String)(data.getString());
  3511. } catch (_) {
  3512. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3513. return null;
  3514. }
  3515. }
  3516. return entries;
  3517. }
  3518. get xfaFactory() {
  3519. let data;
  3520. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3521. data = this.xfaData;
  3522. }
  3523. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3524. }
  3525. get isPureXfa() {
  3526. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3527. }
  3528. get htmlForXfa() {
  3529. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3530. }
  3531. async loadXfaImages() {
  3532. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3533. if (!xfaImagesDict) {
  3534. return;
  3535. }
  3536. const keys = xfaImagesDict.getKeys();
  3537. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3538. await objectLoader.load();
  3539. const xfaImages = new Map();
  3540. for (const key of keys) {
  3541. const stream = xfaImagesDict.get(key);
  3542. if (stream instanceof _base_stream.BaseStream) {
  3543. xfaImages.set(key, stream.getBytes());
  3544. }
  3545. }
  3546. this.xfaFactory.setImages(xfaImages);
  3547. }
  3548. async loadXfaFonts(handler, task) {
  3549. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3550. if (!acroForm) {
  3551. return;
  3552. }
  3553. const resources = await acroForm.getAsync("DR");
  3554. if (!(resources instanceof _primitives.Dict)) {
  3555. return;
  3556. }
  3557. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3558. await objectLoader.load();
  3559. const fontRes = resources.get("Font");
  3560. if (!(fontRes instanceof _primitives.Dict)) {
  3561. return;
  3562. }
  3563. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3564. options.useSystemFonts = false;
  3565. const partialEvaluator = new _evaluator.PartialEvaluator({
  3566. xref: this.xref,
  3567. handler,
  3568. pageIndex: -1,
  3569. idFactory: this._globalIdFactory,
  3570. fontCache: this.catalog.fontCache,
  3571. builtInCMapCache: this.catalog.builtInCMapCache,
  3572. standardFontDataCache: this.catalog.standardFontDataCache,
  3573. options
  3574. });
  3575. const operatorList = new _operator_list.OperatorList();
  3576. const pdfFonts = [];
  3577. const initialState = {
  3578. get font() {
  3579. return pdfFonts[pdfFonts.length - 1];
  3580. },
  3581. set font(font) {
  3582. pdfFonts.push(font);
  3583. },
  3584. clone() {
  3585. return this;
  3586. }
  3587. };
  3588. const fonts = new Map();
  3589. fontRes.forEach((fontName, font) => {
  3590. fonts.set(fontName, font);
  3591. });
  3592. const promises = [];
  3593. for (const [fontName, font] of fonts) {
  3594. const descriptor = font.get("FontDescriptor");
  3595. if (!(descriptor instanceof _primitives.Dict)) {
  3596. continue;
  3597. }
  3598. let fontFamily = descriptor.get("FontFamily");
  3599. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3600. const fontWeight = descriptor.get("FontWeight");
  3601. const italicAngle = -descriptor.get("ItalicAngle");
  3602. const cssFontInfo = {
  3603. fontFamily,
  3604. fontWeight,
  3605. italicAngle
  3606. };
  3607. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3608. continue;
  3609. }
  3610. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3611. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3612. return null;
  3613. }));
  3614. }
  3615. await Promise.all(promises);
  3616. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3617. if (!missingFonts) {
  3618. return;
  3619. }
  3620. options.ignoreErrors = true;
  3621. promises.length = 0;
  3622. pdfFonts.length = 0;
  3623. const reallyMissingFonts = new Set();
  3624. for (const missing of missingFonts) {
  3625. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3626. reallyMissingFonts.add(missing);
  3627. }
  3628. }
  3629. if (reallyMissingFonts.size) {
  3630. missingFonts.push("PdfJS-Fallback");
  3631. }
  3632. for (const missing of missingFonts) {
  3633. if (reallyMissingFonts.has(missing)) {
  3634. continue;
  3635. }
  3636. for (const fontInfo of [{
  3637. name: "Regular",
  3638. fontWeight: 400,
  3639. italicAngle: 0
  3640. }, {
  3641. name: "Bold",
  3642. fontWeight: 700,
  3643. italicAngle: 0
  3644. }, {
  3645. name: "Italic",
  3646. fontWeight: 400,
  3647. italicAngle: 12
  3648. }, {
  3649. name: "BoldItalic",
  3650. fontWeight: 700,
  3651. italicAngle: 12
  3652. }]) {
  3653. const name = `${missing}-${fontInfo.name}`;
  3654. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3655. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3656. fontFamily: missing,
  3657. fontWeight: fontInfo.fontWeight,
  3658. italicAngle: fontInfo.italicAngle
  3659. }).catch(function (reason) {
  3660. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3661. return null;
  3662. }));
  3663. }
  3664. }
  3665. await Promise.all(promises);
  3666. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3667. }
  3668. async serializeXfaData(annotationStorage) {
  3669. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3670. }
  3671. get formInfo() {
  3672. const formInfo = {
  3673. hasFields: false,
  3674. hasAcroForm: false,
  3675. hasXfa: false,
  3676. hasSignatures: false
  3677. };
  3678. const acroForm = this.catalog.acroForm;
  3679. if (!acroForm) {
  3680. return (0, _util.shadow)(this, "formInfo", formInfo);
  3681. }
  3682. try {
  3683. const fields = acroForm.get("Fields");
  3684. const hasFields = Array.isArray(fields) && fields.length > 0;
  3685. formInfo.hasFields = hasFields;
  3686. const xfa = acroForm.get("XFA");
  3687. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3688. const sigFlags = acroForm.get("SigFlags");
  3689. const hasSignatures = !!(sigFlags & 0x1);
  3690. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3691. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3692. formInfo.hasSignatures = hasSignatures;
  3693. } catch (ex) {
  3694. if (ex instanceof _core_utils.MissingDataException) {
  3695. throw ex;
  3696. }
  3697. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3698. }
  3699. return (0, _util.shadow)(this, "formInfo", formInfo);
  3700. }
  3701. get documentInfo() {
  3702. let version = this._version;
  3703. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3704. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3705. version = null;
  3706. }
  3707. const docInfo = {
  3708. PDFFormatVersion: version,
  3709. Language: this.catalog.lang,
  3710. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3711. IsLinearized: !!this.linearization,
  3712. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3713. IsXFAPresent: this.formInfo.hasXfa,
  3714. IsCollectionPresent: !!this.catalog.collection,
  3715. IsSignaturesPresent: this.formInfo.hasSignatures
  3716. };
  3717. let infoDict;
  3718. try {
  3719. infoDict = this.xref.trailer.get("Info");
  3720. } catch (err) {
  3721. if (err instanceof _core_utils.MissingDataException) {
  3722. throw err;
  3723. }
  3724. (0, _util.info)("The document information dictionary is invalid.");
  3725. }
  3726. if (!(infoDict instanceof _primitives.Dict)) {
  3727. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3728. }
  3729. for (const key of infoDict.getKeys()) {
  3730. const value = infoDict.get(key);
  3731. switch (key) {
  3732. case "Title":
  3733. case "Author":
  3734. case "Subject":
  3735. case "Keywords":
  3736. case "Creator":
  3737. case "Producer":
  3738. case "CreationDate":
  3739. case "ModDate":
  3740. if (typeof value === "string") {
  3741. docInfo[key] = (0, _util.stringToPDFString)(value);
  3742. continue;
  3743. }
  3744. break;
  3745. case "Trapped":
  3746. if (value instanceof _primitives.Name) {
  3747. docInfo[key] = value;
  3748. continue;
  3749. }
  3750. break;
  3751. default:
  3752. let customValue;
  3753. switch (typeof value) {
  3754. case "string":
  3755. customValue = (0, _util.stringToPDFString)(value);
  3756. break;
  3757. case "number":
  3758. case "boolean":
  3759. customValue = value;
  3760. break;
  3761. default:
  3762. if (value instanceof _primitives.Name) {
  3763. customValue = value;
  3764. }
  3765. break;
  3766. }
  3767. if (customValue === undefined) {
  3768. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3769. continue;
  3770. }
  3771. if (!docInfo.Custom) {
  3772. docInfo.Custom = Object.create(null);
  3773. }
  3774. docInfo.Custom[key] = customValue;
  3775. continue;
  3776. }
  3777. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3778. }
  3779. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3780. }
  3781. get fingerprints() {
  3782. function validate(data) {
  3783. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3784. }
  3785. function hexString(hash) {
  3786. const buf = [];
  3787. for (let i = 0, ii = hash.length; i < ii; i++) {
  3788. const hex = hash[i].toString(16);
  3789. buf.push(hex.padStart(2, "0"));
  3790. }
  3791. return buf.join("");
  3792. }
  3793. const idArray = this.xref.trailer.get("ID");
  3794. let hashOriginal, hashModified;
  3795. if (Array.isArray(idArray) && validate(idArray[0])) {
  3796. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3797. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3798. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3799. }
  3800. } else {
  3801. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3802. }
  3803. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3804. }
  3805. async _getLinearizationPage(pageIndex) {
  3806. const {
  3807. catalog,
  3808. linearization,
  3809. xref
  3810. } = this;
  3811. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3812. try {
  3813. const obj = await xref.fetchAsync(ref);
  3814. if (obj instanceof _primitives.Dict) {
  3815. let type = obj.getRaw("Type");
  3816. if (type instanceof _primitives.Ref) {
  3817. type = await xref.fetchAsync(type);
  3818. }
  3819. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  3820. if (!catalog.pageKidsCountCache.has(ref)) {
  3821. catalog.pageKidsCountCache.put(ref, 1);
  3822. }
  3823. if (!catalog.pageIndexCache.has(ref)) {
  3824. catalog.pageIndexCache.put(ref, 0);
  3825. }
  3826. return [obj, ref];
  3827. }
  3828. }
  3829. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  3830. } catch (reason) {
  3831. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  3832. return catalog.getPageDict(pageIndex);
  3833. }
  3834. }
  3835. getPage(pageIndex) {
  3836. const cachedPromise = this._pagePromises.get(pageIndex);
  3837. if (cachedPromise) {
  3838. return cachedPromise;
  3839. }
  3840. const {
  3841. catalog,
  3842. linearization,
  3843. xfaFactory
  3844. } = this;
  3845. let promise;
  3846. if (xfaFactory) {
  3847. promise = Promise.resolve([_primitives.Dict.empty, null]);
  3848. } else if (linearization && linearization.pageFirst === pageIndex) {
  3849. promise = this._getLinearizationPage(pageIndex);
  3850. } else {
  3851. promise = catalog.getPageDict(pageIndex);
  3852. }
  3853. promise = promise.then(([pageDict, ref]) => {
  3854. return new Page({
  3855. pdfManager: this.pdfManager,
  3856. xref: this.xref,
  3857. pageIndex,
  3858. pageDict,
  3859. ref,
  3860. globalIdFactory: this._globalIdFactory,
  3861. fontCache: catalog.fontCache,
  3862. builtInCMapCache: catalog.builtInCMapCache,
  3863. standardFontDataCache: catalog.standardFontDataCache,
  3864. globalImageCache: catalog.globalImageCache,
  3865. nonBlendModesSet: catalog.nonBlendModesSet,
  3866. xfaFactory
  3867. });
  3868. });
  3869. this._pagePromises.set(pageIndex, promise);
  3870. return promise;
  3871. }
  3872. async checkFirstPage(recoveryMode = false) {
  3873. if (recoveryMode) {
  3874. return;
  3875. }
  3876. try {
  3877. await this.getPage(0);
  3878. } catch (reason) {
  3879. if (reason instanceof _core_utils.XRefEntryException) {
  3880. this._pagePromises.delete(0);
  3881. await this.cleanup();
  3882. throw new _core_utils.XRefParseException();
  3883. }
  3884. }
  3885. }
  3886. async checkLastPage(recoveryMode = false) {
  3887. const {
  3888. catalog,
  3889. pdfManager
  3890. } = this;
  3891. catalog.setActualNumPages();
  3892. let numPages;
  3893. try {
  3894. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  3895. if (this.xfaFactory) {
  3896. return;
  3897. } else if (this.linearization) {
  3898. numPages = this.linearization.numPages;
  3899. } else {
  3900. numPages = catalog.numPages;
  3901. }
  3902. if (!Number.isInteger(numPages)) {
  3903. throw new _util.FormatError("Page count is not an integer.");
  3904. } else if (numPages <= 1) {
  3905. return;
  3906. }
  3907. await this.getPage(numPages - 1);
  3908. } catch (reason) {
  3909. this._pagePromises.delete(numPages - 1);
  3910. await this.cleanup();
  3911. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3912. throw new _core_utils.XRefParseException();
  3913. }
  3914. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  3915. let pagesTree;
  3916. try {
  3917. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  3918. } catch (reasonAll) {
  3919. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3920. throw new _core_utils.XRefParseException();
  3921. }
  3922. catalog.setActualNumPages(1);
  3923. return;
  3924. }
  3925. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  3926. let promise;
  3927. if (pageDict instanceof Error) {
  3928. promise = Promise.reject(pageDict);
  3929. promise.catch(() => {});
  3930. } else {
  3931. promise = Promise.resolve(new Page({
  3932. pdfManager,
  3933. xref: this.xref,
  3934. pageIndex,
  3935. pageDict,
  3936. ref,
  3937. globalIdFactory: this._globalIdFactory,
  3938. fontCache: catalog.fontCache,
  3939. builtInCMapCache: catalog.builtInCMapCache,
  3940. standardFontDataCache: catalog.standardFontDataCache,
  3941. globalImageCache: catalog.globalImageCache,
  3942. nonBlendModesSet: catalog.nonBlendModesSet,
  3943. xfaFactory: null
  3944. }));
  3945. }
  3946. this._pagePromises.set(pageIndex, promise);
  3947. }
  3948. catalog.setActualNumPages(pagesTree.size);
  3949. }
  3950. }
  3951. fontFallback(id, handler) {
  3952. return this.catalog.fontFallback(id, handler);
  3953. }
  3954. async cleanup(manuallyTriggered = false) {
  3955. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  3956. }
  3957. _collectFieldObjects(name, fieldRef, promises) {
  3958. const field = this.xref.fetchIfRef(fieldRef);
  3959. if (field.has("T")) {
  3960. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3961. if (name === "") {
  3962. name = partName;
  3963. } else {
  3964. name = `${name}.${partName}`;
  3965. }
  3966. }
  3967. if (!promises.has(name)) {
  3968. promises.set(name, []);
  3969. }
  3970. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3971. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3972. return null;
  3973. }));
  3974. if (field.has("Kids")) {
  3975. const kids = field.get("Kids");
  3976. for (const kid of kids) {
  3977. this._collectFieldObjects(name, kid, promises);
  3978. }
  3979. }
  3980. }
  3981. get fieldObjects() {
  3982. if (!this.formInfo.hasFields) {
  3983. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3984. }
  3985. const allFields = Object.create(null);
  3986. const fieldPromises = new Map();
  3987. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3988. this._collectFieldObjects("", fieldRef, fieldPromises);
  3989. }
  3990. const allPromises = [];
  3991. for (const [name, promises] of fieldPromises) {
  3992. allPromises.push(Promise.all(promises).then(fields => {
  3993. fields = fields.filter(field => !!field);
  3994. if (fields.length > 0) {
  3995. allFields[name] = fields;
  3996. }
  3997. }));
  3998. }
  3999. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4000. }
  4001. get hasJSActions() {
  4002. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4003. return (0, _util.shadow)(this, "hasJSActions", promise);
  4004. }
  4005. async _parseHasJSActions() {
  4006. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4007. if (catalogJsActions) {
  4008. return true;
  4009. }
  4010. if (fieldObjects) {
  4011. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4012. }
  4013. return false;
  4014. }
  4015. get calculationOrderIds() {
  4016. const acroForm = this.catalog.acroForm;
  4017. if (!acroForm || !acroForm.has("CO")) {
  4018. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4019. }
  4020. const calculationOrder = acroForm.get("CO");
  4021. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4022. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4023. }
  4024. const ids = [];
  4025. for (const id of calculationOrder) {
  4026. if (id instanceof _primitives.Ref) {
  4027. ids.push(id.toString());
  4028. }
  4029. }
  4030. if (ids.length === 0) {
  4031. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4032. }
  4033. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4034. }
  4035. }
  4036. exports.PDFDocument = PDFDocument;
  4037. /***/ }),
  4038. /* 12 */
  4039. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4040. Object.defineProperty(exports, "__esModule", ({
  4041. value: true
  4042. }));
  4043. exports.getXfaFontDict = getXfaFontDict;
  4044. exports.getXfaFontName = getXfaFontName;
  4045. var _calibri_factors = __w_pdfjs_require__(13);
  4046. var _primitives = __w_pdfjs_require__(5);
  4047. var _helvetica_factors = __w_pdfjs_require__(14);
  4048. var _liberationsans_widths = __w_pdfjs_require__(15);
  4049. var _myriadpro_factors = __w_pdfjs_require__(16);
  4050. var _segoeui_factors = __w_pdfjs_require__(17);
  4051. var _core_utils = __w_pdfjs_require__(8);
  4052. var _fonts_utils = __w_pdfjs_require__(18);
  4053. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  4054. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  4055. name: "LiberationSans-Regular",
  4056. factors: _myriadpro_factors.MyriadProRegularFactors,
  4057. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4058. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4059. metrics: _myriadpro_factors.MyriadProRegularMetrics
  4060. };
  4061. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  4062. name: "LiberationSans-Bold",
  4063. factors: _myriadpro_factors.MyriadProBoldFactors,
  4064. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4065. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4066. metrics: _myriadpro_factors.MyriadProBoldMetrics
  4067. };
  4068. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  4069. name: "LiberationSans-Italic",
  4070. factors: _myriadpro_factors.MyriadProItalicFactors,
  4071. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4072. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4073. metrics: _myriadpro_factors.MyriadProItalicMetrics
  4074. };
  4075. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  4076. name: "LiberationSans-BoldItalic",
  4077. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  4078. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4079. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4080. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  4081. };
  4082. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  4083. name: "LiberationSans-Regular",
  4084. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4085. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  4086. };
  4087. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  4088. name: "LiberationSans-Bold",
  4089. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4090. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  4091. };
  4092. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  4093. name: "LiberationSans-Italic",
  4094. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4095. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  4096. };
  4097. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  4098. name: "LiberationSans-BoldItalic",
  4099. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4100. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  4101. };
  4102. t["Calibri-Regular"] = {
  4103. name: "LiberationSans-Regular",
  4104. factors: _calibri_factors.CalibriRegularFactors,
  4105. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4106. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4107. metrics: _calibri_factors.CalibriRegularMetrics
  4108. };
  4109. t["Calibri-Bold"] = {
  4110. name: "LiberationSans-Bold",
  4111. factors: _calibri_factors.CalibriBoldFactors,
  4112. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4113. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4114. metrics: _calibri_factors.CalibriBoldMetrics
  4115. };
  4116. t["Calibri-Italic"] = {
  4117. name: "LiberationSans-Italic",
  4118. factors: _calibri_factors.CalibriItalicFactors,
  4119. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4120. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4121. metrics: _calibri_factors.CalibriItalicMetrics
  4122. };
  4123. t["Calibri-BoldItalic"] = {
  4124. name: "LiberationSans-BoldItalic",
  4125. factors: _calibri_factors.CalibriBoldItalicFactors,
  4126. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4127. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4128. metrics: _calibri_factors.CalibriBoldItalicMetrics
  4129. };
  4130. t["Segoeui-Regular"] = {
  4131. name: "LiberationSans-Regular",
  4132. factors: _segoeui_factors.SegoeuiRegularFactors,
  4133. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4134. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4135. metrics: _segoeui_factors.SegoeuiRegularMetrics
  4136. };
  4137. t["Segoeui-Bold"] = {
  4138. name: "LiberationSans-Bold",
  4139. factors: _segoeui_factors.SegoeuiBoldFactors,
  4140. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4141. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4142. metrics: _segoeui_factors.SegoeuiBoldMetrics
  4143. };
  4144. t["Segoeui-Italic"] = {
  4145. name: "LiberationSans-Italic",
  4146. factors: _segoeui_factors.SegoeuiItalicFactors,
  4147. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4148. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4149. metrics: _segoeui_factors.SegoeuiItalicMetrics
  4150. };
  4151. t["Segoeui-BoldItalic"] = {
  4152. name: "LiberationSans-BoldItalic",
  4153. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  4154. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4155. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4156. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  4157. };
  4158. t["Helvetica-Regular"] = t.Helvetica = {
  4159. name: "LiberationSans-Regular",
  4160. factors: _helvetica_factors.HelveticaRegularFactors,
  4161. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4162. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4163. metrics: _helvetica_factors.HelveticaRegularMetrics
  4164. };
  4165. t["Helvetica-Bold"] = {
  4166. name: "LiberationSans-Bold",
  4167. factors: _helvetica_factors.HelveticaBoldFactors,
  4168. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4169. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4170. metrics: _helvetica_factors.HelveticaBoldMetrics
  4171. };
  4172. t["Helvetica-Italic"] = {
  4173. name: "LiberationSans-Italic",
  4174. factors: _helvetica_factors.HelveticaItalicFactors,
  4175. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4176. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4177. metrics: _helvetica_factors.HelveticaItalicMetrics
  4178. };
  4179. t["Helvetica-BoldItalic"] = {
  4180. name: "LiberationSans-BoldItalic",
  4181. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  4182. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4183. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4184. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  4185. };
  4186. });
  4187. function getXfaFontName(name) {
  4188. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  4189. const fontMap = getXFAFontMap();
  4190. return fontMap[fontName];
  4191. }
  4192. function getXfaFontWidths(name) {
  4193. const info = getXfaFontName(name);
  4194. if (!info) {
  4195. return null;
  4196. }
  4197. const {
  4198. baseWidths,
  4199. baseMapping,
  4200. factors
  4201. } = info;
  4202. let rescaledBaseWidths;
  4203. if (!factors) {
  4204. rescaledBaseWidths = baseWidths;
  4205. } else {
  4206. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  4207. }
  4208. let currentCode = -2;
  4209. let currentArray;
  4210. const newWidths = [];
  4211. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  4212. if (unicode === -1) {
  4213. continue;
  4214. }
  4215. if (unicode === currentCode + 1) {
  4216. currentArray.push(rescaledBaseWidths[glyphIndex]);
  4217. currentCode += 1;
  4218. } else {
  4219. currentCode = unicode;
  4220. currentArray = [rescaledBaseWidths[glyphIndex]];
  4221. newWidths.push(unicode, currentArray);
  4222. }
  4223. }
  4224. return newWidths;
  4225. }
  4226. function getXfaFontDict(name) {
  4227. const widths = getXfaFontWidths(name);
  4228. const dict = new _primitives.Dict(null);
  4229. dict.set("BaseFont", _primitives.Name.get(name));
  4230. dict.set("Type", _primitives.Name.get("Font"));
  4231. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  4232. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  4233. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  4234. dict.set("W", widths);
  4235. dict.set("FirstChar", widths[0]);
  4236. dict.set("LastChar", widths[widths.length - 2] + widths[widths.length - 1].length - 1);
  4237. const descriptor = new _primitives.Dict(null);
  4238. dict.set("FontDescriptor", descriptor);
  4239. const systemInfo = new _primitives.Dict(null);
  4240. systemInfo.set("Ordering", "Identity");
  4241. systemInfo.set("Registry", "Adobe");
  4242. systemInfo.set("Supplement", 0);
  4243. dict.set("CIDSystemInfo", systemInfo);
  4244. return dict;
  4245. }
  4246. /***/ }),
  4247. /* 13 */
  4248. /***/ ((__unused_webpack_module, exports) => {
  4249. Object.defineProperty(exports, "__esModule", ({
  4250. value: true
  4251. }));
  4252. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  4253. 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];
  4254. exports.CalibriBoldFactors = CalibriBoldFactors;
  4255. const CalibriBoldMetrics = {
  4256. lineHeight: 1.2207,
  4257. lineGap: 0.2207
  4258. };
  4259. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  4260. 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];
  4261. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  4262. const CalibriBoldItalicMetrics = {
  4263. lineHeight: 1.2207,
  4264. lineGap: 0.2207
  4265. };
  4266. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  4267. 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];
  4268. exports.CalibriItalicFactors = CalibriItalicFactors;
  4269. const CalibriItalicMetrics = {
  4270. lineHeight: 1.2207,
  4271. lineGap: 0.2207
  4272. };
  4273. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  4274. 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];
  4275. exports.CalibriRegularFactors = CalibriRegularFactors;
  4276. const CalibriRegularMetrics = {
  4277. lineHeight: 1.2207,
  4278. lineGap: 0.2207
  4279. };
  4280. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  4281. /***/ }),
  4282. /* 14 */
  4283. /***/ ((__unused_webpack_module, exports) => {
  4284. Object.defineProperty(exports, "__esModule", ({
  4285. value: true
  4286. }));
  4287. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  4288. 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];
  4289. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  4290. const HelveticaBoldMetrics = {
  4291. lineHeight: 1.2,
  4292. lineGap: 0.2
  4293. };
  4294. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  4295. 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];
  4296. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  4297. const HelveticaBoldItalicMetrics = {
  4298. lineHeight: 1.35,
  4299. lineGap: 0.2
  4300. };
  4301. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  4302. 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];
  4303. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  4304. const HelveticaItalicMetrics = {
  4305. lineHeight: 1.35,
  4306. lineGap: 0.2
  4307. };
  4308. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  4309. 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];
  4310. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  4311. const HelveticaRegularMetrics = {
  4312. lineHeight: 1.2,
  4313. lineGap: 0.2
  4314. };
  4315. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  4316. /***/ }),
  4317. /* 15 */
  4318. /***/ ((__unused_webpack_module, exports) => {
  4319. Object.defineProperty(exports, "__esModule", ({
  4320. value: true
  4321. }));
  4322. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  4323. 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];
  4324. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  4325. 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];
  4326. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  4327. 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];
  4328. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  4329. 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];
  4330. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  4331. 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];
  4332. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  4333. 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];
  4334. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  4335. 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];
  4336. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  4337. 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];
  4338. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  4339. /***/ }),
  4340. /* 16 */
  4341. /***/ ((__unused_webpack_module, exports) => {
  4342. Object.defineProperty(exports, "__esModule", ({
  4343. value: true
  4344. }));
  4345. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  4346. 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];
  4347. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  4348. const MyriadProBoldMetrics = {
  4349. lineHeight: 1.2,
  4350. lineGap: 0.2
  4351. };
  4352. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  4353. 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];
  4354. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  4355. const MyriadProBoldItalicMetrics = {
  4356. lineHeight: 1.2,
  4357. lineGap: 0.2
  4358. };
  4359. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  4360. 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];
  4361. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  4362. const MyriadProItalicMetrics = {
  4363. lineHeight: 1.2,
  4364. lineGap: 0.2
  4365. };
  4366. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  4367. 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];
  4368. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  4369. const MyriadProRegularMetrics = {
  4370. lineHeight: 1.2,
  4371. lineGap: 0.2
  4372. };
  4373. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  4374. /***/ }),
  4375. /* 17 */
  4376. /***/ ((__unused_webpack_module, exports) => {
  4377. Object.defineProperty(exports, "__esModule", ({
  4378. value: true
  4379. }));
  4380. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  4381. 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];
  4382. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  4383. const SegoeuiBoldMetrics = {
  4384. lineHeight: 1.33008,
  4385. lineGap: 0
  4386. };
  4387. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  4388. 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];
  4389. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  4390. const SegoeuiBoldItalicMetrics = {
  4391. lineHeight: 1.33008,
  4392. lineGap: 0
  4393. };
  4394. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  4395. 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];
  4396. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  4397. const SegoeuiItalicMetrics = {
  4398. lineHeight: 1.33008,
  4399. lineGap: 0
  4400. };
  4401. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  4402. 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];
  4403. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  4404. const SegoeuiRegularMetrics = {
  4405. lineHeight: 1.33008,
  4406. lineGap: 0
  4407. };
  4408. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  4409. /***/ }),
  4410. /* 18 */
  4411. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4412. Object.defineProperty(exports, "__esModule", ({
  4413. value: true
  4414. }));
  4415. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  4416. exports.getFontType = getFontType;
  4417. exports.normalizeFontName = normalizeFontName;
  4418. exports.recoverGlyphName = recoverGlyphName;
  4419. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  4420. var _util = __w_pdfjs_require__(2);
  4421. var _encodings = __w_pdfjs_require__(19);
  4422. var _glyphlist = __w_pdfjs_require__(20);
  4423. var _unicode = __w_pdfjs_require__(21);
  4424. const SEAC_ANALYSIS_ENABLED = true;
  4425. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  4426. const FontFlags = {
  4427. FixedPitch: 1,
  4428. Serif: 2,
  4429. Symbolic: 4,
  4430. Script: 8,
  4431. Nonsymbolic: 32,
  4432. Italic: 64,
  4433. AllCap: 65536,
  4434. SmallCap: 131072,
  4435. ForceBold: 262144
  4436. };
  4437. exports.FontFlags = FontFlags;
  4438. 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"];
  4439. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  4440. function getFontType(type, subtype, isStandardFont = false) {
  4441. switch (type) {
  4442. case "Type1":
  4443. if (isStandardFont) {
  4444. return _util.FontType.TYPE1STANDARD;
  4445. }
  4446. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  4447. case "CIDFontType0":
  4448. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  4449. case "OpenType":
  4450. return _util.FontType.OPENTYPE;
  4451. case "TrueType":
  4452. return _util.FontType.TRUETYPE;
  4453. case "CIDFontType2":
  4454. return _util.FontType.CIDFONTTYPE2;
  4455. case "MMType1":
  4456. return _util.FontType.MMTYPE1;
  4457. case "Type0":
  4458. return _util.FontType.TYPE0;
  4459. default:
  4460. return _util.FontType.UNKNOWN;
  4461. }
  4462. }
  4463. function recoverGlyphName(name, glyphsUnicodeMap) {
  4464. if (glyphsUnicodeMap[name] !== undefined) {
  4465. return name;
  4466. }
  4467. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  4468. if (unicode !== -1) {
  4469. for (const key in glyphsUnicodeMap) {
  4470. if (glyphsUnicodeMap[key] === unicode) {
  4471. return key;
  4472. }
  4473. }
  4474. }
  4475. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  4476. return name;
  4477. }
  4478. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  4479. const charCodeToGlyphId = Object.create(null);
  4480. let glyphId, charCode, baseEncoding;
  4481. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  4482. if (properties.isInternalFont) {
  4483. baseEncoding = builtInEncoding;
  4484. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4485. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4486. if (glyphId >= 0) {
  4487. charCodeToGlyphId[charCode] = glyphId;
  4488. } else {
  4489. charCodeToGlyphId[charCode] = 0;
  4490. }
  4491. }
  4492. } else if (properties.baseEncodingName) {
  4493. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  4494. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4495. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4496. if (glyphId >= 0) {
  4497. charCodeToGlyphId[charCode] = glyphId;
  4498. } else {
  4499. charCodeToGlyphId[charCode] = 0;
  4500. }
  4501. }
  4502. } else if (isSymbolicFont) {
  4503. for (charCode in builtInEncoding) {
  4504. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  4505. }
  4506. } else {
  4507. baseEncoding = _encodings.StandardEncoding;
  4508. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4509. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4510. if (glyphId >= 0) {
  4511. charCodeToGlyphId[charCode] = glyphId;
  4512. } else {
  4513. charCodeToGlyphId[charCode] = 0;
  4514. }
  4515. }
  4516. }
  4517. const differences = properties.differences;
  4518. let glyphsUnicodeMap;
  4519. if (differences) {
  4520. for (charCode in differences) {
  4521. const glyphName = differences[charCode];
  4522. glyphId = glyphNames.indexOf(glyphName);
  4523. if (glyphId === -1) {
  4524. if (!glyphsUnicodeMap) {
  4525. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  4526. }
  4527. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  4528. if (standardGlyphName !== glyphName) {
  4529. glyphId = glyphNames.indexOf(standardGlyphName);
  4530. }
  4531. }
  4532. if (glyphId >= 0) {
  4533. charCodeToGlyphId[charCode] = glyphId;
  4534. } else {
  4535. charCodeToGlyphId[charCode] = 0;
  4536. }
  4537. }
  4538. }
  4539. return charCodeToGlyphId;
  4540. }
  4541. function normalizeFontName(name) {
  4542. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  4543. }
  4544. /***/ }),
  4545. /* 19 */
  4546. /***/ ((__unused_webpack_module, exports) => {
  4547. Object.defineProperty(exports, "__esModule", ({
  4548. value: true
  4549. }));
  4550. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  4551. exports.getEncoding = getEncoding;
  4552. 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"];
  4553. exports.ExpertEncoding = ExpertEncoding;
  4554. 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", "", "", "", ""];
  4555. 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"];
  4556. exports.MacRomanEncoding = MacRomanEncoding;
  4557. 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", "", "", "", ""];
  4558. exports.StandardEncoding = StandardEncoding;
  4559. 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"];
  4560. exports.WinAnsiEncoding = WinAnsiEncoding;
  4561. 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", ""];
  4562. exports.SymbolSetEncoding = SymbolSetEncoding;
  4563. 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", ""];
  4564. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4565. function getEncoding(encodingName) {
  4566. switch (encodingName) {
  4567. case "WinAnsiEncoding":
  4568. return WinAnsiEncoding;
  4569. case "StandardEncoding":
  4570. return StandardEncoding;
  4571. case "MacRomanEncoding":
  4572. return MacRomanEncoding;
  4573. case "SymbolSetEncoding":
  4574. return SymbolSetEncoding;
  4575. case "ZapfDingbatsEncoding":
  4576. return ZapfDingbatsEncoding;
  4577. case "ExpertEncoding":
  4578. return ExpertEncoding;
  4579. case "MacExpertEncoding":
  4580. return MacExpertEncoding;
  4581. default:
  4582. return null;
  4583. }
  4584. }
  4585. /***/ }),
  4586. /* 20 */
  4587. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  4588. __w_pdfjs_require__.r(__webpack_exports__);
  4589. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  4590. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  4591. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  4592. /* harmony export */ });
  4593. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  4594. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  4595. return [
  4596. "A",
  4597. 0x0041,
  4598. "AE",
  4599. 0x00c6,
  4600. "AEacute",
  4601. 0x01fc,
  4602. "AEmacron",
  4603. 0x01e2,
  4604. "AEsmall",
  4605. 0xf7e6,
  4606. "Aacute",
  4607. 0x00c1,
  4608. "Aacutesmall",
  4609. 0xf7e1,
  4610. "Abreve",
  4611. 0x0102,
  4612. "Abreveacute",
  4613. 0x1eae,
  4614. "Abrevecyrillic",
  4615. 0x04d0,
  4616. "Abrevedotbelow",
  4617. 0x1eb6,
  4618. "Abrevegrave",
  4619. 0x1eb0,
  4620. "Abrevehookabove",
  4621. 0x1eb2,
  4622. "Abrevetilde",
  4623. 0x1eb4,
  4624. "Acaron",
  4625. 0x01cd,
  4626. "Acircle",
  4627. 0x24b6,
  4628. "Acircumflex",
  4629. 0x00c2,
  4630. "Acircumflexacute",
  4631. 0x1ea4,
  4632. "Acircumflexdotbelow",
  4633. 0x1eac,
  4634. "Acircumflexgrave",
  4635. 0x1ea6,
  4636. "Acircumflexhookabove",
  4637. 0x1ea8,
  4638. "Acircumflexsmall",
  4639. 0xf7e2,
  4640. "Acircumflextilde",
  4641. 0x1eaa,
  4642. "Acute",
  4643. 0xf6c9,
  4644. "Acutesmall",
  4645. 0xf7b4,
  4646. "Acyrillic",
  4647. 0x0410,
  4648. "Adblgrave",
  4649. 0x0200,
  4650. "Adieresis",
  4651. 0x00c4,
  4652. "Adieresiscyrillic",
  4653. 0x04d2,
  4654. "Adieresismacron",
  4655. 0x01de,
  4656. "Adieresissmall",
  4657. 0xf7e4,
  4658. "Adotbelow",
  4659. 0x1ea0,
  4660. "Adotmacron",
  4661. 0x01e0,
  4662. "Agrave",
  4663. 0x00c0,
  4664. "Agravesmall",
  4665. 0xf7e0,
  4666. "Ahookabove",
  4667. 0x1ea2,
  4668. "Aiecyrillic",
  4669. 0x04d4,
  4670. "Ainvertedbreve",
  4671. 0x0202,
  4672. "Alpha",
  4673. 0x0391,
  4674. "Alphatonos",
  4675. 0x0386,
  4676. "Amacron",
  4677. 0x0100,
  4678. "Amonospace",
  4679. 0xff21,
  4680. "Aogonek",
  4681. 0x0104,
  4682. "Aring",
  4683. 0x00c5,
  4684. "Aringacute",
  4685. 0x01fa,
  4686. "Aringbelow",
  4687. 0x1e00,
  4688. "Aringsmall",
  4689. 0xf7e5,
  4690. "Asmall",
  4691. 0xf761,
  4692. "Atilde",
  4693. 0x00c3,
  4694. "Atildesmall",
  4695. 0xf7e3,
  4696. "Aybarmenian",
  4697. 0x0531,
  4698. "B",
  4699. 0x0042,
  4700. "Bcircle",
  4701. 0x24b7,
  4702. "Bdotaccent",
  4703. 0x1e02,
  4704. "Bdotbelow",
  4705. 0x1e04,
  4706. "Becyrillic",
  4707. 0x0411,
  4708. "Benarmenian",
  4709. 0x0532,
  4710. "Beta",
  4711. 0x0392,
  4712. "Bhook",
  4713. 0x0181,
  4714. "Blinebelow",
  4715. 0x1e06,
  4716. "Bmonospace",
  4717. 0xff22,
  4718. "Brevesmall",
  4719. 0xf6f4,
  4720. "Bsmall",
  4721. 0xf762,
  4722. "Btopbar",
  4723. 0x0182,
  4724. "C",
  4725. 0x0043,
  4726. "Caarmenian",
  4727. 0x053e,
  4728. "Cacute",
  4729. 0x0106,
  4730. "Caron",
  4731. 0xf6ca,
  4732. "Caronsmall",
  4733. 0xf6f5,
  4734. "Ccaron",
  4735. 0x010c,
  4736. "Ccedilla",
  4737. 0x00c7,
  4738. "Ccedillaacute",
  4739. 0x1e08,
  4740. "Ccedillasmall",
  4741. 0xf7e7,
  4742. "Ccircle",
  4743. 0x24b8,
  4744. "Ccircumflex",
  4745. 0x0108,
  4746. "Cdot",
  4747. 0x010a,
  4748. "Cdotaccent",
  4749. 0x010a,
  4750. "Cedillasmall",
  4751. 0xf7b8,
  4752. "Chaarmenian",
  4753. 0x0549,
  4754. "Cheabkhasiancyrillic",
  4755. 0x04bc,
  4756. "Checyrillic",
  4757. 0x0427,
  4758. "Chedescenderabkhasiancyrillic",
  4759. 0x04be,
  4760. "Chedescendercyrillic",
  4761. 0x04b6,
  4762. "Chedieresiscyrillic",
  4763. 0x04f4,
  4764. "Cheharmenian",
  4765. 0x0543,
  4766. "Chekhakassiancyrillic",
  4767. 0x04cb,
  4768. "Cheverticalstrokecyrillic",
  4769. 0x04b8,
  4770. "Chi",
  4771. 0x03a7,
  4772. "Chook",
  4773. 0x0187,
  4774. "Circumflexsmall",
  4775. 0xf6f6,
  4776. "Cmonospace",
  4777. 0xff23,
  4778. "Coarmenian",
  4779. 0x0551,
  4780. "Csmall",
  4781. 0xf763,
  4782. "D",
  4783. 0x0044,
  4784. "DZ",
  4785. 0x01f1,
  4786. "DZcaron",
  4787. 0x01c4,
  4788. "Daarmenian",
  4789. 0x0534,
  4790. "Dafrican",
  4791. 0x0189,
  4792. "Dcaron",
  4793. 0x010e,
  4794. "Dcedilla",
  4795. 0x1e10,
  4796. "Dcircle",
  4797. 0x24b9,
  4798. "Dcircumflexbelow",
  4799. 0x1e12,
  4800. "Dcroat",
  4801. 0x0110,
  4802. "Ddotaccent",
  4803. 0x1e0a,
  4804. "Ddotbelow",
  4805. 0x1e0c,
  4806. "Decyrillic",
  4807. 0x0414,
  4808. "Deicoptic",
  4809. 0x03ee,
  4810. "Delta",
  4811. 0x2206,
  4812. "Deltagreek",
  4813. 0x0394,
  4814. "Dhook",
  4815. 0x018a,
  4816. "Dieresis",
  4817. 0xf6cb,
  4818. "DieresisAcute",
  4819. 0xf6cc,
  4820. "DieresisGrave",
  4821. 0xf6cd,
  4822. "Dieresissmall",
  4823. 0xf7a8,
  4824. "Digammagreek",
  4825. 0x03dc,
  4826. "Djecyrillic",
  4827. 0x0402,
  4828. "Dlinebelow",
  4829. 0x1e0e,
  4830. "Dmonospace",
  4831. 0xff24,
  4832. "Dotaccentsmall",
  4833. 0xf6f7,
  4834. "Dslash",
  4835. 0x0110,
  4836. "Dsmall",
  4837. 0xf764,
  4838. "Dtopbar",
  4839. 0x018b,
  4840. "Dz",
  4841. 0x01f2,
  4842. "Dzcaron",
  4843. 0x01c5,
  4844. "Dzeabkhasiancyrillic",
  4845. 0x04e0,
  4846. "Dzecyrillic",
  4847. 0x0405,
  4848. "Dzhecyrillic",
  4849. 0x040f,
  4850. "E",
  4851. 0x0045,
  4852. "Eacute",
  4853. 0x00c9,
  4854. "Eacutesmall",
  4855. 0xf7e9,
  4856. "Ebreve",
  4857. 0x0114,
  4858. "Ecaron",
  4859. 0x011a,
  4860. "Ecedillabreve",
  4861. 0x1e1c,
  4862. "Echarmenian",
  4863. 0x0535,
  4864. "Ecircle",
  4865. 0x24ba,
  4866. "Ecircumflex",
  4867. 0x00ca,
  4868. "Ecircumflexacute",
  4869. 0x1ebe,
  4870. "Ecircumflexbelow",
  4871. 0x1e18,
  4872. "Ecircumflexdotbelow",
  4873. 0x1ec6,
  4874. "Ecircumflexgrave",
  4875. 0x1ec0,
  4876. "Ecircumflexhookabove",
  4877. 0x1ec2,
  4878. "Ecircumflexsmall",
  4879. 0xf7ea,
  4880. "Ecircumflextilde",
  4881. 0x1ec4,
  4882. "Ecyrillic",
  4883. 0x0404,
  4884. "Edblgrave",
  4885. 0x0204,
  4886. "Edieresis",
  4887. 0x00cb,
  4888. "Edieresissmall",
  4889. 0xf7eb,
  4890. "Edot",
  4891. 0x0116,
  4892. "Edotaccent",
  4893. 0x0116,
  4894. "Edotbelow",
  4895. 0x1eb8,
  4896. "Efcyrillic",
  4897. 0x0424,
  4898. "Egrave",
  4899. 0x00c8,
  4900. "Egravesmall",
  4901. 0xf7e8,
  4902. "Eharmenian",
  4903. 0x0537,
  4904. "Ehookabove",
  4905. 0x1eba,
  4906. "Eightroman",
  4907. 0x2167,
  4908. "Einvertedbreve",
  4909. 0x0206,
  4910. "Eiotifiedcyrillic",
  4911. 0x0464,
  4912. "Elcyrillic",
  4913. 0x041b,
  4914. "Elevenroman",
  4915. 0x216a,
  4916. "Emacron",
  4917. 0x0112,
  4918. "Emacronacute",
  4919. 0x1e16,
  4920. "Emacrongrave",
  4921. 0x1e14,
  4922. "Emcyrillic",
  4923. 0x041c,
  4924. "Emonospace",
  4925. 0xff25,
  4926. "Encyrillic",
  4927. 0x041d,
  4928. "Endescendercyrillic",
  4929. 0x04a2,
  4930. "Eng",
  4931. 0x014a,
  4932. "Enghecyrillic",
  4933. 0x04a4,
  4934. "Enhookcyrillic",
  4935. 0x04c7,
  4936. "Eogonek",
  4937. 0x0118,
  4938. "Eopen",
  4939. 0x0190,
  4940. "Epsilon",
  4941. 0x0395,
  4942. "Epsilontonos",
  4943. 0x0388,
  4944. "Ercyrillic",
  4945. 0x0420,
  4946. "Ereversed",
  4947. 0x018e,
  4948. "Ereversedcyrillic",
  4949. 0x042d,
  4950. "Escyrillic",
  4951. 0x0421,
  4952. "Esdescendercyrillic",
  4953. 0x04aa,
  4954. "Esh",
  4955. 0x01a9,
  4956. "Esmall",
  4957. 0xf765,
  4958. "Eta",
  4959. 0x0397,
  4960. "Etarmenian",
  4961. 0x0538,
  4962. "Etatonos",
  4963. 0x0389,
  4964. "Eth",
  4965. 0x00d0,
  4966. "Ethsmall",
  4967. 0xf7f0,
  4968. "Etilde",
  4969. 0x1ebc,
  4970. "Etildebelow",
  4971. 0x1e1a,
  4972. "Euro",
  4973. 0x20ac,
  4974. "Ezh",
  4975. 0x01b7,
  4976. "Ezhcaron",
  4977. 0x01ee,
  4978. "Ezhreversed",
  4979. 0x01b8,
  4980. "F",
  4981. 0x0046,
  4982. "Fcircle",
  4983. 0x24bb,
  4984. "Fdotaccent",
  4985. 0x1e1e,
  4986. "Feharmenian",
  4987. 0x0556,
  4988. "Feicoptic",
  4989. 0x03e4,
  4990. "Fhook",
  4991. 0x0191,
  4992. "Fitacyrillic",
  4993. 0x0472,
  4994. "Fiveroman",
  4995. 0x2164,
  4996. "Fmonospace",
  4997. 0xff26,
  4998. "Fourroman",
  4999. 0x2163,
  5000. "Fsmall",
  5001. 0xf766,
  5002. "G",
  5003. 0x0047,
  5004. "GBsquare",
  5005. 0x3387,
  5006. "Gacute",
  5007. 0x01f4,
  5008. "Gamma",
  5009. 0x0393,
  5010. "Gammaafrican",
  5011. 0x0194,
  5012. "Gangiacoptic",
  5013. 0x03ea,
  5014. "Gbreve",
  5015. 0x011e,
  5016. "Gcaron",
  5017. 0x01e6,
  5018. "Gcedilla",
  5019. 0x0122,
  5020. "Gcircle",
  5021. 0x24bc,
  5022. "Gcircumflex",
  5023. 0x011c,
  5024. "Gcommaaccent",
  5025. 0x0122,
  5026. "Gdot",
  5027. 0x0120,
  5028. "Gdotaccent",
  5029. 0x0120,
  5030. "Gecyrillic",
  5031. 0x0413,
  5032. "Ghadarmenian",
  5033. 0x0542,
  5034. "Ghemiddlehookcyrillic",
  5035. 0x0494,
  5036. "Ghestrokecyrillic",
  5037. 0x0492,
  5038. "Gheupturncyrillic",
  5039. 0x0490,
  5040. "Ghook",
  5041. 0x0193,
  5042. "Gimarmenian",
  5043. 0x0533,
  5044. "Gjecyrillic",
  5045. 0x0403,
  5046. "Gmacron",
  5047. 0x1e20,
  5048. "Gmonospace",
  5049. 0xff27,
  5050. "Grave",
  5051. 0xf6ce,
  5052. "Gravesmall",
  5053. 0xf760,
  5054. "Gsmall",
  5055. 0xf767,
  5056. "Gsmallhook",
  5057. 0x029b,
  5058. "Gstroke",
  5059. 0x01e4,
  5060. "H",
  5061. 0x0048,
  5062. "H18533",
  5063. 0x25cf,
  5064. "H18543",
  5065. 0x25aa,
  5066. "H18551",
  5067. 0x25ab,
  5068. "H22073",
  5069. 0x25a1,
  5070. "HPsquare",
  5071. 0x33cb,
  5072. "Haabkhasiancyrillic",
  5073. 0x04a8,
  5074. "Hadescendercyrillic",
  5075. 0x04b2,
  5076. "Hardsigncyrillic",
  5077. 0x042a,
  5078. "Hbar",
  5079. 0x0126,
  5080. "Hbrevebelow",
  5081. 0x1e2a,
  5082. "Hcedilla",
  5083. 0x1e28,
  5084. "Hcircle",
  5085. 0x24bd,
  5086. "Hcircumflex",
  5087. 0x0124,
  5088. "Hdieresis",
  5089. 0x1e26,
  5090. "Hdotaccent",
  5091. 0x1e22,
  5092. "Hdotbelow",
  5093. 0x1e24,
  5094. "Hmonospace",
  5095. 0xff28,
  5096. "Hoarmenian",
  5097. 0x0540,
  5098. "Horicoptic",
  5099. 0x03e8,
  5100. "Hsmall",
  5101. 0xf768,
  5102. "Hungarumlaut",
  5103. 0xf6cf,
  5104. "Hungarumlautsmall",
  5105. 0xf6f8,
  5106. "Hzsquare",
  5107. 0x3390,
  5108. "I",
  5109. 0x0049,
  5110. "IAcyrillic",
  5111. 0x042f,
  5112. "IJ",
  5113. 0x0132,
  5114. "IUcyrillic",
  5115. 0x042e,
  5116. "Iacute",
  5117. 0x00cd,
  5118. "Iacutesmall",
  5119. 0xf7ed,
  5120. "Ibreve",
  5121. 0x012c,
  5122. "Icaron",
  5123. 0x01cf,
  5124. "Icircle",
  5125. 0x24be,
  5126. "Icircumflex",
  5127. 0x00ce,
  5128. "Icircumflexsmall",
  5129. 0xf7ee,
  5130. "Icyrillic",
  5131. 0x0406,
  5132. "Idblgrave",
  5133. 0x0208,
  5134. "Idieresis",
  5135. 0x00cf,
  5136. "Idieresisacute",
  5137. 0x1e2e,
  5138. "Idieresiscyrillic",
  5139. 0x04e4,
  5140. "Idieresissmall",
  5141. 0xf7ef,
  5142. "Idot",
  5143. 0x0130,
  5144. "Idotaccent",
  5145. 0x0130,
  5146. "Idotbelow",
  5147. 0x1eca,
  5148. "Iebrevecyrillic",
  5149. 0x04d6,
  5150. "Iecyrillic",
  5151. 0x0415,
  5152. "Ifraktur",
  5153. 0x2111,
  5154. "Igrave",
  5155. 0x00cc,
  5156. "Igravesmall",
  5157. 0xf7ec,
  5158. "Ihookabove",
  5159. 0x1ec8,
  5160. "Iicyrillic",
  5161. 0x0418,
  5162. "Iinvertedbreve",
  5163. 0x020a,
  5164. "Iishortcyrillic",
  5165. 0x0419,
  5166. "Imacron",
  5167. 0x012a,
  5168. "Imacroncyrillic",
  5169. 0x04e2,
  5170. "Imonospace",
  5171. 0xff29,
  5172. "Iniarmenian",
  5173. 0x053b,
  5174. "Iocyrillic",
  5175. 0x0401,
  5176. "Iogonek",
  5177. 0x012e,
  5178. "Iota",
  5179. 0x0399,
  5180. "Iotaafrican",
  5181. 0x0196,
  5182. "Iotadieresis",
  5183. 0x03aa,
  5184. "Iotatonos",
  5185. 0x038a,
  5186. "Ismall",
  5187. 0xf769,
  5188. "Istroke",
  5189. 0x0197,
  5190. "Itilde",
  5191. 0x0128,
  5192. "Itildebelow",
  5193. 0x1e2c,
  5194. "Izhitsacyrillic",
  5195. 0x0474,
  5196. "Izhitsadblgravecyrillic",
  5197. 0x0476,
  5198. "J",
  5199. 0x004a,
  5200. "Jaarmenian",
  5201. 0x0541,
  5202. "Jcircle",
  5203. 0x24bf,
  5204. "Jcircumflex",
  5205. 0x0134,
  5206. "Jecyrillic",
  5207. 0x0408,
  5208. "Jheharmenian",
  5209. 0x054b,
  5210. "Jmonospace",
  5211. 0xff2a,
  5212. "Jsmall",
  5213. 0xf76a,
  5214. "K",
  5215. 0x004b,
  5216. "KBsquare",
  5217. 0x3385,
  5218. "KKsquare",
  5219. 0x33cd,
  5220. "Kabashkircyrillic",
  5221. 0x04a0,
  5222. "Kacute",
  5223. 0x1e30,
  5224. "Kacyrillic",
  5225. 0x041a,
  5226. "Kadescendercyrillic",
  5227. 0x049a,
  5228. "Kahookcyrillic",
  5229. 0x04c3,
  5230. "Kappa",
  5231. 0x039a,
  5232. "Kastrokecyrillic",
  5233. 0x049e,
  5234. "Kaverticalstrokecyrillic",
  5235. 0x049c,
  5236. "Kcaron",
  5237. 0x01e8,
  5238. "Kcedilla",
  5239. 0x0136,
  5240. "Kcircle",
  5241. 0x24c0,
  5242. "Kcommaaccent",
  5243. 0x0136,
  5244. "Kdotbelow",
  5245. 0x1e32,
  5246. "Keharmenian",
  5247. 0x0554,
  5248. "Kenarmenian",
  5249. 0x053f,
  5250. "Khacyrillic",
  5251. 0x0425,
  5252. "Kheicoptic",
  5253. 0x03e6,
  5254. "Khook",
  5255. 0x0198,
  5256. "Kjecyrillic",
  5257. 0x040c,
  5258. "Klinebelow",
  5259. 0x1e34,
  5260. "Kmonospace",
  5261. 0xff2b,
  5262. "Koppacyrillic",
  5263. 0x0480,
  5264. "Koppagreek",
  5265. 0x03de,
  5266. "Ksicyrillic",
  5267. 0x046e,
  5268. "Ksmall",
  5269. 0xf76b,
  5270. "L",
  5271. 0x004c,
  5272. "LJ",
  5273. 0x01c7,
  5274. "LL",
  5275. 0xf6bf,
  5276. "Lacute",
  5277. 0x0139,
  5278. "Lambda",
  5279. 0x039b,
  5280. "Lcaron",
  5281. 0x013d,
  5282. "Lcedilla",
  5283. 0x013b,
  5284. "Lcircle",
  5285. 0x24c1,
  5286. "Lcircumflexbelow",
  5287. 0x1e3c,
  5288. "Lcommaaccent",
  5289. 0x013b,
  5290. "Ldot",
  5291. 0x013f,
  5292. "Ldotaccent",
  5293. 0x013f,
  5294. "Ldotbelow",
  5295. 0x1e36,
  5296. "Ldotbelowmacron",
  5297. 0x1e38,
  5298. "Liwnarmenian",
  5299. 0x053c,
  5300. "Lj",
  5301. 0x01c8,
  5302. "Ljecyrillic",
  5303. 0x0409,
  5304. "Llinebelow",
  5305. 0x1e3a,
  5306. "Lmonospace",
  5307. 0xff2c,
  5308. "Lslash",
  5309. 0x0141,
  5310. "Lslashsmall",
  5311. 0xf6f9,
  5312. "Lsmall",
  5313. 0xf76c,
  5314. "M",
  5315. 0x004d,
  5316. "MBsquare",
  5317. 0x3386,
  5318. "Macron",
  5319. 0xf6d0,
  5320. "Macronsmall",
  5321. 0xf7af,
  5322. "Macute",
  5323. 0x1e3e,
  5324. "Mcircle",
  5325. 0x24c2,
  5326. "Mdotaccent",
  5327. 0x1e40,
  5328. "Mdotbelow",
  5329. 0x1e42,
  5330. "Menarmenian",
  5331. 0x0544,
  5332. "Mmonospace",
  5333. 0xff2d,
  5334. "Msmall",
  5335. 0xf76d,
  5336. "Mturned",
  5337. 0x019c,
  5338. "Mu",
  5339. 0x039c,
  5340. "N",
  5341. 0x004e,
  5342. "NJ",
  5343. 0x01ca,
  5344. "Nacute",
  5345. 0x0143,
  5346. "Ncaron",
  5347. 0x0147,
  5348. "Ncedilla",
  5349. 0x0145,
  5350. "Ncircle",
  5351. 0x24c3,
  5352. "Ncircumflexbelow",
  5353. 0x1e4a,
  5354. "Ncommaaccent",
  5355. 0x0145,
  5356. "Ndotaccent",
  5357. 0x1e44,
  5358. "Ndotbelow",
  5359. 0x1e46,
  5360. "Nhookleft",
  5361. 0x019d,
  5362. "Nineroman",
  5363. 0x2168,
  5364. "Nj",
  5365. 0x01cb,
  5366. "Njecyrillic",
  5367. 0x040a,
  5368. "Nlinebelow",
  5369. 0x1e48,
  5370. "Nmonospace",
  5371. 0xff2e,
  5372. "Nowarmenian",
  5373. 0x0546,
  5374. "Nsmall",
  5375. 0xf76e,
  5376. "Ntilde",
  5377. 0x00d1,
  5378. "Ntildesmall",
  5379. 0xf7f1,
  5380. "Nu",
  5381. 0x039d,
  5382. "O",
  5383. 0x004f,
  5384. "OE",
  5385. 0x0152,
  5386. "OEsmall",
  5387. 0xf6fa,
  5388. "Oacute",
  5389. 0x00d3,
  5390. "Oacutesmall",
  5391. 0xf7f3,
  5392. "Obarredcyrillic",
  5393. 0x04e8,
  5394. "Obarreddieresiscyrillic",
  5395. 0x04ea,
  5396. "Obreve",
  5397. 0x014e,
  5398. "Ocaron",
  5399. 0x01d1,
  5400. "Ocenteredtilde",
  5401. 0x019f,
  5402. "Ocircle",
  5403. 0x24c4,
  5404. "Ocircumflex",
  5405. 0x00d4,
  5406. "Ocircumflexacute",
  5407. 0x1ed0,
  5408. "Ocircumflexdotbelow",
  5409. 0x1ed8,
  5410. "Ocircumflexgrave",
  5411. 0x1ed2,
  5412. "Ocircumflexhookabove",
  5413. 0x1ed4,
  5414. "Ocircumflexsmall",
  5415. 0xf7f4,
  5416. "Ocircumflextilde",
  5417. 0x1ed6,
  5418. "Ocyrillic",
  5419. 0x041e,
  5420. "Odblacute",
  5421. 0x0150,
  5422. "Odblgrave",
  5423. 0x020c,
  5424. "Odieresis",
  5425. 0x00d6,
  5426. "Odieresiscyrillic",
  5427. 0x04e6,
  5428. "Odieresissmall",
  5429. 0xf7f6,
  5430. "Odotbelow",
  5431. 0x1ecc,
  5432. "Ogoneksmall",
  5433. 0xf6fb,
  5434. "Ograve",
  5435. 0x00d2,
  5436. "Ogravesmall",
  5437. 0xf7f2,
  5438. "Oharmenian",
  5439. 0x0555,
  5440. "Ohm",
  5441. 0x2126,
  5442. "Ohookabove",
  5443. 0x1ece,
  5444. "Ohorn",
  5445. 0x01a0,
  5446. "Ohornacute",
  5447. 0x1eda,
  5448. "Ohorndotbelow",
  5449. 0x1ee2,
  5450. "Ohorngrave",
  5451. 0x1edc,
  5452. "Ohornhookabove",
  5453. 0x1ede,
  5454. "Ohorntilde",
  5455. 0x1ee0,
  5456. "Ohungarumlaut",
  5457. 0x0150,
  5458. "Oi",
  5459. 0x01a2,
  5460. "Oinvertedbreve",
  5461. 0x020e,
  5462. "Omacron",
  5463. 0x014c,
  5464. "Omacronacute",
  5465. 0x1e52,
  5466. "Omacrongrave",
  5467. 0x1e50,
  5468. "Omega",
  5469. 0x2126,
  5470. "Omegacyrillic",
  5471. 0x0460,
  5472. "Omegagreek",
  5473. 0x03a9,
  5474. "Omegaroundcyrillic",
  5475. 0x047a,
  5476. "Omegatitlocyrillic",
  5477. 0x047c,
  5478. "Omegatonos",
  5479. 0x038f,
  5480. "Omicron",
  5481. 0x039f,
  5482. "Omicrontonos",
  5483. 0x038c,
  5484. "Omonospace",
  5485. 0xff2f,
  5486. "Oneroman",
  5487. 0x2160,
  5488. "Oogonek",
  5489. 0x01ea,
  5490. "Oogonekmacron",
  5491. 0x01ec,
  5492. "Oopen",
  5493. 0x0186,
  5494. "Oslash",
  5495. 0x00d8,
  5496. "Oslashacute",
  5497. 0x01fe,
  5498. "Oslashsmall",
  5499. 0xf7f8,
  5500. "Osmall",
  5501. 0xf76f,
  5502. "Ostrokeacute",
  5503. 0x01fe,
  5504. "Otcyrillic",
  5505. 0x047e,
  5506. "Otilde",
  5507. 0x00d5,
  5508. "Otildeacute",
  5509. 0x1e4c,
  5510. "Otildedieresis",
  5511. 0x1e4e,
  5512. "Otildesmall",
  5513. 0xf7f5,
  5514. "P",
  5515. 0x0050,
  5516. "Pacute",
  5517. 0x1e54,
  5518. "Pcircle",
  5519. 0x24c5,
  5520. "Pdotaccent",
  5521. 0x1e56,
  5522. "Pecyrillic",
  5523. 0x041f,
  5524. "Peharmenian",
  5525. 0x054a,
  5526. "Pemiddlehookcyrillic",
  5527. 0x04a6,
  5528. "Phi",
  5529. 0x03a6,
  5530. "Phook",
  5531. 0x01a4,
  5532. "Pi",
  5533. 0x03a0,
  5534. "Piwrarmenian",
  5535. 0x0553,
  5536. "Pmonospace",
  5537. 0xff30,
  5538. "Psi",
  5539. 0x03a8,
  5540. "Psicyrillic",
  5541. 0x0470,
  5542. "Psmall",
  5543. 0xf770,
  5544. "Q",
  5545. 0x0051,
  5546. "Qcircle",
  5547. 0x24c6,
  5548. "Qmonospace",
  5549. 0xff31,
  5550. "Qsmall",
  5551. 0xf771,
  5552. "R",
  5553. 0x0052,
  5554. "Raarmenian",
  5555. 0x054c,
  5556. "Racute",
  5557. 0x0154,
  5558. "Rcaron",
  5559. 0x0158,
  5560. "Rcedilla",
  5561. 0x0156,
  5562. "Rcircle",
  5563. 0x24c7,
  5564. "Rcommaaccent",
  5565. 0x0156,
  5566. "Rdblgrave",
  5567. 0x0210,
  5568. "Rdotaccent",
  5569. 0x1e58,
  5570. "Rdotbelow",
  5571. 0x1e5a,
  5572. "Rdotbelowmacron",
  5573. 0x1e5c,
  5574. "Reharmenian",
  5575. 0x0550,
  5576. "Rfraktur",
  5577. 0x211c,
  5578. "Rho",
  5579. 0x03a1,
  5580. "Ringsmall",
  5581. 0xf6fc,
  5582. "Rinvertedbreve",
  5583. 0x0212,
  5584. "Rlinebelow",
  5585. 0x1e5e,
  5586. "Rmonospace",
  5587. 0xff32,
  5588. "Rsmall",
  5589. 0xf772,
  5590. "Rsmallinverted",
  5591. 0x0281,
  5592. "Rsmallinvertedsuperior",
  5593. 0x02b6,
  5594. "S",
  5595. 0x0053,
  5596. "SF010000",
  5597. 0x250c,
  5598. "SF020000",
  5599. 0x2514,
  5600. "SF030000",
  5601. 0x2510,
  5602. "SF040000",
  5603. 0x2518,
  5604. "SF050000",
  5605. 0x253c,
  5606. "SF060000",
  5607. 0x252c,
  5608. "SF070000",
  5609. 0x2534,
  5610. "SF080000",
  5611. 0x251c,
  5612. "SF090000",
  5613. 0x2524,
  5614. "SF100000",
  5615. 0x2500,
  5616. "SF110000",
  5617. 0x2502,
  5618. "SF190000",
  5619. 0x2561,
  5620. "SF200000",
  5621. 0x2562,
  5622. "SF210000",
  5623. 0x2556,
  5624. "SF220000",
  5625. 0x2555,
  5626. "SF230000",
  5627. 0x2563,
  5628. "SF240000",
  5629. 0x2551,
  5630. "SF250000",
  5631. 0x2557,
  5632. "SF260000",
  5633. 0x255d,
  5634. "SF270000",
  5635. 0x255c,
  5636. "SF280000",
  5637. 0x255b,
  5638. "SF360000",
  5639. 0x255e,
  5640. "SF370000",
  5641. 0x255f,
  5642. "SF380000",
  5643. 0x255a,
  5644. "SF390000",
  5645. 0x2554,
  5646. "SF400000",
  5647. 0x2569,
  5648. "SF410000",
  5649. 0x2566,
  5650. "SF420000",
  5651. 0x2560,
  5652. "SF430000",
  5653. 0x2550,
  5654. "SF440000",
  5655. 0x256c,
  5656. "SF450000",
  5657. 0x2567,
  5658. "SF460000",
  5659. 0x2568,
  5660. "SF470000",
  5661. 0x2564,
  5662. "SF480000",
  5663. 0x2565,
  5664. "SF490000",
  5665. 0x2559,
  5666. "SF500000",
  5667. 0x2558,
  5668. "SF510000",
  5669. 0x2552,
  5670. "SF520000",
  5671. 0x2553,
  5672. "SF530000",
  5673. 0x256b,
  5674. "SF540000",
  5675. 0x256a,
  5676. "Sacute",
  5677. 0x015a,
  5678. "Sacutedotaccent",
  5679. 0x1e64,
  5680. "Sampigreek",
  5681. 0x03e0,
  5682. "Scaron",
  5683. 0x0160,
  5684. "Scarondotaccent",
  5685. 0x1e66,
  5686. "Scaronsmall",
  5687. 0xf6fd,
  5688. "Scedilla",
  5689. 0x015e,
  5690. "Schwa",
  5691. 0x018f,
  5692. "Schwacyrillic",
  5693. 0x04d8,
  5694. "Schwadieresiscyrillic",
  5695. 0x04da,
  5696. "Scircle",
  5697. 0x24c8,
  5698. "Scircumflex",
  5699. 0x015c,
  5700. "Scommaaccent",
  5701. 0x0218,
  5702. "Sdotaccent",
  5703. 0x1e60,
  5704. "Sdotbelow",
  5705. 0x1e62,
  5706. "Sdotbelowdotaccent",
  5707. 0x1e68,
  5708. "Seharmenian",
  5709. 0x054d,
  5710. "Sevenroman",
  5711. 0x2166,
  5712. "Shaarmenian",
  5713. 0x0547,
  5714. "Shacyrillic",
  5715. 0x0428,
  5716. "Shchacyrillic",
  5717. 0x0429,
  5718. "Sheicoptic",
  5719. 0x03e2,
  5720. "Shhacyrillic",
  5721. 0x04ba,
  5722. "Shimacoptic",
  5723. 0x03ec,
  5724. "Sigma",
  5725. 0x03a3,
  5726. "Sixroman",
  5727. 0x2165,
  5728. "Smonospace",
  5729. 0xff33,
  5730. "Softsigncyrillic",
  5731. 0x042c,
  5732. "Ssmall",
  5733. 0xf773,
  5734. "Stigmagreek",
  5735. 0x03da,
  5736. "T",
  5737. 0x0054,
  5738. "Tau",
  5739. 0x03a4,
  5740. "Tbar",
  5741. 0x0166,
  5742. "Tcaron",
  5743. 0x0164,
  5744. "Tcedilla",
  5745. 0x0162,
  5746. "Tcircle",
  5747. 0x24c9,
  5748. "Tcircumflexbelow",
  5749. 0x1e70,
  5750. "Tcommaaccent",
  5751. 0x0162,
  5752. "Tdotaccent",
  5753. 0x1e6a,
  5754. "Tdotbelow",
  5755. 0x1e6c,
  5756. "Tecyrillic",
  5757. 0x0422,
  5758. "Tedescendercyrillic",
  5759. 0x04ac,
  5760. "Tenroman",
  5761. 0x2169,
  5762. "Tetsecyrillic",
  5763. 0x04b4,
  5764. "Theta",
  5765. 0x0398,
  5766. "Thook",
  5767. 0x01ac,
  5768. "Thorn",
  5769. 0x00de,
  5770. "Thornsmall",
  5771. 0xf7fe,
  5772. "Threeroman",
  5773. 0x2162,
  5774. "Tildesmall",
  5775. 0xf6fe,
  5776. "Tiwnarmenian",
  5777. 0x054f,
  5778. "Tlinebelow",
  5779. 0x1e6e,
  5780. "Tmonospace",
  5781. 0xff34,
  5782. "Toarmenian",
  5783. 0x0539,
  5784. "Tonefive",
  5785. 0x01bc,
  5786. "Tonesix",
  5787. 0x0184,
  5788. "Tonetwo",
  5789. 0x01a7,
  5790. "Tretroflexhook",
  5791. 0x01ae,
  5792. "Tsecyrillic",
  5793. 0x0426,
  5794. "Tshecyrillic",
  5795. 0x040b,
  5796. "Tsmall",
  5797. 0xf774,
  5798. "Twelveroman",
  5799. 0x216b,
  5800. "Tworoman",
  5801. 0x2161,
  5802. "U",
  5803. 0x0055,
  5804. "Uacute",
  5805. 0x00da,
  5806. "Uacutesmall",
  5807. 0xf7fa,
  5808. "Ubreve",
  5809. 0x016c,
  5810. "Ucaron",
  5811. 0x01d3,
  5812. "Ucircle",
  5813. 0x24ca,
  5814. "Ucircumflex",
  5815. 0x00db,
  5816. "Ucircumflexbelow",
  5817. 0x1e76,
  5818. "Ucircumflexsmall",
  5819. 0xf7fb,
  5820. "Ucyrillic",
  5821. 0x0423,
  5822. "Udblacute",
  5823. 0x0170,
  5824. "Udblgrave",
  5825. 0x0214,
  5826. "Udieresis",
  5827. 0x00dc,
  5828. "Udieresisacute",
  5829. 0x01d7,
  5830. "Udieresisbelow",
  5831. 0x1e72,
  5832. "Udieresiscaron",
  5833. 0x01d9,
  5834. "Udieresiscyrillic",
  5835. 0x04f0,
  5836. "Udieresisgrave",
  5837. 0x01db,
  5838. "Udieresismacron",
  5839. 0x01d5,
  5840. "Udieresissmall",
  5841. 0xf7fc,
  5842. "Udotbelow",
  5843. 0x1ee4,
  5844. "Ugrave",
  5845. 0x00d9,
  5846. "Ugravesmall",
  5847. 0xf7f9,
  5848. "Uhookabove",
  5849. 0x1ee6,
  5850. "Uhorn",
  5851. 0x01af,
  5852. "Uhornacute",
  5853. 0x1ee8,
  5854. "Uhorndotbelow",
  5855. 0x1ef0,
  5856. "Uhorngrave",
  5857. 0x1eea,
  5858. "Uhornhookabove",
  5859. 0x1eec,
  5860. "Uhorntilde",
  5861. 0x1eee,
  5862. "Uhungarumlaut",
  5863. 0x0170,
  5864. "Uhungarumlautcyrillic",
  5865. 0x04f2,
  5866. "Uinvertedbreve",
  5867. 0x0216,
  5868. "Ukcyrillic",
  5869. 0x0478,
  5870. "Umacron",
  5871. 0x016a,
  5872. "Umacroncyrillic",
  5873. 0x04ee,
  5874. "Umacrondieresis",
  5875. 0x1e7a,
  5876. "Umonospace",
  5877. 0xff35,
  5878. "Uogonek",
  5879. 0x0172,
  5880. "Upsilon",
  5881. 0x03a5,
  5882. "Upsilon1",
  5883. 0x03d2,
  5884. "Upsilonacutehooksymbolgreek",
  5885. 0x03d3,
  5886. "Upsilonafrican",
  5887. 0x01b1,
  5888. "Upsilondieresis",
  5889. 0x03ab,
  5890. "Upsilondieresishooksymbolgreek",
  5891. 0x03d4,
  5892. "Upsilonhooksymbol",
  5893. 0x03d2,
  5894. "Upsilontonos",
  5895. 0x038e,
  5896. "Uring",
  5897. 0x016e,
  5898. "Ushortcyrillic",
  5899. 0x040e,
  5900. "Usmall",
  5901. 0xf775,
  5902. "Ustraightcyrillic",
  5903. 0x04ae,
  5904. "Ustraightstrokecyrillic",
  5905. 0x04b0,
  5906. "Utilde",
  5907. 0x0168,
  5908. "Utildeacute",
  5909. 0x1e78,
  5910. "Utildebelow",
  5911. 0x1e74,
  5912. "V",
  5913. 0x0056,
  5914. "Vcircle",
  5915. 0x24cb,
  5916. "Vdotbelow",
  5917. 0x1e7e,
  5918. "Vecyrillic",
  5919. 0x0412,
  5920. "Vewarmenian",
  5921. 0x054e,
  5922. "Vhook",
  5923. 0x01b2,
  5924. "Vmonospace",
  5925. 0xff36,
  5926. "Voarmenian",
  5927. 0x0548,
  5928. "Vsmall",
  5929. 0xf776,
  5930. "Vtilde",
  5931. 0x1e7c,
  5932. "W",
  5933. 0x0057,
  5934. "Wacute",
  5935. 0x1e82,
  5936. "Wcircle",
  5937. 0x24cc,
  5938. "Wcircumflex",
  5939. 0x0174,
  5940. "Wdieresis",
  5941. 0x1e84,
  5942. "Wdotaccent",
  5943. 0x1e86,
  5944. "Wdotbelow",
  5945. 0x1e88,
  5946. "Wgrave",
  5947. 0x1e80,
  5948. "Wmonospace",
  5949. 0xff37,
  5950. "Wsmall",
  5951. 0xf777,
  5952. "X",
  5953. 0x0058,
  5954. "Xcircle",
  5955. 0x24cd,
  5956. "Xdieresis",
  5957. 0x1e8c,
  5958. "Xdotaccent",
  5959. 0x1e8a,
  5960. "Xeharmenian",
  5961. 0x053d,
  5962. "Xi",
  5963. 0x039e,
  5964. "Xmonospace",
  5965. 0xff38,
  5966. "Xsmall",
  5967. 0xf778,
  5968. "Y",
  5969. 0x0059,
  5970. "Yacute",
  5971. 0x00dd,
  5972. "Yacutesmall",
  5973. 0xf7fd,
  5974. "Yatcyrillic",
  5975. 0x0462,
  5976. "Ycircle",
  5977. 0x24ce,
  5978. "Ycircumflex",
  5979. 0x0176,
  5980. "Ydieresis",
  5981. 0x0178,
  5982. "Ydieresissmall",
  5983. 0xf7ff,
  5984. "Ydotaccent",
  5985. 0x1e8e,
  5986. "Ydotbelow",
  5987. 0x1ef4,
  5988. "Yericyrillic",
  5989. 0x042b,
  5990. "Yerudieresiscyrillic",
  5991. 0x04f8,
  5992. "Ygrave",
  5993. 0x1ef2,
  5994. "Yhook",
  5995. 0x01b3,
  5996. "Yhookabove",
  5997. 0x1ef6,
  5998. "Yiarmenian",
  5999. 0x0545,
  6000. "Yicyrillic",
  6001. 0x0407,
  6002. "Yiwnarmenian",
  6003. 0x0552,
  6004. "Ymonospace",
  6005. 0xff39,
  6006. "Ysmall",
  6007. 0xf779,
  6008. "Ytilde",
  6009. 0x1ef8,
  6010. "Yusbigcyrillic",
  6011. 0x046a,
  6012. "Yusbigiotifiedcyrillic",
  6013. 0x046c,
  6014. "Yuslittlecyrillic",
  6015. 0x0466,
  6016. "Yuslittleiotifiedcyrillic",
  6017. 0x0468,
  6018. "Z",
  6019. 0x005a,
  6020. "Zaarmenian",
  6021. 0x0536,
  6022. "Zacute",
  6023. 0x0179,
  6024. "Zcaron",
  6025. 0x017d,
  6026. "Zcaronsmall",
  6027. 0xf6ff,
  6028. "Zcircle",
  6029. 0x24cf,
  6030. "Zcircumflex",
  6031. 0x1e90,
  6032. "Zdot",
  6033. 0x017b,
  6034. "Zdotaccent",
  6035. 0x017b,
  6036. "Zdotbelow",
  6037. 0x1e92,
  6038. "Zecyrillic",
  6039. 0x0417,
  6040. "Zedescendercyrillic",
  6041. 0x0498,
  6042. "Zedieresiscyrillic",
  6043. 0x04de,
  6044. "Zeta",
  6045. 0x0396,
  6046. "Zhearmenian",
  6047. 0x053a,
  6048. "Zhebrevecyrillic",
  6049. 0x04c1,
  6050. "Zhecyrillic",
  6051. 0x0416,
  6052. "Zhedescendercyrillic",
  6053. 0x0496,
  6054. "Zhedieresiscyrillic",
  6055. 0x04dc,
  6056. "Zlinebelow",
  6057. 0x1e94,
  6058. "Zmonospace",
  6059. 0xff3a,
  6060. "Zsmall",
  6061. 0xf77a,
  6062. "Zstroke",
  6063. 0x01b5,
  6064. "a",
  6065. 0x0061,
  6066. "aabengali",
  6067. 0x0986,
  6068. "aacute",
  6069. 0x00e1,
  6070. "aadeva",
  6071. 0x0906,
  6072. "aagujarati",
  6073. 0x0a86,
  6074. "aagurmukhi",
  6075. 0x0a06,
  6076. "aamatragurmukhi",
  6077. 0x0a3e,
  6078. "aarusquare",
  6079. 0x3303,
  6080. "aavowelsignbengali",
  6081. 0x09be,
  6082. "aavowelsigndeva",
  6083. 0x093e,
  6084. "aavowelsigngujarati",
  6085. 0x0abe,
  6086. "abbreviationmarkarmenian",
  6087. 0x055f,
  6088. "abbreviationsigndeva",
  6089. 0x0970,
  6090. "abengali",
  6091. 0x0985,
  6092. "abopomofo",
  6093. 0x311a,
  6094. "abreve",
  6095. 0x0103,
  6096. "abreveacute",
  6097. 0x1eaf,
  6098. "abrevecyrillic",
  6099. 0x04d1,
  6100. "abrevedotbelow",
  6101. 0x1eb7,
  6102. "abrevegrave",
  6103. 0x1eb1,
  6104. "abrevehookabove",
  6105. 0x1eb3,
  6106. "abrevetilde",
  6107. 0x1eb5,
  6108. "acaron",
  6109. 0x01ce,
  6110. "acircle",
  6111. 0x24d0,
  6112. "acircumflex",
  6113. 0x00e2,
  6114. "acircumflexacute",
  6115. 0x1ea5,
  6116. "acircumflexdotbelow",
  6117. 0x1ead,
  6118. "acircumflexgrave",
  6119. 0x1ea7,
  6120. "acircumflexhookabove",
  6121. 0x1ea9,
  6122. "acircumflextilde",
  6123. 0x1eab,
  6124. "acute",
  6125. 0x00b4,
  6126. "acutebelowcmb",
  6127. 0x0317,
  6128. "acutecmb",
  6129. 0x0301,
  6130. "acutecomb",
  6131. 0x0301,
  6132. "acutedeva",
  6133. 0x0954,
  6134. "acutelowmod",
  6135. 0x02cf,
  6136. "acutetonecmb",
  6137. 0x0341,
  6138. "acyrillic",
  6139. 0x0430,
  6140. "adblgrave",
  6141. 0x0201,
  6142. "addakgurmukhi",
  6143. 0x0a71,
  6144. "adeva",
  6145. 0x0905,
  6146. "adieresis",
  6147. 0x00e4,
  6148. "adieresiscyrillic",
  6149. 0x04d3,
  6150. "adieresismacron",
  6151. 0x01df,
  6152. "adotbelow",
  6153. 0x1ea1,
  6154. "adotmacron",
  6155. 0x01e1,
  6156. "ae",
  6157. 0x00e6,
  6158. "aeacute",
  6159. 0x01fd,
  6160. "aekorean",
  6161. 0x3150,
  6162. "aemacron",
  6163. 0x01e3,
  6164. "afii00208",
  6165. 0x2015,
  6166. "afii08941",
  6167. 0x20a4,
  6168. "afii10017",
  6169. 0x0410,
  6170. "afii10018",
  6171. 0x0411,
  6172. "afii10019",
  6173. 0x0412,
  6174. "afii10020",
  6175. 0x0413,
  6176. "afii10021",
  6177. 0x0414,
  6178. "afii10022",
  6179. 0x0415,
  6180. "afii10023",
  6181. 0x0401,
  6182. "afii10024",
  6183. 0x0416,
  6184. "afii10025",
  6185. 0x0417,
  6186. "afii10026",
  6187. 0x0418,
  6188. "afii10027",
  6189. 0x0419,
  6190. "afii10028",
  6191. 0x041a,
  6192. "afii10029",
  6193. 0x041b,
  6194. "afii10030",
  6195. 0x041c,
  6196. "afii10031",
  6197. 0x041d,
  6198. "afii10032",
  6199. 0x041e,
  6200. "afii10033",
  6201. 0x041f,
  6202. "afii10034",
  6203. 0x0420,
  6204. "afii10035",
  6205. 0x0421,
  6206. "afii10036",
  6207. 0x0422,
  6208. "afii10037",
  6209. 0x0423,
  6210. "afii10038",
  6211. 0x0424,
  6212. "afii10039",
  6213. 0x0425,
  6214. "afii10040",
  6215. 0x0426,
  6216. "afii10041",
  6217. 0x0427,
  6218. "afii10042",
  6219. 0x0428,
  6220. "afii10043",
  6221. 0x0429,
  6222. "afii10044",
  6223. 0x042a,
  6224. "afii10045",
  6225. 0x042b,
  6226. "afii10046",
  6227. 0x042c,
  6228. "afii10047",
  6229. 0x042d,
  6230. "afii10048",
  6231. 0x042e,
  6232. "afii10049",
  6233. 0x042f,
  6234. "afii10050",
  6235. 0x0490,
  6236. "afii10051",
  6237. 0x0402,
  6238. "afii10052",
  6239. 0x0403,
  6240. "afii10053",
  6241. 0x0404,
  6242. "afii10054",
  6243. 0x0405,
  6244. "afii10055",
  6245. 0x0406,
  6246. "afii10056",
  6247. 0x0407,
  6248. "afii10057",
  6249. 0x0408,
  6250. "afii10058",
  6251. 0x0409,
  6252. "afii10059",
  6253. 0x040a,
  6254. "afii10060",
  6255. 0x040b,
  6256. "afii10061",
  6257. 0x040c,
  6258. "afii10062",
  6259. 0x040e,
  6260. "afii10063",
  6261. 0xf6c4,
  6262. "afii10064",
  6263. 0xf6c5,
  6264. "afii10065",
  6265. 0x0430,
  6266. "afii10066",
  6267. 0x0431,
  6268. "afii10067",
  6269. 0x0432,
  6270. "afii10068",
  6271. 0x0433,
  6272. "afii10069",
  6273. 0x0434,
  6274. "afii10070",
  6275. 0x0435,
  6276. "afii10071",
  6277. 0x0451,
  6278. "afii10072",
  6279. 0x0436,
  6280. "afii10073",
  6281. 0x0437,
  6282. "afii10074",
  6283. 0x0438,
  6284. "afii10075",
  6285. 0x0439,
  6286. "afii10076",
  6287. 0x043a,
  6288. "afii10077",
  6289. 0x043b,
  6290. "afii10078",
  6291. 0x043c,
  6292. "afii10079",
  6293. 0x043d,
  6294. "afii10080",
  6295. 0x043e,
  6296. "afii10081",
  6297. 0x043f,
  6298. "afii10082",
  6299. 0x0440,
  6300. "afii10083",
  6301. 0x0441,
  6302. "afii10084",
  6303. 0x0442,
  6304. "afii10085",
  6305. 0x0443,
  6306. "afii10086",
  6307. 0x0444,
  6308. "afii10087",
  6309. 0x0445,
  6310. "afii10088",
  6311. 0x0446,
  6312. "afii10089",
  6313. 0x0447,
  6314. "afii10090",
  6315. 0x0448,
  6316. "afii10091",
  6317. 0x0449,
  6318. "afii10092",
  6319. 0x044a,
  6320. "afii10093",
  6321. 0x044b,
  6322. "afii10094",
  6323. 0x044c,
  6324. "afii10095",
  6325. 0x044d,
  6326. "afii10096",
  6327. 0x044e,
  6328. "afii10097",
  6329. 0x044f,
  6330. "afii10098",
  6331. 0x0491,
  6332. "afii10099",
  6333. 0x0452,
  6334. "afii10100",
  6335. 0x0453,
  6336. "afii10101",
  6337. 0x0454,
  6338. "afii10102",
  6339. 0x0455,
  6340. "afii10103",
  6341. 0x0456,
  6342. "afii10104",
  6343. 0x0457,
  6344. "afii10105",
  6345. 0x0458,
  6346. "afii10106",
  6347. 0x0459,
  6348. "afii10107",
  6349. 0x045a,
  6350. "afii10108",
  6351. 0x045b,
  6352. "afii10109",
  6353. 0x045c,
  6354. "afii10110",
  6355. 0x045e,
  6356. "afii10145",
  6357. 0x040f,
  6358. "afii10146",
  6359. 0x0462,
  6360. "afii10147",
  6361. 0x0472,
  6362. "afii10148",
  6363. 0x0474,
  6364. "afii10192",
  6365. 0xf6c6,
  6366. "afii10193",
  6367. 0x045f,
  6368. "afii10194",
  6369. 0x0463,
  6370. "afii10195",
  6371. 0x0473,
  6372. "afii10196",
  6373. 0x0475,
  6374. "afii10831",
  6375. 0xf6c7,
  6376. "afii10832",
  6377. 0xf6c8,
  6378. "afii10846",
  6379. 0x04d9,
  6380. "afii299",
  6381. 0x200e,
  6382. "afii300",
  6383. 0x200f,
  6384. "afii301",
  6385. 0x200d,
  6386. "afii57381",
  6387. 0x066a,
  6388. "afii57388",
  6389. 0x060c,
  6390. "afii57392",
  6391. 0x0660,
  6392. "afii57393",
  6393. 0x0661,
  6394. "afii57394",
  6395. 0x0662,
  6396. "afii57395",
  6397. 0x0663,
  6398. "afii57396",
  6399. 0x0664,
  6400. "afii57397",
  6401. 0x0665,
  6402. "afii57398",
  6403. 0x0666,
  6404. "afii57399",
  6405. 0x0667,
  6406. "afii57400",
  6407. 0x0668,
  6408. "afii57401",
  6409. 0x0669,
  6410. "afii57403",
  6411. 0x061b,
  6412. "afii57407",
  6413. 0x061f,
  6414. "afii57409",
  6415. 0x0621,
  6416. "afii57410",
  6417. 0x0622,
  6418. "afii57411",
  6419. 0x0623,
  6420. "afii57412",
  6421. 0x0624,
  6422. "afii57413",
  6423. 0x0625,
  6424. "afii57414",
  6425. 0x0626,
  6426. "afii57415",
  6427. 0x0627,
  6428. "afii57416",
  6429. 0x0628,
  6430. "afii57417",
  6431. 0x0629,
  6432. "afii57418",
  6433. 0x062a,
  6434. "afii57419",
  6435. 0x062b,
  6436. "afii57420",
  6437. 0x062c,
  6438. "afii57421",
  6439. 0x062d,
  6440. "afii57422",
  6441. 0x062e,
  6442. "afii57423",
  6443. 0x062f,
  6444. "afii57424",
  6445. 0x0630,
  6446. "afii57425",
  6447. 0x0631,
  6448. "afii57426",
  6449. 0x0632,
  6450. "afii57427",
  6451. 0x0633,
  6452. "afii57428",
  6453. 0x0634,
  6454. "afii57429",
  6455. 0x0635,
  6456. "afii57430",
  6457. 0x0636,
  6458. "afii57431",
  6459. 0x0637,
  6460. "afii57432",
  6461. 0x0638,
  6462. "afii57433",
  6463. 0x0639,
  6464. "afii57434",
  6465. 0x063a,
  6466. "afii57440",
  6467. 0x0640,
  6468. "afii57441",
  6469. 0x0641,
  6470. "afii57442",
  6471. 0x0642,
  6472. "afii57443",
  6473. 0x0643,
  6474. "afii57444",
  6475. 0x0644,
  6476. "afii57445",
  6477. 0x0645,
  6478. "afii57446",
  6479. 0x0646,
  6480. "afii57448",
  6481. 0x0648,
  6482. "afii57449",
  6483. 0x0649,
  6484. "afii57450",
  6485. 0x064a,
  6486. "afii57451",
  6487. 0x064b,
  6488. "afii57452",
  6489. 0x064c,
  6490. "afii57453",
  6491. 0x064d,
  6492. "afii57454",
  6493. 0x064e,
  6494. "afii57455",
  6495. 0x064f,
  6496. "afii57456",
  6497. 0x0650,
  6498. "afii57457",
  6499. 0x0651,
  6500. "afii57458",
  6501. 0x0652,
  6502. "afii57470",
  6503. 0x0647,
  6504. "afii57505",
  6505. 0x06a4,
  6506. "afii57506",
  6507. 0x067e,
  6508. "afii57507",
  6509. 0x0686,
  6510. "afii57508",
  6511. 0x0698,
  6512. "afii57509",
  6513. 0x06af,
  6514. "afii57511",
  6515. 0x0679,
  6516. "afii57512",
  6517. 0x0688,
  6518. "afii57513",
  6519. 0x0691,
  6520. "afii57514",
  6521. 0x06ba,
  6522. "afii57519",
  6523. 0x06d2,
  6524. "afii57534",
  6525. 0x06d5,
  6526. "afii57636",
  6527. 0x20aa,
  6528. "afii57645",
  6529. 0x05be,
  6530. "afii57658",
  6531. 0x05c3,
  6532. "afii57664",
  6533. 0x05d0,
  6534. "afii57665",
  6535. 0x05d1,
  6536. "afii57666",
  6537. 0x05d2,
  6538. "afii57667",
  6539. 0x05d3,
  6540. "afii57668",
  6541. 0x05d4,
  6542. "afii57669",
  6543. 0x05d5,
  6544. "afii57670",
  6545. 0x05d6,
  6546. "afii57671",
  6547. 0x05d7,
  6548. "afii57672",
  6549. 0x05d8,
  6550. "afii57673",
  6551. 0x05d9,
  6552. "afii57674",
  6553. 0x05da,
  6554. "afii57675",
  6555. 0x05db,
  6556. "afii57676",
  6557. 0x05dc,
  6558. "afii57677",
  6559. 0x05dd,
  6560. "afii57678",
  6561. 0x05de,
  6562. "afii57679",
  6563. 0x05df,
  6564. "afii57680",
  6565. 0x05e0,
  6566. "afii57681",
  6567. 0x05e1,
  6568. "afii57682",
  6569. 0x05e2,
  6570. "afii57683",
  6571. 0x05e3,
  6572. "afii57684",
  6573. 0x05e4,
  6574. "afii57685",
  6575. 0x05e5,
  6576. "afii57686",
  6577. 0x05e6,
  6578. "afii57687",
  6579. 0x05e7,
  6580. "afii57688",
  6581. 0x05e8,
  6582. "afii57689",
  6583. 0x05e9,
  6584. "afii57690",
  6585. 0x05ea,
  6586. "afii57694",
  6587. 0xfb2a,
  6588. "afii57695",
  6589. 0xfb2b,
  6590. "afii57700",
  6591. 0xfb4b,
  6592. "afii57705",
  6593. 0xfb1f,
  6594. "afii57716",
  6595. 0x05f0,
  6596. "afii57717",
  6597. 0x05f1,
  6598. "afii57718",
  6599. 0x05f2,
  6600. "afii57723",
  6601. 0xfb35,
  6602. "afii57793",
  6603. 0x05b4,
  6604. "afii57794",
  6605. 0x05b5,
  6606. "afii57795",
  6607. 0x05b6,
  6608. "afii57796",
  6609. 0x05bb,
  6610. "afii57797",
  6611. 0x05b8,
  6612. "afii57798",
  6613. 0x05b7,
  6614. "afii57799",
  6615. 0x05b0,
  6616. "afii57800",
  6617. 0x05b2,
  6618. "afii57801",
  6619. 0x05b1,
  6620. "afii57802",
  6621. 0x05b3,
  6622. "afii57803",
  6623. 0x05c2,
  6624. "afii57804",
  6625. 0x05c1,
  6626. "afii57806",
  6627. 0x05b9,
  6628. "afii57807",
  6629. 0x05bc,
  6630. "afii57839",
  6631. 0x05bd,
  6632. "afii57841",
  6633. 0x05bf,
  6634. "afii57842",
  6635. 0x05c0,
  6636. "afii57929",
  6637. 0x02bc,
  6638. "afii61248",
  6639. 0x2105,
  6640. "afii61289",
  6641. 0x2113,
  6642. "afii61352",
  6643. 0x2116,
  6644. "afii61573",
  6645. 0x202c,
  6646. "afii61574",
  6647. 0x202d,
  6648. "afii61575",
  6649. 0x202e,
  6650. "afii61664",
  6651. 0x200c,
  6652. "afii63167",
  6653. 0x066d,
  6654. "afii64937",
  6655. 0x02bd,
  6656. "agrave",
  6657. 0x00e0,
  6658. "agujarati",
  6659. 0x0a85,
  6660. "agurmukhi",
  6661. 0x0a05,
  6662. "ahiragana",
  6663. 0x3042,
  6664. "ahookabove",
  6665. 0x1ea3,
  6666. "aibengali",
  6667. 0x0990,
  6668. "aibopomofo",
  6669. 0x311e,
  6670. "aideva",
  6671. 0x0910,
  6672. "aiecyrillic",
  6673. 0x04d5,
  6674. "aigujarati",
  6675. 0x0a90,
  6676. "aigurmukhi",
  6677. 0x0a10,
  6678. "aimatragurmukhi",
  6679. 0x0a48,
  6680. "ainarabic",
  6681. 0x0639,
  6682. "ainfinalarabic",
  6683. 0xfeca,
  6684. "aininitialarabic",
  6685. 0xfecb,
  6686. "ainmedialarabic",
  6687. 0xfecc,
  6688. "ainvertedbreve",
  6689. 0x0203,
  6690. "aivowelsignbengali",
  6691. 0x09c8,
  6692. "aivowelsigndeva",
  6693. 0x0948,
  6694. "aivowelsigngujarati",
  6695. 0x0ac8,
  6696. "akatakana",
  6697. 0x30a2,
  6698. "akatakanahalfwidth",
  6699. 0xff71,
  6700. "akorean",
  6701. 0x314f,
  6702. "alef",
  6703. 0x05d0,
  6704. "alefarabic",
  6705. 0x0627,
  6706. "alefdageshhebrew",
  6707. 0xfb30,
  6708. "aleffinalarabic",
  6709. 0xfe8e,
  6710. "alefhamzaabovearabic",
  6711. 0x0623,
  6712. "alefhamzaabovefinalarabic",
  6713. 0xfe84,
  6714. "alefhamzabelowarabic",
  6715. 0x0625,
  6716. "alefhamzabelowfinalarabic",
  6717. 0xfe88,
  6718. "alefhebrew",
  6719. 0x05d0,
  6720. "aleflamedhebrew",
  6721. 0xfb4f,
  6722. "alefmaddaabovearabic",
  6723. 0x0622,
  6724. "alefmaddaabovefinalarabic",
  6725. 0xfe82,
  6726. "alefmaksuraarabic",
  6727. 0x0649,
  6728. "alefmaksurafinalarabic",
  6729. 0xfef0,
  6730. "alefmaksurainitialarabic",
  6731. 0xfef3,
  6732. "alefmaksuramedialarabic",
  6733. 0xfef4,
  6734. "alefpatahhebrew",
  6735. 0xfb2e,
  6736. "alefqamatshebrew",
  6737. 0xfb2f,
  6738. "aleph",
  6739. 0x2135,
  6740. "allequal",
  6741. 0x224c,
  6742. "alpha",
  6743. 0x03b1,
  6744. "alphatonos",
  6745. 0x03ac,
  6746. "amacron",
  6747. 0x0101,
  6748. "amonospace",
  6749. 0xff41,
  6750. "ampersand",
  6751. 0x0026,
  6752. "ampersandmonospace",
  6753. 0xff06,
  6754. "ampersandsmall",
  6755. 0xf726,
  6756. "amsquare",
  6757. 0x33c2,
  6758. "anbopomofo",
  6759. 0x3122,
  6760. "angbopomofo",
  6761. 0x3124,
  6762. "angbracketleft",
  6763. 0x3008,
  6764. "angbracketright",
  6765. 0x3009,
  6766. "angkhankhuthai",
  6767. 0x0e5a,
  6768. "angle",
  6769. 0x2220,
  6770. "anglebracketleft",
  6771. 0x3008,
  6772. "anglebracketleftvertical",
  6773. 0xfe3f,
  6774. "anglebracketright",
  6775. 0x3009,
  6776. "anglebracketrightvertical",
  6777. 0xfe40,
  6778. "angleleft",
  6779. 0x2329,
  6780. "angleright",
  6781. 0x232a,
  6782. "angstrom",
  6783. 0x212b,
  6784. "anoteleia",
  6785. 0x0387,
  6786. "anudattadeva",
  6787. 0x0952,
  6788. "anusvarabengali",
  6789. 0x0982,
  6790. "anusvaradeva",
  6791. 0x0902,
  6792. "anusvaragujarati",
  6793. 0x0a82,
  6794. "aogonek",
  6795. 0x0105,
  6796. "apaatosquare",
  6797. 0x3300,
  6798. "aparen",
  6799. 0x249c,
  6800. "apostrophearmenian",
  6801. 0x055a,
  6802. "apostrophemod",
  6803. 0x02bc,
  6804. "apple",
  6805. 0xf8ff,
  6806. "approaches",
  6807. 0x2250,
  6808. "approxequal",
  6809. 0x2248,
  6810. "approxequalorimage",
  6811. 0x2252,
  6812. "approximatelyequal",
  6813. 0x2245,
  6814. "araeaekorean",
  6815. 0x318e,
  6816. "araeakorean",
  6817. 0x318d,
  6818. "arc",
  6819. 0x2312,
  6820. "arighthalfring",
  6821. 0x1e9a,
  6822. "aring",
  6823. 0x00e5,
  6824. "aringacute",
  6825. 0x01fb,
  6826. "aringbelow",
  6827. 0x1e01,
  6828. "arrowboth",
  6829. 0x2194,
  6830. "arrowdashdown",
  6831. 0x21e3,
  6832. "arrowdashleft",
  6833. 0x21e0,
  6834. "arrowdashright",
  6835. 0x21e2,
  6836. "arrowdashup",
  6837. 0x21e1,
  6838. "arrowdblboth",
  6839. 0x21d4,
  6840. "arrowdbldown",
  6841. 0x21d3,
  6842. "arrowdblleft",
  6843. 0x21d0,
  6844. "arrowdblright",
  6845. 0x21d2,
  6846. "arrowdblup",
  6847. 0x21d1,
  6848. "arrowdown",
  6849. 0x2193,
  6850. "arrowdownleft",
  6851. 0x2199,
  6852. "arrowdownright",
  6853. 0x2198,
  6854. "arrowdownwhite",
  6855. 0x21e9,
  6856. "arrowheaddownmod",
  6857. 0x02c5,
  6858. "arrowheadleftmod",
  6859. 0x02c2,
  6860. "arrowheadrightmod",
  6861. 0x02c3,
  6862. "arrowheadupmod",
  6863. 0x02c4,
  6864. "arrowhorizex",
  6865. 0xf8e7,
  6866. "arrowleft",
  6867. 0x2190,
  6868. "arrowleftdbl",
  6869. 0x21d0,
  6870. "arrowleftdblstroke",
  6871. 0x21cd,
  6872. "arrowleftoverright",
  6873. 0x21c6,
  6874. "arrowleftwhite",
  6875. 0x21e6,
  6876. "arrowright",
  6877. 0x2192,
  6878. "arrowrightdblstroke",
  6879. 0x21cf,
  6880. "arrowrightheavy",
  6881. 0x279e,
  6882. "arrowrightoverleft",
  6883. 0x21c4,
  6884. "arrowrightwhite",
  6885. 0x21e8,
  6886. "arrowtableft",
  6887. 0x21e4,
  6888. "arrowtabright",
  6889. 0x21e5,
  6890. "arrowup",
  6891. 0x2191,
  6892. "arrowupdn",
  6893. 0x2195,
  6894. "arrowupdnbse",
  6895. 0x21a8,
  6896. "arrowupdownbase",
  6897. 0x21a8,
  6898. "arrowupleft",
  6899. 0x2196,
  6900. "arrowupleftofdown",
  6901. 0x21c5,
  6902. "arrowupright",
  6903. 0x2197,
  6904. "arrowupwhite",
  6905. 0x21e7,
  6906. "arrowvertex",
  6907. 0xf8e6,
  6908. "asciicircum",
  6909. 0x005e,
  6910. "asciicircummonospace",
  6911. 0xff3e,
  6912. "asciitilde",
  6913. 0x007e,
  6914. "asciitildemonospace",
  6915. 0xff5e,
  6916. "ascript",
  6917. 0x0251,
  6918. "ascriptturned",
  6919. 0x0252,
  6920. "asmallhiragana",
  6921. 0x3041,
  6922. "asmallkatakana",
  6923. 0x30a1,
  6924. "asmallkatakanahalfwidth",
  6925. 0xff67,
  6926. "asterisk",
  6927. 0x002a,
  6928. "asteriskaltonearabic",
  6929. 0x066d,
  6930. "asteriskarabic",
  6931. 0x066d,
  6932. "asteriskmath",
  6933. 0x2217,
  6934. "asteriskmonospace",
  6935. 0xff0a,
  6936. "asterisksmall",
  6937. 0xfe61,
  6938. "asterism",
  6939. 0x2042,
  6940. "asuperior",
  6941. 0xf6e9,
  6942. "asymptoticallyequal",
  6943. 0x2243,
  6944. "at",
  6945. 0x0040,
  6946. "atilde",
  6947. 0x00e3,
  6948. "atmonospace",
  6949. 0xff20,
  6950. "atsmall",
  6951. 0xfe6b,
  6952. "aturned",
  6953. 0x0250,
  6954. "aubengali",
  6955. 0x0994,
  6956. "aubopomofo",
  6957. 0x3120,
  6958. "audeva",
  6959. 0x0914,
  6960. "augujarati",
  6961. 0x0a94,
  6962. "augurmukhi",
  6963. 0x0a14,
  6964. "aulengthmarkbengali",
  6965. 0x09d7,
  6966. "aumatragurmukhi",
  6967. 0x0a4c,
  6968. "auvowelsignbengali",
  6969. 0x09cc,
  6970. "auvowelsigndeva",
  6971. 0x094c,
  6972. "auvowelsigngujarati",
  6973. 0x0acc,
  6974. "avagrahadeva",
  6975. 0x093d,
  6976. "aybarmenian",
  6977. 0x0561,
  6978. "ayin",
  6979. 0x05e2,
  6980. "ayinaltonehebrew",
  6981. 0xfb20,
  6982. "ayinhebrew",
  6983. 0x05e2,
  6984. "b",
  6985. 0x0062,
  6986. "babengali",
  6987. 0x09ac,
  6988. "backslash",
  6989. 0x005c,
  6990. "backslashmonospace",
  6991. 0xff3c,
  6992. "badeva",
  6993. 0x092c,
  6994. "bagujarati",
  6995. 0x0aac,
  6996. "bagurmukhi",
  6997. 0x0a2c,
  6998. "bahiragana",
  6999. 0x3070,
  7000. "bahtthai",
  7001. 0x0e3f,
  7002. "bakatakana",
  7003. 0x30d0,
  7004. "bar",
  7005. 0x007c,
  7006. "barmonospace",
  7007. 0xff5c,
  7008. "bbopomofo",
  7009. 0x3105,
  7010. "bcircle",
  7011. 0x24d1,
  7012. "bdotaccent",
  7013. 0x1e03,
  7014. "bdotbelow",
  7015. 0x1e05,
  7016. "beamedsixteenthnotes",
  7017. 0x266c,
  7018. "because",
  7019. 0x2235,
  7020. "becyrillic",
  7021. 0x0431,
  7022. "beharabic",
  7023. 0x0628,
  7024. "behfinalarabic",
  7025. 0xfe90,
  7026. "behinitialarabic",
  7027. 0xfe91,
  7028. "behiragana",
  7029. 0x3079,
  7030. "behmedialarabic",
  7031. 0xfe92,
  7032. "behmeeminitialarabic",
  7033. 0xfc9f,
  7034. "behmeemisolatedarabic",
  7035. 0xfc08,
  7036. "behnoonfinalarabic",
  7037. 0xfc6d,
  7038. "bekatakana",
  7039. 0x30d9,
  7040. "benarmenian",
  7041. 0x0562,
  7042. "bet",
  7043. 0x05d1,
  7044. "beta",
  7045. 0x03b2,
  7046. "betasymbolgreek",
  7047. 0x03d0,
  7048. "betdagesh",
  7049. 0xfb31,
  7050. "betdageshhebrew",
  7051. 0xfb31,
  7052. "bethebrew",
  7053. 0x05d1,
  7054. "betrafehebrew",
  7055. 0xfb4c,
  7056. "bhabengali",
  7057. 0x09ad,
  7058. "bhadeva",
  7059. 0x092d,
  7060. "bhagujarati",
  7061. 0x0aad,
  7062. "bhagurmukhi",
  7063. 0x0a2d,
  7064. "bhook",
  7065. 0x0253,
  7066. "bihiragana",
  7067. 0x3073,
  7068. "bikatakana",
  7069. 0x30d3,
  7070. "bilabialclick",
  7071. 0x0298,
  7072. "bindigurmukhi",
  7073. 0x0a02,
  7074. "birusquare",
  7075. 0x3331,
  7076. "blackcircle",
  7077. 0x25cf,
  7078. "blackdiamond",
  7079. 0x25c6,
  7080. "blackdownpointingtriangle",
  7081. 0x25bc,
  7082. "blackleftpointingpointer",
  7083. 0x25c4,
  7084. "blackleftpointingtriangle",
  7085. 0x25c0,
  7086. "blacklenticularbracketleft",
  7087. 0x3010,
  7088. "blacklenticularbracketleftvertical",
  7089. 0xfe3b,
  7090. "blacklenticularbracketright",
  7091. 0x3011,
  7092. "blacklenticularbracketrightvertical",
  7093. 0xfe3c,
  7094. "blacklowerlefttriangle",
  7095. 0x25e3,
  7096. "blacklowerrighttriangle",
  7097. 0x25e2,
  7098. "blackrectangle",
  7099. 0x25ac,
  7100. "blackrightpointingpointer",
  7101. 0x25ba,
  7102. "blackrightpointingtriangle",
  7103. 0x25b6,
  7104. "blacksmallsquare",
  7105. 0x25aa,
  7106. "blacksmilingface",
  7107. 0x263b,
  7108. "blacksquare",
  7109. 0x25a0,
  7110. "blackstar",
  7111. 0x2605,
  7112. "blackupperlefttriangle",
  7113. 0x25e4,
  7114. "blackupperrighttriangle",
  7115. 0x25e5,
  7116. "blackuppointingsmalltriangle",
  7117. 0x25b4,
  7118. "blackuppointingtriangle",
  7119. 0x25b2,
  7120. "blank",
  7121. 0x2423,
  7122. "blinebelow",
  7123. 0x1e07,
  7124. "block",
  7125. 0x2588,
  7126. "bmonospace",
  7127. 0xff42,
  7128. "bobaimaithai",
  7129. 0x0e1a,
  7130. "bohiragana",
  7131. 0x307c,
  7132. "bokatakana",
  7133. 0x30dc,
  7134. "bparen",
  7135. 0x249d,
  7136. "bqsquare",
  7137. 0x33c3,
  7138. "braceex",
  7139. 0xf8f4,
  7140. "braceleft",
  7141. 0x007b,
  7142. "braceleftbt",
  7143. 0xf8f3,
  7144. "braceleftmid",
  7145. 0xf8f2,
  7146. "braceleftmonospace",
  7147. 0xff5b,
  7148. "braceleftsmall",
  7149. 0xfe5b,
  7150. "bracelefttp",
  7151. 0xf8f1,
  7152. "braceleftvertical",
  7153. 0xfe37,
  7154. "braceright",
  7155. 0x007d,
  7156. "bracerightbt",
  7157. 0xf8fe,
  7158. "bracerightmid",
  7159. 0xf8fd,
  7160. "bracerightmonospace",
  7161. 0xff5d,
  7162. "bracerightsmall",
  7163. 0xfe5c,
  7164. "bracerighttp",
  7165. 0xf8fc,
  7166. "bracerightvertical",
  7167. 0xfe38,
  7168. "bracketleft",
  7169. 0x005b,
  7170. "bracketleftbt",
  7171. 0xf8f0,
  7172. "bracketleftex",
  7173. 0xf8ef,
  7174. "bracketleftmonospace",
  7175. 0xff3b,
  7176. "bracketlefttp",
  7177. 0xf8ee,
  7178. "bracketright",
  7179. 0x005d,
  7180. "bracketrightbt",
  7181. 0xf8fb,
  7182. "bracketrightex",
  7183. 0xf8fa,
  7184. "bracketrightmonospace",
  7185. 0xff3d,
  7186. "bracketrighttp",
  7187. 0xf8f9,
  7188. "breve",
  7189. 0x02d8,
  7190. "brevebelowcmb",
  7191. 0x032e,
  7192. "brevecmb",
  7193. 0x0306,
  7194. "breveinvertedbelowcmb",
  7195. 0x032f,
  7196. "breveinvertedcmb",
  7197. 0x0311,
  7198. "breveinverteddoublecmb",
  7199. 0x0361,
  7200. "bridgebelowcmb",
  7201. 0x032a,
  7202. "bridgeinvertedbelowcmb",
  7203. 0x033a,
  7204. "brokenbar",
  7205. 0x00a6,
  7206. "bstroke",
  7207. 0x0180,
  7208. "bsuperior",
  7209. 0xf6ea,
  7210. "btopbar",
  7211. 0x0183,
  7212. "buhiragana",
  7213. 0x3076,
  7214. "bukatakana",
  7215. 0x30d6,
  7216. "bullet",
  7217. 0x2022,
  7218. "bulletinverse",
  7219. 0x25d8,
  7220. "bulletoperator",
  7221. 0x2219,
  7222. "bullseye",
  7223. 0x25ce,
  7224. "c",
  7225. 0x0063,
  7226. "caarmenian",
  7227. 0x056e,
  7228. "cabengali",
  7229. 0x099a,
  7230. "cacute",
  7231. 0x0107,
  7232. "cadeva",
  7233. 0x091a,
  7234. "cagujarati",
  7235. 0x0a9a,
  7236. "cagurmukhi",
  7237. 0x0a1a,
  7238. "calsquare",
  7239. 0x3388,
  7240. "candrabindubengali",
  7241. 0x0981,
  7242. "candrabinducmb",
  7243. 0x0310,
  7244. "candrabindudeva",
  7245. 0x0901,
  7246. "candrabindugujarati",
  7247. 0x0a81,
  7248. "capslock",
  7249. 0x21ea,
  7250. "careof",
  7251. 0x2105,
  7252. "caron",
  7253. 0x02c7,
  7254. "caronbelowcmb",
  7255. 0x032c,
  7256. "caroncmb",
  7257. 0x030c,
  7258. "carriagereturn",
  7259. 0x21b5,
  7260. "cbopomofo",
  7261. 0x3118,
  7262. "ccaron",
  7263. 0x010d,
  7264. "ccedilla",
  7265. 0x00e7,
  7266. "ccedillaacute",
  7267. 0x1e09,
  7268. "ccircle",
  7269. 0x24d2,
  7270. "ccircumflex",
  7271. 0x0109,
  7272. "ccurl",
  7273. 0x0255,
  7274. "cdot",
  7275. 0x010b,
  7276. "cdotaccent",
  7277. 0x010b,
  7278. "cdsquare",
  7279. 0x33c5,
  7280. "cedilla",
  7281. 0x00b8,
  7282. "cedillacmb",
  7283. 0x0327,
  7284. "cent",
  7285. 0x00a2,
  7286. "centigrade",
  7287. 0x2103,
  7288. "centinferior",
  7289. 0xf6df,
  7290. "centmonospace",
  7291. 0xffe0,
  7292. "centoldstyle",
  7293. 0xf7a2,
  7294. "centsuperior",
  7295. 0xf6e0,
  7296. "chaarmenian",
  7297. 0x0579,
  7298. "chabengali",
  7299. 0x099b,
  7300. "chadeva",
  7301. 0x091b,
  7302. "chagujarati",
  7303. 0x0a9b,
  7304. "chagurmukhi",
  7305. 0x0a1b,
  7306. "chbopomofo",
  7307. 0x3114,
  7308. "cheabkhasiancyrillic",
  7309. 0x04bd,
  7310. "checkmark",
  7311. 0x2713,
  7312. "checyrillic",
  7313. 0x0447,
  7314. "chedescenderabkhasiancyrillic",
  7315. 0x04bf,
  7316. "chedescendercyrillic",
  7317. 0x04b7,
  7318. "chedieresiscyrillic",
  7319. 0x04f5,
  7320. "cheharmenian",
  7321. 0x0573,
  7322. "chekhakassiancyrillic",
  7323. 0x04cc,
  7324. "cheverticalstrokecyrillic",
  7325. 0x04b9,
  7326. "chi",
  7327. 0x03c7,
  7328. "chieuchacirclekorean",
  7329. 0x3277,
  7330. "chieuchaparenkorean",
  7331. 0x3217,
  7332. "chieuchcirclekorean",
  7333. 0x3269,
  7334. "chieuchkorean",
  7335. 0x314a,
  7336. "chieuchparenkorean",
  7337. 0x3209,
  7338. "chochangthai",
  7339. 0x0e0a,
  7340. "chochanthai",
  7341. 0x0e08,
  7342. "chochingthai",
  7343. 0x0e09,
  7344. "chochoethai",
  7345. 0x0e0c,
  7346. "chook",
  7347. 0x0188,
  7348. "cieucacirclekorean",
  7349. 0x3276,
  7350. "cieucaparenkorean",
  7351. 0x3216,
  7352. "cieuccirclekorean",
  7353. 0x3268,
  7354. "cieuckorean",
  7355. 0x3148,
  7356. "cieucparenkorean",
  7357. 0x3208,
  7358. "cieucuparenkorean",
  7359. 0x321c,
  7360. "circle",
  7361. 0x25cb,
  7362. "circlecopyrt",
  7363. 0x00a9,
  7364. "circlemultiply",
  7365. 0x2297,
  7366. "circleot",
  7367. 0x2299,
  7368. "circleplus",
  7369. 0x2295,
  7370. "circlepostalmark",
  7371. 0x3036,
  7372. "circlewithlefthalfblack",
  7373. 0x25d0,
  7374. "circlewithrighthalfblack",
  7375. 0x25d1,
  7376. "circumflex",
  7377. 0x02c6,
  7378. "circumflexbelowcmb",
  7379. 0x032d,
  7380. "circumflexcmb",
  7381. 0x0302,
  7382. "clear",
  7383. 0x2327,
  7384. "clickalveolar",
  7385. 0x01c2,
  7386. "clickdental",
  7387. 0x01c0,
  7388. "clicklateral",
  7389. 0x01c1,
  7390. "clickretroflex",
  7391. 0x01c3,
  7392. "club",
  7393. 0x2663,
  7394. "clubsuitblack",
  7395. 0x2663,
  7396. "clubsuitwhite",
  7397. 0x2667,
  7398. "cmcubedsquare",
  7399. 0x33a4,
  7400. "cmonospace",
  7401. 0xff43,
  7402. "cmsquaredsquare",
  7403. 0x33a0,
  7404. "coarmenian",
  7405. 0x0581,
  7406. "colon",
  7407. 0x003a,
  7408. "colonmonetary",
  7409. 0x20a1,
  7410. "colonmonospace",
  7411. 0xff1a,
  7412. "colonsign",
  7413. 0x20a1,
  7414. "colonsmall",
  7415. 0xfe55,
  7416. "colontriangularhalfmod",
  7417. 0x02d1,
  7418. "colontriangularmod",
  7419. 0x02d0,
  7420. "comma",
  7421. 0x002c,
  7422. "commaabovecmb",
  7423. 0x0313,
  7424. "commaaboverightcmb",
  7425. 0x0315,
  7426. "commaaccent",
  7427. 0xf6c3,
  7428. "commaarabic",
  7429. 0x060c,
  7430. "commaarmenian",
  7431. 0x055d,
  7432. "commainferior",
  7433. 0xf6e1,
  7434. "commamonospace",
  7435. 0xff0c,
  7436. "commareversedabovecmb",
  7437. 0x0314,
  7438. "commareversedmod",
  7439. 0x02bd,
  7440. "commasmall",
  7441. 0xfe50,
  7442. "commasuperior",
  7443. 0xf6e2,
  7444. "commaturnedabovecmb",
  7445. 0x0312,
  7446. "commaturnedmod",
  7447. 0x02bb,
  7448. "compass",
  7449. 0x263c,
  7450. "congruent",
  7451. 0x2245,
  7452. "contourintegral",
  7453. 0x222e,
  7454. "control",
  7455. 0x2303,
  7456. "controlACK",
  7457. 0x0006,
  7458. "controlBEL",
  7459. 0x0007,
  7460. "controlBS",
  7461. 0x0008,
  7462. "controlCAN",
  7463. 0x0018,
  7464. "controlCR",
  7465. 0x000d,
  7466. "controlDC1",
  7467. 0x0011,
  7468. "controlDC2",
  7469. 0x0012,
  7470. "controlDC3",
  7471. 0x0013,
  7472. "controlDC4",
  7473. 0x0014,
  7474. "controlDEL",
  7475. 0x007f,
  7476. "controlDLE",
  7477. 0x0010,
  7478. "controlEM",
  7479. 0x0019,
  7480. "controlENQ",
  7481. 0x0005,
  7482. "controlEOT",
  7483. 0x0004,
  7484. "controlESC",
  7485. 0x001b,
  7486. "controlETB",
  7487. 0x0017,
  7488. "controlETX",
  7489. 0x0003,
  7490. "controlFF",
  7491. 0x000c,
  7492. "controlFS",
  7493. 0x001c,
  7494. "controlGS",
  7495. 0x001d,
  7496. "controlHT",
  7497. 0x0009,
  7498. "controlLF",
  7499. 0x000a,
  7500. "controlNAK",
  7501. 0x0015,
  7502. "controlNULL",
  7503. 0x0000,
  7504. "controlRS",
  7505. 0x001e,
  7506. "controlSI",
  7507. 0x000f,
  7508. "controlSO",
  7509. 0x000e,
  7510. "controlSOT",
  7511. 0x0002,
  7512. "controlSTX",
  7513. 0x0001,
  7514. "controlSUB",
  7515. 0x001a,
  7516. "controlSYN",
  7517. 0x0016,
  7518. "controlUS",
  7519. 0x001f,
  7520. "controlVT",
  7521. 0x000b,
  7522. "copyright",
  7523. 0x00a9,
  7524. "copyrightsans",
  7525. 0xf8e9,
  7526. "copyrightserif",
  7527. 0xf6d9,
  7528. "cornerbracketleft",
  7529. 0x300c,
  7530. "cornerbracketlefthalfwidth",
  7531. 0xff62,
  7532. "cornerbracketleftvertical",
  7533. 0xfe41,
  7534. "cornerbracketright",
  7535. 0x300d,
  7536. "cornerbracketrighthalfwidth",
  7537. 0xff63,
  7538. "cornerbracketrightvertical",
  7539. 0xfe42,
  7540. "corporationsquare",
  7541. 0x337f,
  7542. "cosquare",
  7543. 0x33c7,
  7544. "coverkgsquare",
  7545. 0x33c6,
  7546. "cparen",
  7547. 0x249e,
  7548. "cruzeiro",
  7549. 0x20a2,
  7550. "cstretched",
  7551. 0x0297,
  7552. "curlyand",
  7553. 0x22cf,
  7554. "curlyor",
  7555. 0x22ce,
  7556. "currency",
  7557. 0x00a4,
  7558. "cyrBreve",
  7559. 0xf6d1,
  7560. "cyrFlex",
  7561. 0xf6d2,
  7562. "cyrbreve",
  7563. 0xf6d4,
  7564. "cyrflex",
  7565. 0xf6d5,
  7566. "d",
  7567. 0x0064,
  7568. "daarmenian",
  7569. 0x0564,
  7570. "dabengali",
  7571. 0x09a6,
  7572. "dadarabic",
  7573. 0x0636,
  7574. "dadeva",
  7575. 0x0926,
  7576. "dadfinalarabic",
  7577. 0xfebe,
  7578. "dadinitialarabic",
  7579. 0xfebf,
  7580. "dadmedialarabic",
  7581. 0xfec0,
  7582. "dagesh",
  7583. 0x05bc,
  7584. "dageshhebrew",
  7585. 0x05bc,
  7586. "dagger",
  7587. 0x2020,
  7588. "daggerdbl",
  7589. 0x2021,
  7590. "dagujarati",
  7591. 0x0aa6,
  7592. "dagurmukhi",
  7593. 0x0a26,
  7594. "dahiragana",
  7595. 0x3060,
  7596. "dakatakana",
  7597. 0x30c0,
  7598. "dalarabic",
  7599. 0x062f,
  7600. "dalet",
  7601. 0x05d3,
  7602. "daletdagesh",
  7603. 0xfb33,
  7604. "daletdageshhebrew",
  7605. 0xfb33,
  7606. "dalethebrew",
  7607. 0x05d3,
  7608. "dalfinalarabic",
  7609. 0xfeaa,
  7610. "dammaarabic",
  7611. 0x064f,
  7612. "dammalowarabic",
  7613. 0x064f,
  7614. "dammatanaltonearabic",
  7615. 0x064c,
  7616. "dammatanarabic",
  7617. 0x064c,
  7618. "danda",
  7619. 0x0964,
  7620. "dargahebrew",
  7621. 0x05a7,
  7622. "dargalefthebrew",
  7623. 0x05a7,
  7624. "dasiapneumatacyrilliccmb",
  7625. 0x0485,
  7626. "dblGrave",
  7627. 0xf6d3,
  7628. "dblanglebracketleft",
  7629. 0x300a,
  7630. "dblanglebracketleftvertical",
  7631. 0xfe3d,
  7632. "dblanglebracketright",
  7633. 0x300b,
  7634. "dblanglebracketrightvertical",
  7635. 0xfe3e,
  7636. "dblarchinvertedbelowcmb",
  7637. 0x032b,
  7638. "dblarrowleft",
  7639. 0x21d4,
  7640. "dblarrowright",
  7641. 0x21d2,
  7642. "dbldanda",
  7643. 0x0965,
  7644. "dblgrave",
  7645. 0xf6d6,
  7646. "dblgravecmb",
  7647. 0x030f,
  7648. "dblintegral",
  7649. 0x222c,
  7650. "dbllowline",
  7651. 0x2017,
  7652. "dbllowlinecmb",
  7653. 0x0333,
  7654. "dbloverlinecmb",
  7655. 0x033f,
  7656. "dblprimemod",
  7657. 0x02ba,
  7658. "dblverticalbar",
  7659. 0x2016,
  7660. "dblverticallineabovecmb",
  7661. 0x030e,
  7662. "dbopomofo",
  7663. 0x3109,
  7664. "dbsquare",
  7665. 0x33c8,
  7666. "dcaron",
  7667. 0x010f,
  7668. "dcedilla",
  7669. 0x1e11,
  7670. "dcircle",
  7671. 0x24d3,
  7672. "dcircumflexbelow",
  7673. 0x1e13,
  7674. "dcroat",
  7675. 0x0111,
  7676. "ddabengali",
  7677. 0x09a1,
  7678. "ddadeva",
  7679. 0x0921,
  7680. "ddagujarati",
  7681. 0x0aa1,
  7682. "ddagurmukhi",
  7683. 0x0a21,
  7684. "ddalarabic",
  7685. 0x0688,
  7686. "ddalfinalarabic",
  7687. 0xfb89,
  7688. "dddhadeva",
  7689. 0x095c,
  7690. "ddhabengali",
  7691. 0x09a2,
  7692. "ddhadeva",
  7693. 0x0922,
  7694. "ddhagujarati",
  7695. 0x0aa2,
  7696. "ddhagurmukhi",
  7697. 0x0a22,
  7698. "ddotaccent",
  7699. 0x1e0b,
  7700. "ddotbelow",
  7701. 0x1e0d,
  7702. "decimalseparatorarabic",
  7703. 0x066b,
  7704. "decimalseparatorpersian",
  7705. 0x066b,
  7706. "decyrillic",
  7707. 0x0434,
  7708. "degree",
  7709. 0x00b0,
  7710. "dehihebrew",
  7711. 0x05ad,
  7712. "dehiragana",
  7713. 0x3067,
  7714. "deicoptic",
  7715. 0x03ef,
  7716. "dekatakana",
  7717. 0x30c7,
  7718. "deleteleft",
  7719. 0x232b,
  7720. "deleteright",
  7721. 0x2326,
  7722. "delta",
  7723. 0x03b4,
  7724. "deltaturned",
  7725. 0x018d,
  7726. "denominatorminusonenumeratorbengali",
  7727. 0x09f8,
  7728. "dezh",
  7729. 0x02a4,
  7730. "dhabengali",
  7731. 0x09a7,
  7732. "dhadeva",
  7733. 0x0927,
  7734. "dhagujarati",
  7735. 0x0aa7,
  7736. "dhagurmukhi",
  7737. 0x0a27,
  7738. "dhook",
  7739. 0x0257,
  7740. "dialytikatonos",
  7741. 0x0385,
  7742. "dialytikatonoscmb",
  7743. 0x0344,
  7744. "diamond",
  7745. 0x2666,
  7746. "diamondsuitwhite",
  7747. 0x2662,
  7748. "dieresis",
  7749. 0x00a8,
  7750. "dieresisacute",
  7751. 0xf6d7,
  7752. "dieresisbelowcmb",
  7753. 0x0324,
  7754. "dieresiscmb",
  7755. 0x0308,
  7756. "dieresisgrave",
  7757. 0xf6d8,
  7758. "dieresistonos",
  7759. 0x0385,
  7760. "dihiragana",
  7761. 0x3062,
  7762. "dikatakana",
  7763. 0x30c2,
  7764. "dittomark",
  7765. 0x3003,
  7766. "divide",
  7767. 0x00f7,
  7768. "divides",
  7769. 0x2223,
  7770. "divisionslash",
  7771. 0x2215,
  7772. "djecyrillic",
  7773. 0x0452,
  7774. "dkshade",
  7775. 0x2593,
  7776. "dlinebelow",
  7777. 0x1e0f,
  7778. "dlsquare",
  7779. 0x3397,
  7780. "dmacron",
  7781. 0x0111,
  7782. "dmonospace",
  7783. 0xff44,
  7784. "dnblock",
  7785. 0x2584,
  7786. "dochadathai",
  7787. 0x0e0e,
  7788. "dodekthai",
  7789. 0x0e14,
  7790. "dohiragana",
  7791. 0x3069,
  7792. "dokatakana",
  7793. 0x30c9,
  7794. "dollar",
  7795. 0x0024,
  7796. "dollarinferior",
  7797. 0xf6e3,
  7798. "dollarmonospace",
  7799. 0xff04,
  7800. "dollaroldstyle",
  7801. 0xf724,
  7802. "dollarsmall",
  7803. 0xfe69,
  7804. "dollarsuperior",
  7805. 0xf6e4,
  7806. "dong",
  7807. 0x20ab,
  7808. "dorusquare",
  7809. 0x3326,
  7810. "dotaccent",
  7811. 0x02d9,
  7812. "dotaccentcmb",
  7813. 0x0307,
  7814. "dotbelowcmb",
  7815. 0x0323,
  7816. "dotbelowcomb",
  7817. 0x0323,
  7818. "dotkatakana",
  7819. 0x30fb,
  7820. "dotlessi",
  7821. 0x0131,
  7822. "dotlessj",
  7823. 0xf6be,
  7824. "dotlessjstrokehook",
  7825. 0x0284,
  7826. "dotmath",
  7827. 0x22c5,
  7828. "dottedcircle",
  7829. 0x25cc,
  7830. "doubleyodpatah",
  7831. 0xfb1f,
  7832. "doubleyodpatahhebrew",
  7833. 0xfb1f,
  7834. "downtackbelowcmb",
  7835. 0x031e,
  7836. "downtackmod",
  7837. 0x02d5,
  7838. "dparen",
  7839. 0x249f,
  7840. "dsuperior",
  7841. 0xf6eb,
  7842. "dtail",
  7843. 0x0256,
  7844. "dtopbar",
  7845. 0x018c,
  7846. "duhiragana",
  7847. 0x3065,
  7848. "dukatakana",
  7849. 0x30c5,
  7850. "dz",
  7851. 0x01f3,
  7852. "dzaltone",
  7853. 0x02a3,
  7854. "dzcaron",
  7855. 0x01c6,
  7856. "dzcurl",
  7857. 0x02a5,
  7858. "dzeabkhasiancyrillic",
  7859. 0x04e1,
  7860. "dzecyrillic",
  7861. 0x0455,
  7862. "dzhecyrillic",
  7863. 0x045f,
  7864. "e",
  7865. 0x0065,
  7866. "eacute",
  7867. 0x00e9,
  7868. "earth",
  7869. 0x2641,
  7870. "ebengali",
  7871. 0x098f,
  7872. "ebopomofo",
  7873. 0x311c,
  7874. "ebreve",
  7875. 0x0115,
  7876. "ecandradeva",
  7877. 0x090d,
  7878. "ecandragujarati",
  7879. 0x0a8d,
  7880. "ecandravowelsigndeva",
  7881. 0x0945,
  7882. "ecandravowelsigngujarati",
  7883. 0x0ac5,
  7884. "ecaron",
  7885. 0x011b,
  7886. "ecedillabreve",
  7887. 0x1e1d,
  7888. "echarmenian",
  7889. 0x0565,
  7890. "echyiwnarmenian",
  7891. 0x0587,
  7892. "ecircle",
  7893. 0x24d4,
  7894. "ecircumflex",
  7895. 0x00ea,
  7896. "ecircumflexacute",
  7897. 0x1ebf,
  7898. "ecircumflexbelow",
  7899. 0x1e19,
  7900. "ecircumflexdotbelow",
  7901. 0x1ec7,
  7902. "ecircumflexgrave",
  7903. 0x1ec1,
  7904. "ecircumflexhookabove",
  7905. 0x1ec3,
  7906. "ecircumflextilde",
  7907. 0x1ec5,
  7908. "ecyrillic",
  7909. 0x0454,
  7910. "edblgrave",
  7911. 0x0205,
  7912. "edeva",
  7913. 0x090f,
  7914. "edieresis",
  7915. 0x00eb,
  7916. "edot",
  7917. 0x0117,
  7918. "edotaccent",
  7919. 0x0117,
  7920. "edotbelow",
  7921. 0x1eb9,
  7922. "eegurmukhi",
  7923. 0x0a0f,
  7924. "eematragurmukhi",
  7925. 0x0a47,
  7926. "efcyrillic",
  7927. 0x0444,
  7928. "egrave",
  7929. 0x00e8,
  7930. "egujarati",
  7931. 0x0a8f,
  7932. "eharmenian",
  7933. 0x0567,
  7934. "ehbopomofo",
  7935. 0x311d,
  7936. "ehiragana",
  7937. 0x3048,
  7938. "ehookabove",
  7939. 0x1ebb,
  7940. "eibopomofo",
  7941. 0x311f,
  7942. "eight",
  7943. 0x0038,
  7944. "eightarabic",
  7945. 0x0668,
  7946. "eightbengali",
  7947. 0x09ee,
  7948. "eightcircle",
  7949. 0x2467,
  7950. "eightcircleinversesansserif",
  7951. 0x2791,
  7952. "eightdeva",
  7953. 0x096e,
  7954. "eighteencircle",
  7955. 0x2471,
  7956. "eighteenparen",
  7957. 0x2485,
  7958. "eighteenperiod",
  7959. 0x2499,
  7960. "eightgujarati",
  7961. 0x0aee,
  7962. "eightgurmukhi",
  7963. 0x0a6e,
  7964. "eighthackarabic",
  7965. 0x0668,
  7966. "eighthangzhou",
  7967. 0x3028,
  7968. "eighthnotebeamed",
  7969. 0x266b,
  7970. "eightideographicparen",
  7971. 0x3227,
  7972. "eightinferior",
  7973. 0x2088,
  7974. "eightmonospace",
  7975. 0xff18,
  7976. "eightoldstyle",
  7977. 0xf738,
  7978. "eightparen",
  7979. 0x247b,
  7980. "eightperiod",
  7981. 0x248f,
  7982. "eightpersian",
  7983. 0x06f8,
  7984. "eightroman",
  7985. 0x2177,
  7986. "eightsuperior",
  7987. 0x2078,
  7988. "eightthai",
  7989. 0x0e58,
  7990. "einvertedbreve",
  7991. 0x0207,
  7992. "eiotifiedcyrillic",
  7993. 0x0465,
  7994. "ekatakana",
  7995. 0x30a8,
  7996. "ekatakanahalfwidth",
  7997. 0xff74,
  7998. "ekonkargurmukhi",
  7999. 0x0a74,
  8000. "ekorean",
  8001. 0x3154,
  8002. "elcyrillic",
  8003. 0x043b,
  8004. "element",
  8005. 0x2208,
  8006. "elevencircle",
  8007. 0x246a,
  8008. "elevenparen",
  8009. 0x247e,
  8010. "elevenperiod",
  8011. 0x2492,
  8012. "elevenroman",
  8013. 0x217a,
  8014. "ellipsis",
  8015. 0x2026,
  8016. "ellipsisvertical",
  8017. 0x22ee,
  8018. "emacron",
  8019. 0x0113,
  8020. "emacronacute",
  8021. 0x1e17,
  8022. "emacrongrave",
  8023. 0x1e15,
  8024. "emcyrillic",
  8025. 0x043c,
  8026. "emdash",
  8027. 0x2014,
  8028. "emdashvertical",
  8029. 0xfe31,
  8030. "emonospace",
  8031. 0xff45,
  8032. "emphasismarkarmenian",
  8033. 0x055b,
  8034. "emptyset",
  8035. 0x2205,
  8036. "enbopomofo",
  8037. 0x3123,
  8038. "encyrillic",
  8039. 0x043d,
  8040. "endash",
  8041. 0x2013,
  8042. "endashvertical",
  8043. 0xfe32,
  8044. "endescendercyrillic",
  8045. 0x04a3,
  8046. "eng",
  8047. 0x014b,
  8048. "engbopomofo",
  8049. 0x3125,
  8050. "enghecyrillic",
  8051. 0x04a5,
  8052. "enhookcyrillic",
  8053. 0x04c8,
  8054. "enspace",
  8055. 0x2002,
  8056. "eogonek",
  8057. 0x0119,
  8058. "eokorean",
  8059. 0x3153,
  8060. "eopen",
  8061. 0x025b,
  8062. "eopenclosed",
  8063. 0x029a,
  8064. "eopenreversed",
  8065. 0x025c,
  8066. "eopenreversedclosed",
  8067. 0x025e,
  8068. "eopenreversedhook",
  8069. 0x025d,
  8070. "eparen",
  8071. 0x24a0,
  8072. "epsilon",
  8073. 0x03b5,
  8074. "epsilontonos",
  8075. 0x03ad,
  8076. "equal",
  8077. 0x003d,
  8078. "equalmonospace",
  8079. 0xff1d,
  8080. "equalsmall",
  8081. 0xfe66,
  8082. "equalsuperior",
  8083. 0x207c,
  8084. "equivalence",
  8085. 0x2261,
  8086. "erbopomofo",
  8087. 0x3126,
  8088. "ercyrillic",
  8089. 0x0440,
  8090. "ereversed",
  8091. 0x0258,
  8092. "ereversedcyrillic",
  8093. 0x044d,
  8094. "escyrillic",
  8095. 0x0441,
  8096. "esdescendercyrillic",
  8097. 0x04ab,
  8098. "esh",
  8099. 0x0283,
  8100. "eshcurl",
  8101. 0x0286,
  8102. "eshortdeva",
  8103. 0x090e,
  8104. "eshortvowelsigndeva",
  8105. 0x0946,
  8106. "eshreversedloop",
  8107. 0x01aa,
  8108. "eshsquatreversed",
  8109. 0x0285,
  8110. "esmallhiragana",
  8111. 0x3047,
  8112. "esmallkatakana",
  8113. 0x30a7,
  8114. "esmallkatakanahalfwidth",
  8115. 0xff6a,
  8116. "estimated",
  8117. 0x212e,
  8118. "esuperior",
  8119. 0xf6ec,
  8120. "eta",
  8121. 0x03b7,
  8122. "etarmenian",
  8123. 0x0568,
  8124. "etatonos",
  8125. 0x03ae,
  8126. "eth",
  8127. 0x00f0,
  8128. "etilde",
  8129. 0x1ebd,
  8130. "etildebelow",
  8131. 0x1e1b,
  8132. "etnahtafoukhhebrew",
  8133. 0x0591,
  8134. "etnahtafoukhlefthebrew",
  8135. 0x0591,
  8136. "etnahtahebrew",
  8137. 0x0591,
  8138. "etnahtalefthebrew",
  8139. 0x0591,
  8140. "eturned",
  8141. 0x01dd,
  8142. "eukorean",
  8143. 0x3161,
  8144. "euro",
  8145. 0x20ac,
  8146. "evowelsignbengali",
  8147. 0x09c7,
  8148. "evowelsigndeva",
  8149. 0x0947,
  8150. "evowelsigngujarati",
  8151. 0x0ac7,
  8152. "exclam",
  8153. 0x0021,
  8154. "exclamarmenian",
  8155. 0x055c,
  8156. "exclamdbl",
  8157. 0x203c,
  8158. "exclamdown",
  8159. 0x00a1,
  8160. "exclamdownsmall",
  8161. 0xf7a1,
  8162. "exclammonospace",
  8163. 0xff01,
  8164. "exclamsmall",
  8165. 0xf721,
  8166. "existential",
  8167. 0x2203,
  8168. "ezh",
  8169. 0x0292,
  8170. "ezhcaron",
  8171. 0x01ef,
  8172. "ezhcurl",
  8173. 0x0293,
  8174. "ezhreversed",
  8175. 0x01b9,
  8176. "ezhtail",
  8177. 0x01ba,
  8178. "f",
  8179. 0x0066,
  8180. "fadeva",
  8181. 0x095e,
  8182. "fagurmukhi",
  8183. 0x0a5e,
  8184. "fahrenheit",
  8185. 0x2109,
  8186. "fathaarabic",
  8187. 0x064e,
  8188. "fathalowarabic",
  8189. 0x064e,
  8190. "fathatanarabic",
  8191. 0x064b,
  8192. "fbopomofo",
  8193. 0x3108,
  8194. "fcircle",
  8195. 0x24d5,
  8196. "fdotaccent",
  8197. 0x1e1f,
  8198. "feharabic",
  8199. 0x0641,
  8200. "feharmenian",
  8201. 0x0586,
  8202. "fehfinalarabic",
  8203. 0xfed2,
  8204. "fehinitialarabic",
  8205. 0xfed3,
  8206. "fehmedialarabic",
  8207. 0xfed4,
  8208. "feicoptic",
  8209. 0x03e5,
  8210. "female",
  8211. 0x2640,
  8212. "ff",
  8213. 0xfb00,
  8214. "f_f",
  8215. 0xfb00,
  8216. "ffi",
  8217. 0xfb03,
  8218. "ffl",
  8219. 0xfb04,
  8220. "fi",
  8221. 0xfb01,
  8222. "fifteencircle",
  8223. 0x246e,
  8224. "fifteenparen",
  8225. 0x2482,
  8226. "fifteenperiod",
  8227. 0x2496,
  8228. "figuredash",
  8229. 0x2012,
  8230. "filledbox",
  8231. 0x25a0,
  8232. "filledrect",
  8233. 0x25ac,
  8234. "finalkaf",
  8235. 0x05da,
  8236. "finalkafdagesh",
  8237. 0xfb3a,
  8238. "finalkafdageshhebrew",
  8239. 0xfb3a,
  8240. "finalkafhebrew",
  8241. 0x05da,
  8242. "finalmem",
  8243. 0x05dd,
  8244. "finalmemhebrew",
  8245. 0x05dd,
  8246. "finalnun",
  8247. 0x05df,
  8248. "finalnunhebrew",
  8249. 0x05df,
  8250. "finalpe",
  8251. 0x05e3,
  8252. "finalpehebrew",
  8253. 0x05e3,
  8254. "finaltsadi",
  8255. 0x05e5,
  8256. "finaltsadihebrew",
  8257. 0x05e5,
  8258. "firsttonechinese",
  8259. 0x02c9,
  8260. "fisheye",
  8261. 0x25c9,
  8262. "fitacyrillic",
  8263. 0x0473,
  8264. "five",
  8265. 0x0035,
  8266. "fivearabic",
  8267. 0x0665,
  8268. "fivebengali",
  8269. 0x09eb,
  8270. "fivecircle",
  8271. 0x2464,
  8272. "fivecircleinversesansserif",
  8273. 0x278e,
  8274. "fivedeva",
  8275. 0x096b,
  8276. "fiveeighths",
  8277. 0x215d,
  8278. "fivegujarati",
  8279. 0x0aeb,
  8280. "fivegurmukhi",
  8281. 0x0a6b,
  8282. "fivehackarabic",
  8283. 0x0665,
  8284. "fivehangzhou",
  8285. 0x3025,
  8286. "fiveideographicparen",
  8287. 0x3224,
  8288. "fiveinferior",
  8289. 0x2085,
  8290. "fivemonospace",
  8291. 0xff15,
  8292. "fiveoldstyle",
  8293. 0xf735,
  8294. "fiveparen",
  8295. 0x2478,
  8296. "fiveperiod",
  8297. 0x248c,
  8298. "fivepersian",
  8299. 0x06f5,
  8300. "fiveroman",
  8301. 0x2174,
  8302. "fivesuperior",
  8303. 0x2075,
  8304. "fivethai",
  8305. 0x0e55,
  8306. "fl",
  8307. 0xfb02,
  8308. "florin",
  8309. 0x0192,
  8310. "fmonospace",
  8311. 0xff46,
  8312. "fmsquare",
  8313. 0x3399,
  8314. "fofanthai",
  8315. 0x0e1f,
  8316. "fofathai",
  8317. 0x0e1d,
  8318. "fongmanthai",
  8319. 0x0e4f,
  8320. "forall",
  8321. 0x2200,
  8322. "four",
  8323. 0x0034,
  8324. "fourarabic",
  8325. 0x0664,
  8326. "fourbengali",
  8327. 0x09ea,
  8328. "fourcircle",
  8329. 0x2463,
  8330. "fourcircleinversesansserif",
  8331. 0x278d,
  8332. "fourdeva",
  8333. 0x096a,
  8334. "fourgujarati",
  8335. 0x0aea,
  8336. "fourgurmukhi",
  8337. 0x0a6a,
  8338. "fourhackarabic",
  8339. 0x0664,
  8340. "fourhangzhou",
  8341. 0x3024,
  8342. "fourideographicparen",
  8343. 0x3223,
  8344. "fourinferior",
  8345. 0x2084,
  8346. "fourmonospace",
  8347. 0xff14,
  8348. "fournumeratorbengali",
  8349. 0x09f7,
  8350. "fouroldstyle",
  8351. 0xf734,
  8352. "fourparen",
  8353. 0x2477,
  8354. "fourperiod",
  8355. 0x248b,
  8356. "fourpersian",
  8357. 0x06f4,
  8358. "fourroman",
  8359. 0x2173,
  8360. "foursuperior",
  8361. 0x2074,
  8362. "fourteencircle",
  8363. 0x246d,
  8364. "fourteenparen",
  8365. 0x2481,
  8366. "fourteenperiod",
  8367. 0x2495,
  8368. "fourthai",
  8369. 0x0e54,
  8370. "fourthtonechinese",
  8371. 0x02cb,
  8372. "fparen",
  8373. 0x24a1,
  8374. "fraction",
  8375. 0x2044,
  8376. "franc",
  8377. 0x20a3,
  8378. "g",
  8379. 0x0067,
  8380. "gabengali",
  8381. 0x0997,
  8382. "gacute",
  8383. 0x01f5,
  8384. "gadeva",
  8385. 0x0917,
  8386. "gafarabic",
  8387. 0x06af,
  8388. "gaffinalarabic",
  8389. 0xfb93,
  8390. "gafinitialarabic",
  8391. 0xfb94,
  8392. "gafmedialarabic",
  8393. 0xfb95,
  8394. "gagujarati",
  8395. 0x0a97,
  8396. "gagurmukhi",
  8397. 0x0a17,
  8398. "gahiragana",
  8399. 0x304c,
  8400. "gakatakana",
  8401. 0x30ac,
  8402. "gamma",
  8403. 0x03b3,
  8404. "gammalatinsmall",
  8405. 0x0263,
  8406. "gammasuperior",
  8407. 0x02e0,
  8408. "gangiacoptic",
  8409. 0x03eb,
  8410. "gbopomofo",
  8411. 0x310d,
  8412. "gbreve",
  8413. 0x011f,
  8414. "gcaron",
  8415. 0x01e7,
  8416. "gcedilla",
  8417. 0x0123,
  8418. "gcircle",
  8419. 0x24d6,
  8420. "gcircumflex",
  8421. 0x011d,
  8422. "gcommaaccent",
  8423. 0x0123,
  8424. "gdot",
  8425. 0x0121,
  8426. "gdotaccent",
  8427. 0x0121,
  8428. "gecyrillic",
  8429. 0x0433,
  8430. "gehiragana",
  8431. 0x3052,
  8432. "gekatakana",
  8433. 0x30b2,
  8434. "geometricallyequal",
  8435. 0x2251,
  8436. "gereshaccenthebrew",
  8437. 0x059c,
  8438. "gereshhebrew",
  8439. 0x05f3,
  8440. "gereshmuqdamhebrew",
  8441. 0x059d,
  8442. "germandbls",
  8443. 0x00df,
  8444. "gershayimaccenthebrew",
  8445. 0x059e,
  8446. "gershayimhebrew",
  8447. 0x05f4,
  8448. "getamark",
  8449. 0x3013,
  8450. "ghabengali",
  8451. 0x0998,
  8452. "ghadarmenian",
  8453. 0x0572,
  8454. "ghadeva",
  8455. 0x0918,
  8456. "ghagujarati",
  8457. 0x0a98,
  8458. "ghagurmukhi",
  8459. 0x0a18,
  8460. "ghainarabic",
  8461. 0x063a,
  8462. "ghainfinalarabic",
  8463. 0xfece,
  8464. "ghaininitialarabic",
  8465. 0xfecf,
  8466. "ghainmedialarabic",
  8467. 0xfed0,
  8468. "ghemiddlehookcyrillic",
  8469. 0x0495,
  8470. "ghestrokecyrillic",
  8471. 0x0493,
  8472. "gheupturncyrillic",
  8473. 0x0491,
  8474. "ghhadeva",
  8475. 0x095a,
  8476. "ghhagurmukhi",
  8477. 0x0a5a,
  8478. "ghook",
  8479. 0x0260,
  8480. "ghzsquare",
  8481. 0x3393,
  8482. "gihiragana",
  8483. 0x304e,
  8484. "gikatakana",
  8485. 0x30ae,
  8486. "gimarmenian",
  8487. 0x0563,
  8488. "gimel",
  8489. 0x05d2,
  8490. "gimeldagesh",
  8491. 0xfb32,
  8492. "gimeldageshhebrew",
  8493. 0xfb32,
  8494. "gimelhebrew",
  8495. 0x05d2,
  8496. "gjecyrillic",
  8497. 0x0453,
  8498. "glottalinvertedstroke",
  8499. 0x01be,
  8500. "glottalstop",
  8501. 0x0294,
  8502. "glottalstopinverted",
  8503. 0x0296,
  8504. "glottalstopmod",
  8505. 0x02c0,
  8506. "glottalstopreversed",
  8507. 0x0295,
  8508. "glottalstopreversedmod",
  8509. 0x02c1,
  8510. "glottalstopreversedsuperior",
  8511. 0x02e4,
  8512. "glottalstopstroke",
  8513. 0x02a1,
  8514. "glottalstopstrokereversed",
  8515. 0x02a2,
  8516. "gmacron",
  8517. 0x1e21,
  8518. "gmonospace",
  8519. 0xff47,
  8520. "gohiragana",
  8521. 0x3054,
  8522. "gokatakana",
  8523. 0x30b4,
  8524. "gparen",
  8525. 0x24a2,
  8526. "gpasquare",
  8527. 0x33ac,
  8528. "gradient",
  8529. 0x2207,
  8530. "grave",
  8531. 0x0060,
  8532. "gravebelowcmb",
  8533. 0x0316,
  8534. "gravecmb",
  8535. 0x0300,
  8536. "gravecomb",
  8537. 0x0300,
  8538. "gravedeva",
  8539. 0x0953,
  8540. "gravelowmod",
  8541. 0x02ce,
  8542. "gravemonospace",
  8543. 0xff40,
  8544. "gravetonecmb",
  8545. 0x0340,
  8546. "greater",
  8547. 0x003e,
  8548. "greaterequal",
  8549. 0x2265,
  8550. "greaterequalorless",
  8551. 0x22db,
  8552. "greatermonospace",
  8553. 0xff1e,
  8554. "greaterorequivalent",
  8555. 0x2273,
  8556. "greaterorless",
  8557. 0x2277,
  8558. "greateroverequal",
  8559. 0x2267,
  8560. "greatersmall",
  8561. 0xfe65,
  8562. "gscript",
  8563. 0x0261,
  8564. "gstroke",
  8565. 0x01e5,
  8566. "guhiragana",
  8567. 0x3050,
  8568. "guillemotleft",
  8569. 0x00ab,
  8570. "guillemotright",
  8571. 0x00bb,
  8572. "guilsinglleft",
  8573. 0x2039,
  8574. "guilsinglright",
  8575. 0x203a,
  8576. "gukatakana",
  8577. 0x30b0,
  8578. "guramusquare",
  8579. 0x3318,
  8580. "gysquare",
  8581. 0x33c9,
  8582. "h",
  8583. 0x0068,
  8584. "haabkhasiancyrillic",
  8585. 0x04a9,
  8586. "haaltonearabic",
  8587. 0x06c1,
  8588. "habengali",
  8589. 0x09b9,
  8590. "hadescendercyrillic",
  8591. 0x04b3,
  8592. "hadeva",
  8593. 0x0939,
  8594. "hagujarati",
  8595. 0x0ab9,
  8596. "hagurmukhi",
  8597. 0x0a39,
  8598. "haharabic",
  8599. 0x062d,
  8600. "hahfinalarabic",
  8601. 0xfea2,
  8602. "hahinitialarabic",
  8603. 0xfea3,
  8604. "hahiragana",
  8605. 0x306f,
  8606. "hahmedialarabic",
  8607. 0xfea4,
  8608. "haitusquare",
  8609. 0x332a,
  8610. "hakatakana",
  8611. 0x30cf,
  8612. "hakatakanahalfwidth",
  8613. 0xff8a,
  8614. "halantgurmukhi",
  8615. 0x0a4d,
  8616. "hamzaarabic",
  8617. 0x0621,
  8618. "hamzalowarabic",
  8619. 0x0621,
  8620. "hangulfiller",
  8621. 0x3164,
  8622. "hardsigncyrillic",
  8623. 0x044a,
  8624. "harpoonleftbarbup",
  8625. 0x21bc,
  8626. "harpoonrightbarbup",
  8627. 0x21c0,
  8628. "hasquare",
  8629. 0x33ca,
  8630. "hatafpatah",
  8631. 0x05b2,
  8632. "hatafpatah16",
  8633. 0x05b2,
  8634. "hatafpatah23",
  8635. 0x05b2,
  8636. "hatafpatah2f",
  8637. 0x05b2,
  8638. "hatafpatahhebrew",
  8639. 0x05b2,
  8640. "hatafpatahnarrowhebrew",
  8641. 0x05b2,
  8642. "hatafpatahquarterhebrew",
  8643. 0x05b2,
  8644. "hatafpatahwidehebrew",
  8645. 0x05b2,
  8646. "hatafqamats",
  8647. 0x05b3,
  8648. "hatafqamats1b",
  8649. 0x05b3,
  8650. "hatafqamats28",
  8651. 0x05b3,
  8652. "hatafqamats34",
  8653. 0x05b3,
  8654. "hatafqamatshebrew",
  8655. 0x05b3,
  8656. "hatafqamatsnarrowhebrew",
  8657. 0x05b3,
  8658. "hatafqamatsquarterhebrew",
  8659. 0x05b3,
  8660. "hatafqamatswidehebrew",
  8661. 0x05b3,
  8662. "hatafsegol",
  8663. 0x05b1,
  8664. "hatafsegol17",
  8665. 0x05b1,
  8666. "hatafsegol24",
  8667. 0x05b1,
  8668. "hatafsegol30",
  8669. 0x05b1,
  8670. "hatafsegolhebrew",
  8671. 0x05b1,
  8672. "hatafsegolnarrowhebrew",
  8673. 0x05b1,
  8674. "hatafsegolquarterhebrew",
  8675. 0x05b1,
  8676. "hatafsegolwidehebrew",
  8677. 0x05b1,
  8678. "hbar",
  8679. 0x0127,
  8680. "hbopomofo",
  8681. 0x310f,
  8682. "hbrevebelow",
  8683. 0x1e2b,
  8684. "hcedilla",
  8685. 0x1e29,
  8686. "hcircle",
  8687. 0x24d7,
  8688. "hcircumflex",
  8689. 0x0125,
  8690. "hdieresis",
  8691. 0x1e27,
  8692. "hdotaccent",
  8693. 0x1e23,
  8694. "hdotbelow",
  8695. 0x1e25,
  8696. "he",
  8697. 0x05d4,
  8698. "heart",
  8699. 0x2665,
  8700. "heartsuitblack",
  8701. 0x2665,
  8702. "heartsuitwhite",
  8703. 0x2661,
  8704. "hedagesh",
  8705. 0xfb34,
  8706. "hedageshhebrew",
  8707. 0xfb34,
  8708. "hehaltonearabic",
  8709. 0x06c1,
  8710. "heharabic",
  8711. 0x0647,
  8712. "hehebrew",
  8713. 0x05d4,
  8714. "hehfinalaltonearabic",
  8715. 0xfba7,
  8716. "hehfinalalttwoarabic",
  8717. 0xfeea,
  8718. "hehfinalarabic",
  8719. 0xfeea,
  8720. "hehhamzaabovefinalarabic",
  8721. 0xfba5,
  8722. "hehhamzaaboveisolatedarabic",
  8723. 0xfba4,
  8724. "hehinitialaltonearabic",
  8725. 0xfba8,
  8726. "hehinitialarabic",
  8727. 0xfeeb,
  8728. "hehiragana",
  8729. 0x3078,
  8730. "hehmedialaltonearabic",
  8731. 0xfba9,
  8732. "hehmedialarabic",
  8733. 0xfeec,
  8734. "heiseierasquare",
  8735. 0x337b,
  8736. "hekatakana",
  8737. 0x30d8,
  8738. "hekatakanahalfwidth",
  8739. 0xff8d,
  8740. "hekutaarusquare",
  8741. 0x3336,
  8742. "henghook",
  8743. 0x0267,
  8744. "herutusquare",
  8745. 0x3339,
  8746. "het",
  8747. 0x05d7,
  8748. "hethebrew",
  8749. 0x05d7,
  8750. "hhook",
  8751. 0x0266,
  8752. "hhooksuperior",
  8753. 0x02b1,
  8754. "hieuhacirclekorean",
  8755. 0x327b,
  8756. "hieuhaparenkorean",
  8757. 0x321b,
  8758. "hieuhcirclekorean",
  8759. 0x326d,
  8760. "hieuhkorean",
  8761. 0x314e,
  8762. "hieuhparenkorean",
  8763. 0x320d,
  8764. "hihiragana",
  8765. 0x3072,
  8766. "hikatakana",
  8767. 0x30d2,
  8768. "hikatakanahalfwidth",
  8769. 0xff8b,
  8770. "hiriq",
  8771. 0x05b4,
  8772. "hiriq14",
  8773. 0x05b4,
  8774. "hiriq21",
  8775. 0x05b4,
  8776. "hiriq2d",
  8777. 0x05b4,
  8778. "hiriqhebrew",
  8779. 0x05b4,
  8780. "hiriqnarrowhebrew",
  8781. 0x05b4,
  8782. "hiriqquarterhebrew",
  8783. 0x05b4,
  8784. "hiriqwidehebrew",
  8785. 0x05b4,
  8786. "hlinebelow",
  8787. 0x1e96,
  8788. "hmonospace",
  8789. 0xff48,
  8790. "hoarmenian",
  8791. 0x0570,
  8792. "hohipthai",
  8793. 0x0e2b,
  8794. "hohiragana",
  8795. 0x307b,
  8796. "hokatakana",
  8797. 0x30db,
  8798. "hokatakanahalfwidth",
  8799. 0xff8e,
  8800. "holam",
  8801. 0x05b9,
  8802. "holam19",
  8803. 0x05b9,
  8804. "holam26",
  8805. 0x05b9,
  8806. "holam32",
  8807. 0x05b9,
  8808. "holamhebrew",
  8809. 0x05b9,
  8810. "holamnarrowhebrew",
  8811. 0x05b9,
  8812. "holamquarterhebrew",
  8813. 0x05b9,
  8814. "holamwidehebrew",
  8815. 0x05b9,
  8816. "honokhukthai",
  8817. 0x0e2e,
  8818. "hookabovecomb",
  8819. 0x0309,
  8820. "hookcmb",
  8821. 0x0309,
  8822. "hookpalatalizedbelowcmb",
  8823. 0x0321,
  8824. "hookretroflexbelowcmb",
  8825. 0x0322,
  8826. "hoonsquare",
  8827. 0x3342,
  8828. "horicoptic",
  8829. 0x03e9,
  8830. "horizontalbar",
  8831. 0x2015,
  8832. "horncmb",
  8833. 0x031b,
  8834. "hotsprings",
  8835. 0x2668,
  8836. "house",
  8837. 0x2302,
  8838. "hparen",
  8839. 0x24a3,
  8840. "hsuperior",
  8841. 0x02b0,
  8842. "hturned",
  8843. 0x0265,
  8844. "huhiragana",
  8845. 0x3075,
  8846. "huiitosquare",
  8847. 0x3333,
  8848. "hukatakana",
  8849. 0x30d5,
  8850. "hukatakanahalfwidth",
  8851. 0xff8c,
  8852. "hungarumlaut",
  8853. 0x02dd,
  8854. "hungarumlautcmb",
  8855. 0x030b,
  8856. "hv",
  8857. 0x0195,
  8858. "hyphen",
  8859. 0x002d,
  8860. "hypheninferior",
  8861. 0xf6e5,
  8862. "hyphenmonospace",
  8863. 0xff0d,
  8864. "hyphensmall",
  8865. 0xfe63,
  8866. "hyphensuperior",
  8867. 0xf6e6,
  8868. "hyphentwo",
  8869. 0x2010,
  8870. "i",
  8871. 0x0069,
  8872. "iacute",
  8873. 0x00ed,
  8874. "iacyrillic",
  8875. 0x044f,
  8876. "ibengali",
  8877. 0x0987,
  8878. "ibopomofo",
  8879. 0x3127,
  8880. "ibreve",
  8881. 0x012d,
  8882. "icaron",
  8883. 0x01d0,
  8884. "icircle",
  8885. 0x24d8,
  8886. "icircumflex",
  8887. 0x00ee,
  8888. "icyrillic",
  8889. 0x0456,
  8890. "idblgrave",
  8891. 0x0209,
  8892. "ideographearthcircle",
  8893. 0x328f,
  8894. "ideographfirecircle",
  8895. 0x328b,
  8896. "ideographicallianceparen",
  8897. 0x323f,
  8898. "ideographiccallparen",
  8899. 0x323a,
  8900. "ideographiccentrecircle",
  8901. 0x32a5,
  8902. "ideographicclose",
  8903. 0x3006,
  8904. "ideographiccomma",
  8905. 0x3001,
  8906. "ideographiccommaleft",
  8907. 0xff64,
  8908. "ideographiccongratulationparen",
  8909. 0x3237,
  8910. "ideographiccorrectcircle",
  8911. 0x32a3,
  8912. "ideographicearthparen",
  8913. 0x322f,
  8914. "ideographicenterpriseparen",
  8915. 0x323d,
  8916. "ideographicexcellentcircle",
  8917. 0x329d,
  8918. "ideographicfestivalparen",
  8919. 0x3240,
  8920. "ideographicfinancialcircle",
  8921. 0x3296,
  8922. "ideographicfinancialparen",
  8923. 0x3236,
  8924. "ideographicfireparen",
  8925. 0x322b,
  8926. "ideographichaveparen",
  8927. 0x3232,
  8928. "ideographichighcircle",
  8929. 0x32a4,
  8930. "ideographiciterationmark",
  8931. 0x3005,
  8932. "ideographiclaborcircle",
  8933. 0x3298,
  8934. "ideographiclaborparen",
  8935. 0x3238,
  8936. "ideographicleftcircle",
  8937. 0x32a7,
  8938. "ideographiclowcircle",
  8939. 0x32a6,
  8940. "ideographicmedicinecircle",
  8941. 0x32a9,
  8942. "ideographicmetalparen",
  8943. 0x322e,
  8944. "ideographicmoonparen",
  8945. 0x322a,
  8946. "ideographicnameparen",
  8947. 0x3234,
  8948. "ideographicperiod",
  8949. 0x3002,
  8950. "ideographicprintcircle",
  8951. 0x329e,
  8952. "ideographicreachparen",
  8953. 0x3243,
  8954. "ideographicrepresentparen",
  8955. 0x3239,
  8956. "ideographicresourceparen",
  8957. 0x323e,
  8958. "ideographicrightcircle",
  8959. 0x32a8,
  8960. "ideographicsecretcircle",
  8961. 0x3299,
  8962. "ideographicselfparen",
  8963. 0x3242,
  8964. "ideographicsocietyparen",
  8965. 0x3233,
  8966. "ideographicspace",
  8967. 0x3000,
  8968. "ideographicspecialparen",
  8969. 0x3235,
  8970. "ideographicstockparen",
  8971. 0x3231,
  8972. "ideographicstudyparen",
  8973. 0x323b,
  8974. "ideographicsunparen",
  8975. 0x3230,
  8976. "ideographicsuperviseparen",
  8977. 0x323c,
  8978. "ideographicwaterparen",
  8979. 0x322c,
  8980. "ideographicwoodparen",
  8981. 0x322d,
  8982. "ideographiczero",
  8983. 0x3007,
  8984. "ideographmetalcircle",
  8985. 0x328e,
  8986. "ideographmooncircle",
  8987. 0x328a,
  8988. "ideographnamecircle",
  8989. 0x3294,
  8990. "ideographsuncircle",
  8991. 0x3290,
  8992. "ideographwatercircle",
  8993. 0x328c,
  8994. "ideographwoodcircle",
  8995. 0x328d,
  8996. "ideva",
  8997. 0x0907,
  8998. "idieresis",
  8999. 0x00ef,
  9000. "idieresisacute",
  9001. 0x1e2f,
  9002. "idieresiscyrillic",
  9003. 0x04e5,
  9004. "idotbelow",
  9005. 0x1ecb,
  9006. "iebrevecyrillic",
  9007. 0x04d7,
  9008. "iecyrillic",
  9009. 0x0435,
  9010. "ieungacirclekorean",
  9011. 0x3275,
  9012. "ieungaparenkorean",
  9013. 0x3215,
  9014. "ieungcirclekorean",
  9015. 0x3267,
  9016. "ieungkorean",
  9017. 0x3147,
  9018. "ieungparenkorean",
  9019. 0x3207,
  9020. "igrave",
  9021. 0x00ec,
  9022. "igujarati",
  9023. 0x0a87,
  9024. "igurmukhi",
  9025. 0x0a07,
  9026. "ihiragana",
  9027. 0x3044,
  9028. "ihookabove",
  9029. 0x1ec9,
  9030. "iibengali",
  9031. 0x0988,
  9032. "iicyrillic",
  9033. 0x0438,
  9034. "iideva",
  9035. 0x0908,
  9036. "iigujarati",
  9037. 0x0a88,
  9038. "iigurmukhi",
  9039. 0x0a08,
  9040. "iimatragurmukhi",
  9041. 0x0a40,
  9042. "iinvertedbreve",
  9043. 0x020b,
  9044. "iishortcyrillic",
  9045. 0x0439,
  9046. "iivowelsignbengali",
  9047. 0x09c0,
  9048. "iivowelsigndeva",
  9049. 0x0940,
  9050. "iivowelsigngujarati",
  9051. 0x0ac0,
  9052. "ij",
  9053. 0x0133,
  9054. "ikatakana",
  9055. 0x30a4,
  9056. "ikatakanahalfwidth",
  9057. 0xff72,
  9058. "ikorean",
  9059. 0x3163,
  9060. "ilde",
  9061. 0x02dc,
  9062. "iluyhebrew",
  9063. 0x05ac,
  9064. "imacron",
  9065. 0x012b,
  9066. "imacroncyrillic",
  9067. 0x04e3,
  9068. "imageorapproximatelyequal",
  9069. 0x2253,
  9070. "imatragurmukhi",
  9071. 0x0a3f,
  9072. "imonospace",
  9073. 0xff49,
  9074. "increment",
  9075. 0x2206,
  9076. "infinity",
  9077. 0x221e,
  9078. "iniarmenian",
  9079. 0x056b,
  9080. "integral",
  9081. 0x222b,
  9082. "integralbottom",
  9083. 0x2321,
  9084. "integralbt",
  9085. 0x2321,
  9086. "integralex",
  9087. 0xf8f5,
  9088. "integraltop",
  9089. 0x2320,
  9090. "integraltp",
  9091. 0x2320,
  9092. "intersection",
  9093. 0x2229,
  9094. "intisquare",
  9095. 0x3305,
  9096. "invbullet",
  9097. 0x25d8,
  9098. "invcircle",
  9099. 0x25d9,
  9100. "invsmileface",
  9101. 0x263b,
  9102. "iocyrillic",
  9103. 0x0451,
  9104. "iogonek",
  9105. 0x012f,
  9106. "iota",
  9107. 0x03b9,
  9108. "iotadieresis",
  9109. 0x03ca,
  9110. "iotadieresistonos",
  9111. 0x0390,
  9112. "iotalatin",
  9113. 0x0269,
  9114. "iotatonos",
  9115. 0x03af,
  9116. "iparen",
  9117. 0x24a4,
  9118. "irigurmukhi",
  9119. 0x0a72,
  9120. "ismallhiragana",
  9121. 0x3043,
  9122. "ismallkatakana",
  9123. 0x30a3,
  9124. "ismallkatakanahalfwidth",
  9125. 0xff68,
  9126. "issharbengali",
  9127. 0x09fa,
  9128. "istroke",
  9129. 0x0268,
  9130. "isuperior",
  9131. 0xf6ed,
  9132. "iterationhiragana",
  9133. 0x309d,
  9134. "iterationkatakana",
  9135. 0x30fd,
  9136. "itilde",
  9137. 0x0129,
  9138. "itildebelow",
  9139. 0x1e2d,
  9140. "iubopomofo",
  9141. 0x3129,
  9142. "iucyrillic",
  9143. 0x044e,
  9144. "ivowelsignbengali",
  9145. 0x09bf,
  9146. "ivowelsigndeva",
  9147. 0x093f,
  9148. "ivowelsigngujarati",
  9149. 0x0abf,
  9150. "izhitsacyrillic",
  9151. 0x0475,
  9152. "izhitsadblgravecyrillic",
  9153. 0x0477,
  9154. "j",
  9155. 0x006a,
  9156. "jaarmenian",
  9157. 0x0571,
  9158. "jabengali",
  9159. 0x099c,
  9160. "jadeva",
  9161. 0x091c,
  9162. "jagujarati",
  9163. 0x0a9c,
  9164. "jagurmukhi",
  9165. 0x0a1c,
  9166. "jbopomofo",
  9167. 0x3110,
  9168. "jcaron",
  9169. 0x01f0,
  9170. "jcircle",
  9171. 0x24d9,
  9172. "jcircumflex",
  9173. 0x0135,
  9174. "jcrossedtail",
  9175. 0x029d,
  9176. "jdotlessstroke",
  9177. 0x025f,
  9178. "jecyrillic",
  9179. 0x0458,
  9180. "jeemarabic",
  9181. 0x062c,
  9182. "jeemfinalarabic",
  9183. 0xfe9e,
  9184. "jeeminitialarabic",
  9185. 0xfe9f,
  9186. "jeemmedialarabic",
  9187. 0xfea0,
  9188. "jeharabic",
  9189. 0x0698,
  9190. "jehfinalarabic",
  9191. 0xfb8b,
  9192. "jhabengali",
  9193. 0x099d,
  9194. "jhadeva",
  9195. 0x091d,
  9196. "jhagujarati",
  9197. 0x0a9d,
  9198. "jhagurmukhi",
  9199. 0x0a1d,
  9200. "jheharmenian",
  9201. 0x057b,
  9202. "jis",
  9203. 0x3004,
  9204. "jmonospace",
  9205. 0xff4a,
  9206. "jparen",
  9207. 0x24a5,
  9208. "jsuperior",
  9209. 0x02b2,
  9210. "k",
  9211. 0x006b,
  9212. "kabashkircyrillic",
  9213. 0x04a1,
  9214. "kabengali",
  9215. 0x0995,
  9216. "kacute",
  9217. 0x1e31,
  9218. "kacyrillic",
  9219. 0x043a,
  9220. "kadescendercyrillic",
  9221. 0x049b,
  9222. "kadeva",
  9223. 0x0915,
  9224. "kaf",
  9225. 0x05db,
  9226. "kafarabic",
  9227. 0x0643,
  9228. "kafdagesh",
  9229. 0xfb3b,
  9230. "kafdageshhebrew",
  9231. 0xfb3b,
  9232. "kaffinalarabic",
  9233. 0xfeda,
  9234. "kafhebrew",
  9235. 0x05db,
  9236. "kafinitialarabic",
  9237. 0xfedb,
  9238. "kafmedialarabic",
  9239. 0xfedc,
  9240. "kafrafehebrew",
  9241. 0xfb4d,
  9242. "kagujarati",
  9243. 0x0a95,
  9244. "kagurmukhi",
  9245. 0x0a15,
  9246. "kahiragana",
  9247. 0x304b,
  9248. "kahookcyrillic",
  9249. 0x04c4,
  9250. "kakatakana",
  9251. 0x30ab,
  9252. "kakatakanahalfwidth",
  9253. 0xff76,
  9254. "kappa",
  9255. 0x03ba,
  9256. "kappasymbolgreek",
  9257. 0x03f0,
  9258. "kapyeounmieumkorean",
  9259. 0x3171,
  9260. "kapyeounphieuphkorean",
  9261. 0x3184,
  9262. "kapyeounpieupkorean",
  9263. 0x3178,
  9264. "kapyeounssangpieupkorean",
  9265. 0x3179,
  9266. "karoriisquare",
  9267. 0x330d,
  9268. "kashidaautoarabic",
  9269. 0x0640,
  9270. "kashidaautonosidebearingarabic",
  9271. 0x0640,
  9272. "kasmallkatakana",
  9273. 0x30f5,
  9274. "kasquare",
  9275. 0x3384,
  9276. "kasraarabic",
  9277. 0x0650,
  9278. "kasratanarabic",
  9279. 0x064d,
  9280. "kastrokecyrillic",
  9281. 0x049f,
  9282. "katahiraprolongmarkhalfwidth",
  9283. 0xff70,
  9284. "kaverticalstrokecyrillic",
  9285. 0x049d,
  9286. "kbopomofo",
  9287. 0x310e,
  9288. "kcalsquare",
  9289. 0x3389,
  9290. "kcaron",
  9291. 0x01e9,
  9292. "kcedilla",
  9293. 0x0137,
  9294. "kcircle",
  9295. 0x24da,
  9296. "kcommaaccent",
  9297. 0x0137,
  9298. "kdotbelow",
  9299. 0x1e33,
  9300. "keharmenian",
  9301. 0x0584,
  9302. "kehiragana",
  9303. 0x3051,
  9304. "kekatakana",
  9305. 0x30b1,
  9306. "kekatakanahalfwidth",
  9307. 0xff79,
  9308. "kenarmenian",
  9309. 0x056f,
  9310. "kesmallkatakana",
  9311. 0x30f6,
  9312. "kgreenlandic",
  9313. 0x0138,
  9314. "khabengali",
  9315. 0x0996,
  9316. "khacyrillic",
  9317. 0x0445,
  9318. "khadeva",
  9319. 0x0916,
  9320. "khagujarati",
  9321. 0x0a96,
  9322. "khagurmukhi",
  9323. 0x0a16,
  9324. "khaharabic",
  9325. 0x062e,
  9326. "khahfinalarabic",
  9327. 0xfea6,
  9328. "khahinitialarabic",
  9329. 0xfea7,
  9330. "khahmedialarabic",
  9331. 0xfea8,
  9332. "kheicoptic",
  9333. 0x03e7,
  9334. "khhadeva",
  9335. 0x0959,
  9336. "khhagurmukhi",
  9337. 0x0a59,
  9338. "khieukhacirclekorean",
  9339. 0x3278,
  9340. "khieukhaparenkorean",
  9341. 0x3218,
  9342. "khieukhcirclekorean",
  9343. 0x326a,
  9344. "khieukhkorean",
  9345. 0x314b,
  9346. "khieukhparenkorean",
  9347. 0x320a,
  9348. "khokhaithai",
  9349. 0x0e02,
  9350. "khokhonthai",
  9351. 0x0e05,
  9352. "khokhuatthai",
  9353. 0x0e03,
  9354. "khokhwaithai",
  9355. 0x0e04,
  9356. "khomutthai",
  9357. 0x0e5b,
  9358. "khook",
  9359. 0x0199,
  9360. "khorakhangthai",
  9361. 0x0e06,
  9362. "khzsquare",
  9363. 0x3391,
  9364. "kihiragana",
  9365. 0x304d,
  9366. "kikatakana",
  9367. 0x30ad,
  9368. "kikatakanahalfwidth",
  9369. 0xff77,
  9370. "kiroguramusquare",
  9371. 0x3315,
  9372. "kiromeetorusquare",
  9373. 0x3316,
  9374. "kirosquare",
  9375. 0x3314,
  9376. "kiyeokacirclekorean",
  9377. 0x326e,
  9378. "kiyeokaparenkorean",
  9379. 0x320e,
  9380. "kiyeokcirclekorean",
  9381. 0x3260,
  9382. "kiyeokkorean",
  9383. 0x3131,
  9384. "kiyeokparenkorean",
  9385. 0x3200,
  9386. "kiyeoksioskorean",
  9387. 0x3133,
  9388. "kjecyrillic",
  9389. 0x045c,
  9390. "klinebelow",
  9391. 0x1e35,
  9392. "klsquare",
  9393. 0x3398,
  9394. "kmcubedsquare",
  9395. 0x33a6,
  9396. "kmonospace",
  9397. 0xff4b,
  9398. "kmsquaredsquare",
  9399. 0x33a2,
  9400. "kohiragana",
  9401. 0x3053,
  9402. "kohmsquare",
  9403. 0x33c0,
  9404. "kokaithai",
  9405. 0x0e01,
  9406. "kokatakana",
  9407. 0x30b3,
  9408. "kokatakanahalfwidth",
  9409. 0xff7a,
  9410. "kooposquare",
  9411. 0x331e,
  9412. "koppacyrillic",
  9413. 0x0481,
  9414. "koreanstandardsymbol",
  9415. 0x327f,
  9416. "koroniscmb",
  9417. 0x0343,
  9418. "kparen",
  9419. 0x24a6,
  9420. "kpasquare",
  9421. 0x33aa,
  9422. "ksicyrillic",
  9423. 0x046f,
  9424. "ktsquare",
  9425. 0x33cf,
  9426. "kturned",
  9427. 0x029e,
  9428. "kuhiragana",
  9429. 0x304f,
  9430. "kukatakana",
  9431. 0x30af,
  9432. "kukatakanahalfwidth",
  9433. 0xff78,
  9434. "kvsquare",
  9435. 0x33b8,
  9436. "kwsquare",
  9437. 0x33be,
  9438. "l",
  9439. 0x006c,
  9440. "labengali",
  9441. 0x09b2,
  9442. "lacute",
  9443. 0x013a,
  9444. "ladeva",
  9445. 0x0932,
  9446. "lagujarati",
  9447. 0x0ab2,
  9448. "lagurmukhi",
  9449. 0x0a32,
  9450. "lakkhangyaothai",
  9451. 0x0e45,
  9452. "lamaleffinalarabic",
  9453. 0xfefc,
  9454. "lamalefhamzaabovefinalarabic",
  9455. 0xfef8,
  9456. "lamalefhamzaaboveisolatedarabic",
  9457. 0xfef7,
  9458. "lamalefhamzabelowfinalarabic",
  9459. 0xfefa,
  9460. "lamalefhamzabelowisolatedarabic",
  9461. 0xfef9,
  9462. "lamalefisolatedarabic",
  9463. 0xfefb,
  9464. "lamalefmaddaabovefinalarabic",
  9465. 0xfef6,
  9466. "lamalefmaddaaboveisolatedarabic",
  9467. 0xfef5,
  9468. "lamarabic",
  9469. 0x0644,
  9470. "lambda",
  9471. 0x03bb,
  9472. "lambdastroke",
  9473. 0x019b,
  9474. "lamed",
  9475. 0x05dc,
  9476. "lameddagesh",
  9477. 0xfb3c,
  9478. "lameddageshhebrew",
  9479. 0xfb3c,
  9480. "lamedhebrew",
  9481. 0x05dc,
  9482. "lamfinalarabic",
  9483. 0xfede,
  9484. "lamhahinitialarabic",
  9485. 0xfcca,
  9486. "laminitialarabic",
  9487. 0xfedf,
  9488. "lamjeeminitialarabic",
  9489. 0xfcc9,
  9490. "lamkhahinitialarabic",
  9491. 0xfccb,
  9492. "lamlamhehisolatedarabic",
  9493. 0xfdf2,
  9494. "lammedialarabic",
  9495. 0xfee0,
  9496. "lammeemhahinitialarabic",
  9497. 0xfd88,
  9498. "lammeeminitialarabic",
  9499. 0xfccc,
  9500. "largecircle",
  9501. 0x25ef,
  9502. "lbar",
  9503. 0x019a,
  9504. "lbelt",
  9505. 0x026c,
  9506. "lbopomofo",
  9507. 0x310c,
  9508. "lcaron",
  9509. 0x013e,
  9510. "lcedilla",
  9511. 0x013c,
  9512. "lcircle",
  9513. 0x24db,
  9514. "lcircumflexbelow",
  9515. 0x1e3d,
  9516. "lcommaaccent",
  9517. 0x013c,
  9518. "ldot",
  9519. 0x0140,
  9520. "ldotaccent",
  9521. 0x0140,
  9522. "ldotbelow",
  9523. 0x1e37,
  9524. "ldotbelowmacron",
  9525. 0x1e39,
  9526. "leftangleabovecmb",
  9527. 0x031a,
  9528. "lefttackbelowcmb",
  9529. 0x0318,
  9530. "less",
  9531. 0x003c,
  9532. "lessequal",
  9533. 0x2264,
  9534. "lessequalorgreater",
  9535. 0x22da,
  9536. "lessmonospace",
  9537. 0xff1c,
  9538. "lessorequivalent",
  9539. 0x2272,
  9540. "lessorgreater",
  9541. 0x2276,
  9542. "lessoverequal",
  9543. 0x2266,
  9544. "lesssmall",
  9545. 0xfe64,
  9546. "lezh",
  9547. 0x026e,
  9548. "lfblock",
  9549. 0x258c,
  9550. "lhookretroflex",
  9551. 0x026d,
  9552. "lira",
  9553. 0x20a4,
  9554. "liwnarmenian",
  9555. 0x056c,
  9556. "lj",
  9557. 0x01c9,
  9558. "ljecyrillic",
  9559. 0x0459,
  9560. "ll",
  9561. 0xf6c0,
  9562. "lladeva",
  9563. 0x0933,
  9564. "llagujarati",
  9565. 0x0ab3,
  9566. "llinebelow",
  9567. 0x1e3b,
  9568. "llladeva",
  9569. 0x0934,
  9570. "llvocalicbengali",
  9571. 0x09e1,
  9572. "llvocalicdeva",
  9573. 0x0961,
  9574. "llvocalicvowelsignbengali",
  9575. 0x09e3,
  9576. "llvocalicvowelsigndeva",
  9577. 0x0963,
  9578. "lmiddletilde",
  9579. 0x026b,
  9580. "lmonospace",
  9581. 0xff4c,
  9582. "lmsquare",
  9583. 0x33d0,
  9584. "lochulathai",
  9585. 0x0e2c,
  9586. "logicaland",
  9587. 0x2227,
  9588. "logicalnot",
  9589. 0x00ac,
  9590. "logicalnotreversed",
  9591. 0x2310,
  9592. "logicalor",
  9593. 0x2228,
  9594. "lolingthai",
  9595. 0x0e25,
  9596. "longs",
  9597. 0x017f,
  9598. "lowlinecenterline",
  9599. 0xfe4e,
  9600. "lowlinecmb",
  9601. 0x0332,
  9602. "lowlinedashed",
  9603. 0xfe4d,
  9604. "lozenge",
  9605. 0x25ca,
  9606. "lparen",
  9607. 0x24a7,
  9608. "lslash",
  9609. 0x0142,
  9610. "lsquare",
  9611. 0x2113,
  9612. "lsuperior",
  9613. 0xf6ee,
  9614. "ltshade",
  9615. 0x2591,
  9616. "luthai",
  9617. 0x0e26,
  9618. "lvocalicbengali",
  9619. 0x098c,
  9620. "lvocalicdeva",
  9621. 0x090c,
  9622. "lvocalicvowelsignbengali",
  9623. 0x09e2,
  9624. "lvocalicvowelsigndeva",
  9625. 0x0962,
  9626. "lxsquare",
  9627. 0x33d3,
  9628. "m",
  9629. 0x006d,
  9630. "mabengali",
  9631. 0x09ae,
  9632. "macron",
  9633. 0x00af,
  9634. "macronbelowcmb",
  9635. 0x0331,
  9636. "macroncmb",
  9637. 0x0304,
  9638. "macronlowmod",
  9639. 0x02cd,
  9640. "macronmonospace",
  9641. 0xffe3,
  9642. "macute",
  9643. 0x1e3f,
  9644. "madeva",
  9645. 0x092e,
  9646. "magujarati",
  9647. 0x0aae,
  9648. "magurmukhi",
  9649. 0x0a2e,
  9650. "mahapakhhebrew",
  9651. 0x05a4,
  9652. "mahapakhlefthebrew",
  9653. 0x05a4,
  9654. "mahiragana",
  9655. 0x307e,
  9656. "maichattawalowleftthai",
  9657. 0xf895,
  9658. "maichattawalowrightthai",
  9659. 0xf894,
  9660. "maichattawathai",
  9661. 0x0e4b,
  9662. "maichattawaupperleftthai",
  9663. 0xf893,
  9664. "maieklowleftthai",
  9665. 0xf88c,
  9666. "maieklowrightthai",
  9667. 0xf88b,
  9668. "maiekthai",
  9669. 0x0e48,
  9670. "maiekupperleftthai",
  9671. 0xf88a,
  9672. "maihanakatleftthai",
  9673. 0xf884,
  9674. "maihanakatthai",
  9675. 0x0e31,
  9676. "maitaikhuleftthai",
  9677. 0xf889,
  9678. "maitaikhuthai",
  9679. 0x0e47,
  9680. "maitholowleftthai",
  9681. 0xf88f,
  9682. "maitholowrightthai",
  9683. 0xf88e,
  9684. "maithothai",
  9685. 0x0e49,
  9686. "maithoupperleftthai",
  9687. 0xf88d,
  9688. "maitrilowleftthai",
  9689. 0xf892,
  9690. "maitrilowrightthai",
  9691. 0xf891,
  9692. "maitrithai",
  9693. 0x0e4a,
  9694. "maitriupperleftthai",
  9695. 0xf890,
  9696. "maiyamokthai",
  9697. 0x0e46,
  9698. "makatakana",
  9699. 0x30de,
  9700. "makatakanahalfwidth",
  9701. 0xff8f,
  9702. "male",
  9703. 0x2642,
  9704. "mansyonsquare",
  9705. 0x3347,
  9706. "maqafhebrew",
  9707. 0x05be,
  9708. "mars",
  9709. 0x2642,
  9710. "masoracirclehebrew",
  9711. 0x05af,
  9712. "masquare",
  9713. 0x3383,
  9714. "mbopomofo",
  9715. 0x3107,
  9716. "mbsquare",
  9717. 0x33d4,
  9718. "mcircle",
  9719. 0x24dc,
  9720. "mcubedsquare",
  9721. 0x33a5,
  9722. "mdotaccent",
  9723. 0x1e41,
  9724. "mdotbelow",
  9725. 0x1e43,
  9726. "meemarabic",
  9727. 0x0645,
  9728. "meemfinalarabic",
  9729. 0xfee2,
  9730. "meeminitialarabic",
  9731. 0xfee3,
  9732. "meemmedialarabic",
  9733. 0xfee4,
  9734. "meemmeeminitialarabic",
  9735. 0xfcd1,
  9736. "meemmeemisolatedarabic",
  9737. 0xfc48,
  9738. "meetorusquare",
  9739. 0x334d,
  9740. "mehiragana",
  9741. 0x3081,
  9742. "meizierasquare",
  9743. 0x337e,
  9744. "mekatakana",
  9745. 0x30e1,
  9746. "mekatakanahalfwidth",
  9747. 0xff92,
  9748. "mem",
  9749. 0x05de,
  9750. "memdagesh",
  9751. 0xfb3e,
  9752. "memdageshhebrew",
  9753. 0xfb3e,
  9754. "memhebrew",
  9755. 0x05de,
  9756. "menarmenian",
  9757. 0x0574,
  9758. "merkhahebrew",
  9759. 0x05a5,
  9760. "merkhakefulahebrew",
  9761. 0x05a6,
  9762. "merkhakefulalefthebrew",
  9763. 0x05a6,
  9764. "merkhalefthebrew",
  9765. 0x05a5,
  9766. "mhook",
  9767. 0x0271,
  9768. "mhzsquare",
  9769. 0x3392,
  9770. "middledotkatakanahalfwidth",
  9771. 0xff65,
  9772. "middot",
  9773. 0x00b7,
  9774. "mieumacirclekorean",
  9775. 0x3272,
  9776. "mieumaparenkorean",
  9777. 0x3212,
  9778. "mieumcirclekorean",
  9779. 0x3264,
  9780. "mieumkorean",
  9781. 0x3141,
  9782. "mieumpansioskorean",
  9783. 0x3170,
  9784. "mieumparenkorean",
  9785. 0x3204,
  9786. "mieumpieupkorean",
  9787. 0x316e,
  9788. "mieumsioskorean",
  9789. 0x316f,
  9790. "mihiragana",
  9791. 0x307f,
  9792. "mikatakana",
  9793. 0x30df,
  9794. "mikatakanahalfwidth",
  9795. 0xff90,
  9796. "minus",
  9797. 0x2212,
  9798. "minusbelowcmb",
  9799. 0x0320,
  9800. "minuscircle",
  9801. 0x2296,
  9802. "minusmod",
  9803. 0x02d7,
  9804. "minusplus",
  9805. 0x2213,
  9806. "minute",
  9807. 0x2032,
  9808. "miribaarusquare",
  9809. 0x334a,
  9810. "mirisquare",
  9811. 0x3349,
  9812. "mlonglegturned",
  9813. 0x0270,
  9814. "mlsquare",
  9815. 0x3396,
  9816. "mmcubedsquare",
  9817. 0x33a3,
  9818. "mmonospace",
  9819. 0xff4d,
  9820. "mmsquaredsquare",
  9821. 0x339f,
  9822. "mohiragana",
  9823. 0x3082,
  9824. "mohmsquare",
  9825. 0x33c1,
  9826. "mokatakana",
  9827. 0x30e2,
  9828. "mokatakanahalfwidth",
  9829. 0xff93,
  9830. "molsquare",
  9831. 0x33d6,
  9832. "momathai",
  9833. 0x0e21,
  9834. "moverssquare",
  9835. 0x33a7,
  9836. "moverssquaredsquare",
  9837. 0x33a8,
  9838. "mparen",
  9839. 0x24a8,
  9840. "mpasquare",
  9841. 0x33ab,
  9842. "mssquare",
  9843. 0x33b3,
  9844. "msuperior",
  9845. 0xf6ef,
  9846. "mturned",
  9847. 0x026f,
  9848. "mu",
  9849. 0x00b5,
  9850. "mu1",
  9851. 0x00b5,
  9852. "muasquare",
  9853. 0x3382,
  9854. "muchgreater",
  9855. 0x226b,
  9856. "muchless",
  9857. 0x226a,
  9858. "mufsquare",
  9859. 0x338c,
  9860. "mugreek",
  9861. 0x03bc,
  9862. "mugsquare",
  9863. 0x338d,
  9864. "muhiragana",
  9865. 0x3080,
  9866. "mukatakana",
  9867. 0x30e0,
  9868. "mukatakanahalfwidth",
  9869. 0xff91,
  9870. "mulsquare",
  9871. 0x3395,
  9872. "multiply",
  9873. 0x00d7,
  9874. "mumsquare",
  9875. 0x339b,
  9876. "munahhebrew",
  9877. 0x05a3,
  9878. "munahlefthebrew",
  9879. 0x05a3,
  9880. "musicalnote",
  9881. 0x266a,
  9882. "musicalnotedbl",
  9883. 0x266b,
  9884. "musicflatsign",
  9885. 0x266d,
  9886. "musicsharpsign",
  9887. 0x266f,
  9888. "mussquare",
  9889. 0x33b2,
  9890. "muvsquare",
  9891. 0x33b6,
  9892. "muwsquare",
  9893. 0x33bc,
  9894. "mvmegasquare",
  9895. 0x33b9,
  9896. "mvsquare",
  9897. 0x33b7,
  9898. "mwmegasquare",
  9899. 0x33bf,
  9900. "mwsquare",
  9901. 0x33bd,
  9902. "n",
  9903. 0x006e,
  9904. "nabengali",
  9905. 0x09a8,
  9906. "nabla",
  9907. 0x2207,
  9908. "nacute",
  9909. 0x0144,
  9910. "nadeva",
  9911. 0x0928,
  9912. "nagujarati",
  9913. 0x0aa8,
  9914. "nagurmukhi",
  9915. 0x0a28,
  9916. "nahiragana",
  9917. 0x306a,
  9918. "nakatakana",
  9919. 0x30ca,
  9920. "nakatakanahalfwidth",
  9921. 0xff85,
  9922. "napostrophe",
  9923. 0x0149,
  9924. "nasquare",
  9925. 0x3381,
  9926. "nbopomofo",
  9927. 0x310b,
  9928. "nbspace",
  9929. 0x00a0,
  9930. "ncaron",
  9931. 0x0148,
  9932. "ncedilla",
  9933. 0x0146,
  9934. "ncircle",
  9935. 0x24dd,
  9936. "ncircumflexbelow",
  9937. 0x1e4b,
  9938. "ncommaaccent",
  9939. 0x0146,
  9940. "ndotaccent",
  9941. 0x1e45,
  9942. "ndotbelow",
  9943. 0x1e47,
  9944. "nehiragana",
  9945. 0x306d,
  9946. "nekatakana",
  9947. 0x30cd,
  9948. "nekatakanahalfwidth",
  9949. 0xff88,
  9950. "newsheqelsign",
  9951. 0x20aa,
  9952. "nfsquare",
  9953. 0x338b,
  9954. "ngabengali",
  9955. 0x0999,
  9956. "ngadeva",
  9957. 0x0919,
  9958. "ngagujarati",
  9959. 0x0a99,
  9960. "ngagurmukhi",
  9961. 0x0a19,
  9962. "ngonguthai",
  9963. 0x0e07,
  9964. "nhiragana",
  9965. 0x3093,
  9966. "nhookleft",
  9967. 0x0272,
  9968. "nhookretroflex",
  9969. 0x0273,
  9970. "nieunacirclekorean",
  9971. 0x326f,
  9972. "nieunaparenkorean",
  9973. 0x320f,
  9974. "nieuncieuckorean",
  9975. 0x3135,
  9976. "nieuncirclekorean",
  9977. 0x3261,
  9978. "nieunhieuhkorean",
  9979. 0x3136,
  9980. "nieunkorean",
  9981. 0x3134,
  9982. "nieunpansioskorean",
  9983. 0x3168,
  9984. "nieunparenkorean",
  9985. 0x3201,
  9986. "nieunsioskorean",
  9987. 0x3167,
  9988. "nieuntikeutkorean",
  9989. 0x3166,
  9990. "nihiragana",
  9991. 0x306b,
  9992. "nikatakana",
  9993. 0x30cb,
  9994. "nikatakanahalfwidth",
  9995. 0xff86,
  9996. "nikhahitleftthai",
  9997. 0xf899,
  9998. "nikhahitthai",
  9999. 0x0e4d,
  10000. "nine",
  10001. 0x0039,
  10002. "ninearabic",
  10003. 0x0669,
  10004. "ninebengali",
  10005. 0x09ef,
  10006. "ninecircle",
  10007. 0x2468,
  10008. "ninecircleinversesansserif",
  10009. 0x2792,
  10010. "ninedeva",
  10011. 0x096f,
  10012. "ninegujarati",
  10013. 0x0aef,
  10014. "ninegurmukhi",
  10015. 0x0a6f,
  10016. "ninehackarabic",
  10017. 0x0669,
  10018. "ninehangzhou",
  10019. 0x3029,
  10020. "nineideographicparen",
  10021. 0x3228,
  10022. "nineinferior",
  10023. 0x2089,
  10024. "ninemonospace",
  10025. 0xff19,
  10026. "nineoldstyle",
  10027. 0xf739,
  10028. "nineparen",
  10029. 0x247c,
  10030. "nineperiod",
  10031. 0x2490,
  10032. "ninepersian",
  10033. 0x06f9,
  10034. "nineroman",
  10035. 0x2178,
  10036. "ninesuperior",
  10037. 0x2079,
  10038. "nineteencircle",
  10039. 0x2472,
  10040. "nineteenparen",
  10041. 0x2486,
  10042. "nineteenperiod",
  10043. 0x249a,
  10044. "ninethai",
  10045. 0x0e59,
  10046. "nj",
  10047. 0x01cc,
  10048. "njecyrillic",
  10049. 0x045a,
  10050. "nkatakana",
  10051. 0x30f3,
  10052. "nkatakanahalfwidth",
  10053. 0xff9d,
  10054. "nlegrightlong",
  10055. 0x019e,
  10056. "nlinebelow",
  10057. 0x1e49,
  10058. "nmonospace",
  10059. 0xff4e,
  10060. "nmsquare",
  10061. 0x339a,
  10062. "nnabengali",
  10063. 0x09a3,
  10064. "nnadeva",
  10065. 0x0923,
  10066. "nnagujarati",
  10067. 0x0aa3,
  10068. "nnagurmukhi",
  10069. 0x0a23,
  10070. "nnnadeva",
  10071. 0x0929,
  10072. "nohiragana",
  10073. 0x306e,
  10074. "nokatakana",
  10075. 0x30ce,
  10076. "nokatakanahalfwidth",
  10077. 0xff89,
  10078. "nonbreakingspace",
  10079. 0x00a0,
  10080. "nonenthai",
  10081. 0x0e13,
  10082. "nonuthai",
  10083. 0x0e19,
  10084. "noonarabic",
  10085. 0x0646,
  10086. "noonfinalarabic",
  10087. 0xfee6,
  10088. "noonghunnaarabic",
  10089. 0x06ba,
  10090. "noonghunnafinalarabic",
  10091. 0xfb9f,
  10092. "nooninitialarabic",
  10093. 0xfee7,
  10094. "noonjeeminitialarabic",
  10095. 0xfcd2,
  10096. "noonjeemisolatedarabic",
  10097. 0xfc4b,
  10098. "noonmedialarabic",
  10099. 0xfee8,
  10100. "noonmeeminitialarabic",
  10101. 0xfcd5,
  10102. "noonmeemisolatedarabic",
  10103. 0xfc4e,
  10104. "noonnoonfinalarabic",
  10105. 0xfc8d,
  10106. "notcontains",
  10107. 0x220c,
  10108. "notelement",
  10109. 0x2209,
  10110. "notelementof",
  10111. 0x2209,
  10112. "notequal",
  10113. 0x2260,
  10114. "notgreater",
  10115. 0x226f,
  10116. "notgreaternorequal",
  10117. 0x2271,
  10118. "notgreaternorless",
  10119. 0x2279,
  10120. "notidentical",
  10121. 0x2262,
  10122. "notless",
  10123. 0x226e,
  10124. "notlessnorequal",
  10125. 0x2270,
  10126. "notparallel",
  10127. 0x2226,
  10128. "notprecedes",
  10129. 0x2280,
  10130. "notsubset",
  10131. 0x2284,
  10132. "notsucceeds",
  10133. 0x2281,
  10134. "notsuperset",
  10135. 0x2285,
  10136. "nowarmenian",
  10137. 0x0576,
  10138. "nparen",
  10139. 0x24a9,
  10140. "nssquare",
  10141. 0x33b1,
  10142. "nsuperior",
  10143. 0x207f,
  10144. "ntilde",
  10145. 0x00f1,
  10146. "nu",
  10147. 0x03bd,
  10148. "nuhiragana",
  10149. 0x306c,
  10150. "nukatakana",
  10151. 0x30cc,
  10152. "nukatakanahalfwidth",
  10153. 0xff87,
  10154. "nuktabengali",
  10155. 0x09bc,
  10156. "nuktadeva",
  10157. 0x093c,
  10158. "nuktagujarati",
  10159. 0x0abc,
  10160. "nuktagurmukhi",
  10161. 0x0a3c,
  10162. "numbersign",
  10163. 0x0023,
  10164. "numbersignmonospace",
  10165. 0xff03,
  10166. "numbersignsmall",
  10167. 0xfe5f,
  10168. "numeralsigngreek",
  10169. 0x0374,
  10170. "numeralsignlowergreek",
  10171. 0x0375,
  10172. "numero",
  10173. 0x2116,
  10174. "nun",
  10175. 0x05e0,
  10176. "nundagesh",
  10177. 0xfb40,
  10178. "nundageshhebrew",
  10179. 0xfb40,
  10180. "nunhebrew",
  10181. 0x05e0,
  10182. "nvsquare",
  10183. 0x33b5,
  10184. "nwsquare",
  10185. 0x33bb,
  10186. "nyabengali",
  10187. 0x099e,
  10188. "nyadeva",
  10189. 0x091e,
  10190. "nyagujarati",
  10191. 0x0a9e,
  10192. "nyagurmukhi",
  10193. 0x0a1e,
  10194. "o",
  10195. 0x006f,
  10196. "oacute",
  10197. 0x00f3,
  10198. "oangthai",
  10199. 0x0e2d,
  10200. "obarred",
  10201. 0x0275,
  10202. "obarredcyrillic",
  10203. 0x04e9,
  10204. "obarreddieresiscyrillic",
  10205. 0x04eb,
  10206. "obengali",
  10207. 0x0993,
  10208. "obopomofo",
  10209. 0x311b,
  10210. "obreve",
  10211. 0x014f,
  10212. "ocandradeva",
  10213. 0x0911,
  10214. "ocandragujarati",
  10215. 0x0a91,
  10216. "ocandravowelsigndeva",
  10217. 0x0949,
  10218. "ocandravowelsigngujarati",
  10219. 0x0ac9,
  10220. "ocaron",
  10221. 0x01d2,
  10222. "ocircle",
  10223. 0x24de,
  10224. "ocircumflex",
  10225. 0x00f4,
  10226. "ocircumflexacute",
  10227. 0x1ed1,
  10228. "ocircumflexdotbelow",
  10229. 0x1ed9,
  10230. "ocircumflexgrave",
  10231. 0x1ed3,
  10232. "ocircumflexhookabove",
  10233. 0x1ed5,
  10234. "ocircumflextilde",
  10235. 0x1ed7,
  10236. "ocyrillic",
  10237. 0x043e,
  10238. "odblacute",
  10239. 0x0151,
  10240. "odblgrave",
  10241. 0x020d,
  10242. "odeva",
  10243. 0x0913,
  10244. "odieresis",
  10245. 0x00f6,
  10246. "odieresiscyrillic",
  10247. 0x04e7,
  10248. "odotbelow",
  10249. 0x1ecd,
  10250. "oe",
  10251. 0x0153,
  10252. "oekorean",
  10253. 0x315a,
  10254. "ogonek",
  10255. 0x02db,
  10256. "ogonekcmb",
  10257. 0x0328,
  10258. "ograve",
  10259. 0x00f2,
  10260. "ogujarati",
  10261. 0x0a93,
  10262. "oharmenian",
  10263. 0x0585,
  10264. "ohiragana",
  10265. 0x304a,
  10266. "ohookabove",
  10267. 0x1ecf,
  10268. "ohorn",
  10269. 0x01a1,
  10270. "ohornacute",
  10271. 0x1edb,
  10272. "ohorndotbelow",
  10273. 0x1ee3,
  10274. "ohorngrave",
  10275. 0x1edd,
  10276. "ohornhookabove",
  10277. 0x1edf,
  10278. "ohorntilde",
  10279. 0x1ee1,
  10280. "ohungarumlaut",
  10281. 0x0151,
  10282. "oi",
  10283. 0x01a3,
  10284. "oinvertedbreve",
  10285. 0x020f,
  10286. "okatakana",
  10287. 0x30aa,
  10288. "okatakanahalfwidth",
  10289. 0xff75,
  10290. "okorean",
  10291. 0x3157,
  10292. "olehebrew",
  10293. 0x05ab,
  10294. "omacron",
  10295. 0x014d,
  10296. "omacronacute",
  10297. 0x1e53,
  10298. "omacrongrave",
  10299. 0x1e51,
  10300. "omdeva",
  10301. 0x0950,
  10302. "omega",
  10303. 0x03c9,
  10304. "omega1",
  10305. 0x03d6,
  10306. "omegacyrillic",
  10307. 0x0461,
  10308. "omegalatinclosed",
  10309. 0x0277,
  10310. "omegaroundcyrillic",
  10311. 0x047b,
  10312. "omegatitlocyrillic",
  10313. 0x047d,
  10314. "omegatonos",
  10315. 0x03ce,
  10316. "omgujarati",
  10317. 0x0ad0,
  10318. "omicron",
  10319. 0x03bf,
  10320. "omicrontonos",
  10321. 0x03cc,
  10322. "omonospace",
  10323. 0xff4f,
  10324. "one",
  10325. 0x0031,
  10326. "onearabic",
  10327. 0x0661,
  10328. "onebengali",
  10329. 0x09e7,
  10330. "onecircle",
  10331. 0x2460,
  10332. "onecircleinversesansserif",
  10333. 0x278a,
  10334. "onedeva",
  10335. 0x0967,
  10336. "onedotenleader",
  10337. 0x2024,
  10338. "oneeighth",
  10339. 0x215b,
  10340. "onefitted",
  10341. 0xf6dc,
  10342. "onegujarati",
  10343. 0x0ae7,
  10344. "onegurmukhi",
  10345. 0x0a67,
  10346. "onehackarabic",
  10347. 0x0661,
  10348. "onehalf",
  10349. 0x00bd,
  10350. "onehangzhou",
  10351. 0x3021,
  10352. "oneideographicparen",
  10353. 0x3220,
  10354. "oneinferior",
  10355. 0x2081,
  10356. "onemonospace",
  10357. 0xff11,
  10358. "onenumeratorbengali",
  10359. 0x09f4,
  10360. "oneoldstyle",
  10361. 0xf731,
  10362. "oneparen",
  10363. 0x2474,
  10364. "oneperiod",
  10365. 0x2488,
  10366. "onepersian",
  10367. 0x06f1,
  10368. "onequarter",
  10369. 0x00bc,
  10370. "oneroman",
  10371. 0x2170,
  10372. "onesuperior",
  10373. 0x00b9,
  10374. "onethai",
  10375. 0x0e51,
  10376. "onethird",
  10377. 0x2153,
  10378. "oogonek",
  10379. 0x01eb,
  10380. "oogonekmacron",
  10381. 0x01ed,
  10382. "oogurmukhi",
  10383. 0x0a13,
  10384. "oomatragurmukhi",
  10385. 0x0a4b,
  10386. "oopen",
  10387. 0x0254,
  10388. "oparen",
  10389. 0x24aa,
  10390. "openbullet",
  10391. 0x25e6,
  10392. "option",
  10393. 0x2325,
  10394. "ordfeminine",
  10395. 0x00aa,
  10396. "ordmasculine",
  10397. 0x00ba,
  10398. "orthogonal",
  10399. 0x221f,
  10400. "oshortdeva",
  10401. 0x0912,
  10402. "oshortvowelsigndeva",
  10403. 0x094a,
  10404. "oslash",
  10405. 0x00f8,
  10406. "oslashacute",
  10407. 0x01ff,
  10408. "osmallhiragana",
  10409. 0x3049,
  10410. "osmallkatakana",
  10411. 0x30a9,
  10412. "osmallkatakanahalfwidth",
  10413. 0xff6b,
  10414. "ostrokeacute",
  10415. 0x01ff,
  10416. "osuperior",
  10417. 0xf6f0,
  10418. "otcyrillic",
  10419. 0x047f,
  10420. "otilde",
  10421. 0x00f5,
  10422. "otildeacute",
  10423. 0x1e4d,
  10424. "otildedieresis",
  10425. 0x1e4f,
  10426. "oubopomofo",
  10427. 0x3121,
  10428. "overline",
  10429. 0x203e,
  10430. "overlinecenterline",
  10431. 0xfe4a,
  10432. "overlinecmb",
  10433. 0x0305,
  10434. "overlinedashed",
  10435. 0xfe49,
  10436. "overlinedblwavy",
  10437. 0xfe4c,
  10438. "overlinewavy",
  10439. 0xfe4b,
  10440. "overscore",
  10441. 0x00af,
  10442. "ovowelsignbengali",
  10443. 0x09cb,
  10444. "ovowelsigndeva",
  10445. 0x094b,
  10446. "ovowelsigngujarati",
  10447. 0x0acb,
  10448. "p",
  10449. 0x0070,
  10450. "paampssquare",
  10451. 0x3380,
  10452. "paasentosquare",
  10453. 0x332b,
  10454. "pabengali",
  10455. 0x09aa,
  10456. "pacute",
  10457. 0x1e55,
  10458. "padeva",
  10459. 0x092a,
  10460. "pagedown",
  10461. 0x21df,
  10462. "pageup",
  10463. 0x21de,
  10464. "pagujarati",
  10465. 0x0aaa,
  10466. "pagurmukhi",
  10467. 0x0a2a,
  10468. "pahiragana",
  10469. 0x3071,
  10470. "paiyannoithai",
  10471. 0x0e2f,
  10472. "pakatakana",
  10473. 0x30d1,
  10474. "palatalizationcyrilliccmb",
  10475. 0x0484,
  10476. "palochkacyrillic",
  10477. 0x04c0,
  10478. "pansioskorean",
  10479. 0x317f,
  10480. "paragraph",
  10481. 0x00b6,
  10482. "parallel",
  10483. 0x2225,
  10484. "parenleft",
  10485. 0x0028,
  10486. "parenleftaltonearabic",
  10487. 0xfd3e,
  10488. "parenleftbt",
  10489. 0xf8ed,
  10490. "parenleftex",
  10491. 0xf8ec,
  10492. "parenleftinferior",
  10493. 0x208d,
  10494. "parenleftmonospace",
  10495. 0xff08,
  10496. "parenleftsmall",
  10497. 0xfe59,
  10498. "parenleftsuperior",
  10499. 0x207d,
  10500. "parenlefttp",
  10501. 0xf8eb,
  10502. "parenleftvertical",
  10503. 0xfe35,
  10504. "parenright",
  10505. 0x0029,
  10506. "parenrightaltonearabic",
  10507. 0xfd3f,
  10508. "parenrightbt",
  10509. 0xf8f8,
  10510. "parenrightex",
  10511. 0xf8f7,
  10512. "parenrightinferior",
  10513. 0x208e,
  10514. "parenrightmonospace",
  10515. 0xff09,
  10516. "parenrightsmall",
  10517. 0xfe5a,
  10518. "parenrightsuperior",
  10519. 0x207e,
  10520. "parenrighttp",
  10521. 0xf8f6,
  10522. "parenrightvertical",
  10523. 0xfe36,
  10524. "partialdiff",
  10525. 0x2202,
  10526. "paseqhebrew",
  10527. 0x05c0,
  10528. "pashtahebrew",
  10529. 0x0599,
  10530. "pasquare",
  10531. 0x33a9,
  10532. "patah",
  10533. 0x05b7,
  10534. "patah11",
  10535. 0x05b7,
  10536. "patah1d",
  10537. 0x05b7,
  10538. "patah2a",
  10539. 0x05b7,
  10540. "patahhebrew",
  10541. 0x05b7,
  10542. "patahnarrowhebrew",
  10543. 0x05b7,
  10544. "patahquarterhebrew",
  10545. 0x05b7,
  10546. "patahwidehebrew",
  10547. 0x05b7,
  10548. "pazerhebrew",
  10549. 0x05a1,
  10550. "pbopomofo",
  10551. 0x3106,
  10552. "pcircle",
  10553. 0x24df,
  10554. "pdotaccent",
  10555. 0x1e57,
  10556. "pe",
  10557. 0x05e4,
  10558. "pecyrillic",
  10559. 0x043f,
  10560. "pedagesh",
  10561. 0xfb44,
  10562. "pedageshhebrew",
  10563. 0xfb44,
  10564. "peezisquare",
  10565. 0x333b,
  10566. "pefinaldageshhebrew",
  10567. 0xfb43,
  10568. "peharabic",
  10569. 0x067e,
  10570. "peharmenian",
  10571. 0x057a,
  10572. "pehebrew",
  10573. 0x05e4,
  10574. "pehfinalarabic",
  10575. 0xfb57,
  10576. "pehinitialarabic",
  10577. 0xfb58,
  10578. "pehiragana",
  10579. 0x307a,
  10580. "pehmedialarabic",
  10581. 0xfb59,
  10582. "pekatakana",
  10583. 0x30da,
  10584. "pemiddlehookcyrillic",
  10585. 0x04a7,
  10586. "perafehebrew",
  10587. 0xfb4e,
  10588. "percent",
  10589. 0x0025,
  10590. "percentarabic",
  10591. 0x066a,
  10592. "percentmonospace",
  10593. 0xff05,
  10594. "percentsmall",
  10595. 0xfe6a,
  10596. "period",
  10597. 0x002e,
  10598. "periodarmenian",
  10599. 0x0589,
  10600. "periodcentered",
  10601. 0x00b7,
  10602. "periodhalfwidth",
  10603. 0xff61,
  10604. "periodinferior",
  10605. 0xf6e7,
  10606. "periodmonospace",
  10607. 0xff0e,
  10608. "periodsmall",
  10609. 0xfe52,
  10610. "periodsuperior",
  10611. 0xf6e8,
  10612. "perispomenigreekcmb",
  10613. 0x0342,
  10614. "perpendicular",
  10615. 0x22a5,
  10616. "perthousand",
  10617. 0x2030,
  10618. "peseta",
  10619. 0x20a7,
  10620. "pfsquare",
  10621. 0x338a,
  10622. "phabengali",
  10623. 0x09ab,
  10624. "phadeva",
  10625. 0x092b,
  10626. "phagujarati",
  10627. 0x0aab,
  10628. "phagurmukhi",
  10629. 0x0a2b,
  10630. "phi",
  10631. 0x03c6,
  10632. "phi1",
  10633. 0x03d5,
  10634. "phieuphacirclekorean",
  10635. 0x327a,
  10636. "phieuphaparenkorean",
  10637. 0x321a,
  10638. "phieuphcirclekorean",
  10639. 0x326c,
  10640. "phieuphkorean",
  10641. 0x314d,
  10642. "phieuphparenkorean",
  10643. 0x320c,
  10644. "philatin",
  10645. 0x0278,
  10646. "phinthuthai",
  10647. 0x0e3a,
  10648. "phisymbolgreek",
  10649. 0x03d5,
  10650. "phook",
  10651. 0x01a5,
  10652. "phophanthai",
  10653. 0x0e1e,
  10654. "phophungthai",
  10655. 0x0e1c,
  10656. "phosamphaothai",
  10657. 0x0e20,
  10658. "pi",
  10659. 0x03c0,
  10660. "pieupacirclekorean",
  10661. 0x3273,
  10662. "pieupaparenkorean",
  10663. 0x3213,
  10664. "pieupcieuckorean",
  10665. 0x3176,
  10666. "pieupcirclekorean",
  10667. 0x3265,
  10668. "pieupkiyeokkorean",
  10669. 0x3172,
  10670. "pieupkorean",
  10671. 0x3142,
  10672. "pieupparenkorean",
  10673. 0x3205,
  10674. "pieupsioskiyeokkorean",
  10675. 0x3174,
  10676. "pieupsioskorean",
  10677. 0x3144,
  10678. "pieupsiostikeutkorean",
  10679. 0x3175,
  10680. "pieupthieuthkorean",
  10681. 0x3177,
  10682. "pieuptikeutkorean",
  10683. 0x3173,
  10684. "pihiragana",
  10685. 0x3074,
  10686. "pikatakana",
  10687. 0x30d4,
  10688. "pisymbolgreek",
  10689. 0x03d6,
  10690. "piwrarmenian",
  10691. 0x0583,
  10692. "plus",
  10693. 0x002b,
  10694. "plusbelowcmb",
  10695. 0x031f,
  10696. "pluscircle",
  10697. 0x2295,
  10698. "plusminus",
  10699. 0x00b1,
  10700. "plusmod",
  10701. 0x02d6,
  10702. "plusmonospace",
  10703. 0xff0b,
  10704. "plussmall",
  10705. 0xfe62,
  10706. "plussuperior",
  10707. 0x207a,
  10708. "pmonospace",
  10709. 0xff50,
  10710. "pmsquare",
  10711. 0x33d8,
  10712. "pohiragana",
  10713. 0x307d,
  10714. "pointingindexdownwhite",
  10715. 0x261f,
  10716. "pointingindexleftwhite",
  10717. 0x261c,
  10718. "pointingindexrightwhite",
  10719. 0x261e,
  10720. "pointingindexupwhite",
  10721. 0x261d,
  10722. "pokatakana",
  10723. 0x30dd,
  10724. "poplathai",
  10725. 0x0e1b,
  10726. "postalmark",
  10727. 0x3012,
  10728. "postalmarkface",
  10729. 0x3020,
  10730. "pparen",
  10731. 0x24ab,
  10732. "precedes",
  10733. 0x227a,
  10734. "prescription",
  10735. 0x211e,
  10736. "primemod",
  10737. 0x02b9,
  10738. "primereversed",
  10739. 0x2035,
  10740. "product",
  10741. 0x220f,
  10742. "projective",
  10743. 0x2305,
  10744. "prolongedkana",
  10745. 0x30fc,
  10746. "propellor",
  10747. 0x2318,
  10748. "propersubset",
  10749. 0x2282,
  10750. "propersuperset",
  10751. 0x2283,
  10752. "proportion",
  10753. 0x2237,
  10754. "proportional",
  10755. 0x221d,
  10756. "psi",
  10757. 0x03c8,
  10758. "psicyrillic",
  10759. 0x0471,
  10760. "psilipneumatacyrilliccmb",
  10761. 0x0486,
  10762. "pssquare",
  10763. 0x33b0,
  10764. "puhiragana",
  10765. 0x3077,
  10766. "pukatakana",
  10767. 0x30d7,
  10768. "pvsquare",
  10769. 0x33b4,
  10770. "pwsquare",
  10771. 0x33ba,
  10772. "q",
  10773. 0x0071,
  10774. "qadeva",
  10775. 0x0958,
  10776. "qadmahebrew",
  10777. 0x05a8,
  10778. "qafarabic",
  10779. 0x0642,
  10780. "qaffinalarabic",
  10781. 0xfed6,
  10782. "qafinitialarabic",
  10783. 0xfed7,
  10784. "qafmedialarabic",
  10785. 0xfed8,
  10786. "qamats",
  10787. 0x05b8,
  10788. "qamats10",
  10789. 0x05b8,
  10790. "qamats1a",
  10791. 0x05b8,
  10792. "qamats1c",
  10793. 0x05b8,
  10794. "qamats27",
  10795. 0x05b8,
  10796. "qamats29",
  10797. 0x05b8,
  10798. "qamats33",
  10799. 0x05b8,
  10800. "qamatsde",
  10801. 0x05b8,
  10802. "qamatshebrew",
  10803. 0x05b8,
  10804. "qamatsnarrowhebrew",
  10805. 0x05b8,
  10806. "qamatsqatanhebrew",
  10807. 0x05b8,
  10808. "qamatsqatannarrowhebrew",
  10809. 0x05b8,
  10810. "qamatsqatanquarterhebrew",
  10811. 0x05b8,
  10812. "qamatsqatanwidehebrew",
  10813. 0x05b8,
  10814. "qamatsquarterhebrew",
  10815. 0x05b8,
  10816. "qamatswidehebrew",
  10817. 0x05b8,
  10818. "qarneyparahebrew",
  10819. 0x059f,
  10820. "qbopomofo",
  10821. 0x3111,
  10822. "qcircle",
  10823. 0x24e0,
  10824. "qhook",
  10825. 0x02a0,
  10826. "qmonospace",
  10827. 0xff51,
  10828. "qof",
  10829. 0x05e7,
  10830. "qofdagesh",
  10831. 0xfb47,
  10832. "qofdageshhebrew",
  10833. 0xfb47,
  10834. "qofhebrew",
  10835. 0x05e7,
  10836. "qparen",
  10837. 0x24ac,
  10838. "quarternote",
  10839. 0x2669,
  10840. "qubuts",
  10841. 0x05bb,
  10842. "qubuts18",
  10843. 0x05bb,
  10844. "qubuts25",
  10845. 0x05bb,
  10846. "qubuts31",
  10847. 0x05bb,
  10848. "qubutshebrew",
  10849. 0x05bb,
  10850. "qubutsnarrowhebrew",
  10851. 0x05bb,
  10852. "qubutsquarterhebrew",
  10853. 0x05bb,
  10854. "qubutswidehebrew",
  10855. 0x05bb,
  10856. "question",
  10857. 0x003f,
  10858. "questionarabic",
  10859. 0x061f,
  10860. "questionarmenian",
  10861. 0x055e,
  10862. "questiondown",
  10863. 0x00bf,
  10864. "questiondownsmall",
  10865. 0xf7bf,
  10866. "questiongreek",
  10867. 0x037e,
  10868. "questionmonospace",
  10869. 0xff1f,
  10870. "questionsmall",
  10871. 0xf73f,
  10872. "quotedbl",
  10873. 0x0022,
  10874. "quotedblbase",
  10875. 0x201e,
  10876. "quotedblleft",
  10877. 0x201c,
  10878. "quotedblmonospace",
  10879. 0xff02,
  10880. "quotedblprime",
  10881. 0x301e,
  10882. "quotedblprimereversed",
  10883. 0x301d,
  10884. "quotedblright",
  10885. 0x201d,
  10886. "quoteleft",
  10887. 0x2018,
  10888. "quoteleftreversed",
  10889. 0x201b,
  10890. "quotereversed",
  10891. 0x201b,
  10892. "quoteright",
  10893. 0x2019,
  10894. "quoterightn",
  10895. 0x0149,
  10896. "quotesinglbase",
  10897. 0x201a,
  10898. "quotesingle",
  10899. 0x0027,
  10900. "quotesinglemonospace",
  10901. 0xff07,
  10902. "r",
  10903. 0x0072,
  10904. "raarmenian",
  10905. 0x057c,
  10906. "rabengali",
  10907. 0x09b0,
  10908. "racute",
  10909. 0x0155,
  10910. "radeva",
  10911. 0x0930,
  10912. "radical",
  10913. 0x221a,
  10914. "radicalex",
  10915. 0xf8e5,
  10916. "radoverssquare",
  10917. 0x33ae,
  10918. "radoverssquaredsquare",
  10919. 0x33af,
  10920. "radsquare",
  10921. 0x33ad,
  10922. "rafe",
  10923. 0x05bf,
  10924. "rafehebrew",
  10925. 0x05bf,
  10926. "ragujarati",
  10927. 0x0ab0,
  10928. "ragurmukhi",
  10929. 0x0a30,
  10930. "rahiragana",
  10931. 0x3089,
  10932. "rakatakana",
  10933. 0x30e9,
  10934. "rakatakanahalfwidth",
  10935. 0xff97,
  10936. "ralowerdiagonalbengali",
  10937. 0x09f1,
  10938. "ramiddlediagonalbengali",
  10939. 0x09f0,
  10940. "ramshorn",
  10941. 0x0264,
  10942. "ratio",
  10943. 0x2236,
  10944. "rbopomofo",
  10945. 0x3116,
  10946. "rcaron",
  10947. 0x0159,
  10948. "rcedilla",
  10949. 0x0157,
  10950. "rcircle",
  10951. 0x24e1,
  10952. "rcommaaccent",
  10953. 0x0157,
  10954. "rdblgrave",
  10955. 0x0211,
  10956. "rdotaccent",
  10957. 0x1e59,
  10958. "rdotbelow",
  10959. 0x1e5b,
  10960. "rdotbelowmacron",
  10961. 0x1e5d,
  10962. "referencemark",
  10963. 0x203b,
  10964. "reflexsubset",
  10965. 0x2286,
  10966. "reflexsuperset",
  10967. 0x2287,
  10968. "registered",
  10969. 0x00ae,
  10970. "registersans",
  10971. 0xf8e8,
  10972. "registerserif",
  10973. 0xf6da,
  10974. "reharabic",
  10975. 0x0631,
  10976. "reharmenian",
  10977. 0x0580,
  10978. "rehfinalarabic",
  10979. 0xfeae,
  10980. "rehiragana",
  10981. 0x308c,
  10982. "rekatakana",
  10983. 0x30ec,
  10984. "rekatakanahalfwidth",
  10985. 0xff9a,
  10986. "resh",
  10987. 0x05e8,
  10988. "reshdageshhebrew",
  10989. 0xfb48,
  10990. "reshhebrew",
  10991. 0x05e8,
  10992. "reversedtilde",
  10993. 0x223d,
  10994. "reviahebrew",
  10995. 0x0597,
  10996. "reviamugrashhebrew",
  10997. 0x0597,
  10998. "revlogicalnot",
  10999. 0x2310,
  11000. "rfishhook",
  11001. 0x027e,
  11002. "rfishhookreversed",
  11003. 0x027f,
  11004. "rhabengali",
  11005. 0x09dd,
  11006. "rhadeva",
  11007. 0x095d,
  11008. "rho",
  11009. 0x03c1,
  11010. "rhook",
  11011. 0x027d,
  11012. "rhookturned",
  11013. 0x027b,
  11014. "rhookturnedsuperior",
  11015. 0x02b5,
  11016. "rhosymbolgreek",
  11017. 0x03f1,
  11018. "rhotichookmod",
  11019. 0x02de,
  11020. "rieulacirclekorean",
  11021. 0x3271,
  11022. "rieulaparenkorean",
  11023. 0x3211,
  11024. "rieulcirclekorean",
  11025. 0x3263,
  11026. "rieulhieuhkorean",
  11027. 0x3140,
  11028. "rieulkiyeokkorean",
  11029. 0x313a,
  11030. "rieulkiyeoksioskorean",
  11031. 0x3169,
  11032. "rieulkorean",
  11033. 0x3139,
  11034. "rieulmieumkorean",
  11035. 0x313b,
  11036. "rieulpansioskorean",
  11037. 0x316c,
  11038. "rieulparenkorean",
  11039. 0x3203,
  11040. "rieulphieuphkorean",
  11041. 0x313f,
  11042. "rieulpieupkorean",
  11043. 0x313c,
  11044. "rieulpieupsioskorean",
  11045. 0x316b,
  11046. "rieulsioskorean",
  11047. 0x313d,
  11048. "rieulthieuthkorean",
  11049. 0x313e,
  11050. "rieultikeutkorean",
  11051. 0x316a,
  11052. "rieulyeorinhieuhkorean",
  11053. 0x316d,
  11054. "rightangle",
  11055. 0x221f,
  11056. "righttackbelowcmb",
  11057. 0x0319,
  11058. "righttriangle",
  11059. 0x22bf,
  11060. "rihiragana",
  11061. 0x308a,
  11062. "rikatakana",
  11063. 0x30ea,
  11064. "rikatakanahalfwidth",
  11065. 0xff98,
  11066. "ring",
  11067. 0x02da,
  11068. "ringbelowcmb",
  11069. 0x0325,
  11070. "ringcmb",
  11071. 0x030a,
  11072. "ringhalfleft",
  11073. 0x02bf,
  11074. "ringhalfleftarmenian",
  11075. 0x0559,
  11076. "ringhalfleftbelowcmb",
  11077. 0x031c,
  11078. "ringhalfleftcentered",
  11079. 0x02d3,
  11080. "ringhalfright",
  11081. 0x02be,
  11082. "ringhalfrightbelowcmb",
  11083. 0x0339,
  11084. "ringhalfrightcentered",
  11085. 0x02d2,
  11086. "rinvertedbreve",
  11087. 0x0213,
  11088. "rittorusquare",
  11089. 0x3351,
  11090. "rlinebelow",
  11091. 0x1e5f,
  11092. "rlongleg",
  11093. 0x027c,
  11094. "rlonglegturned",
  11095. 0x027a,
  11096. "rmonospace",
  11097. 0xff52,
  11098. "rohiragana",
  11099. 0x308d,
  11100. "rokatakana",
  11101. 0x30ed,
  11102. "rokatakanahalfwidth",
  11103. 0xff9b,
  11104. "roruathai",
  11105. 0x0e23,
  11106. "rparen",
  11107. 0x24ad,
  11108. "rrabengali",
  11109. 0x09dc,
  11110. "rradeva",
  11111. 0x0931,
  11112. "rragurmukhi",
  11113. 0x0a5c,
  11114. "rreharabic",
  11115. 0x0691,
  11116. "rrehfinalarabic",
  11117. 0xfb8d,
  11118. "rrvocalicbengali",
  11119. 0x09e0,
  11120. "rrvocalicdeva",
  11121. 0x0960,
  11122. "rrvocalicgujarati",
  11123. 0x0ae0,
  11124. "rrvocalicvowelsignbengali",
  11125. 0x09c4,
  11126. "rrvocalicvowelsigndeva",
  11127. 0x0944,
  11128. "rrvocalicvowelsigngujarati",
  11129. 0x0ac4,
  11130. "rsuperior",
  11131. 0xf6f1,
  11132. "rtblock",
  11133. 0x2590,
  11134. "rturned",
  11135. 0x0279,
  11136. "rturnedsuperior",
  11137. 0x02b4,
  11138. "ruhiragana",
  11139. 0x308b,
  11140. "rukatakana",
  11141. 0x30eb,
  11142. "rukatakanahalfwidth",
  11143. 0xff99,
  11144. "rupeemarkbengali",
  11145. 0x09f2,
  11146. "rupeesignbengali",
  11147. 0x09f3,
  11148. "rupiah",
  11149. 0xf6dd,
  11150. "ruthai",
  11151. 0x0e24,
  11152. "rvocalicbengali",
  11153. 0x098b,
  11154. "rvocalicdeva",
  11155. 0x090b,
  11156. "rvocalicgujarati",
  11157. 0x0a8b,
  11158. "rvocalicvowelsignbengali",
  11159. 0x09c3,
  11160. "rvocalicvowelsigndeva",
  11161. 0x0943,
  11162. "rvocalicvowelsigngujarati",
  11163. 0x0ac3,
  11164. "s",
  11165. 0x0073,
  11166. "sabengali",
  11167. 0x09b8,
  11168. "sacute",
  11169. 0x015b,
  11170. "sacutedotaccent",
  11171. 0x1e65,
  11172. "sadarabic",
  11173. 0x0635,
  11174. "sadeva",
  11175. 0x0938,
  11176. "sadfinalarabic",
  11177. 0xfeba,
  11178. "sadinitialarabic",
  11179. 0xfebb,
  11180. "sadmedialarabic",
  11181. 0xfebc,
  11182. "sagujarati",
  11183. 0x0ab8,
  11184. "sagurmukhi",
  11185. 0x0a38,
  11186. "sahiragana",
  11187. 0x3055,
  11188. "sakatakana",
  11189. 0x30b5,
  11190. "sakatakanahalfwidth",
  11191. 0xff7b,
  11192. "sallallahoualayhewasallamarabic",
  11193. 0xfdfa,
  11194. "samekh",
  11195. 0x05e1,
  11196. "samekhdagesh",
  11197. 0xfb41,
  11198. "samekhdageshhebrew",
  11199. 0xfb41,
  11200. "samekhhebrew",
  11201. 0x05e1,
  11202. "saraaathai",
  11203. 0x0e32,
  11204. "saraaethai",
  11205. 0x0e41,
  11206. "saraaimaimalaithai",
  11207. 0x0e44,
  11208. "saraaimaimuanthai",
  11209. 0x0e43,
  11210. "saraamthai",
  11211. 0x0e33,
  11212. "saraathai",
  11213. 0x0e30,
  11214. "saraethai",
  11215. 0x0e40,
  11216. "saraiileftthai",
  11217. 0xf886,
  11218. "saraiithai",
  11219. 0x0e35,
  11220. "saraileftthai",
  11221. 0xf885,
  11222. "saraithai",
  11223. 0x0e34,
  11224. "saraothai",
  11225. 0x0e42,
  11226. "saraueeleftthai",
  11227. 0xf888,
  11228. "saraueethai",
  11229. 0x0e37,
  11230. "saraueleftthai",
  11231. 0xf887,
  11232. "sarauethai",
  11233. 0x0e36,
  11234. "sarauthai",
  11235. 0x0e38,
  11236. "sarauuthai",
  11237. 0x0e39,
  11238. "sbopomofo",
  11239. 0x3119,
  11240. "scaron",
  11241. 0x0161,
  11242. "scarondotaccent",
  11243. 0x1e67,
  11244. "scedilla",
  11245. 0x015f,
  11246. "schwa",
  11247. 0x0259,
  11248. "schwacyrillic",
  11249. 0x04d9,
  11250. "schwadieresiscyrillic",
  11251. 0x04db,
  11252. "schwahook",
  11253. 0x025a,
  11254. "scircle",
  11255. 0x24e2,
  11256. "scircumflex",
  11257. 0x015d,
  11258. "scommaaccent",
  11259. 0x0219,
  11260. "sdotaccent",
  11261. 0x1e61,
  11262. "sdotbelow",
  11263. 0x1e63,
  11264. "sdotbelowdotaccent",
  11265. 0x1e69,
  11266. "seagullbelowcmb",
  11267. 0x033c,
  11268. "second",
  11269. 0x2033,
  11270. "secondtonechinese",
  11271. 0x02ca,
  11272. "section",
  11273. 0x00a7,
  11274. "seenarabic",
  11275. 0x0633,
  11276. "seenfinalarabic",
  11277. 0xfeb2,
  11278. "seeninitialarabic",
  11279. 0xfeb3,
  11280. "seenmedialarabic",
  11281. 0xfeb4,
  11282. "segol",
  11283. 0x05b6,
  11284. "segol13",
  11285. 0x05b6,
  11286. "segol1f",
  11287. 0x05b6,
  11288. "segol2c",
  11289. 0x05b6,
  11290. "segolhebrew",
  11291. 0x05b6,
  11292. "segolnarrowhebrew",
  11293. 0x05b6,
  11294. "segolquarterhebrew",
  11295. 0x05b6,
  11296. "segoltahebrew",
  11297. 0x0592,
  11298. "segolwidehebrew",
  11299. 0x05b6,
  11300. "seharmenian",
  11301. 0x057d,
  11302. "sehiragana",
  11303. 0x305b,
  11304. "sekatakana",
  11305. 0x30bb,
  11306. "sekatakanahalfwidth",
  11307. 0xff7e,
  11308. "semicolon",
  11309. 0x003b,
  11310. "semicolonarabic",
  11311. 0x061b,
  11312. "semicolonmonospace",
  11313. 0xff1b,
  11314. "semicolonsmall",
  11315. 0xfe54,
  11316. "semivoicedmarkkana",
  11317. 0x309c,
  11318. "semivoicedmarkkanahalfwidth",
  11319. 0xff9f,
  11320. "sentisquare",
  11321. 0x3322,
  11322. "sentosquare",
  11323. 0x3323,
  11324. "seven",
  11325. 0x0037,
  11326. "sevenarabic",
  11327. 0x0667,
  11328. "sevenbengali",
  11329. 0x09ed,
  11330. "sevencircle",
  11331. 0x2466,
  11332. "sevencircleinversesansserif",
  11333. 0x2790,
  11334. "sevendeva",
  11335. 0x096d,
  11336. "seveneighths",
  11337. 0x215e,
  11338. "sevengujarati",
  11339. 0x0aed,
  11340. "sevengurmukhi",
  11341. 0x0a6d,
  11342. "sevenhackarabic",
  11343. 0x0667,
  11344. "sevenhangzhou",
  11345. 0x3027,
  11346. "sevenideographicparen",
  11347. 0x3226,
  11348. "seveninferior",
  11349. 0x2087,
  11350. "sevenmonospace",
  11351. 0xff17,
  11352. "sevenoldstyle",
  11353. 0xf737,
  11354. "sevenparen",
  11355. 0x247a,
  11356. "sevenperiod",
  11357. 0x248e,
  11358. "sevenpersian",
  11359. 0x06f7,
  11360. "sevenroman",
  11361. 0x2176,
  11362. "sevensuperior",
  11363. 0x2077,
  11364. "seventeencircle",
  11365. 0x2470,
  11366. "seventeenparen",
  11367. 0x2484,
  11368. "seventeenperiod",
  11369. 0x2498,
  11370. "seventhai",
  11371. 0x0e57,
  11372. "sfthyphen",
  11373. 0x00ad,
  11374. "shaarmenian",
  11375. 0x0577,
  11376. "shabengali",
  11377. 0x09b6,
  11378. "shacyrillic",
  11379. 0x0448,
  11380. "shaddaarabic",
  11381. 0x0651,
  11382. "shaddadammaarabic",
  11383. 0xfc61,
  11384. "shaddadammatanarabic",
  11385. 0xfc5e,
  11386. "shaddafathaarabic",
  11387. 0xfc60,
  11388. "shaddakasraarabic",
  11389. 0xfc62,
  11390. "shaddakasratanarabic",
  11391. 0xfc5f,
  11392. "shade",
  11393. 0x2592,
  11394. "shadedark",
  11395. 0x2593,
  11396. "shadelight",
  11397. 0x2591,
  11398. "shademedium",
  11399. 0x2592,
  11400. "shadeva",
  11401. 0x0936,
  11402. "shagujarati",
  11403. 0x0ab6,
  11404. "shagurmukhi",
  11405. 0x0a36,
  11406. "shalshelethebrew",
  11407. 0x0593,
  11408. "shbopomofo",
  11409. 0x3115,
  11410. "shchacyrillic",
  11411. 0x0449,
  11412. "sheenarabic",
  11413. 0x0634,
  11414. "sheenfinalarabic",
  11415. 0xfeb6,
  11416. "sheeninitialarabic",
  11417. 0xfeb7,
  11418. "sheenmedialarabic",
  11419. 0xfeb8,
  11420. "sheicoptic",
  11421. 0x03e3,
  11422. "sheqel",
  11423. 0x20aa,
  11424. "sheqelhebrew",
  11425. 0x20aa,
  11426. "sheva",
  11427. 0x05b0,
  11428. "sheva115",
  11429. 0x05b0,
  11430. "sheva15",
  11431. 0x05b0,
  11432. "sheva22",
  11433. 0x05b0,
  11434. "sheva2e",
  11435. 0x05b0,
  11436. "shevahebrew",
  11437. 0x05b0,
  11438. "shevanarrowhebrew",
  11439. 0x05b0,
  11440. "shevaquarterhebrew",
  11441. 0x05b0,
  11442. "shevawidehebrew",
  11443. 0x05b0,
  11444. "shhacyrillic",
  11445. 0x04bb,
  11446. "shimacoptic",
  11447. 0x03ed,
  11448. "shin",
  11449. 0x05e9,
  11450. "shindagesh",
  11451. 0xfb49,
  11452. "shindageshhebrew",
  11453. 0xfb49,
  11454. "shindageshshindot",
  11455. 0xfb2c,
  11456. "shindageshshindothebrew",
  11457. 0xfb2c,
  11458. "shindageshsindot",
  11459. 0xfb2d,
  11460. "shindageshsindothebrew",
  11461. 0xfb2d,
  11462. "shindothebrew",
  11463. 0x05c1,
  11464. "shinhebrew",
  11465. 0x05e9,
  11466. "shinshindot",
  11467. 0xfb2a,
  11468. "shinshindothebrew",
  11469. 0xfb2a,
  11470. "shinsindot",
  11471. 0xfb2b,
  11472. "shinsindothebrew",
  11473. 0xfb2b,
  11474. "shook",
  11475. 0x0282,
  11476. "sigma",
  11477. 0x03c3,
  11478. "sigma1",
  11479. 0x03c2,
  11480. "sigmafinal",
  11481. 0x03c2,
  11482. "sigmalunatesymbolgreek",
  11483. 0x03f2,
  11484. "sihiragana",
  11485. 0x3057,
  11486. "sikatakana",
  11487. 0x30b7,
  11488. "sikatakanahalfwidth",
  11489. 0xff7c,
  11490. "siluqhebrew",
  11491. 0x05bd,
  11492. "siluqlefthebrew",
  11493. 0x05bd,
  11494. "similar",
  11495. 0x223c,
  11496. "sindothebrew",
  11497. 0x05c2,
  11498. "siosacirclekorean",
  11499. 0x3274,
  11500. "siosaparenkorean",
  11501. 0x3214,
  11502. "sioscieuckorean",
  11503. 0x317e,
  11504. "sioscirclekorean",
  11505. 0x3266,
  11506. "sioskiyeokkorean",
  11507. 0x317a,
  11508. "sioskorean",
  11509. 0x3145,
  11510. "siosnieunkorean",
  11511. 0x317b,
  11512. "siosparenkorean",
  11513. 0x3206,
  11514. "siospieupkorean",
  11515. 0x317d,
  11516. "siostikeutkorean",
  11517. 0x317c,
  11518. "six",
  11519. 0x0036,
  11520. "sixarabic",
  11521. 0x0666,
  11522. "sixbengali",
  11523. 0x09ec,
  11524. "sixcircle",
  11525. 0x2465,
  11526. "sixcircleinversesansserif",
  11527. 0x278f,
  11528. "sixdeva",
  11529. 0x096c,
  11530. "sixgujarati",
  11531. 0x0aec,
  11532. "sixgurmukhi",
  11533. 0x0a6c,
  11534. "sixhackarabic",
  11535. 0x0666,
  11536. "sixhangzhou",
  11537. 0x3026,
  11538. "sixideographicparen",
  11539. 0x3225,
  11540. "sixinferior",
  11541. 0x2086,
  11542. "sixmonospace",
  11543. 0xff16,
  11544. "sixoldstyle",
  11545. 0xf736,
  11546. "sixparen",
  11547. 0x2479,
  11548. "sixperiod",
  11549. 0x248d,
  11550. "sixpersian",
  11551. 0x06f6,
  11552. "sixroman",
  11553. 0x2175,
  11554. "sixsuperior",
  11555. 0x2076,
  11556. "sixteencircle",
  11557. 0x246f,
  11558. "sixteencurrencydenominatorbengali",
  11559. 0x09f9,
  11560. "sixteenparen",
  11561. 0x2483,
  11562. "sixteenperiod",
  11563. 0x2497,
  11564. "sixthai",
  11565. 0x0e56,
  11566. "slash",
  11567. 0x002f,
  11568. "slashmonospace",
  11569. 0xff0f,
  11570. "slong",
  11571. 0x017f,
  11572. "slongdotaccent",
  11573. 0x1e9b,
  11574. "smileface",
  11575. 0x263a,
  11576. "smonospace",
  11577. 0xff53,
  11578. "sofpasuqhebrew",
  11579. 0x05c3,
  11580. "softhyphen",
  11581. 0x00ad,
  11582. "softsigncyrillic",
  11583. 0x044c,
  11584. "sohiragana",
  11585. 0x305d,
  11586. "sokatakana",
  11587. 0x30bd,
  11588. "sokatakanahalfwidth",
  11589. 0xff7f,
  11590. "soliduslongoverlaycmb",
  11591. 0x0338,
  11592. "solidusshortoverlaycmb",
  11593. 0x0337,
  11594. "sorusithai",
  11595. 0x0e29,
  11596. "sosalathai",
  11597. 0x0e28,
  11598. "sosothai",
  11599. 0x0e0b,
  11600. "sosuathai",
  11601. 0x0e2a,
  11602. "space",
  11603. 0x0020,
  11604. "spacehackarabic",
  11605. 0x0020,
  11606. "spade",
  11607. 0x2660,
  11608. "spadesuitblack",
  11609. 0x2660,
  11610. "spadesuitwhite",
  11611. 0x2664,
  11612. "sparen",
  11613. 0x24ae,
  11614. "squarebelowcmb",
  11615. 0x033b,
  11616. "squarecc",
  11617. 0x33c4,
  11618. "squarecm",
  11619. 0x339d,
  11620. "squarediagonalcrosshatchfill",
  11621. 0x25a9,
  11622. "squarehorizontalfill",
  11623. 0x25a4,
  11624. "squarekg",
  11625. 0x338f,
  11626. "squarekm",
  11627. 0x339e,
  11628. "squarekmcapital",
  11629. 0x33ce,
  11630. "squareln",
  11631. 0x33d1,
  11632. "squarelog",
  11633. 0x33d2,
  11634. "squaremg",
  11635. 0x338e,
  11636. "squaremil",
  11637. 0x33d5,
  11638. "squaremm",
  11639. 0x339c,
  11640. "squaremsquared",
  11641. 0x33a1,
  11642. "squareorthogonalcrosshatchfill",
  11643. 0x25a6,
  11644. "squareupperlefttolowerrightfill",
  11645. 0x25a7,
  11646. "squareupperrighttolowerleftfill",
  11647. 0x25a8,
  11648. "squareverticalfill",
  11649. 0x25a5,
  11650. "squarewhitewithsmallblack",
  11651. 0x25a3,
  11652. "srsquare",
  11653. 0x33db,
  11654. "ssabengali",
  11655. 0x09b7,
  11656. "ssadeva",
  11657. 0x0937,
  11658. "ssagujarati",
  11659. 0x0ab7,
  11660. "ssangcieuckorean",
  11661. 0x3149,
  11662. "ssanghieuhkorean",
  11663. 0x3185,
  11664. "ssangieungkorean",
  11665. 0x3180,
  11666. "ssangkiyeokkorean",
  11667. 0x3132,
  11668. "ssangnieunkorean",
  11669. 0x3165,
  11670. "ssangpieupkorean",
  11671. 0x3143,
  11672. "ssangsioskorean",
  11673. 0x3146,
  11674. "ssangtikeutkorean",
  11675. 0x3138,
  11676. "ssuperior",
  11677. 0xf6f2,
  11678. "sterling",
  11679. 0x00a3,
  11680. "sterlingmonospace",
  11681. 0xffe1,
  11682. "strokelongoverlaycmb",
  11683. 0x0336,
  11684. "strokeshortoverlaycmb",
  11685. 0x0335,
  11686. "subset",
  11687. 0x2282,
  11688. "subsetnotequal",
  11689. 0x228a,
  11690. "subsetorequal",
  11691. 0x2286,
  11692. "succeeds",
  11693. 0x227b,
  11694. "suchthat",
  11695. 0x220b,
  11696. "suhiragana",
  11697. 0x3059,
  11698. "sukatakana",
  11699. 0x30b9,
  11700. "sukatakanahalfwidth",
  11701. 0xff7d,
  11702. "sukunarabic",
  11703. 0x0652,
  11704. "summation",
  11705. 0x2211,
  11706. "sun",
  11707. 0x263c,
  11708. "superset",
  11709. 0x2283,
  11710. "supersetnotequal",
  11711. 0x228b,
  11712. "supersetorequal",
  11713. 0x2287,
  11714. "svsquare",
  11715. 0x33dc,
  11716. "syouwaerasquare",
  11717. 0x337c,
  11718. "t",
  11719. 0x0074,
  11720. "tabengali",
  11721. 0x09a4,
  11722. "tackdown",
  11723. 0x22a4,
  11724. "tackleft",
  11725. 0x22a3,
  11726. "tadeva",
  11727. 0x0924,
  11728. "tagujarati",
  11729. 0x0aa4,
  11730. "tagurmukhi",
  11731. 0x0a24,
  11732. "taharabic",
  11733. 0x0637,
  11734. "tahfinalarabic",
  11735. 0xfec2,
  11736. "tahinitialarabic",
  11737. 0xfec3,
  11738. "tahiragana",
  11739. 0x305f,
  11740. "tahmedialarabic",
  11741. 0xfec4,
  11742. "taisyouerasquare",
  11743. 0x337d,
  11744. "takatakana",
  11745. 0x30bf,
  11746. "takatakanahalfwidth",
  11747. 0xff80,
  11748. "tatweelarabic",
  11749. 0x0640,
  11750. "tau",
  11751. 0x03c4,
  11752. "tav",
  11753. 0x05ea,
  11754. "tavdages",
  11755. 0xfb4a,
  11756. "tavdagesh",
  11757. 0xfb4a,
  11758. "tavdageshhebrew",
  11759. 0xfb4a,
  11760. "tavhebrew",
  11761. 0x05ea,
  11762. "tbar",
  11763. 0x0167,
  11764. "tbopomofo",
  11765. 0x310a,
  11766. "tcaron",
  11767. 0x0165,
  11768. "tccurl",
  11769. 0x02a8,
  11770. "tcedilla",
  11771. 0x0163,
  11772. "tcheharabic",
  11773. 0x0686,
  11774. "tchehfinalarabic",
  11775. 0xfb7b,
  11776. "tchehinitialarabic",
  11777. 0xfb7c,
  11778. "tchehmedialarabic",
  11779. 0xfb7d,
  11780. "tcircle",
  11781. 0x24e3,
  11782. "tcircumflexbelow",
  11783. 0x1e71,
  11784. "tcommaaccent",
  11785. 0x0163,
  11786. "tdieresis",
  11787. 0x1e97,
  11788. "tdotaccent",
  11789. 0x1e6b,
  11790. "tdotbelow",
  11791. 0x1e6d,
  11792. "tecyrillic",
  11793. 0x0442,
  11794. "tedescendercyrillic",
  11795. 0x04ad,
  11796. "teharabic",
  11797. 0x062a,
  11798. "tehfinalarabic",
  11799. 0xfe96,
  11800. "tehhahinitialarabic",
  11801. 0xfca2,
  11802. "tehhahisolatedarabic",
  11803. 0xfc0c,
  11804. "tehinitialarabic",
  11805. 0xfe97,
  11806. "tehiragana",
  11807. 0x3066,
  11808. "tehjeeminitialarabic",
  11809. 0xfca1,
  11810. "tehjeemisolatedarabic",
  11811. 0xfc0b,
  11812. "tehmarbutaarabic",
  11813. 0x0629,
  11814. "tehmarbutafinalarabic",
  11815. 0xfe94,
  11816. "tehmedialarabic",
  11817. 0xfe98,
  11818. "tehmeeminitialarabic",
  11819. 0xfca4,
  11820. "tehmeemisolatedarabic",
  11821. 0xfc0e,
  11822. "tehnoonfinalarabic",
  11823. 0xfc73,
  11824. "tekatakana",
  11825. 0x30c6,
  11826. "tekatakanahalfwidth",
  11827. 0xff83,
  11828. "telephone",
  11829. 0x2121,
  11830. "telephoneblack",
  11831. 0x260e,
  11832. "telishagedolahebrew",
  11833. 0x05a0,
  11834. "telishaqetanahebrew",
  11835. 0x05a9,
  11836. "tencircle",
  11837. 0x2469,
  11838. "tenideographicparen",
  11839. 0x3229,
  11840. "tenparen",
  11841. 0x247d,
  11842. "tenperiod",
  11843. 0x2491,
  11844. "tenroman",
  11845. 0x2179,
  11846. "tesh",
  11847. 0x02a7,
  11848. "tet",
  11849. 0x05d8,
  11850. "tetdagesh",
  11851. 0xfb38,
  11852. "tetdageshhebrew",
  11853. 0xfb38,
  11854. "tethebrew",
  11855. 0x05d8,
  11856. "tetsecyrillic",
  11857. 0x04b5,
  11858. "tevirhebrew",
  11859. 0x059b,
  11860. "tevirlefthebrew",
  11861. 0x059b,
  11862. "thabengali",
  11863. 0x09a5,
  11864. "thadeva",
  11865. 0x0925,
  11866. "thagujarati",
  11867. 0x0aa5,
  11868. "thagurmukhi",
  11869. 0x0a25,
  11870. "thalarabic",
  11871. 0x0630,
  11872. "thalfinalarabic",
  11873. 0xfeac,
  11874. "thanthakhatlowleftthai",
  11875. 0xf898,
  11876. "thanthakhatlowrightthai",
  11877. 0xf897,
  11878. "thanthakhatthai",
  11879. 0x0e4c,
  11880. "thanthakhatupperleftthai",
  11881. 0xf896,
  11882. "theharabic",
  11883. 0x062b,
  11884. "thehfinalarabic",
  11885. 0xfe9a,
  11886. "thehinitialarabic",
  11887. 0xfe9b,
  11888. "thehmedialarabic",
  11889. 0xfe9c,
  11890. "thereexists",
  11891. 0x2203,
  11892. "therefore",
  11893. 0x2234,
  11894. "theta",
  11895. 0x03b8,
  11896. "theta1",
  11897. 0x03d1,
  11898. "thetasymbolgreek",
  11899. 0x03d1,
  11900. "thieuthacirclekorean",
  11901. 0x3279,
  11902. "thieuthaparenkorean",
  11903. 0x3219,
  11904. "thieuthcirclekorean",
  11905. 0x326b,
  11906. "thieuthkorean",
  11907. 0x314c,
  11908. "thieuthparenkorean",
  11909. 0x320b,
  11910. "thirteencircle",
  11911. 0x246c,
  11912. "thirteenparen",
  11913. 0x2480,
  11914. "thirteenperiod",
  11915. 0x2494,
  11916. "thonangmonthothai",
  11917. 0x0e11,
  11918. "thook",
  11919. 0x01ad,
  11920. "thophuthaothai",
  11921. 0x0e12,
  11922. "thorn",
  11923. 0x00fe,
  11924. "thothahanthai",
  11925. 0x0e17,
  11926. "thothanthai",
  11927. 0x0e10,
  11928. "thothongthai",
  11929. 0x0e18,
  11930. "thothungthai",
  11931. 0x0e16,
  11932. "thousandcyrillic",
  11933. 0x0482,
  11934. "thousandsseparatorarabic",
  11935. 0x066c,
  11936. "thousandsseparatorpersian",
  11937. 0x066c,
  11938. "three",
  11939. 0x0033,
  11940. "threearabic",
  11941. 0x0663,
  11942. "threebengali",
  11943. 0x09e9,
  11944. "threecircle",
  11945. 0x2462,
  11946. "threecircleinversesansserif",
  11947. 0x278c,
  11948. "threedeva",
  11949. 0x0969,
  11950. "threeeighths",
  11951. 0x215c,
  11952. "threegujarati",
  11953. 0x0ae9,
  11954. "threegurmukhi",
  11955. 0x0a69,
  11956. "threehackarabic",
  11957. 0x0663,
  11958. "threehangzhou",
  11959. 0x3023,
  11960. "threeideographicparen",
  11961. 0x3222,
  11962. "threeinferior",
  11963. 0x2083,
  11964. "threemonospace",
  11965. 0xff13,
  11966. "threenumeratorbengali",
  11967. 0x09f6,
  11968. "threeoldstyle",
  11969. 0xf733,
  11970. "threeparen",
  11971. 0x2476,
  11972. "threeperiod",
  11973. 0x248a,
  11974. "threepersian",
  11975. 0x06f3,
  11976. "threequarters",
  11977. 0x00be,
  11978. "threequartersemdash",
  11979. 0xf6de,
  11980. "threeroman",
  11981. 0x2172,
  11982. "threesuperior",
  11983. 0x00b3,
  11984. "threethai",
  11985. 0x0e53,
  11986. "thzsquare",
  11987. 0x3394,
  11988. "tihiragana",
  11989. 0x3061,
  11990. "tikatakana",
  11991. 0x30c1,
  11992. "tikatakanahalfwidth",
  11993. 0xff81,
  11994. "tikeutacirclekorean",
  11995. 0x3270,
  11996. "tikeutaparenkorean",
  11997. 0x3210,
  11998. "tikeutcirclekorean",
  11999. 0x3262,
  12000. "tikeutkorean",
  12001. 0x3137,
  12002. "tikeutparenkorean",
  12003. 0x3202,
  12004. "tilde",
  12005. 0x02dc,
  12006. "tildebelowcmb",
  12007. 0x0330,
  12008. "tildecmb",
  12009. 0x0303,
  12010. "tildecomb",
  12011. 0x0303,
  12012. "tildedoublecmb",
  12013. 0x0360,
  12014. "tildeoperator",
  12015. 0x223c,
  12016. "tildeoverlaycmb",
  12017. 0x0334,
  12018. "tildeverticalcmb",
  12019. 0x033e,
  12020. "timescircle",
  12021. 0x2297,
  12022. "tipehahebrew",
  12023. 0x0596,
  12024. "tipehalefthebrew",
  12025. 0x0596,
  12026. "tippigurmukhi",
  12027. 0x0a70,
  12028. "titlocyrilliccmb",
  12029. 0x0483,
  12030. "tiwnarmenian",
  12031. 0x057f,
  12032. "tlinebelow",
  12033. 0x1e6f,
  12034. "tmonospace",
  12035. 0xff54,
  12036. "toarmenian",
  12037. 0x0569,
  12038. "tohiragana",
  12039. 0x3068,
  12040. "tokatakana",
  12041. 0x30c8,
  12042. "tokatakanahalfwidth",
  12043. 0xff84,
  12044. "tonebarextrahighmod",
  12045. 0x02e5,
  12046. "tonebarextralowmod",
  12047. 0x02e9,
  12048. "tonebarhighmod",
  12049. 0x02e6,
  12050. "tonebarlowmod",
  12051. 0x02e8,
  12052. "tonebarmidmod",
  12053. 0x02e7,
  12054. "tonefive",
  12055. 0x01bd,
  12056. "tonesix",
  12057. 0x0185,
  12058. "tonetwo",
  12059. 0x01a8,
  12060. "tonos",
  12061. 0x0384,
  12062. "tonsquare",
  12063. 0x3327,
  12064. "topatakthai",
  12065. 0x0e0f,
  12066. "tortoiseshellbracketleft",
  12067. 0x3014,
  12068. "tortoiseshellbracketleftsmall",
  12069. 0xfe5d,
  12070. "tortoiseshellbracketleftvertical",
  12071. 0xfe39,
  12072. "tortoiseshellbracketright",
  12073. 0x3015,
  12074. "tortoiseshellbracketrightsmall",
  12075. 0xfe5e,
  12076. "tortoiseshellbracketrightvertical",
  12077. 0xfe3a,
  12078. "totaothai",
  12079. 0x0e15,
  12080. "tpalatalhook",
  12081. 0x01ab,
  12082. "tparen",
  12083. 0x24af,
  12084. "trademark",
  12085. 0x2122,
  12086. "trademarksans",
  12087. 0xf8ea,
  12088. "trademarkserif",
  12089. 0xf6db,
  12090. "tretroflexhook",
  12091. 0x0288,
  12092. "triagdn",
  12093. 0x25bc,
  12094. "triaglf",
  12095. 0x25c4,
  12096. "triagrt",
  12097. 0x25ba,
  12098. "triagup",
  12099. 0x25b2,
  12100. "ts",
  12101. 0x02a6,
  12102. "tsadi",
  12103. 0x05e6,
  12104. "tsadidagesh",
  12105. 0xfb46,
  12106. "tsadidageshhebrew",
  12107. 0xfb46,
  12108. "tsadihebrew",
  12109. 0x05e6,
  12110. "tsecyrillic",
  12111. 0x0446,
  12112. "tsere",
  12113. 0x05b5,
  12114. "tsere12",
  12115. 0x05b5,
  12116. "tsere1e",
  12117. 0x05b5,
  12118. "tsere2b",
  12119. 0x05b5,
  12120. "tserehebrew",
  12121. 0x05b5,
  12122. "tserenarrowhebrew",
  12123. 0x05b5,
  12124. "tserequarterhebrew",
  12125. 0x05b5,
  12126. "tserewidehebrew",
  12127. 0x05b5,
  12128. "tshecyrillic",
  12129. 0x045b,
  12130. "tsuperior",
  12131. 0xf6f3,
  12132. "ttabengali",
  12133. 0x099f,
  12134. "ttadeva",
  12135. 0x091f,
  12136. "ttagujarati",
  12137. 0x0a9f,
  12138. "ttagurmukhi",
  12139. 0x0a1f,
  12140. "tteharabic",
  12141. 0x0679,
  12142. "ttehfinalarabic",
  12143. 0xfb67,
  12144. "ttehinitialarabic",
  12145. 0xfb68,
  12146. "ttehmedialarabic",
  12147. 0xfb69,
  12148. "tthabengali",
  12149. 0x09a0,
  12150. "tthadeva",
  12151. 0x0920,
  12152. "tthagujarati",
  12153. 0x0aa0,
  12154. "tthagurmukhi",
  12155. 0x0a20,
  12156. "tturned",
  12157. 0x0287,
  12158. "tuhiragana",
  12159. 0x3064,
  12160. "tukatakana",
  12161. 0x30c4,
  12162. "tukatakanahalfwidth",
  12163. 0xff82,
  12164. "tusmallhiragana",
  12165. 0x3063,
  12166. "tusmallkatakana",
  12167. 0x30c3,
  12168. "tusmallkatakanahalfwidth",
  12169. 0xff6f,
  12170. "twelvecircle",
  12171. 0x246b,
  12172. "twelveparen",
  12173. 0x247f,
  12174. "twelveperiod",
  12175. 0x2493,
  12176. "twelveroman",
  12177. 0x217b,
  12178. "twentycircle",
  12179. 0x2473,
  12180. "twentyhangzhou",
  12181. 0x5344,
  12182. "twentyparen",
  12183. 0x2487,
  12184. "twentyperiod",
  12185. 0x249b,
  12186. "two",
  12187. 0x0032,
  12188. "twoarabic",
  12189. 0x0662,
  12190. "twobengali",
  12191. 0x09e8,
  12192. "twocircle",
  12193. 0x2461,
  12194. "twocircleinversesansserif",
  12195. 0x278b,
  12196. "twodeva",
  12197. 0x0968,
  12198. "twodotenleader",
  12199. 0x2025,
  12200. "twodotleader",
  12201. 0x2025,
  12202. "twodotleadervertical",
  12203. 0xfe30,
  12204. "twogujarati",
  12205. 0x0ae8,
  12206. "twogurmukhi",
  12207. 0x0a68,
  12208. "twohackarabic",
  12209. 0x0662,
  12210. "twohangzhou",
  12211. 0x3022,
  12212. "twoideographicparen",
  12213. 0x3221,
  12214. "twoinferior",
  12215. 0x2082,
  12216. "twomonospace",
  12217. 0xff12,
  12218. "twonumeratorbengali",
  12219. 0x09f5,
  12220. "twooldstyle",
  12221. 0xf732,
  12222. "twoparen",
  12223. 0x2475,
  12224. "twoperiod",
  12225. 0x2489,
  12226. "twopersian",
  12227. 0x06f2,
  12228. "tworoman",
  12229. 0x2171,
  12230. "twostroke",
  12231. 0x01bb,
  12232. "twosuperior",
  12233. 0x00b2,
  12234. "twothai",
  12235. 0x0e52,
  12236. "twothirds",
  12237. 0x2154,
  12238. "u",
  12239. 0x0075,
  12240. "uacute",
  12241. 0x00fa,
  12242. "ubar",
  12243. 0x0289,
  12244. "ubengali",
  12245. 0x0989,
  12246. "ubopomofo",
  12247. 0x3128,
  12248. "ubreve",
  12249. 0x016d,
  12250. "ucaron",
  12251. 0x01d4,
  12252. "ucircle",
  12253. 0x24e4,
  12254. "ucircumflex",
  12255. 0x00fb,
  12256. "ucircumflexbelow",
  12257. 0x1e77,
  12258. "ucyrillic",
  12259. 0x0443,
  12260. "udattadeva",
  12261. 0x0951,
  12262. "udblacute",
  12263. 0x0171,
  12264. "udblgrave",
  12265. 0x0215,
  12266. "udeva",
  12267. 0x0909,
  12268. "udieresis",
  12269. 0x00fc,
  12270. "udieresisacute",
  12271. 0x01d8,
  12272. "udieresisbelow",
  12273. 0x1e73,
  12274. "udieresiscaron",
  12275. 0x01da,
  12276. "udieresiscyrillic",
  12277. 0x04f1,
  12278. "udieresisgrave",
  12279. 0x01dc,
  12280. "udieresismacron",
  12281. 0x01d6,
  12282. "udotbelow",
  12283. 0x1ee5,
  12284. "ugrave",
  12285. 0x00f9,
  12286. "ugujarati",
  12287. 0x0a89,
  12288. "ugurmukhi",
  12289. 0x0a09,
  12290. "uhiragana",
  12291. 0x3046,
  12292. "uhookabove",
  12293. 0x1ee7,
  12294. "uhorn",
  12295. 0x01b0,
  12296. "uhornacute",
  12297. 0x1ee9,
  12298. "uhorndotbelow",
  12299. 0x1ef1,
  12300. "uhorngrave",
  12301. 0x1eeb,
  12302. "uhornhookabove",
  12303. 0x1eed,
  12304. "uhorntilde",
  12305. 0x1eef,
  12306. "uhungarumlaut",
  12307. 0x0171,
  12308. "uhungarumlautcyrillic",
  12309. 0x04f3,
  12310. "uinvertedbreve",
  12311. 0x0217,
  12312. "ukatakana",
  12313. 0x30a6,
  12314. "ukatakanahalfwidth",
  12315. 0xff73,
  12316. "ukcyrillic",
  12317. 0x0479,
  12318. "ukorean",
  12319. 0x315c,
  12320. "umacron",
  12321. 0x016b,
  12322. "umacroncyrillic",
  12323. 0x04ef,
  12324. "umacrondieresis",
  12325. 0x1e7b,
  12326. "umatragurmukhi",
  12327. 0x0a41,
  12328. "umonospace",
  12329. 0xff55,
  12330. "underscore",
  12331. 0x005f,
  12332. "underscoredbl",
  12333. 0x2017,
  12334. "underscoremonospace",
  12335. 0xff3f,
  12336. "underscorevertical",
  12337. 0xfe33,
  12338. "underscorewavy",
  12339. 0xfe4f,
  12340. "union",
  12341. 0x222a,
  12342. "universal",
  12343. 0x2200,
  12344. "uogonek",
  12345. 0x0173,
  12346. "uparen",
  12347. 0x24b0,
  12348. "upblock",
  12349. 0x2580,
  12350. "upperdothebrew",
  12351. 0x05c4,
  12352. "upsilon",
  12353. 0x03c5,
  12354. "upsilondieresis",
  12355. 0x03cb,
  12356. "upsilondieresistonos",
  12357. 0x03b0,
  12358. "upsilonlatin",
  12359. 0x028a,
  12360. "upsilontonos",
  12361. 0x03cd,
  12362. "uptackbelowcmb",
  12363. 0x031d,
  12364. "uptackmod",
  12365. 0x02d4,
  12366. "uragurmukhi",
  12367. 0x0a73,
  12368. "uring",
  12369. 0x016f,
  12370. "ushortcyrillic",
  12371. 0x045e,
  12372. "usmallhiragana",
  12373. 0x3045,
  12374. "usmallkatakana",
  12375. 0x30a5,
  12376. "usmallkatakanahalfwidth",
  12377. 0xff69,
  12378. "ustraightcyrillic",
  12379. 0x04af,
  12380. "ustraightstrokecyrillic",
  12381. 0x04b1,
  12382. "utilde",
  12383. 0x0169,
  12384. "utildeacute",
  12385. 0x1e79,
  12386. "utildebelow",
  12387. 0x1e75,
  12388. "uubengali",
  12389. 0x098a,
  12390. "uudeva",
  12391. 0x090a,
  12392. "uugujarati",
  12393. 0x0a8a,
  12394. "uugurmukhi",
  12395. 0x0a0a,
  12396. "uumatragurmukhi",
  12397. 0x0a42,
  12398. "uuvowelsignbengali",
  12399. 0x09c2,
  12400. "uuvowelsigndeva",
  12401. 0x0942,
  12402. "uuvowelsigngujarati",
  12403. 0x0ac2,
  12404. "uvowelsignbengali",
  12405. 0x09c1,
  12406. "uvowelsigndeva",
  12407. 0x0941,
  12408. "uvowelsigngujarati",
  12409. 0x0ac1,
  12410. "v",
  12411. 0x0076,
  12412. "vadeva",
  12413. 0x0935,
  12414. "vagujarati",
  12415. 0x0ab5,
  12416. "vagurmukhi",
  12417. 0x0a35,
  12418. "vakatakana",
  12419. 0x30f7,
  12420. "vav",
  12421. 0x05d5,
  12422. "vavdagesh",
  12423. 0xfb35,
  12424. "vavdagesh65",
  12425. 0xfb35,
  12426. "vavdageshhebrew",
  12427. 0xfb35,
  12428. "vavhebrew",
  12429. 0x05d5,
  12430. "vavholam",
  12431. 0xfb4b,
  12432. "vavholamhebrew",
  12433. 0xfb4b,
  12434. "vavvavhebrew",
  12435. 0x05f0,
  12436. "vavyodhebrew",
  12437. 0x05f1,
  12438. "vcircle",
  12439. 0x24e5,
  12440. "vdotbelow",
  12441. 0x1e7f,
  12442. "vecyrillic",
  12443. 0x0432,
  12444. "veharabic",
  12445. 0x06a4,
  12446. "vehfinalarabic",
  12447. 0xfb6b,
  12448. "vehinitialarabic",
  12449. 0xfb6c,
  12450. "vehmedialarabic",
  12451. 0xfb6d,
  12452. "vekatakana",
  12453. 0x30f9,
  12454. "venus",
  12455. 0x2640,
  12456. "verticalbar",
  12457. 0x007c,
  12458. "verticallineabovecmb",
  12459. 0x030d,
  12460. "verticallinebelowcmb",
  12461. 0x0329,
  12462. "verticallinelowmod",
  12463. 0x02cc,
  12464. "verticallinemod",
  12465. 0x02c8,
  12466. "vewarmenian",
  12467. 0x057e,
  12468. "vhook",
  12469. 0x028b,
  12470. "vikatakana",
  12471. 0x30f8,
  12472. "viramabengali",
  12473. 0x09cd,
  12474. "viramadeva",
  12475. 0x094d,
  12476. "viramagujarati",
  12477. 0x0acd,
  12478. "visargabengali",
  12479. 0x0983,
  12480. "visargadeva",
  12481. 0x0903,
  12482. "visargagujarati",
  12483. 0x0a83,
  12484. "vmonospace",
  12485. 0xff56,
  12486. "voarmenian",
  12487. 0x0578,
  12488. "voicediterationhiragana",
  12489. 0x309e,
  12490. "voicediterationkatakana",
  12491. 0x30fe,
  12492. "voicedmarkkana",
  12493. 0x309b,
  12494. "voicedmarkkanahalfwidth",
  12495. 0xff9e,
  12496. "vokatakana",
  12497. 0x30fa,
  12498. "vparen",
  12499. 0x24b1,
  12500. "vtilde",
  12501. 0x1e7d,
  12502. "vturned",
  12503. 0x028c,
  12504. "vuhiragana",
  12505. 0x3094,
  12506. "vukatakana",
  12507. 0x30f4,
  12508. "w",
  12509. 0x0077,
  12510. "wacute",
  12511. 0x1e83,
  12512. "waekorean",
  12513. 0x3159,
  12514. "wahiragana",
  12515. 0x308f,
  12516. "wakatakana",
  12517. 0x30ef,
  12518. "wakatakanahalfwidth",
  12519. 0xff9c,
  12520. "wakorean",
  12521. 0x3158,
  12522. "wasmallhiragana",
  12523. 0x308e,
  12524. "wasmallkatakana",
  12525. 0x30ee,
  12526. "wattosquare",
  12527. 0x3357,
  12528. "wavedash",
  12529. 0x301c,
  12530. "wavyunderscorevertical",
  12531. 0xfe34,
  12532. "wawarabic",
  12533. 0x0648,
  12534. "wawfinalarabic",
  12535. 0xfeee,
  12536. "wawhamzaabovearabic",
  12537. 0x0624,
  12538. "wawhamzaabovefinalarabic",
  12539. 0xfe86,
  12540. "wbsquare",
  12541. 0x33dd,
  12542. "wcircle",
  12543. 0x24e6,
  12544. "wcircumflex",
  12545. 0x0175,
  12546. "wdieresis",
  12547. 0x1e85,
  12548. "wdotaccent",
  12549. 0x1e87,
  12550. "wdotbelow",
  12551. 0x1e89,
  12552. "wehiragana",
  12553. 0x3091,
  12554. "weierstrass",
  12555. 0x2118,
  12556. "wekatakana",
  12557. 0x30f1,
  12558. "wekorean",
  12559. 0x315e,
  12560. "weokorean",
  12561. 0x315d,
  12562. "wgrave",
  12563. 0x1e81,
  12564. "whitebullet",
  12565. 0x25e6,
  12566. "whitecircle",
  12567. 0x25cb,
  12568. "whitecircleinverse",
  12569. 0x25d9,
  12570. "whitecornerbracketleft",
  12571. 0x300e,
  12572. "whitecornerbracketleftvertical",
  12573. 0xfe43,
  12574. "whitecornerbracketright",
  12575. 0x300f,
  12576. "whitecornerbracketrightvertical",
  12577. 0xfe44,
  12578. "whitediamond",
  12579. 0x25c7,
  12580. "whitediamondcontainingblacksmalldiamond",
  12581. 0x25c8,
  12582. "whitedownpointingsmalltriangle",
  12583. 0x25bf,
  12584. "whitedownpointingtriangle",
  12585. 0x25bd,
  12586. "whiteleftpointingsmalltriangle",
  12587. 0x25c3,
  12588. "whiteleftpointingtriangle",
  12589. 0x25c1,
  12590. "whitelenticularbracketleft",
  12591. 0x3016,
  12592. "whitelenticularbracketright",
  12593. 0x3017,
  12594. "whiterightpointingsmalltriangle",
  12595. 0x25b9,
  12596. "whiterightpointingtriangle",
  12597. 0x25b7,
  12598. "whitesmallsquare",
  12599. 0x25ab,
  12600. "whitesmilingface",
  12601. 0x263a,
  12602. "whitesquare",
  12603. 0x25a1,
  12604. "whitestar",
  12605. 0x2606,
  12606. "whitetelephone",
  12607. 0x260f,
  12608. "whitetortoiseshellbracketleft",
  12609. 0x3018,
  12610. "whitetortoiseshellbracketright",
  12611. 0x3019,
  12612. "whiteuppointingsmalltriangle",
  12613. 0x25b5,
  12614. "whiteuppointingtriangle",
  12615. 0x25b3,
  12616. "wihiragana",
  12617. 0x3090,
  12618. "wikatakana",
  12619. 0x30f0,
  12620. "wikorean",
  12621. 0x315f,
  12622. "wmonospace",
  12623. 0xff57,
  12624. "wohiragana",
  12625. 0x3092,
  12626. "wokatakana",
  12627. 0x30f2,
  12628. "wokatakanahalfwidth",
  12629. 0xff66,
  12630. "won",
  12631. 0x20a9,
  12632. "wonmonospace",
  12633. 0xffe6,
  12634. "wowaenthai",
  12635. 0x0e27,
  12636. "wparen",
  12637. 0x24b2,
  12638. "wring",
  12639. 0x1e98,
  12640. "wsuperior",
  12641. 0x02b7,
  12642. "wturned",
  12643. 0x028d,
  12644. "wynn",
  12645. 0x01bf,
  12646. "x",
  12647. 0x0078,
  12648. "xabovecmb",
  12649. 0x033d,
  12650. "xbopomofo",
  12651. 0x3112,
  12652. "xcircle",
  12653. 0x24e7,
  12654. "xdieresis",
  12655. 0x1e8d,
  12656. "xdotaccent",
  12657. 0x1e8b,
  12658. "xeharmenian",
  12659. 0x056d,
  12660. "xi",
  12661. 0x03be,
  12662. "xmonospace",
  12663. 0xff58,
  12664. "xparen",
  12665. 0x24b3,
  12666. "xsuperior",
  12667. 0x02e3,
  12668. "y",
  12669. 0x0079,
  12670. "yaadosquare",
  12671. 0x334e,
  12672. "yabengali",
  12673. 0x09af,
  12674. "yacute",
  12675. 0x00fd,
  12676. "yadeva",
  12677. 0x092f,
  12678. "yaekorean",
  12679. 0x3152,
  12680. "yagujarati",
  12681. 0x0aaf,
  12682. "yagurmukhi",
  12683. 0x0a2f,
  12684. "yahiragana",
  12685. 0x3084,
  12686. "yakatakana",
  12687. 0x30e4,
  12688. "yakatakanahalfwidth",
  12689. 0xff94,
  12690. "yakorean",
  12691. 0x3151,
  12692. "yamakkanthai",
  12693. 0x0e4e,
  12694. "yasmallhiragana",
  12695. 0x3083,
  12696. "yasmallkatakana",
  12697. 0x30e3,
  12698. "yasmallkatakanahalfwidth",
  12699. 0xff6c,
  12700. "yatcyrillic",
  12701. 0x0463,
  12702. "ycircle",
  12703. 0x24e8,
  12704. "ycircumflex",
  12705. 0x0177,
  12706. "ydieresis",
  12707. 0x00ff,
  12708. "ydotaccent",
  12709. 0x1e8f,
  12710. "ydotbelow",
  12711. 0x1ef5,
  12712. "yeharabic",
  12713. 0x064a,
  12714. "yehbarreearabic",
  12715. 0x06d2,
  12716. "yehbarreefinalarabic",
  12717. 0xfbaf,
  12718. "yehfinalarabic",
  12719. 0xfef2,
  12720. "yehhamzaabovearabic",
  12721. 0x0626,
  12722. "yehhamzaabovefinalarabic",
  12723. 0xfe8a,
  12724. "yehhamzaaboveinitialarabic",
  12725. 0xfe8b,
  12726. "yehhamzaabovemedialarabic",
  12727. 0xfe8c,
  12728. "yehinitialarabic",
  12729. 0xfef3,
  12730. "yehmedialarabic",
  12731. 0xfef4,
  12732. "yehmeeminitialarabic",
  12733. 0xfcdd,
  12734. "yehmeemisolatedarabic",
  12735. 0xfc58,
  12736. "yehnoonfinalarabic",
  12737. 0xfc94,
  12738. "yehthreedotsbelowarabic",
  12739. 0x06d1,
  12740. "yekorean",
  12741. 0x3156,
  12742. "yen",
  12743. 0x00a5,
  12744. "yenmonospace",
  12745. 0xffe5,
  12746. "yeokorean",
  12747. 0x3155,
  12748. "yeorinhieuhkorean",
  12749. 0x3186,
  12750. "yerahbenyomohebrew",
  12751. 0x05aa,
  12752. "yerahbenyomolefthebrew",
  12753. 0x05aa,
  12754. "yericyrillic",
  12755. 0x044b,
  12756. "yerudieresiscyrillic",
  12757. 0x04f9,
  12758. "yesieungkorean",
  12759. 0x3181,
  12760. "yesieungpansioskorean",
  12761. 0x3183,
  12762. "yesieungsioskorean",
  12763. 0x3182,
  12764. "yetivhebrew",
  12765. 0x059a,
  12766. "ygrave",
  12767. 0x1ef3,
  12768. "yhook",
  12769. 0x01b4,
  12770. "yhookabove",
  12771. 0x1ef7,
  12772. "yiarmenian",
  12773. 0x0575,
  12774. "yicyrillic",
  12775. 0x0457,
  12776. "yikorean",
  12777. 0x3162,
  12778. "yinyang",
  12779. 0x262f,
  12780. "yiwnarmenian",
  12781. 0x0582,
  12782. "ymonospace",
  12783. 0xff59,
  12784. "yod",
  12785. 0x05d9,
  12786. "yoddagesh",
  12787. 0xfb39,
  12788. "yoddageshhebrew",
  12789. 0xfb39,
  12790. "yodhebrew",
  12791. 0x05d9,
  12792. "yodyodhebrew",
  12793. 0x05f2,
  12794. "yodyodpatahhebrew",
  12795. 0xfb1f,
  12796. "yohiragana",
  12797. 0x3088,
  12798. "yoikorean",
  12799. 0x3189,
  12800. "yokatakana",
  12801. 0x30e8,
  12802. "yokatakanahalfwidth",
  12803. 0xff96,
  12804. "yokorean",
  12805. 0x315b,
  12806. "yosmallhiragana",
  12807. 0x3087,
  12808. "yosmallkatakana",
  12809. 0x30e7,
  12810. "yosmallkatakanahalfwidth",
  12811. 0xff6e,
  12812. "yotgreek",
  12813. 0x03f3,
  12814. "yoyaekorean",
  12815. 0x3188,
  12816. "yoyakorean",
  12817. 0x3187,
  12818. "yoyakthai",
  12819. 0x0e22,
  12820. "yoyingthai",
  12821. 0x0e0d,
  12822. "yparen",
  12823. 0x24b4,
  12824. "ypogegrammeni",
  12825. 0x037a,
  12826. "ypogegrammenigreekcmb",
  12827. 0x0345,
  12828. "yr",
  12829. 0x01a6,
  12830. "yring",
  12831. 0x1e99,
  12832. "ysuperior",
  12833. 0x02b8,
  12834. "ytilde",
  12835. 0x1ef9,
  12836. "yturned",
  12837. 0x028e,
  12838. "yuhiragana",
  12839. 0x3086,
  12840. "yuikorean",
  12841. 0x318c,
  12842. "yukatakana",
  12843. 0x30e6,
  12844. "yukatakanahalfwidth",
  12845. 0xff95,
  12846. "yukorean",
  12847. 0x3160,
  12848. "yusbigcyrillic",
  12849. 0x046b,
  12850. "yusbigiotifiedcyrillic",
  12851. 0x046d,
  12852. "yuslittlecyrillic",
  12853. 0x0467,
  12854. "yuslittleiotifiedcyrillic",
  12855. 0x0469,
  12856. "yusmallhiragana",
  12857. 0x3085,
  12858. "yusmallkatakana",
  12859. 0x30e5,
  12860. "yusmallkatakanahalfwidth",
  12861. 0xff6d,
  12862. "yuyekorean",
  12863. 0x318b,
  12864. "yuyeokorean",
  12865. 0x318a,
  12866. "yyabengali",
  12867. 0x09df,
  12868. "yyadeva",
  12869. 0x095f,
  12870. "z",
  12871. 0x007a,
  12872. "zaarmenian",
  12873. 0x0566,
  12874. "zacute",
  12875. 0x017a,
  12876. "zadeva",
  12877. 0x095b,
  12878. "zagurmukhi",
  12879. 0x0a5b,
  12880. "zaharabic",
  12881. 0x0638,
  12882. "zahfinalarabic",
  12883. 0xfec6,
  12884. "zahinitialarabic",
  12885. 0xfec7,
  12886. "zahiragana",
  12887. 0x3056,
  12888. "zahmedialarabic",
  12889. 0xfec8,
  12890. "zainarabic",
  12891. 0x0632,
  12892. "zainfinalarabic",
  12893. 0xfeb0,
  12894. "zakatakana",
  12895. 0x30b6,
  12896. "zaqefgadolhebrew",
  12897. 0x0595,
  12898. "zaqefqatanhebrew",
  12899. 0x0594,
  12900. "zarqahebrew",
  12901. 0x0598,
  12902. "zayin",
  12903. 0x05d6,
  12904. "zayindagesh",
  12905. 0xfb36,
  12906. "zayindageshhebrew",
  12907. 0xfb36,
  12908. "zayinhebrew",
  12909. 0x05d6,
  12910. "zbopomofo",
  12911. 0x3117,
  12912. "zcaron",
  12913. 0x017e,
  12914. "zcircle",
  12915. 0x24e9,
  12916. "zcircumflex",
  12917. 0x1e91,
  12918. "zcurl",
  12919. 0x0291,
  12920. "zdot",
  12921. 0x017c,
  12922. "zdotaccent",
  12923. 0x017c,
  12924. "zdotbelow",
  12925. 0x1e93,
  12926. "zecyrillic",
  12927. 0x0437,
  12928. "zedescendercyrillic",
  12929. 0x0499,
  12930. "zedieresiscyrillic",
  12931. 0x04df,
  12932. "zehiragana",
  12933. 0x305c,
  12934. "zekatakana",
  12935. 0x30bc,
  12936. "zero",
  12937. 0x0030,
  12938. "zeroarabic",
  12939. 0x0660,
  12940. "zerobengali",
  12941. 0x09e6,
  12942. "zerodeva",
  12943. 0x0966,
  12944. "zerogujarati",
  12945. 0x0ae6,
  12946. "zerogurmukhi",
  12947. 0x0a66,
  12948. "zerohackarabic",
  12949. 0x0660,
  12950. "zeroinferior",
  12951. 0x2080,
  12952. "zeromonospace",
  12953. 0xff10,
  12954. "zerooldstyle",
  12955. 0xf730,
  12956. "zeropersian",
  12957. 0x06f0,
  12958. "zerosuperior",
  12959. 0x2070,
  12960. "zerothai",
  12961. 0x0e50,
  12962. "zerowidthjoiner",
  12963. 0xfeff,
  12964. "zerowidthnonjoiner",
  12965. 0x200c,
  12966. "zerowidthspace",
  12967. 0x200b,
  12968. "zeta",
  12969. 0x03b6,
  12970. "zhbopomofo",
  12971. 0x3113,
  12972. "zhearmenian",
  12973. 0x056a,
  12974. "zhebrevecyrillic",
  12975. 0x04c2,
  12976. "zhecyrillic",
  12977. 0x0436,
  12978. "zhedescendercyrillic",
  12979. 0x0497,
  12980. "zhedieresiscyrillic",
  12981. 0x04dd,
  12982. "zihiragana",
  12983. 0x3058,
  12984. "zikatakana",
  12985. 0x30b8,
  12986. "zinorhebrew",
  12987. 0x05ae,
  12988. "zlinebelow",
  12989. 0x1e95,
  12990. "zmonospace",
  12991. 0xff5a,
  12992. "zohiragana",
  12993. 0x305e,
  12994. "zokatakana",
  12995. 0x30be,
  12996. "zparen",
  12997. 0x24b5,
  12998. "zretroflexhook",
  12999. 0x0290,
  13000. "zstroke",
  13001. 0x01b6,
  13002. "zuhiragana",
  13003. 0x305a,
  13004. "zukatakana",
  13005. 0x30ba,
  13006. ".notdef",
  13007. 0x0000,
  13008. "angbracketleftbig",
  13009. 0x2329,
  13010. "angbracketleftBig",
  13011. 0x2329,
  13012. "angbracketleftbigg",
  13013. 0x2329,
  13014. "angbracketleftBigg",
  13015. 0x2329,
  13016. "angbracketrightBig",
  13017. 0x232a,
  13018. "angbracketrightbig",
  13019. 0x232a,
  13020. "angbracketrightBigg",
  13021. 0x232a,
  13022. "angbracketrightbigg",
  13023. 0x232a,
  13024. "arrowhookleft",
  13025. 0x21aa,
  13026. "arrowhookright",
  13027. 0x21a9,
  13028. "arrowlefttophalf",
  13029. 0x21bc,
  13030. "arrowleftbothalf",
  13031. 0x21bd,
  13032. "arrownortheast",
  13033. 0x2197,
  13034. "arrownorthwest",
  13035. 0x2196,
  13036. "arrowrighttophalf",
  13037. 0x21c0,
  13038. "arrowrightbothalf",
  13039. 0x21c1,
  13040. "arrowsoutheast",
  13041. 0x2198,
  13042. "arrowsouthwest",
  13043. 0x2199,
  13044. "backslashbig",
  13045. 0x2216,
  13046. "backslashBig",
  13047. 0x2216,
  13048. "backslashBigg",
  13049. 0x2216,
  13050. "backslashbigg",
  13051. 0x2216,
  13052. "bardbl",
  13053. 0x2016,
  13054. "bracehtipdownleft",
  13055. 0xfe37,
  13056. "bracehtipdownright",
  13057. 0xfe37,
  13058. "bracehtipupleft",
  13059. 0xfe38,
  13060. "bracehtipupright",
  13061. 0xfe38,
  13062. "braceleftBig",
  13063. 0x007b,
  13064. "braceleftbig",
  13065. 0x007b,
  13066. "braceleftbigg",
  13067. 0x007b,
  13068. "braceleftBigg",
  13069. 0x007b,
  13070. "bracerightBig",
  13071. 0x007d,
  13072. "bracerightbig",
  13073. 0x007d,
  13074. "bracerightbigg",
  13075. 0x007d,
  13076. "bracerightBigg",
  13077. 0x007d,
  13078. "bracketleftbig",
  13079. 0x005b,
  13080. "bracketleftBig",
  13081. 0x005b,
  13082. "bracketleftbigg",
  13083. 0x005b,
  13084. "bracketleftBigg",
  13085. 0x005b,
  13086. "bracketrightBig",
  13087. 0x005d,
  13088. "bracketrightbig",
  13089. 0x005d,
  13090. "bracketrightbigg",
  13091. 0x005d,
  13092. "bracketrightBigg",
  13093. 0x005d,
  13094. "ceilingleftbig",
  13095. 0x2308,
  13096. "ceilingleftBig",
  13097. 0x2308,
  13098. "ceilingleftBigg",
  13099. 0x2308,
  13100. "ceilingleftbigg",
  13101. 0x2308,
  13102. "ceilingrightbig",
  13103. 0x2309,
  13104. "ceilingrightBig",
  13105. 0x2309,
  13106. "ceilingrightbigg",
  13107. 0x2309,
  13108. "ceilingrightBigg",
  13109. 0x2309,
  13110. "circledotdisplay",
  13111. 0x2299,
  13112. "circledottext",
  13113. 0x2299,
  13114. "circlemultiplydisplay",
  13115. 0x2297,
  13116. "circlemultiplytext",
  13117. 0x2297,
  13118. "circleplusdisplay",
  13119. 0x2295,
  13120. "circleplustext",
  13121. 0x2295,
  13122. "contintegraldisplay",
  13123. 0x222e,
  13124. "contintegraltext",
  13125. 0x222e,
  13126. "coproductdisplay",
  13127. 0x2210,
  13128. "coproducttext",
  13129. 0x2210,
  13130. "floorleftBig",
  13131. 0x230a,
  13132. "floorleftbig",
  13133. 0x230a,
  13134. "floorleftbigg",
  13135. 0x230a,
  13136. "floorleftBigg",
  13137. 0x230a,
  13138. "floorrightbig",
  13139. 0x230b,
  13140. "floorrightBig",
  13141. 0x230b,
  13142. "floorrightBigg",
  13143. 0x230b,
  13144. "floorrightbigg",
  13145. 0x230b,
  13146. "hatwide",
  13147. 0x0302,
  13148. "hatwider",
  13149. 0x0302,
  13150. "hatwidest",
  13151. 0x0302,
  13152. "intercal",
  13153. 0x1d40,
  13154. "integraldisplay",
  13155. 0x222b,
  13156. "integraltext",
  13157. 0x222b,
  13158. "intersectiondisplay",
  13159. 0x22c2,
  13160. "intersectiontext",
  13161. 0x22c2,
  13162. "logicalanddisplay",
  13163. 0x2227,
  13164. "logicalandtext",
  13165. 0x2227,
  13166. "logicalordisplay",
  13167. 0x2228,
  13168. "logicalortext",
  13169. 0x2228,
  13170. "parenleftBig",
  13171. 0x0028,
  13172. "parenleftbig",
  13173. 0x0028,
  13174. "parenleftBigg",
  13175. 0x0028,
  13176. "parenleftbigg",
  13177. 0x0028,
  13178. "parenrightBig",
  13179. 0x0029,
  13180. "parenrightbig",
  13181. 0x0029,
  13182. "parenrightBigg",
  13183. 0x0029,
  13184. "parenrightbigg",
  13185. 0x0029,
  13186. "prime",
  13187. 0x2032,
  13188. "productdisplay",
  13189. 0x220f,
  13190. "producttext",
  13191. 0x220f,
  13192. "radicalbig",
  13193. 0x221a,
  13194. "radicalBig",
  13195. 0x221a,
  13196. "radicalBigg",
  13197. 0x221a,
  13198. "radicalbigg",
  13199. 0x221a,
  13200. "radicalbt",
  13201. 0x221a,
  13202. "radicaltp",
  13203. 0x221a,
  13204. "radicalvertex",
  13205. 0x221a,
  13206. "slashbig",
  13207. 0x002f,
  13208. "slashBig",
  13209. 0x002f,
  13210. "slashBigg",
  13211. 0x002f,
  13212. "slashbigg",
  13213. 0x002f,
  13214. "summationdisplay",
  13215. 0x2211,
  13216. "summationtext",
  13217. 0x2211,
  13218. "tildewide",
  13219. 0x02dc,
  13220. "tildewider",
  13221. 0x02dc,
  13222. "tildewidest",
  13223. 0x02dc,
  13224. "uniondisplay",
  13225. 0x22c3,
  13226. "unionmultidisplay",
  13227. 0x228e,
  13228. "unionmultitext",
  13229. 0x228e,
  13230. "unionsqdisplay",
  13231. 0x2294,
  13232. "unionsqtext",
  13233. 0x2294,
  13234. "uniontext",
  13235. 0x22c3,
  13236. "vextenddouble",
  13237. 0x2225,
  13238. "vextendsingle",
  13239. 0x2223
  13240. ];
  13241. });
  13242. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  13243. return [
  13244. "space",
  13245. 0x0020,
  13246. "a1",
  13247. 0x2701,
  13248. "a2",
  13249. 0x2702,
  13250. "a202",
  13251. 0x2703,
  13252. "a3",
  13253. 0x2704,
  13254. "a4",
  13255. 0x260e,
  13256. "a5",
  13257. 0x2706,
  13258. "a119",
  13259. 0x2707,
  13260. "a118",
  13261. 0x2708,
  13262. "a117",
  13263. 0x2709,
  13264. "a11",
  13265. 0x261b,
  13266. "a12",
  13267. 0x261e,
  13268. "a13",
  13269. 0x270c,
  13270. "a14",
  13271. 0x270d,
  13272. "a15",
  13273. 0x270e,
  13274. "a16",
  13275. 0x270f,
  13276. "a105",
  13277. 0x2710,
  13278. "a17",
  13279. 0x2711,
  13280. "a18",
  13281. 0x2712,
  13282. "a19",
  13283. 0x2713,
  13284. "a20",
  13285. 0x2714,
  13286. "a21",
  13287. 0x2715,
  13288. "a22",
  13289. 0x2716,
  13290. "a23",
  13291. 0x2717,
  13292. "a24",
  13293. 0x2718,
  13294. "a25",
  13295. 0x2719,
  13296. "a26",
  13297. 0x271a,
  13298. "a27",
  13299. 0x271b,
  13300. "a28",
  13301. 0x271c,
  13302. "a6",
  13303. 0x271d,
  13304. "a7",
  13305. 0x271e,
  13306. "a8",
  13307. 0x271f,
  13308. "a9",
  13309. 0x2720,
  13310. "a10",
  13311. 0x2721,
  13312. "a29",
  13313. 0x2722,
  13314. "a30",
  13315. 0x2723,
  13316. "a31",
  13317. 0x2724,
  13318. "a32",
  13319. 0x2725,
  13320. "a33",
  13321. 0x2726,
  13322. "a34",
  13323. 0x2727,
  13324. "a35",
  13325. 0x2605,
  13326. "a36",
  13327. 0x2729,
  13328. "a37",
  13329. 0x272a,
  13330. "a38",
  13331. 0x272b,
  13332. "a39",
  13333. 0x272c,
  13334. "a40",
  13335. 0x272d,
  13336. "a41",
  13337. 0x272e,
  13338. "a42",
  13339. 0x272f,
  13340. "a43",
  13341. 0x2730,
  13342. "a44",
  13343. 0x2731,
  13344. "a45",
  13345. 0x2732,
  13346. "a46",
  13347. 0x2733,
  13348. "a47",
  13349. 0x2734,
  13350. "a48",
  13351. 0x2735,
  13352. "a49",
  13353. 0x2736,
  13354. "a50",
  13355. 0x2737,
  13356. "a51",
  13357. 0x2738,
  13358. "a52",
  13359. 0x2739,
  13360. "a53",
  13361. 0x273a,
  13362. "a54",
  13363. 0x273b,
  13364. "a55",
  13365. 0x273c,
  13366. "a56",
  13367. 0x273d,
  13368. "a57",
  13369. 0x273e,
  13370. "a58",
  13371. 0x273f,
  13372. "a59",
  13373. 0x2740,
  13374. "a60",
  13375. 0x2741,
  13376. "a61",
  13377. 0x2742,
  13378. "a62",
  13379. 0x2743,
  13380. "a63",
  13381. 0x2744,
  13382. "a64",
  13383. 0x2745,
  13384. "a65",
  13385. 0x2746,
  13386. "a66",
  13387. 0x2747,
  13388. "a67",
  13389. 0x2748,
  13390. "a68",
  13391. 0x2749,
  13392. "a69",
  13393. 0x274a,
  13394. "a70",
  13395. 0x274b,
  13396. "a71",
  13397. 0x25cf,
  13398. "a72",
  13399. 0x274d,
  13400. "a73",
  13401. 0x25a0,
  13402. "a74",
  13403. 0x274f,
  13404. "a203",
  13405. 0x2750,
  13406. "a75",
  13407. 0x2751,
  13408. "a204",
  13409. 0x2752,
  13410. "a76",
  13411. 0x25b2,
  13412. "a77",
  13413. 0x25bc,
  13414. "a78",
  13415. 0x25c6,
  13416. "a79",
  13417. 0x2756,
  13418. "a81",
  13419. 0x25d7,
  13420. "a82",
  13421. 0x2758,
  13422. "a83",
  13423. 0x2759,
  13424. "a84",
  13425. 0x275a,
  13426. "a97",
  13427. 0x275b,
  13428. "a98",
  13429. 0x275c,
  13430. "a99",
  13431. 0x275d,
  13432. "a100",
  13433. 0x275e,
  13434. "a101",
  13435. 0x2761,
  13436. "a102",
  13437. 0x2762,
  13438. "a103",
  13439. 0x2763,
  13440. "a104",
  13441. 0x2764,
  13442. "a106",
  13443. 0x2765,
  13444. "a107",
  13445. 0x2766,
  13446. "a108",
  13447. 0x2767,
  13448. "a112",
  13449. 0x2663,
  13450. "a111",
  13451. 0x2666,
  13452. "a110",
  13453. 0x2665,
  13454. "a109",
  13455. 0x2660,
  13456. "a120",
  13457. 0x2460,
  13458. "a121",
  13459. 0x2461,
  13460. "a122",
  13461. 0x2462,
  13462. "a123",
  13463. 0x2463,
  13464. "a124",
  13465. 0x2464,
  13466. "a125",
  13467. 0x2465,
  13468. "a126",
  13469. 0x2466,
  13470. "a127",
  13471. 0x2467,
  13472. "a128",
  13473. 0x2468,
  13474. "a129",
  13475. 0x2469,
  13476. "a130",
  13477. 0x2776,
  13478. "a131",
  13479. 0x2777,
  13480. "a132",
  13481. 0x2778,
  13482. "a133",
  13483. 0x2779,
  13484. "a134",
  13485. 0x277a,
  13486. "a135",
  13487. 0x277b,
  13488. "a136",
  13489. 0x277c,
  13490. "a137",
  13491. 0x277d,
  13492. "a138",
  13493. 0x277e,
  13494. "a139",
  13495. 0x277f,
  13496. "a140",
  13497. 0x2780,
  13498. "a141",
  13499. 0x2781,
  13500. "a142",
  13501. 0x2782,
  13502. "a143",
  13503. 0x2783,
  13504. "a144",
  13505. 0x2784,
  13506. "a145",
  13507. 0x2785,
  13508. "a146",
  13509. 0x2786,
  13510. "a147",
  13511. 0x2787,
  13512. "a148",
  13513. 0x2788,
  13514. "a149",
  13515. 0x2789,
  13516. "a150",
  13517. 0x278a,
  13518. "a151",
  13519. 0x278b,
  13520. "a152",
  13521. 0x278c,
  13522. "a153",
  13523. 0x278d,
  13524. "a154",
  13525. 0x278e,
  13526. "a155",
  13527. 0x278f,
  13528. "a156",
  13529. 0x2790,
  13530. "a157",
  13531. 0x2791,
  13532. "a158",
  13533. 0x2792,
  13534. "a159",
  13535. 0x2793,
  13536. "a160",
  13537. 0x2794,
  13538. "a161",
  13539. 0x2192,
  13540. "a163",
  13541. 0x2194,
  13542. "a164",
  13543. 0x2195,
  13544. "a196",
  13545. 0x2798,
  13546. "a165",
  13547. 0x2799,
  13548. "a192",
  13549. 0x279a,
  13550. "a166",
  13551. 0x279b,
  13552. "a167",
  13553. 0x279c,
  13554. "a168",
  13555. 0x279d,
  13556. "a169",
  13557. 0x279e,
  13558. "a170",
  13559. 0x279f,
  13560. "a171",
  13561. 0x27a0,
  13562. "a172",
  13563. 0x27a1,
  13564. "a173",
  13565. 0x27a2,
  13566. "a162",
  13567. 0x27a3,
  13568. "a174",
  13569. 0x27a4,
  13570. "a175",
  13571. 0x27a5,
  13572. "a176",
  13573. 0x27a6,
  13574. "a177",
  13575. 0x27a7,
  13576. "a178",
  13577. 0x27a8,
  13578. "a179",
  13579. 0x27a9,
  13580. "a193",
  13581. 0x27aa,
  13582. "a180",
  13583. 0x27ab,
  13584. "a199",
  13585. 0x27ac,
  13586. "a181",
  13587. 0x27ad,
  13588. "a200",
  13589. 0x27ae,
  13590. "a182",
  13591. 0x27af,
  13592. "a201",
  13593. 0x27b1,
  13594. "a183",
  13595. 0x27b2,
  13596. "a184",
  13597. 0x27b3,
  13598. "a197",
  13599. 0x27b4,
  13600. "a185",
  13601. 0x27b5,
  13602. "a194",
  13603. 0x27b6,
  13604. "a198",
  13605. 0x27b7,
  13606. "a186",
  13607. 0x27b8,
  13608. "a195",
  13609. 0x27b9,
  13610. "a187",
  13611. 0x27ba,
  13612. "a188",
  13613. 0x27bb,
  13614. "a189",
  13615. 0x27bc,
  13616. "a190",
  13617. 0x27bd,
  13618. "a191",
  13619. 0x27be,
  13620. "a89",
  13621. 0x2768,
  13622. "a90",
  13623. 0x2769,
  13624. "a93",
  13625. 0x276a,
  13626. "a94",
  13627. 0x276b,
  13628. "a91",
  13629. 0x276c,
  13630. "a92",
  13631. 0x276d,
  13632. "a205",
  13633. 0x276e,
  13634. "a85",
  13635. 0x276f,
  13636. "a206",
  13637. 0x2770,
  13638. "a86",
  13639. 0x2771,
  13640. "a87",
  13641. 0x2772,
  13642. "a88",
  13643. 0x2773,
  13644. "a95",
  13645. 0x2774,
  13646. "a96",
  13647. 0x2775,
  13648. ".notdef",
  13649. 0x0000
  13650. ];
  13651. });
  13652. /***/ }),
  13653. /* 21 */
  13654. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  13655. __w_pdfjs_require__.r(__webpack_exports__);
  13656. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  13657. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  13658. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  13659. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  13660. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  13661. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  13662. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  13663. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  13664. /* harmony export */ });
  13665. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  13666. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  13667. t[63721] = 0x00a9;
  13668. t[63193] = 0x00a9;
  13669. t[63720] = 0x00ae;
  13670. t[63194] = 0x00ae;
  13671. t[63722] = 0x2122;
  13672. t[63195] = 0x2122;
  13673. t[63729] = 0x23a7;
  13674. t[63730] = 0x23a8;
  13675. t[63731] = 0x23a9;
  13676. t[63740] = 0x23ab;
  13677. t[63741] = 0x23ac;
  13678. t[63742] = 0x23ad;
  13679. t[63726] = 0x23a1;
  13680. t[63727] = 0x23a2;
  13681. t[63728] = 0x23a3;
  13682. t[63737] = 0x23a4;
  13683. t[63738] = 0x23a5;
  13684. t[63739] = 0x23a6;
  13685. t[63723] = 0x239b;
  13686. t[63724] = 0x239c;
  13687. t[63725] = 0x239d;
  13688. t[63734] = 0x239e;
  13689. t[63735] = 0x239f;
  13690. t[63736] = 0x23a0;
  13691. });
  13692. function mapSpecialUnicodeValues(code) {
  13693. if (code >= 0xfff0 && code <= 0xffff) {
  13694. return 0;
  13695. } else if (code >= 0xf600 && code <= 0xf8ff) {
  13696. return getSpecialPUASymbols()[code] || code;
  13697. } else if (code === 0x00ad) {
  13698. return 0x002d;
  13699. }
  13700. return code;
  13701. }
  13702. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  13703. let unicode = glyphsUnicodeMap[name];
  13704. if (unicode !== undefined) {
  13705. return unicode;
  13706. }
  13707. if (!name) {
  13708. return -1;
  13709. }
  13710. if (name[0] === "u") {
  13711. const nameLen = name.length;
  13712. let hexStr;
  13713. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  13714. hexStr = name.substring(3);
  13715. } else if (nameLen >= 5 && nameLen <= 7) {
  13716. hexStr = name.substring(1);
  13717. } else {
  13718. return -1;
  13719. }
  13720. if (hexStr === hexStr.toUpperCase()) {
  13721. unicode = parseInt(hexStr, 16);
  13722. if (unicode >= 0) {
  13723. return unicode;
  13724. }
  13725. }
  13726. }
  13727. return -1;
  13728. }
  13729. const UnicodeRanges = [
  13730. {
  13731. begin: 0x0000,
  13732. end: 0x007f
  13733. },
  13734. {
  13735. begin: 0x0080,
  13736. end: 0x00ff
  13737. },
  13738. {
  13739. begin: 0x0100,
  13740. end: 0x017f
  13741. },
  13742. {
  13743. begin: 0x0180,
  13744. end: 0x024f
  13745. },
  13746. {
  13747. begin: 0x0250,
  13748. end: 0x02af
  13749. },
  13750. {
  13751. begin: 0x02b0,
  13752. end: 0x02ff
  13753. },
  13754. {
  13755. begin: 0x0300,
  13756. end: 0x036f
  13757. },
  13758. {
  13759. begin: 0x0370,
  13760. end: 0x03ff
  13761. },
  13762. {
  13763. begin: 0x2c80,
  13764. end: 0x2cff
  13765. },
  13766. {
  13767. begin: 0x0400,
  13768. end: 0x04ff
  13769. },
  13770. {
  13771. begin: 0x0530,
  13772. end: 0x058f
  13773. },
  13774. {
  13775. begin: 0x0590,
  13776. end: 0x05ff
  13777. },
  13778. {
  13779. begin: 0xa500,
  13780. end: 0xa63f
  13781. },
  13782. {
  13783. begin: 0x0600,
  13784. end: 0x06ff
  13785. },
  13786. {
  13787. begin: 0x07c0,
  13788. end: 0x07ff
  13789. },
  13790. {
  13791. begin: 0x0900,
  13792. end: 0x097f
  13793. },
  13794. {
  13795. begin: 0x0980,
  13796. end: 0x09ff
  13797. },
  13798. {
  13799. begin: 0x0a00,
  13800. end: 0x0a7f
  13801. },
  13802. {
  13803. begin: 0x0a80,
  13804. end: 0x0aff
  13805. },
  13806. {
  13807. begin: 0x0b00,
  13808. end: 0x0b7f
  13809. },
  13810. {
  13811. begin: 0x0b80,
  13812. end: 0x0bff
  13813. },
  13814. {
  13815. begin: 0x0c00,
  13816. end: 0x0c7f
  13817. },
  13818. {
  13819. begin: 0x0c80,
  13820. end: 0x0cff
  13821. },
  13822. {
  13823. begin: 0x0d00,
  13824. end: 0x0d7f
  13825. },
  13826. {
  13827. begin: 0x0e00,
  13828. end: 0x0e7f
  13829. },
  13830. {
  13831. begin: 0x0e80,
  13832. end: 0x0eff
  13833. },
  13834. {
  13835. begin: 0x10a0,
  13836. end: 0x10ff
  13837. },
  13838. {
  13839. begin: 0x1b00,
  13840. end: 0x1b7f
  13841. },
  13842. {
  13843. begin: 0x1100,
  13844. end: 0x11ff
  13845. },
  13846. {
  13847. begin: 0x1e00,
  13848. end: 0x1eff
  13849. },
  13850. {
  13851. begin: 0x1f00,
  13852. end: 0x1fff
  13853. },
  13854. {
  13855. begin: 0x2000,
  13856. end: 0x206f
  13857. },
  13858. {
  13859. begin: 0x2070,
  13860. end: 0x209f
  13861. },
  13862. {
  13863. begin: 0x20a0,
  13864. end: 0x20cf
  13865. },
  13866. {
  13867. begin: 0x20d0,
  13868. end: 0x20ff
  13869. },
  13870. {
  13871. begin: 0x2100,
  13872. end: 0x214f
  13873. },
  13874. {
  13875. begin: 0x2150,
  13876. end: 0x218f
  13877. },
  13878. {
  13879. begin: 0x2190,
  13880. end: 0x21ff
  13881. },
  13882. {
  13883. begin: 0x2200,
  13884. end: 0x22ff
  13885. },
  13886. {
  13887. begin: 0x2300,
  13888. end: 0x23ff
  13889. },
  13890. {
  13891. begin: 0x2400,
  13892. end: 0x243f
  13893. },
  13894. {
  13895. begin: 0x2440,
  13896. end: 0x245f
  13897. },
  13898. {
  13899. begin: 0x2460,
  13900. end: 0x24ff
  13901. },
  13902. {
  13903. begin: 0x2500,
  13904. end: 0x257f
  13905. },
  13906. {
  13907. begin: 0x2580,
  13908. end: 0x259f
  13909. },
  13910. {
  13911. begin: 0x25a0,
  13912. end: 0x25ff
  13913. },
  13914. {
  13915. begin: 0x2600,
  13916. end: 0x26ff
  13917. },
  13918. {
  13919. begin: 0x2700,
  13920. end: 0x27bf
  13921. },
  13922. {
  13923. begin: 0x3000,
  13924. end: 0x303f
  13925. },
  13926. {
  13927. begin: 0x3040,
  13928. end: 0x309f
  13929. },
  13930. {
  13931. begin: 0x30a0,
  13932. end: 0x30ff
  13933. },
  13934. {
  13935. begin: 0x3100,
  13936. end: 0x312f
  13937. },
  13938. {
  13939. begin: 0x3130,
  13940. end: 0x318f
  13941. },
  13942. {
  13943. begin: 0xa840,
  13944. end: 0xa87f
  13945. },
  13946. {
  13947. begin: 0x3200,
  13948. end: 0x32ff
  13949. },
  13950. {
  13951. begin: 0x3300,
  13952. end: 0x33ff
  13953. },
  13954. {
  13955. begin: 0xac00,
  13956. end: 0xd7af
  13957. },
  13958. {
  13959. begin: 0xd800,
  13960. end: 0xdfff
  13961. },
  13962. {
  13963. begin: 0x10900,
  13964. end: 0x1091f
  13965. },
  13966. {
  13967. begin: 0x4e00,
  13968. end: 0x9fff
  13969. },
  13970. {
  13971. begin: 0xe000,
  13972. end: 0xf8ff
  13973. },
  13974. {
  13975. begin: 0x31c0,
  13976. end: 0x31ef
  13977. },
  13978. {
  13979. begin: 0xfb00,
  13980. end: 0xfb4f
  13981. },
  13982. {
  13983. begin: 0xfb50,
  13984. end: 0xfdff
  13985. },
  13986. {
  13987. begin: 0xfe20,
  13988. end: 0xfe2f
  13989. },
  13990. {
  13991. begin: 0xfe10,
  13992. end: 0xfe1f
  13993. },
  13994. {
  13995. begin: 0xfe50,
  13996. end: 0xfe6f
  13997. },
  13998. {
  13999. begin: 0xfe70,
  14000. end: 0xfeff
  14001. },
  14002. {
  14003. begin: 0xff00,
  14004. end: 0xffef
  14005. },
  14006. {
  14007. begin: 0xfff0,
  14008. end: 0xffff
  14009. },
  14010. {
  14011. begin: 0x0f00,
  14012. end: 0x0fff
  14013. },
  14014. {
  14015. begin: 0x0700,
  14016. end: 0x074f
  14017. },
  14018. {
  14019. begin: 0x0780,
  14020. end: 0x07bf
  14021. },
  14022. {
  14023. begin: 0x0d80,
  14024. end: 0x0dff
  14025. },
  14026. {
  14027. begin: 0x1000,
  14028. end: 0x109f
  14029. },
  14030. {
  14031. begin: 0x1200,
  14032. end: 0x137f
  14033. },
  14034. {
  14035. begin: 0x13a0,
  14036. end: 0x13ff
  14037. },
  14038. {
  14039. begin: 0x1400,
  14040. end: 0x167f
  14041. },
  14042. {
  14043. begin: 0x1680,
  14044. end: 0x169f
  14045. },
  14046. {
  14047. begin: 0x16a0,
  14048. end: 0x16ff
  14049. },
  14050. {
  14051. begin: 0x1780,
  14052. end: 0x17ff
  14053. },
  14054. {
  14055. begin: 0x1800,
  14056. end: 0x18af
  14057. },
  14058. {
  14059. begin: 0x2800,
  14060. end: 0x28ff
  14061. },
  14062. {
  14063. begin: 0xa000,
  14064. end: 0xa48f
  14065. },
  14066. {
  14067. begin: 0x1700,
  14068. end: 0x171f
  14069. },
  14070. {
  14071. begin: 0x10300,
  14072. end: 0x1032f
  14073. },
  14074. {
  14075. begin: 0x10330,
  14076. end: 0x1034f
  14077. },
  14078. {
  14079. begin: 0x10400,
  14080. end: 0x1044f
  14081. },
  14082. {
  14083. begin: 0x1d000,
  14084. end: 0x1d0ff
  14085. },
  14086. {
  14087. begin: 0x1d400,
  14088. end: 0x1d7ff
  14089. },
  14090. {
  14091. begin: 0xff000,
  14092. end: 0xffffd
  14093. },
  14094. {
  14095. begin: 0xfe00,
  14096. end: 0xfe0f
  14097. },
  14098. {
  14099. begin: 0xe0000,
  14100. end: 0xe007f
  14101. },
  14102. {
  14103. begin: 0x1900,
  14104. end: 0x194f
  14105. },
  14106. {
  14107. begin: 0x1950,
  14108. end: 0x197f
  14109. },
  14110. {
  14111. begin: 0x1980,
  14112. end: 0x19df
  14113. },
  14114. {
  14115. begin: 0x1a00,
  14116. end: 0x1a1f
  14117. },
  14118. {
  14119. begin: 0x2c00,
  14120. end: 0x2c5f
  14121. },
  14122. {
  14123. begin: 0x2d30,
  14124. end: 0x2d7f
  14125. },
  14126. {
  14127. begin: 0x4dc0,
  14128. end: 0x4dff
  14129. },
  14130. {
  14131. begin: 0xa800,
  14132. end: 0xa82f
  14133. },
  14134. {
  14135. begin: 0x10000,
  14136. end: 0x1007f
  14137. },
  14138. {
  14139. begin: 0x10140,
  14140. end: 0x1018f
  14141. },
  14142. {
  14143. begin: 0x10380,
  14144. end: 0x1039f
  14145. },
  14146. {
  14147. begin: 0x103a0,
  14148. end: 0x103df
  14149. },
  14150. {
  14151. begin: 0x10450,
  14152. end: 0x1047f
  14153. },
  14154. {
  14155. begin: 0x10480,
  14156. end: 0x104af
  14157. },
  14158. {
  14159. begin: 0x10800,
  14160. end: 0x1083f
  14161. },
  14162. {
  14163. begin: 0x10a00,
  14164. end: 0x10a5f
  14165. },
  14166. {
  14167. begin: 0x1d300,
  14168. end: 0x1d35f
  14169. },
  14170. {
  14171. begin: 0x12000,
  14172. end: 0x123ff
  14173. },
  14174. {
  14175. begin: 0x1d360,
  14176. end: 0x1d37f
  14177. },
  14178. {
  14179. begin: 0x1b80,
  14180. end: 0x1bbf
  14181. },
  14182. {
  14183. begin: 0x1c00,
  14184. end: 0x1c4f
  14185. },
  14186. {
  14187. begin: 0x1c50,
  14188. end: 0x1c7f
  14189. },
  14190. {
  14191. begin: 0xa880,
  14192. end: 0xa8df
  14193. },
  14194. {
  14195. begin: 0xa900,
  14196. end: 0xa92f
  14197. },
  14198. {
  14199. begin: 0xa930,
  14200. end: 0xa95f
  14201. },
  14202. {
  14203. begin: 0xaa00,
  14204. end: 0xaa5f
  14205. },
  14206. {
  14207. begin: 0x10190,
  14208. end: 0x101cf
  14209. },
  14210. {
  14211. begin: 0x101d0,
  14212. end: 0x101ff
  14213. },
  14214. {
  14215. begin: 0x102a0,
  14216. end: 0x102df
  14217. },
  14218. {
  14219. begin: 0x1f030,
  14220. end: 0x1f09f
  14221. }
  14222. ];
  14223. function getUnicodeRangeFor(value) {
  14224. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  14225. const range = UnicodeRanges[i];
  14226. if (value >= range.begin && value < range.end) {
  14227. return i;
  14228. }
  14229. }
  14230. return -1;
  14231. }
  14232. function isRTLRangeFor(value) {
  14233. let range = UnicodeRanges[13];
  14234. if (value >= range.begin && value < range.end) {
  14235. return true;
  14236. }
  14237. range = UnicodeRanges[11];
  14238. if (value >= range.begin && value < range.end) {
  14239. return true;
  14240. }
  14241. return false;
  14242. }
  14243. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  14244. return [
  14245. "\u00A8",
  14246. "\u0020\u0308",
  14247. "\u00AF",
  14248. "\u0020\u0304",
  14249. "\u00B4",
  14250. "\u0020\u0301",
  14251. "\u00B5",
  14252. "\u03BC",
  14253. "\u00B8",
  14254. "\u0020\u0327",
  14255. "\u0132",
  14256. "\u0049\u004A",
  14257. "\u0133",
  14258. "\u0069\u006A",
  14259. "\u013F",
  14260. "\u004C\u00B7",
  14261. "\u0140",
  14262. "\u006C\u00B7",
  14263. "\u0149",
  14264. "\u02BC\u006E",
  14265. "\u017F",
  14266. "\u0073",
  14267. "\u01C4",
  14268. "\u0044\u017D",
  14269. "\u01C5",
  14270. "\u0044\u017E",
  14271. "\u01C6",
  14272. "\u0064\u017E",
  14273. "\u01C7",
  14274. "\u004C\u004A",
  14275. "\u01C8",
  14276. "\u004C\u006A",
  14277. "\u01C9",
  14278. "\u006C\u006A",
  14279. "\u01CA",
  14280. "\u004E\u004A",
  14281. "\u01CB",
  14282. "\u004E\u006A",
  14283. "\u01CC",
  14284. "\u006E\u006A",
  14285. "\u01F1",
  14286. "\u0044\u005A",
  14287. "\u01F2",
  14288. "\u0044\u007A",
  14289. "\u01F3",
  14290. "\u0064\u007A",
  14291. "\u02D8",
  14292. "\u0020\u0306",
  14293. "\u02D9",
  14294. "\u0020\u0307",
  14295. "\u02DA",
  14296. "\u0020\u030A",
  14297. "\u02DB",
  14298. "\u0020\u0328",
  14299. "\u02DC",
  14300. "\u0020\u0303",
  14301. "\u02DD",
  14302. "\u0020\u030B",
  14303. "\u037A",
  14304. "\u0020\u0345",
  14305. "\u0384",
  14306. "\u0020\u0301",
  14307. "\u03D0",
  14308. "\u03B2",
  14309. "\u03D1",
  14310. "\u03B8",
  14311. "\u03D2",
  14312. "\u03A5",
  14313. "\u03D5",
  14314. "\u03C6",
  14315. "\u03D6",
  14316. "\u03C0",
  14317. "\u03F0",
  14318. "\u03BA",
  14319. "\u03F1",
  14320. "\u03C1",
  14321. "\u03F2",
  14322. "\u03C2",
  14323. "\u03F4",
  14324. "\u0398",
  14325. "\u03F5",
  14326. "\u03B5",
  14327. "\u03F9",
  14328. "\u03A3",
  14329. "\u0587",
  14330. "\u0565\u0582",
  14331. "\u0675",
  14332. "\u0627\u0674",
  14333. "\u0676",
  14334. "\u0648\u0674",
  14335. "\u0677",
  14336. "\u06C7\u0674",
  14337. "\u0678",
  14338. "\u064A\u0674",
  14339. "\u0E33",
  14340. "\u0E4D\u0E32",
  14341. "\u0EB3",
  14342. "\u0ECD\u0EB2",
  14343. "\u0EDC",
  14344. "\u0EAB\u0E99",
  14345. "\u0EDD",
  14346. "\u0EAB\u0EA1",
  14347. "\u0F77",
  14348. "\u0FB2\u0F81",
  14349. "\u0F79",
  14350. "\u0FB3\u0F81",
  14351. "\u1E9A",
  14352. "\u0061\u02BE",
  14353. "\u1FBD",
  14354. "\u0020\u0313",
  14355. "\u1FBF",
  14356. "\u0020\u0313",
  14357. "\u1FC0",
  14358. "\u0020\u0342",
  14359. "\u1FFE",
  14360. "\u0020\u0314",
  14361. "\u2002",
  14362. "\u0020",
  14363. "\u2003",
  14364. "\u0020",
  14365. "\u2004",
  14366. "\u0020",
  14367. "\u2005",
  14368. "\u0020",
  14369. "\u2006",
  14370. "\u0020",
  14371. "\u2008",
  14372. "\u0020",
  14373. "\u2009",
  14374. "\u0020",
  14375. "\u200A",
  14376. "\u0020",
  14377. "\u2017",
  14378. "\u0020\u0333",
  14379. "\u2024",
  14380. "\u002E",
  14381. "\u2025",
  14382. "\u002E\u002E",
  14383. "\u2026",
  14384. "\u002E\u002E\u002E",
  14385. "\u2033",
  14386. "\u2032\u2032",
  14387. "\u2034",
  14388. "\u2032\u2032\u2032",
  14389. "\u2036",
  14390. "\u2035\u2035",
  14391. "\u2037",
  14392. "\u2035\u2035\u2035",
  14393. "\u203C",
  14394. "\u0021\u0021",
  14395. "\u203E",
  14396. "\u0020\u0305",
  14397. "\u2047",
  14398. "\u003F\u003F",
  14399. "\u2048",
  14400. "\u003F\u0021",
  14401. "\u2049",
  14402. "\u0021\u003F",
  14403. "\u2057",
  14404. "\u2032\u2032\u2032\u2032",
  14405. "\u205F",
  14406. "\u0020",
  14407. "\u20A8",
  14408. "\u0052\u0073",
  14409. "\u2100",
  14410. "\u0061\u002F\u0063",
  14411. "\u2101",
  14412. "\u0061\u002F\u0073",
  14413. "\u2103",
  14414. "\u00B0\u0043",
  14415. "\u2105",
  14416. "\u0063\u002F\u006F",
  14417. "\u2106",
  14418. "\u0063\u002F\u0075",
  14419. "\u2107",
  14420. "\u0190",
  14421. "\u2109",
  14422. "\u00B0\u0046",
  14423. "\u2116",
  14424. "\u004E\u006F",
  14425. "\u2121",
  14426. "\u0054\u0045\u004C",
  14427. "\u2135",
  14428. "\u05D0",
  14429. "\u2136",
  14430. "\u05D1",
  14431. "\u2137",
  14432. "\u05D2",
  14433. "\u2138",
  14434. "\u05D3",
  14435. "\u213B",
  14436. "\u0046\u0041\u0058",
  14437. "\u2160",
  14438. "\u0049",
  14439. "\u2161",
  14440. "\u0049\u0049",
  14441. "\u2162",
  14442. "\u0049\u0049\u0049",
  14443. "\u2163",
  14444. "\u0049\u0056",
  14445. "\u2164",
  14446. "\u0056",
  14447. "\u2165",
  14448. "\u0056\u0049",
  14449. "\u2166",
  14450. "\u0056\u0049\u0049",
  14451. "\u2167",
  14452. "\u0056\u0049\u0049\u0049",
  14453. "\u2168",
  14454. "\u0049\u0058",
  14455. "\u2169",
  14456. "\u0058",
  14457. "\u216A",
  14458. "\u0058\u0049",
  14459. "\u216B",
  14460. "\u0058\u0049\u0049",
  14461. "\u216C",
  14462. "\u004C",
  14463. "\u216D",
  14464. "\u0043",
  14465. "\u216E",
  14466. "\u0044",
  14467. "\u216F",
  14468. "\u004D",
  14469. "\u2170",
  14470. "\u0069",
  14471. "\u2171",
  14472. "\u0069\u0069",
  14473. "\u2172",
  14474. "\u0069\u0069\u0069",
  14475. "\u2173",
  14476. "\u0069\u0076",
  14477. "\u2174",
  14478. "\u0076",
  14479. "\u2175",
  14480. "\u0076\u0069",
  14481. "\u2176",
  14482. "\u0076\u0069\u0069",
  14483. "\u2177",
  14484. "\u0076\u0069\u0069\u0069",
  14485. "\u2178",
  14486. "\u0069\u0078",
  14487. "\u2179",
  14488. "\u0078",
  14489. "\u217A",
  14490. "\u0078\u0069",
  14491. "\u217B",
  14492. "\u0078\u0069\u0069",
  14493. "\u217C",
  14494. "\u006C",
  14495. "\u217D",
  14496. "\u0063",
  14497. "\u217E",
  14498. "\u0064",
  14499. "\u217F",
  14500. "\u006D",
  14501. "\u222C",
  14502. "\u222B\u222B",
  14503. "\u222D",
  14504. "\u222B\u222B\u222B",
  14505. "\u222F",
  14506. "\u222E\u222E",
  14507. "\u2230",
  14508. "\u222E\u222E\u222E",
  14509. "\u2474",
  14510. "\u0028\u0031\u0029",
  14511. "\u2475",
  14512. "\u0028\u0032\u0029",
  14513. "\u2476",
  14514. "\u0028\u0033\u0029",
  14515. "\u2477",
  14516. "\u0028\u0034\u0029",
  14517. "\u2478",
  14518. "\u0028\u0035\u0029",
  14519. "\u2479",
  14520. "\u0028\u0036\u0029",
  14521. "\u247A",
  14522. "\u0028\u0037\u0029",
  14523. "\u247B",
  14524. "\u0028\u0038\u0029",
  14525. "\u247C",
  14526. "\u0028\u0039\u0029",
  14527. "\u247D",
  14528. "\u0028\u0031\u0030\u0029",
  14529. "\u247E",
  14530. "\u0028\u0031\u0031\u0029",
  14531. "\u247F",
  14532. "\u0028\u0031\u0032\u0029",
  14533. "\u2480",
  14534. "\u0028\u0031\u0033\u0029",
  14535. "\u2481",
  14536. "\u0028\u0031\u0034\u0029",
  14537. "\u2482",
  14538. "\u0028\u0031\u0035\u0029",
  14539. "\u2483",
  14540. "\u0028\u0031\u0036\u0029",
  14541. "\u2484",
  14542. "\u0028\u0031\u0037\u0029",
  14543. "\u2485",
  14544. "\u0028\u0031\u0038\u0029",
  14545. "\u2486",
  14546. "\u0028\u0031\u0039\u0029",
  14547. "\u2487",
  14548. "\u0028\u0032\u0030\u0029",
  14549. "\u2488",
  14550. "\u0031\u002E",
  14551. "\u2489",
  14552. "\u0032\u002E",
  14553. "\u248A",
  14554. "\u0033\u002E",
  14555. "\u248B",
  14556. "\u0034\u002E",
  14557. "\u248C",
  14558. "\u0035\u002E",
  14559. "\u248D",
  14560. "\u0036\u002E",
  14561. "\u248E",
  14562. "\u0037\u002E",
  14563. "\u248F",
  14564. "\u0038\u002E",
  14565. "\u2490",
  14566. "\u0039\u002E",
  14567. "\u2491",
  14568. "\u0031\u0030\u002E",
  14569. "\u2492",
  14570. "\u0031\u0031\u002E",
  14571. "\u2493",
  14572. "\u0031\u0032\u002E",
  14573. "\u2494",
  14574. "\u0031\u0033\u002E",
  14575. "\u2495",
  14576. "\u0031\u0034\u002E",
  14577. "\u2496",
  14578. "\u0031\u0035\u002E",
  14579. "\u2497",
  14580. "\u0031\u0036\u002E",
  14581. "\u2498",
  14582. "\u0031\u0037\u002E",
  14583. "\u2499",
  14584. "\u0031\u0038\u002E",
  14585. "\u249A",
  14586. "\u0031\u0039\u002E",
  14587. "\u249B",
  14588. "\u0032\u0030\u002E",
  14589. "\u249C",
  14590. "\u0028\u0061\u0029",
  14591. "\u249D",
  14592. "\u0028\u0062\u0029",
  14593. "\u249E",
  14594. "\u0028\u0063\u0029",
  14595. "\u249F",
  14596. "\u0028\u0064\u0029",
  14597. "\u24A0",
  14598. "\u0028\u0065\u0029",
  14599. "\u24A1",
  14600. "\u0028\u0066\u0029",
  14601. "\u24A2",
  14602. "\u0028\u0067\u0029",
  14603. "\u24A3",
  14604. "\u0028\u0068\u0029",
  14605. "\u24A4",
  14606. "\u0028\u0069\u0029",
  14607. "\u24A5",
  14608. "\u0028\u006A\u0029",
  14609. "\u24A6",
  14610. "\u0028\u006B\u0029",
  14611. "\u24A7",
  14612. "\u0028\u006C\u0029",
  14613. "\u24A8",
  14614. "\u0028\u006D\u0029",
  14615. "\u24A9",
  14616. "\u0028\u006E\u0029",
  14617. "\u24AA",
  14618. "\u0028\u006F\u0029",
  14619. "\u24AB",
  14620. "\u0028\u0070\u0029",
  14621. "\u24AC",
  14622. "\u0028\u0071\u0029",
  14623. "\u24AD",
  14624. "\u0028\u0072\u0029",
  14625. "\u24AE",
  14626. "\u0028\u0073\u0029",
  14627. "\u24AF",
  14628. "\u0028\u0074\u0029",
  14629. "\u24B0",
  14630. "\u0028\u0075\u0029",
  14631. "\u24B1",
  14632. "\u0028\u0076\u0029",
  14633. "\u24B2",
  14634. "\u0028\u0077\u0029",
  14635. "\u24B3",
  14636. "\u0028\u0078\u0029",
  14637. "\u24B4",
  14638. "\u0028\u0079\u0029",
  14639. "\u24B5",
  14640. "\u0028\u007A\u0029",
  14641. "\u2A0C",
  14642. "\u222B\u222B\u222B\u222B",
  14643. "\u2A74",
  14644. "\u003A\u003A\u003D",
  14645. "\u2A75",
  14646. "\u003D\u003D",
  14647. "\u2A76",
  14648. "\u003D\u003D\u003D",
  14649. "\u2E9F",
  14650. "\u6BCD",
  14651. "\u2EF3",
  14652. "\u9F9F",
  14653. "\u2F00",
  14654. "\u4E00",
  14655. "\u2F01",
  14656. "\u4E28",
  14657. "\u2F02",
  14658. "\u4E36",
  14659. "\u2F03",
  14660. "\u4E3F",
  14661. "\u2F04",
  14662. "\u4E59",
  14663. "\u2F05",
  14664. "\u4E85",
  14665. "\u2F06",
  14666. "\u4E8C",
  14667. "\u2F07",
  14668. "\u4EA0",
  14669. "\u2F08",
  14670. "\u4EBA",
  14671. "\u2F09",
  14672. "\u513F",
  14673. "\u2F0A",
  14674. "\u5165",
  14675. "\u2F0B",
  14676. "\u516B",
  14677. "\u2F0C",
  14678. "\u5182",
  14679. "\u2F0D",
  14680. "\u5196",
  14681. "\u2F0E",
  14682. "\u51AB",
  14683. "\u2F0F",
  14684. "\u51E0",
  14685. "\u2F10",
  14686. "\u51F5",
  14687. "\u2F11",
  14688. "\u5200",
  14689. "\u2F12",
  14690. "\u529B",
  14691. "\u2F13",
  14692. "\u52F9",
  14693. "\u2F14",
  14694. "\u5315",
  14695. "\u2F15",
  14696. "\u531A",
  14697. "\u2F16",
  14698. "\u5338",
  14699. "\u2F17",
  14700. "\u5341",
  14701. "\u2F18",
  14702. "\u535C",
  14703. "\u2F19",
  14704. "\u5369",
  14705. "\u2F1A",
  14706. "\u5382",
  14707. "\u2F1B",
  14708. "\u53B6",
  14709. "\u2F1C",
  14710. "\u53C8",
  14711. "\u2F1D",
  14712. "\u53E3",
  14713. "\u2F1E",
  14714. "\u56D7",
  14715. "\u2F1F",
  14716. "\u571F",
  14717. "\u2F20",
  14718. "\u58EB",
  14719. "\u2F21",
  14720. "\u5902",
  14721. "\u2F22",
  14722. "\u590A",
  14723. "\u2F23",
  14724. "\u5915",
  14725. "\u2F24",
  14726. "\u5927",
  14727. "\u2F25",
  14728. "\u5973",
  14729. "\u2F26",
  14730. "\u5B50",
  14731. "\u2F27",
  14732. "\u5B80",
  14733. "\u2F28",
  14734. "\u5BF8",
  14735. "\u2F29",
  14736. "\u5C0F",
  14737. "\u2F2A",
  14738. "\u5C22",
  14739. "\u2F2B",
  14740. "\u5C38",
  14741. "\u2F2C",
  14742. "\u5C6E",
  14743. "\u2F2D",
  14744. "\u5C71",
  14745. "\u2F2E",
  14746. "\u5DDB",
  14747. "\u2F2F",
  14748. "\u5DE5",
  14749. "\u2F30",
  14750. "\u5DF1",
  14751. "\u2F31",
  14752. "\u5DFE",
  14753. "\u2F32",
  14754. "\u5E72",
  14755. "\u2F33",
  14756. "\u5E7A",
  14757. "\u2F34",
  14758. "\u5E7F",
  14759. "\u2F35",
  14760. "\u5EF4",
  14761. "\u2F36",
  14762. "\u5EFE",
  14763. "\u2F37",
  14764. "\u5F0B",
  14765. "\u2F38",
  14766. "\u5F13",
  14767. "\u2F39",
  14768. "\u5F50",
  14769. "\u2F3A",
  14770. "\u5F61",
  14771. "\u2F3B",
  14772. "\u5F73",
  14773. "\u2F3C",
  14774. "\u5FC3",
  14775. "\u2F3D",
  14776. "\u6208",
  14777. "\u2F3E",
  14778. "\u6236",
  14779. "\u2F3F",
  14780. "\u624B",
  14781. "\u2F40",
  14782. "\u652F",
  14783. "\u2F41",
  14784. "\u6534",
  14785. "\u2F42",
  14786. "\u6587",
  14787. "\u2F43",
  14788. "\u6597",
  14789. "\u2F44",
  14790. "\u65A4",
  14791. "\u2F45",
  14792. "\u65B9",
  14793. "\u2F46",
  14794. "\u65E0",
  14795. "\u2F47",
  14796. "\u65E5",
  14797. "\u2F48",
  14798. "\u66F0",
  14799. "\u2F49",
  14800. "\u6708",
  14801. "\u2F4A",
  14802. "\u6728",
  14803. "\u2F4B",
  14804. "\u6B20",
  14805. "\u2F4C",
  14806. "\u6B62",
  14807. "\u2F4D",
  14808. "\u6B79",
  14809. "\u2F4E",
  14810. "\u6BB3",
  14811. "\u2F4F",
  14812. "\u6BCB",
  14813. "\u2F50",
  14814. "\u6BD4",
  14815. "\u2F51",
  14816. "\u6BDB",
  14817. "\u2F52",
  14818. "\u6C0F",
  14819. "\u2F53",
  14820. "\u6C14",
  14821. "\u2F54",
  14822. "\u6C34",
  14823. "\u2F55",
  14824. "\u706B",
  14825. "\u2F56",
  14826. "\u722A",
  14827. "\u2F57",
  14828. "\u7236",
  14829. "\u2F58",
  14830. "\u723B",
  14831. "\u2F59",
  14832. "\u723F",
  14833. "\u2F5A",
  14834. "\u7247",
  14835. "\u2F5B",
  14836. "\u7259",
  14837. "\u2F5C",
  14838. "\u725B",
  14839. "\u2F5D",
  14840. "\u72AC",
  14841. "\u2F5E",
  14842. "\u7384",
  14843. "\u2F5F",
  14844. "\u7389",
  14845. "\u2F60",
  14846. "\u74DC",
  14847. "\u2F61",
  14848. "\u74E6",
  14849. "\u2F62",
  14850. "\u7518",
  14851. "\u2F63",
  14852. "\u751F",
  14853. "\u2F64",
  14854. "\u7528",
  14855. "\u2F65",
  14856. "\u7530",
  14857. "\u2F66",
  14858. "\u758B",
  14859. "\u2F67",
  14860. "\u7592",
  14861. "\u2F68",
  14862. "\u7676",
  14863. "\u2F69",
  14864. "\u767D",
  14865. "\u2F6A",
  14866. "\u76AE",
  14867. "\u2F6B",
  14868. "\u76BF",
  14869. "\u2F6C",
  14870. "\u76EE",
  14871. "\u2F6D",
  14872. "\u77DB",
  14873. "\u2F6E",
  14874. "\u77E2",
  14875. "\u2F6F",
  14876. "\u77F3",
  14877. "\u2F70",
  14878. "\u793A",
  14879. "\u2F71",
  14880. "\u79B8",
  14881. "\u2F72",
  14882. "\u79BE",
  14883. "\u2F73",
  14884. "\u7A74",
  14885. "\u2F74",
  14886. "\u7ACB",
  14887. "\u2F75",
  14888. "\u7AF9",
  14889. "\u2F76",
  14890. "\u7C73",
  14891. "\u2F77",
  14892. "\u7CF8",
  14893. "\u2F78",
  14894. "\u7F36",
  14895. "\u2F79",
  14896. "\u7F51",
  14897. "\u2F7A",
  14898. "\u7F8A",
  14899. "\u2F7B",
  14900. "\u7FBD",
  14901. "\u2F7C",
  14902. "\u8001",
  14903. "\u2F7D",
  14904. "\u800C",
  14905. "\u2F7E",
  14906. "\u8012",
  14907. "\u2F7F",
  14908. "\u8033",
  14909. "\u2F80",
  14910. "\u807F",
  14911. "\u2F81",
  14912. "\u8089",
  14913. "\u2F82",
  14914. "\u81E3",
  14915. "\u2F83",
  14916. "\u81EA",
  14917. "\u2F84",
  14918. "\u81F3",
  14919. "\u2F85",
  14920. "\u81FC",
  14921. "\u2F86",
  14922. "\u820C",
  14923. "\u2F87",
  14924. "\u821B",
  14925. "\u2F88",
  14926. "\u821F",
  14927. "\u2F89",
  14928. "\u826E",
  14929. "\u2F8A",
  14930. "\u8272",
  14931. "\u2F8B",
  14932. "\u8278",
  14933. "\u2F8C",
  14934. "\u864D",
  14935. "\u2F8D",
  14936. "\u866B",
  14937. "\u2F8E",
  14938. "\u8840",
  14939. "\u2F8F",
  14940. "\u884C",
  14941. "\u2F90",
  14942. "\u8863",
  14943. "\u2F91",
  14944. "\u897E",
  14945. "\u2F92",
  14946. "\u898B",
  14947. "\u2F93",
  14948. "\u89D2",
  14949. "\u2F94",
  14950. "\u8A00",
  14951. "\u2F95",
  14952. "\u8C37",
  14953. "\u2F96",
  14954. "\u8C46",
  14955. "\u2F97",
  14956. "\u8C55",
  14957. "\u2F98",
  14958. "\u8C78",
  14959. "\u2F99",
  14960. "\u8C9D",
  14961. "\u2F9A",
  14962. "\u8D64",
  14963. "\u2F9B",
  14964. "\u8D70",
  14965. "\u2F9C",
  14966. "\u8DB3",
  14967. "\u2F9D",
  14968. "\u8EAB",
  14969. "\u2F9E",
  14970. "\u8ECA",
  14971. "\u2F9F",
  14972. "\u8F9B",
  14973. "\u2FA0",
  14974. "\u8FB0",
  14975. "\u2FA1",
  14976. "\u8FB5",
  14977. "\u2FA2",
  14978. "\u9091",
  14979. "\u2FA3",
  14980. "\u9149",
  14981. "\u2FA4",
  14982. "\u91C6",
  14983. "\u2FA5",
  14984. "\u91CC",
  14985. "\u2FA6",
  14986. "\u91D1",
  14987. "\u2FA7",
  14988. "\u9577",
  14989. "\u2FA8",
  14990. "\u9580",
  14991. "\u2FA9",
  14992. "\u961C",
  14993. "\u2FAA",
  14994. "\u96B6",
  14995. "\u2FAB",
  14996. "\u96B9",
  14997. "\u2FAC",
  14998. "\u96E8",
  14999. "\u2FAD",
  15000. "\u9751",
  15001. "\u2FAE",
  15002. "\u975E",
  15003. "\u2FAF",
  15004. "\u9762",
  15005. "\u2FB0",
  15006. "\u9769",
  15007. "\u2FB1",
  15008. "\u97CB",
  15009. "\u2FB2",
  15010. "\u97ED",
  15011. "\u2FB3",
  15012. "\u97F3",
  15013. "\u2FB4",
  15014. "\u9801",
  15015. "\u2FB5",
  15016. "\u98A8",
  15017. "\u2FB6",
  15018. "\u98DB",
  15019. "\u2FB7",
  15020. "\u98DF",
  15021. "\u2FB8",
  15022. "\u9996",
  15023. "\u2FB9",
  15024. "\u9999",
  15025. "\u2FBA",
  15026. "\u99AC",
  15027. "\u2FBB",
  15028. "\u9AA8",
  15029. "\u2FBC",
  15030. "\u9AD8",
  15031. "\u2FBD",
  15032. "\u9ADF",
  15033. "\u2FBE",
  15034. "\u9B25",
  15035. "\u2FBF",
  15036. "\u9B2F",
  15037. "\u2FC0",
  15038. "\u9B32",
  15039. "\u2FC1",
  15040. "\u9B3C",
  15041. "\u2FC2",
  15042. "\u9B5A",
  15043. "\u2FC3",
  15044. "\u9CE5",
  15045. "\u2FC4",
  15046. "\u9E75",
  15047. "\u2FC5",
  15048. "\u9E7F",
  15049. "\u2FC6",
  15050. "\u9EA5",
  15051. "\u2FC7",
  15052. "\u9EBB",
  15053. "\u2FC8",
  15054. "\u9EC3",
  15055. "\u2FC9",
  15056. "\u9ECD",
  15057. "\u2FCA",
  15058. "\u9ED1",
  15059. "\u2FCB",
  15060. "\u9EF9",
  15061. "\u2FCC",
  15062. "\u9EFD",
  15063. "\u2FCD",
  15064. "\u9F0E",
  15065. "\u2FCE",
  15066. "\u9F13",
  15067. "\u2FCF",
  15068. "\u9F20",
  15069. "\u2FD0",
  15070. "\u9F3B",
  15071. "\u2FD1",
  15072. "\u9F4A",
  15073. "\u2FD2",
  15074. "\u9F52",
  15075. "\u2FD3",
  15076. "\u9F8D",
  15077. "\u2FD4",
  15078. "\u9F9C",
  15079. "\u2FD5",
  15080. "\u9FA0",
  15081. "\u3036",
  15082. "\u3012",
  15083. "\u3038",
  15084. "\u5341",
  15085. "\u3039",
  15086. "\u5344",
  15087. "\u303A",
  15088. "\u5345",
  15089. "\u309B",
  15090. "\u0020\u3099",
  15091. "\u309C",
  15092. "\u0020\u309A",
  15093. "\u3131",
  15094. "\u1100",
  15095. "\u3132",
  15096. "\u1101",
  15097. "\u3133",
  15098. "\u11AA",
  15099. "\u3134",
  15100. "\u1102",
  15101. "\u3135",
  15102. "\u11AC",
  15103. "\u3136",
  15104. "\u11AD",
  15105. "\u3137",
  15106. "\u1103",
  15107. "\u3138",
  15108. "\u1104",
  15109. "\u3139",
  15110. "\u1105",
  15111. "\u313A",
  15112. "\u11B0",
  15113. "\u313B",
  15114. "\u11B1",
  15115. "\u313C",
  15116. "\u11B2",
  15117. "\u313D",
  15118. "\u11B3",
  15119. "\u313E",
  15120. "\u11B4",
  15121. "\u313F",
  15122. "\u11B5",
  15123. "\u3140",
  15124. "\u111A",
  15125. "\u3141",
  15126. "\u1106",
  15127. "\u3142",
  15128. "\u1107",
  15129. "\u3143",
  15130. "\u1108",
  15131. "\u3144",
  15132. "\u1121",
  15133. "\u3145",
  15134. "\u1109",
  15135. "\u3146",
  15136. "\u110A",
  15137. "\u3147",
  15138. "\u110B",
  15139. "\u3148",
  15140. "\u110C",
  15141. "\u3149",
  15142. "\u110D",
  15143. "\u314A",
  15144. "\u110E",
  15145. "\u314B",
  15146. "\u110F",
  15147. "\u314C",
  15148. "\u1110",
  15149. "\u314D",
  15150. "\u1111",
  15151. "\u314E",
  15152. "\u1112",
  15153. "\u314F",
  15154. "\u1161",
  15155. "\u3150",
  15156. "\u1162",
  15157. "\u3151",
  15158. "\u1163",
  15159. "\u3152",
  15160. "\u1164",
  15161. "\u3153",
  15162. "\u1165",
  15163. "\u3154",
  15164. "\u1166",
  15165. "\u3155",
  15166. "\u1167",
  15167. "\u3156",
  15168. "\u1168",
  15169. "\u3157",
  15170. "\u1169",
  15171. "\u3158",
  15172. "\u116A",
  15173. "\u3159",
  15174. "\u116B",
  15175. "\u315A",
  15176. "\u116C",
  15177. "\u315B",
  15178. "\u116D",
  15179. "\u315C",
  15180. "\u116E",
  15181. "\u315D",
  15182. "\u116F",
  15183. "\u315E",
  15184. "\u1170",
  15185. "\u315F",
  15186. "\u1171",
  15187. "\u3160",
  15188. "\u1172",
  15189. "\u3161",
  15190. "\u1173",
  15191. "\u3162",
  15192. "\u1174",
  15193. "\u3163",
  15194. "\u1175",
  15195. "\u3164",
  15196. "\u1160",
  15197. "\u3165",
  15198. "\u1114",
  15199. "\u3166",
  15200. "\u1115",
  15201. "\u3167",
  15202. "\u11C7",
  15203. "\u3168",
  15204. "\u11C8",
  15205. "\u3169",
  15206. "\u11CC",
  15207. "\u316A",
  15208. "\u11CE",
  15209. "\u316B",
  15210. "\u11D3",
  15211. "\u316C",
  15212. "\u11D7",
  15213. "\u316D",
  15214. "\u11D9",
  15215. "\u316E",
  15216. "\u111C",
  15217. "\u316F",
  15218. "\u11DD",
  15219. "\u3170",
  15220. "\u11DF",
  15221. "\u3171",
  15222. "\u111D",
  15223. "\u3172",
  15224. "\u111E",
  15225. "\u3173",
  15226. "\u1120",
  15227. "\u3174",
  15228. "\u1122",
  15229. "\u3175",
  15230. "\u1123",
  15231. "\u3176",
  15232. "\u1127",
  15233. "\u3177",
  15234. "\u1129",
  15235. "\u3178",
  15236. "\u112B",
  15237. "\u3179",
  15238. "\u112C",
  15239. "\u317A",
  15240. "\u112D",
  15241. "\u317B",
  15242. "\u112E",
  15243. "\u317C",
  15244. "\u112F",
  15245. "\u317D",
  15246. "\u1132",
  15247. "\u317E",
  15248. "\u1136",
  15249. "\u317F",
  15250. "\u1140",
  15251. "\u3180",
  15252. "\u1147",
  15253. "\u3181",
  15254. "\u114C",
  15255. "\u3182",
  15256. "\u11F1",
  15257. "\u3183",
  15258. "\u11F2",
  15259. "\u3184",
  15260. "\u1157",
  15261. "\u3185",
  15262. "\u1158",
  15263. "\u3186",
  15264. "\u1159",
  15265. "\u3187",
  15266. "\u1184",
  15267. "\u3188",
  15268. "\u1185",
  15269. "\u3189",
  15270. "\u1188",
  15271. "\u318A",
  15272. "\u1191",
  15273. "\u318B",
  15274. "\u1192",
  15275. "\u318C",
  15276. "\u1194",
  15277. "\u318D",
  15278. "\u119E",
  15279. "\u318E",
  15280. "\u11A1",
  15281. "\u3200",
  15282. "\u0028\u1100\u0029",
  15283. "\u3201",
  15284. "\u0028\u1102\u0029",
  15285. "\u3202",
  15286. "\u0028\u1103\u0029",
  15287. "\u3203",
  15288. "\u0028\u1105\u0029",
  15289. "\u3204",
  15290. "\u0028\u1106\u0029",
  15291. "\u3205",
  15292. "\u0028\u1107\u0029",
  15293. "\u3206",
  15294. "\u0028\u1109\u0029",
  15295. "\u3207",
  15296. "\u0028\u110B\u0029",
  15297. "\u3208",
  15298. "\u0028\u110C\u0029",
  15299. "\u3209",
  15300. "\u0028\u110E\u0029",
  15301. "\u320A",
  15302. "\u0028\u110F\u0029",
  15303. "\u320B",
  15304. "\u0028\u1110\u0029",
  15305. "\u320C",
  15306. "\u0028\u1111\u0029",
  15307. "\u320D",
  15308. "\u0028\u1112\u0029",
  15309. "\u320E",
  15310. "\u0028\u1100\u1161\u0029",
  15311. "\u320F",
  15312. "\u0028\u1102\u1161\u0029",
  15313. "\u3210",
  15314. "\u0028\u1103\u1161\u0029",
  15315. "\u3211",
  15316. "\u0028\u1105\u1161\u0029",
  15317. "\u3212",
  15318. "\u0028\u1106\u1161\u0029",
  15319. "\u3213",
  15320. "\u0028\u1107\u1161\u0029",
  15321. "\u3214",
  15322. "\u0028\u1109\u1161\u0029",
  15323. "\u3215",
  15324. "\u0028\u110B\u1161\u0029",
  15325. "\u3216",
  15326. "\u0028\u110C\u1161\u0029",
  15327. "\u3217",
  15328. "\u0028\u110E\u1161\u0029",
  15329. "\u3218",
  15330. "\u0028\u110F\u1161\u0029",
  15331. "\u3219",
  15332. "\u0028\u1110\u1161\u0029",
  15333. "\u321A",
  15334. "\u0028\u1111\u1161\u0029",
  15335. "\u321B",
  15336. "\u0028\u1112\u1161\u0029",
  15337. "\u321C",
  15338. "\u0028\u110C\u116E\u0029",
  15339. "\u321D",
  15340. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  15341. "\u321E",
  15342. "\u0028\u110B\u1169\u1112\u116E\u0029",
  15343. "\u3220",
  15344. "\u0028\u4E00\u0029",
  15345. "\u3221",
  15346. "\u0028\u4E8C\u0029",
  15347. "\u3222",
  15348. "\u0028\u4E09\u0029",
  15349. "\u3223",
  15350. "\u0028\u56DB\u0029",
  15351. "\u3224",
  15352. "\u0028\u4E94\u0029",
  15353. "\u3225",
  15354. "\u0028\u516D\u0029",
  15355. "\u3226",
  15356. "\u0028\u4E03\u0029",
  15357. "\u3227",
  15358. "\u0028\u516B\u0029",
  15359. "\u3228",
  15360. "\u0028\u4E5D\u0029",
  15361. "\u3229",
  15362. "\u0028\u5341\u0029",
  15363. "\u322A",
  15364. "\u0028\u6708\u0029",
  15365. "\u322B",
  15366. "\u0028\u706B\u0029",
  15367. "\u322C",
  15368. "\u0028\u6C34\u0029",
  15369. "\u322D",
  15370. "\u0028\u6728\u0029",
  15371. "\u322E",
  15372. "\u0028\u91D1\u0029",
  15373. "\u322F",
  15374. "\u0028\u571F\u0029",
  15375. "\u3230",
  15376. "\u0028\u65E5\u0029",
  15377. "\u3231",
  15378. "\u0028\u682A\u0029",
  15379. "\u3232",
  15380. "\u0028\u6709\u0029",
  15381. "\u3233",
  15382. "\u0028\u793E\u0029",
  15383. "\u3234",
  15384. "\u0028\u540D\u0029",
  15385. "\u3235",
  15386. "\u0028\u7279\u0029",
  15387. "\u3236",
  15388. "\u0028\u8CA1\u0029",
  15389. "\u3237",
  15390. "\u0028\u795D\u0029",
  15391. "\u3238",
  15392. "\u0028\u52B4\u0029",
  15393. "\u3239",
  15394. "\u0028\u4EE3\u0029",
  15395. "\u323A",
  15396. "\u0028\u547C\u0029",
  15397. "\u323B",
  15398. "\u0028\u5B66\u0029",
  15399. "\u323C",
  15400. "\u0028\u76E3\u0029",
  15401. "\u323D",
  15402. "\u0028\u4F01\u0029",
  15403. "\u323E",
  15404. "\u0028\u8CC7\u0029",
  15405. "\u323F",
  15406. "\u0028\u5354\u0029",
  15407. "\u3240",
  15408. "\u0028\u796D\u0029",
  15409. "\u3241",
  15410. "\u0028\u4F11\u0029",
  15411. "\u3242",
  15412. "\u0028\u81EA\u0029",
  15413. "\u3243",
  15414. "\u0028\u81F3\u0029",
  15415. "\u32C0",
  15416. "\u0031\u6708",
  15417. "\u32C1",
  15418. "\u0032\u6708",
  15419. "\u32C2",
  15420. "\u0033\u6708",
  15421. "\u32C3",
  15422. "\u0034\u6708",
  15423. "\u32C4",
  15424. "\u0035\u6708",
  15425. "\u32C5",
  15426. "\u0036\u6708",
  15427. "\u32C6",
  15428. "\u0037\u6708",
  15429. "\u32C7",
  15430. "\u0038\u6708",
  15431. "\u32C8",
  15432. "\u0039\u6708",
  15433. "\u32C9",
  15434. "\u0031\u0030\u6708",
  15435. "\u32CA",
  15436. "\u0031\u0031\u6708",
  15437. "\u32CB",
  15438. "\u0031\u0032\u6708",
  15439. "\u3358",
  15440. "\u0030\u70B9",
  15441. "\u3359",
  15442. "\u0031\u70B9",
  15443. "\u335A",
  15444. "\u0032\u70B9",
  15445. "\u335B",
  15446. "\u0033\u70B9",
  15447. "\u335C",
  15448. "\u0034\u70B9",
  15449. "\u335D",
  15450. "\u0035\u70B9",
  15451. "\u335E",
  15452. "\u0036\u70B9",
  15453. "\u335F",
  15454. "\u0037\u70B9",
  15455. "\u3360",
  15456. "\u0038\u70B9",
  15457. "\u3361",
  15458. "\u0039\u70B9",
  15459. "\u3362",
  15460. "\u0031\u0030\u70B9",
  15461. "\u3363",
  15462. "\u0031\u0031\u70B9",
  15463. "\u3364",
  15464. "\u0031\u0032\u70B9",
  15465. "\u3365",
  15466. "\u0031\u0033\u70B9",
  15467. "\u3366",
  15468. "\u0031\u0034\u70B9",
  15469. "\u3367",
  15470. "\u0031\u0035\u70B9",
  15471. "\u3368",
  15472. "\u0031\u0036\u70B9",
  15473. "\u3369",
  15474. "\u0031\u0037\u70B9",
  15475. "\u336A",
  15476. "\u0031\u0038\u70B9",
  15477. "\u336B",
  15478. "\u0031\u0039\u70B9",
  15479. "\u336C",
  15480. "\u0032\u0030\u70B9",
  15481. "\u336D",
  15482. "\u0032\u0031\u70B9",
  15483. "\u336E",
  15484. "\u0032\u0032\u70B9",
  15485. "\u336F",
  15486. "\u0032\u0033\u70B9",
  15487. "\u3370",
  15488. "\u0032\u0034\u70B9",
  15489. "\u33E0",
  15490. "\u0031\u65E5",
  15491. "\u33E1",
  15492. "\u0032\u65E5",
  15493. "\u33E2",
  15494. "\u0033\u65E5",
  15495. "\u33E3",
  15496. "\u0034\u65E5",
  15497. "\u33E4",
  15498. "\u0035\u65E5",
  15499. "\u33E5",
  15500. "\u0036\u65E5",
  15501. "\u33E6",
  15502. "\u0037\u65E5",
  15503. "\u33E7",
  15504. "\u0038\u65E5",
  15505. "\u33E8",
  15506. "\u0039\u65E5",
  15507. "\u33E9",
  15508. "\u0031\u0030\u65E5",
  15509. "\u33EA",
  15510. "\u0031\u0031\u65E5",
  15511. "\u33EB",
  15512. "\u0031\u0032\u65E5",
  15513. "\u33EC",
  15514. "\u0031\u0033\u65E5",
  15515. "\u33ED",
  15516. "\u0031\u0034\u65E5",
  15517. "\u33EE",
  15518. "\u0031\u0035\u65E5",
  15519. "\u33EF",
  15520. "\u0031\u0036\u65E5",
  15521. "\u33F0",
  15522. "\u0031\u0037\u65E5",
  15523. "\u33F1",
  15524. "\u0031\u0038\u65E5",
  15525. "\u33F2",
  15526. "\u0031\u0039\u65E5",
  15527. "\u33F3",
  15528. "\u0032\u0030\u65E5",
  15529. "\u33F4",
  15530. "\u0032\u0031\u65E5",
  15531. "\u33F5",
  15532. "\u0032\u0032\u65E5",
  15533. "\u33F6",
  15534. "\u0032\u0033\u65E5",
  15535. "\u33F7",
  15536. "\u0032\u0034\u65E5",
  15537. "\u33F8",
  15538. "\u0032\u0035\u65E5",
  15539. "\u33F9",
  15540. "\u0032\u0036\u65E5",
  15541. "\u33FA",
  15542. "\u0032\u0037\u65E5",
  15543. "\u33FB",
  15544. "\u0032\u0038\u65E5",
  15545. "\u33FC",
  15546. "\u0032\u0039\u65E5",
  15547. "\u33FD",
  15548. "\u0033\u0030\u65E5",
  15549. "\u33FE",
  15550. "\u0033\u0031\u65E5",
  15551. "\uFB00",
  15552. "\u0066\u0066",
  15553. "\uFB01",
  15554. "\u0066\u0069",
  15555. "\uFB02",
  15556. "\u0066\u006C",
  15557. "\uFB03",
  15558. "\u0066\u0066\u0069",
  15559. "\uFB04",
  15560. "\u0066\u0066\u006C",
  15561. "\uFB05",
  15562. "\u017F\u0074",
  15563. "\uFB06",
  15564. "\u0073\u0074",
  15565. "\uFB13",
  15566. "\u0574\u0576",
  15567. "\uFB14",
  15568. "\u0574\u0565",
  15569. "\uFB15",
  15570. "\u0574\u056B",
  15571. "\uFB16",
  15572. "\u057E\u0576",
  15573. "\uFB17",
  15574. "\u0574\u056D",
  15575. "\uFB4F",
  15576. "\u05D0\u05DC",
  15577. "\uFB50",
  15578. "\u0671",
  15579. "\uFB51",
  15580. "\u0671",
  15581. "\uFB52",
  15582. "\u067B",
  15583. "\uFB53",
  15584. "\u067B",
  15585. "\uFB54",
  15586. "\u067B",
  15587. "\uFB55",
  15588. "\u067B",
  15589. "\uFB56",
  15590. "\u067E",
  15591. "\uFB57",
  15592. "\u067E",
  15593. "\uFB58",
  15594. "\u067E",
  15595. "\uFB59",
  15596. "\u067E",
  15597. "\uFB5A",
  15598. "\u0680",
  15599. "\uFB5B",
  15600. "\u0680",
  15601. "\uFB5C",
  15602. "\u0680",
  15603. "\uFB5D",
  15604. "\u0680",
  15605. "\uFB5E",
  15606. "\u067A",
  15607. "\uFB5F",
  15608. "\u067A",
  15609. "\uFB60",
  15610. "\u067A",
  15611. "\uFB61",
  15612. "\u067A",
  15613. "\uFB62",
  15614. "\u067F",
  15615. "\uFB63",
  15616. "\u067F",
  15617. "\uFB64",
  15618. "\u067F",
  15619. "\uFB65",
  15620. "\u067F",
  15621. "\uFB66",
  15622. "\u0679",
  15623. "\uFB67",
  15624. "\u0679",
  15625. "\uFB68",
  15626. "\u0679",
  15627. "\uFB69",
  15628. "\u0679",
  15629. "\uFB6A",
  15630. "\u06A4",
  15631. "\uFB6B",
  15632. "\u06A4",
  15633. "\uFB6C",
  15634. "\u06A4",
  15635. "\uFB6D",
  15636. "\u06A4",
  15637. "\uFB6E",
  15638. "\u06A6",
  15639. "\uFB6F",
  15640. "\u06A6",
  15641. "\uFB70",
  15642. "\u06A6",
  15643. "\uFB71",
  15644. "\u06A6",
  15645. "\uFB72",
  15646. "\u0684",
  15647. "\uFB73",
  15648. "\u0684",
  15649. "\uFB74",
  15650. "\u0684",
  15651. "\uFB75",
  15652. "\u0684",
  15653. "\uFB76",
  15654. "\u0683",
  15655. "\uFB77",
  15656. "\u0683",
  15657. "\uFB78",
  15658. "\u0683",
  15659. "\uFB79",
  15660. "\u0683",
  15661. "\uFB7A",
  15662. "\u0686",
  15663. "\uFB7B",
  15664. "\u0686",
  15665. "\uFB7C",
  15666. "\u0686",
  15667. "\uFB7D",
  15668. "\u0686",
  15669. "\uFB7E",
  15670. "\u0687",
  15671. "\uFB7F",
  15672. "\u0687",
  15673. "\uFB80",
  15674. "\u0687",
  15675. "\uFB81",
  15676. "\u0687",
  15677. "\uFB82",
  15678. "\u068D",
  15679. "\uFB83",
  15680. "\u068D",
  15681. "\uFB84",
  15682. "\u068C",
  15683. "\uFB85",
  15684. "\u068C",
  15685. "\uFB86",
  15686. "\u068E",
  15687. "\uFB87",
  15688. "\u068E",
  15689. "\uFB88",
  15690. "\u0688",
  15691. "\uFB89",
  15692. "\u0688",
  15693. "\uFB8A",
  15694. "\u0698",
  15695. "\uFB8B",
  15696. "\u0698",
  15697. "\uFB8C",
  15698. "\u0691",
  15699. "\uFB8D",
  15700. "\u0691",
  15701. "\uFB8E",
  15702. "\u06A9",
  15703. "\uFB8F",
  15704. "\u06A9",
  15705. "\uFB90",
  15706. "\u06A9",
  15707. "\uFB91",
  15708. "\u06A9",
  15709. "\uFB92",
  15710. "\u06AF",
  15711. "\uFB93",
  15712. "\u06AF",
  15713. "\uFB94",
  15714. "\u06AF",
  15715. "\uFB95",
  15716. "\u06AF",
  15717. "\uFB96",
  15718. "\u06B3",
  15719. "\uFB97",
  15720. "\u06B3",
  15721. "\uFB98",
  15722. "\u06B3",
  15723. "\uFB99",
  15724. "\u06B3",
  15725. "\uFB9A",
  15726. "\u06B1",
  15727. "\uFB9B",
  15728. "\u06B1",
  15729. "\uFB9C",
  15730. "\u06B1",
  15731. "\uFB9D",
  15732. "\u06B1",
  15733. "\uFB9E",
  15734. "\u06BA",
  15735. "\uFB9F",
  15736. "\u06BA",
  15737. "\uFBA0",
  15738. "\u06BB",
  15739. "\uFBA1",
  15740. "\u06BB",
  15741. "\uFBA2",
  15742. "\u06BB",
  15743. "\uFBA3",
  15744. "\u06BB",
  15745. "\uFBA4",
  15746. "\u06C0",
  15747. "\uFBA5",
  15748. "\u06C0",
  15749. "\uFBA6",
  15750. "\u06C1",
  15751. "\uFBA7",
  15752. "\u06C1",
  15753. "\uFBA8",
  15754. "\u06C1",
  15755. "\uFBA9",
  15756. "\u06C1",
  15757. "\uFBAA",
  15758. "\u06BE",
  15759. "\uFBAB",
  15760. "\u06BE",
  15761. "\uFBAC",
  15762. "\u06BE",
  15763. "\uFBAD",
  15764. "\u06BE",
  15765. "\uFBAE",
  15766. "\u06D2",
  15767. "\uFBAF",
  15768. "\u06D2",
  15769. "\uFBB0",
  15770. "\u06D3",
  15771. "\uFBB1",
  15772. "\u06D3",
  15773. "\uFBD3",
  15774. "\u06AD",
  15775. "\uFBD4",
  15776. "\u06AD",
  15777. "\uFBD5",
  15778. "\u06AD",
  15779. "\uFBD6",
  15780. "\u06AD",
  15781. "\uFBD7",
  15782. "\u06C7",
  15783. "\uFBD8",
  15784. "\u06C7",
  15785. "\uFBD9",
  15786. "\u06C6",
  15787. "\uFBDA",
  15788. "\u06C6",
  15789. "\uFBDB",
  15790. "\u06C8",
  15791. "\uFBDC",
  15792. "\u06C8",
  15793. "\uFBDD",
  15794. "\u0677",
  15795. "\uFBDE",
  15796. "\u06CB",
  15797. "\uFBDF",
  15798. "\u06CB",
  15799. "\uFBE0",
  15800. "\u06C5",
  15801. "\uFBE1",
  15802. "\u06C5",
  15803. "\uFBE2",
  15804. "\u06C9",
  15805. "\uFBE3",
  15806. "\u06C9",
  15807. "\uFBE4",
  15808. "\u06D0",
  15809. "\uFBE5",
  15810. "\u06D0",
  15811. "\uFBE6",
  15812. "\u06D0",
  15813. "\uFBE7",
  15814. "\u06D0",
  15815. "\uFBE8",
  15816. "\u0649",
  15817. "\uFBE9",
  15818. "\u0649",
  15819. "\uFBEA",
  15820. "\u0626\u0627",
  15821. "\uFBEB",
  15822. "\u0626\u0627",
  15823. "\uFBEC",
  15824. "\u0626\u06D5",
  15825. "\uFBED",
  15826. "\u0626\u06D5",
  15827. "\uFBEE",
  15828. "\u0626\u0648",
  15829. "\uFBEF",
  15830. "\u0626\u0648",
  15831. "\uFBF0",
  15832. "\u0626\u06C7",
  15833. "\uFBF1",
  15834. "\u0626\u06C7",
  15835. "\uFBF2",
  15836. "\u0626\u06C6",
  15837. "\uFBF3",
  15838. "\u0626\u06C6",
  15839. "\uFBF4",
  15840. "\u0626\u06C8",
  15841. "\uFBF5",
  15842. "\u0626\u06C8",
  15843. "\uFBF6",
  15844. "\u0626\u06D0",
  15845. "\uFBF7",
  15846. "\u0626\u06D0",
  15847. "\uFBF8",
  15848. "\u0626\u06D0",
  15849. "\uFBF9",
  15850. "\u0626\u0649",
  15851. "\uFBFA",
  15852. "\u0626\u0649",
  15853. "\uFBFB",
  15854. "\u0626\u0649",
  15855. "\uFBFC",
  15856. "\u06CC",
  15857. "\uFBFD",
  15858. "\u06CC",
  15859. "\uFBFE",
  15860. "\u06CC",
  15861. "\uFBFF",
  15862. "\u06CC",
  15863. "\uFC00",
  15864. "\u0626\u062C",
  15865. "\uFC01",
  15866. "\u0626\u062D",
  15867. "\uFC02",
  15868. "\u0626\u0645",
  15869. "\uFC03",
  15870. "\u0626\u0649",
  15871. "\uFC04",
  15872. "\u0626\u064A",
  15873. "\uFC05",
  15874. "\u0628\u062C",
  15875. "\uFC06",
  15876. "\u0628\u062D",
  15877. "\uFC07",
  15878. "\u0628\u062E",
  15879. "\uFC08",
  15880. "\u0628\u0645",
  15881. "\uFC09",
  15882. "\u0628\u0649",
  15883. "\uFC0A",
  15884. "\u0628\u064A",
  15885. "\uFC0B",
  15886. "\u062A\u062C",
  15887. "\uFC0C",
  15888. "\u062A\u062D",
  15889. "\uFC0D",
  15890. "\u062A\u062E",
  15891. "\uFC0E",
  15892. "\u062A\u0645",
  15893. "\uFC0F",
  15894. "\u062A\u0649",
  15895. "\uFC10",
  15896. "\u062A\u064A",
  15897. "\uFC11",
  15898. "\u062B\u062C",
  15899. "\uFC12",
  15900. "\u062B\u0645",
  15901. "\uFC13",
  15902. "\u062B\u0649",
  15903. "\uFC14",
  15904. "\u062B\u064A",
  15905. "\uFC15",
  15906. "\u062C\u062D",
  15907. "\uFC16",
  15908. "\u062C\u0645",
  15909. "\uFC17",
  15910. "\u062D\u062C",
  15911. "\uFC18",
  15912. "\u062D\u0645",
  15913. "\uFC19",
  15914. "\u062E\u062C",
  15915. "\uFC1A",
  15916. "\u062E\u062D",
  15917. "\uFC1B",
  15918. "\u062E\u0645",
  15919. "\uFC1C",
  15920. "\u0633\u062C",
  15921. "\uFC1D",
  15922. "\u0633\u062D",
  15923. "\uFC1E",
  15924. "\u0633\u062E",
  15925. "\uFC1F",
  15926. "\u0633\u0645",
  15927. "\uFC20",
  15928. "\u0635\u062D",
  15929. "\uFC21",
  15930. "\u0635\u0645",
  15931. "\uFC22",
  15932. "\u0636\u062C",
  15933. "\uFC23",
  15934. "\u0636\u062D",
  15935. "\uFC24",
  15936. "\u0636\u062E",
  15937. "\uFC25",
  15938. "\u0636\u0645",
  15939. "\uFC26",
  15940. "\u0637\u062D",
  15941. "\uFC27",
  15942. "\u0637\u0645",
  15943. "\uFC28",
  15944. "\u0638\u0645",
  15945. "\uFC29",
  15946. "\u0639\u062C",
  15947. "\uFC2A",
  15948. "\u0639\u0645",
  15949. "\uFC2B",
  15950. "\u063A\u062C",
  15951. "\uFC2C",
  15952. "\u063A\u0645",
  15953. "\uFC2D",
  15954. "\u0641\u062C",
  15955. "\uFC2E",
  15956. "\u0641\u062D",
  15957. "\uFC2F",
  15958. "\u0641\u062E",
  15959. "\uFC30",
  15960. "\u0641\u0645",
  15961. "\uFC31",
  15962. "\u0641\u0649",
  15963. "\uFC32",
  15964. "\u0641\u064A",
  15965. "\uFC33",
  15966. "\u0642\u062D",
  15967. "\uFC34",
  15968. "\u0642\u0645",
  15969. "\uFC35",
  15970. "\u0642\u0649",
  15971. "\uFC36",
  15972. "\u0642\u064A",
  15973. "\uFC37",
  15974. "\u0643\u0627",
  15975. "\uFC38",
  15976. "\u0643\u062C",
  15977. "\uFC39",
  15978. "\u0643\u062D",
  15979. "\uFC3A",
  15980. "\u0643\u062E",
  15981. "\uFC3B",
  15982. "\u0643\u0644",
  15983. "\uFC3C",
  15984. "\u0643\u0645",
  15985. "\uFC3D",
  15986. "\u0643\u0649",
  15987. "\uFC3E",
  15988. "\u0643\u064A",
  15989. "\uFC3F",
  15990. "\u0644\u062C",
  15991. "\uFC40",
  15992. "\u0644\u062D",
  15993. "\uFC41",
  15994. "\u0644\u062E",
  15995. "\uFC42",
  15996. "\u0644\u0645",
  15997. "\uFC43",
  15998. "\u0644\u0649",
  15999. "\uFC44",
  16000. "\u0644\u064A",
  16001. "\uFC45",
  16002. "\u0645\u062C",
  16003. "\uFC46",
  16004. "\u0645\u062D",
  16005. "\uFC47",
  16006. "\u0645\u062E",
  16007. "\uFC48",
  16008. "\u0645\u0645",
  16009. "\uFC49",
  16010. "\u0645\u0649",
  16011. "\uFC4A",
  16012. "\u0645\u064A",
  16013. "\uFC4B",
  16014. "\u0646\u062C",
  16015. "\uFC4C",
  16016. "\u0646\u062D",
  16017. "\uFC4D",
  16018. "\u0646\u062E",
  16019. "\uFC4E",
  16020. "\u0646\u0645",
  16021. "\uFC4F",
  16022. "\u0646\u0649",
  16023. "\uFC50",
  16024. "\u0646\u064A",
  16025. "\uFC51",
  16026. "\u0647\u062C",
  16027. "\uFC52",
  16028. "\u0647\u0645",
  16029. "\uFC53",
  16030. "\u0647\u0649",
  16031. "\uFC54",
  16032. "\u0647\u064A",
  16033. "\uFC55",
  16034. "\u064A\u062C",
  16035. "\uFC56",
  16036. "\u064A\u062D",
  16037. "\uFC57",
  16038. "\u064A\u062E",
  16039. "\uFC58",
  16040. "\u064A\u0645",
  16041. "\uFC59",
  16042. "\u064A\u0649",
  16043. "\uFC5A",
  16044. "\u064A\u064A",
  16045. "\uFC5B",
  16046. "\u0630\u0670",
  16047. "\uFC5C",
  16048. "\u0631\u0670",
  16049. "\uFC5D",
  16050. "\u0649\u0670",
  16051. "\uFC5E",
  16052. "\u0020\u064C\u0651",
  16053. "\uFC5F",
  16054. "\u0020\u064D\u0651",
  16055. "\uFC60",
  16056. "\u0020\u064E\u0651",
  16057. "\uFC61",
  16058. "\u0020\u064F\u0651",
  16059. "\uFC62",
  16060. "\u0020\u0650\u0651",
  16061. "\uFC63",
  16062. "\u0020\u0651\u0670",
  16063. "\uFC64",
  16064. "\u0626\u0631",
  16065. "\uFC65",
  16066. "\u0626\u0632",
  16067. "\uFC66",
  16068. "\u0626\u0645",
  16069. "\uFC67",
  16070. "\u0626\u0646",
  16071. "\uFC68",
  16072. "\u0626\u0649",
  16073. "\uFC69",
  16074. "\u0626\u064A",
  16075. "\uFC6A",
  16076. "\u0628\u0631",
  16077. "\uFC6B",
  16078. "\u0628\u0632",
  16079. "\uFC6C",
  16080. "\u0628\u0645",
  16081. "\uFC6D",
  16082. "\u0628\u0646",
  16083. "\uFC6E",
  16084. "\u0628\u0649",
  16085. "\uFC6F",
  16086. "\u0628\u064A",
  16087. "\uFC70",
  16088. "\u062A\u0631",
  16089. "\uFC71",
  16090. "\u062A\u0632",
  16091. "\uFC72",
  16092. "\u062A\u0645",
  16093. "\uFC73",
  16094. "\u062A\u0646",
  16095. "\uFC74",
  16096. "\u062A\u0649",
  16097. "\uFC75",
  16098. "\u062A\u064A",
  16099. "\uFC76",
  16100. "\u062B\u0631",
  16101. "\uFC77",
  16102. "\u062B\u0632",
  16103. "\uFC78",
  16104. "\u062B\u0645",
  16105. "\uFC79",
  16106. "\u062B\u0646",
  16107. "\uFC7A",
  16108. "\u062B\u0649",
  16109. "\uFC7B",
  16110. "\u062B\u064A",
  16111. "\uFC7C",
  16112. "\u0641\u0649",
  16113. "\uFC7D",
  16114. "\u0641\u064A",
  16115. "\uFC7E",
  16116. "\u0642\u0649",
  16117. "\uFC7F",
  16118. "\u0642\u064A",
  16119. "\uFC80",
  16120. "\u0643\u0627",
  16121. "\uFC81",
  16122. "\u0643\u0644",
  16123. "\uFC82",
  16124. "\u0643\u0645",
  16125. "\uFC83",
  16126. "\u0643\u0649",
  16127. "\uFC84",
  16128. "\u0643\u064A",
  16129. "\uFC85",
  16130. "\u0644\u0645",
  16131. "\uFC86",
  16132. "\u0644\u0649",
  16133. "\uFC87",
  16134. "\u0644\u064A",
  16135. "\uFC88",
  16136. "\u0645\u0627",
  16137. "\uFC89",
  16138. "\u0645\u0645",
  16139. "\uFC8A",
  16140. "\u0646\u0631",
  16141. "\uFC8B",
  16142. "\u0646\u0632",
  16143. "\uFC8C",
  16144. "\u0646\u0645",
  16145. "\uFC8D",
  16146. "\u0646\u0646",
  16147. "\uFC8E",
  16148. "\u0646\u0649",
  16149. "\uFC8F",
  16150. "\u0646\u064A",
  16151. "\uFC90",
  16152. "\u0649\u0670",
  16153. "\uFC91",
  16154. "\u064A\u0631",
  16155. "\uFC92",
  16156. "\u064A\u0632",
  16157. "\uFC93",
  16158. "\u064A\u0645",
  16159. "\uFC94",
  16160. "\u064A\u0646",
  16161. "\uFC95",
  16162. "\u064A\u0649",
  16163. "\uFC96",
  16164. "\u064A\u064A",
  16165. "\uFC97",
  16166. "\u0626\u062C",
  16167. "\uFC98",
  16168. "\u0626\u062D",
  16169. "\uFC99",
  16170. "\u0626\u062E",
  16171. "\uFC9A",
  16172. "\u0626\u0645",
  16173. "\uFC9B",
  16174. "\u0626\u0647",
  16175. "\uFC9C",
  16176. "\u0628\u062C",
  16177. "\uFC9D",
  16178. "\u0628\u062D",
  16179. "\uFC9E",
  16180. "\u0628\u062E",
  16181. "\uFC9F",
  16182. "\u0628\u0645",
  16183. "\uFCA0",
  16184. "\u0628\u0647",
  16185. "\uFCA1",
  16186. "\u062A\u062C",
  16187. "\uFCA2",
  16188. "\u062A\u062D",
  16189. "\uFCA3",
  16190. "\u062A\u062E",
  16191. "\uFCA4",
  16192. "\u062A\u0645",
  16193. "\uFCA5",
  16194. "\u062A\u0647",
  16195. "\uFCA6",
  16196. "\u062B\u0645",
  16197. "\uFCA7",
  16198. "\u062C\u062D",
  16199. "\uFCA8",
  16200. "\u062C\u0645",
  16201. "\uFCA9",
  16202. "\u062D\u062C",
  16203. "\uFCAA",
  16204. "\u062D\u0645",
  16205. "\uFCAB",
  16206. "\u062E\u062C",
  16207. "\uFCAC",
  16208. "\u062E\u0645",
  16209. "\uFCAD",
  16210. "\u0633\u062C",
  16211. "\uFCAE",
  16212. "\u0633\u062D",
  16213. "\uFCAF",
  16214. "\u0633\u062E",
  16215. "\uFCB0",
  16216. "\u0633\u0645",
  16217. "\uFCB1",
  16218. "\u0635\u062D",
  16219. "\uFCB2",
  16220. "\u0635\u062E",
  16221. "\uFCB3",
  16222. "\u0635\u0645",
  16223. "\uFCB4",
  16224. "\u0636\u062C",
  16225. "\uFCB5",
  16226. "\u0636\u062D",
  16227. "\uFCB6",
  16228. "\u0636\u062E",
  16229. "\uFCB7",
  16230. "\u0636\u0645",
  16231. "\uFCB8",
  16232. "\u0637\u062D",
  16233. "\uFCB9",
  16234. "\u0638\u0645",
  16235. "\uFCBA",
  16236. "\u0639\u062C",
  16237. "\uFCBB",
  16238. "\u0639\u0645",
  16239. "\uFCBC",
  16240. "\u063A\u062C",
  16241. "\uFCBD",
  16242. "\u063A\u0645",
  16243. "\uFCBE",
  16244. "\u0641\u062C",
  16245. "\uFCBF",
  16246. "\u0641\u062D",
  16247. "\uFCC0",
  16248. "\u0641\u062E",
  16249. "\uFCC1",
  16250. "\u0641\u0645",
  16251. "\uFCC2",
  16252. "\u0642\u062D",
  16253. "\uFCC3",
  16254. "\u0642\u0645",
  16255. "\uFCC4",
  16256. "\u0643\u062C",
  16257. "\uFCC5",
  16258. "\u0643\u062D",
  16259. "\uFCC6",
  16260. "\u0643\u062E",
  16261. "\uFCC7",
  16262. "\u0643\u0644",
  16263. "\uFCC8",
  16264. "\u0643\u0645",
  16265. "\uFCC9",
  16266. "\u0644\u062C",
  16267. "\uFCCA",
  16268. "\u0644\u062D",
  16269. "\uFCCB",
  16270. "\u0644\u062E",
  16271. "\uFCCC",
  16272. "\u0644\u0645",
  16273. "\uFCCD",
  16274. "\u0644\u0647",
  16275. "\uFCCE",
  16276. "\u0645\u062C",
  16277. "\uFCCF",
  16278. "\u0645\u062D",
  16279. "\uFCD0",
  16280. "\u0645\u062E",
  16281. "\uFCD1",
  16282. "\u0645\u0645",
  16283. "\uFCD2",
  16284. "\u0646\u062C",
  16285. "\uFCD3",
  16286. "\u0646\u062D",
  16287. "\uFCD4",
  16288. "\u0646\u062E",
  16289. "\uFCD5",
  16290. "\u0646\u0645",
  16291. "\uFCD6",
  16292. "\u0646\u0647",
  16293. "\uFCD7",
  16294. "\u0647\u062C",
  16295. "\uFCD8",
  16296. "\u0647\u0645",
  16297. "\uFCD9",
  16298. "\u0647\u0670",
  16299. "\uFCDA",
  16300. "\u064A\u062C",
  16301. "\uFCDB",
  16302. "\u064A\u062D",
  16303. "\uFCDC",
  16304. "\u064A\u062E",
  16305. "\uFCDD",
  16306. "\u064A\u0645",
  16307. "\uFCDE",
  16308. "\u064A\u0647",
  16309. "\uFCDF",
  16310. "\u0626\u0645",
  16311. "\uFCE0",
  16312. "\u0626\u0647",
  16313. "\uFCE1",
  16314. "\u0628\u0645",
  16315. "\uFCE2",
  16316. "\u0628\u0647",
  16317. "\uFCE3",
  16318. "\u062A\u0645",
  16319. "\uFCE4",
  16320. "\u062A\u0647",
  16321. "\uFCE5",
  16322. "\u062B\u0645",
  16323. "\uFCE6",
  16324. "\u062B\u0647",
  16325. "\uFCE7",
  16326. "\u0633\u0645",
  16327. "\uFCE8",
  16328. "\u0633\u0647",
  16329. "\uFCE9",
  16330. "\u0634\u0645",
  16331. "\uFCEA",
  16332. "\u0634\u0647",
  16333. "\uFCEB",
  16334. "\u0643\u0644",
  16335. "\uFCEC",
  16336. "\u0643\u0645",
  16337. "\uFCED",
  16338. "\u0644\u0645",
  16339. "\uFCEE",
  16340. "\u0646\u0645",
  16341. "\uFCEF",
  16342. "\u0646\u0647",
  16343. "\uFCF0",
  16344. "\u064A\u0645",
  16345. "\uFCF1",
  16346. "\u064A\u0647",
  16347. "\uFCF2",
  16348. "\u0640\u064E\u0651",
  16349. "\uFCF3",
  16350. "\u0640\u064F\u0651",
  16351. "\uFCF4",
  16352. "\u0640\u0650\u0651",
  16353. "\uFCF5",
  16354. "\u0637\u0649",
  16355. "\uFCF6",
  16356. "\u0637\u064A",
  16357. "\uFCF7",
  16358. "\u0639\u0649",
  16359. "\uFCF8",
  16360. "\u0639\u064A",
  16361. "\uFCF9",
  16362. "\u063A\u0649",
  16363. "\uFCFA",
  16364. "\u063A\u064A",
  16365. "\uFCFB",
  16366. "\u0633\u0649",
  16367. "\uFCFC",
  16368. "\u0633\u064A",
  16369. "\uFCFD",
  16370. "\u0634\u0649",
  16371. "\uFCFE",
  16372. "\u0634\u064A",
  16373. "\uFCFF",
  16374. "\u062D\u0649",
  16375. "\uFD00",
  16376. "\u062D\u064A",
  16377. "\uFD01",
  16378. "\u062C\u0649",
  16379. "\uFD02",
  16380. "\u062C\u064A",
  16381. "\uFD03",
  16382. "\u062E\u0649",
  16383. "\uFD04",
  16384. "\u062E\u064A",
  16385. "\uFD05",
  16386. "\u0635\u0649",
  16387. "\uFD06",
  16388. "\u0635\u064A",
  16389. "\uFD07",
  16390. "\u0636\u0649",
  16391. "\uFD08",
  16392. "\u0636\u064A",
  16393. "\uFD09",
  16394. "\u0634\u062C",
  16395. "\uFD0A",
  16396. "\u0634\u062D",
  16397. "\uFD0B",
  16398. "\u0634\u062E",
  16399. "\uFD0C",
  16400. "\u0634\u0645",
  16401. "\uFD0D",
  16402. "\u0634\u0631",
  16403. "\uFD0E",
  16404. "\u0633\u0631",
  16405. "\uFD0F",
  16406. "\u0635\u0631",
  16407. "\uFD10",
  16408. "\u0636\u0631",
  16409. "\uFD11",
  16410. "\u0637\u0649",
  16411. "\uFD12",
  16412. "\u0637\u064A",
  16413. "\uFD13",
  16414. "\u0639\u0649",
  16415. "\uFD14",
  16416. "\u0639\u064A",
  16417. "\uFD15",
  16418. "\u063A\u0649",
  16419. "\uFD16",
  16420. "\u063A\u064A",
  16421. "\uFD17",
  16422. "\u0633\u0649",
  16423. "\uFD18",
  16424. "\u0633\u064A",
  16425. "\uFD19",
  16426. "\u0634\u0649",
  16427. "\uFD1A",
  16428. "\u0634\u064A",
  16429. "\uFD1B",
  16430. "\u062D\u0649",
  16431. "\uFD1C",
  16432. "\u062D\u064A",
  16433. "\uFD1D",
  16434. "\u062C\u0649",
  16435. "\uFD1E",
  16436. "\u062C\u064A",
  16437. "\uFD1F",
  16438. "\u062E\u0649",
  16439. "\uFD20",
  16440. "\u062E\u064A",
  16441. "\uFD21",
  16442. "\u0635\u0649",
  16443. "\uFD22",
  16444. "\u0635\u064A",
  16445. "\uFD23",
  16446. "\u0636\u0649",
  16447. "\uFD24",
  16448. "\u0636\u064A",
  16449. "\uFD25",
  16450. "\u0634\u062C",
  16451. "\uFD26",
  16452. "\u0634\u062D",
  16453. "\uFD27",
  16454. "\u0634\u062E",
  16455. "\uFD28",
  16456. "\u0634\u0645",
  16457. "\uFD29",
  16458. "\u0634\u0631",
  16459. "\uFD2A",
  16460. "\u0633\u0631",
  16461. "\uFD2B",
  16462. "\u0635\u0631",
  16463. "\uFD2C",
  16464. "\u0636\u0631",
  16465. "\uFD2D",
  16466. "\u0634\u062C",
  16467. "\uFD2E",
  16468. "\u0634\u062D",
  16469. "\uFD2F",
  16470. "\u0634\u062E",
  16471. "\uFD30",
  16472. "\u0634\u0645",
  16473. "\uFD31",
  16474. "\u0633\u0647",
  16475. "\uFD32",
  16476. "\u0634\u0647",
  16477. "\uFD33",
  16478. "\u0637\u0645",
  16479. "\uFD34",
  16480. "\u0633\u062C",
  16481. "\uFD35",
  16482. "\u0633\u062D",
  16483. "\uFD36",
  16484. "\u0633\u062E",
  16485. "\uFD37",
  16486. "\u0634\u062C",
  16487. "\uFD38",
  16488. "\u0634\u062D",
  16489. "\uFD39",
  16490. "\u0634\u062E",
  16491. "\uFD3A",
  16492. "\u0637\u0645",
  16493. "\uFD3B",
  16494. "\u0638\u0645",
  16495. "\uFD3C",
  16496. "\u0627\u064B",
  16497. "\uFD3D",
  16498. "\u0627\u064B",
  16499. "\uFD50",
  16500. "\u062A\u062C\u0645",
  16501. "\uFD51",
  16502. "\u062A\u062D\u062C",
  16503. "\uFD52",
  16504. "\u062A\u062D\u062C",
  16505. "\uFD53",
  16506. "\u062A\u062D\u0645",
  16507. "\uFD54",
  16508. "\u062A\u062E\u0645",
  16509. "\uFD55",
  16510. "\u062A\u0645\u062C",
  16511. "\uFD56",
  16512. "\u062A\u0645\u062D",
  16513. "\uFD57",
  16514. "\u062A\u0645\u062E",
  16515. "\uFD58",
  16516. "\u062C\u0645\u062D",
  16517. "\uFD59",
  16518. "\u062C\u0645\u062D",
  16519. "\uFD5A",
  16520. "\u062D\u0645\u064A",
  16521. "\uFD5B",
  16522. "\u062D\u0645\u0649",
  16523. "\uFD5C",
  16524. "\u0633\u062D\u062C",
  16525. "\uFD5D",
  16526. "\u0633\u062C\u062D",
  16527. "\uFD5E",
  16528. "\u0633\u062C\u0649",
  16529. "\uFD5F",
  16530. "\u0633\u0645\u062D",
  16531. "\uFD60",
  16532. "\u0633\u0645\u062D",
  16533. "\uFD61",
  16534. "\u0633\u0645\u062C",
  16535. "\uFD62",
  16536. "\u0633\u0645\u0645",
  16537. "\uFD63",
  16538. "\u0633\u0645\u0645",
  16539. "\uFD64",
  16540. "\u0635\u062D\u062D",
  16541. "\uFD65",
  16542. "\u0635\u062D\u062D",
  16543. "\uFD66",
  16544. "\u0635\u0645\u0645",
  16545. "\uFD67",
  16546. "\u0634\u062D\u0645",
  16547. "\uFD68",
  16548. "\u0634\u062D\u0645",
  16549. "\uFD69",
  16550. "\u0634\u062C\u064A",
  16551. "\uFD6A",
  16552. "\u0634\u0645\u062E",
  16553. "\uFD6B",
  16554. "\u0634\u0645\u062E",
  16555. "\uFD6C",
  16556. "\u0634\u0645\u0645",
  16557. "\uFD6D",
  16558. "\u0634\u0645\u0645",
  16559. "\uFD6E",
  16560. "\u0636\u062D\u0649",
  16561. "\uFD6F",
  16562. "\u0636\u062E\u0645",
  16563. "\uFD70",
  16564. "\u0636\u062E\u0645",
  16565. "\uFD71",
  16566. "\u0637\u0645\u062D",
  16567. "\uFD72",
  16568. "\u0637\u0645\u062D",
  16569. "\uFD73",
  16570. "\u0637\u0645\u0645",
  16571. "\uFD74",
  16572. "\u0637\u0645\u064A",
  16573. "\uFD75",
  16574. "\u0639\u062C\u0645",
  16575. "\uFD76",
  16576. "\u0639\u0645\u0645",
  16577. "\uFD77",
  16578. "\u0639\u0645\u0645",
  16579. "\uFD78",
  16580. "\u0639\u0645\u0649",
  16581. "\uFD79",
  16582. "\u063A\u0645\u0645",
  16583. "\uFD7A",
  16584. "\u063A\u0645\u064A",
  16585. "\uFD7B",
  16586. "\u063A\u0645\u0649",
  16587. "\uFD7C",
  16588. "\u0641\u062E\u0645",
  16589. "\uFD7D",
  16590. "\u0641\u062E\u0645",
  16591. "\uFD7E",
  16592. "\u0642\u0645\u062D",
  16593. "\uFD7F",
  16594. "\u0642\u0645\u0645",
  16595. "\uFD80",
  16596. "\u0644\u062D\u0645",
  16597. "\uFD81",
  16598. "\u0644\u062D\u064A",
  16599. "\uFD82",
  16600. "\u0644\u062D\u0649",
  16601. "\uFD83",
  16602. "\u0644\u062C\u062C",
  16603. "\uFD84",
  16604. "\u0644\u062C\u062C",
  16605. "\uFD85",
  16606. "\u0644\u062E\u0645",
  16607. "\uFD86",
  16608. "\u0644\u062E\u0645",
  16609. "\uFD87",
  16610. "\u0644\u0645\u062D",
  16611. "\uFD88",
  16612. "\u0644\u0645\u062D",
  16613. "\uFD89",
  16614. "\u0645\u062D\u062C",
  16615. "\uFD8A",
  16616. "\u0645\u062D\u0645",
  16617. "\uFD8B",
  16618. "\u0645\u062D\u064A",
  16619. "\uFD8C",
  16620. "\u0645\u062C\u062D",
  16621. "\uFD8D",
  16622. "\u0645\u062C\u0645",
  16623. "\uFD8E",
  16624. "\u0645\u062E\u062C",
  16625. "\uFD8F",
  16626. "\u0645\u062E\u0645",
  16627. "\uFD92",
  16628. "\u0645\u062C\u062E",
  16629. "\uFD93",
  16630. "\u0647\u0645\u062C",
  16631. "\uFD94",
  16632. "\u0647\u0645\u0645",
  16633. "\uFD95",
  16634. "\u0646\u062D\u0645",
  16635. "\uFD96",
  16636. "\u0646\u062D\u0649",
  16637. "\uFD97",
  16638. "\u0646\u062C\u0645",
  16639. "\uFD98",
  16640. "\u0646\u062C\u0645",
  16641. "\uFD99",
  16642. "\u0646\u062C\u0649",
  16643. "\uFD9A",
  16644. "\u0646\u0645\u064A",
  16645. "\uFD9B",
  16646. "\u0646\u0645\u0649",
  16647. "\uFD9C",
  16648. "\u064A\u0645\u0645",
  16649. "\uFD9D",
  16650. "\u064A\u0645\u0645",
  16651. "\uFD9E",
  16652. "\u0628\u062E\u064A",
  16653. "\uFD9F",
  16654. "\u062A\u062C\u064A",
  16655. "\uFDA0",
  16656. "\u062A\u062C\u0649",
  16657. "\uFDA1",
  16658. "\u062A\u062E\u064A",
  16659. "\uFDA2",
  16660. "\u062A\u062E\u0649",
  16661. "\uFDA3",
  16662. "\u062A\u0645\u064A",
  16663. "\uFDA4",
  16664. "\u062A\u0645\u0649",
  16665. "\uFDA5",
  16666. "\u062C\u0645\u064A",
  16667. "\uFDA6",
  16668. "\u062C\u062D\u0649",
  16669. "\uFDA7",
  16670. "\u062C\u0645\u0649",
  16671. "\uFDA8",
  16672. "\u0633\u062E\u0649",
  16673. "\uFDA9",
  16674. "\u0635\u062D\u064A",
  16675. "\uFDAA",
  16676. "\u0634\u062D\u064A",
  16677. "\uFDAB",
  16678. "\u0636\u062D\u064A",
  16679. "\uFDAC",
  16680. "\u0644\u062C\u064A",
  16681. "\uFDAD",
  16682. "\u0644\u0645\u064A",
  16683. "\uFDAE",
  16684. "\u064A\u062D\u064A",
  16685. "\uFDAF",
  16686. "\u064A\u062C\u064A",
  16687. "\uFDB0",
  16688. "\u064A\u0645\u064A",
  16689. "\uFDB1",
  16690. "\u0645\u0645\u064A",
  16691. "\uFDB2",
  16692. "\u0642\u0645\u064A",
  16693. "\uFDB3",
  16694. "\u0646\u062D\u064A",
  16695. "\uFDB4",
  16696. "\u0642\u0645\u062D",
  16697. "\uFDB5",
  16698. "\u0644\u062D\u0645",
  16699. "\uFDB6",
  16700. "\u0639\u0645\u064A",
  16701. "\uFDB7",
  16702. "\u0643\u0645\u064A",
  16703. "\uFDB8",
  16704. "\u0646\u062C\u062D",
  16705. "\uFDB9",
  16706. "\u0645\u062E\u064A",
  16707. "\uFDBA",
  16708. "\u0644\u062C\u0645",
  16709. "\uFDBB",
  16710. "\u0643\u0645\u0645",
  16711. "\uFDBC",
  16712. "\u0644\u062C\u0645",
  16713. "\uFDBD",
  16714. "\u0646\u062C\u062D",
  16715. "\uFDBE",
  16716. "\u062C\u062D\u064A",
  16717. "\uFDBF",
  16718. "\u062D\u062C\u064A",
  16719. "\uFDC0",
  16720. "\u0645\u062C\u064A",
  16721. "\uFDC1",
  16722. "\u0641\u0645\u064A",
  16723. "\uFDC2",
  16724. "\u0628\u062D\u064A",
  16725. "\uFDC3",
  16726. "\u0643\u0645\u0645",
  16727. "\uFDC4",
  16728. "\u0639\u062C\u0645",
  16729. "\uFDC5",
  16730. "\u0635\u0645\u0645",
  16731. "\uFDC6",
  16732. "\u0633\u062E\u064A",
  16733. "\uFDC7",
  16734. "\u0646\u062C\u064A",
  16735. "\uFE49",
  16736. "\u203E",
  16737. "\uFE4A",
  16738. "\u203E",
  16739. "\uFE4B",
  16740. "\u203E",
  16741. "\uFE4C",
  16742. "\u203E",
  16743. "\uFE4D",
  16744. "\u005F",
  16745. "\uFE4E",
  16746. "\u005F",
  16747. "\uFE4F",
  16748. "\u005F",
  16749. "\uFE80",
  16750. "\u0621",
  16751. "\uFE81",
  16752. "\u0622",
  16753. "\uFE82",
  16754. "\u0622",
  16755. "\uFE83",
  16756. "\u0623",
  16757. "\uFE84",
  16758. "\u0623",
  16759. "\uFE85",
  16760. "\u0624",
  16761. "\uFE86",
  16762. "\u0624",
  16763. "\uFE87",
  16764. "\u0625",
  16765. "\uFE88",
  16766. "\u0625",
  16767. "\uFE89",
  16768. "\u0626",
  16769. "\uFE8A",
  16770. "\u0626",
  16771. "\uFE8B",
  16772. "\u0626",
  16773. "\uFE8C",
  16774. "\u0626",
  16775. "\uFE8D",
  16776. "\u0627",
  16777. "\uFE8E",
  16778. "\u0627",
  16779. "\uFE8F",
  16780. "\u0628",
  16781. "\uFE90",
  16782. "\u0628",
  16783. "\uFE91",
  16784. "\u0628",
  16785. "\uFE92",
  16786. "\u0628",
  16787. "\uFE93",
  16788. "\u0629",
  16789. "\uFE94",
  16790. "\u0629",
  16791. "\uFE95",
  16792. "\u062A",
  16793. "\uFE96",
  16794. "\u062A",
  16795. "\uFE97",
  16796. "\u062A",
  16797. "\uFE98",
  16798. "\u062A",
  16799. "\uFE99",
  16800. "\u062B",
  16801. "\uFE9A",
  16802. "\u062B",
  16803. "\uFE9B",
  16804. "\u062B",
  16805. "\uFE9C",
  16806. "\u062B",
  16807. "\uFE9D",
  16808. "\u062C",
  16809. "\uFE9E",
  16810. "\u062C",
  16811. "\uFE9F",
  16812. "\u062C",
  16813. "\uFEA0",
  16814. "\u062C",
  16815. "\uFEA1",
  16816. "\u062D",
  16817. "\uFEA2",
  16818. "\u062D",
  16819. "\uFEA3",
  16820. "\u062D",
  16821. "\uFEA4",
  16822. "\u062D",
  16823. "\uFEA5",
  16824. "\u062E",
  16825. "\uFEA6",
  16826. "\u062E",
  16827. "\uFEA7",
  16828. "\u062E",
  16829. "\uFEA8",
  16830. "\u062E",
  16831. "\uFEA9",
  16832. "\u062F",
  16833. "\uFEAA",
  16834. "\u062F",
  16835. "\uFEAB",
  16836. "\u0630",
  16837. "\uFEAC",
  16838. "\u0630",
  16839. "\uFEAD",
  16840. "\u0631",
  16841. "\uFEAE",
  16842. "\u0631",
  16843. "\uFEAF",
  16844. "\u0632",
  16845. "\uFEB0",
  16846. "\u0632",
  16847. "\uFEB1",
  16848. "\u0633",
  16849. "\uFEB2",
  16850. "\u0633",
  16851. "\uFEB3",
  16852. "\u0633",
  16853. "\uFEB4",
  16854. "\u0633",
  16855. "\uFEB5",
  16856. "\u0634",
  16857. "\uFEB6",
  16858. "\u0634",
  16859. "\uFEB7",
  16860. "\u0634",
  16861. "\uFEB8",
  16862. "\u0634",
  16863. "\uFEB9",
  16864. "\u0635",
  16865. "\uFEBA",
  16866. "\u0635",
  16867. "\uFEBB",
  16868. "\u0635",
  16869. "\uFEBC",
  16870. "\u0635",
  16871. "\uFEBD",
  16872. "\u0636",
  16873. "\uFEBE",
  16874. "\u0636",
  16875. "\uFEBF",
  16876. "\u0636",
  16877. "\uFEC0",
  16878. "\u0636",
  16879. "\uFEC1",
  16880. "\u0637",
  16881. "\uFEC2",
  16882. "\u0637",
  16883. "\uFEC3",
  16884. "\u0637",
  16885. "\uFEC4",
  16886. "\u0637",
  16887. "\uFEC5",
  16888. "\u0638",
  16889. "\uFEC6",
  16890. "\u0638",
  16891. "\uFEC7",
  16892. "\u0638",
  16893. "\uFEC8",
  16894. "\u0638",
  16895. "\uFEC9",
  16896. "\u0639",
  16897. "\uFECA",
  16898. "\u0639",
  16899. "\uFECB",
  16900. "\u0639",
  16901. "\uFECC",
  16902. "\u0639",
  16903. "\uFECD",
  16904. "\u063A",
  16905. "\uFECE",
  16906. "\u063A",
  16907. "\uFECF",
  16908. "\u063A",
  16909. "\uFED0",
  16910. "\u063A",
  16911. "\uFED1",
  16912. "\u0641",
  16913. "\uFED2",
  16914. "\u0641",
  16915. "\uFED3",
  16916. "\u0641",
  16917. "\uFED4",
  16918. "\u0641",
  16919. "\uFED5",
  16920. "\u0642",
  16921. "\uFED6",
  16922. "\u0642",
  16923. "\uFED7",
  16924. "\u0642",
  16925. "\uFED8",
  16926. "\u0642",
  16927. "\uFED9",
  16928. "\u0643",
  16929. "\uFEDA",
  16930. "\u0643",
  16931. "\uFEDB",
  16932. "\u0643",
  16933. "\uFEDC",
  16934. "\u0643",
  16935. "\uFEDD",
  16936. "\u0644",
  16937. "\uFEDE",
  16938. "\u0644",
  16939. "\uFEDF",
  16940. "\u0644",
  16941. "\uFEE0",
  16942. "\u0644",
  16943. "\uFEE1",
  16944. "\u0645",
  16945. "\uFEE2",
  16946. "\u0645",
  16947. "\uFEE3",
  16948. "\u0645",
  16949. "\uFEE4",
  16950. "\u0645",
  16951. "\uFEE5",
  16952. "\u0646",
  16953. "\uFEE6",
  16954. "\u0646",
  16955. "\uFEE7",
  16956. "\u0646",
  16957. "\uFEE8",
  16958. "\u0646",
  16959. "\uFEE9",
  16960. "\u0647",
  16961. "\uFEEA",
  16962. "\u0647",
  16963. "\uFEEB",
  16964. "\u0647",
  16965. "\uFEEC",
  16966. "\u0647",
  16967. "\uFEED",
  16968. "\u0648",
  16969. "\uFEEE",
  16970. "\u0648",
  16971. "\uFEEF",
  16972. "\u0649",
  16973. "\uFEF0",
  16974. "\u0649",
  16975. "\uFEF1",
  16976. "\u064A",
  16977. "\uFEF2",
  16978. "\u064A",
  16979. "\uFEF3",
  16980. "\u064A",
  16981. "\uFEF4",
  16982. "\u064A",
  16983. "\uFEF5",
  16984. "\u0644\u0622",
  16985. "\uFEF6",
  16986. "\u0644\u0622",
  16987. "\uFEF7",
  16988. "\u0644\u0623",
  16989. "\uFEF8",
  16990. "\u0644\u0623",
  16991. "\uFEF9",
  16992. "\u0644\u0625",
  16993. "\uFEFA",
  16994. "\u0644\u0625",
  16995. "\uFEFB",
  16996. "\u0644\u0627",
  16997. "\uFEFC",
  16998. "\u0644\u0627"
  16999. ];
  17000. });
  17001. function reverseIfRtl(chars) {
  17002. const charsLength = chars.length;
  17003. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  17004. return chars;
  17005. }
  17006. const buf = [];
  17007. for (let ii = charsLength - 1; ii >= 0; ii--) {
  17008. buf.push(chars[ii]);
  17009. }
  17010. return buf.join("");
  17011. }
  17012. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  17013. const CategoryCache = new Map();
  17014. function getCharUnicodeCategory(char) {
  17015. const cachedCategory = CategoryCache.get(char);
  17016. if (cachedCategory) {
  17017. return cachedCategory;
  17018. }
  17019. const groups = char.match(SpecialCharRegExp);
  17020. const category = {
  17021. isWhitespace: !!(groups && groups[1]),
  17022. isZeroWidthDiacritic: !!(groups && groups[2]),
  17023. isInvisibleFormatMark: !!(groups && groups[3])
  17024. };
  17025. CategoryCache.set(char, category);
  17026. return category;
  17027. }
  17028. function clearUnicodeCaches() {
  17029. CategoryCache.clear();
  17030. }
  17031. /***/ }),
  17032. /* 22 */
  17033. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17034. Object.defineProperty(exports, "__esModule", ({
  17035. value: true
  17036. }));
  17037. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  17038. exports.getQuadPoints = getQuadPoints;
  17039. var _util = __w_pdfjs_require__(2);
  17040. var _core_utils = __w_pdfjs_require__(8);
  17041. var _default_appearance = __w_pdfjs_require__(23);
  17042. var _primitives = __w_pdfjs_require__(5);
  17043. var _base_stream = __w_pdfjs_require__(9);
  17044. var _bidi = __w_pdfjs_require__(60);
  17045. var _catalog = __w_pdfjs_require__(64);
  17046. var _colorspace = __w_pdfjs_require__(24);
  17047. var _file_spec = __w_pdfjs_require__(67);
  17048. var _object_loader = __w_pdfjs_require__(71);
  17049. var _operator_list = __w_pdfjs_require__(62);
  17050. var _stream = __w_pdfjs_require__(10);
  17051. var _writer = __w_pdfjs_require__(72);
  17052. var _factory = __w_pdfjs_require__(75);
  17053. class AnnotationFactory {
  17054. static create(xref, ref, pdfManager, idFactory, collectFields) {
  17055. return Promise.all([pdfManager.ensureCatalog("acroForm"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex]));
  17056. }
  17057. static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex = -1) {
  17058. const dict = xref.fetchIfRef(ref);
  17059. if (!(dict instanceof _primitives.Dict)) {
  17060. return undefined;
  17061. }
  17062. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  17063. let subtype = dict.get("Subtype");
  17064. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  17065. const parameters = {
  17066. xref,
  17067. ref,
  17068. dict,
  17069. subtype,
  17070. id,
  17071. pdfManager,
  17072. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  17073. collectFields,
  17074. pageIndex
  17075. };
  17076. switch (subtype) {
  17077. case "Link":
  17078. return new LinkAnnotation(parameters);
  17079. case "Text":
  17080. return new TextAnnotation(parameters);
  17081. case "Widget":
  17082. let fieldType = (0, _core_utils.getInheritableProperty)({
  17083. dict,
  17084. key: "FT"
  17085. });
  17086. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17087. switch (fieldType) {
  17088. case "Tx":
  17089. return new TextWidgetAnnotation(parameters);
  17090. case "Btn":
  17091. return new ButtonWidgetAnnotation(parameters);
  17092. case "Ch":
  17093. return new ChoiceWidgetAnnotation(parameters);
  17094. case "Sig":
  17095. return new SignatureWidgetAnnotation(parameters);
  17096. }
  17097. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  17098. return new WidgetAnnotation(parameters);
  17099. case "Popup":
  17100. return new PopupAnnotation(parameters);
  17101. case "FreeText":
  17102. return new FreeTextAnnotation(parameters);
  17103. case "Line":
  17104. return new LineAnnotation(parameters);
  17105. case "Square":
  17106. return new SquareAnnotation(parameters);
  17107. case "Circle":
  17108. return new CircleAnnotation(parameters);
  17109. case "PolyLine":
  17110. return new PolylineAnnotation(parameters);
  17111. case "Polygon":
  17112. return new PolygonAnnotation(parameters);
  17113. case "Caret":
  17114. return new CaretAnnotation(parameters);
  17115. case "Ink":
  17116. return new InkAnnotation(parameters);
  17117. case "Highlight":
  17118. return new HighlightAnnotation(parameters);
  17119. case "Underline":
  17120. return new UnderlineAnnotation(parameters);
  17121. case "Squiggly":
  17122. return new SquigglyAnnotation(parameters);
  17123. case "StrikeOut":
  17124. return new StrikeOutAnnotation(parameters);
  17125. case "Stamp":
  17126. return new StampAnnotation(parameters);
  17127. case "FileAttachment":
  17128. return new FileAttachmentAnnotation(parameters);
  17129. default:
  17130. if (!collectFields) {
  17131. if (!subtype) {
  17132. (0, _util.warn)("Annotation is missing the required /Subtype.");
  17133. } else {
  17134. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  17135. }
  17136. }
  17137. return new Annotation(parameters);
  17138. }
  17139. }
  17140. static async _getPageIndex(xref, ref, pdfManager) {
  17141. try {
  17142. const annotDict = await xref.fetchIfRefAsync(ref);
  17143. if (!(annotDict instanceof _primitives.Dict)) {
  17144. return -1;
  17145. }
  17146. const pageRef = annotDict.getRaw("P");
  17147. if (!(pageRef instanceof _primitives.Ref)) {
  17148. return -1;
  17149. }
  17150. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  17151. return pageIndex;
  17152. } catch (ex) {
  17153. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  17154. return -1;
  17155. }
  17156. }
  17157. }
  17158. exports.AnnotationFactory = AnnotationFactory;
  17159. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  17160. if (!Array.isArray(color)) {
  17161. return defaultColor;
  17162. }
  17163. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  17164. switch (color.length) {
  17165. case 0:
  17166. return null;
  17167. case 1:
  17168. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  17169. return rgbColor;
  17170. case 3:
  17171. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  17172. return rgbColor;
  17173. case 4:
  17174. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  17175. return rgbColor;
  17176. default:
  17177. return defaultColor;
  17178. }
  17179. }
  17180. function getQuadPoints(dict, rect) {
  17181. if (!dict.has("QuadPoints")) {
  17182. return null;
  17183. }
  17184. const quadPoints = dict.getArray("QuadPoints");
  17185. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  17186. return null;
  17187. }
  17188. const quadPointsLists = [];
  17189. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  17190. quadPointsLists.push([]);
  17191. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  17192. const x = quadPoints[j];
  17193. const y = quadPoints[j + 1];
  17194. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  17195. return null;
  17196. }
  17197. quadPointsLists[i].push({
  17198. x,
  17199. y
  17200. });
  17201. }
  17202. }
  17203. return quadPointsLists.map(quadPointsList => {
  17204. const [minX, maxX, minY, maxY] = quadPointsList.reduce(([mX, MX, mY, MY], quadPoint) => [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)], [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  17205. return [{
  17206. x: minX,
  17207. y: maxY
  17208. }, {
  17209. x: maxX,
  17210. y: maxY
  17211. }, {
  17212. x: minX,
  17213. y: minY
  17214. }, {
  17215. x: maxX,
  17216. y: minY
  17217. }];
  17218. });
  17219. }
  17220. function getTransformMatrix(rect, bbox, matrix) {
  17221. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  17222. if (minX === maxX || minY === maxY) {
  17223. return [1, 0, 0, 1, rect[0], rect[1]];
  17224. }
  17225. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  17226. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  17227. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  17228. }
  17229. class Annotation {
  17230. constructor(params) {
  17231. const dict = params.dict;
  17232. this.setTitle(dict.get("T"));
  17233. this.setContents(dict.get("Contents"));
  17234. this.setModificationDate(dict.get("M"));
  17235. this.setFlags(dict.get("F"));
  17236. this.setRectangle(dict.getArray("Rect"));
  17237. this.setColor(dict.getArray("C"));
  17238. this.setBorderStyle(dict);
  17239. this.setAppearance(dict);
  17240. this.setBorderAndBackgroundColors(dict.get("MK"));
  17241. this._streams = [];
  17242. if (this.appearance) {
  17243. this._streams.push(this.appearance);
  17244. }
  17245. this.data = {
  17246. annotationFlags: this.flags,
  17247. borderStyle: this.borderStyle,
  17248. color: this.color,
  17249. backgroundColor: this.backgroundColor,
  17250. borderColor: this.borderColor,
  17251. contentsObj: this._contents,
  17252. hasAppearance: !!this.appearance,
  17253. id: params.id,
  17254. modificationDate: this.modificationDate,
  17255. rect: this.rectangle,
  17256. subtype: params.subtype,
  17257. hasOwnCanvas: false
  17258. };
  17259. if (params.collectFields) {
  17260. const kids = dict.get("Kids");
  17261. if (Array.isArray(kids)) {
  17262. const kidIds = [];
  17263. for (const kid of kids) {
  17264. if (kid instanceof _primitives.Ref) {
  17265. kidIds.push(kid.toString());
  17266. }
  17267. }
  17268. if (kidIds.length !== 0) {
  17269. this.data.kidIds = kidIds;
  17270. }
  17271. }
  17272. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17273. this.data.fieldName = this._constructFieldName(dict);
  17274. this.data.pageIndex = params.pageIndex;
  17275. }
  17276. this._fallbackFontDict = null;
  17277. }
  17278. _hasFlag(flags, flag) {
  17279. return !!(flags & flag);
  17280. }
  17281. _isViewable(flags) {
  17282. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  17283. }
  17284. _isPrintable(flags) {
  17285. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  17286. }
  17287. mustBeViewed(annotationStorage) {
  17288. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17289. if (storageEntry && storageEntry.hidden !== undefined) {
  17290. return !storageEntry.hidden;
  17291. }
  17292. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  17293. }
  17294. mustBePrinted(annotationStorage) {
  17295. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17296. if (storageEntry && storageEntry.print !== undefined) {
  17297. return storageEntry.print;
  17298. }
  17299. return this.printable;
  17300. }
  17301. get viewable() {
  17302. if (this.data.quadPoints === null) {
  17303. return false;
  17304. }
  17305. if (this.flags === 0) {
  17306. return true;
  17307. }
  17308. return this._isViewable(this.flags);
  17309. }
  17310. get printable() {
  17311. if (this.data.quadPoints === null) {
  17312. return false;
  17313. }
  17314. if (this.flags === 0) {
  17315. return false;
  17316. }
  17317. return this._isPrintable(this.flags);
  17318. }
  17319. _parseStringHelper(data) {
  17320. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  17321. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  17322. return {
  17323. str,
  17324. dir
  17325. };
  17326. }
  17327. setTitle(title) {
  17328. this._title = this._parseStringHelper(title);
  17329. }
  17330. setContents(contents) {
  17331. this._contents = this._parseStringHelper(contents);
  17332. }
  17333. setModificationDate(modificationDate) {
  17334. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  17335. }
  17336. setFlags(flags) {
  17337. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  17338. }
  17339. hasFlag(flag) {
  17340. return this._hasFlag(this.flags, flag);
  17341. }
  17342. setRectangle(rectangle) {
  17343. if (Array.isArray(rectangle) && rectangle.length === 4) {
  17344. this.rectangle = _util.Util.normalizeRect(rectangle);
  17345. } else {
  17346. this.rectangle = [0, 0, 0, 0];
  17347. }
  17348. }
  17349. setColor(color) {
  17350. this.color = getRgbColor(color);
  17351. }
  17352. setBorderAndBackgroundColors(mk) {
  17353. if (mk instanceof _primitives.Dict) {
  17354. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  17355. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  17356. } else {
  17357. this.borderColor = this.backgroundColor = null;
  17358. }
  17359. }
  17360. setBorderStyle(borderStyle) {
  17361. this.borderStyle = new AnnotationBorderStyle();
  17362. if (!(borderStyle instanceof _primitives.Dict)) {
  17363. return;
  17364. }
  17365. if (borderStyle.has("BS")) {
  17366. const dict = borderStyle.get("BS");
  17367. const dictType = dict.get("Type");
  17368. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  17369. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  17370. this.borderStyle.setStyle(dict.get("S"));
  17371. this.borderStyle.setDashArray(dict.getArray("D"));
  17372. }
  17373. } else if (borderStyle.has("Border")) {
  17374. const array = borderStyle.getArray("Border");
  17375. if (Array.isArray(array) && array.length >= 3) {
  17376. this.borderStyle.setHorizontalCornerRadius(array[0]);
  17377. this.borderStyle.setVerticalCornerRadius(array[1]);
  17378. this.borderStyle.setWidth(array[2], this.rectangle);
  17379. if (array.length === 4) {
  17380. this.borderStyle.setDashArray(array[3], true);
  17381. }
  17382. }
  17383. } else {
  17384. this.borderStyle.setWidth(0);
  17385. }
  17386. }
  17387. setAppearance(dict) {
  17388. this.appearance = null;
  17389. const appearanceStates = dict.get("AP");
  17390. if (!(appearanceStates instanceof _primitives.Dict)) {
  17391. return;
  17392. }
  17393. const normalAppearanceState = appearanceStates.get("N");
  17394. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  17395. this.appearance = normalAppearanceState;
  17396. return;
  17397. }
  17398. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  17399. return;
  17400. }
  17401. const as = dict.get("AS");
  17402. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  17403. return;
  17404. }
  17405. this.appearance = normalAppearanceState.get(as.name);
  17406. }
  17407. loadResources(keys, appearance) {
  17408. return appearance.dict.getAsync("Resources").then(resources => {
  17409. if (!resources) {
  17410. return undefined;
  17411. }
  17412. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  17413. return objectLoader.load().then(function () {
  17414. return resources;
  17415. });
  17416. });
  17417. }
  17418. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17419. const data = this.data;
  17420. let appearance = this.appearance;
  17421. const isUsingOwnCanvas = data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY;
  17422. if (!appearance) {
  17423. if (!isUsingOwnCanvas) {
  17424. return Promise.resolve(new _operator_list.OperatorList());
  17425. }
  17426. appearance = new _stream.StringStream("");
  17427. appearance.dict = new _primitives.Dict();
  17428. }
  17429. const appearanceDict = appearance.dict;
  17430. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  17431. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  17432. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  17433. const transform = getTransformMatrix(data.rect, bbox, matrix);
  17434. return resourcesPromise.then(resources => {
  17435. const opList = new _operator_list.OperatorList();
  17436. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  17437. return evaluator.getOperatorList({
  17438. stream: appearance,
  17439. task,
  17440. resources,
  17441. operatorList: opList,
  17442. fallbackFontDict: this._fallbackFontDict
  17443. }).then(() => {
  17444. opList.addOp(_util.OPS.endAnnotation, []);
  17445. this.reset();
  17446. return opList;
  17447. });
  17448. });
  17449. }
  17450. async save(evaluator, task, annotationStorage) {
  17451. return null;
  17452. }
  17453. getFieldObject() {
  17454. if (this.data.kidIds) {
  17455. return {
  17456. id: this.data.id,
  17457. actions: this.data.actions,
  17458. name: this.data.fieldName,
  17459. strokeColor: this.data.borderColor,
  17460. fillColor: this.data.backgroundColor,
  17461. type: "",
  17462. kidIds: this.data.kidIds,
  17463. page: this.data.pageIndex
  17464. };
  17465. }
  17466. return null;
  17467. }
  17468. reset() {
  17469. for (const stream of this._streams) {
  17470. stream.reset();
  17471. }
  17472. }
  17473. _constructFieldName(dict) {
  17474. if (!dict.has("T") && !dict.has("Parent")) {
  17475. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  17476. return "";
  17477. }
  17478. if (!dict.has("Parent")) {
  17479. return (0, _util.stringToPDFString)(dict.get("T"));
  17480. }
  17481. const fieldName = [];
  17482. if (dict.has("T")) {
  17483. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  17484. }
  17485. let loopDict = dict;
  17486. const visited = new _primitives.RefSet();
  17487. if (dict.objId) {
  17488. visited.put(dict.objId);
  17489. }
  17490. while (loopDict.has("Parent")) {
  17491. loopDict = loopDict.get("Parent");
  17492. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  17493. break;
  17494. }
  17495. if (loopDict.objId) {
  17496. visited.put(loopDict.objId);
  17497. }
  17498. if (loopDict.has("T")) {
  17499. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  17500. }
  17501. }
  17502. return fieldName.join(".");
  17503. }
  17504. }
  17505. exports.Annotation = Annotation;
  17506. class AnnotationBorderStyle {
  17507. constructor() {
  17508. this.width = 1;
  17509. this.style = _util.AnnotationBorderStyleType.SOLID;
  17510. this.dashArray = [3];
  17511. this.horizontalCornerRadius = 0;
  17512. this.verticalCornerRadius = 0;
  17513. }
  17514. setWidth(width, rect = [0, 0, 0, 0]) {
  17515. if (width instanceof _primitives.Name) {
  17516. this.width = 0;
  17517. return;
  17518. }
  17519. if (typeof width === "number") {
  17520. if (width > 0) {
  17521. const maxWidth = (rect[2] - rect[0]) / 2;
  17522. const maxHeight = (rect[3] - rect[1]) / 2;
  17523. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  17524. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  17525. width = 1;
  17526. }
  17527. }
  17528. this.width = width;
  17529. }
  17530. }
  17531. setStyle(style) {
  17532. if (!(style instanceof _primitives.Name)) {
  17533. return;
  17534. }
  17535. switch (style.name) {
  17536. case "S":
  17537. this.style = _util.AnnotationBorderStyleType.SOLID;
  17538. break;
  17539. case "D":
  17540. this.style = _util.AnnotationBorderStyleType.DASHED;
  17541. break;
  17542. case "B":
  17543. this.style = _util.AnnotationBorderStyleType.BEVELED;
  17544. break;
  17545. case "I":
  17546. this.style = _util.AnnotationBorderStyleType.INSET;
  17547. break;
  17548. case "U":
  17549. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  17550. break;
  17551. default:
  17552. break;
  17553. }
  17554. }
  17555. setDashArray(dashArray, forceStyle = false) {
  17556. if (Array.isArray(dashArray) && dashArray.length > 0) {
  17557. let isValid = true;
  17558. let allZeros = true;
  17559. for (const element of dashArray) {
  17560. const validNumber = +element >= 0;
  17561. if (!validNumber) {
  17562. isValid = false;
  17563. break;
  17564. } else if (element > 0) {
  17565. allZeros = false;
  17566. }
  17567. }
  17568. if (isValid && !allZeros) {
  17569. this.dashArray = dashArray;
  17570. if (forceStyle) {
  17571. this.setStyle(_primitives.Name.get("D"));
  17572. }
  17573. } else {
  17574. this.width = 0;
  17575. }
  17576. } else if (dashArray) {
  17577. this.width = 0;
  17578. }
  17579. }
  17580. setHorizontalCornerRadius(radius) {
  17581. if (Number.isInteger(radius)) {
  17582. this.horizontalCornerRadius = radius;
  17583. }
  17584. }
  17585. setVerticalCornerRadius(radius) {
  17586. if (Number.isInteger(radius)) {
  17587. this.verticalCornerRadius = radius;
  17588. }
  17589. }
  17590. }
  17591. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  17592. class MarkupAnnotation extends Annotation {
  17593. constructor(parameters) {
  17594. super(parameters);
  17595. const dict = parameters.dict;
  17596. if (dict.has("IRT")) {
  17597. const rawIRT = dict.getRaw("IRT");
  17598. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  17599. const rt = dict.get("RT");
  17600. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  17601. }
  17602. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  17603. const parent = dict.get("IRT");
  17604. this.setTitle(parent.get("T"));
  17605. this.data.titleObj = this._title;
  17606. this.setContents(parent.get("Contents"));
  17607. this.data.contentsObj = this._contents;
  17608. if (!parent.has("CreationDate")) {
  17609. this.data.creationDate = null;
  17610. } else {
  17611. this.setCreationDate(parent.get("CreationDate"));
  17612. this.data.creationDate = this.creationDate;
  17613. }
  17614. if (!parent.has("M")) {
  17615. this.data.modificationDate = null;
  17616. } else {
  17617. this.setModificationDate(parent.get("M"));
  17618. this.data.modificationDate = this.modificationDate;
  17619. }
  17620. this.data.hasPopup = parent.has("Popup");
  17621. if (!parent.has("C")) {
  17622. this.data.color = null;
  17623. } else {
  17624. this.setColor(parent.getArray("C"));
  17625. this.data.color = this.color;
  17626. }
  17627. } else {
  17628. this.data.titleObj = this._title;
  17629. this.setCreationDate(dict.get("CreationDate"));
  17630. this.data.creationDate = this.creationDate;
  17631. this.data.hasPopup = dict.has("Popup");
  17632. if (!dict.has("C")) {
  17633. this.data.color = null;
  17634. }
  17635. }
  17636. if (dict.has("RC")) {
  17637. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  17638. }
  17639. }
  17640. setCreationDate(creationDate) {
  17641. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  17642. }
  17643. _setDefaultAppearance({
  17644. xref,
  17645. extra,
  17646. strokeColor,
  17647. fillColor,
  17648. blendMode,
  17649. strokeAlpha,
  17650. fillAlpha,
  17651. pointsCallback
  17652. }) {
  17653. let minX = Number.MAX_VALUE;
  17654. let minY = Number.MAX_VALUE;
  17655. let maxX = Number.MIN_VALUE;
  17656. let maxY = Number.MIN_VALUE;
  17657. const buffer = ["q"];
  17658. if (extra) {
  17659. buffer.push(extra);
  17660. }
  17661. if (strokeColor) {
  17662. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  17663. }
  17664. if (fillColor) {
  17665. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  17666. }
  17667. let pointsArray = this.data.quadPoints;
  17668. if (!pointsArray) {
  17669. pointsArray = [[{
  17670. x: this.rectangle[0],
  17671. y: this.rectangle[3]
  17672. }, {
  17673. x: this.rectangle[2],
  17674. y: this.rectangle[3]
  17675. }, {
  17676. x: this.rectangle[0],
  17677. y: this.rectangle[1]
  17678. }, {
  17679. x: this.rectangle[2],
  17680. y: this.rectangle[1]
  17681. }]];
  17682. }
  17683. for (const points of pointsArray) {
  17684. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  17685. minX = Math.min(minX, mX);
  17686. maxX = Math.max(maxX, MX);
  17687. minY = Math.min(minY, mY);
  17688. maxY = Math.max(maxY, MY);
  17689. }
  17690. buffer.push("Q");
  17691. const formDict = new _primitives.Dict(xref);
  17692. const appearanceStreamDict = new _primitives.Dict(xref);
  17693. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  17694. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  17695. appearanceStream.dict = appearanceStreamDict;
  17696. formDict.set("Fm0", appearanceStream);
  17697. const gsDict = new _primitives.Dict(xref);
  17698. if (blendMode) {
  17699. gsDict.set("BM", _primitives.Name.get(blendMode));
  17700. }
  17701. if (typeof strokeAlpha === "number") {
  17702. gsDict.set("CA", strokeAlpha);
  17703. }
  17704. if (typeof fillAlpha === "number") {
  17705. gsDict.set("ca", fillAlpha);
  17706. }
  17707. const stateDict = new _primitives.Dict(xref);
  17708. stateDict.set("GS0", gsDict);
  17709. const resources = new _primitives.Dict(xref);
  17710. resources.set("ExtGState", stateDict);
  17711. resources.set("XObject", formDict);
  17712. const appearanceDict = new _primitives.Dict(xref);
  17713. appearanceDict.set("Resources", resources);
  17714. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  17715. appearanceDict.set("BBox", bbox);
  17716. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  17717. this.appearance.dict = appearanceDict;
  17718. this._streams.push(this.appearance, appearanceStream);
  17719. }
  17720. }
  17721. exports.MarkupAnnotation = MarkupAnnotation;
  17722. class WidgetAnnotation extends Annotation {
  17723. constructor(params) {
  17724. super(params);
  17725. const dict = params.dict;
  17726. const data = this.data;
  17727. this.ref = params.ref;
  17728. data.annotationType = _util.AnnotationType.WIDGET;
  17729. if (data.fieldName === undefined) {
  17730. data.fieldName = this._constructFieldName(dict);
  17731. }
  17732. if (data.actions === undefined) {
  17733. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17734. }
  17735. const fieldValue = (0, _core_utils.getInheritableProperty)({
  17736. dict,
  17737. key: "V",
  17738. getArray: true
  17739. });
  17740. data.fieldValue = this._decodeFormValue(fieldValue);
  17741. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  17742. dict,
  17743. key: "DV",
  17744. getArray: true
  17745. });
  17746. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  17747. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  17748. data.fieldValue = data.defaultFieldValue;
  17749. }
  17750. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  17751. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  17752. dict,
  17753. key: "DA"
  17754. }) || params.acroForm.get("DA");
  17755. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  17756. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  17757. const fieldType = (0, _core_utils.getInheritableProperty)({
  17758. dict,
  17759. key: "FT"
  17760. });
  17761. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17762. const localResources = (0, _core_utils.getInheritableProperty)({
  17763. dict,
  17764. key: "DR"
  17765. });
  17766. const acroFormResources = params.acroForm.get("DR");
  17767. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  17768. this._fieldResources = {
  17769. localResources,
  17770. acroFormResources,
  17771. appearanceResources,
  17772. mergedResources: _primitives.Dict.merge({
  17773. xref: params.xref,
  17774. dictArray: [localResources, appearanceResources, acroFormResources],
  17775. mergeSubDicts: true
  17776. })
  17777. };
  17778. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  17779. dict,
  17780. key: "Ff"
  17781. });
  17782. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  17783. data.fieldFlags = 0;
  17784. }
  17785. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  17786. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  17787. }
  17788. _decodeFormValue(formValue) {
  17789. if (Array.isArray(formValue)) {
  17790. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  17791. } else if (formValue instanceof _primitives.Name) {
  17792. return (0, _util.stringToPDFString)(formValue.name);
  17793. } else if (typeof formValue === "string") {
  17794. return (0, _util.stringToPDFString)(formValue);
  17795. }
  17796. return null;
  17797. }
  17798. hasFieldFlag(flag) {
  17799. return !!(this.data.fieldFlags & flag);
  17800. }
  17801. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17802. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  17803. return Promise.resolve(new _operator_list.OperatorList());
  17804. }
  17805. if (!this._hasText) {
  17806. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17807. }
  17808. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  17809. if (this.appearance && content === null) {
  17810. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17811. }
  17812. const operatorList = new _operator_list.OperatorList();
  17813. if (!this._defaultAppearance || content === null) {
  17814. return operatorList;
  17815. }
  17816. const matrix = [1, 0, 0, 1, 0, 0];
  17817. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17818. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  17819. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]);
  17820. const stream = new _stream.StringStream(content);
  17821. return evaluator.getOperatorList({
  17822. stream,
  17823. task,
  17824. resources: this._fieldResources.mergedResources,
  17825. operatorList
  17826. }).then(function () {
  17827. operatorList.addOp(_util.OPS.endAnnotation, []);
  17828. return operatorList;
  17829. });
  17830. });
  17831. }
  17832. async save(evaluator, task, annotationStorage) {
  17833. if (!annotationStorage) {
  17834. return null;
  17835. }
  17836. const storageEntry = annotationStorage.get(this.data.id);
  17837. const value = storageEntry && storageEntry.value;
  17838. if (value === this.data.fieldValue || value === undefined) {
  17839. return null;
  17840. }
  17841. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  17842. if (appearance === null) {
  17843. return null;
  17844. }
  17845. const {
  17846. xref
  17847. } = evaluator;
  17848. const dict = xref.fetchIfRef(this.ref);
  17849. if (!(dict instanceof _primitives.Dict)) {
  17850. return null;
  17851. }
  17852. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17853. const xfa = {
  17854. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17855. value
  17856. };
  17857. const newRef = xref.getNewRef();
  17858. const AP = new _primitives.Dict(xref);
  17859. AP.set("N", newRef);
  17860. const encrypt = xref.encrypt;
  17861. let originalTransform = null;
  17862. let newTransform = null;
  17863. if (encrypt) {
  17864. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17865. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  17866. appearance = newTransform.encryptString(appearance);
  17867. }
  17868. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  17869. dict.set("AP", AP);
  17870. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17871. const appearanceDict = new _primitives.Dict(xref);
  17872. appearanceDict.set("Length", appearance.length);
  17873. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  17874. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  17875. appearanceDict.set("BBox", bbox);
  17876. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17877. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  17878. bufferOriginal.push("\nendobj\n");
  17879. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  17880. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  17881. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  17882. return [{
  17883. ref: this.ref,
  17884. data: bufferOriginal.join(""),
  17885. xfa
  17886. }, {
  17887. ref: newRef,
  17888. data: bufferNew.join(""),
  17889. xfa: null
  17890. }];
  17891. }
  17892. async _getAppearance(evaluator, task, annotationStorage) {
  17893. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  17894. if (!annotationStorage || isPassword) {
  17895. return null;
  17896. }
  17897. const storageEntry = annotationStorage.get(this.data.id);
  17898. let value = storageEntry && storageEntry.value;
  17899. if (value === undefined) {
  17900. return null;
  17901. }
  17902. value = value.trim();
  17903. if (value === "") {
  17904. return "";
  17905. }
  17906. let lineCount = -1;
  17907. if (this.data.multiLine) {
  17908. lineCount = value.split(/\r\n|\r|\n/).length;
  17909. }
  17910. const defaultPadding = 2;
  17911. const hPadding = defaultPadding;
  17912. const totalHeight = this.data.rect[3] - this.data.rect[1];
  17913. const totalWidth = this.data.rect[2] - this.data.rect[0];
  17914. if (!this._defaultAppearance) {
  17915. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  17916. }
  17917. const font = await this._getFontData(evaluator, task);
  17918. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  17919. let descent = font.descent;
  17920. if (isNaN(descent)) {
  17921. descent = 0;
  17922. }
  17923. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  17924. const alignment = this.data.textAlignment;
  17925. if (this.data.multiLine) {
  17926. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  17927. }
  17928. const encodedString = font.encodeString(value).join("");
  17929. if (this.data.comb) {
  17930. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  17931. }
  17932. if (alignment === 0 || alignment > 2) {
  17933. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  17934. }
  17935. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  17936. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  17937. }
  17938. async _getFontData(evaluator, task) {
  17939. const operatorList = new _operator_list.OperatorList();
  17940. const initialState = {
  17941. font: null,
  17942. clone() {
  17943. return this;
  17944. }
  17945. };
  17946. const {
  17947. fontName,
  17948. fontSize
  17949. } = this.data.defaultAppearanceData;
  17950. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  17951. return initialState.font;
  17952. }
  17953. _getTextWidth(text, font) {
  17954. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  17955. }
  17956. _computeFontSize(height, width, text, font, lineCount) {
  17957. let {
  17958. fontSize
  17959. } = this.data.defaultAppearanceData;
  17960. if (!fontSize) {
  17961. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  17962. const LINE_FACTOR = 1.35;
  17963. if (lineCount === -1) {
  17964. const textWidth = this._getTextWidth(text, font);
  17965. fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth));
  17966. } else {
  17967. const lines = text.split(/\r\n?|\n/);
  17968. const cachedLines = [];
  17969. for (const line of lines) {
  17970. const encoded = font.encodeString(line).join("");
  17971. const glyphs = font.charsToGlyphs(encoded);
  17972. const positions = font.getCharPositions(encoded);
  17973. cachedLines.push({
  17974. line: encoded,
  17975. glyphs,
  17976. positions
  17977. });
  17978. }
  17979. const isTooBig = fsize => {
  17980. let totalHeight = 0;
  17981. for (const cache of cachedLines) {
  17982. const chunks = this._splitLine(null, font, fsize, width, cache);
  17983. totalHeight += chunks.length * fsize;
  17984. if (totalHeight > height) {
  17985. return true;
  17986. }
  17987. }
  17988. return false;
  17989. };
  17990. fontSize = 12;
  17991. let lineHeight = fontSize * LINE_FACTOR;
  17992. let numberOfLines = Math.round(height / lineHeight);
  17993. numberOfLines = Math.max(numberOfLines, lineCount);
  17994. while (true) {
  17995. lineHeight = height / numberOfLines;
  17996. fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR);
  17997. if (isTooBig(fontSize)) {
  17998. numberOfLines++;
  17999. continue;
  18000. }
  18001. break;
  18002. }
  18003. }
  18004. const {
  18005. fontName,
  18006. fontColor
  18007. } = this.data.defaultAppearanceData;
  18008. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  18009. fontSize,
  18010. fontName,
  18011. fontColor
  18012. });
  18013. }
  18014. return [this._defaultAppearance, fontSize];
  18015. }
  18016. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  18017. const width = this._getTextWidth(text, font) * fontSize;
  18018. let shift;
  18019. if (alignment === 1) {
  18020. shift = (totalWidth - width) / 2;
  18021. } else if (alignment === 2) {
  18022. shift = totalWidth - width - hPadding;
  18023. } else {
  18024. shift = hPadding;
  18025. }
  18026. shift = shift.toFixed(2);
  18027. vPadding = vPadding.toFixed(2);
  18028. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  18029. }
  18030. _getSaveFieldResources(xref) {
  18031. const {
  18032. localResources,
  18033. appearanceResources,
  18034. acroFormResources
  18035. } = this._fieldResources;
  18036. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  18037. if (!fontName) {
  18038. return localResources || _primitives.Dict.empty;
  18039. }
  18040. for (const resources of [localResources, appearanceResources]) {
  18041. if (resources instanceof _primitives.Dict) {
  18042. const localFont = resources.get("Font");
  18043. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  18044. return resources;
  18045. }
  18046. }
  18047. }
  18048. if (acroFormResources instanceof _primitives.Dict) {
  18049. const acroFormFont = acroFormResources.get("Font");
  18050. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  18051. const subFontDict = new _primitives.Dict(xref);
  18052. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  18053. const subResourcesDict = new _primitives.Dict(xref);
  18054. subResourcesDict.set("Font", subFontDict);
  18055. return _primitives.Dict.merge({
  18056. xref,
  18057. dictArray: [subResourcesDict, localResources],
  18058. mergeSubDicts: true
  18059. });
  18060. }
  18061. }
  18062. return localResources || _primitives.Dict.empty;
  18063. }
  18064. getFieldObject() {
  18065. return null;
  18066. }
  18067. }
  18068. class TextWidgetAnnotation extends WidgetAnnotation {
  18069. constructor(params) {
  18070. super(params);
  18071. this._hasText = true;
  18072. const dict = params.dict;
  18073. if (typeof this.data.fieldValue !== "string") {
  18074. this.data.fieldValue = "";
  18075. }
  18076. let alignment = (0, _core_utils.getInheritableProperty)({
  18077. dict,
  18078. key: "Q"
  18079. });
  18080. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  18081. alignment = null;
  18082. }
  18083. this.data.textAlignment = alignment;
  18084. let maximumLength = (0, _core_utils.getInheritableProperty)({
  18085. dict,
  18086. key: "MaxLen"
  18087. });
  18088. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  18089. maximumLength = null;
  18090. }
  18091. this.data.maxLen = maximumLength;
  18092. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  18093. 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 !== null;
  18094. }
  18095. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  18096. const combWidth = (width / this.data.maxLen).toFixed(2);
  18097. const buf = [];
  18098. const positions = font.getCharPositions(text);
  18099. for (const [start, end] of positions) {
  18100. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  18101. }
  18102. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  18103. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  18104. }
  18105. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  18106. const lines = text.split(/\r\n?|\n/);
  18107. const buf = [];
  18108. const totalWidth = width - 2 * hPadding;
  18109. for (const line of lines) {
  18110. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  18111. for (const chunk of chunks) {
  18112. const padding = buf.length === 0 ? hPadding : 0;
  18113. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  18114. }
  18115. }
  18116. const renderedText = buf.join("\n");
  18117. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  18118. }
  18119. _splitLine(line, font, fontSize, width, cache = {}) {
  18120. line = cache.line || font.encodeString(line).join("");
  18121. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  18122. if (glyphs.length <= 1) {
  18123. return [line];
  18124. }
  18125. const positions = cache.positions || font.getCharPositions(line);
  18126. const scale = fontSize / 1000;
  18127. const chunks = [];
  18128. let lastSpacePosInStringStart = -1,
  18129. lastSpacePosInStringEnd = -1,
  18130. lastSpacePos = -1,
  18131. startChunk = 0,
  18132. currentWidth = 0;
  18133. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  18134. const [start, end] = positions[i];
  18135. const glyph = glyphs[i];
  18136. const glyphWidth = glyph.width * scale;
  18137. if (glyph.unicode === " ") {
  18138. if (currentWidth + glyphWidth > width) {
  18139. chunks.push(line.substring(startChunk, start));
  18140. startChunk = start;
  18141. currentWidth = glyphWidth;
  18142. lastSpacePosInStringStart = -1;
  18143. lastSpacePos = -1;
  18144. } else {
  18145. currentWidth += glyphWidth;
  18146. lastSpacePosInStringStart = start;
  18147. lastSpacePosInStringEnd = end;
  18148. lastSpacePos = i;
  18149. }
  18150. } else {
  18151. if (currentWidth + glyphWidth > width) {
  18152. if (lastSpacePosInStringStart !== -1) {
  18153. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  18154. startChunk = lastSpacePosInStringEnd;
  18155. i = lastSpacePos + 1;
  18156. lastSpacePosInStringStart = -1;
  18157. currentWidth = 0;
  18158. } else {
  18159. chunks.push(line.substring(startChunk, start));
  18160. startChunk = start;
  18161. currentWidth = glyphWidth;
  18162. }
  18163. } else {
  18164. currentWidth += glyphWidth;
  18165. }
  18166. }
  18167. }
  18168. if (startChunk < line.length) {
  18169. chunks.push(line.substring(startChunk, line.length));
  18170. }
  18171. return chunks;
  18172. }
  18173. getFieldObject() {
  18174. return {
  18175. id: this.data.id,
  18176. value: this.data.fieldValue,
  18177. defaultValue: this.data.defaultFieldValue,
  18178. multiline: this.data.multiLine,
  18179. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  18180. charLimit: this.data.maxLen,
  18181. comb: this.data.comb,
  18182. editable: !this.data.readOnly,
  18183. hidden: this.data.hidden,
  18184. name: this.data.fieldName,
  18185. rect: this.data.rect,
  18186. actions: this.data.actions,
  18187. page: this.data.pageIndex,
  18188. strokeColor: this.data.borderColor,
  18189. fillColor: this.data.backgroundColor,
  18190. type: "text"
  18191. };
  18192. }
  18193. }
  18194. class ButtonWidgetAnnotation extends WidgetAnnotation {
  18195. constructor(params) {
  18196. super(params);
  18197. this.checkedAppearance = null;
  18198. this.uncheckedAppearance = null;
  18199. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18200. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18201. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18202. this.data.isTooltipOnly = false;
  18203. if (this.data.checkBox) {
  18204. this._processCheckBox(params);
  18205. } else if (this.data.radioButton) {
  18206. this._processRadioButton(params);
  18207. } else if (this.data.pushButton) {
  18208. this.data.hasOwnCanvas = true;
  18209. this._processPushButton(params);
  18210. } else {
  18211. (0, _util.warn)("Invalid field flags for button widget annotation");
  18212. }
  18213. }
  18214. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  18215. if (this.data.pushButton) {
  18216. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  18217. }
  18218. let value = null;
  18219. if (annotationStorage) {
  18220. const storageEntry = annotationStorage.get(this.data.id);
  18221. value = storageEntry ? storageEntry.value : null;
  18222. }
  18223. if (value === null) {
  18224. if (this.appearance) {
  18225. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18226. }
  18227. if (this.data.checkBox) {
  18228. value = this.data.fieldValue === this.data.exportValue;
  18229. } else {
  18230. value = this.data.fieldValue === this.data.buttonValue;
  18231. }
  18232. }
  18233. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  18234. if (appearance) {
  18235. const savedAppearance = this.appearance;
  18236. this.appearance = appearance;
  18237. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18238. this.appearance = savedAppearance;
  18239. return operatorList;
  18240. }
  18241. return new _operator_list.OperatorList();
  18242. }
  18243. async save(evaluator, task, annotationStorage) {
  18244. if (this.data.checkBox) {
  18245. return this._saveCheckbox(evaluator, task, annotationStorage);
  18246. }
  18247. if (this.data.radioButton) {
  18248. return this._saveRadioButton(evaluator, task, annotationStorage);
  18249. }
  18250. return null;
  18251. }
  18252. async _saveCheckbox(evaluator, task, annotationStorage) {
  18253. if (!annotationStorage) {
  18254. return null;
  18255. }
  18256. const storageEntry = annotationStorage.get(this.data.id);
  18257. const value = storageEntry && storageEntry.value;
  18258. if (value === undefined) {
  18259. return null;
  18260. }
  18261. const defaultValue = this.data.fieldValue === this.data.exportValue;
  18262. if (defaultValue === value) {
  18263. return null;
  18264. }
  18265. const dict = evaluator.xref.fetchIfRef(this.ref);
  18266. if (!(dict instanceof _primitives.Dict)) {
  18267. return null;
  18268. }
  18269. const xfa = {
  18270. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18271. value: value ? this.data.exportValue : ""
  18272. };
  18273. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  18274. dict.set("V", name);
  18275. dict.set("AS", name);
  18276. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18277. const encrypt = evaluator.xref.encrypt;
  18278. let originalTransform = null;
  18279. if (encrypt) {
  18280. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18281. }
  18282. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18283. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18284. buffer.push("\nendobj\n");
  18285. return [{
  18286. ref: this.ref,
  18287. data: buffer.join(""),
  18288. xfa
  18289. }];
  18290. }
  18291. async _saveRadioButton(evaluator, task, annotationStorage) {
  18292. if (!annotationStorage) {
  18293. return null;
  18294. }
  18295. const storageEntry = annotationStorage.get(this.data.id);
  18296. const value = storageEntry && storageEntry.value;
  18297. if (value === undefined) {
  18298. return null;
  18299. }
  18300. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  18301. if (defaultValue === value) {
  18302. return null;
  18303. }
  18304. const dict = evaluator.xref.fetchIfRef(this.ref);
  18305. if (!(dict instanceof _primitives.Dict)) {
  18306. return null;
  18307. }
  18308. const xfa = {
  18309. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18310. value: value ? this.data.buttonValue : ""
  18311. };
  18312. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  18313. let parentBuffer = null;
  18314. const encrypt = evaluator.xref.encrypt;
  18315. if (value) {
  18316. if (this.parent instanceof _primitives.Ref) {
  18317. const parent = evaluator.xref.fetch(this.parent);
  18318. let parentTransform = null;
  18319. if (encrypt) {
  18320. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  18321. }
  18322. parent.set("V", name);
  18323. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  18324. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  18325. parentBuffer.push("\nendobj\n");
  18326. } else if (this.parent instanceof _primitives.Dict) {
  18327. this.parent.set("V", name);
  18328. }
  18329. }
  18330. dict.set("AS", name);
  18331. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18332. let originalTransform = null;
  18333. if (encrypt) {
  18334. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18335. }
  18336. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18337. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18338. buffer.push("\nendobj\n");
  18339. const newRefs = [{
  18340. ref: this.ref,
  18341. data: buffer.join(""),
  18342. xfa
  18343. }];
  18344. if (parentBuffer !== null) {
  18345. newRefs.push({
  18346. ref: this.parent,
  18347. data: parentBuffer.join(""),
  18348. xfa: null
  18349. });
  18350. }
  18351. return newRefs;
  18352. }
  18353. _getDefaultCheckedAppearance(params, type) {
  18354. const width = this.data.rect[2] - this.data.rect[0];
  18355. const height = this.data.rect[3] - this.data.rect[1];
  18356. const bbox = [0, 0, width, height];
  18357. const FONT_RATIO = 0.8;
  18358. const fontSize = Math.min(width, height) * FONT_RATIO;
  18359. let metrics, char;
  18360. if (type === "check") {
  18361. metrics = {
  18362. width: 0.755 * fontSize,
  18363. height: 0.705 * fontSize
  18364. };
  18365. char = "\x33";
  18366. } else if (type === "disc") {
  18367. metrics = {
  18368. width: 0.791 * fontSize,
  18369. height: 0.705 * fontSize
  18370. };
  18371. char = "\x6C";
  18372. } else {
  18373. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  18374. }
  18375. const xShift = (width - metrics.width) / 2;
  18376. const yShift = (height - metrics.height) / 2;
  18377. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  18378. const appearanceStreamDict = new _primitives.Dict(params.xref);
  18379. appearanceStreamDict.set("FormType", 1);
  18380. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  18381. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  18382. appearanceStreamDict.set("BBox", bbox);
  18383. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  18384. appearanceStreamDict.set("Length", appearance.length);
  18385. const resources = new _primitives.Dict(params.xref);
  18386. const font = new _primitives.Dict(params.xref);
  18387. font.set("PdfJsZaDb", this.fallbackFontDict);
  18388. resources.set("Font", font);
  18389. appearanceStreamDict.set("Resources", resources);
  18390. this.checkedAppearance = new _stream.StringStream(appearance);
  18391. this.checkedAppearance.dict = appearanceStreamDict;
  18392. this._streams.push(this.checkedAppearance);
  18393. }
  18394. _processCheckBox(params) {
  18395. const customAppearance = params.dict.get("AP");
  18396. if (!(customAppearance instanceof _primitives.Dict)) {
  18397. return;
  18398. }
  18399. const normalAppearance = customAppearance.get("N");
  18400. if (!(normalAppearance instanceof _primitives.Dict)) {
  18401. return;
  18402. }
  18403. const asValue = this._decodeFormValue(params.dict.get("AS"));
  18404. if (typeof asValue === "string") {
  18405. this.data.fieldValue = asValue;
  18406. }
  18407. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  18408. const exportValues = normalAppearance.getKeys();
  18409. if (exportValues.length === 0) {
  18410. exportValues.push("Off", yes);
  18411. } else if (exportValues.length === 1) {
  18412. if (exportValues[0] === "Off") {
  18413. exportValues.push(yes);
  18414. } else {
  18415. exportValues.unshift("Off");
  18416. }
  18417. } else if (exportValues.includes(yes)) {
  18418. exportValues.length = 0;
  18419. exportValues.push("Off", yes);
  18420. } else {
  18421. const otherYes = exportValues.find(v => v !== "Off");
  18422. exportValues.length = 0;
  18423. exportValues.push("Off", otherYes);
  18424. }
  18425. if (!exportValues.includes(this.data.fieldValue)) {
  18426. this.data.fieldValue = "Off";
  18427. }
  18428. this.data.exportValue = exportValues[1];
  18429. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  18430. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18431. if (this.checkedAppearance) {
  18432. this._streams.push(this.checkedAppearance);
  18433. } else {
  18434. this._getDefaultCheckedAppearance(params, "check");
  18435. }
  18436. if (this.uncheckedAppearance) {
  18437. this._streams.push(this.uncheckedAppearance);
  18438. }
  18439. this._fallbackFontDict = this.fallbackFontDict;
  18440. }
  18441. _processRadioButton(params) {
  18442. this.data.fieldValue = this.data.buttonValue = null;
  18443. const fieldParent = params.dict.get("Parent");
  18444. if (fieldParent instanceof _primitives.Dict) {
  18445. this.parent = params.dict.getRaw("Parent");
  18446. const fieldParentValue = fieldParent.get("V");
  18447. if (fieldParentValue instanceof _primitives.Name) {
  18448. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  18449. }
  18450. }
  18451. const appearanceStates = params.dict.get("AP");
  18452. if (!(appearanceStates instanceof _primitives.Dict)) {
  18453. return;
  18454. }
  18455. const normalAppearance = appearanceStates.get("N");
  18456. if (!(normalAppearance instanceof _primitives.Dict)) {
  18457. return;
  18458. }
  18459. for (const key of normalAppearance.getKeys()) {
  18460. if (key !== "Off") {
  18461. this.data.buttonValue = this._decodeFormValue(key);
  18462. break;
  18463. }
  18464. }
  18465. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  18466. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18467. if (this.checkedAppearance) {
  18468. this._streams.push(this.checkedAppearance);
  18469. } else {
  18470. this._getDefaultCheckedAppearance(params, "disc");
  18471. }
  18472. if (this.uncheckedAppearance) {
  18473. this._streams.push(this.uncheckedAppearance);
  18474. }
  18475. this._fallbackFontDict = this.fallbackFontDict;
  18476. }
  18477. _processPushButton(params) {
  18478. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  18479. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  18480. return;
  18481. }
  18482. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  18483. _catalog.Catalog.parseDestDictionary({
  18484. destDict: params.dict,
  18485. resultObj: this.data,
  18486. docBaseUrl: params.pdfManager.docBaseUrl
  18487. });
  18488. }
  18489. getFieldObject() {
  18490. let type = "button";
  18491. let exportValues;
  18492. if (this.data.checkBox) {
  18493. type = "checkbox";
  18494. exportValues = this.data.exportValue;
  18495. } else if (this.data.radioButton) {
  18496. type = "radiobutton";
  18497. exportValues = this.data.buttonValue;
  18498. }
  18499. return {
  18500. id: this.data.id,
  18501. value: this.data.fieldValue || "Off",
  18502. defaultValue: this.data.defaultFieldValue,
  18503. exportValues,
  18504. editable: !this.data.readOnly,
  18505. name: this.data.fieldName,
  18506. rect: this.data.rect,
  18507. hidden: this.data.hidden,
  18508. actions: this.data.actions,
  18509. page: this.data.pageIndex,
  18510. strokeColor: this.data.borderColor,
  18511. fillColor: this.data.backgroundColor,
  18512. type
  18513. };
  18514. }
  18515. get fallbackFontDict() {
  18516. const dict = new _primitives.Dict();
  18517. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  18518. dict.set("Type", _primitives.Name.get("FallbackType"));
  18519. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18520. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  18521. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  18522. }
  18523. }
  18524. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  18525. constructor(params) {
  18526. super(params);
  18527. this.data.options = [];
  18528. const options = (0, _core_utils.getInheritableProperty)({
  18529. dict: params.dict,
  18530. key: "Opt"
  18531. });
  18532. if (Array.isArray(options)) {
  18533. const xref = params.xref;
  18534. for (let i = 0, ii = options.length; i < ii; i++) {
  18535. const option = xref.fetchIfRef(options[i]);
  18536. const isOptionArray = Array.isArray(option);
  18537. this.data.options[i] = {
  18538. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  18539. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  18540. };
  18541. }
  18542. }
  18543. if (typeof this.data.fieldValue === "string") {
  18544. this.data.fieldValue = [this.data.fieldValue];
  18545. } else if (!this.data.fieldValue) {
  18546. this.data.fieldValue = [];
  18547. }
  18548. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  18549. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  18550. this._hasText = true;
  18551. }
  18552. getFieldObject() {
  18553. const type = this.data.combo ? "combobox" : "listbox";
  18554. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  18555. return {
  18556. id: this.data.id,
  18557. value,
  18558. defaultValue: this.data.defaultFieldValue,
  18559. editable: !this.data.readOnly,
  18560. name: this.data.fieldName,
  18561. rect: this.data.rect,
  18562. numItems: this.data.fieldValue.length,
  18563. multipleSelection: this.data.multiSelect,
  18564. hidden: this.data.hidden,
  18565. actions: this.data.actions,
  18566. items: this.data.options,
  18567. page: this.data.pageIndex,
  18568. strokeColor: this.data.borderColor,
  18569. fillColor: this.data.backgroundColor,
  18570. type
  18571. };
  18572. }
  18573. }
  18574. class SignatureWidgetAnnotation extends WidgetAnnotation {
  18575. constructor(params) {
  18576. super(params);
  18577. this.data.fieldValue = null;
  18578. }
  18579. getFieldObject() {
  18580. return {
  18581. id: this.data.id,
  18582. value: null,
  18583. page: this.data.pageIndex,
  18584. type: "signature"
  18585. };
  18586. }
  18587. }
  18588. class TextAnnotation extends MarkupAnnotation {
  18589. constructor(parameters) {
  18590. const DEFAULT_ICON_SIZE = 22;
  18591. super(parameters);
  18592. const dict = parameters.dict;
  18593. this.data.annotationType = _util.AnnotationType.TEXT;
  18594. if (this.data.hasAppearance) {
  18595. this.data.name = "NoIcon";
  18596. } else {
  18597. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  18598. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  18599. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  18600. }
  18601. if (dict.has("State")) {
  18602. this.data.state = dict.get("State") || null;
  18603. this.data.stateModel = dict.get("StateModel") || null;
  18604. } else {
  18605. this.data.state = null;
  18606. this.data.stateModel = null;
  18607. }
  18608. }
  18609. }
  18610. class LinkAnnotation extends Annotation {
  18611. constructor(params) {
  18612. super(params);
  18613. this.data.annotationType = _util.AnnotationType.LINK;
  18614. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  18615. if (quadPoints) {
  18616. this.data.quadPoints = quadPoints;
  18617. }
  18618. _catalog.Catalog.parseDestDictionary({
  18619. destDict: params.dict,
  18620. resultObj: this.data,
  18621. docBaseUrl: params.pdfManager.docBaseUrl
  18622. });
  18623. }
  18624. }
  18625. class PopupAnnotation extends Annotation {
  18626. constructor(parameters) {
  18627. super(parameters);
  18628. this.data.annotationType = _util.AnnotationType.POPUP;
  18629. let parentItem = parameters.dict.get("Parent");
  18630. if (!parentItem) {
  18631. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  18632. return;
  18633. }
  18634. const parentSubtype = parentItem.get("Subtype");
  18635. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  18636. const rawParent = parameters.dict.getRaw("Parent");
  18637. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  18638. const parentRect = parentItem.getArray("Rect");
  18639. if (Array.isArray(parentRect) && parentRect.length === 4) {
  18640. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  18641. } else {
  18642. this.data.parentRect = [0, 0, 0, 0];
  18643. }
  18644. const rt = parentItem.get("RT");
  18645. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  18646. parentItem = parentItem.get("IRT");
  18647. }
  18648. if (!parentItem.has("M")) {
  18649. this.data.modificationDate = null;
  18650. } else {
  18651. this.setModificationDate(parentItem.get("M"));
  18652. this.data.modificationDate = this.modificationDate;
  18653. }
  18654. if (!parentItem.has("C")) {
  18655. this.data.color = null;
  18656. } else {
  18657. this.setColor(parentItem.getArray("C"));
  18658. this.data.color = this.color;
  18659. }
  18660. if (!this.viewable) {
  18661. const parentFlags = parentItem.get("F");
  18662. if (this._isViewable(parentFlags)) {
  18663. this.setFlags(parentFlags);
  18664. }
  18665. }
  18666. this.setTitle(parentItem.get("T"));
  18667. this.data.titleObj = this._title;
  18668. this.setContents(parentItem.get("Contents"));
  18669. this.data.contentsObj = this._contents;
  18670. if (parentItem.has("RC")) {
  18671. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  18672. }
  18673. }
  18674. }
  18675. class FreeTextAnnotation extends MarkupAnnotation {
  18676. constructor(parameters) {
  18677. super(parameters);
  18678. this.data.annotationType = _util.AnnotationType.FREETEXT;
  18679. }
  18680. }
  18681. class LineAnnotation extends MarkupAnnotation {
  18682. constructor(parameters) {
  18683. super(parameters);
  18684. this.data.annotationType = _util.AnnotationType.LINE;
  18685. const lineCoordinates = parameters.dict.getArray("L");
  18686. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  18687. if (!this.appearance) {
  18688. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18689. const strokeAlpha = parameters.dict.get("CA");
  18690. let fillColor = null,
  18691. interiorColor = parameters.dict.getArray("IC");
  18692. if (interiorColor) {
  18693. interiorColor = getRgbColor(interiorColor, null);
  18694. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18695. }
  18696. const fillAlpha = fillColor ? strokeAlpha : null;
  18697. const borderWidth = this.borderStyle.width || 1,
  18698. borderAdjust = 2 * borderWidth;
  18699. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  18700. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18701. this.rectangle = bbox;
  18702. }
  18703. this._setDefaultAppearance({
  18704. xref: parameters.xref,
  18705. extra: `${borderWidth} w`,
  18706. strokeColor,
  18707. fillColor,
  18708. strokeAlpha,
  18709. fillAlpha,
  18710. pointsCallback: (buffer, points) => {
  18711. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  18712. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  18713. }
  18714. });
  18715. }
  18716. }
  18717. }
  18718. class SquareAnnotation extends MarkupAnnotation {
  18719. constructor(parameters) {
  18720. super(parameters);
  18721. this.data.annotationType = _util.AnnotationType.SQUARE;
  18722. if (!this.appearance) {
  18723. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18724. const strokeAlpha = parameters.dict.get("CA");
  18725. let fillColor = null,
  18726. interiorColor = parameters.dict.getArray("IC");
  18727. if (interiorColor) {
  18728. interiorColor = getRgbColor(interiorColor, null);
  18729. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18730. }
  18731. const fillAlpha = fillColor ? strokeAlpha : null;
  18732. if (this.borderStyle.width === 0 && !fillColor) {
  18733. return;
  18734. }
  18735. this._setDefaultAppearance({
  18736. xref: parameters.xref,
  18737. extra: `${this.borderStyle.width} w`,
  18738. strokeColor,
  18739. fillColor,
  18740. strokeAlpha,
  18741. fillAlpha,
  18742. pointsCallback: (buffer, points) => {
  18743. const x = points[2].x + this.borderStyle.width / 2;
  18744. const y = points[2].y + this.borderStyle.width / 2;
  18745. const width = points[3].x - points[2].x - this.borderStyle.width;
  18746. const height = points[1].y - points[3].y - this.borderStyle.width;
  18747. buffer.push(`${x} ${y} ${width} ${height} re`);
  18748. if (fillColor) {
  18749. buffer.push("B");
  18750. } else {
  18751. buffer.push("S");
  18752. }
  18753. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18754. }
  18755. });
  18756. }
  18757. }
  18758. }
  18759. class CircleAnnotation extends MarkupAnnotation {
  18760. constructor(parameters) {
  18761. super(parameters);
  18762. this.data.annotationType = _util.AnnotationType.CIRCLE;
  18763. if (!this.appearance) {
  18764. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18765. const strokeAlpha = parameters.dict.get("CA");
  18766. let fillColor = null;
  18767. let interiorColor = parameters.dict.getArray("IC");
  18768. if (interiorColor) {
  18769. interiorColor = getRgbColor(interiorColor, null);
  18770. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18771. }
  18772. const fillAlpha = fillColor ? strokeAlpha : null;
  18773. if (this.borderStyle.width === 0 && !fillColor) {
  18774. return;
  18775. }
  18776. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  18777. this._setDefaultAppearance({
  18778. xref: parameters.xref,
  18779. extra: `${this.borderStyle.width} w`,
  18780. strokeColor,
  18781. fillColor,
  18782. strokeAlpha,
  18783. fillAlpha,
  18784. pointsCallback: (buffer, points) => {
  18785. const x0 = points[0].x + this.borderStyle.width / 2;
  18786. const y0 = points[0].y - this.borderStyle.width / 2;
  18787. const x1 = points[3].x - this.borderStyle.width / 2;
  18788. const y1 = points[3].y + this.borderStyle.width / 2;
  18789. const xMid = x0 + (x1 - x0) / 2;
  18790. const yMid = y0 + (y1 - y0) / 2;
  18791. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  18792. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  18793. 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");
  18794. if (fillColor) {
  18795. buffer.push("B");
  18796. } else {
  18797. buffer.push("S");
  18798. }
  18799. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18800. }
  18801. });
  18802. }
  18803. }
  18804. }
  18805. class PolylineAnnotation extends MarkupAnnotation {
  18806. constructor(parameters) {
  18807. super(parameters);
  18808. this.data.annotationType = _util.AnnotationType.POLYLINE;
  18809. this.data.vertices = [];
  18810. const rawVertices = parameters.dict.getArray("Vertices");
  18811. if (!Array.isArray(rawVertices)) {
  18812. return;
  18813. }
  18814. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  18815. this.data.vertices.push({
  18816. x: rawVertices[i],
  18817. y: rawVertices[i + 1]
  18818. });
  18819. }
  18820. if (!this.appearance) {
  18821. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18822. const strokeAlpha = parameters.dict.get("CA");
  18823. const borderWidth = this.borderStyle.width || 1,
  18824. borderAdjust = 2 * borderWidth;
  18825. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  18826. for (const vertex of this.data.vertices) {
  18827. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  18828. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  18829. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  18830. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  18831. }
  18832. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18833. this.rectangle = bbox;
  18834. }
  18835. this._setDefaultAppearance({
  18836. xref: parameters.xref,
  18837. extra: `${borderWidth} w`,
  18838. strokeColor,
  18839. strokeAlpha,
  18840. pointsCallback: (buffer, points) => {
  18841. const vertices = this.data.vertices;
  18842. for (let i = 0, ii = vertices.length; i < ii; i++) {
  18843. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  18844. }
  18845. buffer.push("S");
  18846. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18847. }
  18848. });
  18849. }
  18850. }
  18851. }
  18852. class PolygonAnnotation extends PolylineAnnotation {
  18853. constructor(parameters) {
  18854. super(parameters);
  18855. this.data.annotationType = _util.AnnotationType.POLYGON;
  18856. }
  18857. }
  18858. class CaretAnnotation extends MarkupAnnotation {
  18859. constructor(parameters) {
  18860. super(parameters);
  18861. this.data.annotationType = _util.AnnotationType.CARET;
  18862. }
  18863. }
  18864. class InkAnnotation extends MarkupAnnotation {
  18865. constructor(parameters) {
  18866. super(parameters);
  18867. this.data.annotationType = _util.AnnotationType.INK;
  18868. this.data.inkLists = [];
  18869. const rawInkLists = parameters.dict.getArray("InkList");
  18870. if (!Array.isArray(rawInkLists)) {
  18871. return;
  18872. }
  18873. const xref = parameters.xref;
  18874. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  18875. this.data.inkLists.push([]);
  18876. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  18877. this.data.inkLists[i].push({
  18878. x: xref.fetchIfRef(rawInkLists[i][j]),
  18879. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  18880. });
  18881. }
  18882. }
  18883. if (!this.appearance) {
  18884. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18885. const strokeAlpha = parameters.dict.get("CA");
  18886. const borderWidth = this.borderStyle.width || 1,
  18887. borderAdjust = 2 * borderWidth;
  18888. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  18889. for (const inkLists of this.data.inkLists) {
  18890. for (const vertex of inkLists) {
  18891. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  18892. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  18893. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  18894. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  18895. }
  18896. }
  18897. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18898. this.rectangle = bbox;
  18899. }
  18900. this._setDefaultAppearance({
  18901. xref: parameters.xref,
  18902. extra: `${borderWidth} w`,
  18903. strokeColor,
  18904. strokeAlpha,
  18905. pointsCallback: (buffer, points) => {
  18906. for (const inkList of this.data.inkLists) {
  18907. for (let i = 0, ii = inkList.length; i < ii; i++) {
  18908. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  18909. }
  18910. buffer.push("S");
  18911. }
  18912. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18913. }
  18914. });
  18915. }
  18916. }
  18917. }
  18918. class HighlightAnnotation extends MarkupAnnotation {
  18919. constructor(parameters) {
  18920. super(parameters);
  18921. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  18922. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18923. if (quadPoints) {
  18924. const resources = this.appearance && this.appearance.dict.get("Resources");
  18925. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  18926. if (this.appearance) {
  18927. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  18928. }
  18929. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  18930. const fillAlpha = parameters.dict.get("CA");
  18931. this._setDefaultAppearance({
  18932. xref: parameters.xref,
  18933. fillColor,
  18934. blendMode: "Multiply",
  18935. fillAlpha,
  18936. pointsCallback: (buffer, points) => {
  18937. 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");
  18938. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18939. }
  18940. });
  18941. }
  18942. } else {
  18943. this.data.hasPopup = false;
  18944. }
  18945. }
  18946. }
  18947. class UnderlineAnnotation extends MarkupAnnotation {
  18948. constructor(parameters) {
  18949. super(parameters);
  18950. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  18951. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18952. if (quadPoints) {
  18953. if (!this.appearance) {
  18954. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18955. const strokeAlpha = parameters.dict.get("CA");
  18956. this._setDefaultAppearance({
  18957. xref: parameters.xref,
  18958. extra: "[] 0 d 1 w",
  18959. strokeColor,
  18960. strokeAlpha,
  18961. pointsCallback: (buffer, points) => {
  18962. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  18963. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18964. }
  18965. });
  18966. }
  18967. } else {
  18968. this.data.hasPopup = false;
  18969. }
  18970. }
  18971. }
  18972. class SquigglyAnnotation extends MarkupAnnotation {
  18973. constructor(parameters) {
  18974. super(parameters);
  18975. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  18976. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18977. if (quadPoints) {
  18978. if (!this.appearance) {
  18979. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18980. const strokeAlpha = parameters.dict.get("CA");
  18981. this._setDefaultAppearance({
  18982. xref: parameters.xref,
  18983. extra: "[] 0 d 1 w",
  18984. strokeColor,
  18985. strokeAlpha,
  18986. pointsCallback: (buffer, points) => {
  18987. const dy = (points[0].y - points[2].y) / 6;
  18988. let shift = dy;
  18989. let x = points[2].x;
  18990. const y = points[2].y;
  18991. const xEnd = points[3].x;
  18992. buffer.push(`${x} ${y + shift} m`);
  18993. do {
  18994. x += 2;
  18995. shift = shift === 0 ? dy : 0;
  18996. buffer.push(`${x} ${y + shift} l`);
  18997. } while (x < xEnd);
  18998. buffer.push("S");
  18999. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  19000. }
  19001. });
  19002. }
  19003. } else {
  19004. this.data.hasPopup = false;
  19005. }
  19006. }
  19007. }
  19008. class StrikeOutAnnotation extends MarkupAnnotation {
  19009. constructor(parameters) {
  19010. super(parameters);
  19011. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  19012. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19013. if (quadPoints) {
  19014. if (!this.appearance) {
  19015. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19016. const strokeAlpha = parameters.dict.get("CA");
  19017. this._setDefaultAppearance({
  19018. xref: parameters.xref,
  19019. extra: "[] 0 d 1 w",
  19020. strokeColor,
  19021. strokeAlpha,
  19022. pointsCallback: (buffer, points) => {
  19023. 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");
  19024. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19025. }
  19026. });
  19027. }
  19028. } else {
  19029. this.data.hasPopup = false;
  19030. }
  19031. }
  19032. }
  19033. class StampAnnotation extends MarkupAnnotation {
  19034. constructor(parameters) {
  19035. super(parameters);
  19036. this.data.annotationType = _util.AnnotationType.STAMP;
  19037. }
  19038. }
  19039. class FileAttachmentAnnotation extends MarkupAnnotation {
  19040. constructor(parameters) {
  19041. super(parameters);
  19042. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  19043. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  19044. this.data.file = file.serializable;
  19045. }
  19046. }
  19047. /***/ }),
  19048. /* 23 */
  19049. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19050. Object.defineProperty(exports, "__esModule", ({
  19051. value: true
  19052. }));
  19053. exports.createDefaultAppearance = createDefaultAppearance;
  19054. exports.parseDefaultAppearance = parseDefaultAppearance;
  19055. var _util = __w_pdfjs_require__(2);
  19056. var _colorspace = __w_pdfjs_require__(24);
  19057. var _core_utils = __w_pdfjs_require__(8);
  19058. var _evaluator = __w_pdfjs_require__(25);
  19059. var _primitives = __w_pdfjs_require__(5);
  19060. var _stream = __w_pdfjs_require__(10);
  19061. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  19062. constructor(str) {
  19063. super(new _stream.StringStream(str));
  19064. }
  19065. parse() {
  19066. const operation = {
  19067. fn: 0,
  19068. args: []
  19069. };
  19070. const result = {
  19071. fontSize: 0,
  19072. fontName: "",
  19073. fontColor: new Uint8ClampedArray(3)
  19074. };
  19075. try {
  19076. while (true) {
  19077. operation.args.length = 0;
  19078. if (!this.read(operation)) {
  19079. break;
  19080. }
  19081. if (this.savedStatesDepth !== 0) {
  19082. continue;
  19083. }
  19084. const {
  19085. fn,
  19086. args
  19087. } = operation;
  19088. switch (fn | 0) {
  19089. case _util.OPS.setFont:
  19090. const [fontName, fontSize] = args;
  19091. if (fontName instanceof _primitives.Name) {
  19092. result.fontName = fontName.name;
  19093. }
  19094. if (typeof fontSize === "number" && fontSize > 0) {
  19095. result.fontSize = fontSize;
  19096. }
  19097. break;
  19098. case _util.OPS.setFillRGBColor:
  19099. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  19100. break;
  19101. case _util.OPS.setFillGray:
  19102. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  19103. break;
  19104. case _util.OPS.setFillColorSpace:
  19105. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  19106. break;
  19107. }
  19108. }
  19109. } catch (reason) {
  19110. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  19111. }
  19112. return result;
  19113. }
  19114. }
  19115. function parseDefaultAppearance(str) {
  19116. return new DefaultAppearanceEvaluator(str).parse();
  19117. }
  19118. function createDefaultAppearance({
  19119. fontSize,
  19120. fontName,
  19121. fontColor
  19122. }) {
  19123. let colorCmd;
  19124. if (fontColor.every(c => c === 0)) {
  19125. colorCmd = "0 g";
  19126. } else {
  19127. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  19128. }
  19129. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  19130. }
  19131. /***/ }),
  19132. /* 24 */
  19133. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19134. Object.defineProperty(exports, "__esModule", ({
  19135. value: true
  19136. }));
  19137. exports.ColorSpace = void 0;
  19138. var _util = __w_pdfjs_require__(2);
  19139. var _primitives = __w_pdfjs_require__(5);
  19140. var _base_stream = __w_pdfjs_require__(9);
  19141. var _core_utils = __w_pdfjs_require__(8);
  19142. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  19143. const COMPONENTS = 3;
  19144. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  19145. const xRatio = w1 / w2;
  19146. const yRatio = h1 / h2;
  19147. let newIndex = 0,
  19148. oldIndex;
  19149. const xScaled = new Uint16Array(w2);
  19150. const w1Scanline = w1 * COMPONENTS;
  19151. for (let i = 0; i < w2; i++) {
  19152. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  19153. }
  19154. for (let i = 0; i < h2; i++) {
  19155. const py = Math.floor(i * yRatio) * w1Scanline;
  19156. for (let j = 0; j < w2; j++) {
  19157. oldIndex = py + xScaled[j];
  19158. dest[newIndex++] = src[oldIndex++];
  19159. dest[newIndex++] = src[oldIndex++];
  19160. dest[newIndex++] = src[oldIndex++];
  19161. newIndex += alpha01;
  19162. }
  19163. }
  19164. }
  19165. class ColorSpace {
  19166. constructor(name, numComps) {
  19167. if (this.constructor === ColorSpace) {
  19168. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  19169. }
  19170. this.name = name;
  19171. this.numComps = numComps;
  19172. }
  19173. getRgb(src, srcOffset) {
  19174. const rgb = new Uint8ClampedArray(3);
  19175. this.getRgbItem(src, srcOffset, rgb, 0);
  19176. return rgb;
  19177. }
  19178. getRgbItem(src, srcOffset, dest, destOffset) {
  19179. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  19180. }
  19181. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19182. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  19183. }
  19184. getOutputLength(inputLength, alpha01) {
  19185. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  19186. }
  19187. isPassthrough(bits) {
  19188. return false;
  19189. }
  19190. isDefaultDecode(decodeMap, bpc) {
  19191. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  19192. }
  19193. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  19194. const count = originalWidth * originalHeight;
  19195. let rgbBuf = null;
  19196. const numComponentColors = 1 << bpc;
  19197. const needsResizing = originalHeight !== height || originalWidth !== width;
  19198. if (this.isPassthrough(bpc)) {
  19199. rgbBuf = comps;
  19200. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  19201. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  19202. for (let i = 0; i < numComponentColors; i++) {
  19203. allColors[i] = i;
  19204. }
  19205. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  19206. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  19207. if (!needsResizing) {
  19208. let destPos = 0;
  19209. for (let i = 0; i < count; ++i) {
  19210. const key = comps[i] * 3;
  19211. dest[destPos++] = colorMap[key];
  19212. dest[destPos++] = colorMap[key + 1];
  19213. dest[destPos++] = colorMap[key + 2];
  19214. destPos += alpha01;
  19215. }
  19216. } else {
  19217. rgbBuf = new Uint8Array(count * 3);
  19218. let rgbPos = 0;
  19219. for (let i = 0; i < count; ++i) {
  19220. const key = comps[i] * 3;
  19221. rgbBuf[rgbPos++] = colorMap[key];
  19222. rgbBuf[rgbPos++] = colorMap[key + 1];
  19223. rgbBuf[rgbPos++] = colorMap[key + 2];
  19224. }
  19225. }
  19226. } else {
  19227. if (!needsResizing) {
  19228. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  19229. } else {
  19230. rgbBuf = new Uint8ClampedArray(count * 3);
  19231. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  19232. }
  19233. }
  19234. if (rgbBuf) {
  19235. if (needsResizing) {
  19236. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  19237. } else {
  19238. let destPos = 0,
  19239. rgbPos = 0;
  19240. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  19241. dest[destPos++] = rgbBuf[rgbPos++];
  19242. dest[destPos++] = rgbBuf[rgbPos++];
  19243. dest[destPos++] = rgbBuf[rgbPos++];
  19244. destPos += alpha01;
  19245. }
  19246. }
  19247. }
  19248. }
  19249. get usesZeroToOneRange() {
  19250. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  19251. }
  19252. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  19253. if (!localColorSpaceCache) {
  19254. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  19255. }
  19256. if (!parsedColorSpace) {
  19257. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  19258. }
  19259. let csName, csRef;
  19260. if (cacheKey instanceof _primitives.Ref) {
  19261. csRef = cacheKey;
  19262. cacheKey = xref.fetch(cacheKey);
  19263. }
  19264. if (cacheKey instanceof _primitives.Name) {
  19265. csName = cacheKey.name;
  19266. }
  19267. if (csName || csRef) {
  19268. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  19269. }
  19270. }
  19271. static getCached(cacheKey, xref, localColorSpaceCache) {
  19272. if (!localColorSpaceCache) {
  19273. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  19274. }
  19275. if (cacheKey instanceof _primitives.Ref) {
  19276. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  19277. if (localColorSpace) {
  19278. return localColorSpace;
  19279. }
  19280. try {
  19281. cacheKey = xref.fetch(cacheKey);
  19282. } catch (ex) {
  19283. if (ex instanceof _core_utils.MissingDataException) {
  19284. throw ex;
  19285. }
  19286. }
  19287. }
  19288. if (cacheKey instanceof _primitives.Name) {
  19289. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  19290. if (localColorSpace) {
  19291. return localColorSpace;
  19292. }
  19293. }
  19294. return null;
  19295. }
  19296. static async parseAsync({
  19297. cs,
  19298. xref,
  19299. resources = null,
  19300. pdfFunctionFactory,
  19301. localColorSpaceCache
  19302. }) {
  19303. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19304. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19305. return parsedColorSpace;
  19306. }
  19307. static parse({
  19308. cs,
  19309. xref,
  19310. resources = null,
  19311. pdfFunctionFactory,
  19312. localColorSpaceCache
  19313. }) {
  19314. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  19315. if (cachedColorSpace) {
  19316. return cachedColorSpace;
  19317. }
  19318. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19319. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19320. return parsedColorSpace;
  19321. }
  19322. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  19323. cs = xref.fetchIfRef(cs);
  19324. if (cs instanceof _primitives.Name) {
  19325. switch (cs.name) {
  19326. case "G":
  19327. case "DeviceGray":
  19328. return this.singletons.gray;
  19329. case "RGB":
  19330. case "DeviceRGB":
  19331. return this.singletons.rgb;
  19332. case "CMYK":
  19333. case "DeviceCMYK":
  19334. return this.singletons.cmyk;
  19335. case "Pattern":
  19336. return new PatternCS(null);
  19337. default:
  19338. if (resources instanceof _primitives.Dict) {
  19339. const colorSpaces = resources.get("ColorSpace");
  19340. if (colorSpaces instanceof _primitives.Dict) {
  19341. const resourcesCS = colorSpaces.get(cs.name);
  19342. if (resourcesCS) {
  19343. if (resourcesCS instanceof _primitives.Name) {
  19344. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  19345. }
  19346. cs = resourcesCS;
  19347. break;
  19348. }
  19349. }
  19350. }
  19351. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  19352. }
  19353. }
  19354. if (Array.isArray(cs)) {
  19355. const mode = xref.fetchIfRef(cs[0]).name;
  19356. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  19357. switch (mode) {
  19358. case "G":
  19359. case "DeviceGray":
  19360. return this.singletons.gray;
  19361. case "RGB":
  19362. case "DeviceRGB":
  19363. return this.singletons.rgb;
  19364. case "CMYK":
  19365. case "DeviceCMYK":
  19366. return this.singletons.cmyk;
  19367. case "CalGray":
  19368. params = xref.fetchIfRef(cs[1]);
  19369. whitePoint = params.getArray("WhitePoint");
  19370. blackPoint = params.getArray("BlackPoint");
  19371. gamma = params.get("Gamma");
  19372. return new CalGrayCS(whitePoint, blackPoint, gamma);
  19373. case "CalRGB":
  19374. params = xref.fetchIfRef(cs[1]);
  19375. whitePoint = params.getArray("WhitePoint");
  19376. blackPoint = params.getArray("BlackPoint");
  19377. gamma = params.getArray("Gamma");
  19378. const matrix = params.getArray("Matrix");
  19379. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  19380. case "ICCBased":
  19381. const stream = xref.fetchIfRef(cs[1]);
  19382. const dict = stream.dict;
  19383. numComps = dict.get("N");
  19384. const alt = dict.get("Alternate");
  19385. if (alt) {
  19386. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  19387. if (altCS.numComps === numComps) {
  19388. return altCS;
  19389. }
  19390. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  19391. }
  19392. if (numComps === 1) {
  19393. return this.singletons.gray;
  19394. } else if (numComps === 3) {
  19395. return this.singletons.rgb;
  19396. } else if (numComps === 4) {
  19397. return this.singletons.cmyk;
  19398. }
  19399. break;
  19400. case "Pattern":
  19401. baseCS = cs[1] || null;
  19402. if (baseCS) {
  19403. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  19404. }
  19405. return new PatternCS(baseCS);
  19406. case "I":
  19407. case "Indexed":
  19408. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  19409. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  19410. const lookup = xref.fetchIfRef(cs[3]);
  19411. return new IndexedCS(baseCS, hiVal, lookup);
  19412. case "Separation":
  19413. case "DeviceN":
  19414. const name = xref.fetchIfRef(cs[1]);
  19415. numComps = Array.isArray(name) ? name.length : 1;
  19416. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  19417. const tintFn = pdfFunctionFactory.create(cs[3]);
  19418. return new AlternateCS(numComps, baseCS, tintFn);
  19419. case "Lab":
  19420. params = xref.fetchIfRef(cs[1]);
  19421. whitePoint = params.getArray("WhitePoint");
  19422. blackPoint = params.getArray("BlackPoint");
  19423. const range = params.getArray("Range");
  19424. return new LabCS(whitePoint, blackPoint, range);
  19425. default:
  19426. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  19427. }
  19428. }
  19429. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  19430. }
  19431. static isDefaultDecode(decode, numComps) {
  19432. if (!Array.isArray(decode)) {
  19433. return true;
  19434. }
  19435. if (numComps * 2 !== decode.length) {
  19436. (0, _util.warn)("The decode map is not the correct length");
  19437. return true;
  19438. }
  19439. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  19440. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  19441. return false;
  19442. }
  19443. }
  19444. return true;
  19445. }
  19446. static get singletons() {
  19447. return (0, _util.shadow)(this, "singletons", {
  19448. get gray() {
  19449. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  19450. },
  19451. get rgb() {
  19452. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  19453. },
  19454. get cmyk() {
  19455. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  19456. }
  19457. });
  19458. }
  19459. }
  19460. exports.ColorSpace = ColorSpace;
  19461. class AlternateCS extends ColorSpace {
  19462. constructor(numComps, base, tintFn) {
  19463. super("Alternate", numComps);
  19464. this.base = base;
  19465. this.tintFn = tintFn;
  19466. this.tmpBuf = new Float32Array(base.numComps);
  19467. }
  19468. getRgbItem(src, srcOffset, dest, destOffset) {
  19469. const tmpBuf = this.tmpBuf;
  19470. this.tintFn(src, srcOffset, tmpBuf, 0);
  19471. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  19472. }
  19473. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19474. const tintFn = this.tintFn;
  19475. const base = this.base;
  19476. const scale = 1 / ((1 << bits) - 1);
  19477. const baseNumComps = base.numComps;
  19478. const usesZeroToOneRange = base.usesZeroToOneRange;
  19479. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  19480. let pos = isPassthrough ? destOffset : 0;
  19481. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  19482. const numComps = this.numComps;
  19483. const scaled = new Float32Array(numComps);
  19484. const tinted = new Float32Array(baseNumComps);
  19485. let i, j;
  19486. for (i = 0; i < count; i++) {
  19487. for (j = 0; j < numComps; j++) {
  19488. scaled[j] = src[srcOffset++] * scale;
  19489. }
  19490. tintFn(scaled, 0, tinted, 0);
  19491. if (usesZeroToOneRange) {
  19492. for (j = 0; j < baseNumComps; j++) {
  19493. baseBuf[pos++] = tinted[j] * 255;
  19494. }
  19495. } else {
  19496. base.getRgbItem(tinted, 0, baseBuf, pos);
  19497. pos += baseNumComps;
  19498. }
  19499. }
  19500. if (!isPassthrough) {
  19501. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  19502. }
  19503. }
  19504. getOutputLength(inputLength, alpha01) {
  19505. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  19506. }
  19507. }
  19508. class PatternCS extends ColorSpace {
  19509. constructor(baseCS) {
  19510. super("Pattern", null);
  19511. this.base = baseCS;
  19512. }
  19513. isDefaultDecode(decodeMap, bpc) {
  19514. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  19515. }
  19516. }
  19517. class IndexedCS extends ColorSpace {
  19518. constructor(base, highVal, lookup) {
  19519. super("Indexed", 1);
  19520. this.base = base;
  19521. this.highVal = highVal;
  19522. const length = base.numComps * highVal;
  19523. this.lookup = new Uint8Array(length);
  19524. if (lookup instanceof _base_stream.BaseStream) {
  19525. const bytes = lookup.getBytes(length);
  19526. this.lookup.set(bytes);
  19527. } else if (typeof lookup === "string") {
  19528. for (let i = 0; i < length; ++i) {
  19529. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  19530. }
  19531. } else {
  19532. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  19533. }
  19534. }
  19535. getRgbItem(src, srcOffset, dest, destOffset) {
  19536. const numComps = this.base.numComps;
  19537. const start = src[srcOffset] * numComps;
  19538. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  19539. }
  19540. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19541. const base = this.base;
  19542. const numComps = base.numComps;
  19543. const outputDelta = base.getOutputLength(numComps, alpha01);
  19544. const lookup = this.lookup;
  19545. for (let i = 0; i < count; ++i) {
  19546. const lookupPos = src[srcOffset++] * numComps;
  19547. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  19548. destOffset += outputDelta;
  19549. }
  19550. }
  19551. getOutputLength(inputLength, alpha01) {
  19552. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  19553. }
  19554. isDefaultDecode(decodeMap, bpc) {
  19555. if (!Array.isArray(decodeMap)) {
  19556. return true;
  19557. }
  19558. if (decodeMap.length !== 2) {
  19559. (0, _util.warn)("Decode map length is not correct");
  19560. return true;
  19561. }
  19562. if (!Number.isInteger(bpc) || bpc < 1) {
  19563. (0, _util.warn)("Bits per component is not correct");
  19564. return true;
  19565. }
  19566. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  19567. }
  19568. }
  19569. class DeviceGrayCS extends ColorSpace {
  19570. constructor() {
  19571. super("DeviceGray", 1);
  19572. }
  19573. getRgbItem(src, srcOffset, dest, destOffset) {
  19574. const c = src[srcOffset] * 255;
  19575. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  19576. }
  19577. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19578. const scale = 255 / ((1 << bits) - 1);
  19579. let j = srcOffset,
  19580. q = destOffset;
  19581. for (let i = 0; i < count; ++i) {
  19582. const c = scale * src[j++];
  19583. dest[q++] = c;
  19584. dest[q++] = c;
  19585. dest[q++] = c;
  19586. q += alpha01;
  19587. }
  19588. }
  19589. getOutputLength(inputLength, alpha01) {
  19590. return inputLength * (3 + alpha01);
  19591. }
  19592. }
  19593. class DeviceRgbCS extends ColorSpace {
  19594. constructor() {
  19595. super("DeviceRGB", 3);
  19596. }
  19597. getRgbItem(src, srcOffset, dest, destOffset) {
  19598. dest[destOffset] = src[srcOffset] * 255;
  19599. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  19600. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  19601. }
  19602. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19603. if (bits === 8 && alpha01 === 0) {
  19604. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  19605. return;
  19606. }
  19607. const scale = 255 / ((1 << bits) - 1);
  19608. let j = srcOffset,
  19609. q = destOffset;
  19610. for (let i = 0; i < count; ++i) {
  19611. dest[q++] = scale * src[j++];
  19612. dest[q++] = scale * src[j++];
  19613. dest[q++] = scale * src[j++];
  19614. q += alpha01;
  19615. }
  19616. }
  19617. getOutputLength(inputLength, alpha01) {
  19618. return inputLength * (3 + alpha01) / 3 | 0;
  19619. }
  19620. isPassthrough(bits) {
  19621. return bits === 8;
  19622. }
  19623. }
  19624. const DeviceCmykCS = function DeviceCmykCSClosure() {
  19625. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  19626. const c = src[srcOffset] * srcScale;
  19627. const m = src[srcOffset + 1] * srcScale;
  19628. const y = src[srcOffset + 2] * srcScale;
  19629. const k = src[srcOffset + 3] * srcScale;
  19630. 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);
  19631. 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);
  19632. 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);
  19633. }
  19634. class DeviceCmykCS extends ColorSpace {
  19635. constructor() {
  19636. super("DeviceCMYK", 4);
  19637. }
  19638. getRgbItem(src, srcOffset, dest, destOffset) {
  19639. convertToRgb(src, srcOffset, 1, dest, destOffset);
  19640. }
  19641. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19642. const scale = 1 / ((1 << bits) - 1);
  19643. for (let i = 0; i < count; i++) {
  19644. convertToRgb(src, srcOffset, scale, dest, destOffset);
  19645. srcOffset += 4;
  19646. destOffset += 3 + alpha01;
  19647. }
  19648. }
  19649. getOutputLength(inputLength, alpha01) {
  19650. return inputLength / 4 * (3 + alpha01) | 0;
  19651. }
  19652. }
  19653. return DeviceCmykCS;
  19654. }();
  19655. const CalGrayCS = function CalGrayCSClosure() {
  19656. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19657. const A = src[srcOffset] * scale;
  19658. const AG = A ** cs.G;
  19659. const L = cs.YW * AG;
  19660. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  19661. dest[destOffset] = val;
  19662. dest[destOffset + 1] = val;
  19663. dest[destOffset + 2] = val;
  19664. }
  19665. class CalGrayCS extends ColorSpace {
  19666. constructor(whitePoint, blackPoint, gamma) {
  19667. super("CalGray", 1);
  19668. if (!whitePoint) {
  19669. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  19670. }
  19671. blackPoint = blackPoint || [0, 0, 0];
  19672. gamma = gamma || 1;
  19673. this.XW = whitePoint[0];
  19674. this.YW = whitePoint[1];
  19675. this.ZW = whitePoint[2];
  19676. this.XB = blackPoint[0];
  19677. this.YB = blackPoint[1];
  19678. this.ZB = blackPoint[2];
  19679. this.G = gamma;
  19680. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19681. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19682. }
  19683. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19684. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  19685. this.XB = this.YB = this.ZB = 0;
  19686. }
  19687. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  19688. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  19689. }
  19690. if (this.G < 1) {
  19691. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  19692. this.G = 1;
  19693. }
  19694. }
  19695. getRgbItem(src, srcOffset, dest, destOffset) {
  19696. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19697. }
  19698. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19699. const scale = 1 / ((1 << bits) - 1);
  19700. for (let i = 0; i < count; ++i) {
  19701. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19702. srcOffset += 1;
  19703. destOffset += 3 + alpha01;
  19704. }
  19705. }
  19706. getOutputLength(inputLength, alpha01) {
  19707. return inputLength * (3 + alpha01);
  19708. }
  19709. }
  19710. return CalGrayCS;
  19711. }();
  19712. const CalRGBCS = function CalRGBCSClosure() {
  19713. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  19714. 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]);
  19715. 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]);
  19716. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  19717. const tempNormalizeMatrix = new Float32Array(3);
  19718. const tempConvertMatrix1 = new Float32Array(3);
  19719. const tempConvertMatrix2 = new Float32Array(3);
  19720. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  19721. function matrixProduct(a, b, result) {
  19722. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  19723. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  19724. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  19725. }
  19726. function convertToFlat(sourceWhitePoint, LMS, result) {
  19727. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  19728. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  19729. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  19730. }
  19731. function convertToD65(sourceWhitePoint, LMS, result) {
  19732. const D65X = 0.95047;
  19733. const D65Y = 1;
  19734. const D65Z = 1.08883;
  19735. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  19736. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  19737. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  19738. }
  19739. function sRGBTransferFunction(color) {
  19740. if (color <= 0.0031308) {
  19741. return adjustToRange(0, 1, 12.92 * color);
  19742. }
  19743. if (color >= 0.99554525) {
  19744. return 1;
  19745. }
  19746. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  19747. }
  19748. function adjustToRange(min, max, value) {
  19749. return Math.max(min, Math.min(max, value));
  19750. }
  19751. function decodeL(L) {
  19752. if (L < 0) {
  19753. return -decodeL(-L);
  19754. }
  19755. if (L > 8.0) {
  19756. return ((L + 16) / 116) ** 3;
  19757. }
  19758. return L * DECODE_L_CONSTANT;
  19759. }
  19760. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  19761. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  19762. result[0] = XYZ_Flat[0];
  19763. result[1] = XYZ_Flat[1];
  19764. result[2] = XYZ_Flat[2];
  19765. return;
  19766. }
  19767. const zeroDecodeL = decodeL(0);
  19768. const X_DST = zeroDecodeL;
  19769. const X_SRC = decodeL(sourceBlackPoint[0]);
  19770. const Y_DST = zeroDecodeL;
  19771. const Y_SRC = decodeL(sourceBlackPoint[1]);
  19772. const Z_DST = zeroDecodeL;
  19773. const Z_SRC = decodeL(sourceBlackPoint[2]);
  19774. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  19775. const X_Offset = 1 - X_Scale;
  19776. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  19777. const Y_Offset = 1 - Y_Scale;
  19778. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  19779. const Z_Offset = 1 - Z_Scale;
  19780. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  19781. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  19782. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  19783. }
  19784. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  19785. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  19786. result[0] = XYZ_In[0];
  19787. result[1] = XYZ_In[1];
  19788. result[2] = XYZ_In[2];
  19789. return;
  19790. }
  19791. const LMS = result;
  19792. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19793. const LMS_Flat = tempNormalizeMatrix;
  19794. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  19795. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  19796. }
  19797. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  19798. const LMS = result;
  19799. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19800. const LMS_D65 = tempNormalizeMatrix;
  19801. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  19802. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  19803. }
  19804. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19805. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  19806. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  19807. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  19808. const AGR = A === 1 ? 1 : A ** cs.GR;
  19809. const BGG = B === 1 ? 1 : B ** cs.GG;
  19810. const CGB = C === 1 ? 1 : C ** cs.GB;
  19811. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  19812. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  19813. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  19814. const XYZ = tempConvertMatrix1;
  19815. XYZ[0] = X;
  19816. XYZ[1] = Y;
  19817. XYZ[2] = Z;
  19818. const XYZ_Flat = tempConvertMatrix2;
  19819. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  19820. const XYZ_Black = tempConvertMatrix1;
  19821. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  19822. const XYZ_D65 = tempConvertMatrix2;
  19823. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  19824. const SRGB = tempConvertMatrix1;
  19825. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  19826. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  19827. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  19828. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  19829. }
  19830. class CalRGBCS extends ColorSpace {
  19831. constructor(whitePoint, blackPoint, gamma, matrix) {
  19832. super("CalRGB", 3);
  19833. if (!whitePoint) {
  19834. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  19835. }
  19836. blackPoint = blackPoint || new Float32Array(3);
  19837. gamma = gamma || new Float32Array([1, 1, 1]);
  19838. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  19839. const XW = whitePoint[0];
  19840. const YW = whitePoint[1];
  19841. const ZW = whitePoint[2];
  19842. this.whitePoint = whitePoint;
  19843. const XB = blackPoint[0];
  19844. const YB = blackPoint[1];
  19845. const ZB = blackPoint[2];
  19846. this.blackPoint = blackPoint;
  19847. this.GR = gamma[0];
  19848. this.GG = gamma[1];
  19849. this.GB = gamma[2];
  19850. this.MXA = matrix[0];
  19851. this.MYA = matrix[1];
  19852. this.MZA = matrix[2];
  19853. this.MXB = matrix[3];
  19854. this.MYB = matrix[4];
  19855. this.MZB = matrix[5];
  19856. this.MXC = matrix[6];
  19857. this.MYC = matrix[7];
  19858. this.MZC = matrix[8];
  19859. if (XW < 0 || ZW < 0 || YW !== 1) {
  19860. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19861. }
  19862. if (XB < 0 || YB < 0 || ZB < 0) {
  19863. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  19864. this.blackPoint = new Float32Array(3);
  19865. }
  19866. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  19867. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  19868. this.GR = this.GG = this.GB = 1;
  19869. }
  19870. }
  19871. getRgbItem(src, srcOffset, dest, destOffset) {
  19872. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19873. }
  19874. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19875. const scale = 1 / ((1 << bits) - 1);
  19876. for (let i = 0; i < count; ++i) {
  19877. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19878. srcOffset += 3;
  19879. destOffset += 3 + alpha01;
  19880. }
  19881. }
  19882. getOutputLength(inputLength, alpha01) {
  19883. return inputLength * (3 + alpha01) / 3 | 0;
  19884. }
  19885. }
  19886. return CalRGBCS;
  19887. }();
  19888. const LabCS = function LabCSClosure() {
  19889. function fn_g(x) {
  19890. let result;
  19891. if (x >= 6 / 29) {
  19892. result = x ** 3;
  19893. } else {
  19894. result = 108 / 841 * (x - 4 / 29);
  19895. }
  19896. return result;
  19897. }
  19898. function decode(value, high1, low2, high2) {
  19899. return low2 + value * (high2 - low2) / high1;
  19900. }
  19901. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  19902. let Ls = src[srcOffset];
  19903. let as = src[srcOffset + 1];
  19904. let bs = src[srcOffset + 2];
  19905. if (maxVal !== false) {
  19906. Ls = decode(Ls, maxVal, 0, 100);
  19907. as = decode(as, maxVal, cs.amin, cs.amax);
  19908. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  19909. }
  19910. if (as > cs.amax) {
  19911. as = cs.amax;
  19912. } else if (as < cs.amin) {
  19913. as = cs.amin;
  19914. }
  19915. if (bs > cs.bmax) {
  19916. bs = cs.bmax;
  19917. } else if (bs < cs.bmin) {
  19918. bs = cs.bmin;
  19919. }
  19920. const M = (Ls + 16) / 116;
  19921. const L = M + as / 500;
  19922. const N = M - bs / 200;
  19923. const X = cs.XW * fn_g(L);
  19924. const Y = cs.YW * fn_g(M);
  19925. const Z = cs.ZW * fn_g(N);
  19926. let r, g, b;
  19927. if (cs.ZW < 1) {
  19928. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  19929. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  19930. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  19931. } else {
  19932. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  19933. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  19934. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  19935. }
  19936. dest[destOffset] = Math.sqrt(r) * 255;
  19937. dest[destOffset + 1] = Math.sqrt(g) * 255;
  19938. dest[destOffset + 2] = Math.sqrt(b) * 255;
  19939. }
  19940. class LabCS extends ColorSpace {
  19941. constructor(whitePoint, blackPoint, range) {
  19942. super("Lab", 3);
  19943. if (!whitePoint) {
  19944. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  19945. }
  19946. blackPoint = blackPoint || [0, 0, 0];
  19947. range = range || [-100, 100, -100, 100];
  19948. this.XW = whitePoint[0];
  19949. this.YW = whitePoint[1];
  19950. this.ZW = whitePoint[2];
  19951. this.amin = range[0];
  19952. this.amax = range[1];
  19953. this.bmin = range[2];
  19954. this.bmax = range[3];
  19955. this.XB = blackPoint[0];
  19956. this.YB = blackPoint[1];
  19957. this.ZB = blackPoint[2];
  19958. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19959. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  19960. }
  19961. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19962. (0, _util.info)("Invalid BlackPoint, falling back to default");
  19963. this.XB = this.YB = this.ZB = 0;
  19964. }
  19965. if (this.amin > this.amax || this.bmin > this.bmax) {
  19966. (0, _util.info)("Invalid Range, falling back to defaults");
  19967. this.amin = -100;
  19968. this.amax = 100;
  19969. this.bmin = -100;
  19970. this.bmax = 100;
  19971. }
  19972. }
  19973. getRgbItem(src, srcOffset, dest, destOffset) {
  19974. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  19975. }
  19976. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19977. const maxVal = (1 << bits) - 1;
  19978. for (let i = 0; i < count; i++) {
  19979. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  19980. srcOffset += 3;
  19981. destOffset += 3 + alpha01;
  19982. }
  19983. }
  19984. getOutputLength(inputLength, alpha01) {
  19985. return inputLength * (3 + alpha01) / 3 | 0;
  19986. }
  19987. isDefaultDecode(decodeMap, bpc) {
  19988. return true;
  19989. }
  19990. get usesZeroToOneRange() {
  19991. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  19992. }
  19993. }
  19994. return LabCS;
  19995. }();
  19996. /***/ }),
  19997. /* 25 */
  19998. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19999. Object.defineProperty(exports, "__esModule", ({
  20000. value: true
  20001. }));
  20002. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  20003. var _util = __w_pdfjs_require__(2);
  20004. var _cmap = __w_pdfjs_require__(26);
  20005. var _primitives = __w_pdfjs_require__(5);
  20006. var _fonts = __w_pdfjs_require__(44);
  20007. var _fonts_utils = __w_pdfjs_require__(18);
  20008. var _encodings = __w_pdfjs_require__(19);
  20009. var _standard_fonts = __w_pdfjs_require__(47);
  20010. var _unicode = __w_pdfjs_require__(21);
  20011. var _pattern = __w_pdfjs_require__(56);
  20012. var _xfa_fonts = __w_pdfjs_require__(12);
  20013. var _to_unicode_map = __w_pdfjs_require__(48);
  20014. var _function = __w_pdfjs_require__(57);
  20015. var _parser = __w_pdfjs_require__(27);
  20016. var _image_utils = __w_pdfjs_require__(59);
  20017. var _stream = __w_pdfjs_require__(10);
  20018. var _base_stream = __w_pdfjs_require__(9);
  20019. var _bidi = __w_pdfjs_require__(60);
  20020. var _colorspace = __w_pdfjs_require__(24);
  20021. var _decode_stream = __w_pdfjs_require__(29);
  20022. var _glyphlist = __w_pdfjs_require__(20);
  20023. var _core_utils = __w_pdfjs_require__(8);
  20024. var _metrics = __w_pdfjs_require__(51);
  20025. var _murmurhash = __w_pdfjs_require__(61);
  20026. var _operator_list = __w_pdfjs_require__(62);
  20027. var _image = __w_pdfjs_require__(63);
  20028. const DefaultPartialEvaluatorOptions = Object.freeze({
  20029. maxImageSize: -1,
  20030. disableFontFace: false,
  20031. ignoreErrors: false,
  20032. isEvalSupported: true,
  20033. fontExtraProperties: false,
  20034. useSystemFonts: true,
  20035. cMapUrl: null,
  20036. standardFontDataUrl: null
  20037. });
  20038. const PatternType = {
  20039. TILING: 1,
  20040. SHADING: 2
  20041. };
  20042. const TEXT_CHUNK_BATCH_SIZE = 10;
  20043. const deferred = Promise.resolve();
  20044. function normalizeBlendMode(value, parsingArray = false) {
  20045. if (Array.isArray(value)) {
  20046. for (let i = 0, ii = value.length; i < ii; i++) {
  20047. const maybeBM = normalizeBlendMode(value[i], true);
  20048. if (maybeBM) {
  20049. return maybeBM;
  20050. }
  20051. }
  20052. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  20053. return "source-over";
  20054. }
  20055. if (!(value instanceof _primitives.Name)) {
  20056. if (parsingArray) {
  20057. return null;
  20058. }
  20059. return "source-over";
  20060. }
  20061. switch (value.name) {
  20062. case "Normal":
  20063. case "Compatible":
  20064. return "source-over";
  20065. case "Multiply":
  20066. return "multiply";
  20067. case "Screen":
  20068. return "screen";
  20069. case "Overlay":
  20070. return "overlay";
  20071. case "Darken":
  20072. return "darken";
  20073. case "Lighten":
  20074. return "lighten";
  20075. case "ColorDodge":
  20076. return "color-dodge";
  20077. case "ColorBurn":
  20078. return "color-burn";
  20079. case "HardLight":
  20080. return "hard-light";
  20081. case "SoftLight":
  20082. return "soft-light";
  20083. case "Difference":
  20084. return "difference";
  20085. case "Exclusion":
  20086. return "exclusion";
  20087. case "Hue":
  20088. return "hue";
  20089. case "Saturation":
  20090. return "saturation";
  20091. case "Color":
  20092. return "color";
  20093. case "Luminosity":
  20094. return "luminosity";
  20095. }
  20096. if (parsingArray) {
  20097. return null;
  20098. }
  20099. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  20100. return "source-over";
  20101. }
  20102. class TimeSlotManager {
  20103. static get TIME_SLOT_DURATION_MS() {
  20104. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  20105. }
  20106. static get CHECK_TIME_EVERY() {
  20107. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  20108. }
  20109. constructor() {
  20110. this.reset();
  20111. }
  20112. check() {
  20113. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  20114. return false;
  20115. }
  20116. this.checked = 0;
  20117. return this.endTime <= Date.now();
  20118. }
  20119. reset() {
  20120. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  20121. this.checked = 0;
  20122. }
  20123. }
  20124. class PartialEvaluator {
  20125. constructor({
  20126. xref,
  20127. handler,
  20128. pageIndex,
  20129. idFactory,
  20130. fontCache,
  20131. builtInCMapCache,
  20132. standardFontDataCache,
  20133. globalImageCache,
  20134. options = null
  20135. }) {
  20136. this.xref = xref;
  20137. this.handler = handler;
  20138. this.pageIndex = pageIndex;
  20139. this.idFactory = idFactory;
  20140. this.fontCache = fontCache;
  20141. this.builtInCMapCache = builtInCMapCache;
  20142. this.standardFontDataCache = standardFontDataCache;
  20143. this.globalImageCache = globalImageCache;
  20144. this.options = options || DefaultPartialEvaluatorOptions;
  20145. this.parsingType3Font = false;
  20146. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  20147. }
  20148. get _pdfFunctionFactory() {
  20149. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  20150. xref: this.xref,
  20151. isEvalSupported: this.options.isEvalSupported
  20152. });
  20153. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  20154. }
  20155. clone(newOptions = null) {
  20156. const newEvaluator = Object.create(this);
  20157. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  20158. return newEvaluator;
  20159. }
  20160. hasBlendModes(resources, nonBlendModesSet) {
  20161. if (!(resources instanceof _primitives.Dict)) {
  20162. return false;
  20163. }
  20164. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  20165. return false;
  20166. }
  20167. const processed = new _primitives.RefSet(nonBlendModesSet);
  20168. if (resources.objId) {
  20169. processed.put(resources.objId);
  20170. }
  20171. const nodes = [resources],
  20172. xref = this.xref;
  20173. while (nodes.length) {
  20174. const node = nodes.shift();
  20175. const graphicStates = node.get("ExtGState");
  20176. if (graphicStates instanceof _primitives.Dict) {
  20177. for (let graphicState of graphicStates.getRawValues()) {
  20178. if (graphicState instanceof _primitives.Ref) {
  20179. if (processed.has(graphicState)) {
  20180. continue;
  20181. }
  20182. try {
  20183. graphicState = xref.fetch(graphicState);
  20184. } catch (ex) {
  20185. processed.put(graphicState);
  20186. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  20187. continue;
  20188. }
  20189. }
  20190. if (!(graphicState instanceof _primitives.Dict)) {
  20191. continue;
  20192. }
  20193. if (graphicState.objId) {
  20194. processed.put(graphicState.objId);
  20195. }
  20196. const bm = graphicState.get("BM");
  20197. if (bm instanceof _primitives.Name) {
  20198. if (bm.name !== "Normal") {
  20199. return true;
  20200. }
  20201. continue;
  20202. }
  20203. if (bm !== undefined && Array.isArray(bm)) {
  20204. for (const element of bm) {
  20205. if (element instanceof _primitives.Name && element.name !== "Normal") {
  20206. return true;
  20207. }
  20208. }
  20209. }
  20210. }
  20211. }
  20212. const xObjects = node.get("XObject");
  20213. if (!(xObjects instanceof _primitives.Dict)) {
  20214. continue;
  20215. }
  20216. for (let xObject of xObjects.getRawValues()) {
  20217. if (xObject instanceof _primitives.Ref) {
  20218. if (processed.has(xObject)) {
  20219. continue;
  20220. }
  20221. try {
  20222. xObject = xref.fetch(xObject);
  20223. } catch (ex) {
  20224. processed.put(xObject);
  20225. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  20226. continue;
  20227. }
  20228. }
  20229. if (!(xObject instanceof _base_stream.BaseStream)) {
  20230. continue;
  20231. }
  20232. if (xObject.dict.objId) {
  20233. processed.put(xObject.dict.objId);
  20234. }
  20235. const xResources = xObject.dict.get("Resources");
  20236. if (!(xResources instanceof _primitives.Dict)) {
  20237. continue;
  20238. }
  20239. if (xResources.objId && processed.has(xResources.objId)) {
  20240. continue;
  20241. }
  20242. nodes.push(xResources);
  20243. if (xResources.objId) {
  20244. processed.put(xResources.objId);
  20245. }
  20246. }
  20247. }
  20248. processed.forEach(ref => {
  20249. nonBlendModesSet.put(ref);
  20250. });
  20251. return false;
  20252. }
  20253. async fetchBuiltInCMap(name) {
  20254. const cachedData = this.builtInCMapCache.get(name);
  20255. if (cachedData) {
  20256. return cachedData;
  20257. }
  20258. let data;
  20259. if (this.options.cMapUrl !== null) {
  20260. const url = `${this.options.cMapUrl}${name}.bcmap`;
  20261. const response = await fetch(url);
  20262. if (!response.ok) {
  20263. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  20264. }
  20265. data = {
  20266. cMapData: new Uint8Array(await response.arrayBuffer()),
  20267. compressionType: _util.CMapCompressionType.BINARY
  20268. };
  20269. } else {
  20270. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  20271. name
  20272. });
  20273. }
  20274. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  20275. this.builtInCMapCache.set(name, data);
  20276. }
  20277. return data;
  20278. }
  20279. async fetchStandardFontData(name) {
  20280. const cachedData = this.standardFontDataCache.get(name);
  20281. if (cachedData) {
  20282. return new _stream.Stream(cachedData);
  20283. }
  20284. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  20285. return null;
  20286. }
  20287. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  20288. filename = standardFontNameToFileName[name];
  20289. let data;
  20290. if (this.options.standardFontDataUrl !== null) {
  20291. const url = `${this.options.standardFontDataUrl}${filename}`;
  20292. const response = await fetch(url);
  20293. if (!response.ok) {
  20294. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  20295. } else {
  20296. data = await response.arrayBuffer();
  20297. }
  20298. } else {
  20299. try {
  20300. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  20301. filename
  20302. });
  20303. } catch (e) {
  20304. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  20305. }
  20306. }
  20307. if (!data) {
  20308. return null;
  20309. }
  20310. this.standardFontDataCache.set(name, data);
  20311. return new _stream.Stream(data);
  20312. }
  20313. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  20314. const dict = xobj.dict;
  20315. const matrix = dict.getArray("Matrix");
  20316. let bbox = dict.getArray("BBox");
  20317. if (Array.isArray(bbox) && bbox.length === 4) {
  20318. bbox = _util.Util.normalizeRect(bbox);
  20319. } else {
  20320. bbox = null;
  20321. }
  20322. let optionalContent, groupOptions;
  20323. if (dict.has("OC")) {
  20324. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20325. }
  20326. if (optionalContent !== undefined) {
  20327. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20328. }
  20329. const group = dict.get("Group");
  20330. if (group) {
  20331. groupOptions = {
  20332. matrix,
  20333. bbox,
  20334. smask,
  20335. isolated: false,
  20336. knockout: false
  20337. };
  20338. const groupSubtype = group.get("S");
  20339. let colorSpace = null;
  20340. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  20341. groupOptions.isolated = group.get("I") || false;
  20342. groupOptions.knockout = group.get("K") || false;
  20343. if (group.has("CS")) {
  20344. const cs = group.getRaw("CS");
  20345. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  20346. if (cachedColorSpace) {
  20347. colorSpace = cachedColorSpace;
  20348. } else {
  20349. colorSpace = await this.parseColorSpace({
  20350. cs,
  20351. resources,
  20352. localColorSpaceCache
  20353. });
  20354. }
  20355. }
  20356. }
  20357. if (smask && smask.backdrop) {
  20358. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  20359. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  20360. }
  20361. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  20362. }
  20363. const args = group ? [matrix, null] : [matrix, bbox];
  20364. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  20365. return this.getOperatorList({
  20366. stream: xobj,
  20367. task,
  20368. resources: dict.get("Resources") || resources,
  20369. operatorList,
  20370. initialState
  20371. }).then(function () {
  20372. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  20373. if (group) {
  20374. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  20375. }
  20376. if (optionalContent !== undefined) {
  20377. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20378. }
  20379. });
  20380. }
  20381. _sendImgData(objId, imgData, cacheGlobally = false) {
  20382. const transfers = imgData ? [imgData.data.buffer] : null;
  20383. if (this.parsingType3Font || cacheGlobally) {
  20384. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  20385. }
  20386. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  20387. }
  20388. async buildPaintImageXObject({
  20389. resources,
  20390. image,
  20391. isInline = false,
  20392. operatorList,
  20393. cacheKey,
  20394. localImageCache,
  20395. localColorSpaceCache
  20396. }) {
  20397. const dict = image.dict;
  20398. const imageRef = dict.objId;
  20399. const w = dict.get("W", "Width");
  20400. const h = dict.get("H", "Height");
  20401. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  20402. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  20403. return;
  20404. }
  20405. const maxImageSize = this.options.maxImageSize;
  20406. if (maxImageSize !== -1 && w * h > maxImageSize) {
  20407. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  20408. return;
  20409. }
  20410. let optionalContent;
  20411. if (dict.has("OC")) {
  20412. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20413. }
  20414. if (optionalContent !== undefined) {
  20415. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20416. }
  20417. const imageMask = dict.get("IM", "ImageMask") || false;
  20418. const interpolate = dict.get("I", "Interpolate");
  20419. let imgData, args;
  20420. if (imageMask) {
  20421. const bitStrideLength = w + 7 >> 3;
  20422. const imgArray = image.getBytes(bitStrideLength * h, true);
  20423. const decode = dict.getArray("D", "Decode");
  20424. imgData = _image.PDFImage.createMask({
  20425. imgArray,
  20426. width: w,
  20427. height: h,
  20428. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20429. inverseDecode: !!decode && decode[0] > 0,
  20430. interpolate
  20431. });
  20432. imgData.cached = !!cacheKey;
  20433. args = [imgData];
  20434. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  20435. if (cacheKey) {
  20436. localImageCache.set(cacheKey, imageRef, {
  20437. fn: _util.OPS.paintImageMaskXObject,
  20438. args
  20439. });
  20440. }
  20441. if (optionalContent !== undefined) {
  20442. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20443. }
  20444. return;
  20445. }
  20446. const softMask = dict.get("SM", "SMask") || false;
  20447. const mask = dict.get("Mask") || false;
  20448. const SMALL_IMAGE_DIMENSIONS = 200;
  20449. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  20450. const imageObj = new _image.PDFImage({
  20451. xref: this.xref,
  20452. res: resources,
  20453. image,
  20454. isInline,
  20455. pdfFunctionFactory: this._pdfFunctionFactory,
  20456. localColorSpaceCache
  20457. });
  20458. imgData = imageObj.createImageData(true);
  20459. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  20460. if (optionalContent !== undefined) {
  20461. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20462. }
  20463. return;
  20464. }
  20465. let objId = `img_${this.idFactory.createObjId()}`,
  20466. cacheGlobally = false;
  20467. if (this.parsingType3Font) {
  20468. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  20469. } else if (imageRef) {
  20470. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  20471. if (cacheGlobally) {
  20472. objId = `${this.idFactory.getDocId()}_${objId}`;
  20473. }
  20474. }
  20475. operatorList.addDependency(objId);
  20476. args = [objId, w, h];
  20477. _image.PDFImage.buildImage({
  20478. xref: this.xref,
  20479. res: resources,
  20480. image,
  20481. isInline,
  20482. pdfFunctionFactory: this._pdfFunctionFactory,
  20483. localColorSpaceCache
  20484. }).then(imageObj => {
  20485. imgData = imageObj.createImageData(false);
  20486. if (cacheKey && imageRef && cacheGlobally) {
  20487. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  20488. }
  20489. return this._sendImgData(objId, imgData, cacheGlobally);
  20490. }).catch(reason => {
  20491. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  20492. return this._sendImgData(objId, null, cacheGlobally);
  20493. });
  20494. operatorList.addOp(_util.OPS.paintImageXObject, args);
  20495. if (cacheKey) {
  20496. localImageCache.set(cacheKey, imageRef, {
  20497. fn: _util.OPS.paintImageXObject,
  20498. args
  20499. });
  20500. if (imageRef) {
  20501. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  20502. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  20503. if (cacheGlobally) {
  20504. this.globalImageCache.setData(imageRef, {
  20505. objId,
  20506. fn: _util.OPS.paintImageXObject,
  20507. args,
  20508. byteSize: 0
  20509. });
  20510. }
  20511. }
  20512. }
  20513. if (optionalContent !== undefined) {
  20514. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20515. }
  20516. }
  20517. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  20518. const smaskContent = smask.get("G");
  20519. const smaskOptions = {
  20520. subtype: smask.get("S").name,
  20521. backdrop: smask.get("BC")
  20522. };
  20523. const transferObj = smask.get("TR");
  20524. if ((0, _function.isPDFFunction)(transferObj)) {
  20525. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20526. const transferMap = new Uint8Array(256);
  20527. const tmp = new Float32Array(1);
  20528. for (let i = 0; i < 256; i++) {
  20529. tmp[0] = i / 255;
  20530. transferFn(tmp, 0, tmp, 0);
  20531. transferMap[i] = tmp[0] * 255 | 0;
  20532. }
  20533. smaskOptions.transferMap = transferMap;
  20534. }
  20535. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  20536. }
  20537. handleTransferFunction(tr) {
  20538. let transferArray;
  20539. if (Array.isArray(tr)) {
  20540. transferArray = tr;
  20541. } else if ((0, _function.isPDFFunction)(tr)) {
  20542. transferArray = [tr];
  20543. } else {
  20544. return null;
  20545. }
  20546. const transferMaps = [];
  20547. let numFns = 0,
  20548. numEffectfulFns = 0;
  20549. for (const entry of transferArray) {
  20550. const transferObj = this.xref.fetchIfRef(entry);
  20551. numFns++;
  20552. if ((0, _primitives.isName)(transferObj, "Identity")) {
  20553. transferMaps.push(null);
  20554. continue;
  20555. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  20556. return null;
  20557. }
  20558. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20559. const transferMap = new Uint8Array(256),
  20560. tmp = new Float32Array(1);
  20561. for (let j = 0; j < 256; j++) {
  20562. tmp[0] = j / 255;
  20563. transferFn(tmp, 0, tmp, 0);
  20564. transferMap[j] = tmp[0] * 255 | 0;
  20565. }
  20566. transferMaps.push(transferMap);
  20567. numEffectfulFns++;
  20568. }
  20569. if (!(numFns === 1 || numFns === 4)) {
  20570. return null;
  20571. }
  20572. if (numEffectfulFns === 0) {
  20573. return null;
  20574. }
  20575. return transferMaps;
  20576. }
  20577. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  20578. const tilingOpList = new _operator_list.OperatorList();
  20579. const patternResources = _primitives.Dict.merge({
  20580. xref: this.xref,
  20581. dictArray: [patternDict.get("Resources"), resources]
  20582. });
  20583. return this.getOperatorList({
  20584. stream: pattern,
  20585. task,
  20586. resources: patternResources,
  20587. operatorList: tilingOpList
  20588. }).then(function () {
  20589. const operatorListIR = tilingOpList.getIR();
  20590. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  20591. operatorList.addDependencies(tilingOpList.dependencies);
  20592. operatorList.addOp(fn, tilingPatternIR);
  20593. if (patternDict.objId) {
  20594. localTilingPatternCache.set(null, patternDict.objId, {
  20595. operatorListIR,
  20596. dict: patternDict
  20597. });
  20598. }
  20599. }).catch(reason => {
  20600. if (reason instanceof _util.AbortException) {
  20601. return;
  20602. }
  20603. if (this.options.ignoreErrors) {
  20604. this.handler.send("UnsupportedFeature", {
  20605. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  20606. });
  20607. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  20608. return;
  20609. }
  20610. throw reason;
  20611. });
  20612. }
  20613. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  20614. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  20615. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  20616. if (!translated.font.isType3Font) {
  20617. return translated;
  20618. }
  20619. return translated.loadType3Data(this, resources, task).then(function () {
  20620. operatorList.addDependencies(translated.type3Dependencies);
  20621. return translated;
  20622. }).catch(reason => {
  20623. this.handler.send("UnsupportedFeature", {
  20624. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  20625. });
  20626. return new TranslatedFont({
  20627. loadedName: "g_font_error",
  20628. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  20629. dict: translated.font,
  20630. evaluatorOptions: this.options
  20631. });
  20632. });
  20633. }).then(translated => {
  20634. state.font = translated.font;
  20635. translated.send(this.handler);
  20636. return translated.loadedName;
  20637. });
  20638. }
  20639. handleText(chars, state) {
  20640. const font = state.font;
  20641. const glyphs = font.charsToGlyphs(chars);
  20642. if (font.data) {
  20643. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  20644. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  20645. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  20646. }
  20647. }
  20648. return glyphs;
  20649. }
  20650. ensureStateFont(state) {
  20651. if (state.font) {
  20652. return;
  20653. }
  20654. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  20655. if (this.options.ignoreErrors) {
  20656. this.handler.send("UnsupportedFeature", {
  20657. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  20658. });
  20659. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  20660. return;
  20661. }
  20662. throw reason;
  20663. }
  20664. async setGState({
  20665. resources,
  20666. gState,
  20667. operatorList,
  20668. cacheKey,
  20669. task,
  20670. stateManager,
  20671. localGStateCache,
  20672. localColorSpaceCache
  20673. }) {
  20674. const gStateRef = gState.objId;
  20675. let isSimpleGState = true;
  20676. const gStateObj = [];
  20677. const gStateKeys = gState.getKeys();
  20678. let promise = Promise.resolve();
  20679. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  20680. const key = gStateKeys[i];
  20681. const value = gState.get(key);
  20682. switch (key) {
  20683. case "Type":
  20684. break;
  20685. case "LW":
  20686. case "LC":
  20687. case "LJ":
  20688. case "ML":
  20689. case "D":
  20690. case "RI":
  20691. case "FL":
  20692. case "CA":
  20693. case "ca":
  20694. gStateObj.push([key, value]);
  20695. break;
  20696. case "Font":
  20697. isSimpleGState = false;
  20698. promise = promise.then(() => {
  20699. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  20700. operatorList.addDependency(loadedName);
  20701. gStateObj.push([key, [loadedName, value[1]]]);
  20702. });
  20703. });
  20704. break;
  20705. case "BM":
  20706. gStateObj.push([key, normalizeBlendMode(value)]);
  20707. break;
  20708. case "SMask":
  20709. if ((0, _primitives.isName)(value, "None")) {
  20710. gStateObj.push([key, false]);
  20711. break;
  20712. }
  20713. if (value instanceof _primitives.Dict) {
  20714. isSimpleGState = false;
  20715. promise = promise.then(() => {
  20716. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  20717. });
  20718. gStateObj.push([key, true]);
  20719. } else {
  20720. (0, _util.warn)("Unsupported SMask type");
  20721. }
  20722. break;
  20723. case "TR":
  20724. const transferMaps = this.handleTransferFunction(value);
  20725. gStateObj.push([key, transferMaps]);
  20726. break;
  20727. case "OP":
  20728. case "op":
  20729. case "OPM":
  20730. case "BG":
  20731. case "BG2":
  20732. case "UCR":
  20733. case "UCR2":
  20734. case "TR2":
  20735. case "HT":
  20736. case "SM":
  20737. case "SA":
  20738. case "AIS":
  20739. case "TK":
  20740. (0, _util.info)("graphic state operator " + key);
  20741. break;
  20742. default:
  20743. (0, _util.info)("Unknown graphic state operator " + key);
  20744. break;
  20745. }
  20746. }
  20747. return promise.then(function () {
  20748. if (gStateObj.length > 0) {
  20749. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  20750. }
  20751. if (isSimpleGState) {
  20752. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  20753. }
  20754. });
  20755. }
  20756. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  20757. const errorFont = async () => {
  20758. return new TranslatedFont({
  20759. loadedName: "g_font_error",
  20760. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  20761. dict: font,
  20762. evaluatorOptions: this.options
  20763. });
  20764. };
  20765. const xref = this.xref;
  20766. let fontRef;
  20767. if (font) {
  20768. if (!(font instanceof _primitives.Ref)) {
  20769. throw new _util.FormatError('The "font" object should be a reference.');
  20770. }
  20771. fontRef = font;
  20772. } else {
  20773. const fontRes = resources.get("Font");
  20774. if (fontRes) {
  20775. fontRef = fontRes.getRaw(fontName);
  20776. }
  20777. }
  20778. if (!fontRef) {
  20779. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  20780. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  20781. (0, _util.warn)(`${partialMsg}.`);
  20782. return errorFont();
  20783. }
  20784. this.handler.send("UnsupportedFeature", {
  20785. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  20786. });
  20787. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  20788. if (fallbackFontDict) {
  20789. fontRef = fallbackFontDict;
  20790. } else {
  20791. fontRef = PartialEvaluator.fallbackFontDict;
  20792. }
  20793. }
  20794. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  20795. return errorFont();
  20796. }
  20797. if (this.fontCache.has(fontRef)) {
  20798. return this.fontCache.get(fontRef);
  20799. }
  20800. font = xref.fetchIfRef(fontRef);
  20801. if (!(font instanceof _primitives.Dict)) {
  20802. return errorFont();
  20803. }
  20804. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  20805. return this.fontCache.get(font.cacheKey);
  20806. }
  20807. const fontCapability = (0, _util.createPromiseCapability)();
  20808. let preEvaluatedFont;
  20809. try {
  20810. preEvaluatedFont = this.preEvaluateFont(font);
  20811. preEvaluatedFont.cssFontInfo = cssFontInfo;
  20812. } catch (reason) {
  20813. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  20814. return errorFont();
  20815. }
  20816. const {
  20817. descriptor,
  20818. hash
  20819. } = preEvaluatedFont;
  20820. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  20821. let fontID;
  20822. if (fontRefIsRef) {
  20823. fontID = `f${fontRef.toString()}`;
  20824. }
  20825. if (hash && descriptor instanceof _primitives.Dict) {
  20826. if (!descriptor.fontAliases) {
  20827. descriptor.fontAliases = Object.create(null);
  20828. }
  20829. const fontAliases = descriptor.fontAliases;
  20830. if (fontAliases[hash]) {
  20831. const aliasFontRef = fontAliases[hash].aliasRef;
  20832. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  20833. this.fontCache.putAlias(fontRef, aliasFontRef);
  20834. return this.fontCache.get(fontRef);
  20835. }
  20836. } else {
  20837. fontAliases[hash] = {
  20838. fontID: this.idFactory.createFontId()
  20839. };
  20840. }
  20841. if (fontRefIsRef) {
  20842. fontAliases[hash].aliasRef = fontRef;
  20843. }
  20844. fontID = fontAliases[hash].fontID;
  20845. }
  20846. if (fontRefIsRef) {
  20847. this.fontCache.put(fontRef, fontCapability.promise);
  20848. } else {
  20849. if (!fontID) {
  20850. fontID = this.idFactory.createFontId();
  20851. }
  20852. font.cacheKey = `cacheKey_${fontID}`;
  20853. this.fontCache.put(font.cacheKey, fontCapability.promise);
  20854. }
  20855. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  20856. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  20857. this.translateFont(preEvaluatedFont).then(translatedFont => {
  20858. if (translatedFont.fontType !== undefined) {
  20859. xref.stats.addFontType(translatedFont.fontType);
  20860. }
  20861. fontCapability.resolve(new TranslatedFont({
  20862. loadedName: font.loadedName,
  20863. font: translatedFont,
  20864. dict: font,
  20865. evaluatorOptions: this.options
  20866. }));
  20867. }).catch(reason => {
  20868. this.handler.send("UnsupportedFeature", {
  20869. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  20870. });
  20871. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  20872. try {
  20873. const fontFile3 = descriptor && descriptor.get("FontFile3");
  20874. const subtype = fontFile3 && fontFile3.get("Subtype");
  20875. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  20876. if (fontType !== undefined) {
  20877. xref.stats.addFontType(fontType);
  20878. }
  20879. } catch (ex) {}
  20880. fontCapability.resolve(new TranslatedFont({
  20881. loadedName: font.loadedName,
  20882. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  20883. dict: font,
  20884. evaluatorOptions: this.options
  20885. }));
  20886. });
  20887. return fontCapability.promise;
  20888. }
  20889. buildPath(operatorList, fn, args, parsingText = false) {
  20890. const lastIndex = operatorList.length - 1;
  20891. if (!args) {
  20892. args = [];
  20893. }
  20894. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  20895. if (parsingText) {
  20896. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  20897. operatorList.addOp(_util.OPS.save, null);
  20898. }
  20899. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  20900. if (parsingText) {
  20901. operatorList.addOp(_util.OPS.restore, null);
  20902. }
  20903. } else {
  20904. const opArgs = operatorList.argsArray[lastIndex];
  20905. opArgs[0].push(fn);
  20906. Array.prototype.push.apply(opArgs[1], args);
  20907. }
  20908. }
  20909. parseColorSpace({
  20910. cs,
  20911. resources,
  20912. localColorSpaceCache
  20913. }) {
  20914. return _colorspace.ColorSpace.parseAsync({
  20915. cs,
  20916. xref: this.xref,
  20917. resources,
  20918. pdfFunctionFactory: this._pdfFunctionFactory,
  20919. localColorSpaceCache
  20920. }).catch(reason => {
  20921. if (reason instanceof _util.AbortException) {
  20922. return null;
  20923. }
  20924. if (this.options.ignoreErrors) {
  20925. this.handler.send("UnsupportedFeature", {
  20926. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  20927. });
  20928. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  20929. return null;
  20930. }
  20931. throw reason;
  20932. });
  20933. }
  20934. parseShading({
  20935. shading,
  20936. resources,
  20937. localColorSpaceCache,
  20938. localShadingPatternCache
  20939. }) {
  20940. let id = localShadingPatternCache.get(shading);
  20941. if (!id) {
  20942. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  20943. const patternIR = shadingFill.getIR();
  20944. id = `pattern_${this.idFactory.createObjId()}`;
  20945. localShadingPatternCache.set(shading, id);
  20946. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  20947. }
  20948. return id;
  20949. }
  20950. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  20951. const patternName = args.pop();
  20952. if (patternName instanceof _primitives.Name) {
  20953. const rawPattern = patterns.getRaw(patternName.name);
  20954. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  20955. if (localTilingPattern) {
  20956. try {
  20957. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  20958. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  20959. operatorList.addOp(fn, tilingPatternIR);
  20960. return undefined;
  20961. } catch (ex) {}
  20962. }
  20963. const pattern = this.xref.fetchIfRef(rawPattern);
  20964. if (pattern) {
  20965. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  20966. const typeNum = dict.get("PatternType");
  20967. if (typeNum === PatternType.TILING) {
  20968. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  20969. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  20970. } else if (typeNum === PatternType.SHADING) {
  20971. const shading = dict.get("Shading");
  20972. const matrix = dict.getArray("Matrix");
  20973. const objId = this.parseShading({
  20974. shading,
  20975. resources,
  20976. localColorSpaceCache,
  20977. localShadingPatternCache
  20978. });
  20979. operatorList.addOp(fn, ["Shading", objId, matrix]);
  20980. return undefined;
  20981. }
  20982. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  20983. }
  20984. }
  20985. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  20986. }
  20987. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  20988. const MAX_NESTING = 10;
  20989. if (++nestingCounter > MAX_NESTING) {
  20990. (0, _util.warn)("Visibility expression is too deeply nested");
  20991. return;
  20992. }
  20993. const length = array.length;
  20994. const operator = this.xref.fetchIfRef(array[0]);
  20995. if (length < 2 || !(operator instanceof _primitives.Name)) {
  20996. (0, _util.warn)("Invalid visibility expression");
  20997. return;
  20998. }
  20999. switch (operator.name) {
  21000. case "And":
  21001. case "Or":
  21002. case "Not":
  21003. currentResult.push(operator.name);
  21004. break;
  21005. default:
  21006. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  21007. return;
  21008. }
  21009. for (let i = 1; i < length; i++) {
  21010. const raw = array[i];
  21011. const object = this.xref.fetchIfRef(raw);
  21012. if (Array.isArray(object)) {
  21013. const nestedResult = [];
  21014. currentResult.push(nestedResult);
  21015. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  21016. } else if (raw instanceof _primitives.Ref) {
  21017. currentResult.push(raw.toString());
  21018. }
  21019. }
  21020. }
  21021. async parseMarkedContentProps(contentProperties, resources) {
  21022. let optionalContent;
  21023. if (contentProperties instanceof _primitives.Name) {
  21024. const properties = resources.get("Properties");
  21025. optionalContent = properties.get(contentProperties.name);
  21026. } else if (contentProperties instanceof _primitives.Dict) {
  21027. optionalContent = contentProperties;
  21028. } else {
  21029. throw new _util.FormatError("Optional content properties malformed.");
  21030. }
  21031. const optionalContentType = optionalContent.get("Type").name;
  21032. if (optionalContentType === "OCG") {
  21033. return {
  21034. type: optionalContentType,
  21035. id: optionalContent.objId
  21036. };
  21037. } else if (optionalContentType === "OCMD") {
  21038. const expression = optionalContent.get("VE");
  21039. if (Array.isArray(expression)) {
  21040. const result = [];
  21041. this._parseVisibilityExpression(expression, 0, result);
  21042. if (result.length > 0) {
  21043. return {
  21044. type: "OCMD",
  21045. expression: result
  21046. };
  21047. }
  21048. }
  21049. const optionalContentGroups = optionalContent.get("OCGs");
  21050. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  21051. const groupIds = [];
  21052. if (Array.isArray(optionalContentGroups)) {
  21053. for (const ocg of optionalContentGroups) {
  21054. groupIds.push(ocg.toString());
  21055. }
  21056. } else {
  21057. groupIds.push(optionalContentGroups.objId);
  21058. }
  21059. return {
  21060. type: optionalContentType,
  21061. ids: groupIds,
  21062. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  21063. expression: null
  21064. };
  21065. } else if (optionalContentGroups instanceof _primitives.Ref) {
  21066. return {
  21067. type: optionalContentType,
  21068. id: optionalContentGroups.toString()
  21069. };
  21070. }
  21071. }
  21072. return null;
  21073. }
  21074. getOperatorList({
  21075. stream,
  21076. task,
  21077. resources,
  21078. operatorList,
  21079. initialState = null,
  21080. fallbackFontDict = null
  21081. }) {
  21082. resources = resources || _primitives.Dict.empty;
  21083. initialState = initialState || new EvalState();
  21084. if (!operatorList) {
  21085. throw new Error('getOperatorList: missing "operatorList" parameter');
  21086. }
  21087. const self = this;
  21088. const xref = this.xref;
  21089. let parsingText = false;
  21090. const localImageCache = new _image_utils.LocalImageCache();
  21091. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  21092. const localGStateCache = new _image_utils.LocalGStateCache();
  21093. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  21094. const localShadingPatternCache = new Map();
  21095. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  21096. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  21097. const stateManager = new StateManager(initialState);
  21098. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21099. const timeSlotManager = new TimeSlotManager();
  21100. function closePendingRestoreOPS(argument) {
  21101. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  21102. operatorList.addOp(_util.OPS.restore, []);
  21103. }
  21104. }
  21105. return new Promise(function promiseBody(resolve, reject) {
  21106. const next = function (promise) {
  21107. Promise.all([promise, operatorList.ready]).then(function () {
  21108. try {
  21109. promiseBody(resolve, reject);
  21110. } catch (ex) {
  21111. reject(ex);
  21112. }
  21113. }, reject);
  21114. };
  21115. task.ensureNotTerminated();
  21116. timeSlotManager.reset();
  21117. const operation = {};
  21118. let stop, i, ii, cs, name, isValidName;
  21119. while (!(stop = timeSlotManager.check())) {
  21120. operation.args = null;
  21121. if (!preprocessor.read(operation)) {
  21122. break;
  21123. }
  21124. let args = operation.args;
  21125. let fn = operation.fn;
  21126. switch (fn | 0) {
  21127. case _util.OPS.paintXObject:
  21128. isValidName = args[0] instanceof _primitives.Name;
  21129. name = args[0].name;
  21130. if (isValidName) {
  21131. const localImage = localImageCache.getByName(name);
  21132. if (localImage) {
  21133. operatorList.addOp(localImage.fn, localImage.args);
  21134. args = null;
  21135. continue;
  21136. }
  21137. }
  21138. next(new Promise(function (resolveXObject, rejectXObject) {
  21139. if (!isValidName) {
  21140. throw new _util.FormatError("XObject must be referred to by name.");
  21141. }
  21142. let xobj = xobjs.getRaw(name);
  21143. if (xobj instanceof _primitives.Ref) {
  21144. const localImage = localImageCache.getByRef(xobj);
  21145. if (localImage) {
  21146. operatorList.addOp(localImage.fn, localImage.args);
  21147. resolveXObject();
  21148. return;
  21149. }
  21150. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  21151. if (globalImage) {
  21152. operatorList.addDependency(globalImage.objId);
  21153. operatorList.addOp(globalImage.fn, globalImage.args);
  21154. resolveXObject();
  21155. return;
  21156. }
  21157. xobj = xref.fetch(xobj);
  21158. }
  21159. if (!(xobj instanceof _base_stream.BaseStream)) {
  21160. throw new _util.FormatError("XObject should be a stream");
  21161. }
  21162. const type = xobj.dict.get("Subtype");
  21163. if (!(type instanceof _primitives.Name)) {
  21164. throw new _util.FormatError("XObject should have a Name subtype");
  21165. }
  21166. if (type.name === "Form") {
  21167. stateManager.save();
  21168. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  21169. stateManager.restore();
  21170. resolveXObject();
  21171. }, rejectXObject);
  21172. return;
  21173. } else if (type.name === "Image") {
  21174. self.buildPaintImageXObject({
  21175. resources,
  21176. image: xobj,
  21177. operatorList,
  21178. cacheKey: name,
  21179. localImageCache,
  21180. localColorSpaceCache
  21181. }).then(resolveXObject, rejectXObject);
  21182. return;
  21183. } else if (type.name === "PS") {
  21184. (0, _util.info)("Ignored XObject subtype PS");
  21185. } else {
  21186. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  21187. }
  21188. resolveXObject();
  21189. }).catch(function (reason) {
  21190. if (reason instanceof _util.AbortException) {
  21191. return;
  21192. }
  21193. if (self.options.ignoreErrors) {
  21194. self.handler.send("UnsupportedFeature", {
  21195. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  21196. });
  21197. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  21198. return;
  21199. }
  21200. throw reason;
  21201. }));
  21202. return;
  21203. case _util.OPS.setFont:
  21204. var fontSize = args[1];
  21205. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  21206. operatorList.addDependency(loadedName);
  21207. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  21208. }));
  21209. return;
  21210. case _util.OPS.beginText:
  21211. parsingText = true;
  21212. break;
  21213. case _util.OPS.endText:
  21214. parsingText = false;
  21215. break;
  21216. case _util.OPS.endInlineImage:
  21217. var cacheKey = args[0].cacheKey;
  21218. if (cacheKey) {
  21219. const localImage = localImageCache.getByName(cacheKey);
  21220. if (localImage) {
  21221. operatorList.addOp(localImage.fn, localImage.args);
  21222. args = null;
  21223. continue;
  21224. }
  21225. }
  21226. next(self.buildPaintImageXObject({
  21227. resources,
  21228. image: args[0],
  21229. isInline: true,
  21230. operatorList,
  21231. cacheKey,
  21232. localImageCache,
  21233. localColorSpaceCache
  21234. }));
  21235. return;
  21236. case _util.OPS.showText:
  21237. if (!stateManager.state.font) {
  21238. self.ensureStateFont(stateManager.state);
  21239. continue;
  21240. }
  21241. args[0] = self.handleText(args[0], stateManager.state);
  21242. break;
  21243. case _util.OPS.showSpacedText:
  21244. if (!stateManager.state.font) {
  21245. self.ensureStateFont(stateManager.state);
  21246. continue;
  21247. }
  21248. var arr = args[0];
  21249. var combinedGlyphs = [];
  21250. var arrLength = arr.length;
  21251. var state = stateManager.state;
  21252. for (i = 0; i < arrLength; ++i) {
  21253. const arrItem = arr[i];
  21254. if (typeof arrItem === "string") {
  21255. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  21256. } else if (typeof arrItem === "number") {
  21257. combinedGlyphs.push(arrItem);
  21258. }
  21259. }
  21260. args[0] = combinedGlyphs;
  21261. fn = _util.OPS.showText;
  21262. break;
  21263. case _util.OPS.nextLineShowText:
  21264. if (!stateManager.state.font) {
  21265. self.ensureStateFont(stateManager.state);
  21266. continue;
  21267. }
  21268. operatorList.addOp(_util.OPS.nextLine);
  21269. args[0] = self.handleText(args[0], stateManager.state);
  21270. fn = _util.OPS.showText;
  21271. break;
  21272. case _util.OPS.nextLineSetSpacingShowText:
  21273. if (!stateManager.state.font) {
  21274. self.ensureStateFont(stateManager.state);
  21275. continue;
  21276. }
  21277. operatorList.addOp(_util.OPS.nextLine);
  21278. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  21279. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  21280. args[0] = self.handleText(args[0], stateManager.state);
  21281. fn = _util.OPS.showText;
  21282. break;
  21283. case _util.OPS.setTextRenderingMode:
  21284. stateManager.state.textRenderingMode = args[0];
  21285. break;
  21286. case _util.OPS.setFillColorSpace:
  21287. {
  21288. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21289. if (cachedColorSpace) {
  21290. stateManager.state.fillColorSpace = cachedColorSpace;
  21291. continue;
  21292. }
  21293. next(self.parseColorSpace({
  21294. cs: args[0],
  21295. resources,
  21296. localColorSpaceCache
  21297. }).then(function (colorSpace) {
  21298. if (colorSpace) {
  21299. stateManager.state.fillColorSpace = colorSpace;
  21300. }
  21301. }));
  21302. return;
  21303. }
  21304. case _util.OPS.setStrokeColorSpace:
  21305. {
  21306. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21307. if (cachedColorSpace) {
  21308. stateManager.state.strokeColorSpace = cachedColorSpace;
  21309. continue;
  21310. }
  21311. next(self.parseColorSpace({
  21312. cs: args[0],
  21313. resources,
  21314. localColorSpaceCache
  21315. }).then(function (colorSpace) {
  21316. if (colorSpace) {
  21317. stateManager.state.strokeColorSpace = colorSpace;
  21318. }
  21319. }));
  21320. return;
  21321. }
  21322. case _util.OPS.setFillColor:
  21323. cs = stateManager.state.fillColorSpace;
  21324. args = cs.getRgb(args, 0);
  21325. fn = _util.OPS.setFillRGBColor;
  21326. break;
  21327. case _util.OPS.setStrokeColor:
  21328. cs = stateManager.state.strokeColorSpace;
  21329. args = cs.getRgb(args, 0);
  21330. fn = _util.OPS.setStrokeRGBColor;
  21331. break;
  21332. case _util.OPS.setFillGray:
  21333. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  21334. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21335. fn = _util.OPS.setFillRGBColor;
  21336. break;
  21337. case _util.OPS.setStrokeGray:
  21338. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  21339. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21340. fn = _util.OPS.setStrokeRGBColor;
  21341. break;
  21342. case _util.OPS.setFillCMYKColor:
  21343. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21344. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21345. fn = _util.OPS.setFillRGBColor;
  21346. break;
  21347. case _util.OPS.setStrokeCMYKColor:
  21348. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21349. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21350. fn = _util.OPS.setStrokeRGBColor;
  21351. break;
  21352. case _util.OPS.setFillRGBColor:
  21353. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21354. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21355. break;
  21356. case _util.OPS.setStrokeRGBColor:
  21357. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21358. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21359. break;
  21360. case _util.OPS.setFillColorN:
  21361. cs = stateManager.state.fillColorSpace;
  21362. if (cs.name === "Pattern") {
  21363. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21364. return;
  21365. }
  21366. args = cs.getRgb(args, 0);
  21367. fn = _util.OPS.setFillRGBColor;
  21368. break;
  21369. case _util.OPS.setStrokeColorN:
  21370. cs = stateManager.state.strokeColorSpace;
  21371. if (cs.name === "Pattern") {
  21372. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21373. return;
  21374. }
  21375. args = cs.getRgb(args, 0);
  21376. fn = _util.OPS.setStrokeRGBColor;
  21377. break;
  21378. case _util.OPS.shadingFill:
  21379. var shadingRes = resources.get("Shading");
  21380. if (!shadingRes) {
  21381. throw new _util.FormatError("No shading resource found");
  21382. }
  21383. var shading = shadingRes.get(args[0].name);
  21384. if (!shading) {
  21385. throw new _util.FormatError("No shading object found");
  21386. }
  21387. const patternId = self.parseShading({
  21388. shading,
  21389. resources,
  21390. localColorSpaceCache,
  21391. localShadingPatternCache
  21392. });
  21393. args = [patternId];
  21394. fn = _util.OPS.shadingFill;
  21395. break;
  21396. case _util.OPS.setGState:
  21397. isValidName = args[0] instanceof _primitives.Name;
  21398. name = args[0].name;
  21399. if (isValidName) {
  21400. const localGStateObj = localGStateCache.getByName(name);
  21401. if (localGStateObj) {
  21402. if (localGStateObj.length > 0) {
  21403. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  21404. }
  21405. args = null;
  21406. continue;
  21407. }
  21408. }
  21409. next(new Promise(function (resolveGState, rejectGState) {
  21410. if (!isValidName) {
  21411. throw new _util.FormatError("GState must be referred to by name.");
  21412. }
  21413. const extGState = resources.get("ExtGState");
  21414. if (!(extGState instanceof _primitives.Dict)) {
  21415. throw new _util.FormatError("ExtGState should be a dictionary.");
  21416. }
  21417. const gState = extGState.get(name);
  21418. if (!(gState instanceof _primitives.Dict)) {
  21419. throw new _util.FormatError("GState should be a dictionary.");
  21420. }
  21421. self.setGState({
  21422. resources,
  21423. gState,
  21424. operatorList,
  21425. cacheKey: name,
  21426. task,
  21427. stateManager,
  21428. localGStateCache,
  21429. localColorSpaceCache
  21430. }).then(resolveGState, rejectGState);
  21431. }).catch(function (reason) {
  21432. if (reason instanceof _util.AbortException) {
  21433. return;
  21434. }
  21435. if (self.options.ignoreErrors) {
  21436. self.handler.send("UnsupportedFeature", {
  21437. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  21438. });
  21439. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  21440. return;
  21441. }
  21442. throw reason;
  21443. }));
  21444. return;
  21445. case _util.OPS.moveTo:
  21446. case _util.OPS.lineTo:
  21447. case _util.OPS.curveTo:
  21448. case _util.OPS.curveTo2:
  21449. case _util.OPS.curveTo3:
  21450. case _util.OPS.closePath:
  21451. case _util.OPS.rectangle:
  21452. self.buildPath(operatorList, fn, args, parsingText);
  21453. continue;
  21454. case _util.OPS.markPoint:
  21455. case _util.OPS.markPointProps:
  21456. case _util.OPS.beginCompat:
  21457. case _util.OPS.endCompat:
  21458. continue;
  21459. case _util.OPS.beginMarkedContentProps:
  21460. if (!(args[0] instanceof _primitives.Name)) {
  21461. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  21462. continue;
  21463. }
  21464. if (args[0].name === "OC") {
  21465. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  21466. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  21467. }).catch(reason => {
  21468. if (reason instanceof _util.AbortException) {
  21469. return;
  21470. }
  21471. if (self.options.ignoreErrors) {
  21472. self.handler.send("UnsupportedFeature", {
  21473. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  21474. });
  21475. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  21476. return;
  21477. }
  21478. throw reason;
  21479. }));
  21480. return;
  21481. }
  21482. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  21483. break;
  21484. case _util.OPS.beginMarkedContent:
  21485. case _util.OPS.endMarkedContent:
  21486. default:
  21487. if (args !== null) {
  21488. for (i = 0, ii = args.length; i < ii; i++) {
  21489. if (args[i] instanceof _primitives.Dict) {
  21490. break;
  21491. }
  21492. }
  21493. if (i < ii) {
  21494. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  21495. continue;
  21496. }
  21497. }
  21498. }
  21499. operatorList.addOp(fn, args);
  21500. }
  21501. if (stop) {
  21502. next(deferred);
  21503. return;
  21504. }
  21505. closePendingRestoreOPS();
  21506. resolve();
  21507. }).catch(reason => {
  21508. if (reason instanceof _util.AbortException) {
  21509. return;
  21510. }
  21511. if (this.options.ignoreErrors) {
  21512. this.handler.send("UnsupportedFeature", {
  21513. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  21514. });
  21515. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  21516. closePendingRestoreOPS();
  21517. return;
  21518. }
  21519. throw reason;
  21520. });
  21521. }
  21522. getTextContent({
  21523. stream,
  21524. task,
  21525. resources,
  21526. stateManager = null,
  21527. combineTextItems = false,
  21528. includeMarkedContent = false,
  21529. sink,
  21530. seenStyles = new Set(),
  21531. viewBox
  21532. }) {
  21533. resources = resources || _primitives.Dict.empty;
  21534. stateManager = stateManager || new StateManager(new TextState());
  21535. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  21536. const textContent = {
  21537. items: [],
  21538. styles: Object.create(null)
  21539. };
  21540. const textContentItem = {
  21541. initialized: false,
  21542. str: [],
  21543. totalWidth: 0,
  21544. totalHeight: 0,
  21545. width: 0,
  21546. height: 0,
  21547. vertical: false,
  21548. prevTransform: null,
  21549. textAdvanceScale: 0,
  21550. spaceInFlowMin: 0,
  21551. spaceInFlowMax: 0,
  21552. trackingSpaceMin: Infinity,
  21553. negativeSpaceMax: -Infinity,
  21554. transform: null,
  21555. fontName: null,
  21556. hasEOL: false
  21557. };
  21558. const TRACKING_SPACE_FACTOR = 0.1;
  21559. const NEGATIVE_SPACE_FACTOR = -0.2;
  21560. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  21561. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  21562. const self = this;
  21563. const xref = this.xref;
  21564. const showSpacedTextBuffer = [];
  21565. let xobjs = null;
  21566. const emptyXObjectCache = new _image_utils.LocalImageCache();
  21567. const emptyGStateCache = new _image_utils.LocalGStateCache();
  21568. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21569. let textState;
  21570. function getCurrentTextTransform() {
  21571. const font = textState.font;
  21572. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  21573. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  21574. const glyphHeight = font.bbox[3] - font.bbox[1];
  21575. if (glyphHeight > 0) {
  21576. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  21577. }
  21578. }
  21579. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  21580. }
  21581. function ensureTextContentItem() {
  21582. if (textContentItem.initialized) {
  21583. return textContentItem;
  21584. }
  21585. const font = textState.font,
  21586. loadedName = font.loadedName;
  21587. if (!seenStyles.has(loadedName)) {
  21588. seenStyles.add(loadedName);
  21589. textContent.styles[loadedName] = {
  21590. fontFamily: font.fallbackName,
  21591. ascent: font.ascent,
  21592. descent: font.descent,
  21593. vertical: font.vertical
  21594. };
  21595. }
  21596. textContentItem.fontName = loadedName;
  21597. const trm = textContentItem.transform = getCurrentTextTransform();
  21598. if (!font.vertical) {
  21599. textContentItem.width = textContentItem.totalWidth = 0;
  21600. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  21601. textContentItem.vertical = false;
  21602. } else {
  21603. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  21604. textContentItem.height = textContentItem.totalHeight = 0;
  21605. textContentItem.vertical = true;
  21606. }
  21607. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21608. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21609. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  21610. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  21611. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  21612. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  21613. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  21614. textContentItem.hasEOL = false;
  21615. textContentItem.initialized = true;
  21616. return textContentItem;
  21617. }
  21618. function updateAdvanceScale() {
  21619. if (!textContentItem.initialized) {
  21620. return;
  21621. }
  21622. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21623. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21624. const scaleFactor = scaleCtmX * scaleLineX;
  21625. if (scaleFactor === textContentItem.textAdvanceScale) {
  21626. return;
  21627. }
  21628. if (!textContentItem.vertical) {
  21629. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21630. textContentItem.width = 0;
  21631. } else {
  21632. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21633. textContentItem.height = 0;
  21634. }
  21635. textContentItem.textAdvanceScale = scaleFactor;
  21636. }
  21637. function runBidiTransform(textChunk) {
  21638. const text = textChunk.str.join("");
  21639. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  21640. return {
  21641. str: bidiResult.str,
  21642. dir: bidiResult.dir,
  21643. width: Math.abs(textChunk.totalWidth),
  21644. height: Math.abs(textChunk.totalHeight),
  21645. transform: textChunk.transform,
  21646. fontName: textChunk.fontName,
  21647. hasEOL: textChunk.hasEOL
  21648. };
  21649. }
  21650. function handleSetFont(fontName, fontRef) {
  21651. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  21652. if (!translated.font.isType3Font) {
  21653. return translated;
  21654. }
  21655. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  21656. return translated;
  21657. });
  21658. }).then(function (translated) {
  21659. textState.font = translated.font;
  21660. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  21661. });
  21662. }
  21663. function applyInverseRotation(x, y, matrix) {
  21664. const scale = Math.hypot(matrix[0], matrix[1]);
  21665. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  21666. }
  21667. function compareWithLastPosition() {
  21668. const currentTransform = getCurrentTextTransform();
  21669. let posX = currentTransform[4];
  21670. let posY = currentTransform[5];
  21671. const shiftedX = posX - viewBox[0];
  21672. const shiftedY = posY - viewBox[1];
  21673. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  21674. return false;
  21675. }
  21676. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  21677. return true;
  21678. }
  21679. let lastPosX = textContentItem.prevTransform[4];
  21680. let lastPosY = textContentItem.prevTransform[5];
  21681. if (lastPosX === posX && lastPosY === posY) {
  21682. return true;
  21683. }
  21684. let rotate = -1;
  21685. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  21686. rotate = currentTransform[0] > 0 ? 0 : 180;
  21687. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  21688. rotate = currentTransform[1] > 0 ? 90 : 270;
  21689. }
  21690. switch (rotate) {
  21691. case 0:
  21692. break;
  21693. case 90:
  21694. [posX, posY] = [posY, posX];
  21695. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  21696. break;
  21697. case 180:
  21698. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  21699. break;
  21700. case 270:
  21701. [posX, posY] = [-posY, -posX];
  21702. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  21703. break;
  21704. default:
  21705. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  21706. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  21707. }
  21708. if (textState.font.vertical) {
  21709. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  21710. const advanceX = posX - lastPosX;
  21711. const textOrientation = Math.sign(textContentItem.height);
  21712. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  21713. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  21714. appendEOL();
  21715. return true;
  21716. }
  21717. flushTextContentItem();
  21718. return true;
  21719. }
  21720. if (Math.abs(advanceX) > textContentItem.width) {
  21721. appendEOL();
  21722. return true;
  21723. }
  21724. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  21725. textContentItem.height += advanceY;
  21726. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  21727. if (textContentItem.str.length === 0) {
  21728. textContent.items.push({
  21729. str: " ",
  21730. dir: "ltr",
  21731. width: 0,
  21732. height: Math.abs(advanceY),
  21733. transform: textContentItem.prevTransform,
  21734. fontName: textContentItem.fontName,
  21735. hasEOL: false
  21736. });
  21737. } else {
  21738. textContentItem.height += advanceY;
  21739. }
  21740. }
  21741. return true;
  21742. }
  21743. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  21744. const advanceY = posY - lastPosY;
  21745. const textOrientation = Math.sign(textContentItem.width);
  21746. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  21747. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  21748. appendEOL();
  21749. return true;
  21750. }
  21751. flushTextContentItem();
  21752. return true;
  21753. }
  21754. if (Math.abs(advanceY) > textContentItem.height) {
  21755. appendEOL();
  21756. return true;
  21757. }
  21758. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  21759. textContentItem.width += advanceX;
  21760. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  21761. if (textContentItem.str.length === 0) {
  21762. textContent.items.push({
  21763. str: " ",
  21764. dir: "ltr",
  21765. width: Math.abs(advanceX),
  21766. height: 0,
  21767. transform: textContentItem.prevTransform,
  21768. fontName: textContentItem.fontName,
  21769. hasEOL: false
  21770. });
  21771. } else {
  21772. textContentItem.width += advanceX;
  21773. }
  21774. }
  21775. return true;
  21776. }
  21777. function buildTextContentItem({
  21778. chars,
  21779. extraSpacing
  21780. }) {
  21781. const font = textState.font;
  21782. if (!chars) {
  21783. const charSpacing = textState.charSpacing + extraSpacing;
  21784. if (charSpacing) {
  21785. if (!font.vertical) {
  21786. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21787. } else {
  21788. textState.translateTextMatrix(0, -charSpacing);
  21789. }
  21790. }
  21791. return;
  21792. }
  21793. const glyphs = font.charsToGlyphs(chars);
  21794. const scale = textState.fontMatrix[0] * textState.fontSize;
  21795. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  21796. const glyph = glyphs[i];
  21797. if (glyph.isInvisibleFormatMark) {
  21798. continue;
  21799. }
  21800. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  21801. let glyphWidth = glyph.width;
  21802. if (font.vertical) {
  21803. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  21804. }
  21805. let scaledDim = glyphWidth * scale;
  21806. if (glyph.isWhitespace && (i === 0 || i + 1 === ii || glyphs[i - 1].isWhitespace || glyphs[i + 1].isWhitespace || extraSpacing)) {
  21807. if (!font.vertical) {
  21808. charSpacing += scaledDim + textState.wordSpacing;
  21809. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21810. } else {
  21811. charSpacing += -scaledDim + textState.wordSpacing;
  21812. textState.translateTextMatrix(0, -charSpacing);
  21813. }
  21814. continue;
  21815. }
  21816. if (!compareWithLastPosition()) {
  21817. continue;
  21818. }
  21819. const textChunk = ensureTextContentItem();
  21820. if (glyph.isZeroWidthDiacritic) {
  21821. scaledDim = 0;
  21822. }
  21823. if (!font.vertical) {
  21824. scaledDim *= textState.textHScale;
  21825. textState.translateTextMatrix(scaledDim, 0);
  21826. textChunk.width += scaledDim;
  21827. } else {
  21828. textState.translateTextMatrix(0, scaledDim);
  21829. scaledDim = Math.abs(scaledDim);
  21830. textChunk.height += scaledDim;
  21831. }
  21832. if (scaledDim) {
  21833. textChunk.prevTransform = getCurrentTextTransform();
  21834. }
  21835. if (glyph.isWhitespace) {
  21836. textChunk.str.push(" ");
  21837. } else {
  21838. let glyphUnicode = glyph.unicode;
  21839. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  21840. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  21841. textChunk.str.push(glyphUnicode);
  21842. }
  21843. if (charSpacing) {
  21844. if (!font.vertical) {
  21845. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21846. } else {
  21847. textState.translateTextMatrix(0, -charSpacing);
  21848. }
  21849. }
  21850. }
  21851. }
  21852. function appendEOL() {
  21853. if (textContentItem.initialized) {
  21854. textContentItem.hasEOL = true;
  21855. flushTextContentItem();
  21856. } else {
  21857. textContent.items.push({
  21858. str: "",
  21859. dir: "ltr",
  21860. width: 0,
  21861. height: 0,
  21862. transform: getCurrentTextTransform(),
  21863. fontName: textState.font.loadedName,
  21864. hasEOL: true
  21865. });
  21866. }
  21867. }
  21868. function addFakeSpaces(width, transf, textOrientation) {
  21869. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  21870. if (textContentItem.initialized) {
  21871. textContentItem.str.push(" ");
  21872. }
  21873. return false;
  21874. }
  21875. const fontName = textContentItem.fontName;
  21876. let height = 0;
  21877. if (textContentItem.vertical) {
  21878. height = width;
  21879. width = 0;
  21880. }
  21881. flushTextContentItem();
  21882. textContent.items.push({
  21883. str: " ",
  21884. dir: "ltr",
  21885. width: Math.abs(width),
  21886. height: Math.abs(height),
  21887. transform: transf || getCurrentTextTransform(),
  21888. fontName,
  21889. hasEOL: false
  21890. });
  21891. return true;
  21892. }
  21893. function flushTextContentItem() {
  21894. if (!textContentItem.initialized || !textContentItem.str) {
  21895. return;
  21896. }
  21897. if (!textContentItem.vertical) {
  21898. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21899. } else {
  21900. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21901. }
  21902. textContent.items.push(runBidiTransform(textContentItem));
  21903. textContentItem.initialized = false;
  21904. textContentItem.str.length = 0;
  21905. }
  21906. function enqueueChunk(batch = false) {
  21907. const length = textContent.items.length;
  21908. if (length === 0) {
  21909. return;
  21910. }
  21911. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  21912. return;
  21913. }
  21914. sink.enqueue(textContent, length);
  21915. textContent.items = [];
  21916. textContent.styles = Object.create(null);
  21917. }
  21918. const timeSlotManager = new TimeSlotManager();
  21919. return new Promise(function promiseBody(resolve, reject) {
  21920. const next = function (promise) {
  21921. enqueueChunk(true);
  21922. Promise.all([promise, sink.ready]).then(function () {
  21923. try {
  21924. promiseBody(resolve, reject);
  21925. } catch (ex) {
  21926. reject(ex);
  21927. }
  21928. }, reject);
  21929. };
  21930. task.ensureNotTerminated();
  21931. timeSlotManager.reset();
  21932. const operation = {};
  21933. let stop,
  21934. args = [];
  21935. while (!(stop = timeSlotManager.check())) {
  21936. args.length = 0;
  21937. operation.args = args;
  21938. if (!preprocessor.read(operation)) {
  21939. break;
  21940. }
  21941. textState = stateManager.state;
  21942. const fn = operation.fn;
  21943. args = operation.args;
  21944. switch (fn | 0) {
  21945. case _util.OPS.setFont:
  21946. var fontNameArg = args[0].name,
  21947. fontSizeArg = args[1];
  21948. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  21949. break;
  21950. }
  21951. flushTextContentItem();
  21952. textState.fontName = fontNameArg;
  21953. textState.fontSize = fontSizeArg;
  21954. next(handleSetFont(fontNameArg, null));
  21955. return;
  21956. case _util.OPS.setTextRise:
  21957. textState.textRise = args[0];
  21958. break;
  21959. case _util.OPS.setHScale:
  21960. textState.textHScale = args[0] / 100;
  21961. break;
  21962. case _util.OPS.setLeading:
  21963. textState.leading = args[0];
  21964. break;
  21965. case _util.OPS.moveText:
  21966. textState.translateTextLineMatrix(args[0], args[1]);
  21967. textState.textMatrix = textState.textLineMatrix.slice();
  21968. break;
  21969. case _util.OPS.setLeadingMoveText:
  21970. textState.leading = -args[1];
  21971. textState.translateTextLineMatrix(args[0], args[1]);
  21972. textState.textMatrix = textState.textLineMatrix.slice();
  21973. break;
  21974. case _util.OPS.nextLine:
  21975. textState.carriageReturn();
  21976. break;
  21977. case _util.OPS.setTextMatrix:
  21978. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  21979. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  21980. updateAdvanceScale();
  21981. break;
  21982. case _util.OPS.setCharSpacing:
  21983. textState.charSpacing = args[0];
  21984. break;
  21985. case _util.OPS.setWordSpacing:
  21986. textState.wordSpacing = args[0];
  21987. break;
  21988. case _util.OPS.beginText:
  21989. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  21990. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  21991. break;
  21992. case _util.OPS.showSpacedText:
  21993. if (!stateManager.state.font) {
  21994. self.ensureStateFont(stateManager.state);
  21995. continue;
  21996. }
  21997. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  21998. const elements = args[0];
  21999. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  22000. const item = elements[i];
  22001. if (typeof item === "string") {
  22002. showSpacedTextBuffer.push(item);
  22003. } else if (typeof item === "number" && item !== 0) {
  22004. const str = showSpacedTextBuffer.join("");
  22005. showSpacedTextBuffer.length = 0;
  22006. buildTextContentItem({
  22007. chars: str,
  22008. extraSpacing: item * spaceFactor
  22009. });
  22010. }
  22011. }
  22012. const item = elements[elements.length - 1];
  22013. if (typeof item === "string") {
  22014. showSpacedTextBuffer.push(item);
  22015. }
  22016. if (showSpacedTextBuffer.length > 0) {
  22017. const str = showSpacedTextBuffer.join("");
  22018. showSpacedTextBuffer.length = 0;
  22019. buildTextContentItem({
  22020. chars: str,
  22021. extraSpacing: 0
  22022. });
  22023. }
  22024. break;
  22025. case _util.OPS.showText:
  22026. if (!stateManager.state.font) {
  22027. self.ensureStateFont(stateManager.state);
  22028. continue;
  22029. }
  22030. buildTextContentItem({
  22031. chars: args[0],
  22032. extraSpacing: 0
  22033. });
  22034. break;
  22035. case _util.OPS.nextLineShowText:
  22036. if (!stateManager.state.font) {
  22037. self.ensureStateFont(stateManager.state);
  22038. continue;
  22039. }
  22040. textState.carriageReturn();
  22041. buildTextContentItem({
  22042. chars: args[0],
  22043. extraSpacing: 0
  22044. });
  22045. break;
  22046. case _util.OPS.nextLineSetSpacingShowText:
  22047. if (!stateManager.state.font) {
  22048. self.ensureStateFont(stateManager.state);
  22049. continue;
  22050. }
  22051. textState.wordSpacing = args[0];
  22052. textState.charSpacing = args[1];
  22053. textState.carriageReturn();
  22054. buildTextContentItem({
  22055. chars: args[2],
  22056. extraSpacing: 0
  22057. });
  22058. break;
  22059. case _util.OPS.paintXObject:
  22060. flushTextContentItem();
  22061. if (!xobjs) {
  22062. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  22063. }
  22064. var isValidName = args[0] instanceof _primitives.Name;
  22065. var name = args[0].name;
  22066. if (isValidName && emptyXObjectCache.getByName(name)) {
  22067. break;
  22068. }
  22069. next(new Promise(function (resolveXObject, rejectXObject) {
  22070. if (!isValidName) {
  22071. throw new _util.FormatError("XObject must be referred to by name.");
  22072. }
  22073. let xobj = xobjs.getRaw(name);
  22074. if (xobj instanceof _primitives.Ref) {
  22075. if (emptyXObjectCache.getByRef(xobj)) {
  22076. resolveXObject();
  22077. return;
  22078. }
  22079. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  22080. if (globalImage) {
  22081. resolveXObject();
  22082. return;
  22083. }
  22084. xobj = xref.fetch(xobj);
  22085. }
  22086. if (!(xobj instanceof _base_stream.BaseStream)) {
  22087. throw new _util.FormatError("XObject should be a stream");
  22088. }
  22089. const type = xobj.dict.get("Subtype");
  22090. if (!(type instanceof _primitives.Name)) {
  22091. throw new _util.FormatError("XObject should have a Name subtype");
  22092. }
  22093. if (type.name !== "Form") {
  22094. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22095. resolveXObject();
  22096. return;
  22097. }
  22098. const currentState = stateManager.state.clone();
  22099. const xObjStateManager = new StateManager(currentState);
  22100. const matrix = xobj.dict.getArray("Matrix");
  22101. if (Array.isArray(matrix) && matrix.length === 6) {
  22102. xObjStateManager.transform(matrix);
  22103. }
  22104. enqueueChunk();
  22105. const sinkWrapper = {
  22106. enqueueInvoked: false,
  22107. enqueue(chunk, size) {
  22108. this.enqueueInvoked = true;
  22109. sink.enqueue(chunk, size);
  22110. },
  22111. get desiredSize() {
  22112. return sink.desiredSize;
  22113. },
  22114. get ready() {
  22115. return sink.ready;
  22116. }
  22117. };
  22118. self.getTextContent({
  22119. stream: xobj,
  22120. task,
  22121. resources: xobj.dict.get("Resources") || resources,
  22122. stateManager: xObjStateManager,
  22123. combineTextItems,
  22124. includeMarkedContent,
  22125. sink: sinkWrapper,
  22126. seenStyles,
  22127. viewBox
  22128. }).then(function () {
  22129. if (!sinkWrapper.enqueueInvoked) {
  22130. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22131. }
  22132. resolveXObject();
  22133. }, rejectXObject);
  22134. }).catch(function (reason) {
  22135. if (reason instanceof _util.AbortException) {
  22136. return;
  22137. }
  22138. if (self.options.ignoreErrors) {
  22139. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  22140. return;
  22141. }
  22142. throw reason;
  22143. }));
  22144. return;
  22145. case _util.OPS.setGState:
  22146. isValidName = args[0] instanceof _primitives.Name;
  22147. name = args[0].name;
  22148. if (isValidName && emptyGStateCache.getByName(name)) {
  22149. break;
  22150. }
  22151. next(new Promise(function (resolveGState, rejectGState) {
  22152. if (!isValidName) {
  22153. throw new _util.FormatError("GState must be referred to by name.");
  22154. }
  22155. const extGState = resources.get("ExtGState");
  22156. if (!(extGState instanceof _primitives.Dict)) {
  22157. throw new _util.FormatError("ExtGState should be a dictionary.");
  22158. }
  22159. const gState = extGState.get(name);
  22160. if (!(gState instanceof _primitives.Dict)) {
  22161. throw new _util.FormatError("GState should be a dictionary.");
  22162. }
  22163. const gStateFont = gState.get("Font");
  22164. if (!gStateFont) {
  22165. emptyGStateCache.set(name, gState.objId, true);
  22166. resolveGState();
  22167. return;
  22168. }
  22169. flushTextContentItem();
  22170. textState.fontName = null;
  22171. textState.fontSize = gStateFont[1];
  22172. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  22173. }).catch(function (reason) {
  22174. if (reason instanceof _util.AbortException) {
  22175. return;
  22176. }
  22177. if (self.options.ignoreErrors) {
  22178. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  22179. return;
  22180. }
  22181. throw reason;
  22182. }));
  22183. return;
  22184. case _util.OPS.beginMarkedContent:
  22185. if (includeMarkedContent) {
  22186. textContent.items.push({
  22187. type: "beginMarkedContent",
  22188. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  22189. });
  22190. }
  22191. break;
  22192. case _util.OPS.beginMarkedContentProps:
  22193. if (includeMarkedContent) {
  22194. flushTextContentItem();
  22195. let mcid = null;
  22196. if (args[1] instanceof _primitives.Dict) {
  22197. mcid = args[1].get("MCID");
  22198. }
  22199. textContent.items.push({
  22200. type: "beginMarkedContentProps",
  22201. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  22202. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  22203. });
  22204. }
  22205. break;
  22206. case _util.OPS.endMarkedContent:
  22207. if (includeMarkedContent) {
  22208. flushTextContentItem();
  22209. textContent.items.push({
  22210. type: "endMarkedContent"
  22211. });
  22212. }
  22213. break;
  22214. }
  22215. if (textContent.items.length >= sink.desiredSize) {
  22216. stop = true;
  22217. break;
  22218. }
  22219. }
  22220. if (stop) {
  22221. next(deferred);
  22222. return;
  22223. }
  22224. flushTextContentItem();
  22225. enqueueChunk();
  22226. resolve();
  22227. }).catch(reason => {
  22228. if (reason instanceof _util.AbortException) {
  22229. return;
  22230. }
  22231. if (this.options.ignoreErrors) {
  22232. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  22233. flushTextContentItem();
  22234. enqueueChunk();
  22235. return;
  22236. }
  22237. throw reason;
  22238. });
  22239. }
  22240. extractDataStructures(dict, baseDict, properties) {
  22241. const xref = this.xref;
  22242. let cidToGidBytes;
  22243. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  22244. if (properties.composite) {
  22245. const cidSystemInfo = dict.get("CIDSystemInfo");
  22246. if (cidSystemInfo instanceof _primitives.Dict) {
  22247. properties.cidSystemInfo = {
  22248. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  22249. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  22250. supplement: cidSystemInfo.get("Supplement")
  22251. };
  22252. }
  22253. const cidToGidMap = dict.get("CIDToGIDMap");
  22254. if (cidToGidMap instanceof _base_stream.BaseStream) {
  22255. cidToGidBytes = cidToGidMap.getBytes();
  22256. }
  22257. }
  22258. const differences = [];
  22259. let baseEncodingName = null;
  22260. let encoding;
  22261. if (dict.has("Encoding")) {
  22262. encoding = dict.get("Encoding");
  22263. if (encoding instanceof _primitives.Dict) {
  22264. baseEncodingName = encoding.get("BaseEncoding");
  22265. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  22266. if (encoding.has("Differences")) {
  22267. const diffEncoding = encoding.get("Differences");
  22268. let index = 0;
  22269. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  22270. const data = xref.fetchIfRef(diffEncoding[j]);
  22271. if (typeof data === "number") {
  22272. index = data;
  22273. } else if (data instanceof _primitives.Name) {
  22274. differences[index++] = data.name;
  22275. } else {
  22276. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  22277. }
  22278. }
  22279. }
  22280. } else if (encoding instanceof _primitives.Name) {
  22281. baseEncodingName = encoding.name;
  22282. } else {
  22283. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  22284. }
  22285. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  22286. baseEncodingName = null;
  22287. }
  22288. }
  22289. if (baseEncodingName) {
  22290. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22291. } else {
  22292. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  22293. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  22294. encoding = _encodings.StandardEncoding;
  22295. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  22296. encoding = _encodings.WinAnsiEncoding;
  22297. }
  22298. if (isSymbolicFont) {
  22299. encoding = _encodings.MacRomanEncoding;
  22300. if (!properties.file || properties.isInternalFont) {
  22301. if (/Symbol/i.test(properties.name)) {
  22302. encoding = _encodings.SymbolSetEncoding;
  22303. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  22304. encoding = _encodings.ZapfDingbatsEncoding;
  22305. }
  22306. }
  22307. }
  22308. properties.defaultEncoding = encoding;
  22309. }
  22310. properties.differences = differences;
  22311. properties.baseEncodingName = baseEncodingName;
  22312. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  22313. properties.dict = dict;
  22314. return toUnicodePromise.then(readToUnicode => {
  22315. properties.toUnicode = readToUnicode;
  22316. return this.buildToUnicode(properties);
  22317. }).then(builtToUnicode => {
  22318. properties.toUnicode = builtToUnicode;
  22319. if (cidToGidBytes) {
  22320. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  22321. }
  22322. return properties;
  22323. });
  22324. }
  22325. _simpleFontToUnicode(properties, forceGlyphs = false) {
  22326. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  22327. const toUnicode = [];
  22328. const encoding = properties.defaultEncoding.slice();
  22329. const baseEncodingName = properties.baseEncodingName;
  22330. const differences = properties.differences;
  22331. for (const charcode in differences) {
  22332. const glyphName = differences[charcode];
  22333. if (glyphName === ".notdef") {
  22334. continue;
  22335. }
  22336. encoding[charcode] = glyphName;
  22337. }
  22338. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22339. for (const charcode in encoding) {
  22340. let glyphName = encoding[charcode];
  22341. if (glyphName === "") {
  22342. continue;
  22343. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  22344. let code = 0;
  22345. switch (glyphName[0]) {
  22346. case "G":
  22347. if (glyphName.length === 3) {
  22348. code = parseInt(glyphName.substring(1), 16);
  22349. }
  22350. break;
  22351. case "g":
  22352. if (glyphName.length === 5) {
  22353. code = parseInt(glyphName.substring(1), 16);
  22354. }
  22355. break;
  22356. case "C":
  22357. case "c":
  22358. if (glyphName.length >= 3 && glyphName.length <= 4) {
  22359. const codeStr = glyphName.substring(1);
  22360. if (forceGlyphs) {
  22361. code = parseInt(codeStr, 16);
  22362. break;
  22363. }
  22364. code = +codeStr;
  22365. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  22366. return this._simpleFontToUnicode(properties, true);
  22367. }
  22368. }
  22369. break;
  22370. default:
  22371. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22372. if (unicode !== -1) {
  22373. code = unicode;
  22374. }
  22375. }
  22376. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  22377. if (baseEncodingName && code === +charcode) {
  22378. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22379. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  22380. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22381. continue;
  22382. }
  22383. }
  22384. toUnicode[charcode] = String.fromCodePoint(code);
  22385. }
  22386. continue;
  22387. }
  22388. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22389. }
  22390. return toUnicode;
  22391. }
  22392. async buildToUnicode(properties) {
  22393. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  22394. if (properties.hasIncludedToUnicodeMap) {
  22395. if (!properties.composite && properties.hasEncoding) {
  22396. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  22397. }
  22398. return properties.toUnicode;
  22399. }
  22400. if (!properties.composite) {
  22401. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  22402. }
  22403. 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"))) {
  22404. const {
  22405. registry,
  22406. ordering
  22407. } = properties.cidSystemInfo;
  22408. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  22409. const ucs2CMap = await _cmap.CMapFactory.create({
  22410. encoding: ucs2CMapName,
  22411. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22412. useCMap: null
  22413. });
  22414. const toUnicode = [];
  22415. properties.cMap.forEach(function (charcode, cid) {
  22416. if (cid > 0xffff) {
  22417. throw new _util.FormatError("Max size of CID is 65,535");
  22418. }
  22419. const ucs2 = ucs2CMap.lookup(cid);
  22420. if (ucs2) {
  22421. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  22422. }
  22423. });
  22424. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  22425. }
  22426. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  22427. }
  22428. readToUnicode(cmapObj) {
  22429. if (!cmapObj) {
  22430. return Promise.resolve(null);
  22431. }
  22432. if (cmapObj instanceof _primitives.Name) {
  22433. return _cmap.CMapFactory.create({
  22434. encoding: cmapObj,
  22435. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22436. useCMap: null
  22437. }).then(function (cmap) {
  22438. if (cmap instanceof _cmap.IdentityCMap) {
  22439. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22440. }
  22441. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  22442. });
  22443. } else if (cmapObj instanceof _base_stream.BaseStream) {
  22444. return _cmap.CMapFactory.create({
  22445. encoding: cmapObj,
  22446. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22447. useCMap: null
  22448. }).then(function (cmap) {
  22449. if (cmap instanceof _cmap.IdentityCMap) {
  22450. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22451. }
  22452. const map = new Array(cmap.length);
  22453. cmap.forEach(function (charCode, token) {
  22454. if (typeof token === "number") {
  22455. map[charCode] = String.fromCodePoint(token);
  22456. return;
  22457. }
  22458. const str = [];
  22459. for (let k = 0; k < token.length; k += 2) {
  22460. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22461. if ((w1 & 0xf800) !== 0xd800) {
  22462. str.push(w1);
  22463. continue;
  22464. }
  22465. k += 2;
  22466. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22467. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  22468. }
  22469. map[charCode] = String.fromCodePoint.apply(String, str);
  22470. });
  22471. return new _to_unicode_map.ToUnicodeMap(map);
  22472. }, reason => {
  22473. if (reason instanceof _util.AbortException) {
  22474. return null;
  22475. }
  22476. if (this.options.ignoreErrors) {
  22477. this.handler.send("UnsupportedFeature", {
  22478. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  22479. });
  22480. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  22481. return null;
  22482. }
  22483. throw reason;
  22484. });
  22485. }
  22486. return Promise.resolve(null);
  22487. }
  22488. readCidToGidMap(glyphsData, toUnicode) {
  22489. const result = [];
  22490. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  22491. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  22492. const code = j >> 1;
  22493. if (glyphID === 0 && !toUnicode.has(code)) {
  22494. continue;
  22495. }
  22496. result[code] = glyphID;
  22497. }
  22498. return result;
  22499. }
  22500. extractWidths(dict, descriptor, properties) {
  22501. const xref = this.xref;
  22502. let glyphsWidths = [];
  22503. let defaultWidth = 0;
  22504. const glyphsVMetrics = [];
  22505. let defaultVMetrics;
  22506. let i, ii, j, jj, start, code, widths;
  22507. if (properties.composite) {
  22508. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  22509. widths = dict.get("W");
  22510. if (widths) {
  22511. for (i = 0, ii = widths.length; i < ii; i++) {
  22512. start = xref.fetchIfRef(widths[i++]);
  22513. code = xref.fetchIfRef(widths[i]);
  22514. if (Array.isArray(code)) {
  22515. for (j = 0, jj = code.length; j < jj; j++) {
  22516. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  22517. }
  22518. } else {
  22519. const width = xref.fetchIfRef(widths[++i]);
  22520. for (j = start; j <= code; j++) {
  22521. glyphsWidths[j] = width;
  22522. }
  22523. }
  22524. }
  22525. }
  22526. if (properties.vertical) {
  22527. let vmetrics = dict.getArray("DW2") || [880, -1000];
  22528. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  22529. vmetrics = dict.get("W2");
  22530. if (vmetrics) {
  22531. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  22532. start = xref.fetchIfRef(vmetrics[i++]);
  22533. code = xref.fetchIfRef(vmetrics[i]);
  22534. if (Array.isArray(code)) {
  22535. for (j = 0, jj = code.length; j < jj; j++) {
  22536. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  22537. }
  22538. } else {
  22539. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  22540. for (j = start; j <= code; j++) {
  22541. glyphsVMetrics[j] = vmetric;
  22542. }
  22543. }
  22544. }
  22545. }
  22546. }
  22547. } else {
  22548. const firstChar = properties.firstChar;
  22549. widths = dict.get("Widths");
  22550. if (widths) {
  22551. j = firstChar;
  22552. for (i = 0, ii = widths.length; i < ii; i++) {
  22553. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  22554. }
  22555. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  22556. } else {
  22557. const baseFontName = dict.get("BaseFont");
  22558. if (baseFontName instanceof _primitives.Name) {
  22559. const metrics = this.getBaseFontMetrics(baseFontName.name);
  22560. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  22561. defaultWidth = metrics.defaultWidth;
  22562. }
  22563. }
  22564. }
  22565. let isMonospace = true;
  22566. let firstWidth = defaultWidth;
  22567. for (const glyph in glyphsWidths) {
  22568. const glyphWidth = glyphsWidths[glyph];
  22569. if (!glyphWidth) {
  22570. continue;
  22571. }
  22572. if (!firstWidth) {
  22573. firstWidth = glyphWidth;
  22574. continue;
  22575. }
  22576. if (firstWidth !== glyphWidth) {
  22577. isMonospace = false;
  22578. break;
  22579. }
  22580. }
  22581. if (isMonospace) {
  22582. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  22583. }
  22584. properties.defaultWidth = defaultWidth;
  22585. properties.widths = glyphsWidths;
  22586. properties.defaultVMetrics = defaultVMetrics;
  22587. properties.vmetrics = glyphsVMetrics;
  22588. }
  22589. isSerifFont(baseFontName) {
  22590. const fontNameWoStyle = baseFontName.split("-")[0];
  22591. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  22592. }
  22593. getBaseFontMetrics(name) {
  22594. let defaultWidth = 0;
  22595. let widths = Object.create(null);
  22596. let monospace = false;
  22597. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  22598. let lookupName = stdFontMap[name] || name;
  22599. const Metrics = (0, _metrics.getMetrics)();
  22600. if (!(lookupName in Metrics)) {
  22601. if (this.isSerifFont(name)) {
  22602. lookupName = "Times-Roman";
  22603. } else {
  22604. lookupName = "Helvetica";
  22605. }
  22606. }
  22607. const glyphWidths = Metrics[lookupName];
  22608. if (typeof glyphWidths === "number") {
  22609. defaultWidth = glyphWidths;
  22610. monospace = true;
  22611. } else {
  22612. widths = glyphWidths();
  22613. }
  22614. return {
  22615. defaultWidth,
  22616. monospace,
  22617. widths
  22618. };
  22619. }
  22620. buildCharCodeToWidth(widthsByGlyphName, properties) {
  22621. const widths = Object.create(null);
  22622. const differences = properties.differences;
  22623. const encoding = properties.defaultEncoding;
  22624. for (let charCode = 0; charCode < 256; charCode++) {
  22625. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  22626. widths[charCode] = widthsByGlyphName[differences[charCode]];
  22627. continue;
  22628. }
  22629. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  22630. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  22631. continue;
  22632. }
  22633. }
  22634. return widths;
  22635. }
  22636. preEvaluateFont(dict) {
  22637. const baseDict = dict;
  22638. let type = dict.get("Subtype");
  22639. if (!(type instanceof _primitives.Name)) {
  22640. throw new _util.FormatError("invalid font Subtype");
  22641. }
  22642. let composite = false;
  22643. let hash, toUnicode;
  22644. if (type.name === "Type0") {
  22645. const df = dict.get("DescendantFonts");
  22646. if (!df) {
  22647. throw new _util.FormatError("Descendant fonts are not specified");
  22648. }
  22649. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  22650. if (!(dict instanceof _primitives.Dict)) {
  22651. throw new _util.FormatError("Descendant font is not a dictionary.");
  22652. }
  22653. type = dict.get("Subtype");
  22654. if (!(type instanceof _primitives.Name)) {
  22655. throw new _util.FormatError("invalid font Subtype");
  22656. }
  22657. composite = true;
  22658. }
  22659. const firstChar = dict.get("FirstChar") || 0,
  22660. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  22661. const descriptor = dict.get("FontDescriptor");
  22662. if (descriptor) {
  22663. hash = new _murmurhash.MurmurHash3_64();
  22664. const encoding = baseDict.getRaw("Encoding");
  22665. if (encoding instanceof _primitives.Name) {
  22666. hash.update(encoding.name);
  22667. } else if (encoding instanceof _primitives.Ref) {
  22668. hash.update(encoding.toString());
  22669. } else if (encoding instanceof _primitives.Dict) {
  22670. for (const entry of encoding.getRawValues()) {
  22671. if (entry instanceof _primitives.Name) {
  22672. hash.update(entry.name);
  22673. } else if (entry instanceof _primitives.Ref) {
  22674. hash.update(entry.toString());
  22675. } else if (Array.isArray(entry)) {
  22676. const diffLength = entry.length,
  22677. diffBuf = new Array(diffLength);
  22678. for (let j = 0; j < diffLength; j++) {
  22679. const diffEntry = entry[j];
  22680. if (diffEntry instanceof _primitives.Name) {
  22681. diffBuf[j] = diffEntry.name;
  22682. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  22683. diffBuf[j] = diffEntry.toString();
  22684. }
  22685. }
  22686. hash.update(diffBuf.join());
  22687. }
  22688. }
  22689. }
  22690. hash.update(`${firstChar}-${lastChar}`);
  22691. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  22692. if (toUnicode instanceof _base_stream.BaseStream) {
  22693. const stream = toUnicode.str || toUnicode;
  22694. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  22695. hash.update(uint8array);
  22696. } else if (toUnicode instanceof _primitives.Name) {
  22697. hash.update(toUnicode.name);
  22698. }
  22699. const widths = dict.get("Widths") || baseDict.get("Widths");
  22700. if (Array.isArray(widths)) {
  22701. const widthsBuf = [];
  22702. for (const entry of widths) {
  22703. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  22704. widthsBuf.push(entry.toString());
  22705. }
  22706. }
  22707. hash.update(widthsBuf.join());
  22708. }
  22709. if (composite) {
  22710. hash.update("compositeFont");
  22711. const compositeWidths = dict.get("W") || baseDict.get("W");
  22712. if (Array.isArray(compositeWidths)) {
  22713. const widthsBuf = [];
  22714. for (const entry of compositeWidths) {
  22715. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  22716. widthsBuf.push(entry.toString());
  22717. } else if (Array.isArray(entry)) {
  22718. const subWidthsBuf = [];
  22719. for (const element of entry) {
  22720. if (typeof element === "number" || element instanceof _primitives.Ref) {
  22721. subWidthsBuf.push(element.toString());
  22722. }
  22723. }
  22724. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  22725. }
  22726. }
  22727. hash.update(widthsBuf.join());
  22728. }
  22729. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  22730. if (cidToGidMap instanceof _primitives.Name) {
  22731. hash.update(cidToGidMap.name);
  22732. } else if (cidToGidMap instanceof _primitives.Ref) {
  22733. hash.update(cidToGidMap.toString());
  22734. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  22735. hash.update(cidToGidMap.peekBytes());
  22736. }
  22737. }
  22738. }
  22739. return {
  22740. descriptor,
  22741. dict,
  22742. baseDict,
  22743. composite,
  22744. type: type.name,
  22745. firstChar,
  22746. lastChar,
  22747. toUnicode,
  22748. hash: hash ? hash.hexdigest() : ""
  22749. };
  22750. }
  22751. async translateFont({
  22752. descriptor,
  22753. dict,
  22754. baseDict,
  22755. composite,
  22756. type,
  22757. firstChar,
  22758. lastChar,
  22759. toUnicode,
  22760. cssFontInfo
  22761. }) {
  22762. const isType3Font = type === "Type3";
  22763. let properties;
  22764. if (!descriptor) {
  22765. if (isType3Font) {
  22766. descriptor = new _primitives.Dict(null);
  22767. descriptor.set("FontName", _primitives.Name.get(type));
  22768. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  22769. } else {
  22770. let baseFontName = dict.get("BaseFont");
  22771. if (!(baseFontName instanceof _primitives.Name)) {
  22772. throw new _util.FormatError("Base font is not specified");
  22773. }
  22774. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  22775. const metrics = this.getBaseFontMetrics(baseFontName);
  22776. const fontNameWoStyle = baseFontName.split("-")[0];
  22777. 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);
  22778. properties = {
  22779. type,
  22780. name: baseFontName,
  22781. loadedName: baseDict.loadedName,
  22782. widths: metrics.widths,
  22783. defaultWidth: metrics.defaultWidth,
  22784. isSimulatedFlags: true,
  22785. flags,
  22786. firstChar,
  22787. lastChar,
  22788. toUnicode,
  22789. xHeight: 0,
  22790. capHeight: 0,
  22791. italicAngle: 0,
  22792. isType3Font
  22793. };
  22794. const widths = dict.get("Widths");
  22795. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  22796. let file = null;
  22797. if (standardFontName) {
  22798. properties.isStandardFont = true;
  22799. file = await this.fetchStandardFontData(standardFontName);
  22800. properties.isInternalFont = !!file;
  22801. }
  22802. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  22803. if (widths) {
  22804. const glyphWidths = [];
  22805. let j = firstChar;
  22806. for (let i = 0, ii = widths.length; i < ii; i++) {
  22807. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  22808. }
  22809. newProperties.widths = glyphWidths;
  22810. } else {
  22811. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  22812. }
  22813. return new _fonts.Font(baseFontName, file, newProperties);
  22814. });
  22815. }
  22816. }
  22817. let fontName = descriptor.get("FontName");
  22818. let baseFont = dict.get("BaseFont");
  22819. if (typeof fontName === "string") {
  22820. fontName = _primitives.Name.get(fontName);
  22821. }
  22822. if (typeof baseFont === "string") {
  22823. baseFont = _primitives.Name.get(baseFont);
  22824. }
  22825. if (!isType3Font) {
  22826. const fontNameStr = fontName && fontName.name;
  22827. const baseFontStr = baseFont && baseFont.name;
  22828. if (fontNameStr !== baseFontStr) {
  22829. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  22830. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  22831. fontName = baseFont;
  22832. }
  22833. }
  22834. }
  22835. fontName = fontName || baseFont;
  22836. if (!(fontName instanceof _primitives.Name)) {
  22837. throw new _util.FormatError("invalid font name");
  22838. }
  22839. let fontFile, subtype, length1, length2, length3;
  22840. try {
  22841. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  22842. } catch (ex) {
  22843. if (!this.options.ignoreErrors) {
  22844. throw ex;
  22845. }
  22846. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  22847. fontFile = new _stream.NullStream();
  22848. }
  22849. let isStandardFont = false;
  22850. let isInternalFont = false;
  22851. let glyphScaleFactors = null;
  22852. if (fontFile) {
  22853. if (fontFile.dict) {
  22854. const subtypeEntry = fontFile.dict.get("Subtype");
  22855. if (subtypeEntry instanceof _primitives.Name) {
  22856. subtype = subtypeEntry.name;
  22857. }
  22858. length1 = fontFile.dict.get("Length1");
  22859. length2 = fontFile.dict.get("Length2");
  22860. length3 = fontFile.dict.get("Length3");
  22861. }
  22862. } else if (cssFontInfo) {
  22863. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  22864. if (standardFontName) {
  22865. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  22866. cssFontInfo.metrics = standardFontName.metrics || null;
  22867. glyphScaleFactors = standardFontName.factors || null;
  22868. fontFile = await this.fetchStandardFontData(standardFontName.name);
  22869. isInternalFont = !!fontFile;
  22870. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  22871. composite = true;
  22872. }
  22873. } else if (!isType3Font) {
  22874. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  22875. if (standardFontName) {
  22876. isStandardFont = true;
  22877. fontFile = await this.fetchStandardFontData(standardFontName);
  22878. isInternalFont = !!fontFile;
  22879. }
  22880. }
  22881. properties = {
  22882. type,
  22883. name: fontName.name,
  22884. subtype,
  22885. file: fontFile,
  22886. length1,
  22887. length2,
  22888. length3,
  22889. isStandardFont,
  22890. isInternalFont,
  22891. loadedName: baseDict.loadedName,
  22892. composite,
  22893. fixedPitch: false,
  22894. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  22895. firstChar,
  22896. lastChar,
  22897. toUnicode,
  22898. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  22899. ascent: descriptor.get("Ascent"),
  22900. descent: descriptor.get("Descent"),
  22901. xHeight: descriptor.get("XHeight") || 0,
  22902. capHeight: descriptor.get("CapHeight") || 0,
  22903. flags: descriptor.get("Flags"),
  22904. italicAngle: descriptor.get("ItalicAngle") || 0,
  22905. isType3Font,
  22906. cssFontInfo,
  22907. scaleFactors: glyphScaleFactors
  22908. };
  22909. if (composite) {
  22910. const cidEncoding = baseDict.get("Encoding");
  22911. if (cidEncoding instanceof _primitives.Name) {
  22912. properties.cidEncoding = cidEncoding.name;
  22913. }
  22914. const cMap = await _cmap.CMapFactory.create({
  22915. encoding: cidEncoding,
  22916. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22917. useCMap: null
  22918. });
  22919. properties.cMap = cMap;
  22920. properties.vertical = properties.cMap.vertical;
  22921. }
  22922. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  22923. this.extractWidths(dict, descriptor, newProperties);
  22924. return new _fonts.Font(fontName.name, fontFile, newProperties);
  22925. });
  22926. }
  22927. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  22928. function buildPath(fontChar) {
  22929. const glyphName = `${font.loadedName}_path_${fontChar}`;
  22930. try {
  22931. if (font.renderer.hasBuiltPath(fontChar)) {
  22932. return;
  22933. }
  22934. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  22935. } catch (reason) {
  22936. if (evaluatorOptions.ignoreErrors) {
  22937. handler.send("UnsupportedFeature", {
  22938. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  22939. });
  22940. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  22941. return;
  22942. }
  22943. throw reason;
  22944. }
  22945. }
  22946. for (const glyph of glyphs) {
  22947. buildPath(glyph.fontChar);
  22948. const accent = glyph.accent;
  22949. if (accent && accent.fontChar) {
  22950. buildPath(accent.fontChar);
  22951. }
  22952. }
  22953. }
  22954. static get fallbackFontDict() {
  22955. const dict = new _primitives.Dict();
  22956. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  22957. dict.set("Type", _primitives.Name.get("FallbackType"));
  22958. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  22959. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  22960. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  22961. }
  22962. }
  22963. exports.PartialEvaluator = PartialEvaluator;
  22964. class TranslatedFont {
  22965. constructor({
  22966. loadedName,
  22967. font,
  22968. dict,
  22969. evaluatorOptions
  22970. }) {
  22971. this.loadedName = loadedName;
  22972. this.font = font;
  22973. this.dict = dict;
  22974. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  22975. this.type3Loaded = null;
  22976. this.type3Dependencies = font.isType3Font ? new Set() : null;
  22977. this.sent = false;
  22978. }
  22979. send(handler) {
  22980. if (this.sent) {
  22981. return;
  22982. }
  22983. this.sent = true;
  22984. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  22985. }
  22986. fallback(handler) {
  22987. if (!this.font.data) {
  22988. return;
  22989. }
  22990. this.font.disableFontFace = true;
  22991. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  22992. }
  22993. loadType3Data(evaluator, resources, task) {
  22994. if (this.type3Loaded) {
  22995. return this.type3Loaded;
  22996. }
  22997. if (!this.font.isType3Font) {
  22998. throw new Error("Must be a Type3 font.");
  22999. }
  23000. const type3Evaluator = evaluator.clone({
  23001. ignoreErrors: false
  23002. });
  23003. type3Evaluator.parsingType3Font = true;
  23004. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  23005. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  23006. type3FontRefs.put(this.dict.objId);
  23007. }
  23008. type3Evaluator.type3FontRefs = type3FontRefs;
  23009. const translatedFont = this.font,
  23010. type3Dependencies = this.type3Dependencies;
  23011. let loadCharProcsPromise = Promise.resolve();
  23012. const charProcs = this.dict.get("CharProcs");
  23013. const fontResources = this.dict.get("Resources") || resources;
  23014. const charProcOperatorList = Object.create(null);
  23015. const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]);
  23016. for (const key of charProcs.getKeys()) {
  23017. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  23018. const glyphStream = charProcs.get(key);
  23019. const operatorList = new _operator_list.OperatorList();
  23020. return type3Evaluator.getOperatorList({
  23021. stream: glyphStream,
  23022. task,
  23023. resources: fontResources,
  23024. operatorList
  23025. }).then(() => {
  23026. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  23027. this._removeType3ColorOperators(operatorList, isEmptyBBox);
  23028. }
  23029. charProcOperatorList[key] = operatorList.getIR();
  23030. for (const dependency of operatorList.dependencies) {
  23031. type3Dependencies.add(dependency);
  23032. }
  23033. }).catch(function (reason) {
  23034. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  23035. const dummyOperatorList = new _operator_list.OperatorList();
  23036. charProcOperatorList[key] = dummyOperatorList.getIR();
  23037. });
  23038. });
  23039. }
  23040. this.type3Loaded = loadCharProcsPromise.then(() => {
  23041. translatedFont.charProcOperatorList = charProcOperatorList;
  23042. if (this._bbox) {
  23043. translatedFont.isCharBBox = true;
  23044. translatedFont.bbox = this._bbox;
  23045. }
  23046. });
  23047. return this.type3Loaded;
  23048. }
  23049. _removeType3ColorOperators(operatorList, isEmptyBBox = false) {
  23050. if (isEmptyBBox) {
  23051. if (!this._bbox) {
  23052. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  23053. }
  23054. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2));
  23055. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  23056. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  23057. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  23058. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  23059. }
  23060. let i = 1,
  23061. ii = operatorList.length;
  23062. while (i < ii) {
  23063. switch (operatorList.fnArray[i]) {
  23064. case _util.OPS.setStrokeColorSpace:
  23065. case _util.OPS.setFillColorSpace:
  23066. case _util.OPS.setStrokeColor:
  23067. case _util.OPS.setStrokeColorN:
  23068. case _util.OPS.setFillColor:
  23069. case _util.OPS.setFillColorN:
  23070. case _util.OPS.setStrokeGray:
  23071. case _util.OPS.setFillGray:
  23072. case _util.OPS.setStrokeRGBColor:
  23073. case _util.OPS.setFillRGBColor:
  23074. case _util.OPS.setStrokeCMYKColor:
  23075. case _util.OPS.setFillCMYKColor:
  23076. case _util.OPS.shadingFill:
  23077. case _util.OPS.setRenderingIntent:
  23078. operatorList.fnArray.splice(i, 1);
  23079. operatorList.argsArray.splice(i, 1);
  23080. ii--;
  23081. continue;
  23082. case _util.OPS.setGState:
  23083. const [gStateObj] = operatorList.argsArray[i];
  23084. let j = 0,
  23085. jj = gStateObj.length;
  23086. while (j < jj) {
  23087. const [gStateKey] = gStateObj[j];
  23088. switch (gStateKey) {
  23089. case "TR":
  23090. case "TR2":
  23091. case "HT":
  23092. case "BG":
  23093. case "BG2":
  23094. case "UCR":
  23095. case "UCR2":
  23096. gStateObj.splice(j, 1);
  23097. jj--;
  23098. continue;
  23099. }
  23100. j++;
  23101. }
  23102. break;
  23103. }
  23104. i++;
  23105. }
  23106. }
  23107. }
  23108. class StateManager {
  23109. constructor(initialState = new EvalState()) {
  23110. this.state = initialState;
  23111. this.stateStack = [];
  23112. }
  23113. save() {
  23114. const old = this.state;
  23115. this.stateStack.push(this.state);
  23116. this.state = old.clone();
  23117. }
  23118. restore() {
  23119. const prev = this.stateStack.pop();
  23120. if (prev) {
  23121. this.state = prev;
  23122. }
  23123. }
  23124. transform(args) {
  23125. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  23126. }
  23127. }
  23128. class TextState {
  23129. constructor() {
  23130. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23131. this.fontName = null;
  23132. this.fontSize = 0;
  23133. this.font = null;
  23134. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  23135. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  23136. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  23137. this.charSpacing = 0;
  23138. this.wordSpacing = 0;
  23139. this.leading = 0;
  23140. this.textHScale = 1;
  23141. this.textRise = 0;
  23142. }
  23143. setTextMatrix(a, b, c, d, e, f) {
  23144. const m = this.textMatrix;
  23145. m[0] = a;
  23146. m[1] = b;
  23147. m[2] = c;
  23148. m[3] = d;
  23149. m[4] = e;
  23150. m[5] = f;
  23151. }
  23152. setTextLineMatrix(a, b, c, d, e, f) {
  23153. const m = this.textLineMatrix;
  23154. m[0] = a;
  23155. m[1] = b;
  23156. m[2] = c;
  23157. m[3] = d;
  23158. m[4] = e;
  23159. m[5] = f;
  23160. }
  23161. translateTextMatrix(x, y) {
  23162. const m = this.textMatrix;
  23163. m[4] = m[0] * x + m[2] * y + m[4];
  23164. m[5] = m[1] * x + m[3] * y + m[5];
  23165. }
  23166. translateTextLineMatrix(x, y) {
  23167. const m = this.textLineMatrix;
  23168. m[4] = m[0] * x + m[2] * y + m[4];
  23169. m[5] = m[1] * x + m[3] * y + m[5];
  23170. }
  23171. carriageReturn() {
  23172. this.translateTextLineMatrix(0, -this.leading);
  23173. this.textMatrix = this.textLineMatrix.slice();
  23174. }
  23175. clone() {
  23176. const clone = Object.create(this);
  23177. clone.textMatrix = this.textMatrix.slice();
  23178. clone.textLineMatrix = this.textLineMatrix.slice();
  23179. clone.fontMatrix = this.fontMatrix.slice();
  23180. return clone;
  23181. }
  23182. }
  23183. class EvalState {
  23184. constructor() {
  23185. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23186. this.font = null;
  23187. this.textRenderingMode = _util.TextRenderingMode.FILL;
  23188. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  23189. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  23190. }
  23191. clone() {
  23192. return Object.create(this);
  23193. }
  23194. }
  23195. class EvaluatorPreprocessor {
  23196. static get opMap() {
  23197. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  23198. t.w = {
  23199. id: _util.OPS.setLineWidth,
  23200. numArgs: 1,
  23201. variableArgs: false
  23202. };
  23203. t.J = {
  23204. id: _util.OPS.setLineCap,
  23205. numArgs: 1,
  23206. variableArgs: false
  23207. };
  23208. t.j = {
  23209. id: _util.OPS.setLineJoin,
  23210. numArgs: 1,
  23211. variableArgs: false
  23212. };
  23213. t.M = {
  23214. id: _util.OPS.setMiterLimit,
  23215. numArgs: 1,
  23216. variableArgs: false
  23217. };
  23218. t.d = {
  23219. id: _util.OPS.setDash,
  23220. numArgs: 2,
  23221. variableArgs: false
  23222. };
  23223. t.ri = {
  23224. id: _util.OPS.setRenderingIntent,
  23225. numArgs: 1,
  23226. variableArgs: false
  23227. };
  23228. t.i = {
  23229. id: _util.OPS.setFlatness,
  23230. numArgs: 1,
  23231. variableArgs: false
  23232. };
  23233. t.gs = {
  23234. id: _util.OPS.setGState,
  23235. numArgs: 1,
  23236. variableArgs: false
  23237. };
  23238. t.q = {
  23239. id: _util.OPS.save,
  23240. numArgs: 0,
  23241. variableArgs: false
  23242. };
  23243. t.Q = {
  23244. id: _util.OPS.restore,
  23245. numArgs: 0,
  23246. variableArgs: false
  23247. };
  23248. t.cm = {
  23249. id: _util.OPS.transform,
  23250. numArgs: 6,
  23251. variableArgs: false
  23252. };
  23253. t.m = {
  23254. id: _util.OPS.moveTo,
  23255. numArgs: 2,
  23256. variableArgs: false
  23257. };
  23258. t.l = {
  23259. id: _util.OPS.lineTo,
  23260. numArgs: 2,
  23261. variableArgs: false
  23262. };
  23263. t.c = {
  23264. id: _util.OPS.curveTo,
  23265. numArgs: 6,
  23266. variableArgs: false
  23267. };
  23268. t.v = {
  23269. id: _util.OPS.curveTo2,
  23270. numArgs: 4,
  23271. variableArgs: false
  23272. };
  23273. t.y = {
  23274. id: _util.OPS.curveTo3,
  23275. numArgs: 4,
  23276. variableArgs: false
  23277. };
  23278. t.h = {
  23279. id: _util.OPS.closePath,
  23280. numArgs: 0,
  23281. variableArgs: false
  23282. };
  23283. t.re = {
  23284. id: _util.OPS.rectangle,
  23285. numArgs: 4,
  23286. variableArgs: false
  23287. };
  23288. t.S = {
  23289. id: _util.OPS.stroke,
  23290. numArgs: 0,
  23291. variableArgs: false
  23292. };
  23293. t.s = {
  23294. id: _util.OPS.closeStroke,
  23295. numArgs: 0,
  23296. variableArgs: false
  23297. };
  23298. t.f = {
  23299. id: _util.OPS.fill,
  23300. numArgs: 0,
  23301. variableArgs: false
  23302. };
  23303. t.F = {
  23304. id: _util.OPS.fill,
  23305. numArgs: 0,
  23306. variableArgs: false
  23307. };
  23308. t["f*"] = {
  23309. id: _util.OPS.eoFill,
  23310. numArgs: 0,
  23311. variableArgs: false
  23312. };
  23313. t.B = {
  23314. id: _util.OPS.fillStroke,
  23315. numArgs: 0,
  23316. variableArgs: false
  23317. };
  23318. t["B*"] = {
  23319. id: _util.OPS.eoFillStroke,
  23320. numArgs: 0,
  23321. variableArgs: false
  23322. };
  23323. t.b = {
  23324. id: _util.OPS.closeFillStroke,
  23325. numArgs: 0,
  23326. variableArgs: false
  23327. };
  23328. t["b*"] = {
  23329. id: _util.OPS.closeEOFillStroke,
  23330. numArgs: 0,
  23331. variableArgs: false
  23332. };
  23333. t.n = {
  23334. id: _util.OPS.endPath,
  23335. numArgs: 0,
  23336. variableArgs: false
  23337. };
  23338. t.W = {
  23339. id: _util.OPS.clip,
  23340. numArgs: 0,
  23341. variableArgs: false
  23342. };
  23343. t["W*"] = {
  23344. id: _util.OPS.eoClip,
  23345. numArgs: 0,
  23346. variableArgs: false
  23347. };
  23348. t.BT = {
  23349. id: _util.OPS.beginText,
  23350. numArgs: 0,
  23351. variableArgs: false
  23352. };
  23353. t.ET = {
  23354. id: _util.OPS.endText,
  23355. numArgs: 0,
  23356. variableArgs: false
  23357. };
  23358. t.Tc = {
  23359. id: _util.OPS.setCharSpacing,
  23360. numArgs: 1,
  23361. variableArgs: false
  23362. };
  23363. t.Tw = {
  23364. id: _util.OPS.setWordSpacing,
  23365. numArgs: 1,
  23366. variableArgs: false
  23367. };
  23368. t.Tz = {
  23369. id: _util.OPS.setHScale,
  23370. numArgs: 1,
  23371. variableArgs: false
  23372. };
  23373. t.TL = {
  23374. id: _util.OPS.setLeading,
  23375. numArgs: 1,
  23376. variableArgs: false
  23377. };
  23378. t.Tf = {
  23379. id: _util.OPS.setFont,
  23380. numArgs: 2,
  23381. variableArgs: false
  23382. };
  23383. t.Tr = {
  23384. id: _util.OPS.setTextRenderingMode,
  23385. numArgs: 1,
  23386. variableArgs: false
  23387. };
  23388. t.Ts = {
  23389. id: _util.OPS.setTextRise,
  23390. numArgs: 1,
  23391. variableArgs: false
  23392. };
  23393. t.Td = {
  23394. id: _util.OPS.moveText,
  23395. numArgs: 2,
  23396. variableArgs: false
  23397. };
  23398. t.TD = {
  23399. id: _util.OPS.setLeadingMoveText,
  23400. numArgs: 2,
  23401. variableArgs: false
  23402. };
  23403. t.Tm = {
  23404. id: _util.OPS.setTextMatrix,
  23405. numArgs: 6,
  23406. variableArgs: false
  23407. };
  23408. t["T*"] = {
  23409. id: _util.OPS.nextLine,
  23410. numArgs: 0,
  23411. variableArgs: false
  23412. };
  23413. t.Tj = {
  23414. id: _util.OPS.showText,
  23415. numArgs: 1,
  23416. variableArgs: false
  23417. };
  23418. t.TJ = {
  23419. id: _util.OPS.showSpacedText,
  23420. numArgs: 1,
  23421. variableArgs: false
  23422. };
  23423. t["'"] = {
  23424. id: _util.OPS.nextLineShowText,
  23425. numArgs: 1,
  23426. variableArgs: false
  23427. };
  23428. t['"'] = {
  23429. id: _util.OPS.nextLineSetSpacingShowText,
  23430. numArgs: 3,
  23431. variableArgs: false
  23432. };
  23433. t.d0 = {
  23434. id: _util.OPS.setCharWidth,
  23435. numArgs: 2,
  23436. variableArgs: false
  23437. };
  23438. t.d1 = {
  23439. id: _util.OPS.setCharWidthAndBounds,
  23440. numArgs: 6,
  23441. variableArgs: false
  23442. };
  23443. t.CS = {
  23444. id: _util.OPS.setStrokeColorSpace,
  23445. numArgs: 1,
  23446. variableArgs: false
  23447. };
  23448. t.cs = {
  23449. id: _util.OPS.setFillColorSpace,
  23450. numArgs: 1,
  23451. variableArgs: false
  23452. };
  23453. t.SC = {
  23454. id: _util.OPS.setStrokeColor,
  23455. numArgs: 4,
  23456. variableArgs: true
  23457. };
  23458. t.SCN = {
  23459. id: _util.OPS.setStrokeColorN,
  23460. numArgs: 33,
  23461. variableArgs: true
  23462. };
  23463. t.sc = {
  23464. id: _util.OPS.setFillColor,
  23465. numArgs: 4,
  23466. variableArgs: true
  23467. };
  23468. t.scn = {
  23469. id: _util.OPS.setFillColorN,
  23470. numArgs: 33,
  23471. variableArgs: true
  23472. };
  23473. t.G = {
  23474. id: _util.OPS.setStrokeGray,
  23475. numArgs: 1,
  23476. variableArgs: false
  23477. };
  23478. t.g = {
  23479. id: _util.OPS.setFillGray,
  23480. numArgs: 1,
  23481. variableArgs: false
  23482. };
  23483. t.RG = {
  23484. id: _util.OPS.setStrokeRGBColor,
  23485. numArgs: 3,
  23486. variableArgs: false
  23487. };
  23488. t.rg = {
  23489. id: _util.OPS.setFillRGBColor,
  23490. numArgs: 3,
  23491. variableArgs: false
  23492. };
  23493. t.K = {
  23494. id: _util.OPS.setStrokeCMYKColor,
  23495. numArgs: 4,
  23496. variableArgs: false
  23497. };
  23498. t.k = {
  23499. id: _util.OPS.setFillCMYKColor,
  23500. numArgs: 4,
  23501. variableArgs: false
  23502. };
  23503. t.sh = {
  23504. id: _util.OPS.shadingFill,
  23505. numArgs: 1,
  23506. variableArgs: false
  23507. };
  23508. t.BI = {
  23509. id: _util.OPS.beginInlineImage,
  23510. numArgs: 0,
  23511. variableArgs: false
  23512. };
  23513. t.ID = {
  23514. id: _util.OPS.beginImageData,
  23515. numArgs: 0,
  23516. variableArgs: false
  23517. };
  23518. t.EI = {
  23519. id: _util.OPS.endInlineImage,
  23520. numArgs: 1,
  23521. variableArgs: false
  23522. };
  23523. t.Do = {
  23524. id: _util.OPS.paintXObject,
  23525. numArgs: 1,
  23526. variableArgs: false
  23527. };
  23528. t.MP = {
  23529. id: _util.OPS.markPoint,
  23530. numArgs: 1,
  23531. variableArgs: false
  23532. };
  23533. t.DP = {
  23534. id: _util.OPS.markPointProps,
  23535. numArgs: 2,
  23536. variableArgs: false
  23537. };
  23538. t.BMC = {
  23539. id: _util.OPS.beginMarkedContent,
  23540. numArgs: 1,
  23541. variableArgs: false
  23542. };
  23543. t.BDC = {
  23544. id: _util.OPS.beginMarkedContentProps,
  23545. numArgs: 2,
  23546. variableArgs: false
  23547. };
  23548. t.EMC = {
  23549. id: _util.OPS.endMarkedContent,
  23550. numArgs: 0,
  23551. variableArgs: false
  23552. };
  23553. t.BX = {
  23554. id: _util.OPS.beginCompat,
  23555. numArgs: 0,
  23556. variableArgs: false
  23557. };
  23558. t.EX = {
  23559. id: _util.OPS.endCompat,
  23560. numArgs: 0,
  23561. variableArgs: false
  23562. };
  23563. t.BM = null;
  23564. t.BD = null;
  23565. t.true = null;
  23566. t.fa = null;
  23567. t.fal = null;
  23568. t.fals = null;
  23569. t.false = null;
  23570. t.nu = null;
  23571. t.nul = null;
  23572. t.null = null;
  23573. });
  23574. return (0, _util.shadow)(this, "opMap", getOPMap());
  23575. }
  23576. static get MAX_INVALID_PATH_OPS() {
  23577. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  23578. }
  23579. constructor(stream, xref, stateManager = new StateManager()) {
  23580. this.parser = new _parser.Parser({
  23581. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  23582. xref
  23583. });
  23584. this.stateManager = stateManager;
  23585. this.nonProcessedArgs = [];
  23586. this._numInvalidPathOPS = 0;
  23587. }
  23588. get savedStatesDepth() {
  23589. return this.stateManager.stateStack.length;
  23590. }
  23591. read(operation) {
  23592. let args = operation.args;
  23593. while (true) {
  23594. const obj = this.parser.getObj();
  23595. if (obj instanceof _primitives.Cmd) {
  23596. const cmd = obj.cmd;
  23597. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  23598. if (!opSpec) {
  23599. (0, _util.warn)(`Unknown command "${cmd}".`);
  23600. continue;
  23601. }
  23602. const fn = opSpec.id;
  23603. const numArgs = opSpec.numArgs;
  23604. let argsLength = args !== null ? args.length : 0;
  23605. if (!opSpec.variableArgs) {
  23606. if (argsLength !== numArgs) {
  23607. const nonProcessedArgs = this.nonProcessedArgs;
  23608. while (argsLength > numArgs) {
  23609. nonProcessedArgs.push(args.shift());
  23610. argsLength--;
  23611. }
  23612. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  23613. if (args === null) {
  23614. args = [];
  23615. }
  23616. args.unshift(nonProcessedArgs.pop());
  23617. argsLength++;
  23618. }
  23619. }
  23620. if (argsLength < numArgs) {
  23621. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  23622. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  23623. throw new _util.FormatError(`Invalid ${partialMsg}`);
  23624. }
  23625. (0, _util.warn)(`Skipping ${partialMsg}`);
  23626. if (args !== null) {
  23627. args.length = 0;
  23628. }
  23629. continue;
  23630. }
  23631. } else if (argsLength > numArgs) {
  23632. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  23633. }
  23634. this.preprocessCommand(fn, args);
  23635. operation.fn = fn;
  23636. operation.args = args;
  23637. return true;
  23638. }
  23639. if (obj === _primitives.EOF) {
  23640. return false;
  23641. }
  23642. if (obj !== null) {
  23643. if (args === null) {
  23644. args = [];
  23645. }
  23646. args.push(obj);
  23647. if (args.length > 33) {
  23648. throw new _util.FormatError("Too many arguments");
  23649. }
  23650. }
  23651. }
  23652. }
  23653. preprocessCommand(fn, args) {
  23654. switch (fn | 0) {
  23655. case _util.OPS.save:
  23656. this.stateManager.save();
  23657. break;
  23658. case _util.OPS.restore:
  23659. this.stateManager.restore();
  23660. break;
  23661. case _util.OPS.transform:
  23662. this.stateManager.transform(args);
  23663. break;
  23664. }
  23665. }
  23666. }
  23667. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  23668. /***/ }),
  23669. /* 26 */
  23670. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23671. Object.defineProperty(exports, "__esModule", ({
  23672. value: true
  23673. }));
  23674. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  23675. var _util = __w_pdfjs_require__(2);
  23676. var _primitives = __w_pdfjs_require__(5);
  23677. var _base_stream = __w_pdfjs_require__(9);
  23678. var _parser = __w_pdfjs_require__(27);
  23679. var _core_utils = __w_pdfjs_require__(8);
  23680. var _stream = __w_pdfjs_require__(10);
  23681. 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"];
  23682. const MAX_MAP_RANGE = 2 ** 24 - 1;
  23683. class CMap {
  23684. constructor(builtInCMap = false) {
  23685. this.codespaceRanges = [[], [], [], []];
  23686. this.numCodespaceRanges = 0;
  23687. this._map = [];
  23688. this.name = "";
  23689. this.vertical = false;
  23690. this.useCMap = null;
  23691. this.builtInCMap = builtInCMap;
  23692. }
  23693. addCodespaceRange(n, low, high) {
  23694. this.codespaceRanges[n - 1].push(low, high);
  23695. this.numCodespaceRanges++;
  23696. }
  23697. mapCidRange(low, high, dstLow) {
  23698. if (high - low > MAX_MAP_RANGE) {
  23699. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  23700. }
  23701. while (low <= high) {
  23702. this._map[low++] = dstLow++;
  23703. }
  23704. }
  23705. mapBfRange(low, high, dstLow) {
  23706. if (high - low > MAX_MAP_RANGE) {
  23707. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  23708. }
  23709. const lastByte = dstLow.length - 1;
  23710. while (low <= high) {
  23711. this._map[low++] = dstLow;
  23712. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  23713. if (nextCharCode > 0xff) {
  23714. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  23715. continue;
  23716. }
  23717. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  23718. }
  23719. }
  23720. mapBfRangeToArray(low, high, array) {
  23721. if (high - low > MAX_MAP_RANGE) {
  23722. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  23723. }
  23724. const ii = array.length;
  23725. let i = 0;
  23726. while (low <= high && i < ii) {
  23727. this._map[low] = array[i++];
  23728. ++low;
  23729. }
  23730. }
  23731. mapOne(src, dst) {
  23732. this._map[src] = dst;
  23733. }
  23734. lookup(code) {
  23735. return this._map[code];
  23736. }
  23737. contains(code) {
  23738. return this._map[code] !== undefined;
  23739. }
  23740. forEach(callback) {
  23741. const map = this._map;
  23742. const length = map.length;
  23743. if (length <= 0x10000) {
  23744. for (let i = 0; i < length; i++) {
  23745. if (map[i] !== undefined) {
  23746. callback(i, map[i]);
  23747. }
  23748. }
  23749. } else {
  23750. for (const i in map) {
  23751. callback(i, map[i]);
  23752. }
  23753. }
  23754. }
  23755. charCodeOf(value) {
  23756. const map = this._map;
  23757. if (map.length <= 0x10000) {
  23758. return map.indexOf(value);
  23759. }
  23760. for (const charCode in map) {
  23761. if (map[charCode] === value) {
  23762. return charCode | 0;
  23763. }
  23764. }
  23765. return -1;
  23766. }
  23767. getMap() {
  23768. return this._map;
  23769. }
  23770. readCharCode(str, offset, out) {
  23771. let c = 0;
  23772. const codespaceRanges = this.codespaceRanges;
  23773. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  23774. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  23775. const codespaceRange = codespaceRanges[n];
  23776. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  23777. const low = codespaceRange[k++];
  23778. const high = codespaceRange[k++];
  23779. if (c >= low && c <= high) {
  23780. out.charcode = c;
  23781. out.length = n + 1;
  23782. return;
  23783. }
  23784. }
  23785. }
  23786. out.charcode = 0;
  23787. out.length = 1;
  23788. }
  23789. getCharCodeLength(charCode) {
  23790. const codespaceRanges = this.codespaceRanges;
  23791. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  23792. const codespaceRange = codespaceRanges[n];
  23793. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  23794. const low = codespaceRange[k++];
  23795. const high = codespaceRange[k++];
  23796. if (charCode >= low && charCode <= high) {
  23797. return n + 1;
  23798. }
  23799. }
  23800. }
  23801. return 1;
  23802. }
  23803. get length() {
  23804. return this._map.length;
  23805. }
  23806. get isIdentityCMap() {
  23807. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  23808. return false;
  23809. }
  23810. if (this._map.length !== 0x10000) {
  23811. return false;
  23812. }
  23813. for (let i = 0; i < 0x10000; i++) {
  23814. if (this._map[i] !== i) {
  23815. return false;
  23816. }
  23817. }
  23818. return true;
  23819. }
  23820. }
  23821. exports.CMap = CMap;
  23822. class IdentityCMap extends CMap {
  23823. constructor(vertical, n) {
  23824. super();
  23825. this.vertical = vertical;
  23826. this.addCodespaceRange(n, 0, 0xffff);
  23827. }
  23828. mapCidRange(low, high, dstLow) {
  23829. (0, _util.unreachable)("should not call mapCidRange");
  23830. }
  23831. mapBfRange(low, high, dstLow) {
  23832. (0, _util.unreachable)("should not call mapBfRange");
  23833. }
  23834. mapBfRangeToArray(low, high, array) {
  23835. (0, _util.unreachable)("should not call mapBfRangeToArray");
  23836. }
  23837. mapOne(src, dst) {
  23838. (0, _util.unreachable)("should not call mapCidOne");
  23839. }
  23840. lookup(code) {
  23841. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  23842. }
  23843. contains(code) {
  23844. return Number.isInteger(code) && code <= 0xffff;
  23845. }
  23846. forEach(callback) {
  23847. for (let i = 0; i <= 0xffff; i++) {
  23848. callback(i, i);
  23849. }
  23850. }
  23851. charCodeOf(value) {
  23852. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  23853. }
  23854. getMap() {
  23855. const map = new Array(0x10000);
  23856. for (let i = 0; i <= 0xffff; i++) {
  23857. map[i] = i;
  23858. }
  23859. return map;
  23860. }
  23861. get length() {
  23862. return 0x10000;
  23863. }
  23864. get isIdentityCMap() {
  23865. (0, _util.unreachable)("should not access .isIdentityCMap");
  23866. }
  23867. }
  23868. exports.IdentityCMap = IdentityCMap;
  23869. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  23870. function hexToInt(a, size) {
  23871. let n = 0;
  23872. for (let i = 0; i <= size; i++) {
  23873. n = n << 8 | a[i];
  23874. }
  23875. return n >>> 0;
  23876. }
  23877. function hexToStr(a, size) {
  23878. if (size === 1) {
  23879. return String.fromCharCode(a[0], a[1]);
  23880. }
  23881. if (size === 3) {
  23882. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  23883. }
  23884. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  23885. }
  23886. function addHex(a, b, size) {
  23887. let c = 0;
  23888. for (let i = size; i >= 0; i--) {
  23889. c += a[i] + b[i];
  23890. a[i] = c & 255;
  23891. c >>= 8;
  23892. }
  23893. }
  23894. function incHex(a, size) {
  23895. let c = 1;
  23896. for (let i = size; i >= 0 && c > 0; i--) {
  23897. c += a[i];
  23898. a[i] = c & 255;
  23899. c >>= 8;
  23900. }
  23901. }
  23902. const MAX_NUM_SIZE = 16;
  23903. const MAX_ENCODED_NUM_SIZE = 19;
  23904. class BinaryCMapStream {
  23905. constructor(data) {
  23906. this.buffer = data;
  23907. this.pos = 0;
  23908. this.end = data.length;
  23909. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  23910. }
  23911. readByte() {
  23912. if (this.pos >= this.end) {
  23913. return -1;
  23914. }
  23915. return this.buffer[this.pos++];
  23916. }
  23917. readNumber() {
  23918. let n = 0;
  23919. let last;
  23920. do {
  23921. const b = this.readByte();
  23922. if (b < 0) {
  23923. throw new _util.FormatError("unexpected EOF in bcmap");
  23924. }
  23925. last = !(b & 0x80);
  23926. n = n << 7 | b & 0x7f;
  23927. } while (!last);
  23928. return n;
  23929. }
  23930. readSigned() {
  23931. const n = this.readNumber();
  23932. return n & 1 ? ~(n >>> 1) : n >>> 1;
  23933. }
  23934. readHex(num, size) {
  23935. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  23936. this.pos += size + 1;
  23937. }
  23938. readHexNumber(num, size) {
  23939. let last;
  23940. const stack = this.tmpBuf;
  23941. let sp = 0;
  23942. do {
  23943. const b = this.readByte();
  23944. if (b < 0) {
  23945. throw new _util.FormatError("unexpected EOF in bcmap");
  23946. }
  23947. last = !(b & 0x80);
  23948. stack[sp++] = b & 0x7f;
  23949. } while (!last);
  23950. let i = size,
  23951. buffer = 0,
  23952. bufferSize = 0;
  23953. while (i >= 0) {
  23954. while (bufferSize < 8 && stack.length > 0) {
  23955. buffer |= stack[--sp] << bufferSize;
  23956. bufferSize += 7;
  23957. }
  23958. num[i] = buffer & 255;
  23959. i--;
  23960. buffer >>= 8;
  23961. bufferSize -= 8;
  23962. }
  23963. }
  23964. readHexSigned(num, size) {
  23965. this.readHexNumber(num, size);
  23966. const sign = num[size] & 1 ? 255 : 0;
  23967. let c = 0;
  23968. for (let i = 0; i <= size; i++) {
  23969. c = (c & 1) << 8 | num[i];
  23970. num[i] = c >> 1 ^ sign;
  23971. }
  23972. }
  23973. readString() {
  23974. const len = this.readNumber();
  23975. let s = "";
  23976. for (let i = 0; i < len; i++) {
  23977. s += String.fromCharCode(this.readNumber());
  23978. }
  23979. return s;
  23980. }
  23981. }
  23982. class BinaryCMapReader {
  23983. async process(data, cMap, extend) {
  23984. const stream = new BinaryCMapStream(data);
  23985. const header = stream.readByte();
  23986. cMap.vertical = !!(header & 1);
  23987. let useCMap = null;
  23988. const start = new Uint8Array(MAX_NUM_SIZE);
  23989. const end = new Uint8Array(MAX_NUM_SIZE);
  23990. const char = new Uint8Array(MAX_NUM_SIZE);
  23991. const charCode = new Uint8Array(MAX_NUM_SIZE);
  23992. const tmp = new Uint8Array(MAX_NUM_SIZE);
  23993. let code;
  23994. let b;
  23995. while ((b = stream.readByte()) >= 0) {
  23996. const type = b >> 5;
  23997. if (type === 7) {
  23998. switch (b & 0x1f) {
  23999. case 0:
  24000. stream.readString();
  24001. break;
  24002. case 1:
  24003. useCMap = stream.readString();
  24004. break;
  24005. }
  24006. continue;
  24007. }
  24008. const sequence = !!(b & 0x10);
  24009. const dataSize = b & 15;
  24010. if (dataSize + 1 > MAX_NUM_SIZE) {
  24011. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  24012. }
  24013. const ucs2DataSize = 1;
  24014. const subitemsCount = stream.readNumber();
  24015. switch (type) {
  24016. case 0:
  24017. stream.readHex(start, dataSize);
  24018. stream.readHexNumber(end, dataSize);
  24019. addHex(end, start, dataSize);
  24020. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24021. for (let i = 1; i < subitemsCount; i++) {
  24022. incHex(end, dataSize);
  24023. stream.readHexNumber(start, dataSize);
  24024. addHex(start, end, dataSize);
  24025. stream.readHexNumber(end, dataSize);
  24026. addHex(end, start, dataSize);
  24027. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24028. }
  24029. break;
  24030. case 1:
  24031. stream.readHex(start, dataSize);
  24032. stream.readHexNumber(end, dataSize);
  24033. addHex(end, start, dataSize);
  24034. stream.readNumber();
  24035. for (let i = 1; i < subitemsCount; i++) {
  24036. incHex(end, dataSize);
  24037. stream.readHexNumber(start, dataSize);
  24038. addHex(start, end, dataSize);
  24039. stream.readHexNumber(end, dataSize);
  24040. addHex(end, start, dataSize);
  24041. stream.readNumber();
  24042. }
  24043. break;
  24044. case 2:
  24045. stream.readHex(char, dataSize);
  24046. code = stream.readNumber();
  24047. cMap.mapOne(hexToInt(char, dataSize), code);
  24048. for (let i = 1; i < subitemsCount; i++) {
  24049. incHex(char, dataSize);
  24050. if (!sequence) {
  24051. stream.readHexNumber(tmp, dataSize);
  24052. addHex(char, tmp, dataSize);
  24053. }
  24054. code = stream.readSigned() + (code + 1);
  24055. cMap.mapOne(hexToInt(char, dataSize), code);
  24056. }
  24057. break;
  24058. case 3:
  24059. stream.readHex(start, dataSize);
  24060. stream.readHexNumber(end, dataSize);
  24061. addHex(end, start, dataSize);
  24062. code = stream.readNumber();
  24063. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24064. for (let i = 1; i < subitemsCount; i++) {
  24065. incHex(end, dataSize);
  24066. if (!sequence) {
  24067. stream.readHexNumber(start, dataSize);
  24068. addHex(start, end, dataSize);
  24069. } else {
  24070. start.set(end);
  24071. }
  24072. stream.readHexNumber(end, dataSize);
  24073. addHex(end, start, dataSize);
  24074. code = stream.readNumber();
  24075. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24076. }
  24077. break;
  24078. case 4:
  24079. stream.readHex(char, ucs2DataSize);
  24080. stream.readHex(charCode, dataSize);
  24081. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24082. for (let i = 1; i < subitemsCount; i++) {
  24083. incHex(char, ucs2DataSize);
  24084. if (!sequence) {
  24085. stream.readHexNumber(tmp, ucs2DataSize);
  24086. addHex(char, tmp, ucs2DataSize);
  24087. }
  24088. incHex(charCode, dataSize);
  24089. stream.readHexSigned(tmp, dataSize);
  24090. addHex(charCode, tmp, dataSize);
  24091. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24092. }
  24093. break;
  24094. case 5:
  24095. stream.readHex(start, ucs2DataSize);
  24096. stream.readHexNumber(end, ucs2DataSize);
  24097. addHex(end, start, ucs2DataSize);
  24098. stream.readHex(charCode, dataSize);
  24099. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24100. for (let i = 1; i < subitemsCount; i++) {
  24101. incHex(end, ucs2DataSize);
  24102. if (!sequence) {
  24103. stream.readHexNumber(start, ucs2DataSize);
  24104. addHex(start, end, ucs2DataSize);
  24105. } else {
  24106. start.set(end);
  24107. }
  24108. stream.readHexNumber(end, ucs2DataSize);
  24109. addHex(end, start, ucs2DataSize);
  24110. stream.readHex(charCode, dataSize);
  24111. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24112. }
  24113. break;
  24114. default:
  24115. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  24116. }
  24117. }
  24118. if (useCMap) {
  24119. return extend(useCMap);
  24120. }
  24121. return cMap;
  24122. }
  24123. }
  24124. return BinaryCMapReader;
  24125. }();
  24126. const CMapFactory = function CMapFactoryClosure() {
  24127. function strToInt(str) {
  24128. let a = 0;
  24129. for (let i = 0; i < str.length; i++) {
  24130. a = a << 8 | str.charCodeAt(i);
  24131. }
  24132. return a >>> 0;
  24133. }
  24134. function expectString(obj) {
  24135. if (typeof obj !== "string") {
  24136. throw new _util.FormatError("Malformed CMap: expected string.");
  24137. }
  24138. }
  24139. function expectInt(obj) {
  24140. if (!Number.isInteger(obj)) {
  24141. throw new _util.FormatError("Malformed CMap: expected int.");
  24142. }
  24143. }
  24144. function parseBfChar(cMap, lexer) {
  24145. while (true) {
  24146. let obj = lexer.getObj();
  24147. if (obj === _primitives.EOF) {
  24148. break;
  24149. }
  24150. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  24151. return;
  24152. }
  24153. expectString(obj);
  24154. const src = strToInt(obj);
  24155. obj = lexer.getObj();
  24156. expectString(obj);
  24157. const dst = obj;
  24158. cMap.mapOne(src, dst);
  24159. }
  24160. }
  24161. function parseBfRange(cMap, lexer) {
  24162. while (true) {
  24163. let obj = lexer.getObj();
  24164. if (obj === _primitives.EOF) {
  24165. break;
  24166. }
  24167. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  24168. return;
  24169. }
  24170. expectString(obj);
  24171. const low = strToInt(obj);
  24172. obj = lexer.getObj();
  24173. expectString(obj);
  24174. const high = strToInt(obj);
  24175. obj = lexer.getObj();
  24176. if (Number.isInteger(obj) || typeof obj === "string") {
  24177. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  24178. cMap.mapBfRange(low, high, dstLow);
  24179. } else if ((0, _primitives.isCmd)(obj, "[")) {
  24180. obj = lexer.getObj();
  24181. const array = [];
  24182. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  24183. array.push(obj);
  24184. obj = lexer.getObj();
  24185. }
  24186. cMap.mapBfRangeToArray(low, high, array);
  24187. } else {
  24188. break;
  24189. }
  24190. }
  24191. throw new _util.FormatError("Invalid bf range.");
  24192. }
  24193. function parseCidChar(cMap, lexer) {
  24194. while (true) {
  24195. let obj = lexer.getObj();
  24196. if (obj === _primitives.EOF) {
  24197. break;
  24198. }
  24199. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  24200. return;
  24201. }
  24202. expectString(obj);
  24203. const src = strToInt(obj);
  24204. obj = lexer.getObj();
  24205. expectInt(obj);
  24206. const dst = obj;
  24207. cMap.mapOne(src, dst);
  24208. }
  24209. }
  24210. function parseCidRange(cMap, lexer) {
  24211. while (true) {
  24212. let obj = lexer.getObj();
  24213. if (obj === _primitives.EOF) {
  24214. break;
  24215. }
  24216. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  24217. return;
  24218. }
  24219. expectString(obj);
  24220. const low = strToInt(obj);
  24221. obj = lexer.getObj();
  24222. expectString(obj);
  24223. const high = strToInt(obj);
  24224. obj = lexer.getObj();
  24225. expectInt(obj);
  24226. const dstLow = obj;
  24227. cMap.mapCidRange(low, high, dstLow);
  24228. }
  24229. }
  24230. function parseCodespaceRange(cMap, lexer) {
  24231. while (true) {
  24232. let obj = lexer.getObj();
  24233. if (obj === _primitives.EOF) {
  24234. break;
  24235. }
  24236. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  24237. return;
  24238. }
  24239. if (typeof obj !== "string") {
  24240. break;
  24241. }
  24242. const low = strToInt(obj);
  24243. obj = lexer.getObj();
  24244. if (typeof obj !== "string") {
  24245. break;
  24246. }
  24247. const high = strToInt(obj);
  24248. cMap.addCodespaceRange(obj.length, low, high);
  24249. }
  24250. throw new _util.FormatError("Invalid codespace range.");
  24251. }
  24252. function parseWMode(cMap, lexer) {
  24253. const obj = lexer.getObj();
  24254. if (Number.isInteger(obj)) {
  24255. cMap.vertical = !!obj;
  24256. }
  24257. }
  24258. function parseCMapName(cMap, lexer) {
  24259. const obj = lexer.getObj();
  24260. if (obj instanceof _primitives.Name) {
  24261. cMap.name = obj.name;
  24262. }
  24263. }
  24264. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  24265. let previous, embeddedUseCMap;
  24266. objLoop: while (true) {
  24267. try {
  24268. const obj = lexer.getObj();
  24269. if (obj === _primitives.EOF) {
  24270. break;
  24271. } else if (obj instanceof _primitives.Name) {
  24272. if (obj.name === "WMode") {
  24273. parseWMode(cMap, lexer);
  24274. } else if (obj.name === "CMapName") {
  24275. parseCMapName(cMap, lexer);
  24276. }
  24277. previous = obj;
  24278. } else if (obj instanceof _primitives.Cmd) {
  24279. switch (obj.cmd) {
  24280. case "endcmap":
  24281. break objLoop;
  24282. case "usecmap":
  24283. if (previous instanceof _primitives.Name) {
  24284. embeddedUseCMap = previous.name;
  24285. }
  24286. break;
  24287. case "begincodespacerange":
  24288. parseCodespaceRange(cMap, lexer);
  24289. break;
  24290. case "beginbfchar":
  24291. parseBfChar(cMap, lexer);
  24292. break;
  24293. case "begincidchar":
  24294. parseCidChar(cMap, lexer);
  24295. break;
  24296. case "beginbfrange":
  24297. parseBfRange(cMap, lexer);
  24298. break;
  24299. case "begincidrange":
  24300. parseCidRange(cMap, lexer);
  24301. break;
  24302. }
  24303. }
  24304. } catch (ex) {
  24305. if (ex instanceof _core_utils.MissingDataException) {
  24306. throw ex;
  24307. }
  24308. (0, _util.warn)("Invalid cMap data: " + ex);
  24309. continue;
  24310. }
  24311. }
  24312. if (!useCMap && embeddedUseCMap) {
  24313. useCMap = embeddedUseCMap;
  24314. }
  24315. if (useCMap) {
  24316. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24317. }
  24318. return cMap;
  24319. }
  24320. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  24321. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  24322. if (cMap.numCodespaceRanges === 0) {
  24323. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  24324. for (let i = 0; i < useCodespaceRanges.length; i++) {
  24325. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  24326. }
  24327. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  24328. }
  24329. cMap.useCMap.forEach(function (key, value) {
  24330. if (!cMap.contains(key)) {
  24331. cMap.mapOne(key, cMap.useCMap.lookup(key));
  24332. }
  24333. });
  24334. return cMap;
  24335. }
  24336. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  24337. if (name === "Identity-H") {
  24338. return new IdentityCMap(false, 2);
  24339. } else if (name === "Identity-V") {
  24340. return new IdentityCMap(true, 2);
  24341. }
  24342. if (!BUILT_IN_CMAPS.includes(name)) {
  24343. throw new Error("Unknown CMap name: " + name);
  24344. }
  24345. if (!fetchBuiltInCMap) {
  24346. throw new Error("Built-in CMap parameters are not provided.");
  24347. }
  24348. const {
  24349. cMapData,
  24350. compressionType
  24351. } = await fetchBuiltInCMap(name);
  24352. const cMap = new CMap(true);
  24353. if (compressionType === _util.CMapCompressionType.BINARY) {
  24354. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  24355. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24356. });
  24357. }
  24358. if (compressionType === _util.CMapCompressionType.NONE) {
  24359. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  24360. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  24361. }
  24362. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  24363. }
  24364. return {
  24365. async create(params) {
  24366. const encoding = params.encoding;
  24367. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  24368. const useCMap = params.useCMap;
  24369. if (encoding instanceof _primitives.Name) {
  24370. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  24371. } else if (encoding instanceof _base_stream.BaseStream) {
  24372. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  24373. if (parsedCMap.isIdentityCMap) {
  24374. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  24375. }
  24376. return parsedCMap;
  24377. }
  24378. throw new Error("Encoding required.");
  24379. }
  24380. };
  24381. }();
  24382. exports.CMapFactory = CMapFactory;
  24383. /***/ }),
  24384. /* 27 */
  24385. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24386. Object.defineProperty(exports, "__esModule", ({
  24387. value: true
  24388. }));
  24389. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  24390. var _util = __w_pdfjs_require__(2);
  24391. var _primitives = __w_pdfjs_require__(5);
  24392. var _core_utils = __w_pdfjs_require__(8);
  24393. var _ascii_85_stream = __w_pdfjs_require__(28);
  24394. var _ascii_hex_stream = __w_pdfjs_require__(30);
  24395. var _ccitt_stream = __w_pdfjs_require__(31);
  24396. var _flate_stream = __w_pdfjs_require__(33);
  24397. var _jbig2_stream = __w_pdfjs_require__(34);
  24398. var _jpeg_stream = __w_pdfjs_require__(37);
  24399. var _jpx_stream = __w_pdfjs_require__(39);
  24400. var _lzw_stream = __w_pdfjs_require__(41);
  24401. var _stream = __w_pdfjs_require__(10);
  24402. var _predictor_stream = __w_pdfjs_require__(42);
  24403. var _run_length_stream = __w_pdfjs_require__(43);
  24404. const MAX_LENGTH_TO_CACHE = 1000;
  24405. const MAX_ADLER32_LENGTH = 5552;
  24406. function computeAdler32(bytes) {
  24407. const bytesLength = bytes.length;
  24408. let a = 1,
  24409. b = 0;
  24410. for (let i = 0; i < bytesLength; ++i) {
  24411. a += bytes[i] & 0xff;
  24412. b += a;
  24413. }
  24414. return b % 65521 << 16 | a % 65521;
  24415. }
  24416. class Parser {
  24417. constructor({
  24418. lexer,
  24419. xref,
  24420. allowStreams = false,
  24421. recoveryMode = false
  24422. }) {
  24423. this.lexer = lexer;
  24424. this.xref = xref;
  24425. this.allowStreams = allowStreams;
  24426. this.recoveryMode = recoveryMode;
  24427. this.imageCache = Object.create(null);
  24428. this.refill();
  24429. }
  24430. refill() {
  24431. this.buf1 = this.lexer.getObj();
  24432. this.buf2 = this.lexer.getObj();
  24433. }
  24434. shift() {
  24435. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  24436. this.buf1 = this.buf2;
  24437. this.buf2 = null;
  24438. } else {
  24439. this.buf1 = this.buf2;
  24440. this.buf2 = this.lexer.getObj();
  24441. }
  24442. }
  24443. tryShift() {
  24444. try {
  24445. this.shift();
  24446. return true;
  24447. } catch (e) {
  24448. if (e instanceof _core_utils.MissingDataException) {
  24449. throw e;
  24450. }
  24451. return false;
  24452. }
  24453. }
  24454. getObj(cipherTransform = null) {
  24455. const buf1 = this.buf1;
  24456. this.shift();
  24457. if (buf1 instanceof _primitives.Cmd) {
  24458. switch (buf1.cmd) {
  24459. case "BI":
  24460. return this.makeInlineImage(cipherTransform);
  24461. case "[":
  24462. const array = [];
  24463. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  24464. array.push(this.getObj(cipherTransform));
  24465. }
  24466. if (this.buf1 === _primitives.EOF) {
  24467. if (this.recoveryMode) {
  24468. return array;
  24469. }
  24470. throw new _core_utils.ParserEOFException("End of file inside array.");
  24471. }
  24472. this.shift();
  24473. return array;
  24474. case "<<":
  24475. const dict = new _primitives.Dict(this.xref);
  24476. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  24477. if (!(this.buf1 instanceof _primitives.Name)) {
  24478. (0, _util.info)("Malformed dictionary: key must be a name object");
  24479. this.shift();
  24480. continue;
  24481. }
  24482. const key = this.buf1.name;
  24483. this.shift();
  24484. if (this.buf1 === _primitives.EOF) {
  24485. break;
  24486. }
  24487. dict.set(key, this.getObj(cipherTransform));
  24488. }
  24489. if (this.buf1 === _primitives.EOF) {
  24490. if (this.recoveryMode) {
  24491. return dict;
  24492. }
  24493. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  24494. }
  24495. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  24496. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  24497. }
  24498. this.shift();
  24499. return dict;
  24500. default:
  24501. return buf1;
  24502. }
  24503. }
  24504. if (Number.isInteger(buf1)) {
  24505. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  24506. const ref = _primitives.Ref.get(buf1, this.buf1);
  24507. this.shift();
  24508. this.shift();
  24509. return ref;
  24510. }
  24511. return buf1;
  24512. }
  24513. if (typeof buf1 === "string") {
  24514. if (cipherTransform) {
  24515. return cipherTransform.decryptString(buf1);
  24516. }
  24517. return buf1;
  24518. }
  24519. return buf1;
  24520. }
  24521. findDefaultInlineStreamEnd(stream) {
  24522. const E = 0x45,
  24523. I = 0x49,
  24524. SPACE = 0x20,
  24525. LF = 0xa,
  24526. CR = 0xd,
  24527. NUL = 0x0;
  24528. const lexer = this.lexer,
  24529. startPos = stream.pos,
  24530. n = 10;
  24531. let state = 0,
  24532. ch,
  24533. maybeEIPos;
  24534. while ((ch = stream.getByte()) !== -1) {
  24535. if (state === 0) {
  24536. state = ch === E ? 1 : 0;
  24537. } else if (state === 1) {
  24538. state = ch === I ? 2 : 0;
  24539. } else {
  24540. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  24541. if (ch === SPACE || ch === LF || ch === CR) {
  24542. maybeEIPos = stream.pos;
  24543. const followingBytes = stream.peekBytes(n);
  24544. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  24545. ch = followingBytes[i];
  24546. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  24547. continue;
  24548. }
  24549. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  24550. state = 0;
  24551. break;
  24552. }
  24553. }
  24554. if (state !== 2) {
  24555. continue;
  24556. }
  24557. if (lexer.knownCommands) {
  24558. const nextObj = lexer.peekObj();
  24559. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  24560. state = 0;
  24561. }
  24562. } else {
  24563. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  24564. }
  24565. if (state === 2) {
  24566. break;
  24567. }
  24568. } else {
  24569. state = 0;
  24570. }
  24571. }
  24572. }
  24573. if (ch === -1) {
  24574. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  24575. if (maybeEIPos) {
  24576. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  24577. stream.skip(-(stream.pos - maybeEIPos));
  24578. }
  24579. }
  24580. let endOffset = 4;
  24581. stream.skip(-endOffset);
  24582. ch = stream.peekByte();
  24583. stream.skip(endOffset);
  24584. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  24585. endOffset--;
  24586. }
  24587. return stream.pos - endOffset - startPos;
  24588. }
  24589. findDCTDecodeInlineStreamEnd(stream) {
  24590. const startPos = stream.pos;
  24591. let foundEOI = false,
  24592. b,
  24593. markerLength;
  24594. while ((b = stream.getByte()) !== -1) {
  24595. if (b !== 0xff) {
  24596. continue;
  24597. }
  24598. switch (stream.getByte()) {
  24599. case 0x00:
  24600. break;
  24601. case 0xff:
  24602. stream.skip(-1);
  24603. break;
  24604. case 0xd9:
  24605. foundEOI = true;
  24606. break;
  24607. case 0xc0:
  24608. case 0xc1:
  24609. case 0xc2:
  24610. case 0xc3:
  24611. case 0xc5:
  24612. case 0xc6:
  24613. case 0xc7:
  24614. case 0xc9:
  24615. case 0xca:
  24616. case 0xcb:
  24617. case 0xcd:
  24618. case 0xce:
  24619. case 0xcf:
  24620. case 0xc4:
  24621. case 0xcc:
  24622. case 0xda:
  24623. case 0xdb:
  24624. case 0xdc:
  24625. case 0xdd:
  24626. case 0xde:
  24627. case 0xdf:
  24628. case 0xe0:
  24629. case 0xe1:
  24630. case 0xe2:
  24631. case 0xe3:
  24632. case 0xe4:
  24633. case 0xe5:
  24634. case 0xe6:
  24635. case 0xe7:
  24636. case 0xe8:
  24637. case 0xe9:
  24638. case 0xea:
  24639. case 0xeb:
  24640. case 0xec:
  24641. case 0xed:
  24642. case 0xee:
  24643. case 0xef:
  24644. case 0xfe:
  24645. markerLength = stream.getUint16();
  24646. if (markerLength > 2) {
  24647. stream.skip(markerLength - 2);
  24648. } else {
  24649. stream.skip(-2);
  24650. }
  24651. break;
  24652. }
  24653. if (foundEOI) {
  24654. break;
  24655. }
  24656. }
  24657. const length = stream.pos - startPos;
  24658. if (b === -1) {
  24659. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  24660. stream.skip(-length);
  24661. return this.findDefaultInlineStreamEnd(stream);
  24662. }
  24663. this.inlineStreamSkipEI(stream);
  24664. return length;
  24665. }
  24666. findASCII85DecodeInlineStreamEnd(stream) {
  24667. const TILDE = 0x7e,
  24668. GT = 0x3e;
  24669. const startPos = stream.pos;
  24670. let ch;
  24671. while ((ch = stream.getByte()) !== -1) {
  24672. if (ch === TILDE) {
  24673. const tildePos = stream.pos;
  24674. ch = stream.peekByte();
  24675. while ((0, _core_utils.isWhiteSpace)(ch)) {
  24676. stream.skip();
  24677. ch = stream.peekByte();
  24678. }
  24679. if (ch === GT) {
  24680. stream.skip();
  24681. break;
  24682. }
  24683. if (stream.pos > tildePos) {
  24684. const maybeEI = stream.peekBytes(2);
  24685. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  24686. break;
  24687. }
  24688. }
  24689. }
  24690. }
  24691. const length = stream.pos - startPos;
  24692. if (ch === -1) {
  24693. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24694. stream.skip(-length);
  24695. return this.findDefaultInlineStreamEnd(stream);
  24696. }
  24697. this.inlineStreamSkipEI(stream);
  24698. return length;
  24699. }
  24700. findASCIIHexDecodeInlineStreamEnd(stream) {
  24701. const GT = 0x3e;
  24702. const startPos = stream.pos;
  24703. let ch;
  24704. while ((ch = stream.getByte()) !== -1) {
  24705. if (ch === GT) {
  24706. break;
  24707. }
  24708. }
  24709. const length = stream.pos - startPos;
  24710. if (ch === -1) {
  24711. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24712. stream.skip(-length);
  24713. return this.findDefaultInlineStreamEnd(stream);
  24714. }
  24715. this.inlineStreamSkipEI(stream);
  24716. return length;
  24717. }
  24718. inlineStreamSkipEI(stream) {
  24719. const E = 0x45,
  24720. I = 0x49;
  24721. let state = 0,
  24722. ch;
  24723. while ((ch = stream.getByte()) !== -1) {
  24724. if (state === 0) {
  24725. state = ch === E ? 1 : 0;
  24726. } else if (state === 1) {
  24727. state = ch === I ? 2 : 0;
  24728. } else if (state === 2) {
  24729. break;
  24730. }
  24731. }
  24732. }
  24733. makeInlineImage(cipherTransform) {
  24734. const lexer = this.lexer;
  24735. const stream = lexer.stream;
  24736. const dict = new _primitives.Dict(this.xref);
  24737. let dictLength;
  24738. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  24739. if (!(this.buf1 instanceof _primitives.Name)) {
  24740. throw new _util.FormatError("Dictionary key must be a name object");
  24741. }
  24742. const key = this.buf1.name;
  24743. this.shift();
  24744. if (this.buf1 === _primitives.EOF) {
  24745. break;
  24746. }
  24747. dict.set(key, this.getObj(cipherTransform));
  24748. }
  24749. if (lexer.beginInlineImagePos !== -1) {
  24750. dictLength = stream.pos - lexer.beginInlineImagePos;
  24751. }
  24752. const filter = dict.get("F", "Filter");
  24753. let filterName;
  24754. if (filter instanceof _primitives.Name) {
  24755. filterName = filter.name;
  24756. } else if (Array.isArray(filter)) {
  24757. const filterZero = this.xref.fetchIfRef(filter[0]);
  24758. if (filterZero instanceof _primitives.Name) {
  24759. filterName = filterZero.name;
  24760. }
  24761. }
  24762. const startPos = stream.pos;
  24763. let length;
  24764. switch (filterName) {
  24765. case "DCT":
  24766. case "DCTDecode":
  24767. length = this.findDCTDecodeInlineStreamEnd(stream);
  24768. break;
  24769. case "A85":
  24770. case "ASCII85Decode":
  24771. length = this.findASCII85DecodeInlineStreamEnd(stream);
  24772. break;
  24773. case "AHx":
  24774. case "ASCIIHexDecode":
  24775. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  24776. break;
  24777. default:
  24778. length = this.findDefaultInlineStreamEnd(stream);
  24779. }
  24780. let imageStream = stream.makeSubStream(startPos, length, dict);
  24781. let cacheKey;
  24782. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  24783. const imageBytes = imageStream.getBytes();
  24784. imageStream.reset();
  24785. const initialStreamPos = stream.pos;
  24786. stream.pos = lexer.beginInlineImagePos;
  24787. const dictBytes = stream.getBytes(dictLength);
  24788. stream.pos = initialStreamPos;
  24789. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  24790. const cacheEntry = this.imageCache[cacheKey];
  24791. if (cacheEntry !== undefined) {
  24792. this.buf2 = _primitives.Cmd.get("EI");
  24793. this.shift();
  24794. cacheEntry.reset();
  24795. return cacheEntry;
  24796. }
  24797. }
  24798. if (cipherTransform) {
  24799. imageStream = cipherTransform.createStream(imageStream, length);
  24800. }
  24801. imageStream = this.filter(imageStream, dict, length);
  24802. imageStream.dict = dict;
  24803. if (cacheKey !== undefined) {
  24804. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  24805. this.imageCache[cacheKey] = imageStream;
  24806. }
  24807. this.buf2 = _primitives.Cmd.get("EI");
  24808. this.shift();
  24809. return imageStream;
  24810. }
  24811. _findStreamLength(startPos, signature) {
  24812. const {
  24813. stream
  24814. } = this.lexer;
  24815. stream.pos = startPos;
  24816. const SCAN_BLOCK_LENGTH = 2048;
  24817. const signatureLength = signature.length;
  24818. while (stream.pos < stream.end) {
  24819. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  24820. const scanLength = scanBytes.length - signatureLength;
  24821. if (scanLength <= 0) {
  24822. break;
  24823. }
  24824. let pos = 0;
  24825. while (pos < scanLength) {
  24826. let j = 0;
  24827. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  24828. j++;
  24829. }
  24830. if (j >= signatureLength) {
  24831. stream.pos += pos;
  24832. return stream.pos - startPos;
  24833. }
  24834. pos++;
  24835. }
  24836. stream.pos += scanLength;
  24837. }
  24838. return -1;
  24839. }
  24840. makeStream(dict, cipherTransform) {
  24841. const lexer = this.lexer;
  24842. let stream = lexer.stream;
  24843. lexer.skipToNextLine();
  24844. const startPos = stream.pos - 1;
  24845. let length = dict.get("Length");
  24846. if (!Number.isInteger(length)) {
  24847. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  24848. length = 0;
  24849. }
  24850. stream.pos = startPos + length;
  24851. lexer.nextChar();
  24852. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  24853. this.shift();
  24854. } else {
  24855. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  24856. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  24857. if (actualLength < 0) {
  24858. const MAX_TRUNCATION = 1;
  24859. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  24860. const end = ENDSTREAM_SIGNATURE.length - i;
  24861. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  24862. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  24863. if (maybeLength >= 0) {
  24864. const lastByte = stream.peekBytes(end + 1)[end];
  24865. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  24866. break;
  24867. }
  24868. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  24869. actualLength = maybeLength;
  24870. break;
  24871. }
  24872. }
  24873. if (actualLength < 0) {
  24874. throw new _util.FormatError("Missing endstream command.");
  24875. }
  24876. }
  24877. length = actualLength;
  24878. lexer.nextChar();
  24879. this.shift();
  24880. this.shift();
  24881. }
  24882. this.shift();
  24883. stream = stream.makeSubStream(startPos, length, dict);
  24884. if (cipherTransform) {
  24885. stream = cipherTransform.createStream(stream, length);
  24886. }
  24887. stream = this.filter(stream, dict, length);
  24888. stream.dict = dict;
  24889. return stream;
  24890. }
  24891. filter(stream, dict, length) {
  24892. let filter = dict.get("F", "Filter");
  24893. let params = dict.get("DP", "DecodeParms");
  24894. if (filter instanceof _primitives.Name) {
  24895. if (Array.isArray(params)) {
  24896. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  24897. }
  24898. return this.makeFilter(stream, filter.name, length, params);
  24899. }
  24900. let maybeLength = length;
  24901. if (Array.isArray(filter)) {
  24902. const filterArray = filter;
  24903. const paramsArray = params;
  24904. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  24905. filter = this.xref.fetchIfRef(filterArray[i]);
  24906. if (!(filter instanceof _primitives.Name)) {
  24907. throw new _util.FormatError(`Bad filter name "${filter}"`);
  24908. }
  24909. params = null;
  24910. if (Array.isArray(paramsArray) && i in paramsArray) {
  24911. params = this.xref.fetchIfRef(paramsArray[i]);
  24912. }
  24913. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  24914. maybeLength = null;
  24915. }
  24916. }
  24917. return stream;
  24918. }
  24919. makeFilter(stream, name, maybeLength, params) {
  24920. if (maybeLength === 0) {
  24921. (0, _util.warn)(`Empty "${name}" stream.`);
  24922. return new _stream.NullStream();
  24923. }
  24924. const xrefStats = this.xref.stats;
  24925. try {
  24926. switch (name) {
  24927. case "Fl":
  24928. case "FlateDecode":
  24929. xrefStats.addStreamType(_util.StreamType.FLATE);
  24930. if (params) {
  24931. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  24932. }
  24933. return new _flate_stream.FlateStream(stream, maybeLength);
  24934. case "LZW":
  24935. case "LZWDecode":
  24936. xrefStats.addStreamType(_util.StreamType.LZW);
  24937. let earlyChange = 1;
  24938. if (params) {
  24939. if (params.has("EarlyChange")) {
  24940. earlyChange = params.get("EarlyChange");
  24941. }
  24942. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  24943. }
  24944. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  24945. case "DCT":
  24946. case "DCTDecode":
  24947. xrefStats.addStreamType(_util.StreamType.DCT);
  24948. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  24949. case "JPX":
  24950. case "JPXDecode":
  24951. xrefStats.addStreamType(_util.StreamType.JPX);
  24952. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  24953. case "A85":
  24954. case "ASCII85Decode":
  24955. xrefStats.addStreamType(_util.StreamType.A85);
  24956. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  24957. case "AHx":
  24958. case "ASCIIHexDecode":
  24959. xrefStats.addStreamType(_util.StreamType.AHX);
  24960. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  24961. case "CCF":
  24962. case "CCITTFaxDecode":
  24963. xrefStats.addStreamType(_util.StreamType.CCF);
  24964. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  24965. case "RL":
  24966. case "RunLengthDecode":
  24967. xrefStats.addStreamType(_util.StreamType.RLX);
  24968. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  24969. case "JBIG2Decode":
  24970. xrefStats.addStreamType(_util.StreamType.JBIG);
  24971. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  24972. }
  24973. (0, _util.warn)(`Filter "${name}" is not supported.`);
  24974. return stream;
  24975. } catch (ex) {
  24976. if (ex instanceof _core_utils.MissingDataException) {
  24977. throw ex;
  24978. }
  24979. (0, _util.warn)(`Invalid stream: "${ex}"`);
  24980. return new _stream.NullStream();
  24981. }
  24982. }
  24983. }
  24984. exports.Parser = Parser;
  24985. 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];
  24986. function toHexDigit(ch) {
  24987. if (ch >= 0x30 && ch <= 0x39) {
  24988. return ch & 0x0f;
  24989. }
  24990. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  24991. return (ch & 0x0f) + 9;
  24992. }
  24993. return -1;
  24994. }
  24995. class Lexer {
  24996. constructor(stream, knownCommands = null) {
  24997. this.stream = stream;
  24998. this.nextChar();
  24999. this.strBuf = [];
  25000. this.knownCommands = knownCommands;
  25001. this._hexStringNumWarn = 0;
  25002. this.beginInlineImagePos = -1;
  25003. }
  25004. nextChar() {
  25005. return this.currentChar = this.stream.getByte();
  25006. }
  25007. peekChar() {
  25008. return this.stream.peekByte();
  25009. }
  25010. getNumber() {
  25011. let ch = this.currentChar;
  25012. let eNotation = false;
  25013. let divideBy = 0;
  25014. let sign = 0;
  25015. if (ch === 0x2d) {
  25016. sign = -1;
  25017. ch = this.nextChar();
  25018. if (ch === 0x2d) {
  25019. ch = this.nextChar();
  25020. }
  25021. } else if (ch === 0x2b) {
  25022. sign = 1;
  25023. ch = this.nextChar();
  25024. }
  25025. if (ch === 0x0a || ch === 0x0d) {
  25026. do {
  25027. ch = this.nextChar();
  25028. } while (ch === 0x0a || ch === 0x0d);
  25029. }
  25030. if (ch === 0x2e) {
  25031. divideBy = 10;
  25032. ch = this.nextChar();
  25033. }
  25034. if (ch < 0x30 || ch > 0x39) {
  25035. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  25036. if (divideBy === 10 && sign === 0) {
  25037. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  25038. return 0;
  25039. }
  25040. if (divideBy === 0 && sign === -1) {
  25041. (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero.");
  25042. return 0;
  25043. }
  25044. }
  25045. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  25046. }
  25047. sign = sign || 1;
  25048. let baseValue = ch - 0x30;
  25049. let powerValue = 0;
  25050. let powerValueSign = 1;
  25051. while ((ch = this.nextChar()) >= 0) {
  25052. if (ch >= 0x30 && ch <= 0x39) {
  25053. const currentDigit = ch - 0x30;
  25054. if (eNotation) {
  25055. powerValue = powerValue * 10 + currentDigit;
  25056. } else {
  25057. if (divideBy !== 0) {
  25058. divideBy *= 10;
  25059. }
  25060. baseValue = baseValue * 10 + currentDigit;
  25061. }
  25062. } else if (ch === 0x2e) {
  25063. if (divideBy === 0) {
  25064. divideBy = 1;
  25065. } else {
  25066. break;
  25067. }
  25068. } else if (ch === 0x2d) {
  25069. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  25070. } else if (ch === 0x45 || ch === 0x65) {
  25071. ch = this.peekChar();
  25072. if (ch === 0x2b || ch === 0x2d) {
  25073. powerValueSign = ch === 0x2d ? -1 : 1;
  25074. this.nextChar();
  25075. } else if (ch < 0x30 || ch > 0x39) {
  25076. break;
  25077. }
  25078. eNotation = true;
  25079. } else {
  25080. break;
  25081. }
  25082. }
  25083. if (divideBy !== 0) {
  25084. baseValue /= divideBy;
  25085. }
  25086. if (eNotation) {
  25087. baseValue *= 10 ** (powerValueSign * powerValue);
  25088. }
  25089. return sign * baseValue;
  25090. }
  25091. getString() {
  25092. let numParen = 1;
  25093. let done = false;
  25094. const strBuf = this.strBuf;
  25095. strBuf.length = 0;
  25096. let ch = this.nextChar();
  25097. while (true) {
  25098. let charBuffered = false;
  25099. switch (ch | 0) {
  25100. case -1:
  25101. (0, _util.warn)("Unterminated string");
  25102. done = true;
  25103. break;
  25104. case 0x28:
  25105. ++numParen;
  25106. strBuf.push("(");
  25107. break;
  25108. case 0x29:
  25109. if (--numParen === 0) {
  25110. this.nextChar();
  25111. done = true;
  25112. } else {
  25113. strBuf.push(")");
  25114. }
  25115. break;
  25116. case 0x5c:
  25117. ch = this.nextChar();
  25118. switch (ch) {
  25119. case -1:
  25120. (0, _util.warn)("Unterminated string");
  25121. done = true;
  25122. break;
  25123. case 0x6e:
  25124. strBuf.push("\n");
  25125. break;
  25126. case 0x72:
  25127. strBuf.push("\r");
  25128. break;
  25129. case 0x74:
  25130. strBuf.push("\t");
  25131. break;
  25132. case 0x62:
  25133. strBuf.push("\b");
  25134. break;
  25135. case 0x66:
  25136. strBuf.push("\f");
  25137. break;
  25138. case 0x5c:
  25139. case 0x28:
  25140. case 0x29:
  25141. strBuf.push(String.fromCharCode(ch));
  25142. break;
  25143. case 0x30:
  25144. case 0x31:
  25145. case 0x32:
  25146. case 0x33:
  25147. case 0x34:
  25148. case 0x35:
  25149. case 0x36:
  25150. case 0x37:
  25151. let x = ch & 0x0f;
  25152. ch = this.nextChar();
  25153. charBuffered = true;
  25154. if (ch >= 0x30 && ch <= 0x37) {
  25155. x = (x << 3) + (ch & 0x0f);
  25156. ch = this.nextChar();
  25157. if (ch >= 0x30 && ch <= 0x37) {
  25158. charBuffered = false;
  25159. x = (x << 3) + (ch & 0x0f);
  25160. }
  25161. }
  25162. strBuf.push(String.fromCharCode(x));
  25163. break;
  25164. case 0x0d:
  25165. if (this.peekChar() === 0x0a) {
  25166. this.nextChar();
  25167. }
  25168. break;
  25169. case 0x0a:
  25170. break;
  25171. default:
  25172. strBuf.push(String.fromCharCode(ch));
  25173. break;
  25174. }
  25175. break;
  25176. default:
  25177. strBuf.push(String.fromCharCode(ch));
  25178. break;
  25179. }
  25180. if (done) {
  25181. break;
  25182. }
  25183. if (!charBuffered) {
  25184. ch = this.nextChar();
  25185. }
  25186. }
  25187. return strBuf.join("");
  25188. }
  25189. getName() {
  25190. let ch, previousCh;
  25191. const strBuf = this.strBuf;
  25192. strBuf.length = 0;
  25193. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25194. if (ch === 0x23) {
  25195. ch = this.nextChar();
  25196. if (specialChars[ch]) {
  25197. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  25198. strBuf.push("#");
  25199. break;
  25200. }
  25201. const x = toHexDigit(ch);
  25202. if (x !== -1) {
  25203. previousCh = ch;
  25204. ch = this.nextChar();
  25205. const x2 = toHexDigit(ch);
  25206. if (x2 === -1) {
  25207. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  25208. strBuf.push("#", String.fromCharCode(previousCh));
  25209. if (specialChars[ch]) {
  25210. break;
  25211. }
  25212. strBuf.push(String.fromCharCode(ch));
  25213. continue;
  25214. }
  25215. strBuf.push(String.fromCharCode(x << 4 | x2));
  25216. } else {
  25217. strBuf.push("#", String.fromCharCode(ch));
  25218. }
  25219. } else {
  25220. strBuf.push(String.fromCharCode(ch));
  25221. }
  25222. }
  25223. if (strBuf.length > 127) {
  25224. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  25225. }
  25226. return _primitives.Name.get(strBuf.join(""));
  25227. }
  25228. _hexStringWarn(ch) {
  25229. const MAX_HEX_STRING_NUM_WARN = 5;
  25230. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  25231. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  25232. return;
  25233. }
  25234. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  25235. return;
  25236. }
  25237. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  25238. }
  25239. getHexString() {
  25240. const strBuf = this.strBuf;
  25241. strBuf.length = 0;
  25242. let ch = this.currentChar;
  25243. let isFirstHex = true;
  25244. let firstDigit, secondDigit;
  25245. this._hexStringNumWarn = 0;
  25246. while (true) {
  25247. if (ch < 0) {
  25248. (0, _util.warn)("Unterminated hex string");
  25249. break;
  25250. } else if (ch === 0x3e) {
  25251. this.nextChar();
  25252. break;
  25253. } else if (specialChars[ch] === 1) {
  25254. ch = this.nextChar();
  25255. continue;
  25256. } else {
  25257. if (isFirstHex) {
  25258. firstDigit = toHexDigit(ch);
  25259. if (firstDigit === -1) {
  25260. this._hexStringWarn(ch);
  25261. ch = this.nextChar();
  25262. continue;
  25263. }
  25264. } else {
  25265. secondDigit = toHexDigit(ch);
  25266. if (secondDigit === -1) {
  25267. this._hexStringWarn(ch);
  25268. ch = this.nextChar();
  25269. continue;
  25270. }
  25271. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  25272. }
  25273. isFirstHex = !isFirstHex;
  25274. ch = this.nextChar();
  25275. }
  25276. }
  25277. return strBuf.join("");
  25278. }
  25279. getObj() {
  25280. let comment = false;
  25281. let ch = this.currentChar;
  25282. while (true) {
  25283. if (ch < 0) {
  25284. return _primitives.EOF;
  25285. }
  25286. if (comment) {
  25287. if (ch === 0x0a || ch === 0x0d) {
  25288. comment = false;
  25289. }
  25290. } else if (ch === 0x25) {
  25291. comment = true;
  25292. } else if (specialChars[ch] !== 1) {
  25293. break;
  25294. }
  25295. ch = this.nextChar();
  25296. }
  25297. switch (ch | 0) {
  25298. case 0x30:
  25299. case 0x31:
  25300. case 0x32:
  25301. case 0x33:
  25302. case 0x34:
  25303. case 0x35:
  25304. case 0x36:
  25305. case 0x37:
  25306. case 0x38:
  25307. case 0x39:
  25308. case 0x2b:
  25309. case 0x2d:
  25310. case 0x2e:
  25311. return this.getNumber();
  25312. case 0x28:
  25313. return this.getString();
  25314. case 0x2f:
  25315. return this.getName();
  25316. case 0x5b:
  25317. this.nextChar();
  25318. return _primitives.Cmd.get("[");
  25319. case 0x5d:
  25320. this.nextChar();
  25321. return _primitives.Cmd.get("]");
  25322. case 0x3c:
  25323. ch = this.nextChar();
  25324. if (ch === 0x3c) {
  25325. this.nextChar();
  25326. return _primitives.Cmd.get("<<");
  25327. }
  25328. return this.getHexString();
  25329. case 0x3e:
  25330. ch = this.nextChar();
  25331. if (ch === 0x3e) {
  25332. this.nextChar();
  25333. return _primitives.Cmd.get(">>");
  25334. }
  25335. return _primitives.Cmd.get(">");
  25336. case 0x7b:
  25337. this.nextChar();
  25338. return _primitives.Cmd.get("{");
  25339. case 0x7d:
  25340. this.nextChar();
  25341. return _primitives.Cmd.get("}");
  25342. case 0x29:
  25343. this.nextChar();
  25344. throw new _util.FormatError(`Illegal character: ${ch}`);
  25345. }
  25346. let str = String.fromCharCode(ch);
  25347. if (ch < 0x20 || ch > 0x7f) {
  25348. const nextCh = this.peekChar();
  25349. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  25350. this.nextChar();
  25351. return _primitives.Cmd.get(str);
  25352. }
  25353. }
  25354. const knownCommands = this.knownCommands;
  25355. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25356. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25357. const possibleCommand = str + String.fromCharCode(ch);
  25358. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  25359. break;
  25360. }
  25361. if (str.length === 128) {
  25362. throw new _util.FormatError(`Command token too long: ${str.length}`);
  25363. }
  25364. str = possibleCommand;
  25365. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25366. }
  25367. if (str === "true") {
  25368. return true;
  25369. }
  25370. if (str === "false") {
  25371. return false;
  25372. }
  25373. if (str === "null") {
  25374. return null;
  25375. }
  25376. if (str === "BI") {
  25377. this.beginInlineImagePos = this.stream.pos;
  25378. }
  25379. return _primitives.Cmd.get(str);
  25380. }
  25381. peekObj() {
  25382. const streamPos = this.stream.pos,
  25383. currentChar = this.currentChar,
  25384. beginInlineImagePos = this.beginInlineImagePos;
  25385. let nextObj;
  25386. try {
  25387. nextObj = this.getObj();
  25388. } catch (ex) {
  25389. if (ex instanceof _core_utils.MissingDataException) {
  25390. throw ex;
  25391. }
  25392. (0, _util.warn)(`peekObj: ${ex}`);
  25393. }
  25394. this.stream.pos = streamPos;
  25395. this.currentChar = currentChar;
  25396. this.beginInlineImagePos = beginInlineImagePos;
  25397. return nextObj;
  25398. }
  25399. skipToNextLine() {
  25400. let ch = this.currentChar;
  25401. while (ch >= 0) {
  25402. if (ch === 0x0d) {
  25403. ch = this.nextChar();
  25404. if (ch === 0x0a) {
  25405. this.nextChar();
  25406. }
  25407. break;
  25408. } else if (ch === 0x0a) {
  25409. this.nextChar();
  25410. break;
  25411. }
  25412. ch = this.nextChar();
  25413. }
  25414. }
  25415. }
  25416. exports.Lexer = Lexer;
  25417. class Linearization {
  25418. static create(stream) {
  25419. function getInt(linDict, name, allowZeroValue = false) {
  25420. const obj = linDict.get(name);
  25421. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  25422. return obj;
  25423. }
  25424. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  25425. }
  25426. function getHints(linDict) {
  25427. const hints = linDict.get("H");
  25428. let hintsLength;
  25429. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  25430. for (let index = 0; index < hintsLength; index++) {
  25431. const hint = hints[index];
  25432. if (!(Number.isInteger(hint) && hint > 0)) {
  25433. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  25434. }
  25435. }
  25436. return hints;
  25437. }
  25438. throw new Error("Hint array in the linearization dictionary is invalid.");
  25439. }
  25440. const parser = new Parser({
  25441. lexer: new Lexer(stream),
  25442. xref: null
  25443. });
  25444. const obj1 = parser.getObj();
  25445. const obj2 = parser.getObj();
  25446. const obj3 = parser.getObj();
  25447. const linDict = parser.getObj();
  25448. let obj, length;
  25449. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  25450. return null;
  25451. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  25452. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  25453. }
  25454. return {
  25455. length,
  25456. hints: getHints(linDict),
  25457. objectNumberFirst: getInt(linDict, "O"),
  25458. endFirst: getInt(linDict, "E"),
  25459. numPages: getInt(linDict, "N"),
  25460. mainXRefEntriesOffset: getInt(linDict, "T"),
  25461. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  25462. };
  25463. }
  25464. }
  25465. exports.Linearization = Linearization;
  25466. /***/ }),
  25467. /* 28 */
  25468. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25469. Object.defineProperty(exports, "__esModule", ({
  25470. value: true
  25471. }));
  25472. exports.Ascii85Stream = void 0;
  25473. var _decode_stream = __w_pdfjs_require__(29);
  25474. var _core_utils = __w_pdfjs_require__(8);
  25475. class Ascii85Stream extends _decode_stream.DecodeStream {
  25476. constructor(str, maybeLength) {
  25477. if (maybeLength) {
  25478. maybeLength *= 0.8;
  25479. }
  25480. super(maybeLength);
  25481. this.str = str;
  25482. this.dict = str.dict;
  25483. this.input = new Uint8Array(5);
  25484. }
  25485. readBlock() {
  25486. const TILDA_CHAR = 0x7e;
  25487. const Z_LOWER_CHAR = 0x7a;
  25488. const EOF = -1;
  25489. const str = this.str;
  25490. let c = str.getByte();
  25491. while ((0, _core_utils.isWhiteSpace)(c)) {
  25492. c = str.getByte();
  25493. }
  25494. if (c === EOF || c === TILDA_CHAR) {
  25495. this.eof = true;
  25496. return;
  25497. }
  25498. const bufferLength = this.bufferLength;
  25499. let buffer, i;
  25500. if (c === Z_LOWER_CHAR) {
  25501. buffer = this.ensureBuffer(bufferLength + 4);
  25502. for (i = 0; i < 4; ++i) {
  25503. buffer[bufferLength + i] = 0;
  25504. }
  25505. this.bufferLength += 4;
  25506. } else {
  25507. const input = this.input;
  25508. input[0] = c;
  25509. for (i = 1; i < 5; ++i) {
  25510. c = str.getByte();
  25511. while ((0, _core_utils.isWhiteSpace)(c)) {
  25512. c = str.getByte();
  25513. }
  25514. input[i] = c;
  25515. if (c === EOF || c === TILDA_CHAR) {
  25516. break;
  25517. }
  25518. }
  25519. buffer = this.ensureBuffer(bufferLength + i - 1);
  25520. this.bufferLength += i - 1;
  25521. if (i < 5) {
  25522. for (; i < 5; ++i) {
  25523. input[i] = 0x21 + 84;
  25524. }
  25525. this.eof = true;
  25526. }
  25527. let t = 0;
  25528. for (i = 0; i < 5; ++i) {
  25529. t = t * 85 + (input[i] - 0x21);
  25530. }
  25531. for (i = 3; i >= 0; --i) {
  25532. buffer[bufferLength + i] = t & 0xff;
  25533. t >>= 8;
  25534. }
  25535. }
  25536. }
  25537. }
  25538. exports.Ascii85Stream = Ascii85Stream;
  25539. /***/ }),
  25540. /* 29 */
  25541. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25542. Object.defineProperty(exports, "__esModule", ({
  25543. value: true
  25544. }));
  25545. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  25546. var _base_stream = __w_pdfjs_require__(9);
  25547. var _stream = __w_pdfjs_require__(10);
  25548. const emptyBuffer = new Uint8Array(0);
  25549. class DecodeStream extends _base_stream.BaseStream {
  25550. constructor(maybeMinBufferLength) {
  25551. super();
  25552. this._rawMinBufferLength = maybeMinBufferLength || 0;
  25553. this.pos = 0;
  25554. this.bufferLength = 0;
  25555. this.eof = false;
  25556. this.buffer = emptyBuffer;
  25557. this.minBufferLength = 512;
  25558. if (maybeMinBufferLength) {
  25559. while (this.minBufferLength < maybeMinBufferLength) {
  25560. this.minBufferLength *= 2;
  25561. }
  25562. }
  25563. }
  25564. get isEmpty() {
  25565. while (!this.eof && this.bufferLength === 0) {
  25566. this.readBlock();
  25567. }
  25568. return this.bufferLength === 0;
  25569. }
  25570. ensureBuffer(requested) {
  25571. const buffer = this.buffer;
  25572. if (requested <= buffer.byteLength) {
  25573. return buffer;
  25574. }
  25575. let size = this.minBufferLength;
  25576. while (size < requested) {
  25577. size *= 2;
  25578. }
  25579. const buffer2 = new Uint8Array(size);
  25580. buffer2.set(buffer);
  25581. return this.buffer = buffer2;
  25582. }
  25583. getByte() {
  25584. const pos = this.pos;
  25585. while (this.bufferLength <= pos) {
  25586. if (this.eof) {
  25587. return -1;
  25588. }
  25589. this.readBlock();
  25590. }
  25591. return this.buffer[this.pos++];
  25592. }
  25593. getBytes(length, forceClamped = false) {
  25594. const pos = this.pos;
  25595. let end;
  25596. if (length) {
  25597. this.ensureBuffer(pos + length);
  25598. end = pos + length;
  25599. while (!this.eof && this.bufferLength < end) {
  25600. this.readBlock();
  25601. }
  25602. const bufEnd = this.bufferLength;
  25603. if (end > bufEnd) {
  25604. end = bufEnd;
  25605. }
  25606. } else {
  25607. while (!this.eof) {
  25608. this.readBlock();
  25609. }
  25610. end = this.bufferLength;
  25611. }
  25612. this.pos = end;
  25613. const subarray = this.buffer.subarray(pos, end);
  25614. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  25615. }
  25616. reset() {
  25617. this.pos = 0;
  25618. }
  25619. makeSubStream(start, length, dict = null) {
  25620. if (length === undefined) {
  25621. while (!this.eof) {
  25622. this.readBlock();
  25623. }
  25624. } else {
  25625. const end = start + length;
  25626. while (this.bufferLength <= end && !this.eof) {
  25627. this.readBlock();
  25628. }
  25629. }
  25630. return new _stream.Stream(this.buffer, start, length, dict);
  25631. }
  25632. getBaseStreams() {
  25633. return this.str ? this.str.getBaseStreams() : null;
  25634. }
  25635. }
  25636. exports.DecodeStream = DecodeStream;
  25637. class StreamsSequenceStream extends DecodeStream {
  25638. constructor(streams, onError = null) {
  25639. let maybeLength = 0;
  25640. for (const stream of streams) {
  25641. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  25642. }
  25643. super(maybeLength);
  25644. this.streams = streams;
  25645. this._onError = onError;
  25646. }
  25647. readBlock() {
  25648. const streams = this.streams;
  25649. if (streams.length === 0) {
  25650. this.eof = true;
  25651. return;
  25652. }
  25653. const stream = streams.shift();
  25654. let chunk;
  25655. try {
  25656. chunk = stream.getBytes();
  25657. } catch (reason) {
  25658. if (this._onError) {
  25659. this._onError(reason, stream.dict && stream.dict.objId);
  25660. return;
  25661. }
  25662. throw reason;
  25663. }
  25664. const bufferLength = this.bufferLength;
  25665. const newLength = bufferLength + chunk.length;
  25666. const buffer = this.ensureBuffer(newLength);
  25667. buffer.set(chunk, bufferLength);
  25668. this.bufferLength = newLength;
  25669. }
  25670. getBaseStreams() {
  25671. const baseStreamsBuf = [];
  25672. for (const stream of this.streams) {
  25673. const baseStreams = stream.getBaseStreams();
  25674. if (baseStreams) {
  25675. baseStreamsBuf.push(...baseStreams);
  25676. }
  25677. }
  25678. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  25679. }
  25680. }
  25681. exports.StreamsSequenceStream = StreamsSequenceStream;
  25682. /***/ }),
  25683. /* 30 */
  25684. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25685. Object.defineProperty(exports, "__esModule", ({
  25686. value: true
  25687. }));
  25688. exports.AsciiHexStream = void 0;
  25689. var _decode_stream = __w_pdfjs_require__(29);
  25690. class AsciiHexStream extends _decode_stream.DecodeStream {
  25691. constructor(str, maybeLength) {
  25692. if (maybeLength) {
  25693. maybeLength *= 0.5;
  25694. }
  25695. super(maybeLength);
  25696. this.str = str;
  25697. this.dict = str.dict;
  25698. this.firstDigit = -1;
  25699. }
  25700. readBlock() {
  25701. const UPSTREAM_BLOCK_SIZE = 8000;
  25702. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  25703. if (!bytes.length) {
  25704. this.eof = true;
  25705. return;
  25706. }
  25707. const maxDecodeLength = bytes.length + 1 >> 1;
  25708. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  25709. let bufferLength = this.bufferLength;
  25710. let firstDigit = this.firstDigit;
  25711. for (const ch of bytes) {
  25712. let digit;
  25713. if (ch >= 0x30 && ch <= 0x39) {
  25714. digit = ch & 0x0f;
  25715. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25716. digit = (ch & 0x0f) + 9;
  25717. } else if (ch === 0x3e) {
  25718. this.eof = true;
  25719. break;
  25720. } else {
  25721. continue;
  25722. }
  25723. if (firstDigit < 0) {
  25724. firstDigit = digit;
  25725. } else {
  25726. buffer[bufferLength++] = firstDigit << 4 | digit;
  25727. firstDigit = -1;
  25728. }
  25729. }
  25730. if (firstDigit >= 0 && this.eof) {
  25731. buffer[bufferLength++] = firstDigit << 4;
  25732. firstDigit = -1;
  25733. }
  25734. this.firstDigit = firstDigit;
  25735. this.bufferLength = bufferLength;
  25736. }
  25737. }
  25738. exports.AsciiHexStream = AsciiHexStream;
  25739. /***/ }),
  25740. /* 31 */
  25741. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25742. Object.defineProperty(exports, "__esModule", ({
  25743. value: true
  25744. }));
  25745. exports.CCITTFaxStream = void 0;
  25746. var _ccitt = __w_pdfjs_require__(32);
  25747. var _decode_stream = __w_pdfjs_require__(29);
  25748. var _primitives = __w_pdfjs_require__(5);
  25749. class CCITTFaxStream extends _decode_stream.DecodeStream {
  25750. constructor(str, maybeLength, params) {
  25751. super(maybeLength);
  25752. this.str = str;
  25753. this.dict = str.dict;
  25754. if (!(params instanceof _primitives.Dict)) {
  25755. params = _primitives.Dict.empty;
  25756. }
  25757. const source = {
  25758. next() {
  25759. return str.getByte();
  25760. }
  25761. };
  25762. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  25763. K: params.get("K"),
  25764. EndOfLine: params.get("EndOfLine"),
  25765. EncodedByteAlign: params.get("EncodedByteAlign"),
  25766. Columns: params.get("Columns"),
  25767. Rows: params.get("Rows"),
  25768. EndOfBlock: params.get("EndOfBlock"),
  25769. BlackIs1: params.get("BlackIs1")
  25770. });
  25771. }
  25772. readBlock() {
  25773. while (!this.eof) {
  25774. const c = this.ccittFaxDecoder.readNextChar();
  25775. if (c === -1) {
  25776. this.eof = true;
  25777. return;
  25778. }
  25779. this.ensureBuffer(this.bufferLength + 1);
  25780. this.buffer[this.bufferLength++] = c;
  25781. }
  25782. }
  25783. }
  25784. exports.CCITTFaxStream = CCITTFaxStream;
  25785. /***/ }),
  25786. /* 32 */
  25787. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25788. Object.defineProperty(exports, "__esModule", ({
  25789. value: true
  25790. }));
  25791. exports.CCITTFaxDecoder = void 0;
  25792. var _util = __w_pdfjs_require__(2);
  25793. const ccittEOL = -2;
  25794. const ccittEOF = -1;
  25795. const twoDimPass = 0;
  25796. const twoDimHoriz = 1;
  25797. const twoDimVert0 = 2;
  25798. const twoDimVertR1 = 3;
  25799. const twoDimVertL1 = 4;
  25800. const twoDimVertR2 = 5;
  25801. const twoDimVertL2 = 6;
  25802. const twoDimVertR3 = 7;
  25803. const twoDimVertL3 = 8;
  25804. 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]];
  25805. 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]];
  25806. 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]];
  25807. 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]];
  25808. 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]];
  25809. 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]];
  25810. class CCITTFaxDecoder {
  25811. constructor(source, options = {}) {
  25812. if (!source || typeof source.next !== "function") {
  25813. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  25814. }
  25815. this.source = source;
  25816. this.eof = false;
  25817. this.encoding = options.K || 0;
  25818. this.eoline = options.EndOfLine || false;
  25819. this.byteAlign = options.EncodedByteAlign || false;
  25820. this.columns = options.Columns || 1728;
  25821. this.rows = options.Rows || 0;
  25822. let eoblock = options.EndOfBlock;
  25823. if (eoblock === null || eoblock === undefined) {
  25824. eoblock = true;
  25825. }
  25826. this.eoblock = eoblock;
  25827. this.black = options.BlackIs1 || false;
  25828. this.codingLine = new Uint32Array(this.columns + 1);
  25829. this.refLine = new Uint32Array(this.columns + 2);
  25830. this.codingLine[0] = this.columns;
  25831. this.codingPos = 0;
  25832. this.row = 0;
  25833. this.nextLine2D = this.encoding < 0;
  25834. this.inputBits = 0;
  25835. this.inputBuf = 0;
  25836. this.outputBits = 0;
  25837. this.rowsDone = false;
  25838. let code1;
  25839. while ((code1 = this._lookBits(12)) === 0) {
  25840. this._eatBits(1);
  25841. }
  25842. if (code1 === 1) {
  25843. this._eatBits(12);
  25844. }
  25845. if (this.encoding > 0) {
  25846. this.nextLine2D = !this._lookBits(1);
  25847. this._eatBits(1);
  25848. }
  25849. }
  25850. readNextChar() {
  25851. if (this.eof) {
  25852. return -1;
  25853. }
  25854. const refLine = this.refLine;
  25855. const codingLine = this.codingLine;
  25856. const columns = this.columns;
  25857. let refPos, blackPixels, bits, i;
  25858. if (this.outputBits === 0) {
  25859. if (this.rowsDone) {
  25860. this.eof = true;
  25861. }
  25862. if (this.eof) {
  25863. return -1;
  25864. }
  25865. this.err = false;
  25866. let code1, code2, code3;
  25867. if (this.nextLine2D) {
  25868. for (i = 0; codingLine[i] < columns; ++i) {
  25869. refLine[i] = codingLine[i];
  25870. }
  25871. refLine[i++] = columns;
  25872. refLine[i] = columns;
  25873. codingLine[0] = 0;
  25874. this.codingPos = 0;
  25875. refPos = 0;
  25876. blackPixels = 0;
  25877. while (codingLine[this.codingPos] < columns) {
  25878. code1 = this._getTwoDimCode();
  25879. switch (code1) {
  25880. case twoDimPass:
  25881. this._addPixels(refLine[refPos + 1], blackPixels);
  25882. if (refLine[refPos + 1] < columns) {
  25883. refPos += 2;
  25884. }
  25885. break;
  25886. case twoDimHoriz:
  25887. code1 = code2 = 0;
  25888. if (blackPixels) {
  25889. do {
  25890. code1 += code3 = this._getBlackCode();
  25891. } while (code3 >= 64);
  25892. do {
  25893. code2 += code3 = this._getWhiteCode();
  25894. } while (code3 >= 64);
  25895. } else {
  25896. do {
  25897. code1 += code3 = this._getWhiteCode();
  25898. } while (code3 >= 64);
  25899. do {
  25900. code2 += code3 = this._getBlackCode();
  25901. } while (code3 >= 64);
  25902. }
  25903. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  25904. if (codingLine[this.codingPos] < columns) {
  25905. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  25906. }
  25907. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25908. refPos += 2;
  25909. }
  25910. break;
  25911. case twoDimVertR3:
  25912. this._addPixels(refLine[refPos] + 3, blackPixels);
  25913. blackPixels ^= 1;
  25914. if (codingLine[this.codingPos] < columns) {
  25915. ++refPos;
  25916. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25917. refPos += 2;
  25918. }
  25919. }
  25920. break;
  25921. case twoDimVertR2:
  25922. this._addPixels(refLine[refPos] + 2, blackPixels);
  25923. blackPixels ^= 1;
  25924. if (codingLine[this.codingPos] < columns) {
  25925. ++refPos;
  25926. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25927. refPos += 2;
  25928. }
  25929. }
  25930. break;
  25931. case twoDimVertR1:
  25932. this._addPixels(refLine[refPos] + 1, blackPixels);
  25933. blackPixels ^= 1;
  25934. if (codingLine[this.codingPos] < columns) {
  25935. ++refPos;
  25936. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25937. refPos += 2;
  25938. }
  25939. }
  25940. break;
  25941. case twoDimVert0:
  25942. this._addPixels(refLine[refPos], blackPixels);
  25943. blackPixels ^= 1;
  25944. if (codingLine[this.codingPos] < columns) {
  25945. ++refPos;
  25946. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25947. refPos += 2;
  25948. }
  25949. }
  25950. break;
  25951. case twoDimVertL3:
  25952. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  25953. blackPixels ^= 1;
  25954. if (codingLine[this.codingPos] < columns) {
  25955. if (refPos > 0) {
  25956. --refPos;
  25957. } else {
  25958. ++refPos;
  25959. }
  25960. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25961. refPos += 2;
  25962. }
  25963. }
  25964. break;
  25965. case twoDimVertL2:
  25966. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  25967. blackPixels ^= 1;
  25968. if (codingLine[this.codingPos] < columns) {
  25969. if (refPos > 0) {
  25970. --refPos;
  25971. } else {
  25972. ++refPos;
  25973. }
  25974. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25975. refPos += 2;
  25976. }
  25977. }
  25978. break;
  25979. case twoDimVertL1:
  25980. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  25981. blackPixels ^= 1;
  25982. if (codingLine[this.codingPos] < columns) {
  25983. if (refPos > 0) {
  25984. --refPos;
  25985. } else {
  25986. ++refPos;
  25987. }
  25988. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25989. refPos += 2;
  25990. }
  25991. }
  25992. break;
  25993. case ccittEOF:
  25994. this._addPixels(columns, 0);
  25995. this.eof = true;
  25996. break;
  25997. default:
  25998. (0, _util.info)("bad 2d code");
  25999. this._addPixels(columns, 0);
  26000. this.err = true;
  26001. }
  26002. }
  26003. } else {
  26004. codingLine[0] = 0;
  26005. this.codingPos = 0;
  26006. blackPixels = 0;
  26007. while (codingLine[this.codingPos] < columns) {
  26008. code1 = 0;
  26009. if (blackPixels) {
  26010. do {
  26011. code1 += code3 = this._getBlackCode();
  26012. } while (code3 >= 64);
  26013. } else {
  26014. do {
  26015. code1 += code3 = this._getWhiteCode();
  26016. } while (code3 >= 64);
  26017. }
  26018. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26019. blackPixels ^= 1;
  26020. }
  26021. }
  26022. let gotEOL = false;
  26023. if (this.byteAlign) {
  26024. this.inputBits &= ~7;
  26025. }
  26026. if (!this.eoblock && this.row === this.rows - 1) {
  26027. this.rowsDone = true;
  26028. } else {
  26029. code1 = this._lookBits(12);
  26030. if (this.eoline) {
  26031. while (code1 !== ccittEOF && code1 !== 1) {
  26032. this._eatBits(1);
  26033. code1 = this._lookBits(12);
  26034. }
  26035. } else {
  26036. while (code1 === 0) {
  26037. this._eatBits(1);
  26038. code1 = this._lookBits(12);
  26039. }
  26040. }
  26041. if (code1 === 1) {
  26042. this._eatBits(12);
  26043. gotEOL = true;
  26044. } else if (code1 === ccittEOF) {
  26045. this.eof = true;
  26046. }
  26047. }
  26048. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  26049. this.nextLine2D = !this._lookBits(1);
  26050. this._eatBits(1);
  26051. }
  26052. if (this.eoblock && gotEOL && this.byteAlign) {
  26053. code1 = this._lookBits(12);
  26054. if (code1 === 1) {
  26055. this._eatBits(12);
  26056. if (this.encoding > 0) {
  26057. this._lookBits(1);
  26058. this._eatBits(1);
  26059. }
  26060. if (this.encoding >= 0) {
  26061. for (i = 0; i < 4; ++i) {
  26062. code1 = this._lookBits(12);
  26063. if (code1 !== 1) {
  26064. (0, _util.info)("bad rtc code: " + code1);
  26065. }
  26066. this._eatBits(12);
  26067. if (this.encoding > 0) {
  26068. this._lookBits(1);
  26069. this._eatBits(1);
  26070. }
  26071. }
  26072. }
  26073. this.eof = true;
  26074. }
  26075. } else if (this.err && this.eoline) {
  26076. while (true) {
  26077. code1 = this._lookBits(13);
  26078. if (code1 === ccittEOF) {
  26079. this.eof = true;
  26080. return -1;
  26081. }
  26082. if (code1 >> 1 === 1) {
  26083. break;
  26084. }
  26085. this._eatBits(1);
  26086. }
  26087. this._eatBits(12);
  26088. if (this.encoding > 0) {
  26089. this._eatBits(1);
  26090. this.nextLine2D = !(code1 & 1);
  26091. }
  26092. }
  26093. if (codingLine[0] > 0) {
  26094. this.outputBits = codingLine[this.codingPos = 0];
  26095. } else {
  26096. this.outputBits = codingLine[this.codingPos = 1];
  26097. }
  26098. this.row++;
  26099. }
  26100. let c;
  26101. if (this.outputBits >= 8) {
  26102. c = this.codingPos & 1 ? 0 : 0xff;
  26103. this.outputBits -= 8;
  26104. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  26105. this.codingPos++;
  26106. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26107. }
  26108. } else {
  26109. bits = 8;
  26110. c = 0;
  26111. do {
  26112. if (typeof this.outputBits !== "number") {
  26113. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  26114. }
  26115. if (this.outputBits > bits) {
  26116. c <<= bits;
  26117. if (!(this.codingPos & 1)) {
  26118. c |= 0xff >> 8 - bits;
  26119. }
  26120. this.outputBits -= bits;
  26121. bits = 0;
  26122. } else {
  26123. c <<= this.outputBits;
  26124. if (!(this.codingPos & 1)) {
  26125. c |= 0xff >> 8 - this.outputBits;
  26126. }
  26127. bits -= this.outputBits;
  26128. this.outputBits = 0;
  26129. if (codingLine[this.codingPos] < columns) {
  26130. this.codingPos++;
  26131. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26132. } else if (bits > 0) {
  26133. c <<= bits;
  26134. bits = 0;
  26135. }
  26136. }
  26137. } while (bits);
  26138. }
  26139. if (this.black) {
  26140. c ^= 0xff;
  26141. }
  26142. return c;
  26143. }
  26144. _addPixels(a1, blackPixels) {
  26145. const codingLine = this.codingLine;
  26146. let codingPos = this.codingPos;
  26147. if (a1 > codingLine[codingPos]) {
  26148. if (a1 > this.columns) {
  26149. (0, _util.info)("row is wrong length");
  26150. this.err = true;
  26151. a1 = this.columns;
  26152. }
  26153. if (codingPos & 1 ^ blackPixels) {
  26154. ++codingPos;
  26155. }
  26156. codingLine[codingPos] = a1;
  26157. }
  26158. this.codingPos = codingPos;
  26159. }
  26160. _addPixelsNeg(a1, blackPixels) {
  26161. const codingLine = this.codingLine;
  26162. let codingPos = this.codingPos;
  26163. if (a1 > codingLine[codingPos]) {
  26164. if (a1 > this.columns) {
  26165. (0, _util.info)("row is wrong length");
  26166. this.err = true;
  26167. a1 = this.columns;
  26168. }
  26169. if (codingPos & 1 ^ blackPixels) {
  26170. ++codingPos;
  26171. }
  26172. codingLine[codingPos] = a1;
  26173. } else if (a1 < codingLine[codingPos]) {
  26174. if (a1 < 0) {
  26175. (0, _util.info)("invalid code");
  26176. this.err = true;
  26177. a1 = 0;
  26178. }
  26179. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  26180. --codingPos;
  26181. }
  26182. codingLine[codingPos] = a1;
  26183. }
  26184. this.codingPos = codingPos;
  26185. }
  26186. _findTableCode(start, end, table, limit) {
  26187. const limitValue = limit || 0;
  26188. for (let i = start; i <= end; ++i) {
  26189. let code = this._lookBits(i);
  26190. if (code === ccittEOF) {
  26191. return [true, 1, false];
  26192. }
  26193. if (i < end) {
  26194. code <<= end - i;
  26195. }
  26196. if (!limitValue || code >= limitValue) {
  26197. const p = table[code - limitValue];
  26198. if (p[0] === i) {
  26199. this._eatBits(i);
  26200. return [true, p[1], true];
  26201. }
  26202. }
  26203. }
  26204. return [false, 0, false];
  26205. }
  26206. _getTwoDimCode() {
  26207. let code = 0;
  26208. let p;
  26209. if (this.eoblock) {
  26210. code = this._lookBits(7);
  26211. p = twoDimTable[code];
  26212. if (p && p[0] > 0) {
  26213. this._eatBits(p[0]);
  26214. return p[1];
  26215. }
  26216. } else {
  26217. const result = this._findTableCode(1, 7, twoDimTable);
  26218. if (result[0] && result[2]) {
  26219. return result[1];
  26220. }
  26221. }
  26222. (0, _util.info)("Bad two dim code");
  26223. return ccittEOF;
  26224. }
  26225. _getWhiteCode() {
  26226. let code = 0;
  26227. let p;
  26228. if (this.eoblock) {
  26229. code = this._lookBits(12);
  26230. if (code === ccittEOF) {
  26231. return 1;
  26232. }
  26233. if (code >> 5 === 0) {
  26234. p = whiteTable1[code];
  26235. } else {
  26236. p = whiteTable2[code >> 3];
  26237. }
  26238. if (p[0] > 0) {
  26239. this._eatBits(p[0]);
  26240. return p[1];
  26241. }
  26242. } else {
  26243. let result = this._findTableCode(1, 9, whiteTable2);
  26244. if (result[0]) {
  26245. return result[1];
  26246. }
  26247. result = this._findTableCode(11, 12, whiteTable1);
  26248. if (result[0]) {
  26249. return result[1];
  26250. }
  26251. }
  26252. (0, _util.info)("bad white code");
  26253. this._eatBits(1);
  26254. return 1;
  26255. }
  26256. _getBlackCode() {
  26257. let code, p;
  26258. if (this.eoblock) {
  26259. code = this._lookBits(13);
  26260. if (code === ccittEOF) {
  26261. return 1;
  26262. }
  26263. if (code >> 7 === 0) {
  26264. p = blackTable1[code];
  26265. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  26266. p = blackTable2[(code >> 1) - 64];
  26267. } else {
  26268. p = blackTable3[code >> 7];
  26269. }
  26270. if (p[0] > 0) {
  26271. this._eatBits(p[0]);
  26272. return p[1];
  26273. }
  26274. } else {
  26275. let result = this._findTableCode(2, 6, blackTable3);
  26276. if (result[0]) {
  26277. return result[1];
  26278. }
  26279. result = this._findTableCode(7, 12, blackTable2, 64);
  26280. if (result[0]) {
  26281. return result[1];
  26282. }
  26283. result = this._findTableCode(10, 13, blackTable1);
  26284. if (result[0]) {
  26285. return result[1];
  26286. }
  26287. }
  26288. (0, _util.info)("bad black code");
  26289. this._eatBits(1);
  26290. return 1;
  26291. }
  26292. _lookBits(n) {
  26293. let c;
  26294. while (this.inputBits < n) {
  26295. if ((c = this.source.next()) === -1) {
  26296. if (this.inputBits === 0) {
  26297. return ccittEOF;
  26298. }
  26299. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  26300. }
  26301. this.inputBuf = this.inputBuf << 8 | c;
  26302. this.inputBits += 8;
  26303. }
  26304. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  26305. }
  26306. _eatBits(n) {
  26307. if ((this.inputBits -= n) < 0) {
  26308. this.inputBits = 0;
  26309. }
  26310. }
  26311. }
  26312. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  26313. /***/ }),
  26314. /* 33 */
  26315. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26316. Object.defineProperty(exports, "__esModule", ({
  26317. value: true
  26318. }));
  26319. exports.FlateStream = void 0;
  26320. var _decode_stream = __w_pdfjs_require__(29);
  26321. var _util = __w_pdfjs_require__(2);
  26322. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  26323. 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]);
  26324. 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]);
  26325. 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];
  26326. 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];
  26327. class FlateStream extends _decode_stream.DecodeStream {
  26328. constructor(str, maybeLength) {
  26329. super(maybeLength);
  26330. this.str = str;
  26331. this.dict = str.dict;
  26332. const cmf = str.getByte();
  26333. const flg = str.getByte();
  26334. if (cmf === -1 || flg === -1) {
  26335. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  26336. }
  26337. if ((cmf & 0x0f) !== 0x08) {
  26338. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  26339. }
  26340. if (((cmf << 8) + flg) % 31 !== 0) {
  26341. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  26342. }
  26343. if (flg & 0x20) {
  26344. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  26345. }
  26346. this.codeSize = 0;
  26347. this.codeBuf = 0;
  26348. }
  26349. getBits(bits) {
  26350. const str = this.str;
  26351. let codeSize = this.codeSize;
  26352. let codeBuf = this.codeBuf;
  26353. let b;
  26354. while (codeSize < bits) {
  26355. if ((b = str.getByte()) === -1) {
  26356. throw new _util.FormatError("Bad encoding in flate stream");
  26357. }
  26358. codeBuf |= b << codeSize;
  26359. codeSize += 8;
  26360. }
  26361. b = codeBuf & (1 << bits) - 1;
  26362. this.codeBuf = codeBuf >> bits;
  26363. this.codeSize = codeSize -= bits;
  26364. return b;
  26365. }
  26366. getCode(table) {
  26367. const str = this.str;
  26368. const codes = table[0];
  26369. const maxLen = table[1];
  26370. let codeSize = this.codeSize;
  26371. let codeBuf = this.codeBuf;
  26372. let b;
  26373. while (codeSize < maxLen) {
  26374. if ((b = str.getByte()) === -1) {
  26375. break;
  26376. }
  26377. codeBuf |= b << codeSize;
  26378. codeSize += 8;
  26379. }
  26380. const code = codes[codeBuf & (1 << maxLen) - 1];
  26381. const codeLen = code >> 16;
  26382. const codeVal = code & 0xffff;
  26383. if (codeLen < 1 || codeSize < codeLen) {
  26384. throw new _util.FormatError("Bad encoding in flate stream");
  26385. }
  26386. this.codeBuf = codeBuf >> codeLen;
  26387. this.codeSize = codeSize - codeLen;
  26388. return codeVal;
  26389. }
  26390. generateHuffmanTable(lengths) {
  26391. const n = lengths.length;
  26392. let maxLen = 0;
  26393. let i;
  26394. for (i = 0; i < n; ++i) {
  26395. if (lengths[i] > maxLen) {
  26396. maxLen = lengths[i];
  26397. }
  26398. }
  26399. const size = 1 << maxLen;
  26400. const codes = new Int32Array(size);
  26401. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  26402. for (let val = 0; val < n; ++val) {
  26403. if (lengths[val] === len) {
  26404. let code2 = 0;
  26405. let t = code;
  26406. for (i = 0; i < len; ++i) {
  26407. code2 = code2 << 1 | t & 1;
  26408. t >>= 1;
  26409. }
  26410. for (i = code2; i < size; i += skip) {
  26411. codes[i] = len << 16 | val;
  26412. }
  26413. ++code;
  26414. }
  26415. }
  26416. }
  26417. return [codes, maxLen];
  26418. }
  26419. readBlock() {
  26420. let buffer, len;
  26421. const str = this.str;
  26422. let hdr = this.getBits(3);
  26423. if (hdr & 1) {
  26424. this.eof = true;
  26425. }
  26426. hdr >>= 1;
  26427. if (hdr === 0) {
  26428. let b;
  26429. if ((b = str.getByte()) === -1) {
  26430. throw new _util.FormatError("Bad block header in flate stream");
  26431. }
  26432. let blockLen = b;
  26433. if ((b = str.getByte()) === -1) {
  26434. throw new _util.FormatError("Bad block header in flate stream");
  26435. }
  26436. blockLen |= b << 8;
  26437. if ((b = str.getByte()) === -1) {
  26438. throw new _util.FormatError("Bad block header in flate stream");
  26439. }
  26440. let check = b;
  26441. if ((b = str.getByte()) === -1) {
  26442. throw new _util.FormatError("Bad block header in flate stream");
  26443. }
  26444. check |= b << 8;
  26445. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  26446. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  26447. }
  26448. this.codeBuf = 0;
  26449. this.codeSize = 0;
  26450. const bufferLength = this.bufferLength,
  26451. end = bufferLength + blockLen;
  26452. buffer = this.ensureBuffer(end);
  26453. this.bufferLength = end;
  26454. if (blockLen === 0) {
  26455. if (str.peekByte() === -1) {
  26456. this.eof = true;
  26457. }
  26458. } else {
  26459. const block = str.getBytes(blockLen);
  26460. buffer.set(block, bufferLength);
  26461. if (block.length < blockLen) {
  26462. this.eof = true;
  26463. }
  26464. }
  26465. return;
  26466. }
  26467. let litCodeTable;
  26468. let distCodeTable;
  26469. if (hdr === 1) {
  26470. litCodeTable = fixedLitCodeTab;
  26471. distCodeTable = fixedDistCodeTab;
  26472. } else if (hdr === 2) {
  26473. const numLitCodes = this.getBits(5) + 257;
  26474. const numDistCodes = this.getBits(5) + 1;
  26475. const numCodeLenCodes = this.getBits(4) + 4;
  26476. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  26477. let i;
  26478. for (i = 0; i < numCodeLenCodes; ++i) {
  26479. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  26480. }
  26481. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  26482. len = 0;
  26483. i = 0;
  26484. const codes = numLitCodes + numDistCodes;
  26485. const codeLengths = new Uint8Array(codes);
  26486. let bitsLength, bitsOffset, what;
  26487. while (i < codes) {
  26488. const code = this.getCode(codeLenCodeTab);
  26489. if (code === 16) {
  26490. bitsLength = 2;
  26491. bitsOffset = 3;
  26492. what = len;
  26493. } else if (code === 17) {
  26494. bitsLength = 3;
  26495. bitsOffset = 3;
  26496. what = len = 0;
  26497. } else if (code === 18) {
  26498. bitsLength = 7;
  26499. bitsOffset = 11;
  26500. what = len = 0;
  26501. } else {
  26502. codeLengths[i++] = len = code;
  26503. continue;
  26504. }
  26505. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  26506. while (repeatLength-- > 0) {
  26507. codeLengths[i++] = what;
  26508. }
  26509. }
  26510. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  26511. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  26512. } else {
  26513. throw new _util.FormatError("Unknown block type in flate stream");
  26514. }
  26515. buffer = this.buffer;
  26516. let limit = buffer ? buffer.length : 0;
  26517. let pos = this.bufferLength;
  26518. while (true) {
  26519. let code1 = this.getCode(litCodeTable);
  26520. if (code1 < 256) {
  26521. if (pos + 1 >= limit) {
  26522. buffer = this.ensureBuffer(pos + 1);
  26523. limit = buffer.length;
  26524. }
  26525. buffer[pos++] = code1;
  26526. continue;
  26527. }
  26528. if (code1 === 256) {
  26529. this.bufferLength = pos;
  26530. return;
  26531. }
  26532. code1 -= 257;
  26533. code1 = lengthDecode[code1];
  26534. let code2 = code1 >> 16;
  26535. if (code2 > 0) {
  26536. code2 = this.getBits(code2);
  26537. }
  26538. len = (code1 & 0xffff) + code2;
  26539. code1 = this.getCode(distCodeTable);
  26540. code1 = distDecode[code1];
  26541. code2 = code1 >> 16;
  26542. if (code2 > 0) {
  26543. code2 = this.getBits(code2);
  26544. }
  26545. const dist = (code1 & 0xffff) + code2;
  26546. if (pos + len >= limit) {
  26547. buffer = this.ensureBuffer(pos + len);
  26548. limit = buffer.length;
  26549. }
  26550. for (let k = 0; k < len; ++k, ++pos) {
  26551. buffer[pos] = buffer[pos - dist];
  26552. }
  26553. }
  26554. }
  26555. }
  26556. exports.FlateStream = FlateStream;
  26557. /***/ }),
  26558. /* 34 */
  26559. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26560. Object.defineProperty(exports, "__esModule", ({
  26561. value: true
  26562. }));
  26563. exports.Jbig2Stream = void 0;
  26564. var _base_stream = __w_pdfjs_require__(9);
  26565. var _decode_stream = __w_pdfjs_require__(29);
  26566. var _primitives = __w_pdfjs_require__(5);
  26567. var _jbig = __w_pdfjs_require__(35);
  26568. var _util = __w_pdfjs_require__(2);
  26569. class Jbig2Stream extends _decode_stream.DecodeStream {
  26570. constructor(stream, maybeLength, params) {
  26571. super(maybeLength);
  26572. this.stream = stream;
  26573. this.dict = stream.dict;
  26574. this.maybeLength = maybeLength;
  26575. this.params = params;
  26576. }
  26577. get bytes() {
  26578. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  26579. }
  26580. ensureBuffer(requested) {}
  26581. readBlock() {
  26582. if (this.eof) {
  26583. return;
  26584. }
  26585. const jbig2Image = new _jbig.Jbig2Image();
  26586. const chunks = [];
  26587. if (this.params instanceof _primitives.Dict) {
  26588. const globalsStream = this.params.get("JBIG2Globals");
  26589. if (globalsStream instanceof _base_stream.BaseStream) {
  26590. const globals = globalsStream.getBytes();
  26591. chunks.push({
  26592. data: globals,
  26593. start: 0,
  26594. end: globals.length
  26595. });
  26596. }
  26597. }
  26598. chunks.push({
  26599. data: this.bytes,
  26600. start: 0,
  26601. end: this.bytes.length
  26602. });
  26603. const data = jbig2Image.parseChunks(chunks);
  26604. const dataLength = data.length;
  26605. for (let i = 0; i < dataLength; i++) {
  26606. data[i] ^= 0xff;
  26607. }
  26608. this.buffer = data;
  26609. this.bufferLength = dataLength;
  26610. this.eof = true;
  26611. }
  26612. }
  26613. exports.Jbig2Stream = Jbig2Stream;
  26614. /***/ }),
  26615. /* 35 */
  26616. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26617. Object.defineProperty(exports, "__esModule", ({
  26618. value: true
  26619. }));
  26620. exports.Jbig2Image = void 0;
  26621. var _util = __w_pdfjs_require__(2);
  26622. var _core_utils = __w_pdfjs_require__(8);
  26623. var _arithmetic_decoder = __w_pdfjs_require__(36);
  26624. var _ccitt = __w_pdfjs_require__(32);
  26625. class Jbig2Error extends _util.BaseException {
  26626. constructor(msg) {
  26627. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  26628. }
  26629. }
  26630. class ContextCache {
  26631. getContexts(id) {
  26632. if (id in this) {
  26633. return this[id];
  26634. }
  26635. return this[id] = new Int8Array(1 << 16);
  26636. }
  26637. }
  26638. class DecodingContext {
  26639. constructor(data, start, end) {
  26640. this.data = data;
  26641. this.start = start;
  26642. this.end = end;
  26643. }
  26644. get decoder() {
  26645. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  26646. return (0, _util.shadow)(this, "decoder", decoder);
  26647. }
  26648. get contextCache() {
  26649. const cache = new ContextCache();
  26650. return (0, _util.shadow)(this, "contextCache", cache);
  26651. }
  26652. }
  26653. function decodeInteger(contextCache, procedure, decoder) {
  26654. const contexts = contextCache.getContexts(procedure);
  26655. let prev = 1;
  26656. function readBits(length) {
  26657. let v = 0;
  26658. for (let i = 0; i < length; i++) {
  26659. const bit = decoder.readBit(contexts, prev);
  26660. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  26661. v = v << 1 | bit;
  26662. }
  26663. return v >>> 0;
  26664. }
  26665. const sign = readBits(1);
  26666. 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);
  26667. if (sign === 0) {
  26668. return value;
  26669. } else if (value > 0) {
  26670. return -value;
  26671. }
  26672. return null;
  26673. }
  26674. function decodeIAID(contextCache, decoder, codeLength) {
  26675. const contexts = contextCache.getContexts("IAID");
  26676. let prev = 1;
  26677. for (let i = 0; i < codeLength; i++) {
  26678. const bit = decoder.readBit(contexts, prev);
  26679. prev = prev << 1 | bit;
  26680. }
  26681. if (codeLength < 31) {
  26682. return prev & (1 << codeLength) - 1;
  26683. }
  26684. return prev & 0x7fffffff;
  26685. }
  26686. 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"];
  26687. const CodingTemplates = [[{
  26688. x: -1,
  26689. y: -2
  26690. }, {
  26691. x: 0,
  26692. y: -2
  26693. }, {
  26694. x: 1,
  26695. y: -2
  26696. }, {
  26697. x: -2,
  26698. y: -1
  26699. }, {
  26700. x: -1,
  26701. y: -1
  26702. }, {
  26703. x: 0,
  26704. y: -1
  26705. }, {
  26706. x: 1,
  26707. y: -1
  26708. }, {
  26709. x: 2,
  26710. y: -1
  26711. }, {
  26712. x: -4,
  26713. y: 0
  26714. }, {
  26715. x: -3,
  26716. y: 0
  26717. }, {
  26718. x: -2,
  26719. y: 0
  26720. }, {
  26721. x: -1,
  26722. y: 0
  26723. }], [{
  26724. x: -1,
  26725. y: -2
  26726. }, {
  26727. x: 0,
  26728. y: -2
  26729. }, {
  26730. x: 1,
  26731. y: -2
  26732. }, {
  26733. x: 2,
  26734. y: -2
  26735. }, {
  26736. x: -2,
  26737. y: -1
  26738. }, {
  26739. x: -1,
  26740. y: -1
  26741. }, {
  26742. x: 0,
  26743. y: -1
  26744. }, {
  26745. x: 1,
  26746. y: -1
  26747. }, {
  26748. x: 2,
  26749. y: -1
  26750. }, {
  26751. x: -3,
  26752. y: 0
  26753. }, {
  26754. x: -2,
  26755. y: 0
  26756. }, {
  26757. x: -1,
  26758. y: 0
  26759. }], [{
  26760. x: -1,
  26761. y: -2
  26762. }, {
  26763. x: 0,
  26764. y: -2
  26765. }, {
  26766. x: 1,
  26767. y: -2
  26768. }, {
  26769. x: -2,
  26770. y: -1
  26771. }, {
  26772. x: -1,
  26773. y: -1
  26774. }, {
  26775. x: 0,
  26776. y: -1
  26777. }, {
  26778. x: 1,
  26779. y: -1
  26780. }, {
  26781. x: -2,
  26782. y: 0
  26783. }, {
  26784. x: -1,
  26785. y: 0
  26786. }], [{
  26787. x: -3,
  26788. y: -1
  26789. }, {
  26790. x: -2,
  26791. y: -1
  26792. }, {
  26793. x: -1,
  26794. y: -1
  26795. }, {
  26796. x: 0,
  26797. y: -1
  26798. }, {
  26799. x: 1,
  26800. y: -1
  26801. }, {
  26802. x: -4,
  26803. y: 0
  26804. }, {
  26805. x: -3,
  26806. y: 0
  26807. }, {
  26808. x: -2,
  26809. y: 0
  26810. }, {
  26811. x: -1,
  26812. y: 0
  26813. }]];
  26814. const RefinementTemplates = [{
  26815. coding: [{
  26816. x: 0,
  26817. y: -1
  26818. }, {
  26819. x: 1,
  26820. y: -1
  26821. }, {
  26822. x: -1,
  26823. y: 0
  26824. }],
  26825. reference: [{
  26826. x: 0,
  26827. y: -1
  26828. }, {
  26829. x: 1,
  26830. y: -1
  26831. }, {
  26832. x: -1,
  26833. y: 0
  26834. }, {
  26835. x: 0,
  26836. y: 0
  26837. }, {
  26838. x: 1,
  26839. y: 0
  26840. }, {
  26841. x: -1,
  26842. y: 1
  26843. }, {
  26844. x: 0,
  26845. y: 1
  26846. }, {
  26847. x: 1,
  26848. y: 1
  26849. }]
  26850. }, {
  26851. coding: [{
  26852. x: -1,
  26853. y: -1
  26854. }, {
  26855. x: 0,
  26856. y: -1
  26857. }, {
  26858. x: 1,
  26859. y: -1
  26860. }, {
  26861. x: -1,
  26862. y: 0
  26863. }],
  26864. reference: [{
  26865. x: 0,
  26866. y: -1
  26867. }, {
  26868. x: -1,
  26869. y: 0
  26870. }, {
  26871. x: 0,
  26872. y: 0
  26873. }, {
  26874. x: 1,
  26875. y: 0
  26876. }, {
  26877. x: 0,
  26878. y: 1
  26879. }, {
  26880. x: 1,
  26881. y: 1
  26882. }]
  26883. }];
  26884. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  26885. const RefinementReusedContexts = [0x0020, 0x0008];
  26886. function decodeBitmapTemplate0(width, height, decodingContext) {
  26887. const decoder = decodingContext.decoder;
  26888. const contexts = decodingContext.contextCache.getContexts("GB");
  26889. const bitmap = [];
  26890. let contextLabel, i, j, pixel, row, row1, row2;
  26891. const OLD_PIXEL_MASK = 0x7bf7;
  26892. for (i = 0; i < height; i++) {
  26893. row = bitmap[i] = new Uint8Array(width);
  26894. row1 = i < 1 ? row : bitmap[i - 1];
  26895. row2 = i < 2 ? row : bitmap[i - 2];
  26896. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  26897. for (j = 0; j < width; j++) {
  26898. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  26899. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  26900. }
  26901. }
  26902. return bitmap;
  26903. }
  26904. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  26905. if (mmr) {
  26906. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  26907. return decodeMMRBitmap(input, width, height, false);
  26908. }
  26909. 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) {
  26910. return decodeBitmapTemplate0(width, height, decodingContext);
  26911. }
  26912. const useskip = !!skip;
  26913. const template = CodingTemplates[templateIndex].concat(at);
  26914. template.sort(function (a, b) {
  26915. return a.y - b.y || a.x - b.x;
  26916. });
  26917. const templateLength = template.length;
  26918. const templateX = new Int8Array(templateLength);
  26919. const templateY = new Int8Array(templateLength);
  26920. const changingTemplateEntries = [];
  26921. let reuseMask = 0,
  26922. minX = 0,
  26923. maxX = 0,
  26924. minY = 0;
  26925. let c, k;
  26926. for (k = 0; k < templateLength; k++) {
  26927. templateX[k] = template[k].x;
  26928. templateY[k] = template[k].y;
  26929. minX = Math.min(minX, template[k].x);
  26930. maxX = Math.max(maxX, template[k].x);
  26931. minY = Math.min(minY, template[k].y);
  26932. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  26933. reuseMask |= 1 << templateLength - 1 - k;
  26934. } else {
  26935. changingTemplateEntries.push(k);
  26936. }
  26937. }
  26938. const changingEntriesLength = changingTemplateEntries.length;
  26939. const changingTemplateX = new Int8Array(changingEntriesLength);
  26940. const changingTemplateY = new Int8Array(changingEntriesLength);
  26941. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  26942. for (c = 0; c < changingEntriesLength; c++) {
  26943. k = changingTemplateEntries[c];
  26944. changingTemplateX[c] = template[k].x;
  26945. changingTemplateY[c] = template[k].y;
  26946. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  26947. }
  26948. const sbb_left = -minX;
  26949. const sbb_top = -minY;
  26950. const sbb_right = width - maxX;
  26951. const pseudoPixelContext = ReusedContexts[templateIndex];
  26952. let row = new Uint8Array(width);
  26953. const bitmap = [];
  26954. const decoder = decodingContext.decoder;
  26955. const contexts = decodingContext.contextCache.getContexts("GB");
  26956. let ltp = 0,
  26957. j,
  26958. i0,
  26959. j0,
  26960. contextLabel = 0,
  26961. bit,
  26962. shift;
  26963. for (let i = 0; i < height; i++) {
  26964. if (prediction) {
  26965. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  26966. ltp ^= sltp;
  26967. if (ltp) {
  26968. bitmap.push(row);
  26969. continue;
  26970. }
  26971. }
  26972. row = new Uint8Array(row);
  26973. bitmap.push(row);
  26974. for (j = 0; j < width; j++) {
  26975. if (useskip && skip[i][j]) {
  26976. row[j] = 0;
  26977. continue;
  26978. }
  26979. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  26980. contextLabel = contextLabel << 1 & reuseMask;
  26981. for (k = 0; k < changingEntriesLength; k++) {
  26982. i0 = i + changingTemplateY[k];
  26983. j0 = j + changingTemplateX[k];
  26984. bit = bitmap[i0][j0];
  26985. if (bit) {
  26986. bit = changingTemplateBit[k];
  26987. contextLabel |= bit;
  26988. }
  26989. }
  26990. } else {
  26991. contextLabel = 0;
  26992. shift = templateLength - 1;
  26993. for (k = 0; k < templateLength; k++, shift--) {
  26994. j0 = j + templateX[k];
  26995. if (j0 >= 0 && j0 < width) {
  26996. i0 = i + templateY[k];
  26997. if (i0 >= 0) {
  26998. bit = bitmap[i0][j0];
  26999. if (bit) {
  27000. contextLabel |= bit << shift;
  27001. }
  27002. }
  27003. }
  27004. }
  27005. }
  27006. const pixel = decoder.readBit(contexts, contextLabel);
  27007. row[j] = pixel;
  27008. }
  27009. }
  27010. return bitmap;
  27011. }
  27012. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  27013. let codingTemplate = RefinementTemplates[templateIndex].coding;
  27014. if (templateIndex === 0) {
  27015. codingTemplate = codingTemplate.concat([at[0]]);
  27016. }
  27017. const codingTemplateLength = codingTemplate.length;
  27018. const codingTemplateX = new Int32Array(codingTemplateLength);
  27019. const codingTemplateY = new Int32Array(codingTemplateLength);
  27020. let k;
  27021. for (k = 0; k < codingTemplateLength; k++) {
  27022. codingTemplateX[k] = codingTemplate[k].x;
  27023. codingTemplateY[k] = codingTemplate[k].y;
  27024. }
  27025. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  27026. if (templateIndex === 0) {
  27027. referenceTemplate = referenceTemplate.concat([at[1]]);
  27028. }
  27029. const referenceTemplateLength = referenceTemplate.length;
  27030. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  27031. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  27032. for (k = 0; k < referenceTemplateLength; k++) {
  27033. referenceTemplateX[k] = referenceTemplate[k].x;
  27034. referenceTemplateY[k] = referenceTemplate[k].y;
  27035. }
  27036. const referenceWidth = referenceBitmap[0].length;
  27037. const referenceHeight = referenceBitmap.length;
  27038. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  27039. const bitmap = [];
  27040. const decoder = decodingContext.decoder;
  27041. const contexts = decodingContext.contextCache.getContexts("GR");
  27042. let ltp = 0;
  27043. for (let i = 0; i < height; i++) {
  27044. if (prediction) {
  27045. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27046. ltp ^= sltp;
  27047. if (ltp) {
  27048. throw new Jbig2Error("prediction is not supported");
  27049. }
  27050. }
  27051. const row = new Uint8Array(width);
  27052. bitmap.push(row);
  27053. for (let j = 0; j < width; j++) {
  27054. let i0, j0;
  27055. let contextLabel = 0;
  27056. for (k = 0; k < codingTemplateLength; k++) {
  27057. i0 = i + codingTemplateY[k];
  27058. j0 = j + codingTemplateX[k];
  27059. if (i0 < 0 || j0 < 0 || j0 >= width) {
  27060. contextLabel <<= 1;
  27061. } else {
  27062. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  27063. }
  27064. }
  27065. for (k = 0; k < referenceTemplateLength; k++) {
  27066. i0 = i + referenceTemplateY[k] - offsetY;
  27067. j0 = j + referenceTemplateX[k] - offsetX;
  27068. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  27069. contextLabel <<= 1;
  27070. } else {
  27071. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  27072. }
  27073. }
  27074. const pixel = decoder.readBit(contexts, contextLabel);
  27075. row[j] = pixel;
  27076. }
  27077. }
  27078. return bitmap;
  27079. }
  27080. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  27081. if (huffman && refinement) {
  27082. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  27083. }
  27084. const newSymbols = [];
  27085. let currentHeight = 0;
  27086. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  27087. const decoder = decodingContext.decoder;
  27088. const contextCache = decodingContext.contextCache;
  27089. let tableB1, symbolWidths;
  27090. if (huffman) {
  27091. tableB1 = getStandardTable(1);
  27092. symbolWidths = [];
  27093. symbolCodeLength = Math.max(symbolCodeLength, 1);
  27094. }
  27095. while (newSymbols.length < numberOfNewSymbols) {
  27096. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  27097. currentHeight += deltaHeight;
  27098. let currentWidth = 0,
  27099. totalWidth = 0;
  27100. const firstSymbol = huffman ? symbolWidths.length : 0;
  27101. while (true) {
  27102. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  27103. if (deltaWidth === null) {
  27104. break;
  27105. }
  27106. currentWidth += deltaWidth;
  27107. totalWidth += currentWidth;
  27108. let bitmap;
  27109. if (refinement) {
  27110. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  27111. if (numberOfInstances > 1) {
  27112. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  27113. } else {
  27114. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  27115. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27116. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27117. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  27118. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  27119. }
  27120. newSymbols.push(bitmap);
  27121. } else if (huffman) {
  27122. symbolWidths.push(currentWidth);
  27123. } else {
  27124. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  27125. newSymbols.push(bitmap);
  27126. }
  27127. }
  27128. if (huffman && !refinement) {
  27129. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  27130. huffmanInput.byteAlign();
  27131. let collectiveBitmap;
  27132. if (bitmapSize === 0) {
  27133. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  27134. } else {
  27135. const originalEnd = huffmanInput.end;
  27136. const bitmapEnd = huffmanInput.position + bitmapSize;
  27137. huffmanInput.end = bitmapEnd;
  27138. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  27139. huffmanInput.end = originalEnd;
  27140. huffmanInput.position = bitmapEnd;
  27141. }
  27142. const numberOfSymbolsDecoded = symbolWidths.length;
  27143. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  27144. newSymbols.push(collectiveBitmap);
  27145. } else {
  27146. let i,
  27147. y,
  27148. xMin = 0,
  27149. xMax,
  27150. bitmapWidth,
  27151. symbolBitmap;
  27152. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  27153. bitmapWidth = symbolWidths[i];
  27154. xMax = xMin + bitmapWidth;
  27155. symbolBitmap = [];
  27156. for (y = 0; y < currentHeight; y++) {
  27157. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27158. }
  27159. newSymbols.push(symbolBitmap);
  27160. xMin = xMax;
  27161. }
  27162. }
  27163. }
  27164. }
  27165. const exportedSymbols = [],
  27166. flags = [];
  27167. let currentFlag = false,
  27168. i,
  27169. ii;
  27170. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  27171. while (flags.length < totalSymbolsLength) {
  27172. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  27173. while (runLength--) {
  27174. flags.push(currentFlag);
  27175. }
  27176. currentFlag = !currentFlag;
  27177. }
  27178. for (i = 0, ii = symbols.length; i < ii; i++) {
  27179. if (flags[i]) {
  27180. exportedSymbols.push(symbols[i]);
  27181. }
  27182. }
  27183. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  27184. if (flags[i]) {
  27185. exportedSymbols.push(newSymbols[j]);
  27186. }
  27187. }
  27188. return exportedSymbols;
  27189. }
  27190. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  27191. if (huffman && refinement) {
  27192. throw new Jbig2Error("refinement with Huffman is not supported");
  27193. }
  27194. const bitmap = [];
  27195. let i, row;
  27196. for (i = 0; i < height; i++) {
  27197. row = new Uint8Array(width);
  27198. if (defaultPixelValue) {
  27199. for (let j = 0; j < width; j++) {
  27200. row[j] = defaultPixelValue;
  27201. }
  27202. }
  27203. bitmap.push(row);
  27204. }
  27205. const decoder = decodingContext.decoder;
  27206. const contextCache = decodingContext.contextCache;
  27207. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  27208. let firstS = 0;
  27209. i = 0;
  27210. while (i < numberOfSymbolInstances) {
  27211. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  27212. stripT += deltaT;
  27213. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  27214. firstS += deltaFirstS;
  27215. let currentS = firstS;
  27216. do {
  27217. let currentT = 0;
  27218. if (stripSize > 1) {
  27219. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  27220. }
  27221. const t = stripSize * stripT + currentT;
  27222. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  27223. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  27224. let symbolBitmap = inputSymbols[symbolId];
  27225. let symbolWidth = symbolBitmap[0].length;
  27226. let symbolHeight = symbolBitmap.length;
  27227. if (applyRefinement) {
  27228. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  27229. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  27230. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27231. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27232. symbolWidth += rdw;
  27233. symbolHeight += rdh;
  27234. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  27235. }
  27236. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  27237. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  27238. let s2, t2, symbolRow;
  27239. if (transposed) {
  27240. for (s2 = 0; s2 < symbolHeight; s2++) {
  27241. row = bitmap[offsetS + s2];
  27242. if (!row) {
  27243. continue;
  27244. }
  27245. symbolRow = symbolBitmap[s2];
  27246. const maxWidth = Math.min(width - offsetT, symbolWidth);
  27247. switch (combinationOperator) {
  27248. case 0:
  27249. for (t2 = 0; t2 < maxWidth; t2++) {
  27250. row[offsetT + t2] |= symbolRow[t2];
  27251. }
  27252. break;
  27253. case 2:
  27254. for (t2 = 0; t2 < maxWidth; t2++) {
  27255. row[offsetT + t2] ^= symbolRow[t2];
  27256. }
  27257. break;
  27258. default:
  27259. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27260. }
  27261. }
  27262. currentS += symbolHeight - 1;
  27263. } else {
  27264. for (t2 = 0; t2 < symbolHeight; t2++) {
  27265. row = bitmap[offsetT + t2];
  27266. if (!row) {
  27267. continue;
  27268. }
  27269. symbolRow = symbolBitmap[t2];
  27270. switch (combinationOperator) {
  27271. case 0:
  27272. for (s2 = 0; s2 < symbolWidth; s2++) {
  27273. row[offsetS + s2] |= symbolRow[s2];
  27274. }
  27275. break;
  27276. case 2:
  27277. for (s2 = 0; s2 < symbolWidth; s2++) {
  27278. row[offsetS + s2] ^= symbolRow[s2];
  27279. }
  27280. break;
  27281. default:
  27282. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27283. }
  27284. }
  27285. currentS += symbolWidth - 1;
  27286. }
  27287. i++;
  27288. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  27289. if (deltaS === null) {
  27290. break;
  27291. }
  27292. currentS += deltaS + dsOffset;
  27293. } while (true);
  27294. }
  27295. return bitmap;
  27296. }
  27297. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  27298. const at = [];
  27299. if (!mmr) {
  27300. at.push({
  27301. x: -patternWidth,
  27302. y: 0
  27303. });
  27304. if (template === 0) {
  27305. at.push({
  27306. x: -3,
  27307. y: -1
  27308. }, {
  27309. x: 2,
  27310. y: -2
  27311. }, {
  27312. x: -2,
  27313. y: -2
  27314. });
  27315. }
  27316. }
  27317. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  27318. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  27319. const patterns = [];
  27320. for (let i = 0; i <= maxPatternIndex; i++) {
  27321. const patternBitmap = [];
  27322. const xMin = patternWidth * i;
  27323. const xMax = xMin + patternWidth;
  27324. for (let y = 0; y < patternHeight; y++) {
  27325. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27326. }
  27327. patterns.push(patternBitmap);
  27328. }
  27329. return patterns;
  27330. }
  27331. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  27332. const skip = null;
  27333. if (enableSkip) {
  27334. throw new Jbig2Error("skip is not supported");
  27335. }
  27336. if (combinationOperator !== 0) {
  27337. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  27338. }
  27339. const regionBitmap = [];
  27340. let i, j, row;
  27341. for (i = 0; i < regionHeight; i++) {
  27342. row = new Uint8Array(regionWidth);
  27343. if (defaultPixelValue) {
  27344. for (j = 0; j < regionWidth; j++) {
  27345. row[j] = defaultPixelValue;
  27346. }
  27347. }
  27348. regionBitmap.push(row);
  27349. }
  27350. const numberOfPatterns = patterns.length;
  27351. const pattern0 = patterns[0];
  27352. const patternWidth = pattern0[0].length,
  27353. patternHeight = pattern0.length;
  27354. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  27355. const at = [];
  27356. if (!mmr) {
  27357. at.push({
  27358. x: template <= 1 ? 3 : 2,
  27359. y: -1
  27360. });
  27361. if (template === 0) {
  27362. at.push({
  27363. x: -3,
  27364. y: -1
  27365. }, {
  27366. x: 2,
  27367. y: -2
  27368. }, {
  27369. x: -2,
  27370. y: -2
  27371. });
  27372. }
  27373. }
  27374. const grayScaleBitPlanes = [];
  27375. let mmrInput, bitmap;
  27376. if (mmr) {
  27377. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27378. }
  27379. for (i = bitsPerValue - 1; i >= 0; i--) {
  27380. if (mmr) {
  27381. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  27382. } else {
  27383. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  27384. }
  27385. grayScaleBitPlanes[i] = bitmap;
  27386. }
  27387. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  27388. for (mg = 0; mg < gridHeight; mg++) {
  27389. for (ng = 0; ng < gridWidth; ng++) {
  27390. bit = 0;
  27391. patternIndex = 0;
  27392. for (j = bitsPerValue - 1; j >= 0; j--) {
  27393. bit ^= grayScaleBitPlanes[j][mg][ng];
  27394. patternIndex |= bit << j;
  27395. }
  27396. patternBitmap = patterns[patternIndex];
  27397. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  27398. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  27399. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  27400. for (i = 0; i < patternHeight; i++) {
  27401. regionRow = regionBitmap[y + i];
  27402. patternRow = patternBitmap[i];
  27403. for (j = 0; j < patternWidth; j++) {
  27404. regionRow[x + j] |= patternRow[j];
  27405. }
  27406. }
  27407. } else {
  27408. let regionX, regionY;
  27409. for (i = 0; i < patternHeight; i++) {
  27410. regionY = y + i;
  27411. if (regionY < 0 || regionY >= regionHeight) {
  27412. continue;
  27413. }
  27414. regionRow = regionBitmap[regionY];
  27415. patternRow = patternBitmap[i];
  27416. for (j = 0; j < patternWidth; j++) {
  27417. regionX = x + j;
  27418. if (regionX >= 0 && regionX < regionWidth) {
  27419. regionRow[regionX] |= patternRow[j];
  27420. }
  27421. }
  27422. }
  27423. }
  27424. }
  27425. }
  27426. return regionBitmap;
  27427. }
  27428. function readSegmentHeader(data, start) {
  27429. const segmentHeader = {};
  27430. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  27431. const flags = data[start + 4];
  27432. const segmentType = flags & 0x3f;
  27433. if (!SegmentTypes[segmentType]) {
  27434. throw new Jbig2Error("invalid segment type: " + segmentType);
  27435. }
  27436. segmentHeader.type = segmentType;
  27437. segmentHeader.typeName = SegmentTypes[segmentType];
  27438. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  27439. const pageAssociationFieldSize = !!(flags & 0x40);
  27440. const referredFlags = data[start + 5];
  27441. let referredToCount = referredFlags >> 5 & 7;
  27442. const retainBits = [referredFlags & 31];
  27443. let position = start + 6;
  27444. if (referredFlags === 7) {
  27445. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  27446. position += 3;
  27447. let bytes = referredToCount + 7 >> 3;
  27448. retainBits[0] = data[position++];
  27449. while (--bytes > 0) {
  27450. retainBits.push(data[position++]);
  27451. }
  27452. } else if (referredFlags === 5 || referredFlags === 6) {
  27453. throw new Jbig2Error("invalid referred-to flags");
  27454. }
  27455. segmentHeader.retainBits = retainBits;
  27456. let referredToSegmentNumberSize = 4;
  27457. if (segmentHeader.number <= 256) {
  27458. referredToSegmentNumberSize = 1;
  27459. } else if (segmentHeader.number <= 65536) {
  27460. referredToSegmentNumberSize = 2;
  27461. }
  27462. const referredTo = [];
  27463. let i, ii;
  27464. for (i = 0; i < referredToCount; i++) {
  27465. let number;
  27466. if (referredToSegmentNumberSize === 1) {
  27467. number = data[position];
  27468. } else if (referredToSegmentNumberSize === 2) {
  27469. number = (0, _core_utils.readUint16)(data, position);
  27470. } else {
  27471. number = (0, _core_utils.readUint32)(data, position);
  27472. }
  27473. referredTo.push(number);
  27474. position += referredToSegmentNumberSize;
  27475. }
  27476. segmentHeader.referredTo = referredTo;
  27477. if (!pageAssociationFieldSize) {
  27478. segmentHeader.pageAssociation = data[position++];
  27479. } else {
  27480. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  27481. position += 4;
  27482. }
  27483. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  27484. position += 4;
  27485. if (segmentHeader.length === 0xffffffff) {
  27486. if (segmentType === 38) {
  27487. const genericRegionInfo = readRegionSegmentInformation(data, position);
  27488. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  27489. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  27490. const searchPatternLength = 6;
  27491. const searchPattern = new Uint8Array(searchPatternLength);
  27492. if (!genericRegionMmr) {
  27493. searchPattern[0] = 0xff;
  27494. searchPattern[1] = 0xac;
  27495. }
  27496. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  27497. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  27498. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  27499. searchPattern[5] = genericRegionInfo.height & 0xff;
  27500. for (i = position, ii = data.length; i < ii; i++) {
  27501. let j = 0;
  27502. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  27503. j++;
  27504. }
  27505. if (j === searchPatternLength) {
  27506. segmentHeader.length = i + searchPatternLength;
  27507. break;
  27508. }
  27509. }
  27510. if (segmentHeader.length === 0xffffffff) {
  27511. throw new Jbig2Error("segment end was not found");
  27512. }
  27513. } else {
  27514. throw new Jbig2Error("invalid unknown segment length");
  27515. }
  27516. }
  27517. segmentHeader.headerEnd = position;
  27518. return segmentHeader;
  27519. }
  27520. function readSegments(header, data, start, end) {
  27521. const segments = [];
  27522. let position = start;
  27523. while (position < end) {
  27524. const segmentHeader = readSegmentHeader(data, position);
  27525. position = segmentHeader.headerEnd;
  27526. const segment = {
  27527. header: segmentHeader,
  27528. data
  27529. };
  27530. if (!header.randomAccess) {
  27531. segment.start = position;
  27532. position += segmentHeader.length;
  27533. segment.end = position;
  27534. }
  27535. segments.push(segment);
  27536. if (segmentHeader.type === 51) {
  27537. break;
  27538. }
  27539. }
  27540. if (header.randomAccess) {
  27541. for (let i = 0, ii = segments.length; i < ii; i++) {
  27542. segments[i].start = position;
  27543. position += segments[i].header.length;
  27544. segments[i].end = position;
  27545. }
  27546. }
  27547. return segments;
  27548. }
  27549. function readRegionSegmentInformation(data, start) {
  27550. return {
  27551. width: (0, _core_utils.readUint32)(data, start),
  27552. height: (0, _core_utils.readUint32)(data, start + 4),
  27553. x: (0, _core_utils.readUint32)(data, start + 8),
  27554. y: (0, _core_utils.readUint32)(data, start + 12),
  27555. combinationOperator: data[start + 16] & 7
  27556. };
  27557. }
  27558. const RegionSegmentInformationFieldLength = 17;
  27559. function processSegment(segment, visitor) {
  27560. const header = segment.header;
  27561. const data = segment.data,
  27562. end = segment.end;
  27563. let position = segment.start;
  27564. let args, at, i, atLength;
  27565. switch (header.type) {
  27566. case 0:
  27567. const dictionary = {};
  27568. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  27569. dictionary.huffman = !!(dictionaryFlags & 1);
  27570. dictionary.refinement = !!(dictionaryFlags & 2);
  27571. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  27572. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  27573. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  27574. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  27575. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  27576. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  27577. dictionary.template = dictionaryFlags >> 10 & 3;
  27578. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  27579. position += 2;
  27580. if (!dictionary.huffman) {
  27581. atLength = dictionary.template === 0 ? 4 : 1;
  27582. at = [];
  27583. for (i = 0; i < atLength; i++) {
  27584. at.push({
  27585. x: (0, _core_utils.readInt8)(data, position),
  27586. y: (0, _core_utils.readInt8)(data, position + 1)
  27587. });
  27588. position += 2;
  27589. }
  27590. dictionary.at = at;
  27591. }
  27592. if (dictionary.refinement && !dictionary.refinementTemplate) {
  27593. at = [];
  27594. for (i = 0; i < 2; i++) {
  27595. at.push({
  27596. x: (0, _core_utils.readInt8)(data, position),
  27597. y: (0, _core_utils.readInt8)(data, position + 1)
  27598. });
  27599. position += 2;
  27600. }
  27601. dictionary.refinementAt = at;
  27602. }
  27603. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  27604. position += 4;
  27605. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  27606. position += 4;
  27607. args = [dictionary, header.number, header.referredTo, data, position, end];
  27608. break;
  27609. case 6:
  27610. case 7:
  27611. const textRegion = {};
  27612. textRegion.info = readRegionSegmentInformation(data, position);
  27613. position += RegionSegmentInformationFieldLength;
  27614. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  27615. position += 2;
  27616. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  27617. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  27618. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  27619. textRegion.stripSize = 1 << textRegion.logStripSize;
  27620. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  27621. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  27622. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  27623. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  27624. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  27625. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  27626. if (textRegion.huffman) {
  27627. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  27628. position += 2;
  27629. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  27630. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  27631. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  27632. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  27633. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  27634. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  27635. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  27636. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  27637. }
  27638. if (textRegion.refinement && !textRegion.refinementTemplate) {
  27639. at = [];
  27640. for (i = 0; i < 2; i++) {
  27641. at.push({
  27642. x: (0, _core_utils.readInt8)(data, position),
  27643. y: (0, _core_utils.readInt8)(data, position + 1)
  27644. });
  27645. position += 2;
  27646. }
  27647. textRegion.refinementAt = at;
  27648. }
  27649. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  27650. position += 4;
  27651. args = [textRegion, header.referredTo, data, position, end];
  27652. break;
  27653. case 16:
  27654. const patternDictionary = {};
  27655. const patternDictionaryFlags = data[position++];
  27656. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  27657. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  27658. patternDictionary.patternWidth = data[position++];
  27659. patternDictionary.patternHeight = data[position++];
  27660. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  27661. position += 4;
  27662. args = [patternDictionary, header.number, data, position, end];
  27663. break;
  27664. case 22:
  27665. case 23:
  27666. const halftoneRegion = {};
  27667. halftoneRegion.info = readRegionSegmentInformation(data, position);
  27668. position += RegionSegmentInformationFieldLength;
  27669. const halftoneRegionFlags = data[position++];
  27670. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  27671. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  27672. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  27673. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  27674. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  27675. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  27676. position += 4;
  27677. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  27678. position += 4;
  27679. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27680. position += 4;
  27681. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27682. position += 4;
  27683. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  27684. position += 2;
  27685. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  27686. position += 2;
  27687. args = [halftoneRegion, header.referredTo, data, position, end];
  27688. break;
  27689. case 38:
  27690. case 39:
  27691. const genericRegion = {};
  27692. genericRegion.info = readRegionSegmentInformation(data, position);
  27693. position += RegionSegmentInformationFieldLength;
  27694. const genericRegionSegmentFlags = data[position++];
  27695. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  27696. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  27697. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  27698. if (!genericRegion.mmr) {
  27699. atLength = genericRegion.template === 0 ? 4 : 1;
  27700. at = [];
  27701. for (i = 0; i < atLength; i++) {
  27702. at.push({
  27703. x: (0, _core_utils.readInt8)(data, position),
  27704. y: (0, _core_utils.readInt8)(data, position + 1)
  27705. });
  27706. position += 2;
  27707. }
  27708. genericRegion.at = at;
  27709. }
  27710. args = [genericRegion, data, position, end];
  27711. break;
  27712. case 48:
  27713. const pageInfo = {
  27714. width: (0, _core_utils.readUint32)(data, position),
  27715. height: (0, _core_utils.readUint32)(data, position + 4),
  27716. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  27717. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  27718. };
  27719. if (pageInfo.height === 0xffffffff) {
  27720. delete pageInfo.height;
  27721. }
  27722. const pageSegmentFlags = data[position + 16];
  27723. (0, _core_utils.readUint16)(data, position + 17);
  27724. pageInfo.lossless = !!(pageSegmentFlags & 1);
  27725. pageInfo.refinement = !!(pageSegmentFlags & 2);
  27726. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  27727. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  27728. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  27729. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  27730. args = [pageInfo];
  27731. break;
  27732. case 49:
  27733. break;
  27734. case 50:
  27735. break;
  27736. case 51:
  27737. break;
  27738. case 53:
  27739. args = [header.number, data, position, end];
  27740. break;
  27741. case 62:
  27742. break;
  27743. default:
  27744. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  27745. }
  27746. const callbackName = "on" + header.typeName;
  27747. if (callbackName in visitor) {
  27748. visitor[callbackName].apply(visitor, args);
  27749. }
  27750. }
  27751. function processSegments(segments, visitor) {
  27752. for (let i = 0, ii = segments.length; i < ii; i++) {
  27753. processSegment(segments[i], visitor);
  27754. }
  27755. }
  27756. function parseJbig2Chunks(chunks) {
  27757. const visitor = new SimpleSegmentVisitor();
  27758. for (let i = 0, ii = chunks.length; i < ii; i++) {
  27759. const chunk = chunks[i];
  27760. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  27761. processSegments(segments, visitor);
  27762. }
  27763. return visitor.buffer;
  27764. }
  27765. function parseJbig2(data) {
  27766. const end = data.length;
  27767. let position = 0;
  27768. if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) {
  27769. throw new Jbig2Error("parseJbig2 - invalid header.");
  27770. }
  27771. const header = Object.create(null);
  27772. position += 8;
  27773. const flags = data[position++];
  27774. header.randomAccess = !(flags & 1);
  27775. if (!(flags & 2)) {
  27776. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  27777. position += 4;
  27778. }
  27779. const segments = readSegments(header, data, position, end);
  27780. const visitor = new SimpleSegmentVisitor();
  27781. processSegments(segments, visitor);
  27782. const {
  27783. width,
  27784. height
  27785. } = visitor.currentPageInfo;
  27786. const bitPacked = visitor.buffer;
  27787. const imgData = new Uint8ClampedArray(width * height);
  27788. let q = 0,
  27789. k = 0;
  27790. for (let i = 0; i < height; i++) {
  27791. let mask = 0,
  27792. buffer;
  27793. for (let j = 0; j < width; j++) {
  27794. if (!mask) {
  27795. mask = 128;
  27796. buffer = bitPacked[k++];
  27797. }
  27798. imgData[q++] = buffer & mask ? 0 : 255;
  27799. mask >>= 1;
  27800. }
  27801. }
  27802. return {
  27803. imgData,
  27804. width,
  27805. height
  27806. };
  27807. }
  27808. class SimpleSegmentVisitor {
  27809. onPageInformation(info) {
  27810. this.currentPageInfo = info;
  27811. const rowSize = info.width + 7 >> 3;
  27812. const buffer = new Uint8ClampedArray(rowSize * info.height);
  27813. if (info.defaultPixelValue) {
  27814. for (let i = 0, ii = buffer.length; i < ii; i++) {
  27815. buffer[i] = 0xff;
  27816. }
  27817. }
  27818. this.buffer = buffer;
  27819. }
  27820. drawBitmap(regionInfo, bitmap) {
  27821. const pageInfo = this.currentPageInfo;
  27822. const width = regionInfo.width,
  27823. height = regionInfo.height;
  27824. const rowSize = pageInfo.width + 7 >> 3;
  27825. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  27826. const buffer = this.buffer;
  27827. const mask0 = 128 >> (regionInfo.x & 7);
  27828. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  27829. let i, j, mask, offset;
  27830. switch (combinationOperator) {
  27831. case 0:
  27832. for (i = 0; i < height; i++) {
  27833. mask = mask0;
  27834. offset = offset0;
  27835. for (j = 0; j < width; j++) {
  27836. if (bitmap[i][j]) {
  27837. buffer[offset] |= mask;
  27838. }
  27839. mask >>= 1;
  27840. if (!mask) {
  27841. mask = 128;
  27842. offset++;
  27843. }
  27844. }
  27845. offset0 += rowSize;
  27846. }
  27847. break;
  27848. case 2:
  27849. for (i = 0; i < height; i++) {
  27850. mask = mask0;
  27851. offset = offset0;
  27852. for (j = 0; j < width; j++) {
  27853. if (bitmap[i][j]) {
  27854. buffer[offset] ^= mask;
  27855. }
  27856. mask >>= 1;
  27857. if (!mask) {
  27858. mask = 128;
  27859. offset++;
  27860. }
  27861. }
  27862. offset0 += rowSize;
  27863. }
  27864. break;
  27865. default:
  27866. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27867. }
  27868. }
  27869. onImmediateGenericRegion(region, data, start, end) {
  27870. const regionInfo = region.info;
  27871. const decodingContext = new DecodingContext(data, start, end);
  27872. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  27873. this.drawBitmap(regionInfo, bitmap);
  27874. }
  27875. onImmediateLosslessGenericRegion() {
  27876. this.onImmediateGenericRegion.apply(this, arguments);
  27877. }
  27878. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  27879. let huffmanTables, huffmanInput;
  27880. if (dictionary.huffman) {
  27881. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  27882. huffmanInput = new Reader(data, start, end);
  27883. }
  27884. let symbols = this.symbols;
  27885. if (!symbols) {
  27886. this.symbols = symbols = {};
  27887. }
  27888. let inputSymbols = [];
  27889. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  27890. const referredSymbols = symbols[referredSegments[i]];
  27891. if (referredSymbols) {
  27892. inputSymbols = inputSymbols.concat(referredSymbols);
  27893. }
  27894. }
  27895. const decodingContext = new DecodingContext(data, start, end);
  27896. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  27897. }
  27898. onImmediateTextRegion(region, referredSegments, data, start, end) {
  27899. const regionInfo = region.info;
  27900. let huffmanTables, huffmanInput;
  27901. const symbols = this.symbols;
  27902. let inputSymbols = [];
  27903. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  27904. const referredSymbols = symbols[referredSegments[i]];
  27905. if (referredSymbols) {
  27906. inputSymbols = inputSymbols.concat(referredSymbols);
  27907. }
  27908. }
  27909. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  27910. if (region.huffman) {
  27911. huffmanInput = new Reader(data, start, end);
  27912. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  27913. }
  27914. const decodingContext = new DecodingContext(data, start, end);
  27915. 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);
  27916. this.drawBitmap(regionInfo, bitmap);
  27917. }
  27918. onImmediateLosslessTextRegion() {
  27919. this.onImmediateTextRegion.apply(this, arguments);
  27920. }
  27921. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  27922. let patterns = this.patterns;
  27923. if (!patterns) {
  27924. this.patterns = patterns = {};
  27925. }
  27926. const decodingContext = new DecodingContext(data, start, end);
  27927. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  27928. }
  27929. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  27930. const patterns = this.patterns[referredSegments[0]];
  27931. const regionInfo = region.info;
  27932. const decodingContext = new DecodingContext(data, start, end);
  27933. 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);
  27934. this.drawBitmap(regionInfo, bitmap);
  27935. }
  27936. onImmediateLosslessHalftoneRegion() {
  27937. this.onImmediateHalftoneRegion.apply(this, arguments);
  27938. }
  27939. onTables(currentSegment, data, start, end) {
  27940. let customTables = this.customTables;
  27941. if (!customTables) {
  27942. this.customTables = customTables = {};
  27943. }
  27944. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  27945. }
  27946. }
  27947. class HuffmanLine {
  27948. constructor(lineData) {
  27949. if (lineData.length === 2) {
  27950. this.isOOB = true;
  27951. this.rangeLow = 0;
  27952. this.prefixLength = lineData[0];
  27953. this.rangeLength = 0;
  27954. this.prefixCode = lineData[1];
  27955. this.isLowerRange = false;
  27956. } else {
  27957. this.isOOB = false;
  27958. this.rangeLow = lineData[0];
  27959. this.prefixLength = lineData[1];
  27960. this.rangeLength = lineData[2];
  27961. this.prefixCode = lineData[3];
  27962. this.isLowerRange = lineData[4] === "lower";
  27963. }
  27964. }
  27965. }
  27966. class HuffmanTreeNode {
  27967. constructor(line) {
  27968. this.children = [];
  27969. if (line) {
  27970. this.isLeaf = true;
  27971. this.rangeLength = line.rangeLength;
  27972. this.rangeLow = line.rangeLow;
  27973. this.isLowerRange = line.isLowerRange;
  27974. this.isOOB = line.isOOB;
  27975. } else {
  27976. this.isLeaf = false;
  27977. }
  27978. }
  27979. buildTree(line, shift) {
  27980. const bit = line.prefixCode >> shift & 1;
  27981. if (shift <= 0) {
  27982. this.children[bit] = new HuffmanTreeNode(line);
  27983. } else {
  27984. let node = this.children[bit];
  27985. if (!node) {
  27986. this.children[bit] = node = new HuffmanTreeNode(null);
  27987. }
  27988. node.buildTree(line, shift - 1);
  27989. }
  27990. }
  27991. decodeNode(reader) {
  27992. if (this.isLeaf) {
  27993. if (this.isOOB) {
  27994. return null;
  27995. }
  27996. const htOffset = reader.readBits(this.rangeLength);
  27997. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  27998. }
  27999. const node = this.children[reader.readBit()];
  28000. if (!node) {
  28001. throw new Jbig2Error("invalid Huffman data");
  28002. }
  28003. return node.decodeNode(reader);
  28004. }
  28005. }
  28006. class HuffmanTable {
  28007. constructor(lines, prefixCodesDone) {
  28008. if (!prefixCodesDone) {
  28009. this.assignPrefixCodes(lines);
  28010. }
  28011. this.rootNode = new HuffmanTreeNode(null);
  28012. for (let i = 0, ii = lines.length; i < ii; i++) {
  28013. const line = lines[i];
  28014. if (line.prefixLength > 0) {
  28015. this.rootNode.buildTree(line, line.prefixLength - 1);
  28016. }
  28017. }
  28018. }
  28019. decode(reader) {
  28020. return this.rootNode.decodeNode(reader);
  28021. }
  28022. assignPrefixCodes(lines) {
  28023. const linesLength = lines.length;
  28024. let prefixLengthMax = 0;
  28025. for (let i = 0; i < linesLength; i++) {
  28026. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  28027. }
  28028. const histogram = new Uint32Array(prefixLengthMax + 1);
  28029. for (let i = 0; i < linesLength; i++) {
  28030. histogram[lines[i].prefixLength]++;
  28031. }
  28032. let currentLength = 1,
  28033. firstCode = 0,
  28034. currentCode,
  28035. currentTemp,
  28036. line;
  28037. histogram[0] = 0;
  28038. while (currentLength <= prefixLengthMax) {
  28039. firstCode = firstCode + histogram[currentLength - 1] << 1;
  28040. currentCode = firstCode;
  28041. currentTemp = 0;
  28042. while (currentTemp < linesLength) {
  28043. line = lines[currentTemp];
  28044. if (line.prefixLength === currentLength) {
  28045. line.prefixCode = currentCode;
  28046. currentCode++;
  28047. }
  28048. currentTemp++;
  28049. }
  28050. currentLength++;
  28051. }
  28052. }
  28053. }
  28054. function decodeTablesSegment(data, start, end) {
  28055. const flags = data[start];
  28056. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  28057. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  28058. const reader = new Reader(data, start + 9, end);
  28059. const prefixSizeBits = (flags >> 1 & 7) + 1;
  28060. const rangeSizeBits = (flags >> 4 & 7) + 1;
  28061. const lines = [];
  28062. let prefixLength,
  28063. rangeLength,
  28064. currentRangeLow = lowestValue;
  28065. do {
  28066. prefixLength = reader.readBits(prefixSizeBits);
  28067. rangeLength = reader.readBits(rangeSizeBits);
  28068. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  28069. currentRangeLow += 1 << rangeLength;
  28070. } while (currentRangeLow < highestValue);
  28071. prefixLength = reader.readBits(prefixSizeBits);
  28072. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  28073. prefixLength = reader.readBits(prefixSizeBits);
  28074. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  28075. if (flags & 1) {
  28076. prefixLength = reader.readBits(prefixSizeBits);
  28077. lines.push(new HuffmanLine([prefixLength, 0]));
  28078. }
  28079. return new HuffmanTable(lines, false);
  28080. }
  28081. const standardTablesCache = {};
  28082. function getStandardTable(number) {
  28083. let table = standardTablesCache[number];
  28084. if (table) {
  28085. return table;
  28086. }
  28087. let lines;
  28088. switch (number) {
  28089. case 1:
  28090. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  28091. break;
  28092. case 2:
  28093. 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]];
  28094. break;
  28095. case 3:
  28096. 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]];
  28097. break;
  28098. case 4:
  28099. 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]];
  28100. break;
  28101. case 5:
  28102. 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]];
  28103. break;
  28104. case 6:
  28105. 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]];
  28106. break;
  28107. case 7:
  28108. 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]];
  28109. break;
  28110. case 8:
  28111. 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]];
  28112. break;
  28113. case 9:
  28114. 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]];
  28115. break;
  28116. case 10:
  28117. 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]];
  28118. break;
  28119. case 11:
  28120. 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]];
  28121. break;
  28122. case 12:
  28123. 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]];
  28124. break;
  28125. case 13:
  28126. 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]];
  28127. break;
  28128. case 14:
  28129. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  28130. break;
  28131. case 15:
  28132. 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]];
  28133. break;
  28134. default:
  28135. throw new Jbig2Error(`standard table B.${number} does not exist`);
  28136. }
  28137. for (let i = 0, ii = lines.length; i < ii; i++) {
  28138. lines[i] = new HuffmanLine(lines[i]);
  28139. }
  28140. table = new HuffmanTable(lines, true);
  28141. standardTablesCache[number] = table;
  28142. return table;
  28143. }
  28144. class Reader {
  28145. constructor(data, start, end) {
  28146. this.data = data;
  28147. this.start = start;
  28148. this.end = end;
  28149. this.position = start;
  28150. this.shift = -1;
  28151. this.currentByte = 0;
  28152. }
  28153. readBit() {
  28154. if (this.shift < 0) {
  28155. if (this.position >= this.end) {
  28156. throw new Jbig2Error("end of data while reading bit");
  28157. }
  28158. this.currentByte = this.data[this.position++];
  28159. this.shift = 7;
  28160. }
  28161. const bit = this.currentByte >> this.shift & 1;
  28162. this.shift--;
  28163. return bit;
  28164. }
  28165. readBits(numBits) {
  28166. let result = 0,
  28167. i;
  28168. for (i = numBits - 1; i >= 0; i--) {
  28169. result |= this.readBit() << i;
  28170. }
  28171. return result;
  28172. }
  28173. byteAlign() {
  28174. this.shift = -1;
  28175. }
  28176. next() {
  28177. if (this.position >= this.end) {
  28178. return -1;
  28179. }
  28180. return this.data[this.position++];
  28181. }
  28182. }
  28183. function getCustomHuffmanTable(index, referredTo, customTables) {
  28184. let currentIndex = 0;
  28185. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  28186. const table = customTables[referredTo[i]];
  28187. if (table) {
  28188. if (index === currentIndex) {
  28189. return table;
  28190. }
  28191. currentIndex++;
  28192. }
  28193. }
  28194. throw new Jbig2Error("can't find custom Huffman table");
  28195. }
  28196. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  28197. const codes = [];
  28198. for (let i = 0; i <= 34; i++) {
  28199. const codeLength = reader.readBits(4);
  28200. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28201. }
  28202. const runCodesTable = new HuffmanTable(codes, false);
  28203. codes.length = 0;
  28204. for (let i = 0; i < numberOfSymbols;) {
  28205. const codeLength = runCodesTable.decode(reader);
  28206. if (codeLength >= 32) {
  28207. let repeatedLength, numberOfRepeats, j;
  28208. switch (codeLength) {
  28209. case 32:
  28210. if (i === 0) {
  28211. throw new Jbig2Error("no previous value in symbol ID table");
  28212. }
  28213. numberOfRepeats = reader.readBits(2) + 3;
  28214. repeatedLength = codes[i - 1].prefixLength;
  28215. break;
  28216. case 33:
  28217. numberOfRepeats = reader.readBits(3) + 3;
  28218. repeatedLength = 0;
  28219. break;
  28220. case 34:
  28221. numberOfRepeats = reader.readBits(7) + 11;
  28222. repeatedLength = 0;
  28223. break;
  28224. default:
  28225. throw new Jbig2Error("invalid code length in symbol ID table");
  28226. }
  28227. for (j = 0; j < numberOfRepeats; j++) {
  28228. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  28229. i++;
  28230. }
  28231. } else {
  28232. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28233. i++;
  28234. }
  28235. }
  28236. reader.byteAlign();
  28237. const symbolIDTable = new HuffmanTable(codes, false);
  28238. let customIndex = 0,
  28239. tableFirstS,
  28240. tableDeltaS,
  28241. tableDeltaT;
  28242. switch (textRegion.huffmanFS) {
  28243. case 0:
  28244. case 1:
  28245. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  28246. break;
  28247. case 3:
  28248. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28249. customIndex++;
  28250. break;
  28251. default:
  28252. throw new Jbig2Error("invalid Huffman FS selector");
  28253. }
  28254. switch (textRegion.huffmanDS) {
  28255. case 0:
  28256. case 1:
  28257. case 2:
  28258. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  28259. break;
  28260. case 3:
  28261. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28262. customIndex++;
  28263. break;
  28264. default:
  28265. throw new Jbig2Error("invalid Huffman DS selector");
  28266. }
  28267. switch (textRegion.huffmanDT) {
  28268. case 0:
  28269. case 1:
  28270. case 2:
  28271. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  28272. break;
  28273. case 3:
  28274. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28275. customIndex++;
  28276. break;
  28277. default:
  28278. throw new Jbig2Error("invalid Huffman DT selector");
  28279. }
  28280. if (textRegion.refinement) {
  28281. throw new Jbig2Error("refinement with Huffman is not supported");
  28282. }
  28283. return {
  28284. symbolIDTable,
  28285. tableFirstS,
  28286. tableDeltaS,
  28287. tableDeltaT
  28288. };
  28289. }
  28290. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  28291. let customIndex = 0,
  28292. tableDeltaHeight,
  28293. tableDeltaWidth;
  28294. switch (dictionary.huffmanDHSelector) {
  28295. case 0:
  28296. case 1:
  28297. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  28298. break;
  28299. case 3:
  28300. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28301. customIndex++;
  28302. break;
  28303. default:
  28304. throw new Jbig2Error("invalid Huffman DH selector");
  28305. }
  28306. switch (dictionary.huffmanDWSelector) {
  28307. case 0:
  28308. case 1:
  28309. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  28310. break;
  28311. case 3:
  28312. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28313. customIndex++;
  28314. break;
  28315. default:
  28316. throw new Jbig2Error("invalid Huffman DW selector");
  28317. }
  28318. let tableBitmapSize, tableAggregateInstances;
  28319. if (dictionary.bitmapSizeSelector) {
  28320. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28321. customIndex++;
  28322. } else {
  28323. tableBitmapSize = getStandardTable(1);
  28324. }
  28325. if (dictionary.aggregationInstancesSelector) {
  28326. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28327. } else {
  28328. tableAggregateInstances = getStandardTable(1);
  28329. }
  28330. return {
  28331. tableDeltaHeight,
  28332. tableDeltaWidth,
  28333. tableBitmapSize,
  28334. tableAggregateInstances
  28335. };
  28336. }
  28337. function readUncompressedBitmap(reader, width, height) {
  28338. const bitmap = [];
  28339. for (let y = 0; y < height; y++) {
  28340. const row = new Uint8Array(width);
  28341. bitmap.push(row);
  28342. for (let x = 0; x < width; x++) {
  28343. row[x] = reader.readBit();
  28344. }
  28345. reader.byteAlign();
  28346. }
  28347. return bitmap;
  28348. }
  28349. function decodeMMRBitmap(input, width, height, endOfBlock) {
  28350. const params = {
  28351. K: -1,
  28352. Columns: width,
  28353. Rows: height,
  28354. BlackIs1: true,
  28355. EndOfBlock: endOfBlock
  28356. };
  28357. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  28358. const bitmap = [];
  28359. let currentByte,
  28360. eof = false;
  28361. for (let y = 0; y < height; y++) {
  28362. const row = new Uint8Array(width);
  28363. bitmap.push(row);
  28364. let shift = -1;
  28365. for (let x = 0; x < width; x++) {
  28366. if (shift < 0) {
  28367. currentByte = decoder.readNextChar();
  28368. if (currentByte === -1) {
  28369. currentByte = 0;
  28370. eof = true;
  28371. }
  28372. shift = 7;
  28373. }
  28374. row[x] = currentByte >> shift & 1;
  28375. shift--;
  28376. }
  28377. }
  28378. if (endOfBlock && !eof) {
  28379. const lookForEOFLimit = 5;
  28380. for (let i = 0; i < lookForEOFLimit; i++) {
  28381. if (decoder.readNextChar() === -1) {
  28382. break;
  28383. }
  28384. }
  28385. }
  28386. return bitmap;
  28387. }
  28388. class Jbig2Image {
  28389. parseChunks(chunks) {
  28390. return parseJbig2Chunks(chunks);
  28391. }
  28392. parse(data) {
  28393. const {
  28394. imgData,
  28395. width,
  28396. height
  28397. } = parseJbig2(data);
  28398. this.width = width;
  28399. this.height = height;
  28400. return imgData;
  28401. }
  28402. }
  28403. exports.Jbig2Image = Jbig2Image;
  28404. /***/ }),
  28405. /* 36 */
  28406. /***/ ((__unused_webpack_module, exports) => {
  28407. Object.defineProperty(exports, "__esModule", ({
  28408. value: true
  28409. }));
  28410. exports.ArithmeticDecoder = void 0;
  28411. const QeTable = [{
  28412. qe: 0x5601,
  28413. nmps: 1,
  28414. nlps: 1,
  28415. switchFlag: 1
  28416. }, {
  28417. qe: 0x3401,
  28418. nmps: 2,
  28419. nlps: 6,
  28420. switchFlag: 0
  28421. }, {
  28422. qe: 0x1801,
  28423. nmps: 3,
  28424. nlps: 9,
  28425. switchFlag: 0
  28426. }, {
  28427. qe: 0x0ac1,
  28428. nmps: 4,
  28429. nlps: 12,
  28430. switchFlag: 0
  28431. }, {
  28432. qe: 0x0521,
  28433. nmps: 5,
  28434. nlps: 29,
  28435. switchFlag: 0
  28436. }, {
  28437. qe: 0x0221,
  28438. nmps: 38,
  28439. nlps: 33,
  28440. switchFlag: 0
  28441. }, {
  28442. qe: 0x5601,
  28443. nmps: 7,
  28444. nlps: 6,
  28445. switchFlag: 1
  28446. }, {
  28447. qe: 0x5401,
  28448. nmps: 8,
  28449. nlps: 14,
  28450. switchFlag: 0
  28451. }, {
  28452. qe: 0x4801,
  28453. nmps: 9,
  28454. nlps: 14,
  28455. switchFlag: 0
  28456. }, {
  28457. qe: 0x3801,
  28458. nmps: 10,
  28459. nlps: 14,
  28460. switchFlag: 0
  28461. }, {
  28462. qe: 0x3001,
  28463. nmps: 11,
  28464. nlps: 17,
  28465. switchFlag: 0
  28466. }, {
  28467. qe: 0x2401,
  28468. nmps: 12,
  28469. nlps: 18,
  28470. switchFlag: 0
  28471. }, {
  28472. qe: 0x1c01,
  28473. nmps: 13,
  28474. nlps: 20,
  28475. switchFlag: 0
  28476. }, {
  28477. qe: 0x1601,
  28478. nmps: 29,
  28479. nlps: 21,
  28480. switchFlag: 0
  28481. }, {
  28482. qe: 0x5601,
  28483. nmps: 15,
  28484. nlps: 14,
  28485. switchFlag: 1
  28486. }, {
  28487. qe: 0x5401,
  28488. nmps: 16,
  28489. nlps: 14,
  28490. switchFlag: 0
  28491. }, {
  28492. qe: 0x5101,
  28493. nmps: 17,
  28494. nlps: 15,
  28495. switchFlag: 0
  28496. }, {
  28497. qe: 0x4801,
  28498. nmps: 18,
  28499. nlps: 16,
  28500. switchFlag: 0
  28501. }, {
  28502. qe: 0x3801,
  28503. nmps: 19,
  28504. nlps: 17,
  28505. switchFlag: 0
  28506. }, {
  28507. qe: 0x3401,
  28508. nmps: 20,
  28509. nlps: 18,
  28510. switchFlag: 0
  28511. }, {
  28512. qe: 0x3001,
  28513. nmps: 21,
  28514. nlps: 19,
  28515. switchFlag: 0
  28516. }, {
  28517. qe: 0x2801,
  28518. nmps: 22,
  28519. nlps: 19,
  28520. switchFlag: 0
  28521. }, {
  28522. qe: 0x2401,
  28523. nmps: 23,
  28524. nlps: 20,
  28525. switchFlag: 0
  28526. }, {
  28527. qe: 0x2201,
  28528. nmps: 24,
  28529. nlps: 21,
  28530. switchFlag: 0
  28531. }, {
  28532. qe: 0x1c01,
  28533. nmps: 25,
  28534. nlps: 22,
  28535. switchFlag: 0
  28536. }, {
  28537. qe: 0x1801,
  28538. nmps: 26,
  28539. nlps: 23,
  28540. switchFlag: 0
  28541. }, {
  28542. qe: 0x1601,
  28543. nmps: 27,
  28544. nlps: 24,
  28545. switchFlag: 0
  28546. }, {
  28547. qe: 0x1401,
  28548. nmps: 28,
  28549. nlps: 25,
  28550. switchFlag: 0
  28551. }, {
  28552. qe: 0x1201,
  28553. nmps: 29,
  28554. nlps: 26,
  28555. switchFlag: 0
  28556. }, {
  28557. qe: 0x1101,
  28558. nmps: 30,
  28559. nlps: 27,
  28560. switchFlag: 0
  28561. }, {
  28562. qe: 0x0ac1,
  28563. nmps: 31,
  28564. nlps: 28,
  28565. switchFlag: 0
  28566. }, {
  28567. qe: 0x09c1,
  28568. nmps: 32,
  28569. nlps: 29,
  28570. switchFlag: 0
  28571. }, {
  28572. qe: 0x08a1,
  28573. nmps: 33,
  28574. nlps: 30,
  28575. switchFlag: 0
  28576. }, {
  28577. qe: 0x0521,
  28578. nmps: 34,
  28579. nlps: 31,
  28580. switchFlag: 0
  28581. }, {
  28582. qe: 0x0441,
  28583. nmps: 35,
  28584. nlps: 32,
  28585. switchFlag: 0
  28586. }, {
  28587. qe: 0x02a1,
  28588. nmps: 36,
  28589. nlps: 33,
  28590. switchFlag: 0
  28591. }, {
  28592. qe: 0x0221,
  28593. nmps: 37,
  28594. nlps: 34,
  28595. switchFlag: 0
  28596. }, {
  28597. qe: 0x0141,
  28598. nmps: 38,
  28599. nlps: 35,
  28600. switchFlag: 0
  28601. }, {
  28602. qe: 0x0111,
  28603. nmps: 39,
  28604. nlps: 36,
  28605. switchFlag: 0
  28606. }, {
  28607. qe: 0x0085,
  28608. nmps: 40,
  28609. nlps: 37,
  28610. switchFlag: 0
  28611. }, {
  28612. qe: 0x0049,
  28613. nmps: 41,
  28614. nlps: 38,
  28615. switchFlag: 0
  28616. }, {
  28617. qe: 0x0025,
  28618. nmps: 42,
  28619. nlps: 39,
  28620. switchFlag: 0
  28621. }, {
  28622. qe: 0x0015,
  28623. nmps: 43,
  28624. nlps: 40,
  28625. switchFlag: 0
  28626. }, {
  28627. qe: 0x0009,
  28628. nmps: 44,
  28629. nlps: 41,
  28630. switchFlag: 0
  28631. }, {
  28632. qe: 0x0005,
  28633. nmps: 45,
  28634. nlps: 42,
  28635. switchFlag: 0
  28636. }, {
  28637. qe: 0x0001,
  28638. nmps: 45,
  28639. nlps: 43,
  28640. switchFlag: 0
  28641. }, {
  28642. qe: 0x5601,
  28643. nmps: 46,
  28644. nlps: 46,
  28645. switchFlag: 0
  28646. }];
  28647. class ArithmeticDecoder {
  28648. constructor(data, start, end) {
  28649. this.data = data;
  28650. this.bp = start;
  28651. this.dataEnd = end;
  28652. this.chigh = data[start];
  28653. this.clow = 0;
  28654. this.byteIn();
  28655. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  28656. this.clow = this.clow << 7 & 0xffff;
  28657. this.ct -= 7;
  28658. this.a = 0x8000;
  28659. }
  28660. byteIn() {
  28661. const data = this.data;
  28662. let bp = this.bp;
  28663. if (data[bp] === 0xff) {
  28664. if (data[bp + 1] > 0x8f) {
  28665. this.clow += 0xff00;
  28666. this.ct = 8;
  28667. } else {
  28668. bp++;
  28669. this.clow += data[bp] << 9;
  28670. this.ct = 7;
  28671. this.bp = bp;
  28672. }
  28673. } else {
  28674. bp++;
  28675. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  28676. this.ct = 8;
  28677. this.bp = bp;
  28678. }
  28679. if (this.clow > 0xffff) {
  28680. this.chigh += this.clow >> 16;
  28681. this.clow &= 0xffff;
  28682. }
  28683. }
  28684. readBit(contexts, pos) {
  28685. let cx_index = contexts[pos] >> 1,
  28686. cx_mps = contexts[pos] & 1;
  28687. const qeTableIcx = QeTable[cx_index];
  28688. const qeIcx = qeTableIcx.qe;
  28689. let d;
  28690. let a = this.a - qeIcx;
  28691. if (this.chigh < qeIcx) {
  28692. if (a < qeIcx) {
  28693. a = qeIcx;
  28694. d = cx_mps;
  28695. cx_index = qeTableIcx.nmps;
  28696. } else {
  28697. a = qeIcx;
  28698. d = 1 ^ cx_mps;
  28699. if (qeTableIcx.switchFlag === 1) {
  28700. cx_mps = d;
  28701. }
  28702. cx_index = qeTableIcx.nlps;
  28703. }
  28704. } else {
  28705. this.chigh -= qeIcx;
  28706. if ((a & 0x8000) !== 0) {
  28707. this.a = a;
  28708. return cx_mps;
  28709. }
  28710. if (a < qeIcx) {
  28711. d = 1 ^ cx_mps;
  28712. if (qeTableIcx.switchFlag === 1) {
  28713. cx_mps = d;
  28714. }
  28715. cx_index = qeTableIcx.nlps;
  28716. } else {
  28717. d = cx_mps;
  28718. cx_index = qeTableIcx.nmps;
  28719. }
  28720. }
  28721. do {
  28722. if (this.ct === 0) {
  28723. this.byteIn();
  28724. }
  28725. a <<= 1;
  28726. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  28727. this.clow = this.clow << 1 & 0xffff;
  28728. this.ct--;
  28729. } while ((a & 0x8000) === 0);
  28730. this.a = a;
  28731. contexts[pos] = cx_index << 1 | cx_mps;
  28732. return d;
  28733. }
  28734. }
  28735. exports.ArithmeticDecoder = ArithmeticDecoder;
  28736. /***/ }),
  28737. /* 37 */
  28738. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28739. Object.defineProperty(exports, "__esModule", ({
  28740. value: true
  28741. }));
  28742. exports.JpegStream = void 0;
  28743. var _decode_stream = __w_pdfjs_require__(29);
  28744. var _primitives = __w_pdfjs_require__(5);
  28745. var _jpg = __w_pdfjs_require__(38);
  28746. var _util = __w_pdfjs_require__(2);
  28747. class JpegStream extends _decode_stream.DecodeStream {
  28748. constructor(stream, maybeLength, params) {
  28749. let ch;
  28750. while ((ch = stream.getByte()) !== -1) {
  28751. if (ch === 0xff) {
  28752. stream.skip(-1);
  28753. break;
  28754. }
  28755. }
  28756. super(maybeLength);
  28757. this.stream = stream;
  28758. this.dict = stream.dict;
  28759. this.maybeLength = maybeLength;
  28760. this.params = params;
  28761. }
  28762. get bytes() {
  28763. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  28764. }
  28765. ensureBuffer(requested) {}
  28766. readBlock() {
  28767. if (this.eof) {
  28768. return;
  28769. }
  28770. const jpegOptions = {
  28771. decodeTransform: undefined,
  28772. colorTransform: undefined
  28773. };
  28774. const decodeArr = this.dict.getArray("D", "Decode");
  28775. if (this.forceRGB && Array.isArray(decodeArr)) {
  28776. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  28777. const decodeArrLength = decodeArr.length;
  28778. const transform = new Int32Array(decodeArrLength);
  28779. let transformNeeded = false;
  28780. const maxValue = (1 << bitsPerComponent) - 1;
  28781. for (let i = 0; i < decodeArrLength; i += 2) {
  28782. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  28783. transform[i + 1] = decodeArr[i] * maxValue | 0;
  28784. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  28785. transformNeeded = true;
  28786. }
  28787. }
  28788. if (transformNeeded) {
  28789. jpegOptions.decodeTransform = transform;
  28790. }
  28791. }
  28792. if (this.params instanceof _primitives.Dict) {
  28793. const colorTransform = this.params.get("ColorTransform");
  28794. if (Number.isInteger(colorTransform)) {
  28795. jpegOptions.colorTransform = colorTransform;
  28796. }
  28797. }
  28798. const jpegImage = new _jpg.JpegImage(jpegOptions);
  28799. jpegImage.parse(this.bytes);
  28800. const data = jpegImage.getData({
  28801. width: this.drawWidth,
  28802. height: this.drawHeight,
  28803. forceRGB: this.forceRGB,
  28804. isSourcePDF: true
  28805. });
  28806. this.buffer = data;
  28807. this.bufferLength = data.length;
  28808. this.eof = true;
  28809. }
  28810. }
  28811. exports.JpegStream = JpegStream;
  28812. /***/ }),
  28813. /* 38 */
  28814. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28815. Object.defineProperty(exports, "__esModule", ({
  28816. value: true
  28817. }));
  28818. exports.JpegImage = void 0;
  28819. var _util = __w_pdfjs_require__(2);
  28820. var _core_utils = __w_pdfjs_require__(8);
  28821. class JpegError extends _util.BaseException {
  28822. constructor(msg) {
  28823. super(`JPEG error: ${msg}`, "JpegError");
  28824. }
  28825. }
  28826. class DNLMarkerError extends _util.BaseException {
  28827. constructor(message, scanLines) {
  28828. super(message, "DNLMarkerError");
  28829. this.scanLines = scanLines;
  28830. }
  28831. }
  28832. class EOIMarkerError extends _util.BaseException {
  28833. constructor(msg) {
  28834. super(msg, "EOIMarkerError");
  28835. }
  28836. }
  28837. 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]);
  28838. const dctCos1 = 4017;
  28839. const dctSin1 = 799;
  28840. const dctCos3 = 3406;
  28841. const dctSin3 = 2276;
  28842. const dctCos6 = 1567;
  28843. const dctSin6 = 3784;
  28844. const dctSqrt2 = 5793;
  28845. const dctSqrt1d2 = 2896;
  28846. function buildHuffmanTable(codeLengths, values) {
  28847. let k = 0,
  28848. i,
  28849. j,
  28850. length = 16;
  28851. while (length > 0 && !codeLengths[length - 1]) {
  28852. length--;
  28853. }
  28854. const code = [{
  28855. children: [],
  28856. index: 0
  28857. }];
  28858. let p = code[0],
  28859. q;
  28860. for (i = 0; i < length; i++) {
  28861. for (j = 0; j < codeLengths[i]; j++) {
  28862. p = code.pop();
  28863. p.children[p.index] = values[k];
  28864. while (p.index > 0) {
  28865. p = code.pop();
  28866. }
  28867. p.index++;
  28868. code.push(p);
  28869. while (code.length <= i) {
  28870. code.push(q = {
  28871. children: [],
  28872. index: 0
  28873. });
  28874. p.children[p.index] = q.children;
  28875. p = q;
  28876. }
  28877. k++;
  28878. }
  28879. if (i + 1 < length) {
  28880. code.push(q = {
  28881. children: [],
  28882. index: 0
  28883. });
  28884. p.children[p.index] = q.children;
  28885. p = q;
  28886. }
  28887. }
  28888. return code[0].children;
  28889. }
  28890. function getBlockBufferOffset(component, row, col) {
  28891. return 64 * ((component.blocksPerLine + 1) * row + col);
  28892. }
  28893. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  28894. const mcusPerLine = frame.mcusPerLine;
  28895. const progressive = frame.progressive;
  28896. const startOffset = offset;
  28897. let bitsData = 0,
  28898. bitsCount = 0;
  28899. function readBit() {
  28900. if (bitsCount > 0) {
  28901. bitsCount--;
  28902. return bitsData >> bitsCount & 1;
  28903. }
  28904. bitsData = data[offset++];
  28905. if (bitsData === 0xff) {
  28906. const nextByte = data[offset++];
  28907. if (nextByte) {
  28908. if (nextByte === 0xdc && parseDNLMarker) {
  28909. offset += 2;
  28910. const scanLines = (0, _core_utils.readUint16)(data, offset);
  28911. offset += 2;
  28912. if (scanLines > 0 && scanLines !== frame.scanLines) {
  28913. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  28914. }
  28915. } else if (nextByte === 0xd9) {
  28916. if (parseDNLMarker) {
  28917. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  28918. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  28919. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  28920. }
  28921. }
  28922. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  28923. }
  28924. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  28925. }
  28926. }
  28927. bitsCount = 7;
  28928. return bitsData >>> 7;
  28929. }
  28930. function decodeHuffman(tree) {
  28931. let node = tree;
  28932. while (true) {
  28933. node = node[readBit()];
  28934. switch (typeof node) {
  28935. case "number":
  28936. return node;
  28937. case "object":
  28938. continue;
  28939. }
  28940. throw new JpegError("invalid huffman sequence");
  28941. }
  28942. }
  28943. function receive(length) {
  28944. let n = 0;
  28945. while (length > 0) {
  28946. n = n << 1 | readBit();
  28947. length--;
  28948. }
  28949. return n;
  28950. }
  28951. function receiveAndExtend(length) {
  28952. if (length === 1) {
  28953. return readBit() === 1 ? 1 : -1;
  28954. }
  28955. const n = receive(length);
  28956. if (n >= 1 << length - 1) {
  28957. return n;
  28958. }
  28959. return n + (-1 << length) + 1;
  28960. }
  28961. function decodeBaseline(component, blockOffset) {
  28962. const t = decodeHuffman(component.huffmanTableDC);
  28963. const diff = t === 0 ? 0 : receiveAndExtend(t);
  28964. component.blockData[blockOffset] = component.pred += diff;
  28965. let k = 1;
  28966. while (k < 64) {
  28967. const rs = decodeHuffman(component.huffmanTableAC);
  28968. const s = rs & 15,
  28969. r = rs >> 4;
  28970. if (s === 0) {
  28971. if (r < 15) {
  28972. break;
  28973. }
  28974. k += 16;
  28975. continue;
  28976. }
  28977. k += r;
  28978. const z = dctZigZag[k];
  28979. component.blockData[blockOffset + z] = receiveAndExtend(s);
  28980. k++;
  28981. }
  28982. }
  28983. function decodeDCFirst(component, blockOffset) {
  28984. const t = decodeHuffman(component.huffmanTableDC);
  28985. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  28986. component.blockData[blockOffset] = component.pred += diff;
  28987. }
  28988. function decodeDCSuccessive(component, blockOffset) {
  28989. component.blockData[blockOffset] |= readBit() << successive;
  28990. }
  28991. let eobrun = 0;
  28992. function decodeACFirst(component, blockOffset) {
  28993. if (eobrun > 0) {
  28994. eobrun--;
  28995. return;
  28996. }
  28997. let k = spectralStart;
  28998. const e = spectralEnd;
  28999. while (k <= e) {
  29000. const rs = decodeHuffman(component.huffmanTableAC);
  29001. const s = rs & 15,
  29002. r = rs >> 4;
  29003. if (s === 0) {
  29004. if (r < 15) {
  29005. eobrun = receive(r) + (1 << r) - 1;
  29006. break;
  29007. }
  29008. k += 16;
  29009. continue;
  29010. }
  29011. k += r;
  29012. const z = dctZigZag[k];
  29013. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  29014. k++;
  29015. }
  29016. }
  29017. let successiveACState = 0,
  29018. successiveACNextValue;
  29019. function decodeACSuccessive(component, blockOffset) {
  29020. let k = spectralStart;
  29021. const e = spectralEnd;
  29022. let r = 0;
  29023. let s;
  29024. let rs;
  29025. while (k <= e) {
  29026. const offsetZ = blockOffset + dctZigZag[k];
  29027. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  29028. switch (successiveACState) {
  29029. case 0:
  29030. rs = decodeHuffman(component.huffmanTableAC);
  29031. s = rs & 15;
  29032. r = rs >> 4;
  29033. if (s === 0) {
  29034. if (r < 15) {
  29035. eobrun = receive(r) + (1 << r);
  29036. successiveACState = 4;
  29037. } else {
  29038. r = 16;
  29039. successiveACState = 1;
  29040. }
  29041. } else {
  29042. if (s !== 1) {
  29043. throw new JpegError("invalid ACn encoding");
  29044. }
  29045. successiveACNextValue = receiveAndExtend(s);
  29046. successiveACState = r ? 2 : 3;
  29047. }
  29048. continue;
  29049. case 1:
  29050. case 2:
  29051. if (component.blockData[offsetZ]) {
  29052. component.blockData[offsetZ] += sign * (readBit() << successive);
  29053. } else {
  29054. r--;
  29055. if (r === 0) {
  29056. successiveACState = successiveACState === 2 ? 3 : 0;
  29057. }
  29058. }
  29059. break;
  29060. case 3:
  29061. if (component.blockData[offsetZ]) {
  29062. component.blockData[offsetZ] += sign * (readBit() << successive);
  29063. } else {
  29064. component.blockData[offsetZ] = successiveACNextValue << successive;
  29065. successiveACState = 0;
  29066. }
  29067. break;
  29068. case 4:
  29069. if (component.blockData[offsetZ]) {
  29070. component.blockData[offsetZ] += sign * (readBit() << successive);
  29071. }
  29072. break;
  29073. }
  29074. k++;
  29075. }
  29076. if (successiveACState === 4) {
  29077. eobrun--;
  29078. if (eobrun === 0) {
  29079. successiveACState = 0;
  29080. }
  29081. }
  29082. }
  29083. let blockRow = 0;
  29084. function decodeMcu(component, decode, mcu, row, col) {
  29085. const mcuRow = mcu / mcusPerLine | 0;
  29086. const mcuCol = mcu % mcusPerLine;
  29087. blockRow = mcuRow * component.v + row;
  29088. const blockCol = mcuCol * component.h + col;
  29089. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29090. decode(component, blockOffset);
  29091. }
  29092. function decodeBlock(component, decode, mcu) {
  29093. blockRow = mcu / component.blocksPerLine | 0;
  29094. const blockCol = mcu % component.blocksPerLine;
  29095. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29096. decode(component, blockOffset);
  29097. }
  29098. const componentsLength = components.length;
  29099. let component, i, j, k, n;
  29100. let decodeFn;
  29101. if (progressive) {
  29102. if (spectralStart === 0) {
  29103. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  29104. } else {
  29105. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  29106. }
  29107. } else {
  29108. decodeFn = decodeBaseline;
  29109. }
  29110. let mcu = 0,
  29111. fileMarker;
  29112. let mcuExpected;
  29113. if (componentsLength === 1) {
  29114. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  29115. } else {
  29116. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  29117. }
  29118. let h, v;
  29119. while (mcu <= mcuExpected) {
  29120. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  29121. if (mcuToRead > 0) {
  29122. for (i = 0; i < componentsLength; i++) {
  29123. components[i].pred = 0;
  29124. }
  29125. eobrun = 0;
  29126. if (componentsLength === 1) {
  29127. component = components[0];
  29128. for (n = 0; n < mcuToRead; n++) {
  29129. decodeBlock(component, decodeFn, mcu);
  29130. mcu++;
  29131. }
  29132. } else {
  29133. for (n = 0; n < mcuToRead; n++) {
  29134. for (i = 0; i < componentsLength; i++) {
  29135. component = components[i];
  29136. h = component.h;
  29137. v = component.v;
  29138. for (j = 0; j < v; j++) {
  29139. for (k = 0; k < h; k++) {
  29140. decodeMcu(component, decodeFn, mcu, j, k);
  29141. }
  29142. }
  29143. }
  29144. mcu++;
  29145. }
  29146. }
  29147. }
  29148. bitsCount = 0;
  29149. fileMarker = findNextFileMarker(data, offset);
  29150. if (!fileMarker) {
  29151. break;
  29152. }
  29153. if (fileMarker.invalid) {
  29154. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  29155. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  29156. offset = fileMarker.offset;
  29157. }
  29158. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  29159. offset += 2;
  29160. } else {
  29161. break;
  29162. }
  29163. }
  29164. return offset - startOffset;
  29165. }
  29166. function quantizeAndInverse(component, blockBufferOffset, p) {
  29167. const qt = component.quantizationTable,
  29168. blockData = component.blockData;
  29169. let v0, v1, v2, v3, v4, v5, v6, v7;
  29170. let p0, p1, p2, p3, p4, p5, p6, p7;
  29171. let t;
  29172. if (!qt) {
  29173. throw new JpegError("missing required Quantization Table.");
  29174. }
  29175. for (let row = 0; row < 64; row += 8) {
  29176. p0 = blockData[blockBufferOffset + row];
  29177. p1 = blockData[blockBufferOffset + row + 1];
  29178. p2 = blockData[blockBufferOffset + row + 2];
  29179. p3 = blockData[blockBufferOffset + row + 3];
  29180. p4 = blockData[blockBufferOffset + row + 4];
  29181. p5 = blockData[blockBufferOffset + row + 5];
  29182. p6 = blockData[blockBufferOffset + row + 6];
  29183. p7 = blockData[blockBufferOffset + row + 7];
  29184. p0 *= qt[row];
  29185. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29186. t = dctSqrt2 * p0 + 512 >> 10;
  29187. p[row] = t;
  29188. p[row + 1] = t;
  29189. p[row + 2] = t;
  29190. p[row + 3] = t;
  29191. p[row + 4] = t;
  29192. p[row + 5] = t;
  29193. p[row + 6] = t;
  29194. p[row + 7] = t;
  29195. continue;
  29196. }
  29197. p1 *= qt[row + 1];
  29198. p2 *= qt[row + 2];
  29199. p3 *= qt[row + 3];
  29200. p4 *= qt[row + 4];
  29201. p5 *= qt[row + 5];
  29202. p6 *= qt[row + 6];
  29203. p7 *= qt[row + 7];
  29204. v0 = dctSqrt2 * p0 + 128 >> 8;
  29205. v1 = dctSqrt2 * p4 + 128 >> 8;
  29206. v2 = p2;
  29207. v3 = p6;
  29208. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  29209. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  29210. v5 = p3 << 4;
  29211. v6 = p5 << 4;
  29212. v0 = v0 + v1 + 1 >> 1;
  29213. v1 = v0 - v1;
  29214. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  29215. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  29216. v3 = t;
  29217. v4 = v4 + v6 + 1 >> 1;
  29218. v6 = v4 - v6;
  29219. v7 = v7 + v5 + 1 >> 1;
  29220. v5 = v7 - v5;
  29221. v0 = v0 + v3 + 1 >> 1;
  29222. v3 = v0 - v3;
  29223. v1 = v1 + v2 + 1 >> 1;
  29224. v2 = v1 - v2;
  29225. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29226. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29227. v7 = t;
  29228. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29229. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29230. v6 = t;
  29231. p[row] = v0 + v7;
  29232. p[row + 7] = v0 - v7;
  29233. p[row + 1] = v1 + v6;
  29234. p[row + 6] = v1 - v6;
  29235. p[row + 2] = v2 + v5;
  29236. p[row + 5] = v2 - v5;
  29237. p[row + 3] = v3 + v4;
  29238. p[row + 4] = v3 - v4;
  29239. }
  29240. for (let col = 0; col < 8; ++col) {
  29241. p0 = p[col];
  29242. p1 = p[col + 8];
  29243. p2 = p[col + 16];
  29244. p3 = p[col + 24];
  29245. p4 = p[col + 32];
  29246. p5 = p[col + 40];
  29247. p6 = p[col + 48];
  29248. p7 = p[col + 56];
  29249. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29250. t = dctSqrt2 * p0 + 8192 >> 14;
  29251. if (t < -2040) {
  29252. t = 0;
  29253. } else if (t >= 2024) {
  29254. t = 255;
  29255. } else {
  29256. t = t + 2056 >> 4;
  29257. }
  29258. blockData[blockBufferOffset + col] = t;
  29259. blockData[blockBufferOffset + col + 8] = t;
  29260. blockData[blockBufferOffset + col + 16] = t;
  29261. blockData[blockBufferOffset + col + 24] = t;
  29262. blockData[blockBufferOffset + col + 32] = t;
  29263. blockData[blockBufferOffset + col + 40] = t;
  29264. blockData[blockBufferOffset + col + 48] = t;
  29265. blockData[blockBufferOffset + col + 56] = t;
  29266. continue;
  29267. }
  29268. v0 = dctSqrt2 * p0 + 2048 >> 12;
  29269. v1 = dctSqrt2 * p4 + 2048 >> 12;
  29270. v2 = p2;
  29271. v3 = p6;
  29272. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  29273. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  29274. v5 = p3;
  29275. v6 = p5;
  29276. v0 = (v0 + v1 + 1 >> 1) + 4112;
  29277. v1 = v0 - v1;
  29278. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  29279. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  29280. v3 = t;
  29281. v4 = v4 + v6 + 1 >> 1;
  29282. v6 = v4 - v6;
  29283. v7 = v7 + v5 + 1 >> 1;
  29284. v5 = v7 - v5;
  29285. v0 = v0 + v3 + 1 >> 1;
  29286. v3 = v0 - v3;
  29287. v1 = v1 + v2 + 1 >> 1;
  29288. v2 = v1 - v2;
  29289. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29290. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29291. v7 = t;
  29292. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29293. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29294. v6 = t;
  29295. p0 = v0 + v7;
  29296. p7 = v0 - v7;
  29297. p1 = v1 + v6;
  29298. p6 = v1 - v6;
  29299. p2 = v2 + v5;
  29300. p5 = v2 - v5;
  29301. p3 = v3 + v4;
  29302. p4 = v3 - v4;
  29303. if (p0 < 16) {
  29304. p0 = 0;
  29305. } else if (p0 >= 4080) {
  29306. p0 = 255;
  29307. } else {
  29308. p0 >>= 4;
  29309. }
  29310. if (p1 < 16) {
  29311. p1 = 0;
  29312. } else if (p1 >= 4080) {
  29313. p1 = 255;
  29314. } else {
  29315. p1 >>= 4;
  29316. }
  29317. if (p2 < 16) {
  29318. p2 = 0;
  29319. } else if (p2 >= 4080) {
  29320. p2 = 255;
  29321. } else {
  29322. p2 >>= 4;
  29323. }
  29324. if (p3 < 16) {
  29325. p3 = 0;
  29326. } else if (p3 >= 4080) {
  29327. p3 = 255;
  29328. } else {
  29329. p3 >>= 4;
  29330. }
  29331. if (p4 < 16) {
  29332. p4 = 0;
  29333. } else if (p4 >= 4080) {
  29334. p4 = 255;
  29335. } else {
  29336. p4 >>= 4;
  29337. }
  29338. if (p5 < 16) {
  29339. p5 = 0;
  29340. } else if (p5 >= 4080) {
  29341. p5 = 255;
  29342. } else {
  29343. p5 >>= 4;
  29344. }
  29345. if (p6 < 16) {
  29346. p6 = 0;
  29347. } else if (p6 >= 4080) {
  29348. p6 = 255;
  29349. } else {
  29350. p6 >>= 4;
  29351. }
  29352. if (p7 < 16) {
  29353. p7 = 0;
  29354. } else if (p7 >= 4080) {
  29355. p7 = 255;
  29356. } else {
  29357. p7 >>= 4;
  29358. }
  29359. blockData[blockBufferOffset + col] = p0;
  29360. blockData[blockBufferOffset + col + 8] = p1;
  29361. blockData[blockBufferOffset + col + 16] = p2;
  29362. blockData[blockBufferOffset + col + 24] = p3;
  29363. blockData[blockBufferOffset + col + 32] = p4;
  29364. blockData[blockBufferOffset + col + 40] = p5;
  29365. blockData[blockBufferOffset + col + 48] = p6;
  29366. blockData[blockBufferOffset + col + 56] = p7;
  29367. }
  29368. }
  29369. function buildComponentData(frame, component) {
  29370. const blocksPerLine = component.blocksPerLine;
  29371. const blocksPerColumn = component.blocksPerColumn;
  29372. const computationBuffer = new Int16Array(64);
  29373. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  29374. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  29375. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  29376. quantizeAndInverse(component, offset, computationBuffer);
  29377. }
  29378. }
  29379. return component.blockData;
  29380. }
  29381. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  29382. const maxPos = data.length - 1;
  29383. let newPos = startPos < currentPos ? startPos : currentPos;
  29384. if (currentPos >= maxPos) {
  29385. return null;
  29386. }
  29387. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  29388. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  29389. return {
  29390. invalid: null,
  29391. marker: currentMarker,
  29392. offset: currentPos
  29393. };
  29394. }
  29395. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  29396. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  29397. if (++newPos >= maxPos) {
  29398. return null;
  29399. }
  29400. newMarker = (0, _core_utils.readUint16)(data, newPos);
  29401. }
  29402. return {
  29403. invalid: currentMarker.toString(16),
  29404. marker: newMarker,
  29405. offset: newPos
  29406. };
  29407. }
  29408. class JpegImage {
  29409. constructor({
  29410. decodeTransform = null,
  29411. colorTransform = -1
  29412. } = {}) {
  29413. this._decodeTransform = decodeTransform;
  29414. this._colorTransform = colorTransform;
  29415. }
  29416. parse(data, {
  29417. dnlScanLines = null
  29418. } = {}) {
  29419. function readDataBlock() {
  29420. const length = (0, _core_utils.readUint16)(data, offset);
  29421. offset += 2;
  29422. let endOffset = offset + length - 2;
  29423. const fileMarker = findNextFileMarker(data, endOffset, offset);
  29424. if (fileMarker && fileMarker.invalid) {
  29425. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  29426. endOffset = fileMarker.offset;
  29427. }
  29428. const array = data.subarray(offset, endOffset);
  29429. offset += array.length;
  29430. return array;
  29431. }
  29432. function prepareComponents(frame) {
  29433. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  29434. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  29435. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29436. const component = frame.components[i];
  29437. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  29438. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  29439. const blocksPerLineForMcu = mcusPerLine * component.h;
  29440. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  29441. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  29442. component.blockData = new Int16Array(blocksBufferSize);
  29443. component.blocksPerLine = blocksPerLine;
  29444. component.blocksPerColumn = blocksPerColumn;
  29445. }
  29446. frame.mcusPerLine = mcusPerLine;
  29447. frame.mcusPerColumn = mcusPerColumn;
  29448. }
  29449. let offset = 0;
  29450. let jfif = null;
  29451. let adobe = null;
  29452. let frame, resetInterval;
  29453. let numSOSMarkers = 0;
  29454. const quantizationTables = [];
  29455. const huffmanTablesAC = [],
  29456. huffmanTablesDC = [];
  29457. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  29458. offset += 2;
  29459. if (fileMarker !== 0xffd8) {
  29460. throw new JpegError("SOI not found");
  29461. }
  29462. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29463. offset += 2;
  29464. markerLoop: while (fileMarker !== 0xffd9) {
  29465. let i, j, l;
  29466. switch (fileMarker) {
  29467. case 0xffe0:
  29468. case 0xffe1:
  29469. case 0xffe2:
  29470. case 0xffe3:
  29471. case 0xffe4:
  29472. case 0xffe5:
  29473. case 0xffe6:
  29474. case 0xffe7:
  29475. case 0xffe8:
  29476. case 0xffe9:
  29477. case 0xffea:
  29478. case 0xffeb:
  29479. case 0xffec:
  29480. case 0xffed:
  29481. case 0xffee:
  29482. case 0xffef:
  29483. case 0xfffe:
  29484. const appData = readDataBlock();
  29485. if (fileMarker === 0xffe0) {
  29486. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  29487. jfif = {
  29488. version: {
  29489. major: appData[5],
  29490. minor: appData[6]
  29491. },
  29492. densityUnits: appData[7],
  29493. xDensity: appData[8] << 8 | appData[9],
  29494. yDensity: appData[10] << 8 | appData[11],
  29495. thumbWidth: appData[12],
  29496. thumbHeight: appData[13],
  29497. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  29498. };
  29499. }
  29500. }
  29501. if (fileMarker === 0xffee) {
  29502. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  29503. adobe = {
  29504. version: appData[5] << 8 | appData[6],
  29505. flags0: appData[7] << 8 | appData[8],
  29506. flags1: appData[9] << 8 | appData[10],
  29507. transformCode: appData[11]
  29508. };
  29509. }
  29510. }
  29511. break;
  29512. case 0xffdb:
  29513. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  29514. offset += 2;
  29515. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  29516. let z;
  29517. while (offset < quantizationTablesEnd) {
  29518. const quantizationTableSpec = data[offset++];
  29519. const tableData = new Uint16Array(64);
  29520. if (quantizationTableSpec >> 4 === 0) {
  29521. for (j = 0; j < 64; j++) {
  29522. z = dctZigZag[j];
  29523. tableData[z] = data[offset++];
  29524. }
  29525. } else if (quantizationTableSpec >> 4 === 1) {
  29526. for (j = 0; j < 64; j++) {
  29527. z = dctZigZag[j];
  29528. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  29529. offset += 2;
  29530. }
  29531. } else {
  29532. throw new JpegError("DQT - invalid table spec");
  29533. }
  29534. quantizationTables[quantizationTableSpec & 15] = tableData;
  29535. }
  29536. break;
  29537. case 0xffc0:
  29538. case 0xffc1:
  29539. case 0xffc2:
  29540. if (frame) {
  29541. throw new JpegError("Only single frame JPEGs supported");
  29542. }
  29543. offset += 2;
  29544. frame = {};
  29545. frame.extended = fileMarker === 0xffc1;
  29546. frame.progressive = fileMarker === 0xffc2;
  29547. frame.precision = data[offset++];
  29548. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  29549. offset += 2;
  29550. frame.scanLines = dnlScanLines || sofScanLines;
  29551. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  29552. offset += 2;
  29553. frame.components = [];
  29554. frame.componentIds = {};
  29555. const componentsCount = data[offset++];
  29556. let maxH = 0,
  29557. maxV = 0;
  29558. for (i = 0; i < componentsCount; i++) {
  29559. const componentId = data[offset];
  29560. const h = data[offset + 1] >> 4;
  29561. const v = data[offset + 1] & 15;
  29562. if (maxH < h) {
  29563. maxH = h;
  29564. }
  29565. if (maxV < v) {
  29566. maxV = v;
  29567. }
  29568. const qId = data[offset + 2];
  29569. l = frame.components.push({
  29570. h,
  29571. v,
  29572. quantizationId: qId,
  29573. quantizationTable: null
  29574. });
  29575. frame.componentIds[componentId] = l - 1;
  29576. offset += 3;
  29577. }
  29578. frame.maxH = maxH;
  29579. frame.maxV = maxV;
  29580. prepareComponents(frame);
  29581. break;
  29582. case 0xffc4:
  29583. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  29584. offset += 2;
  29585. for (i = 2; i < huffmanLength;) {
  29586. const huffmanTableSpec = data[offset++];
  29587. const codeLengths = new Uint8Array(16);
  29588. let codeLengthSum = 0;
  29589. for (j = 0; j < 16; j++, offset++) {
  29590. codeLengthSum += codeLengths[j] = data[offset];
  29591. }
  29592. const huffmanValues = new Uint8Array(codeLengthSum);
  29593. for (j = 0; j < codeLengthSum; j++, offset++) {
  29594. huffmanValues[j] = data[offset];
  29595. }
  29596. i += 17 + codeLengthSum;
  29597. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  29598. }
  29599. break;
  29600. case 0xffdd:
  29601. offset += 2;
  29602. resetInterval = (0, _core_utils.readUint16)(data, offset);
  29603. offset += 2;
  29604. break;
  29605. case 0xffda:
  29606. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  29607. offset += 2;
  29608. const selectorsCount = data[offset++],
  29609. components = [];
  29610. for (i = 0; i < selectorsCount; i++) {
  29611. const index = data[offset++];
  29612. const componentIndex = frame.componentIds[index];
  29613. const component = frame.components[componentIndex];
  29614. component.index = index;
  29615. const tableSpec = data[offset++];
  29616. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  29617. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  29618. components.push(component);
  29619. }
  29620. const spectralStart = data[offset++],
  29621. spectralEnd = data[offset++],
  29622. successiveApproximation = data[offset++];
  29623. try {
  29624. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  29625. offset += processed;
  29626. } catch (ex) {
  29627. if (ex instanceof DNLMarkerError) {
  29628. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  29629. return this.parse(data, {
  29630. dnlScanLines: ex.scanLines
  29631. });
  29632. } else if (ex instanceof EOIMarkerError) {
  29633. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  29634. break markerLoop;
  29635. }
  29636. throw ex;
  29637. }
  29638. break;
  29639. case 0xffdc:
  29640. offset += 4;
  29641. break;
  29642. case 0xffff:
  29643. if (data[offset] !== 0xff) {
  29644. offset--;
  29645. }
  29646. break;
  29647. default:
  29648. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  29649. if (nextFileMarker && nextFileMarker.invalid) {
  29650. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  29651. offset = nextFileMarker.offset;
  29652. break;
  29653. }
  29654. if (!nextFileMarker || offset >= data.length - 1) {
  29655. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  29656. break markerLoop;
  29657. }
  29658. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  29659. }
  29660. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29661. offset += 2;
  29662. }
  29663. this.width = frame.samplesPerLine;
  29664. this.height = frame.scanLines;
  29665. this.jfif = jfif;
  29666. this.adobe = adobe;
  29667. this.components = [];
  29668. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29669. const component = frame.components[i];
  29670. const quantizationTable = quantizationTables[component.quantizationId];
  29671. if (quantizationTable) {
  29672. component.quantizationTable = quantizationTable;
  29673. }
  29674. this.components.push({
  29675. index: component.index,
  29676. output: buildComponentData(frame, component),
  29677. scaleX: component.h / frame.maxH,
  29678. scaleY: component.v / frame.maxV,
  29679. blocksPerLine: component.blocksPerLine,
  29680. blocksPerColumn: component.blocksPerColumn
  29681. });
  29682. }
  29683. this.numComponents = this.components.length;
  29684. return undefined;
  29685. }
  29686. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  29687. const scaleX = this.width / width,
  29688. scaleY = this.height / height;
  29689. let component, componentScaleX, componentScaleY, blocksPerScanline;
  29690. let x, y, i, j, k;
  29691. let index;
  29692. let offset = 0;
  29693. let output;
  29694. const numComponents = this.components.length;
  29695. const dataLength = width * height * numComponents;
  29696. const data = new Uint8ClampedArray(dataLength);
  29697. const xScaleBlockOffset = new Uint32Array(width);
  29698. const mask3LSB = 0xfffffff8;
  29699. let lastComponentScaleX;
  29700. for (i = 0; i < numComponents; i++) {
  29701. component = this.components[i];
  29702. componentScaleX = component.scaleX * scaleX;
  29703. componentScaleY = component.scaleY * scaleY;
  29704. offset = i;
  29705. output = component.output;
  29706. blocksPerScanline = component.blocksPerLine + 1 << 3;
  29707. if (componentScaleX !== lastComponentScaleX) {
  29708. for (x = 0; x < width; x++) {
  29709. j = 0 | x * componentScaleX;
  29710. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  29711. }
  29712. lastComponentScaleX = componentScaleX;
  29713. }
  29714. for (y = 0; y < height; y++) {
  29715. j = 0 | y * componentScaleY;
  29716. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  29717. for (x = 0; x < width; x++) {
  29718. data[offset] = output[index + xScaleBlockOffset[x]];
  29719. offset += numComponents;
  29720. }
  29721. }
  29722. }
  29723. let transform = this._decodeTransform;
  29724. if (!isSourcePDF && numComponents === 4 && !transform) {
  29725. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  29726. }
  29727. if (transform) {
  29728. for (i = 0; i < dataLength;) {
  29729. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  29730. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  29731. }
  29732. }
  29733. }
  29734. return data;
  29735. }
  29736. get _isColorConversionNeeded() {
  29737. if (this.adobe) {
  29738. return !!this.adobe.transformCode;
  29739. }
  29740. if (this.numComponents === 3) {
  29741. if (this._colorTransform === 0) {
  29742. return false;
  29743. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  29744. return false;
  29745. }
  29746. return true;
  29747. }
  29748. if (this._colorTransform === 1) {
  29749. return true;
  29750. }
  29751. return false;
  29752. }
  29753. _convertYccToRgb(data) {
  29754. let Y, Cb, Cr;
  29755. for (let i = 0, length = data.length; i < length; i += 3) {
  29756. Y = data[i];
  29757. Cb = data[i + 1];
  29758. Cr = data[i + 2];
  29759. data[i] = Y - 179.456 + 1.402 * Cr;
  29760. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  29761. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  29762. }
  29763. return data;
  29764. }
  29765. _convertYcckToRgb(data) {
  29766. let Y, Cb, Cr, k;
  29767. let offset = 0;
  29768. for (let i = 0, length = data.length; i < length; i += 4) {
  29769. Y = data[i];
  29770. Cb = data[i + 1];
  29771. Cr = data[i + 2];
  29772. k = data[i + 3];
  29773. 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);
  29774. 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);
  29775. 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);
  29776. }
  29777. return data.subarray(0, offset);
  29778. }
  29779. _convertYcckToCmyk(data) {
  29780. let Y, Cb, Cr;
  29781. for (let i = 0, length = data.length; i < length; i += 4) {
  29782. Y = data[i];
  29783. Cb = data[i + 1];
  29784. Cr = data[i + 2];
  29785. data[i] = 434.456 - Y - 1.402 * Cr;
  29786. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  29787. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  29788. }
  29789. return data;
  29790. }
  29791. _convertCmykToRgb(data) {
  29792. let c, m, y, k;
  29793. let offset = 0;
  29794. for (let i = 0, length = data.length; i < length; i += 4) {
  29795. c = data[i];
  29796. m = data[i + 1];
  29797. y = data[i + 2];
  29798. k = data[i + 3];
  29799. 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);
  29800. 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);
  29801. 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);
  29802. }
  29803. return data.subarray(0, offset);
  29804. }
  29805. getData({
  29806. width,
  29807. height,
  29808. forceRGB = false,
  29809. isSourcePDF = false
  29810. }) {
  29811. if (this.numComponents > 4) {
  29812. throw new JpegError("Unsupported color mode");
  29813. }
  29814. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  29815. if (this.numComponents === 1 && forceRGB) {
  29816. const dataLength = data.length;
  29817. const rgbData = new Uint8ClampedArray(dataLength * 3);
  29818. let offset = 0;
  29819. for (let i = 0; i < dataLength; i++) {
  29820. const grayColor = data[i];
  29821. rgbData[offset++] = grayColor;
  29822. rgbData[offset++] = grayColor;
  29823. rgbData[offset++] = grayColor;
  29824. }
  29825. return rgbData;
  29826. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  29827. return this._convertYccToRgb(data);
  29828. } else if (this.numComponents === 4) {
  29829. if (this._isColorConversionNeeded) {
  29830. if (forceRGB) {
  29831. return this._convertYcckToRgb(data);
  29832. }
  29833. return this._convertYcckToCmyk(data);
  29834. } else if (forceRGB) {
  29835. return this._convertCmykToRgb(data);
  29836. }
  29837. }
  29838. return data;
  29839. }
  29840. }
  29841. exports.JpegImage = JpegImage;
  29842. /***/ }),
  29843. /* 39 */
  29844. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29845. Object.defineProperty(exports, "__esModule", ({
  29846. value: true
  29847. }));
  29848. exports.JpxStream = void 0;
  29849. var _decode_stream = __w_pdfjs_require__(29);
  29850. var _jpx = __w_pdfjs_require__(40);
  29851. var _util = __w_pdfjs_require__(2);
  29852. class JpxStream extends _decode_stream.DecodeStream {
  29853. constructor(stream, maybeLength, params) {
  29854. super(maybeLength);
  29855. this.stream = stream;
  29856. this.dict = stream.dict;
  29857. this.maybeLength = maybeLength;
  29858. this.params = params;
  29859. }
  29860. get bytes() {
  29861. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  29862. }
  29863. ensureBuffer(requested) {}
  29864. readBlock() {
  29865. if (this.eof) {
  29866. return;
  29867. }
  29868. const jpxImage = new _jpx.JpxImage();
  29869. jpxImage.parse(this.bytes);
  29870. const width = jpxImage.width;
  29871. const height = jpxImage.height;
  29872. const componentsCount = jpxImage.componentsCount;
  29873. const tileCount = jpxImage.tiles.length;
  29874. if (tileCount === 1) {
  29875. this.buffer = jpxImage.tiles[0].items;
  29876. } else {
  29877. const data = new Uint8ClampedArray(width * height * componentsCount);
  29878. for (let k = 0; k < tileCount; k++) {
  29879. const tileComponents = jpxImage.tiles[k];
  29880. const tileWidth = tileComponents.width;
  29881. const tileHeight = tileComponents.height;
  29882. const tileLeft = tileComponents.left;
  29883. const tileTop = tileComponents.top;
  29884. const src = tileComponents.items;
  29885. let srcPosition = 0;
  29886. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  29887. const imgRowSize = width * componentsCount;
  29888. const tileRowSize = tileWidth * componentsCount;
  29889. for (let j = 0; j < tileHeight; j++) {
  29890. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  29891. data.set(rowBytes, dataPosition);
  29892. srcPosition += tileRowSize;
  29893. dataPosition += imgRowSize;
  29894. }
  29895. }
  29896. this.buffer = data;
  29897. }
  29898. this.bufferLength = this.buffer.length;
  29899. this.eof = true;
  29900. }
  29901. }
  29902. exports.JpxStream = JpxStream;
  29903. /***/ }),
  29904. /* 40 */
  29905. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29906. Object.defineProperty(exports, "__esModule", ({
  29907. value: true
  29908. }));
  29909. exports.JpxImage = void 0;
  29910. var _util = __w_pdfjs_require__(2);
  29911. var _core_utils = __w_pdfjs_require__(8);
  29912. var _arithmetic_decoder = __w_pdfjs_require__(36);
  29913. class JpxError extends _util.BaseException {
  29914. constructor(msg) {
  29915. super(`JPX error: ${msg}`, "JpxError");
  29916. }
  29917. }
  29918. const SubbandsGainLog2 = {
  29919. LL: 0,
  29920. LH: 1,
  29921. HL: 1,
  29922. HH: 2
  29923. };
  29924. class JpxImage {
  29925. constructor() {
  29926. this.failOnCorruptedImage = false;
  29927. }
  29928. parse(data) {
  29929. const head = (0, _core_utils.readUint16)(data, 0);
  29930. if (head === 0xff4f) {
  29931. this.parseCodestream(data, 0, data.length);
  29932. return;
  29933. }
  29934. const length = data.length;
  29935. let position = 0;
  29936. while (position < length) {
  29937. let headerSize = 8;
  29938. let lbox = (0, _core_utils.readUint32)(data, position);
  29939. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  29940. position += headerSize;
  29941. if (lbox === 1) {
  29942. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  29943. position += 8;
  29944. headerSize += 8;
  29945. }
  29946. if (lbox === 0) {
  29947. lbox = length - position + headerSize;
  29948. }
  29949. if (lbox < headerSize) {
  29950. throw new JpxError("Invalid box field size");
  29951. }
  29952. const dataLength = lbox - headerSize;
  29953. let jumpDataLength = true;
  29954. switch (tbox) {
  29955. case 0x6a703268:
  29956. jumpDataLength = false;
  29957. break;
  29958. case 0x636f6c72:
  29959. const method = data[position];
  29960. if (method === 1) {
  29961. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  29962. switch (colorspace) {
  29963. case 16:
  29964. case 17:
  29965. case 18:
  29966. break;
  29967. default:
  29968. (0, _util.warn)("Unknown colorspace " + colorspace);
  29969. break;
  29970. }
  29971. } else if (method === 2) {
  29972. (0, _util.info)("ICC profile not supported");
  29973. }
  29974. break;
  29975. case 0x6a703263:
  29976. this.parseCodestream(data, position, position + dataLength);
  29977. break;
  29978. case 0x6a502020:
  29979. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  29980. (0, _util.warn)("Invalid JP2 signature");
  29981. }
  29982. break;
  29983. case 0x6a501a1a:
  29984. case 0x66747970:
  29985. case 0x72726571:
  29986. case 0x72657320:
  29987. case 0x69686472:
  29988. break;
  29989. default:
  29990. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  29991. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  29992. break;
  29993. }
  29994. if (jumpDataLength) {
  29995. position += dataLength;
  29996. }
  29997. }
  29998. }
  29999. parseImageProperties(stream) {
  30000. let newByte = stream.getByte();
  30001. while (newByte >= 0) {
  30002. const oldByte = newByte;
  30003. newByte = stream.getByte();
  30004. const code = oldByte << 8 | newByte;
  30005. if (code === 0xff51) {
  30006. stream.skip(4);
  30007. const Xsiz = stream.getInt32() >>> 0;
  30008. const Ysiz = stream.getInt32() >>> 0;
  30009. const XOsiz = stream.getInt32() >>> 0;
  30010. const YOsiz = stream.getInt32() >>> 0;
  30011. stream.skip(16);
  30012. const Csiz = stream.getUint16();
  30013. this.width = Xsiz - XOsiz;
  30014. this.height = Ysiz - YOsiz;
  30015. this.componentsCount = Csiz;
  30016. this.bitsPerComponent = 8;
  30017. return;
  30018. }
  30019. }
  30020. throw new JpxError("No size marker found in JPX stream");
  30021. }
  30022. parseCodestream(data, start, end) {
  30023. const context = {};
  30024. let doNotRecover = false;
  30025. try {
  30026. let position = start;
  30027. while (position + 1 < end) {
  30028. const code = (0, _core_utils.readUint16)(data, position);
  30029. position += 2;
  30030. let length = 0,
  30031. j,
  30032. sqcd,
  30033. spqcds,
  30034. spqcdSize,
  30035. scalarExpounded,
  30036. tile;
  30037. switch (code) {
  30038. case 0xff4f:
  30039. context.mainHeader = true;
  30040. break;
  30041. case 0xffd9:
  30042. break;
  30043. case 0xff51:
  30044. length = (0, _core_utils.readUint16)(data, position);
  30045. const siz = {};
  30046. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  30047. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  30048. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  30049. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  30050. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  30051. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  30052. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  30053. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  30054. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  30055. siz.Csiz = componentsCount;
  30056. const components = [];
  30057. j = position + 38;
  30058. for (let i = 0; i < componentsCount; i++) {
  30059. const component = {
  30060. precision: (data[j] & 0x7f) + 1,
  30061. isSigned: !!(data[j] & 0x80),
  30062. XRsiz: data[j + 1],
  30063. YRsiz: data[j + 2]
  30064. };
  30065. j += 3;
  30066. calculateComponentDimensions(component, siz);
  30067. components.push(component);
  30068. }
  30069. context.SIZ = siz;
  30070. context.components = components;
  30071. calculateTileGrids(context, components);
  30072. context.QCC = [];
  30073. context.COC = [];
  30074. break;
  30075. case 0xff5c:
  30076. length = (0, _core_utils.readUint16)(data, position);
  30077. const qcd = {};
  30078. j = position + 2;
  30079. sqcd = data[j++];
  30080. switch (sqcd & 0x1f) {
  30081. case 0:
  30082. spqcdSize = 8;
  30083. scalarExpounded = true;
  30084. break;
  30085. case 1:
  30086. spqcdSize = 16;
  30087. scalarExpounded = false;
  30088. break;
  30089. case 2:
  30090. spqcdSize = 16;
  30091. scalarExpounded = true;
  30092. break;
  30093. default:
  30094. throw new Error("Invalid SQcd value " + sqcd);
  30095. }
  30096. qcd.noQuantization = spqcdSize === 8;
  30097. qcd.scalarExpounded = scalarExpounded;
  30098. qcd.guardBits = sqcd >> 5;
  30099. spqcds = [];
  30100. while (j < length + position) {
  30101. const spqcd = {};
  30102. if (spqcdSize === 8) {
  30103. spqcd.epsilon = data[j++] >> 3;
  30104. spqcd.mu = 0;
  30105. } else {
  30106. spqcd.epsilon = data[j] >> 3;
  30107. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30108. j += 2;
  30109. }
  30110. spqcds.push(spqcd);
  30111. }
  30112. qcd.SPqcds = spqcds;
  30113. if (context.mainHeader) {
  30114. context.QCD = qcd;
  30115. } else {
  30116. context.currentTile.QCD = qcd;
  30117. context.currentTile.QCC = [];
  30118. }
  30119. break;
  30120. case 0xff5d:
  30121. length = (0, _core_utils.readUint16)(data, position);
  30122. const qcc = {};
  30123. j = position + 2;
  30124. let cqcc;
  30125. if (context.SIZ.Csiz < 257) {
  30126. cqcc = data[j++];
  30127. } else {
  30128. cqcc = (0, _core_utils.readUint16)(data, j);
  30129. j += 2;
  30130. }
  30131. sqcd = data[j++];
  30132. switch (sqcd & 0x1f) {
  30133. case 0:
  30134. spqcdSize = 8;
  30135. scalarExpounded = true;
  30136. break;
  30137. case 1:
  30138. spqcdSize = 16;
  30139. scalarExpounded = false;
  30140. break;
  30141. case 2:
  30142. spqcdSize = 16;
  30143. scalarExpounded = true;
  30144. break;
  30145. default:
  30146. throw new Error("Invalid SQcd value " + sqcd);
  30147. }
  30148. qcc.noQuantization = spqcdSize === 8;
  30149. qcc.scalarExpounded = scalarExpounded;
  30150. qcc.guardBits = sqcd >> 5;
  30151. spqcds = [];
  30152. while (j < length + position) {
  30153. const spqcd = {};
  30154. if (spqcdSize === 8) {
  30155. spqcd.epsilon = data[j++] >> 3;
  30156. spqcd.mu = 0;
  30157. } else {
  30158. spqcd.epsilon = data[j] >> 3;
  30159. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30160. j += 2;
  30161. }
  30162. spqcds.push(spqcd);
  30163. }
  30164. qcc.SPqcds = spqcds;
  30165. if (context.mainHeader) {
  30166. context.QCC[cqcc] = qcc;
  30167. } else {
  30168. context.currentTile.QCC[cqcc] = qcc;
  30169. }
  30170. break;
  30171. case 0xff52:
  30172. length = (0, _core_utils.readUint16)(data, position);
  30173. const cod = {};
  30174. j = position + 2;
  30175. const scod = data[j++];
  30176. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  30177. cod.sopMarkerUsed = !!(scod & 2);
  30178. cod.ephMarkerUsed = !!(scod & 4);
  30179. cod.progressionOrder = data[j++];
  30180. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  30181. j += 2;
  30182. cod.multipleComponentTransform = data[j++];
  30183. cod.decompositionLevelsCount = data[j++];
  30184. cod.xcb = (data[j++] & 0xf) + 2;
  30185. cod.ycb = (data[j++] & 0xf) + 2;
  30186. const blockStyle = data[j++];
  30187. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  30188. cod.resetContextProbabilities = !!(blockStyle & 2);
  30189. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  30190. cod.verticallyStripe = !!(blockStyle & 8);
  30191. cod.predictableTermination = !!(blockStyle & 16);
  30192. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  30193. cod.reversibleTransformation = data[j++];
  30194. if (cod.entropyCoderWithCustomPrecincts) {
  30195. const precinctsSizes = [];
  30196. while (j < length + position) {
  30197. const precinctsSize = data[j++];
  30198. precinctsSizes.push({
  30199. PPx: precinctsSize & 0xf,
  30200. PPy: precinctsSize >> 4
  30201. });
  30202. }
  30203. cod.precinctsSizes = precinctsSizes;
  30204. }
  30205. const unsupported = [];
  30206. if (cod.selectiveArithmeticCodingBypass) {
  30207. unsupported.push("selectiveArithmeticCodingBypass");
  30208. }
  30209. if (cod.terminationOnEachCodingPass) {
  30210. unsupported.push("terminationOnEachCodingPass");
  30211. }
  30212. if (cod.verticallyStripe) {
  30213. unsupported.push("verticallyStripe");
  30214. }
  30215. if (cod.predictableTermination) {
  30216. unsupported.push("predictableTermination");
  30217. }
  30218. if (unsupported.length > 0) {
  30219. doNotRecover = true;
  30220. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  30221. }
  30222. if (context.mainHeader) {
  30223. context.COD = cod;
  30224. } else {
  30225. context.currentTile.COD = cod;
  30226. context.currentTile.COC = [];
  30227. }
  30228. break;
  30229. case 0xff90:
  30230. length = (0, _core_utils.readUint16)(data, position);
  30231. tile = {};
  30232. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  30233. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  30234. tile.dataEnd = tile.length + position - 2;
  30235. tile.partIndex = data[position + 8];
  30236. tile.partsCount = data[position + 9];
  30237. context.mainHeader = false;
  30238. if (tile.partIndex === 0) {
  30239. tile.COD = context.COD;
  30240. tile.COC = context.COC.slice(0);
  30241. tile.QCD = context.QCD;
  30242. tile.QCC = context.QCC.slice(0);
  30243. }
  30244. context.currentTile = tile;
  30245. break;
  30246. case 0xff93:
  30247. tile = context.currentTile;
  30248. if (tile.partIndex === 0) {
  30249. initializeTile(context, tile.index);
  30250. buildPackets(context);
  30251. }
  30252. length = tile.dataEnd - position;
  30253. parseTilePackets(context, data, position, length);
  30254. break;
  30255. case 0xff53:
  30256. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  30257. case 0xff55:
  30258. case 0xff57:
  30259. case 0xff58:
  30260. case 0xff64:
  30261. length = (0, _core_utils.readUint16)(data, position);
  30262. break;
  30263. default:
  30264. throw new Error("Unknown codestream code: " + code.toString(16));
  30265. }
  30266. position += length;
  30267. }
  30268. } catch (e) {
  30269. if (doNotRecover || this.failOnCorruptedImage) {
  30270. throw new JpxError(e.message);
  30271. } else {
  30272. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  30273. }
  30274. }
  30275. this.tiles = transformComponents(context);
  30276. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  30277. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  30278. this.componentsCount = context.SIZ.Csiz;
  30279. }
  30280. }
  30281. exports.JpxImage = JpxImage;
  30282. function calculateComponentDimensions(component, siz) {
  30283. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  30284. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  30285. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  30286. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  30287. component.width = component.x1 - component.x0;
  30288. component.height = component.y1 - component.y0;
  30289. }
  30290. function calculateTileGrids(context, components) {
  30291. const siz = context.SIZ;
  30292. const tiles = [];
  30293. let tile;
  30294. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  30295. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  30296. for (let q = 0; q < numYtiles; q++) {
  30297. for (let p = 0; p < numXtiles; p++) {
  30298. tile = {};
  30299. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  30300. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  30301. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  30302. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  30303. tile.width = tile.tx1 - tile.tx0;
  30304. tile.height = tile.ty1 - tile.ty0;
  30305. tile.components = [];
  30306. tiles.push(tile);
  30307. }
  30308. }
  30309. context.tiles = tiles;
  30310. const componentsCount = siz.Csiz;
  30311. for (let i = 0, ii = componentsCount; i < ii; i++) {
  30312. const component = components[i];
  30313. for (let j = 0, jj = tiles.length; j < jj; j++) {
  30314. const tileComponent = {};
  30315. tile = tiles[j];
  30316. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  30317. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  30318. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  30319. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  30320. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  30321. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  30322. tile.components[i] = tileComponent;
  30323. }
  30324. }
  30325. }
  30326. function getBlocksDimensions(context, component, r) {
  30327. const codOrCoc = component.codingStyleParameters;
  30328. const result = {};
  30329. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  30330. result.PPx = 15;
  30331. result.PPy = 15;
  30332. } else {
  30333. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  30334. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  30335. }
  30336. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  30337. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  30338. return result;
  30339. }
  30340. function buildPrecincts(context, resolution, dimensions) {
  30341. const precinctWidth = 1 << dimensions.PPx;
  30342. const precinctHeight = 1 << dimensions.PPy;
  30343. const isZeroRes = resolution.resLevel === 0;
  30344. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  30345. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  30346. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  30347. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  30348. const numprecincts = numprecinctswide * numprecinctshigh;
  30349. resolution.precinctParameters = {
  30350. precinctWidth,
  30351. precinctHeight,
  30352. numprecinctswide,
  30353. numprecinctshigh,
  30354. numprecincts,
  30355. precinctWidthInSubband,
  30356. precinctHeightInSubband
  30357. };
  30358. }
  30359. function buildCodeblocks(context, subband, dimensions) {
  30360. const xcb_ = dimensions.xcb_;
  30361. const ycb_ = dimensions.ycb_;
  30362. const codeblockWidth = 1 << xcb_;
  30363. const codeblockHeight = 1 << ycb_;
  30364. const cbx0 = subband.tbx0 >> xcb_;
  30365. const cby0 = subband.tby0 >> ycb_;
  30366. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  30367. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  30368. const precinctParameters = subband.resolution.precinctParameters;
  30369. const codeblocks = [];
  30370. const precincts = [];
  30371. let i, j, codeblock, precinctNumber;
  30372. for (j = cby0; j < cby1; j++) {
  30373. for (i = cbx0; i < cbx1; i++) {
  30374. codeblock = {
  30375. cbx: i,
  30376. cby: j,
  30377. tbx0: codeblockWidth * i,
  30378. tby0: codeblockHeight * j,
  30379. tbx1: codeblockWidth * (i + 1),
  30380. tby1: codeblockHeight * (j + 1)
  30381. };
  30382. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  30383. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  30384. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  30385. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  30386. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  30387. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  30388. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  30389. codeblock.precinctNumber = precinctNumber;
  30390. codeblock.subbandType = subband.type;
  30391. codeblock.Lblock = 3;
  30392. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  30393. continue;
  30394. }
  30395. codeblocks.push(codeblock);
  30396. let precinct = precincts[precinctNumber];
  30397. if (precinct !== undefined) {
  30398. if (i < precinct.cbxMin) {
  30399. precinct.cbxMin = i;
  30400. } else if (i > precinct.cbxMax) {
  30401. precinct.cbxMax = i;
  30402. }
  30403. if (j < precinct.cbyMin) {
  30404. precinct.cbxMin = j;
  30405. } else if (j > precinct.cbyMax) {
  30406. precinct.cbyMax = j;
  30407. }
  30408. } else {
  30409. precincts[precinctNumber] = precinct = {
  30410. cbxMin: i,
  30411. cbyMin: j,
  30412. cbxMax: i,
  30413. cbyMax: j
  30414. };
  30415. }
  30416. codeblock.precinct = precinct;
  30417. }
  30418. }
  30419. subband.codeblockParameters = {
  30420. codeblockWidth: xcb_,
  30421. codeblockHeight: ycb_,
  30422. numcodeblockwide: cbx1 - cbx0 + 1,
  30423. numcodeblockhigh: cby1 - cby0 + 1
  30424. };
  30425. subband.codeblocks = codeblocks;
  30426. subband.precincts = precincts;
  30427. }
  30428. function createPacket(resolution, precinctNumber, layerNumber) {
  30429. const precinctCodeblocks = [];
  30430. const subbands = resolution.subbands;
  30431. for (let i = 0, ii = subbands.length; i < ii; i++) {
  30432. const subband = subbands[i];
  30433. const codeblocks = subband.codeblocks;
  30434. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  30435. const codeblock = codeblocks[j];
  30436. if (codeblock.precinctNumber !== precinctNumber) {
  30437. continue;
  30438. }
  30439. precinctCodeblocks.push(codeblock);
  30440. }
  30441. }
  30442. return {
  30443. layerNumber,
  30444. codeblocks: precinctCodeblocks
  30445. };
  30446. }
  30447. function LayerResolutionComponentPositionIterator(context) {
  30448. const siz = context.SIZ;
  30449. const tileIndex = context.currentTile.index;
  30450. const tile = context.tiles[tileIndex];
  30451. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30452. const componentsCount = siz.Csiz;
  30453. let maxDecompositionLevelsCount = 0;
  30454. for (let q = 0; q < componentsCount; q++) {
  30455. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30456. }
  30457. let l = 0,
  30458. r = 0,
  30459. i = 0,
  30460. k = 0;
  30461. this.nextPacket = function JpxImage_nextPacket() {
  30462. for (; l < layersCount; l++) {
  30463. for (; r <= maxDecompositionLevelsCount; r++) {
  30464. for (; i < componentsCount; i++) {
  30465. const component = tile.components[i];
  30466. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30467. continue;
  30468. }
  30469. const resolution = component.resolutions[r];
  30470. const numprecincts = resolution.precinctParameters.numprecincts;
  30471. for (; k < numprecincts;) {
  30472. const packet = createPacket(resolution, k, l);
  30473. k++;
  30474. return packet;
  30475. }
  30476. k = 0;
  30477. }
  30478. i = 0;
  30479. }
  30480. r = 0;
  30481. }
  30482. throw new JpxError("Out of packets");
  30483. };
  30484. }
  30485. function ResolutionLayerComponentPositionIterator(context) {
  30486. const siz = context.SIZ;
  30487. const tileIndex = context.currentTile.index;
  30488. const tile = context.tiles[tileIndex];
  30489. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30490. const componentsCount = siz.Csiz;
  30491. let maxDecompositionLevelsCount = 0;
  30492. for (let q = 0; q < componentsCount; q++) {
  30493. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30494. }
  30495. let r = 0,
  30496. l = 0,
  30497. i = 0,
  30498. k = 0;
  30499. this.nextPacket = function JpxImage_nextPacket() {
  30500. for (; r <= maxDecompositionLevelsCount; r++) {
  30501. for (; l < layersCount; l++) {
  30502. for (; i < componentsCount; i++) {
  30503. const component = tile.components[i];
  30504. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30505. continue;
  30506. }
  30507. const resolution = component.resolutions[r];
  30508. const numprecincts = resolution.precinctParameters.numprecincts;
  30509. for (; k < numprecincts;) {
  30510. const packet = createPacket(resolution, k, l);
  30511. k++;
  30512. return packet;
  30513. }
  30514. k = 0;
  30515. }
  30516. i = 0;
  30517. }
  30518. l = 0;
  30519. }
  30520. throw new JpxError("Out of packets");
  30521. };
  30522. }
  30523. function ResolutionPositionComponentLayerIterator(context) {
  30524. const siz = context.SIZ;
  30525. const tileIndex = context.currentTile.index;
  30526. const tile = context.tiles[tileIndex];
  30527. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30528. const componentsCount = siz.Csiz;
  30529. let l, r, c, p;
  30530. let maxDecompositionLevelsCount = 0;
  30531. for (c = 0; c < componentsCount; c++) {
  30532. const component = tile.components[c];
  30533. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  30534. }
  30535. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  30536. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  30537. let maxNumPrecincts = 0;
  30538. for (c = 0; c < componentsCount; ++c) {
  30539. const resolutions = tile.components[c].resolutions;
  30540. if (r < resolutions.length) {
  30541. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  30542. }
  30543. }
  30544. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  30545. }
  30546. l = 0;
  30547. r = 0;
  30548. c = 0;
  30549. p = 0;
  30550. this.nextPacket = function JpxImage_nextPacket() {
  30551. for (; r <= maxDecompositionLevelsCount; r++) {
  30552. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  30553. for (; c < componentsCount; c++) {
  30554. const component = tile.components[c];
  30555. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30556. continue;
  30557. }
  30558. const resolution = component.resolutions[r];
  30559. const numprecincts = resolution.precinctParameters.numprecincts;
  30560. if (p >= numprecincts) {
  30561. continue;
  30562. }
  30563. for (; l < layersCount;) {
  30564. const packet = createPacket(resolution, p, l);
  30565. l++;
  30566. return packet;
  30567. }
  30568. l = 0;
  30569. }
  30570. c = 0;
  30571. }
  30572. p = 0;
  30573. }
  30574. throw new JpxError("Out of packets");
  30575. };
  30576. }
  30577. function PositionComponentResolutionLayerIterator(context) {
  30578. const siz = context.SIZ;
  30579. const tileIndex = context.currentTile.index;
  30580. const tile = context.tiles[tileIndex];
  30581. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30582. const componentsCount = siz.Csiz;
  30583. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30584. const precinctsIterationSizes = precinctsSizes;
  30585. let l = 0,
  30586. r = 0,
  30587. c = 0,
  30588. px = 0,
  30589. py = 0;
  30590. this.nextPacket = function JpxImage_nextPacket() {
  30591. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30592. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30593. for (; c < componentsCount; c++) {
  30594. const component = tile.components[c];
  30595. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30596. for (; r <= decompositionLevelsCount; r++) {
  30597. const resolution = component.resolutions[r];
  30598. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  30599. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30600. if (k === null) {
  30601. continue;
  30602. }
  30603. for (; l < layersCount;) {
  30604. const packet = createPacket(resolution, k, l);
  30605. l++;
  30606. return packet;
  30607. }
  30608. l = 0;
  30609. }
  30610. r = 0;
  30611. }
  30612. c = 0;
  30613. }
  30614. px = 0;
  30615. }
  30616. throw new JpxError("Out of packets");
  30617. };
  30618. }
  30619. function ComponentPositionResolutionLayerIterator(context) {
  30620. const siz = context.SIZ;
  30621. const tileIndex = context.currentTile.index;
  30622. const tile = context.tiles[tileIndex];
  30623. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30624. const componentsCount = siz.Csiz;
  30625. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30626. let l = 0,
  30627. r = 0,
  30628. c = 0,
  30629. px = 0,
  30630. py = 0;
  30631. this.nextPacket = function JpxImage_nextPacket() {
  30632. for (; c < componentsCount; ++c) {
  30633. const component = tile.components[c];
  30634. const precinctsIterationSizes = precinctsSizes.components[c];
  30635. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30636. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30637. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30638. for (; r <= decompositionLevelsCount; r++) {
  30639. const resolution = component.resolutions[r];
  30640. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  30641. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30642. if (k === null) {
  30643. continue;
  30644. }
  30645. for (; l < layersCount;) {
  30646. const packet = createPacket(resolution, k, l);
  30647. l++;
  30648. return packet;
  30649. }
  30650. l = 0;
  30651. }
  30652. r = 0;
  30653. }
  30654. px = 0;
  30655. }
  30656. py = 0;
  30657. }
  30658. throw new JpxError("Out of packets");
  30659. };
  30660. }
  30661. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  30662. const posX = pxIndex * precinctIterationSizes.minWidth;
  30663. const posY = pyIndex * precinctIterationSizes.minHeight;
  30664. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  30665. return null;
  30666. }
  30667. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  30668. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  30669. }
  30670. function getPrecinctSizesInImageScale(tile) {
  30671. const componentsCount = tile.components.length;
  30672. let minWidth = Number.MAX_VALUE;
  30673. let minHeight = Number.MAX_VALUE;
  30674. let maxNumWide = 0;
  30675. let maxNumHigh = 0;
  30676. const sizePerComponent = new Array(componentsCount);
  30677. for (let c = 0; c < componentsCount; c++) {
  30678. const component = tile.components[c];
  30679. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30680. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  30681. let minWidthCurrentComponent = Number.MAX_VALUE;
  30682. let minHeightCurrentComponent = Number.MAX_VALUE;
  30683. let maxNumWideCurrentComponent = 0;
  30684. let maxNumHighCurrentComponent = 0;
  30685. let scale = 1;
  30686. for (let r = decompositionLevelsCount; r >= 0; --r) {
  30687. const resolution = component.resolutions[r];
  30688. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  30689. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30690. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30691. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30692. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30693. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30694. sizePerResolution[r] = {
  30695. width: widthCurrentResolution,
  30696. height: heightCurrentResolution
  30697. };
  30698. scale <<= 1;
  30699. }
  30700. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30701. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30702. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30703. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30704. sizePerComponent[c] = {
  30705. resolutions: sizePerResolution,
  30706. minWidth: minWidthCurrentComponent,
  30707. minHeight: minHeightCurrentComponent,
  30708. maxNumWide: maxNumWideCurrentComponent,
  30709. maxNumHigh: maxNumHighCurrentComponent
  30710. };
  30711. }
  30712. return {
  30713. components: sizePerComponent,
  30714. minWidth,
  30715. minHeight,
  30716. maxNumWide,
  30717. maxNumHigh
  30718. };
  30719. }
  30720. function buildPackets(context) {
  30721. const siz = context.SIZ;
  30722. const tileIndex = context.currentTile.index;
  30723. const tile = context.tiles[tileIndex];
  30724. const componentsCount = siz.Csiz;
  30725. for (let c = 0; c < componentsCount; c++) {
  30726. const component = tile.components[c];
  30727. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30728. const resolutions = [];
  30729. const subbands = [];
  30730. for (let r = 0; r <= decompositionLevelsCount; r++) {
  30731. const blocksDimensions = getBlocksDimensions(context, component, r);
  30732. const resolution = {};
  30733. const scale = 1 << decompositionLevelsCount - r;
  30734. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30735. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30736. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30737. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30738. resolution.resLevel = r;
  30739. buildPrecincts(context, resolution, blocksDimensions);
  30740. resolutions.push(resolution);
  30741. let subband;
  30742. if (r === 0) {
  30743. subband = {};
  30744. subband.type = "LL";
  30745. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30746. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30747. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30748. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30749. subband.resolution = resolution;
  30750. buildCodeblocks(context, subband, blocksDimensions);
  30751. subbands.push(subband);
  30752. resolution.subbands = [subband];
  30753. } else {
  30754. const bscale = 1 << decompositionLevelsCount - r + 1;
  30755. const resolutionSubbands = [];
  30756. subband = {};
  30757. subband.type = "HL";
  30758. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30759. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30760. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30761. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30762. subband.resolution = resolution;
  30763. buildCodeblocks(context, subband, blocksDimensions);
  30764. subbands.push(subband);
  30765. resolutionSubbands.push(subband);
  30766. subband = {};
  30767. subband.type = "LH";
  30768. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30769. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30770. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30771. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30772. subband.resolution = resolution;
  30773. buildCodeblocks(context, subband, blocksDimensions);
  30774. subbands.push(subband);
  30775. resolutionSubbands.push(subband);
  30776. subband = {};
  30777. subband.type = "HH";
  30778. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30779. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30780. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30781. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30782. subband.resolution = resolution;
  30783. buildCodeblocks(context, subband, blocksDimensions);
  30784. subbands.push(subband);
  30785. resolutionSubbands.push(subband);
  30786. resolution.subbands = resolutionSubbands;
  30787. }
  30788. }
  30789. component.resolutions = resolutions;
  30790. component.subbands = subbands;
  30791. }
  30792. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30793. switch (progressionOrder) {
  30794. case 0:
  30795. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30796. break;
  30797. case 1:
  30798. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30799. break;
  30800. case 2:
  30801. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30802. break;
  30803. case 3:
  30804. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30805. break;
  30806. case 4:
  30807. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30808. break;
  30809. default:
  30810. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  30811. }
  30812. }
  30813. function parseTilePackets(context, data, offset, dataLength) {
  30814. let position = 0;
  30815. let buffer,
  30816. bufferSize = 0,
  30817. skipNextBit = false;
  30818. function readBits(count) {
  30819. while (bufferSize < count) {
  30820. const b = data[offset + position];
  30821. position++;
  30822. if (skipNextBit) {
  30823. buffer = buffer << 7 | b;
  30824. bufferSize += 7;
  30825. skipNextBit = false;
  30826. } else {
  30827. buffer = buffer << 8 | b;
  30828. bufferSize += 8;
  30829. }
  30830. if (b === 0xff) {
  30831. skipNextBit = true;
  30832. }
  30833. }
  30834. bufferSize -= count;
  30835. return buffer >>> bufferSize & (1 << count) - 1;
  30836. }
  30837. function skipMarkerIfEqual(value) {
  30838. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  30839. skipBytes(1);
  30840. return true;
  30841. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  30842. skipBytes(2);
  30843. return true;
  30844. }
  30845. return false;
  30846. }
  30847. function skipBytes(count) {
  30848. position += count;
  30849. }
  30850. function alignToByte() {
  30851. bufferSize = 0;
  30852. if (skipNextBit) {
  30853. position++;
  30854. skipNextBit = false;
  30855. }
  30856. }
  30857. function readCodingpasses() {
  30858. if (readBits(1) === 0) {
  30859. return 1;
  30860. }
  30861. if (readBits(1) === 0) {
  30862. return 2;
  30863. }
  30864. let value = readBits(2);
  30865. if (value < 3) {
  30866. return value + 3;
  30867. }
  30868. value = readBits(5);
  30869. if (value < 31) {
  30870. return value + 6;
  30871. }
  30872. value = readBits(7);
  30873. return value + 37;
  30874. }
  30875. const tileIndex = context.currentTile.index;
  30876. const tile = context.tiles[tileIndex];
  30877. const sopMarkerUsed = context.COD.sopMarkerUsed;
  30878. const ephMarkerUsed = context.COD.ephMarkerUsed;
  30879. const packetsIterator = tile.packetsIterator;
  30880. while (position < dataLength) {
  30881. alignToByte();
  30882. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30883. skipBytes(4);
  30884. }
  30885. const packet = packetsIterator.nextPacket();
  30886. if (!readBits(1)) {
  30887. continue;
  30888. }
  30889. const layerNumber = packet.layerNumber,
  30890. queue = [];
  30891. let codeblock;
  30892. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30893. codeblock = packet.codeblocks[i];
  30894. let precinct = codeblock.precinct;
  30895. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30896. const codeblockRow = codeblock.cby - precinct.cbyMin;
  30897. let codeblockIncluded = false;
  30898. let firstTimeInclusion = false;
  30899. let valueReady, zeroBitPlanesTree;
  30900. if (codeblock.included !== undefined) {
  30901. codeblockIncluded = !!readBits(1);
  30902. } else {
  30903. precinct = codeblock.precinct;
  30904. let inclusionTree;
  30905. if (precinct.inclusionTree !== undefined) {
  30906. inclusionTree = precinct.inclusionTree;
  30907. } else {
  30908. const width = precinct.cbxMax - precinct.cbxMin + 1;
  30909. const height = precinct.cbyMax - precinct.cbyMin + 1;
  30910. inclusionTree = new InclusionTree(width, height, layerNumber);
  30911. zeroBitPlanesTree = new TagTree(width, height);
  30912. precinct.inclusionTree = inclusionTree;
  30913. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30914. for (let l = 0; l < layerNumber; l++) {
  30915. if (readBits(1) !== 0) {
  30916. throw new JpxError("Invalid tag tree");
  30917. }
  30918. }
  30919. }
  30920. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30921. while (true) {
  30922. if (readBits(1)) {
  30923. valueReady = !inclusionTree.nextLevel();
  30924. if (valueReady) {
  30925. codeblock.included = true;
  30926. codeblockIncluded = firstTimeInclusion = true;
  30927. break;
  30928. }
  30929. } else {
  30930. inclusionTree.incrementValue(layerNumber);
  30931. break;
  30932. }
  30933. }
  30934. }
  30935. }
  30936. if (!codeblockIncluded) {
  30937. continue;
  30938. }
  30939. if (firstTimeInclusion) {
  30940. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30941. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30942. while (true) {
  30943. if (readBits(1)) {
  30944. valueReady = !zeroBitPlanesTree.nextLevel();
  30945. if (valueReady) {
  30946. break;
  30947. }
  30948. } else {
  30949. zeroBitPlanesTree.incrementValue();
  30950. }
  30951. }
  30952. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30953. }
  30954. const codingpasses = readCodingpasses();
  30955. while (readBits(1)) {
  30956. codeblock.Lblock++;
  30957. }
  30958. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  30959. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30960. const codedDataLength = readBits(bits);
  30961. queue.push({
  30962. codeblock,
  30963. codingpasses,
  30964. dataLength: codedDataLength
  30965. });
  30966. }
  30967. alignToByte();
  30968. if (ephMarkerUsed) {
  30969. skipMarkerIfEqual(0x92);
  30970. }
  30971. while (queue.length > 0) {
  30972. const packetItem = queue.shift();
  30973. codeblock = packetItem.codeblock;
  30974. if (codeblock.data === undefined) {
  30975. codeblock.data = [];
  30976. }
  30977. codeblock.data.push({
  30978. data,
  30979. start: offset + position,
  30980. end: offset + position + packetItem.dataLength,
  30981. codingpasses: packetItem.codingpasses
  30982. });
  30983. position += packetItem.dataLength;
  30984. }
  30985. }
  30986. return position;
  30987. }
  30988. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  30989. const x0 = subband.tbx0;
  30990. const y0 = subband.tby0;
  30991. const width = subband.tbx1 - subband.tbx0;
  30992. const codeblocks = subband.codeblocks;
  30993. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  30994. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  30995. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  30996. const codeblock = codeblocks[i];
  30997. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30998. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30999. if (blockWidth === 0 || blockHeight === 0) {
  31000. continue;
  31001. }
  31002. if (codeblock.data === undefined) {
  31003. continue;
  31004. }
  31005. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  31006. let currentCodingpassType = 2;
  31007. const data = codeblock.data;
  31008. let totalLength = 0,
  31009. codingpasses = 0;
  31010. let j, jj, dataItem;
  31011. for (j = 0, jj = data.length; j < jj; j++) {
  31012. dataItem = data[j];
  31013. totalLength += dataItem.end - dataItem.start;
  31014. codingpasses += dataItem.codingpasses;
  31015. }
  31016. const encodedData = new Uint8Array(totalLength);
  31017. let position = 0;
  31018. for (j = 0, jj = data.length; j < jj; j++) {
  31019. dataItem = data[j];
  31020. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  31021. encodedData.set(chunk, position);
  31022. position += chunk.length;
  31023. }
  31024. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  31025. bitModel.setDecoder(decoder);
  31026. for (j = 0; j < codingpasses; j++) {
  31027. switch (currentCodingpassType) {
  31028. case 0:
  31029. bitModel.runSignificancePropagationPass();
  31030. break;
  31031. case 1:
  31032. bitModel.runMagnitudeRefinementPass();
  31033. break;
  31034. case 2:
  31035. bitModel.runCleanupPass();
  31036. if (segmentationSymbolUsed) {
  31037. bitModel.checkSegmentationSymbol();
  31038. }
  31039. break;
  31040. }
  31041. if (resetContextProbabilities) {
  31042. bitModel.reset();
  31043. }
  31044. currentCodingpassType = (currentCodingpassType + 1) % 3;
  31045. }
  31046. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  31047. const sign = bitModel.coefficentsSign;
  31048. const magnitude = bitModel.coefficentsMagnitude;
  31049. const bitsDecoded = bitModel.bitsDecoded;
  31050. const magnitudeCorrection = reversible ? 0 : 0.5;
  31051. let k, n, nb;
  31052. position = 0;
  31053. const interleave = subband.type !== "LL";
  31054. for (j = 0; j < blockHeight; j++) {
  31055. const row = offset / width | 0;
  31056. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  31057. for (k = 0; k < blockWidth; k++) {
  31058. n = magnitude[position];
  31059. if (n !== 0) {
  31060. n = (n + magnitudeCorrection) * delta;
  31061. if (sign[position] !== 0) {
  31062. n = -n;
  31063. }
  31064. nb = bitsDecoded[position];
  31065. const pos = interleave ? levelOffset + (offset << 1) : offset;
  31066. if (reversible && nb >= mb) {
  31067. coefficients[pos] = n;
  31068. } else {
  31069. coefficients[pos] = n * (1 << mb - nb);
  31070. }
  31071. }
  31072. offset++;
  31073. position++;
  31074. }
  31075. offset += width - blockWidth;
  31076. }
  31077. }
  31078. }
  31079. function transformTile(context, tile, c) {
  31080. const component = tile.components[c];
  31081. const codingStyleParameters = component.codingStyleParameters;
  31082. const quantizationParameters = component.quantizationParameters;
  31083. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  31084. const spqcds = quantizationParameters.SPqcds;
  31085. const scalarExpounded = quantizationParameters.scalarExpounded;
  31086. const guardBits = quantizationParameters.guardBits;
  31087. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  31088. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  31089. const precision = context.components[c].precision;
  31090. const reversible = codingStyleParameters.reversibleTransformation;
  31091. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  31092. const subbandCoefficients = [];
  31093. let b = 0;
  31094. for (let i = 0; i <= decompositionLevelsCount; i++) {
  31095. const resolution = component.resolutions[i];
  31096. const width = resolution.trx1 - resolution.trx0;
  31097. const height = resolution.try1 - resolution.try0;
  31098. const coefficients = new Float32Array(width * height);
  31099. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  31100. let mu, epsilon;
  31101. if (!scalarExpounded) {
  31102. mu = spqcds[0].mu;
  31103. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  31104. } else {
  31105. mu = spqcds[b].mu;
  31106. epsilon = spqcds[b].epsilon;
  31107. b++;
  31108. }
  31109. const subband = resolution.subbands[j];
  31110. const gainLog2 = SubbandsGainLog2[subband.type];
  31111. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  31112. const mb = guardBits + epsilon - 1;
  31113. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  31114. }
  31115. subbandCoefficients.push({
  31116. width,
  31117. height,
  31118. items: coefficients
  31119. });
  31120. }
  31121. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  31122. return {
  31123. left: component.tcx0,
  31124. top: component.tcy0,
  31125. width: result.width,
  31126. height: result.height,
  31127. items: result.items
  31128. };
  31129. }
  31130. function transformComponents(context) {
  31131. const siz = context.SIZ;
  31132. const components = context.components;
  31133. const componentsCount = siz.Csiz;
  31134. const resultImages = [];
  31135. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  31136. const tile = context.tiles[i];
  31137. const transformedTiles = [];
  31138. for (let c = 0; c < componentsCount; c++) {
  31139. transformedTiles[c] = transformTile(context, tile, c);
  31140. }
  31141. const tile0 = transformedTiles[0];
  31142. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  31143. const result = {
  31144. left: tile0.left,
  31145. top: tile0.top,
  31146. width: tile0.width,
  31147. height: tile0.height,
  31148. items: out
  31149. };
  31150. let shift, offset;
  31151. let pos = 0,
  31152. j,
  31153. jj,
  31154. y0,
  31155. y1,
  31156. y2;
  31157. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  31158. const fourComponents = componentsCount === 4;
  31159. const y0items = transformedTiles[0].items;
  31160. const y1items = transformedTiles[1].items;
  31161. const y2items = transformedTiles[2].items;
  31162. const y3items = fourComponents ? transformedTiles[3].items : null;
  31163. shift = components[0].precision - 8;
  31164. offset = (128 << shift) + 0.5;
  31165. const component0 = tile.components[0];
  31166. const alpha01 = componentsCount - 3;
  31167. jj = y0items.length;
  31168. if (!component0.codingStyleParameters.reversibleTransformation) {
  31169. for (j = 0; j < jj; j++, pos += alpha01) {
  31170. y0 = y0items[j] + offset;
  31171. y1 = y1items[j];
  31172. y2 = y2items[j];
  31173. out[pos++] = y0 + 1.402 * y2 >> shift;
  31174. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  31175. out[pos++] = y0 + 1.772 * y1 >> shift;
  31176. }
  31177. } else {
  31178. for (j = 0; j < jj; j++, pos += alpha01) {
  31179. y0 = y0items[j] + offset;
  31180. y1 = y1items[j];
  31181. y2 = y2items[j];
  31182. const g = y0 - (y2 + y1 >> 2);
  31183. out[pos++] = g + y2 >> shift;
  31184. out[pos++] = g >> shift;
  31185. out[pos++] = g + y1 >> shift;
  31186. }
  31187. }
  31188. if (fourComponents) {
  31189. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  31190. out[pos] = y3items[j] + offset >> shift;
  31191. }
  31192. }
  31193. } else {
  31194. for (let c = 0; c < componentsCount; c++) {
  31195. const items = transformedTiles[c].items;
  31196. shift = components[c].precision - 8;
  31197. offset = (128 << shift) + 0.5;
  31198. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  31199. out[pos] = items[j] + offset >> shift;
  31200. pos += componentsCount;
  31201. }
  31202. }
  31203. }
  31204. resultImages.push(result);
  31205. }
  31206. return resultImages;
  31207. }
  31208. function initializeTile(context, tileIndex) {
  31209. const siz = context.SIZ;
  31210. const componentsCount = siz.Csiz;
  31211. const tile = context.tiles[tileIndex];
  31212. for (let c = 0; c < componentsCount; c++) {
  31213. const component = tile.components[c];
  31214. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  31215. component.quantizationParameters = qcdOrQcc;
  31216. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  31217. component.codingStyleParameters = codOrCoc;
  31218. }
  31219. tile.codingStyleDefaultParameters = context.currentTile.COD;
  31220. }
  31221. class TagTree {
  31222. constructor(width, height) {
  31223. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31224. this.levels = [];
  31225. for (let i = 0; i < levelsLength; i++) {
  31226. const level = {
  31227. width,
  31228. height,
  31229. items: []
  31230. };
  31231. this.levels.push(level);
  31232. width = Math.ceil(width / 2);
  31233. height = Math.ceil(height / 2);
  31234. }
  31235. }
  31236. reset(i, j) {
  31237. let currentLevel = 0,
  31238. value = 0,
  31239. level;
  31240. while (currentLevel < this.levels.length) {
  31241. level = this.levels[currentLevel];
  31242. const index = i + j * level.width;
  31243. if (level.items[index] !== undefined) {
  31244. value = level.items[index];
  31245. break;
  31246. }
  31247. level.index = index;
  31248. i >>= 1;
  31249. j >>= 1;
  31250. currentLevel++;
  31251. }
  31252. currentLevel--;
  31253. level = this.levels[currentLevel];
  31254. level.items[level.index] = value;
  31255. this.currentLevel = currentLevel;
  31256. delete this.value;
  31257. }
  31258. incrementValue() {
  31259. const level = this.levels[this.currentLevel];
  31260. level.items[level.index]++;
  31261. }
  31262. nextLevel() {
  31263. let currentLevel = this.currentLevel;
  31264. let level = this.levels[currentLevel];
  31265. const value = level.items[level.index];
  31266. currentLevel--;
  31267. if (currentLevel < 0) {
  31268. this.value = value;
  31269. return false;
  31270. }
  31271. this.currentLevel = currentLevel;
  31272. level = this.levels[currentLevel];
  31273. level.items[level.index] = value;
  31274. return true;
  31275. }
  31276. }
  31277. class InclusionTree {
  31278. constructor(width, height, defaultValue) {
  31279. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31280. this.levels = [];
  31281. for (let i = 0; i < levelsLength; i++) {
  31282. const items = new Uint8Array(width * height);
  31283. for (let j = 0, jj = items.length; j < jj; j++) {
  31284. items[j] = defaultValue;
  31285. }
  31286. const level = {
  31287. width,
  31288. height,
  31289. items
  31290. };
  31291. this.levels.push(level);
  31292. width = Math.ceil(width / 2);
  31293. height = Math.ceil(height / 2);
  31294. }
  31295. }
  31296. reset(i, j, stopValue) {
  31297. let currentLevel = 0;
  31298. while (currentLevel < this.levels.length) {
  31299. const level = this.levels[currentLevel];
  31300. const index = i + j * level.width;
  31301. level.index = index;
  31302. const value = level.items[index];
  31303. if (value === 0xff) {
  31304. break;
  31305. }
  31306. if (value > stopValue) {
  31307. this.currentLevel = currentLevel;
  31308. this.propagateValues();
  31309. return false;
  31310. }
  31311. i >>= 1;
  31312. j >>= 1;
  31313. currentLevel++;
  31314. }
  31315. this.currentLevel = currentLevel - 1;
  31316. return true;
  31317. }
  31318. incrementValue(stopValue) {
  31319. const level = this.levels[this.currentLevel];
  31320. level.items[level.index] = stopValue + 1;
  31321. this.propagateValues();
  31322. }
  31323. propagateValues() {
  31324. let levelIndex = this.currentLevel;
  31325. let level = this.levels[levelIndex];
  31326. const currentValue = level.items[level.index];
  31327. while (--levelIndex >= 0) {
  31328. level = this.levels[levelIndex];
  31329. level.items[level.index] = currentValue;
  31330. }
  31331. }
  31332. nextLevel() {
  31333. let currentLevel = this.currentLevel;
  31334. let level = this.levels[currentLevel];
  31335. const value = level.items[level.index];
  31336. level.items[level.index] = 0xff;
  31337. currentLevel--;
  31338. if (currentLevel < 0) {
  31339. return false;
  31340. }
  31341. this.currentLevel = currentLevel;
  31342. level = this.levels[currentLevel];
  31343. level.items[level.index] = value;
  31344. return true;
  31345. }
  31346. }
  31347. const BitModel = function BitModelClosure() {
  31348. const UNIFORM_CONTEXT = 17;
  31349. const RUNLENGTH_CONTEXT = 18;
  31350. 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]);
  31351. 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]);
  31352. 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]);
  31353. class BitModel {
  31354. constructor(width, height, subband, zeroBitPlanes, mb) {
  31355. this.width = width;
  31356. this.height = height;
  31357. let contextLabelTable;
  31358. if (subband === "HH") {
  31359. contextLabelTable = HHContextLabel;
  31360. } else if (subband === "HL") {
  31361. contextLabelTable = HLContextLabel;
  31362. } else {
  31363. contextLabelTable = LLAndLHContextsLabel;
  31364. }
  31365. this.contextLabelTable = contextLabelTable;
  31366. const coefficientCount = width * height;
  31367. this.neighborsSignificance = new Uint8Array(coefficientCount);
  31368. this.coefficentsSign = new Uint8Array(coefficientCount);
  31369. let coefficentsMagnitude;
  31370. if (mb > 14) {
  31371. coefficentsMagnitude = new Uint32Array(coefficientCount);
  31372. } else if (mb > 6) {
  31373. coefficentsMagnitude = new Uint16Array(coefficientCount);
  31374. } else {
  31375. coefficentsMagnitude = new Uint8Array(coefficientCount);
  31376. }
  31377. this.coefficentsMagnitude = coefficentsMagnitude;
  31378. this.processingFlags = new Uint8Array(coefficientCount);
  31379. const bitsDecoded = new Uint8Array(coefficientCount);
  31380. if (zeroBitPlanes !== 0) {
  31381. for (let i = 0; i < coefficientCount; i++) {
  31382. bitsDecoded[i] = zeroBitPlanes;
  31383. }
  31384. }
  31385. this.bitsDecoded = bitsDecoded;
  31386. this.reset();
  31387. }
  31388. setDecoder(decoder) {
  31389. this.decoder = decoder;
  31390. }
  31391. reset() {
  31392. this.contexts = new Int8Array(19);
  31393. this.contexts[0] = 4 << 1 | 0;
  31394. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  31395. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  31396. }
  31397. setNeighborsSignificance(row, column, index) {
  31398. const neighborsSignificance = this.neighborsSignificance;
  31399. const width = this.width,
  31400. height = this.height;
  31401. const left = column > 0;
  31402. const right = column + 1 < width;
  31403. let i;
  31404. if (row > 0) {
  31405. i = index - width;
  31406. if (left) {
  31407. neighborsSignificance[i - 1] += 0x10;
  31408. }
  31409. if (right) {
  31410. neighborsSignificance[i + 1] += 0x10;
  31411. }
  31412. neighborsSignificance[i] += 0x04;
  31413. }
  31414. if (row + 1 < height) {
  31415. i = index + width;
  31416. if (left) {
  31417. neighborsSignificance[i - 1] += 0x10;
  31418. }
  31419. if (right) {
  31420. neighborsSignificance[i + 1] += 0x10;
  31421. }
  31422. neighborsSignificance[i] += 0x04;
  31423. }
  31424. if (left) {
  31425. neighborsSignificance[index - 1] += 0x01;
  31426. }
  31427. if (right) {
  31428. neighborsSignificance[index + 1] += 0x01;
  31429. }
  31430. neighborsSignificance[index] |= 0x80;
  31431. }
  31432. runSignificancePropagationPass() {
  31433. const decoder = this.decoder;
  31434. const width = this.width,
  31435. height = this.height;
  31436. const coefficentsMagnitude = this.coefficentsMagnitude;
  31437. const coefficentsSign = this.coefficentsSign;
  31438. const neighborsSignificance = this.neighborsSignificance;
  31439. const processingFlags = this.processingFlags;
  31440. const contexts = this.contexts;
  31441. const labels = this.contextLabelTable;
  31442. const bitsDecoded = this.bitsDecoded;
  31443. const processedInverseMask = ~1;
  31444. const processedMask = 1;
  31445. const firstMagnitudeBitMask = 2;
  31446. for (let i0 = 0; i0 < height; i0 += 4) {
  31447. for (let j = 0; j < width; j++) {
  31448. let index = i0 * width + j;
  31449. for (let i1 = 0; i1 < 4; i1++, index += width) {
  31450. const i = i0 + i1;
  31451. if (i >= height) {
  31452. break;
  31453. }
  31454. processingFlags[index] &= processedInverseMask;
  31455. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  31456. continue;
  31457. }
  31458. const contextLabel = labels[neighborsSignificance[index]];
  31459. const decision = decoder.readBit(contexts, contextLabel);
  31460. if (decision) {
  31461. const sign = this.decodeSignBit(i, j, index);
  31462. coefficentsSign[index] = sign;
  31463. coefficentsMagnitude[index] = 1;
  31464. this.setNeighborsSignificance(i, j, index);
  31465. processingFlags[index] |= firstMagnitudeBitMask;
  31466. }
  31467. bitsDecoded[index]++;
  31468. processingFlags[index] |= processedMask;
  31469. }
  31470. }
  31471. }
  31472. }
  31473. decodeSignBit(row, column, index) {
  31474. const width = this.width,
  31475. height = this.height;
  31476. const coefficentsMagnitude = this.coefficentsMagnitude;
  31477. const coefficentsSign = this.coefficentsSign;
  31478. let contribution, sign0, sign1, significance1;
  31479. let contextLabel, decoded;
  31480. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  31481. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31482. sign1 = coefficentsSign[index + 1];
  31483. if (significance1) {
  31484. sign0 = coefficentsSign[index - 1];
  31485. contribution = 1 - sign1 - sign0;
  31486. } else {
  31487. contribution = 1 - sign1 - sign1;
  31488. }
  31489. } else if (significance1) {
  31490. sign0 = coefficentsSign[index - 1];
  31491. contribution = 1 - sign0 - sign0;
  31492. } else {
  31493. contribution = 0;
  31494. }
  31495. const horizontalContribution = 3 * contribution;
  31496. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31497. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31498. sign1 = coefficentsSign[index + width];
  31499. if (significance1) {
  31500. sign0 = coefficentsSign[index - width];
  31501. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31502. } else {
  31503. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31504. }
  31505. } else if (significance1) {
  31506. sign0 = coefficentsSign[index - width];
  31507. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31508. } else {
  31509. contribution = horizontalContribution;
  31510. }
  31511. if (contribution >= 0) {
  31512. contextLabel = 9 + contribution;
  31513. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31514. } else {
  31515. contextLabel = 9 - contribution;
  31516. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31517. }
  31518. return decoded;
  31519. }
  31520. runMagnitudeRefinementPass() {
  31521. const decoder = this.decoder;
  31522. const width = this.width,
  31523. height = this.height;
  31524. const coefficentsMagnitude = this.coefficentsMagnitude;
  31525. const neighborsSignificance = this.neighborsSignificance;
  31526. const contexts = this.contexts;
  31527. const bitsDecoded = this.bitsDecoded;
  31528. const processingFlags = this.processingFlags;
  31529. const processedMask = 1;
  31530. const firstMagnitudeBitMask = 2;
  31531. const length = width * height;
  31532. const width4 = width * 4;
  31533. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31534. indexNext = Math.min(length, index0 + width4);
  31535. for (let j = 0; j < width; j++) {
  31536. for (let index = index0 + j; index < indexNext; index += width) {
  31537. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31538. continue;
  31539. }
  31540. let contextLabel = 16;
  31541. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31542. processingFlags[index] ^= firstMagnitudeBitMask;
  31543. const significance = neighborsSignificance[index] & 127;
  31544. contextLabel = significance === 0 ? 15 : 14;
  31545. }
  31546. const bit = decoder.readBit(contexts, contextLabel);
  31547. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31548. bitsDecoded[index]++;
  31549. processingFlags[index] |= processedMask;
  31550. }
  31551. }
  31552. }
  31553. }
  31554. runCleanupPass() {
  31555. const decoder = this.decoder;
  31556. const width = this.width,
  31557. height = this.height;
  31558. const neighborsSignificance = this.neighborsSignificance;
  31559. const coefficentsMagnitude = this.coefficentsMagnitude;
  31560. const coefficentsSign = this.coefficentsSign;
  31561. const contexts = this.contexts;
  31562. const labels = this.contextLabelTable;
  31563. const bitsDecoded = this.bitsDecoded;
  31564. const processingFlags = this.processingFlags;
  31565. const processedMask = 1;
  31566. const firstMagnitudeBitMask = 2;
  31567. const oneRowDown = width;
  31568. const twoRowsDown = width * 2;
  31569. const threeRowsDown = width * 3;
  31570. let iNext;
  31571. for (let i0 = 0; i0 < height; i0 = iNext) {
  31572. iNext = Math.min(i0 + 4, height);
  31573. const indexBase = i0 * width;
  31574. const checkAllEmpty = i0 + 3 < height;
  31575. for (let j = 0; j < width; j++) {
  31576. const index0 = indexBase + j;
  31577. 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;
  31578. let i1 = 0,
  31579. index = index0;
  31580. let i = i0,
  31581. sign;
  31582. if (allEmpty) {
  31583. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31584. if (!hasSignificantCoefficent) {
  31585. bitsDecoded[index0]++;
  31586. bitsDecoded[index0 + oneRowDown]++;
  31587. bitsDecoded[index0 + twoRowsDown]++;
  31588. bitsDecoded[index0 + threeRowsDown]++;
  31589. continue;
  31590. }
  31591. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31592. if (i1 !== 0) {
  31593. i = i0 + i1;
  31594. index += i1 * width;
  31595. }
  31596. sign = this.decodeSignBit(i, j, index);
  31597. coefficentsSign[index] = sign;
  31598. coefficentsMagnitude[index] = 1;
  31599. this.setNeighborsSignificance(i, j, index);
  31600. processingFlags[index] |= firstMagnitudeBitMask;
  31601. index = index0;
  31602. for (let i2 = i0; i2 <= i; i2++, index += width) {
  31603. bitsDecoded[index]++;
  31604. }
  31605. i1++;
  31606. }
  31607. for (i = i0 + i1; i < iNext; i++, index += width) {
  31608. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31609. continue;
  31610. }
  31611. const contextLabel = labels[neighborsSignificance[index]];
  31612. const decision = decoder.readBit(contexts, contextLabel);
  31613. if (decision === 1) {
  31614. sign = this.decodeSignBit(i, j, index);
  31615. coefficentsSign[index] = sign;
  31616. coefficentsMagnitude[index] = 1;
  31617. this.setNeighborsSignificance(i, j, index);
  31618. processingFlags[index] |= firstMagnitudeBitMask;
  31619. }
  31620. bitsDecoded[index]++;
  31621. }
  31622. }
  31623. }
  31624. }
  31625. checkSegmentationSymbol() {
  31626. const decoder = this.decoder;
  31627. const contexts = this.contexts;
  31628. 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);
  31629. if (symbol !== 0xa) {
  31630. throw new JpxError("Invalid segmentation symbol");
  31631. }
  31632. }
  31633. }
  31634. return BitModel;
  31635. }();
  31636. class Transform {
  31637. constructor() {
  31638. if (this.constructor === Transform) {
  31639. (0, _util.unreachable)("Cannot initialize Transform.");
  31640. }
  31641. }
  31642. calculate(subbands, u0, v0) {
  31643. let ll = subbands[0];
  31644. for (let i = 1, ii = subbands.length; i < ii; i++) {
  31645. ll = this.iterate(ll, subbands[i], u0, v0);
  31646. }
  31647. return ll;
  31648. }
  31649. extend(buffer, offset, size) {
  31650. let i1 = offset - 1,
  31651. j1 = offset + 1;
  31652. let i2 = offset + size - 2,
  31653. j2 = offset + size;
  31654. buffer[i1--] = buffer[j1++];
  31655. buffer[j2++] = buffer[i2--];
  31656. buffer[i1--] = buffer[j1++];
  31657. buffer[j2++] = buffer[i2--];
  31658. buffer[i1--] = buffer[j1++];
  31659. buffer[j2++] = buffer[i2--];
  31660. buffer[i1] = buffer[j1];
  31661. buffer[j2] = buffer[i2];
  31662. }
  31663. filter(x, offset, length) {
  31664. (0, _util.unreachable)("Abstract method `filter` called");
  31665. }
  31666. iterate(ll, hl_lh_hh, u0, v0) {
  31667. const llWidth = ll.width,
  31668. llHeight = ll.height;
  31669. let llItems = ll.items;
  31670. const width = hl_lh_hh.width;
  31671. const height = hl_lh_hh.height;
  31672. const items = hl_lh_hh.items;
  31673. let i, j, k, l, u, v;
  31674. for (k = 0, i = 0; i < llHeight; i++) {
  31675. l = i * 2 * width;
  31676. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31677. items[l] = llItems[k];
  31678. }
  31679. }
  31680. llItems = ll.items = null;
  31681. const bufferPadding = 4;
  31682. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31683. if (width === 1) {
  31684. if ((u0 & 1) !== 0) {
  31685. for (v = 0, k = 0; v < height; v++, k += width) {
  31686. items[k] *= 0.5;
  31687. }
  31688. }
  31689. } else {
  31690. for (v = 0, k = 0; v < height; v++, k += width) {
  31691. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31692. this.extend(rowBuffer, bufferPadding, width);
  31693. this.filter(rowBuffer, bufferPadding, width);
  31694. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31695. }
  31696. }
  31697. let numBuffers = 16;
  31698. const colBuffers = [];
  31699. for (i = 0; i < numBuffers; i++) {
  31700. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31701. }
  31702. let b,
  31703. currentBuffer = 0;
  31704. ll = bufferPadding + height;
  31705. if (height === 1) {
  31706. if ((v0 & 1) !== 0) {
  31707. for (u = 0; u < width; u++) {
  31708. items[u] *= 0.5;
  31709. }
  31710. }
  31711. } else {
  31712. for (u = 0; u < width; u++) {
  31713. if (currentBuffer === 0) {
  31714. numBuffers = Math.min(width - u, numBuffers);
  31715. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31716. for (b = 0; b < numBuffers; b++) {
  31717. colBuffers[b][l] = items[k + b];
  31718. }
  31719. }
  31720. currentBuffer = numBuffers;
  31721. }
  31722. currentBuffer--;
  31723. const buffer = colBuffers[currentBuffer];
  31724. this.extend(buffer, bufferPadding, height);
  31725. this.filter(buffer, bufferPadding, height);
  31726. if (currentBuffer === 0) {
  31727. k = u - numBuffers + 1;
  31728. for (l = bufferPadding; l < ll; k += width, l++) {
  31729. for (b = 0; b < numBuffers; b++) {
  31730. items[k + b] = colBuffers[b][l];
  31731. }
  31732. }
  31733. }
  31734. }
  31735. }
  31736. return {
  31737. width,
  31738. height,
  31739. items
  31740. };
  31741. }
  31742. }
  31743. class IrreversibleTransform extends Transform {
  31744. filter(x, offset, length) {
  31745. const len = length >> 1;
  31746. offset |= 0;
  31747. let j, n, current, next;
  31748. const alpha = -1.586134342059924;
  31749. const beta = -0.052980118572961;
  31750. const gamma = 0.882911075530934;
  31751. const delta = 0.443506852043971;
  31752. const K = 1.230174104914001;
  31753. const K_ = 1 / K;
  31754. j = offset - 3;
  31755. for (n = len + 4; n--; j += 2) {
  31756. x[j] *= K_;
  31757. }
  31758. j = offset - 2;
  31759. current = delta * x[j - 1];
  31760. for (n = len + 3; n--; j += 2) {
  31761. next = delta * x[j + 1];
  31762. x[j] = K * x[j] - current - next;
  31763. if (n--) {
  31764. j += 2;
  31765. current = delta * x[j + 1];
  31766. x[j] = K * x[j] - current - next;
  31767. } else {
  31768. break;
  31769. }
  31770. }
  31771. j = offset - 1;
  31772. current = gamma * x[j - 1];
  31773. for (n = len + 2; n--; j += 2) {
  31774. next = gamma * x[j + 1];
  31775. x[j] -= current + next;
  31776. if (n--) {
  31777. j += 2;
  31778. current = gamma * x[j + 1];
  31779. x[j] -= current + next;
  31780. } else {
  31781. break;
  31782. }
  31783. }
  31784. j = offset;
  31785. current = beta * x[j - 1];
  31786. for (n = len + 1; n--; j += 2) {
  31787. next = beta * x[j + 1];
  31788. x[j] -= current + next;
  31789. if (n--) {
  31790. j += 2;
  31791. current = beta * x[j + 1];
  31792. x[j] -= current + next;
  31793. } else {
  31794. break;
  31795. }
  31796. }
  31797. if (len !== 0) {
  31798. j = offset + 1;
  31799. current = alpha * x[j - 1];
  31800. for (n = len; n--; j += 2) {
  31801. next = alpha * x[j + 1];
  31802. x[j] -= current + next;
  31803. if (n--) {
  31804. j += 2;
  31805. current = alpha * x[j + 1];
  31806. x[j] -= current + next;
  31807. } else {
  31808. break;
  31809. }
  31810. }
  31811. }
  31812. }
  31813. }
  31814. class ReversibleTransform extends Transform {
  31815. filter(x, offset, length) {
  31816. const len = length >> 1;
  31817. offset |= 0;
  31818. let j, n;
  31819. for (j = offset, n = len + 1; n--; j += 2) {
  31820. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31821. }
  31822. for (j = offset + 1, n = len; n--; j += 2) {
  31823. x[j] += x[j - 1] + x[j + 1] >> 1;
  31824. }
  31825. }
  31826. }
  31827. /***/ }),
  31828. /* 41 */
  31829. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31830. Object.defineProperty(exports, "__esModule", ({
  31831. value: true
  31832. }));
  31833. exports.LZWStream = void 0;
  31834. var _decode_stream = __w_pdfjs_require__(29);
  31835. class LZWStream extends _decode_stream.DecodeStream {
  31836. constructor(str, maybeLength, earlyChange) {
  31837. super(maybeLength);
  31838. this.str = str;
  31839. this.dict = str.dict;
  31840. this.cachedData = 0;
  31841. this.bitsCached = 0;
  31842. const maxLzwDictionarySize = 4096;
  31843. const lzwState = {
  31844. earlyChange,
  31845. codeLength: 9,
  31846. nextCode: 258,
  31847. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  31848. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  31849. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  31850. currentSequence: new Uint8Array(maxLzwDictionarySize),
  31851. currentSequenceLength: 0
  31852. };
  31853. for (let i = 0; i < 256; ++i) {
  31854. lzwState.dictionaryValues[i] = i;
  31855. lzwState.dictionaryLengths[i] = 1;
  31856. }
  31857. this.lzwState = lzwState;
  31858. }
  31859. readBits(n) {
  31860. let bitsCached = this.bitsCached;
  31861. let cachedData = this.cachedData;
  31862. while (bitsCached < n) {
  31863. const c = this.str.getByte();
  31864. if (c === -1) {
  31865. this.eof = true;
  31866. return null;
  31867. }
  31868. cachedData = cachedData << 8 | c;
  31869. bitsCached += 8;
  31870. }
  31871. this.bitsCached = bitsCached -= n;
  31872. this.cachedData = cachedData;
  31873. this.lastCode = null;
  31874. return cachedData >>> bitsCached & (1 << n) - 1;
  31875. }
  31876. readBlock() {
  31877. const blockSize = 512,
  31878. decodedSizeDelta = blockSize;
  31879. let estimatedDecodedSize = blockSize * 2;
  31880. let i, j, q;
  31881. const lzwState = this.lzwState;
  31882. if (!lzwState) {
  31883. return;
  31884. }
  31885. const earlyChange = lzwState.earlyChange;
  31886. let nextCode = lzwState.nextCode;
  31887. const dictionaryValues = lzwState.dictionaryValues;
  31888. const dictionaryLengths = lzwState.dictionaryLengths;
  31889. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  31890. let codeLength = lzwState.codeLength;
  31891. let prevCode = lzwState.prevCode;
  31892. const currentSequence = lzwState.currentSequence;
  31893. let currentSequenceLength = lzwState.currentSequenceLength;
  31894. let decodedLength = 0;
  31895. let currentBufferLength = this.bufferLength;
  31896. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  31897. for (i = 0; i < blockSize; i++) {
  31898. const code = this.readBits(codeLength);
  31899. const hasPrev = currentSequenceLength > 0;
  31900. if (code < 256) {
  31901. currentSequence[0] = code;
  31902. currentSequenceLength = 1;
  31903. } else if (code >= 258) {
  31904. if (code < nextCode) {
  31905. currentSequenceLength = dictionaryLengths[code];
  31906. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  31907. currentSequence[j] = dictionaryValues[q];
  31908. q = dictionaryPrevCodes[q];
  31909. }
  31910. } else {
  31911. currentSequence[currentSequenceLength++] = currentSequence[0];
  31912. }
  31913. } else if (code === 256) {
  31914. codeLength = 9;
  31915. nextCode = 258;
  31916. currentSequenceLength = 0;
  31917. continue;
  31918. } else {
  31919. this.eof = true;
  31920. delete this.lzwState;
  31921. break;
  31922. }
  31923. if (hasPrev) {
  31924. dictionaryPrevCodes[nextCode] = prevCode;
  31925. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  31926. dictionaryValues[nextCode] = currentSequence[0];
  31927. nextCode++;
  31928. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  31929. }
  31930. prevCode = code;
  31931. decodedLength += currentSequenceLength;
  31932. if (estimatedDecodedSize < decodedLength) {
  31933. do {
  31934. estimatedDecodedSize += decodedSizeDelta;
  31935. } while (estimatedDecodedSize < decodedLength);
  31936. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  31937. }
  31938. for (j = 0; j < currentSequenceLength; j++) {
  31939. buffer[currentBufferLength++] = currentSequence[j];
  31940. }
  31941. }
  31942. lzwState.nextCode = nextCode;
  31943. lzwState.codeLength = codeLength;
  31944. lzwState.prevCode = prevCode;
  31945. lzwState.currentSequenceLength = currentSequenceLength;
  31946. this.bufferLength = currentBufferLength;
  31947. }
  31948. }
  31949. exports.LZWStream = LZWStream;
  31950. /***/ }),
  31951. /* 42 */
  31952. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31953. Object.defineProperty(exports, "__esModule", ({
  31954. value: true
  31955. }));
  31956. exports.PredictorStream = void 0;
  31957. var _decode_stream = __w_pdfjs_require__(29);
  31958. var _primitives = __w_pdfjs_require__(5);
  31959. var _util = __w_pdfjs_require__(2);
  31960. class PredictorStream extends _decode_stream.DecodeStream {
  31961. constructor(str, maybeLength, params) {
  31962. super(maybeLength);
  31963. if (!(params instanceof _primitives.Dict)) {
  31964. return str;
  31965. }
  31966. const predictor = this.predictor = params.get("Predictor") || 1;
  31967. if (predictor <= 1) {
  31968. return str;
  31969. }
  31970. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  31971. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  31972. }
  31973. if (predictor === 2) {
  31974. this.readBlock = this.readBlockTiff;
  31975. } else {
  31976. this.readBlock = this.readBlockPng;
  31977. }
  31978. this.str = str;
  31979. this.dict = str.dict;
  31980. const colors = this.colors = params.get("Colors") || 1;
  31981. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  31982. const columns = this.columns = params.get("Columns") || 1;
  31983. this.pixBytes = colors * bits + 7 >> 3;
  31984. this.rowBytes = columns * colors * bits + 7 >> 3;
  31985. return this;
  31986. }
  31987. readBlockTiff() {
  31988. const rowBytes = this.rowBytes;
  31989. const bufferLength = this.bufferLength;
  31990. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  31991. const bits = this.bits;
  31992. const colors = this.colors;
  31993. const rawBytes = this.str.getBytes(rowBytes);
  31994. this.eof = !rawBytes.length;
  31995. if (this.eof) {
  31996. return;
  31997. }
  31998. let inbuf = 0,
  31999. outbuf = 0;
  32000. let inbits = 0,
  32001. outbits = 0;
  32002. let pos = bufferLength;
  32003. let i;
  32004. if (bits === 1 && colors === 1) {
  32005. for (i = 0; i < rowBytes; ++i) {
  32006. let c = rawBytes[i] ^ inbuf;
  32007. c ^= c >> 1;
  32008. c ^= c >> 2;
  32009. c ^= c >> 4;
  32010. inbuf = (c & 1) << 7;
  32011. buffer[pos++] = c;
  32012. }
  32013. } else if (bits === 8) {
  32014. for (i = 0; i < colors; ++i) {
  32015. buffer[pos++] = rawBytes[i];
  32016. }
  32017. for (; i < rowBytes; ++i) {
  32018. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  32019. pos++;
  32020. }
  32021. } else if (bits === 16) {
  32022. const bytesPerPixel = colors * 2;
  32023. for (i = 0; i < bytesPerPixel; ++i) {
  32024. buffer[pos++] = rawBytes[i];
  32025. }
  32026. for (; i < rowBytes; i += 2) {
  32027. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  32028. buffer[pos++] = sum >> 8 & 0xff;
  32029. buffer[pos++] = sum & 0xff;
  32030. }
  32031. } else {
  32032. const compArray = new Uint8Array(colors + 1);
  32033. const bitMask = (1 << bits) - 1;
  32034. let j = 0,
  32035. k = bufferLength;
  32036. const columns = this.columns;
  32037. for (i = 0; i < columns; ++i) {
  32038. for (let kk = 0; kk < colors; ++kk) {
  32039. if (inbits < bits) {
  32040. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  32041. inbits += 8;
  32042. }
  32043. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  32044. inbits -= bits;
  32045. outbuf = outbuf << bits | compArray[kk];
  32046. outbits += bits;
  32047. if (outbits >= 8) {
  32048. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  32049. outbits -= 8;
  32050. }
  32051. }
  32052. }
  32053. if (outbits > 0) {
  32054. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  32055. }
  32056. }
  32057. this.bufferLength += rowBytes;
  32058. }
  32059. readBlockPng() {
  32060. const rowBytes = this.rowBytes;
  32061. const pixBytes = this.pixBytes;
  32062. const predictor = this.str.getByte();
  32063. const rawBytes = this.str.getBytes(rowBytes);
  32064. this.eof = !rawBytes.length;
  32065. if (this.eof) {
  32066. return;
  32067. }
  32068. const bufferLength = this.bufferLength;
  32069. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32070. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  32071. if (prevRow.length === 0) {
  32072. prevRow = new Uint8Array(rowBytes);
  32073. }
  32074. let i,
  32075. j = bufferLength,
  32076. up,
  32077. c;
  32078. switch (predictor) {
  32079. case 0:
  32080. for (i = 0; i < rowBytes; ++i) {
  32081. buffer[j++] = rawBytes[i];
  32082. }
  32083. break;
  32084. case 1:
  32085. for (i = 0; i < pixBytes; ++i) {
  32086. buffer[j++] = rawBytes[i];
  32087. }
  32088. for (; i < rowBytes; ++i) {
  32089. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  32090. j++;
  32091. }
  32092. break;
  32093. case 2:
  32094. for (i = 0; i < rowBytes; ++i) {
  32095. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  32096. }
  32097. break;
  32098. case 3:
  32099. for (i = 0; i < pixBytes; ++i) {
  32100. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  32101. }
  32102. for (; i < rowBytes; ++i) {
  32103. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  32104. j++;
  32105. }
  32106. break;
  32107. case 4:
  32108. for (i = 0; i < pixBytes; ++i) {
  32109. up = prevRow[i];
  32110. c = rawBytes[i];
  32111. buffer[j++] = up + c;
  32112. }
  32113. for (; i < rowBytes; ++i) {
  32114. up = prevRow[i];
  32115. const upLeft = prevRow[i - pixBytes];
  32116. const left = buffer[j - pixBytes];
  32117. const p = left + up - upLeft;
  32118. let pa = p - left;
  32119. if (pa < 0) {
  32120. pa = -pa;
  32121. }
  32122. let pb = p - up;
  32123. if (pb < 0) {
  32124. pb = -pb;
  32125. }
  32126. let pc = p - upLeft;
  32127. if (pc < 0) {
  32128. pc = -pc;
  32129. }
  32130. c = rawBytes[i];
  32131. if (pa <= pb && pa <= pc) {
  32132. buffer[j++] = left + c;
  32133. } else if (pb <= pc) {
  32134. buffer[j++] = up + c;
  32135. } else {
  32136. buffer[j++] = upLeft + c;
  32137. }
  32138. }
  32139. break;
  32140. default:
  32141. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32142. }
  32143. this.bufferLength += rowBytes;
  32144. }
  32145. }
  32146. exports.PredictorStream = PredictorStream;
  32147. /***/ }),
  32148. /* 43 */
  32149. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32150. Object.defineProperty(exports, "__esModule", ({
  32151. value: true
  32152. }));
  32153. exports.RunLengthStream = void 0;
  32154. var _decode_stream = __w_pdfjs_require__(29);
  32155. class RunLengthStream extends _decode_stream.DecodeStream {
  32156. constructor(str, maybeLength) {
  32157. super(maybeLength);
  32158. this.str = str;
  32159. this.dict = str.dict;
  32160. }
  32161. readBlock() {
  32162. const repeatHeader = this.str.getBytes(2);
  32163. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  32164. this.eof = true;
  32165. return;
  32166. }
  32167. let buffer;
  32168. let bufferLength = this.bufferLength;
  32169. let n = repeatHeader[0];
  32170. if (n < 128) {
  32171. buffer = this.ensureBuffer(bufferLength + n + 1);
  32172. buffer[bufferLength++] = repeatHeader[1];
  32173. if (n > 0) {
  32174. const source = this.str.getBytes(n);
  32175. buffer.set(source, bufferLength);
  32176. bufferLength += n;
  32177. }
  32178. } else {
  32179. n = 257 - n;
  32180. const b = repeatHeader[1];
  32181. buffer = this.ensureBuffer(bufferLength + n + 1);
  32182. for (let i = 0; i < n; i++) {
  32183. buffer[bufferLength++] = b;
  32184. }
  32185. }
  32186. this.bufferLength = bufferLength;
  32187. }
  32188. }
  32189. exports.RunLengthStream = RunLengthStream;
  32190. /***/ }),
  32191. /* 44 */
  32192. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32193. Object.defineProperty(exports, "__esModule", ({
  32194. value: true
  32195. }));
  32196. exports.Font = exports.ErrorFont = void 0;
  32197. var _util = __w_pdfjs_require__(2);
  32198. var _cff_parser = __w_pdfjs_require__(45);
  32199. var _fonts_utils = __w_pdfjs_require__(18);
  32200. var _unicode = __w_pdfjs_require__(21);
  32201. var _glyphlist = __w_pdfjs_require__(20);
  32202. var _encodings = __w_pdfjs_require__(19);
  32203. var _standard_fonts = __w_pdfjs_require__(47);
  32204. var _to_unicode_map = __w_pdfjs_require__(48);
  32205. var _cff_font = __w_pdfjs_require__(49);
  32206. var _font_renderer = __w_pdfjs_require__(50);
  32207. var _metrics = __w_pdfjs_require__(51);
  32208. var _glyf = __w_pdfjs_require__(52);
  32209. var _cmap = __w_pdfjs_require__(26);
  32210. var _opentype_file_builder = __w_pdfjs_require__(53);
  32211. var _core_utils = __w_pdfjs_require__(8);
  32212. var _stream = __w_pdfjs_require__(10);
  32213. var _type1_font = __w_pdfjs_require__(54);
  32214. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  32215. const PDF_GLYPH_SPACE_UNITS = 1000;
  32216. 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"];
  32217. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  32218. function adjustWidths(properties) {
  32219. if (!properties.fontMatrix) {
  32220. return;
  32221. }
  32222. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  32223. return;
  32224. }
  32225. const scale = 0.001 / properties.fontMatrix[0];
  32226. const glyphsWidths = properties.widths;
  32227. for (const glyph in glyphsWidths) {
  32228. glyphsWidths[glyph] *= scale;
  32229. }
  32230. properties.defaultWidth *= scale;
  32231. }
  32232. function adjustToUnicode(properties, builtInEncoding) {
  32233. if (properties.isInternalFont) {
  32234. return;
  32235. }
  32236. if (builtInEncoding === properties.defaultEncoding) {
  32237. return;
  32238. }
  32239. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32240. return;
  32241. }
  32242. const toUnicode = [],
  32243. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32244. for (const charCode in builtInEncoding) {
  32245. if (properties.hasIncludedToUnicodeMap) {
  32246. if (properties.toUnicode.has(charCode)) {
  32247. continue;
  32248. }
  32249. } else if (properties.hasEncoding) {
  32250. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  32251. continue;
  32252. }
  32253. }
  32254. const glyphName = builtInEncoding[charCode];
  32255. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32256. if (unicode !== -1) {
  32257. toUnicode[charCode] = String.fromCharCode(unicode);
  32258. }
  32259. }
  32260. if (toUnicode.length > 0) {
  32261. properties.toUnicode.amend(toUnicode);
  32262. }
  32263. }
  32264. function amendFallbackToUnicode(properties) {
  32265. if (!properties.fallbackToUnicode) {
  32266. return;
  32267. }
  32268. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32269. return;
  32270. }
  32271. const toUnicode = [];
  32272. for (const charCode in properties.fallbackToUnicode) {
  32273. if (properties.toUnicode.has(charCode)) {
  32274. continue;
  32275. }
  32276. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  32277. }
  32278. if (toUnicode.length > 0) {
  32279. properties.toUnicode.amend(toUnicode);
  32280. }
  32281. }
  32282. class Glyph {
  32283. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32284. this.originalCharCode = originalCharCode;
  32285. this.fontChar = fontChar;
  32286. this.unicode = unicode;
  32287. this.accent = accent;
  32288. this.width = width;
  32289. this.vmetric = vmetric;
  32290. this.operatorListId = operatorListId;
  32291. this.isSpace = isSpace;
  32292. this.isInFont = isInFont;
  32293. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  32294. this.isWhitespace = category.isWhitespace;
  32295. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  32296. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  32297. }
  32298. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32299. 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;
  32300. }
  32301. }
  32302. function int16(b0, b1) {
  32303. return (b0 << 8) + b1;
  32304. }
  32305. function writeSignedInt16(bytes, index, value) {
  32306. bytes[index + 1] = value;
  32307. bytes[index] = value >>> 8;
  32308. }
  32309. function signedInt16(b0, b1) {
  32310. const value = (b0 << 8) + b1;
  32311. return value & 1 << 15 ? value - 0x10000 : value;
  32312. }
  32313. function int32(b0, b1, b2, b3) {
  32314. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  32315. }
  32316. function string16(value) {
  32317. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32318. }
  32319. function safeString16(value) {
  32320. if (value > 0x7fff) {
  32321. value = 0x7fff;
  32322. } else if (value < -0x8000) {
  32323. value = -0x8000;
  32324. }
  32325. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32326. }
  32327. function isTrueTypeFile(file) {
  32328. const header = file.peekBytes(4);
  32329. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  32330. }
  32331. function isTrueTypeCollectionFile(file) {
  32332. const header = file.peekBytes(4);
  32333. return (0, _util.bytesToString)(header) === "ttcf";
  32334. }
  32335. function isOpenTypeFile(file) {
  32336. const header = file.peekBytes(4);
  32337. return (0, _util.bytesToString)(header) === "OTTO";
  32338. }
  32339. function isType1File(file) {
  32340. const header = file.peekBytes(2);
  32341. if (header[0] === 0x25 && header[1] === 0x21) {
  32342. return true;
  32343. }
  32344. if (header[0] === 0x80 && header[1] === 0x01) {
  32345. return true;
  32346. }
  32347. return false;
  32348. }
  32349. function isCFFFile(file) {
  32350. const header = file.peekBytes(4);
  32351. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  32352. return true;
  32353. }
  32354. return false;
  32355. }
  32356. function getFontFileType(file, {
  32357. type,
  32358. subtype,
  32359. composite
  32360. }) {
  32361. let fileType, fileSubtype;
  32362. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  32363. if (composite) {
  32364. fileType = "CIDFontType2";
  32365. } else {
  32366. fileType = "TrueType";
  32367. }
  32368. } else if (isOpenTypeFile(file)) {
  32369. if (composite) {
  32370. fileType = "CIDFontType2";
  32371. } else {
  32372. fileType = "OpenType";
  32373. }
  32374. } else if (isType1File(file)) {
  32375. if (composite) {
  32376. fileType = "CIDFontType0";
  32377. } else {
  32378. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32379. }
  32380. } else if (isCFFFile(file)) {
  32381. if (composite) {
  32382. fileType = "CIDFontType0";
  32383. fileSubtype = "CIDFontType0C";
  32384. } else {
  32385. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32386. fileSubtype = "Type1C";
  32387. }
  32388. } else {
  32389. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  32390. fileType = type;
  32391. fileSubtype = subtype;
  32392. }
  32393. return [fileType, fileSubtype];
  32394. }
  32395. function applyStandardFontGlyphMap(map, glyphMap) {
  32396. for (const charCode in glyphMap) {
  32397. map[+charCode] = glyphMap[charCode];
  32398. }
  32399. }
  32400. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  32401. const toFontChar = [];
  32402. let unicode;
  32403. for (let i = 0, ii = encoding.length; i < ii; i++) {
  32404. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  32405. if (unicode !== -1) {
  32406. toFontChar[i] = unicode;
  32407. }
  32408. }
  32409. for (const charCode in differences) {
  32410. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  32411. if (unicode !== -1) {
  32412. toFontChar[+charCode] = unicode;
  32413. }
  32414. }
  32415. return toFontChar;
  32416. }
  32417. function convertCidString(charCode, cid, shouldThrow = false) {
  32418. switch (cid.length) {
  32419. case 1:
  32420. return cid.charCodeAt(0);
  32421. case 2:
  32422. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  32423. }
  32424. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  32425. if (shouldThrow) {
  32426. throw new _util.FormatError(msg);
  32427. }
  32428. (0, _util.warn)(msg);
  32429. return cid;
  32430. }
  32431. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  32432. const newMap = Object.create(null);
  32433. const toFontChar = [];
  32434. let privateUseAreaIndex = 0;
  32435. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32436. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32437. for (let originalCharCode in charCodeToGlyphId) {
  32438. originalCharCode |= 0;
  32439. let glyphId = charCodeToGlyphId[originalCharCode];
  32440. if (!hasGlyph(glyphId)) {
  32441. continue;
  32442. }
  32443. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  32444. privateUseAreaIndex++;
  32445. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  32446. (0, _util.warn)("Ran out of space in font private use area.");
  32447. break;
  32448. }
  32449. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32450. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32451. }
  32452. const fontCharCode = nextAvailableFontCharCode++;
  32453. if (glyphId === 0) {
  32454. glyphId = newGlyphZeroId;
  32455. }
  32456. newMap[fontCharCode] = glyphId;
  32457. toFontChar[originalCharCode] = fontCharCode;
  32458. }
  32459. return {
  32460. toFontChar,
  32461. charCodeToGlyphId: newMap,
  32462. nextAvailableFontCharCode
  32463. };
  32464. }
  32465. function getRanges(glyphs, numGlyphs) {
  32466. const codes = [];
  32467. for (const charCode in glyphs) {
  32468. if (glyphs[charCode] >= numGlyphs) {
  32469. continue;
  32470. }
  32471. codes.push({
  32472. fontCharCode: charCode | 0,
  32473. glyphId: glyphs[charCode]
  32474. });
  32475. }
  32476. if (codes.length === 0) {
  32477. codes.push({
  32478. fontCharCode: 0,
  32479. glyphId: 0
  32480. });
  32481. }
  32482. codes.sort(function fontGetRangesSort(a, b) {
  32483. return a.fontCharCode - b.fontCharCode;
  32484. });
  32485. const ranges = [];
  32486. const length = codes.length;
  32487. for (let n = 0; n < length;) {
  32488. const start = codes[n].fontCharCode;
  32489. const codeIndices = [codes[n].glyphId];
  32490. ++n;
  32491. let end = start;
  32492. while (n < length && end + 1 === codes[n].fontCharCode) {
  32493. codeIndices.push(codes[n].glyphId);
  32494. ++end;
  32495. ++n;
  32496. if (end === 0xffff) {
  32497. break;
  32498. }
  32499. }
  32500. ranges.push([start, end, codeIndices]);
  32501. }
  32502. return ranges;
  32503. }
  32504. function createCmapTable(glyphs, numGlyphs) {
  32505. const ranges = getRanges(glyphs, numGlyphs);
  32506. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  32507. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  32508. let i, ii, j, jj;
  32509. for (i = ranges.length - 1; i >= 0; --i) {
  32510. if (ranges[i][0] <= 0xffff) {
  32511. break;
  32512. }
  32513. }
  32514. const bmpLength = i + 1;
  32515. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  32516. ranges[i][1] = 0xfffe;
  32517. }
  32518. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  32519. const segCount = bmpLength + trailingRangesCount;
  32520. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  32521. let startCount = "";
  32522. let endCount = "";
  32523. let idDeltas = "";
  32524. let idRangeOffsets = "";
  32525. let glyphsIds = "";
  32526. let bias = 0;
  32527. let range, start, end, codes;
  32528. for (i = 0, ii = bmpLength; i < ii; i++) {
  32529. range = ranges[i];
  32530. start = range[0];
  32531. end = range[1];
  32532. startCount += string16(start);
  32533. endCount += string16(end);
  32534. codes = range[2];
  32535. let contiguous = true;
  32536. for (j = 1, jj = codes.length; j < jj; ++j) {
  32537. if (codes[j] !== codes[j - 1] + 1) {
  32538. contiguous = false;
  32539. break;
  32540. }
  32541. }
  32542. if (!contiguous) {
  32543. const offset = (segCount - i) * 2 + bias * 2;
  32544. bias += end - start + 1;
  32545. idDeltas += string16(0);
  32546. idRangeOffsets += string16(offset);
  32547. for (j = 0, jj = codes.length; j < jj; ++j) {
  32548. glyphsIds += string16(codes[j]);
  32549. }
  32550. } else {
  32551. const startCode = codes[0];
  32552. idDeltas += string16(startCode - start & 0xffff);
  32553. idRangeOffsets += string16(0);
  32554. }
  32555. }
  32556. if (trailingRangesCount > 0) {
  32557. endCount += "\xFF\xFF";
  32558. startCount += "\xFF\xFF";
  32559. idDeltas += "\x00\x01";
  32560. idRangeOffsets += "\x00\x00";
  32561. }
  32562. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  32563. let format31012 = "";
  32564. let header31012 = "";
  32565. if (numTables > 1) {
  32566. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  32567. format31012 = "";
  32568. for (i = 0, ii = ranges.length; i < ii; i++) {
  32569. range = ranges[i];
  32570. start = range[0];
  32571. codes = range[2];
  32572. let code = codes[0];
  32573. for (j = 1, jj = codes.length; j < jj; ++j) {
  32574. if (codes[j] !== codes[j - 1] + 1) {
  32575. end = range[0] + j - 1;
  32576. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  32577. start = end + 1;
  32578. code = codes[j];
  32579. }
  32580. }
  32581. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  32582. }
  32583. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  32584. }
  32585. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  32586. }
  32587. function validateOS2Table(os2, file) {
  32588. file.pos = (file.start || 0) + os2.offset;
  32589. const version = file.getUint16();
  32590. file.skip(60);
  32591. const selection = file.getUint16();
  32592. if (version < 4 && selection & 0x0300) {
  32593. return false;
  32594. }
  32595. const firstChar = file.getUint16();
  32596. const lastChar = file.getUint16();
  32597. if (firstChar > lastChar) {
  32598. return false;
  32599. }
  32600. file.skip(6);
  32601. const usWinAscent = file.getUint16();
  32602. if (usWinAscent === 0) {
  32603. return false;
  32604. }
  32605. os2.data[8] = os2.data[9] = 0;
  32606. return true;
  32607. }
  32608. function createOS2Table(properties, charstrings, override) {
  32609. override = override || {
  32610. unitsPerEm: 0,
  32611. yMax: 0,
  32612. yMin: 0,
  32613. ascent: 0,
  32614. descent: 0
  32615. };
  32616. let ulUnicodeRange1 = 0;
  32617. let ulUnicodeRange2 = 0;
  32618. let ulUnicodeRange3 = 0;
  32619. let ulUnicodeRange4 = 0;
  32620. let firstCharIndex = null;
  32621. let lastCharIndex = 0;
  32622. if (charstrings) {
  32623. for (let code in charstrings) {
  32624. code |= 0;
  32625. if (firstCharIndex > code || !firstCharIndex) {
  32626. firstCharIndex = code;
  32627. }
  32628. if (lastCharIndex < code) {
  32629. lastCharIndex = code;
  32630. }
  32631. const position = (0, _unicode.getUnicodeRangeFor)(code);
  32632. if (position < 32) {
  32633. ulUnicodeRange1 |= 1 << position;
  32634. } else if (position < 64) {
  32635. ulUnicodeRange2 |= 1 << position - 32;
  32636. } else if (position < 96) {
  32637. ulUnicodeRange3 |= 1 << position - 64;
  32638. } else if (position < 123) {
  32639. ulUnicodeRange4 |= 1 << position - 96;
  32640. } else {
  32641. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  32642. }
  32643. }
  32644. if (lastCharIndex > 0xffff) {
  32645. lastCharIndex = 0xffff;
  32646. }
  32647. } else {
  32648. firstCharIndex = 0;
  32649. lastCharIndex = 255;
  32650. }
  32651. const bbox = properties.bbox || [0, 0, 0, 0];
  32652. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  32653. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  32654. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  32655. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  32656. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  32657. typoDescent = -typoDescent;
  32658. }
  32659. const winAscent = override.yMax || typoAscent;
  32660. const winDescent = -override.yMin || -typoDescent;
  32661. 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";
  32662. }
  32663. function createPostTable(properties) {
  32664. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  32665. 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";
  32666. }
  32667. function createPostscriptName(name) {
  32668. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  32669. }
  32670. function createNameTable(name, proto) {
  32671. if (!proto) {
  32672. proto = [[], []];
  32673. }
  32674. 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"];
  32675. const stringsUnicode = [];
  32676. let i, ii, j, jj, str;
  32677. for (i = 0, ii = strings.length; i < ii; i++) {
  32678. str = proto[1][i] || strings[i];
  32679. const strBufUnicode = [];
  32680. for (j = 0, jj = str.length; j < jj; j++) {
  32681. strBufUnicode.push(string16(str.charCodeAt(j)));
  32682. }
  32683. stringsUnicode.push(strBufUnicode.join(""));
  32684. }
  32685. const names = [strings, stringsUnicode];
  32686. const platforms = ["\x00\x01", "\x00\x03"];
  32687. const encodings = ["\x00\x00", "\x00\x01"];
  32688. const languages = ["\x00\x00", "\x04\x09"];
  32689. const namesRecordCount = strings.length * platforms.length;
  32690. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  32691. let strOffset = 0;
  32692. for (i = 0, ii = platforms.length; i < ii; i++) {
  32693. const strs = names[i];
  32694. for (j = 0, jj = strs.length; j < jj; j++) {
  32695. str = strs[j];
  32696. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  32697. nameTable += nameRecord;
  32698. strOffset += str.length;
  32699. }
  32700. }
  32701. nameTable += strings.join("") + stringsUnicode.join("");
  32702. return nameTable;
  32703. }
  32704. class Font {
  32705. constructor(name, file, properties) {
  32706. this.name = name;
  32707. this.psName = null;
  32708. this.mimetype = null;
  32709. this.disableFontFace = false;
  32710. this.loadedName = properties.loadedName;
  32711. this.isType3Font = properties.isType3Font;
  32712. this.missingFile = false;
  32713. this.cssFontInfo = properties.cssFontInfo;
  32714. this._charsCache = Object.create(null);
  32715. this._glyphCache = Object.create(null);
  32716. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  32717. if (!isSerifFont && !properties.isSimulatedFlags) {
  32718. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  32719. serifFonts = (0, _standard_fonts.getSerifFonts)();
  32720. for (const namePart of baseName.split("+")) {
  32721. if (serifFonts[namePart]) {
  32722. isSerifFont = true;
  32723. break;
  32724. }
  32725. }
  32726. }
  32727. this.isSerifFont = isSerifFont;
  32728. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  32729. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  32730. let type = properties.type;
  32731. let subtype = properties.subtype;
  32732. this.type = type;
  32733. this.subtype = subtype;
  32734. let fallbackName = "sans-serif";
  32735. if (this.isMonospace) {
  32736. fallbackName = "monospace";
  32737. } else if (this.isSerifFont) {
  32738. fallbackName = "serif";
  32739. }
  32740. this.fallbackName = fallbackName;
  32741. this.differences = properties.differences;
  32742. this.widths = properties.widths;
  32743. this.defaultWidth = properties.defaultWidth;
  32744. this.composite = properties.composite;
  32745. this.cMap = properties.cMap;
  32746. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  32747. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  32748. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  32749. this.lineHeight = this.ascent - this.descent;
  32750. this.fontMatrix = properties.fontMatrix;
  32751. this.bbox = properties.bbox;
  32752. this.defaultEncoding = properties.defaultEncoding;
  32753. this.toUnicode = properties.toUnicode;
  32754. this.toFontChar = [];
  32755. if (properties.type === "Type3") {
  32756. for (let charCode = 0; charCode < 256; charCode++) {
  32757. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  32758. }
  32759. this.fontType = _util.FontType.TYPE3;
  32760. return;
  32761. }
  32762. this.cidEncoding = properties.cidEncoding || "";
  32763. this.vertical = !!properties.vertical;
  32764. if (this.vertical) {
  32765. this.vmetrics = properties.vmetrics;
  32766. this.defaultVMetrics = properties.defaultVMetrics;
  32767. }
  32768. if (!file || file.isEmpty) {
  32769. if (file) {
  32770. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  32771. }
  32772. this.fallbackToSystemFont(properties);
  32773. return;
  32774. }
  32775. [type, subtype] = getFontFileType(file, properties);
  32776. if (type !== this.type || subtype !== this.subtype) {
  32777. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  32778. }
  32779. let data;
  32780. try {
  32781. switch (type) {
  32782. case "MMType1":
  32783. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  32784. case "Type1":
  32785. case "CIDFontType0":
  32786. this.mimetype = "font/opentype";
  32787. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  32788. adjustWidths(properties);
  32789. data = this.convert(name, cff, properties);
  32790. break;
  32791. case "OpenType":
  32792. case "TrueType":
  32793. case "CIDFontType2":
  32794. this.mimetype = "font/opentype";
  32795. data = this.checkAndRepair(name, file, properties);
  32796. if (this.isOpenType) {
  32797. adjustWidths(properties);
  32798. type = "OpenType";
  32799. }
  32800. break;
  32801. default:
  32802. throw new _util.FormatError(`Font ${type} is not supported`);
  32803. }
  32804. } catch (e) {
  32805. (0, _util.warn)(e);
  32806. this.fallbackToSystemFont(properties);
  32807. return;
  32808. }
  32809. amendFallbackToUnicode(properties);
  32810. this.data = data;
  32811. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  32812. this.fontMatrix = properties.fontMatrix;
  32813. this.widths = properties.widths;
  32814. this.defaultWidth = properties.defaultWidth;
  32815. this.toUnicode = properties.toUnicode;
  32816. this.seacMap = properties.seacMap;
  32817. }
  32818. get renderer() {
  32819. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  32820. return (0, _util.shadow)(this, "renderer", renderer);
  32821. }
  32822. exportData(extraProperties = false) {
  32823. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  32824. const data = Object.create(null);
  32825. let property, value;
  32826. for (property of exportDataProperties) {
  32827. value = this[property];
  32828. if (value !== undefined) {
  32829. data[property] = value;
  32830. }
  32831. }
  32832. return data;
  32833. }
  32834. fallbackToSystemFont(properties) {
  32835. this.missingFile = true;
  32836. const name = this.name;
  32837. const type = this.type;
  32838. const subtype = this.subtype;
  32839. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  32840. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  32841. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  32842. const isStandardFont = !!stdFontMap[fontName];
  32843. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  32844. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  32845. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  32846. const metrics = fontBasicMetricsMap[fontName];
  32847. if (metrics) {
  32848. if (isNaN(this.ascent)) {
  32849. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  32850. }
  32851. if (isNaN(this.descent)) {
  32852. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  32853. }
  32854. if (isNaN(this.capHeight)) {
  32855. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  32856. }
  32857. }
  32858. this.bold = fontName.search(/bold/gi) !== -1;
  32859. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  32860. this.black = name.search(/Black/g) !== -1;
  32861. const isNarrow = name.search(/Narrow/g) !== -1;
  32862. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  32863. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  32864. const cidToGidMap = properties.cidToGidMap;
  32865. const map = [];
  32866. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  32867. if (/Arial-?Black/i.test(name)) {
  32868. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  32869. } else if (/Calibri/i.test(name)) {
  32870. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  32871. }
  32872. if (cidToGidMap) {
  32873. for (const charCode in map) {
  32874. const cid = map[charCode];
  32875. if (cidToGidMap[cid] !== undefined) {
  32876. map[+charCode] = cidToGidMap[cid];
  32877. }
  32878. }
  32879. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32880. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32881. const cid = map[charCode];
  32882. if (cidToGidMap[cid] === undefined) {
  32883. map[+charCode] = unicodeCharCode;
  32884. }
  32885. });
  32886. }
  32887. }
  32888. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  32889. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32890. map[+charCode] = unicodeCharCode;
  32891. });
  32892. }
  32893. this.toFontChar = map;
  32894. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  32895. } else if (/Symbol/i.test(fontName)) {
  32896. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  32897. } else if (/Dingbats/i.test(fontName)) {
  32898. if (/Wingdings/i.test(name)) {
  32899. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  32900. }
  32901. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  32902. } else if (isStandardFont) {
  32903. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  32904. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  32905. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32906. map[+charCode] = unicodeCharCode;
  32907. });
  32908. }
  32909. this.toFontChar = map;
  32910. } else {
  32911. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32912. const map = [];
  32913. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  32914. if (!this.composite) {
  32915. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  32916. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32917. if (unicode !== -1) {
  32918. unicodeCharCode = unicode;
  32919. }
  32920. }
  32921. map[+charCode] = unicodeCharCode;
  32922. });
  32923. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32924. if (/Verdana/i.test(name)) {
  32925. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  32926. }
  32927. }
  32928. this.toFontChar = map;
  32929. }
  32930. amendFallbackToUnicode(properties);
  32931. this.loadedName = fontName.split("-")[0];
  32932. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  32933. }
  32934. checkAndRepair(name, font, properties) {
  32935. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  32936. function readTables(file, numTables) {
  32937. const tables = Object.create(null);
  32938. tables["OS/2"] = null;
  32939. tables.cmap = null;
  32940. tables.head = null;
  32941. tables.hhea = null;
  32942. tables.hmtx = null;
  32943. tables.maxp = null;
  32944. tables.name = null;
  32945. tables.post = null;
  32946. for (let i = 0; i < numTables; i++) {
  32947. const table = readTableEntry(file);
  32948. if (!VALID_TABLES.includes(table.tag)) {
  32949. continue;
  32950. }
  32951. if (table.length === 0) {
  32952. continue;
  32953. }
  32954. tables[table.tag] = table;
  32955. }
  32956. return tables;
  32957. }
  32958. function readTableEntry(file) {
  32959. const tag = file.getString(4);
  32960. const checksum = file.getInt32() >>> 0;
  32961. const offset = file.getInt32() >>> 0;
  32962. const length = file.getInt32() >>> 0;
  32963. const previousPosition = file.pos;
  32964. file.pos = file.start ? file.start : 0;
  32965. file.skip(offset);
  32966. const data = file.getBytes(length);
  32967. file.pos = previousPosition;
  32968. if (tag === "head") {
  32969. data[8] = data[9] = data[10] = data[11] = 0;
  32970. data[17] |= 0x20;
  32971. }
  32972. return {
  32973. tag,
  32974. checksum,
  32975. length,
  32976. offset,
  32977. data
  32978. };
  32979. }
  32980. function readOpenTypeHeader(ttf) {
  32981. return {
  32982. version: ttf.getString(4),
  32983. numTables: ttf.getUint16(),
  32984. searchRange: ttf.getUint16(),
  32985. entrySelector: ttf.getUint16(),
  32986. rangeShift: ttf.getUint16()
  32987. };
  32988. }
  32989. function readTrueTypeCollectionHeader(ttc) {
  32990. const ttcTag = ttc.getString(4);
  32991. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  32992. const majorVersion = ttc.getUint16();
  32993. const minorVersion = ttc.getUint16();
  32994. const numFonts = ttc.getInt32() >>> 0;
  32995. const offsetTable = [];
  32996. for (let i = 0; i < numFonts; i++) {
  32997. offsetTable.push(ttc.getInt32() >>> 0);
  32998. }
  32999. const header = {
  33000. ttcTag,
  33001. majorVersion,
  33002. minorVersion,
  33003. numFonts,
  33004. offsetTable
  33005. };
  33006. switch (majorVersion) {
  33007. case 1:
  33008. return header;
  33009. case 2:
  33010. header.dsigTag = ttc.getInt32() >>> 0;
  33011. header.dsigLength = ttc.getInt32() >>> 0;
  33012. header.dsigOffset = ttc.getInt32() >>> 0;
  33013. return header;
  33014. }
  33015. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  33016. }
  33017. function readTrueTypeCollectionData(ttc, fontName) {
  33018. const {
  33019. numFonts,
  33020. offsetTable
  33021. } = readTrueTypeCollectionHeader(ttc);
  33022. const fontNameParts = fontName.split("+");
  33023. let fallbackData;
  33024. for (let i = 0; i < numFonts; i++) {
  33025. ttc.pos = (ttc.start || 0) + offsetTable[i];
  33026. const potentialHeader = readOpenTypeHeader(ttc);
  33027. const potentialTables = readTables(ttc, potentialHeader.numTables);
  33028. if (!potentialTables.name) {
  33029. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  33030. }
  33031. const nameTable = readNameTable(potentialTables.name);
  33032. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  33033. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  33034. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  33035. if (!nameEntry) {
  33036. continue;
  33037. }
  33038. if (nameEntry === fontName) {
  33039. return {
  33040. header: potentialHeader,
  33041. tables: potentialTables
  33042. };
  33043. }
  33044. if (fontNameParts.length < 2) {
  33045. continue;
  33046. }
  33047. for (const part of fontNameParts) {
  33048. if (nameEntry === part) {
  33049. fallbackData = {
  33050. name: part,
  33051. header: potentialHeader,
  33052. tables: potentialTables
  33053. };
  33054. }
  33055. }
  33056. }
  33057. }
  33058. }
  33059. if (fallbackData) {
  33060. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  33061. return {
  33062. header: fallbackData.header,
  33063. tables: fallbackData.tables
  33064. };
  33065. }
  33066. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  33067. }
  33068. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  33069. if (!cmap) {
  33070. (0, _util.warn)("No cmap table available.");
  33071. return {
  33072. platformId: -1,
  33073. encodingId: -1,
  33074. mappings: [],
  33075. hasShortCmap: false
  33076. };
  33077. }
  33078. let segment;
  33079. let start = (file.start ? file.start : 0) + cmap.offset;
  33080. file.pos = start;
  33081. file.skip(2);
  33082. const numTables = file.getUint16();
  33083. let potentialTable;
  33084. let canBreak = false;
  33085. for (let i = 0; i < numTables; i++) {
  33086. const platformId = file.getUint16();
  33087. const encodingId = file.getUint16();
  33088. const offset = file.getInt32() >>> 0;
  33089. let useTable = false;
  33090. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  33091. continue;
  33092. }
  33093. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  33094. useTable = true;
  33095. } else if (platformId === 1 && encodingId === 0) {
  33096. useTable = true;
  33097. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  33098. useTable = true;
  33099. if (!isSymbolicFont) {
  33100. canBreak = true;
  33101. }
  33102. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  33103. useTable = true;
  33104. let correctlySorted = true;
  33105. if (i < numTables - 1) {
  33106. const nextBytes = file.peekBytes(2),
  33107. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  33108. if (nextPlatformId < platformId) {
  33109. correctlySorted = false;
  33110. }
  33111. }
  33112. if (correctlySorted) {
  33113. canBreak = true;
  33114. }
  33115. }
  33116. if (useTable) {
  33117. potentialTable = {
  33118. platformId,
  33119. encodingId,
  33120. offset
  33121. };
  33122. }
  33123. if (canBreak) {
  33124. break;
  33125. }
  33126. }
  33127. if (potentialTable) {
  33128. file.pos = start + potentialTable.offset;
  33129. }
  33130. if (!potentialTable || file.peekByte() === -1) {
  33131. (0, _util.warn)("Could not find a preferred cmap table.");
  33132. return {
  33133. platformId: -1,
  33134. encodingId: -1,
  33135. mappings: [],
  33136. hasShortCmap: false
  33137. };
  33138. }
  33139. const format = file.getUint16();
  33140. file.skip(2 + 2);
  33141. let hasShortCmap = false;
  33142. const mappings = [];
  33143. let j, glyphId;
  33144. if (format === 0) {
  33145. for (j = 0; j < 256; j++) {
  33146. const index = file.getByte();
  33147. if (!index) {
  33148. continue;
  33149. }
  33150. mappings.push({
  33151. charCode: j,
  33152. glyphId: index
  33153. });
  33154. }
  33155. hasShortCmap = true;
  33156. } else if (format === 2) {
  33157. const subHeaderKeys = [];
  33158. let maxSubHeaderKey = 0;
  33159. for (let i = 0; i < 256; i++) {
  33160. const subHeaderKey = file.getUint16() >> 3;
  33161. subHeaderKeys.push(subHeaderKey);
  33162. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  33163. }
  33164. const subHeaders = [];
  33165. for (let i = 0; i <= maxSubHeaderKey; i++) {
  33166. subHeaders.push({
  33167. firstCode: file.getUint16(),
  33168. entryCount: file.getUint16(),
  33169. idDelta: signedInt16(file.getByte(), file.getByte()),
  33170. idRangePos: file.pos + file.getUint16()
  33171. });
  33172. }
  33173. for (let i = 0; i < 256; i++) {
  33174. if (subHeaderKeys[i] === 0) {
  33175. file.pos = subHeaders[0].idRangePos + 2 * i;
  33176. glyphId = file.getUint16();
  33177. mappings.push({
  33178. charCode: i,
  33179. glyphId
  33180. });
  33181. } else {
  33182. const s = subHeaders[subHeaderKeys[i]];
  33183. for (j = 0; j < s.entryCount; j++) {
  33184. const charCode = (i << 8) + j + s.firstCode;
  33185. file.pos = s.idRangePos + 2 * j;
  33186. glyphId = file.getUint16();
  33187. if (glyphId !== 0) {
  33188. glyphId = (glyphId + s.idDelta) % 65536;
  33189. }
  33190. mappings.push({
  33191. charCode,
  33192. glyphId
  33193. });
  33194. }
  33195. }
  33196. }
  33197. } else if (format === 4) {
  33198. const segCount = file.getUint16() >> 1;
  33199. file.skip(6);
  33200. const segments = [];
  33201. let segIndex;
  33202. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33203. segments.push({
  33204. end: file.getUint16()
  33205. });
  33206. }
  33207. file.skip(2);
  33208. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33209. segments[segIndex].start = file.getUint16();
  33210. }
  33211. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33212. segments[segIndex].delta = file.getUint16();
  33213. }
  33214. let offsetsCount = 0,
  33215. offsetIndex;
  33216. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33217. segment = segments[segIndex];
  33218. const rangeOffset = file.getUint16();
  33219. if (!rangeOffset) {
  33220. segment.offsetIndex = -1;
  33221. continue;
  33222. }
  33223. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  33224. segment.offsetIndex = offsetIndex;
  33225. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  33226. }
  33227. const offsets = [];
  33228. for (j = 0; j < offsetsCount; j++) {
  33229. offsets.push(file.getUint16());
  33230. }
  33231. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33232. segment = segments[segIndex];
  33233. start = segment.start;
  33234. const end = segment.end;
  33235. const delta = segment.delta;
  33236. offsetIndex = segment.offsetIndex;
  33237. for (j = start; j <= end; j++) {
  33238. if (j === 0xffff) {
  33239. continue;
  33240. }
  33241. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  33242. glyphId = glyphId + delta & 0xffff;
  33243. mappings.push({
  33244. charCode: j,
  33245. glyphId
  33246. });
  33247. }
  33248. }
  33249. } else if (format === 6) {
  33250. const firstCode = file.getUint16();
  33251. const entryCount = file.getUint16();
  33252. for (j = 0; j < entryCount; j++) {
  33253. glyphId = file.getUint16();
  33254. const charCode = firstCode + j;
  33255. mappings.push({
  33256. charCode,
  33257. glyphId
  33258. });
  33259. }
  33260. } else {
  33261. (0, _util.warn)("cmap table has unsupported format: " + format);
  33262. return {
  33263. platformId: -1,
  33264. encodingId: -1,
  33265. mappings: [],
  33266. hasShortCmap: false
  33267. };
  33268. }
  33269. mappings.sort(function (a, b) {
  33270. return a.charCode - b.charCode;
  33271. });
  33272. for (let i = 1; i < mappings.length; i++) {
  33273. if (mappings[i - 1].charCode === mappings[i].charCode) {
  33274. mappings.splice(i, 1);
  33275. i--;
  33276. }
  33277. }
  33278. return {
  33279. platformId: potentialTable.platformId,
  33280. encodingId: potentialTable.encodingId,
  33281. mappings,
  33282. hasShortCmap
  33283. };
  33284. }
  33285. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  33286. if (!header) {
  33287. if (metrics) {
  33288. metrics.data = null;
  33289. }
  33290. return;
  33291. }
  33292. file.pos = (file.start ? file.start : 0) + header.offset;
  33293. file.pos += 4;
  33294. file.pos += 2;
  33295. file.pos += 2;
  33296. file.pos += 2;
  33297. file.pos += 2;
  33298. file.pos += 2;
  33299. file.pos += 2;
  33300. file.pos += 2;
  33301. file.pos += 2;
  33302. file.pos += 2;
  33303. const caretOffset = file.getUint16();
  33304. file.pos += 8;
  33305. file.pos += 2;
  33306. let numOfMetrics = file.getUint16();
  33307. if (caretOffset !== 0) {
  33308. const macStyle = int16(headTable.data[44], headTable.data[45]);
  33309. if (!(macStyle & 2)) {
  33310. header.data[22] = 0;
  33311. header.data[23] = 0;
  33312. }
  33313. }
  33314. if (numOfMetrics > numGlyphs) {
  33315. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  33316. numOfMetrics = numGlyphs;
  33317. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  33318. header.data[35] = numOfMetrics & 0x00ff;
  33319. }
  33320. const numOfSidebearings = numGlyphs - numOfMetrics;
  33321. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  33322. if (numMissing > 0) {
  33323. const entries = new Uint8Array(metrics.length + numMissing * 2);
  33324. entries.set(metrics.data);
  33325. if (dupFirstEntry) {
  33326. entries[metrics.length] = metrics.data[2];
  33327. entries[metrics.length + 1] = metrics.data[3];
  33328. }
  33329. metrics.data = entries;
  33330. }
  33331. }
  33332. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  33333. const glyphProfile = {
  33334. length: 0,
  33335. sizeOfInstructions: 0
  33336. };
  33337. if (sourceEnd - sourceStart <= 12) {
  33338. return glyphProfile;
  33339. }
  33340. const glyf = source.subarray(sourceStart, sourceEnd);
  33341. let contoursCount = signedInt16(glyf[0], glyf[1]);
  33342. if (contoursCount < 0) {
  33343. contoursCount = -1;
  33344. writeSignedInt16(glyf, 0, contoursCount);
  33345. dest.set(glyf, destStart);
  33346. glyphProfile.length = glyf.length;
  33347. return glyphProfile;
  33348. }
  33349. let i,
  33350. j = 10,
  33351. flagsCount = 0;
  33352. for (i = 0; i < contoursCount; i++) {
  33353. const endPoint = glyf[j] << 8 | glyf[j + 1];
  33354. flagsCount = endPoint + 1;
  33355. j += 2;
  33356. }
  33357. const instructionsStart = j;
  33358. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  33359. glyphProfile.sizeOfInstructions = instructionsLength;
  33360. j += 2 + instructionsLength;
  33361. const instructionsEnd = j;
  33362. let coordinatesLength = 0;
  33363. for (i = 0; i < flagsCount; i++) {
  33364. const flag = glyf[j++];
  33365. if (flag & 0xc0) {
  33366. glyf[j - 1] = flag & 0x3f;
  33367. }
  33368. let xLength = 2;
  33369. if (flag & 2) {
  33370. xLength = 1;
  33371. } else if (flag & 16) {
  33372. xLength = 0;
  33373. }
  33374. let yLength = 2;
  33375. if (flag & 4) {
  33376. yLength = 1;
  33377. } else if (flag & 32) {
  33378. yLength = 0;
  33379. }
  33380. const xyLength = xLength + yLength;
  33381. coordinatesLength += xyLength;
  33382. if (flag & 8) {
  33383. const repeat = glyf[j++];
  33384. i += repeat;
  33385. coordinatesLength += repeat * xyLength;
  33386. }
  33387. }
  33388. if (coordinatesLength === 0) {
  33389. return glyphProfile;
  33390. }
  33391. let glyphDataLength = j + coordinatesLength;
  33392. if (glyphDataLength > glyf.length) {
  33393. return glyphProfile;
  33394. }
  33395. if (!hintsValid && instructionsLength > 0) {
  33396. dest.set(glyf.subarray(0, instructionsStart), destStart);
  33397. dest.set([0, 0], destStart + instructionsStart);
  33398. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  33399. glyphDataLength -= instructionsLength;
  33400. if (glyf.length - glyphDataLength > 3) {
  33401. glyphDataLength = glyphDataLength + 3 & ~3;
  33402. }
  33403. glyphProfile.length = glyphDataLength;
  33404. return glyphProfile;
  33405. }
  33406. if (glyf.length - glyphDataLength > 3) {
  33407. glyphDataLength = glyphDataLength + 3 & ~3;
  33408. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  33409. glyphProfile.length = glyphDataLength;
  33410. return glyphProfile;
  33411. }
  33412. dest.set(glyf, destStart);
  33413. glyphProfile.length = glyf.length;
  33414. return glyphProfile;
  33415. }
  33416. function sanitizeHead(head, numGlyphs, locaLength) {
  33417. const data = head.data;
  33418. const version = int32(data[0], data[1], data[2], data[3]);
  33419. if (version >> 16 !== 1) {
  33420. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  33421. data[0] = 0;
  33422. data[1] = 1;
  33423. data[2] = 0;
  33424. data[3] = 0;
  33425. }
  33426. const indexToLocFormat = int16(data[50], data[51]);
  33427. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  33428. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  33429. const numGlyphsPlusOne = numGlyphs + 1;
  33430. if (locaLength === numGlyphsPlusOne << 1) {
  33431. data[50] = 0;
  33432. data[51] = 0;
  33433. } else if (locaLength === numGlyphsPlusOne << 2) {
  33434. data[50] = 0;
  33435. data[51] = 1;
  33436. } else {
  33437. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  33438. }
  33439. }
  33440. }
  33441. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  33442. let itemSize, itemDecode, itemEncode;
  33443. if (isGlyphLocationsLong) {
  33444. itemSize = 4;
  33445. itemDecode = function fontItemDecodeLong(data, offset) {
  33446. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  33447. };
  33448. itemEncode = function fontItemEncodeLong(data, offset, value) {
  33449. data[offset] = value >>> 24 & 0xff;
  33450. data[offset + 1] = value >> 16 & 0xff;
  33451. data[offset + 2] = value >> 8 & 0xff;
  33452. data[offset + 3] = value & 0xff;
  33453. };
  33454. } else {
  33455. itemSize = 2;
  33456. itemDecode = function fontItemDecode(data, offset) {
  33457. return data[offset] << 9 | data[offset + 1] << 1;
  33458. };
  33459. itemEncode = function fontItemEncode(data, offset, value) {
  33460. data[offset] = value >> 9 & 0xff;
  33461. data[offset + 1] = value >> 1 & 0xff;
  33462. };
  33463. }
  33464. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  33465. const locaDataSize = itemSize * (1 + numGlyphsOut);
  33466. const locaData = new Uint8Array(locaDataSize);
  33467. locaData.set(loca.data.subarray(0, locaDataSize));
  33468. loca.data = locaData;
  33469. const oldGlyfData = glyf.data;
  33470. const oldGlyfDataLength = oldGlyfData.length;
  33471. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  33472. let i, j;
  33473. const locaEntries = [];
  33474. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  33475. let offset = itemDecode(locaData, j);
  33476. if (offset > oldGlyfDataLength) {
  33477. offset = oldGlyfDataLength;
  33478. }
  33479. locaEntries.push({
  33480. index: i,
  33481. offset,
  33482. endOffset: 0
  33483. });
  33484. }
  33485. locaEntries.sort((a, b) => {
  33486. return a.offset - b.offset;
  33487. });
  33488. for (i = 0; i < numGlyphs; i++) {
  33489. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  33490. }
  33491. locaEntries.sort((a, b) => {
  33492. return a.index - b.index;
  33493. });
  33494. const missingGlyphs = Object.create(null);
  33495. let writeOffset = 0;
  33496. itemEncode(locaData, 0, writeOffset);
  33497. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  33498. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  33499. const newLength = glyphProfile.length;
  33500. if (newLength === 0) {
  33501. missingGlyphs[i] = true;
  33502. }
  33503. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  33504. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  33505. }
  33506. writeOffset += newLength;
  33507. itemEncode(locaData, j, writeOffset);
  33508. }
  33509. if (writeOffset === 0) {
  33510. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  33511. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  33512. itemEncode(locaData, j, simpleGlyph.length);
  33513. }
  33514. glyf.data = simpleGlyph;
  33515. } else if (dupFirstEntry) {
  33516. const firstEntryLength = itemDecode(locaData, itemSize);
  33517. if (newGlyfData.length > firstEntryLength + writeOffset) {
  33518. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  33519. } else {
  33520. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  33521. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  33522. }
  33523. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  33524. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  33525. } else {
  33526. glyf.data = newGlyfData.subarray(0, writeOffset);
  33527. }
  33528. return {
  33529. missingGlyphs,
  33530. maxSizeOfInstructions
  33531. };
  33532. }
  33533. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  33534. const start = (font.start ? font.start : 0) + post.offset;
  33535. font.pos = start;
  33536. const length = post.length,
  33537. end = start + length;
  33538. const version = font.getInt32();
  33539. font.skip(28);
  33540. let glyphNames;
  33541. let valid = true;
  33542. let i;
  33543. switch (version) {
  33544. case 0x00010000:
  33545. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  33546. break;
  33547. case 0x00020000:
  33548. const numGlyphs = font.getUint16();
  33549. if (numGlyphs !== maxpNumGlyphs) {
  33550. valid = false;
  33551. break;
  33552. }
  33553. const glyphNameIndexes = [];
  33554. for (i = 0; i < numGlyphs; ++i) {
  33555. const index = font.getUint16();
  33556. if (index >= 32768) {
  33557. valid = false;
  33558. break;
  33559. }
  33560. glyphNameIndexes.push(index);
  33561. }
  33562. if (!valid) {
  33563. break;
  33564. }
  33565. const customNames = [],
  33566. strBuf = [];
  33567. while (font.pos < end) {
  33568. const stringLength = font.getByte();
  33569. strBuf.length = stringLength;
  33570. for (i = 0; i < stringLength; ++i) {
  33571. strBuf[i] = String.fromCharCode(font.getByte());
  33572. }
  33573. customNames.push(strBuf.join(""));
  33574. }
  33575. glyphNames = [];
  33576. for (i = 0; i < numGlyphs; ++i) {
  33577. const j = glyphNameIndexes[i];
  33578. if (j < 258) {
  33579. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  33580. continue;
  33581. }
  33582. glyphNames.push(customNames[j - 258]);
  33583. }
  33584. break;
  33585. case 0x00030000:
  33586. break;
  33587. default:
  33588. (0, _util.warn)("Unknown/unsupported post table version " + version);
  33589. valid = false;
  33590. if (propertiesObj.defaultEncoding) {
  33591. glyphNames = propertiesObj.defaultEncoding;
  33592. }
  33593. break;
  33594. }
  33595. propertiesObj.glyphNames = glyphNames;
  33596. return valid;
  33597. }
  33598. function readNameTable(nameTable) {
  33599. const start = (font.start ? font.start : 0) + nameTable.offset;
  33600. font.pos = start;
  33601. const names = [[], []];
  33602. const length = nameTable.length,
  33603. end = start + length;
  33604. const format = font.getUint16();
  33605. const FORMAT_0_HEADER_LENGTH = 6;
  33606. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  33607. return names;
  33608. }
  33609. const numRecords = font.getUint16();
  33610. const stringsStart = font.getUint16();
  33611. const records = [];
  33612. const NAME_RECORD_LENGTH = 12;
  33613. let i, ii;
  33614. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  33615. const r = {
  33616. platform: font.getUint16(),
  33617. encoding: font.getUint16(),
  33618. language: font.getUint16(),
  33619. name: font.getUint16(),
  33620. length: font.getUint16(),
  33621. offset: font.getUint16()
  33622. };
  33623. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  33624. records.push(r);
  33625. }
  33626. }
  33627. for (i = 0, ii = records.length; i < ii; i++) {
  33628. const record = records[i];
  33629. if (record.length <= 0) {
  33630. continue;
  33631. }
  33632. const pos = start + stringsStart + record.offset;
  33633. if (pos + record.length > end) {
  33634. continue;
  33635. }
  33636. font.pos = pos;
  33637. const nameIndex = record.name;
  33638. if (record.encoding) {
  33639. let str = "";
  33640. for (let j = 0, jj = record.length; j < jj; j += 2) {
  33641. str += String.fromCharCode(font.getUint16());
  33642. }
  33643. names[1][nameIndex] = str;
  33644. } else {
  33645. names[0][nameIndex] = font.getString(record.length);
  33646. }
  33647. }
  33648. return names;
  33649. }
  33650. 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];
  33651. function sanitizeTTProgram(table, ttContext) {
  33652. let data = table.data;
  33653. let i = 0,
  33654. j,
  33655. n,
  33656. b,
  33657. funcId,
  33658. pc,
  33659. lastEndf = 0,
  33660. lastDeff = 0;
  33661. const stack = [];
  33662. const callstack = [];
  33663. const functionsCalled = [];
  33664. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  33665. let inFDEF = false,
  33666. ifLevel = 0,
  33667. inELSE = 0;
  33668. for (let ii = data.length; i < ii;) {
  33669. const op = data[i++];
  33670. if (op === 0x40) {
  33671. n = data[i++];
  33672. if (inFDEF || inELSE) {
  33673. i += n;
  33674. } else {
  33675. for (j = 0; j < n; j++) {
  33676. stack.push(data[i++]);
  33677. }
  33678. }
  33679. } else if (op === 0x41) {
  33680. n = data[i++];
  33681. if (inFDEF || inELSE) {
  33682. i += n * 2;
  33683. } else {
  33684. for (j = 0; j < n; j++) {
  33685. b = data[i++];
  33686. stack.push(b << 8 | data[i++]);
  33687. }
  33688. }
  33689. } else if ((op & 0xf8) === 0xb0) {
  33690. n = op - 0xb0 + 1;
  33691. if (inFDEF || inELSE) {
  33692. i += n;
  33693. } else {
  33694. for (j = 0; j < n; j++) {
  33695. stack.push(data[i++]);
  33696. }
  33697. }
  33698. } else if ((op & 0xf8) === 0xb8) {
  33699. n = op - 0xb8 + 1;
  33700. if (inFDEF || inELSE) {
  33701. i += n * 2;
  33702. } else {
  33703. for (j = 0; j < n; j++) {
  33704. b = data[i++];
  33705. stack.push(b << 8 | data[i++]);
  33706. }
  33707. }
  33708. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  33709. if (!inFDEF && !inELSE) {
  33710. funcId = stack[stack.length - 1];
  33711. if (isNaN(funcId)) {
  33712. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  33713. } else {
  33714. ttContext.functionsUsed[funcId] = true;
  33715. if (funcId in ttContext.functionsStackDeltas) {
  33716. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  33717. if (newStackLength < 0) {
  33718. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  33719. ttContext.hintsValid = false;
  33720. return;
  33721. }
  33722. stack.length = newStackLength;
  33723. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  33724. callstack.push({
  33725. data,
  33726. i,
  33727. stackTop: stack.length - 1
  33728. });
  33729. functionsCalled.push(funcId);
  33730. pc = ttContext.functionsDefined[funcId];
  33731. if (!pc) {
  33732. (0, _util.warn)("TT: CALL non-existent function");
  33733. ttContext.hintsValid = false;
  33734. return;
  33735. }
  33736. data = pc.data;
  33737. i = pc.i;
  33738. }
  33739. }
  33740. }
  33741. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  33742. if (inFDEF || inELSE) {
  33743. (0, _util.warn)("TT: nested FDEFs not allowed");
  33744. tooComplexToFollowFunctions = true;
  33745. }
  33746. inFDEF = true;
  33747. lastDeff = i;
  33748. funcId = stack.pop();
  33749. ttContext.functionsDefined[funcId] = {
  33750. data,
  33751. i
  33752. };
  33753. } else if (op === 0x2d) {
  33754. if (inFDEF) {
  33755. inFDEF = false;
  33756. lastEndf = i;
  33757. } else {
  33758. pc = callstack.pop();
  33759. if (!pc) {
  33760. (0, _util.warn)("TT: ENDF bad stack");
  33761. ttContext.hintsValid = false;
  33762. return;
  33763. }
  33764. funcId = functionsCalled.pop();
  33765. data = pc.data;
  33766. i = pc.i;
  33767. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  33768. }
  33769. } else if (op === 0x89) {
  33770. if (inFDEF || inELSE) {
  33771. (0, _util.warn)("TT: nested IDEFs not allowed");
  33772. tooComplexToFollowFunctions = true;
  33773. }
  33774. inFDEF = true;
  33775. lastDeff = i;
  33776. } else if (op === 0x58) {
  33777. ++ifLevel;
  33778. } else if (op === 0x1b) {
  33779. inELSE = ifLevel;
  33780. } else if (op === 0x59) {
  33781. if (inELSE === ifLevel) {
  33782. inELSE = 0;
  33783. }
  33784. --ifLevel;
  33785. } else if (op === 0x1c) {
  33786. if (!inFDEF && !inELSE) {
  33787. const offset = stack[stack.length - 1];
  33788. if (offset > 0) {
  33789. i += offset - 1;
  33790. }
  33791. }
  33792. }
  33793. if (!inFDEF && !inELSE) {
  33794. let stackDelta = 0;
  33795. if (op <= 0x8e) {
  33796. stackDelta = TTOpsStackDeltas[op];
  33797. } else if (op >= 0xc0 && op <= 0xdf) {
  33798. stackDelta = -1;
  33799. } else if (op >= 0xe0) {
  33800. stackDelta = -2;
  33801. }
  33802. if (op >= 0x71 && op <= 0x75) {
  33803. n = stack.pop();
  33804. if (!isNaN(n)) {
  33805. stackDelta = -n * 2;
  33806. }
  33807. }
  33808. while (stackDelta < 0 && stack.length > 0) {
  33809. stack.pop();
  33810. stackDelta++;
  33811. }
  33812. while (stackDelta > 0) {
  33813. stack.push(NaN);
  33814. stackDelta--;
  33815. }
  33816. }
  33817. }
  33818. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  33819. const content = [data];
  33820. if (i > data.length) {
  33821. content.push(new Uint8Array(i - data.length));
  33822. }
  33823. if (lastDeff > lastEndf) {
  33824. (0, _util.warn)("TT: complementing a missing function tail");
  33825. content.push(new Uint8Array([0x22, 0x2d]));
  33826. }
  33827. foldTTTable(table, content);
  33828. }
  33829. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  33830. if (ttContext.tooComplexToFollowFunctions) {
  33831. return;
  33832. }
  33833. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  33834. (0, _util.warn)("TT: more functions defined than expected");
  33835. ttContext.hintsValid = false;
  33836. return;
  33837. }
  33838. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  33839. if (j > maxFunctionDefs) {
  33840. (0, _util.warn)("TT: invalid function id: " + j);
  33841. ttContext.hintsValid = false;
  33842. return;
  33843. }
  33844. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  33845. (0, _util.warn)("TT: undefined function: " + j);
  33846. ttContext.hintsValid = false;
  33847. return;
  33848. }
  33849. }
  33850. }
  33851. function foldTTTable(table, content) {
  33852. if (content.length > 1) {
  33853. let newLength = 0;
  33854. let j, jj;
  33855. for (j = 0, jj = content.length; j < jj; j++) {
  33856. newLength += content[j].length;
  33857. }
  33858. newLength = newLength + 3 & ~3;
  33859. const result = new Uint8Array(newLength);
  33860. let pos = 0;
  33861. for (j = 0, jj = content.length; j < jj; j++) {
  33862. result.set(content[j], pos);
  33863. pos += content[j].length;
  33864. }
  33865. table.data = result;
  33866. table.length = newLength;
  33867. }
  33868. }
  33869. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  33870. const ttContext = {
  33871. functionsDefined: [],
  33872. functionsUsed: [],
  33873. functionsStackDeltas: [],
  33874. tooComplexToFollowFunctions: false,
  33875. hintsValid: true
  33876. };
  33877. if (fpgm) {
  33878. sanitizeTTProgram(fpgm, ttContext);
  33879. }
  33880. if (prep) {
  33881. sanitizeTTProgram(prep, ttContext);
  33882. }
  33883. if (fpgm) {
  33884. checkInvalidFunctions(ttContext, maxFunctionDefs);
  33885. }
  33886. if (cvt && cvt.length & 1) {
  33887. const cvtData = new Uint8Array(cvt.length + 1);
  33888. cvtData.set(cvt.data);
  33889. cvt.data = cvtData;
  33890. }
  33891. return ttContext.hintsValid;
  33892. }
  33893. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  33894. let header, tables;
  33895. if (isTrueTypeCollectionFile(font)) {
  33896. const ttcData = readTrueTypeCollectionData(font, this.name);
  33897. header = ttcData.header;
  33898. tables = ttcData.tables;
  33899. } else {
  33900. header = readOpenTypeHeader(font);
  33901. tables = readTables(font, header.numTables);
  33902. }
  33903. let cff, cffFile;
  33904. const isTrueType = !tables["CFF "];
  33905. if (!isTrueType) {
  33906. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  33907. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  33908. cffFile = new _stream.Stream(tables["CFF "].data);
  33909. cff = new _cff_font.CFFFont(cffFile, properties);
  33910. adjustWidths(properties);
  33911. return this.convert(name, cff, properties);
  33912. }
  33913. delete tables.glyf;
  33914. delete tables.loca;
  33915. delete tables.fpgm;
  33916. delete tables.prep;
  33917. delete tables["cvt "];
  33918. this.isOpenType = true;
  33919. } else {
  33920. if (!tables.loca) {
  33921. throw new _util.FormatError('Required "loca" table is not found');
  33922. }
  33923. if (!tables.glyf) {
  33924. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  33925. tables.glyf = {
  33926. tag: "glyf",
  33927. data: new Uint8Array(0)
  33928. };
  33929. }
  33930. this.isOpenType = false;
  33931. }
  33932. if (!tables.maxp) {
  33933. throw new _util.FormatError('Required "maxp" table is not found');
  33934. }
  33935. font.pos = (font.start || 0) + tables.maxp.offset;
  33936. const version = font.getInt32();
  33937. const numGlyphs = font.getUint16();
  33938. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  33939. const {
  33940. scaleFactors
  33941. } = properties;
  33942. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  33943. const glyphs = new _glyf.GlyfTable({
  33944. glyfTable: tables.glyf.data,
  33945. isGlyphLocationsLong,
  33946. locaTable: tables.loca.data,
  33947. numGlyphs
  33948. });
  33949. glyphs.scale(scaleFactors);
  33950. const {
  33951. glyf,
  33952. loca,
  33953. isLocationLong
  33954. } = glyphs.write();
  33955. tables.glyf.data = glyf;
  33956. tables.loca.data = loca;
  33957. if (isLocationLong !== !!isGlyphLocationsLong) {
  33958. tables.head.data[50] = 0;
  33959. tables.head.data[51] = isLocationLong ? 1 : 0;
  33960. }
  33961. const metrics = tables.hmtx.data;
  33962. for (let i = 0; i < numGlyphs; i++) {
  33963. const j = 4 * i;
  33964. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  33965. metrics[j] = advanceWidth >> 8 & 0xff;
  33966. metrics[j + 1] = advanceWidth & 0xff;
  33967. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  33968. writeSignedInt16(metrics, j + 2, lsb);
  33969. }
  33970. }
  33971. let numGlyphsOut = numGlyphs + 1;
  33972. let dupFirstEntry = true;
  33973. if (numGlyphsOut > 0xffff) {
  33974. dupFirstEntry = false;
  33975. numGlyphsOut = numGlyphs;
  33976. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  33977. }
  33978. let maxFunctionDefs = 0;
  33979. let maxSizeOfInstructions = 0;
  33980. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  33981. font.pos += 8;
  33982. const maxZones = font.getUint16();
  33983. if (maxZones > 2) {
  33984. tables.maxp.data[14] = 0;
  33985. tables.maxp.data[15] = 2;
  33986. }
  33987. font.pos += 4;
  33988. maxFunctionDefs = font.getUint16();
  33989. font.pos += 4;
  33990. maxSizeOfInstructions = font.getUint16();
  33991. }
  33992. tables.maxp.data[4] = numGlyphsOut >> 8;
  33993. tables.maxp.data[5] = numGlyphsOut & 255;
  33994. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  33995. if (!hintsValid) {
  33996. delete tables.fpgm;
  33997. delete tables.prep;
  33998. delete tables["cvt "];
  33999. }
  34000. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  34001. if (!tables.head) {
  34002. throw new _util.FormatError('Required "head" table is not found');
  34003. }
  34004. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  34005. let missingGlyphs = Object.create(null);
  34006. if (isTrueType) {
  34007. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34008. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  34009. missingGlyphs = glyphsInfo.missingGlyphs;
  34010. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34011. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  34012. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  34013. }
  34014. }
  34015. if (!tables.hhea) {
  34016. throw new _util.FormatError('Required "hhea" table is not found');
  34017. }
  34018. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  34019. tables.hhea.data[10] = 0xff;
  34020. tables.hhea.data[11] = 0xff;
  34021. }
  34022. const metricsOverride = {
  34023. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  34024. yMax: int16(tables.head.data[42], tables.head.data[43]),
  34025. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  34026. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  34027. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  34028. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  34029. };
  34030. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  34031. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  34032. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  34033. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  34034. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  34035. this.lineGap = this.cssFontInfo.metrics.lineGap;
  34036. } else {
  34037. this.lineHeight = this.ascent - this.descent + this.lineGap;
  34038. }
  34039. if (tables.post) {
  34040. readPostScriptTable(tables.post, properties, numGlyphs);
  34041. }
  34042. tables.post = {
  34043. tag: "post",
  34044. data: createPostTable(properties)
  34045. };
  34046. const charCodeToGlyphId = [];
  34047. function hasGlyph(glyphId) {
  34048. return !missingGlyphs[glyphId];
  34049. }
  34050. if (properties.composite) {
  34051. const cidToGidMap = properties.cidToGidMap || [];
  34052. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  34053. properties.cMap.forEach(function (charCode, cid) {
  34054. if (typeof cid === "string") {
  34055. cid = convertCidString(charCode, cid, true);
  34056. }
  34057. if (cid > 0xffff) {
  34058. throw new _util.FormatError("Max size of CID is 65,535");
  34059. }
  34060. let glyphId = -1;
  34061. if (isCidToGidMapEmpty) {
  34062. glyphId = cid;
  34063. } else if (cidToGidMap[cid] !== undefined) {
  34064. glyphId = cidToGidMap[cid];
  34065. }
  34066. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  34067. charCodeToGlyphId[charCode] = glyphId;
  34068. }
  34069. });
  34070. } else {
  34071. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  34072. const cmapPlatformId = cmapTable.platformId;
  34073. const cmapEncodingId = cmapTable.encodingId;
  34074. const cmapMappings = cmapTable.mappings;
  34075. const cmapMappingsLength = cmapMappings.length;
  34076. let baseEncoding = [],
  34077. forcePostTable = false;
  34078. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  34079. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  34080. }
  34081. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  34082. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34083. for (let charCode = 0; charCode < 256; charCode++) {
  34084. let glyphName;
  34085. if (this.differences[charCode] !== undefined) {
  34086. glyphName = this.differences[charCode];
  34087. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  34088. glyphName = baseEncoding[charCode];
  34089. } else {
  34090. glyphName = _encodings.StandardEncoding[charCode];
  34091. }
  34092. if (!glyphName) {
  34093. continue;
  34094. }
  34095. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  34096. let unicodeOrCharCode;
  34097. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  34098. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  34099. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  34100. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  34101. }
  34102. if (unicodeOrCharCode === undefined) {
  34103. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  34104. const unicode = this.toUnicode.get(charCode);
  34105. if (unicode) {
  34106. unicodeOrCharCode = unicode.codePointAt(0);
  34107. }
  34108. }
  34109. if (unicodeOrCharCode === undefined) {
  34110. continue;
  34111. }
  34112. }
  34113. for (let i = 0; i < cmapMappingsLength; ++i) {
  34114. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  34115. continue;
  34116. }
  34117. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34118. break;
  34119. }
  34120. }
  34121. } else if (cmapPlatformId === 0) {
  34122. for (let i = 0; i < cmapMappingsLength; ++i) {
  34123. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  34124. }
  34125. forcePostTable = true;
  34126. } else {
  34127. for (let i = 0; i < cmapMappingsLength; ++i) {
  34128. let charCode = cmapMappings[i].charCode;
  34129. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  34130. charCode &= 0xff;
  34131. }
  34132. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34133. }
  34134. }
  34135. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  34136. for (let i = 0; i < 256; ++i) {
  34137. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  34138. continue;
  34139. }
  34140. const glyphName = this.differences[i] || baseEncoding[i];
  34141. if (!glyphName) {
  34142. continue;
  34143. }
  34144. const glyphId = properties.glyphNames.indexOf(glyphName);
  34145. if (glyphId > 0 && hasGlyph(glyphId)) {
  34146. charCodeToGlyphId[i] = glyphId;
  34147. }
  34148. }
  34149. }
  34150. }
  34151. if (charCodeToGlyphId.length === 0) {
  34152. charCodeToGlyphId[0] = 0;
  34153. }
  34154. let glyphZeroId = numGlyphsOut - 1;
  34155. if (!dupFirstEntry) {
  34156. glyphZeroId = 0;
  34157. }
  34158. if (!properties.cssFontInfo) {
  34159. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  34160. this.toFontChar = newMapping.toFontChar;
  34161. tables.cmap = {
  34162. tag: "cmap",
  34163. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  34164. };
  34165. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  34166. tables["OS/2"] = {
  34167. tag: "OS/2",
  34168. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  34169. };
  34170. }
  34171. }
  34172. if (!isTrueType) {
  34173. try {
  34174. cffFile = new _stream.Stream(tables["CFF "].data);
  34175. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  34176. cff = parser.parse();
  34177. cff.duplicateFirstGlyph();
  34178. const compiler = new _cff_parser.CFFCompiler(cff);
  34179. tables["CFF "].data = compiler.compile();
  34180. } catch (e) {
  34181. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  34182. }
  34183. }
  34184. if (!tables.name) {
  34185. tables.name = {
  34186. tag: "name",
  34187. data: createNameTable(this.name)
  34188. };
  34189. } else {
  34190. const namePrototype = readNameTable(tables.name);
  34191. tables.name.data = createNameTable(name, namePrototype);
  34192. this.psName = namePrototype[0][6] || null;
  34193. }
  34194. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  34195. for (const tableTag in tables) {
  34196. builder.addTable(tableTag, tables[tableTag].data);
  34197. }
  34198. return builder.toArray();
  34199. }
  34200. convert(fontName, font, properties) {
  34201. properties.fixedPitch = false;
  34202. if (properties.builtInEncoding) {
  34203. adjustToUnicode(properties, properties.builtInEncoding);
  34204. }
  34205. let glyphZeroId = 1;
  34206. if (font instanceof _cff_font.CFFFont) {
  34207. glyphZeroId = font.numGlyphs - 1;
  34208. }
  34209. const mapping = font.getGlyphMapping(properties);
  34210. let newMapping = null;
  34211. let newCharCodeToGlyphId = mapping;
  34212. if (!properties.cssFontInfo) {
  34213. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  34214. this.toFontChar = newMapping.toFontChar;
  34215. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  34216. }
  34217. const numGlyphs = font.numGlyphs;
  34218. function getCharCodes(charCodeToGlyphId, glyphId) {
  34219. let charCodes = null;
  34220. for (const charCode in charCodeToGlyphId) {
  34221. if (glyphId === charCodeToGlyphId[charCode]) {
  34222. if (!charCodes) {
  34223. charCodes = [];
  34224. }
  34225. charCodes.push(charCode | 0);
  34226. }
  34227. }
  34228. return charCodes;
  34229. }
  34230. function createCharCode(charCodeToGlyphId, glyphId) {
  34231. for (const charCode in charCodeToGlyphId) {
  34232. if (glyphId === charCodeToGlyphId[charCode]) {
  34233. return charCode | 0;
  34234. }
  34235. }
  34236. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  34237. return newMapping.nextAvailableFontCharCode++;
  34238. }
  34239. const seacs = font.seacs;
  34240. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  34241. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  34242. const charset = font.getCharset();
  34243. const seacMap = Object.create(null);
  34244. for (let glyphId in seacs) {
  34245. glyphId |= 0;
  34246. const seac = seacs[glyphId];
  34247. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  34248. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  34249. const baseGlyphId = charset.indexOf(baseGlyphName);
  34250. const accentGlyphId = charset.indexOf(accentGlyphName);
  34251. if (baseGlyphId < 0 || accentGlyphId < 0) {
  34252. continue;
  34253. }
  34254. const accentOffset = {
  34255. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  34256. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  34257. };
  34258. const charCodes = getCharCodes(mapping, glyphId);
  34259. if (!charCodes) {
  34260. continue;
  34261. }
  34262. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  34263. const charCode = charCodes[i];
  34264. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  34265. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  34266. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  34267. seacMap[charCode] = {
  34268. baseFontCharCode,
  34269. accentFontCharCode,
  34270. accentOffset
  34271. };
  34272. }
  34273. }
  34274. properties.seacMap = seacMap;
  34275. }
  34276. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  34277. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  34278. builder.addTable("CFF ", font.data);
  34279. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  34280. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  34281. 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");
  34282. 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));
  34283. builder.addTable("hmtx", function fontFieldsHmtx() {
  34284. const charstrings = font.charstrings;
  34285. const cffWidths = font.cff ? font.cff.widths : null;
  34286. let hmtx = "\x00\x00\x00\x00";
  34287. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  34288. let width = 0;
  34289. if (charstrings) {
  34290. const charstring = charstrings[i - 1];
  34291. width = "width" in charstring ? charstring.width : 0;
  34292. } else if (cffWidths) {
  34293. width = Math.ceil(cffWidths[i] || 0);
  34294. }
  34295. hmtx += string16(width) + string16(0);
  34296. }
  34297. return hmtx;
  34298. }());
  34299. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  34300. builder.addTable("name", createNameTable(fontName));
  34301. builder.addTable("post", createPostTable(properties));
  34302. return builder.toArray();
  34303. }
  34304. get spaceWidth() {
  34305. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  34306. let width;
  34307. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  34308. const glyphName = possibleSpaceReplacements[i];
  34309. if (glyphName in this.widths) {
  34310. width = this.widths[glyphName];
  34311. break;
  34312. }
  34313. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34314. const glyphUnicode = glyphsUnicodeMap[glyphName];
  34315. let charcode = 0;
  34316. if (this.composite && this.cMap.contains(glyphUnicode)) {
  34317. charcode = this.cMap.lookup(glyphUnicode);
  34318. if (typeof charcode === "string") {
  34319. charcode = convertCidString(glyphUnicode, charcode);
  34320. }
  34321. }
  34322. if (!charcode && this.toUnicode) {
  34323. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  34324. }
  34325. if (charcode <= 0) {
  34326. charcode = glyphUnicode;
  34327. }
  34328. width = this.widths[charcode];
  34329. if (width) {
  34330. break;
  34331. }
  34332. }
  34333. width = width || this.defaultWidth;
  34334. return (0, _util.shadow)(this, "spaceWidth", width);
  34335. }
  34336. _charToGlyph(charcode, isSpace = false) {
  34337. let fontCharCode, width, operatorListId;
  34338. let widthCode = charcode;
  34339. if (this.cMap && this.cMap.contains(charcode)) {
  34340. widthCode = this.cMap.lookup(charcode);
  34341. if (typeof widthCode === "string") {
  34342. widthCode = convertCidString(charcode, widthCode);
  34343. }
  34344. }
  34345. width = this.widths[widthCode];
  34346. if (typeof width !== "number") {
  34347. width = this.defaultWidth;
  34348. }
  34349. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  34350. let unicode = this.toUnicode.get(charcode) || charcode;
  34351. if (typeof unicode === "number") {
  34352. unicode = String.fromCharCode(unicode);
  34353. }
  34354. let isInFont = this.toFontChar[charcode] !== undefined;
  34355. fontCharCode = this.toFontChar[charcode] || charcode;
  34356. if (this.missingFile) {
  34357. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  34358. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  34359. fontCharCode = 0x20;
  34360. }
  34361. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  34362. }
  34363. if (this.isType3Font) {
  34364. operatorListId = fontCharCode;
  34365. }
  34366. let accent = null;
  34367. if (this.seacMap && this.seacMap[charcode]) {
  34368. isInFont = true;
  34369. const seac = this.seacMap[charcode];
  34370. fontCharCode = seac.baseFontCharCode;
  34371. accent = {
  34372. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  34373. offset: seac.accentOffset
  34374. };
  34375. }
  34376. let fontChar = "";
  34377. if (typeof fontCharCode === "number") {
  34378. if (fontCharCode <= 0x10ffff) {
  34379. fontChar = String.fromCodePoint(fontCharCode);
  34380. } else {
  34381. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  34382. }
  34383. }
  34384. let glyph = this._glyphCache[charcode];
  34385. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  34386. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  34387. this._glyphCache[charcode] = glyph;
  34388. }
  34389. return glyph;
  34390. }
  34391. charsToGlyphs(chars) {
  34392. let glyphs = this._charsCache[chars];
  34393. if (glyphs) {
  34394. return glyphs;
  34395. }
  34396. glyphs = [];
  34397. if (this.cMap) {
  34398. const c = Object.create(null),
  34399. ii = chars.length;
  34400. let i = 0;
  34401. while (i < ii) {
  34402. this.cMap.readCharCode(chars, i, c);
  34403. const {
  34404. charcode,
  34405. length
  34406. } = c;
  34407. i += length;
  34408. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  34409. glyphs.push(glyph);
  34410. }
  34411. } else {
  34412. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34413. const charcode = chars.charCodeAt(i);
  34414. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  34415. glyphs.push(glyph);
  34416. }
  34417. }
  34418. return this._charsCache[chars] = glyphs;
  34419. }
  34420. getCharPositions(chars) {
  34421. const positions = [];
  34422. if (this.cMap) {
  34423. const c = Object.create(null);
  34424. let i = 0;
  34425. while (i < chars.length) {
  34426. this.cMap.readCharCode(chars, i, c);
  34427. const length = c.length;
  34428. positions.push([i, i + length]);
  34429. i += length;
  34430. }
  34431. } else {
  34432. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34433. positions.push([i, i + 1]);
  34434. }
  34435. }
  34436. return positions;
  34437. }
  34438. get glyphCacheValues() {
  34439. return Object.values(this._glyphCache);
  34440. }
  34441. encodeString(str) {
  34442. const buffers = [];
  34443. const currentBuf = [];
  34444. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  34445. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  34446. for (let i = 0, ii = str.length; i < ii; i++) {
  34447. const unicode = str.codePointAt(i);
  34448. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  34449. i++;
  34450. }
  34451. if (this.toUnicode) {
  34452. const charCode = getCharCode(unicode);
  34453. if (charCode !== -1) {
  34454. if (hasCurrentBufErrors()) {
  34455. buffers.push(currentBuf.join(""));
  34456. currentBuf.length = 0;
  34457. }
  34458. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  34459. for (let j = charCodeLength - 1; j >= 0; j--) {
  34460. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  34461. }
  34462. continue;
  34463. }
  34464. }
  34465. if (!hasCurrentBufErrors()) {
  34466. buffers.push(currentBuf.join(""));
  34467. currentBuf.length = 0;
  34468. }
  34469. currentBuf.push(String.fromCodePoint(unicode));
  34470. }
  34471. buffers.push(currentBuf.join(""));
  34472. return buffers;
  34473. }
  34474. }
  34475. exports.Font = Font;
  34476. class ErrorFont {
  34477. constructor(error) {
  34478. this.error = error;
  34479. this.loadedName = "g_font_error";
  34480. this.missingFile = true;
  34481. }
  34482. charsToGlyphs() {
  34483. return [];
  34484. }
  34485. encodeString(chars) {
  34486. return [chars];
  34487. }
  34488. exportData(extraProperties = false) {
  34489. return {
  34490. error: this.error
  34491. };
  34492. }
  34493. }
  34494. exports.ErrorFont = ErrorFont;
  34495. /***/ }),
  34496. /* 45 */
  34497. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34498. Object.defineProperty(exports, "__esModule", ({
  34499. value: true
  34500. }));
  34501. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  34502. var _util = __w_pdfjs_require__(2);
  34503. var _charsets = __w_pdfjs_require__(46);
  34504. var _encodings = __w_pdfjs_require__(19);
  34505. const MAX_SUBR_NESTING = 10;
  34506. 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"];
  34507. exports.CFFStandardStrings = CFFStandardStrings;
  34508. const NUM_STANDARD_CFF_STRINGS = 391;
  34509. const CFFParser = function CFFParserClosure() {
  34510. const CharstringValidationData = [null, {
  34511. id: "hstem",
  34512. min: 2,
  34513. stackClearing: true,
  34514. stem: true
  34515. }, null, {
  34516. id: "vstem",
  34517. min: 2,
  34518. stackClearing: true,
  34519. stem: true
  34520. }, {
  34521. id: "vmoveto",
  34522. min: 1,
  34523. stackClearing: true
  34524. }, {
  34525. id: "rlineto",
  34526. min: 2,
  34527. resetStack: true
  34528. }, {
  34529. id: "hlineto",
  34530. min: 1,
  34531. resetStack: true
  34532. }, {
  34533. id: "vlineto",
  34534. min: 1,
  34535. resetStack: true
  34536. }, {
  34537. id: "rrcurveto",
  34538. min: 6,
  34539. resetStack: true
  34540. }, null, {
  34541. id: "callsubr",
  34542. min: 1,
  34543. undefStack: true
  34544. }, {
  34545. id: "return",
  34546. min: 0,
  34547. undefStack: true
  34548. }, null, null, {
  34549. id: "endchar",
  34550. min: 0,
  34551. stackClearing: true
  34552. }, null, null, null, {
  34553. id: "hstemhm",
  34554. min: 2,
  34555. stackClearing: true,
  34556. stem: true
  34557. }, {
  34558. id: "hintmask",
  34559. min: 0,
  34560. stackClearing: true
  34561. }, {
  34562. id: "cntrmask",
  34563. min: 0,
  34564. stackClearing: true
  34565. }, {
  34566. id: "rmoveto",
  34567. min: 2,
  34568. stackClearing: true
  34569. }, {
  34570. id: "hmoveto",
  34571. min: 1,
  34572. stackClearing: true
  34573. }, {
  34574. id: "vstemhm",
  34575. min: 2,
  34576. stackClearing: true,
  34577. stem: true
  34578. }, {
  34579. id: "rcurveline",
  34580. min: 8,
  34581. resetStack: true
  34582. }, {
  34583. id: "rlinecurve",
  34584. min: 8,
  34585. resetStack: true
  34586. }, {
  34587. id: "vvcurveto",
  34588. min: 4,
  34589. resetStack: true
  34590. }, {
  34591. id: "hhcurveto",
  34592. min: 4,
  34593. resetStack: true
  34594. }, null, {
  34595. id: "callgsubr",
  34596. min: 1,
  34597. undefStack: true
  34598. }, {
  34599. id: "vhcurveto",
  34600. min: 4,
  34601. resetStack: true
  34602. }, {
  34603. id: "hvcurveto",
  34604. min: 4,
  34605. resetStack: true
  34606. }];
  34607. const CharstringValidationData12 = [null, null, null, {
  34608. id: "and",
  34609. min: 2,
  34610. stackDelta: -1
  34611. }, {
  34612. id: "or",
  34613. min: 2,
  34614. stackDelta: -1
  34615. }, {
  34616. id: "not",
  34617. min: 1,
  34618. stackDelta: 0
  34619. }, null, null, null, {
  34620. id: "abs",
  34621. min: 1,
  34622. stackDelta: 0
  34623. }, {
  34624. id: "add",
  34625. min: 2,
  34626. stackDelta: -1,
  34627. stackFn: function stack_div(stack, index) {
  34628. stack[index - 2] = stack[index - 2] + stack[index - 1];
  34629. }
  34630. }, {
  34631. id: "sub",
  34632. min: 2,
  34633. stackDelta: -1,
  34634. stackFn: function stack_div(stack, index) {
  34635. stack[index - 2] = stack[index - 2] - stack[index - 1];
  34636. }
  34637. }, {
  34638. id: "div",
  34639. min: 2,
  34640. stackDelta: -1,
  34641. stackFn: function stack_div(stack, index) {
  34642. stack[index - 2] = stack[index - 2] / stack[index - 1];
  34643. }
  34644. }, null, {
  34645. id: "neg",
  34646. min: 1,
  34647. stackDelta: 0,
  34648. stackFn: function stack_div(stack, index) {
  34649. stack[index - 1] = -stack[index - 1];
  34650. }
  34651. }, {
  34652. id: "eq",
  34653. min: 2,
  34654. stackDelta: -1
  34655. }, null, null, {
  34656. id: "drop",
  34657. min: 1,
  34658. stackDelta: -1
  34659. }, null, {
  34660. id: "put",
  34661. min: 2,
  34662. stackDelta: -2
  34663. }, {
  34664. id: "get",
  34665. min: 1,
  34666. stackDelta: 0
  34667. }, {
  34668. id: "ifelse",
  34669. min: 4,
  34670. stackDelta: -3
  34671. }, {
  34672. id: "random",
  34673. min: 0,
  34674. stackDelta: 1
  34675. }, {
  34676. id: "mul",
  34677. min: 2,
  34678. stackDelta: -1,
  34679. stackFn: function stack_div(stack, index) {
  34680. stack[index - 2] = stack[index - 2] * stack[index - 1];
  34681. }
  34682. }, null, {
  34683. id: "sqrt",
  34684. min: 1,
  34685. stackDelta: 0
  34686. }, {
  34687. id: "dup",
  34688. min: 1,
  34689. stackDelta: 1
  34690. }, {
  34691. id: "exch",
  34692. min: 2,
  34693. stackDelta: 0
  34694. }, {
  34695. id: "index",
  34696. min: 2,
  34697. stackDelta: 0
  34698. }, {
  34699. id: "roll",
  34700. min: 3,
  34701. stackDelta: -2
  34702. }, null, null, null, {
  34703. id: "hflex",
  34704. min: 7,
  34705. resetStack: true
  34706. }, {
  34707. id: "flex",
  34708. min: 13,
  34709. resetStack: true
  34710. }, {
  34711. id: "hflex1",
  34712. min: 9,
  34713. resetStack: true
  34714. }, {
  34715. id: "flex1",
  34716. min: 11,
  34717. resetStack: true
  34718. }];
  34719. class CFFParser {
  34720. constructor(file, properties, seacAnalysisEnabled) {
  34721. this.bytes = file.getBytes();
  34722. this.properties = properties;
  34723. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  34724. }
  34725. parse() {
  34726. const properties = this.properties;
  34727. const cff = new CFF();
  34728. this.cff = cff;
  34729. const header = this.parseHeader();
  34730. const nameIndex = this.parseIndex(header.endPos);
  34731. const topDictIndex = this.parseIndex(nameIndex.endPos);
  34732. const stringIndex = this.parseIndex(topDictIndex.endPos);
  34733. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  34734. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  34735. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  34736. cff.header = header.obj;
  34737. cff.names = this.parseNameIndex(nameIndex.obj);
  34738. cff.strings = this.parseStringIndex(stringIndex.obj);
  34739. cff.topDict = topDict;
  34740. cff.globalSubrIndex = globalSubrIndex.obj;
  34741. this.parsePrivateDict(cff.topDict);
  34742. cff.isCIDFont = topDict.hasName("ROS");
  34743. const charStringOffset = topDict.getByName("CharStrings");
  34744. const charStringIndex = this.parseIndex(charStringOffset).obj;
  34745. const fontMatrix = topDict.getByName("FontMatrix");
  34746. if (fontMatrix) {
  34747. properties.fontMatrix = fontMatrix;
  34748. }
  34749. const fontBBox = topDict.getByName("FontBBox");
  34750. if (fontBBox) {
  34751. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  34752. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  34753. properties.ascentScaled = true;
  34754. }
  34755. let charset, encoding;
  34756. if (cff.isCIDFont) {
  34757. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  34758. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  34759. const dictRaw = fdArrayIndex.get(i);
  34760. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  34761. this.parsePrivateDict(fontDict);
  34762. cff.fdArray.push(fontDict);
  34763. }
  34764. encoding = null;
  34765. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  34766. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  34767. } else {
  34768. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  34769. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  34770. }
  34771. cff.charset = charset;
  34772. cff.encoding = encoding;
  34773. const charStringsAndSeacs = this.parseCharStrings({
  34774. charStrings: charStringIndex,
  34775. localSubrIndex: topDict.privateDict.subrsIndex,
  34776. globalSubrIndex: globalSubrIndex.obj,
  34777. fdSelect: cff.fdSelect,
  34778. fdArray: cff.fdArray,
  34779. privateDict: topDict.privateDict
  34780. });
  34781. cff.charStrings = charStringsAndSeacs.charStrings;
  34782. cff.seacs = charStringsAndSeacs.seacs;
  34783. cff.widths = charStringsAndSeacs.widths;
  34784. return cff;
  34785. }
  34786. parseHeader() {
  34787. let bytes = this.bytes;
  34788. const bytesLength = bytes.length;
  34789. let offset = 0;
  34790. while (offset < bytesLength && bytes[offset] !== 1) {
  34791. ++offset;
  34792. }
  34793. if (offset >= bytesLength) {
  34794. throw new _util.FormatError("Invalid CFF header");
  34795. }
  34796. if (offset !== 0) {
  34797. (0, _util.info)("cff data is shifted");
  34798. bytes = bytes.subarray(offset);
  34799. this.bytes = bytes;
  34800. }
  34801. const major = bytes[0];
  34802. const minor = bytes[1];
  34803. const hdrSize = bytes[2];
  34804. const offSize = bytes[3];
  34805. const header = new CFFHeader(major, minor, hdrSize, offSize);
  34806. return {
  34807. obj: header,
  34808. endPos: hdrSize
  34809. };
  34810. }
  34811. parseDict(dict) {
  34812. let pos = 0;
  34813. function parseOperand() {
  34814. let value = dict[pos++];
  34815. if (value === 30) {
  34816. return parseFloatOperand();
  34817. } else if (value === 28) {
  34818. value = dict[pos++];
  34819. value = (value << 24 | dict[pos++] << 16) >> 16;
  34820. return value;
  34821. } else if (value === 29) {
  34822. value = dict[pos++];
  34823. value = value << 8 | dict[pos++];
  34824. value = value << 8 | dict[pos++];
  34825. value = value << 8 | dict[pos++];
  34826. return value;
  34827. } else if (value >= 32 && value <= 246) {
  34828. return value - 139;
  34829. } else if (value >= 247 && value <= 250) {
  34830. return (value - 247) * 256 + dict[pos++] + 108;
  34831. } else if (value >= 251 && value <= 254) {
  34832. return -((value - 251) * 256) - dict[pos++] - 108;
  34833. }
  34834. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  34835. return NaN;
  34836. }
  34837. function parseFloatOperand() {
  34838. let str = "";
  34839. const eof = 15;
  34840. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  34841. const length = dict.length;
  34842. while (pos < length) {
  34843. const b = dict[pos++];
  34844. const b1 = b >> 4;
  34845. const b2 = b & 15;
  34846. if (b1 === eof) {
  34847. break;
  34848. }
  34849. str += lookup[b1];
  34850. if (b2 === eof) {
  34851. break;
  34852. }
  34853. str += lookup[b2];
  34854. }
  34855. return parseFloat(str);
  34856. }
  34857. let operands = [];
  34858. const entries = [];
  34859. pos = 0;
  34860. const end = dict.length;
  34861. while (pos < end) {
  34862. let b = dict[pos];
  34863. if (b <= 21) {
  34864. if (b === 12) {
  34865. b = b << 8 | dict[++pos];
  34866. }
  34867. entries.push([b, operands]);
  34868. operands = [];
  34869. ++pos;
  34870. } else {
  34871. operands.push(parseOperand());
  34872. }
  34873. }
  34874. return entries;
  34875. }
  34876. parseIndex(pos) {
  34877. const cffIndex = new CFFIndex();
  34878. const bytes = this.bytes;
  34879. const count = bytes[pos++] << 8 | bytes[pos++];
  34880. const offsets = [];
  34881. let end = pos;
  34882. let i, ii;
  34883. if (count !== 0) {
  34884. const offsetSize = bytes[pos++];
  34885. const startPos = pos + (count + 1) * offsetSize - 1;
  34886. for (i = 0, ii = count + 1; i < ii; ++i) {
  34887. let offset = 0;
  34888. for (let j = 0; j < offsetSize; ++j) {
  34889. offset <<= 8;
  34890. offset += bytes[pos++];
  34891. }
  34892. offsets.push(startPos + offset);
  34893. }
  34894. end = offsets[count];
  34895. }
  34896. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  34897. const offsetStart = offsets[i];
  34898. const offsetEnd = offsets[i + 1];
  34899. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  34900. }
  34901. return {
  34902. obj: cffIndex,
  34903. endPos: end
  34904. };
  34905. }
  34906. parseNameIndex(index) {
  34907. const names = [];
  34908. for (let i = 0, ii = index.count; i < ii; ++i) {
  34909. const name = index.get(i);
  34910. names.push((0, _util.bytesToString)(name));
  34911. }
  34912. return names;
  34913. }
  34914. parseStringIndex(index) {
  34915. const strings = new CFFStrings();
  34916. for (let i = 0, ii = index.count; i < ii; ++i) {
  34917. const data = index.get(i);
  34918. strings.add((0, _util.bytesToString)(data));
  34919. }
  34920. return strings;
  34921. }
  34922. createDict(Type, dict, strings) {
  34923. const cffDict = new Type(strings);
  34924. for (let i = 0, ii = dict.length; i < ii; ++i) {
  34925. const pair = dict[i];
  34926. const key = pair[0];
  34927. const value = pair[1];
  34928. cffDict.setByKey(key, value);
  34929. }
  34930. return cffDict;
  34931. }
  34932. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  34933. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  34934. return false;
  34935. }
  34936. let stackSize = state.stackSize;
  34937. const stack = state.stack;
  34938. const length = data.length;
  34939. for (let j = 0; j < length;) {
  34940. const value = data[j++];
  34941. let validationCommand = null;
  34942. if (value === 12) {
  34943. const q = data[j++];
  34944. if (q === 0) {
  34945. data[j - 2] = 139;
  34946. data[j - 1] = 22;
  34947. stackSize = 0;
  34948. } else {
  34949. validationCommand = CharstringValidationData12[q];
  34950. }
  34951. } else if (value === 28) {
  34952. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  34953. j += 2;
  34954. stackSize++;
  34955. } else if (value === 14) {
  34956. if (stackSize >= 4) {
  34957. stackSize -= 4;
  34958. if (this.seacAnalysisEnabled) {
  34959. state.seac = stack.slice(stackSize, stackSize + 4);
  34960. return false;
  34961. }
  34962. }
  34963. validationCommand = CharstringValidationData[value];
  34964. } else if (value >= 32 && value <= 246) {
  34965. stack[stackSize] = value - 139;
  34966. stackSize++;
  34967. } else if (value >= 247 && value <= 254) {
  34968. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  34969. j++;
  34970. stackSize++;
  34971. } else if (value === 255) {
  34972. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  34973. j += 4;
  34974. stackSize++;
  34975. } else if (value === 19 || value === 20) {
  34976. state.hints += stackSize >> 1;
  34977. j += state.hints + 7 >> 3;
  34978. stackSize %= 2;
  34979. validationCommand = CharstringValidationData[value];
  34980. } else if (value === 10 || value === 29) {
  34981. let subrsIndex;
  34982. if (value === 10) {
  34983. subrsIndex = localSubrIndex;
  34984. } else {
  34985. subrsIndex = globalSubrIndex;
  34986. }
  34987. if (!subrsIndex) {
  34988. validationCommand = CharstringValidationData[value];
  34989. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  34990. return false;
  34991. }
  34992. let bias = 32768;
  34993. if (subrsIndex.count < 1240) {
  34994. bias = 107;
  34995. } else if (subrsIndex.count < 33900) {
  34996. bias = 1131;
  34997. }
  34998. const subrNumber = stack[--stackSize] + bias;
  34999. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  35000. validationCommand = CharstringValidationData[value];
  35001. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  35002. return false;
  35003. }
  35004. state.stackSize = stackSize;
  35005. state.callDepth++;
  35006. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  35007. if (!valid) {
  35008. return false;
  35009. }
  35010. state.callDepth--;
  35011. stackSize = state.stackSize;
  35012. continue;
  35013. } else if (value === 11) {
  35014. state.stackSize = stackSize;
  35015. return true;
  35016. } else if (value === 0 && j === data.length) {
  35017. data[j - 1] = 14;
  35018. validationCommand = CharstringValidationData[14];
  35019. } else {
  35020. validationCommand = CharstringValidationData[value];
  35021. }
  35022. if (validationCommand) {
  35023. if (validationCommand.stem) {
  35024. state.hints += stackSize >> 1;
  35025. if (value === 3 || value === 23) {
  35026. state.hasVStems = true;
  35027. } else if (state.hasVStems && (value === 1 || value === 18)) {
  35028. (0, _util.warn)("CFF stem hints are in wrong order");
  35029. data[j - 1] = value === 1 ? 3 : 23;
  35030. }
  35031. }
  35032. if ("min" in validationCommand) {
  35033. if (!state.undefStack && stackSize < validationCommand.min) {
  35034. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  35035. if (stackSize === 0) {
  35036. data[j - 1] = 14;
  35037. return true;
  35038. }
  35039. return false;
  35040. }
  35041. }
  35042. if (state.firstStackClearing && validationCommand.stackClearing) {
  35043. state.firstStackClearing = false;
  35044. stackSize -= validationCommand.min;
  35045. if (stackSize >= 2 && validationCommand.stem) {
  35046. stackSize %= 2;
  35047. } else if (stackSize > 1) {
  35048. (0, _util.warn)("Found too many parameters for stack-clearing command");
  35049. }
  35050. if (stackSize > 0) {
  35051. state.width = stack[stackSize - 1];
  35052. }
  35053. }
  35054. if ("stackDelta" in validationCommand) {
  35055. if ("stackFn" in validationCommand) {
  35056. validationCommand.stackFn(stack, stackSize);
  35057. }
  35058. stackSize += validationCommand.stackDelta;
  35059. } else if (validationCommand.stackClearing) {
  35060. stackSize = 0;
  35061. } else if (validationCommand.resetStack) {
  35062. stackSize = 0;
  35063. state.undefStack = false;
  35064. } else if (validationCommand.undefStack) {
  35065. stackSize = 0;
  35066. state.undefStack = true;
  35067. state.firstStackClearing = false;
  35068. }
  35069. }
  35070. }
  35071. state.stackSize = stackSize;
  35072. return true;
  35073. }
  35074. parseCharStrings({
  35075. charStrings,
  35076. localSubrIndex,
  35077. globalSubrIndex,
  35078. fdSelect,
  35079. fdArray,
  35080. privateDict
  35081. }) {
  35082. const seacs = [];
  35083. const widths = [];
  35084. const count = charStrings.count;
  35085. for (let i = 0; i < count; i++) {
  35086. const charstring = charStrings.get(i);
  35087. const state = {
  35088. callDepth: 0,
  35089. stackSize: 0,
  35090. stack: [],
  35091. undefStack: true,
  35092. hints: 0,
  35093. firstStackClearing: true,
  35094. seac: null,
  35095. width: null,
  35096. hasVStems: false
  35097. };
  35098. let valid = true;
  35099. let localSubrToUse = null;
  35100. let privateDictToUse = privateDict;
  35101. if (fdSelect && fdArray.length) {
  35102. const fdIndex = fdSelect.getFDIndex(i);
  35103. if (fdIndex === -1) {
  35104. (0, _util.warn)("Glyph index is not in fd select.");
  35105. valid = false;
  35106. }
  35107. if (fdIndex >= fdArray.length) {
  35108. (0, _util.warn)("Invalid fd index for glyph index.");
  35109. valid = false;
  35110. }
  35111. if (valid) {
  35112. privateDictToUse = fdArray[fdIndex].privateDict;
  35113. localSubrToUse = privateDictToUse.subrsIndex;
  35114. }
  35115. } else if (localSubrIndex) {
  35116. localSubrToUse = localSubrIndex;
  35117. }
  35118. if (valid) {
  35119. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  35120. }
  35121. if (state.width !== null) {
  35122. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  35123. widths[i] = nominalWidth + state.width;
  35124. } else {
  35125. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  35126. widths[i] = defaultWidth;
  35127. }
  35128. if (state.seac !== null) {
  35129. seacs[i] = state.seac;
  35130. }
  35131. if (!valid) {
  35132. charStrings.set(i, new Uint8Array([14]));
  35133. }
  35134. }
  35135. return {
  35136. charStrings,
  35137. seacs,
  35138. widths
  35139. };
  35140. }
  35141. emptyPrivateDictionary(parentDict) {
  35142. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  35143. parentDict.setByKey(18, [0, 0]);
  35144. parentDict.privateDict = privateDict;
  35145. }
  35146. parsePrivateDict(parentDict) {
  35147. if (!parentDict.hasName("Private")) {
  35148. this.emptyPrivateDictionary(parentDict);
  35149. return;
  35150. }
  35151. const privateOffset = parentDict.getByName("Private");
  35152. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  35153. parentDict.removeByName("Private");
  35154. return;
  35155. }
  35156. const size = privateOffset[0];
  35157. const offset = privateOffset[1];
  35158. if (size === 0 || offset >= this.bytes.length) {
  35159. this.emptyPrivateDictionary(parentDict);
  35160. return;
  35161. }
  35162. const privateDictEnd = offset + size;
  35163. const dictData = this.bytes.subarray(offset, privateDictEnd);
  35164. const dict = this.parseDict(dictData);
  35165. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  35166. parentDict.privateDict = privateDict;
  35167. if (!privateDict.getByName("Subrs")) {
  35168. return;
  35169. }
  35170. const subrsOffset = privateDict.getByName("Subrs");
  35171. const relativeOffset = offset + subrsOffset;
  35172. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  35173. this.emptyPrivateDictionary(parentDict);
  35174. return;
  35175. }
  35176. const subrsIndex = this.parseIndex(relativeOffset);
  35177. privateDict.subrsIndex = subrsIndex.obj;
  35178. }
  35179. parseCharsets(pos, length, strings, cid) {
  35180. if (pos === 0) {
  35181. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  35182. } else if (pos === 1) {
  35183. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  35184. } else if (pos === 2) {
  35185. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  35186. }
  35187. const bytes = this.bytes;
  35188. const start = pos;
  35189. const format = bytes[pos++];
  35190. const charset = [cid ? 0 : ".notdef"];
  35191. let id, count, i;
  35192. length -= 1;
  35193. switch (format) {
  35194. case 0:
  35195. for (i = 0; i < length; i++) {
  35196. id = bytes[pos++] << 8 | bytes[pos++];
  35197. charset.push(cid ? id : strings.get(id));
  35198. }
  35199. break;
  35200. case 1:
  35201. while (charset.length <= length) {
  35202. id = bytes[pos++] << 8 | bytes[pos++];
  35203. count = bytes[pos++];
  35204. for (i = 0; i <= count; i++) {
  35205. charset.push(cid ? id++ : strings.get(id++));
  35206. }
  35207. }
  35208. break;
  35209. case 2:
  35210. while (charset.length <= length) {
  35211. id = bytes[pos++] << 8 | bytes[pos++];
  35212. count = bytes[pos++] << 8 | bytes[pos++];
  35213. for (i = 0; i <= count; i++) {
  35214. charset.push(cid ? id++ : strings.get(id++));
  35215. }
  35216. }
  35217. break;
  35218. default:
  35219. throw new _util.FormatError("Unknown charset format");
  35220. }
  35221. const end = pos;
  35222. const raw = bytes.subarray(start, end);
  35223. return new CFFCharset(false, format, charset, raw);
  35224. }
  35225. parseEncoding(pos, properties, strings, charset) {
  35226. const encoding = Object.create(null);
  35227. const bytes = this.bytes;
  35228. let predefined = false;
  35229. let format, i, ii;
  35230. let raw = null;
  35231. function readSupplement() {
  35232. const supplementsCount = bytes[pos++];
  35233. for (i = 0; i < supplementsCount; i++) {
  35234. const code = bytes[pos++];
  35235. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  35236. encoding[code] = charset.indexOf(strings.get(sid));
  35237. }
  35238. }
  35239. if (pos === 0 || pos === 1) {
  35240. predefined = true;
  35241. format = pos;
  35242. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  35243. for (i = 0, ii = charset.length; i < ii; i++) {
  35244. const index = baseEncoding.indexOf(charset[i]);
  35245. if (index !== -1) {
  35246. encoding[index] = i;
  35247. }
  35248. }
  35249. } else {
  35250. const dataStart = pos;
  35251. format = bytes[pos++];
  35252. switch (format & 0x7f) {
  35253. case 0:
  35254. const glyphsCount = bytes[pos++];
  35255. for (i = 1; i <= glyphsCount; i++) {
  35256. encoding[bytes[pos++]] = i;
  35257. }
  35258. break;
  35259. case 1:
  35260. const rangesCount = bytes[pos++];
  35261. let gid = 1;
  35262. for (i = 0; i < rangesCount; i++) {
  35263. const start = bytes[pos++];
  35264. const left = bytes[pos++];
  35265. for (let j = start; j <= start + left; j++) {
  35266. encoding[j] = gid++;
  35267. }
  35268. }
  35269. break;
  35270. default:
  35271. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  35272. }
  35273. const dataEnd = pos;
  35274. if (format & 0x80) {
  35275. bytes[dataStart] &= 0x7f;
  35276. readSupplement();
  35277. }
  35278. raw = bytes.subarray(dataStart, dataEnd);
  35279. }
  35280. format &= 0x7f;
  35281. return new CFFEncoding(predefined, format, encoding, raw);
  35282. }
  35283. parseFDSelect(pos, length) {
  35284. const bytes = this.bytes;
  35285. const format = bytes[pos++];
  35286. const fdSelect = [];
  35287. let i;
  35288. switch (format) {
  35289. case 0:
  35290. for (i = 0; i < length; ++i) {
  35291. const id = bytes[pos++];
  35292. fdSelect.push(id);
  35293. }
  35294. break;
  35295. case 3:
  35296. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  35297. for (i = 0; i < rangesCount; ++i) {
  35298. let first = bytes[pos++] << 8 | bytes[pos++];
  35299. if (i === 0 && first !== 0) {
  35300. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  35301. first = 0;
  35302. }
  35303. const fdIndex = bytes[pos++];
  35304. const next = bytes[pos] << 8 | bytes[pos + 1];
  35305. for (let j = first; j < next; ++j) {
  35306. fdSelect.push(fdIndex);
  35307. }
  35308. }
  35309. pos += 2;
  35310. break;
  35311. default:
  35312. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  35313. }
  35314. if (fdSelect.length !== length) {
  35315. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  35316. }
  35317. return new CFFFDSelect(format, fdSelect);
  35318. }
  35319. }
  35320. return CFFParser;
  35321. }();
  35322. exports.CFFParser = CFFParser;
  35323. class CFF {
  35324. constructor() {
  35325. this.header = null;
  35326. this.names = [];
  35327. this.topDict = null;
  35328. this.strings = new CFFStrings();
  35329. this.globalSubrIndex = null;
  35330. this.encoding = null;
  35331. this.charset = null;
  35332. this.charStrings = null;
  35333. this.fdArray = [];
  35334. this.fdSelect = null;
  35335. this.isCIDFont = false;
  35336. }
  35337. duplicateFirstGlyph() {
  35338. if (this.charStrings.count >= 65535) {
  35339. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  35340. return;
  35341. }
  35342. const glyphZero = this.charStrings.get(0);
  35343. this.charStrings.add(glyphZero);
  35344. if (this.isCIDFont) {
  35345. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  35346. }
  35347. }
  35348. hasGlyphId(id) {
  35349. if (id < 0 || id >= this.charStrings.count) {
  35350. return false;
  35351. }
  35352. const glyph = this.charStrings.get(id);
  35353. return glyph.length > 0;
  35354. }
  35355. }
  35356. exports.CFF = CFF;
  35357. class CFFHeader {
  35358. constructor(major, minor, hdrSize, offSize) {
  35359. this.major = major;
  35360. this.minor = minor;
  35361. this.hdrSize = hdrSize;
  35362. this.offSize = offSize;
  35363. }
  35364. }
  35365. exports.CFFHeader = CFFHeader;
  35366. class CFFStrings {
  35367. constructor() {
  35368. this.strings = [];
  35369. }
  35370. get(index) {
  35371. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  35372. return CFFStandardStrings[index];
  35373. }
  35374. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  35375. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  35376. }
  35377. return CFFStandardStrings[0];
  35378. }
  35379. getSID(str) {
  35380. let index = CFFStandardStrings.indexOf(str);
  35381. if (index !== -1) {
  35382. return index;
  35383. }
  35384. index = this.strings.indexOf(str);
  35385. if (index !== -1) {
  35386. return index + NUM_STANDARD_CFF_STRINGS;
  35387. }
  35388. return -1;
  35389. }
  35390. add(value) {
  35391. this.strings.push(value);
  35392. }
  35393. get count() {
  35394. return this.strings.length;
  35395. }
  35396. }
  35397. exports.CFFStrings = CFFStrings;
  35398. class CFFIndex {
  35399. constructor() {
  35400. this.objects = [];
  35401. this.length = 0;
  35402. }
  35403. add(data) {
  35404. this.length += data.length;
  35405. this.objects.push(data);
  35406. }
  35407. set(index, data) {
  35408. this.length += data.length - this.objects[index].length;
  35409. this.objects[index] = data;
  35410. }
  35411. get(index) {
  35412. return this.objects[index];
  35413. }
  35414. get count() {
  35415. return this.objects.length;
  35416. }
  35417. }
  35418. exports.CFFIndex = CFFIndex;
  35419. class CFFDict {
  35420. constructor(tables, strings) {
  35421. this.keyToNameMap = tables.keyToNameMap;
  35422. this.nameToKeyMap = tables.nameToKeyMap;
  35423. this.defaults = tables.defaults;
  35424. this.types = tables.types;
  35425. this.opcodes = tables.opcodes;
  35426. this.order = tables.order;
  35427. this.strings = strings;
  35428. this.values = Object.create(null);
  35429. }
  35430. setByKey(key, value) {
  35431. if (!(key in this.keyToNameMap)) {
  35432. return false;
  35433. }
  35434. const valueLength = value.length;
  35435. if (valueLength === 0) {
  35436. return true;
  35437. }
  35438. for (let i = 0; i < valueLength; i++) {
  35439. if (isNaN(value[i])) {
  35440. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  35441. return true;
  35442. }
  35443. }
  35444. const type = this.types[key];
  35445. if (type === "num" || type === "sid" || type === "offset") {
  35446. value = value[0];
  35447. }
  35448. this.values[key] = value;
  35449. return true;
  35450. }
  35451. setByName(name, value) {
  35452. if (!(name in this.nameToKeyMap)) {
  35453. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  35454. }
  35455. this.values[this.nameToKeyMap[name]] = value;
  35456. }
  35457. hasName(name) {
  35458. return this.nameToKeyMap[name] in this.values;
  35459. }
  35460. getByName(name) {
  35461. if (!(name in this.nameToKeyMap)) {
  35462. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  35463. }
  35464. const key = this.nameToKeyMap[name];
  35465. if (!(key in this.values)) {
  35466. return this.defaults[key];
  35467. }
  35468. return this.values[key];
  35469. }
  35470. removeByName(name) {
  35471. delete this.values[this.nameToKeyMap[name]];
  35472. }
  35473. static createTables(layout) {
  35474. const tables = {
  35475. keyToNameMap: {},
  35476. nameToKeyMap: {},
  35477. defaults: {},
  35478. types: {},
  35479. opcodes: {},
  35480. order: []
  35481. };
  35482. for (let i = 0, ii = layout.length; i < ii; ++i) {
  35483. const entry = layout[i];
  35484. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  35485. tables.keyToNameMap[key] = entry[1];
  35486. tables.nameToKeyMap[entry[1]] = key;
  35487. tables.types[key] = entry[2];
  35488. tables.defaults[key] = entry[3];
  35489. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  35490. tables.order.push(key);
  35491. }
  35492. return tables;
  35493. }
  35494. }
  35495. const CFFTopDict = function CFFTopDictClosure() {
  35496. const layout = [[[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]];
  35497. let tables = null;
  35498. class CFFTopDict extends CFFDict {
  35499. constructor(strings) {
  35500. if (tables === null) {
  35501. tables = CFFDict.createTables(layout);
  35502. }
  35503. super(tables, strings);
  35504. this.privateDict = null;
  35505. }
  35506. }
  35507. return CFFTopDict;
  35508. }();
  35509. exports.CFFTopDict = CFFTopDict;
  35510. const CFFPrivateDict = function CFFPrivateDictClosure() {
  35511. const layout = [[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]];
  35512. let tables = null;
  35513. class CFFPrivateDict extends CFFDict {
  35514. constructor(strings) {
  35515. if (tables === null) {
  35516. tables = CFFDict.createTables(layout);
  35517. }
  35518. super(tables, strings);
  35519. this.subrsIndex = null;
  35520. }
  35521. }
  35522. return CFFPrivateDict;
  35523. }();
  35524. exports.CFFPrivateDict = CFFPrivateDict;
  35525. const CFFCharsetPredefinedTypes = {
  35526. ISO_ADOBE: 0,
  35527. EXPERT: 1,
  35528. EXPERT_SUBSET: 2
  35529. };
  35530. class CFFCharset {
  35531. constructor(predefined, format, charset, raw) {
  35532. this.predefined = predefined;
  35533. this.format = format;
  35534. this.charset = charset;
  35535. this.raw = raw;
  35536. }
  35537. }
  35538. exports.CFFCharset = CFFCharset;
  35539. class CFFEncoding {
  35540. constructor(predefined, format, encoding, raw) {
  35541. this.predefined = predefined;
  35542. this.format = format;
  35543. this.encoding = encoding;
  35544. this.raw = raw;
  35545. }
  35546. }
  35547. class CFFFDSelect {
  35548. constructor(format, fdSelect) {
  35549. this.format = format;
  35550. this.fdSelect = fdSelect;
  35551. }
  35552. getFDIndex(glyphIndex) {
  35553. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  35554. return -1;
  35555. }
  35556. return this.fdSelect[glyphIndex];
  35557. }
  35558. }
  35559. exports.CFFFDSelect = CFFFDSelect;
  35560. class CFFOffsetTracker {
  35561. constructor() {
  35562. this.offsets = Object.create(null);
  35563. }
  35564. isTracking(key) {
  35565. return key in this.offsets;
  35566. }
  35567. track(key, location) {
  35568. if (key in this.offsets) {
  35569. throw new _util.FormatError(`Already tracking location of ${key}`);
  35570. }
  35571. this.offsets[key] = location;
  35572. }
  35573. offset(value) {
  35574. for (const key in this.offsets) {
  35575. this.offsets[key] += value;
  35576. }
  35577. }
  35578. setEntryLocation(key, values, output) {
  35579. if (!(key in this.offsets)) {
  35580. throw new _util.FormatError(`Not tracking location of ${key}`);
  35581. }
  35582. const data = output.data;
  35583. const dataOffset = this.offsets[key];
  35584. const size = 5;
  35585. for (let i = 0, ii = values.length; i < ii; ++i) {
  35586. const offset0 = i * size + dataOffset;
  35587. const offset1 = offset0 + 1;
  35588. const offset2 = offset0 + 2;
  35589. const offset3 = offset0 + 3;
  35590. const offset4 = offset0 + 4;
  35591. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  35592. throw new _util.FormatError("writing to an offset that is not empty");
  35593. }
  35594. const value = values[i];
  35595. data[offset0] = 0x1d;
  35596. data[offset1] = value >> 24 & 0xff;
  35597. data[offset2] = value >> 16 & 0xff;
  35598. data[offset3] = value >> 8 & 0xff;
  35599. data[offset4] = value & 0xff;
  35600. }
  35601. }
  35602. }
  35603. class CFFCompiler {
  35604. constructor(cff) {
  35605. this.cff = cff;
  35606. }
  35607. compile() {
  35608. const cff = this.cff;
  35609. const output = {
  35610. data: [],
  35611. length: 0,
  35612. add: function CFFCompiler_add(data) {
  35613. this.data = this.data.concat(data);
  35614. this.length = this.data.length;
  35615. }
  35616. };
  35617. const header = this.compileHeader(cff.header);
  35618. output.add(header);
  35619. const nameIndex = this.compileNameIndex(cff.names);
  35620. output.add(nameIndex);
  35621. if (cff.isCIDFont) {
  35622. if (cff.topDict.hasName("FontMatrix")) {
  35623. const base = cff.topDict.getByName("FontMatrix");
  35624. cff.topDict.removeByName("FontMatrix");
  35625. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  35626. const subDict = cff.fdArray[i];
  35627. let matrix = base.slice(0);
  35628. if (subDict.hasName("FontMatrix")) {
  35629. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  35630. }
  35631. subDict.setByName("FontMatrix", matrix);
  35632. }
  35633. }
  35634. }
  35635. const xuid = cff.topDict.getByName("XUID");
  35636. if (xuid && xuid.length > 16) {
  35637. cff.topDict.removeByName("XUID");
  35638. }
  35639. cff.topDict.setByName("charset", 0);
  35640. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  35641. output.add(compiled.output);
  35642. const topDictTracker = compiled.trackers[0];
  35643. const stringIndex = this.compileStringIndex(cff.strings.strings);
  35644. output.add(stringIndex);
  35645. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  35646. output.add(globalSubrIndex);
  35647. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  35648. if (cff.encoding.predefined) {
  35649. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  35650. } else {
  35651. const encoding = this.compileEncoding(cff.encoding);
  35652. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  35653. output.add(encoding);
  35654. }
  35655. }
  35656. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  35657. topDictTracker.setEntryLocation("charset", [output.length], output);
  35658. output.add(charset);
  35659. const charStrings = this.compileCharStrings(cff.charStrings);
  35660. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  35661. output.add(charStrings);
  35662. if (cff.isCIDFont) {
  35663. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  35664. const fdSelect = this.compileFDSelect(cff.fdSelect);
  35665. output.add(fdSelect);
  35666. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  35667. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  35668. output.add(compiled.output);
  35669. const fontDictTrackers = compiled.trackers;
  35670. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  35671. }
  35672. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  35673. output.add([0]);
  35674. return output.data;
  35675. }
  35676. encodeNumber(value) {
  35677. if (Number.isInteger(value)) {
  35678. return this.encodeInteger(value);
  35679. }
  35680. return this.encodeFloat(value);
  35681. }
  35682. static get EncodeFloatRegExp() {
  35683. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  35684. }
  35685. encodeFloat(num) {
  35686. let value = num.toString();
  35687. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  35688. if (m) {
  35689. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  35690. value = (Math.round(num * epsilon) / epsilon).toString();
  35691. }
  35692. let nibbles = "";
  35693. let i, ii;
  35694. for (i = 0, ii = value.length; i < ii; ++i) {
  35695. const a = value[i];
  35696. if (a === "e") {
  35697. nibbles += value[++i] === "-" ? "c" : "b";
  35698. } else if (a === ".") {
  35699. nibbles += "a";
  35700. } else if (a === "-") {
  35701. nibbles += "e";
  35702. } else {
  35703. nibbles += a;
  35704. }
  35705. }
  35706. nibbles += nibbles.length & 1 ? "f" : "ff";
  35707. const out = [30];
  35708. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  35709. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  35710. }
  35711. return out;
  35712. }
  35713. encodeInteger(value) {
  35714. let code;
  35715. if (value >= -107 && value <= 107) {
  35716. code = [value + 139];
  35717. } else if (value >= 108 && value <= 1131) {
  35718. value -= 108;
  35719. code = [(value >> 8) + 247, value & 0xff];
  35720. } else if (value >= -1131 && value <= -108) {
  35721. value = -value - 108;
  35722. code = [(value >> 8) + 251, value & 0xff];
  35723. } else if (value >= -32768 && value <= 32767) {
  35724. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  35725. } else {
  35726. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  35727. }
  35728. return code;
  35729. }
  35730. compileHeader(header) {
  35731. return [header.major, header.minor, 4, header.offSize];
  35732. }
  35733. compileNameIndex(names) {
  35734. const nameIndex = new CFFIndex();
  35735. for (let i = 0, ii = names.length; i < ii; ++i) {
  35736. const name = names[i];
  35737. const length = Math.min(name.length, 127);
  35738. let sanitizedName = new Array(length);
  35739. for (let j = 0; j < length; j++) {
  35740. let char = name[j];
  35741. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  35742. char = "_";
  35743. }
  35744. sanitizedName[j] = char;
  35745. }
  35746. sanitizedName = sanitizedName.join("");
  35747. if (sanitizedName === "") {
  35748. sanitizedName = "Bad_Font_Name";
  35749. }
  35750. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  35751. }
  35752. return this.compileIndex(nameIndex);
  35753. }
  35754. compileTopDicts(dicts, length, removeCidKeys) {
  35755. const fontDictTrackers = [];
  35756. let fdArrayIndex = new CFFIndex();
  35757. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  35758. const fontDict = dicts[i];
  35759. if (removeCidKeys) {
  35760. fontDict.removeByName("CIDFontVersion");
  35761. fontDict.removeByName("CIDFontRevision");
  35762. fontDict.removeByName("CIDFontType");
  35763. fontDict.removeByName("CIDCount");
  35764. fontDict.removeByName("UIDBase");
  35765. }
  35766. const fontDictTracker = new CFFOffsetTracker();
  35767. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  35768. fontDictTrackers.push(fontDictTracker);
  35769. fdArrayIndex.add(fontDictData);
  35770. fontDictTracker.offset(length);
  35771. }
  35772. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  35773. return {
  35774. trackers: fontDictTrackers,
  35775. output: fdArrayIndex
  35776. };
  35777. }
  35778. compilePrivateDicts(dicts, trackers, output) {
  35779. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  35780. const fontDict = dicts[i];
  35781. const privateDict = fontDict.privateDict;
  35782. if (!privateDict || !fontDict.hasName("Private")) {
  35783. throw new _util.FormatError("There must be a private dictionary.");
  35784. }
  35785. const privateDictTracker = new CFFOffsetTracker();
  35786. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  35787. let outputLength = output.length;
  35788. privateDictTracker.offset(outputLength);
  35789. if (!privateDictData.length) {
  35790. outputLength = 0;
  35791. }
  35792. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  35793. output.add(privateDictData);
  35794. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  35795. const subrs = this.compileIndex(privateDict.subrsIndex);
  35796. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  35797. output.add(subrs);
  35798. }
  35799. }
  35800. }
  35801. compileDict(dict, offsetTracker) {
  35802. let out = [];
  35803. const order = dict.order;
  35804. for (let i = 0; i < order.length; ++i) {
  35805. const key = order[i];
  35806. if (!(key in dict.values)) {
  35807. continue;
  35808. }
  35809. let values = dict.values[key];
  35810. let types = dict.types[key];
  35811. if (!Array.isArray(types)) {
  35812. types = [types];
  35813. }
  35814. if (!Array.isArray(values)) {
  35815. values = [values];
  35816. }
  35817. if (values.length === 0) {
  35818. continue;
  35819. }
  35820. for (let j = 0, jj = types.length; j < jj; ++j) {
  35821. const type = types[j];
  35822. const value = values[j];
  35823. switch (type) {
  35824. case "num":
  35825. case "sid":
  35826. out = out.concat(this.encodeNumber(value));
  35827. break;
  35828. case "offset":
  35829. const name = dict.keyToNameMap[key];
  35830. if (!offsetTracker.isTracking(name)) {
  35831. offsetTracker.track(name, out.length);
  35832. }
  35833. out = out.concat([0x1d, 0, 0, 0, 0]);
  35834. break;
  35835. case "array":
  35836. case "delta":
  35837. out = out.concat(this.encodeNumber(value));
  35838. for (let k = 1, kk = values.length; k < kk; ++k) {
  35839. out = out.concat(this.encodeNumber(values[k]));
  35840. }
  35841. break;
  35842. default:
  35843. throw new _util.FormatError(`Unknown data type of ${type}`);
  35844. }
  35845. }
  35846. out = out.concat(dict.opcodes[key]);
  35847. }
  35848. return out;
  35849. }
  35850. compileStringIndex(strings) {
  35851. const stringIndex = new CFFIndex();
  35852. for (let i = 0, ii = strings.length; i < ii; ++i) {
  35853. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  35854. }
  35855. return this.compileIndex(stringIndex);
  35856. }
  35857. compileGlobalSubrIndex() {
  35858. const globalSubrIndex = this.cff.globalSubrIndex;
  35859. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  35860. }
  35861. compileCharStrings(charStrings) {
  35862. const charStringsIndex = new CFFIndex();
  35863. for (let i = 0; i < charStrings.count; i++) {
  35864. const glyph = charStrings.get(i);
  35865. if (glyph.length === 0) {
  35866. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  35867. continue;
  35868. }
  35869. charStringsIndex.add(glyph);
  35870. }
  35871. return this.compileIndex(charStringsIndex);
  35872. }
  35873. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  35874. let out;
  35875. const numGlyphsLessNotDef = numGlyphs - 1;
  35876. if (isCIDFont) {
  35877. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  35878. } else {
  35879. const length = 1 + numGlyphsLessNotDef * 2;
  35880. out = new Uint8Array(length);
  35881. out[0] = 0;
  35882. let charsetIndex = 0;
  35883. const numCharsets = charset.charset.length;
  35884. let warned = false;
  35885. for (let i = 1; i < out.length; i += 2) {
  35886. let sid = 0;
  35887. if (charsetIndex < numCharsets) {
  35888. const name = charset.charset[charsetIndex++];
  35889. sid = strings.getSID(name);
  35890. if (sid === -1) {
  35891. sid = 0;
  35892. if (!warned) {
  35893. warned = true;
  35894. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  35895. }
  35896. }
  35897. }
  35898. out[i] = sid >> 8 & 0xff;
  35899. out[i + 1] = sid & 0xff;
  35900. }
  35901. }
  35902. return this.compileTypedArray(out);
  35903. }
  35904. compileEncoding(encoding) {
  35905. return this.compileTypedArray(encoding.raw);
  35906. }
  35907. compileFDSelect(fdSelect) {
  35908. const format = fdSelect.format;
  35909. let out, i;
  35910. switch (format) {
  35911. case 0:
  35912. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  35913. out[0] = format;
  35914. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  35915. out[i + 1] = fdSelect.fdSelect[i];
  35916. }
  35917. break;
  35918. case 3:
  35919. const start = 0;
  35920. let lastFD = fdSelect.fdSelect[0];
  35921. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  35922. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  35923. const currentFD = fdSelect.fdSelect[i];
  35924. if (currentFD !== lastFD) {
  35925. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  35926. lastFD = currentFD;
  35927. }
  35928. }
  35929. const numRanges = (ranges.length - 3) / 3;
  35930. ranges[1] = numRanges >> 8 & 0xff;
  35931. ranges[2] = numRanges & 0xff;
  35932. ranges.push(i >> 8 & 0xff, i & 0xff);
  35933. out = new Uint8Array(ranges);
  35934. break;
  35935. }
  35936. return this.compileTypedArray(out);
  35937. }
  35938. compileTypedArray(data) {
  35939. const out = [];
  35940. for (let i = 0, ii = data.length; i < ii; ++i) {
  35941. out[i] = data[i];
  35942. }
  35943. return out;
  35944. }
  35945. compileIndex(index, trackers = []) {
  35946. const objects = index.objects;
  35947. const count = objects.length;
  35948. if (count === 0) {
  35949. return [0, 0, 0];
  35950. }
  35951. const data = [count >> 8 & 0xff, count & 0xff];
  35952. let lastOffset = 1,
  35953. i;
  35954. for (i = 0; i < count; ++i) {
  35955. lastOffset += objects[i].length;
  35956. }
  35957. let offsetSize;
  35958. if (lastOffset < 0x100) {
  35959. offsetSize = 1;
  35960. } else if (lastOffset < 0x10000) {
  35961. offsetSize = 2;
  35962. } else if (lastOffset < 0x1000000) {
  35963. offsetSize = 3;
  35964. } else {
  35965. offsetSize = 4;
  35966. }
  35967. data.push(offsetSize);
  35968. let relativeOffset = 1;
  35969. for (i = 0; i < count + 1; i++) {
  35970. if (offsetSize === 1) {
  35971. data.push(relativeOffset & 0xff);
  35972. } else if (offsetSize === 2) {
  35973. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35974. } else if (offsetSize === 3) {
  35975. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35976. } else {
  35977. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35978. }
  35979. if (objects[i]) {
  35980. relativeOffset += objects[i].length;
  35981. }
  35982. }
  35983. for (i = 0; i < count; i++) {
  35984. if (trackers[i]) {
  35985. trackers[i].offset(data.length);
  35986. }
  35987. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  35988. data.push(objects[i][j]);
  35989. }
  35990. }
  35991. return data;
  35992. }
  35993. }
  35994. exports.CFFCompiler = CFFCompiler;
  35995. /***/ }),
  35996. /* 46 */
  35997. /***/ ((__unused_webpack_module, exports) => {
  35998. Object.defineProperty(exports, "__esModule", ({
  35999. value: true
  36000. }));
  36001. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  36002. 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"];
  36003. exports.ISOAdobeCharset = ISOAdobeCharset;
  36004. 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"];
  36005. exports.ExpertCharset = ExpertCharset;
  36006. 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"];
  36007. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36008. /***/ }),
  36009. /* 47 */
  36010. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36011. Object.defineProperty(exports, "__esModule", ({
  36012. value: true
  36013. }));
  36014. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  36015. exports.getStandardFontName = getStandardFontName;
  36016. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  36017. var _core_utils = __w_pdfjs_require__(8);
  36018. var _fonts_utils = __w_pdfjs_require__(18);
  36019. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36020. t["Times-Roman"] = "Times-Roman";
  36021. t.Helvetica = "Helvetica";
  36022. t.Courier = "Courier";
  36023. t.Symbol = "Symbol";
  36024. t["Times-Bold"] = "Times-Bold";
  36025. t["Helvetica-Bold"] = "Helvetica-Bold";
  36026. t["Courier-Bold"] = "Courier-Bold";
  36027. t.ZapfDingbats = "ZapfDingbats";
  36028. t["Times-Italic"] = "Times-Italic";
  36029. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  36030. t["Courier-Oblique"] = "Courier-Oblique";
  36031. t["Times-BoldItalic"] = "Times-BoldItalic";
  36032. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  36033. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  36034. t.ArialNarrow = "Helvetica";
  36035. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  36036. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  36037. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  36038. t.ArialBlack = "Helvetica";
  36039. t["ArialBlack-Bold"] = "Helvetica-Bold";
  36040. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  36041. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  36042. t["Arial-Black"] = "Helvetica";
  36043. t["Arial-Black-Bold"] = "Helvetica-Bold";
  36044. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  36045. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  36046. t.Arial = "Helvetica";
  36047. t["Arial-Bold"] = "Helvetica-Bold";
  36048. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  36049. t["Arial-Italic"] = "Helvetica-Oblique";
  36050. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  36051. t["Arial-BoldMT"] = "Helvetica-Bold";
  36052. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  36053. t.ArialMT = "Helvetica";
  36054. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  36055. t["Courier-Italic"] = "Courier-Oblique";
  36056. t.CourierNew = "Courier";
  36057. t["CourierNew-Bold"] = "Courier-Bold";
  36058. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  36059. t["CourierNew-Italic"] = "Courier-Oblique";
  36060. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  36061. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  36062. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  36063. t.CourierNewPSMT = "Courier";
  36064. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  36065. t["Helvetica-Italic"] = "Helvetica-Oblique";
  36066. t["Symbol-Bold"] = "Symbol";
  36067. t["Symbol-BoldItalic"] = "Symbol";
  36068. t["Symbol-Italic"] = "Symbol";
  36069. t.TimesNewRoman = "Times-Roman";
  36070. t["TimesNewRoman-Bold"] = "Times-Bold";
  36071. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  36072. t["TimesNewRoman-Italic"] = "Times-Italic";
  36073. t.TimesNewRomanPS = "Times-Roman";
  36074. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  36075. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  36076. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  36077. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  36078. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  36079. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  36080. t.TimesNewRomanPSMT = "Times-Roman";
  36081. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  36082. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  36083. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  36084. });
  36085. exports.getStdFontMap = getStdFontMap;
  36086. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36087. t.Courier = "FoxitFixed.pfb";
  36088. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  36089. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  36090. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  36091. t.Helvetica = "FoxitSans.pfb";
  36092. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  36093. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  36094. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  36095. t["Times-Roman"] = "FoxitSerif.pfb";
  36096. t["Times-Bold"] = "FoxitSerifBold.pfb";
  36097. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  36098. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  36099. t.Symbol = "FoxitSymbol.pfb";
  36100. t.ZapfDingbats = "FoxitDingbats.pfb";
  36101. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  36102. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  36103. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  36104. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  36105. });
  36106. exports.getFontNameToFileMap = getFontNameToFileMap;
  36107. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36108. t.Calibri = "Helvetica";
  36109. t["Calibri-Bold"] = "Helvetica-Bold";
  36110. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  36111. t["Calibri-Italic"] = "Helvetica-Oblique";
  36112. t.CenturyGothic = "Helvetica";
  36113. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  36114. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  36115. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  36116. t.ComicSansMS = "Comic Sans MS";
  36117. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  36118. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  36119. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  36120. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  36121. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  36122. t["ItcSymbol-Book"] = "Helvetica";
  36123. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  36124. t["ItcSymbol-Medium"] = "Helvetica";
  36125. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  36126. t.LucidaConsole = "Courier";
  36127. t["LucidaConsole-Bold"] = "Courier-Bold";
  36128. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  36129. t["LucidaConsole-Italic"] = "Courier-Oblique";
  36130. t["LucidaSans-Demi"] = "Helvetica-Bold";
  36131. t["MS-Gothic"] = "MS Gothic";
  36132. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  36133. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  36134. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  36135. t["MS-Mincho"] = "MS Mincho";
  36136. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  36137. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  36138. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  36139. t["MS-PGothic"] = "MS PGothic";
  36140. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  36141. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  36142. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  36143. t["MS-PMincho"] = "MS PMincho";
  36144. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  36145. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  36146. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  36147. t.NuptialScript = "Times-Italic";
  36148. t.SegoeUISymbol = "Helvetica";
  36149. t.Wingdings = "ZapfDingbats";
  36150. t["Wingdings-Regular"] = "ZapfDingbats";
  36151. });
  36152. exports.getNonStdFontMap = getNonStdFontMap;
  36153. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36154. t["Adobe Jenson"] = true;
  36155. t["Adobe Text"] = true;
  36156. t.Albertus = true;
  36157. t.Aldus = true;
  36158. t.Alexandria = true;
  36159. t.Algerian = true;
  36160. t["American Typewriter"] = true;
  36161. t.Antiqua = true;
  36162. t.Apex = true;
  36163. t.Arno = true;
  36164. t.Aster = true;
  36165. t.Aurora = true;
  36166. t.Baskerville = true;
  36167. t.Bell = true;
  36168. t.Bembo = true;
  36169. t["Bembo Schoolbook"] = true;
  36170. t.Benguiat = true;
  36171. t["Berkeley Old Style"] = true;
  36172. t["Bernhard Modern"] = true;
  36173. t["Berthold City"] = true;
  36174. t.Bodoni = true;
  36175. t["Bauer Bodoni"] = true;
  36176. t["Book Antiqua"] = true;
  36177. t.Bookman = true;
  36178. t["Bordeaux Roman"] = true;
  36179. t["Californian FB"] = true;
  36180. t.Calisto = true;
  36181. t.Calvert = true;
  36182. t.Capitals = true;
  36183. t.Cambria = true;
  36184. t.Cartier = true;
  36185. t.Caslon = true;
  36186. t.Catull = true;
  36187. t.Centaur = true;
  36188. t["Century Old Style"] = true;
  36189. t["Century Schoolbook"] = true;
  36190. t.Chaparral = true;
  36191. t["Charis SIL"] = true;
  36192. t.Cheltenham = true;
  36193. t["Cholla Slab"] = true;
  36194. t.Clarendon = true;
  36195. t.Clearface = true;
  36196. t.Cochin = true;
  36197. t.Colonna = true;
  36198. t["Computer Modern"] = true;
  36199. t["Concrete Roman"] = true;
  36200. t.Constantia = true;
  36201. t["Cooper Black"] = true;
  36202. t.Corona = true;
  36203. t.Ecotype = true;
  36204. t.Egyptienne = true;
  36205. t.Elephant = true;
  36206. t.Excelsior = true;
  36207. t.Fairfield = true;
  36208. t["FF Scala"] = true;
  36209. t.Folkard = true;
  36210. t.Footlight = true;
  36211. t.FreeSerif = true;
  36212. t["Friz Quadrata"] = true;
  36213. t.Garamond = true;
  36214. t.Gentium = true;
  36215. t.Georgia = true;
  36216. t.Gloucester = true;
  36217. t["Goudy Old Style"] = true;
  36218. t["Goudy Schoolbook"] = true;
  36219. t["Goudy Pro Font"] = true;
  36220. t.Granjon = true;
  36221. t["Guardian Egyptian"] = true;
  36222. t.Heather = true;
  36223. t.Hercules = true;
  36224. t["High Tower Text"] = true;
  36225. t.Hiroshige = true;
  36226. t["Hoefler Text"] = true;
  36227. t["Humana Serif"] = true;
  36228. t.Imprint = true;
  36229. t["Ionic No. 5"] = true;
  36230. t.Janson = true;
  36231. t.Joanna = true;
  36232. t.Korinna = true;
  36233. t.Lexicon = true;
  36234. t.LiberationSerif = true;
  36235. t["Liberation Serif"] = true;
  36236. t["Linux Libertine"] = true;
  36237. t.Literaturnaya = true;
  36238. t.Lucida = true;
  36239. t["Lucida Bright"] = true;
  36240. t.Melior = true;
  36241. t.Memphis = true;
  36242. t.Miller = true;
  36243. t.Minion = true;
  36244. t.Modern = true;
  36245. t["Mona Lisa"] = true;
  36246. t["Mrs Eaves"] = true;
  36247. t["MS Serif"] = true;
  36248. t["Museo Slab"] = true;
  36249. t["New York"] = true;
  36250. t["Nimbus Roman"] = true;
  36251. t["NPS Rawlinson Roadway"] = true;
  36252. t.NuptialScript = true;
  36253. t.Palatino = true;
  36254. t.Perpetua = true;
  36255. t.Plantin = true;
  36256. t["Plantin Schoolbook"] = true;
  36257. t.Playbill = true;
  36258. t["Poor Richard"] = true;
  36259. t["Rawlinson Roadway"] = true;
  36260. t.Renault = true;
  36261. t.Requiem = true;
  36262. t.Rockwell = true;
  36263. t.Roman = true;
  36264. t["Rotis Serif"] = true;
  36265. t.Sabon = true;
  36266. t.Scala = true;
  36267. t.Seagull = true;
  36268. t.Sistina = true;
  36269. t.Souvenir = true;
  36270. t.STIX = true;
  36271. t["Stone Informal"] = true;
  36272. t["Stone Serif"] = true;
  36273. t.Sylfaen = true;
  36274. t.Times = true;
  36275. t.Trajan = true;
  36276. t["Trinité"] = true;
  36277. t["Trump Mediaeval"] = true;
  36278. t.Utopia = true;
  36279. t["Vale Type"] = true;
  36280. t["Bitstream Vera"] = true;
  36281. t["Vera Serif"] = true;
  36282. t.Versailles = true;
  36283. t.Wanted = true;
  36284. t.Weiss = true;
  36285. t["Wide Latin"] = true;
  36286. t.Windsor = true;
  36287. t.XITS = true;
  36288. });
  36289. exports.getSerifFonts = getSerifFonts;
  36290. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36291. t.Dingbats = true;
  36292. t.Symbol = true;
  36293. t.ZapfDingbats = true;
  36294. });
  36295. exports.getSymbolsFonts = getSymbolsFonts;
  36296. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36297. t[2] = 10;
  36298. t[3] = 32;
  36299. t[4] = 33;
  36300. t[5] = 34;
  36301. t[6] = 35;
  36302. t[7] = 36;
  36303. t[8] = 37;
  36304. t[9] = 38;
  36305. t[10] = 39;
  36306. t[11] = 40;
  36307. t[12] = 41;
  36308. t[13] = 42;
  36309. t[14] = 43;
  36310. t[15] = 44;
  36311. t[16] = 45;
  36312. t[17] = 46;
  36313. t[18] = 47;
  36314. t[19] = 48;
  36315. t[20] = 49;
  36316. t[21] = 50;
  36317. t[22] = 51;
  36318. t[23] = 52;
  36319. t[24] = 53;
  36320. t[25] = 54;
  36321. t[26] = 55;
  36322. t[27] = 56;
  36323. t[28] = 57;
  36324. t[29] = 58;
  36325. t[30] = 894;
  36326. t[31] = 60;
  36327. t[32] = 61;
  36328. t[33] = 62;
  36329. t[34] = 63;
  36330. t[35] = 64;
  36331. t[36] = 65;
  36332. t[37] = 66;
  36333. t[38] = 67;
  36334. t[39] = 68;
  36335. t[40] = 69;
  36336. t[41] = 70;
  36337. t[42] = 71;
  36338. t[43] = 72;
  36339. t[44] = 73;
  36340. t[45] = 74;
  36341. t[46] = 75;
  36342. t[47] = 76;
  36343. t[48] = 77;
  36344. t[49] = 78;
  36345. t[50] = 79;
  36346. t[51] = 80;
  36347. t[52] = 81;
  36348. t[53] = 82;
  36349. t[54] = 83;
  36350. t[55] = 84;
  36351. t[56] = 85;
  36352. t[57] = 86;
  36353. t[58] = 87;
  36354. t[59] = 88;
  36355. t[60] = 89;
  36356. t[61] = 90;
  36357. t[62] = 91;
  36358. t[63] = 92;
  36359. t[64] = 93;
  36360. t[65] = 94;
  36361. t[66] = 95;
  36362. t[67] = 96;
  36363. t[68] = 97;
  36364. t[69] = 98;
  36365. t[70] = 99;
  36366. t[71] = 100;
  36367. t[72] = 101;
  36368. t[73] = 102;
  36369. t[74] = 103;
  36370. t[75] = 104;
  36371. t[76] = 105;
  36372. t[77] = 106;
  36373. t[78] = 107;
  36374. t[79] = 108;
  36375. t[80] = 109;
  36376. t[81] = 110;
  36377. t[82] = 111;
  36378. t[83] = 112;
  36379. t[84] = 113;
  36380. t[85] = 114;
  36381. t[86] = 115;
  36382. t[87] = 116;
  36383. t[88] = 117;
  36384. t[89] = 118;
  36385. t[90] = 119;
  36386. t[91] = 120;
  36387. t[92] = 121;
  36388. t[93] = 122;
  36389. t[94] = 123;
  36390. t[95] = 124;
  36391. t[96] = 125;
  36392. t[97] = 126;
  36393. t[98] = 196;
  36394. t[99] = 197;
  36395. t[100] = 199;
  36396. t[101] = 201;
  36397. t[102] = 209;
  36398. t[103] = 214;
  36399. t[104] = 220;
  36400. t[105] = 225;
  36401. t[106] = 224;
  36402. t[107] = 226;
  36403. t[108] = 228;
  36404. t[109] = 227;
  36405. t[110] = 229;
  36406. t[111] = 231;
  36407. t[112] = 233;
  36408. t[113] = 232;
  36409. t[114] = 234;
  36410. t[115] = 235;
  36411. t[116] = 237;
  36412. t[117] = 236;
  36413. t[118] = 238;
  36414. t[119] = 239;
  36415. t[120] = 241;
  36416. t[121] = 243;
  36417. t[122] = 242;
  36418. t[123] = 244;
  36419. t[124] = 246;
  36420. t[125] = 245;
  36421. t[126] = 250;
  36422. t[127] = 249;
  36423. t[128] = 251;
  36424. t[129] = 252;
  36425. t[130] = 8224;
  36426. t[131] = 176;
  36427. t[132] = 162;
  36428. t[133] = 163;
  36429. t[134] = 167;
  36430. t[135] = 8226;
  36431. t[136] = 182;
  36432. t[137] = 223;
  36433. t[138] = 174;
  36434. t[139] = 169;
  36435. t[140] = 8482;
  36436. t[141] = 180;
  36437. t[142] = 168;
  36438. t[143] = 8800;
  36439. t[144] = 198;
  36440. t[145] = 216;
  36441. t[146] = 8734;
  36442. t[147] = 177;
  36443. t[148] = 8804;
  36444. t[149] = 8805;
  36445. t[150] = 165;
  36446. t[151] = 181;
  36447. t[152] = 8706;
  36448. t[153] = 8721;
  36449. t[154] = 8719;
  36450. t[156] = 8747;
  36451. t[157] = 170;
  36452. t[158] = 186;
  36453. t[159] = 8486;
  36454. t[160] = 230;
  36455. t[161] = 248;
  36456. t[162] = 191;
  36457. t[163] = 161;
  36458. t[164] = 172;
  36459. t[165] = 8730;
  36460. t[166] = 402;
  36461. t[167] = 8776;
  36462. t[168] = 8710;
  36463. t[169] = 171;
  36464. t[170] = 187;
  36465. t[171] = 8230;
  36466. t[200] = 193;
  36467. t[203] = 205;
  36468. t[210] = 218;
  36469. t[223] = 711;
  36470. t[224] = 321;
  36471. t[225] = 322;
  36472. t[226] = 352;
  36473. t[227] = 353;
  36474. t[228] = 381;
  36475. t[229] = 382;
  36476. t[233] = 221;
  36477. t[234] = 253;
  36478. t[252] = 263;
  36479. t[253] = 268;
  36480. t[254] = 269;
  36481. t[258] = 258;
  36482. t[260] = 260;
  36483. t[261] = 261;
  36484. t[265] = 280;
  36485. t[266] = 281;
  36486. t[267] = 282;
  36487. t[268] = 283;
  36488. t[269] = 313;
  36489. t[275] = 323;
  36490. t[276] = 324;
  36491. t[278] = 328;
  36492. t[283] = 344;
  36493. t[284] = 345;
  36494. t[285] = 346;
  36495. t[286] = 347;
  36496. t[292] = 367;
  36497. t[295] = 377;
  36498. t[296] = 378;
  36499. t[298] = 380;
  36500. t[305] = 963;
  36501. t[306] = 964;
  36502. t[307] = 966;
  36503. t[308] = 8215;
  36504. t[309] = 8252;
  36505. t[310] = 8319;
  36506. t[311] = 8359;
  36507. t[312] = 8592;
  36508. t[313] = 8593;
  36509. t[337] = 9552;
  36510. t[493] = 1039;
  36511. t[494] = 1040;
  36512. t[705] = 1524;
  36513. t[706] = 8362;
  36514. t[710] = 64288;
  36515. t[711] = 64298;
  36516. t[759] = 1617;
  36517. t[761] = 1776;
  36518. t[763] = 1778;
  36519. t[775] = 1652;
  36520. t[777] = 1764;
  36521. t[778] = 1780;
  36522. t[779] = 1781;
  36523. t[780] = 1782;
  36524. t[782] = 771;
  36525. t[783] = 64726;
  36526. t[786] = 8363;
  36527. t[788] = 8532;
  36528. t[790] = 768;
  36529. t[791] = 769;
  36530. t[792] = 768;
  36531. t[795] = 803;
  36532. t[797] = 64336;
  36533. t[798] = 64337;
  36534. t[799] = 64342;
  36535. t[800] = 64343;
  36536. t[801] = 64344;
  36537. t[802] = 64345;
  36538. t[803] = 64362;
  36539. t[804] = 64363;
  36540. t[805] = 64364;
  36541. t[2424] = 7821;
  36542. t[2425] = 7822;
  36543. t[2426] = 7823;
  36544. t[2427] = 7824;
  36545. t[2428] = 7825;
  36546. t[2429] = 7826;
  36547. t[2430] = 7827;
  36548. t[2433] = 7682;
  36549. t[2678] = 8045;
  36550. t[2679] = 8046;
  36551. t[2830] = 1552;
  36552. t[2838] = 686;
  36553. t[2840] = 751;
  36554. t[2842] = 753;
  36555. t[2843] = 754;
  36556. t[2844] = 755;
  36557. t[2846] = 757;
  36558. t[2856] = 767;
  36559. t[2857] = 848;
  36560. t[2858] = 849;
  36561. t[2862] = 853;
  36562. t[2863] = 854;
  36563. t[2864] = 855;
  36564. t[2865] = 861;
  36565. t[2866] = 862;
  36566. t[2906] = 7460;
  36567. t[2908] = 7462;
  36568. t[2909] = 7463;
  36569. t[2910] = 7464;
  36570. t[2912] = 7466;
  36571. t[2913] = 7467;
  36572. t[2914] = 7468;
  36573. t[2916] = 7470;
  36574. t[2917] = 7471;
  36575. t[2918] = 7472;
  36576. t[2920] = 7474;
  36577. t[2921] = 7475;
  36578. t[2922] = 7476;
  36579. t[2924] = 7478;
  36580. t[2925] = 7479;
  36581. t[2926] = 7480;
  36582. t[2928] = 7482;
  36583. t[2929] = 7483;
  36584. t[2930] = 7484;
  36585. t[2932] = 7486;
  36586. t[2933] = 7487;
  36587. t[2934] = 7488;
  36588. t[2936] = 7490;
  36589. t[2937] = 7491;
  36590. t[2938] = 7492;
  36591. t[2940] = 7494;
  36592. t[2941] = 7495;
  36593. t[2942] = 7496;
  36594. t[2944] = 7498;
  36595. t[2946] = 7500;
  36596. t[2948] = 7502;
  36597. t[2950] = 7504;
  36598. t[2951] = 7505;
  36599. t[2952] = 7506;
  36600. t[2954] = 7508;
  36601. t[2955] = 7509;
  36602. t[2956] = 7510;
  36603. t[2958] = 7512;
  36604. t[2959] = 7513;
  36605. t[2960] = 7514;
  36606. t[2962] = 7516;
  36607. t[2963] = 7517;
  36608. t[2964] = 7518;
  36609. t[2966] = 7520;
  36610. t[2967] = 7521;
  36611. t[2968] = 7522;
  36612. t[2970] = 7524;
  36613. t[2971] = 7525;
  36614. t[2972] = 7526;
  36615. t[2974] = 7528;
  36616. t[2975] = 7529;
  36617. t[2976] = 7530;
  36618. t[2978] = 1537;
  36619. t[2979] = 1538;
  36620. t[2980] = 1539;
  36621. t[2982] = 1549;
  36622. t[2983] = 1551;
  36623. t[2984] = 1552;
  36624. t[2986] = 1554;
  36625. t[2987] = 1555;
  36626. t[2988] = 1556;
  36627. t[2990] = 1623;
  36628. t[2991] = 1624;
  36629. t[2995] = 1775;
  36630. t[2999] = 1791;
  36631. t[3002] = 64290;
  36632. t[3003] = 64291;
  36633. t[3004] = 64292;
  36634. t[3006] = 64294;
  36635. t[3007] = 64295;
  36636. t[3008] = 64296;
  36637. t[3011] = 1900;
  36638. t[3014] = 8223;
  36639. t[3015] = 8244;
  36640. t[3017] = 7532;
  36641. t[3018] = 7533;
  36642. t[3019] = 7534;
  36643. t[3075] = 7590;
  36644. t[3076] = 7591;
  36645. t[3079] = 7594;
  36646. t[3080] = 7595;
  36647. t[3083] = 7598;
  36648. t[3084] = 7599;
  36649. t[3087] = 7602;
  36650. t[3088] = 7603;
  36651. t[3091] = 7606;
  36652. t[3092] = 7607;
  36653. t[3095] = 7610;
  36654. t[3096] = 7611;
  36655. t[3099] = 7614;
  36656. t[3100] = 7615;
  36657. t[3103] = 7618;
  36658. t[3104] = 7619;
  36659. t[3107] = 8337;
  36660. t[3108] = 8338;
  36661. t[3116] = 1884;
  36662. t[3119] = 1885;
  36663. t[3120] = 1885;
  36664. t[3123] = 1886;
  36665. t[3124] = 1886;
  36666. t[3127] = 1887;
  36667. t[3128] = 1887;
  36668. t[3131] = 1888;
  36669. t[3132] = 1888;
  36670. t[3135] = 1889;
  36671. t[3136] = 1889;
  36672. t[3139] = 1890;
  36673. t[3140] = 1890;
  36674. t[3143] = 1891;
  36675. t[3144] = 1891;
  36676. t[3147] = 1892;
  36677. t[3148] = 1892;
  36678. t[3153] = 580;
  36679. t[3154] = 581;
  36680. t[3157] = 584;
  36681. t[3158] = 585;
  36682. t[3161] = 588;
  36683. t[3162] = 589;
  36684. t[3165] = 891;
  36685. t[3166] = 892;
  36686. t[3169] = 1274;
  36687. t[3170] = 1275;
  36688. t[3173] = 1278;
  36689. t[3174] = 1279;
  36690. t[3181] = 7622;
  36691. t[3182] = 7623;
  36692. t[3282] = 11799;
  36693. t[3316] = 578;
  36694. t[3379] = 42785;
  36695. t[3393] = 1159;
  36696. t[3416] = 8377;
  36697. });
  36698. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  36699. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  36700. t[227] = 322;
  36701. t[264] = 261;
  36702. t[291] = 346;
  36703. });
  36704. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  36705. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  36706. t[1] = 32;
  36707. t[4] = 65;
  36708. t[6] = 193;
  36709. t[17] = 66;
  36710. t[18] = 67;
  36711. t[21] = 268;
  36712. t[24] = 68;
  36713. t[28] = 69;
  36714. t[30] = 201;
  36715. t[32] = 282;
  36716. t[38] = 70;
  36717. t[39] = 71;
  36718. t[44] = 72;
  36719. t[47] = 73;
  36720. t[49] = 205;
  36721. t[58] = 74;
  36722. t[60] = 75;
  36723. t[62] = 76;
  36724. t[68] = 77;
  36725. t[69] = 78;
  36726. t[75] = 79;
  36727. t[87] = 80;
  36728. t[89] = 81;
  36729. t[90] = 82;
  36730. t[92] = 344;
  36731. t[94] = 83;
  36732. t[97] = 352;
  36733. t[100] = 84;
  36734. t[104] = 85;
  36735. t[115] = 86;
  36736. t[116] = 87;
  36737. t[121] = 88;
  36738. t[122] = 89;
  36739. t[124] = 221;
  36740. t[127] = 90;
  36741. t[129] = 381;
  36742. t[258] = 97;
  36743. t[260] = 225;
  36744. t[268] = 261;
  36745. t[271] = 98;
  36746. t[272] = 99;
  36747. t[273] = 263;
  36748. t[275] = 269;
  36749. t[282] = 100;
  36750. t[286] = 101;
  36751. t[288] = 233;
  36752. t[290] = 283;
  36753. t[295] = 281;
  36754. t[296] = 102;
  36755. t[336] = 103;
  36756. t[346] = 104;
  36757. t[349] = 105;
  36758. t[351] = 237;
  36759. t[361] = 106;
  36760. t[364] = 107;
  36761. t[367] = 108;
  36762. t[371] = 322;
  36763. t[373] = 109;
  36764. t[374] = 110;
  36765. t[381] = 111;
  36766. t[383] = 243;
  36767. t[393] = 112;
  36768. t[395] = 113;
  36769. t[396] = 114;
  36770. t[398] = 345;
  36771. t[400] = 115;
  36772. t[401] = 347;
  36773. t[403] = 353;
  36774. t[410] = 116;
  36775. t[437] = 117;
  36776. t[448] = 118;
  36777. t[449] = 119;
  36778. t[454] = 120;
  36779. t[455] = 121;
  36780. t[457] = 253;
  36781. t[460] = 122;
  36782. t[462] = 382;
  36783. t[463] = 380;
  36784. t[853] = 44;
  36785. t[855] = 58;
  36786. t[856] = 46;
  36787. t[876] = 47;
  36788. t[878] = 45;
  36789. t[882] = 45;
  36790. t[894] = 40;
  36791. t[895] = 41;
  36792. t[896] = 91;
  36793. t[897] = 93;
  36794. t[923] = 64;
  36795. t[1004] = 48;
  36796. t[1005] = 49;
  36797. t[1006] = 50;
  36798. t[1007] = 51;
  36799. t[1008] = 52;
  36800. t[1009] = 53;
  36801. t[1010] = 54;
  36802. t[1011] = 55;
  36803. t[1012] = 56;
  36804. t[1013] = 57;
  36805. t[1081] = 37;
  36806. t[1085] = 43;
  36807. t[1086] = 45;
  36808. });
  36809. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  36810. function getStandardFontName(name) {
  36811. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  36812. const stdFontMap = getStdFontMap();
  36813. return stdFontMap[fontName];
  36814. }
  36815. /***/ }),
  36816. /* 48 */
  36817. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36818. Object.defineProperty(exports, "__esModule", ({
  36819. value: true
  36820. }));
  36821. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  36822. var _util = __w_pdfjs_require__(2);
  36823. class ToUnicodeMap {
  36824. constructor(cmap = []) {
  36825. this._map = cmap;
  36826. }
  36827. get length() {
  36828. return this._map.length;
  36829. }
  36830. forEach(callback) {
  36831. for (const charCode in this._map) {
  36832. callback(charCode, this._map[charCode].charCodeAt(0));
  36833. }
  36834. }
  36835. has(i) {
  36836. return this._map[i] !== undefined;
  36837. }
  36838. get(i) {
  36839. return this._map[i];
  36840. }
  36841. charCodeOf(value) {
  36842. const map = this._map;
  36843. if (map.length <= 0x10000) {
  36844. return map.indexOf(value);
  36845. }
  36846. for (const charCode in map) {
  36847. if (map[charCode] === value) {
  36848. return charCode | 0;
  36849. }
  36850. }
  36851. return -1;
  36852. }
  36853. amend(map) {
  36854. for (const charCode in map) {
  36855. this._map[charCode] = map[charCode];
  36856. }
  36857. }
  36858. }
  36859. exports.ToUnicodeMap = ToUnicodeMap;
  36860. class IdentityToUnicodeMap {
  36861. constructor(firstChar, lastChar) {
  36862. this.firstChar = firstChar;
  36863. this.lastChar = lastChar;
  36864. }
  36865. get length() {
  36866. return this.lastChar + 1 - this.firstChar;
  36867. }
  36868. forEach(callback) {
  36869. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  36870. callback(i, i);
  36871. }
  36872. }
  36873. has(i) {
  36874. return this.firstChar <= i && i <= this.lastChar;
  36875. }
  36876. get(i) {
  36877. if (this.firstChar <= i && i <= this.lastChar) {
  36878. return String.fromCharCode(i);
  36879. }
  36880. return undefined;
  36881. }
  36882. charCodeOf(v) {
  36883. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  36884. }
  36885. amend(map) {
  36886. (0, _util.unreachable)("Should not call amend()");
  36887. }
  36888. }
  36889. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  36890. /***/ }),
  36891. /* 49 */
  36892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36893. Object.defineProperty(exports, "__esModule", ({
  36894. value: true
  36895. }));
  36896. exports.CFFFont = void 0;
  36897. var _cff_parser = __w_pdfjs_require__(45);
  36898. var _fonts_utils = __w_pdfjs_require__(18);
  36899. var _util = __w_pdfjs_require__(2);
  36900. class CFFFont {
  36901. constructor(file, properties) {
  36902. this.properties = properties;
  36903. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  36904. this.cff = parser.parse();
  36905. this.cff.duplicateFirstGlyph();
  36906. const compiler = new _cff_parser.CFFCompiler(this.cff);
  36907. this.seacs = this.cff.seacs;
  36908. try {
  36909. this.data = compiler.compile();
  36910. } catch (e) {
  36911. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  36912. this.data = file;
  36913. }
  36914. this._createBuiltInEncoding();
  36915. }
  36916. get numGlyphs() {
  36917. return this.cff.charStrings.count;
  36918. }
  36919. getCharset() {
  36920. return this.cff.charset.charset;
  36921. }
  36922. getGlyphMapping() {
  36923. const cff = this.cff;
  36924. const properties = this.properties;
  36925. const charsets = cff.charset.charset;
  36926. let charCodeToGlyphId;
  36927. let glyphId;
  36928. if (properties.composite) {
  36929. charCodeToGlyphId = Object.create(null);
  36930. let charCode;
  36931. if (cff.isCIDFont) {
  36932. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  36933. const cid = charsets[glyphId];
  36934. charCode = properties.cMap.charCodeOf(cid);
  36935. charCodeToGlyphId[charCode] = glyphId;
  36936. }
  36937. } else {
  36938. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  36939. charCode = properties.cMap.charCodeOf(glyphId);
  36940. charCodeToGlyphId[charCode] = glyphId;
  36941. }
  36942. }
  36943. return charCodeToGlyphId;
  36944. }
  36945. let encoding = cff.encoding ? cff.encoding.encoding : null;
  36946. if (properties.isInternalFont) {
  36947. encoding = properties.defaultEncoding;
  36948. }
  36949. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  36950. return charCodeToGlyphId;
  36951. }
  36952. hasGlyphId(id) {
  36953. return this.cff.hasGlyphId(id);
  36954. }
  36955. _createBuiltInEncoding() {
  36956. const {
  36957. charset,
  36958. encoding
  36959. } = this.cff;
  36960. if (!charset || !encoding) {
  36961. return;
  36962. }
  36963. const charsets = charset.charset,
  36964. encodings = encoding.encoding;
  36965. const map = [];
  36966. for (const charCode in encodings) {
  36967. const glyphId = encodings[charCode];
  36968. if (glyphId >= 0) {
  36969. const glyphName = charsets[glyphId];
  36970. if (glyphName) {
  36971. map[charCode] = glyphName;
  36972. }
  36973. }
  36974. }
  36975. if (map.length > 0) {
  36976. this.properties.builtInEncoding = map;
  36977. }
  36978. }
  36979. }
  36980. exports.CFFFont = CFFFont;
  36981. /***/ }),
  36982. /* 50 */
  36983. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36984. Object.defineProperty(exports, "__esModule", ({
  36985. value: true
  36986. }));
  36987. exports.FontRendererFactory = void 0;
  36988. var _util = __w_pdfjs_require__(2);
  36989. var _cff_parser = __w_pdfjs_require__(45);
  36990. var _glyphlist = __w_pdfjs_require__(20);
  36991. var _encodings = __w_pdfjs_require__(19);
  36992. var _stream = __w_pdfjs_require__(10);
  36993. function getUint32(data, offset) {
  36994. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  36995. }
  36996. function getUint16(data, offset) {
  36997. return data[offset] << 8 | data[offset + 1];
  36998. }
  36999. function getInt16(data, offset) {
  37000. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  37001. }
  37002. function getInt8(data, offset) {
  37003. return data[offset] << 24 >> 24;
  37004. }
  37005. function getFloat214(data, offset) {
  37006. return getInt16(data, offset) / 16384;
  37007. }
  37008. function getSubroutineBias(subrs) {
  37009. const numSubrs = subrs.length;
  37010. let bias = 32768;
  37011. if (numSubrs < 1240) {
  37012. bias = 107;
  37013. } else if (numSubrs < 33900) {
  37014. bias = 1131;
  37015. }
  37016. return bias;
  37017. }
  37018. function parseCmap(data, start, end) {
  37019. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  37020. const format = getUint16(data, start + offset);
  37021. let ranges, p, i;
  37022. if (format === 4) {
  37023. getUint16(data, start + offset + 2);
  37024. const segCount = getUint16(data, start + offset + 6) >> 1;
  37025. p = start + offset + 14;
  37026. ranges = [];
  37027. for (i = 0; i < segCount; i++, p += 2) {
  37028. ranges[i] = {
  37029. end: getUint16(data, p)
  37030. };
  37031. }
  37032. p += 2;
  37033. for (i = 0; i < segCount; i++, p += 2) {
  37034. ranges[i].start = getUint16(data, p);
  37035. }
  37036. for (i = 0; i < segCount; i++, p += 2) {
  37037. ranges[i].idDelta = getUint16(data, p);
  37038. }
  37039. for (i = 0; i < segCount; i++, p += 2) {
  37040. let idOffset = getUint16(data, p);
  37041. if (idOffset === 0) {
  37042. continue;
  37043. }
  37044. ranges[i].ids = [];
  37045. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  37046. ranges[i].ids[j] = getUint16(data, p + idOffset);
  37047. idOffset += 2;
  37048. }
  37049. }
  37050. return ranges;
  37051. } else if (format === 12) {
  37052. const groups = getUint32(data, start + offset + 12);
  37053. p = start + offset + 16;
  37054. ranges = [];
  37055. for (i = 0; i < groups; i++) {
  37056. start = getUint32(data, p);
  37057. ranges.push({
  37058. start,
  37059. end: getUint32(data, p + 4),
  37060. idDelta: getUint32(data, p + 8) - start
  37061. });
  37062. p += 12;
  37063. }
  37064. return ranges;
  37065. }
  37066. throw new _util.FormatError(`unsupported cmap: ${format}`);
  37067. }
  37068. function parseCff(data, start, end, seacAnalysisEnabled) {
  37069. const properties = {};
  37070. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  37071. const cff = parser.parse();
  37072. return {
  37073. glyphs: cff.charStrings.objects,
  37074. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  37075. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  37076. isCFFCIDFont: cff.isCIDFont,
  37077. fdSelect: cff.fdSelect,
  37078. fdArray: cff.fdArray
  37079. };
  37080. }
  37081. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  37082. let itemSize, itemDecode;
  37083. if (isGlyphLocationsLong) {
  37084. itemSize = 4;
  37085. itemDecode = getUint32;
  37086. } else {
  37087. itemSize = 2;
  37088. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  37089. }
  37090. const glyphs = [];
  37091. let startOffset = itemDecode(loca, 0);
  37092. for (let j = itemSize; j < loca.length; j += itemSize) {
  37093. const endOffset = itemDecode(loca, j);
  37094. glyphs.push(glyf.subarray(startOffset, endOffset));
  37095. startOffset = endOffset;
  37096. }
  37097. return glyphs;
  37098. }
  37099. function lookupCmap(ranges, unicode) {
  37100. const code = unicode.codePointAt(0);
  37101. let gid = 0,
  37102. l = 0,
  37103. r = ranges.length - 1;
  37104. while (l < r) {
  37105. const c = l + r + 1 >> 1;
  37106. if (code < ranges[c].start) {
  37107. r = c - 1;
  37108. } else {
  37109. l = c;
  37110. }
  37111. }
  37112. if (ranges[l].start <= code && code <= ranges[l].end) {
  37113. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  37114. }
  37115. return {
  37116. charCode: code,
  37117. glyphId: gid
  37118. };
  37119. }
  37120. function compileGlyf(code, cmds, font) {
  37121. function moveTo(x, y) {
  37122. cmds.push({
  37123. cmd: "moveTo",
  37124. args: [x, y]
  37125. });
  37126. }
  37127. function lineTo(x, y) {
  37128. cmds.push({
  37129. cmd: "lineTo",
  37130. args: [x, y]
  37131. });
  37132. }
  37133. function quadraticCurveTo(xa, ya, x, y) {
  37134. cmds.push({
  37135. cmd: "quadraticCurveTo",
  37136. args: [xa, ya, x, y]
  37137. });
  37138. }
  37139. let i = 0;
  37140. const numberOfContours = getInt16(code, i);
  37141. let flags;
  37142. let x = 0,
  37143. y = 0;
  37144. i += 10;
  37145. if (numberOfContours < 0) {
  37146. do {
  37147. flags = getUint16(code, i);
  37148. const glyphIndex = getUint16(code, i + 2);
  37149. i += 4;
  37150. let arg1, arg2;
  37151. if (flags & 0x01) {
  37152. if (flags & 0x02) {
  37153. arg1 = getInt16(code, i);
  37154. arg2 = getInt16(code, i + 2);
  37155. } else {
  37156. arg1 = getUint16(code, i);
  37157. arg2 = getUint16(code, i + 2);
  37158. }
  37159. i += 4;
  37160. } else {
  37161. if (flags & 0x02) {
  37162. arg1 = getInt8(code, i++);
  37163. arg2 = getInt8(code, i++);
  37164. } else {
  37165. arg1 = code[i++];
  37166. arg2 = code[i++];
  37167. }
  37168. }
  37169. if (flags & 0x02) {
  37170. x = arg1;
  37171. y = arg2;
  37172. } else {
  37173. x = 0;
  37174. y = 0;
  37175. }
  37176. let scaleX = 1,
  37177. scaleY = 1,
  37178. scale01 = 0,
  37179. scale10 = 0;
  37180. if (flags & 0x08) {
  37181. scaleX = scaleY = getFloat214(code, i);
  37182. i += 2;
  37183. } else if (flags & 0x40) {
  37184. scaleX = getFloat214(code, i);
  37185. scaleY = getFloat214(code, i + 2);
  37186. i += 4;
  37187. } else if (flags & 0x80) {
  37188. scaleX = getFloat214(code, i);
  37189. scale01 = getFloat214(code, i + 2);
  37190. scale10 = getFloat214(code, i + 4);
  37191. scaleY = getFloat214(code, i + 6);
  37192. i += 8;
  37193. }
  37194. const subglyph = font.glyphs[glyphIndex];
  37195. if (subglyph) {
  37196. cmds.push({
  37197. cmd: "save"
  37198. }, {
  37199. cmd: "transform",
  37200. args: [scaleX, scale01, scale10, scaleY, x, y]
  37201. });
  37202. if (!(flags & 0x02)) {}
  37203. compileGlyf(subglyph, cmds, font);
  37204. cmds.push({
  37205. cmd: "restore"
  37206. });
  37207. }
  37208. } while (flags & 0x20);
  37209. } else {
  37210. const endPtsOfContours = [];
  37211. let j, jj;
  37212. for (j = 0; j < numberOfContours; j++) {
  37213. endPtsOfContours.push(getUint16(code, i));
  37214. i += 2;
  37215. }
  37216. const instructionLength = getUint16(code, i);
  37217. i += 2 + instructionLength;
  37218. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  37219. const points = [];
  37220. while (points.length < numberOfPoints) {
  37221. flags = code[i++];
  37222. let repeat = 1;
  37223. if (flags & 0x08) {
  37224. repeat += code[i++];
  37225. }
  37226. while (repeat-- > 0) {
  37227. points.push({
  37228. flags
  37229. });
  37230. }
  37231. }
  37232. for (j = 0; j < numberOfPoints; j++) {
  37233. switch (points[j].flags & 0x12) {
  37234. case 0x00:
  37235. x += getInt16(code, i);
  37236. i += 2;
  37237. break;
  37238. case 0x02:
  37239. x -= code[i++];
  37240. break;
  37241. case 0x12:
  37242. x += code[i++];
  37243. break;
  37244. }
  37245. points[j].x = x;
  37246. }
  37247. for (j = 0; j < numberOfPoints; j++) {
  37248. switch (points[j].flags & 0x24) {
  37249. case 0x00:
  37250. y += getInt16(code, i);
  37251. i += 2;
  37252. break;
  37253. case 0x04:
  37254. y -= code[i++];
  37255. break;
  37256. case 0x24:
  37257. y += code[i++];
  37258. break;
  37259. }
  37260. points[j].y = y;
  37261. }
  37262. let startPoint = 0;
  37263. for (i = 0; i < numberOfContours; i++) {
  37264. const endPoint = endPtsOfContours[i];
  37265. const contour = points.slice(startPoint, endPoint + 1);
  37266. if (contour[0].flags & 1) {
  37267. contour.push(contour[0]);
  37268. } else if (contour[contour.length - 1].flags & 1) {
  37269. contour.unshift(contour[contour.length - 1]);
  37270. } else {
  37271. const p = {
  37272. flags: 1,
  37273. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  37274. y: (contour[0].y + contour[contour.length - 1].y) / 2
  37275. };
  37276. contour.unshift(p);
  37277. contour.push(p);
  37278. }
  37279. moveTo(contour[0].x, contour[0].y);
  37280. for (j = 1, jj = contour.length; j < jj; j++) {
  37281. if (contour[j].flags & 1) {
  37282. lineTo(contour[j].x, contour[j].y);
  37283. } else if (contour[j + 1].flags & 1) {
  37284. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  37285. j++;
  37286. } else {
  37287. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  37288. }
  37289. }
  37290. startPoint = endPoint + 1;
  37291. }
  37292. }
  37293. }
  37294. function compileCharString(charStringCode, cmds, font, glyphId) {
  37295. function moveTo(x, y) {
  37296. cmds.push({
  37297. cmd: "moveTo",
  37298. args: [x, y]
  37299. });
  37300. }
  37301. function lineTo(x, y) {
  37302. cmds.push({
  37303. cmd: "lineTo",
  37304. args: [x, y]
  37305. });
  37306. }
  37307. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  37308. cmds.push({
  37309. cmd: "bezierCurveTo",
  37310. args: [x1, y1, x2, y2, x, y]
  37311. });
  37312. }
  37313. const stack = [];
  37314. let x = 0,
  37315. y = 0;
  37316. let stems = 0;
  37317. function parse(code) {
  37318. let i = 0;
  37319. while (i < code.length) {
  37320. let stackClean = false;
  37321. let v = code[i++];
  37322. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  37323. switch (v) {
  37324. case 1:
  37325. stems += stack.length >> 1;
  37326. stackClean = true;
  37327. break;
  37328. case 3:
  37329. stems += stack.length >> 1;
  37330. stackClean = true;
  37331. break;
  37332. case 4:
  37333. y += stack.pop();
  37334. moveTo(x, y);
  37335. stackClean = true;
  37336. break;
  37337. case 5:
  37338. while (stack.length > 0) {
  37339. x += stack.shift();
  37340. y += stack.shift();
  37341. lineTo(x, y);
  37342. }
  37343. break;
  37344. case 6:
  37345. while (stack.length > 0) {
  37346. x += stack.shift();
  37347. lineTo(x, y);
  37348. if (stack.length === 0) {
  37349. break;
  37350. }
  37351. y += stack.shift();
  37352. lineTo(x, y);
  37353. }
  37354. break;
  37355. case 7:
  37356. while (stack.length > 0) {
  37357. y += stack.shift();
  37358. lineTo(x, y);
  37359. if (stack.length === 0) {
  37360. break;
  37361. }
  37362. x += stack.shift();
  37363. lineTo(x, y);
  37364. }
  37365. break;
  37366. case 8:
  37367. while (stack.length > 0) {
  37368. xa = x + stack.shift();
  37369. ya = y + stack.shift();
  37370. xb = xa + stack.shift();
  37371. yb = ya + stack.shift();
  37372. x = xb + stack.shift();
  37373. y = yb + stack.shift();
  37374. bezierCurveTo(xa, ya, xb, yb, x, y);
  37375. }
  37376. break;
  37377. case 10:
  37378. n = stack.pop();
  37379. subrCode = null;
  37380. if (font.isCFFCIDFont) {
  37381. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  37382. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  37383. const fontDict = font.fdArray[fdIndex];
  37384. let subrs;
  37385. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  37386. subrs = fontDict.privateDict.subrsIndex.objects;
  37387. }
  37388. if (subrs) {
  37389. n += getSubroutineBias(subrs);
  37390. subrCode = subrs[n];
  37391. }
  37392. } else {
  37393. (0, _util.warn)("Invalid fd index for glyph index.");
  37394. }
  37395. } else {
  37396. subrCode = font.subrs[n + font.subrsBias];
  37397. }
  37398. if (subrCode) {
  37399. parse(subrCode);
  37400. }
  37401. break;
  37402. case 11:
  37403. return;
  37404. case 12:
  37405. v = code[i++];
  37406. switch (v) {
  37407. case 34:
  37408. xa = x + stack.shift();
  37409. xb = xa + stack.shift();
  37410. y1 = y + stack.shift();
  37411. x = xb + stack.shift();
  37412. bezierCurveTo(xa, y, xb, y1, x, y1);
  37413. xa = x + stack.shift();
  37414. xb = xa + stack.shift();
  37415. x = xb + stack.shift();
  37416. bezierCurveTo(xa, y1, xb, y, x, y);
  37417. break;
  37418. case 35:
  37419. xa = x + stack.shift();
  37420. ya = y + stack.shift();
  37421. xb = xa + stack.shift();
  37422. yb = ya + stack.shift();
  37423. x = xb + stack.shift();
  37424. y = yb + stack.shift();
  37425. bezierCurveTo(xa, ya, xb, yb, x, y);
  37426. xa = x + stack.shift();
  37427. ya = y + stack.shift();
  37428. xb = xa + stack.shift();
  37429. yb = ya + stack.shift();
  37430. x = xb + stack.shift();
  37431. y = yb + stack.shift();
  37432. bezierCurveTo(xa, ya, xb, yb, x, y);
  37433. stack.pop();
  37434. break;
  37435. case 36:
  37436. xa = x + stack.shift();
  37437. y1 = y + stack.shift();
  37438. xb = xa + stack.shift();
  37439. y2 = y1 + stack.shift();
  37440. x = xb + stack.shift();
  37441. bezierCurveTo(xa, y1, xb, y2, x, y2);
  37442. xa = x + stack.shift();
  37443. xb = xa + stack.shift();
  37444. y3 = y2 + stack.shift();
  37445. x = xb + stack.shift();
  37446. bezierCurveTo(xa, y2, xb, y3, x, y);
  37447. break;
  37448. case 37:
  37449. const x0 = x,
  37450. y0 = y;
  37451. xa = x + stack.shift();
  37452. ya = y + stack.shift();
  37453. xb = xa + stack.shift();
  37454. yb = ya + stack.shift();
  37455. x = xb + stack.shift();
  37456. y = yb + stack.shift();
  37457. bezierCurveTo(xa, ya, xb, yb, x, y);
  37458. xa = x + stack.shift();
  37459. ya = y + stack.shift();
  37460. xb = xa + stack.shift();
  37461. yb = ya + stack.shift();
  37462. x = xb;
  37463. y = yb;
  37464. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  37465. x += stack.shift();
  37466. } else {
  37467. y += stack.shift();
  37468. }
  37469. bezierCurveTo(xa, ya, xb, yb, x, y);
  37470. break;
  37471. default:
  37472. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  37473. }
  37474. break;
  37475. case 14:
  37476. if (stack.length >= 4) {
  37477. const achar = stack.pop();
  37478. const bchar = stack.pop();
  37479. y = stack.pop();
  37480. x = stack.pop();
  37481. cmds.push({
  37482. cmd: "save"
  37483. }, {
  37484. cmd: "translate",
  37485. args: [x, y]
  37486. });
  37487. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  37488. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37489. cmds.push({
  37490. cmd: "restore"
  37491. });
  37492. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  37493. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37494. }
  37495. return;
  37496. case 18:
  37497. stems += stack.length >> 1;
  37498. stackClean = true;
  37499. break;
  37500. case 19:
  37501. stems += stack.length >> 1;
  37502. i += stems + 7 >> 3;
  37503. stackClean = true;
  37504. break;
  37505. case 20:
  37506. stems += stack.length >> 1;
  37507. i += stems + 7 >> 3;
  37508. stackClean = true;
  37509. break;
  37510. case 21:
  37511. y += stack.pop();
  37512. x += stack.pop();
  37513. moveTo(x, y);
  37514. stackClean = true;
  37515. break;
  37516. case 22:
  37517. x += stack.pop();
  37518. moveTo(x, y);
  37519. stackClean = true;
  37520. break;
  37521. case 23:
  37522. stems += stack.length >> 1;
  37523. stackClean = true;
  37524. break;
  37525. case 24:
  37526. while (stack.length > 2) {
  37527. xa = x + stack.shift();
  37528. ya = y + stack.shift();
  37529. xb = xa + stack.shift();
  37530. yb = ya + stack.shift();
  37531. x = xb + stack.shift();
  37532. y = yb + stack.shift();
  37533. bezierCurveTo(xa, ya, xb, yb, x, y);
  37534. }
  37535. x += stack.shift();
  37536. y += stack.shift();
  37537. lineTo(x, y);
  37538. break;
  37539. case 25:
  37540. while (stack.length > 6) {
  37541. x += stack.shift();
  37542. y += stack.shift();
  37543. lineTo(x, y);
  37544. }
  37545. xa = x + stack.shift();
  37546. ya = y + stack.shift();
  37547. xb = xa + stack.shift();
  37548. yb = ya + stack.shift();
  37549. x = xb + stack.shift();
  37550. y = yb + stack.shift();
  37551. bezierCurveTo(xa, ya, xb, yb, x, y);
  37552. break;
  37553. case 26:
  37554. if (stack.length % 2) {
  37555. x += stack.shift();
  37556. }
  37557. while (stack.length > 0) {
  37558. xa = x;
  37559. ya = y + stack.shift();
  37560. xb = xa + stack.shift();
  37561. yb = ya + stack.shift();
  37562. x = xb;
  37563. y = yb + stack.shift();
  37564. bezierCurveTo(xa, ya, xb, yb, x, y);
  37565. }
  37566. break;
  37567. case 27:
  37568. if (stack.length % 2) {
  37569. y += stack.shift();
  37570. }
  37571. while (stack.length > 0) {
  37572. xa = x + stack.shift();
  37573. ya = y;
  37574. xb = xa + stack.shift();
  37575. yb = ya + stack.shift();
  37576. x = xb + stack.shift();
  37577. y = yb;
  37578. bezierCurveTo(xa, ya, xb, yb, x, y);
  37579. }
  37580. break;
  37581. case 28:
  37582. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  37583. i += 2;
  37584. break;
  37585. case 29:
  37586. n = stack.pop() + font.gsubrsBias;
  37587. subrCode = font.gsubrs[n];
  37588. if (subrCode) {
  37589. parse(subrCode);
  37590. }
  37591. break;
  37592. case 30:
  37593. while (stack.length > 0) {
  37594. xa = x;
  37595. ya = y + stack.shift();
  37596. xb = xa + stack.shift();
  37597. yb = ya + stack.shift();
  37598. x = xb + stack.shift();
  37599. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37600. bezierCurveTo(xa, ya, xb, yb, x, y);
  37601. if (stack.length === 0) {
  37602. break;
  37603. }
  37604. xa = x + stack.shift();
  37605. ya = y;
  37606. xb = xa + stack.shift();
  37607. yb = ya + stack.shift();
  37608. y = yb + stack.shift();
  37609. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37610. bezierCurveTo(xa, ya, xb, yb, x, y);
  37611. }
  37612. break;
  37613. case 31:
  37614. while (stack.length > 0) {
  37615. xa = x + stack.shift();
  37616. ya = y;
  37617. xb = xa + stack.shift();
  37618. yb = ya + stack.shift();
  37619. y = yb + stack.shift();
  37620. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37621. bezierCurveTo(xa, ya, xb, yb, x, y);
  37622. if (stack.length === 0) {
  37623. break;
  37624. }
  37625. xa = x;
  37626. ya = y + stack.shift();
  37627. xb = xa + stack.shift();
  37628. yb = ya + stack.shift();
  37629. x = xb + stack.shift();
  37630. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37631. bezierCurveTo(xa, ya, xb, yb, x, y);
  37632. }
  37633. break;
  37634. default:
  37635. if (v < 32) {
  37636. throw new _util.FormatError(`unknown operator: ${v}`);
  37637. }
  37638. if (v < 247) {
  37639. stack.push(v - 139);
  37640. } else if (v < 251) {
  37641. stack.push((v - 247) * 256 + code[i++] + 108);
  37642. } else if (v < 255) {
  37643. stack.push(-(v - 251) * 256 - code[i++] - 108);
  37644. } else {
  37645. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  37646. i += 4;
  37647. }
  37648. break;
  37649. }
  37650. if (stackClean) {
  37651. stack.length = 0;
  37652. }
  37653. }
  37654. }
  37655. parse(charStringCode);
  37656. }
  37657. const NOOP = [];
  37658. class CompiledFont {
  37659. constructor(fontMatrix) {
  37660. if (this.constructor === CompiledFont) {
  37661. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  37662. }
  37663. this.fontMatrix = fontMatrix;
  37664. this.compiledGlyphs = Object.create(null);
  37665. this.compiledCharCodeToGlyphId = Object.create(null);
  37666. }
  37667. getPathJs(unicode) {
  37668. const {
  37669. charCode,
  37670. glyphId
  37671. } = lookupCmap(this.cmap, unicode);
  37672. let fn = this.compiledGlyphs[glyphId];
  37673. if (!fn) {
  37674. try {
  37675. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  37676. this.compiledGlyphs[glyphId] = fn;
  37677. } catch (ex) {
  37678. this.compiledGlyphs[glyphId] = NOOP;
  37679. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37680. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37681. }
  37682. throw ex;
  37683. }
  37684. }
  37685. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37686. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37687. }
  37688. return fn;
  37689. }
  37690. compileGlyph(code, glyphId) {
  37691. if (!code || code.length === 0 || code[0] === 14) {
  37692. return NOOP;
  37693. }
  37694. let fontMatrix = this.fontMatrix;
  37695. if (this.isCFFCIDFont) {
  37696. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  37697. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  37698. const fontDict = this.fdArray[fdIndex];
  37699. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  37700. } else {
  37701. (0, _util.warn)("Invalid fd index for glyph index.");
  37702. }
  37703. }
  37704. const cmds = [{
  37705. cmd: "save"
  37706. }, {
  37707. cmd: "transform",
  37708. args: fontMatrix.slice()
  37709. }, {
  37710. cmd: "scale",
  37711. args: ["size", "-size"]
  37712. }];
  37713. this.compileGlyphImpl(code, cmds, glyphId);
  37714. cmds.push({
  37715. cmd: "restore"
  37716. });
  37717. return cmds;
  37718. }
  37719. compileGlyphImpl() {
  37720. (0, _util.unreachable)("Children classes should implement this.");
  37721. }
  37722. hasBuiltPath(unicode) {
  37723. const {
  37724. charCode,
  37725. glyphId
  37726. } = lookupCmap(this.cmap, unicode);
  37727. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  37728. }
  37729. }
  37730. class TrueTypeCompiled extends CompiledFont {
  37731. constructor(glyphs, cmap, fontMatrix) {
  37732. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  37733. this.glyphs = glyphs;
  37734. this.cmap = cmap;
  37735. }
  37736. compileGlyphImpl(code, cmds) {
  37737. compileGlyf(code, cmds, this);
  37738. }
  37739. }
  37740. class Type2Compiled extends CompiledFont {
  37741. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  37742. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  37743. this.glyphs = cffInfo.glyphs;
  37744. this.gsubrs = cffInfo.gsubrs || [];
  37745. this.subrs = cffInfo.subrs || [];
  37746. this.cmap = cmap;
  37747. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  37748. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  37749. this.subrsBias = getSubroutineBias(this.subrs);
  37750. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  37751. this.fdSelect = cffInfo.fdSelect;
  37752. this.fdArray = cffInfo.fdArray;
  37753. }
  37754. compileGlyphImpl(code, cmds, glyphId) {
  37755. compileCharString(code, cmds, this, glyphId);
  37756. }
  37757. }
  37758. class FontRendererFactory {
  37759. static create(font, seacAnalysisEnabled) {
  37760. const data = new Uint8Array(font.data);
  37761. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  37762. const numTables = getUint16(data, 4);
  37763. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  37764. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  37765. const offset = getUint32(data, p + 8);
  37766. const length = getUint32(data, p + 12);
  37767. switch (tag) {
  37768. case "cmap":
  37769. cmap = parseCmap(data, offset, offset + length);
  37770. break;
  37771. case "glyf":
  37772. glyf = data.subarray(offset, offset + length);
  37773. break;
  37774. case "loca":
  37775. loca = data.subarray(offset, offset + length);
  37776. break;
  37777. case "head":
  37778. unitsPerEm = getUint16(data, offset + 18);
  37779. indexToLocFormat = getUint16(data, offset + 50);
  37780. break;
  37781. case "CFF ":
  37782. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  37783. break;
  37784. }
  37785. }
  37786. if (glyf) {
  37787. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  37788. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  37789. }
  37790. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  37791. }
  37792. }
  37793. exports.FontRendererFactory = FontRendererFactory;
  37794. /***/ }),
  37795. /* 51 */
  37796. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37797. Object.defineProperty(exports, "__esModule", ({
  37798. value: true
  37799. }));
  37800. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  37801. var _core_utils = __w_pdfjs_require__(8);
  37802. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  37803. t.Courier = 600;
  37804. t["Courier-Bold"] = 600;
  37805. t["Courier-BoldOblique"] = 600;
  37806. t["Courier-Oblique"] = 600;
  37807. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  37808. t.space = 278;
  37809. t.exclam = 278;
  37810. t.quotedbl = 355;
  37811. t.numbersign = 556;
  37812. t.dollar = 556;
  37813. t.percent = 889;
  37814. t.ampersand = 667;
  37815. t.quoteright = 222;
  37816. t.parenleft = 333;
  37817. t.parenright = 333;
  37818. t.asterisk = 389;
  37819. t.plus = 584;
  37820. t.comma = 278;
  37821. t.hyphen = 333;
  37822. t.period = 278;
  37823. t.slash = 278;
  37824. t.zero = 556;
  37825. t.one = 556;
  37826. t.two = 556;
  37827. t.three = 556;
  37828. t.four = 556;
  37829. t.five = 556;
  37830. t.six = 556;
  37831. t.seven = 556;
  37832. t.eight = 556;
  37833. t.nine = 556;
  37834. t.colon = 278;
  37835. t.semicolon = 278;
  37836. t.less = 584;
  37837. t.equal = 584;
  37838. t.greater = 584;
  37839. t.question = 556;
  37840. t.at = 1015;
  37841. t.A = 667;
  37842. t.B = 667;
  37843. t.C = 722;
  37844. t.D = 722;
  37845. t.E = 667;
  37846. t.F = 611;
  37847. t.G = 778;
  37848. t.H = 722;
  37849. t.I = 278;
  37850. t.J = 500;
  37851. t.K = 667;
  37852. t.L = 556;
  37853. t.M = 833;
  37854. t.N = 722;
  37855. t.O = 778;
  37856. t.P = 667;
  37857. t.Q = 778;
  37858. t.R = 722;
  37859. t.S = 667;
  37860. t.T = 611;
  37861. t.U = 722;
  37862. t.V = 667;
  37863. t.W = 944;
  37864. t.X = 667;
  37865. t.Y = 667;
  37866. t.Z = 611;
  37867. t.bracketleft = 278;
  37868. t.backslash = 278;
  37869. t.bracketright = 278;
  37870. t.asciicircum = 469;
  37871. t.underscore = 556;
  37872. t.quoteleft = 222;
  37873. t.a = 556;
  37874. t.b = 556;
  37875. t.c = 500;
  37876. t.d = 556;
  37877. t.e = 556;
  37878. t.f = 278;
  37879. t.g = 556;
  37880. t.h = 556;
  37881. t.i = 222;
  37882. t.j = 222;
  37883. t.k = 500;
  37884. t.l = 222;
  37885. t.m = 833;
  37886. t.n = 556;
  37887. t.o = 556;
  37888. t.p = 556;
  37889. t.q = 556;
  37890. t.r = 333;
  37891. t.s = 500;
  37892. t.t = 278;
  37893. t.u = 556;
  37894. t.v = 500;
  37895. t.w = 722;
  37896. t.x = 500;
  37897. t.y = 500;
  37898. t.z = 500;
  37899. t.braceleft = 334;
  37900. t.bar = 260;
  37901. t.braceright = 334;
  37902. t.asciitilde = 584;
  37903. t.exclamdown = 333;
  37904. t.cent = 556;
  37905. t.sterling = 556;
  37906. t.fraction = 167;
  37907. t.yen = 556;
  37908. t.florin = 556;
  37909. t.section = 556;
  37910. t.currency = 556;
  37911. t.quotesingle = 191;
  37912. t.quotedblleft = 333;
  37913. t.guillemotleft = 556;
  37914. t.guilsinglleft = 333;
  37915. t.guilsinglright = 333;
  37916. t.fi = 500;
  37917. t.fl = 500;
  37918. t.endash = 556;
  37919. t.dagger = 556;
  37920. t.daggerdbl = 556;
  37921. t.periodcentered = 278;
  37922. t.paragraph = 537;
  37923. t.bullet = 350;
  37924. t.quotesinglbase = 222;
  37925. t.quotedblbase = 333;
  37926. t.quotedblright = 333;
  37927. t.guillemotright = 556;
  37928. t.ellipsis = 1000;
  37929. t.perthousand = 1000;
  37930. t.questiondown = 611;
  37931. t.grave = 333;
  37932. t.acute = 333;
  37933. t.circumflex = 333;
  37934. t.tilde = 333;
  37935. t.macron = 333;
  37936. t.breve = 333;
  37937. t.dotaccent = 333;
  37938. t.dieresis = 333;
  37939. t.ring = 333;
  37940. t.cedilla = 333;
  37941. t.hungarumlaut = 333;
  37942. t.ogonek = 333;
  37943. t.caron = 333;
  37944. t.emdash = 1000;
  37945. t.AE = 1000;
  37946. t.ordfeminine = 370;
  37947. t.Lslash = 556;
  37948. t.Oslash = 778;
  37949. t.OE = 1000;
  37950. t.ordmasculine = 365;
  37951. t.ae = 889;
  37952. t.dotlessi = 278;
  37953. t.lslash = 222;
  37954. t.oslash = 611;
  37955. t.oe = 944;
  37956. t.germandbls = 611;
  37957. t.Idieresis = 278;
  37958. t.eacute = 556;
  37959. t.abreve = 556;
  37960. t.uhungarumlaut = 556;
  37961. t.ecaron = 556;
  37962. t.Ydieresis = 667;
  37963. t.divide = 584;
  37964. t.Yacute = 667;
  37965. t.Acircumflex = 667;
  37966. t.aacute = 556;
  37967. t.Ucircumflex = 722;
  37968. t.yacute = 500;
  37969. t.scommaaccent = 500;
  37970. t.ecircumflex = 556;
  37971. t.Uring = 722;
  37972. t.Udieresis = 722;
  37973. t.aogonek = 556;
  37974. t.Uacute = 722;
  37975. t.uogonek = 556;
  37976. t.Edieresis = 667;
  37977. t.Dcroat = 722;
  37978. t.commaaccent = 250;
  37979. t.copyright = 737;
  37980. t.Emacron = 667;
  37981. t.ccaron = 500;
  37982. t.aring = 556;
  37983. t.Ncommaaccent = 722;
  37984. t.lacute = 222;
  37985. t.agrave = 556;
  37986. t.Tcommaaccent = 611;
  37987. t.Cacute = 722;
  37988. t.atilde = 556;
  37989. t.Edotaccent = 667;
  37990. t.scaron = 500;
  37991. t.scedilla = 500;
  37992. t.iacute = 278;
  37993. t.lozenge = 471;
  37994. t.Rcaron = 722;
  37995. t.Gcommaaccent = 778;
  37996. t.ucircumflex = 556;
  37997. t.acircumflex = 556;
  37998. t.Amacron = 667;
  37999. t.rcaron = 333;
  38000. t.ccedilla = 500;
  38001. t.Zdotaccent = 611;
  38002. t.Thorn = 667;
  38003. t.Omacron = 778;
  38004. t.Racute = 722;
  38005. t.Sacute = 667;
  38006. t.dcaron = 643;
  38007. t.Umacron = 722;
  38008. t.uring = 556;
  38009. t.threesuperior = 333;
  38010. t.Ograve = 778;
  38011. t.Agrave = 667;
  38012. t.Abreve = 667;
  38013. t.multiply = 584;
  38014. t.uacute = 556;
  38015. t.Tcaron = 611;
  38016. t.partialdiff = 476;
  38017. t.ydieresis = 500;
  38018. t.Nacute = 722;
  38019. t.icircumflex = 278;
  38020. t.Ecircumflex = 667;
  38021. t.adieresis = 556;
  38022. t.edieresis = 556;
  38023. t.cacute = 500;
  38024. t.nacute = 556;
  38025. t.umacron = 556;
  38026. t.Ncaron = 722;
  38027. t.Iacute = 278;
  38028. t.plusminus = 584;
  38029. t.brokenbar = 260;
  38030. t.registered = 737;
  38031. t.Gbreve = 778;
  38032. t.Idotaccent = 278;
  38033. t.summation = 600;
  38034. t.Egrave = 667;
  38035. t.racute = 333;
  38036. t.omacron = 556;
  38037. t.Zacute = 611;
  38038. t.Zcaron = 611;
  38039. t.greaterequal = 549;
  38040. t.Eth = 722;
  38041. t.Ccedilla = 722;
  38042. t.lcommaaccent = 222;
  38043. t.tcaron = 317;
  38044. t.eogonek = 556;
  38045. t.Uogonek = 722;
  38046. t.Aacute = 667;
  38047. t.Adieresis = 667;
  38048. t.egrave = 556;
  38049. t.zacute = 500;
  38050. t.iogonek = 222;
  38051. t.Oacute = 778;
  38052. t.oacute = 556;
  38053. t.amacron = 556;
  38054. t.sacute = 500;
  38055. t.idieresis = 278;
  38056. t.Ocircumflex = 778;
  38057. t.Ugrave = 722;
  38058. t.Delta = 612;
  38059. t.thorn = 556;
  38060. t.twosuperior = 333;
  38061. t.Odieresis = 778;
  38062. t.mu = 556;
  38063. t.igrave = 278;
  38064. t.ohungarumlaut = 556;
  38065. t.Eogonek = 667;
  38066. t.dcroat = 556;
  38067. t.threequarters = 834;
  38068. t.Scedilla = 667;
  38069. t.lcaron = 299;
  38070. t.Kcommaaccent = 667;
  38071. t.Lacute = 556;
  38072. t.trademark = 1000;
  38073. t.edotaccent = 556;
  38074. t.Igrave = 278;
  38075. t.Imacron = 278;
  38076. t.Lcaron = 556;
  38077. t.onehalf = 834;
  38078. t.lessequal = 549;
  38079. t.ocircumflex = 556;
  38080. t.ntilde = 556;
  38081. t.Uhungarumlaut = 722;
  38082. t.Eacute = 667;
  38083. t.emacron = 556;
  38084. t.gbreve = 556;
  38085. t.onequarter = 834;
  38086. t.Scaron = 667;
  38087. t.Scommaaccent = 667;
  38088. t.Ohungarumlaut = 778;
  38089. t.degree = 400;
  38090. t.ograve = 556;
  38091. t.Ccaron = 722;
  38092. t.ugrave = 556;
  38093. t.radical = 453;
  38094. t.Dcaron = 722;
  38095. t.rcommaaccent = 333;
  38096. t.Ntilde = 722;
  38097. t.otilde = 556;
  38098. t.Rcommaaccent = 722;
  38099. t.Lcommaaccent = 556;
  38100. t.Atilde = 667;
  38101. t.Aogonek = 667;
  38102. t.Aring = 667;
  38103. t.Otilde = 778;
  38104. t.zdotaccent = 500;
  38105. t.Ecaron = 667;
  38106. t.Iogonek = 278;
  38107. t.kcommaaccent = 500;
  38108. t.minus = 584;
  38109. t.Icircumflex = 278;
  38110. t.ncaron = 556;
  38111. t.tcommaaccent = 278;
  38112. t.logicalnot = 584;
  38113. t.odieresis = 556;
  38114. t.udieresis = 556;
  38115. t.notequal = 549;
  38116. t.gcommaaccent = 556;
  38117. t.eth = 556;
  38118. t.zcaron = 500;
  38119. t.ncommaaccent = 556;
  38120. t.onesuperior = 333;
  38121. t.imacron = 278;
  38122. t.Euro = 556;
  38123. });
  38124. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38125. t.space = 278;
  38126. t.exclam = 333;
  38127. t.quotedbl = 474;
  38128. t.numbersign = 556;
  38129. t.dollar = 556;
  38130. t.percent = 889;
  38131. t.ampersand = 722;
  38132. t.quoteright = 278;
  38133. t.parenleft = 333;
  38134. t.parenright = 333;
  38135. t.asterisk = 389;
  38136. t.plus = 584;
  38137. t.comma = 278;
  38138. t.hyphen = 333;
  38139. t.period = 278;
  38140. t.slash = 278;
  38141. t.zero = 556;
  38142. t.one = 556;
  38143. t.two = 556;
  38144. t.three = 556;
  38145. t.four = 556;
  38146. t.five = 556;
  38147. t.six = 556;
  38148. t.seven = 556;
  38149. t.eight = 556;
  38150. t.nine = 556;
  38151. t.colon = 333;
  38152. t.semicolon = 333;
  38153. t.less = 584;
  38154. t.equal = 584;
  38155. t.greater = 584;
  38156. t.question = 611;
  38157. t.at = 975;
  38158. t.A = 722;
  38159. t.B = 722;
  38160. t.C = 722;
  38161. t.D = 722;
  38162. t.E = 667;
  38163. t.F = 611;
  38164. t.G = 778;
  38165. t.H = 722;
  38166. t.I = 278;
  38167. t.J = 556;
  38168. t.K = 722;
  38169. t.L = 611;
  38170. t.M = 833;
  38171. t.N = 722;
  38172. t.O = 778;
  38173. t.P = 667;
  38174. t.Q = 778;
  38175. t.R = 722;
  38176. t.S = 667;
  38177. t.T = 611;
  38178. t.U = 722;
  38179. t.V = 667;
  38180. t.W = 944;
  38181. t.X = 667;
  38182. t.Y = 667;
  38183. t.Z = 611;
  38184. t.bracketleft = 333;
  38185. t.backslash = 278;
  38186. t.bracketright = 333;
  38187. t.asciicircum = 584;
  38188. t.underscore = 556;
  38189. t.quoteleft = 278;
  38190. t.a = 556;
  38191. t.b = 611;
  38192. t.c = 556;
  38193. t.d = 611;
  38194. t.e = 556;
  38195. t.f = 333;
  38196. t.g = 611;
  38197. t.h = 611;
  38198. t.i = 278;
  38199. t.j = 278;
  38200. t.k = 556;
  38201. t.l = 278;
  38202. t.m = 889;
  38203. t.n = 611;
  38204. t.o = 611;
  38205. t.p = 611;
  38206. t.q = 611;
  38207. t.r = 389;
  38208. t.s = 556;
  38209. t.t = 333;
  38210. t.u = 611;
  38211. t.v = 556;
  38212. t.w = 778;
  38213. t.x = 556;
  38214. t.y = 556;
  38215. t.z = 500;
  38216. t.braceleft = 389;
  38217. t.bar = 280;
  38218. t.braceright = 389;
  38219. t.asciitilde = 584;
  38220. t.exclamdown = 333;
  38221. t.cent = 556;
  38222. t.sterling = 556;
  38223. t.fraction = 167;
  38224. t.yen = 556;
  38225. t.florin = 556;
  38226. t.section = 556;
  38227. t.currency = 556;
  38228. t.quotesingle = 238;
  38229. t.quotedblleft = 500;
  38230. t.guillemotleft = 556;
  38231. t.guilsinglleft = 333;
  38232. t.guilsinglright = 333;
  38233. t.fi = 611;
  38234. t.fl = 611;
  38235. t.endash = 556;
  38236. t.dagger = 556;
  38237. t.daggerdbl = 556;
  38238. t.periodcentered = 278;
  38239. t.paragraph = 556;
  38240. t.bullet = 350;
  38241. t.quotesinglbase = 278;
  38242. t.quotedblbase = 500;
  38243. t.quotedblright = 500;
  38244. t.guillemotright = 556;
  38245. t.ellipsis = 1000;
  38246. t.perthousand = 1000;
  38247. t.questiondown = 611;
  38248. t.grave = 333;
  38249. t.acute = 333;
  38250. t.circumflex = 333;
  38251. t.tilde = 333;
  38252. t.macron = 333;
  38253. t.breve = 333;
  38254. t.dotaccent = 333;
  38255. t.dieresis = 333;
  38256. t.ring = 333;
  38257. t.cedilla = 333;
  38258. t.hungarumlaut = 333;
  38259. t.ogonek = 333;
  38260. t.caron = 333;
  38261. t.emdash = 1000;
  38262. t.AE = 1000;
  38263. t.ordfeminine = 370;
  38264. t.Lslash = 611;
  38265. t.Oslash = 778;
  38266. t.OE = 1000;
  38267. t.ordmasculine = 365;
  38268. t.ae = 889;
  38269. t.dotlessi = 278;
  38270. t.lslash = 278;
  38271. t.oslash = 611;
  38272. t.oe = 944;
  38273. t.germandbls = 611;
  38274. t.Idieresis = 278;
  38275. t.eacute = 556;
  38276. t.abreve = 556;
  38277. t.uhungarumlaut = 611;
  38278. t.ecaron = 556;
  38279. t.Ydieresis = 667;
  38280. t.divide = 584;
  38281. t.Yacute = 667;
  38282. t.Acircumflex = 722;
  38283. t.aacute = 556;
  38284. t.Ucircumflex = 722;
  38285. t.yacute = 556;
  38286. t.scommaaccent = 556;
  38287. t.ecircumflex = 556;
  38288. t.Uring = 722;
  38289. t.Udieresis = 722;
  38290. t.aogonek = 556;
  38291. t.Uacute = 722;
  38292. t.uogonek = 611;
  38293. t.Edieresis = 667;
  38294. t.Dcroat = 722;
  38295. t.commaaccent = 250;
  38296. t.copyright = 737;
  38297. t.Emacron = 667;
  38298. t.ccaron = 556;
  38299. t.aring = 556;
  38300. t.Ncommaaccent = 722;
  38301. t.lacute = 278;
  38302. t.agrave = 556;
  38303. t.Tcommaaccent = 611;
  38304. t.Cacute = 722;
  38305. t.atilde = 556;
  38306. t.Edotaccent = 667;
  38307. t.scaron = 556;
  38308. t.scedilla = 556;
  38309. t.iacute = 278;
  38310. t.lozenge = 494;
  38311. t.Rcaron = 722;
  38312. t.Gcommaaccent = 778;
  38313. t.ucircumflex = 611;
  38314. t.acircumflex = 556;
  38315. t.Amacron = 722;
  38316. t.rcaron = 389;
  38317. t.ccedilla = 556;
  38318. t.Zdotaccent = 611;
  38319. t.Thorn = 667;
  38320. t.Omacron = 778;
  38321. t.Racute = 722;
  38322. t.Sacute = 667;
  38323. t.dcaron = 743;
  38324. t.Umacron = 722;
  38325. t.uring = 611;
  38326. t.threesuperior = 333;
  38327. t.Ograve = 778;
  38328. t.Agrave = 722;
  38329. t.Abreve = 722;
  38330. t.multiply = 584;
  38331. t.uacute = 611;
  38332. t.Tcaron = 611;
  38333. t.partialdiff = 494;
  38334. t.ydieresis = 556;
  38335. t.Nacute = 722;
  38336. t.icircumflex = 278;
  38337. t.Ecircumflex = 667;
  38338. t.adieresis = 556;
  38339. t.edieresis = 556;
  38340. t.cacute = 556;
  38341. t.nacute = 611;
  38342. t.umacron = 611;
  38343. t.Ncaron = 722;
  38344. t.Iacute = 278;
  38345. t.plusminus = 584;
  38346. t.brokenbar = 280;
  38347. t.registered = 737;
  38348. t.Gbreve = 778;
  38349. t.Idotaccent = 278;
  38350. t.summation = 600;
  38351. t.Egrave = 667;
  38352. t.racute = 389;
  38353. t.omacron = 611;
  38354. t.Zacute = 611;
  38355. t.Zcaron = 611;
  38356. t.greaterequal = 549;
  38357. t.Eth = 722;
  38358. t.Ccedilla = 722;
  38359. t.lcommaaccent = 278;
  38360. t.tcaron = 389;
  38361. t.eogonek = 556;
  38362. t.Uogonek = 722;
  38363. t.Aacute = 722;
  38364. t.Adieresis = 722;
  38365. t.egrave = 556;
  38366. t.zacute = 500;
  38367. t.iogonek = 278;
  38368. t.Oacute = 778;
  38369. t.oacute = 611;
  38370. t.amacron = 556;
  38371. t.sacute = 556;
  38372. t.idieresis = 278;
  38373. t.Ocircumflex = 778;
  38374. t.Ugrave = 722;
  38375. t.Delta = 612;
  38376. t.thorn = 611;
  38377. t.twosuperior = 333;
  38378. t.Odieresis = 778;
  38379. t.mu = 611;
  38380. t.igrave = 278;
  38381. t.ohungarumlaut = 611;
  38382. t.Eogonek = 667;
  38383. t.dcroat = 611;
  38384. t.threequarters = 834;
  38385. t.Scedilla = 667;
  38386. t.lcaron = 400;
  38387. t.Kcommaaccent = 722;
  38388. t.Lacute = 611;
  38389. t.trademark = 1000;
  38390. t.edotaccent = 556;
  38391. t.Igrave = 278;
  38392. t.Imacron = 278;
  38393. t.Lcaron = 611;
  38394. t.onehalf = 834;
  38395. t.lessequal = 549;
  38396. t.ocircumflex = 611;
  38397. t.ntilde = 611;
  38398. t.Uhungarumlaut = 722;
  38399. t.Eacute = 667;
  38400. t.emacron = 556;
  38401. t.gbreve = 611;
  38402. t.onequarter = 834;
  38403. t.Scaron = 667;
  38404. t.Scommaaccent = 667;
  38405. t.Ohungarumlaut = 778;
  38406. t.degree = 400;
  38407. t.ograve = 611;
  38408. t.Ccaron = 722;
  38409. t.ugrave = 611;
  38410. t.radical = 549;
  38411. t.Dcaron = 722;
  38412. t.rcommaaccent = 389;
  38413. t.Ntilde = 722;
  38414. t.otilde = 611;
  38415. t.Rcommaaccent = 722;
  38416. t.Lcommaaccent = 611;
  38417. t.Atilde = 722;
  38418. t.Aogonek = 722;
  38419. t.Aring = 722;
  38420. t.Otilde = 778;
  38421. t.zdotaccent = 500;
  38422. t.Ecaron = 667;
  38423. t.Iogonek = 278;
  38424. t.kcommaaccent = 556;
  38425. t.minus = 584;
  38426. t.Icircumflex = 278;
  38427. t.ncaron = 611;
  38428. t.tcommaaccent = 333;
  38429. t.logicalnot = 584;
  38430. t.odieresis = 611;
  38431. t.udieresis = 611;
  38432. t.notequal = 549;
  38433. t.gcommaaccent = 611;
  38434. t.eth = 611;
  38435. t.zcaron = 500;
  38436. t.ncommaaccent = 611;
  38437. t.onesuperior = 333;
  38438. t.imacron = 278;
  38439. t.Euro = 556;
  38440. });
  38441. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38442. t.space = 278;
  38443. t.exclam = 333;
  38444. t.quotedbl = 474;
  38445. t.numbersign = 556;
  38446. t.dollar = 556;
  38447. t.percent = 889;
  38448. t.ampersand = 722;
  38449. t.quoteright = 278;
  38450. t.parenleft = 333;
  38451. t.parenright = 333;
  38452. t.asterisk = 389;
  38453. t.plus = 584;
  38454. t.comma = 278;
  38455. t.hyphen = 333;
  38456. t.period = 278;
  38457. t.slash = 278;
  38458. t.zero = 556;
  38459. t.one = 556;
  38460. t.two = 556;
  38461. t.three = 556;
  38462. t.four = 556;
  38463. t.five = 556;
  38464. t.six = 556;
  38465. t.seven = 556;
  38466. t.eight = 556;
  38467. t.nine = 556;
  38468. t.colon = 333;
  38469. t.semicolon = 333;
  38470. t.less = 584;
  38471. t.equal = 584;
  38472. t.greater = 584;
  38473. t.question = 611;
  38474. t.at = 975;
  38475. t.A = 722;
  38476. t.B = 722;
  38477. t.C = 722;
  38478. t.D = 722;
  38479. t.E = 667;
  38480. t.F = 611;
  38481. t.G = 778;
  38482. t.H = 722;
  38483. t.I = 278;
  38484. t.J = 556;
  38485. t.K = 722;
  38486. t.L = 611;
  38487. t.M = 833;
  38488. t.N = 722;
  38489. t.O = 778;
  38490. t.P = 667;
  38491. t.Q = 778;
  38492. t.R = 722;
  38493. t.S = 667;
  38494. t.T = 611;
  38495. t.U = 722;
  38496. t.V = 667;
  38497. t.W = 944;
  38498. t.X = 667;
  38499. t.Y = 667;
  38500. t.Z = 611;
  38501. t.bracketleft = 333;
  38502. t.backslash = 278;
  38503. t.bracketright = 333;
  38504. t.asciicircum = 584;
  38505. t.underscore = 556;
  38506. t.quoteleft = 278;
  38507. t.a = 556;
  38508. t.b = 611;
  38509. t.c = 556;
  38510. t.d = 611;
  38511. t.e = 556;
  38512. t.f = 333;
  38513. t.g = 611;
  38514. t.h = 611;
  38515. t.i = 278;
  38516. t.j = 278;
  38517. t.k = 556;
  38518. t.l = 278;
  38519. t.m = 889;
  38520. t.n = 611;
  38521. t.o = 611;
  38522. t.p = 611;
  38523. t.q = 611;
  38524. t.r = 389;
  38525. t.s = 556;
  38526. t.t = 333;
  38527. t.u = 611;
  38528. t.v = 556;
  38529. t.w = 778;
  38530. t.x = 556;
  38531. t.y = 556;
  38532. t.z = 500;
  38533. t.braceleft = 389;
  38534. t.bar = 280;
  38535. t.braceright = 389;
  38536. t.asciitilde = 584;
  38537. t.exclamdown = 333;
  38538. t.cent = 556;
  38539. t.sterling = 556;
  38540. t.fraction = 167;
  38541. t.yen = 556;
  38542. t.florin = 556;
  38543. t.section = 556;
  38544. t.currency = 556;
  38545. t.quotesingle = 238;
  38546. t.quotedblleft = 500;
  38547. t.guillemotleft = 556;
  38548. t.guilsinglleft = 333;
  38549. t.guilsinglright = 333;
  38550. t.fi = 611;
  38551. t.fl = 611;
  38552. t.endash = 556;
  38553. t.dagger = 556;
  38554. t.daggerdbl = 556;
  38555. t.periodcentered = 278;
  38556. t.paragraph = 556;
  38557. t.bullet = 350;
  38558. t.quotesinglbase = 278;
  38559. t.quotedblbase = 500;
  38560. t.quotedblright = 500;
  38561. t.guillemotright = 556;
  38562. t.ellipsis = 1000;
  38563. t.perthousand = 1000;
  38564. t.questiondown = 611;
  38565. t.grave = 333;
  38566. t.acute = 333;
  38567. t.circumflex = 333;
  38568. t.tilde = 333;
  38569. t.macron = 333;
  38570. t.breve = 333;
  38571. t.dotaccent = 333;
  38572. t.dieresis = 333;
  38573. t.ring = 333;
  38574. t.cedilla = 333;
  38575. t.hungarumlaut = 333;
  38576. t.ogonek = 333;
  38577. t.caron = 333;
  38578. t.emdash = 1000;
  38579. t.AE = 1000;
  38580. t.ordfeminine = 370;
  38581. t.Lslash = 611;
  38582. t.Oslash = 778;
  38583. t.OE = 1000;
  38584. t.ordmasculine = 365;
  38585. t.ae = 889;
  38586. t.dotlessi = 278;
  38587. t.lslash = 278;
  38588. t.oslash = 611;
  38589. t.oe = 944;
  38590. t.germandbls = 611;
  38591. t.Idieresis = 278;
  38592. t.eacute = 556;
  38593. t.abreve = 556;
  38594. t.uhungarumlaut = 611;
  38595. t.ecaron = 556;
  38596. t.Ydieresis = 667;
  38597. t.divide = 584;
  38598. t.Yacute = 667;
  38599. t.Acircumflex = 722;
  38600. t.aacute = 556;
  38601. t.Ucircumflex = 722;
  38602. t.yacute = 556;
  38603. t.scommaaccent = 556;
  38604. t.ecircumflex = 556;
  38605. t.Uring = 722;
  38606. t.Udieresis = 722;
  38607. t.aogonek = 556;
  38608. t.Uacute = 722;
  38609. t.uogonek = 611;
  38610. t.Edieresis = 667;
  38611. t.Dcroat = 722;
  38612. t.commaaccent = 250;
  38613. t.copyright = 737;
  38614. t.Emacron = 667;
  38615. t.ccaron = 556;
  38616. t.aring = 556;
  38617. t.Ncommaaccent = 722;
  38618. t.lacute = 278;
  38619. t.agrave = 556;
  38620. t.Tcommaaccent = 611;
  38621. t.Cacute = 722;
  38622. t.atilde = 556;
  38623. t.Edotaccent = 667;
  38624. t.scaron = 556;
  38625. t.scedilla = 556;
  38626. t.iacute = 278;
  38627. t.lozenge = 494;
  38628. t.Rcaron = 722;
  38629. t.Gcommaaccent = 778;
  38630. t.ucircumflex = 611;
  38631. t.acircumflex = 556;
  38632. t.Amacron = 722;
  38633. t.rcaron = 389;
  38634. t.ccedilla = 556;
  38635. t.Zdotaccent = 611;
  38636. t.Thorn = 667;
  38637. t.Omacron = 778;
  38638. t.Racute = 722;
  38639. t.Sacute = 667;
  38640. t.dcaron = 743;
  38641. t.Umacron = 722;
  38642. t.uring = 611;
  38643. t.threesuperior = 333;
  38644. t.Ograve = 778;
  38645. t.Agrave = 722;
  38646. t.Abreve = 722;
  38647. t.multiply = 584;
  38648. t.uacute = 611;
  38649. t.Tcaron = 611;
  38650. t.partialdiff = 494;
  38651. t.ydieresis = 556;
  38652. t.Nacute = 722;
  38653. t.icircumflex = 278;
  38654. t.Ecircumflex = 667;
  38655. t.adieresis = 556;
  38656. t.edieresis = 556;
  38657. t.cacute = 556;
  38658. t.nacute = 611;
  38659. t.umacron = 611;
  38660. t.Ncaron = 722;
  38661. t.Iacute = 278;
  38662. t.plusminus = 584;
  38663. t.brokenbar = 280;
  38664. t.registered = 737;
  38665. t.Gbreve = 778;
  38666. t.Idotaccent = 278;
  38667. t.summation = 600;
  38668. t.Egrave = 667;
  38669. t.racute = 389;
  38670. t.omacron = 611;
  38671. t.Zacute = 611;
  38672. t.Zcaron = 611;
  38673. t.greaterequal = 549;
  38674. t.Eth = 722;
  38675. t.Ccedilla = 722;
  38676. t.lcommaaccent = 278;
  38677. t.tcaron = 389;
  38678. t.eogonek = 556;
  38679. t.Uogonek = 722;
  38680. t.Aacute = 722;
  38681. t.Adieresis = 722;
  38682. t.egrave = 556;
  38683. t.zacute = 500;
  38684. t.iogonek = 278;
  38685. t.Oacute = 778;
  38686. t.oacute = 611;
  38687. t.amacron = 556;
  38688. t.sacute = 556;
  38689. t.idieresis = 278;
  38690. t.Ocircumflex = 778;
  38691. t.Ugrave = 722;
  38692. t.Delta = 612;
  38693. t.thorn = 611;
  38694. t.twosuperior = 333;
  38695. t.Odieresis = 778;
  38696. t.mu = 611;
  38697. t.igrave = 278;
  38698. t.ohungarumlaut = 611;
  38699. t.Eogonek = 667;
  38700. t.dcroat = 611;
  38701. t.threequarters = 834;
  38702. t.Scedilla = 667;
  38703. t.lcaron = 400;
  38704. t.Kcommaaccent = 722;
  38705. t.Lacute = 611;
  38706. t.trademark = 1000;
  38707. t.edotaccent = 556;
  38708. t.Igrave = 278;
  38709. t.Imacron = 278;
  38710. t.Lcaron = 611;
  38711. t.onehalf = 834;
  38712. t.lessequal = 549;
  38713. t.ocircumflex = 611;
  38714. t.ntilde = 611;
  38715. t.Uhungarumlaut = 722;
  38716. t.Eacute = 667;
  38717. t.emacron = 556;
  38718. t.gbreve = 611;
  38719. t.onequarter = 834;
  38720. t.Scaron = 667;
  38721. t.Scommaaccent = 667;
  38722. t.Ohungarumlaut = 778;
  38723. t.degree = 400;
  38724. t.ograve = 611;
  38725. t.Ccaron = 722;
  38726. t.ugrave = 611;
  38727. t.radical = 549;
  38728. t.Dcaron = 722;
  38729. t.rcommaaccent = 389;
  38730. t.Ntilde = 722;
  38731. t.otilde = 611;
  38732. t.Rcommaaccent = 722;
  38733. t.Lcommaaccent = 611;
  38734. t.Atilde = 722;
  38735. t.Aogonek = 722;
  38736. t.Aring = 722;
  38737. t.Otilde = 778;
  38738. t.zdotaccent = 500;
  38739. t.Ecaron = 667;
  38740. t.Iogonek = 278;
  38741. t.kcommaaccent = 556;
  38742. t.minus = 584;
  38743. t.Icircumflex = 278;
  38744. t.ncaron = 611;
  38745. t.tcommaaccent = 333;
  38746. t.logicalnot = 584;
  38747. t.odieresis = 611;
  38748. t.udieresis = 611;
  38749. t.notequal = 549;
  38750. t.gcommaaccent = 611;
  38751. t.eth = 611;
  38752. t.zcaron = 500;
  38753. t.ncommaaccent = 611;
  38754. t.onesuperior = 333;
  38755. t.imacron = 278;
  38756. t.Euro = 556;
  38757. });
  38758. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38759. t.space = 278;
  38760. t.exclam = 278;
  38761. t.quotedbl = 355;
  38762. t.numbersign = 556;
  38763. t.dollar = 556;
  38764. t.percent = 889;
  38765. t.ampersand = 667;
  38766. t.quoteright = 222;
  38767. t.parenleft = 333;
  38768. t.parenright = 333;
  38769. t.asterisk = 389;
  38770. t.plus = 584;
  38771. t.comma = 278;
  38772. t.hyphen = 333;
  38773. t.period = 278;
  38774. t.slash = 278;
  38775. t.zero = 556;
  38776. t.one = 556;
  38777. t.two = 556;
  38778. t.three = 556;
  38779. t.four = 556;
  38780. t.five = 556;
  38781. t.six = 556;
  38782. t.seven = 556;
  38783. t.eight = 556;
  38784. t.nine = 556;
  38785. t.colon = 278;
  38786. t.semicolon = 278;
  38787. t.less = 584;
  38788. t.equal = 584;
  38789. t.greater = 584;
  38790. t.question = 556;
  38791. t.at = 1015;
  38792. t.A = 667;
  38793. t.B = 667;
  38794. t.C = 722;
  38795. t.D = 722;
  38796. t.E = 667;
  38797. t.F = 611;
  38798. t.G = 778;
  38799. t.H = 722;
  38800. t.I = 278;
  38801. t.J = 500;
  38802. t.K = 667;
  38803. t.L = 556;
  38804. t.M = 833;
  38805. t.N = 722;
  38806. t.O = 778;
  38807. t.P = 667;
  38808. t.Q = 778;
  38809. t.R = 722;
  38810. t.S = 667;
  38811. t.T = 611;
  38812. t.U = 722;
  38813. t.V = 667;
  38814. t.W = 944;
  38815. t.X = 667;
  38816. t.Y = 667;
  38817. t.Z = 611;
  38818. t.bracketleft = 278;
  38819. t.backslash = 278;
  38820. t.bracketright = 278;
  38821. t.asciicircum = 469;
  38822. t.underscore = 556;
  38823. t.quoteleft = 222;
  38824. t.a = 556;
  38825. t.b = 556;
  38826. t.c = 500;
  38827. t.d = 556;
  38828. t.e = 556;
  38829. t.f = 278;
  38830. t.g = 556;
  38831. t.h = 556;
  38832. t.i = 222;
  38833. t.j = 222;
  38834. t.k = 500;
  38835. t.l = 222;
  38836. t.m = 833;
  38837. t.n = 556;
  38838. t.o = 556;
  38839. t.p = 556;
  38840. t.q = 556;
  38841. t.r = 333;
  38842. t.s = 500;
  38843. t.t = 278;
  38844. t.u = 556;
  38845. t.v = 500;
  38846. t.w = 722;
  38847. t.x = 500;
  38848. t.y = 500;
  38849. t.z = 500;
  38850. t.braceleft = 334;
  38851. t.bar = 260;
  38852. t.braceright = 334;
  38853. t.asciitilde = 584;
  38854. t.exclamdown = 333;
  38855. t.cent = 556;
  38856. t.sterling = 556;
  38857. t.fraction = 167;
  38858. t.yen = 556;
  38859. t.florin = 556;
  38860. t.section = 556;
  38861. t.currency = 556;
  38862. t.quotesingle = 191;
  38863. t.quotedblleft = 333;
  38864. t.guillemotleft = 556;
  38865. t.guilsinglleft = 333;
  38866. t.guilsinglright = 333;
  38867. t.fi = 500;
  38868. t.fl = 500;
  38869. t.endash = 556;
  38870. t.dagger = 556;
  38871. t.daggerdbl = 556;
  38872. t.periodcentered = 278;
  38873. t.paragraph = 537;
  38874. t.bullet = 350;
  38875. t.quotesinglbase = 222;
  38876. t.quotedblbase = 333;
  38877. t.quotedblright = 333;
  38878. t.guillemotright = 556;
  38879. t.ellipsis = 1000;
  38880. t.perthousand = 1000;
  38881. t.questiondown = 611;
  38882. t.grave = 333;
  38883. t.acute = 333;
  38884. t.circumflex = 333;
  38885. t.tilde = 333;
  38886. t.macron = 333;
  38887. t.breve = 333;
  38888. t.dotaccent = 333;
  38889. t.dieresis = 333;
  38890. t.ring = 333;
  38891. t.cedilla = 333;
  38892. t.hungarumlaut = 333;
  38893. t.ogonek = 333;
  38894. t.caron = 333;
  38895. t.emdash = 1000;
  38896. t.AE = 1000;
  38897. t.ordfeminine = 370;
  38898. t.Lslash = 556;
  38899. t.Oslash = 778;
  38900. t.OE = 1000;
  38901. t.ordmasculine = 365;
  38902. t.ae = 889;
  38903. t.dotlessi = 278;
  38904. t.lslash = 222;
  38905. t.oslash = 611;
  38906. t.oe = 944;
  38907. t.germandbls = 611;
  38908. t.Idieresis = 278;
  38909. t.eacute = 556;
  38910. t.abreve = 556;
  38911. t.uhungarumlaut = 556;
  38912. t.ecaron = 556;
  38913. t.Ydieresis = 667;
  38914. t.divide = 584;
  38915. t.Yacute = 667;
  38916. t.Acircumflex = 667;
  38917. t.aacute = 556;
  38918. t.Ucircumflex = 722;
  38919. t.yacute = 500;
  38920. t.scommaaccent = 500;
  38921. t.ecircumflex = 556;
  38922. t.Uring = 722;
  38923. t.Udieresis = 722;
  38924. t.aogonek = 556;
  38925. t.Uacute = 722;
  38926. t.uogonek = 556;
  38927. t.Edieresis = 667;
  38928. t.Dcroat = 722;
  38929. t.commaaccent = 250;
  38930. t.copyright = 737;
  38931. t.Emacron = 667;
  38932. t.ccaron = 500;
  38933. t.aring = 556;
  38934. t.Ncommaaccent = 722;
  38935. t.lacute = 222;
  38936. t.agrave = 556;
  38937. t.Tcommaaccent = 611;
  38938. t.Cacute = 722;
  38939. t.atilde = 556;
  38940. t.Edotaccent = 667;
  38941. t.scaron = 500;
  38942. t.scedilla = 500;
  38943. t.iacute = 278;
  38944. t.lozenge = 471;
  38945. t.Rcaron = 722;
  38946. t.Gcommaaccent = 778;
  38947. t.ucircumflex = 556;
  38948. t.acircumflex = 556;
  38949. t.Amacron = 667;
  38950. t.rcaron = 333;
  38951. t.ccedilla = 500;
  38952. t.Zdotaccent = 611;
  38953. t.Thorn = 667;
  38954. t.Omacron = 778;
  38955. t.Racute = 722;
  38956. t.Sacute = 667;
  38957. t.dcaron = 643;
  38958. t.Umacron = 722;
  38959. t.uring = 556;
  38960. t.threesuperior = 333;
  38961. t.Ograve = 778;
  38962. t.Agrave = 667;
  38963. t.Abreve = 667;
  38964. t.multiply = 584;
  38965. t.uacute = 556;
  38966. t.Tcaron = 611;
  38967. t.partialdiff = 476;
  38968. t.ydieresis = 500;
  38969. t.Nacute = 722;
  38970. t.icircumflex = 278;
  38971. t.Ecircumflex = 667;
  38972. t.adieresis = 556;
  38973. t.edieresis = 556;
  38974. t.cacute = 500;
  38975. t.nacute = 556;
  38976. t.umacron = 556;
  38977. t.Ncaron = 722;
  38978. t.Iacute = 278;
  38979. t.plusminus = 584;
  38980. t.brokenbar = 260;
  38981. t.registered = 737;
  38982. t.Gbreve = 778;
  38983. t.Idotaccent = 278;
  38984. t.summation = 600;
  38985. t.Egrave = 667;
  38986. t.racute = 333;
  38987. t.omacron = 556;
  38988. t.Zacute = 611;
  38989. t.Zcaron = 611;
  38990. t.greaterequal = 549;
  38991. t.Eth = 722;
  38992. t.Ccedilla = 722;
  38993. t.lcommaaccent = 222;
  38994. t.tcaron = 317;
  38995. t.eogonek = 556;
  38996. t.Uogonek = 722;
  38997. t.Aacute = 667;
  38998. t.Adieresis = 667;
  38999. t.egrave = 556;
  39000. t.zacute = 500;
  39001. t.iogonek = 222;
  39002. t.Oacute = 778;
  39003. t.oacute = 556;
  39004. t.amacron = 556;
  39005. t.sacute = 500;
  39006. t.idieresis = 278;
  39007. t.Ocircumflex = 778;
  39008. t.Ugrave = 722;
  39009. t.Delta = 612;
  39010. t.thorn = 556;
  39011. t.twosuperior = 333;
  39012. t.Odieresis = 778;
  39013. t.mu = 556;
  39014. t.igrave = 278;
  39015. t.ohungarumlaut = 556;
  39016. t.Eogonek = 667;
  39017. t.dcroat = 556;
  39018. t.threequarters = 834;
  39019. t.Scedilla = 667;
  39020. t.lcaron = 299;
  39021. t.Kcommaaccent = 667;
  39022. t.Lacute = 556;
  39023. t.trademark = 1000;
  39024. t.edotaccent = 556;
  39025. t.Igrave = 278;
  39026. t.Imacron = 278;
  39027. t.Lcaron = 556;
  39028. t.onehalf = 834;
  39029. t.lessequal = 549;
  39030. t.ocircumflex = 556;
  39031. t.ntilde = 556;
  39032. t.Uhungarumlaut = 722;
  39033. t.Eacute = 667;
  39034. t.emacron = 556;
  39035. t.gbreve = 556;
  39036. t.onequarter = 834;
  39037. t.Scaron = 667;
  39038. t.Scommaaccent = 667;
  39039. t.Ohungarumlaut = 778;
  39040. t.degree = 400;
  39041. t.ograve = 556;
  39042. t.Ccaron = 722;
  39043. t.ugrave = 556;
  39044. t.radical = 453;
  39045. t.Dcaron = 722;
  39046. t.rcommaaccent = 333;
  39047. t.Ntilde = 722;
  39048. t.otilde = 556;
  39049. t.Rcommaaccent = 722;
  39050. t.Lcommaaccent = 556;
  39051. t.Atilde = 667;
  39052. t.Aogonek = 667;
  39053. t.Aring = 667;
  39054. t.Otilde = 778;
  39055. t.zdotaccent = 500;
  39056. t.Ecaron = 667;
  39057. t.Iogonek = 278;
  39058. t.kcommaaccent = 500;
  39059. t.minus = 584;
  39060. t.Icircumflex = 278;
  39061. t.ncaron = 556;
  39062. t.tcommaaccent = 278;
  39063. t.logicalnot = 584;
  39064. t.odieresis = 556;
  39065. t.udieresis = 556;
  39066. t.notequal = 549;
  39067. t.gcommaaccent = 556;
  39068. t.eth = 556;
  39069. t.zcaron = 500;
  39070. t.ncommaaccent = 556;
  39071. t.onesuperior = 333;
  39072. t.imacron = 278;
  39073. t.Euro = 556;
  39074. });
  39075. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  39076. t.space = 250;
  39077. t.exclam = 333;
  39078. t.universal = 713;
  39079. t.numbersign = 500;
  39080. t.existential = 549;
  39081. t.percent = 833;
  39082. t.ampersand = 778;
  39083. t.suchthat = 439;
  39084. t.parenleft = 333;
  39085. t.parenright = 333;
  39086. t.asteriskmath = 500;
  39087. t.plus = 549;
  39088. t.comma = 250;
  39089. t.minus = 549;
  39090. t.period = 250;
  39091. t.slash = 278;
  39092. t.zero = 500;
  39093. t.one = 500;
  39094. t.two = 500;
  39095. t.three = 500;
  39096. t.four = 500;
  39097. t.five = 500;
  39098. t.six = 500;
  39099. t.seven = 500;
  39100. t.eight = 500;
  39101. t.nine = 500;
  39102. t.colon = 278;
  39103. t.semicolon = 278;
  39104. t.less = 549;
  39105. t.equal = 549;
  39106. t.greater = 549;
  39107. t.question = 444;
  39108. t.congruent = 549;
  39109. t.Alpha = 722;
  39110. t.Beta = 667;
  39111. t.Chi = 722;
  39112. t.Delta = 612;
  39113. t.Epsilon = 611;
  39114. t.Phi = 763;
  39115. t.Gamma = 603;
  39116. t.Eta = 722;
  39117. t.Iota = 333;
  39118. t.theta1 = 631;
  39119. t.Kappa = 722;
  39120. t.Lambda = 686;
  39121. t.Mu = 889;
  39122. t.Nu = 722;
  39123. t.Omicron = 722;
  39124. t.Pi = 768;
  39125. t.Theta = 741;
  39126. t.Rho = 556;
  39127. t.Sigma = 592;
  39128. t.Tau = 611;
  39129. t.Upsilon = 690;
  39130. t.sigma1 = 439;
  39131. t.Omega = 768;
  39132. t.Xi = 645;
  39133. t.Psi = 795;
  39134. t.Zeta = 611;
  39135. t.bracketleft = 333;
  39136. t.therefore = 863;
  39137. t.bracketright = 333;
  39138. t.perpendicular = 658;
  39139. t.underscore = 500;
  39140. t.radicalex = 500;
  39141. t.alpha = 631;
  39142. t.beta = 549;
  39143. t.chi = 549;
  39144. t.delta = 494;
  39145. t.epsilon = 439;
  39146. t.phi = 521;
  39147. t.gamma = 411;
  39148. t.eta = 603;
  39149. t.iota = 329;
  39150. t.phi1 = 603;
  39151. t.kappa = 549;
  39152. t.lambda = 549;
  39153. t.mu = 576;
  39154. t.nu = 521;
  39155. t.omicron = 549;
  39156. t.pi = 549;
  39157. t.theta = 521;
  39158. t.rho = 549;
  39159. t.sigma = 603;
  39160. t.tau = 439;
  39161. t.upsilon = 576;
  39162. t.omega1 = 713;
  39163. t.omega = 686;
  39164. t.xi = 493;
  39165. t.psi = 686;
  39166. t.zeta = 494;
  39167. t.braceleft = 480;
  39168. t.bar = 200;
  39169. t.braceright = 480;
  39170. t.similar = 549;
  39171. t.Euro = 750;
  39172. t.Upsilon1 = 620;
  39173. t.minute = 247;
  39174. t.lessequal = 549;
  39175. t.fraction = 167;
  39176. t.infinity = 713;
  39177. t.florin = 500;
  39178. t.club = 753;
  39179. t.diamond = 753;
  39180. t.heart = 753;
  39181. t.spade = 753;
  39182. t.arrowboth = 1042;
  39183. t.arrowleft = 987;
  39184. t.arrowup = 603;
  39185. t.arrowright = 987;
  39186. t.arrowdown = 603;
  39187. t.degree = 400;
  39188. t.plusminus = 549;
  39189. t.second = 411;
  39190. t.greaterequal = 549;
  39191. t.multiply = 549;
  39192. t.proportional = 713;
  39193. t.partialdiff = 494;
  39194. t.bullet = 460;
  39195. t.divide = 549;
  39196. t.notequal = 549;
  39197. t.equivalence = 549;
  39198. t.approxequal = 549;
  39199. t.ellipsis = 1000;
  39200. t.arrowvertex = 603;
  39201. t.arrowhorizex = 1000;
  39202. t.carriagereturn = 658;
  39203. t.aleph = 823;
  39204. t.Ifraktur = 686;
  39205. t.Rfraktur = 795;
  39206. t.weierstrass = 987;
  39207. t.circlemultiply = 768;
  39208. t.circleplus = 768;
  39209. t.emptyset = 823;
  39210. t.intersection = 768;
  39211. t.union = 768;
  39212. t.propersuperset = 713;
  39213. t.reflexsuperset = 713;
  39214. t.notsubset = 713;
  39215. t.propersubset = 713;
  39216. t.reflexsubset = 713;
  39217. t.element = 713;
  39218. t.notelement = 713;
  39219. t.angle = 768;
  39220. t.gradient = 713;
  39221. t.registerserif = 790;
  39222. t.copyrightserif = 790;
  39223. t.trademarkserif = 890;
  39224. t.product = 823;
  39225. t.radical = 549;
  39226. t.dotmath = 250;
  39227. t.logicalnot = 713;
  39228. t.logicaland = 603;
  39229. t.logicalor = 603;
  39230. t.arrowdblboth = 1042;
  39231. t.arrowdblleft = 987;
  39232. t.arrowdblup = 603;
  39233. t.arrowdblright = 987;
  39234. t.arrowdbldown = 603;
  39235. t.lozenge = 494;
  39236. t.angleleft = 329;
  39237. t.registersans = 790;
  39238. t.copyrightsans = 790;
  39239. t.trademarksans = 786;
  39240. t.summation = 713;
  39241. t.parenlefttp = 384;
  39242. t.parenleftex = 384;
  39243. t.parenleftbt = 384;
  39244. t.bracketlefttp = 384;
  39245. t.bracketleftex = 384;
  39246. t.bracketleftbt = 384;
  39247. t.bracelefttp = 494;
  39248. t.braceleftmid = 494;
  39249. t.braceleftbt = 494;
  39250. t.braceex = 494;
  39251. t.angleright = 329;
  39252. t.integral = 274;
  39253. t.integraltp = 686;
  39254. t.integralex = 686;
  39255. t.integralbt = 686;
  39256. t.parenrighttp = 384;
  39257. t.parenrightex = 384;
  39258. t.parenrightbt = 384;
  39259. t.bracketrighttp = 384;
  39260. t.bracketrightex = 384;
  39261. t.bracketrightbt = 384;
  39262. t.bracerighttp = 494;
  39263. t.bracerightmid = 494;
  39264. t.bracerightbt = 494;
  39265. t.apple = 790;
  39266. });
  39267. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39268. t.space = 250;
  39269. t.exclam = 333;
  39270. t.quotedbl = 408;
  39271. t.numbersign = 500;
  39272. t.dollar = 500;
  39273. t.percent = 833;
  39274. t.ampersand = 778;
  39275. t.quoteright = 333;
  39276. t.parenleft = 333;
  39277. t.parenright = 333;
  39278. t.asterisk = 500;
  39279. t.plus = 564;
  39280. t.comma = 250;
  39281. t.hyphen = 333;
  39282. t.period = 250;
  39283. t.slash = 278;
  39284. t.zero = 500;
  39285. t.one = 500;
  39286. t.two = 500;
  39287. t.three = 500;
  39288. t.four = 500;
  39289. t.five = 500;
  39290. t.six = 500;
  39291. t.seven = 500;
  39292. t.eight = 500;
  39293. t.nine = 500;
  39294. t.colon = 278;
  39295. t.semicolon = 278;
  39296. t.less = 564;
  39297. t.equal = 564;
  39298. t.greater = 564;
  39299. t.question = 444;
  39300. t.at = 921;
  39301. t.A = 722;
  39302. t.B = 667;
  39303. t.C = 667;
  39304. t.D = 722;
  39305. t.E = 611;
  39306. t.F = 556;
  39307. t.G = 722;
  39308. t.H = 722;
  39309. t.I = 333;
  39310. t.J = 389;
  39311. t.K = 722;
  39312. t.L = 611;
  39313. t.M = 889;
  39314. t.N = 722;
  39315. t.O = 722;
  39316. t.P = 556;
  39317. t.Q = 722;
  39318. t.R = 667;
  39319. t.S = 556;
  39320. t.T = 611;
  39321. t.U = 722;
  39322. t.V = 722;
  39323. t.W = 944;
  39324. t.X = 722;
  39325. t.Y = 722;
  39326. t.Z = 611;
  39327. t.bracketleft = 333;
  39328. t.backslash = 278;
  39329. t.bracketright = 333;
  39330. t.asciicircum = 469;
  39331. t.underscore = 500;
  39332. t.quoteleft = 333;
  39333. t.a = 444;
  39334. t.b = 500;
  39335. t.c = 444;
  39336. t.d = 500;
  39337. t.e = 444;
  39338. t.f = 333;
  39339. t.g = 500;
  39340. t.h = 500;
  39341. t.i = 278;
  39342. t.j = 278;
  39343. t.k = 500;
  39344. t.l = 278;
  39345. t.m = 778;
  39346. t.n = 500;
  39347. t.o = 500;
  39348. t.p = 500;
  39349. t.q = 500;
  39350. t.r = 333;
  39351. t.s = 389;
  39352. t.t = 278;
  39353. t.u = 500;
  39354. t.v = 500;
  39355. t.w = 722;
  39356. t.x = 500;
  39357. t.y = 500;
  39358. t.z = 444;
  39359. t.braceleft = 480;
  39360. t.bar = 200;
  39361. t.braceright = 480;
  39362. t.asciitilde = 541;
  39363. t.exclamdown = 333;
  39364. t.cent = 500;
  39365. t.sterling = 500;
  39366. t.fraction = 167;
  39367. t.yen = 500;
  39368. t.florin = 500;
  39369. t.section = 500;
  39370. t.currency = 500;
  39371. t.quotesingle = 180;
  39372. t.quotedblleft = 444;
  39373. t.guillemotleft = 500;
  39374. t.guilsinglleft = 333;
  39375. t.guilsinglright = 333;
  39376. t.fi = 556;
  39377. t.fl = 556;
  39378. t.endash = 500;
  39379. t.dagger = 500;
  39380. t.daggerdbl = 500;
  39381. t.periodcentered = 250;
  39382. t.paragraph = 453;
  39383. t.bullet = 350;
  39384. t.quotesinglbase = 333;
  39385. t.quotedblbase = 444;
  39386. t.quotedblright = 444;
  39387. t.guillemotright = 500;
  39388. t.ellipsis = 1000;
  39389. t.perthousand = 1000;
  39390. t.questiondown = 444;
  39391. t.grave = 333;
  39392. t.acute = 333;
  39393. t.circumflex = 333;
  39394. t.tilde = 333;
  39395. t.macron = 333;
  39396. t.breve = 333;
  39397. t.dotaccent = 333;
  39398. t.dieresis = 333;
  39399. t.ring = 333;
  39400. t.cedilla = 333;
  39401. t.hungarumlaut = 333;
  39402. t.ogonek = 333;
  39403. t.caron = 333;
  39404. t.emdash = 1000;
  39405. t.AE = 889;
  39406. t.ordfeminine = 276;
  39407. t.Lslash = 611;
  39408. t.Oslash = 722;
  39409. t.OE = 889;
  39410. t.ordmasculine = 310;
  39411. t.ae = 667;
  39412. t.dotlessi = 278;
  39413. t.lslash = 278;
  39414. t.oslash = 500;
  39415. t.oe = 722;
  39416. t.germandbls = 500;
  39417. t.Idieresis = 333;
  39418. t.eacute = 444;
  39419. t.abreve = 444;
  39420. t.uhungarumlaut = 500;
  39421. t.ecaron = 444;
  39422. t.Ydieresis = 722;
  39423. t.divide = 564;
  39424. t.Yacute = 722;
  39425. t.Acircumflex = 722;
  39426. t.aacute = 444;
  39427. t.Ucircumflex = 722;
  39428. t.yacute = 500;
  39429. t.scommaaccent = 389;
  39430. t.ecircumflex = 444;
  39431. t.Uring = 722;
  39432. t.Udieresis = 722;
  39433. t.aogonek = 444;
  39434. t.Uacute = 722;
  39435. t.uogonek = 500;
  39436. t.Edieresis = 611;
  39437. t.Dcroat = 722;
  39438. t.commaaccent = 250;
  39439. t.copyright = 760;
  39440. t.Emacron = 611;
  39441. t.ccaron = 444;
  39442. t.aring = 444;
  39443. t.Ncommaaccent = 722;
  39444. t.lacute = 278;
  39445. t.agrave = 444;
  39446. t.Tcommaaccent = 611;
  39447. t.Cacute = 667;
  39448. t.atilde = 444;
  39449. t.Edotaccent = 611;
  39450. t.scaron = 389;
  39451. t.scedilla = 389;
  39452. t.iacute = 278;
  39453. t.lozenge = 471;
  39454. t.Rcaron = 667;
  39455. t.Gcommaaccent = 722;
  39456. t.ucircumflex = 500;
  39457. t.acircumflex = 444;
  39458. t.Amacron = 722;
  39459. t.rcaron = 333;
  39460. t.ccedilla = 444;
  39461. t.Zdotaccent = 611;
  39462. t.Thorn = 556;
  39463. t.Omacron = 722;
  39464. t.Racute = 667;
  39465. t.Sacute = 556;
  39466. t.dcaron = 588;
  39467. t.Umacron = 722;
  39468. t.uring = 500;
  39469. t.threesuperior = 300;
  39470. t.Ograve = 722;
  39471. t.Agrave = 722;
  39472. t.Abreve = 722;
  39473. t.multiply = 564;
  39474. t.uacute = 500;
  39475. t.Tcaron = 611;
  39476. t.partialdiff = 476;
  39477. t.ydieresis = 500;
  39478. t.Nacute = 722;
  39479. t.icircumflex = 278;
  39480. t.Ecircumflex = 611;
  39481. t.adieresis = 444;
  39482. t.edieresis = 444;
  39483. t.cacute = 444;
  39484. t.nacute = 500;
  39485. t.umacron = 500;
  39486. t.Ncaron = 722;
  39487. t.Iacute = 333;
  39488. t.plusminus = 564;
  39489. t.brokenbar = 200;
  39490. t.registered = 760;
  39491. t.Gbreve = 722;
  39492. t.Idotaccent = 333;
  39493. t.summation = 600;
  39494. t.Egrave = 611;
  39495. t.racute = 333;
  39496. t.omacron = 500;
  39497. t.Zacute = 611;
  39498. t.Zcaron = 611;
  39499. t.greaterequal = 549;
  39500. t.Eth = 722;
  39501. t.Ccedilla = 667;
  39502. t.lcommaaccent = 278;
  39503. t.tcaron = 326;
  39504. t.eogonek = 444;
  39505. t.Uogonek = 722;
  39506. t.Aacute = 722;
  39507. t.Adieresis = 722;
  39508. t.egrave = 444;
  39509. t.zacute = 444;
  39510. t.iogonek = 278;
  39511. t.Oacute = 722;
  39512. t.oacute = 500;
  39513. t.amacron = 444;
  39514. t.sacute = 389;
  39515. t.idieresis = 278;
  39516. t.Ocircumflex = 722;
  39517. t.Ugrave = 722;
  39518. t.Delta = 612;
  39519. t.thorn = 500;
  39520. t.twosuperior = 300;
  39521. t.Odieresis = 722;
  39522. t.mu = 500;
  39523. t.igrave = 278;
  39524. t.ohungarumlaut = 500;
  39525. t.Eogonek = 611;
  39526. t.dcroat = 500;
  39527. t.threequarters = 750;
  39528. t.Scedilla = 556;
  39529. t.lcaron = 344;
  39530. t.Kcommaaccent = 722;
  39531. t.Lacute = 611;
  39532. t.trademark = 980;
  39533. t.edotaccent = 444;
  39534. t.Igrave = 333;
  39535. t.Imacron = 333;
  39536. t.Lcaron = 611;
  39537. t.onehalf = 750;
  39538. t.lessequal = 549;
  39539. t.ocircumflex = 500;
  39540. t.ntilde = 500;
  39541. t.Uhungarumlaut = 722;
  39542. t.Eacute = 611;
  39543. t.emacron = 444;
  39544. t.gbreve = 500;
  39545. t.onequarter = 750;
  39546. t.Scaron = 556;
  39547. t.Scommaaccent = 556;
  39548. t.Ohungarumlaut = 722;
  39549. t.degree = 400;
  39550. t.ograve = 500;
  39551. t.Ccaron = 667;
  39552. t.ugrave = 500;
  39553. t.radical = 453;
  39554. t.Dcaron = 722;
  39555. t.rcommaaccent = 333;
  39556. t.Ntilde = 722;
  39557. t.otilde = 500;
  39558. t.Rcommaaccent = 667;
  39559. t.Lcommaaccent = 611;
  39560. t.Atilde = 722;
  39561. t.Aogonek = 722;
  39562. t.Aring = 722;
  39563. t.Otilde = 722;
  39564. t.zdotaccent = 444;
  39565. t.Ecaron = 611;
  39566. t.Iogonek = 333;
  39567. t.kcommaaccent = 500;
  39568. t.minus = 564;
  39569. t.Icircumflex = 333;
  39570. t.ncaron = 500;
  39571. t.tcommaaccent = 278;
  39572. t.logicalnot = 564;
  39573. t.odieresis = 500;
  39574. t.udieresis = 500;
  39575. t.notequal = 549;
  39576. t.gcommaaccent = 500;
  39577. t.eth = 500;
  39578. t.zcaron = 444;
  39579. t.ncommaaccent = 500;
  39580. t.onesuperior = 300;
  39581. t.imacron = 278;
  39582. t.Euro = 500;
  39583. });
  39584. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39585. t.space = 250;
  39586. t.exclam = 333;
  39587. t.quotedbl = 555;
  39588. t.numbersign = 500;
  39589. t.dollar = 500;
  39590. t.percent = 1000;
  39591. t.ampersand = 833;
  39592. t.quoteright = 333;
  39593. t.parenleft = 333;
  39594. t.parenright = 333;
  39595. t.asterisk = 500;
  39596. t.plus = 570;
  39597. t.comma = 250;
  39598. t.hyphen = 333;
  39599. t.period = 250;
  39600. t.slash = 278;
  39601. t.zero = 500;
  39602. t.one = 500;
  39603. t.two = 500;
  39604. t.three = 500;
  39605. t.four = 500;
  39606. t.five = 500;
  39607. t.six = 500;
  39608. t.seven = 500;
  39609. t.eight = 500;
  39610. t.nine = 500;
  39611. t.colon = 333;
  39612. t.semicolon = 333;
  39613. t.less = 570;
  39614. t.equal = 570;
  39615. t.greater = 570;
  39616. t.question = 500;
  39617. t.at = 930;
  39618. t.A = 722;
  39619. t.B = 667;
  39620. t.C = 722;
  39621. t.D = 722;
  39622. t.E = 667;
  39623. t.F = 611;
  39624. t.G = 778;
  39625. t.H = 778;
  39626. t.I = 389;
  39627. t.J = 500;
  39628. t.K = 778;
  39629. t.L = 667;
  39630. t.M = 944;
  39631. t.N = 722;
  39632. t.O = 778;
  39633. t.P = 611;
  39634. t.Q = 778;
  39635. t.R = 722;
  39636. t.S = 556;
  39637. t.T = 667;
  39638. t.U = 722;
  39639. t.V = 722;
  39640. t.W = 1000;
  39641. t.X = 722;
  39642. t.Y = 722;
  39643. t.Z = 667;
  39644. t.bracketleft = 333;
  39645. t.backslash = 278;
  39646. t.bracketright = 333;
  39647. t.asciicircum = 581;
  39648. t.underscore = 500;
  39649. t.quoteleft = 333;
  39650. t.a = 500;
  39651. t.b = 556;
  39652. t.c = 444;
  39653. t.d = 556;
  39654. t.e = 444;
  39655. t.f = 333;
  39656. t.g = 500;
  39657. t.h = 556;
  39658. t.i = 278;
  39659. t.j = 333;
  39660. t.k = 556;
  39661. t.l = 278;
  39662. t.m = 833;
  39663. t.n = 556;
  39664. t.o = 500;
  39665. t.p = 556;
  39666. t.q = 556;
  39667. t.r = 444;
  39668. t.s = 389;
  39669. t.t = 333;
  39670. t.u = 556;
  39671. t.v = 500;
  39672. t.w = 722;
  39673. t.x = 500;
  39674. t.y = 500;
  39675. t.z = 444;
  39676. t.braceleft = 394;
  39677. t.bar = 220;
  39678. t.braceright = 394;
  39679. t.asciitilde = 520;
  39680. t.exclamdown = 333;
  39681. t.cent = 500;
  39682. t.sterling = 500;
  39683. t.fraction = 167;
  39684. t.yen = 500;
  39685. t.florin = 500;
  39686. t.section = 500;
  39687. t.currency = 500;
  39688. t.quotesingle = 278;
  39689. t.quotedblleft = 500;
  39690. t.guillemotleft = 500;
  39691. t.guilsinglleft = 333;
  39692. t.guilsinglright = 333;
  39693. t.fi = 556;
  39694. t.fl = 556;
  39695. t.endash = 500;
  39696. t.dagger = 500;
  39697. t.daggerdbl = 500;
  39698. t.periodcentered = 250;
  39699. t.paragraph = 540;
  39700. t.bullet = 350;
  39701. t.quotesinglbase = 333;
  39702. t.quotedblbase = 500;
  39703. t.quotedblright = 500;
  39704. t.guillemotright = 500;
  39705. t.ellipsis = 1000;
  39706. t.perthousand = 1000;
  39707. t.questiondown = 500;
  39708. t.grave = 333;
  39709. t.acute = 333;
  39710. t.circumflex = 333;
  39711. t.tilde = 333;
  39712. t.macron = 333;
  39713. t.breve = 333;
  39714. t.dotaccent = 333;
  39715. t.dieresis = 333;
  39716. t.ring = 333;
  39717. t.cedilla = 333;
  39718. t.hungarumlaut = 333;
  39719. t.ogonek = 333;
  39720. t.caron = 333;
  39721. t.emdash = 1000;
  39722. t.AE = 1000;
  39723. t.ordfeminine = 300;
  39724. t.Lslash = 667;
  39725. t.Oslash = 778;
  39726. t.OE = 1000;
  39727. t.ordmasculine = 330;
  39728. t.ae = 722;
  39729. t.dotlessi = 278;
  39730. t.lslash = 278;
  39731. t.oslash = 500;
  39732. t.oe = 722;
  39733. t.germandbls = 556;
  39734. t.Idieresis = 389;
  39735. t.eacute = 444;
  39736. t.abreve = 500;
  39737. t.uhungarumlaut = 556;
  39738. t.ecaron = 444;
  39739. t.Ydieresis = 722;
  39740. t.divide = 570;
  39741. t.Yacute = 722;
  39742. t.Acircumflex = 722;
  39743. t.aacute = 500;
  39744. t.Ucircumflex = 722;
  39745. t.yacute = 500;
  39746. t.scommaaccent = 389;
  39747. t.ecircumflex = 444;
  39748. t.Uring = 722;
  39749. t.Udieresis = 722;
  39750. t.aogonek = 500;
  39751. t.Uacute = 722;
  39752. t.uogonek = 556;
  39753. t.Edieresis = 667;
  39754. t.Dcroat = 722;
  39755. t.commaaccent = 250;
  39756. t.copyright = 747;
  39757. t.Emacron = 667;
  39758. t.ccaron = 444;
  39759. t.aring = 500;
  39760. t.Ncommaaccent = 722;
  39761. t.lacute = 278;
  39762. t.agrave = 500;
  39763. t.Tcommaaccent = 667;
  39764. t.Cacute = 722;
  39765. t.atilde = 500;
  39766. t.Edotaccent = 667;
  39767. t.scaron = 389;
  39768. t.scedilla = 389;
  39769. t.iacute = 278;
  39770. t.lozenge = 494;
  39771. t.Rcaron = 722;
  39772. t.Gcommaaccent = 778;
  39773. t.ucircumflex = 556;
  39774. t.acircumflex = 500;
  39775. t.Amacron = 722;
  39776. t.rcaron = 444;
  39777. t.ccedilla = 444;
  39778. t.Zdotaccent = 667;
  39779. t.Thorn = 611;
  39780. t.Omacron = 778;
  39781. t.Racute = 722;
  39782. t.Sacute = 556;
  39783. t.dcaron = 672;
  39784. t.Umacron = 722;
  39785. t.uring = 556;
  39786. t.threesuperior = 300;
  39787. t.Ograve = 778;
  39788. t.Agrave = 722;
  39789. t.Abreve = 722;
  39790. t.multiply = 570;
  39791. t.uacute = 556;
  39792. t.Tcaron = 667;
  39793. t.partialdiff = 494;
  39794. t.ydieresis = 500;
  39795. t.Nacute = 722;
  39796. t.icircumflex = 278;
  39797. t.Ecircumflex = 667;
  39798. t.adieresis = 500;
  39799. t.edieresis = 444;
  39800. t.cacute = 444;
  39801. t.nacute = 556;
  39802. t.umacron = 556;
  39803. t.Ncaron = 722;
  39804. t.Iacute = 389;
  39805. t.plusminus = 570;
  39806. t.brokenbar = 220;
  39807. t.registered = 747;
  39808. t.Gbreve = 778;
  39809. t.Idotaccent = 389;
  39810. t.summation = 600;
  39811. t.Egrave = 667;
  39812. t.racute = 444;
  39813. t.omacron = 500;
  39814. t.Zacute = 667;
  39815. t.Zcaron = 667;
  39816. t.greaterequal = 549;
  39817. t.Eth = 722;
  39818. t.Ccedilla = 722;
  39819. t.lcommaaccent = 278;
  39820. t.tcaron = 416;
  39821. t.eogonek = 444;
  39822. t.Uogonek = 722;
  39823. t.Aacute = 722;
  39824. t.Adieresis = 722;
  39825. t.egrave = 444;
  39826. t.zacute = 444;
  39827. t.iogonek = 278;
  39828. t.Oacute = 778;
  39829. t.oacute = 500;
  39830. t.amacron = 500;
  39831. t.sacute = 389;
  39832. t.idieresis = 278;
  39833. t.Ocircumflex = 778;
  39834. t.Ugrave = 722;
  39835. t.Delta = 612;
  39836. t.thorn = 556;
  39837. t.twosuperior = 300;
  39838. t.Odieresis = 778;
  39839. t.mu = 556;
  39840. t.igrave = 278;
  39841. t.ohungarumlaut = 500;
  39842. t.Eogonek = 667;
  39843. t.dcroat = 556;
  39844. t.threequarters = 750;
  39845. t.Scedilla = 556;
  39846. t.lcaron = 394;
  39847. t.Kcommaaccent = 778;
  39848. t.Lacute = 667;
  39849. t.trademark = 1000;
  39850. t.edotaccent = 444;
  39851. t.Igrave = 389;
  39852. t.Imacron = 389;
  39853. t.Lcaron = 667;
  39854. t.onehalf = 750;
  39855. t.lessequal = 549;
  39856. t.ocircumflex = 500;
  39857. t.ntilde = 556;
  39858. t.Uhungarumlaut = 722;
  39859. t.Eacute = 667;
  39860. t.emacron = 444;
  39861. t.gbreve = 500;
  39862. t.onequarter = 750;
  39863. t.Scaron = 556;
  39864. t.Scommaaccent = 556;
  39865. t.Ohungarumlaut = 778;
  39866. t.degree = 400;
  39867. t.ograve = 500;
  39868. t.Ccaron = 722;
  39869. t.ugrave = 556;
  39870. t.radical = 549;
  39871. t.Dcaron = 722;
  39872. t.rcommaaccent = 444;
  39873. t.Ntilde = 722;
  39874. t.otilde = 500;
  39875. t.Rcommaaccent = 722;
  39876. t.Lcommaaccent = 667;
  39877. t.Atilde = 722;
  39878. t.Aogonek = 722;
  39879. t.Aring = 722;
  39880. t.Otilde = 778;
  39881. t.zdotaccent = 444;
  39882. t.Ecaron = 667;
  39883. t.Iogonek = 389;
  39884. t.kcommaaccent = 556;
  39885. t.minus = 570;
  39886. t.Icircumflex = 389;
  39887. t.ncaron = 556;
  39888. t.tcommaaccent = 333;
  39889. t.logicalnot = 570;
  39890. t.odieresis = 500;
  39891. t.udieresis = 556;
  39892. t.notequal = 549;
  39893. t.gcommaaccent = 500;
  39894. t.eth = 500;
  39895. t.zcaron = 444;
  39896. t.ncommaaccent = 556;
  39897. t.onesuperior = 300;
  39898. t.imacron = 278;
  39899. t.Euro = 500;
  39900. });
  39901. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39902. t.space = 250;
  39903. t.exclam = 389;
  39904. t.quotedbl = 555;
  39905. t.numbersign = 500;
  39906. t.dollar = 500;
  39907. t.percent = 833;
  39908. t.ampersand = 778;
  39909. t.quoteright = 333;
  39910. t.parenleft = 333;
  39911. t.parenright = 333;
  39912. t.asterisk = 500;
  39913. t.plus = 570;
  39914. t.comma = 250;
  39915. t.hyphen = 333;
  39916. t.period = 250;
  39917. t.slash = 278;
  39918. t.zero = 500;
  39919. t.one = 500;
  39920. t.two = 500;
  39921. t.three = 500;
  39922. t.four = 500;
  39923. t.five = 500;
  39924. t.six = 500;
  39925. t.seven = 500;
  39926. t.eight = 500;
  39927. t.nine = 500;
  39928. t.colon = 333;
  39929. t.semicolon = 333;
  39930. t.less = 570;
  39931. t.equal = 570;
  39932. t.greater = 570;
  39933. t.question = 500;
  39934. t.at = 832;
  39935. t.A = 667;
  39936. t.B = 667;
  39937. t.C = 667;
  39938. t.D = 722;
  39939. t.E = 667;
  39940. t.F = 667;
  39941. t.G = 722;
  39942. t.H = 778;
  39943. t.I = 389;
  39944. t.J = 500;
  39945. t.K = 667;
  39946. t.L = 611;
  39947. t.M = 889;
  39948. t.N = 722;
  39949. t.O = 722;
  39950. t.P = 611;
  39951. t.Q = 722;
  39952. t.R = 667;
  39953. t.S = 556;
  39954. t.T = 611;
  39955. t.U = 722;
  39956. t.V = 667;
  39957. t.W = 889;
  39958. t.X = 667;
  39959. t.Y = 611;
  39960. t.Z = 611;
  39961. t.bracketleft = 333;
  39962. t.backslash = 278;
  39963. t.bracketright = 333;
  39964. t.asciicircum = 570;
  39965. t.underscore = 500;
  39966. t.quoteleft = 333;
  39967. t.a = 500;
  39968. t.b = 500;
  39969. t.c = 444;
  39970. t.d = 500;
  39971. t.e = 444;
  39972. t.f = 333;
  39973. t.g = 500;
  39974. t.h = 556;
  39975. t.i = 278;
  39976. t.j = 278;
  39977. t.k = 500;
  39978. t.l = 278;
  39979. t.m = 778;
  39980. t.n = 556;
  39981. t.o = 500;
  39982. t.p = 500;
  39983. t.q = 500;
  39984. t.r = 389;
  39985. t.s = 389;
  39986. t.t = 278;
  39987. t.u = 556;
  39988. t.v = 444;
  39989. t.w = 667;
  39990. t.x = 500;
  39991. t.y = 444;
  39992. t.z = 389;
  39993. t.braceleft = 348;
  39994. t.bar = 220;
  39995. t.braceright = 348;
  39996. t.asciitilde = 570;
  39997. t.exclamdown = 389;
  39998. t.cent = 500;
  39999. t.sterling = 500;
  40000. t.fraction = 167;
  40001. t.yen = 500;
  40002. t.florin = 500;
  40003. t.section = 500;
  40004. t.currency = 500;
  40005. t.quotesingle = 278;
  40006. t.quotedblleft = 500;
  40007. t.guillemotleft = 500;
  40008. t.guilsinglleft = 333;
  40009. t.guilsinglright = 333;
  40010. t.fi = 556;
  40011. t.fl = 556;
  40012. t.endash = 500;
  40013. t.dagger = 500;
  40014. t.daggerdbl = 500;
  40015. t.periodcentered = 250;
  40016. t.paragraph = 500;
  40017. t.bullet = 350;
  40018. t.quotesinglbase = 333;
  40019. t.quotedblbase = 500;
  40020. t.quotedblright = 500;
  40021. t.guillemotright = 500;
  40022. t.ellipsis = 1000;
  40023. t.perthousand = 1000;
  40024. t.questiondown = 500;
  40025. t.grave = 333;
  40026. t.acute = 333;
  40027. t.circumflex = 333;
  40028. t.tilde = 333;
  40029. t.macron = 333;
  40030. t.breve = 333;
  40031. t.dotaccent = 333;
  40032. t.dieresis = 333;
  40033. t.ring = 333;
  40034. t.cedilla = 333;
  40035. t.hungarumlaut = 333;
  40036. t.ogonek = 333;
  40037. t.caron = 333;
  40038. t.emdash = 1000;
  40039. t.AE = 944;
  40040. t.ordfeminine = 266;
  40041. t.Lslash = 611;
  40042. t.Oslash = 722;
  40043. t.OE = 944;
  40044. t.ordmasculine = 300;
  40045. t.ae = 722;
  40046. t.dotlessi = 278;
  40047. t.lslash = 278;
  40048. t.oslash = 500;
  40049. t.oe = 722;
  40050. t.germandbls = 500;
  40051. t.Idieresis = 389;
  40052. t.eacute = 444;
  40053. t.abreve = 500;
  40054. t.uhungarumlaut = 556;
  40055. t.ecaron = 444;
  40056. t.Ydieresis = 611;
  40057. t.divide = 570;
  40058. t.Yacute = 611;
  40059. t.Acircumflex = 667;
  40060. t.aacute = 500;
  40061. t.Ucircumflex = 722;
  40062. t.yacute = 444;
  40063. t.scommaaccent = 389;
  40064. t.ecircumflex = 444;
  40065. t.Uring = 722;
  40066. t.Udieresis = 722;
  40067. t.aogonek = 500;
  40068. t.Uacute = 722;
  40069. t.uogonek = 556;
  40070. t.Edieresis = 667;
  40071. t.Dcroat = 722;
  40072. t.commaaccent = 250;
  40073. t.copyright = 747;
  40074. t.Emacron = 667;
  40075. t.ccaron = 444;
  40076. t.aring = 500;
  40077. t.Ncommaaccent = 722;
  40078. t.lacute = 278;
  40079. t.agrave = 500;
  40080. t.Tcommaaccent = 611;
  40081. t.Cacute = 667;
  40082. t.atilde = 500;
  40083. t.Edotaccent = 667;
  40084. t.scaron = 389;
  40085. t.scedilla = 389;
  40086. t.iacute = 278;
  40087. t.lozenge = 494;
  40088. t.Rcaron = 667;
  40089. t.Gcommaaccent = 722;
  40090. t.ucircumflex = 556;
  40091. t.acircumflex = 500;
  40092. t.Amacron = 667;
  40093. t.rcaron = 389;
  40094. t.ccedilla = 444;
  40095. t.Zdotaccent = 611;
  40096. t.Thorn = 611;
  40097. t.Omacron = 722;
  40098. t.Racute = 667;
  40099. t.Sacute = 556;
  40100. t.dcaron = 608;
  40101. t.Umacron = 722;
  40102. t.uring = 556;
  40103. t.threesuperior = 300;
  40104. t.Ograve = 722;
  40105. t.Agrave = 667;
  40106. t.Abreve = 667;
  40107. t.multiply = 570;
  40108. t.uacute = 556;
  40109. t.Tcaron = 611;
  40110. t.partialdiff = 494;
  40111. t.ydieresis = 444;
  40112. t.Nacute = 722;
  40113. t.icircumflex = 278;
  40114. t.Ecircumflex = 667;
  40115. t.adieresis = 500;
  40116. t.edieresis = 444;
  40117. t.cacute = 444;
  40118. t.nacute = 556;
  40119. t.umacron = 556;
  40120. t.Ncaron = 722;
  40121. t.Iacute = 389;
  40122. t.plusminus = 570;
  40123. t.brokenbar = 220;
  40124. t.registered = 747;
  40125. t.Gbreve = 722;
  40126. t.Idotaccent = 389;
  40127. t.summation = 600;
  40128. t.Egrave = 667;
  40129. t.racute = 389;
  40130. t.omacron = 500;
  40131. t.Zacute = 611;
  40132. t.Zcaron = 611;
  40133. t.greaterequal = 549;
  40134. t.Eth = 722;
  40135. t.Ccedilla = 667;
  40136. t.lcommaaccent = 278;
  40137. t.tcaron = 366;
  40138. t.eogonek = 444;
  40139. t.Uogonek = 722;
  40140. t.Aacute = 667;
  40141. t.Adieresis = 667;
  40142. t.egrave = 444;
  40143. t.zacute = 389;
  40144. t.iogonek = 278;
  40145. t.Oacute = 722;
  40146. t.oacute = 500;
  40147. t.amacron = 500;
  40148. t.sacute = 389;
  40149. t.idieresis = 278;
  40150. t.Ocircumflex = 722;
  40151. t.Ugrave = 722;
  40152. t.Delta = 612;
  40153. t.thorn = 500;
  40154. t.twosuperior = 300;
  40155. t.Odieresis = 722;
  40156. t.mu = 576;
  40157. t.igrave = 278;
  40158. t.ohungarumlaut = 500;
  40159. t.Eogonek = 667;
  40160. t.dcroat = 500;
  40161. t.threequarters = 750;
  40162. t.Scedilla = 556;
  40163. t.lcaron = 382;
  40164. t.Kcommaaccent = 667;
  40165. t.Lacute = 611;
  40166. t.trademark = 1000;
  40167. t.edotaccent = 444;
  40168. t.Igrave = 389;
  40169. t.Imacron = 389;
  40170. t.Lcaron = 611;
  40171. t.onehalf = 750;
  40172. t.lessequal = 549;
  40173. t.ocircumflex = 500;
  40174. t.ntilde = 556;
  40175. t.Uhungarumlaut = 722;
  40176. t.Eacute = 667;
  40177. t.emacron = 444;
  40178. t.gbreve = 500;
  40179. t.onequarter = 750;
  40180. t.Scaron = 556;
  40181. t.Scommaaccent = 556;
  40182. t.Ohungarumlaut = 722;
  40183. t.degree = 400;
  40184. t.ograve = 500;
  40185. t.Ccaron = 667;
  40186. t.ugrave = 556;
  40187. t.radical = 549;
  40188. t.Dcaron = 722;
  40189. t.rcommaaccent = 389;
  40190. t.Ntilde = 722;
  40191. t.otilde = 500;
  40192. t.Rcommaaccent = 667;
  40193. t.Lcommaaccent = 611;
  40194. t.Atilde = 667;
  40195. t.Aogonek = 667;
  40196. t.Aring = 667;
  40197. t.Otilde = 722;
  40198. t.zdotaccent = 389;
  40199. t.Ecaron = 667;
  40200. t.Iogonek = 389;
  40201. t.kcommaaccent = 500;
  40202. t.minus = 606;
  40203. t.Icircumflex = 389;
  40204. t.ncaron = 556;
  40205. t.tcommaaccent = 278;
  40206. t.logicalnot = 606;
  40207. t.odieresis = 500;
  40208. t.udieresis = 556;
  40209. t.notequal = 549;
  40210. t.gcommaaccent = 500;
  40211. t.eth = 500;
  40212. t.zcaron = 389;
  40213. t.ncommaaccent = 556;
  40214. t.onesuperior = 300;
  40215. t.imacron = 278;
  40216. t.Euro = 500;
  40217. });
  40218. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40219. t.space = 250;
  40220. t.exclam = 333;
  40221. t.quotedbl = 420;
  40222. t.numbersign = 500;
  40223. t.dollar = 500;
  40224. t.percent = 833;
  40225. t.ampersand = 778;
  40226. t.quoteright = 333;
  40227. t.parenleft = 333;
  40228. t.parenright = 333;
  40229. t.asterisk = 500;
  40230. t.plus = 675;
  40231. t.comma = 250;
  40232. t.hyphen = 333;
  40233. t.period = 250;
  40234. t.slash = 278;
  40235. t.zero = 500;
  40236. t.one = 500;
  40237. t.two = 500;
  40238. t.three = 500;
  40239. t.four = 500;
  40240. t.five = 500;
  40241. t.six = 500;
  40242. t.seven = 500;
  40243. t.eight = 500;
  40244. t.nine = 500;
  40245. t.colon = 333;
  40246. t.semicolon = 333;
  40247. t.less = 675;
  40248. t.equal = 675;
  40249. t.greater = 675;
  40250. t.question = 500;
  40251. t.at = 920;
  40252. t.A = 611;
  40253. t.B = 611;
  40254. t.C = 667;
  40255. t.D = 722;
  40256. t.E = 611;
  40257. t.F = 611;
  40258. t.G = 722;
  40259. t.H = 722;
  40260. t.I = 333;
  40261. t.J = 444;
  40262. t.K = 667;
  40263. t.L = 556;
  40264. t.M = 833;
  40265. t.N = 667;
  40266. t.O = 722;
  40267. t.P = 611;
  40268. t.Q = 722;
  40269. t.R = 611;
  40270. t.S = 500;
  40271. t.T = 556;
  40272. t.U = 722;
  40273. t.V = 611;
  40274. t.W = 833;
  40275. t.X = 611;
  40276. t.Y = 556;
  40277. t.Z = 556;
  40278. t.bracketleft = 389;
  40279. t.backslash = 278;
  40280. t.bracketright = 389;
  40281. t.asciicircum = 422;
  40282. t.underscore = 500;
  40283. t.quoteleft = 333;
  40284. t.a = 500;
  40285. t.b = 500;
  40286. t.c = 444;
  40287. t.d = 500;
  40288. t.e = 444;
  40289. t.f = 278;
  40290. t.g = 500;
  40291. t.h = 500;
  40292. t.i = 278;
  40293. t.j = 278;
  40294. t.k = 444;
  40295. t.l = 278;
  40296. t.m = 722;
  40297. t.n = 500;
  40298. t.o = 500;
  40299. t.p = 500;
  40300. t.q = 500;
  40301. t.r = 389;
  40302. t.s = 389;
  40303. t.t = 278;
  40304. t.u = 500;
  40305. t.v = 444;
  40306. t.w = 667;
  40307. t.x = 444;
  40308. t.y = 444;
  40309. t.z = 389;
  40310. t.braceleft = 400;
  40311. t.bar = 275;
  40312. t.braceright = 400;
  40313. t.asciitilde = 541;
  40314. t.exclamdown = 389;
  40315. t.cent = 500;
  40316. t.sterling = 500;
  40317. t.fraction = 167;
  40318. t.yen = 500;
  40319. t.florin = 500;
  40320. t.section = 500;
  40321. t.currency = 500;
  40322. t.quotesingle = 214;
  40323. t.quotedblleft = 556;
  40324. t.guillemotleft = 500;
  40325. t.guilsinglleft = 333;
  40326. t.guilsinglright = 333;
  40327. t.fi = 500;
  40328. t.fl = 500;
  40329. t.endash = 500;
  40330. t.dagger = 500;
  40331. t.daggerdbl = 500;
  40332. t.periodcentered = 250;
  40333. t.paragraph = 523;
  40334. t.bullet = 350;
  40335. t.quotesinglbase = 333;
  40336. t.quotedblbase = 556;
  40337. t.quotedblright = 556;
  40338. t.guillemotright = 500;
  40339. t.ellipsis = 889;
  40340. t.perthousand = 1000;
  40341. t.questiondown = 500;
  40342. t.grave = 333;
  40343. t.acute = 333;
  40344. t.circumflex = 333;
  40345. t.tilde = 333;
  40346. t.macron = 333;
  40347. t.breve = 333;
  40348. t.dotaccent = 333;
  40349. t.dieresis = 333;
  40350. t.ring = 333;
  40351. t.cedilla = 333;
  40352. t.hungarumlaut = 333;
  40353. t.ogonek = 333;
  40354. t.caron = 333;
  40355. t.emdash = 889;
  40356. t.AE = 889;
  40357. t.ordfeminine = 276;
  40358. t.Lslash = 556;
  40359. t.Oslash = 722;
  40360. t.OE = 944;
  40361. t.ordmasculine = 310;
  40362. t.ae = 667;
  40363. t.dotlessi = 278;
  40364. t.lslash = 278;
  40365. t.oslash = 500;
  40366. t.oe = 667;
  40367. t.germandbls = 500;
  40368. t.Idieresis = 333;
  40369. t.eacute = 444;
  40370. t.abreve = 500;
  40371. t.uhungarumlaut = 500;
  40372. t.ecaron = 444;
  40373. t.Ydieresis = 556;
  40374. t.divide = 675;
  40375. t.Yacute = 556;
  40376. t.Acircumflex = 611;
  40377. t.aacute = 500;
  40378. t.Ucircumflex = 722;
  40379. t.yacute = 444;
  40380. t.scommaaccent = 389;
  40381. t.ecircumflex = 444;
  40382. t.Uring = 722;
  40383. t.Udieresis = 722;
  40384. t.aogonek = 500;
  40385. t.Uacute = 722;
  40386. t.uogonek = 500;
  40387. t.Edieresis = 611;
  40388. t.Dcroat = 722;
  40389. t.commaaccent = 250;
  40390. t.copyright = 760;
  40391. t.Emacron = 611;
  40392. t.ccaron = 444;
  40393. t.aring = 500;
  40394. t.Ncommaaccent = 667;
  40395. t.lacute = 278;
  40396. t.agrave = 500;
  40397. t.Tcommaaccent = 556;
  40398. t.Cacute = 667;
  40399. t.atilde = 500;
  40400. t.Edotaccent = 611;
  40401. t.scaron = 389;
  40402. t.scedilla = 389;
  40403. t.iacute = 278;
  40404. t.lozenge = 471;
  40405. t.Rcaron = 611;
  40406. t.Gcommaaccent = 722;
  40407. t.ucircumflex = 500;
  40408. t.acircumflex = 500;
  40409. t.Amacron = 611;
  40410. t.rcaron = 389;
  40411. t.ccedilla = 444;
  40412. t.Zdotaccent = 556;
  40413. t.Thorn = 611;
  40414. t.Omacron = 722;
  40415. t.Racute = 611;
  40416. t.Sacute = 500;
  40417. t.dcaron = 544;
  40418. t.Umacron = 722;
  40419. t.uring = 500;
  40420. t.threesuperior = 300;
  40421. t.Ograve = 722;
  40422. t.Agrave = 611;
  40423. t.Abreve = 611;
  40424. t.multiply = 675;
  40425. t.uacute = 500;
  40426. t.Tcaron = 556;
  40427. t.partialdiff = 476;
  40428. t.ydieresis = 444;
  40429. t.Nacute = 667;
  40430. t.icircumflex = 278;
  40431. t.Ecircumflex = 611;
  40432. t.adieresis = 500;
  40433. t.edieresis = 444;
  40434. t.cacute = 444;
  40435. t.nacute = 500;
  40436. t.umacron = 500;
  40437. t.Ncaron = 667;
  40438. t.Iacute = 333;
  40439. t.plusminus = 675;
  40440. t.brokenbar = 275;
  40441. t.registered = 760;
  40442. t.Gbreve = 722;
  40443. t.Idotaccent = 333;
  40444. t.summation = 600;
  40445. t.Egrave = 611;
  40446. t.racute = 389;
  40447. t.omacron = 500;
  40448. t.Zacute = 556;
  40449. t.Zcaron = 556;
  40450. t.greaterequal = 549;
  40451. t.Eth = 722;
  40452. t.Ccedilla = 667;
  40453. t.lcommaaccent = 278;
  40454. t.tcaron = 300;
  40455. t.eogonek = 444;
  40456. t.Uogonek = 722;
  40457. t.Aacute = 611;
  40458. t.Adieresis = 611;
  40459. t.egrave = 444;
  40460. t.zacute = 389;
  40461. t.iogonek = 278;
  40462. t.Oacute = 722;
  40463. t.oacute = 500;
  40464. t.amacron = 500;
  40465. t.sacute = 389;
  40466. t.idieresis = 278;
  40467. t.Ocircumflex = 722;
  40468. t.Ugrave = 722;
  40469. t.Delta = 612;
  40470. t.thorn = 500;
  40471. t.twosuperior = 300;
  40472. t.Odieresis = 722;
  40473. t.mu = 500;
  40474. t.igrave = 278;
  40475. t.ohungarumlaut = 500;
  40476. t.Eogonek = 611;
  40477. t.dcroat = 500;
  40478. t.threequarters = 750;
  40479. t.Scedilla = 500;
  40480. t.lcaron = 300;
  40481. t.Kcommaaccent = 667;
  40482. t.Lacute = 556;
  40483. t.trademark = 980;
  40484. t.edotaccent = 444;
  40485. t.Igrave = 333;
  40486. t.Imacron = 333;
  40487. t.Lcaron = 611;
  40488. t.onehalf = 750;
  40489. t.lessequal = 549;
  40490. t.ocircumflex = 500;
  40491. t.ntilde = 500;
  40492. t.Uhungarumlaut = 722;
  40493. t.Eacute = 611;
  40494. t.emacron = 444;
  40495. t.gbreve = 500;
  40496. t.onequarter = 750;
  40497. t.Scaron = 500;
  40498. t.Scommaaccent = 500;
  40499. t.Ohungarumlaut = 722;
  40500. t.degree = 400;
  40501. t.ograve = 500;
  40502. t.Ccaron = 667;
  40503. t.ugrave = 500;
  40504. t.radical = 453;
  40505. t.Dcaron = 722;
  40506. t.rcommaaccent = 389;
  40507. t.Ntilde = 667;
  40508. t.otilde = 500;
  40509. t.Rcommaaccent = 611;
  40510. t.Lcommaaccent = 556;
  40511. t.Atilde = 611;
  40512. t.Aogonek = 611;
  40513. t.Aring = 611;
  40514. t.Otilde = 722;
  40515. t.zdotaccent = 389;
  40516. t.Ecaron = 611;
  40517. t.Iogonek = 333;
  40518. t.kcommaaccent = 444;
  40519. t.minus = 675;
  40520. t.Icircumflex = 333;
  40521. t.ncaron = 500;
  40522. t.tcommaaccent = 278;
  40523. t.logicalnot = 675;
  40524. t.odieresis = 500;
  40525. t.udieresis = 500;
  40526. t.notequal = 549;
  40527. t.gcommaaccent = 500;
  40528. t.eth = 500;
  40529. t.zcaron = 389;
  40530. t.ncommaaccent = 500;
  40531. t.onesuperior = 300;
  40532. t.imacron = 278;
  40533. t.Euro = 500;
  40534. });
  40535. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  40536. t.space = 278;
  40537. t.a1 = 974;
  40538. t.a2 = 961;
  40539. t.a202 = 974;
  40540. t.a3 = 980;
  40541. t.a4 = 719;
  40542. t.a5 = 789;
  40543. t.a119 = 790;
  40544. t.a118 = 791;
  40545. t.a117 = 690;
  40546. t.a11 = 960;
  40547. t.a12 = 939;
  40548. t.a13 = 549;
  40549. t.a14 = 855;
  40550. t.a15 = 911;
  40551. t.a16 = 933;
  40552. t.a105 = 911;
  40553. t.a17 = 945;
  40554. t.a18 = 974;
  40555. t.a19 = 755;
  40556. t.a20 = 846;
  40557. t.a21 = 762;
  40558. t.a22 = 761;
  40559. t.a23 = 571;
  40560. t.a24 = 677;
  40561. t.a25 = 763;
  40562. t.a26 = 760;
  40563. t.a27 = 759;
  40564. t.a28 = 754;
  40565. t.a6 = 494;
  40566. t.a7 = 552;
  40567. t.a8 = 537;
  40568. t.a9 = 577;
  40569. t.a10 = 692;
  40570. t.a29 = 786;
  40571. t.a30 = 788;
  40572. t.a31 = 788;
  40573. t.a32 = 790;
  40574. t.a33 = 793;
  40575. t.a34 = 794;
  40576. t.a35 = 816;
  40577. t.a36 = 823;
  40578. t.a37 = 789;
  40579. t.a38 = 841;
  40580. t.a39 = 823;
  40581. t.a40 = 833;
  40582. t.a41 = 816;
  40583. t.a42 = 831;
  40584. t.a43 = 923;
  40585. t.a44 = 744;
  40586. t.a45 = 723;
  40587. t.a46 = 749;
  40588. t.a47 = 790;
  40589. t.a48 = 792;
  40590. t.a49 = 695;
  40591. t.a50 = 776;
  40592. t.a51 = 768;
  40593. t.a52 = 792;
  40594. t.a53 = 759;
  40595. t.a54 = 707;
  40596. t.a55 = 708;
  40597. t.a56 = 682;
  40598. t.a57 = 701;
  40599. t.a58 = 826;
  40600. t.a59 = 815;
  40601. t.a60 = 789;
  40602. t.a61 = 789;
  40603. t.a62 = 707;
  40604. t.a63 = 687;
  40605. t.a64 = 696;
  40606. t.a65 = 689;
  40607. t.a66 = 786;
  40608. t.a67 = 787;
  40609. t.a68 = 713;
  40610. t.a69 = 791;
  40611. t.a70 = 785;
  40612. t.a71 = 791;
  40613. t.a72 = 873;
  40614. t.a73 = 761;
  40615. t.a74 = 762;
  40616. t.a203 = 762;
  40617. t.a75 = 759;
  40618. t.a204 = 759;
  40619. t.a76 = 892;
  40620. t.a77 = 892;
  40621. t.a78 = 788;
  40622. t.a79 = 784;
  40623. t.a81 = 438;
  40624. t.a82 = 138;
  40625. t.a83 = 277;
  40626. t.a84 = 415;
  40627. t.a97 = 392;
  40628. t.a98 = 392;
  40629. t.a99 = 668;
  40630. t.a100 = 668;
  40631. t.a89 = 390;
  40632. t.a90 = 390;
  40633. t.a93 = 317;
  40634. t.a94 = 317;
  40635. t.a91 = 276;
  40636. t.a92 = 276;
  40637. t.a205 = 509;
  40638. t.a85 = 509;
  40639. t.a206 = 410;
  40640. t.a86 = 410;
  40641. t.a87 = 234;
  40642. t.a88 = 234;
  40643. t.a95 = 334;
  40644. t.a96 = 334;
  40645. t.a101 = 732;
  40646. t.a102 = 544;
  40647. t.a103 = 544;
  40648. t.a104 = 910;
  40649. t.a106 = 667;
  40650. t.a107 = 760;
  40651. t.a108 = 760;
  40652. t.a112 = 776;
  40653. t.a111 = 595;
  40654. t.a110 = 694;
  40655. t.a109 = 626;
  40656. t.a120 = 788;
  40657. t.a121 = 788;
  40658. t.a122 = 788;
  40659. t.a123 = 788;
  40660. t.a124 = 788;
  40661. t.a125 = 788;
  40662. t.a126 = 788;
  40663. t.a127 = 788;
  40664. t.a128 = 788;
  40665. t.a129 = 788;
  40666. t.a130 = 788;
  40667. t.a131 = 788;
  40668. t.a132 = 788;
  40669. t.a133 = 788;
  40670. t.a134 = 788;
  40671. t.a135 = 788;
  40672. t.a136 = 788;
  40673. t.a137 = 788;
  40674. t.a138 = 788;
  40675. t.a139 = 788;
  40676. t.a140 = 788;
  40677. t.a141 = 788;
  40678. t.a142 = 788;
  40679. t.a143 = 788;
  40680. t.a144 = 788;
  40681. t.a145 = 788;
  40682. t.a146 = 788;
  40683. t.a147 = 788;
  40684. t.a148 = 788;
  40685. t.a149 = 788;
  40686. t.a150 = 788;
  40687. t.a151 = 788;
  40688. t.a152 = 788;
  40689. t.a153 = 788;
  40690. t.a154 = 788;
  40691. t.a155 = 788;
  40692. t.a156 = 788;
  40693. t.a157 = 788;
  40694. t.a158 = 788;
  40695. t.a159 = 788;
  40696. t.a160 = 894;
  40697. t.a161 = 838;
  40698. t.a163 = 1016;
  40699. t.a164 = 458;
  40700. t.a196 = 748;
  40701. t.a165 = 924;
  40702. t.a192 = 748;
  40703. t.a166 = 918;
  40704. t.a167 = 927;
  40705. t.a168 = 928;
  40706. t.a169 = 928;
  40707. t.a170 = 834;
  40708. t.a171 = 873;
  40709. t.a172 = 828;
  40710. t.a173 = 924;
  40711. t.a162 = 924;
  40712. t.a174 = 917;
  40713. t.a175 = 930;
  40714. t.a176 = 931;
  40715. t.a177 = 463;
  40716. t.a178 = 883;
  40717. t.a179 = 836;
  40718. t.a193 = 836;
  40719. t.a180 = 867;
  40720. t.a199 = 867;
  40721. t.a181 = 696;
  40722. t.a200 = 696;
  40723. t.a182 = 874;
  40724. t.a201 = 874;
  40725. t.a183 = 760;
  40726. t.a184 = 946;
  40727. t.a197 = 771;
  40728. t.a185 = 865;
  40729. t.a194 = 771;
  40730. t.a198 = 888;
  40731. t.a186 = 967;
  40732. t.a195 = 888;
  40733. t.a187 = 831;
  40734. t.a188 = 873;
  40735. t.a189 = 927;
  40736. t.a190 = 970;
  40737. t.a191 = 918;
  40738. });
  40739. });
  40740. exports.getMetrics = getMetrics;
  40741. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  40742. t.Courier = {
  40743. ascent: 629,
  40744. descent: -157,
  40745. capHeight: 562,
  40746. xHeight: -426
  40747. };
  40748. t["Courier-Bold"] = {
  40749. ascent: 629,
  40750. descent: -157,
  40751. capHeight: 562,
  40752. xHeight: 439
  40753. };
  40754. t["Courier-Oblique"] = {
  40755. ascent: 629,
  40756. descent: -157,
  40757. capHeight: 562,
  40758. xHeight: 426
  40759. };
  40760. t["Courier-BoldOblique"] = {
  40761. ascent: 629,
  40762. descent: -157,
  40763. capHeight: 562,
  40764. xHeight: 426
  40765. };
  40766. t.Helvetica = {
  40767. ascent: 718,
  40768. descent: -207,
  40769. capHeight: 718,
  40770. xHeight: 523
  40771. };
  40772. t["Helvetica-Bold"] = {
  40773. ascent: 718,
  40774. descent: -207,
  40775. capHeight: 718,
  40776. xHeight: 532
  40777. };
  40778. t["Helvetica-Oblique"] = {
  40779. ascent: 718,
  40780. descent: -207,
  40781. capHeight: 718,
  40782. xHeight: 523
  40783. };
  40784. t["Helvetica-BoldOblique"] = {
  40785. ascent: 718,
  40786. descent: -207,
  40787. capHeight: 718,
  40788. xHeight: 532
  40789. };
  40790. t["Times-Roman"] = {
  40791. ascent: 683,
  40792. descent: -217,
  40793. capHeight: 662,
  40794. xHeight: 450
  40795. };
  40796. t["Times-Bold"] = {
  40797. ascent: 683,
  40798. descent: -217,
  40799. capHeight: 676,
  40800. xHeight: 461
  40801. };
  40802. t["Times-Italic"] = {
  40803. ascent: 683,
  40804. descent: -217,
  40805. capHeight: 653,
  40806. xHeight: 441
  40807. };
  40808. t["Times-BoldItalic"] = {
  40809. ascent: 683,
  40810. descent: -217,
  40811. capHeight: 669,
  40812. xHeight: 462
  40813. };
  40814. t.Symbol = {
  40815. ascent: Math.NaN,
  40816. descent: Math.NaN,
  40817. capHeight: Math.NaN,
  40818. xHeight: Math.NaN
  40819. };
  40820. t.ZapfDingbats = {
  40821. ascent: Math.NaN,
  40822. descent: Math.NaN,
  40823. capHeight: Math.NaN,
  40824. xHeight: Math.NaN
  40825. };
  40826. });
  40827. exports.getFontBasicMetrics = getFontBasicMetrics;
  40828. /***/ }),
  40829. /* 52 */
  40830. /***/ ((__unused_webpack_module, exports) => {
  40831. Object.defineProperty(exports, "__esModule", ({
  40832. value: true
  40833. }));
  40834. exports.GlyfTable = void 0;
  40835. const ON_CURVE_POINT = 1 << 0;
  40836. const X_SHORT_VECTOR = 1 << 1;
  40837. const Y_SHORT_VECTOR = 1 << 2;
  40838. const REPEAT_FLAG = 1 << 3;
  40839. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  40840. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  40841. const OVERLAP_SIMPLE = 1 << 6;
  40842. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  40843. const ARGS_ARE_XY_VALUES = 1 << 1;
  40844. const WE_HAVE_A_SCALE = 1 << 3;
  40845. const MORE_COMPONENTS = 1 << 5;
  40846. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  40847. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  40848. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  40849. class GlyfTable {
  40850. constructor({
  40851. glyfTable,
  40852. isGlyphLocationsLong,
  40853. locaTable,
  40854. numGlyphs
  40855. }) {
  40856. this.glyphs = [];
  40857. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  40858. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  40859. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  40860. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  40861. let pos = 0;
  40862. for (let i = 0; i < numGlyphs; i++) {
  40863. pos += offsetSize;
  40864. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  40865. if (next === prev) {
  40866. this.glyphs.push(new Glyph({}));
  40867. continue;
  40868. }
  40869. const glyph = Glyph.parse(prev, glyf);
  40870. this.glyphs.push(glyph);
  40871. prev = next;
  40872. }
  40873. }
  40874. getSize() {
  40875. return this.glyphs.reduce((a, g) => {
  40876. const size = g.getSize();
  40877. return a + (size + 3 & ~3);
  40878. }, 0);
  40879. }
  40880. write() {
  40881. const totalSize = this.getSize();
  40882. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  40883. const isLocationLong = totalSize > 0x1fffe;
  40884. const offsetSize = isLocationLong ? 4 : 2;
  40885. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  40886. if (isLocationLong) {
  40887. locaTable.setUint32(0, 0);
  40888. } else {
  40889. locaTable.setUint16(0, 0);
  40890. }
  40891. let pos = 0;
  40892. let locaIndex = 0;
  40893. for (const glyph of this.glyphs) {
  40894. pos += glyph.write(pos, glyfTable);
  40895. pos = pos + 3 & ~3;
  40896. locaIndex += offsetSize;
  40897. if (isLocationLong) {
  40898. locaTable.setUint32(locaIndex, pos);
  40899. } else {
  40900. locaTable.setUint16(locaIndex, pos >> 1);
  40901. }
  40902. }
  40903. return {
  40904. isLocationLong,
  40905. loca: new Uint8Array(locaTable.buffer),
  40906. glyf: new Uint8Array(glyfTable.buffer)
  40907. };
  40908. }
  40909. scale(factors) {
  40910. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  40911. this.glyphs[i].scale(factors[i]);
  40912. }
  40913. }
  40914. }
  40915. exports.GlyfTable = GlyfTable;
  40916. class Glyph {
  40917. constructor({
  40918. header = null,
  40919. simple = null,
  40920. composites = null
  40921. }) {
  40922. this.header = header;
  40923. this.simple = simple;
  40924. this.composites = composites;
  40925. }
  40926. static parse(pos, glyf) {
  40927. const [read, header] = GlyphHeader.parse(pos, glyf);
  40928. pos += read;
  40929. if (header.numberOfContours < 0) {
  40930. const composites = [];
  40931. while (true) {
  40932. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  40933. pos += n;
  40934. composites.push(composite);
  40935. if (!(composite.flags & MORE_COMPONENTS)) {
  40936. break;
  40937. }
  40938. }
  40939. return new Glyph({
  40940. header,
  40941. composites
  40942. });
  40943. }
  40944. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  40945. return new Glyph({
  40946. header,
  40947. simple
  40948. });
  40949. }
  40950. getSize() {
  40951. if (!this.header) {
  40952. return 0;
  40953. }
  40954. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  40955. return this.header.getSize() + size;
  40956. }
  40957. write(pos, buf) {
  40958. if (!this.header) {
  40959. return 0;
  40960. }
  40961. const spos = pos;
  40962. pos += this.header.write(pos, buf);
  40963. if (this.simple) {
  40964. pos += this.simple.write(pos, buf);
  40965. } else {
  40966. for (const composite of this.composites) {
  40967. pos += composite.write(pos, buf);
  40968. }
  40969. }
  40970. return pos - spos;
  40971. }
  40972. scale(factor) {
  40973. if (!this.header) {
  40974. return;
  40975. }
  40976. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  40977. this.header.scale(xMiddle, factor);
  40978. if (this.simple) {
  40979. this.simple.scale(xMiddle, factor);
  40980. } else {
  40981. for (const composite of this.composites) {
  40982. composite.scale(xMiddle, factor);
  40983. }
  40984. }
  40985. }
  40986. }
  40987. class GlyphHeader {
  40988. constructor({
  40989. numberOfContours,
  40990. xMin,
  40991. yMin,
  40992. xMax,
  40993. yMax
  40994. }) {
  40995. this.numberOfContours = numberOfContours;
  40996. this.xMin = xMin;
  40997. this.yMin = yMin;
  40998. this.xMax = xMax;
  40999. this.yMax = yMax;
  41000. }
  41001. static parse(pos, glyf) {
  41002. return [10, new GlyphHeader({
  41003. numberOfContours: glyf.getInt16(pos),
  41004. xMin: glyf.getInt16(pos + 2),
  41005. yMin: glyf.getInt16(pos + 4),
  41006. xMax: glyf.getInt16(pos + 6),
  41007. yMax: glyf.getInt16(pos + 8)
  41008. })];
  41009. }
  41010. getSize() {
  41011. return 10;
  41012. }
  41013. write(pos, buf) {
  41014. buf.setInt16(pos, this.numberOfContours);
  41015. buf.setInt16(pos + 2, this.xMin);
  41016. buf.setInt16(pos + 4, this.yMin);
  41017. buf.setInt16(pos + 6, this.xMax);
  41018. buf.setInt16(pos + 8, this.yMax);
  41019. return 10;
  41020. }
  41021. scale(x, factor) {
  41022. this.xMin = Math.round(x + (this.xMin - x) * factor);
  41023. this.xMax = Math.round(x + (this.xMax - x) * factor);
  41024. }
  41025. }
  41026. class Contour {
  41027. constructor({
  41028. flags,
  41029. xCoordinates,
  41030. yCoordinates
  41031. }) {
  41032. this.xCoordinates = xCoordinates;
  41033. this.yCoordinates = yCoordinates;
  41034. this.flags = flags;
  41035. }
  41036. }
  41037. class SimpleGlyph {
  41038. constructor({
  41039. contours,
  41040. instructions
  41041. }) {
  41042. this.contours = contours;
  41043. this.instructions = instructions;
  41044. }
  41045. static parse(pos, glyf, numberOfContours) {
  41046. const endPtsOfContours = [];
  41047. for (let i = 0; i < numberOfContours; i++) {
  41048. const endPt = glyf.getUint16(pos);
  41049. pos += 2;
  41050. endPtsOfContours.push(endPt);
  41051. }
  41052. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  41053. const instructionLength = glyf.getUint16(pos);
  41054. pos += 2;
  41055. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41056. pos += instructionLength;
  41057. const flags = [];
  41058. for (let i = 0; i < numberOfPt; pos++, i++) {
  41059. let flag = glyf.getUint8(pos);
  41060. flags.push(flag);
  41061. if (flag & REPEAT_FLAG) {
  41062. const count = glyf.getUint8(++pos);
  41063. flag ^= REPEAT_FLAG;
  41064. for (let m = 0; m < count; m++) {
  41065. flags.push(flag);
  41066. }
  41067. i += count;
  41068. }
  41069. }
  41070. const allXCoordinates = [];
  41071. let xCoordinates = [];
  41072. let yCoordinates = [];
  41073. let pointFlags = [];
  41074. const contours = [];
  41075. let endPtsOfContoursIndex = 0;
  41076. let lastCoordinate = 0;
  41077. for (let i = 0; i < numberOfPt; i++) {
  41078. const flag = flags[i];
  41079. if (flag & X_SHORT_VECTOR) {
  41080. const x = glyf.getUint8(pos++);
  41081. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  41082. xCoordinates.push(lastCoordinate);
  41083. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  41084. xCoordinates.push(lastCoordinate);
  41085. } else {
  41086. lastCoordinate += glyf.getInt16(pos);
  41087. pos += 2;
  41088. xCoordinates.push(lastCoordinate);
  41089. }
  41090. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41091. endPtsOfContoursIndex++;
  41092. allXCoordinates.push(xCoordinates);
  41093. xCoordinates = [];
  41094. }
  41095. }
  41096. lastCoordinate = 0;
  41097. endPtsOfContoursIndex = 0;
  41098. for (let i = 0; i < numberOfPt; i++) {
  41099. const flag = flags[i];
  41100. if (flag & Y_SHORT_VECTOR) {
  41101. const y = glyf.getUint8(pos++);
  41102. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  41103. yCoordinates.push(lastCoordinate);
  41104. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  41105. yCoordinates.push(lastCoordinate);
  41106. } else {
  41107. lastCoordinate += glyf.getInt16(pos);
  41108. pos += 2;
  41109. yCoordinates.push(lastCoordinate);
  41110. }
  41111. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  41112. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41113. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  41114. endPtsOfContoursIndex++;
  41115. contours.push(new Contour({
  41116. flags: pointFlags,
  41117. xCoordinates,
  41118. yCoordinates
  41119. }));
  41120. yCoordinates = [];
  41121. pointFlags = [];
  41122. }
  41123. }
  41124. return new SimpleGlyph({
  41125. contours,
  41126. instructions
  41127. });
  41128. }
  41129. getSize() {
  41130. let size = this.contours.length * 2 + 2 + this.instructions.length;
  41131. let lastX = 0;
  41132. let lastY = 0;
  41133. for (const contour of this.contours) {
  41134. size += contour.flags.length;
  41135. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41136. const x = contour.xCoordinates[i];
  41137. const y = contour.yCoordinates[i];
  41138. let abs = Math.abs(x - lastX);
  41139. if (abs > 255) {
  41140. size += 2;
  41141. } else if (abs > 0) {
  41142. size += 1;
  41143. }
  41144. lastX = x;
  41145. abs = Math.abs(y - lastY);
  41146. if (abs > 255) {
  41147. size += 2;
  41148. } else if (abs > 0) {
  41149. size += 1;
  41150. }
  41151. lastY = y;
  41152. }
  41153. }
  41154. return size;
  41155. }
  41156. write(pos, buf) {
  41157. const spos = pos;
  41158. const xCoordinates = [];
  41159. const yCoordinates = [];
  41160. const flags = [];
  41161. let lastX = 0;
  41162. let lastY = 0;
  41163. for (const contour of this.contours) {
  41164. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41165. let flag = contour.flags[i];
  41166. const x = contour.xCoordinates[i];
  41167. let delta = x - lastX;
  41168. if (delta === 0) {
  41169. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  41170. xCoordinates.push(0);
  41171. } else {
  41172. const abs = Math.abs(delta);
  41173. if (abs <= 255) {
  41174. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  41175. xCoordinates.push(abs);
  41176. } else {
  41177. xCoordinates.push(delta);
  41178. }
  41179. }
  41180. lastX = x;
  41181. const y = contour.yCoordinates[i];
  41182. delta = y - lastY;
  41183. if (delta === 0) {
  41184. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  41185. yCoordinates.push(0);
  41186. } else {
  41187. const abs = Math.abs(delta);
  41188. if (abs <= 255) {
  41189. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  41190. yCoordinates.push(abs);
  41191. } else {
  41192. yCoordinates.push(delta);
  41193. }
  41194. }
  41195. lastY = y;
  41196. flags.push(flag);
  41197. }
  41198. buf.setUint16(pos, xCoordinates.length - 1);
  41199. pos += 2;
  41200. }
  41201. buf.setUint16(pos, this.instructions.length);
  41202. pos += 2;
  41203. if (this.instructions.length) {
  41204. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41205. pos += this.instructions.length;
  41206. }
  41207. for (const flag of flags) {
  41208. buf.setUint8(pos++, flag);
  41209. }
  41210. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  41211. const x = xCoordinates[i];
  41212. const flag = flags[i];
  41213. if (flag & X_SHORT_VECTOR) {
  41214. buf.setUint8(pos++, x);
  41215. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  41216. buf.setInt16(pos, x);
  41217. pos += 2;
  41218. }
  41219. }
  41220. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  41221. const y = yCoordinates[i];
  41222. const flag = flags[i];
  41223. if (flag & Y_SHORT_VECTOR) {
  41224. buf.setUint8(pos++, y);
  41225. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  41226. buf.setInt16(pos, y);
  41227. pos += 2;
  41228. }
  41229. }
  41230. return pos - spos;
  41231. }
  41232. scale(x, factor) {
  41233. for (const contour of this.contours) {
  41234. if (contour.xCoordinates.length === 0) {
  41235. continue;
  41236. }
  41237. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41238. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  41239. }
  41240. }
  41241. }
  41242. }
  41243. class CompositeGlyph {
  41244. constructor({
  41245. flags,
  41246. glyphIndex,
  41247. argument1,
  41248. argument2,
  41249. transf,
  41250. instructions
  41251. }) {
  41252. this.flags = flags;
  41253. this.glyphIndex = glyphIndex;
  41254. this.argument1 = argument1;
  41255. this.argument2 = argument2;
  41256. this.transf = transf;
  41257. this.instructions = instructions;
  41258. }
  41259. static parse(pos, glyf) {
  41260. const spos = pos;
  41261. const transf = [];
  41262. let flags = glyf.getUint16(pos);
  41263. const glyphIndex = glyf.getUint16(pos + 2);
  41264. pos += 4;
  41265. let argument1, argument2;
  41266. if (flags & ARG_1_AND_2_ARE_WORDS) {
  41267. if (flags & ARGS_ARE_XY_VALUES) {
  41268. argument1 = glyf.getInt16(pos);
  41269. argument2 = glyf.getInt16(pos + 2);
  41270. } else {
  41271. argument1 = glyf.getUint16(pos);
  41272. argument2 = glyf.getUint16(pos + 2);
  41273. }
  41274. pos += 4;
  41275. flags ^= ARG_1_AND_2_ARE_WORDS;
  41276. } else {
  41277. if (flags & ARGS_ARE_XY_VALUES) {
  41278. argument1 = glyf.getInt8(pos);
  41279. argument2 = glyf.getInt8(pos + 1);
  41280. } else {
  41281. argument1 = glyf.getUint8(pos);
  41282. argument2 = glyf.getUint8(pos + 1);
  41283. }
  41284. pos += 2;
  41285. }
  41286. if (flags & WE_HAVE_A_SCALE) {
  41287. transf.push(glyf.getUint16(pos));
  41288. pos += 2;
  41289. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  41290. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  41291. pos += 4;
  41292. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  41293. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  41294. pos += 8;
  41295. }
  41296. let instructions = null;
  41297. if (flags & WE_HAVE_INSTRUCTIONS) {
  41298. const instructionLength = glyf.getUint16(pos);
  41299. pos += 2;
  41300. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41301. pos += instructionLength;
  41302. }
  41303. return [pos - spos, new CompositeGlyph({
  41304. flags,
  41305. glyphIndex,
  41306. argument1,
  41307. argument2,
  41308. transf,
  41309. instructions
  41310. })];
  41311. }
  41312. getSize() {
  41313. let size = 2 + 2 + this.transf.length * 2;
  41314. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41315. size += 2 + this.instructions.length;
  41316. }
  41317. size += 2;
  41318. if (this.flags & 2) {
  41319. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41320. size += 2;
  41321. }
  41322. } else {
  41323. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  41324. size += 2;
  41325. }
  41326. }
  41327. return size;
  41328. }
  41329. write(pos, buf) {
  41330. const spos = pos;
  41331. if (this.flags & ARGS_ARE_XY_VALUES) {
  41332. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41333. this.flags |= ARG_1_AND_2_ARE_WORDS;
  41334. }
  41335. } else {
  41336. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  41337. this.flags |= ARG_1_AND_2_ARE_WORDS;
  41338. }
  41339. }
  41340. buf.setUint16(pos, this.flags);
  41341. buf.setUint16(pos + 2, this.glyphIndex);
  41342. pos += 4;
  41343. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  41344. if (this.flags & ARGS_ARE_XY_VALUES) {
  41345. buf.setInt16(pos, this.argument1);
  41346. buf.setInt16(pos + 2, this.argument2);
  41347. } else {
  41348. buf.setUint16(pos, this.argument1);
  41349. buf.setUint16(pos + 2, this.argument2);
  41350. }
  41351. pos += 4;
  41352. } else {
  41353. buf.setUint8(pos, this.argument1);
  41354. buf.setUint8(pos + 1, this.argument2);
  41355. pos += 2;
  41356. }
  41357. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41358. buf.setUint16(pos, this.instructions.length);
  41359. pos += 2;
  41360. if (this.instructions.length) {
  41361. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41362. pos += this.instructions.length;
  41363. }
  41364. }
  41365. return pos - spos;
  41366. }
  41367. scale(x, factor) {}
  41368. }
  41369. /***/ }),
  41370. /* 53 */
  41371. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41372. Object.defineProperty(exports, "__esModule", ({
  41373. value: true
  41374. }));
  41375. exports.OpenTypeFileBuilder = void 0;
  41376. var _core_utils = __w_pdfjs_require__(8);
  41377. var _util = __w_pdfjs_require__(2);
  41378. function writeInt16(dest, offset, num) {
  41379. dest[offset] = num >> 8 & 0xff;
  41380. dest[offset + 1] = num & 0xff;
  41381. }
  41382. function writeInt32(dest, offset, num) {
  41383. dest[offset] = num >> 24 & 0xff;
  41384. dest[offset + 1] = num >> 16 & 0xff;
  41385. dest[offset + 2] = num >> 8 & 0xff;
  41386. dest[offset + 3] = num & 0xff;
  41387. }
  41388. function writeData(dest, offset, data) {
  41389. if (data instanceof Uint8Array) {
  41390. dest.set(data, offset);
  41391. } else if (typeof data === "string") {
  41392. for (let i = 0, ii = data.length; i < ii; i++) {
  41393. dest[offset++] = data.charCodeAt(i) & 0xff;
  41394. }
  41395. } else {
  41396. for (let i = 0, ii = data.length; i < ii; i++) {
  41397. dest[offset++] = data[i] & 0xff;
  41398. }
  41399. }
  41400. }
  41401. const OTF_HEADER_SIZE = 12;
  41402. const OTF_TABLE_ENTRY_SIZE = 16;
  41403. class OpenTypeFileBuilder {
  41404. constructor(sfnt) {
  41405. this.sfnt = sfnt;
  41406. this.tables = Object.create(null);
  41407. }
  41408. static getSearchParams(entriesCount, entrySize) {
  41409. let maxPower2 = 1,
  41410. log2 = 0;
  41411. while ((maxPower2 ^ entriesCount) > maxPower2) {
  41412. maxPower2 <<= 1;
  41413. log2++;
  41414. }
  41415. const searchRange = maxPower2 * entrySize;
  41416. return {
  41417. range: searchRange,
  41418. entry: log2,
  41419. rangeShift: entrySize * entriesCount - searchRange
  41420. };
  41421. }
  41422. toArray() {
  41423. let sfnt = this.sfnt;
  41424. const tables = this.tables;
  41425. const tablesNames = Object.keys(tables);
  41426. tablesNames.sort();
  41427. const numTables = tablesNames.length;
  41428. let i, j, jj, table, tableName;
  41429. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  41430. const tableOffsets = [offset];
  41431. for (i = 0; i < numTables; i++) {
  41432. table = tables[tablesNames[i]];
  41433. const paddedLength = (table.length + 3 & ~3) >>> 0;
  41434. offset += paddedLength;
  41435. tableOffsets.push(offset);
  41436. }
  41437. const file = new Uint8Array(offset);
  41438. for (i = 0; i < numTables; i++) {
  41439. table = tables[tablesNames[i]];
  41440. writeData(file, tableOffsets[i], table);
  41441. }
  41442. if (sfnt === "true") {
  41443. sfnt = (0, _util.string32)(0x00010000);
  41444. }
  41445. file[0] = sfnt.charCodeAt(0) & 0xff;
  41446. file[1] = sfnt.charCodeAt(1) & 0xff;
  41447. file[2] = sfnt.charCodeAt(2) & 0xff;
  41448. file[3] = sfnt.charCodeAt(3) & 0xff;
  41449. writeInt16(file, 4, numTables);
  41450. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  41451. writeInt16(file, 6, searchParams.range);
  41452. writeInt16(file, 8, searchParams.entry);
  41453. writeInt16(file, 10, searchParams.rangeShift);
  41454. offset = OTF_HEADER_SIZE;
  41455. for (i = 0; i < numTables; i++) {
  41456. tableName = tablesNames[i];
  41457. file[offset] = tableName.charCodeAt(0) & 0xff;
  41458. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  41459. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  41460. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  41461. let checksum = 0;
  41462. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  41463. const quad = (0, _core_utils.readUint32)(file, j);
  41464. checksum = checksum + quad >>> 0;
  41465. }
  41466. writeInt32(file, offset + 4, checksum);
  41467. writeInt32(file, offset + 8, tableOffsets[i]);
  41468. writeInt32(file, offset + 12, tables[tableName].length);
  41469. offset += OTF_TABLE_ENTRY_SIZE;
  41470. }
  41471. return file;
  41472. }
  41473. addTable(tag, data) {
  41474. if (tag in this.tables) {
  41475. throw new Error("Table " + tag + " already exists");
  41476. }
  41477. this.tables[tag] = data;
  41478. }
  41479. }
  41480. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  41481. /***/ }),
  41482. /* 54 */
  41483. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41484. Object.defineProperty(exports, "__esModule", ({
  41485. value: true
  41486. }));
  41487. exports.Type1Font = void 0;
  41488. var _cff_parser = __w_pdfjs_require__(45);
  41489. var _fonts_utils = __w_pdfjs_require__(18);
  41490. var _core_utils = __w_pdfjs_require__(8);
  41491. var _stream = __w_pdfjs_require__(10);
  41492. var _type1_parser = __w_pdfjs_require__(55);
  41493. var _util = __w_pdfjs_require__(2);
  41494. function findBlock(streamBytes, signature, startIndex) {
  41495. const streamBytesLength = streamBytes.length;
  41496. const signatureLength = signature.length;
  41497. const scanLength = streamBytesLength - signatureLength;
  41498. let i = startIndex,
  41499. found = false;
  41500. while (i < scanLength) {
  41501. let j = 0;
  41502. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41503. j++;
  41504. }
  41505. if (j >= signatureLength) {
  41506. i += j;
  41507. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  41508. i++;
  41509. }
  41510. found = true;
  41511. break;
  41512. }
  41513. i++;
  41514. }
  41515. return {
  41516. found,
  41517. length: i
  41518. };
  41519. }
  41520. function getHeaderBlock(stream, suggestedLength) {
  41521. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  41522. const streamStartPos = stream.pos;
  41523. let headerBytes, headerBytesLength, block;
  41524. try {
  41525. headerBytes = stream.getBytes(suggestedLength);
  41526. headerBytesLength = headerBytes.length;
  41527. } catch (ex) {}
  41528. if (headerBytesLength === suggestedLength) {
  41529. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41530. if (block.found && block.length === suggestedLength) {
  41531. return {
  41532. stream: new _stream.Stream(headerBytes),
  41533. length: suggestedLength
  41534. };
  41535. }
  41536. }
  41537. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  41538. stream.pos = streamStartPos;
  41539. const SCAN_BLOCK_LENGTH = 2048;
  41540. let actualLength;
  41541. while (true) {
  41542. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41543. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41544. if (block.length === 0) {
  41545. break;
  41546. }
  41547. stream.pos += block.length;
  41548. if (block.found) {
  41549. actualLength = stream.pos - streamStartPos;
  41550. break;
  41551. }
  41552. }
  41553. stream.pos = streamStartPos;
  41554. if (actualLength) {
  41555. return {
  41556. stream: new _stream.Stream(stream.getBytes(actualLength)),
  41557. length: actualLength
  41558. };
  41559. }
  41560. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  41561. return {
  41562. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  41563. length: suggestedLength
  41564. };
  41565. }
  41566. function getEexecBlock(stream, suggestedLength) {
  41567. const eexecBytes = stream.getBytes();
  41568. return {
  41569. stream: new _stream.Stream(eexecBytes),
  41570. length: eexecBytes.length
  41571. };
  41572. }
  41573. class Type1Font {
  41574. constructor(name, file, properties) {
  41575. const PFB_HEADER_SIZE = 6;
  41576. let headerBlockLength = properties.length1;
  41577. let eexecBlockLength = properties.length2;
  41578. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41579. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41580. if (pfbHeaderPresent) {
  41581. file.skip(PFB_HEADER_SIZE);
  41582. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41583. }
  41584. const headerBlock = getHeaderBlock(file, headerBlockLength);
  41585. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41586. headerBlockParser.extractFontHeader(properties);
  41587. if (pfbHeaderPresent) {
  41588. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41589. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41590. }
  41591. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  41592. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41593. const data = eexecBlockParser.extractFontProgram(properties);
  41594. for (const key in data.properties) {
  41595. properties[key] = data.properties[key];
  41596. }
  41597. const charstrings = data.charstrings;
  41598. const type2Charstrings = this.getType2Charstrings(charstrings);
  41599. const subrs = this.getType2Subrs(data.subrs);
  41600. this.charstrings = charstrings;
  41601. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41602. this.seacs = this.getSeacs(data.charstrings);
  41603. }
  41604. get numGlyphs() {
  41605. return this.charstrings.length + 1;
  41606. }
  41607. getCharset() {
  41608. const charset = [".notdef"];
  41609. const charstrings = this.charstrings;
  41610. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41611. charset.push(charstrings[glyphId].glyphName);
  41612. }
  41613. return charset;
  41614. }
  41615. getGlyphMapping(properties) {
  41616. const charstrings = this.charstrings;
  41617. if (properties.composite) {
  41618. const charCodeToGlyphId = Object.create(null);
  41619. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  41620. const charCode = properties.cMap.charCodeOf(glyphId);
  41621. charCodeToGlyphId[charCode] = glyphId + 1;
  41622. }
  41623. return charCodeToGlyphId;
  41624. }
  41625. const glyphNames = [".notdef"];
  41626. let builtInEncoding, glyphId;
  41627. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41628. glyphNames.push(charstrings[glyphId].glyphName);
  41629. }
  41630. const encoding = properties.builtInEncoding;
  41631. if (encoding) {
  41632. builtInEncoding = Object.create(null);
  41633. for (const charCode in encoding) {
  41634. glyphId = glyphNames.indexOf(encoding[charCode]);
  41635. if (glyphId >= 0) {
  41636. builtInEncoding[charCode] = glyphId;
  41637. }
  41638. }
  41639. }
  41640. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  41641. }
  41642. hasGlyphId(id) {
  41643. if (id < 0 || id >= this.numGlyphs) {
  41644. return false;
  41645. }
  41646. if (id === 0) {
  41647. return true;
  41648. }
  41649. const glyph = this.charstrings[id - 1];
  41650. return glyph.charstring.length > 0;
  41651. }
  41652. getSeacs(charstrings) {
  41653. const seacMap = [];
  41654. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  41655. const charstring = charstrings[i];
  41656. if (charstring.seac) {
  41657. seacMap[i + 1] = charstring.seac;
  41658. }
  41659. }
  41660. return seacMap;
  41661. }
  41662. getType2Charstrings(type1Charstrings) {
  41663. const type2Charstrings = [];
  41664. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41665. type2Charstrings.push(type1Charstrings[i].charstring);
  41666. }
  41667. return type2Charstrings;
  41668. }
  41669. getType2Subrs(type1Subrs) {
  41670. let bias = 0;
  41671. const count = type1Subrs.length;
  41672. if (count < 1133) {
  41673. bias = 107;
  41674. } else if (count < 33769) {
  41675. bias = 1131;
  41676. } else {
  41677. bias = 32768;
  41678. }
  41679. const type2Subrs = [];
  41680. let i;
  41681. for (i = 0; i < bias; i++) {
  41682. type2Subrs.push([0x0b]);
  41683. }
  41684. for (i = 0; i < count; i++) {
  41685. type2Subrs.push(type1Subrs[i]);
  41686. }
  41687. return type2Subrs;
  41688. }
  41689. wrap(name, glyphs, charstrings, subrs, properties) {
  41690. const cff = new _cff_parser.CFF();
  41691. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  41692. cff.names = [name];
  41693. const topDict = new _cff_parser.CFFTopDict();
  41694. topDict.setByName("version", 391);
  41695. topDict.setByName("Notice", 392);
  41696. topDict.setByName("FullName", 393);
  41697. topDict.setByName("FamilyName", 394);
  41698. topDict.setByName("Weight", 395);
  41699. topDict.setByName("Encoding", null);
  41700. topDict.setByName("FontMatrix", properties.fontMatrix);
  41701. topDict.setByName("FontBBox", properties.bbox);
  41702. topDict.setByName("charset", null);
  41703. topDict.setByName("CharStrings", null);
  41704. topDict.setByName("Private", null);
  41705. cff.topDict = topDict;
  41706. const strings = new _cff_parser.CFFStrings();
  41707. strings.add("Version 0.11");
  41708. strings.add("See original notice");
  41709. strings.add(name);
  41710. strings.add(name);
  41711. strings.add("Medium");
  41712. cff.strings = strings;
  41713. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  41714. const count = glyphs.length;
  41715. const charsetArray = [".notdef"];
  41716. let i, ii;
  41717. for (i = 0; i < count; i++) {
  41718. const glyphName = charstrings[i].glyphName;
  41719. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  41720. if (index === -1) {
  41721. strings.add(glyphName);
  41722. }
  41723. charsetArray.push(glyphName);
  41724. }
  41725. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  41726. const charStringsIndex = new _cff_parser.CFFIndex();
  41727. charStringsIndex.add([0x8b, 0x0e]);
  41728. for (i = 0; i < count; i++) {
  41729. charStringsIndex.add(glyphs[i]);
  41730. }
  41731. cff.charStrings = charStringsIndex;
  41732. const privateDict = new _cff_parser.CFFPrivateDict();
  41733. privateDict.setByName("Subrs", null);
  41734. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  41735. for (i = 0, ii = fields.length; i < ii; i++) {
  41736. const field = fields[i];
  41737. if (!(field in properties.privateData)) {
  41738. continue;
  41739. }
  41740. const value = properties.privateData[field];
  41741. if (Array.isArray(value)) {
  41742. for (let j = value.length - 1; j > 0; j--) {
  41743. value[j] -= value[j - 1];
  41744. }
  41745. }
  41746. privateDict.setByName(field, value);
  41747. }
  41748. cff.topDict.privateDict = privateDict;
  41749. const subrIndex = new _cff_parser.CFFIndex();
  41750. for (i = 0, ii = subrs.length; i < ii; i++) {
  41751. subrIndex.add(subrs[i]);
  41752. }
  41753. privateDict.subrsIndex = subrIndex;
  41754. const compiler = new _cff_parser.CFFCompiler(cff);
  41755. return compiler.compile();
  41756. }
  41757. }
  41758. exports.Type1Font = Type1Font;
  41759. /***/ }),
  41760. /* 55 */
  41761. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41762. Object.defineProperty(exports, "__esModule", ({
  41763. value: true
  41764. }));
  41765. exports.Type1Parser = void 0;
  41766. var _encodings = __w_pdfjs_require__(19);
  41767. var _core_utils = __w_pdfjs_require__(8);
  41768. var _stream = __w_pdfjs_require__(10);
  41769. var _util = __w_pdfjs_require__(2);
  41770. const HINTING_ENABLED = false;
  41771. const Type1CharString = function Type1CharStringClosure() {
  41772. const COMMAND_MAP = {
  41773. hstem: [1],
  41774. vstem: [3],
  41775. vmoveto: [4],
  41776. rlineto: [5],
  41777. hlineto: [6],
  41778. vlineto: [7],
  41779. rrcurveto: [8],
  41780. callsubr: [10],
  41781. flex: [12, 35],
  41782. drop: [12, 18],
  41783. endchar: [14],
  41784. rmoveto: [21],
  41785. hmoveto: [22],
  41786. vhcurveto: [30],
  41787. hvcurveto: [31]
  41788. };
  41789. class Type1CharString {
  41790. constructor() {
  41791. this.width = 0;
  41792. this.lsb = 0;
  41793. this.flexing = false;
  41794. this.output = [];
  41795. this.stack = [];
  41796. }
  41797. convert(encoded, subrs, seacAnalysisEnabled) {
  41798. const count = encoded.length;
  41799. let error = false;
  41800. let wx, sbx, subrNumber;
  41801. for (let i = 0; i < count; i++) {
  41802. let value = encoded[i];
  41803. if (value < 32) {
  41804. if (value === 12) {
  41805. value = (value << 8) + encoded[++i];
  41806. }
  41807. switch (value) {
  41808. case 1:
  41809. if (!HINTING_ENABLED) {
  41810. this.stack = [];
  41811. break;
  41812. }
  41813. error = this.executeCommand(2, COMMAND_MAP.hstem);
  41814. break;
  41815. case 3:
  41816. if (!HINTING_ENABLED) {
  41817. this.stack = [];
  41818. break;
  41819. }
  41820. error = this.executeCommand(2, COMMAND_MAP.vstem);
  41821. break;
  41822. case 4:
  41823. if (this.flexing) {
  41824. if (this.stack.length < 1) {
  41825. error = true;
  41826. break;
  41827. }
  41828. const dy = this.stack.pop();
  41829. this.stack.push(0, dy);
  41830. break;
  41831. }
  41832. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  41833. break;
  41834. case 5:
  41835. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  41836. break;
  41837. case 6:
  41838. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  41839. break;
  41840. case 7:
  41841. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  41842. break;
  41843. case 8:
  41844. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  41845. break;
  41846. case 9:
  41847. this.stack = [];
  41848. break;
  41849. case 10:
  41850. if (this.stack.length < 1) {
  41851. error = true;
  41852. break;
  41853. }
  41854. subrNumber = this.stack.pop();
  41855. if (!subrs[subrNumber]) {
  41856. error = true;
  41857. break;
  41858. }
  41859. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  41860. break;
  41861. case 11:
  41862. return error;
  41863. case 13:
  41864. if (this.stack.length < 2) {
  41865. error = true;
  41866. break;
  41867. }
  41868. wx = this.stack.pop();
  41869. sbx = this.stack.pop();
  41870. this.lsb = sbx;
  41871. this.width = wx;
  41872. this.stack.push(wx, sbx);
  41873. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  41874. break;
  41875. case 14:
  41876. this.output.push(COMMAND_MAP.endchar[0]);
  41877. break;
  41878. case 21:
  41879. if (this.flexing) {
  41880. break;
  41881. }
  41882. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  41883. break;
  41884. case 22:
  41885. if (this.flexing) {
  41886. this.stack.push(0);
  41887. break;
  41888. }
  41889. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  41890. break;
  41891. case 30:
  41892. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  41893. break;
  41894. case 31:
  41895. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  41896. break;
  41897. case (12 << 8) + 0:
  41898. this.stack = [];
  41899. break;
  41900. case (12 << 8) + 1:
  41901. if (!HINTING_ENABLED) {
  41902. this.stack = [];
  41903. break;
  41904. }
  41905. error = this.executeCommand(2, COMMAND_MAP.vstem);
  41906. break;
  41907. case (12 << 8) + 2:
  41908. if (!HINTING_ENABLED) {
  41909. this.stack = [];
  41910. break;
  41911. }
  41912. error = this.executeCommand(2, COMMAND_MAP.hstem);
  41913. break;
  41914. case (12 << 8) + 6:
  41915. if (seacAnalysisEnabled) {
  41916. const asb = this.stack[this.stack.length - 5];
  41917. this.seac = this.stack.splice(-4, 4);
  41918. this.seac[0] += this.lsb - asb;
  41919. error = this.executeCommand(0, COMMAND_MAP.endchar);
  41920. } else {
  41921. error = this.executeCommand(4, COMMAND_MAP.endchar);
  41922. }
  41923. break;
  41924. case (12 << 8) + 7:
  41925. if (this.stack.length < 4) {
  41926. error = true;
  41927. break;
  41928. }
  41929. this.stack.pop();
  41930. wx = this.stack.pop();
  41931. const sby = this.stack.pop();
  41932. sbx = this.stack.pop();
  41933. this.lsb = sbx;
  41934. this.width = wx;
  41935. this.stack.push(wx, sbx, sby);
  41936. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  41937. break;
  41938. case (12 << 8) + 12:
  41939. if (this.stack.length < 2) {
  41940. error = true;
  41941. break;
  41942. }
  41943. const num2 = this.stack.pop();
  41944. const num1 = this.stack.pop();
  41945. this.stack.push(num1 / num2);
  41946. break;
  41947. case (12 << 8) + 16:
  41948. if (this.stack.length < 2) {
  41949. error = true;
  41950. break;
  41951. }
  41952. subrNumber = this.stack.pop();
  41953. const numArgs = this.stack.pop();
  41954. if (subrNumber === 0 && numArgs === 3) {
  41955. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  41956. 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]);
  41957. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  41958. this.flexing = false;
  41959. this.stack.push(flexArgs[15], flexArgs[16]);
  41960. } else if (subrNumber === 1 && numArgs === 0) {
  41961. this.flexing = true;
  41962. }
  41963. break;
  41964. case (12 << 8) + 17:
  41965. break;
  41966. case (12 << 8) + 33:
  41967. this.stack = [];
  41968. break;
  41969. default:
  41970. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  41971. break;
  41972. }
  41973. if (error) {
  41974. break;
  41975. }
  41976. continue;
  41977. } else if (value <= 246) {
  41978. value -= 139;
  41979. } else if (value <= 250) {
  41980. value = (value - 247) * 256 + encoded[++i] + 108;
  41981. } else if (value <= 254) {
  41982. value = -((value - 251) * 256) - encoded[++i] - 108;
  41983. } else {
  41984. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  41985. }
  41986. this.stack.push(value);
  41987. }
  41988. return error;
  41989. }
  41990. executeCommand(howManyArgs, command, keepStack) {
  41991. const stackLength = this.stack.length;
  41992. if (howManyArgs > stackLength) {
  41993. return true;
  41994. }
  41995. const start = stackLength - howManyArgs;
  41996. for (let i = start; i < stackLength; i++) {
  41997. let value = this.stack[i];
  41998. if (Number.isInteger(value)) {
  41999. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  42000. } else {
  42001. value = 65536 * value | 0;
  42002. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  42003. }
  42004. }
  42005. this.output.push.apply(this.output, command);
  42006. if (keepStack) {
  42007. this.stack.splice(start, howManyArgs);
  42008. } else {
  42009. this.stack.length = 0;
  42010. }
  42011. return false;
  42012. }
  42013. }
  42014. return Type1CharString;
  42015. }();
  42016. const Type1Parser = function Type1ParserClosure() {
  42017. const EEXEC_ENCRYPT_KEY = 55665;
  42018. const CHAR_STRS_ENCRYPT_KEY = 4330;
  42019. function isHexDigit(code) {
  42020. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  42021. }
  42022. function decrypt(data, key, discardNumber) {
  42023. if (discardNumber >= data.length) {
  42024. return new Uint8Array(0);
  42025. }
  42026. const c1 = 52845,
  42027. c2 = 22719;
  42028. let r = key | 0,
  42029. i,
  42030. j;
  42031. for (i = 0; i < discardNumber; i++) {
  42032. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  42033. }
  42034. const count = data.length - discardNumber;
  42035. const decrypted = new Uint8Array(count);
  42036. for (i = discardNumber, j = 0; j < count; i++, j++) {
  42037. const value = data[i];
  42038. decrypted[j] = value ^ r >> 8;
  42039. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42040. }
  42041. return decrypted;
  42042. }
  42043. function decryptAscii(data, key, discardNumber) {
  42044. const c1 = 52845,
  42045. c2 = 22719;
  42046. let r = key | 0;
  42047. const count = data.length,
  42048. maybeLength = count >>> 1;
  42049. const decrypted = new Uint8Array(maybeLength);
  42050. let i, j;
  42051. for (i = 0, j = 0; i < count; i++) {
  42052. const digit1 = data[i];
  42053. if (!isHexDigit(digit1)) {
  42054. continue;
  42055. }
  42056. i++;
  42057. let digit2;
  42058. while (i < count && !isHexDigit(digit2 = data[i])) {
  42059. i++;
  42060. }
  42061. if (i < count) {
  42062. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  42063. decrypted[j++] = value ^ r >> 8;
  42064. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42065. }
  42066. }
  42067. return decrypted.slice(discardNumber, j);
  42068. }
  42069. function isSpecial(c) {
  42070. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  42071. }
  42072. class Type1Parser {
  42073. constructor(stream, encrypted, seacAnalysisEnabled) {
  42074. if (encrypted) {
  42075. const data = stream.getBytes();
  42076. 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]));
  42077. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  42078. }
  42079. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  42080. this.stream = stream;
  42081. this.nextChar();
  42082. }
  42083. readNumberArray() {
  42084. this.getToken();
  42085. const array = [];
  42086. while (true) {
  42087. const token = this.getToken();
  42088. if (token === null || token === "]" || token === "}") {
  42089. break;
  42090. }
  42091. array.push(parseFloat(token || 0));
  42092. }
  42093. return array;
  42094. }
  42095. readNumber() {
  42096. const token = this.getToken();
  42097. return parseFloat(token || 0);
  42098. }
  42099. readInt() {
  42100. const token = this.getToken();
  42101. return parseInt(token || 0, 10) | 0;
  42102. }
  42103. readBoolean() {
  42104. const token = this.getToken();
  42105. return token === "true" ? 1 : 0;
  42106. }
  42107. nextChar() {
  42108. return this.currentChar = this.stream.getByte();
  42109. }
  42110. prevChar() {
  42111. this.stream.skip(-2);
  42112. return this.currentChar = this.stream.getByte();
  42113. }
  42114. getToken() {
  42115. let comment = false;
  42116. let ch = this.currentChar;
  42117. while (true) {
  42118. if (ch === -1) {
  42119. return null;
  42120. }
  42121. if (comment) {
  42122. if (ch === 0x0a || ch === 0x0d) {
  42123. comment = false;
  42124. }
  42125. } else if (ch === 0x25) {
  42126. comment = true;
  42127. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42128. break;
  42129. }
  42130. ch = this.nextChar();
  42131. }
  42132. if (isSpecial(ch)) {
  42133. this.nextChar();
  42134. return String.fromCharCode(ch);
  42135. }
  42136. let token = "";
  42137. do {
  42138. token += String.fromCharCode(ch);
  42139. ch = this.nextChar();
  42140. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  42141. return token;
  42142. }
  42143. readCharStrings(bytes, lenIV) {
  42144. if (lenIV === -1) {
  42145. return bytes;
  42146. }
  42147. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  42148. }
  42149. extractFontProgram(properties) {
  42150. const stream = this.stream;
  42151. const subrs = [],
  42152. charstrings = [];
  42153. const privateData = Object.create(null);
  42154. privateData.lenIV = 4;
  42155. const program = {
  42156. subrs: [],
  42157. charstrings: [],
  42158. properties: {
  42159. privateData
  42160. }
  42161. };
  42162. let token, length, data, lenIV, encoded;
  42163. while ((token = this.getToken()) !== null) {
  42164. if (token !== "/") {
  42165. continue;
  42166. }
  42167. token = this.getToken();
  42168. switch (token) {
  42169. case "CharStrings":
  42170. this.getToken();
  42171. this.getToken();
  42172. this.getToken();
  42173. this.getToken();
  42174. while (true) {
  42175. token = this.getToken();
  42176. if (token === null || token === "end") {
  42177. break;
  42178. }
  42179. if (token !== "/") {
  42180. continue;
  42181. }
  42182. const glyph = this.getToken();
  42183. length = this.readInt();
  42184. this.getToken();
  42185. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42186. lenIV = program.properties.privateData.lenIV;
  42187. encoded = this.readCharStrings(data, lenIV);
  42188. this.nextChar();
  42189. token = this.getToken();
  42190. if (token === "noaccess") {
  42191. this.getToken();
  42192. } else if (token === "/") {
  42193. this.prevChar();
  42194. }
  42195. charstrings.push({
  42196. glyph,
  42197. encoded
  42198. });
  42199. }
  42200. break;
  42201. case "Subrs":
  42202. this.readInt();
  42203. this.getToken();
  42204. while (this.getToken() === "dup") {
  42205. const index = this.readInt();
  42206. length = this.readInt();
  42207. this.getToken();
  42208. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42209. lenIV = program.properties.privateData.lenIV;
  42210. encoded = this.readCharStrings(data, lenIV);
  42211. this.nextChar();
  42212. token = this.getToken();
  42213. if (token === "noaccess") {
  42214. this.getToken();
  42215. }
  42216. subrs[index] = encoded;
  42217. }
  42218. break;
  42219. case "BlueValues":
  42220. case "OtherBlues":
  42221. case "FamilyBlues":
  42222. case "FamilyOtherBlues":
  42223. const blueArray = this.readNumberArray();
  42224. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  42225. program.properties.privateData[token] = blueArray;
  42226. }
  42227. break;
  42228. case "StemSnapH":
  42229. case "StemSnapV":
  42230. program.properties.privateData[token] = this.readNumberArray();
  42231. break;
  42232. case "StdHW":
  42233. case "StdVW":
  42234. program.properties.privateData[token] = this.readNumberArray()[0];
  42235. break;
  42236. case "BlueShift":
  42237. case "lenIV":
  42238. case "BlueFuzz":
  42239. case "BlueScale":
  42240. case "LanguageGroup":
  42241. case "ExpansionFactor":
  42242. program.properties.privateData[token] = this.readNumber();
  42243. break;
  42244. case "ForceBold":
  42245. program.properties.privateData[token] = this.readBoolean();
  42246. break;
  42247. }
  42248. }
  42249. for (let i = 0; i < charstrings.length; i++) {
  42250. const glyph = charstrings[i].glyph;
  42251. encoded = charstrings[i].encoded;
  42252. const charString = new Type1CharString();
  42253. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  42254. let output = charString.output;
  42255. if (error) {
  42256. output = [14];
  42257. }
  42258. const charStringObject = {
  42259. glyphName: glyph,
  42260. charstring: output,
  42261. width: charString.width,
  42262. lsb: charString.lsb,
  42263. seac: charString.seac
  42264. };
  42265. if (glyph === ".notdef") {
  42266. program.charstrings.unshift(charStringObject);
  42267. } else {
  42268. program.charstrings.push(charStringObject);
  42269. }
  42270. if (properties.builtInEncoding) {
  42271. const index = properties.builtInEncoding.indexOf(glyph);
  42272. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  42273. properties.widths[index] = charString.width;
  42274. }
  42275. }
  42276. }
  42277. return program;
  42278. }
  42279. extractFontHeader(properties) {
  42280. let token;
  42281. while ((token = this.getToken()) !== null) {
  42282. if (token !== "/") {
  42283. continue;
  42284. }
  42285. token = this.getToken();
  42286. switch (token) {
  42287. case "FontMatrix":
  42288. const matrix = this.readNumberArray();
  42289. properties.fontMatrix = matrix;
  42290. break;
  42291. case "Encoding":
  42292. const encodingArg = this.getToken();
  42293. let encoding;
  42294. if (!/^\d+$/.test(encodingArg)) {
  42295. encoding = (0, _encodings.getEncoding)(encodingArg);
  42296. } else {
  42297. encoding = [];
  42298. const size = parseInt(encodingArg, 10) | 0;
  42299. this.getToken();
  42300. for (let j = 0; j < size; j++) {
  42301. token = this.getToken();
  42302. while (token !== "dup" && token !== "def") {
  42303. token = this.getToken();
  42304. if (token === null) {
  42305. return;
  42306. }
  42307. }
  42308. if (token === "def") {
  42309. break;
  42310. }
  42311. const index = this.readInt();
  42312. this.getToken();
  42313. const glyph = this.getToken();
  42314. encoding[index] = glyph;
  42315. this.getToken();
  42316. }
  42317. }
  42318. properties.builtInEncoding = encoding;
  42319. break;
  42320. case "FontBBox":
  42321. const fontBBox = this.readNumberArray();
  42322. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  42323. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  42324. properties.ascentScaled = true;
  42325. break;
  42326. }
  42327. }
  42328. }
  42329. }
  42330. return Type1Parser;
  42331. }();
  42332. exports.Type1Parser = Type1Parser;
  42333. /***/ }),
  42334. /* 56 */
  42335. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42336. Object.defineProperty(exports, "__esModule", ({
  42337. value: true
  42338. }));
  42339. exports.Pattern = void 0;
  42340. exports.getTilingPatternIR = getTilingPatternIR;
  42341. var _util = __w_pdfjs_require__(2);
  42342. var _base_stream = __w_pdfjs_require__(9);
  42343. var _colorspace = __w_pdfjs_require__(24);
  42344. var _core_utils = __w_pdfjs_require__(8);
  42345. const ShadingType = {
  42346. FUNCTION_BASED: 1,
  42347. AXIAL: 2,
  42348. RADIAL: 3,
  42349. FREE_FORM_MESH: 4,
  42350. LATTICE_FORM_MESH: 5,
  42351. COONS_PATCH_MESH: 6,
  42352. TENSOR_PATCH_MESH: 7
  42353. };
  42354. class Pattern {
  42355. constructor() {
  42356. (0, _util.unreachable)("Cannot initialize Pattern.");
  42357. }
  42358. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  42359. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  42360. const type = dict.get("ShadingType");
  42361. try {
  42362. switch (type) {
  42363. case ShadingType.AXIAL:
  42364. case ShadingType.RADIAL:
  42365. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  42366. case ShadingType.FREE_FORM_MESH:
  42367. case ShadingType.LATTICE_FORM_MESH:
  42368. case ShadingType.COONS_PATCH_MESH:
  42369. case ShadingType.TENSOR_PATCH_MESH:
  42370. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  42371. default:
  42372. throw new _util.FormatError("Unsupported ShadingType: " + type);
  42373. }
  42374. } catch (ex) {
  42375. if (ex instanceof _core_utils.MissingDataException) {
  42376. throw ex;
  42377. }
  42378. handler.send("UnsupportedFeature", {
  42379. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  42380. });
  42381. (0, _util.warn)(ex);
  42382. return new DummyShading();
  42383. }
  42384. }
  42385. }
  42386. exports.Pattern = Pattern;
  42387. class BaseShading {
  42388. static get SMALL_NUMBER() {
  42389. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  42390. }
  42391. constructor() {
  42392. if (this.constructor === BaseShading) {
  42393. (0, _util.unreachable)("Cannot initialize BaseShading.");
  42394. }
  42395. }
  42396. getIR() {
  42397. (0, _util.unreachable)("Abstract method `getIR` called.");
  42398. }
  42399. }
  42400. class RadialAxialShading extends BaseShading {
  42401. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  42402. super();
  42403. this.coordsArr = dict.getArray("Coords");
  42404. this.shadingType = dict.get("ShadingType");
  42405. const cs = _colorspace.ColorSpace.parse({
  42406. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  42407. xref,
  42408. resources,
  42409. pdfFunctionFactory,
  42410. localColorSpaceCache
  42411. });
  42412. const bbox = dict.getArray("BBox");
  42413. if (Array.isArray(bbox) && bbox.length === 4) {
  42414. this.bbox = _util.Util.normalizeRect(bbox);
  42415. } else {
  42416. this.bbox = null;
  42417. }
  42418. let t0 = 0.0,
  42419. t1 = 1.0;
  42420. if (dict.has("Domain")) {
  42421. const domainArr = dict.getArray("Domain");
  42422. t0 = domainArr[0];
  42423. t1 = domainArr[1];
  42424. }
  42425. let extendStart = false,
  42426. extendEnd = false;
  42427. if (dict.has("Extend")) {
  42428. const extendArr = dict.getArray("Extend");
  42429. extendStart = extendArr[0];
  42430. extendEnd = extendArr[1];
  42431. }
  42432. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  42433. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  42434. const distance = Math.hypot(x1 - x2, y1 - y2);
  42435. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  42436. (0, _util.warn)("Unsupported radial gradient.");
  42437. }
  42438. }
  42439. this.extendStart = extendStart;
  42440. this.extendEnd = extendEnd;
  42441. const fnObj = dict.getRaw("Function");
  42442. const fn = pdfFunctionFactory.createFromArray(fnObj);
  42443. const NUMBER_OF_SAMPLES = 10;
  42444. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  42445. const colorStops = this.colorStops = [];
  42446. if (t0 >= t1 || step <= 0) {
  42447. (0, _util.info)("Bad shading domain.");
  42448. return;
  42449. }
  42450. const color = new Float32Array(cs.numComps),
  42451. ratio = new Float32Array(1);
  42452. let rgbColor;
  42453. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  42454. ratio[0] = t0 + i * step;
  42455. fn(ratio, 0, color, 0);
  42456. rgbColor = cs.getRgb(color, 0);
  42457. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  42458. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  42459. }
  42460. let background = "transparent";
  42461. if (dict.has("Background")) {
  42462. rgbColor = cs.getRgb(dict.get("Background"), 0);
  42463. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  42464. }
  42465. if (!extendStart) {
  42466. colorStops.unshift([0, background]);
  42467. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  42468. }
  42469. if (!extendEnd) {
  42470. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  42471. colorStops.push([1, background]);
  42472. }
  42473. this.colorStops = colorStops;
  42474. }
  42475. getIR() {
  42476. const coordsArr = this.coordsArr;
  42477. const shadingType = this.shadingType;
  42478. let type, p0, p1, r0, r1;
  42479. if (shadingType === ShadingType.AXIAL) {
  42480. p0 = [coordsArr[0], coordsArr[1]];
  42481. p1 = [coordsArr[2], coordsArr[3]];
  42482. r0 = null;
  42483. r1 = null;
  42484. type = "axial";
  42485. } else if (shadingType === ShadingType.RADIAL) {
  42486. p0 = [coordsArr[0], coordsArr[1]];
  42487. p1 = [coordsArr[3], coordsArr[4]];
  42488. r0 = coordsArr[2];
  42489. r1 = coordsArr[5];
  42490. type = "radial";
  42491. } else {
  42492. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  42493. }
  42494. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  42495. }
  42496. }
  42497. class MeshStreamReader {
  42498. constructor(stream, context) {
  42499. this.stream = stream;
  42500. this.context = context;
  42501. this.buffer = 0;
  42502. this.bufferLength = 0;
  42503. const numComps = context.numComps;
  42504. this.tmpCompsBuf = new Float32Array(numComps);
  42505. const csNumComps = context.colorSpace.numComps;
  42506. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  42507. }
  42508. get hasData() {
  42509. if (this.stream.end) {
  42510. return this.stream.pos < this.stream.end;
  42511. }
  42512. if (this.bufferLength > 0) {
  42513. return true;
  42514. }
  42515. const nextByte = this.stream.getByte();
  42516. if (nextByte < 0) {
  42517. return false;
  42518. }
  42519. this.buffer = nextByte;
  42520. this.bufferLength = 8;
  42521. return true;
  42522. }
  42523. readBits(n) {
  42524. let buffer = this.buffer;
  42525. let bufferLength = this.bufferLength;
  42526. if (n === 32) {
  42527. if (bufferLength === 0) {
  42528. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  42529. }
  42530. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  42531. const nextByte = this.stream.getByte();
  42532. this.buffer = nextByte & (1 << bufferLength) - 1;
  42533. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  42534. }
  42535. if (n === 8 && bufferLength === 0) {
  42536. return this.stream.getByte();
  42537. }
  42538. while (bufferLength < n) {
  42539. buffer = buffer << 8 | this.stream.getByte();
  42540. bufferLength += 8;
  42541. }
  42542. bufferLength -= n;
  42543. this.bufferLength = bufferLength;
  42544. this.buffer = buffer & (1 << bufferLength) - 1;
  42545. return buffer >> bufferLength;
  42546. }
  42547. align() {
  42548. this.buffer = 0;
  42549. this.bufferLength = 0;
  42550. }
  42551. readFlag() {
  42552. return this.readBits(this.context.bitsPerFlag);
  42553. }
  42554. readCoordinate() {
  42555. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  42556. const xi = this.readBits(bitsPerCoordinate);
  42557. const yi = this.readBits(bitsPerCoordinate);
  42558. const decode = this.context.decode;
  42559. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  42560. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  42561. }
  42562. readComponents() {
  42563. const numComps = this.context.numComps;
  42564. const bitsPerComponent = this.context.bitsPerComponent;
  42565. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  42566. const decode = this.context.decode;
  42567. const components = this.tmpCompsBuf;
  42568. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  42569. const ci = this.readBits(bitsPerComponent);
  42570. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  42571. }
  42572. const color = this.tmpCsCompsBuf;
  42573. if (this.context.colorFn) {
  42574. this.context.colorFn(components, 0, color, 0);
  42575. }
  42576. return this.context.colorSpace.getRgb(color, 0);
  42577. }
  42578. }
  42579. const getB = function getBClosure() {
  42580. function buildB(count) {
  42581. const lut = [];
  42582. for (let i = 0; i <= count; i++) {
  42583. const t = i / count,
  42584. t_ = 1 - t;
  42585. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  42586. }
  42587. return lut;
  42588. }
  42589. const cache = [];
  42590. return function (count) {
  42591. if (!cache[count]) {
  42592. cache[count] = buildB(count);
  42593. }
  42594. return cache[count];
  42595. };
  42596. }();
  42597. class MeshShading extends BaseShading {
  42598. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  42599. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  42600. }
  42601. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  42602. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  42603. }
  42604. static get TRIANGLE_DENSITY() {
  42605. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  42606. }
  42607. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  42608. super();
  42609. if (!(stream instanceof _base_stream.BaseStream)) {
  42610. throw new _util.FormatError("Mesh data is not a stream");
  42611. }
  42612. const dict = stream.dict;
  42613. this.shadingType = dict.get("ShadingType");
  42614. const bbox = dict.getArray("BBox");
  42615. if (Array.isArray(bbox) && bbox.length === 4) {
  42616. this.bbox = _util.Util.normalizeRect(bbox);
  42617. } else {
  42618. this.bbox = null;
  42619. }
  42620. const cs = _colorspace.ColorSpace.parse({
  42621. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  42622. xref,
  42623. resources,
  42624. pdfFunctionFactory,
  42625. localColorSpaceCache
  42626. });
  42627. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  42628. const fnObj = dict.getRaw("Function");
  42629. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  42630. this.coords = [];
  42631. this.colors = [];
  42632. this.figures = [];
  42633. const decodeContext = {
  42634. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  42635. bitsPerComponent: dict.get("BitsPerComponent"),
  42636. bitsPerFlag: dict.get("BitsPerFlag"),
  42637. decode: dict.getArray("Decode"),
  42638. colorFn: fn,
  42639. colorSpace: cs,
  42640. numComps: fn ? 1 : cs.numComps
  42641. };
  42642. const reader = new MeshStreamReader(stream, decodeContext);
  42643. let patchMesh = false;
  42644. switch (this.shadingType) {
  42645. case ShadingType.FREE_FORM_MESH:
  42646. this._decodeType4Shading(reader);
  42647. break;
  42648. case ShadingType.LATTICE_FORM_MESH:
  42649. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  42650. if (verticesPerRow < 2) {
  42651. throw new _util.FormatError("Invalid VerticesPerRow");
  42652. }
  42653. this._decodeType5Shading(reader, verticesPerRow);
  42654. break;
  42655. case ShadingType.COONS_PATCH_MESH:
  42656. this._decodeType6Shading(reader);
  42657. patchMesh = true;
  42658. break;
  42659. case ShadingType.TENSOR_PATCH_MESH:
  42660. this._decodeType7Shading(reader);
  42661. patchMesh = true;
  42662. break;
  42663. default:
  42664. (0, _util.unreachable)("Unsupported mesh type.");
  42665. break;
  42666. }
  42667. if (patchMesh) {
  42668. this._updateBounds();
  42669. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  42670. this._buildFigureFromPatch(i);
  42671. }
  42672. }
  42673. this._updateBounds();
  42674. this._packData();
  42675. }
  42676. _decodeType4Shading(reader) {
  42677. const coords = this.coords;
  42678. const colors = this.colors;
  42679. const operators = [];
  42680. const ps = [];
  42681. let verticesLeft = 0;
  42682. while (reader.hasData) {
  42683. const f = reader.readFlag();
  42684. const coord = reader.readCoordinate();
  42685. const color = reader.readComponents();
  42686. if (verticesLeft === 0) {
  42687. if (!(0 <= f && f <= 2)) {
  42688. throw new _util.FormatError("Unknown type4 flag");
  42689. }
  42690. switch (f) {
  42691. case 0:
  42692. verticesLeft = 3;
  42693. break;
  42694. case 1:
  42695. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  42696. verticesLeft = 1;
  42697. break;
  42698. case 2:
  42699. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  42700. verticesLeft = 1;
  42701. break;
  42702. }
  42703. operators.push(f);
  42704. }
  42705. ps.push(coords.length);
  42706. coords.push(coord);
  42707. colors.push(color);
  42708. verticesLeft--;
  42709. reader.align();
  42710. }
  42711. this.figures.push({
  42712. type: "triangles",
  42713. coords: new Int32Array(ps),
  42714. colors: new Int32Array(ps)
  42715. });
  42716. }
  42717. _decodeType5Shading(reader, verticesPerRow) {
  42718. const coords = this.coords;
  42719. const colors = this.colors;
  42720. const ps = [];
  42721. while (reader.hasData) {
  42722. const coord = reader.readCoordinate();
  42723. const color = reader.readComponents();
  42724. ps.push(coords.length);
  42725. coords.push(coord);
  42726. colors.push(color);
  42727. }
  42728. this.figures.push({
  42729. type: "lattice",
  42730. coords: new Int32Array(ps),
  42731. colors: new Int32Array(ps),
  42732. verticesPerRow
  42733. });
  42734. }
  42735. _decodeType6Shading(reader) {
  42736. const coords = this.coords;
  42737. const colors = this.colors;
  42738. const ps = new Int32Array(16);
  42739. const cs = new Int32Array(4);
  42740. while (reader.hasData) {
  42741. const f = reader.readFlag();
  42742. if (!(0 <= f && f <= 3)) {
  42743. throw new _util.FormatError("Unknown type6 flag");
  42744. }
  42745. const pi = coords.length;
  42746. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  42747. coords.push(reader.readCoordinate());
  42748. }
  42749. const ci = colors.length;
  42750. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  42751. colors.push(reader.readComponents());
  42752. }
  42753. let tmp1, tmp2, tmp3, tmp4;
  42754. switch (f) {
  42755. case 0:
  42756. ps[12] = pi + 3;
  42757. ps[13] = pi + 4;
  42758. ps[14] = pi + 5;
  42759. ps[15] = pi + 6;
  42760. ps[8] = pi + 2;
  42761. ps[11] = pi + 7;
  42762. ps[4] = pi + 1;
  42763. ps[7] = pi + 8;
  42764. ps[0] = pi;
  42765. ps[1] = pi + 11;
  42766. ps[2] = pi + 10;
  42767. ps[3] = pi + 9;
  42768. cs[2] = ci + 1;
  42769. cs[3] = ci + 2;
  42770. cs[0] = ci;
  42771. cs[1] = ci + 3;
  42772. break;
  42773. case 1:
  42774. tmp1 = ps[12];
  42775. tmp2 = ps[13];
  42776. tmp3 = ps[14];
  42777. tmp4 = ps[15];
  42778. ps[12] = tmp4;
  42779. ps[13] = pi + 0;
  42780. ps[14] = pi + 1;
  42781. ps[15] = pi + 2;
  42782. ps[8] = tmp3;
  42783. ps[11] = pi + 3;
  42784. ps[4] = tmp2;
  42785. ps[7] = pi + 4;
  42786. ps[0] = tmp1;
  42787. ps[1] = pi + 7;
  42788. ps[2] = pi + 6;
  42789. ps[3] = pi + 5;
  42790. tmp1 = cs[2];
  42791. tmp2 = cs[3];
  42792. cs[2] = tmp2;
  42793. cs[3] = ci;
  42794. cs[0] = tmp1;
  42795. cs[1] = ci + 1;
  42796. break;
  42797. case 2:
  42798. tmp1 = ps[15];
  42799. tmp2 = ps[11];
  42800. ps[12] = ps[3];
  42801. ps[13] = pi + 0;
  42802. ps[14] = pi + 1;
  42803. ps[15] = pi + 2;
  42804. ps[8] = ps[7];
  42805. ps[11] = pi + 3;
  42806. ps[4] = tmp2;
  42807. ps[7] = pi + 4;
  42808. ps[0] = tmp1;
  42809. ps[1] = pi + 7;
  42810. ps[2] = pi + 6;
  42811. ps[3] = pi + 5;
  42812. tmp1 = cs[3];
  42813. cs[2] = cs[1];
  42814. cs[3] = ci;
  42815. cs[0] = tmp1;
  42816. cs[1] = ci + 1;
  42817. break;
  42818. case 3:
  42819. ps[12] = ps[0];
  42820. ps[13] = pi + 0;
  42821. ps[14] = pi + 1;
  42822. ps[15] = pi + 2;
  42823. ps[8] = ps[1];
  42824. ps[11] = pi + 3;
  42825. ps[4] = ps[2];
  42826. ps[7] = pi + 4;
  42827. ps[0] = ps[3];
  42828. ps[1] = pi + 7;
  42829. ps[2] = pi + 6;
  42830. ps[3] = pi + 5;
  42831. cs[2] = cs[0];
  42832. cs[3] = ci;
  42833. cs[0] = cs[1];
  42834. cs[1] = ci + 1;
  42835. break;
  42836. }
  42837. ps[5] = coords.length;
  42838. 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]);
  42839. ps[6] = coords.length;
  42840. 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]);
  42841. ps[9] = coords.length;
  42842. 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]);
  42843. ps[10] = coords.length;
  42844. 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]);
  42845. this.figures.push({
  42846. type: "patch",
  42847. coords: new Int32Array(ps),
  42848. colors: new Int32Array(cs)
  42849. });
  42850. }
  42851. }
  42852. _decodeType7Shading(reader) {
  42853. const coords = this.coords;
  42854. const colors = this.colors;
  42855. const ps = new Int32Array(16);
  42856. const cs = new Int32Array(4);
  42857. while (reader.hasData) {
  42858. const f = reader.readFlag();
  42859. if (!(0 <= f && f <= 3)) {
  42860. throw new _util.FormatError("Unknown type7 flag");
  42861. }
  42862. const pi = coords.length;
  42863. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  42864. coords.push(reader.readCoordinate());
  42865. }
  42866. const ci = colors.length;
  42867. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  42868. colors.push(reader.readComponents());
  42869. }
  42870. let tmp1, tmp2, tmp3, tmp4;
  42871. switch (f) {
  42872. case 0:
  42873. ps[12] = pi + 3;
  42874. ps[13] = pi + 4;
  42875. ps[14] = pi + 5;
  42876. ps[15] = pi + 6;
  42877. ps[8] = pi + 2;
  42878. ps[9] = pi + 13;
  42879. ps[10] = pi + 14;
  42880. ps[11] = pi + 7;
  42881. ps[4] = pi + 1;
  42882. ps[5] = pi + 12;
  42883. ps[6] = pi + 15;
  42884. ps[7] = pi + 8;
  42885. ps[0] = pi;
  42886. ps[1] = pi + 11;
  42887. ps[2] = pi + 10;
  42888. ps[3] = pi + 9;
  42889. cs[2] = ci + 1;
  42890. cs[3] = ci + 2;
  42891. cs[0] = ci;
  42892. cs[1] = ci + 3;
  42893. break;
  42894. case 1:
  42895. tmp1 = ps[12];
  42896. tmp2 = ps[13];
  42897. tmp3 = ps[14];
  42898. tmp4 = ps[15];
  42899. ps[12] = tmp4;
  42900. ps[13] = pi + 0;
  42901. ps[14] = pi + 1;
  42902. ps[15] = pi + 2;
  42903. ps[8] = tmp3;
  42904. ps[9] = pi + 9;
  42905. ps[10] = pi + 10;
  42906. ps[11] = pi + 3;
  42907. ps[4] = tmp2;
  42908. ps[5] = pi + 8;
  42909. ps[6] = pi + 11;
  42910. ps[7] = pi + 4;
  42911. ps[0] = tmp1;
  42912. ps[1] = pi + 7;
  42913. ps[2] = pi + 6;
  42914. ps[3] = pi + 5;
  42915. tmp1 = cs[2];
  42916. tmp2 = cs[3];
  42917. cs[2] = tmp2;
  42918. cs[3] = ci;
  42919. cs[0] = tmp1;
  42920. cs[1] = ci + 1;
  42921. break;
  42922. case 2:
  42923. tmp1 = ps[15];
  42924. tmp2 = ps[11];
  42925. ps[12] = ps[3];
  42926. ps[13] = pi + 0;
  42927. ps[14] = pi + 1;
  42928. ps[15] = pi + 2;
  42929. ps[8] = ps[7];
  42930. ps[9] = pi + 9;
  42931. ps[10] = pi + 10;
  42932. ps[11] = pi + 3;
  42933. ps[4] = tmp2;
  42934. ps[5] = pi + 8;
  42935. ps[6] = pi + 11;
  42936. ps[7] = pi + 4;
  42937. ps[0] = tmp1;
  42938. ps[1] = pi + 7;
  42939. ps[2] = pi + 6;
  42940. ps[3] = pi + 5;
  42941. tmp1 = cs[3];
  42942. cs[2] = cs[1];
  42943. cs[3] = ci;
  42944. cs[0] = tmp1;
  42945. cs[1] = ci + 1;
  42946. break;
  42947. case 3:
  42948. ps[12] = ps[0];
  42949. ps[13] = pi + 0;
  42950. ps[14] = pi + 1;
  42951. ps[15] = pi + 2;
  42952. ps[8] = ps[1];
  42953. ps[9] = pi + 9;
  42954. ps[10] = pi + 10;
  42955. ps[11] = pi + 3;
  42956. ps[4] = ps[2];
  42957. ps[5] = pi + 8;
  42958. ps[6] = pi + 11;
  42959. ps[7] = pi + 4;
  42960. ps[0] = ps[3];
  42961. ps[1] = pi + 7;
  42962. ps[2] = pi + 6;
  42963. ps[3] = pi + 5;
  42964. cs[2] = cs[0];
  42965. cs[3] = ci;
  42966. cs[0] = cs[1];
  42967. cs[1] = ci + 1;
  42968. break;
  42969. }
  42970. this.figures.push({
  42971. type: "patch",
  42972. coords: new Int32Array(ps),
  42973. colors: new Int32Array(cs)
  42974. });
  42975. }
  42976. }
  42977. _buildFigureFromPatch(index) {
  42978. const figure = this.figures[index];
  42979. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  42980. const coords = this.coords,
  42981. colors = this.colors;
  42982. const pi = figure.coords;
  42983. const ci = figure.colors;
  42984. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  42985. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  42986. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  42987. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  42988. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  42989. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  42990. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  42991. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  42992. const verticesPerRow = splitXBy + 1;
  42993. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  42994. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  42995. let k = 0;
  42996. const cl = new Uint8Array(3),
  42997. cr = new Uint8Array(3);
  42998. const c0 = colors[ci[0]],
  42999. c1 = colors[ci[1]],
  43000. c2 = colors[ci[2]],
  43001. c3 = colors[ci[3]];
  43002. const bRow = getB(splitYBy),
  43003. bCol = getB(splitXBy);
  43004. for (let row = 0; row <= splitYBy; row++) {
  43005. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  43006. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  43007. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  43008. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  43009. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  43010. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  43011. for (let col = 0; col <= splitXBy; col++, k++) {
  43012. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  43013. continue;
  43014. }
  43015. let x = 0,
  43016. y = 0;
  43017. let q = 0;
  43018. for (let i = 0; i <= 3; i++) {
  43019. for (let j = 0; j <= 3; j++, q++) {
  43020. const m = bRow[row][i] * bCol[col][j];
  43021. x += coords[pi[q]][0] * m;
  43022. y += coords[pi[q]][1] * m;
  43023. }
  43024. }
  43025. figureCoords[k] = coords.length;
  43026. coords.push([x, y]);
  43027. figureColors[k] = colors.length;
  43028. const newColor = new Uint8Array(3);
  43029. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  43030. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  43031. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  43032. colors.push(newColor);
  43033. }
  43034. }
  43035. figureCoords[0] = pi[0];
  43036. figureColors[0] = ci[0];
  43037. figureCoords[splitXBy] = pi[3];
  43038. figureColors[splitXBy] = ci[1];
  43039. figureCoords[verticesPerRow * splitYBy] = pi[12];
  43040. figureColors[verticesPerRow * splitYBy] = ci[2];
  43041. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  43042. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  43043. this.figures[index] = {
  43044. type: "lattice",
  43045. coords: figureCoords,
  43046. colors: figureColors,
  43047. verticesPerRow
  43048. };
  43049. }
  43050. _updateBounds() {
  43051. let minX = this.coords[0][0],
  43052. minY = this.coords[0][1],
  43053. maxX = minX,
  43054. maxY = minY;
  43055. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  43056. const x = this.coords[i][0],
  43057. y = this.coords[i][1];
  43058. minX = minX > x ? x : minX;
  43059. minY = minY > y ? y : minY;
  43060. maxX = maxX < x ? x : maxX;
  43061. maxY = maxY < y ? y : maxY;
  43062. }
  43063. this.bounds = [minX, minY, maxX, maxY];
  43064. }
  43065. _packData() {
  43066. let i, ii, j, jj;
  43067. const coords = this.coords;
  43068. const coordsPacked = new Float32Array(coords.length * 2);
  43069. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  43070. const xy = coords[i];
  43071. coordsPacked[j++] = xy[0];
  43072. coordsPacked[j++] = xy[1];
  43073. }
  43074. this.coords = coordsPacked;
  43075. const colors = this.colors;
  43076. const colorsPacked = new Uint8Array(colors.length * 3);
  43077. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  43078. const c = colors[i];
  43079. colorsPacked[j++] = c[0];
  43080. colorsPacked[j++] = c[1];
  43081. colorsPacked[j++] = c[2];
  43082. }
  43083. this.colors = colorsPacked;
  43084. const figures = this.figures;
  43085. for (i = 0, ii = figures.length; i < ii; i++) {
  43086. const figure = figures[i],
  43087. ps = figure.coords,
  43088. cs = figure.colors;
  43089. for (j = 0, jj = ps.length; j < jj; j++) {
  43090. ps[j] *= 2;
  43091. cs[j] *= 3;
  43092. }
  43093. }
  43094. }
  43095. getIR() {
  43096. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  43097. }
  43098. }
  43099. class DummyShading extends BaseShading {
  43100. getIR() {
  43101. return ["Dummy"];
  43102. }
  43103. }
  43104. function getTilingPatternIR(operatorList, dict, color) {
  43105. const matrix = dict.getArray("Matrix");
  43106. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  43107. const xstep = dict.get("XStep");
  43108. const ystep = dict.get("YStep");
  43109. const paintType = dict.get("PaintType");
  43110. const tilingType = dict.get("TilingType");
  43111. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  43112. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  43113. }
  43114. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  43115. }
  43116. /***/ }),
  43117. /* 57 */
  43118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43119. Object.defineProperty(exports, "__esModule", ({
  43120. value: true
  43121. }));
  43122. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  43123. exports.isPDFFunction = isPDFFunction;
  43124. var _primitives = __w_pdfjs_require__(5);
  43125. var _util = __w_pdfjs_require__(2);
  43126. var _ps_parser = __w_pdfjs_require__(58);
  43127. var _base_stream = __w_pdfjs_require__(9);
  43128. var _image_utils = __w_pdfjs_require__(59);
  43129. class PDFFunctionFactory {
  43130. constructor({
  43131. xref,
  43132. isEvalSupported = true
  43133. }) {
  43134. this.xref = xref;
  43135. this.isEvalSupported = isEvalSupported !== false;
  43136. }
  43137. create(fn) {
  43138. const cachedFunction = this.getCached(fn);
  43139. if (cachedFunction) {
  43140. return cachedFunction;
  43141. }
  43142. const parsedFunction = PDFFunction.parse({
  43143. xref: this.xref,
  43144. isEvalSupported: this.isEvalSupported,
  43145. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  43146. });
  43147. this._cache(fn, parsedFunction);
  43148. return parsedFunction;
  43149. }
  43150. createFromArray(fnObj) {
  43151. const cachedFunction = this.getCached(fnObj);
  43152. if (cachedFunction) {
  43153. return cachedFunction;
  43154. }
  43155. const parsedFunction = PDFFunction.parseArray({
  43156. xref: this.xref,
  43157. isEvalSupported: this.isEvalSupported,
  43158. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  43159. });
  43160. this._cache(fnObj, parsedFunction);
  43161. return parsedFunction;
  43162. }
  43163. getCached(cacheKey) {
  43164. let fnRef;
  43165. if (cacheKey instanceof _primitives.Ref) {
  43166. fnRef = cacheKey;
  43167. } else if (cacheKey instanceof _primitives.Dict) {
  43168. fnRef = cacheKey.objId;
  43169. } else if (cacheKey instanceof _base_stream.BaseStream) {
  43170. fnRef = cacheKey.dict && cacheKey.dict.objId;
  43171. }
  43172. if (fnRef) {
  43173. const localFunction = this._localFunctionCache.getByRef(fnRef);
  43174. if (localFunction) {
  43175. return localFunction;
  43176. }
  43177. }
  43178. return null;
  43179. }
  43180. _cache(cacheKey, parsedFunction) {
  43181. if (!parsedFunction) {
  43182. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  43183. }
  43184. let fnRef;
  43185. if (cacheKey instanceof _primitives.Ref) {
  43186. fnRef = cacheKey;
  43187. } else if (cacheKey instanceof _primitives.Dict) {
  43188. fnRef = cacheKey.objId;
  43189. } else if (cacheKey instanceof _base_stream.BaseStream) {
  43190. fnRef = cacheKey.dict && cacheKey.dict.objId;
  43191. }
  43192. if (fnRef) {
  43193. this._localFunctionCache.set(null, fnRef, parsedFunction);
  43194. }
  43195. }
  43196. get _localFunctionCache() {
  43197. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  43198. }
  43199. }
  43200. exports.PDFFunctionFactory = PDFFunctionFactory;
  43201. function toNumberArray(arr) {
  43202. if (!Array.isArray(arr)) {
  43203. return null;
  43204. }
  43205. const length = arr.length;
  43206. for (let i = 0; i < length; i++) {
  43207. if (typeof arr[i] !== "number") {
  43208. const result = new Array(length);
  43209. for (let j = 0; j < length; j++) {
  43210. result[j] = +arr[j];
  43211. }
  43212. return result;
  43213. }
  43214. }
  43215. return arr;
  43216. }
  43217. class PDFFunction {
  43218. static getSampleArray(size, outputSize, bps, stream) {
  43219. let i, ii;
  43220. let length = 1;
  43221. for (i = 0, ii = size.length; i < ii; i++) {
  43222. length *= size[i];
  43223. }
  43224. length *= outputSize;
  43225. const array = new Array(length);
  43226. let codeSize = 0;
  43227. let codeBuf = 0;
  43228. const sampleMul = 1.0 / (2.0 ** bps - 1);
  43229. const strBytes = stream.getBytes((length * bps + 7) / 8);
  43230. let strIdx = 0;
  43231. for (i = 0; i < length; i++) {
  43232. while (codeSize < bps) {
  43233. codeBuf <<= 8;
  43234. codeBuf |= strBytes[strIdx++];
  43235. codeSize += 8;
  43236. }
  43237. codeSize -= bps;
  43238. array[i] = (codeBuf >> codeSize) * sampleMul;
  43239. codeBuf &= (1 << codeSize) - 1;
  43240. }
  43241. return array;
  43242. }
  43243. static parse({
  43244. xref,
  43245. isEvalSupported,
  43246. fn
  43247. }) {
  43248. const dict = fn.dict || fn;
  43249. const typeNum = dict.get("FunctionType");
  43250. switch (typeNum) {
  43251. case 0:
  43252. return this.constructSampled({
  43253. xref,
  43254. isEvalSupported,
  43255. fn,
  43256. dict
  43257. });
  43258. case 1:
  43259. break;
  43260. case 2:
  43261. return this.constructInterpolated({
  43262. xref,
  43263. isEvalSupported,
  43264. dict
  43265. });
  43266. case 3:
  43267. return this.constructStiched({
  43268. xref,
  43269. isEvalSupported,
  43270. dict
  43271. });
  43272. case 4:
  43273. return this.constructPostScript({
  43274. xref,
  43275. isEvalSupported,
  43276. fn,
  43277. dict
  43278. });
  43279. }
  43280. throw new _util.FormatError("Unknown type of function");
  43281. }
  43282. static parseArray({
  43283. xref,
  43284. isEvalSupported,
  43285. fnObj
  43286. }) {
  43287. if (!Array.isArray(fnObj)) {
  43288. return this.parse({
  43289. xref,
  43290. isEvalSupported,
  43291. fn: fnObj
  43292. });
  43293. }
  43294. const fnArray = [];
  43295. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  43296. fnArray.push(this.parse({
  43297. xref,
  43298. isEvalSupported,
  43299. fn: xref.fetchIfRef(fnObj[j])
  43300. }));
  43301. }
  43302. return function (src, srcOffset, dest, destOffset) {
  43303. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  43304. fnArray[i](src, srcOffset, dest, destOffset + i);
  43305. }
  43306. };
  43307. }
  43308. static constructSampled({
  43309. xref,
  43310. isEvalSupported,
  43311. fn,
  43312. dict
  43313. }) {
  43314. function toMultiArray(arr) {
  43315. const inputLength = arr.length;
  43316. const out = [];
  43317. let index = 0;
  43318. for (let i = 0; i < inputLength; i += 2) {
  43319. out[index++] = [arr[i], arr[i + 1]];
  43320. }
  43321. return out;
  43322. }
  43323. function interpolate(x, xmin, xmax, ymin, ymax) {
  43324. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  43325. }
  43326. let domain = toNumberArray(dict.getArray("Domain"));
  43327. let range = toNumberArray(dict.getArray("Range"));
  43328. if (!domain || !range) {
  43329. throw new _util.FormatError("No domain or range");
  43330. }
  43331. const inputSize = domain.length / 2;
  43332. const outputSize = range.length / 2;
  43333. domain = toMultiArray(domain);
  43334. range = toMultiArray(range);
  43335. const size = toNumberArray(dict.getArray("Size"));
  43336. const bps = dict.get("BitsPerSample");
  43337. const order = dict.get("Order") || 1;
  43338. if (order !== 1) {
  43339. (0, _util.info)("No support for cubic spline interpolation: " + order);
  43340. }
  43341. let encode = toNumberArray(dict.getArray("Encode"));
  43342. if (!encode) {
  43343. encode = [];
  43344. for (let i = 0; i < inputSize; ++i) {
  43345. encode.push([0, size[i] - 1]);
  43346. }
  43347. } else {
  43348. encode = toMultiArray(encode);
  43349. }
  43350. let decode = toNumberArray(dict.getArray("Decode"));
  43351. if (!decode) {
  43352. decode = range;
  43353. } else {
  43354. decode = toMultiArray(decode);
  43355. }
  43356. const samples = this.getSampleArray(size, outputSize, bps, fn);
  43357. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  43358. const cubeVertices = 1 << inputSize;
  43359. const cubeN = new Float64Array(cubeVertices);
  43360. const cubeVertex = new Uint32Array(cubeVertices);
  43361. let i, j;
  43362. for (j = 0; j < cubeVertices; j++) {
  43363. cubeN[j] = 1;
  43364. }
  43365. let k = outputSize,
  43366. pos = 1;
  43367. for (i = 0; i < inputSize; ++i) {
  43368. const domain_2i = domain[i][0];
  43369. const domain_2i_1 = domain[i][1];
  43370. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  43371. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  43372. const size_i = size[i];
  43373. e = Math.min(Math.max(e, 0), size_i - 1);
  43374. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  43375. const n0 = e0 + 1 - e;
  43376. const n1 = e - e0;
  43377. const offset0 = e0 * k;
  43378. const offset1 = offset0 + k;
  43379. for (j = 0; j < cubeVertices; j++) {
  43380. if (j & pos) {
  43381. cubeN[j] *= n1;
  43382. cubeVertex[j] += offset1;
  43383. } else {
  43384. cubeN[j] *= n0;
  43385. cubeVertex[j] += offset0;
  43386. }
  43387. }
  43388. k *= size_i;
  43389. pos <<= 1;
  43390. }
  43391. for (j = 0; j < outputSize; ++j) {
  43392. let rj = 0;
  43393. for (i = 0; i < cubeVertices; i++) {
  43394. rj += samples[cubeVertex[i] + j] * cubeN[i];
  43395. }
  43396. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  43397. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  43398. }
  43399. };
  43400. }
  43401. static constructInterpolated({
  43402. xref,
  43403. isEvalSupported,
  43404. dict
  43405. }) {
  43406. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  43407. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  43408. const n = dict.get("N");
  43409. const diff = [];
  43410. for (let i = 0, ii = c0.length; i < ii; ++i) {
  43411. diff.push(c1[i] - c0[i]);
  43412. }
  43413. const length = diff.length;
  43414. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  43415. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  43416. for (let j = 0; j < length; ++j) {
  43417. dest[destOffset + j] = c0[j] + x * diff[j];
  43418. }
  43419. };
  43420. }
  43421. static constructStiched({
  43422. xref,
  43423. isEvalSupported,
  43424. dict
  43425. }) {
  43426. const domain = toNumberArray(dict.getArray("Domain"));
  43427. if (!domain) {
  43428. throw new _util.FormatError("No domain");
  43429. }
  43430. const inputSize = domain.length / 2;
  43431. if (inputSize !== 1) {
  43432. throw new _util.FormatError("Bad domain for stiched function");
  43433. }
  43434. const fnRefs = dict.get("Functions");
  43435. const fns = [];
  43436. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  43437. fns.push(this.parse({
  43438. xref,
  43439. isEvalSupported,
  43440. fn: xref.fetchIfRef(fnRefs[i])
  43441. }));
  43442. }
  43443. const bounds = toNumberArray(dict.getArray("Bounds"));
  43444. const encode = toNumberArray(dict.getArray("Encode"));
  43445. const tmpBuf = new Float32Array(1);
  43446. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  43447. const clip = function constructStichedFromIRClip(v, min, max) {
  43448. if (v > max) {
  43449. v = max;
  43450. } else if (v < min) {
  43451. v = min;
  43452. }
  43453. return v;
  43454. };
  43455. const v = clip(src[srcOffset], domain[0], domain[1]);
  43456. const length = bounds.length;
  43457. let i;
  43458. for (i = 0; i < length; ++i) {
  43459. if (v < bounds[i]) {
  43460. break;
  43461. }
  43462. }
  43463. let dmin = domain[0];
  43464. if (i > 0) {
  43465. dmin = bounds[i - 1];
  43466. }
  43467. let dmax = domain[1];
  43468. if (i < bounds.length) {
  43469. dmax = bounds[i];
  43470. }
  43471. const rmin = encode[2 * i];
  43472. const rmax = encode[2 * i + 1];
  43473. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  43474. fns[i](tmpBuf, 0, dest, destOffset);
  43475. };
  43476. }
  43477. static constructPostScript({
  43478. xref,
  43479. isEvalSupported,
  43480. fn,
  43481. dict
  43482. }) {
  43483. const domain = toNumberArray(dict.getArray("Domain"));
  43484. const range = toNumberArray(dict.getArray("Range"));
  43485. if (!domain) {
  43486. throw new _util.FormatError("No domain.");
  43487. }
  43488. if (!range) {
  43489. throw new _util.FormatError("No range.");
  43490. }
  43491. const lexer = new _ps_parser.PostScriptLexer(fn);
  43492. const parser = new _ps_parser.PostScriptParser(lexer);
  43493. const code = parser.parse();
  43494. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  43495. const compiled = new PostScriptCompiler().compile(code, domain, range);
  43496. if (compiled) {
  43497. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  43498. }
  43499. }
  43500. (0, _util.info)("Unable to compile PS function");
  43501. const numOutputs = range.length >> 1;
  43502. const numInputs = domain.length >> 1;
  43503. const evaluator = new PostScriptEvaluator(code);
  43504. const cache = Object.create(null);
  43505. const MAX_CACHE_SIZE = 2048 * 4;
  43506. let cache_available = MAX_CACHE_SIZE;
  43507. const tmpBuf = new Float32Array(numInputs);
  43508. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  43509. let i, value;
  43510. let key = "";
  43511. const input = tmpBuf;
  43512. for (i = 0; i < numInputs; i++) {
  43513. value = src[srcOffset + i];
  43514. input[i] = value;
  43515. key += value + "_";
  43516. }
  43517. const cachedValue = cache[key];
  43518. if (cachedValue !== undefined) {
  43519. dest.set(cachedValue, destOffset);
  43520. return;
  43521. }
  43522. const output = new Float32Array(numOutputs);
  43523. const stack = evaluator.execute(input);
  43524. const stackIndex = stack.length - numOutputs;
  43525. for (i = 0; i < numOutputs; i++) {
  43526. value = stack[stackIndex + i];
  43527. let bound = range[i * 2];
  43528. if (value < bound) {
  43529. value = bound;
  43530. } else {
  43531. bound = range[i * 2 + 1];
  43532. if (value > bound) {
  43533. value = bound;
  43534. }
  43535. }
  43536. output[i] = value;
  43537. }
  43538. if (cache_available > 0) {
  43539. cache_available--;
  43540. cache[key] = output;
  43541. }
  43542. dest.set(output, destOffset);
  43543. };
  43544. }
  43545. }
  43546. function isPDFFunction(v) {
  43547. let fnDict;
  43548. if (typeof v !== "object") {
  43549. return false;
  43550. } else if (v instanceof _primitives.Dict) {
  43551. fnDict = v;
  43552. } else if (v instanceof _base_stream.BaseStream) {
  43553. fnDict = v.dict;
  43554. } else {
  43555. return false;
  43556. }
  43557. return fnDict.has("FunctionType");
  43558. }
  43559. class PostScriptStack {
  43560. static get MAX_STACK_SIZE() {
  43561. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  43562. }
  43563. constructor(initialStack) {
  43564. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  43565. }
  43566. push(value) {
  43567. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  43568. throw new Error("PostScript function stack overflow.");
  43569. }
  43570. this.stack.push(value);
  43571. }
  43572. pop() {
  43573. if (this.stack.length <= 0) {
  43574. throw new Error("PostScript function stack underflow.");
  43575. }
  43576. return this.stack.pop();
  43577. }
  43578. copy(n) {
  43579. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  43580. throw new Error("PostScript function stack overflow.");
  43581. }
  43582. const stack = this.stack;
  43583. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  43584. stack.push(stack[i]);
  43585. }
  43586. }
  43587. index(n) {
  43588. this.push(this.stack[this.stack.length - n - 1]);
  43589. }
  43590. roll(n, p) {
  43591. const stack = this.stack;
  43592. const l = stack.length - n;
  43593. const r = stack.length - 1;
  43594. const c = l + (p - Math.floor(p / n) * n);
  43595. for (let i = l, j = r; i < j; i++, j--) {
  43596. const t = stack[i];
  43597. stack[i] = stack[j];
  43598. stack[j] = t;
  43599. }
  43600. for (let i = l, j = c - 1; i < j; i++, j--) {
  43601. const t = stack[i];
  43602. stack[i] = stack[j];
  43603. stack[j] = t;
  43604. }
  43605. for (let i = c, j = r; i < j; i++, j--) {
  43606. const t = stack[i];
  43607. stack[i] = stack[j];
  43608. stack[j] = t;
  43609. }
  43610. }
  43611. }
  43612. class PostScriptEvaluator {
  43613. constructor(operators) {
  43614. this.operators = operators;
  43615. }
  43616. execute(initialStack) {
  43617. const stack = new PostScriptStack(initialStack);
  43618. let counter = 0;
  43619. const operators = this.operators;
  43620. const length = operators.length;
  43621. let operator, a, b;
  43622. while (counter < length) {
  43623. operator = operators[counter++];
  43624. if (typeof operator === "number") {
  43625. stack.push(operator);
  43626. continue;
  43627. }
  43628. switch (operator) {
  43629. case "jz":
  43630. b = stack.pop();
  43631. a = stack.pop();
  43632. if (!a) {
  43633. counter = b;
  43634. }
  43635. break;
  43636. case "j":
  43637. a = stack.pop();
  43638. counter = a;
  43639. break;
  43640. case "abs":
  43641. a = stack.pop();
  43642. stack.push(Math.abs(a));
  43643. break;
  43644. case "add":
  43645. b = stack.pop();
  43646. a = stack.pop();
  43647. stack.push(a + b);
  43648. break;
  43649. case "and":
  43650. b = stack.pop();
  43651. a = stack.pop();
  43652. if (typeof a === "boolean" && typeof b === "boolean") {
  43653. stack.push(a && b);
  43654. } else {
  43655. stack.push(a & b);
  43656. }
  43657. break;
  43658. case "atan":
  43659. a = stack.pop();
  43660. stack.push(Math.atan(a));
  43661. break;
  43662. case "bitshift":
  43663. b = stack.pop();
  43664. a = stack.pop();
  43665. if (a > 0) {
  43666. stack.push(a << b);
  43667. } else {
  43668. stack.push(a >> b);
  43669. }
  43670. break;
  43671. case "ceiling":
  43672. a = stack.pop();
  43673. stack.push(Math.ceil(a));
  43674. break;
  43675. case "copy":
  43676. a = stack.pop();
  43677. stack.copy(a);
  43678. break;
  43679. case "cos":
  43680. a = stack.pop();
  43681. stack.push(Math.cos(a));
  43682. break;
  43683. case "cvi":
  43684. a = stack.pop() | 0;
  43685. stack.push(a);
  43686. break;
  43687. case "cvr":
  43688. break;
  43689. case "div":
  43690. b = stack.pop();
  43691. a = stack.pop();
  43692. stack.push(a / b);
  43693. break;
  43694. case "dup":
  43695. stack.copy(1);
  43696. break;
  43697. case "eq":
  43698. b = stack.pop();
  43699. a = stack.pop();
  43700. stack.push(a === b);
  43701. break;
  43702. case "exch":
  43703. stack.roll(2, 1);
  43704. break;
  43705. case "exp":
  43706. b = stack.pop();
  43707. a = stack.pop();
  43708. stack.push(a ** b);
  43709. break;
  43710. case "false":
  43711. stack.push(false);
  43712. break;
  43713. case "floor":
  43714. a = stack.pop();
  43715. stack.push(Math.floor(a));
  43716. break;
  43717. case "ge":
  43718. b = stack.pop();
  43719. a = stack.pop();
  43720. stack.push(a >= b);
  43721. break;
  43722. case "gt":
  43723. b = stack.pop();
  43724. a = stack.pop();
  43725. stack.push(a > b);
  43726. break;
  43727. case "idiv":
  43728. b = stack.pop();
  43729. a = stack.pop();
  43730. stack.push(a / b | 0);
  43731. break;
  43732. case "index":
  43733. a = stack.pop();
  43734. stack.index(a);
  43735. break;
  43736. case "le":
  43737. b = stack.pop();
  43738. a = stack.pop();
  43739. stack.push(a <= b);
  43740. break;
  43741. case "ln":
  43742. a = stack.pop();
  43743. stack.push(Math.log(a));
  43744. break;
  43745. case "log":
  43746. a = stack.pop();
  43747. stack.push(Math.log(a) / Math.LN10);
  43748. break;
  43749. case "lt":
  43750. b = stack.pop();
  43751. a = stack.pop();
  43752. stack.push(a < b);
  43753. break;
  43754. case "mod":
  43755. b = stack.pop();
  43756. a = stack.pop();
  43757. stack.push(a % b);
  43758. break;
  43759. case "mul":
  43760. b = stack.pop();
  43761. a = stack.pop();
  43762. stack.push(a * b);
  43763. break;
  43764. case "ne":
  43765. b = stack.pop();
  43766. a = stack.pop();
  43767. stack.push(a !== b);
  43768. break;
  43769. case "neg":
  43770. a = stack.pop();
  43771. stack.push(-a);
  43772. break;
  43773. case "not":
  43774. a = stack.pop();
  43775. if (typeof a === "boolean") {
  43776. stack.push(!a);
  43777. } else {
  43778. stack.push(~a);
  43779. }
  43780. break;
  43781. case "or":
  43782. b = stack.pop();
  43783. a = stack.pop();
  43784. if (typeof a === "boolean" && typeof b === "boolean") {
  43785. stack.push(a || b);
  43786. } else {
  43787. stack.push(a | b);
  43788. }
  43789. break;
  43790. case "pop":
  43791. stack.pop();
  43792. break;
  43793. case "roll":
  43794. b = stack.pop();
  43795. a = stack.pop();
  43796. stack.roll(a, b);
  43797. break;
  43798. case "round":
  43799. a = stack.pop();
  43800. stack.push(Math.round(a));
  43801. break;
  43802. case "sin":
  43803. a = stack.pop();
  43804. stack.push(Math.sin(a));
  43805. break;
  43806. case "sqrt":
  43807. a = stack.pop();
  43808. stack.push(Math.sqrt(a));
  43809. break;
  43810. case "sub":
  43811. b = stack.pop();
  43812. a = stack.pop();
  43813. stack.push(a - b);
  43814. break;
  43815. case "true":
  43816. stack.push(true);
  43817. break;
  43818. case "truncate":
  43819. a = stack.pop();
  43820. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  43821. stack.push(a);
  43822. break;
  43823. case "xor":
  43824. b = stack.pop();
  43825. a = stack.pop();
  43826. if (typeof a === "boolean" && typeof b === "boolean") {
  43827. stack.push(a !== b);
  43828. } else {
  43829. stack.push(a ^ b);
  43830. }
  43831. break;
  43832. default:
  43833. throw new _util.FormatError(`Unknown operator ${operator}`);
  43834. }
  43835. }
  43836. return stack.stack;
  43837. }
  43838. }
  43839. exports.PostScriptEvaluator = PostScriptEvaluator;
  43840. const PostScriptCompiler = function PostScriptCompilerClosure() {
  43841. class AstNode {
  43842. constructor(type) {
  43843. this.type = type;
  43844. }
  43845. visit(visitor) {
  43846. (0, _util.unreachable)("abstract method");
  43847. }
  43848. }
  43849. class AstArgument extends AstNode {
  43850. constructor(index, min, max) {
  43851. super("args");
  43852. this.index = index;
  43853. this.min = min;
  43854. this.max = max;
  43855. }
  43856. visit(visitor) {
  43857. visitor.visitArgument(this);
  43858. }
  43859. }
  43860. class AstLiteral extends AstNode {
  43861. constructor(number) {
  43862. super("literal");
  43863. this.number = number;
  43864. this.min = number;
  43865. this.max = number;
  43866. }
  43867. visit(visitor) {
  43868. visitor.visitLiteral(this);
  43869. }
  43870. }
  43871. class AstBinaryOperation extends AstNode {
  43872. constructor(op, arg1, arg2, min, max) {
  43873. super("binary");
  43874. this.op = op;
  43875. this.arg1 = arg1;
  43876. this.arg2 = arg2;
  43877. this.min = min;
  43878. this.max = max;
  43879. }
  43880. visit(visitor) {
  43881. visitor.visitBinaryOperation(this);
  43882. }
  43883. }
  43884. class AstMin extends AstNode {
  43885. constructor(arg, max) {
  43886. super("max");
  43887. this.arg = arg;
  43888. this.min = arg.min;
  43889. this.max = max;
  43890. }
  43891. visit(visitor) {
  43892. visitor.visitMin(this);
  43893. }
  43894. }
  43895. class AstVariable extends AstNode {
  43896. constructor(index, min, max) {
  43897. super("var");
  43898. this.index = index;
  43899. this.min = min;
  43900. this.max = max;
  43901. }
  43902. visit(visitor) {
  43903. visitor.visitVariable(this);
  43904. }
  43905. }
  43906. class AstVariableDefinition extends AstNode {
  43907. constructor(variable, arg) {
  43908. super("definition");
  43909. this.variable = variable;
  43910. this.arg = arg;
  43911. }
  43912. visit(visitor) {
  43913. visitor.visitVariableDefinition(this);
  43914. }
  43915. }
  43916. class ExpressionBuilderVisitor {
  43917. constructor() {
  43918. this.parts = [];
  43919. }
  43920. visitArgument(arg) {
  43921. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  43922. }
  43923. visitVariable(variable) {
  43924. this.parts.push("v", variable.index);
  43925. }
  43926. visitLiteral(literal) {
  43927. this.parts.push(literal.number);
  43928. }
  43929. visitBinaryOperation(operation) {
  43930. this.parts.push("(");
  43931. operation.arg1.visit(this);
  43932. this.parts.push(" ", operation.op, " ");
  43933. operation.arg2.visit(this);
  43934. this.parts.push(")");
  43935. }
  43936. visitVariableDefinition(definition) {
  43937. this.parts.push("var ");
  43938. definition.variable.visit(this);
  43939. this.parts.push(" = ");
  43940. definition.arg.visit(this);
  43941. this.parts.push(";");
  43942. }
  43943. visitMin(max) {
  43944. this.parts.push("Math.min(");
  43945. max.arg.visit(this);
  43946. this.parts.push(", ", max.max, ")");
  43947. }
  43948. toString() {
  43949. return this.parts.join("");
  43950. }
  43951. }
  43952. function buildAddOperation(num1, num2) {
  43953. if (num2.type === "literal" && num2.number === 0) {
  43954. return num1;
  43955. }
  43956. if (num1.type === "literal" && num1.number === 0) {
  43957. return num2;
  43958. }
  43959. if (num2.type === "literal" && num1.type === "literal") {
  43960. return new AstLiteral(num1.number + num2.number);
  43961. }
  43962. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  43963. }
  43964. function buildMulOperation(num1, num2) {
  43965. if (num2.type === "literal") {
  43966. if (num2.number === 0) {
  43967. return new AstLiteral(0);
  43968. } else if (num2.number === 1) {
  43969. return num1;
  43970. } else if (num1.type === "literal") {
  43971. return new AstLiteral(num1.number * num2.number);
  43972. }
  43973. }
  43974. if (num1.type === "literal") {
  43975. if (num1.number === 0) {
  43976. return new AstLiteral(0);
  43977. } else if (num1.number === 1) {
  43978. return num2;
  43979. }
  43980. }
  43981. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  43982. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  43983. return new AstBinaryOperation("*", num1, num2, min, max);
  43984. }
  43985. function buildSubOperation(num1, num2) {
  43986. if (num2.type === "literal") {
  43987. if (num2.number === 0) {
  43988. return num1;
  43989. } else if (num1.type === "literal") {
  43990. return new AstLiteral(num1.number - num2.number);
  43991. }
  43992. }
  43993. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  43994. return num2.arg2;
  43995. }
  43996. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  43997. }
  43998. function buildMinOperation(num1, max) {
  43999. if (num1.min >= max) {
  44000. return new AstLiteral(max);
  44001. } else if (num1.max <= max) {
  44002. return num1;
  44003. }
  44004. return new AstMin(num1, max);
  44005. }
  44006. class PostScriptCompiler {
  44007. compile(code, domain, range) {
  44008. const stack = [];
  44009. const instructions = [];
  44010. const inputSize = domain.length >> 1,
  44011. outputSize = range.length >> 1;
  44012. let lastRegister = 0;
  44013. let n, j;
  44014. let num1, num2, ast1, ast2, tmpVar, item;
  44015. for (let i = 0; i < inputSize; i++) {
  44016. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  44017. }
  44018. for (let i = 0, ii = code.length; i < ii; i++) {
  44019. item = code[i];
  44020. if (typeof item === "number") {
  44021. stack.push(new AstLiteral(item));
  44022. continue;
  44023. }
  44024. switch (item) {
  44025. case "add":
  44026. if (stack.length < 2) {
  44027. return null;
  44028. }
  44029. num2 = stack.pop();
  44030. num1 = stack.pop();
  44031. stack.push(buildAddOperation(num1, num2));
  44032. break;
  44033. case "cvr":
  44034. if (stack.length < 1) {
  44035. return null;
  44036. }
  44037. break;
  44038. case "mul":
  44039. if (stack.length < 2) {
  44040. return null;
  44041. }
  44042. num2 = stack.pop();
  44043. num1 = stack.pop();
  44044. stack.push(buildMulOperation(num1, num2));
  44045. break;
  44046. case "sub":
  44047. if (stack.length < 2) {
  44048. return null;
  44049. }
  44050. num2 = stack.pop();
  44051. num1 = stack.pop();
  44052. stack.push(buildSubOperation(num1, num2));
  44053. break;
  44054. case "exch":
  44055. if (stack.length < 2) {
  44056. return null;
  44057. }
  44058. ast1 = stack.pop();
  44059. ast2 = stack.pop();
  44060. stack.push(ast1, ast2);
  44061. break;
  44062. case "pop":
  44063. if (stack.length < 1) {
  44064. return null;
  44065. }
  44066. stack.pop();
  44067. break;
  44068. case "index":
  44069. if (stack.length < 1) {
  44070. return null;
  44071. }
  44072. num1 = stack.pop();
  44073. if (num1.type !== "literal") {
  44074. return null;
  44075. }
  44076. n = num1.number;
  44077. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  44078. return null;
  44079. }
  44080. ast1 = stack[stack.length - n - 1];
  44081. if (ast1.type === "literal" || ast1.type === "var") {
  44082. stack.push(ast1);
  44083. break;
  44084. }
  44085. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  44086. stack[stack.length - n - 1] = tmpVar;
  44087. stack.push(tmpVar);
  44088. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  44089. break;
  44090. case "dup":
  44091. if (stack.length < 1) {
  44092. return null;
  44093. }
  44094. 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]) {
  44095. num1 = stack.pop();
  44096. stack.push(buildMinOperation(num1, code[i + 1]));
  44097. i += 6;
  44098. break;
  44099. }
  44100. ast1 = stack[stack.length - 1];
  44101. if (ast1.type === "literal" || ast1.type === "var") {
  44102. stack.push(ast1);
  44103. break;
  44104. }
  44105. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  44106. stack[stack.length - 1] = tmpVar;
  44107. stack.push(tmpVar);
  44108. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  44109. break;
  44110. case "roll":
  44111. if (stack.length < 2) {
  44112. return null;
  44113. }
  44114. num2 = stack.pop();
  44115. num1 = stack.pop();
  44116. if (num2.type !== "literal" || num1.type !== "literal") {
  44117. return null;
  44118. }
  44119. j = num2.number;
  44120. n = num1.number;
  44121. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  44122. return null;
  44123. }
  44124. j = (j % n + n) % n;
  44125. if (j === 0) {
  44126. break;
  44127. }
  44128. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  44129. break;
  44130. default:
  44131. return null;
  44132. }
  44133. }
  44134. if (stack.length !== outputSize) {
  44135. return null;
  44136. }
  44137. const result = [];
  44138. for (const instruction of instructions) {
  44139. const statementBuilder = new ExpressionBuilderVisitor();
  44140. instruction.visit(statementBuilder);
  44141. result.push(statementBuilder.toString());
  44142. }
  44143. for (let i = 0, ii = stack.length; i < ii; i++) {
  44144. const expr = stack[i],
  44145. statementBuilder = new ExpressionBuilderVisitor();
  44146. expr.visit(statementBuilder);
  44147. const min = range[i * 2],
  44148. max = range[i * 2 + 1];
  44149. const out = [statementBuilder.toString()];
  44150. if (min > expr.min) {
  44151. out.unshift("Math.max(", min, ", ");
  44152. out.push(")");
  44153. }
  44154. if (max < expr.max) {
  44155. out.unshift("Math.min(", max, ", ");
  44156. out.push(")");
  44157. }
  44158. out.unshift("dest[destOffset + ", i, "] = ");
  44159. out.push(";");
  44160. result.push(out.join(""));
  44161. }
  44162. return result.join("\n");
  44163. }
  44164. }
  44165. return PostScriptCompiler;
  44166. }();
  44167. exports.PostScriptCompiler = PostScriptCompiler;
  44168. /***/ }),
  44169. /* 58 */
  44170. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44171. Object.defineProperty(exports, "__esModule", ({
  44172. value: true
  44173. }));
  44174. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  44175. var _util = __w_pdfjs_require__(2);
  44176. var _primitives = __w_pdfjs_require__(5);
  44177. var _core_utils = __w_pdfjs_require__(8);
  44178. class PostScriptParser {
  44179. constructor(lexer) {
  44180. this.lexer = lexer;
  44181. this.operators = [];
  44182. this.token = null;
  44183. this.prev = null;
  44184. }
  44185. nextToken() {
  44186. this.prev = this.token;
  44187. this.token = this.lexer.getToken();
  44188. }
  44189. accept(type) {
  44190. if (this.token.type === type) {
  44191. this.nextToken();
  44192. return true;
  44193. }
  44194. return false;
  44195. }
  44196. expect(type) {
  44197. if (this.accept(type)) {
  44198. return true;
  44199. }
  44200. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  44201. }
  44202. parse() {
  44203. this.nextToken();
  44204. this.expect(PostScriptTokenTypes.LBRACE);
  44205. this.parseBlock();
  44206. this.expect(PostScriptTokenTypes.RBRACE);
  44207. return this.operators;
  44208. }
  44209. parseBlock() {
  44210. while (true) {
  44211. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  44212. this.operators.push(this.prev.value);
  44213. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  44214. this.operators.push(this.prev.value);
  44215. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  44216. this.parseCondition();
  44217. } else {
  44218. return;
  44219. }
  44220. }
  44221. }
  44222. parseCondition() {
  44223. const conditionLocation = this.operators.length;
  44224. this.operators.push(null, null);
  44225. this.parseBlock();
  44226. this.expect(PostScriptTokenTypes.RBRACE);
  44227. if (this.accept(PostScriptTokenTypes.IF)) {
  44228. this.operators[conditionLocation] = this.operators.length;
  44229. this.operators[conditionLocation + 1] = "jz";
  44230. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  44231. const jumpLocation = this.operators.length;
  44232. this.operators.push(null, null);
  44233. const endOfTrue = this.operators.length;
  44234. this.parseBlock();
  44235. this.expect(PostScriptTokenTypes.RBRACE);
  44236. this.expect(PostScriptTokenTypes.IFELSE);
  44237. this.operators[jumpLocation] = this.operators.length;
  44238. this.operators[jumpLocation + 1] = "j";
  44239. this.operators[conditionLocation] = endOfTrue;
  44240. this.operators[conditionLocation + 1] = "jz";
  44241. } else {
  44242. throw new _util.FormatError("PS Function: error parsing conditional.");
  44243. }
  44244. }
  44245. }
  44246. exports.PostScriptParser = PostScriptParser;
  44247. const PostScriptTokenTypes = {
  44248. LBRACE: 0,
  44249. RBRACE: 1,
  44250. NUMBER: 2,
  44251. OPERATOR: 3,
  44252. IF: 4,
  44253. IFELSE: 5
  44254. };
  44255. class PostScriptToken {
  44256. static get opCache() {
  44257. return (0, _util.shadow)(this, "opCache", Object.create(null));
  44258. }
  44259. constructor(type, value) {
  44260. this.type = type;
  44261. this.value = value;
  44262. }
  44263. static getOperator(op) {
  44264. const opValue = PostScriptToken.opCache[op];
  44265. if (opValue) {
  44266. return opValue;
  44267. }
  44268. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  44269. }
  44270. static get LBRACE() {
  44271. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  44272. }
  44273. static get RBRACE() {
  44274. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  44275. }
  44276. static get IF() {
  44277. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  44278. }
  44279. static get IFELSE() {
  44280. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  44281. }
  44282. }
  44283. class PostScriptLexer {
  44284. constructor(stream) {
  44285. this.stream = stream;
  44286. this.nextChar();
  44287. this.strBuf = [];
  44288. }
  44289. nextChar() {
  44290. return this.currentChar = this.stream.getByte();
  44291. }
  44292. getToken() {
  44293. let comment = false;
  44294. let ch = this.currentChar;
  44295. while (true) {
  44296. if (ch < 0) {
  44297. return _primitives.EOF;
  44298. }
  44299. if (comment) {
  44300. if (ch === 0x0a || ch === 0x0d) {
  44301. comment = false;
  44302. }
  44303. } else if (ch === 0x25) {
  44304. comment = true;
  44305. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  44306. break;
  44307. }
  44308. ch = this.nextChar();
  44309. }
  44310. switch (ch | 0) {
  44311. case 0x30:
  44312. case 0x31:
  44313. case 0x32:
  44314. case 0x33:
  44315. case 0x34:
  44316. case 0x35:
  44317. case 0x36:
  44318. case 0x37:
  44319. case 0x38:
  44320. case 0x39:
  44321. case 0x2b:
  44322. case 0x2d:
  44323. case 0x2e:
  44324. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  44325. case 0x7b:
  44326. this.nextChar();
  44327. return PostScriptToken.LBRACE;
  44328. case 0x7d:
  44329. this.nextChar();
  44330. return PostScriptToken.RBRACE;
  44331. }
  44332. const strBuf = this.strBuf;
  44333. strBuf.length = 0;
  44334. strBuf[0] = String.fromCharCode(ch);
  44335. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  44336. strBuf.push(String.fromCharCode(ch));
  44337. }
  44338. const str = strBuf.join("");
  44339. switch (str.toLowerCase()) {
  44340. case "if":
  44341. return PostScriptToken.IF;
  44342. case "ifelse":
  44343. return PostScriptToken.IFELSE;
  44344. default:
  44345. return PostScriptToken.getOperator(str);
  44346. }
  44347. }
  44348. getNumber() {
  44349. let ch = this.currentChar;
  44350. const strBuf = this.strBuf;
  44351. strBuf.length = 0;
  44352. strBuf[0] = String.fromCharCode(ch);
  44353. while ((ch = this.nextChar()) >= 0) {
  44354. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  44355. strBuf.push(String.fromCharCode(ch));
  44356. } else {
  44357. break;
  44358. }
  44359. }
  44360. const value = parseFloat(strBuf.join(""));
  44361. if (isNaN(value)) {
  44362. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  44363. }
  44364. return value;
  44365. }
  44366. }
  44367. exports.PostScriptLexer = PostScriptLexer;
  44368. /***/ }),
  44369. /* 59 */
  44370. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44371. Object.defineProperty(exports, "__esModule", ({
  44372. value: true
  44373. }));
  44374. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  44375. var _util = __w_pdfjs_require__(2);
  44376. var _primitives = __w_pdfjs_require__(5);
  44377. class BaseLocalCache {
  44378. constructor(options) {
  44379. if (this.constructor === BaseLocalCache) {
  44380. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  44381. }
  44382. this._onlyRefs = (options && options.onlyRefs) === true;
  44383. if (!this._onlyRefs) {
  44384. this._nameRefMap = new Map();
  44385. this._imageMap = new Map();
  44386. }
  44387. this._imageCache = new _primitives.RefSetCache();
  44388. }
  44389. getByName(name) {
  44390. if (this._onlyRefs) {
  44391. (0, _util.unreachable)("Should not call `getByName` method.");
  44392. }
  44393. const ref = this._nameRefMap.get(name);
  44394. if (ref) {
  44395. return this.getByRef(ref);
  44396. }
  44397. return this._imageMap.get(name) || null;
  44398. }
  44399. getByRef(ref) {
  44400. return this._imageCache.get(ref) || null;
  44401. }
  44402. set(name, ref, data) {
  44403. (0, _util.unreachable)("Abstract method `set` called.");
  44404. }
  44405. }
  44406. class LocalImageCache extends BaseLocalCache {
  44407. set(name, ref = null, data) {
  44408. if (typeof name !== "string") {
  44409. throw new Error('LocalImageCache.set - expected "name" argument.');
  44410. }
  44411. if (ref) {
  44412. if (this._imageCache.has(ref)) {
  44413. return;
  44414. }
  44415. this._nameRefMap.set(name, ref);
  44416. this._imageCache.put(ref, data);
  44417. return;
  44418. }
  44419. if (this._imageMap.has(name)) {
  44420. return;
  44421. }
  44422. this._imageMap.set(name, data);
  44423. }
  44424. }
  44425. exports.LocalImageCache = LocalImageCache;
  44426. class LocalColorSpaceCache extends BaseLocalCache {
  44427. set(name = null, ref = null, data) {
  44428. if (typeof name !== "string" && !ref) {
  44429. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  44430. }
  44431. if (ref) {
  44432. if (this._imageCache.has(ref)) {
  44433. return;
  44434. }
  44435. if (name !== null) {
  44436. this._nameRefMap.set(name, ref);
  44437. }
  44438. this._imageCache.put(ref, data);
  44439. return;
  44440. }
  44441. if (this._imageMap.has(name)) {
  44442. return;
  44443. }
  44444. this._imageMap.set(name, data);
  44445. }
  44446. }
  44447. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  44448. class LocalFunctionCache extends BaseLocalCache {
  44449. constructor(options) {
  44450. super({
  44451. onlyRefs: true
  44452. });
  44453. }
  44454. set(name = null, ref, data) {
  44455. if (!ref) {
  44456. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  44457. }
  44458. if (this._imageCache.has(ref)) {
  44459. return;
  44460. }
  44461. this._imageCache.put(ref, data);
  44462. }
  44463. }
  44464. exports.LocalFunctionCache = LocalFunctionCache;
  44465. class LocalGStateCache extends BaseLocalCache {
  44466. set(name, ref = null, data) {
  44467. if (typeof name !== "string") {
  44468. throw new Error('LocalGStateCache.set - expected "name" argument.');
  44469. }
  44470. if (ref) {
  44471. if (this._imageCache.has(ref)) {
  44472. return;
  44473. }
  44474. this._nameRefMap.set(name, ref);
  44475. this._imageCache.put(ref, data);
  44476. return;
  44477. }
  44478. if (this._imageMap.has(name)) {
  44479. return;
  44480. }
  44481. this._imageMap.set(name, data);
  44482. }
  44483. }
  44484. exports.LocalGStateCache = LocalGStateCache;
  44485. class LocalTilingPatternCache extends BaseLocalCache {
  44486. constructor(options) {
  44487. super({
  44488. onlyRefs: true
  44489. });
  44490. }
  44491. set(name = null, ref, data) {
  44492. if (!ref) {
  44493. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  44494. }
  44495. if (this._imageCache.has(ref)) {
  44496. return;
  44497. }
  44498. this._imageCache.put(ref, data);
  44499. }
  44500. }
  44501. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  44502. class GlobalImageCache {
  44503. static get NUM_PAGES_THRESHOLD() {
  44504. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  44505. }
  44506. static get MIN_IMAGES_TO_CACHE() {
  44507. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  44508. }
  44509. static get MAX_BYTE_SIZE() {
  44510. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  44511. }
  44512. constructor() {
  44513. this._refCache = new _primitives.RefSetCache();
  44514. this._imageCache = new _primitives.RefSetCache();
  44515. }
  44516. get _byteSize() {
  44517. let byteSize = 0;
  44518. this._imageCache.forEach(imageData => {
  44519. byteSize += imageData.byteSize;
  44520. });
  44521. return byteSize;
  44522. }
  44523. get _cacheLimitReached() {
  44524. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  44525. return false;
  44526. }
  44527. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  44528. return false;
  44529. }
  44530. return true;
  44531. }
  44532. shouldCache(ref, pageIndex) {
  44533. const pageIndexSet = this._refCache.get(ref);
  44534. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  44535. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  44536. return false;
  44537. }
  44538. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  44539. return false;
  44540. }
  44541. return true;
  44542. }
  44543. addPageIndex(ref, pageIndex) {
  44544. let pageIndexSet = this._refCache.get(ref);
  44545. if (!pageIndexSet) {
  44546. pageIndexSet = new Set();
  44547. this._refCache.put(ref, pageIndexSet);
  44548. }
  44549. pageIndexSet.add(pageIndex);
  44550. }
  44551. addByteSize(ref, byteSize) {
  44552. const imageData = this._imageCache.get(ref);
  44553. if (!imageData) {
  44554. return;
  44555. }
  44556. if (imageData.byteSize) {
  44557. return;
  44558. }
  44559. imageData.byteSize = byteSize;
  44560. }
  44561. getData(ref, pageIndex) {
  44562. const pageIndexSet = this._refCache.get(ref);
  44563. if (!pageIndexSet) {
  44564. return null;
  44565. }
  44566. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  44567. return null;
  44568. }
  44569. const imageData = this._imageCache.get(ref);
  44570. if (!imageData) {
  44571. return null;
  44572. }
  44573. pageIndexSet.add(pageIndex);
  44574. return imageData;
  44575. }
  44576. setData(ref, data) {
  44577. if (!this._refCache.has(ref)) {
  44578. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  44579. }
  44580. if (this._imageCache.has(ref)) {
  44581. return;
  44582. }
  44583. if (this._cacheLimitReached) {
  44584. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  44585. return;
  44586. }
  44587. this._imageCache.put(ref, data);
  44588. }
  44589. clear(onlyData = false) {
  44590. if (!onlyData) {
  44591. this._refCache.clear();
  44592. }
  44593. this._imageCache.clear();
  44594. }
  44595. }
  44596. exports.GlobalImageCache = GlobalImageCache;
  44597. /***/ }),
  44598. /* 60 */
  44599. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44600. Object.defineProperty(exports, "__esModule", ({
  44601. value: true
  44602. }));
  44603. exports.bidi = bidi;
  44604. var _util = __w_pdfjs_require__(2);
  44605. 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"];
  44606. 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"];
  44607. function isOdd(i) {
  44608. return (i & 1) !== 0;
  44609. }
  44610. function isEven(i) {
  44611. return (i & 1) === 0;
  44612. }
  44613. function findUnequal(arr, start, value) {
  44614. let j, jj;
  44615. for (j = start, jj = arr.length; j < jj; ++j) {
  44616. if (arr[j] !== value) {
  44617. return j;
  44618. }
  44619. }
  44620. return j;
  44621. }
  44622. function setValues(arr, start, end, value) {
  44623. for (let j = start; j < end; ++j) {
  44624. arr[j] = value;
  44625. }
  44626. }
  44627. function reverseValues(arr, start, end) {
  44628. for (let i = start, j = end - 1; i < j; ++i, --j) {
  44629. const temp = arr[i];
  44630. arr[i] = arr[j];
  44631. arr[j] = temp;
  44632. }
  44633. }
  44634. function createBidiText(str, isLTR, vertical = false) {
  44635. let dir = "ltr";
  44636. if (vertical) {
  44637. dir = "ttb";
  44638. } else if (!isLTR) {
  44639. dir = "rtl";
  44640. }
  44641. return {
  44642. str,
  44643. dir
  44644. };
  44645. }
  44646. const chars = [];
  44647. const types = [];
  44648. function bidi(str, startLevel = -1, vertical = false) {
  44649. let isLTR = true;
  44650. const strLength = str.length;
  44651. if (strLength === 0 || vertical) {
  44652. return createBidiText(str, isLTR, vertical);
  44653. }
  44654. chars.length = strLength;
  44655. types.length = strLength;
  44656. let numBidi = 0;
  44657. let i, ii;
  44658. for (i = 0; i < strLength; ++i) {
  44659. chars[i] = str.charAt(i);
  44660. const charCode = str.charCodeAt(i);
  44661. let charType = "L";
  44662. if (charCode <= 0x00ff) {
  44663. charType = baseTypes[charCode];
  44664. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  44665. charType = "R";
  44666. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  44667. charType = arabicTypes[charCode & 0xff];
  44668. if (!charType) {
  44669. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  44670. }
  44671. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  44672. charType = "AL";
  44673. }
  44674. if (charType === "R" || charType === "AL" || charType === "AN") {
  44675. numBidi++;
  44676. }
  44677. types[i] = charType;
  44678. }
  44679. if (numBidi === 0) {
  44680. isLTR = true;
  44681. return createBidiText(str, isLTR);
  44682. }
  44683. if (startLevel === -1) {
  44684. if (numBidi / strLength < 0.3 && strLength > 4) {
  44685. isLTR = true;
  44686. startLevel = 0;
  44687. } else {
  44688. isLTR = false;
  44689. startLevel = 1;
  44690. }
  44691. }
  44692. const levels = [];
  44693. for (i = 0; i < strLength; ++i) {
  44694. levels[i] = startLevel;
  44695. }
  44696. const e = isOdd(startLevel) ? "R" : "L";
  44697. const sor = e;
  44698. const eor = sor;
  44699. let lastType = sor;
  44700. for (i = 0; i < strLength; ++i) {
  44701. if (types[i] === "NSM") {
  44702. types[i] = lastType;
  44703. } else {
  44704. lastType = types[i];
  44705. }
  44706. }
  44707. lastType = sor;
  44708. let t;
  44709. for (i = 0; i < strLength; ++i) {
  44710. t = types[i];
  44711. if (t === "EN") {
  44712. types[i] = lastType === "AL" ? "AN" : "EN";
  44713. } else if (t === "R" || t === "L" || t === "AL") {
  44714. lastType = t;
  44715. }
  44716. }
  44717. for (i = 0; i < strLength; ++i) {
  44718. t = types[i];
  44719. if (t === "AL") {
  44720. types[i] = "R";
  44721. }
  44722. }
  44723. for (i = 1; i < strLength - 1; ++i) {
  44724. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  44725. types[i] = "EN";
  44726. }
  44727. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  44728. types[i] = types[i - 1];
  44729. }
  44730. }
  44731. for (i = 0; i < strLength; ++i) {
  44732. if (types[i] === "EN") {
  44733. for (let j = i - 1; j >= 0; --j) {
  44734. if (types[j] !== "ET") {
  44735. break;
  44736. }
  44737. types[j] = "EN";
  44738. }
  44739. for (let j = i + 1; j < strLength; ++j) {
  44740. if (types[j] !== "ET") {
  44741. break;
  44742. }
  44743. types[j] = "EN";
  44744. }
  44745. }
  44746. }
  44747. for (i = 0; i < strLength; ++i) {
  44748. t = types[i];
  44749. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  44750. types[i] = "ON";
  44751. }
  44752. }
  44753. lastType = sor;
  44754. for (i = 0; i < strLength; ++i) {
  44755. t = types[i];
  44756. if (t === "EN") {
  44757. types[i] = lastType === "L" ? "L" : "EN";
  44758. } else if (t === "R" || t === "L") {
  44759. lastType = t;
  44760. }
  44761. }
  44762. for (i = 0; i < strLength; ++i) {
  44763. if (types[i] === "ON") {
  44764. const end = findUnequal(types, i + 1, "ON");
  44765. let before = sor;
  44766. if (i > 0) {
  44767. before = types[i - 1];
  44768. }
  44769. let after = eor;
  44770. if (end + 1 < strLength) {
  44771. after = types[end + 1];
  44772. }
  44773. if (before !== "L") {
  44774. before = "R";
  44775. }
  44776. if (after !== "L") {
  44777. after = "R";
  44778. }
  44779. if (before === after) {
  44780. setValues(types, i, end, before);
  44781. }
  44782. i = end - 1;
  44783. }
  44784. }
  44785. for (i = 0; i < strLength; ++i) {
  44786. if (types[i] === "ON") {
  44787. types[i] = e;
  44788. }
  44789. }
  44790. for (i = 0; i < strLength; ++i) {
  44791. t = types[i];
  44792. if (isEven(levels[i])) {
  44793. if (t === "R") {
  44794. levels[i] += 1;
  44795. } else if (t === "AN" || t === "EN") {
  44796. levels[i] += 2;
  44797. }
  44798. } else {
  44799. if (t === "L" || t === "AN" || t === "EN") {
  44800. levels[i] += 1;
  44801. }
  44802. }
  44803. }
  44804. let highestLevel = -1;
  44805. let lowestOddLevel = 99;
  44806. let level;
  44807. for (i = 0, ii = levels.length; i < ii; ++i) {
  44808. level = levels[i];
  44809. if (highestLevel < level) {
  44810. highestLevel = level;
  44811. }
  44812. if (lowestOddLevel > level && isOdd(level)) {
  44813. lowestOddLevel = level;
  44814. }
  44815. }
  44816. for (level = highestLevel; level >= lowestOddLevel; --level) {
  44817. let start = -1;
  44818. for (i = 0, ii = levels.length; i < ii; ++i) {
  44819. if (levels[i] < level) {
  44820. if (start >= 0) {
  44821. reverseValues(chars, start, i);
  44822. start = -1;
  44823. }
  44824. } else if (start < 0) {
  44825. start = i;
  44826. }
  44827. }
  44828. if (start >= 0) {
  44829. reverseValues(chars, start, levels.length);
  44830. }
  44831. }
  44832. for (i = 0, ii = chars.length; i < ii; ++i) {
  44833. const ch = chars[i];
  44834. if (ch === "<" || ch === ">") {
  44835. chars[i] = "";
  44836. }
  44837. }
  44838. return createBidiText(chars.join(""), isLTR);
  44839. }
  44840. /***/ }),
  44841. /* 61 */
  44842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44843. Object.defineProperty(exports, "__esModule", ({
  44844. value: true
  44845. }));
  44846. exports.MurmurHash3_64 = void 0;
  44847. var _util = __w_pdfjs_require__(2);
  44848. const SEED = 0xc3d2e1f0;
  44849. const MASK_HIGH = 0xffff0000;
  44850. const MASK_LOW = 0xffff;
  44851. class MurmurHash3_64 {
  44852. constructor(seed) {
  44853. this.h1 = seed ? seed & 0xffffffff : SEED;
  44854. this.h2 = seed ? seed & 0xffffffff : SEED;
  44855. }
  44856. update(input) {
  44857. let data, length;
  44858. if (typeof input === "string") {
  44859. data = new Uint8Array(input.length * 2);
  44860. length = 0;
  44861. for (let i = 0, ii = input.length; i < ii; i++) {
  44862. const code = input.charCodeAt(i);
  44863. if (code <= 0xff) {
  44864. data[length++] = code;
  44865. } else {
  44866. data[length++] = code >>> 8;
  44867. data[length++] = code & 0xff;
  44868. }
  44869. }
  44870. } else if ((0, _util.isArrayBuffer)(input)) {
  44871. data = input.slice();
  44872. length = data.byteLength;
  44873. } else {
  44874. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  44875. }
  44876. const blockCounts = length >> 2;
  44877. const tailLength = length - blockCounts * 4;
  44878. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  44879. let k1 = 0,
  44880. k2 = 0;
  44881. let h1 = this.h1,
  44882. h2 = this.h2;
  44883. const C1 = 0xcc9e2d51,
  44884. C2 = 0x1b873593;
  44885. const C1_LOW = C1 & MASK_LOW,
  44886. C2_LOW = C2 & MASK_LOW;
  44887. for (let i = 0; i < blockCounts; i++) {
  44888. if (i & 1) {
  44889. k1 = dataUint32[i];
  44890. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44891. k1 = k1 << 15 | k1 >>> 17;
  44892. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44893. h1 ^= k1;
  44894. h1 = h1 << 13 | h1 >>> 19;
  44895. h1 = h1 * 5 + 0xe6546b64;
  44896. } else {
  44897. k2 = dataUint32[i];
  44898. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  44899. k2 = k2 << 15 | k2 >>> 17;
  44900. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  44901. h2 ^= k2;
  44902. h2 = h2 << 13 | h2 >>> 19;
  44903. h2 = h2 * 5 + 0xe6546b64;
  44904. }
  44905. }
  44906. k1 = 0;
  44907. switch (tailLength) {
  44908. case 3:
  44909. k1 ^= data[blockCounts * 4 + 2] << 16;
  44910. case 2:
  44911. k1 ^= data[blockCounts * 4 + 1] << 8;
  44912. case 1:
  44913. k1 ^= data[blockCounts * 4];
  44914. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44915. k1 = k1 << 15 | k1 >>> 17;
  44916. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44917. if (blockCounts & 1) {
  44918. h1 ^= k1;
  44919. } else {
  44920. h2 ^= k1;
  44921. }
  44922. }
  44923. this.h1 = h1;
  44924. this.h2 = h2;
  44925. }
  44926. hexdigest() {
  44927. let h1 = this.h1,
  44928. h2 = this.h2;
  44929. h1 ^= h2 >>> 1;
  44930. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  44931. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  44932. h1 ^= h2 >>> 1;
  44933. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  44934. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  44935. h1 ^= h2 >>> 1;
  44936. const hex1 = (h1 >>> 0).toString(16),
  44937. hex2 = (h2 >>> 0).toString(16);
  44938. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  44939. }
  44940. }
  44941. exports.MurmurHash3_64 = MurmurHash3_64;
  44942. /***/ }),
  44943. /* 62 */
  44944. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44945. Object.defineProperty(exports, "__esModule", ({
  44946. value: true
  44947. }));
  44948. exports.OperatorList = void 0;
  44949. var _util = __w_pdfjs_require__(2);
  44950. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  44951. let state = parentState;
  44952. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  44953. const item = pattern[i];
  44954. state = state[item] || (state[item] = []);
  44955. }
  44956. state[pattern[pattern.length - 1]] = {
  44957. checkFn,
  44958. iterateFn,
  44959. processFn
  44960. };
  44961. }
  44962. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  44963. const iFirstPIMXO = iFirstSave + 2;
  44964. let i;
  44965. for (i = 0; i < count; i++) {
  44966. const arg = argsArray[iFirstPIMXO + 4 * i];
  44967. const imageMask = arg.length === 1 && arg[0];
  44968. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  44969. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  44970. continue;
  44971. }
  44972. break;
  44973. }
  44974. return count - i;
  44975. }
  44976. const InitialState = [];
  44977. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  44978. const fnArray = context.fnArray;
  44979. const iFirstSave = context.iCurr - 3;
  44980. const pos = (i - iFirstSave) % 4;
  44981. switch (pos) {
  44982. case 0:
  44983. return fnArray[i] === _util.OPS.save;
  44984. case 1:
  44985. return fnArray[i] === _util.OPS.transform;
  44986. case 2:
  44987. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  44988. case 3:
  44989. return fnArray[i] === _util.OPS.restore;
  44990. }
  44991. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  44992. }, function foundInlineImageGroup(context, i) {
  44993. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  44994. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  44995. const MAX_WIDTH = 1000;
  44996. const IMAGE_PADDING = 1;
  44997. const fnArray = context.fnArray,
  44998. argsArray = context.argsArray;
  44999. const curr = context.iCurr;
  45000. const iFirstSave = curr - 3;
  45001. const iFirstTransform = curr - 2;
  45002. const iFirstPIIXO = curr - 1;
  45003. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  45004. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  45005. return i - (i - iFirstSave) % 4;
  45006. }
  45007. let maxX = 0;
  45008. const map = [];
  45009. let maxLineHeight = 0;
  45010. let currentX = IMAGE_PADDING,
  45011. currentY = IMAGE_PADDING;
  45012. for (let q = 0; q < count; q++) {
  45013. const transform = argsArray[iFirstTransform + (q << 2)];
  45014. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  45015. if (currentX + img.width > MAX_WIDTH) {
  45016. maxX = Math.max(maxX, currentX);
  45017. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  45018. currentX = 0;
  45019. maxLineHeight = 0;
  45020. }
  45021. map.push({
  45022. transform,
  45023. x: currentX,
  45024. y: currentY,
  45025. w: img.width,
  45026. h: img.height
  45027. });
  45028. currentX += img.width + 2 * IMAGE_PADDING;
  45029. maxLineHeight = Math.max(maxLineHeight, img.height);
  45030. }
  45031. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  45032. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  45033. const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  45034. const imgRowSize = imgWidth << 2;
  45035. for (let q = 0; q < count; q++) {
  45036. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  45037. const rowSize = map[q].w << 2;
  45038. let dataOffset = 0;
  45039. let offset = map[q].x + map[q].y * imgWidth << 2;
  45040. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  45041. for (let k = 0, kk = map[q].h; k < kk; k++) {
  45042. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  45043. dataOffset += rowSize;
  45044. offset += imgRowSize;
  45045. }
  45046. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  45047. while (offset >= 0) {
  45048. data[offset - 4] = data[offset];
  45049. data[offset - 3] = data[offset + 1];
  45050. data[offset - 2] = data[offset + 2];
  45051. data[offset - 1] = data[offset + 3];
  45052. data[offset + rowSize] = data[offset + rowSize - 4];
  45053. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  45054. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  45055. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  45056. offset -= imgRowSize;
  45057. }
  45058. }
  45059. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  45060. argsArray.splice(iFirstSave, count * 4, [{
  45061. width: imgWidth,
  45062. height: imgHeight,
  45063. kind: _util.ImageKind.RGBA_32BPP,
  45064. data: imgData
  45065. }, map]);
  45066. return iFirstSave + 1;
  45067. });
  45068. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  45069. const fnArray = context.fnArray;
  45070. const iFirstSave = context.iCurr - 3;
  45071. const pos = (i - iFirstSave) % 4;
  45072. switch (pos) {
  45073. case 0:
  45074. return fnArray[i] === _util.OPS.save;
  45075. case 1:
  45076. return fnArray[i] === _util.OPS.transform;
  45077. case 2:
  45078. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  45079. case 3:
  45080. return fnArray[i] === _util.OPS.restore;
  45081. }
  45082. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  45083. }, function foundImageMaskGroup(context, i) {
  45084. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  45085. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  45086. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  45087. const fnArray = context.fnArray,
  45088. argsArray = context.argsArray;
  45089. const curr = context.iCurr;
  45090. const iFirstSave = curr - 3;
  45091. const iFirstTransform = curr - 2;
  45092. const iFirstPIMXO = curr - 1;
  45093. let count = Math.floor((i - iFirstSave) / 4);
  45094. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  45095. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  45096. return i - (i - iFirstSave) % 4;
  45097. }
  45098. let isSameImage = false;
  45099. let iTransform, transformArgs;
  45100. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  45101. const firstTransformArg0 = argsArray[iFirstTransform][0],
  45102. firstTransformArg1 = argsArray[iFirstTransform][1],
  45103. firstTransformArg2 = argsArray[iFirstTransform][2],
  45104. firstTransformArg3 = argsArray[iFirstTransform][3];
  45105. if (firstTransformArg1 === firstTransformArg2) {
  45106. isSameImage = true;
  45107. iTransform = iFirstTransform + 4;
  45108. let iPIMXO = iFirstPIMXO + 4;
  45109. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  45110. transformArgs = argsArray[iTransform];
  45111. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  45112. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  45113. isSameImage = false;
  45114. } else {
  45115. count = q;
  45116. }
  45117. break;
  45118. }
  45119. }
  45120. }
  45121. if (isSameImage) {
  45122. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  45123. const positions = new Float32Array(count * 2);
  45124. iTransform = iFirstTransform;
  45125. for (let q = 0; q < count; q++, iTransform += 4) {
  45126. transformArgs = argsArray[iTransform];
  45127. positions[q << 1] = transformArgs[4];
  45128. positions[(q << 1) + 1] = transformArgs[5];
  45129. }
  45130. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  45131. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  45132. } else {
  45133. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  45134. const images = [];
  45135. for (let q = 0; q < count; q++) {
  45136. transformArgs = argsArray[iFirstTransform + (q << 2)];
  45137. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  45138. images.push({
  45139. data: maskParams.data,
  45140. width: maskParams.width,
  45141. height: maskParams.height,
  45142. transform: transformArgs
  45143. });
  45144. }
  45145. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  45146. argsArray.splice(iFirstSave, count * 4, [images]);
  45147. }
  45148. return iFirstSave + 1;
  45149. });
  45150. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  45151. const argsArray = context.argsArray;
  45152. const iFirstTransform = context.iCurr - 2;
  45153. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  45154. }, function iterateImageGroup(context, i) {
  45155. const fnArray = context.fnArray,
  45156. argsArray = context.argsArray;
  45157. const iFirstSave = context.iCurr - 3;
  45158. const pos = (i - iFirstSave) % 4;
  45159. switch (pos) {
  45160. case 0:
  45161. return fnArray[i] === _util.OPS.save;
  45162. case 1:
  45163. if (fnArray[i] !== _util.OPS.transform) {
  45164. return false;
  45165. }
  45166. const iFirstTransform = context.iCurr - 2;
  45167. const firstTransformArg0 = argsArray[iFirstTransform][0];
  45168. const firstTransformArg3 = argsArray[iFirstTransform][3];
  45169. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  45170. return false;
  45171. }
  45172. return true;
  45173. case 2:
  45174. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  45175. return false;
  45176. }
  45177. const iFirstPIXO = context.iCurr - 1;
  45178. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45179. if (argsArray[i][0] !== firstPIXOArg0) {
  45180. return false;
  45181. }
  45182. return true;
  45183. case 3:
  45184. return fnArray[i] === _util.OPS.restore;
  45185. }
  45186. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  45187. }, function (context, i) {
  45188. const MIN_IMAGES_IN_BLOCK = 3;
  45189. const MAX_IMAGES_IN_BLOCK = 1000;
  45190. const fnArray = context.fnArray,
  45191. argsArray = context.argsArray;
  45192. const curr = context.iCurr;
  45193. const iFirstSave = curr - 3;
  45194. const iFirstTransform = curr - 2;
  45195. const iFirstPIXO = curr - 1;
  45196. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45197. const firstTransformArg0 = argsArray[iFirstTransform][0];
  45198. const firstTransformArg3 = argsArray[iFirstTransform][3];
  45199. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  45200. if (count < MIN_IMAGES_IN_BLOCK) {
  45201. return i - (i - iFirstSave) % 4;
  45202. }
  45203. const positions = new Float32Array(count * 2);
  45204. let iTransform = iFirstTransform;
  45205. for (let q = 0; q < count; q++, iTransform += 4) {
  45206. const transformArgs = argsArray[iTransform];
  45207. positions[q << 1] = transformArgs[4];
  45208. positions[(q << 1) + 1] = transformArgs[5];
  45209. }
  45210. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  45211. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  45212. argsArray.splice(iFirstSave, count * 4, args);
  45213. return iFirstSave + 1;
  45214. });
  45215. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  45216. const fnArray = context.fnArray,
  45217. argsArray = context.argsArray;
  45218. const iFirstSave = context.iCurr - 4;
  45219. const pos = (i - iFirstSave) % 5;
  45220. switch (pos) {
  45221. case 0:
  45222. return fnArray[i] === _util.OPS.beginText;
  45223. case 1:
  45224. return fnArray[i] === _util.OPS.setFont;
  45225. case 2:
  45226. return fnArray[i] === _util.OPS.setTextMatrix;
  45227. case 3:
  45228. if (fnArray[i] !== _util.OPS.showText) {
  45229. return false;
  45230. }
  45231. const iFirstSetFont = context.iCurr - 3;
  45232. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45233. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45234. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  45235. return false;
  45236. }
  45237. return true;
  45238. case 4:
  45239. return fnArray[i] === _util.OPS.endText;
  45240. }
  45241. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  45242. }, function (context, i) {
  45243. const MIN_CHARS_IN_BLOCK = 3;
  45244. const MAX_CHARS_IN_BLOCK = 1000;
  45245. const fnArray = context.fnArray,
  45246. argsArray = context.argsArray;
  45247. const curr = context.iCurr;
  45248. const iFirstBeginText = curr - 4;
  45249. const iFirstSetFont = curr - 3;
  45250. const iFirstSetTextMatrix = curr - 2;
  45251. const iFirstShowText = curr - 1;
  45252. const iFirstEndText = curr;
  45253. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45254. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45255. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  45256. if (count < MIN_CHARS_IN_BLOCK) {
  45257. return i - (i - iFirstBeginText) % 5;
  45258. }
  45259. let iFirst = iFirstBeginText;
  45260. 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) {
  45261. count++;
  45262. iFirst -= 5;
  45263. }
  45264. let iEndText = iFirst + 4;
  45265. for (let q = 1; q < count; q++) {
  45266. fnArray.splice(iEndText, 3);
  45267. argsArray.splice(iEndText, 3);
  45268. iEndText += 2;
  45269. }
  45270. return iEndText + 1;
  45271. });
  45272. class NullOptimizer {
  45273. constructor(queue) {
  45274. this.queue = queue;
  45275. }
  45276. _optimize() {}
  45277. push(fn, args) {
  45278. this.queue.fnArray.push(fn);
  45279. this.queue.argsArray.push(args);
  45280. this._optimize();
  45281. }
  45282. flush() {}
  45283. reset() {}
  45284. }
  45285. class QueueOptimizer extends NullOptimizer {
  45286. constructor(queue) {
  45287. super(queue);
  45288. this.state = null;
  45289. this.context = {
  45290. iCurr: 0,
  45291. fnArray: queue.fnArray,
  45292. argsArray: queue.argsArray
  45293. };
  45294. this.match = null;
  45295. this.lastProcessed = 0;
  45296. }
  45297. _optimize() {
  45298. const fnArray = this.queue.fnArray;
  45299. let i = this.lastProcessed,
  45300. ii = fnArray.length;
  45301. let state = this.state;
  45302. let match = this.match;
  45303. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  45304. this.lastProcessed = ii;
  45305. return;
  45306. }
  45307. const context = this.context;
  45308. while (i < ii) {
  45309. if (match) {
  45310. const iterate = (0, match.iterateFn)(context, i);
  45311. if (iterate) {
  45312. i++;
  45313. continue;
  45314. }
  45315. i = (0, match.processFn)(context, i + 1);
  45316. ii = fnArray.length;
  45317. match = null;
  45318. state = null;
  45319. if (i >= ii) {
  45320. break;
  45321. }
  45322. }
  45323. state = (state || InitialState)[fnArray[i]];
  45324. if (!state || Array.isArray(state)) {
  45325. i++;
  45326. continue;
  45327. }
  45328. context.iCurr = i;
  45329. i++;
  45330. if (state.checkFn && !(0, state.checkFn)(context)) {
  45331. state = null;
  45332. continue;
  45333. }
  45334. match = state;
  45335. state = null;
  45336. }
  45337. this.state = state;
  45338. this.match = match;
  45339. this.lastProcessed = i;
  45340. }
  45341. flush() {
  45342. while (this.match) {
  45343. const length = this.queue.fnArray.length;
  45344. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  45345. this.match = null;
  45346. this.state = null;
  45347. this._optimize();
  45348. }
  45349. }
  45350. reset() {
  45351. this.state = null;
  45352. this.match = null;
  45353. this.lastProcessed = 0;
  45354. }
  45355. }
  45356. class OperatorList {
  45357. static get CHUNK_SIZE() {
  45358. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  45359. }
  45360. static get CHUNK_SIZE_ABOUT() {
  45361. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  45362. }
  45363. constructor(intent = 0, streamSink) {
  45364. this._streamSink = streamSink;
  45365. this.fnArray = [];
  45366. this.argsArray = [];
  45367. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  45368. this.optimizer = new QueueOptimizer(this);
  45369. } else {
  45370. this.optimizer = new NullOptimizer(this);
  45371. }
  45372. this.dependencies = new Set();
  45373. this._totalLength = 0;
  45374. this.weight = 0;
  45375. this._resolved = streamSink ? null : Promise.resolve();
  45376. }
  45377. get length() {
  45378. return this.argsArray.length;
  45379. }
  45380. get ready() {
  45381. return this._resolved || this._streamSink.ready;
  45382. }
  45383. get totalLength() {
  45384. return this._totalLength + this.length;
  45385. }
  45386. addOp(fn, args) {
  45387. this.optimizer.push(fn, args);
  45388. this.weight++;
  45389. if (this._streamSink) {
  45390. if (this.weight >= OperatorList.CHUNK_SIZE) {
  45391. this.flush();
  45392. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  45393. this.flush();
  45394. }
  45395. }
  45396. }
  45397. addDependency(dependency) {
  45398. if (this.dependencies.has(dependency)) {
  45399. return;
  45400. }
  45401. this.dependencies.add(dependency);
  45402. this.addOp(_util.OPS.dependency, [dependency]);
  45403. }
  45404. addDependencies(dependencies) {
  45405. for (const dependency of dependencies) {
  45406. this.addDependency(dependency);
  45407. }
  45408. }
  45409. addOpList(opList) {
  45410. if (!(opList instanceof OperatorList)) {
  45411. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  45412. return;
  45413. }
  45414. for (const dependency of opList.dependencies) {
  45415. this.dependencies.add(dependency);
  45416. }
  45417. for (let i = 0, ii = opList.length; i < ii; i++) {
  45418. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  45419. }
  45420. }
  45421. getIR() {
  45422. return {
  45423. fnArray: this.fnArray,
  45424. argsArray: this.argsArray,
  45425. length: this.length
  45426. };
  45427. }
  45428. get _transfers() {
  45429. const transfers = [];
  45430. const {
  45431. fnArray,
  45432. argsArray,
  45433. length
  45434. } = this;
  45435. for (let i = 0; i < length; i++) {
  45436. switch (fnArray[i]) {
  45437. case _util.OPS.paintInlineImageXObject:
  45438. case _util.OPS.paintInlineImageXObjectGroup:
  45439. case _util.OPS.paintImageMaskXObject:
  45440. const arg = argsArray[i][0];
  45441. ;
  45442. if (!arg.cached) {
  45443. transfers.push(arg.data.buffer);
  45444. }
  45445. break;
  45446. }
  45447. }
  45448. return transfers;
  45449. }
  45450. flush(lastChunk = false) {
  45451. this.optimizer.flush();
  45452. const length = this.length;
  45453. this._totalLength += length;
  45454. this._streamSink.enqueue({
  45455. fnArray: this.fnArray,
  45456. argsArray: this.argsArray,
  45457. lastChunk,
  45458. length
  45459. }, 1, this._transfers);
  45460. this.dependencies.clear();
  45461. this.fnArray.length = 0;
  45462. this.argsArray.length = 0;
  45463. this.weight = 0;
  45464. this.optimizer.reset();
  45465. }
  45466. }
  45467. exports.OperatorList = OperatorList;
  45468. /***/ }),
  45469. /* 63 */
  45470. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45471. Object.defineProperty(exports, "__esModule", ({
  45472. value: true
  45473. }));
  45474. exports.PDFImage = void 0;
  45475. var _util = __w_pdfjs_require__(2);
  45476. var _base_stream = __w_pdfjs_require__(9);
  45477. var _colorspace = __w_pdfjs_require__(24);
  45478. var _decode_stream = __w_pdfjs_require__(29);
  45479. var _jpeg_stream = __w_pdfjs_require__(37);
  45480. var _jpx = __w_pdfjs_require__(40);
  45481. var _primitives = __w_pdfjs_require__(5);
  45482. function decodeAndClamp(value, addend, coefficient, max) {
  45483. value = addend + value * coefficient;
  45484. if (value < 0) {
  45485. value = 0;
  45486. } else if (value > max) {
  45487. value = max;
  45488. }
  45489. return value;
  45490. }
  45491. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  45492. const length = w2 * h2;
  45493. let dest;
  45494. if (bpc <= 8) {
  45495. dest = new Uint8Array(length);
  45496. } else if (bpc <= 16) {
  45497. dest = new Uint16Array(length);
  45498. } else {
  45499. dest = new Uint32Array(length);
  45500. }
  45501. const xRatio = w1 / w2;
  45502. const yRatio = h1 / h2;
  45503. let i,
  45504. j,
  45505. py,
  45506. newIndex = 0,
  45507. oldIndex;
  45508. const xScaled = new Uint16Array(w2);
  45509. const w1Scanline = w1;
  45510. for (i = 0; i < w2; i++) {
  45511. xScaled[i] = Math.floor(i * xRatio);
  45512. }
  45513. for (i = 0; i < h2; i++) {
  45514. py = Math.floor(i * yRatio) * w1Scanline;
  45515. for (j = 0; j < w2; j++) {
  45516. oldIndex = py + xScaled[j];
  45517. dest[newIndex++] = src[oldIndex];
  45518. }
  45519. }
  45520. return dest;
  45521. }
  45522. class PDFImage {
  45523. constructor({
  45524. xref,
  45525. res,
  45526. image,
  45527. isInline = false,
  45528. smask = null,
  45529. mask = null,
  45530. isMask = false,
  45531. pdfFunctionFactory,
  45532. localColorSpaceCache
  45533. }) {
  45534. this.image = image;
  45535. const dict = image.dict;
  45536. const filter = dict.get("F", "Filter");
  45537. if (filter instanceof _primitives.Name) {
  45538. switch (filter.name) {
  45539. case "JPXDecode":
  45540. const jpxImage = new _jpx.JpxImage();
  45541. jpxImage.parseImageProperties(image.stream);
  45542. image.stream.reset();
  45543. image.width = jpxImage.width;
  45544. image.height = jpxImage.height;
  45545. image.bitsPerComponent = jpxImage.bitsPerComponent;
  45546. image.numComps = jpxImage.componentsCount;
  45547. break;
  45548. case "JBIG2Decode":
  45549. image.bitsPerComponent = 1;
  45550. image.numComps = 1;
  45551. break;
  45552. }
  45553. }
  45554. let width = dict.get("W", "Width");
  45555. let height = dict.get("H", "Height");
  45556. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  45557. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  45558. width = image.width;
  45559. height = image.height;
  45560. }
  45561. if (width < 1 || height < 1) {
  45562. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  45563. }
  45564. this.width = width;
  45565. this.height = height;
  45566. this.interpolate = dict.get("I", "Interpolate");
  45567. this.imageMask = dict.get("IM", "ImageMask") || false;
  45568. this.matte = dict.get("Matte") || false;
  45569. let bitsPerComponent = image.bitsPerComponent;
  45570. if (!bitsPerComponent) {
  45571. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  45572. if (!bitsPerComponent) {
  45573. if (this.imageMask) {
  45574. bitsPerComponent = 1;
  45575. } else {
  45576. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  45577. }
  45578. }
  45579. }
  45580. this.bpc = bitsPerComponent;
  45581. if (!this.imageMask) {
  45582. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  45583. if (!colorSpace) {
  45584. (0, _util.info)("JPX images (which do not require color spaces)");
  45585. switch (image.numComps) {
  45586. case 1:
  45587. colorSpace = _primitives.Name.get("DeviceGray");
  45588. break;
  45589. case 3:
  45590. colorSpace = _primitives.Name.get("DeviceRGB");
  45591. break;
  45592. case 4:
  45593. colorSpace = _primitives.Name.get("DeviceCMYK");
  45594. break;
  45595. default:
  45596. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  45597. }
  45598. }
  45599. this.colorSpace = _colorspace.ColorSpace.parse({
  45600. cs: colorSpace,
  45601. xref,
  45602. resources: isInline ? res : null,
  45603. pdfFunctionFactory,
  45604. localColorSpaceCache
  45605. });
  45606. this.numComps = this.colorSpace.numComps;
  45607. }
  45608. this.decode = dict.getArray("D", "Decode");
  45609. this.needsDecode = false;
  45610. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  45611. this.needsDecode = true;
  45612. const max = (1 << bitsPerComponent) - 1;
  45613. this.decodeCoefficients = [];
  45614. this.decodeAddends = [];
  45615. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  45616. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  45617. const dmin = this.decode[i];
  45618. const dmax = this.decode[i + 1];
  45619. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  45620. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  45621. }
  45622. }
  45623. if (smask) {
  45624. this.smask = new PDFImage({
  45625. xref,
  45626. res,
  45627. image: smask,
  45628. isInline,
  45629. pdfFunctionFactory,
  45630. localColorSpaceCache
  45631. });
  45632. } else if (mask) {
  45633. if (mask instanceof _base_stream.BaseStream) {
  45634. const maskDict = mask.dict,
  45635. imageMask = maskDict.get("IM", "ImageMask");
  45636. if (!imageMask) {
  45637. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  45638. } else {
  45639. this.mask = new PDFImage({
  45640. xref,
  45641. res,
  45642. image: mask,
  45643. isInline,
  45644. isMask: true,
  45645. pdfFunctionFactory,
  45646. localColorSpaceCache
  45647. });
  45648. }
  45649. } else {
  45650. this.mask = mask;
  45651. }
  45652. }
  45653. }
  45654. static async buildImage({
  45655. xref,
  45656. res,
  45657. image,
  45658. isInline = false,
  45659. pdfFunctionFactory,
  45660. localColorSpaceCache
  45661. }) {
  45662. const imageData = image;
  45663. let smaskData = null;
  45664. let maskData = null;
  45665. const smask = image.dict.get("SMask");
  45666. const mask = image.dict.get("Mask");
  45667. if (smask) {
  45668. smaskData = smask;
  45669. } else if (mask) {
  45670. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  45671. maskData = mask;
  45672. } else {
  45673. (0, _util.warn)("Unsupported mask format.");
  45674. }
  45675. }
  45676. return new PDFImage({
  45677. xref,
  45678. res,
  45679. image: imageData,
  45680. isInline,
  45681. smask: smaskData,
  45682. mask: maskData,
  45683. pdfFunctionFactory,
  45684. localColorSpaceCache
  45685. });
  45686. }
  45687. static createMask({
  45688. imgArray,
  45689. width,
  45690. height,
  45691. imageIsFromDecodeStream,
  45692. inverseDecode,
  45693. interpolate
  45694. }) {
  45695. const computedLength = (width + 7 >> 3) * height;
  45696. const actualLength = imgArray.byteLength;
  45697. const haveFullData = computedLength === actualLength;
  45698. let data, i;
  45699. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  45700. data = imgArray;
  45701. } else if (!inverseDecode) {
  45702. data = new Uint8ClampedArray(actualLength);
  45703. data.set(imgArray);
  45704. } else {
  45705. data = new Uint8ClampedArray(computedLength);
  45706. data.set(imgArray);
  45707. for (i = actualLength; i < computedLength; i++) {
  45708. data[i] = 0xff;
  45709. }
  45710. }
  45711. if (inverseDecode) {
  45712. for (i = 0; i < actualLength; i++) {
  45713. data[i] ^= 0xff;
  45714. }
  45715. }
  45716. return {
  45717. data,
  45718. width,
  45719. height,
  45720. interpolate
  45721. };
  45722. }
  45723. get drawWidth() {
  45724. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  45725. }
  45726. get drawHeight() {
  45727. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  45728. }
  45729. decodeBuffer(buffer) {
  45730. const bpc = this.bpc;
  45731. const numComps = this.numComps;
  45732. const decodeAddends = this.decodeAddends;
  45733. const decodeCoefficients = this.decodeCoefficients;
  45734. const max = (1 << bpc) - 1;
  45735. let i, ii;
  45736. if (bpc === 1) {
  45737. for (i = 0, ii = buffer.length; i < ii; i++) {
  45738. buffer[i] = +!buffer[i];
  45739. }
  45740. return;
  45741. }
  45742. let index = 0;
  45743. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  45744. for (let j = 0; j < numComps; j++) {
  45745. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  45746. index++;
  45747. }
  45748. }
  45749. }
  45750. getComponents(buffer) {
  45751. const bpc = this.bpc;
  45752. if (bpc === 8) {
  45753. return buffer;
  45754. }
  45755. const width = this.width;
  45756. const height = this.height;
  45757. const numComps = this.numComps;
  45758. const length = width * height * numComps;
  45759. let bufferPos = 0;
  45760. let output;
  45761. if (bpc <= 8) {
  45762. output = new Uint8Array(length);
  45763. } else if (bpc <= 16) {
  45764. output = new Uint16Array(length);
  45765. } else {
  45766. output = new Uint32Array(length);
  45767. }
  45768. const rowComps = width * numComps;
  45769. const max = (1 << bpc) - 1;
  45770. let i = 0,
  45771. ii,
  45772. buf;
  45773. if (bpc === 1) {
  45774. let mask, loop1End, loop2End;
  45775. for (let j = 0; j < height; j++) {
  45776. loop1End = i + (rowComps & ~7);
  45777. loop2End = i + rowComps;
  45778. while (i < loop1End) {
  45779. buf = buffer[bufferPos++];
  45780. output[i] = buf >> 7 & 1;
  45781. output[i + 1] = buf >> 6 & 1;
  45782. output[i + 2] = buf >> 5 & 1;
  45783. output[i + 3] = buf >> 4 & 1;
  45784. output[i + 4] = buf >> 3 & 1;
  45785. output[i + 5] = buf >> 2 & 1;
  45786. output[i + 6] = buf >> 1 & 1;
  45787. output[i + 7] = buf & 1;
  45788. i += 8;
  45789. }
  45790. if (i < loop2End) {
  45791. buf = buffer[bufferPos++];
  45792. mask = 128;
  45793. while (i < loop2End) {
  45794. output[i++] = +!!(buf & mask);
  45795. mask >>= 1;
  45796. }
  45797. }
  45798. }
  45799. } else {
  45800. let bits = 0;
  45801. buf = 0;
  45802. for (i = 0, ii = length; i < ii; ++i) {
  45803. if (i % rowComps === 0) {
  45804. buf = 0;
  45805. bits = 0;
  45806. }
  45807. while (bits < bpc) {
  45808. buf = buf << 8 | buffer[bufferPos++];
  45809. bits += 8;
  45810. }
  45811. const remainingBits = bits - bpc;
  45812. let value = buf >> remainingBits;
  45813. if (value < 0) {
  45814. value = 0;
  45815. } else if (value > max) {
  45816. value = max;
  45817. }
  45818. output[i] = value;
  45819. buf &= (1 << remainingBits) - 1;
  45820. bits = remainingBits;
  45821. }
  45822. }
  45823. return output;
  45824. }
  45825. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  45826. const smask = this.smask;
  45827. const mask = this.mask;
  45828. let alphaBuf, sw, sh, i, ii, j;
  45829. if (smask) {
  45830. sw = smask.width;
  45831. sh = smask.height;
  45832. alphaBuf = new Uint8ClampedArray(sw * sh);
  45833. smask.fillGrayBuffer(alphaBuf);
  45834. if (sw !== width || sh !== height) {
  45835. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  45836. }
  45837. } else if (mask) {
  45838. if (mask instanceof PDFImage) {
  45839. sw = mask.width;
  45840. sh = mask.height;
  45841. alphaBuf = new Uint8ClampedArray(sw * sh);
  45842. mask.numComps = 1;
  45843. mask.fillGrayBuffer(alphaBuf);
  45844. for (i = 0, ii = sw * sh; i < ii; ++i) {
  45845. alphaBuf[i] = 255 - alphaBuf[i];
  45846. }
  45847. if (sw !== width || sh !== height) {
  45848. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  45849. }
  45850. } else if (Array.isArray(mask)) {
  45851. alphaBuf = new Uint8ClampedArray(width * height);
  45852. const numComps = this.numComps;
  45853. for (i = 0, ii = width * height; i < ii; ++i) {
  45854. let opacity = 0;
  45855. const imageOffset = i * numComps;
  45856. for (j = 0; j < numComps; ++j) {
  45857. const color = image[imageOffset + j];
  45858. const maskOffset = j * 2;
  45859. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  45860. opacity = 255;
  45861. break;
  45862. }
  45863. }
  45864. alphaBuf[i] = opacity;
  45865. }
  45866. } else {
  45867. throw new _util.FormatError("Unknown mask format.");
  45868. }
  45869. }
  45870. if (alphaBuf) {
  45871. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45872. rgbaBuf[j] = alphaBuf[i];
  45873. }
  45874. } else {
  45875. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45876. rgbaBuf[j] = 255;
  45877. }
  45878. }
  45879. }
  45880. undoPreblend(buffer, width, height) {
  45881. const matte = this.smask && this.smask.matte;
  45882. if (!matte) {
  45883. return;
  45884. }
  45885. const matteRgb = this.colorSpace.getRgb(matte, 0);
  45886. const matteR = matteRgb[0];
  45887. const matteG = matteRgb[1];
  45888. const matteB = matteRgb[2];
  45889. const length = width * height * 4;
  45890. for (let i = 0; i < length; i += 4) {
  45891. const alpha = buffer[i + 3];
  45892. if (alpha === 0) {
  45893. buffer[i] = 255;
  45894. buffer[i + 1] = 255;
  45895. buffer[i + 2] = 255;
  45896. continue;
  45897. }
  45898. const k = 255 / alpha;
  45899. buffer[i] = (buffer[i] - matteR) * k + matteR;
  45900. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  45901. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  45902. }
  45903. }
  45904. createImageData(forceRGBA = false) {
  45905. const drawWidth = this.drawWidth;
  45906. const drawHeight = this.drawHeight;
  45907. const imgData = {
  45908. width: drawWidth,
  45909. height: drawHeight,
  45910. interpolate: this.interpolate,
  45911. kind: 0,
  45912. data: null
  45913. };
  45914. const numComps = this.numComps;
  45915. const originalWidth = this.width;
  45916. const originalHeight = this.height;
  45917. const bpc = this.bpc;
  45918. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  45919. let imgArray;
  45920. if (!forceRGBA) {
  45921. let kind;
  45922. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  45923. kind = _util.ImageKind.GRAYSCALE_1BPP;
  45924. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  45925. kind = _util.ImageKind.RGB_24BPP;
  45926. }
  45927. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  45928. imgData.kind = kind;
  45929. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45930. if (this.image instanceof _decode_stream.DecodeStream) {
  45931. imgData.data = imgArray;
  45932. } else {
  45933. const newArray = new Uint8ClampedArray(imgArray.length);
  45934. newArray.set(imgArray);
  45935. imgData.data = newArray;
  45936. }
  45937. if (this.needsDecode) {
  45938. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  45939. const buffer = imgData.data;
  45940. for (let i = 0, ii = buffer.length; i < ii; i++) {
  45941. buffer[i] ^= 0xff;
  45942. }
  45943. }
  45944. return imgData;
  45945. }
  45946. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  45947. let imageLength = originalHeight * rowBytes;
  45948. switch (this.colorSpace.name) {
  45949. case "DeviceGray":
  45950. imageLength *= 3;
  45951. case "DeviceRGB":
  45952. case "DeviceCMYK":
  45953. imgData.kind = _util.ImageKind.RGB_24BPP;
  45954. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  45955. return imgData;
  45956. }
  45957. }
  45958. }
  45959. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45960. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  45961. const comps = this.getComponents(imgArray);
  45962. let alpha01, maybeUndoPreblend;
  45963. if (!forceRGBA && !this.smask && !this.mask) {
  45964. imgData.kind = _util.ImageKind.RGB_24BPP;
  45965. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  45966. alpha01 = 0;
  45967. maybeUndoPreblend = false;
  45968. } else {
  45969. imgData.kind = _util.ImageKind.RGBA_32BPP;
  45970. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  45971. alpha01 = 1;
  45972. maybeUndoPreblend = true;
  45973. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  45974. }
  45975. if (this.needsDecode) {
  45976. this.decodeBuffer(comps);
  45977. }
  45978. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  45979. if (maybeUndoPreblend) {
  45980. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  45981. }
  45982. return imgData;
  45983. }
  45984. fillGrayBuffer(buffer) {
  45985. const numComps = this.numComps;
  45986. if (numComps !== 1) {
  45987. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  45988. }
  45989. const width = this.width;
  45990. const height = this.height;
  45991. const bpc = this.bpc;
  45992. const rowBytes = width * numComps * bpc + 7 >> 3;
  45993. const imgArray = this.getImageBytes(height * rowBytes);
  45994. const comps = this.getComponents(imgArray);
  45995. let i, length;
  45996. if (bpc === 1) {
  45997. length = width * height;
  45998. if (this.needsDecode) {
  45999. for (i = 0; i < length; ++i) {
  46000. buffer[i] = comps[i] - 1 & 255;
  46001. }
  46002. } else {
  46003. for (i = 0; i < length; ++i) {
  46004. buffer[i] = -comps[i] & 255;
  46005. }
  46006. }
  46007. return;
  46008. }
  46009. if (this.needsDecode) {
  46010. this.decodeBuffer(comps);
  46011. }
  46012. length = width * height;
  46013. const scale = 255 / ((1 << bpc) - 1);
  46014. for (i = 0; i < length; ++i) {
  46015. buffer[i] = scale * comps[i];
  46016. }
  46017. }
  46018. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  46019. this.image.reset();
  46020. this.image.drawWidth = drawWidth || this.width;
  46021. this.image.drawHeight = drawHeight || this.height;
  46022. this.image.forceRGB = !!forceRGB;
  46023. return this.image.getBytes(length, true);
  46024. }
  46025. }
  46026. exports.PDFImage = PDFImage;
  46027. /***/ }),
  46028. /* 64 */
  46029. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46030. Object.defineProperty(exports, "__esModule", ({
  46031. value: true
  46032. }));
  46033. exports.Catalog = void 0;
  46034. var _core_utils = __w_pdfjs_require__(8);
  46035. var _util = __w_pdfjs_require__(2);
  46036. var _primitives = __w_pdfjs_require__(5);
  46037. var _name_number_tree = __w_pdfjs_require__(65);
  46038. var _base_stream = __w_pdfjs_require__(9);
  46039. var _cleanup_helper = __w_pdfjs_require__(66);
  46040. var _colorspace = __w_pdfjs_require__(24);
  46041. var _file_spec = __w_pdfjs_require__(67);
  46042. var _image_utils = __w_pdfjs_require__(59);
  46043. var _metadata_parser = __w_pdfjs_require__(68);
  46044. var _struct_tree = __w_pdfjs_require__(70);
  46045. function fetchDestination(dest) {
  46046. if (dest instanceof _primitives.Dict) {
  46047. dest = dest.get("D");
  46048. }
  46049. return Array.isArray(dest) ? dest : null;
  46050. }
  46051. class Catalog {
  46052. constructor(pdfManager, xref) {
  46053. this.pdfManager = pdfManager;
  46054. this.xref = xref;
  46055. this._catDict = xref.getCatalogObj();
  46056. if (!(this._catDict instanceof _primitives.Dict)) {
  46057. throw new _util.FormatError("Catalog object is not a dictionary.");
  46058. }
  46059. this.toplevelPagesDict;
  46060. this._actualNumPages = null;
  46061. this.fontCache = new _primitives.RefSetCache();
  46062. this.builtInCMapCache = new Map();
  46063. this.standardFontDataCache = new Map();
  46064. this.globalImageCache = new _image_utils.GlobalImageCache();
  46065. this.pageKidsCountCache = new _primitives.RefSetCache();
  46066. this.pageIndexCache = new _primitives.RefSetCache();
  46067. this.nonBlendModesSet = new _primitives.RefSet();
  46068. }
  46069. get version() {
  46070. const version = this._catDict.get("Version");
  46071. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  46072. }
  46073. get lang() {
  46074. const lang = this._catDict.get("Lang");
  46075. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  46076. }
  46077. get needsRendering() {
  46078. const needsRendering = this._catDict.get("NeedsRendering");
  46079. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  46080. }
  46081. get collection() {
  46082. let collection = null;
  46083. try {
  46084. const obj = this._catDict.get("Collection");
  46085. if (obj instanceof _primitives.Dict && obj.size > 0) {
  46086. collection = obj;
  46087. }
  46088. } catch (ex) {
  46089. if (ex instanceof _core_utils.MissingDataException) {
  46090. throw ex;
  46091. }
  46092. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  46093. }
  46094. return (0, _util.shadow)(this, "collection", collection);
  46095. }
  46096. get acroForm() {
  46097. let acroForm = null;
  46098. try {
  46099. const obj = this._catDict.get("AcroForm");
  46100. if (obj instanceof _primitives.Dict && obj.size > 0) {
  46101. acroForm = obj;
  46102. }
  46103. } catch (ex) {
  46104. if (ex instanceof _core_utils.MissingDataException) {
  46105. throw ex;
  46106. }
  46107. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  46108. }
  46109. return (0, _util.shadow)(this, "acroForm", acroForm);
  46110. }
  46111. get acroFormRef() {
  46112. const value = this._catDict.getRaw("AcroForm");
  46113. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  46114. }
  46115. get metadata() {
  46116. const streamRef = this._catDict.getRaw("Metadata");
  46117. if (!(streamRef instanceof _primitives.Ref)) {
  46118. return (0, _util.shadow)(this, "metadata", null);
  46119. }
  46120. let metadata = null;
  46121. try {
  46122. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  46123. const stream = this.xref.fetch(streamRef, suppressEncryption);
  46124. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  46125. const type = stream.dict.get("Type");
  46126. const subtype = stream.dict.get("Subtype");
  46127. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  46128. const data = (0, _util.stringToUTF8String)(stream.getString());
  46129. if (data) {
  46130. metadata = new _metadata_parser.MetadataParser(data).serializable;
  46131. }
  46132. }
  46133. }
  46134. } catch (ex) {
  46135. if (ex instanceof _core_utils.MissingDataException) {
  46136. throw ex;
  46137. }
  46138. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  46139. }
  46140. return (0, _util.shadow)(this, "metadata", metadata);
  46141. }
  46142. get markInfo() {
  46143. let markInfo = null;
  46144. try {
  46145. markInfo = this._readMarkInfo();
  46146. } catch (ex) {
  46147. if (ex instanceof _core_utils.MissingDataException) {
  46148. throw ex;
  46149. }
  46150. (0, _util.warn)("Unable to read mark info.");
  46151. }
  46152. return (0, _util.shadow)(this, "markInfo", markInfo);
  46153. }
  46154. _readMarkInfo() {
  46155. const obj = this._catDict.get("MarkInfo");
  46156. if (!(obj instanceof _primitives.Dict)) {
  46157. return null;
  46158. }
  46159. const markInfo = Object.assign(Object.create(null), {
  46160. Marked: false,
  46161. UserProperties: false,
  46162. Suspects: false
  46163. });
  46164. for (const key in markInfo) {
  46165. if (!obj.has(key)) {
  46166. continue;
  46167. }
  46168. const value = obj.get(key);
  46169. if (typeof value !== "boolean") {
  46170. continue;
  46171. }
  46172. markInfo[key] = value;
  46173. }
  46174. return markInfo;
  46175. }
  46176. get structTreeRoot() {
  46177. let structTree = null;
  46178. try {
  46179. structTree = this._readStructTreeRoot();
  46180. } catch (ex) {
  46181. if (ex instanceof _core_utils.MissingDataException) {
  46182. throw ex;
  46183. }
  46184. (0, _util.warn)("Unable read to structTreeRoot info.");
  46185. }
  46186. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  46187. }
  46188. _readStructTreeRoot() {
  46189. const obj = this._catDict.get("StructTreeRoot");
  46190. if (!(obj instanceof _primitives.Dict)) {
  46191. return null;
  46192. }
  46193. const root = new _struct_tree.StructTreeRoot(obj);
  46194. root.init();
  46195. return root;
  46196. }
  46197. get toplevelPagesDict() {
  46198. const pagesObj = this._catDict.get("Pages");
  46199. if (!(pagesObj instanceof _primitives.Dict)) {
  46200. throw new _util.FormatError("Invalid top-level pages dictionary.");
  46201. }
  46202. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  46203. }
  46204. get documentOutline() {
  46205. let obj = null;
  46206. try {
  46207. obj = this._readDocumentOutline();
  46208. } catch (ex) {
  46209. if (ex instanceof _core_utils.MissingDataException) {
  46210. throw ex;
  46211. }
  46212. (0, _util.warn)("Unable to read document outline.");
  46213. }
  46214. return (0, _util.shadow)(this, "documentOutline", obj);
  46215. }
  46216. _readDocumentOutline() {
  46217. let obj = this._catDict.get("Outlines");
  46218. if (!(obj instanceof _primitives.Dict)) {
  46219. return null;
  46220. }
  46221. obj = obj.getRaw("First");
  46222. if (!(obj instanceof _primitives.Ref)) {
  46223. return null;
  46224. }
  46225. const root = {
  46226. items: []
  46227. };
  46228. const queue = [{
  46229. obj,
  46230. parent: root
  46231. }];
  46232. const processed = new _primitives.RefSet();
  46233. processed.put(obj);
  46234. const xref = this.xref,
  46235. blackColor = new Uint8ClampedArray(3);
  46236. while (queue.length > 0) {
  46237. const i = queue.shift();
  46238. const outlineDict = xref.fetchIfRef(i.obj);
  46239. if (outlineDict === null) {
  46240. continue;
  46241. }
  46242. if (!outlineDict.has("Title")) {
  46243. throw new _util.FormatError("Invalid outline item encountered.");
  46244. }
  46245. const data = {
  46246. url: null,
  46247. dest: null
  46248. };
  46249. Catalog.parseDestDictionary({
  46250. destDict: outlineDict,
  46251. resultObj: data,
  46252. docBaseUrl: this.pdfManager.docBaseUrl
  46253. });
  46254. const title = outlineDict.get("Title");
  46255. const flags = outlineDict.get("F") || 0;
  46256. const color = outlineDict.getArray("C");
  46257. const count = outlineDict.get("Count");
  46258. let rgbColor = blackColor;
  46259. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  46260. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  46261. }
  46262. const outlineItem = {
  46263. dest: data.dest,
  46264. url: data.url,
  46265. unsafeUrl: data.unsafeUrl,
  46266. newWindow: data.newWindow,
  46267. title: (0, _util.stringToPDFString)(title),
  46268. color: rgbColor,
  46269. count: Number.isInteger(count) ? count : undefined,
  46270. bold: !!(flags & 2),
  46271. italic: !!(flags & 1),
  46272. items: []
  46273. };
  46274. i.parent.items.push(outlineItem);
  46275. obj = outlineDict.getRaw("First");
  46276. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  46277. queue.push({
  46278. obj,
  46279. parent: outlineItem
  46280. });
  46281. processed.put(obj);
  46282. }
  46283. obj = outlineDict.getRaw("Next");
  46284. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  46285. queue.push({
  46286. obj,
  46287. parent: i.parent
  46288. });
  46289. processed.put(obj);
  46290. }
  46291. }
  46292. return root.items.length > 0 ? root.items : null;
  46293. }
  46294. get permissions() {
  46295. let permissions = null;
  46296. try {
  46297. permissions = this._readPermissions();
  46298. } catch (ex) {
  46299. if (ex instanceof _core_utils.MissingDataException) {
  46300. throw ex;
  46301. }
  46302. (0, _util.warn)("Unable to read permissions.");
  46303. }
  46304. return (0, _util.shadow)(this, "permissions", permissions);
  46305. }
  46306. _readPermissions() {
  46307. const encrypt = this.xref.trailer.get("Encrypt");
  46308. if (!(encrypt instanceof _primitives.Dict)) {
  46309. return null;
  46310. }
  46311. let flags = encrypt.get("P");
  46312. if (typeof flags !== "number") {
  46313. return null;
  46314. }
  46315. flags += 2 ** 32;
  46316. const permissions = [];
  46317. for (const key in _util.PermissionFlag) {
  46318. const value = _util.PermissionFlag[key];
  46319. if (flags & value) {
  46320. permissions.push(value);
  46321. }
  46322. }
  46323. return permissions;
  46324. }
  46325. get optionalContentConfig() {
  46326. let config = null;
  46327. try {
  46328. const properties = this._catDict.get("OCProperties");
  46329. if (!properties) {
  46330. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46331. }
  46332. const defaultConfig = properties.get("D");
  46333. if (!defaultConfig) {
  46334. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46335. }
  46336. const groupsData = properties.get("OCGs");
  46337. if (!Array.isArray(groupsData)) {
  46338. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46339. }
  46340. const groups = [];
  46341. const groupRefs = [];
  46342. for (const groupRef of groupsData) {
  46343. if (!(groupRef instanceof _primitives.Ref)) {
  46344. continue;
  46345. }
  46346. groupRefs.push(groupRef);
  46347. const group = this.xref.fetchIfRef(groupRef);
  46348. groups.push({
  46349. id: groupRef.toString(),
  46350. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  46351. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  46352. });
  46353. }
  46354. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  46355. config.groups = groups;
  46356. } catch (ex) {
  46357. if (ex instanceof _core_utils.MissingDataException) {
  46358. throw ex;
  46359. }
  46360. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  46361. }
  46362. return (0, _util.shadow)(this, "optionalContentConfig", config);
  46363. }
  46364. _readOptionalContentConfig(config, contentGroupRefs) {
  46365. function parseOnOff(refs) {
  46366. const onParsed = [];
  46367. if (Array.isArray(refs)) {
  46368. for (const value of refs) {
  46369. if (!(value instanceof _primitives.Ref)) {
  46370. continue;
  46371. }
  46372. if (contentGroupRefs.includes(value)) {
  46373. onParsed.push(value.toString());
  46374. }
  46375. }
  46376. }
  46377. return onParsed;
  46378. }
  46379. function parseOrder(refs, nestedLevels = 0) {
  46380. if (!Array.isArray(refs)) {
  46381. return null;
  46382. }
  46383. const order = [];
  46384. for (const value of refs) {
  46385. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  46386. parsedOrderRefs.put(value);
  46387. order.push(value.toString());
  46388. continue;
  46389. }
  46390. const nestedOrder = parseNestedOrder(value, nestedLevels);
  46391. if (nestedOrder) {
  46392. order.push(nestedOrder);
  46393. }
  46394. }
  46395. if (nestedLevels > 0) {
  46396. return order;
  46397. }
  46398. const hiddenGroups = [];
  46399. for (const groupRef of contentGroupRefs) {
  46400. if (parsedOrderRefs.has(groupRef)) {
  46401. continue;
  46402. }
  46403. hiddenGroups.push(groupRef.toString());
  46404. }
  46405. if (hiddenGroups.length) {
  46406. order.push({
  46407. name: null,
  46408. order: hiddenGroups
  46409. });
  46410. }
  46411. return order;
  46412. }
  46413. function parseNestedOrder(ref, nestedLevels) {
  46414. if (++nestedLevels > MAX_NESTED_LEVELS) {
  46415. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  46416. return null;
  46417. }
  46418. const value = xref.fetchIfRef(ref);
  46419. if (!Array.isArray(value)) {
  46420. return null;
  46421. }
  46422. const nestedName = xref.fetchIfRef(value[0]);
  46423. if (typeof nestedName !== "string") {
  46424. return null;
  46425. }
  46426. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  46427. if (!nestedOrder || !nestedOrder.length) {
  46428. return null;
  46429. }
  46430. return {
  46431. name: (0, _util.stringToPDFString)(nestedName),
  46432. order: nestedOrder
  46433. };
  46434. }
  46435. const xref = this.xref,
  46436. parsedOrderRefs = new _primitives.RefSet(),
  46437. MAX_NESTED_LEVELS = 10;
  46438. return {
  46439. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  46440. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  46441. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  46442. on: parseOnOff(config.get("ON")),
  46443. off: parseOnOff(config.get("OFF")),
  46444. order: parseOrder(config.get("Order")),
  46445. groups: null
  46446. };
  46447. }
  46448. setActualNumPages(num = null) {
  46449. this._actualNumPages = num;
  46450. }
  46451. get hasActualNumPages() {
  46452. return this._actualNumPages !== null;
  46453. }
  46454. get _pagesCount() {
  46455. const obj = this.toplevelPagesDict.get("Count");
  46456. if (!Number.isInteger(obj)) {
  46457. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  46458. }
  46459. return (0, _util.shadow)(this, "_pagesCount", obj);
  46460. }
  46461. get numPages() {
  46462. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  46463. }
  46464. get destinations() {
  46465. const obj = this._readDests(),
  46466. dests = Object.create(null);
  46467. if (obj instanceof _name_number_tree.NameTree) {
  46468. for (const [key, value] of obj.getAll()) {
  46469. const dest = fetchDestination(value);
  46470. if (dest) {
  46471. dests[key] = dest;
  46472. }
  46473. }
  46474. } else if (obj instanceof _primitives.Dict) {
  46475. obj.forEach(function (key, value) {
  46476. const dest = fetchDestination(value);
  46477. if (dest) {
  46478. dests[key] = dest;
  46479. }
  46480. });
  46481. }
  46482. return (0, _util.shadow)(this, "destinations", dests);
  46483. }
  46484. getDestination(id) {
  46485. const obj = this._readDests();
  46486. if (obj instanceof _name_number_tree.NameTree) {
  46487. const dest = fetchDestination(obj.get(id));
  46488. if (dest) {
  46489. return dest;
  46490. }
  46491. const allDest = this.destinations[id];
  46492. if (allDest) {
  46493. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  46494. return allDest;
  46495. }
  46496. } else if (obj instanceof _primitives.Dict) {
  46497. const dest = fetchDestination(obj.get(id));
  46498. if (dest) {
  46499. return dest;
  46500. }
  46501. }
  46502. return null;
  46503. }
  46504. _readDests() {
  46505. const obj = this._catDict.get("Names");
  46506. if (obj && obj.has("Dests")) {
  46507. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  46508. } else if (this._catDict.has("Dests")) {
  46509. return this._catDict.get("Dests");
  46510. }
  46511. return undefined;
  46512. }
  46513. get pageLabels() {
  46514. let obj = null;
  46515. try {
  46516. obj = this._readPageLabels();
  46517. } catch (ex) {
  46518. if (ex instanceof _core_utils.MissingDataException) {
  46519. throw ex;
  46520. }
  46521. (0, _util.warn)("Unable to read page labels.");
  46522. }
  46523. return (0, _util.shadow)(this, "pageLabels", obj);
  46524. }
  46525. _readPageLabels() {
  46526. const obj = this._catDict.getRaw("PageLabels");
  46527. if (!obj) {
  46528. return null;
  46529. }
  46530. const pageLabels = new Array(this.numPages);
  46531. let style = null,
  46532. prefix = "";
  46533. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  46534. const nums = numberTree.getAll();
  46535. let currentLabel = "",
  46536. currentIndex = 1;
  46537. for (let i = 0, ii = this.numPages; i < ii; i++) {
  46538. const labelDict = nums.get(i);
  46539. if (labelDict !== undefined) {
  46540. if (!(labelDict instanceof _primitives.Dict)) {
  46541. throw new _util.FormatError("PageLabel is not a dictionary.");
  46542. }
  46543. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  46544. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  46545. }
  46546. if (labelDict.has("S")) {
  46547. const s = labelDict.get("S");
  46548. if (!(s instanceof _primitives.Name)) {
  46549. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  46550. }
  46551. style = s.name;
  46552. } else {
  46553. style = null;
  46554. }
  46555. if (labelDict.has("P")) {
  46556. const p = labelDict.get("P");
  46557. if (typeof p !== "string") {
  46558. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  46559. }
  46560. prefix = (0, _util.stringToPDFString)(p);
  46561. } else {
  46562. prefix = "";
  46563. }
  46564. if (labelDict.has("St")) {
  46565. const st = labelDict.get("St");
  46566. if (!(Number.isInteger(st) && st >= 1)) {
  46567. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  46568. }
  46569. currentIndex = st;
  46570. } else {
  46571. currentIndex = 1;
  46572. }
  46573. }
  46574. switch (style) {
  46575. case "D":
  46576. currentLabel = currentIndex;
  46577. break;
  46578. case "R":
  46579. case "r":
  46580. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  46581. break;
  46582. case "A":
  46583. case "a":
  46584. const LIMIT = 26;
  46585. const A_UPPER_CASE = 0x41,
  46586. A_LOWER_CASE = 0x61;
  46587. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  46588. const letterIndex = currentIndex - 1;
  46589. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  46590. const charBuf = [];
  46591. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  46592. charBuf.push(character);
  46593. }
  46594. currentLabel = charBuf.join("");
  46595. break;
  46596. default:
  46597. if (style) {
  46598. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  46599. }
  46600. currentLabel = "";
  46601. }
  46602. pageLabels[i] = prefix + currentLabel;
  46603. currentIndex++;
  46604. }
  46605. return pageLabels;
  46606. }
  46607. get pageLayout() {
  46608. const obj = this._catDict.get("PageLayout");
  46609. let pageLayout = "";
  46610. if (obj instanceof _primitives.Name) {
  46611. switch (obj.name) {
  46612. case "SinglePage":
  46613. case "OneColumn":
  46614. case "TwoColumnLeft":
  46615. case "TwoColumnRight":
  46616. case "TwoPageLeft":
  46617. case "TwoPageRight":
  46618. pageLayout = obj.name;
  46619. }
  46620. }
  46621. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  46622. }
  46623. get pageMode() {
  46624. const obj = this._catDict.get("PageMode");
  46625. let pageMode = "UseNone";
  46626. if (obj instanceof _primitives.Name) {
  46627. switch (obj.name) {
  46628. case "UseNone":
  46629. case "UseOutlines":
  46630. case "UseThumbs":
  46631. case "FullScreen":
  46632. case "UseOC":
  46633. case "UseAttachments":
  46634. pageMode = obj.name;
  46635. }
  46636. }
  46637. return (0, _util.shadow)(this, "pageMode", pageMode);
  46638. }
  46639. get viewerPreferences() {
  46640. const obj = this._catDict.get("ViewerPreferences");
  46641. if (!(obj instanceof _primitives.Dict)) {
  46642. return (0, _util.shadow)(this, "viewerPreferences", null);
  46643. }
  46644. let prefs = null;
  46645. for (const key of obj.getKeys()) {
  46646. const value = obj.get(key);
  46647. let prefValue;
  46648. switch (key) {
  46649. case "HideToolbar":
  46650. case "HideMenubar":
  46651. case "HideWindowUI":
  46652. case "FitWindow":
  46653. case "CenterWindow":
  46654. case "DisplayDocTitle":
  46655. case "PickTrayByPDFSize":
  46656. if (typeof value === "boolean") {
  46657. prefValue = value;
  46658. }
  46659. break;
  46660. case "NonFullScreenPageMode":
  46661. if (value instanceof _primitives.Name) {
  46662. switch (value.name) {
  46663. case "UseNone":
  46664. case "UseOutlines":
  46665. case "UseThumbs":
  46666. case "UseOC":
  46667. prefValue = value.name;
  46668. break;
  46669. default:
  46670. prefValue = "UseNone";
  46671. }
  46672. }
  46673. break;
  46674. case "Direction":
  46675. if (value instanceof _primitives.Name) {
  46676. switch (value.name) {
  46677. case "L2R":
  46678. case "R2L":
  46679. prefValue = value.name;
  46680. break;
  46681. default:
  46682. prefValue = "L2R";
  46683. }
  46684. }
  46685. break;
  46686. case "ViewArea":
  46687. case "ViewClip":
  46688. case "PrintArea":
  46689. case "PrintClip":
  46690. if (value instanceof _primitives.Name) {
  46691. switch (value.name) {
  46692. case "MediaBox":
  46693. case "CropBox":
  46694. case "BleedBox":
  46695. case "TrimBox":
  46696. case "ArtBox":
  46697. prefValue = value.name;
  46698. break;
  46699. default:
  46700. prefValue = "CropBox";
  46701. }
  46702. }
  46703. break;
  46704. case "PrintScaling":
  46705. if (value instanceof _primitives.Name) {
  46706. switch (value.name) {
  46707. case "None":
  46708. case "AppDefault":
  46709. prefValue = value.name;
  46710. break;
  46711. default:
  46712. prefValue = "AppDefault";
  46713. }
  46714. }
  46715. break;
  46716. case "Duplex":
  46717. if (value instanceof _primitives.Name) {
  46718. switch (value.name) {
  46719. case "Simplex":
  46720. case "DuplexFlipShortEdge":
  46721. case "DuplexFlipLongEdge":
  46722. prefValue = value.name;
  46723. break;
  46724. default:
  46725. prefValue = "None";
  46726. }
  46727. }
  46728. break;
  46729. case "PrintPageRange":
  46730. if (Array.isArray(value) && value.length % 2 === 0) {
  46731. const isValid = value.every((page, i, arr) => {
  46732. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  46733. });
  46734. if (isValid) {
  46735. prefValue = value;
  46736. }
  46737. }
  46738. break;
  46739. case "NumCopies":
  46740. if (Number.isInteger(value) && value > 0) {
  46741. prefValue = value;
  46742. }
  46743. break;
  46744. default:
  46745. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  46746. continue;
  46747. }
  46748. if (prefValue === undefined) {
  46749. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  46750. continue;
  46751. }
  46752. if (!prefs) {
  46753. prefs = Object.create(null);
  46754. }
  46755. prefs[key] = prefValue;
  46756. }
  46757. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  46758. }
  46759. get openAction() {
  46760. const obj = this._catDict.get("OpenAction");
  46761. const openAction = Object.create(null);
  46762. if (obj instanceof _primitives.Dict) {
  46763. const destDict = new _primitives.Dict(this.xref);
  46764. destDict.set("A", obj);
  46765. const resultObj = {
  46766. url: null,
  46767. dest: null,
  46768. action: null
  46769. };
  46770. Catalog.parseDestDictionary({
  46771. destDict,
  46772. resultObj
  46773. });
  46774. if (Array.isArray(resultObj.dest)) {
  46775. openAction.dest = resultObj.dest;
  46776. } else if (resultObj.action) {
  46777. openAction.action = resultObj.action;
  46778. }
  46779. } else if (Array.isArray(obj)) {
  46780. openAction.dest = obj;
  46781. }
  46782. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  46783. }
  46784. get attachments() {
  46785. const obj = this._catDict.get("Names");
  46786. let attachments = null;
  46787. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  46788. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  46789. for (const [key, value] of nameTree.getAll()) {
  46790. const fs = new _file_spec.FileSpec(value, this.xref);
  46791. if (!attachments) {
  46792. attachments = Object.create(null);
  46793. }
  46794. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  46795. }
  46796. }
  46797. return (0, _util.shadow)(this, "attachments", attachments);
  46798. }
  46799. get xfaImages() {
  46800. const obj = this._catDict.get("Names");
  46801. let xfaImages = null;
  46802. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  46803. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  46804. for (const [key, value] of nameTree.getAll()) {
  46805. if (!xfaImages) {
  46806. xfaImages = new _primitives.Dict(this.xref);
  46807. }
  46808. xfaImages.set(key, value);
  46809. }
  46810. }
  46811. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  46812. }
  46813. _collectJavaScript() {
  46814. const obj = this._catDict.get("Names");
  46815. let javaScript = null;
  46816. function appendIfJavaScriptDict(name, jsDict) {
  46817. if (!(jsDict instanceof _primitives.Dict)) {
  46818. return;
  46819. }
  46820. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  46821. return;
  46822. }
  46823. let js = jsDict.get("JS");
  46824. if (js instanceof _base_stream.BaseStream) {
  46825. js = js.getString();
  46826. } else if (typeof js !== "string") {
  46827. return;
  46828. }
  46829. if (javaScript === null) {
  46830. javaScript = new Map();
  46831. }
  46832. javaScript.set(name, (0, _util.stringToPDFString)(js));
  46833. }
  46834. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  46835. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  46836. for (const [key, value] of nameTree.getAll()) {
  46837. appendIfJavaScriptDict(key, value);
  46838. }
  46839. }
  46840. const openAction = this._catDict.get("OpenAction");
  46841. if (openAction) {
  46842. appendIfJavaScriptDict("OpenAction", openAction);
  46843. }
  46844. return javaScript;
  46845. }
  46846. get javaScript() {
  46847. const javaScript = this._collectJavaScript();
  46848. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  46849. }
  46850. get jsActions() {
  46851. const javaScript = this._collectJavaScript();
  46852. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  46853. if (javaScript) {
  46854. if (!actions) {
  46855. actions = Object.create(null);
  46856. }
  46857. for (const [key, val] of javaScript) {
  46858. if (key in actions) {
  46859. actions[key].push(val);
  46860. } else {
  46861. actions[key] = [val];
  46862. }
  46863. }
  46864. }
  46865. return (0, _util.shadow)(this, "jsActions", actions);
  46866. }
  46867. fontFallback(id, handler) {
  46868. const promises = [];
  46869. this.fontCache.forEach(function (promise) {
  46870. promises.push(promise);
  46871. });
  46872. return Promise.all(promises).then(translatedFonts => {
  46873. for (const translatedFont of translatedFonts) {
  46874. if (translatedFont.loadedName === id) {
  46875. translatedFont.fallback(handler);
  46876. return;
  46877. }
  46878. }
  46879. });
  46880. }
  46881. cleanup(manuallyTriggered = false) {
  46882. (0, _cleanup_helper.clearGlobalCaches)();
  46883. this.globalImageCache.clear(manuallyTriggered);
  46884. this.pageKidsCountCache.clear();
  46885. this.pageIndexCache.clear();
  46886. this.nonBlendModesSet.clear();
  46887. const promises = [];
  46888. this.fontCache.forEach(function (promise) {
  46889. promises.push(promise);
  46890. });
  46891. return Promise.all(promises).then(translatedFonts => {
  46892. for (const {
  46893. dict
  46894. } of translatedFonts) {
  46895. delete dict.cacheKey;
  46896. }
  46897. this.fontCache.clear();
  46898. this.builtInCMapCache.clear();
  46899. this.standardFontDataCache.clear();
  46900. });
  46901. }
  46902. async getPageDict(pageIndex) {
  46903. const nodesToVisit = [this.toplevelPagesDict];
  46904. const visitedNodes = new _primitives.RefSet();
  46905. const pagesRef = this._catDict.getRaw("Pages");
  46906. if (pagesRef instanceof _primitives.Ref) {
  46907. visitedNodes.put(pagesRef);
  46908. }
  46909. const xref = this.xref,
  46910. pageKidsCountCache = this.pageKidsCountCache,
  46911. pageIndexCache = this.pageIndexCache;
  46912. let currentPageIndex = 0;
  46913. while (nodesToVisit.length) {
  46914. const currentNode = nodesToVisit.pop();
  46915. if (currentNode instanceof _primitives.Ref) {
  46916. const count = pageKidsCountCache.get(currentNode);
  46917. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  46918. currentPageIndex += count;
  46919. continue;
  46920. }
  46921. if (visitedNodes.has(currentNode)) {
  46922. throw new _util.FormatError("Pages tree contains circular reference.");
  46923. }
  46924. visitedNodes.put(currentNode);
  46925. const obj = await xref.fetchAsync(currentNode);
  46926. if (obj instanceof _primitives.Dict) {
  46927. let type = obj.getRaw("Type");
  46928. if (type instanceof _primitives.Ref) {
  46929. type = await xref.fetchAsync(type);
  46930. }
  46931. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  46932. if (!pageKidsCountCache.has(currentNode)) {
  46933. pageKidsCountCache.put(currentNode, 1);
  46934. }
  46935. if (!pageIndexCache.has(currentNode)) {
  46936. pageIndexCache.put(currentNode, currentPageIndex);
  46937. }
  46938. if (currentPageIndex === pageIndex) {
  46939. return [obj, currentNode];
  46940. }
  46941. currentPageIndex++;
  46942. continue;
  46943. }
  46944. }
  46945. nodesToVisit.push(obj);
  46946. continue;
  46947. }
  46948. if (!(currentNode instanceof _primitives.Dict)) {
  46949. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  46950. }
  46951. const {
  46952. objId
  46953. } = currentNode;
  46954. let count = currentNode.getRaw("Count");
  46955. if (count instanceof _primitives.Ref) {
  46956. count = await xref.fetchAsync(count);
  46957. }
  46958. if (Number.isInteger(count) && count >= 0) {
  46959. if (objId && !pageKidsCountCache.has(objId)) {
  46960. pageKidsCountCache.put(objId, count);
  46961. }
  46962. if (currentPageIndex + count <= pageIndex) {
  46963. currentPageIndex += count;
  46964. continue;
  46965. }
  46966. }
  46967. let kids = currentNode.getRaw("Kids");
  46968. if (kids instanceof _primitives.Ref) {
  46969. kids = await xref.fetchAsync(kids);
  46970. }
  46971. if (!Array.isArray(kids)) {
  46972. let type = currentNode.getRaw("Type");
  46973. if (type instanceof _primitives.Ref) {
  46974. type = await xref.fetchAsync(type);
  46975. }
  46976. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  46977. if (currentPageIndex === pageIndex) {
  46978. return [currentNode, null];
  46979. }
  46980. currentPageIndex++;
  46981. continue;
  46982. }
  46983. throw new _util.FormatError("Page dictionary kids object is not an array.");
  46984. }
  46985. for (let last = kids.length - 1; last >= 0; last--) {
  46986. nodesToVisit.push(kids[last]);
  46987. }
  46988. }
  46989. throw new Error(`Page index ${pageIndex} not found.`);
  46990. }
  46991. async getAllPageDicts(recoveryMode = false) {
  46992. const queue = [{
  46993. currentNode: this.toplevelPagesDict,
  46994. posInKids: 0
  46995. }];
  46996. const visitedNodes = new _primitives.RefSet();
  46997. const pagesRef = this._catDict.getRaw("Pages");
  46998. if (pagesRef instanceof _primitives.Ref) {
  46999. visitedNodes.put(pagesRef);
  47000. }
  47001. const map = new Map(),
  47002. xref = this.xref,
  47003. pageIndexCache = this.pageIndexCache;
  47004. let pageIndex = 0;
  47005. function addPageDict(pageDict, pageRef) {
  47006. if (pageRef && !pageIndexCache.has(pageRef)) {
  47007. pageIndexCache.put(pageRef, pageIndex);
  47008. }
  47009. map.set(pageIndex++, [pageDict, pageRef]);
  47010. }
  47011. function addPageError(error) {
  47012. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  47013. throw error;
  47014. }
  47015. map.set(pageIndex++, [error, null]);
  47016. }
  47017. while (queue.length > 0) {
  47018. const queueItem = queue[queue.length - 1];
  47019. const {
  47020. currentNode,
  47021. posInKids
  47022. } = queueItem;
  47023. let kids = currentNode.getRaw("Kids");
  47024. if (kids instanceof _primitives.Ref) {
  47025. try {
  47026. kids = await xref.fetchAsync(kids);
  47027. } catch (ex) {
  47028. addPageError(ex);
  47029. break;
  47030. }
  47031. }
  47032. if (!Array.isArray(kids)) {
  47033. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  47034. break;
  47035. }
  47036. if (posInKids >= kids.length) {
  47037. queue.pop();
  47038. continue;
  47039. }
  47040. const kidObj = kids[posInKids];
  47041. let obj;
  47042. if (kidObj instanceof _primitives.Ref) {
  47043. if (visitedNodes.has(kidObj)) {
  47044. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  47045. break;
  47046. }
  47047. visitedNodes.put(kidObj);
  47048. try {
  47049. obj = await xref.fetchAsync(kidObj);
  47050. } catch (ex) {
  47051. addPageError(ex);
  47052. break;
  47053. }
  47054. } else {
  47055. obj = kidObj;
  47056. }
  47057. if (!(obj instanceof _primitives.Dict)) {
  47058. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  47059. break;
  47060. }
  47061. let type = obj.getRaw("Type");
  47062. if (type instanceof _primitives.Ref) {
  47063. try {
  47064. type = await xref.fetchAsync(type);
  47065. } catch (ex) {
  47066. addPageError(ex);
  47067. break;
  47068. }
  47069. }
  47070. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  47071. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  47072. } else {
  47073. queue.push({
  47074. currentNode: obj,
  47075. posInKids: 0
  47076. });
  47077. }
  47078. queueItem.posInKids++;
  47079. }
  47080. return map;
  47081. }
  47082. getPageIndex(pageRef) {
  47083. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  47084. if (cachedPageIndex !== undefined) {
  47085. return Promise.resolve(cachedPageIndex);
  47086. }
  47087. const xref = this.xref;
  47088. function pagesBeforeRef(kidRef) {
  47089. let total = 0,
  47090. parentRef;
  47091. return xref.fetchAsync(kidRef).then(function (node) {
  47092. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  47093. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  47094. }
  47095. if (!node) {
  47096. return null;
  47097. }
  47098. if (!(node instanceof _primitives.Dict)) {
  47099. throw new _util.FormatError("Node must be a dictionary.");
  47100. }
  47101. parentRef = node.getRaw("Parent");
  47102. return node.getAsync("Parent");
  47103. }).then(function (parent) {
  47104. if (!parent) {
  47105. return null;
  47106. }
  47107. if (!(parent instanceof _primitives.Dict)) {
  47108. throw new _util.FormatError("Parent must be a dictionary.");
  47109. }
  47110. return parent.getAsync("Kids");
  47111. }).then(function (kids) {
  47112. if (!kids) {
  47113. return null;
  47114. }
  47115. const kidPromises = [];
  47116. let found = false;
  47117. for (let i = 0, ii = kids.length; i < ii; i++) {
  47118. const kid = kids[i];
  47119. if (!(kid instanceof _primitives.Ref)) {
  47120. throw new _util.FormatError("Kid must be a reference.");
  47121. }
  47122. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  47123. found = true;
  47124. break;
  47125. }
  47126. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  47127. if (!(obj instanceof _primitives.Dict)) {
  47128. throw new _util.FormatError("Kid node must be a dictionary.");
  47129. }
  47130. if (obj.has("Count")) {
  47131. total += obj.get("Count");
  47132. } else {
  47133. total++;
  47134. }
  47135. }));
  47136. }
  47137. if (!found) {
  47138. throw new _util.FormatError("Kid reference not found in parent's kids.");
  47139. }
  47140. return Promise.all(kidPromises).then(function () {
  47141. return [total, parentRef];
  47142. });
  47143. });
  47144. }
  47145. let total = 0;
  47146. const next = ref => pagesBeforeRef(ref).then(args => {
  47147. if (!args) {
  47148. this.pageIndexCache.put(pageRef, total);
  47149. return total;
  47150. }
  47151. const [count, parentRef] = args;
  47152. total += count;
  47153. return next(parentRef);
  47154. });
  47155. return next(pageRef);
  47156. }
  47157. static parseDestDictionary(params) {
  47158. const destDict = params.destDict;
  47159. if (!(destDict instanceof _primitives.Dict)) {
  47160. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  47161. return;
  47162. }
  47163. const resultObj = params.resultObj;
  47164. if (typeof resultObj !== "object") {
  47165. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  47166. return;
  47167. }
  47168. const docBaseUrl = params.docBaseUrl || null;
  47169. let action = destDict.get("A"),
  47170. url,
  47171. dest;
  47172. if (!(action instanceof _primitives.Dict)) {
  47173. if (destDict.has("Dest")) {
  47174. action = destDict.get("Dest");
  47175. } else {
  47176. action = destDict.get("AA");
  47177. if (action instanceof _primitives.Dict) {
  47178. if (action.has("D")) {
  47179. action = action.get("D");
  47180. } else if (action.has("U")) {
  47181. action = action.get("U");
  47182. }
  47183. }
  47184. }
  47185. }
  47186. if (action instanceof _primitives.Dict) {
  47187. const actionType = action.get("S");
  47188. if (!(actionType instanceof _primitives.Name)) {
  47189. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  47190. return;
  47191. }
  47192. const actionName = actionType.name;
  47193. switch (actionName) {
  47194. case "ResetForm":
  47195. const flags = action.get("Flags");
  47196. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  47197. const fields = [];
  47198. const refs = [];
  47199. for (const obj of action.get("Fields") || []) {
  47200. if (obj instanceof _primitives.Ref) {
  47201. refs.push(obj.toString());
  47202. } else if (typeof obj === "string") {
  47203. fields.push((0, _util.stringToPDFString)(obj));
  47204. }
  47205. }
  47206. resultObj.resetForm = {
  47207. fields,
  47208. refs,
  47209. include
  47210. };
  47211. break;
  47212. case "URI":
  47213. url = action.get("URI");
  47214. if (url instanceof _primitives.Name) {
  47215. url = "/" + url.name;
  47216. }
  47217. break;
  47218. case "GoTo":
  47219. dest = action.get("D");
  47220. break;
  47221. case "Launch":
  47222. case "GoToR":
  47223. const urlDict = action.get("F");
  47224. if (urlDict instanceof _primitives.Dict) {
  47225. url = urlDict.get("F") || null;
  47226. } else if (typeof urlDict === "string") {
  47227. url = urlDict;
  47228. }
  47229. let remoteDest = action.get("D");
  47230. if (remoteDest) {
  47231. if (remoteDest instanceof _primitives.Name) {
  47232. remoteDest = remoteDest.name;
  47233. }
  47234. if (typeof url === "string") {
  47235. const baseUrl = url.split("#")[0];
  47236. if (typeof remoteDest === "string") {
  47237. url = baseUrl + "#" + remoteDest;
  47238. } else if (Array.isArray(remoteDest)) {
  47239. url = baseUrl + "#" + JSON.stringify(remoteDest);
  47240. }
  47241. }
  47242. }
  47243. const newWindow = action.get("NewWindow");
  47244. if (typeof newWindow === "boolean") {
  47245. resultObj.newWindow = newWindow;
  47246. }
  47247. break;
  47248. case "Named":
  47249. const namedAction = action.get("N");
  47250. if (namedAction instanceof _primitives.Name) {
  47251. resultObj.action = namedAction.name;
  47252. }
  47253. break;
  47254. case "JavaScript":
  47255. const jsAction = action.get("JS");
  47256. let js;
  47257. if (jsAction instanceof _base_stream.BaseStream) {
  47258. js = jsAction.getString();
  47259. } else if (typeof jsAction === "string") {
  47260. js = jsAction;
  47261. }
  47262. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  47263. if (jsURL) {
  47264. url = jsURL.url;
  47265. resultObj.newWindow = jsURL.newWindow;
  47266. break;
  47267. }
  47268. default:
  47269. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  47270. break;
  47271. }
  47272. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  47273. break;
  47274. }
  47275. } else if (destDict.has("Dest")) {
  47276. dest = destDict.get("Dest");
  47277. }
  47278. if (typeof url === "string") {
  47279. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  47280. addDefaultProtocol: true,
  47281. tryConvertEncoding: true
  47282. });
  47283. if (absoluteUrl) {
  47284. resultObj.url = absoluteUrl.href;
  47285. }
  47286. resultObj.unsafeUrl = url;
  47287. }
  47288. if (dest) {
  47289. if (dest instanceof _primitives.Name) {
  47290. dest = dest.name;
  47291. }
  47292. if (typeof dest === "string" || Array.isArray(dest)) {
  47293. resultObj.dest = dest;
  47294. }
  47295. }
  47296. }
  47297. }
  47298. exports.Catalog = Catalog;
  47299. /***/ }),
  47300. /* 65 */
  47301. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47302. Object.defineProperty(exports, "__esModule", ({
  47303. value: true
  47304. }));
  47305. exports.NumberTree = exports.NameTree = void 0;
  47306. var _primitives = __w_pdfjs_require__(5);
  47307. var _util = __w_pdfjs_require__(2);
  47308. class NameOrNumberTree {
  47309. constructor(root, xref, type) {
  47310. if (this.constructor === NameOrNumberTree) {
  47311. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  47312. }
  47313. this.root = root;
  47314. this.xref = xref;
  47315. this._type = type;
  47316. }
  47317. getAll() {
  47318. const map = new Map();
  47319. if (!this.root) {
  47320. return map;
  47321. }
  47322. const xref = this.xref;
  47323. const processed = new _primitives.RefSet();
  47324. processed.put(this.root);
  47325. const queue = [this.root];
  47326. while (queue.length > 0) {
  47327. const obj = xref.fetchIfRef(queue.shift());
  47328. if (!(obj instanceof _primitives.Dict)) {
  47329. continue;
  47330. }
  47331. if (obj.has("Kids")) {
  47332. const kids = obj.get("Kids");
  47333. for (let i = 0, ii = kids.length; i < ii; i++) {
  47334. const kid = kids[i];
  47335. if (processed.has(kid)) {
  47336. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  47337. }
  47338. queue.push(kid);
  47339. processed.put(kid);
  47340. }
  47341. continue;
  47342. }
  47343. const entries = obj.get(this._type);
  47344. if (!Array.isArray(entries)) {
  47345. continue;
  47346. }
  47347. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  47348. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  47349. }
  47350. }
  47351. return map;
  47352. }
  47353. get(key) {
  47354. if (!this.root) {
  47355. return null;
  47356. }
  47357. const xref = this.xref;
  47358. let kidsOrEntries = xref.fetchIfRef(this.root);
  47359. let loopCount = 0;
  47360. const MAX_LEVELS = 10;
  47361. while (kidsOrEntries.has("Kids")) {
  47362. if (++loopCount > MAX_LEVELS) {
  47363. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  47364. return null;
  47365. }
  47366. const kids = kidsOrEntries.get("Kids");
  47367. if (!Array.isArray(kids)) {
  47368. return null;
  47369. }
  47370. let l = 0,
  47371. r = kids.length - 1;
  47372. while (l <= r) {
  47373. const m = l + r >> 1;
  47374. const kid = xref.fetchIfRef(kids[m]);
  47375. const limits = kid.get("Limits");
  47376. if (key < xref.fetchIfRef(limits[0])) {
  47377. r = m - 1;
  47378. } else if (key > xref.fetchIfRef(limits[1])) {
  47379. l = m + 1;
  47380. } else {
  47381. kidsOrEntries = xref.fetchIfRef(kids[m]);
  47382. break;
  47383. }
  47384. }
  47385. if (l > r) {
  47386. return null;
  47387. }
  47388. }
  47389. const entries = kidsOrEntries.get(this._type);
  47390. if (Array.isArray(entries)) {
  47391. let l = 0,
  47392. r = entries.length - 2;
  47393. while (l <= r) {
  47394. const tmp = l + r >> 1,
  47395. m = tmp + (tmp & 1);
  47396. const currentKey = xref.fetchIfRef(entries[m]);
  47397. if (key < currentKey) {
  47398. r = m - 2;
  47399. } else if (key > currentKey) {
  47400. l = m + 2;
  47401. } else {
  47402. return xref.fetchIfRef(entries[m + 1]);
  47403. }
  47404. }
  47405. }
  47406. return null;
  47407. }
  47408. }
  47409. class NameTree extends NameOrNumberTree {
  47410. constructor(root, xref) {
  47411. super(root, xref, "Names");
  47412. }
  47413. }
  47414. exports.NameTree = NameTree;
  47415. class NumberTree extends NameOrNumberTree {
  47416. constructor(root, xref) {
  47417. super(root, xref, "Nums");
  47418. }
  47419. }
  47420. exports.NumberTree = NumberTree;
  47421. /***/ }),
  47422. /* 66 */
  47423. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47424. Object.defineProperty(exports, "__esModule", ({
  47425. value: true
  47426. }));
  47427. exports.clearGlobalCaches = clearGlobalCaches;
  47428. var _primitives = __w_pdfjs_require__(5);
  47429. var _unicode = __w_pdfjs_require__(21);
  47430. function clearGlobalCaches() {
  47431. (0, _primitives.clearPrimitiveCaches)();
  47432. (0, _unicode.clearUnicodeCaches)();
  47433. }
  47434. /***/ }),
  47435. /* 67 */
  47436. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47437. Object.defineProperty(exports, "__esModule", ({
  47438. value: true
  47439. }));
  47440. exports.FileSpec = void 0;
  47441. var _util = __w_pdfjs_require__(2);
  47442. var _base_stream = __w_pdfjs_require__(9);
  47443. var _primitives = __w_pdfjs_require__(5);
  47444. function pickPlatformItem(dict) {
  47445. if (dict.has("UF")) {
  47446. return dict.get("UF");
  47447. } else if (dict.has("F")) {
  47448. return dict.get("F");
  47449. } else if (dict.has("Unix")) {
  47450. return dict.get("Unix");
  47451. } else if (dict.has("Mac")) {
  47452. return dict.get("Mac");
  47453. } else if (dict.has("DOS")) {
  47454. return dict.get("DOS");
  47455. }
  47456. return null;
  47457. }
  47458. class FileSpec {
  47459. constructor(root, xref) {
  47460. if (!(root instanceof _primitives.Dict)) {
  47461. return;
  47462. }
  47463. this.xref = xref;
  47464. this.root = root;
  47465. if (root.has("FS")) {
  47466. this.fs = root.get("FS");
  47467. }
  47468. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  47469. if (root.has("RF")) {
  47470. (0, _util.warn)("Related file specifications are not supported");
  47471. }
  47472. this.contentAvailable = true;
  47473. if (!root.has("EF")) {
  47474. this.contentAvailable = false;
  47475. (0, _util.warn)("Non-embedded file specifications are not supported");
  47476. }
  47477. }
  47478. get filename() {
  47479. if (!this._filename && this.root) {
  47480. const filename = pickPlatformItem(this.root) || "unnamed";
  47481. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  47482. }
  47483. return this._filename;
  47484. }
  47485. get content() {
  47486. if (!this.contentAvailable) {
  47487. return null;
  47488. }
  47489. if (!this.contentRef && this.root) {
  47490. this.contentRef = pickPlatformItem(this.root.get("EF"));
  47491. }
  47492. let content = null;
  47493. if (this.contentRef) {
  47494. const fileObj = this.xref.fetchIfRef(this.contentRef);
  47495. if (fileObj instanceof _base_stream.BaseStream) {
  47496. content = fileObj.getBytes();
  47497. } else {
  47498. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  47499. }
  47500. } else {
  47501. (0, _util.warn)("Embedded file specification does not have a content");
  47502. }
  47503. return content;
  47504. }
  47505. get serializable() {
  47506. return {
  47507. filename: this.filename,
  47508. content: this.content
  47509. };
  47510. }
  47511. }
  47512. exports.FileSpec = FileSpec;
  47513. /***/ }),
  47514. /* 68 */
  47515. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47516. Object.defineProperty(exports, "__esModule", ({
  47517. value: true
  47518. }));
  47519. exports.MetadataParser = void 0;
  47520. var _xml_parser = __w_pdfjs_require__(69);
  47521. class MetadataParser {
  47522. constructor(data) {
  47523. data = this._repair(data);
  47524. const parser = new _xml_parser.SimpleXMLParser({
  47525. lowerCaseName: true
  47526. });
  47527. const xmlDocument = parser.parseFromString(data);
  47528. this._metadataMap = new Map();
  47529. this._data = data;
  47530. if (xmlDocument) {
  47531. this._parse(xmlDocument);
  47532. }
  47533. }
  47534. _repair(data) {
  47535. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  47536. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  47537. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  47538. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  47539. switch (name) {
  47540. case "amp":
  47541. return "&";
  47542. case "apos":
  47543. return "'";
  47544. case "gt":
  47545. return ">";
  47546. case "lt":
  47547. return "<";
  47548. case "quot":
  47549. return '"';
  47550. }
  47551. throw new Error(`_repair: ${name} isn't defined.`);
  47552. });
  47553. const charBuf = [];
  47554. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  47555. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  47556. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  47557. charBuf.push(String.fromCharCode(code));
  47558. } else {
  47559. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  47560. }
  47561. }
  47562. return ">" + charBuf.join("");
  47563. });
  47564. }
  47565. _getSequence(entry) {
  47566. const name = entry.nodeName;
  47567. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  47568. return null;
  47569. }
  47570. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  47571. }
  47572. _parseArray(entry) {
  47573. if (!entry.hasChildNodes()) {
  47574. return;
  47575. }
  47576. const [seqNode] = entry.childNodes;
  47577. const sequence = this._getSequence(seqNode) || [];
  47578. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  47579. }
  47580. _parse(xmlDocument) {
  47581. let rdf = xmlDocument.documentElement;
  47582. if (rdf.nodeName !== "rdf:rdf") {
  47583. rdf = rdf.firstChild;
  47584. while (rdf && rdf.nodeName !== "rdf:rdf") {
  47585. rdf = rdf.nextSibling;
  47586. }
  47587. }
  47588. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  47589. return;
  47590. }
  47591. for (const desc of rdf.childNodes) {
  47592. if (desc.nodeName !== "rdf:description") {
  47593. continue;
  47594. }
  47595. for (const entry of desc.childNodes) {
  47596. const name = entry.nodeName;
  47597. switch (name) {
  47598. case "#text":
  47599. continue;
  47600. case "dc:creator":
  47601. case "dc:subject":
  47602. this._parseArray(entry);
  47603. continue;
  47604. }
  47605. this._metadataMap.set(name, entry.textContent.trim());
  47606. }
  47607. }
  47608. }
  47609. get serializable() {
  47610. return {
  47611. parsedData: this._metadataMap,
  47612. rawData: this._data
  47613. };
  47614. }
  47615. }
  47616. exports.MetadataParser = MetadataParser;
  47617. /***/ }),
  47618. /* 69 */
  47619. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47620. Object.defineProperty(exports, "__esModule", ({
  47621. value: true
  47622. }));
  47623. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47624. var _core_utils = __w_pdfjs_require__(8);
  47625. const XMLParserErrorCode = {
  47626. NoError: 0,
  47627. EndOfDocument: -1,
  47628. UnterminatedCdat: -2,
  47629. UnterminatedXmlDeclaration: -3,
  47630. UnterminatedDoctypeDeclaration: -4,
  47631. UnterminatedComment: -5,
  47632. MalformedElement: -6,
  47633. OutOfMemory: -7,
  47634. UnterminatedAttributeValue: -8,
  47635. UnterminatedElement: -9,
  47636. ElementNeverBegun: -10
  47637. };
  47638. exports.XMLParserErrorCode = XMLParserErrorCode;
  47639. function isWhitespace(s, index) {
  47640. const ch = s[index];
  47641. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47642. }
  47643. function isWhitespaceString(s) {
  47644. for (let i = 0, ii = s.length; i < ii; i++) {
  47645. if (!isWhitespace(s, i)) {
  47646. return false;
  47647. }
  47648. }
  47649. return true;
  47650. }
  47651. class XMLParserBase {
  47652. _resolveEntities(s) {
  47653. return s.replace(/&([^;]+);/g, (all, entity) => {
  47654. if (entity.substring(0, 2) === "#x") {
  47655. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47656. } else if (entity.substring(0, 1) === "#") {
  47657. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47658. }
  47659. switch (entity) {
  47660. case "lt":
  47661. return "<";
  47662. case "gt":
  47663. return ">";
  47664. case "amp":
  47665. return "&";
  47666. case "quot":
  47667. return '"';
  47668. case "apos":
  47669. return "'";
  47670. }
  47671. return this.onResolveEntity(entity);
  47672. });
  47673. }
  47674. _parseContent(s, start) {
  47675. const attributes = [];
  47676. let pos = start;
  47677. function skipWs() {
  47678. while (pos < s.length && isWhitespace(s, pos)) {
  47679. ++pos;
  47680. }
  47681. }
  47682. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47683. ++pos;
  47684. }
  47685. const name = s.substring(start, pos);
  47686. skipWs();
  47687. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47688. skipWs();
  47689. let attrName = "",
  47690. attrValue = "";
  47691. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47692. attrName += s[pos];
  47693. ++pos;
  47694. }
  47695. skipWs();
  47696. if (s[pos] !== "=") {
  47697. return null;
  47698. }
  47699. ++pos;
  47700. skipWs();
  47701. const attrEndChar = s[pos];
  47702. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47703. return null;
  47704. }
  47705. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47706. if (attrEndIndex < 0) {
  47707. return null;
  47708. }
  47709. attrValue = s.substring(pos, attrEndIndex);
  47710. attributes.push({
  47711. name: attrName,
  47712. value: this._resolveEntities(attrValue)
  47713. });
  47714. pos = attrEndIndex + 1;
  47715. skipWs();
  47716. }
  47717. return {
  47718. name,
  47719. attributes,
  47720. parsed: pos - start
  47721. };
  47722. }
  47723. _parseProcessingInstruction(s, start) {
  47724. let pos = start;
  47725. function skipWs() {
  47726. while (pos < s.length && isWhitespace(s, pos)) {
  47727. ++pos;
  47728. }
  47729. }
  47730. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47731. ++pos;
  47732. }
  47733. const name = s.substring(start, pos);
  47734. skipWs();
  47735. const attrStart = pos;
  47736. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47737. ++pos;
  47738. }
  47739. const value = s.substring(attrStart, pos);
  47740. return {
  47741. name,
  47742. value,
  47743. parsed: pos - start
  47744. };
  47745. }
  47746. parseXml(s) {
  47747. let i = 0;
  47748. while (i < s.length) {
  47749. const ch = s[i];
  47750. let j = i;
  47751. if (ch === "<") {
  47752. ++j;
  47753. const ch2 = s[j];
  47754. let q;
  47755. switch (ch2) {
  47756. case "/":
  47757. ++j;
  47758. q = s.indexOf(">", j);
  47759. if (q < 0) {
  47760. this.onError(XMLParserErrorCode.UnterminatedElement);
  47761. return;
  47762. }
  47763. this.onEndElement(s.substring(j, q));
  47764. j = q + 1;
  47765. break;
  47766. case "?":
  47767. ++j;
  47768. const pi = this._parseProcessingInstruction(s, j);
  47769. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47770. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47771. return;
  47772. }
  47773. this.onPi(pi.name, pi.value);
  47774. j += pi.parsed + 2;
  47775. break;
  47776. case "!":
  47777. if (s.substring(j + 1, j + 3) === "--") {
  47778. q = s.indexOf("-->", j + 3);
  47779. if (q < 0) {
  47780. this.onError(XMLParserErrorCode.UnterminatedComment);
  47781. return;
  47782. }
  47783. this.onComment(s.substring(j + 3, q));
  47784. j = q + 3;
  47785. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47786. q = s.indexOf("]]>", j + 8);
  47787. if (q < 0) {
  47788. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47789. return;
  47790. }
  47791. this.onCdata(s.substring(j + 8, q));
  47792. j = q + 3;
  47793. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47794. const q2 = s.indexOf("[", j + 8);
  47795. let complexDoctype = false;
  47796. q = s.indexOf(">", j + 8);
  47797. if (q < 0) {
  47798. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47799. return;
  47800. }
  47801. if (q2 > 0 && q > q2) {
  47802. q = s.indexOf("]>", j + 8);
  47803. if (q < 0) {
  47804. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47805. return;
  47806. }
  47807. complexDoctype = true;
  47808. }
  47809. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47810. this.onDoctype(doctypeContent);
  47811. j = q + (complexDoctype ? 2 : 1);
  47812. } else {
  47813. this.onError(XMLParserErrorCode.MalformedElement);
  47814. return;
  47815. }
  47816. break;
  47817. default:
  47818. const content = this._parseContent(s, j);
  47819. if (content === null) {
  47820. this.onError(XMLParserErrorCode.MalformedElement);
  47821. return;
  47822. }
  47823. let isClosed = false;
  47824. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47825. isClosed = true;
  47826. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47827. this.onError(XMLParserErrorCode.UnterminatedElement);
  47828. return;
  47829. }
  47830. this.onBeginElement(content.name, content.attributes, isClosed);
  47831. j += content.parsed + (isClosed ? 2 : 1);
  47832. break;
  47833. }
  47834. } else {
  47835. while (j < s.length && s[j] !== "<") {
  47836. j++;
  47837. }
  47838. const text = s.substring(i, j);
  47839. this.onText(this._resolveEntities(text));
  47840. }
  47841. i = j;
  47842. }
  47843. }
  47844. onResolveEntity(name) {
  47845. return `&${name};`;
  47846. }
  47847. onPi(name, value) {}
  47848. onComment(text) {}
  47849. onCdata(text) {}
  47850. onDoctype(doctypeContent) {}
  47851. onText(text) {}
  47852. onBeginElement(name, attributes, isEmpty) {}
  47853. onEndElement(name) {}
  47854. onError(code) {}
  47855. }
  47856. exports.XMLParserBase = XMLParserBase;
  47857. class SimpleDOMNode {
  47858. constructor(nodeName, nodeValue) {
  47859. this.nodeName = nodeName;
  47860. this.nodeValue = nodeValue;
  47861. Object.defineProperty(this, "parentNode", {
  47862. value: null,
  47863. writable: true
  47864. });
  47865. }
  47866. get firstChild() {
  47867. return this.childNodes && this.childNodes[0];
  47868. }
  47869. get nextSibling() {
  47870. const childNodes = this.parentNode.childNodes;
  47871. if (!childNodes) {
  47872. return undefined;
  47873. }
  47874. const index = childNodes.indexOf(this);
  47875. if (index === -1) {
  47876. return undefined;
  47877. }
  47878. return childNodes[index + 1];
  47879. }
  47880. get textContent() {
  47881. if (!this.childNodes) {
  47882. return this.nodeValue || "";
  47883. }
  47884. return this.childNodes.map(function (child) {
  47885. return child.textContent;
  47886. }).join("");
  47887. }
  47888. hasChildNodes() {
  47889. return this.childNodes && this.childNodes.length > 0;
  47890. }
  47891. searchNode(paths, pos) {
  47892. if (pos >= paths.length) {
  47893. return this;
  47894. }
  47895. const component = paths[pos];
  47896. const stack = [];
  47897. let node = this;
  47898. while (true) {
  47899. if (component.name === node.nodeName) {
  47900. if (component.pos === 0) {
  47901. const res = node.searchNode(paths, pos + 1);
  47902. if (res !== null) {
  47903. return res;
  47904. }
  47905. } else if (stack.length === 0) {
  47906. return null;
  47907. } else {
  47908. const [parent] = stack.pop();
  47909. let siblingPos = 0;
  47910. for (const child of parent.childNodes) {
  47911. if (component.name === child.nodeName) {
  47912. if (siblingPos === component.pos) {
  47913. return child.searchNode(paths, pos + 1);
  47914. }
  47915. siblingPos++;
  47916. }
  47917. }
  47918. return node.searchNode(paths, pos + 1);
  47919. }
  47920. }
  47921. if (node.childNodes && node.childNodes.length !== 0) {
  47922. stack.push([node, 0]);
  47923. node = node.childNodes[0];
  47924. } else if (stack.length === 0) {
  47925. return null;
  47926. } else {
  47927. while (stack.length !== 0) {
  47928. const [parent, currentPos] = stack.pop();
  47929. const newPos = currentPos + 1;
  47930. if (newPos < parent.childNodes.length) {
  47931. stack.push([parent, newPos]);
  47932. node = parent.childNodes[newPos];
  47933. break;
  47934. }
  47935. }
  47936. if (stack.length === 0) {
  47937. return null;
  47938. }
  47939. }
  47940. }
  47941. }
  47942. dump(buffer) {
  47943. if (this.nodeName === "#text") {
  47944. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  47945. return;
  47946. }
  47947. buffer.push(`<${this.nodeName}`);
  47948. if (this.attributes) {
  47949. for (const attribute of this.attributes) {
  47950. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  47951. }
  47952. }
  47953. if (this.hasChildNodes()) {
  47954. buffer.push(">");
  47955. for (const child of this.childNodes) {
  47956. child.dump(buffer);
  47957. }
  47958. buffer.push(`</${this.nodeName}>`);
  47959. } else if (this.nodeValue) {
  47960. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47961. } else {
  47962. buffer.push("/>");
  47963. }
  47964. }
  47965. }
  47966. exports.SimpleDOMNode = SimpleDOMNode;
  47967. class SimpleXMLParser extends XMLParserBase {
  47968. constructor({
  47969. hasAttributes = false,
  47970. lowerCaseName = false
  47971. }) {
  47972. super();
  47973. this._currentFragment = null;
  47974. this._stack = null;
  47975. this._errorCode = XMLParserErrorCode.NoError;
  47976. this._hasAttributes = hasAttributes;
  47977. this._lowerCaseName = lowerCaseName;
  47978. }
  47979. parseFromString(data) {
  47980. this._currentFragment = [];
  47981. this._stack = [];
  47982. this._errorCode = XMLParserErrorCode.NoError;
  47983. this.parseXml(data);
  47984. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47985. return undefined;
  47986. }
  47987. const [documentElement] = this._currentFragment;
  47988. if (!documentElement) {
  47989. return undefined;
  47990. }
  47991. return {
  47992. documentElement
  47993. };
  47994. }
  47995. onText(text) {
  47996. if (isWhitespaceString(text)) {
  47997. return;
  47998. }
  47999. const node = new SimpleDOMNode("#text", text);
  48000. this._currentFragment.push(node);
  48001. }
  48002. onCdata(text) {
  48003. const node = new SimpleDOMNode("#text", text);
  48004. this._currentFragment.push(node);
  48005. }
  48006. onBeginElement(name, attributes, isEmpty) {
  48007. if (this._lowerCaseName) {
  48008. name = name.toLowerCase();
  48009. }
  48010. const node = new SimpleDOMNode(name);
  48011. node.childNodes = [];
  48012. if (this._hasAttributes) {
  48013. node.attributes = attributes;
  48014. }
  48015. this._currentFragment.push(node);
  48016. if (isEmpty) {
  48017. return;
  48018. }
  48019. this._stack.push(this._currentFragment);
  48020. this._currentFragment = node.childNodes;
  48021. }
  48022. onEndElement(name) {
  48023. this._currentFragment = this._stack.pop() || [];
  48024. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  48025. if (!lastElement) {
  48026. return;
  48027. }
  48028. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  48029. lastElement.childNodes[i].parentNode = lastElement;
  48030. }
  48031. }
  48032. onError(code) {
  48033. this._errorCode = code;
  48034. }
  48035. }
  48036. exports.SimpleXMLParser = SimpleXMLParser;
  48037. /***/ }),
  48038. /* 70 */
  48039. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48040. Object.defineProperty(exports, "__esModule", ({
  48041. value: true
  48042. }));
  48043. exports.StructTreeRoot = exports.StructTreePage = void 0;
  48044. var _primitives = __w_pdfjs_require__(5);
  48045. var _util = __w_pdfjs_require__(2);
  48046. var _name_number_tree = __w_pdfjs_require__(65);
  48047. const MAX_DEPTH = 40;
  48048. const StructElementType = {
  48049. PAGE_CONTENT: "PAGE_CONTENT",
  48050. STREAM_CONTENT: "STREAM_CONTENT",
  48051. OBJECT: "OBJECT",
  48052. ELEMENT: "ELEMENT"
  48053. };
  48054. class StructTreeRoot {
  48055. constructor(rootDict) {
  48056. this.dict = rootDict;
  48057. this.roleMap = new Map();
  48058. }
  48059. init() {
  48060. this.readRoleMap();
  48061. }
  48062. readRoleMap() {
  48063. const roleMapDict = this.dict.get("RoleMap");
  48064. if (!(roleMapDict instanceof _primitives.Dict)) {
  48065. return;
  48066. }
  48067. roleMapDict.forEach((key, value) => {
  48068. if (!(value instanceof _primitives.Name)) {
  48069. return;
  48070. }
  48071. this.roleMap.set(key, value.name);
  48072. });
  48073. }
  48074. }
  48075. exports.StructTreeRoot = StructTreeRoot;
  48076. class StructElementNode {
  48077. constructor(tree, dict) {
  48078. this.tree = tree;
  48079. this.dict = dict;
  48080. this.kids = [];
  48081. this.parseKids();
  48082. }
  48083. get role() {
  48084. const nameObj = this.dict.get("S");
  48085. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  48086. const {
  48087. root
  48088. } = this.tree;
  48089. if (root.roleMap.has(name)) {
  48090. return root.roleMap.get(name);
  48091. }
  48092. return name;
  48093. }
  48094. parseKids() {
  48095. let pageObjId = null;
  48096. const objRef = this.dict.getRaw("Pg");
  48097. if (objRef instanceof _primitives.Ref) {
  48098. pageObjId = objRef.toString();
  48099. }
  48100. const kids = this.dict.get("K");
  48101. if (Array.isArray(kids)) {
  48102. for (const kid of kids) {
  48103. const element = this.parseKid(pageObjId, kid);
  48104. if (element) {
  48105. this.kids.push(element);
  48106. }
  48107. }
  48108. } else {
  48109. const element = this.parseKid(pageObjId, kids);
  48110. if (element) {
  48111. this.kids.push(element);
  48112. }
  48113. }
  48114. }
  48115. parseKid(pageObjId, kid) {
  48116. if (Number.isInteger(kid)) {
  48117. if (this.tree.pageDict.objId !== pageObjId) {
  48118. return null;
  48119. }
  48120. return new StructElement({
  48121. type: StructElementType.PAGE_CONTENT,
  48122. mcid: kid,
  48123. pageObjId
  48124. });
  48125. }
  48126. let kidDict = null;
  48127. if (kid instanceof _primitives.Ref) {
  48128. kidDict = this.dict.xref.fetch(kid);
  48129. } else if (kid instanceof _primitives.Dict) {
  48130. kidDict = kid;
  48131. }
  48132. if (!kidDict) {
  48133. return null;
  48134. }
  48135. const pageRef = kidDict.getRaw("Pg");
  48136. if (pageRef instanceof _primitives.Ref) {
  48137. pageObjId = pageRef.toString();
  48138. }
  48139. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  48140. if (type === "MCR") {
  48141. if (this.tree.pageDict.objId !== pageObjId) {
  48142. return null;
  48143. }
  48144. return new StructElement({
  48145. type: StructElementType.STREAM_CONTENT,
  48146. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  48147. pageObjId,
  48148. mcid: kidDict.get("MCID")
  48149. });
  48150. }
  48151. if (type === "OBJR") {
  48152. if (this.tree.pageDict.objId !== pageObjId) {
  48153. return null;
  48154. }
  48155. return new StructElement({
  48156. type: StructElementType.OBJECT,
  48157. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  48158. pageObjId
  48159. });
  48160. }
  48161. return new StructElement({
  48162. type: StructElementType.ELEMENT,
  48163. dict: kidDict
  48164. });
  48165. }
  48166. }
  48167. class StructElement {
  48168. constructor({
  48169. type,
  48170. dict = null,
  48171. mcid = null,
  48172. pageObjId = null,
  48173. refObjId = null
  48174. }) {
  48175. this.type = type;
  48176. this.dict = dict;
  48177. this.mcid = mcid;
  48178. this.pageObjId = pageObjId;
  48179. this.refObjId = refObjId;
  48180. this.parentNode = null;
  48181. }
  48182. }
  48183. class StructTreePage {
  48184. constructor(structTreeRoot, pageDict) {
  48185. this.root = structTreeRoot;
  48186. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  48187. this.pageDict = pageDict;
  48188. this.nodes = [];
  48189. }
  48190. parse() {
  48191. if (!this.root || !this.rootDict) {
  48192. return;
  48193. }
  48194. const parentTree = this.rootDict.get("ParentTree");
  48195. if (!parentTree) {
  48196. return;
  48197. }
  48198. const id = this.pageDict.get("StructParents");
  48199. if (!Number.isInteger(id)) {
  48200. return;
  48201. }
  48202. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  48203. const parentArray = numberTree.get(id);
  48204. if (!Array.isArray(parentArray)) {
  48205. return;
  48206. }
  48207. const map = new Map();
  48208. for (const ref of parentArray) {
  48209. if (ref instanceof _primitives.Ref) {
  48210. this.addNode(this.rootDict.xref.fetch(ref), map);
  48211. }
  48212. }
  48213. }
  48214. addNode(dict, map, level = 0) {
  48215. if (level > MAX_DEPTH) {
  48216. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  48217. return null;
  48218. }
  48219. if (map.has(dict)) {
  48220. return map.get(dict);
  48221. }
  48222. const element = new StructElementNode(this, dict);
  48223. map.set(dict, element);
  48224. const parent = dict.get("P");
  48225. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  48226. if (!this.addTopLevelNode(dict, element)) {
  48227. map.delete(dict);
  48228. }
  48229. return element;
  48230. }
  48231. const parentNode = this.addNode(parent, map, level + 1);
  48232. if (!parentNode) {
  48233. return element;
  48234. }
  48235. let save = false;
  48236. for (const kid of parentNode.kids) {
  48237. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  48238. kid.parentNode = element;
  48239. save = true;
  48240. }
  48241. }
  48242. if (!save) {
  48243. map.delete(dict);
  48244. }
  48245. return element;
  48246. }
  48247. addTopLevelNode(dict, element) {
  48248. const obj = this.rootDict.get("K");
  48249. if (!obj) {
  48250. return false;
  48251. }
  48252. if (obj instanceof _primitives.Dict) {
  48253. if (obj.objId !== dict.objId) {
  48254. return false;
  48255. }
  48256. this.nodes[0] = element;
  48257. return true;
  48258. }
  48259. if (!Array.isArray(obj)) {
  48260. return true;
  48261. }
  48262. let save = false;
  48263. for (let i = 0; i < obj.length; i++) {
  48264. const kidRef = obj[i];
  48265. if (kidRef && kidRef.toString() === dict.objId) {
  48266. this.nodes[i] = element;
  48267. save = true;
  48268. }
  48269. }
  48270. return save;
  48271. }
  48272. get serializable() {
  48273. function nodeToSerializable(node, parent, level = 0) {
  48274. if (level > MAX_DEPTH) {
  48275. (0, _util.warn)("StructTree too deep to be fully serialized.");
  48276. return;
  48277. }
  48278. const obj = Object.create(null);
  48279. obj.role = node.role;
  48280. obj.children = [];
  48281. parent.children.push(obj);
  48282. const alt = node.dict.get("Alt");
  48283. if (typeof alt === "string") {
  48284. obj.alt = (0, _util.stringToPDFString)(alt);
  48285. }
  48286. const lang = node.dict.get("Lang");
  48287. if (typeof lang === "string") {
  48288. obj.lang = (0, _util.stringToPDFString)(lang);
  48289. }
  48290. for (const kid of node.kids) {
  48291. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  48292. if (kidElement) {
  48293. nodeToSerializable(kidElement, obj, level + 1);
  48294. continue;
  48295. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  48296. obj.children.push({
  48297. type: "content",
  48298. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  48299. });
  48300. } else if (kid.type === StructElementType.OBJECT) {
  48301. obj.children.push({
  48302. type: "object",
  48303. id: kid.refObjId
  48304. });
  48305. }
  48306. }
  48307. }
  48308. const root = Object.create(null);
  48309. root.children = [];
  48310. root.role = "Root";
  48311. for (const child of this.nodes) {
  48312. if (!child) {
  48313. continue;
  48314. }
  48315. nodeToSerializable(child, root);
  48316. }
  48317. return root;
  48318. }
  48319. }
  48320. exports.StructTreePage = StructTreePage;
  48321. /***/ }),
  48322. /* 71 */
  48323. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48324. Object.defineProperty(exports, "__esModule", ({
  48325. value: true
  48326. }));
  48327. exports.ObjectLoader = void 0;
  48328. var _primitives = __w_pdfjs_require__(5);
  48329. var _base_stream = __w_pdfjs_require__(9);
  48330. var _core_utils = __w_pdfjs_require__(8);
  48331. var _util = __w_pdfjs_require__(2);
  48332. function mayHaveChildren(value) {
  48333. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  48334. }
  48335. function addChildren(node, nodesToVisit) {
  48336. if (node instanceof _primitives.Dict) {
  48337. node = node.getRawValues();
  48338. } else if (node instanceof _base_stream.BaseStream) {
  48339. node = node.dict.getRawValues();
  48340. } else if (!Array.isArray(node)) {
  48341. return;
  48342. }
  48343. for (const rawValue of node) {
  48344. if (mayHaveChildren(rawValue)) {
  48345. nodesToVisit.push(rawValue);
  48346. }
  48347. }
  48348. }
  48349. class ObjectLoader {
  48350. constructor(dict, keys, xref) {
  48351. this.dict = dict;
  48352. this.keys = keys;
  48353. this.xref = xref;
  48354. this.refSet = null;
  48355. }
  48356. async load() {
  48357. if (this.xref.stream.isDataLoaded) {
  48358. return undefined;
  48359. }
  48360. const {
  48361. keys,
  48362. dict
  48363. } = this;
  48364. this.refSet = new _primitives.RefSet();
  48365. const nodesToVisit = [];
  48366. for (let i = 0, ii = keys.length; i < ii; i++) {
  48367. const rawValue = dict.getRaw(keys[i]);
  48368. if (rawValue !== undefined) {
  48369. nodesToVisit.push(rawValue);
  48370. }
  48371. }
  48372. return this._walk(nodesToVisit);
  48373. }
  48374. async _walk(nodesToVisit) {
  48375. const nodesToRevisit = [];
  48376. const pendingRequests = [];
  48377. while (nodesToVisit.length) {
  48378. let currentNode = nodesToVisit.pop();
  48379. if (currentNode instanceof _primitives.Ref) {
  48380. if (this.refSet.has(currentNode)) {
  48381. continue;
  48382. }
  48383. try {
  48384. this.refSet.put(currentNode);
  48385. currentNode = this.xref.fetch(currentNode);
  48386. } catch (ex) {
  48387. if (!(ex instanceof _core_utils.MissingDataException)) {
  48388. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  48389. this.refSet = null;
  48390. const {
  48391. manager
  48392. } = this.xref.stream;
  48393. return manager.requestAllChunks();
  48394. }
  48395. nodesToRevisit.push(currentNode);
  48396. pendingRequests.push({
  48397. begin: ex.begin,
  48398. end: ex.end
  48399. });
  48400. }
  48401. }
  48402. if (currentNode instanceof _base_stream.BaseStream) {
  48403. const baseStreams = currentNode.getBaseStreams();
  48404. if (baseStreams) {
  48405. let foundMissingData = false;
  48406. for (const stream of baseStreams) {
  48407. if (stream.isDataLoaded) {
  48408. continue;
  48409. }
  48410. foundMissingData = true;
  48411. pendingRequests.push({
  48412. begin: stream.start,
  48413. end: stream.end
  48414. });
  48415. }
  48416. if (foundMissingData) {
  48417. nodesToRevisit.push(currentNode);
  48418. }
  48419. }
  48420. }
  48421. addChildren(currentNode, nodesToVisit);
  48422. }
  48423. if (pendingRequests.length) {
  48424. await this.xref.stream.manager.requestRanges(pendingRequests);
  48425. for (const node of nodesToRevisit) {
  48426. if (node instanceof _primitives.Ref) {
  48427. this.refSet.remove(node);
  48428. }
  48429. }
  48430. return this._walk(nodesToRevisit);
  48431. }
  48432. this.refSet = null;
  48433. return undefined;
  48434. }
  48435. }
  48436. exports.ObjectLoader = ObjectLoader;
  48437. /***/ }),
  48438. /* 72 */
  48439. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48440. Object.defineProperty(exports, "__esModule", ({
  48441. value: true
  48442. }));
  48443. exports.incrementalUpdate = incrementalUpdate;
  48444. exports.writeDict = writeDict;
  48445. var _util = __w_pdfjs_require__(2);
  48446. var _primitives = __w_pdfjs_require__(5);
  48447. var _core_utils = __w_pdfjs_require__(8);
  48448. var _xml_parser = __w_pdfjs_require__(69);
  48449. var _base_stream = __w_pdfjs_require__(9);
  48450. var _crypto = __w_pdfjs_require__(73);
  48451. function writeDict(dict, buffer, transform) {
  48452. buffer.push("<<");
  48453. for (const key of dict.getKeys()) {
  48454. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  48455. writeValue(dict.getRaw(key), buffer, transform);
  48456. }
  48457. buffer.push(">>");
  48458. }
  48459. function writeStream(stream, buffer, transform) {
  48460. writeDict(stream.dict, buffer, transform);
  48461. buffer.push(" stream\n");
  48462. let string = stream.getString();
  48463. if (transform !== null) {
  48464. string = transform.encryptString(string);
  48465. }
  48466. buffer.push(string, "\nendstream\n");
  48467. }
  48468. function writeArray(array, buffer, transform) {
  48469. buffer.push("[");
  48470. let first = true;
  48471. for (const val of array) {
  48472. if (!first) {
  48473. buffer.push(" ");
  48474. } else {
  48475. first = false;
  48476. }
  48477. writeValue(val, buffer, transform);
  48478. }
  48479. buffer.push("]");
  48480. }
  48481. function numberToString(value) {
  48482. if (Number.isInteger(value)) {
  48483. return value.toString();
  48484. }
  48485. const roundedValue = Math.round(value * 100);
  48486. if (roundedValue % 100 === 0) {
  48487. return (roundedValue / 100).toString();
  48488. }
  48489. if (roundedValue % 10 === 0) {
  48490. return value.toFixed(1);
  48491. }
  48492. return value.toFixed(2);
  48493. }
  48494. function writeValue(value, buffer, transform) {
  48495. if (value instanceof _primitives.Name) {
  48496. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  48497. } else if (value instanceof _primitives.Ref) {
  48498. buffer.push(`${value.num} ${value.gen} R`);
  48499. } else if (Array.isArray(value)) {
  48500. writeArray(value, buffer, transform);
  48501. } else if (typeof value === "string") {
  48502. if (transform !== null) {
  48503. value = transform.encryptString(value);
  48504. }
  48505. buffer.push(`(${(0, _util.escapeString)(value)})`);
  48506. } else if (typeof value === "number") {
  48507. buffer.push(numberToString(value));
  48508. } else if (typeof value === "boolean") {
  48509. buffer.push(value.toString());
  48510. } else if (value instanceof _primitives.Dict) {
  48511. writeDict(value, buffer, transform);
  48512. } else if (value instanceof _base_stream.BaseStream) {
  48513. writeStream(value, buffer, transform);
  48514. } else if (value === null) {
  48515. buffer.push("null");
  48516. } else {
  48517. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  48518. }
  48519. }
  48520. function writeInt(number, size, offset, buffer) {
  48521. for (let i = size + offset - 1; i > offset - 1; i--) {
  48522. buffer[i] = number & 0xff;
  48523. number >>= 8;
  48524. }
  48525. return offset + size;
  48526. }
  48527. function writeString(string, offset, buffer) {
  48528. for (let i = 0, len = string.length; i < len; i++) {
  48529. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  48530. }
  48531. }
  48532. function computeMD5(filesize, xrefInfo) {
  48533. const time = Math.floor(Date.now() / 1000);
  48534. const filename = xrefInfo.filename || "";
  48535. const md5Buffer = [time.toString(), filename, filesize.toString()];
  48536. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  48537. for (const value of Object.values(xrefInfo.info)) {
  48538. md5Buffer.push(value);
  48539. md5BufferLen += value.length;
  48540. }
  48541. const array = new Uint8Array(md5BufferLen);
  48542. let offset = 0;
  48543. for (const str of md5Buffer) {
  48544. writeString(str, offset, array);
  48545. offset += str.length;
  48546. }
  48547. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  48548. }
  48549. function writeXFADataForAcroform(str, newRefs) {
  48550. const xml = new _xml_parser.SimpleXMLParser({
  48551. hasAttributes: true
  48552. }).parseFromString(str);
  48553. for (const {
  48554. xfa
  48555. } of newRefs) {
  48556. if (!xfa) {
  48557. continue;
  48558. }
  48559. const {
  48560. path,
  48561. value
  48562. } = xfa;
  48563. if (!path) {
  48564. continue;
  48565. }
  48566. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  48567. if (node) {
  48568. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  48569. } else {
  48570. (0, _util.warn)(`Node not found for path: ${path}`);
  48571. }
  48572. }
  48573. const buffer = [];
  48574. xml.documentElement.dump(buffer);
  48575. return buffer.join("");
  48576. }
  48577. function updateXFA({
  48578. xfaData,
  48579. xfaDatasetsRef,
  48580. hasXfaDatasetsEntry,
  48581. acroFormRef,
  48582. acroForm,
  48583. newRefs,
  48584. xref,
  48585. xrefInfo
  48586. }) {
  48587. if (xref === null) {
  48588. return;
  48589. }
  48590. if (!hasXfaDatasetsEntry) {
  48591. if (!acroFormRef) {
  48592. (0, _util.warn)("XFA - Cannot save it");
  48593. return;
  48594. }
  48595. const oldXfa = acroForm.get("XFA");
  48596. const newXfa = oldXfa.slice();
  48597. newXfa.splice(2, 0, "datasets");
  48598. newXfa.splice(3, 0, xfaDatasetsRef);
  48599. acroForm.set("XFA", newXfa);
  48600. const encrypt = xref.encrypt;
  48601. let transform = null;
  48602. if (encrypt) {
  48603. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  48604. }
  48605. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  48606. writeDict(acroForm, buffer, transform);
  48607. buffer.push("\n");
  48608. acroForm.set("XFA", oldXfa);
  48609. newRefs.push({
  48610. ref: acroFormRef,
  48611. data: buffer.join("")
  48612. });
  48613. }
  48614. if (xfaData === null) {
  48615. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  48616. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  48617. }
  48618. const encrypt = xref.encrypt;
  48619. if (encrypt) {
  48620. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  48621. xfaData = transform.encryptString(xfaData);
  48622. }
  48623. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  48624. newRefs.push({
  48625. ref: xfaDatasetsRef,
  48626. data
  48627. });
  48628. }
  48629. function incrementalUpdate({
  48630. originalData,
  48631. xrefInfo,
  48632. newRefs,
  48633. xref = null,
  48634. hasXfa = false,
  48635. xfaDatasetsRef = null,
  48636. hasXfaDatasetsEntry = false,
  48637. acroFormRef = null,
  48638. acroForm = null,
  48639. xfaData = null
  48640. }) {
  48641. if (hasXfa) {
  48642. updateXFA({
  48643. xfaData,
  48644. xfaDatasetsRef,
  48645. hasXfaDatasetsEntry,
  48646. acroFormRef,
  48647. acroForm,
  48648. newRefs,
  48649. xref,
  48650. xrefInfo
  48651. });
  48652. }
  48653. const newXref = new _primitives.Dict(null);
  48654. const refForXrefTable = xrefInfo.newRef;
  48655. let buffer, baseOffset;
  48656. const lastByte = originalData[originalData.length - 1];
  48657. if (lastByte === 0x0a || lastByte === 0x0d) {
  48658. buffer = [];
  48659. baseOffset = originalData.length;
  48660. } else {
  48661. buffer = ["\n"];
  48662. baseOffset = originalData.length + 1;
  48663. }
  48664. newXref.set("Size", refForXrefTable.num + 1);
  48665. newXref.set("Prev", xrefInfo.startXRef);
  48666. newXref.set("Type", _primitives.Name.get("XRef"));
  48667. if (xrefInfo.rootRef !== null) {
  48668. newXref.set("Root", xrefInfo.rootRef);
  48669. }
  48670. if (xrefInfo.infoRef !== null) {
  48671. newXref.set("Info", xrefInfo.infoRef);
  48672. }
  48673. if (xrefInfo.encryptRef !== null) {
  48674. newXref.set("Encrypt", xrefInfo.encryptRef);
  48675. }
  48676. newRefs.push({
  48677. ref: refForXrefTable,
  48678. data: ""
  48679. });
  48680. newRefs = newRefs.sort((a, b) => {
  48681. return a.ref.num - b.ref.num;
  48682. });
  48683. const xrefTableData = [[0, 1, 0xffff]];
  48684. const indexes = [0, 1];
  48685. let maxOffset = 0;
  48686. for (const {
  48687. ref,
  48688. data
  48689. } of newRefs) {
  48690. maxOffset = Math.max(maxOffset, baseOffset);
  48691. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  48692. baseOffset += data.length;
  48693. indexes.push(ref.num, 1);
  48694. buffer.push(data);
  48695. }
  48696. newXref.set("Index", indexes);
  48697. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  48698. const md5 = computeMD5(baseOffset, xrefInfo);
  48699. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  48700. }
  48701. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  48702. const sizes = [1, offsetSize, 2];
  48703. const structSize = sizes[0] + sizes[1] + sizes[2];
  48704. const tableLength = structSize * xrefTableData.length;
  48705. newXref.set("W", sizes);
  48706. newXref.set("Length", tableLength);
  48707. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  48708. writeDict(newXref, buffer, null);
  48709. buffer.push(" stream\n");
  48710. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  48711. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  48712. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  48713. array.set(originalData);
  48714. let offset = originalData.length;
  48715. for (const str of buffer) {
  48716. writeString(str, offset, array);
  48717. offset += str.length;
  48718. }
  48719. for (const [type, objOffset, gen] of xrefTableData) {
  48720. offset = writeInt(type, sizes[0], offset, array);
  48721. offset = writeInt(objOffset, sizes[1], offset, array);
  48722. offset = writeInt(gen, sizes[2], offset, array);
  48723. }
  48724. writeString(footer, offset, array);
  48725. return array;
  48726. }
  48727. /***/ }),
  48728. /* 73 */
  48729. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48730. Object.defineProperty(exports, "__esModule", ({
  48731. value: true
  48732. }));
  48733. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  48734. exports.calculateSHA384 = calculateSHA384;
  48735. exports.calculateSHA512 = void 0;
  48736. var _util = __w_pdfjs_require__(2);
  48737. var _primitives = __w_pdfjs_require__(5);
  48738. var _decrypt_stream = __w_pdfjs_require__(74);
  48739. class ARCFourCipher {
  48740. constructor(key) {
  48741. this.a = 0;
  48742. this.b = 0;
  48743. const s = new Uint8Array(256);
  48744. const keyLength = key.length;
  48745. for (let i = 0; i < 256; ++i) {
  48746. s[i] = i;
  48747. }
  48748. for (let i = 0, j = 0; i < 256; ++i) {
  48749. const tmp = s[i];
  48750. j = j + tmp + key[i % keyLength] & 0xff;
  48751. s[i] = s[j];
  48752. s[j] = tmp;
  48753. }
  48754. this.s = s;
  48755. }
  48756. encryptBlock(data) {
  48757. let a = this.a,
  48758. b = this.b;
  48759. const s = this.s;
  48760. const n = data.length;
  48761. const output = new Uint8Array(n);
  48762. for (let i = 0; i < n; ++i) {
  48763. a = a + 1 & 0xff;
  48764. const tmp = s[a];
  48765. b = b + tmp & 0xff;
  48766. const tmp2 = s[b];
  48767. s[a] = tmp2;
  48768. s[b] = tmp;
  48769. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  48770. }
  48771. this.a = a;
  48772. this.b = b;
  48773. return output;
  48774. }
  48775. decryptBlock(data) {
  48776. return this.encryptBlock(data);
  48777. }
  48778. encrypt(data) {
  48779. return this.encryptBlock(data);
  48780. }
  48781. }
  48782. exports.ARCFourCipher = ARCFourCipher;
  48783. const calculateMD5 = function calculateMD5Closure() {
  48784. 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]);
  48785. 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]);
  48786. function hash(data, offset, length) {
  48787. let h0 = 1732584193,
  48788. h1 = -271733879,
  48789. h2 = -1732584194,
  48790. h3 = 271733878;
  48791. const paddedLength = length + 72 & ~63;
  48792. const padded = new Uint8Array(paddedLength);
  48793. let i, j;
  48794. for (i = 0; i < length; ++i) {
  48795. padded[i] = data[offset++];
  48796. }
  48797. padded[i++] = 0x80;
  48798. const n = paddedLength - 8;
  48799. while (i < n) {
  48800. padded[i++] = 0;
  48801. }
  48802. padded[i++] = length << 3 & 0xff;
  48803. padded[i++] = length >> 5 & 0xff;
  48804. padded[i++] = length >> 13 & 0xff;
  48805. padded[i++] = length >> 21 & 0xff;
  48806. padded[i++] = length >>> 29 & 0xff;
  48807. padded[i++] = 0;
  48808. padded[i++] = 0;
  48809. padded[i++] = 0;
  48810. const w = new Int32Array(16);
  48811. for (i = 0; i < paddedLength;) {
  48812. for (j = 0; j < 16; ++j, i += 4) {
  48813. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  48814. }
  48815. let a = h0,
  48816. b = h1,
  48817. c = h2,
  48818. d = h3,
  48819. f,
  48820. g;
  48821. for (j = 0; j < 64; ++j) {
  48822. if (j < 16) {
  48823. f = b & c | ~b & d;
  48824. g = j;
  48825. } else if (j < 32) {
  48826. f = d & b | ~d & c;
  48827. g = 5 * j + 1 & 15;
  48828. } else if (j < 48) {
  48829. f = b ^ c ^ d;
  48830. g = 3 * j + 5 & 15;
  48831. } else {
  48832. f = c ^ (b | ~d);
  48833. g = 7 * j & 15;
  48834. }
  48835. const tmp = d,
  48836. rotateArg = a + f + k[j] + w[g] | 0,
  48837. rotate = r[j];
  48838. d = c;
  48839. c = b;
  48840. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48841. a = tmp;
  48842. }
  48843. h0 = h0 + a | 0;
  48844. h1 = h1 + b | 0;
  48845. h2 = h2 + c | 0;
  48846. h3 = h3 + d | 0;
  48847. }
  48848. 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]);
  48849. }
  48850. return hash;
  48851. }();
  48852. exports.calculateMD5 = calculateMD5;
  48853. class Word64 {
  48854. constructor(highInteger, lowInteger) {
  48855. this.high = highInteger | 0;
  48856. this.low = lowInteger | 0;
  48857. }
  48858. and(word) {
  48859. this.high &= word.high;
  48860. this.low &= word.low;
  48861. }
  48862. xor(word) {
  48863. this.high ^= word.high;
  48864. this.low ^= word.low;
  48865. }
  48866. or(word) {
  48867. this.high |= word.high;
  48868. this.low |= word.low;
  48869. }
  48870. shiftRight(places) {
  48871. if (places >= 32) {
  48872. this.low = this.high >>> places - 32 | 0;
  48873. this.high = 0;
  48874. } else {
  48875. this.low = this.low >>> places | this.high << 32 - places;
  48876. this.high = this.high >>> places | 0;
  48877. }
  48878. }
  48879. shiftLeft(places) {
  48880. if (places >= 32) {
  48881. this.high = this.low << places - 32;
  48882. this.low = 0;
  48883. } else {
  48884. this.high = this.high << places | this.low >>> 32 - places;
  48885. this.low <<= places;
  48886. }
  48887. }
  48888. rotateRight(places) {
  48889. let low, high;
  48890. if (places & 32) {
  48891. high = this.low;
  48892. low = this.high;
  48893. } else {
  48894. low = this.low;
  48895. high = this.high;
  48896. }
  48897. places &= 31;
  48898. this.low = low >>> places | high << 32 - places;
  48899. this.high = high >>> places | low << 32 - places;
  48900. }
  48901. not() {
  48902. this.high = ~this.high;
  48903. this.low = ~this.low;
  48904. }
  48905. add(word) {
  48906. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48907. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48908. if (lowAdd > 0xffffffff) {
  48909. highAdd += 1;
  48910. }
  48911. this.low = lowAdd | 0;
  48912. this.high = highAdd | 0;
  48913. }
  48914. copyTo(bytes, offset) {
  48915. bytes[offset] = this.high >>> 24 & 0xff;
  48916. bytes[offset + 1] = this.high >> 16 & 0xff;
  48917. bytes[offset + 2] = this.high >> 8 & 0xff;
  48918. bytes[offset + 3] = this.high & 0xff;
  48919. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48920. bytes[offset + 5] = this.low >> 16 & 0xff;
  48921. bytes[offset + 6] = this.low >> 8 & 0xff;
  48922. bytes[offset + 7] = this.low & 0xff;
  48923. }
  48924. assign(word) {
  48925. this.high = word.high;
  48926. this.low = word.low;
  48927. }
  48928. }
  48929. const calculateSHA256 = function calculateSHA256Closure() {
  48930. function rotr(x, n) {
  48931. return x >>> n | x << 32 - n;
  48932. }
  48933. function ch(x, y, z) {
  48934. return x & y ^ ~x & z;
  48935. }
  48936. function maj(x, y, z) {
  48937. return x & y ^ x & z ^ y & z;
  48938. }
  48939. function sigma(x) {
  48940. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48941. }
  48942. function sigmaPrime(x) {
  48943. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48944. }
  48945. function littleSigma(x) {
  48946. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48947. }
  48948. function littleSigmaPrime(x) {
  48949. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48950. }
  48951. 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];
  48952. function hash(data, offset, length) {
  48953. let h0 = 0x6a09e667,
  48954. h1 = 0xbb67ae85,
  48955. h2 = 0x3c6ef372,
  48956. h3 = 0xa54ff53a,
  48957. h4 = 0x510e527f,
  48958. h5 = 0x9b05688c,
  48959. h6 = 0x1f83d9ab,
  48960. h7 = 0x5be0cd19;
  48961. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48962. const padded = new Uint8Array(paddedLength);
  48963. let i, j;
  48964. for (i = 0; i < length; ++i) {
  48965. padded[i] = data[offset++];
  48966. }
  48967. padded[i++] = 0x80;
  48968. const n = paddedLength - 8;
  48969. while (i < n) {
  48970. padded[i++] = 0;
  48971. }
  48972. padded[i++] = 0;
  48973. padded[i++] = 0;
  48974. padded[i++] = 0;
  48975. padded[i++] = length >>> 29 & 0xff;
  48976. padded[i++] = length >> 21 & 0xff;
  48977. padded[i++] = length >> 13 & 0xff;
  48978. padded[i++] = length >> 5 & 0xff;
  48979. padded[i++] = length << 3 & 0xff;
  48980. const w = new Uint32Array(64);
  48981. for (i = 0; i < paddedLength;) {
  48982. for (j = 0; j < 16; ++j) {
  48983. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48984. i += 4;
  48985. }
  48986. for (j = 16; j < 64; ++j) {
  48987. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48988. }
  48989. let a = h0,
  48990. b = h1,
  48991. c = h2,
  48992. d = h3,
  48993. e = h4,
  48994. f = h5,
  48995. g = h6,
  48996. h = h7,
  48997. t1,
  48998. t2;
  48999. for (j = 0; j < 64; ++j) {
  49000. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  49001. t2 = sigma(a) + maj(a, b, c);
  49002. h = g;
  49003. g = f;
  49004. f = e;
  49005. e = d + t1 | 0;
  49006. d = c;
  49007. c = b;
  49008. b = a;
  49009. a = t1 + t2 | 0;
  49010. }
  49011. h0 = h0 + a | 0;
  49012. h1 = h1 + b | 0;
  49013. h2 = h2 + c | 0;
  49014. h3 = h3 + d | 0;
  49015. h4 = h4 + e | 0;
  49016. h5 = h5 + f | 0;
  49017. h6 = h6 + g | 0;
  49018. h7 = h7 + h | 0;
  49019. }
  49020. 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]);
  49021. }
  49022. return hash;
  49023. }();
  49024. exports.calculateSHA256 = calculateSHA256;
  49025. const calculateSHA512 = function calculateSHA512Closure() {
  49026. function ch(result, x, y, z, tmp) {
  49027. result.assign(x);
  49028. result.and(y);
  49029. tmp.assign(x);
  49030. tmp.not();
  49031. tmp.and(z);
  49032. result.xor(tmp);
  49033. }
  49034. function maj(result, x, y, z, tmp) {
  49035. result.assign(x);
  49036. result.and(y);
  49037. tmp.assign(x);
  49038. tmp.and(z);
  49039. result.xor(tmp);
  49040. tmp.assign(y);
  49041. tmp.and(z);
  49042. result.xor(tmp);
  49043. }
  49044. function sigma(result, x, tmp) {
  49045. result.assign(x);
  49046. result.rotateRight(28);
  49047. tmp.assign(x);
  49048. tmp.rotateRight(34);
  49049. result.xor(tmp);
  49050. tmp.assign(x);
  49051. tmp.rotateRight(39);
  49052. result.xor(tmp);
  49053. }
  49054. function sigmaPrime(result, x, tmp) {
  49055. result.assign(x);
  49056. result.rotateRight(14);
  49057. tmp.assign(x);
  49058. tmp.rotateRight(18);
  49059. result.xor(tmp);
  49060. tmp.assign(x);
  49061. tmp.rotateRight(41);
  49062. result.xor(tmp);
  49063. }
  49064. function littleSigma(result, x, tmp) {
  49065. result.assign(x);
  49066. result.rotateRight(1);
  49067. tmp.assign(x);
  49068. tmp.rotateRight(8);
  49069. result.xor(tmp);
  49070. tmp.assign(x);
  49071. tmp.shiftRight(7);
  49072. result.xor(tmp);
  49073. }
  49074. function littleSigmaPrime(result, x, tmp) {
  49075. result.assign(x);
  49076. result.rotateRight(19);
  49077. tmp.assign(x);
  49078. tmp.rotateRight(61);
  49079. result.xor(tmp);
  49080. tmp.assign(x);
  49081. tmp.shiftRight(6);
  49082. result.xor(tmp);
  49083. }
  49084. 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)];
  49085. function hash(data, offset, length, mode384 = false) {
  49086. let h0, h1, h2, h3, h4, h5, h6, h7;
  49087. if (!mode384) {
  49088. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  49089. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  49090. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  49091. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  49092. h4 = new Word64(0x510e527f, 0xade682d1);
  49093. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  49094. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  49095. h7 = new Word64(0x5be0cd19, 0x137e2179);
  49096. } else {
  49097. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  49098. h1 = new Word64(0x629a292a, 0x367cd507);
  49099. h2 = new Word64(0x9159015a, 0x3070dd17);
  49100. h3 = new Word64(0x152fecd8, 0xf70e5939);
  49101. h4 = new Word64(0x67332667, 0xffc00b31);
  49102. h5 = new Word64(0x8eb44a87, 0x68581511);
  49103. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  49104. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  49105. }
  49106. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  49107. const padded = new Uint8Array(paddedLength);
  49108. let i, j;
  49109. for (i = 0; i < length; ++i) {
  49110. padded[i] = data[offset++];
  49111. }
  49112. padded[i++] = 0x80;
  49113. const n = paddedLength - 16;
  49114. while (i < n) {
  49115. padded[i++] = 0;
  49116. }
  49117. padded[i++] = 0;
  49118. padded[i++] = 0;
  49119. padded[i++] = 0;
  49120. padded[i++] = 0;
  49121. padded[i++] = 0;
  49122. padded[i++] = 0;
  49123. padded[i++] = 0;
  49124. padded[i++] = 0;
  49125. padded[i++] = 0;
  49126. padded[i++] = 0;
  49127. padded[i++] = 0;
  49128. padded[i++] = length >>> 29 & 0xff;
  49129. padded[i++] = length >> 21 & 0xff;
  49130. padded[i++] = length >> 13 & 0xff;
  49131. padded[i++] = length >> 5 & 0xff;
  49132. padded[i++] = length << 3 & 0xff;
  49133. const w = new Array(80);
  49134. for (i = 0; i < 80; i++) {
  49135. w[i] = new Word64(0, 0);
  49136. }
  49137. let a = new Word64(0, 0),
  49138. b = new Word64(0, 0),
  49139. c = new Word64(0, 0);
  49140. let d = new Word64(0, 0),
  49141. e = new Word64(0, 0),
  49142. f = new Word64(0, 0);
  49143. let g = new Word64(0, 0),
  49144. h = new Word64(0, 0);
  49145. const t1 = new Word64(0, 0),
  49146. t2 = new Word64(0, 0);
  49147. const tmp1 = new Word64(0, 0),
  49148. tmp2 = new Word64(0, 0);
  49149. let tmp3;
  49150. for (i = 0; i < paddedLength;) {
  49151. for (j = 0; j < 16; ++j) {
  49152. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  49153. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  49154. i += 8;
  49155. }
  49156. for (j = 16; j < 80; ++j) {
  49157. tmp3 = w[j];
  49158. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  49159. tmp3.add(w[j - 7]);
  49160. littleSigma(tmp1, w[j - 15], tmp2);
  49161. tmp3.add(tmp1);
  49162. tmp3.add(w[j - 16]);
  49163. }
  49164. a.assign(h0);
  49165. b.assign(h1);
  49166. c.assign(h2);
  49167. d.assign(h3);
  49168. e.assign(h4);
  49169. f.assign(h5);
  49170. g.assign(h6);
  49171. h.assign(h7);
  49172. for (j = 0; j < 80; ++j) {
  49173. t1.assign(h);
  49174. sigmaPrime(tmp1, e, tmp2);
  49175. t1.add(tmp1);
  49176. ch(tmp1, e, f, g, tmp2);
  49177. t1.add(tmp1);
  49178. t1.add(k[j]);
  49179. t1.add(w[j]);
  49180. sigma(t2, a, tmp2);
  49181. maj(tmp1, a, b, c, tmp2);
  49182. t2.add(tmp1);
  49183. tmp3 = h;
  49184. h = g;
  49185. g = f;
  49186. f = e;
  49187. d.add(t1);
  49188. e = d;
  49189. d = c;
  49190. c = b;
  49191. b = a;
  49192. tmp3.assign(t1);
  49193. tmp3.add(t2);
  49194. a = tmp3;
  49195. }
  49196. h0.add(a);
  49197. h1.add(b);
  49198. h2.add(c);
  49199. h3.add(d);
  49200. h4.add(e);
  49201. h5.add(f);
  49202. h6.add(g);
  49203. h7.add(h);
  49204. }
  49205. let result;
  49206. if (!mode384) {
  49207. result = new Uint8Array(64);
  49208. h0.copyTo(result, 0);
  49209. h1.copyTo(result, 8);
  49210. h2.copyTo(result, 16);
  49211. h3.copyTo(result, 24);
  49212. h4.copyTo(result, 32);
  49213. h5.copyTo(result, 40);
  49214. h6.copyTo(result, 48);
  49215. h7.copyTo(result, 56);
  49216. } else {
  49217. result = new Uint8Array(48);
  49218. h0.copyTo(result, 0);
  49219. h1.copyTo(result, 8);
  49220. h2.copyTo(result, 16);
  49221. h3.copyTo(result, 24);
  49222. h4.copyTo(result, 32);
  49223. h5.copyTo(result, 40);
  49224. }
  49225. return result;
  49226. }
  49227. return hash;
  49228. }();
  49229. exports.calculateSHA512 = calculateSHA512;
  49230. function calculateSHA384(data, offset, length) {
  49231. return calculateSHA512(data, offset, length, true);
  49232. }
  49233. class NullCipher {
  49234. decryptBlock(data) {
  49235. return data;
  49236. }
  49237. encrypt(data) {
  49238. return data;
  49239. }
  49240. }
  49241. class AESBaseCipher {
  49242. constructor() {
  49243. if (this.constructor === AESBaseCipher) {
  49244. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  49245. }
  49246. 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]);
  49247. 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]);
  49248. 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]);
  49249. this._mixCol = new Uint8Array(256);
  49250. for (let i = 0; i < 256; i++) {
  49251. if (i < 128) {
  49252. this._mixCol[i] = i << 1;
  49253. } else {
  49254. this._mixCol[i] = i << 1 ^ 0x1b;
  49255. }
  49256. }
  49257. this.buffer = new Uint8Array(16);
  49258. this.bufferPosition = 0;
  49259. }
  49260. _expandKey(cipherKey) {
  49261. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  49262. }
  49263. _decrypt(input, key) {
  49264. let t, u, v;
  49265. const state = new Uint8Array(16);
  49266. state.set(input);
  49267. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49268. state[j] ^= key[k];
  49269. }
  49270. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  49271. t = state[13];
  49272. state[13] = state[9];
  49273. state[9] = state[5];
  49274. state[5] = state[1];
  49275. state[1] = t;
  49276. t = state[14];
  49277. u = state[10];
  49278. state[14] = state[6];
  49279. state[10] = state[2];
  49280. state[6] = t;
  49281. state[2] = u;
  49282. t = state[15];
  49283. u = state[11];
  49284. v = state[7];
  49285. state[15] = state[3];
  49286. state[11] = t;
  49287. state[7] = u;
  49288. state[3] = v;
  49289. for (let j = 0; j < 16; ++j) {
  49290. state[j] = this._inv_s[state[j]];
  49291. }
  49292. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49293. state[j] ^= key[k];
  49294. }
  49295. for (let j = 0; j < 16; j += 4) {
  49296. const s0 = this._mix[state[j]];
  49297. const s1 = this._mix[state[j + 1]];
  49298. const s2 = this._mix[state[j + 2]];
  49299. const s3 = this._mix[state[j + 3]];
  49300. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  49301. state[j] = t >>> 24 & 0xff;
  49302. state[j + 1] = t >> 16 & 0xff;
  49303. state[j + 2] = t >> 8 & 0xff;
  49304. state[j + 3] = t & 0xff;
  49305. }
  49306. }
  49307. t = state[13];
  49308. state[13] = state[9];
  49309. state[9] = state[5];
  49310. state[5] = state[1];
  49311. state[1] = t;
  49312. t = state[14];
  49313. u = state[10];
  49314. state[14] = state[6];
  49315. state[10] = state[2];
  49316. state[6] = t;
  49317. state[2] = u;
  49318. t = state[15];
  49319. u = state[11];
  49320. v = state[7];
  49321. state[15] = state[3];
  49322. state[11] = t;
  49323. state[7] = u;
  49324. state[3] = v;
  49325. for (let j = 0; j < 16; ++j) {
  49326. state[j] = this._inv_s[state[j]];
  49327. state[j] ^= key[j];
  49328. }
  49329. return state;
  49330. }
  49331. _encrypt(input, key) {
  49332. const s = this._s;
  49333. let t, u, v;
  49334. const state = new Uint8Array(16);
  49335. state.set(input);
  49336. for (let j = 0; j < 16; ++j) {
  49337. state[j] ^= key[j];
  49338. }
  49339. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  49340. for (let j = 0; j < 16; ++j) {
  49341. state[j] = s[state[j]];
  49342. }
  49343. v = state[1];
  49344. state[1] = state[5];
  49345. state[5] = state[9];
  49346. state[9] = state[13];
  49347. state[13] = v;
  49348. v = state[2];
  49349. u = state[6];
  49350. state[2] = state[10];
  49351. state[6] = state[14];
  49352. state[10] = v;
  49353. state[14] = u;
  49354. v = state[3];
  49355. u = state[7];
  49356. t = state[11];
  49357. state[3] = state[15];
  49358. state[7] = v;
  49359. state[11] = u;
  49360. state[15] = t;
  49361. for (let j = 0; j < 16; j += 4) {
  49362. const s0 = state[j + 0];
  49363. const s1 = state[j + 1];
  49364. const s2 = state[j + 2];
  49365. const s3 = state[j + 3];
  49366. t = s0 ^ s1 ^ s2 ^ s3;
  49367. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  49368. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  49369. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  49370. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  49371. }
  49372. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49373. state[j] ^= key[k];
  49374. }
  49375. }
  49376. for (let j = 0; j < 16; ++j) {
  49377. state[j] = s[state[j]];
  49378. }
  49379. v = state[1];
  49380. state[1] = state[5];
  49381. state[5] = state[9];
  49382. state[9] = state[13];
  49383. state[13] = v;
  49384. v = state[2];
  49385. u = state[6];
  49386. state[2] = state[10];
  49387. state[6] = state[14];
  49388. state[10] = v;
  49389. state[14] = u;
  49390. v = state[3];
  49391. u = state[7];
  49392. t = state[11];
  49393. state[3] = state[15];
  49394. state[7] = v;
  49395. state[11] = u;
  49396. state[15] = t;
  49397. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49398. state[j] ^= key[k];
  49399. }
  49400. return state;
  49401. }
  49402. _decryptBlock2(data, finalize) {
  49403. const sourceLength = data.length;
  49404. let buffer = this.buffer,
  49405. bufferLength = this.bufferPosition;
  49406. const result = [];
  49407. let iv = this.iv;
  49408. for (let i = 0; i < sourceLength; ++i) {
  49409. buffer[bufferLength] = data[i];
  49410. ++bufferLength;
  49411. if (bufferLength < 16) {
  49412. continue;
  49413. }
  49414. const plain = this._decrypt(buffer, this._key);
  49415. for (let j = 0; j < 16; ++j) {
  49416. plain[j] ^= iv[j];
  49417. }
  49418. iv = buffer;
  49419. result.push(plain);
  49420. buffer = new Uint8Array(16);
  49421. bufferLength = 0;
  49422. }
  49423. this.buffer = buffer;
  49424. this.bufferLength = bufferLength;
  49425. this.iv = iv;
  49426. if (result.length === 0) {
  49427. return new Uint8Array(0);
  49428. }
  49429. let outputLength = 16 * result.length;
  49430. if (finalize) {
  49431. const lastBlock = result[result.length - 1];
  49432. let psLen = lastBlock[15];
  49433. if (psLen <= 16) {
  49434. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49435. if (lastBlock[i] !== psLen) {
  49436. psLen = 0;
  49437. break;
  49438. }
  49439. }
  49440. outputLength -= psLen;
  49441. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49442. }
  49443. }
  49444. const output = new Uint8Array(outputLength);
  49445. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49446. output.set(result[i], j);
  49447. }
  49448. return output;
  49449. }
  49450. decryptBlock(data, finalize, iv = null) {
  49451. const sourceLength = data.length;
  49452. const buffer = this.buffer;
  49453. let bufferLength = this.bufferPosition;
  49454. if (iv) {
  49455. this.iv = iv;
  49456. } else {
  49457. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49458. buffer[bufferLength] = data[i];
  49459. }
  49460. if (bufferLength < 16) {
  49461. this.bufferLength = bufferLength;
  49462. return new Uint8Array(0);
  49463. }
  49464. this.iv = buffer;
  49465. data = data.subarray(16);
  49466. }
  49467. this.buffer = new Uint8Array(16);
  49468. this.bufferLength = 0;
  49469. this.decryptBlock = this._decryptBlock2;
  49470. return this.decryptBlock(data, finalize);
  49471. }
  49472. encrypt(data, iv) {
  49473. const sourceLength = data.length;
  49474. let buffer = this.buffer,
  49475. bufferLength = this.bufferPosition;
  49476. const result = [];
  49477. if (!iv) {
  49478. iv = new Uint8Array(16);
  49479. }
  49480. for (let i = 0; i < sourceLength; ++i) {
  49481. buffer[bufferLength] = data[i];
  49482. ++bufferLength;
  49483. if (bufferLength < 16) {
  49484. continue;
  49485. }
  49486. for (let j = 0; j < 16; ++j) {
  49487. buffer[j] ^= iv[j];
  49488. }
  49489. const cipher = this._encrypt(buffer, this._key);
  49490. iv = cipher;
  49491. result.push(cipher);
  49492. buffer = new Uint8Array(16);
  49493. bufferLength = 0;
  49494. }
  49495. this.buffer = buffer;
  49496. this.bufferLength = bufferLength;
  49497. this.iv = iv;
  49498. if (result.length === 0) {
  49499. return new Uint8Array(0);
  49500. }
  49501. const outputLength = 16 * result.length;
  49502. const output = new Uint8Array(outputLength);
  49503. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49504. output.set(result[i], j);
  49505. }
  49506. return output;
  49507. }
  49508. }
  49509. class AES128Cipher extends AESBaseCipher {
  49510. constructor(key) {
  49511. super();
  49512. this._cyclesOfRepetition = 10;
  49513. this._keySize = 160;
  49514. 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]);
  49515. this._key = this._expandKey(key);
  49516. }
  49517. _expandKey(cipherKey) {
  49518. const b = 176;
  49519. const s = this._s;
  49520. const rcon = this._rcon;
  49521. const result = new Uint8Array(b);
  49522. result.set(cipherKey);
  49523. for (let j = 16, i = 1; j < b; ++i) {
  49524. let t1 = result[j - 3];
  49525. let t2 = result[j - 2];
  49526. let t3 = result[j - 1];
  49527. let t4 = result[j - 4];
  49528. t1 = s[t1];
  49529. t2 = s[t2];
  49530. t3 = s[t3];
  49531. t4 = s[t4];
  49532. t1 ^= rcon[i];
  49533. for (let n = 0; n < 4; ++n) {
  49534. result[j] = t1 ^= result[j - 16];
  49535. j++;
  49536. result[j] = t2 ^= result[j - 16];
  49537. j++;
  49538. result[j] = t3 ^= result[j - 16];
  49539. j++;
  49540. result[j] = t4 ^= result[j - 16];
  49541. j++;
  49542. }
  49543. }
  49544. return result;
  49545. }
  49546. }
  49547. exports.AES128Cipher = AES128Cipher;
  49548. class AES256Cipher extends AESBaseCipher {
  49549. constructor(key) {
  49550. super();
  49551. this._cyclesOfRepetition = 14;
  49552. this._keySize = 224;
  49553. this._key = this._expandKey(key);
  49554. }
  49555. _expandKey(cipherKey) {
  49556. const b = 240;
  49557. const s = this._s;
  49558. const result = new Uint8Array(b);
  49559. result.set(cipherKey);
  49560. let r = 1;
  49561. let t1, t2, t3, t4;
  49562. for (let j = 32, i = 1; j < b; ++i) {
  49563. if (j % 32 === 16) {
  49564. t1 = s[t1];
  49565. t2 = s[t2];
  49566. t3 = s[t3];
  49567. t4 = s[t4];
  49568. } else if (j % 32 === 0) {
  49569. t1 = result[j - 3];
  49570. t2 = result[j - 2];
  49571. t3 = result[j - 1];
  49572. t4 = result[j - 4];
  49573. t1 = s[t1];
  49574. t2 = s[t2];
  49575. t3 = s[t3];
  49576. t4 = s[t4];
  49577. t1 ^= r;
  49578. if ((r <<= 1) >= 256) {
  49579. r = (r ^ 0x1b) & 0xff;
  49580. }
  49581. }
  49582. for (let n = 0; n < 4; ++n) {
  49583. result[j] = t1 ^= result[j - 32];
  49584. j++;
  49585. result[j] = t2 ^= result[j - 32];
  49586. j++;
  49587. result[j] = t3 ^= result[j - 32];
  49588. j++;
  49589. result[j] = t4 ^= result[j - 32];
  49590. j++;
  49591. }
  49592. }
  49593. return result;
  49594. }
  49595. }
  49596. exports.AES256Cipher = AES256Cipher;
  49597. class PDF17 {
  49598. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49599. const hashData = new Uint8Array(password.length + 56);
  49600. hashData.set(password, 0);
  49601. hashData.set(ownerValidationSalt, password.length);
  49602. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49603. const result = calculateSHA256(hashData, 0, hashData.length);
  49604. return (0, _util.isArrayEqual)(result, ownerPassword);
  49605. }
  49606. checkUserPassword(password, userValidationSalt, userPassword) {
  49607. const hashData = new Uint8Array(password.length + 8);
  49608. hashData.set(password, 0);
  49609. hashData.set(userValidationSalt, password.length);
  49610. const result = calculateSHA256(hashData, 0, hashData.length);
  49611. return (0, _util.isArrayEqual)(result, userPassword);
  49612. }
  49613. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49614. const hashData = new Uint8Array(password.length + 56);
  49615. hashData.set(password, 0);
  49616. hashData.set(ownerKeySalt, password.length);
  49617. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49618. const key = calculateSHA256(hashData, 0, hashData.length);
  49619. const cipher = new AES256Cipher(key);
  49620. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49621. }
  49622. getUserKey(password, userKeySalt, userEncryption) {
  49623. const hashData = new Uint8Array(password.length + 8);
  49624. hashData.set(password, 0);
  49625. hashData.set(userKeySalt, password.length);
  49626. const key = calculateSHA256(hashData, 0, hashData.length);
  49627. const cipher = new AES256Cipher(key);
  49628. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49629. }
  49630. }
  49631. exports.PDF17 = PDF17;
  49632. const PDF20 = function PDF20Closure() {
  49633. function calculatePDF20Hash(password, input, userBytes) {
  49634. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  49635. let e = [0];
  49636. let i = 0;
  49637. while (i < 64 || e[e.length - 1] > i - 32) {
  49638. const combinedLength = password.length + k.length + userBytes.length,
  49639. combinedArray = new Uint8Array(combinedLength);
  49640. let writeOffset = 0;
  49641. combinedArray.set(password, writeOffset);
  49642. writeOffset += password.length;
  49643. combinedArray.set(k, writeOffset);
  49644. writeOffset += k.length;
  49645. combinedArray.set(userBytes, writeOffset);
  49646. const k1 = new Uint8Array(combinedLength * 64);
  49647. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  49648. k1.set(combinedArray, pos);
  49649. }
  49650. const cipher = new AES128Cipher(k.subarray(0, 16));
  49651. e = cipher.encrypt(k1, k.subarray(16, 32));
  49652. let remainder = 0;
  49653. for (let z = 0; z < 16; z++) {
  49654. remainder *= 256 % 3;
  49655. remainder %= 3;
  49656. remainder += (e[z] >>> 0) % 3;
  49657. remainder %= 3;
  49658. }
  49659. if (remainder === 0) {
  49660. k = calculateSHA256(e, 0, e.length);
  49661. } else if (remainder === 1) {
  49662. k = calculateSHA384(e, 0, e.length);
  49663. } else if (remainder === 2) {
  49664. k = calculateSHA512(e, 0, e.length);
  49665. }
  49666. i++;
  49667. }
  49668. return k.subarray(0, 32);
  49669. }
  49670. class PDF20 {
  49671. hash(password, concatBytes, userBytes) {
  49672. return calculatePDF20Hash(password, concatBytes, userBytes);
  49673. }
  49674. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49675. const hashData = new Uint8Array(password.length + 56);
  49676. hashData.set(password, 0);
  49677. hashData.set(ownerValidationSalt, password.length);
  49678. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49679. const result = calculatePDF20Hash(password, hashData, userBytes);
  49680. return (0, _util.isArrayEqual)(result, ownerPassword);
  49681. }
  49682. checkUserPassword(password, userValidationSalt, userPassword) {
  49683. const hashData = new Uint8Array(password.length + 8);
  49684. hashData.set(password, 0);
  49685. hashData.set(userValidationSalt, password.length);
  49686. const result = calculatePDF20Hash(password, hashData, []);
  49687. return (0, _util.isArrayEqual)(result, userPassword);
  49688. }
  49689. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49690. const hashData = new Uint8Array(password.length + 56);
  49691. hashData.set(password, 0);
  49692. hashData.set(ownerKeySalt, password.length);
  49693. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49694. const key = calculatePDF20Hash(password, hashData, userBytes);
  49695. const cipher = new AES256Cipher(key);
  49696. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49697. }
  49698. getUserKey(password, userKeySalt, userEncryption) {
  49699. const hashData = new Uint8Array(password.length + 8);
  49700. hashData.set(password, 0);
  49701. hashData.set(userKeySalt, password.length);
  49702. const key = calculatePDF20Hash(password, hashData, []);
  49703. const cipher = new AES256Cipher(key);
  49704. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49705. }
  49706. }
  49707. return PDF20;
  49708. }();
  49709. exports.PDF20 = PDF20;
  49710. class CipherTransform {
  49711. constructor(stringCipherConstructor, streamCipherConstructor) {
  49712. this.StringCipherConstructor = stringCipherConstructor;
  49713. this.StreamCipherConstructor = streamCipherConstructor;
  49714. }
  49715. createStream(stream, length) {
  49716. const cipher = new this.StreamCipherConstructor();
  49717. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  49718. return cipher.decryptBlock(data, finalize);
  49719. });
  49720. }
  49721. decryptString(s) {
  49722. const cipher = new this.StringCipherConstructor();
  49723. let data = (0, _util.stringToBytes)(s);
  49724. data = cipher.decryptBlock(data, true);
  49725. return (0, _util.bytesToString)(data);
  49726. }
  49727. encryptString(s) {
  49728. const cipher = new this.StringCipherConstructor();
  49729. if (cipher instanceof AESBaseCipher) {
  49730. const strLen = s.length;
  49731. const pad = 16 - strLen % 16;
  49732. s += String.fromCharCode(pad).repeat(pad);
  49733. const iv = new Uint8Array(16);
  49734. if (typeof crypto !== "undefined") {
  49735. crypto.getRandomValues(iv);
  49736. } else {
  49737. for (let i = 0; i < 16; i++) {
  49738. iv[i] = Math.floor(256 * Math.random());
  49739. }
  49740. }
  49741. let data = (0, _util.stringToBytes)(s);
  49742. data = cipher.encrypt(data, iv);
  49743. const buf = new Uint8Array(16 + data.length);
  49744. buf.set(iv);
  49745. buf.set(data, 16);
  49746. return (0, _util.bytesToString)(buf);
  49747. }
  49748. let data = (0, _util.stringToBytes)(s);
  49749. data = cipher.encrypt(data);
  49750. return (0, _util.bytesToString)(data);
  49751. }
  49752. }
  49753. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  49754. 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]);
  49755. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  49756. if (password) {
  49757. const passwordLength = Math.min(127, password.length);
  49758. password = password.subarray(0, passwordLength);
  49759. } else {
  49760. password = [];
  49761. }
  49762. let pdfAlgorithm;
  49763. if (revision === 6) {
  49764. pdfAlgorithm = new PDF20();
  49765. } else {
  49766. pdfAlgorithm = new PDF17();
  49767. }
  49768. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  49769. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  49770. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  49771. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  49772. }
  49773. return null;
  49774. }
  49775. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  49776. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  49777. const hashData = new Uint8Array(hashDataSize);
  49778. let i = 0,
  49779. j,
  49780. n;
  49781. if (password) {
  49782. n = Math.min(32, password.length);
  49783. for (; i < n; ++i) {
  49784. hashData[i] = password[i];
  49785. }
  49786. }
  49787. j = 0;
  49788. while (i < 32) {
  49789. hashData[i++] = defaultPasswordBytes[j++];
  49790. }
  49791. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  49792. hashData[i++] = ownerPassword[j];
  49793. }
  49794. hashData[i++] = flags & 0xff;
  49795. hashData[i++] = flags >> 8 & 0xff;
  49796. hashData[i++] = flags >> 16 & 0xff;
  49797. hashData[i++] = flags >>> 24 & 0xff;
  49798. for (j = 0, n = fileId.length; j < n; ++j) {
  49799. hashData[i++] = fileId[j];
  49800. }
  49801. if (revision >= 4 && !encryptMetadata) {
  49802. hashData[i++] = 0xff;
  49803. hashData[i++] = 0xff;
  49804. hashData[i++] = 0xff;
  49805. hashData[i++] = 0xff;
  49806. }
  49807. let hash = calculateMD5(hashData, 0, i);
  49808. const keyLengthInBytes = keyLength >> 3;
  49809. if (revision >= 3) {
  49810. for (j = 0; j < 50; ++j) {
  49811. hash = calculateMD5(hash, 0, keyLengthInBytes);
  49812. }
  49813. }
  49814. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  49815. let cipher, checkData;
  49816. if (revision >= 3) {
  49817. for (i = 0; i < 32; ++i) {
  49818. hashData[i] = defaultPasswordBytes[i];
  49819. }
  49820. for (j = 0, n = fileId.length; j < n; ++j) {
  49821. hashData[i++] = fileId[j];
  49822. }
  49823. cipher = new ARCFourCipher(encryptionKey);
  49824. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  49825. n = encryptionKey.length;
  49826. const derivedKey = new Uint8Array(n);
  49827. for (j = 1; j <= 19; ++j) {
  49828. for (let k = 0; k < n; ++k) {
  49829. derivedKey[k] = encryptionKey[k] ^ j;
  49830. }
  49831. cipher = new ARCFourCipher(derivedKey);
  49832. checkData = cipher.encryptBlock(checkData);
  49833. }
  49834. for (j = 0, n = checkData.length; j < n; ++j) {
  49835. if (userPassword[j] !== checkData[j]) {
  49836. return null;
  49837. }
  49838. }
  49839. } else {
  49840. cipher = new ARCFourCipher(encryptionKey);
  49841. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49842. for (j = 0, n = checkData.length; j < n; ++j) {
  49843. if (userPassword[j] !== checkData[j]) {
  49844. return null;
  49845. }
  49846. }
  49847. }
  49848. return encryptionKey;
  49849. }
  49850. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49851. const hashData = new Uint8Array(32);
  49852. let i = 0;
  49853. const n = Math.min(32, password.length);
  49854. for (; i < n; ++i) {
  49855. hashData[i] = password[i];
  49856. }
  49857. let j = 0;
  49858. while (i < 32) {
  49859. hashData[i++] = defaultPasswordBytes[j++];
  49860. }
  49861. let hash = calculateMD5(hashData, 0, i);
  49862. const keyLengthInBytes = keyLength >> 3;
  49863. if (revision >= 3) {
  49864. for (j = 0; j < 50; ++j) {
  49865. hash = calculateMD5(hash, 0, hash.length);
  49866. }
  49867. }
  49868. let cipher, userPassword;
  49869. if (revision >= 3) {
  49870. userPassword = ownerPassword;
  49871. const derivedKey = new Uint8Array(keyLengthInBytes);
  49872. for (j = 19; j >= 0; j--) {
  49873. for (let k = 0; k < keyLengthInBytes; ++k) {
  49874. derivedKey[k] = hash[k] ^ j;
  49875. }
  49876. cipher = new ARCFourCipher(derivedKey);
  49877. userPassword = cipher.encryptBlock(userPassword);
  49878. }
  49879. } else {
  49880. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49881. userPassword = cipher.encryptBlock(ownerPassword);
  49882. }
  49883. return userPassword;
  49884. }
  49885. const identityName = _primitives.Name.get("Identity");
  49886. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49887. const key = new Uint8Array(encryptionKey.length + 9);
  49888. const n = encryptionKey.length;
  49889. let i;
  49890. for (i = 0; i < n; ++i) {
  49891. key[i] = encryptionKey[i];
  49892. }
  49893. key[i++] = num & 0xff;
  49894. key[i++] = num >> 8 & 0xff;
  49895. key[i++] = num >> 16 & 0xff;
  49896. key[i++] = gen & 0xff;
  49897. key[i++] = gen >> 8 & 0xff;
  49898. if (isAes) {
  49899. key[i++] = 0x73;
  49900. key[i++] = 0x41;
  49901. key[i++] = 0x6c;
  49902. key[i++] = 0x54;
  49903. }
  49904. const hash = calculateMD5(key, 0, i);
  49905. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49906. }
  49907. function buildCipherConstructor(cf, name, num, gen, key) {
  49908. if (!(name instanceof _primitives.Name)) {
  49909. throw new _util.FormatError("Invalid crypt filter name.");
  49910. }
  49911. const cryptFilter = cf.get(name.name);
  49912. let cfm;
  49913. if (cryptFilter !== null && cryptFilter !== undefined) {
  49914. cfm = cryptFilter.get("CFM");
  49915. }
  49916. if (!cfm || cfm.name === "None") {
  49917. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49918. return new NullCipher();
  49919. };
  49920. }
  49921. if (cfm.name === "V2") {
  49922. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49923. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49924. };
  49925. }
  49926. if (cfm.name === "AESV2") {
  49927. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49928. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49929. };
  49930. }
  49931. if (cfm.name === "AESV3") {
  49932. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49933. return new AES256Cipher(key);
  49934. };
  49935. }
  49936. throw new _util.FormatError("Unknown crypto method");
  49937. }
  49938. class CipherTransformFactory {
  49939. constructor(dict, fileId, password) {
  49940. const filter = dict.get("Filter");
  49941. if (!(0, _primitives.isName)(filter, "Standard")) {
  49942. throw new _util.FormatError("unknown encryption method");
  49943. }
  49944. this.filterName = filter.name;
  49945. this.dict = dict;
  49946. const algorithm = dict.get("V");
  49947. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49948. throw new _util.FormatError("unsupported encryption algorithm");
  49949. }
  49950. this.algorithm = algorithm;
  49951. let keyLength = dict.get("Length");
  49952. if (!keyLength) {
  49953. if (algorithm <= 3) {
  49954. keyLength = 40;
  49955. } else {
  49956. const cfDict = dict.get("CF");
  49957. const streamCryptoName = dict.get("StmF");
  49958. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49959. cfDict.suppressEncryption = true;
  49960. const handlerDict = cfDict.get(streamCryptoName.name);
  49961. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49962. if (keyLength < 40) {
  49963. keyLength <<= 3;
  49964. }
  49965. }
  49966. }
  49967. }
  49968. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49969. throw new _util.FormatError("invalid key length");
  49970. }
  49971. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49972. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49973. const flags = dict.get("P");
  49974. const revision = dict.get("R");
  49975. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49976. this.encryptMetadata = encryptMetadata;
  49977. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49978. let passwordBytes;
  49979. if (password) {
  49980. if (revision === 6) {
  49981. try {
  49982. password = (0, _util.utf8StringToString)(password);
  49983. } catch (ex) {
  49984. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49985. }
  49986. }
  49987. passwordBytes = (0, _util.stringToBytes)(password);
  49988. }
  49989. let encryptionKey;
  49990. if (algorithm !== 5) {
  49991. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49992. } else {
  49993. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49994. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49995. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49996. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49997. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49998. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49999. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  50000. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  50001. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  50002. }
  50003. if (!encryptionKey && !password) {
  50004. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  50005. } else if (!encryptionKey && password) {
  50006. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  50007. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  50008. }
  50009. if (!encryptionKey) {
  50010. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  50011. }
  50012. this.encryptionKey = encryptionKey;
  50013. if (algorithm >= 4) {
  50014. const cf = dict.get("CF");
  50015. if (cf instanceof _primitives.Dict) {
  50016. cf.suppressEncryption = true;
  50017. }
  50018. this.cf = cf;
  50019. this.stmf = dict.get("StmF") || identityName;
  50020. this.strf = dict.get("StrF") || identityName;
  50021. this.eff = dict.get("EFF") || this.stmf;
  50022. }
  50023. }
  50024. createCipherTransform(num, gen) {
  50025. if (this.algorithm === 4 || this.algorithm === 5) {
  50026. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  50027. }
  50028. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  50029. const cipherConstructor = function buildCipherCipherConstructor() {
  50030. return new ARCFourCipher(key);
  50031. };
  50032. return new CipherTransform(cipherConstructor, cipherConstructor);
  50033. }
  50034. }
  50035. return CipherTransformFactory;
  50036. }();
  50037. exports.CipherTransformFactory = CipherTransformFactory;
  50038. /***/ }),
  50039. /* 74 */
  50040. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50041. Object.defineProperty(exports, "__esModule", ({
  50042. value: true
  50043. }));
  50044. exports.DecryptStream = void 0;
  50045. var _decode_stream = __w_pdfjs_require__(29);
  50046. const chunkSize = 512;
  50047. class DecryptStream extends _decode_stream.DecodeStream {
  50048. constructor(str, maybeLength, decrypt) {
  50049. super(maybeLength);
  50050. this.str = str;
  50051. this.dict = str.dict;
  50052. this.decrypt = decrypt;
  50053. this.nextChunk = null;
  50054. this.initialized = false;
  50055. }
  50056. readBlock() {
  50057. let chunk;
  50058. if (this.initialized) {
  50059. chunk = this.nextChunk;
  50060. } else {
  50061. chunk = this.str.getBytes(chunkSize);
  50062. this.initialized = true;
  50063. }
  50064. if (!chunk || chunk.length === 0) {
  50065. this.eof = true;
  50066. return;
  50067. }
  50068. this.nextChunk = this.str.getBytes(chunkSize);
  50069. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  50070. const decrypt = this.decrypt;
  50071. chunk = decrypt(chunk, !hasMoreData);
  50072. let bufferLength = this.bufferLength;
  50073. const n = chunk.length,
  50074. buffer = this.ensureBuffer(bufferLength + n);
  50075. for (let i = 0; i < n; i++) {
  50076. buffer[bufferLength++] = chunk[i];
  50077. }
  50078. this.bufferLength = bufferLength;
  50079. }
  50080. }
  50081. exports.DecryptStream = DecryptStream;
  50082. /***/ }),
  50083. /* 75 */
  50084. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50085. Object.defineProperty(exports, "__esModule", ({
  50086. value: true
  50087. }));
  50088. exports.XFAFactory = void 0;
  50089. var _xfa_object = __w_pdfjs_require__(76);
  50090. var _bind = __w_pdfjs_require__(80);
  50091. var _data = __w_pdfjs_require__(86);
  50092. var _fonts = __w_pdfjs_require__(84);
  50093. var _utils = __w_pdfjs_require__(77);
  50094. var _util = __w_pdfjs_require__(2);
  50095. var _parser = __w_pdfjs_require__(87);
  50096. var _xhtml = __w_pdfjs_require__(97);
  50097. class XFAFactory {
  50098. constructor(data) {
  50099. try {
  50100. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  50101. const binder = new _bind.Binder(this.root);
  50102. this.form = binder.bind();
  50103. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  50104. this.form[_xfa_object.$globalData].template = this.form;
  50105. } catch (e) {
  50106. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  50107. }
  50108. }
  50109. isValid() {
  50110. return this.root && this.form;
  50111. }
  50112. _createPagesHelper() {
  50113. const iterator = this.form[_xfa_object.$toPages]();
  50114. return new Promise((resolve, reject) => {
  50115. const nextIteration = () => {
  50116. try {
  50117. const value = iterator.next();
  50118. if (value.done) {
  50119. resolve(value.value);
  50120. } else {
  50121. setTimeout(nextIteration, 0);
  50122. }
  50123. } catch (e) {
  50124. reject(e);
  50125. }
  50126. };
  50127. setTimeout(nextIteration, 0);
  50128. });
  50129. }
  50130. async _createPages() {
  50131. try {
  50132. this.pages = await this._createPagesHelper();
  50133. this.dims = this.pages.children.map(c => {
  50134. const {
  50135. width,
  50136. height
  50137. } = c.attributes.style;
  50138. return [0, 0, parseInt(width), parseInt(height)];
  50139. });
  50140. } catch (e) {
  50141. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  50142. }
  50143. }
  50144. getBoundingBox(pageIndex) {
  50145. return this.dims[pageIndex];
  50146. }
  50147. async getNumPages() {
  50148. if (!this.pages) {
  50149. await this._createPages();
  50150. }
  50151. return this.dims.length;
  50152. }
  50153. setImages(images) {
  50154. this.form[_xfa_object.$globalData].images = images;
  50155. }
  50156. setFonts(fonts) {
  50157. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  50158. const missingFonts = [];
  50159. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  50160. typeface = (0, _utils.stripQuotes)(typeface);
  50161. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  50162. if (!font) {
  50163. missingFonts.push(typeface);
  50164. }
  50165. }
  50166. if (missingFonts.length > 0) {
  50167. return missingFonts;
  50168. }
  50169. return null;
  50170. }
  50171. appendFonts(fonts, reallyMissingFonts) {
  50172. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  50173. }
  50174. async getPages() {
  50175. if (!this.pages) {
  50176. await this._createPages();
  50177. }
  50178. const pages = this.pages;
  50179. this.pages = null;
  50180. return pages;
  50181. }
  50182. serializeData(storage) {
  50183. return this.dataHandler.serialize(storage);
  50184. }
  50185. static _createDocument(data) {
  50186. if (!data["/xdp:xdp"]) {
  50187. return data["xdp:xdp"];
  50188. }
  50189. return Object.values(data).join("");
  50190. }
  50191. static getRichTextAsHtml(rc) {
  50192. if (!rc || typeof rc !== "string") {
  50193. return null;
  50194. }
  50195. try {
  50196. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  50197. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  50198. const newRoot = _xhtml.XhtmlNamespace.body({});
  50199. newRoot[_xfa_object.$appendChild](root);
  50200. root = newRoot;
  50201. }
  50202. const result = root[_xfa_object.$toHTML]();
  50203. if (!result.success) {
  50204. return null;
  50205. }
  50206. const {
  50207. html
  50208. } = result;
  50209. const {
  50210. attributes
  50211. } = html;
  50212. if (attributes) {
  50213. if (attributes.class) {
  50214. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  50215. }
  50216. attributes.dir = "auto";
  50217. }
  50218. return {
  50219. html,
  50220. str: root[_xfa_object.$text]()
  50221. };
  50222. } catch (e) {
  50223. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  50224. }
  50225. return null;
  50226. }
  50227. }
  50228. exports.XFAFactory = XFAFactory;
  50229. /***/ }),
  50230. /* 76 */
  50231. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50232. Object.defineProperty(exports, "__esModule", ({
  50233. value: true
  50234. }));
  50235. 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;
  50236. var _utils = __w_pdfjs_require__(77);
  50237. var _util = __w_pdfjs_require__(2);
  50238. var _core_utils = __w_pdfjs_require__(8);
  50239. var _namespaces = __w_pdfjs_require__(78);
  50240. var _som = __w_pdfjs_require__(79);
  50241. const $acceptWhitespace = Symbol();
  50242. exports.$acceptWhitespace = $acceptWhitespace;
  50243. const $addHTML = Symbol();
  50244. exports.$addHTML = $addHTML;
  50245. const $appendChild = Symbol();
  50246. exports.$appendChild = $appendChild;
  50247. const $childrenToHTML = Symbol();
  50248. exports.$childrenToHTML = $childrenToHTML;
  50249. const $clean = Symbol();
  50250. exports.$clean = $clean;
  50251. const $cleanPage = Symbol();
  50252. exports.$cleanPage = $cleanPage;
  50253. const $cleanup = Symbol();
  50254. exports.$cleanup = $cleanup;
  50255. const $clone = Symbol();
  50256. exports.$clone = $clone;
  50257. const $consumed = Symbol();
  50258. exports.$consumed = $consumed;
  50259. const $content = Symbol("content");
  50260. exports.$content = $content;
  50261. const $data = Symbol("data");
  50262. exports.$data = $data;
  50263. const $dump = Symbol();
  50264. exports.$dump = $dump;
  50265. const $extra = Symbol("extra");
  50266. exports.$extra = $extra;
  50267. const $finalize = Symbol();
  50268. exports.$finalize = $finalize;
  50269. const $flushHTML = Symbol();
  50270. exports.$flushHTML = $flushHTML;
  50271. const $getAttributeIt = Symbol();
  50272. exports.$getAttributeIt = $getAttributeIt;
  50273. const $getAttributes = Symbol();
  50274. exports.$getAttributes = $getAttributes;
  50275. const $getAvailableSpace = Symbol();
  50276. exports.$getAvailableSpace = $getAvailableSpace;
  50277. const $getChildrenByClass = Symbol();
  50278. exports.$getChildrenByClass = $getChildrenByClass;
  50279. const $getChildrenByName = Symbol();
  50280. exports.$getChildrenByName = $getChildrenByName;
  50281. const $getChildrenByNameIt = Symbol();
  50282. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  50283. const $getDataValue = Symbol();
  50284. exports.$getDataValue = $getDataValue;
  50285. const $getExtra = Symbol();
  50286. exports.$getExtra = $getExtra;
  50287. const $getRealChildrenByNameIt = Symbol();
  50288. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  50289. const $getChildren = Symbol();
  50290. exports.$getChildren = $getChildren;
  50291. const $getContainedChildren = Symbol();
  50292. exports.$getContainedChildren = $getContainedChildren;
  50293. const $getNextPage = Symbol();
  50294. exports.$getNextPage = $getNextPage;
  50295. const $getSubformParent = Symbol();
  50296. exports.$getSubformParent = $getSubformParent;
  50297. const $getParent = Symbol();
  50298. exports.$getParent = $getParent;
  50299. const $getTemplateRoot = Symbol();
  50300. exports.$getTemplateRoot = $getTemplateRoot;
  50301. const $globalData = Symbol();
  50302. exports.$globalData = $globalData;
  50303. const $hasSettableValue = Symbol();
  50304. exports.$hasSettableValue = $hasSettableValue;
  50305. const $ids = Symbol();
  50306. exports.$ids = $ids;
  50307. const $indexOf = Symbol();
  50308. exports.$indexOf = $indexOf;
  50309. const $insertAt = Symbol();
  50310. exports.$insertAt = $insertAt;
  50311. const $isCDATAXml = Symbol();
  50312. exports.$isCDATAXml = $isCDATAXml;
  50313. const $isBindable = Symbol();
  50314. exports.$isBindable = $isBindable;
  50315. const $isDataValue = Symbol();
  50316. exports.$isDataValue = $isDataValue;
  50317. const $isDescendent = Symbol();
  50318. exports.$isDescendent = $isDescendent;
  50319. const $isNsAgnostic = Symbol();
  50320. exports.$isNsAgnostic = $isNsAgnostic;
  50321. const $isSplittable = Symbol();
  50322. exports.$isSplittable = $isSplittable;
  50323. const $isThereMoreWidth = Symbol();
  50324. exports.$isThereMoreWidth = $isThereMoreWidth;
  50325. const $isTransparent = Symbol();
  50326. exports.$isTransparent = $isTransparent;
  50327. const $isUsable = Symbol();
  50328. exports.$isUsable = $isUsable;
  50329. const $lastAttribute = Symbol();
  50330. const $namespaceId = Symbol("namespaceId");
  50331. exports.$namespaceId = $namespaceId;
  50332. const $nodeName = Symbol("nodeName");
  50333. exports.$nodeName = $nodeName;
  50334. const $nsAttributes = Symbol();
  50335. exports.$nsAttributes = $nsAttributes;
  50336. const $onChild = Symbol();
  50337. exports.$onChild = $onChild;
  50338. const $onChildCheck = Symbol();
  50339. exports.$onChildCheck = $onChildCheck;
  50340. const $onText = Symbol();
  50341. exports.$onText = $onText;
  50342. const $pushGlyphs = Symbol();
  50343. exports.$pushGlyphs = $pushGlyphs;
  50344. const $popPara = Symbol();
  50345. exports.$popPara = $popPara;
  50346. const $pushPara = Symbol();
  50347. exports.$pushPara = $pushPara;
  50348. const $removeChild = Symbol();
  50349. exports.$removeChild = $removeChild;
  50350. const $root = Symbol("root");
  50351. exports.$root = $root;
  50352. const $resolvePrototypes = Symbol();
  50353. exports.$resolvePrototypes = $resolvePrototypes;
  50354. const $searchNode = Symbol();
  50355. exports.$searchNode = $searchNode;
  50356. const $setId = Symbol();
  50357. exports.$setId = $setId;
  50358. const $setSetAttributes = Symbol();
  50359. exports.$setSetAttributes = $setSetAttributes;
  50360. const $setValue = Symbol();
  50361. exports.$setValue = $setValue;
  50362. const $tabIndex = Symbol();
  50363. exports.$tabIndex = $tabIndex;
  50364. const $text = Symbol();
  50365. exports.$text = $text;
  50366. const $toPages = Symbol();
  50367. exports.$toPages = $toPages;
  50368. const $toHTML = Symbol();
  50369. exports.$toHTML = $toHTML;
  50370. const $toString = Symbol();
  50371. exports.$toString = $toString;
  50372. const $toStyle = Symbol();
  50373. exports.$toStyle = $toStyle;
  50374. const $uid = Symbol("uid");
  50375. exports.$uid = $uid;
  50376. const _applyPrototype = Symbol();
  50377. const _attributes = Symbol();
  50378. const _attributeNames = Symbol();
  50379. const _children = Symbol("_children");
  50380. const _cloneAttribute = Symbol();
  50381. const _dataValue = Symbol();
  50382. const _defaultValue = Symbol();
  50383. const _filteredChildrenGenerator = Symbol();
  50384. const _getPrototype = Symbol();
  50385. const _getUnsetAttributes = Symbol();
  50386. const _hasChildren = Symbol();
  50387. const _max = Symbol();
  50388. const _options = Symbol();
  50389. const _parent = Symbol("parent");
  50390. const _resolvePrototypesHelper = Symbol();
  50391. const _setAttributes = Symbol();
  50392. const _validator = Symbol();
  50393. let uid = 0;
  50394. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  50395. class XFAObject {
  50396. constructor(nsId, name, hasChildren = false) {
  50397. this[$namespaceId] = nsId;
  50398. this[$nodeName] = name;
  50399. this[_hasChildren] = hasChildren;
  50400. this[_parent] = null;
  50401. this[_children] = [];
  50402. this[$uid] = `${name}${uid++}`;
  50403. this[$globalData] = null;
  50404. }
  50405. [$onChild](child) {
  50406. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  50407. return false;
  50408. }
  50409. const name = child[$nodeName];
  50410. const node = this[name];
  50411. if (node instanceof XFAObjectArray) {
  50412. if (node.push(child)) {
  50413. this[$appendChild](child);
  50414. return true;
  50415. }
  50416. } else {
  50417. if (node !== null) {
  50418. this[$removeChild](node);
  50419. }
  50420. this[name] = child;
  50421. this[$appendChild](child);
  50422. return true;
  50423. }
  50424. let id = "";
  50425. if (this.id) {
  50426. id = ` (id: ${this.id})`;
  50427. } else if (this.name) {
  50428. id = ` (name: ${this.name} ${this.h.value})`;
  50429. }
  50430. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  50431. return false;
  50432. }
  50433. [$onChildCheck](child) {
  50434. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  50435. }
  50436. [$isNsAgnostic]() {
  50437. return false;
  50438. }
  50439. [$acceptWhitespace]() {
  50440. return false;
  50441. }
  50442. [$isCDATAXml]() {
  50443. return false;
  50444. }
  50445. [$isBindable]() {
  50446. return false;
  50447. }
  50448. [$popPara]() {
  50449. if (this.para) {
  50450. this[$getTemplateRoot]()[$extra].paraStack.pop();
  50451. }
  50452. }
  50453. [$pushPara]() {
  50454. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  50455. }
  50456. [$setId](ids) {
  50457. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  50458. ids.set(this.id, this);
  50459. }
  50460. }
  50461. [$getTemplateRoot]() {
  50462. return this[$globalData].template;
  50463. }
  50464. [$isSplittable]() {
  50465. return false;
  50466. }
  50467. [$isThereMoreWidth]() {
  50468. return false;
  50469. }
  50470. [$appendChild](child) {
  50471. child[_parent] = this;
  50472. this[_children].push(child);
  50473. if (!child[$globalData] && this[$globalData]) {
  50474. child[$globalData] = this[$globalData];
  50475. }
  50476. }
  50477. [$removeChild](child) {
  50478. const i = this[_children].indexOf(child);
  50479. this[_children].splice(i, 1);
  50480. }
  50481. [$hasSettableValue]() {
  50482. return this.hasOwnProperty("value");
  50483. }
  50484. [$setValue](_) {}
  50485. [$onText](_) {}
  50486. [$finalize]() {}
  50487. [$clean](builder) {
  50488. delete this[_hasChildren];
  50489. if (this[$cleanup]) {
  50490. builder.clean(this[$cleanup]);
  50491. delete this[$cleanup];
  50492. }
  50493. }
  50494. [$indexOf](child) {
  50495. return this[_children].indexOf(child);
  50496. }
  50497. [$insertAt](i, child) {
  50498. child[_parent] = this;
  50499. this[_children].splice(i, 0, child);
  50500. if (!child[$globalData] && this[$globalData]) {
  50501. child[$globalData] = this[$globalData];
  50502. }
  50503. }
  50504. [$isTransparent]() {
  50505. return !this.name;
  50506. }
  50507. [$lastAttribute]() {
  50508. return "";
  50509. }
  50510. [$text]() {
  50511. if (this[_children].length === 0) {
  50512. return this[$content];
  50513. }
  50514. return this[_children].map(c => c[$text]()).join("");
  50515. }
  50516. get [_attributeNames]() {
  50517. const proto = Object.getPrototypeOf(this);
  50518. if (!proto._attributes) {
  50519. const attributes = proto._attributes = new Set();
  50520. for (const name of Object.getOwnPropertyNames(this)) {
  50521. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  50522. break;
  50523. }
  50524. attributes.add(name);
  50525. }
  50526. }
  50527. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  50528. }
  50529. [$isDescendent](parent) {
  50530. let node = this;
  50531. while (node) {
  50532. if (node === parent) {
  50533. return true;
  50534. }
  50535. node = node[$getParent]();
  50536. }
  50537. return false;
  50538. }
  50539. [$getParent]() {
  50540. return this[_parent];
  50541. }
  50542. [$getSubformParent]() {
  50543. return this[$getParent]();
  50544. }
  50545. [$getChildren](name = null) {
  50546. if (!name) {
  50547. return this[_children];
  50548. }
  50549. return this[name];
  50550. }
  50551. [$dump]() {
  50552. const dumped = Object.create(null);
  50553. if (this[$content]) {
  50554. dumped.$content = this[$content];
  50555. }
  50556. for (const name of Object.getOwnPropertyNames(this)) {
  50557. const value = this[name];
  50558. if (value === null) {
  50559. continue;
  50560. }
  50561. if (value instanceof XFAObject) {
  50562. dumped[name] = value[$dump]();
  50563. } else if (value instanceof XFAObjectArray) {
  50564. if (!value.isEmpty()) {
  50565. dumped[name] = value.dump();
  50566. }
  50567. } else {
  50568. dumped[name] = value;
  50569. }
  50570. }
  50571. return dumped;
  50572. }
  50573. [$toStyle]() {
  50574. return null;
  50575. }
  50576. [$toHTML]() {
  50577. return _utils.HTMLResult.EMPTY;
  50578. }
  50579. *[$getContainedChildren]() {
  50580. for (const node of this[$getChildren]()) {
  50581. yield node;
  50582. }
  50583. }
  50584. *[_filteredChildrenGenerator](filter, include) {
  50585. for (const node of this[$getContainedChildren]()) {
  50586. if (!filter || include === filter.has(node[$nodeName])) {
  50587. const availableSpace = this[$getAvailableSpace]();
  50588. const res = node[$toHTML](availableSpace);
  50589. if (!res.success) {
  50590. this[$extra].failingNode = node;
  50591. }
  50592. yield res;
  50593. }
  50594. }
  50595. }
  50596. [$flushHTML]() {
  50597. return null;
  50598. }
  50599. [$addHTML](html, bbox) {
  50600. this[$extra].children.push(html);
  50601. }
  50602. [$getAvailableSpace]() {}
  50603. [$childrenToHTML]({
  50604. filter = null,
  50605. include = true
  50606. }) {
  50607. if (!this[$extra].generator) {
  50608. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  50609. } else {
  50610. const availableSpace = this[$getAvailableSpace]();
  50611. const res = this[$extra].failingNode[$toHTML](availableSpace);
  50612. if (!res.success) {
  50613. return res;
  50614. }
  50615. if (res.html) {
  50616. this[$addHTML](res.html, res.bbox);
  50617. }
  50618. delete this[$extra].failingNode;
  50619. }
  50620. while (true) {
  50621. const gen = this[$extra].generator.next();
  50622. if (gen.done) {
  50623. break;
  50624. }
  50625. const res = gen.value;
  50626. if (!res.success) {
  50627. return res;
  50628. }
  50629. if (res.html) {
  50630. this[$addHTML](res.html, res.bbox);
  50631. }
  50632. }
  50633. this[$extra].generator = null;
  50634. return _utils.HTMLResult.EMPTY;
  50635. }
  50636. [$setSetAttributes](attributes) {
  50637. this[_setAttributes] = new Set(Object.keys(attributes));
  50638. }
  50639. [_getUnsetAttributes](protoAttributes) {
  50640. const allAttr = this[_attributeNames];
  50641. const setAttr = this[_setAttributes];
  50642. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  50643. }
  50644. [$resolvePrototypes](ids, ancestors = new Set()) {
  50645. for (const child of this[_children]) {
  50646. child[_resolvePrototypesHelper](ids, ancestors);
  50647. }
  50648. }
  50649. [_resolvePrototypesHelper](ids, ancestors) {
  50650. const proto = this[_getPrototype](ids, ancestors);
  50651. if (proto) {
  50652. this[_applyPrototype](proto, ids, ancestors);
  50653. } else {
  50654. this[$resolvePrototypes](ids, ancestors);
  50655. }
  50656. }
  50657. [_getPrototype](ids, ancestors) {
  50658. const {
  50659. use,
  50660. usehref
  50661. } = this;
  50662. if (!use && !usehref) {
  50663. return null;
  50664. }
  50665. let proto = null;
  50666. let somExpression = null;
  50667. let id = null;
  50668. let ref = use;
  50669. if (usehref) {
  50670. ref = usehref;
  50671. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  50672. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  50673. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  50674. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  50675. } else if (usehref.startsWith("#")) {
  50676. id = usehref.slice(1);
  50677. } else if (usehref.startsWith(".#")) {
  50678. id = usehref.slice(2);
  50679. }
  50680. } else if (use.startsWith("#")) {
  50681. id = use.slice(1);
  50682. } else {
  50683. somExpression = use;
  50684. }
  50685. this.use = this.usehref = "";
  50686. if (id) {
  50687. proto = ids.get(id);
  50688. } else {
  50689. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  50690. if (proto) {
  50691. proto = proto[0];
  50692. }
  50693. }
  50694. if (!proto) {
  50695. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  50696. return null;
  50697. }
  50698. if (proto[$nodeName] !== this[$nodeName]) {
  50699. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  50700. return null;
  50701. }
  50702. if (ancestors.has(proto)) {
  50703. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  50704. return null;
  50705. }
  50706. ancestors.add(proto);
  50707. const protoProto = proto[_getPrototype](ids, ancestors);
  50708. if (protoProto) {
  50709. proto[_applyPrototype](protoProto, ids, ancestors);
  50710. }
  50711. proto[$resolvePrototypes](ids, ancestors);
  50712. ancestors.delete(proto);
  50713. return proto;
  50714. }
  50715. [_applyPrototype](proto, ids, ancestors) {
  50716. if (ancestors.has(proto)) {
  50717. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  50718. return;
  50719. }
  50720. if (!this[$content] && proto[$content]) {
  50721. this[$content] = proto[$content];
  50722. }
  50723. const newAncestors = new Set(ancestors);
  50724. newAncestors.add(proto);
  50725. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  50726. this[unsetAttrName] = proto[unsetAttrName];
  50727. if (this[_setAttributes]) {
  50728. this[_setAttributes].add(unsetAttrName);
  50729. }
  50730. }
  50731. for (const name of Object.getOwnPropertyNames(this)) {
  50732. if (this[_attributeNames].has(name)) {
  50733. continue;
  50734. }
  50735. const value = this[name];
  50736. const protoValue = proto[name];
  50737. if (value instanceof XFAObjectArray) {
  50738. for (const child of value[_children]) {
  50739. child[_resolvePrototypesHelper](ids, ancestors);
  50740. }
  50741. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  50742. const child = proto[_children][i][$clone]();
  50743. if (value.push(child)) {
  50744. child[_parent] = this;
  50745. this[_children].push(child);
  50746. child[_resolvePrototypesHelper](ids, ancestors);
  50747. } else {
  50748. break;
  50749. }
  50750. }
  50751. continue;
  50752. }
  50753. if (value !== null) {
  50754. value[$resolvePrototypes](ids, ancestors);
  50755. if (protoValue) {
  50756. value[_applyPrototype](protoValue, ids, ancestors);
  50757. }
  50758. continue;
  50759. }
  50760. if (protoValue !== null) {
  50761. const child = protoValue[$clone]();
  50762. child[_parent] = this;
  50763. this[name] = child;
  50764. this[_children].push(child);
  50765. child[_resolvePrototypesHelper](ids, ancestors);
  50766. }
  50767. }
  50768. }
  50769. static [_cloneAttribute](obj) {
  50770. if (Array.isArray(obj)) {
  50771. return obj.map(x => XFAObject[_cloneAttribute](x));
  50772. }
  50773. if (typeof obj === "object" && obj !== null) {
  50774. return Object.assign({}, obj);
  50775. }
  50776. return obj;
  50777. }
  50778. [$clone]() {
  50779. const clone = Object.create(Object.getPrototypeOf(this));
  50780. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  50781. try {
  50782. clone[$symbol] = this[$symbol];
  50783. } catch (_) {
  50784. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  50785. }
  50786. }
  50787. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  50788. clone[_children] = [];
  50789. for (const name of Object.getOwnPropertyNames(this)) {
  50790. if (this[_attributeNames].has(name)) {
  50791. clone[name] = XFAObject[_cloneAttribute](this[name]);
  50792. continue;
  50793. }
  50794. const value = this[name];
  50795. if (value instanceof XFAObjectArray) {
  50796. clone[name] = new XFAObjectArray(value[_max]);
  50797. } else {
  50798. clone[name] = null;
  50799. }
  50800. }
  50801. for (const child of this[_children]) {
  50802. const name = child[$nodeName];
  50803. const clonedChild = child[$clone]();
  50804. clone[_children].push(clonedChild);
  50805. clonedChild[_parent] = clone;
  50806. if (clone[name] === null) {
  50807. clone[name] = clonedChild;
  50808. } else {
  50809. clone[name][_children].push(clonedChild);
  50810. }
  50811. }
  50812. return clone;
  50813. }
  50814. [$getChildren](name = null) {
  50815. if (!name) {
  50816. return this[_children];
  50817. }
  50818. return this[_children].filter(c => c[$nodeName] === name);
  50819. }
  50820. [$getChildrenByClass](name) {
  50821. return this[name];
  50822. }
  50823. [$getChildrenByName](name, allTransparent, first = true) {
  50824. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  50825. }
  50826. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  50827. if (name === "parent") {
  50828. yield this[_parent];
  50829. return;
  50830. }
  50831. for (const child of this[_children]) {
  50832. if (child[$nodeName] === name) {
  50833. yield child;
  50834. }
  50835. if (child.name === name) {
  50836. yield child;
  50837. }
  50838. if (allTransparent || child[$isTransparent]()) {
  50839. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  50840. }
  50841. }
  50842. if (first && this[_attributeNames].has(name)) {
  50843. yield new XFAAttribute(this, name, this[name]);
  50844. }
  50845. }
  50846. }
  50847. exports.XFAObject = XFAObject;
  50848. class XFAObjectArray {
  50849. constructor(max = Infinity) {
  50850. this[_max] = max;
  50851. this[_children] = [];
  50852. }
  50853. push(child) {
  50854. const len = this[_children].length;
  50855. if (len <= this[_max]) {
  50856. this[_children].push(child);
  50857. return true;
  50858. }
  50859. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  50860. return false;
  50861. }
  50862. isEmpty() {
  50863. return this[_children].length === 0;
  50864. }
  50865. dump() {
  50866. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  50867. }
  50868. [$clone]() {
  50869. const clone = new XFAObjectArray(this[_max]);
  50870. clone[_children] = this[_children].map(c => c[$clone]());
  50871. return clone;
  50872. }
  50873. get children() {
  50874. return this[_children];
  50875. }
  50876. clear() {
  50877. this[_children].length = 0;
  50878. }
  50879. }
  50880. exports.XFAObjectArray = XFAObjectArray;
  50881. class XFAAttribute {
  50882. constructor(node, name, value) {
  50883. this[_parent] = node;
  50884. this[$nodeName] = name;
  50885. this[$content] = value;
  50886. this[$consumed] = false;
  50887. this[$uid] = `attribute${uid++}`;
  50888. }
  50889. [$getParent]() {
  50890. return this[_parent];
  50891. }
  50892. [$isDataValue]() {
  50893. return true;
  50894. }
  50895. [$getDataValue]() {
  50896. return this[$content].trim();
  50897. }
  50898. [$setValue](value) {
  50899. value = value.value || "";
  50900. this[$content] = value.toString();
  50901. }
  50902. [$text]() {
  50903. return this[$content];
  50904. }
  50905. [$isDescendent](parent) {
  50906. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  50907. }
  50908. }
  50909. exports.XFAAttribute = XFAAttribute;
  50910. class XmlObject extends XFAObject {
  50911. constructor(nsId, name, attributes = {}) {
  50912. super(nsId, name);
  50913. this[$content] = "";
  50914. this[_dataValue] = null;
  50915. if (name !== "#text") {
  50916. const map = new Map();
  50917. this[_attributes] = map;
  50918. for (const [attrName, value] of Object.entries(attributes)) {
  50919. map.set(attrName, new XFAAttribute(this, attrName, value));
  50920. }
  50921. if (attributes.hasOwnProperty($nsAttributes)) {
  50922. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  50923. if (dataNode !== undefined) {
  50924. if (dataNode === "dataGroup") {
  50925. this[_dataValue] = false;
  50926. } else if (dataNode === "dataValue") {
  50927. this[_dataValue] = true;
  50928. }
  50929. }
  50930. }
  50931. }
  50932. this[$consumed] = false;
  50933. }
  50934. [$toString](buf) {
  50935. const tagName = this[$nodeName];
  50936. if (tagName === "#text") {
  50937. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  50938. return;
  50939. }
  50940. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  50941. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  50942. buf.push(`<${prefix}${utf8TagName}`);
  50943. for (const [name, value] of this[_attributes].entries()) {
  50944. const utf8Name = (0, _util.utf8StringToString)(name);
  50945. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  50946. }
  50947. if (this[_dataValue] !== null) {
  50948. if (this[_dataValue]) {
  50949. buf.push(` xfa:dataNode="dataValue"`);
  50950. } else {
  50951. buf.push(` xfa:dataNode="dataGroup"`);
  50952. }
  50953. }
  50954. if (!this[$content] && this[_children].length === 0) {
  50955. buf.push("/>");
  50956. return;
  50957. }
  50958. buf.push(">");
  50959. if (this[$content]) {
  50960. if (typeof this[$content] === "string") {
  50961. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  50962. } else {
  50963. this[$content][$toString](buf);
  50964. }
  50965. } else {
  50966. for (const child of this[_children]) {
  50967. child[$toString](buf);
  50968. }
  50969. }
  50970. buf.push(`</${prefix}${utf8TagName}>`);
  50971. }
  50972. [$onChild](child) {
  50973. if (this[$content]) {
  50974. const node = new XmlObject(this[$namespaceId], "#text");
  50975. this[$appendChild](node);
  50976. node[$content] = this[$content];
  50977. this[$content] = "";
  50978. }
  50979. this[$appendChild](child);
  50980. return true;
  50981. }
  50982. [$onText](str) {
  50983. this[$content] += str;
  50984. }
  50985. [$finalize]() {
  50986. if (this[$content] && this[_children].length > 0) {
  50987. const node = new XmlObject(this[$namespaceId], "#text");
  50988. this[$appendChild](node);
  50989. node[$content] = this[$content];
  50990. delete this[$content];
  50991. }
  50992. }
  50993. [$toHTML]() {
  50994. if (this[$nodeName] === "#text") {
  50995. return _utils.HTMLResult.success({
  50996. name: "#text",
  50997. value: this[$content]
  50998. });
  50999. }
  51000. return _utils.HTMLResult.EMPTY;
  51001. }
  51002. [$getChildren](name = null) {
  51003. if (!name) {
  51004. return this[_children];
  51005. }
  51006. return this[_children].filter(c => c[$nodeName] === name);
  51007. }
  51008. [$getAttributes]() {
  51009. return this[_attributes];
  51010. }
  51011. [$getChildrenByClass](name) {
  51012. const value = this[_attributes].get(name);
  51013. if (value !== undefined) {
  51014. return value;
  51015. }
  51016. return this[$getChildren](name);
  51017. }
  51018. *[$getChildrenByNameIt](name, allTransparent) {
  51019. const value = this[_attributes].get(name);
  51020. if (value) {
  51021. yield value;
  51022. }
  51023. for (const child of this[_children]) {
  51024. if (child[$nodeName] === name) {
  51025. yield child;
  51026. }
  51027. if (allTransparent) {
  51028. yield* child[$getChildrenByNameIt](name, allTransparent);
  51029. }
  51030. }
  51031. }
  51032. *[$getAttributeIt](name, skipConsumed) {
  51033. const value = this[_attributes].get(name);
  51034. if (value && (!skipConsumed || !value[$consumed])) {
  51035. yield value;
  51036. }
  51037. for (const child of this[_children]) {
  51038. yield* child[$getAttributeIt](name, skipConsumed);
  51039. }
  51040. }
  51041. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  51042. for (const child of this[_children]) {
  51043. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  51044. yield child;
  51045. }
  51046. if (allTransparent) {
  51047. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  51048. }
  51049. }
  51050. }
  51051. [$isDataValue]() {
  51052. if (this[_dataValue] === null) {
  51053. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  51054. }
  51055. return this[_dataValue];
  51056. }
  51057. [$getDataValue]() {
  51058. if (this[_dataValue] === null) {
  51059. if (this[_children].length === 0) {
  51060. return this[$content].trim();
  51061. }
  51062. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  51063. return this[_children][0][$text]().trim();
  51064. }
  51065. return null;
  51066. }
  51067. return this[$content].trim();
  51068. }
  51069. [$setValue](value) {
  51070. value = value.value || "";
  51071. this[$content] = value.toString();
  51072. }
  51073. [$dump](hasNS = false) {
  51074. const dumped = Object.create(null);
  51075. if (hasNS) {
  51076. dumped.$ns = this[$namespaceId];
  51077. }
  51078. if (this[$content]) {
  51079. dumped.$content = this[$content];
  51080. }
  51081. dumped.$name = this[$nodeName];
  51082. dumped.children = [];
  51083. for (const child of this[_children]) {
  51084. dumped.children.push(child[$dump](hasNS));
  51085. }
  51086. dumped.attributes = Object.create(null);
  51087. for (const [name, value] of this[_attributes]) {
  51088. dumped.attributes[name] = value[$content];
  51089. }
  51090. return dumped;
  51091. }
  51092. }
  51093. exports.XmlObject = XmlObject;
  51094. class ContentObject extends XFAObject {
  51095. constructor(nsId, name) {
  51096. super(nsId, name);
  51097. this[$content] = "";
  51098. }
  51099. [$onText](text) {
  51100. this[$content] += text;
  51101. }
  51102. [$finalize]() {}
  51103. }
  51104. exports.ContentObject = ContentObject;
  51105. class OptionObject extends ContentObject {
  51106. constructor(nsId, name, options) {
  51107. super(nsId, name);
  51108. this[_options] = options;
  51109. }
  51110. [$finalize]() {
  51111. this[$content] = (0, _utils.getKeyword)({
  51112. data: this[$content],
  51113. defaultValue: this[_options][0],
  51114. validate: k => this[_options].includes(k)
  51115. });
  51116. }
  51117. [$clean](builder) {
  51118. super[$clean](builder);
  51119. delete this[_options];
  51120. }
  51121. }
  51122. exports.OptionObject = OptionObject;
  51123. class StringObject extends ContentObject {
  51124. [$finalize]() {
  51125. this[$content] = this[$content].trim();
  51126. }
  51127. }
  51128. exports.StringObject = StringObject;
  51129. class IntegerObject extends ContentObject {
  51130. constructor(nsId, name, defaultValue, validator) {
  51131. super(nsId, name);
  51132. this[_defaultValue] = defaultValue;
  51133. this[_validator] = validator;
  51134. }
  51135. [$finalize]() {
  51136. this[$content] = (0, _utils.getInteger)({
  51137. data: this[$content],
  51138. defaultValue: this[_defaultValue],
  51139. validate: this[_validator]
  51140. });
  51141. }
  51142. [$clean](builder) {
  51143. super[$clean](builder);
  51144. delete this[_defaultValue];
  51145. delete this[_validator];
  51146. }
  51147. }
  51148. exports.IntegerObject = IntegerObject;
  51149. class Option01 extends IntegerObject {
  51150. constructor(nsId, name) {
  51151. super(nsId, name, 0, n => n === 1);
  51152. }
  51153. }
  51154. exports.Option01 = Option01;
  51155. class Option10 extends IntegerObject {
  51156. constructor(nsId, name) {
  51157. super(nsId, name, 1, n => n === 0);
  51158. }
  51159. }
  51160. exports.Option10 = Option10;
  51161. /***/ }),
  51162. /* 77 */
  51163. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51164. Object.defineProperty(exports, "__esModule", ({
  51165. value: true
  51166. }));
  51167. exports.HTMLResult = void 0;
  51168. exports.getBBox = getBBox;
  51169. exports.getColor = getColor;
  51170. exports.getFloat = getFloat;
  51171. exports.getInteger = getInteger;
  51172. exports.getKeyword = getKeyword;
  51173. exports.getMeasurement = getMeasurement;
  51174. exports.getRatio = getRatio;
  51175. exports.getRelevant = getRelevant;
  51176. exports.getStringOption = getStringOption;
  51177. exports.stripQuotes = stripQuotes;
  51178. var _util = __w_pdfjs_require__(2);
  51179. const dimConverters = {
  51180. pt: x => x,
  51181. cm: x => x / 2.54 * 72,
  51182. mm: x => x / (10 * 2.54) * 72,
  51183. in: x => x * 72,
  51184. px: x => x
  51185. };
  51186. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  51187. function stripQuotes(str) {
  51188. if (str.startsWith("'") || str.startsWith('"')) {
  51189. return str.slice(1, str.length - 1);
  51190. }
  51191. return str;
  51192. }
  51193. function getInteger({
  51194. data,
  51195. defaultValue,
  51196. validate
  51197. }) {
  51198. if (!data) {
  51199. return defaultValue;
  51200. }
  51201. data = data.trim();
  51202. const n = parseInt(data, 10);
  51203. if (!isNaN(n) && validate(n)) {
  51204. return n;
  51205. }
  51206. return defaultValue;
  51207. }
  51208. function getFloat({
  51209. data,
  51210. defaultValue,
  51211. validate
  51212. }) {
  51213. if (!data) {
  51214. return defaultValue;
  51215. }
  51216. data = data.trim();
  51217. const n = parseFloat(data);
  51218. if (!isNaN(n) && validate(n)) {
  51219. return n;
  51220. }
  51221. return defaultValue;
  51222. }
  51223. function getKeyword({
  51224. data,
  51225. defaultValue,
  51226. validate
  51227. }) {
  51228. if (!data) {
  51229. return defaultValue;
  51230. }
  51231. data = data.trim();
  51232. if (validate(data)) {
  51233. return data;
  51234. }
  51235. return defaultValue;
  51236. }
  51237. function getStringOption(data, options) {
  51238. return getKeyword({
  51239. data,
  51240. defaultValue: options[0],
  51241. validate: k => options.includes(k)
  51242. });
  51243. }
  51244. function getMeasurement(str, def = "0") {
  51245. def = def || "0";
  51246. if (!str) {
  51247. return getMeasurement(def);
  51248. }
  51249. const match = str.trim().match(measurementPattern);
  51250. if (!match) {
  51251. return getMeasurement(def);
  51252. }
  51253. const [, valueStr, unit] = match;
  51254. const value = parseFloat(valueStr);
  51255. if (isNaN(value)) {
  51256. return getMeasurement(def);
  51257. }
  51258. if (value === 0) {
  51259. return 0;
  51260. }
  51261. const conv = dimConverters[unit];
  51262. if (conv) {
  51263. return conv(value);
  51264. }
  51265. return value;
  51266. }
  51267. function getRatio(data) {
  51268. if (!data) {
  51269. return {
  51270. num: 1,
  51271. den: 1
  51272. };
  51273. }
  51274. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  51275. if (ratio.length === 1) {
  51276. ratio.push(1);
  51277. }
  51278. if (ratio.length === 0) {
  51279. return {
  51280. num: 1,
  51281. den: 1
  51282. };
  51283. }
  51284. const [num, den] = ratio;
  51285. return {
  51286. num,
  51287. den
  51288. };
  51289. }
  51290. function getRelevant(data) {
  51291. if (!data) {
  51292. return [];
  51293. }
  51294. return data.trim().split(/\s+/).map(e => {
  51295. return {
  51296. excluded: e[0] === "-",
  51297. viewname: e.substring(1)
  51298. };
  51299. });
  51300. }
  51301. function getColor(data, def = [0, 0, 0]) {
  51302. let [r, g, b] = def;
  51303. if (!data) {
  51304. return {
  51305. r,
  51306. g,
  51307. b
  51308. };
  51309. }
  51310. 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);
  51311. if (color.length < 3) {
  51312. return {
  51313. r,
  51314. g,
  51315. b
  51316. };
  51317. }
  51318. [r, g, b] = color;
  51319. return {
  51320. r,
  51321. g,
  51322. b
  51323. };
  51324. }
  51325. function getBBox(data) {
  51326. const def = -1;
  51327. if (!data) {
  51328. return {
  51329. x: def,
  51330. y: def,
  51331. width: def,
  51332. height: def
  51333. };
  51334. }
  51335. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  51336. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  51337. return {
  51338. x: def,
  51339. y: def,
  51340. width: def,
  51341. height: def
  51342. };
  51343. }
  51344. const [x, y, width, height] = bbox;
  51345. return {
  51346. x,
  51347. y,
  51348. width,
  51349. height
  51350. };
  51351. }
  51352. class HTMLResult {
  51353. static get FAILURE() {
  51354. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  51355. }
  51356. static get EMPTY() {
  51357. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  51358. }
  51359. constructor(success, html, bbox, breakNode) {
  51360. this.success = success;
  51361. this.html = html;
  51362. this.bbox = bbox;
  51363. this.breakNode = breakNode;
  51364. }
  51365. isBreak() {
  51366. return !!this.breakNode;
  51367. }
  51368. static breakNode(node) {
  51369. return new HTMLResult(false, null, null, node);
  51370. }
  51371. static success(html, bbox = null) {
  51372. return new HTMLResult(true, html, bbox, null);
  51373. }
  51374. }
  51375. exports.HTMLResult = HTMLResult;
  51376. /***/ }),
  51377. /* 78 */
  51378. /***/ ((__unused_webpack_module, exports) => {
  51379. Object.defineProperty(exports, "__esModule", ({
  51380. value: true
  51381. }));
  51382. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  51383. const $buildXFAObject = Symbol();
  51384. exports.$buildXFAObject = $buildXFAObject;
  51385. const NamespaceIds = {
  51386. config: {
  51387. id: 0,
  51388. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  51389. },
  51390. connectionSet: {
  51391. id: 1,
  51392. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  51393. },
  51394. datasets: {
  51395. id: 2,
  51396. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  51397. },
  51398. form: {
  51399. id: 3,
  51400. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  51401. },
  51402. localeSet: {
  51403. id: 4,
  51404. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  51405. },
  51406. pdf: {
  51407. id: 5,
  51408. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  51409. },
  51410. signature: {
  51411. id: 6,
  51412. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  51413. },
  51414. sourceSet: {
  51415. id: 7,
  51416. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  51417. },
  51418. stylesheet: {
  51419. id: 8,
  51420. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  51421. },
  51422. template: {
  51423. id: 9,
  51424. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  51425. },
  51426. xdc: {
  51427. id: 10,
  51428. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  51429. },
  51430. xdp: {
  51431. id: 11,
  51432. check: ns => ns === "http://ns.adobe.com/xdp/"
  51433. },
  51434. xfdf: {
  51435. id: 12,
  51436. check: ns => ns === "http://ns.adobe.com/xfdf/"
  51437. },
  51438. xhtml: {
  51439. id: 13,
  51440. check: ns => ns === "http://www.w3.org/1999/xhtml"
  51441. },
  51442. xmpmeta: {
  51443. id: 14,
  51444. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  51445. }
  51446. };
  51447. exports.NamespaceIds = NamespaceIds;
  51448. /***/ }),
  51449. /* 79 */
  51450. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51451. Object.defineProperty(exports, "__esModule", ({
  51452. value: true
  51453. }));
  51454. exports.createDataNode = createDataNode;
  51455. exports.searchNode = searchNode;
  51456. var _xfa_object = __w_pdfjs_require__(76);
  51457. var _namespaces = __w_pdfjs_require__(78);
  51458. var _util = __w_pdfjs_require__(2);
  51459. const namePattern = /^[^.[]+/;
  51460. const indexPattern = /^[^\]]+/;
  51461. const operators = {
  51462. dot: 0,
  51463. dotDot: 1,
  51464. dotHash: 2,
  51465. dotBracket: 3,
  51466. dotParen: 4
  51467. };
  51468. 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]]);
  51469. const somCache = new WeakMap();
  51470. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51471. function parseIndex(index) {
  51472. index = index.trim();
  51473. if (index === "*") {
  51474. return Infinity;
  51475. }
  51476. return parseInt(index, 10) || 0;
  51477. }
  51478. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  51479. let match = expr.match(namePattern);
  51480. if (!match) {
  51481. return null;
  51482. }
  51483. let [name] = match;
  51484. const parsed = [{
  51485. name,
  51486. cacheName: "." + name,
  51487. index: 0,
  51488. js: null,
  51489. formCalc: null,
  51490. operator: operators.dot
  51491. }];
  51492. let pos = name.length;
  51493. while (pos < expr.length) {
  51494. const spos = pos;
  51495. const char = expr.charAt(pos++);
  51496. if (char === "[") {
  51497. match = expr.slice(pos).match(indexPattern);
  51498. if (!match) {
  51499. (0, _util.warn)("XFA - Invalid index in SOM expression");
  51500. return null;
  51501. }
  51502. parsed[parsed.length - 1].index = parseIndex(match[0]);
  51503. pos += match[0].length + 1;
  51504. continue;
  51505. }
  51506. let operator;
  51507. switch (expr.charAt(pos)) {
  51508. case ".":
  51509. if (!dotDotAllowed) {
  51510. return null;
  51511. }
  51512. pos++;
  51513. operator = operators.dotDot;
  51514. break;
  51515. case "#":
  51516. pos++;
  51517. operator = operators.dotHash;
  51518. break;
  51519. case "[":
  51520. if (noExpr) {
  51521. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  51522. return null;
  51523. }
  51524. operator = operators.dotBracket;
  51525. break;
  51526. case "(":
  51527. if (noExpr) {
  51528. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  51529. return null;
  51530. }
  51531. operator = operators.dotParen;
  51532. break;
  51533. default:
  51534. operator = operators.dot;
  51535. break;
  51536. }
  51537. match = expr.slice(pos).match(namePattern);
  51538. if (!match) {
  51539. break;
  51540. }
  51541. [name] = match;
  51542. pos += name.length;
  51543. parsed.push({
  51544. name,
  51545. cacheName: expr.slice(spos, pos),
  51546. operator,
  51547. index: 0,
  51548. js: null,
  51549. formCalc: null
  51550. });
  51551. }
  51552. return parsed;
  51553. }
  51554. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  51555. const parsed = parseExpression(expr, dotDotAllowed);
  51556. if (!parsed) {
  51557. return null;
  51558. }
  51559. const fn = shortcuts.get(parsed[0].name);
  51560. let i = 0;
  51561. let isQualified;
  51562. if (fn) {
  51563. isQualified = true;
  51564. root = [fn(root, container)];
  51565. i = 1;
  51566. } else {
  51567. isQualified = container === null;
  51568. root = [container || root];
  51569. }
  51570. for (let ii = parsed.length; i < ii; i++) {
  51571. const {
  51572. name,
  51573. cacheName,
  51574. operator,
  51575. index
  51576. } = parsed[i];
  51577. const nodes = [];
  51578. for (const node of root) {
  51579. if (!(node instanceof _xfa_object.XFAObject)) {
  51580. continue;
  51581. }
  51582. let children, cached;
  51583. if (useCache) {
  51584. cached = somCache.get(node);
  51585. if (!cached) {
  51586. cached = new Map();
  51587. somCache.set(node, cached);
  51588. }
  51589. children = cached.get(cacheName);
  51590. }
  51591. if (!children) {
  51592. switch (operator) {
  51593. case operators.dot:
  51594. children = node[_xfa_object.$getChildrenByName](name, false);
  51595. break;
  51596. case operators.dotDot:
  51597. children = node[_xfa_object.$getChildrenByName](name, true);
  51598. break;
  51599. case operators.dotHash:
  51600. children = node[_xfa_object.$getChildrenByClass](name);
  51601. if (children instanceof _xfa_object.XFAObjectArray) {
  51602. children = children.children;
  51603. } else {
  51604. children = [children];
  51605. }
  51606. break;
  51607. default:
  51608. break;
  51609. }
  51610. if (useCache) {
  51611. cached.set(cacheName, children);
  51612. }
  51613. }
  51614. if (children.length > 0) {
  51615. nodes.push(children);
  51616. }
  51617. }
  51618. if (nodes.length === 0 && !isQualified && i === 0) {
  51619. const parent = container[_xfa_object.$getParent]();
  51620. container = parent;
  51621. if (!container) {
  51622. return null;
  51623. }
  51624. i = -1;
  51625. root = [container];
  51626. continue;
  51627. }
  51628. if (isFinite(index)) {
  51629. root = nodes.filter(node => index < node.length).map(node => node[index]);
  51630. } else {
  51631. root = nodes.reduce((acc, node) => acc.concat(node), []);
  51632. }
  51633. }
  51634. if (root.length === 0) {
  51635. return null;
  51636. }
  51637. return root;
  51638. }
  51639. function createNodes(root, path) {
  51640. let node = null;
  51641. for (const {
  51642. name,
  51643. index
  51644. } of path) {
  51645. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  51646. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  51647. node = new _xfa_object.XmlObject(nsId, name);
  51648. root[_xfa_object.$appendChild](node);
  51649. }
  51650. root = node;
  51651. }
  51652. return node;
  51653. }
  51654. function createDataNode(root, container, expr) {
  51655. const parsed = parseExpression(expr);
  51656. if (!parsed) {
  51657. return null;
  51658. }
  51659. if (parsed.some(x => x.operator === operators.dotDot)) {
  51660. return null;
  51661. }
  51662. const fn = shortcuts.get(parsed[0].name);
  51663. let i = 0;
  51664. if (fn) {
  51665. root = fn(root, container);
  51666. i = 1;
  51667. } else {
  51668. root = container || root;
  51669. }
  51670. for (let ii = parsed.length; i < ii; i++) {
  51671. const {
  51672. name,
  51673. operator,
  51674. index
  51675. } = parsed[i];
  51676. if (!isFinite(index)) {
  51677. parsed[i].index = 0;
  51678. return createNodes(root, parsed.slice(i));
  51679. }
  51680. let children;
  51681. switch (operator) {
  51682. case operators.dot:
  51683. children = root[_xfa_object.$getChildrenByName](name, false);
  51684. break;
  51685. case operators.dotDot:
  51686. children = root[_xfa_object.$getChildrenByName](name, true);
  51687. break;
  51688. case operators.dotHash:
  51689. children = root[_xfa_object.$getChildrenByClass](name);
  51690. if (children instanceof _xfa_object.XFAObjectArray) {
  51691. children = children.children;
  51692. } else {
  51693. children = [children];
  51694. }
  51695. break;
  51696. default:
  51697. break;
  51698. }
  51699. if (children.length === 0) {
  51700. return createNodes(root, parsed.slice(i));
  51701. }
  51702. if (index < children.length) {
  51703. const child = children[index];
  51704. if (!(child instanceof _xfa_object.XFAObject)) {
  51705. (0, _util.warn)(`XFA - Cannot create a node.`);
  51706. return null;
  51707. }
  51708. root = child;
  51709. } else {
  51710. parsed[i].index = index - children.length;
  51711. return createNodes(root, parsed.slice(i));
  51712. }
  51713. }
  51714. return null;
  51715. }
  51716. /***/ }),
  51717. /* 80 */
  51718. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51719. Object.defineProperty(exports, "__esModule", ({
  51720. value: true
  51721. }));
  51722. exports.Binder = void 0;
  51723. var _xfa_object = __w_pdfjs_require__(76);
  51724. var _template = __w_pdfjs_require__(81);
  51725. var _som = __w_pdfjs_require__(79);
  51726. var _namespaces = __w_pdfjs_require__(78);
  51727. var _util = __w_pdfjs_require__(2);
  51728. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51729. function createText(content) {
  51730. const node = new _template.Text({});
  51731. node[_xfa_object.$content] = content;
  51732. return node;
  51733. }
  51734. class Binder {
  51735. constructor(root) {
  51736. this.root = root;
  51737. this.datasets = root.datasets;
  51738. if (root.datasets && root.datasets.data) {
  51739. this.data = root.datasets.data;
  51740. } else {
  51741. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  51742. }
  51743. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  51744. this.root.form = this.form = root.template[_xfa_object.$clone]();
  51745. }
  51746. _isConsumeData() {
  51747. return !this.emptyMerge && this._mergeMode;
  51748. }
  51749. _isMatchTemplate() {
  51750. return !this._isConsumeData();
  51751. }
  51752. bind() {
  51753. this._bindElement(this.form, this.data);
  51754. return this.form;
  51755. }
  51756. getData() {
  51757. return this.data;
  51758. }
  51759. _bindValue(formNode, data, picture) {
  51760. formNode[_xfa_object.$data] = data;
  51761. if (formNode[_xfa_object.$hasSettableValue]()) {
  51762. if (data[_xfa_object.$isDataValue]()) {
  51763. const value = data[_xfa_object.$getDataValue]();
  51764. formNode[_xfa_object.$setValue](createText(value));
  51765. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  51766. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  51767. formNode[_xfa_object.$setValue](createText(value));
  51768. } else if (this._isConsumeData()) {
  51769. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  51770. }
  51771. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  51772. this._bindElement(formNode, data);
  51773. } else {
  51774. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  51775. }
  51776. }
  51777. _findDataByNameToConsume(name, isValue, dataNode, global) {
  51778. if (!name) {
  51779. return null;
  51780. }
  51781. let generator, match;
  51782. for (let i = 0; i < 3; i++) {
  51783. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  51784. while (true) {
  51785. match = generator.next().value;
  51786. if (!match) {
  51787. break;
  51788. }
  51789. if (isValue === match[_xfa_object.$isDataValue]()) {
  51790. return match;
  51791. }
  51792. }
  51793. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  51794. break;
  51795. }
  51796. dataNode = dataNode[_xfa_object.$getParent]();
  51797. }
  51798. if (!global) {
  51799. return null;
  51800. }
  51801. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  51802. match = generator.next().value;
  51803. if (match) {
  51804. return match;
  51805. }
  51806. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  51807. match = generator.next().value;
  51808. if (match && match[_xfa_object.$isDataValue]()) {
  51809. return match;
  51810. }
  51811. return null;
  51812. }
  51813. _setProperties(formNode, dataNode) {
  51814. if (!formNode.hasOwnProperty("setProperty")) {
  51815. return;
  51816. }
  51817. for (const {
  51818. ref,
  51819. target,
  51820. connection
  51821. } of formNode.setProperty.children) {
  51822. if (connection) {
  51823. continue;
  51824. }
  51825. if (!ref) {
  51826. continue;
  51827. }
  51828. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  51829. if (!nodes) {
  51830. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  51831. continue;
  51832. }
  51833. const [node] = nodes;
  51834. if (!node[_xfa_object.$isDescendent](this.data)) {
  51835. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  51836. continue;
  51837. }
  51838. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  51839. if (!targetNodes) {
  51840. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  51841. continue;
  51842. }
  51843. const [targetNode] = targetNodes;
  51844. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  51845. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  51846. continue;
  51847. }
  51848. const targetParent = targetNode[_xfa_object.$getParent]();
  51849. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  51850. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  51851. continue;
  51852. }
  51853. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  51854. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  51855. continue;
  51856. }
  51857. const content = node[_xfa_object.$text]();
  51858. const name = targetNode[_xfa_object.$nodeName];
  51859. if (targetNode instanceof _xfa_object.XFAAttribute) {
  51860. const attrs = Object.create(null);
  51861. attrs[name] = content;
  51862. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  51863. targetParent[name] = obj[name];
  51864. continue;
  51865. }
  51866. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  51867. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  51868. continue;
  51869. }
  51870. targetNode[_xfa_object.$data] = node;
  51871. targetNode[_xfa_object.$content] = content;
  51872. targetNode[_xfa_object.$finalize]();
  51873. }
  51874. }
  51875. _bindItems(formNode, dataNode) {
  51876. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  51877. return;
  51878. }
  51879. for (const item of formNode.items.children) {
  51880. formNode[_xfa_object.$removeChild](item);
  51881. }
  51882. formNode.items.clear();
  51883. const labels = new _template.Items({});
  51884. const values = new _template.Items({});
  51885. formNode[_xfa_object.$appendChild](labels);
  51886. formNode.items.push(labels);
  51887. formNode[_xfa_object.$appendChild](values);
  51888. formNode.items.push(values);
  51889. for (const {
  51890. ref,
  51891. labelRef,
  51892. valueRef,
  51893. connection
  51894. } of formNode.bindItems.children) {
  51895. if (connection) {
  51896. continue;
  51897. }
  51898. if (!ref) {
  51899. continue;
  51900. }
  51901. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  51902. if (!nodes) {
  51903. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  51904. continue;
  51905. }
  51906. for (const node of nodes) {
  51907. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  51908. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  51909. continue;
  51910. }
  51911. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  51912. if (!labelNodes) {
  51913. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  51914. continue;
  51915. }
  51916. const [labelNode] = labelNodes;
  51917. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  51918. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  51919. continue;
  51920. }
  51921. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  51922. if (!valueNodes) {
  51923. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  51924. continue;
  51925. }
  51926. const [valueNode] = valueNodes;
  51927. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  51928. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  51929. continue;
  51930. }
  51931. const label = createText(labelNode[_xfa_object.$text]());
  51932. const value = createText(valueNode[_xfa_object.$text]());
  51933. labels[_xfa_object.$appendChild](label);
  51934. labels.text.push(label);
  51935. values[_xfa_object.$appendChild](value);
  51936. values.text.push(value);
  51937. }
  51938. }
  51939. }
  51940. _bindOccurrences(formNode, matches, picture) {
  51941. let baseClone;
  51942. if (matches.length > 1) {
  51943. baseClone = formNode[_xfa_object.$clone]();
  51944. baseClone[_xfa_object.$removeChild](baseClone.occur);
  51945. baseClone.occur = null;
  51946. }
  51947. this._bindValue(formNode, matches[0], picture);
  51948. this._setProperties(formNode, matches[0]);
  51949. this._bindItems(formNode, matches[0]);
  51950. if (matches.length === 1) {
  51951. return;
  51952. }
  51953. const parent = formNode[_xfa_object.$getParent]();
  51954. const name = formNode[_xfa_object.$nodeName];
  51955. const pos = parent[_xfa_object.$indexOf](formNode);
  51956. for (let i = 1, ii = matches.length; i < ii; i++) {
  51957. const match = matches[i];
  51958. const clone = baseClone[_xfa_object.$clone]();
  51959. parent[name].push(clone);
  51960. parent[_xfa_object.$insertAt](pos + i, clone);
  51961. this._bindValue(clone, match, picture);
  51962. this._setProperties(clone, match);
  51963. this._bindItems(clone, match);
  51964. }
  51965. }
  51966. _createOccurrences(formNode) {
  51967. if (!this.emptyMerge) {
  51968. return;
  51969. }
  51970. const {
  51971. occur
  51972. } = formNode;
  51973. if (!occur || occur.initial <= 1) {
  51974. return;
  51975. }
  51976. const parent = formNode[_xfa_object.$getParent]();
  51977. const name = formNode[_xfa_object.$nodeName];
  51978. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  51979. return;
  51980. }
  51981. let currentNumber;
  51982. if (formNode.name) {
  51983. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  51984. } else {
  51985. currentNumber = parent[name].children.length;
  51986. }
  51987. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  51988. const ii = occur.initial - currentNumber;
  51989. if (ii) {
  51990. const nodeClone = formNode[_xfa_object.$clone]();
  51991. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  51992. nodeClone.occur = null;
  51993. parent[name].push(nodeClone);
  51994. parent[_xfa_object.$insertAt](pos, nodeClone);
  51995. for (let i = 1; i < ii; i++) {
  51996. const clone = nodeClone[_xfa_object.$clone]();
  51997. parent[name].push(clone);
  51998. parent[_xfa_object.$insertAt](pos + i, clone);
  51999. }
  52000. }
  52001. }
  52002. _getOccurInfo(formNode) {
  52003. const {
  52004. name,
  52005. occur
  52006. } = formNode;
  52007. if (!occur || !name) {
  52008. return [1, 1];
  52009. }
  52010. const max = occur.max === -1 ? Infinity : occur.max;
  52011. return [occur.min, max];
  52012. }
  52013. _setAndBind(formNode, dataNode) {
  52014. this._setProperties(formNode, dataNode);
  52015. this._bindItems(formNode, dataNode);
  52016. this._bindElement(formNode, dataNode);
  52017. }
  52018. _bindElement(formNode, dataNode) {
  52019. const uselessNodes = [];
  52020. this._createOccurrences(formNode);
  52021. for (const child of formNode[_xfa_object.$getChildren]()) {
  52022. if (child[_xfa_object.$data]) {
  52023. continue;
  52024. }
  52025. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  52026. this._mergeMode = child.mergeMode === "consumeData";
  52027. const dataChildren = dataNode[_xfa_object.$getChildren]();
  52028. if (dataChildren.length > 0) {
  52029. this._bindOccurrences(child, [dataChildren[0]], null);
  52030. } else if (this.emptyMerge) {
  52031. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  52032. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  52033. dataNode[_xfa_object.$appendChild](dataChild);
  52034. this._bindElement(child, dataChild);
  52035. }
  52036. continue;
  52037. }
  52038. if (!child[_xfa_object.$isBindable]()) {
  52039. continue;
  52040. }
  52041. let global = false;
  52042. let picture = null;
  52043. let ref = null;
  52044. let match = null;
  52045. if (child.bind) {
  52046. switch (child.bind.match) {
  52047. case "none":
  52048. this._setAndBind(child, dataNode);
  52049. continue;
  52050. case "global":
  52051. global = true;
  52052. break;
  52053. case "dataRef":
  52054. if (!child.bind.ref) {
  52055. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  52056. this._setAndBind(child, dataNode);
  52057. continue;
  52058. }
  52059. ref = child.bind.ref;
  52060. break;
  52061. default:
  52062. break;
  52063. }
  52064. if (child.bind.picture) {
  52065. picture = child.bind.picture[_xfa_object.$content];
  52066. }
  52067. }
  52068. const [min, max] = this._getOccurInfo(child);
  52069. if (ref) {
  52070. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  52071. if (match === null) {
  52072. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  52073. if (!match) {
  52074. continue;
  52075. }
  52076. if (this._isConsumeData()) {
  52077. match[_xfa_object.$consumed] = true;
  52078. }
  52079. this._setAndBind(child, match);
  52080. continue;
  52081. } else {
  52082. if (this._isConsumeData()) {
  52083. match = match.filter(node => !node[_xfa_object.$consumed]);
  52084. }
  52085. if (match.length > max) {
  52086. match = match.slice(0, max);
  52087. } else if (match.length === 0) {
  52088. match = null;
  52089. }
  52090. if (match && this._isConsumeData()) {
  52091. match.forEach(node => {
  52092. node[_xfa_object.$consumed] = true;
  52093. });
  52094. }
  52095. }
  52096. } else {
  52097. if (!child.name) {
  52098. this._setAndBind(child, dataNode);
  52099. continue;
  52100. }
  52101. if (this._isConsumeData()) {
  52102. const matches = [];
  52103. while (matches.length < max) {
  52104. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  52105. if (!found) {
  52106. break;
  52107. }
  52108. found[_xfa_object.$consumed] = true;
  52109. matches.push(found);
  52110. }
  52111. match = matches.length > 0 ? matches : null;
  52112. } else {
  52113. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  52114. if (!match) {
  52115. if (min === 0) {
  52116. uselessNodes.push(child);
  52117. continue;
  52118. }
  52119. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  52120. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  52121. if (this.emptyMerge) {
  52122. match[_xfa_object.$consumed] = true;
  52123. }
  52124. dataNode[_xfa_object.$appendChild](match);
  52125. this._setAndBind(child, match);
  52126. continue;
  52127. }
  52128. if (this.emptyMerge) {
  52129. match[_xfa_object.$consumed] = true;
  52130. }
  52131. match = [match];
  52132. }
  52133. }
  52134. if (match) {
  52135. this._bindOccurrences(child, match, picture);
  52136. } else if (min > 0) {
  52137. this._setAndBind(child, dataNode);
  52138. } else {
  52139. uselessNodes.push(child);
  52140. }
  52141. }
  52142. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  52143. }
  52144. }
  52145. exports.Binder = Binder;
  52146. /***/ }),
  52147. /* 81 */
  52148. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52149. Object.defineProperty(exports, "__esModule", ({
  52150. value: true
  52151. }));
  52152. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  52153. var _xfa_object = __w_pdfjs_require__(76);
  52154. var _namespaces = __w_pdfjs_require__(78);
  52155. var _layout = __w_pdfjs_require__(82);
  52156. var _html_utils = __w_pdfjs_require__(83);
  52157. var _utils = __w_pdfjs_require__(77);
  52158. var _util = __w_pdfjs_require__(2);
  52159. var _fonts = __w_pdfjs_require__(84);
  52160. var _core_utils = __w_pdfjs_require__(8);
  52161. var _som = __w_pdfjs_require__(79);
  52162. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  52163. const SVG_NS = "http://www.w3.org/2000/svg";
  52164. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  52165. const MAX_EMPTY_PAGES = 3;
  52166. const DEFAULT_TAB_INDEX = 5000;
  52167. const HEADING_PATTERN = /^H(\d+)$/;
  52168. 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"]);
  52169. 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"]];
  52170. function getBorderDims(node) {
  52171. if (!node || !node.border) {
  52172. return {
  52173. w: 0,
  52174. h: 0
  52175. };
  52176. }
  52177. const borderExtra = node.border[_xfa_object.$getExtra]();
  52178. if (!borderExtra) {
  52179. return {
  52180. w: 0,
  52181. h: 0
  52182. };
  52183. }
  52184. return {
  52185. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  52186. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  52187. };
  52188. }
  52189. function hasMargin(node) {
  52190. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  52191. }
  52192. function _setValue(templateNode, value) {
  52193. if (!templateNode.value) {
  52194. const nodeValue = new Value({});
  52195. templateNode[_xfa_object.$appendChild](nodeValue);
  52196. templateNode.value = nodeValue;
  52197. }
  52198. templateNode.value[_xfa_object.$setValue](value);
  52199. }
  52200. function* getContainedChildren(node) {
  52201. for (const child of node[_xfa_object.$getChildren]()) {
  52202. if (child instanceof SubformSet) {
  52203. yield* child[_xfa_object.$getContainedChildren]();
  52204. continue;
  52205. }
  52206. yield child;
  52207. }
  52208. }
  52209. function setTabIndex(node) {
  52210. while (node) {
  52211. if (!node.traversal) {
  52212. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52213. return;
  52214. }
  52215. if (node[_xfa_object.$tabIndex]) {
  52216. return;
  52217. }
  52218. let next = null;
  52219. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  52220. if (child.operation === "next") {
  52221. next = child;
  52222. break;
  52223. }
  52224. }
  52225. if (!next || !next.ref) {
  52226. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52227. return;
  52228. }
  52229. const root = node[_xfa_object.$getTemplateRoot]();
  52230. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  52231. const ref = root[_xfa_object.$searchNode](next.ref, node);
  52232. if (!ref) {
  52233. return;
  52234. }
  52235. node = ref[0];
  52236. }
  52237. }
  52238. function applyAssist(obj, attributes) {
  52239. const assist = obj.assist;
  52240. if (assist) {
  52241. const assistTitle = assist[_xfa_object.$toHTML]();
  52242. if (assistTitle) {
  52243. attributes.title = assistTitle;
  52244. }
  52245. const role = assist.role;
  52246. const match = role.match(HEADING_PATTERN);
  52247. if (match) {
  52248. const ariaRole = "heading";
  52249. const ariaLevel = match[1];
  52250. attributes.role = ariaRole;
  52251. attributes["aria-level"] = ariaLevel;
  52252. }
  52253. }
  52254. if (obj.layout === "table") {
  52255. attributes.role = "table";
  52256. } else if (obj.layout === "row") {
  52257. attributes.role = "row";
  52258. } else {
  52259. const parent = obj[_xfa_object.$getParent]();
  52260. if (parent.layout === "row") {
  52261. if (parent.assist && parent.assist.role === "TH") {
  52262. attributes.role = "columnheader";
  52263. } else {
  52264. attributes.role = "cell";
  52265. }
  52266. }
  52267. }
  52268. }
  52269. function ariaLabel(obj) {
  52270. if (!obj.assist) {
  52271. return null;
  52272. }
  52273. const assist = obj.assist;
  52274. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  52275. return assist.speak[_xfa_object.$content];
  52276. }
  52277. if (assist.toolTip) {
  52278. return assist.toolTip[_xfa_object.$content];
  52279. }
  52280. return null;
  52281. }
  52282. function valueToHtml(value) {
  52283. return _utils.HTMLResult.success({
  52284. name: "div",
  52285. attributes: {
  52286. class: ["xfaRich"],
  52287. style: Object.create(null)
  52288. },
  52289. children: [{
  52290. name: "span",
  52291. attributes: {
  52292. style: Object.create(null)
  52293. },
  52294. value
  52295. }]
  52296. });
  52297. }
  52298. function setFirstUnsplittable(node) {
  52299. const root = node[_xfa_object.$getTemplateRoot]();
  52300. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  52301. root[_xfa_object.$extra].firstUnsplittable = node;
  52302. root[_xfa_object.$extra].noLayoutFailure = true;
  52303. }
  52304. }
  52305. function unsetFirstUnsplittable(node) {
  52306. const root = node[_xfa_object.$getTemplateRoot]();
  52307. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  52308. root[_xfa_object.$extra].noLayoutFailure = false;
  52309. }
  52310. }
  52311. function handleBreak(node) {
  52312. if (node[_xfa_object.$extra]) {
  52313. return false;
  52314. }
  52315. node[_xfa_object.$extra] = Object.create(null);
  52316. if (node.targetType === "auto") {
  52317. return false;
  52318. }
  52319. const root = node[_xfa_object.$getTemplateRoot]();
  52320. let target = null;
  52321. if (node.target) {
  52322. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  52323. if (!target) {
  52324. return false;
  52325. }
  52326. target = target[0];
  52327. }
  52328. const {
  52329. currentPageArea,
  52330. currentContentArea
  52331. } = root[_xfa_object.$extra];
  52332. if (node.targetType === "pageArea") {
  52333. if (!(target instanceof PageArea)) {
  52334. target = null;
  52335. }
  52336. if (node.startNew) {
  52337. node[_xfa_object.$extra].target = target || currentPageArea;
  52338. return true;
  52339. } else if (target && target !== currentPageArea) {
  52340. node[_xfa_object.$extra].target = target;
  52341. return true;
  52342. }
  52343. return false;
  52344. }
  52345. if (!(target instanceof ContentArea)) {
  52346. target = null;
  52347. }
  52348. const pageArea = target && target[_xfa_object.$getParent]();
  52349. let index;
  52350. let nextPageArea = pageArea;
  52351. if (node.startNew) {
  52352. if (target) {
  52353. const contentAreas = pageArea.contentArea.children;
  52354. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  52355. const indexForTarget = contentAreas.indexOf(target);
  52356. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  52357. nextPageArea = null;
  52358. }
  52359. index = indexForTarget - 1;
  52360. } else {
  52361. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  52362. }
  52363. } else if (target && target !== currentContentArea) {
  52364. const contentAreas = pageArea.contentArea.children;
  52365. index = contentAreas.indexOf(target) - 1;
  52366. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  52367. } else {
  52368. return false;
  52369. }
  52370. node[_xfa_object.$extra].target = nextPageArea;
  52371. node[_xfa_object.$extra].index = index;
  52372. return true;
  52373. }
  52374. function handleOverflow(node, extraNode, space) {
  52375. const root = node[_xfa_object.$getTemplateRoot]();
  52376. const saved = root[_xfa_object.$extra].noLayoutFailure;
  52377. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  52378. extraNode[_xfa_object.$getSubformParent] = () => node;
  52379. root[_xfa_object.$extra].noLayoutFailure = true;
  52380. const res = extraNode[_xfa_object.$toHTML](space);
  52381. node[_xfa_object.$addHTML](res.html, res.bbox);
  52382. root[_xfa_object.$extra].noLayoutFailure = saved;
  52383. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  52384. }
  52385. class AppearanceFilter extends _xfa_object.StringObject {
  52386. constructor(attributes) {
  52387. super(TEMPLATE_NS_ID, "appearanceFilter");
  52388. this.id = attributes.id || "";
  52389. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52390. this.use = attributes.use || "";
  52391. this.usehref = attributes.usehref || "";
  52392. }
  52393. }
  52394. class Arc extends _xfa_object.XFAObject {
  52395. constructor(attributes) {
  52396. super(TEMPLATE_NS_ID, "arc", true);
  52397. this.circular = (0, _utils.getInteger)({
  52398. data: attributes.circular,
  52399. defaultValue: 0,
  52400. validate: x => x === 1
  52401. });
  52402. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52403. this.id = attributes.id || "";
  52404. this.startAngle = (0, _utils.getFloat)({
  52405. data: attributes.startAngle,
  52406. defaultValue: 0,
  52407. validate: x => true
  52408. });
  52409. this.sweepAngle = (0, _utils.getFloat)({
  52410. data: attributes.sweepAngle,
  52411. defaultValue: 360,
  52412. validate: x => true
  52413. });
  52414. this.use = attributes.use || "";
  52415. this.usehref = attributes.usehref || "";
  52416. this.edge = null;
  52417. this.fill = null;
  52418. }
  52419. [_xfa_object.$toHTML]() {
  52420. const edge = this.edge ? this.edge : new Edge({});
  52421. const edgeStyle = edge[_xfa_object.$toStyle]();
  52422. const style = Object.create(null);
  52423. if (this.fill && this.fill.presence === "visible") {
  52424. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52425. } else {
  52426. style.fill = "transparent";
  52427. }
  52428. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  52429. style.stroke = edgeStyle.color;
  52430. let arc;
  52431. const attributes = {
  52432. xmlns: SVG_NS,
  52433. style: {
  52434. width: "100%",
  52435. height: "100%",
  52436. overflow: "visible"
  52437. }
  52438. };
  52439. if (this.sweepAngle === 360) {
  52440. arc = {
  52441. name: "ellipse",
  52442. attributes: {
  52443. xmlns: SVG_NS,
  52444. cx: "50%",
  52445. cy: "50%",
  52446. rx: "50%",
  52447. ry: "50%",
  52448. style
  52449. }
  52450. };
  52451. } else {
  52452. const startAngle = this.startAngle * Math.PI / 180;
  52453. const sweepAngle = this.sweepAngle * Math.PI / 180;
  52454. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  52455. 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))];
  52456. arc = {
  52457. name: "path",
  52458. attributes: {
  52459. xmlns: SVG_NS,
  52460. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  52461. vectorEffect: "non-scaling-stroke",
  52462. style
  52463. }
  52464. };
  52465. Object.assign(attributes, {
  52466. viewBox: "0 0 100 100",
  52467. preserveAspectRatio: "none"
  52468. });
  52469. }
  52470. const svg = {
  52471. name: "svg",
  52472. children: [arc],
  52473. attributes
  52474. };
  52475. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52476. if (hasMargin(parent)) {
  52477. return _utils.HTMLResult.success({
  52478. name: "div",
  52479. attributes: {
  52480. style: {
  52481. display: "inline",
  52482. width: "100%",
  52483. height: "100%"
  52484. }
  52485. },
  52486. children: [svg]
  52487. });
  52488. }
  52489. svg.attributes.style.position = "absolute";
  52490. return _utils.HTMLResult.success(svg);
  52491. }
  52492. }
  52493. class Area extends _xfa_object.XFAObject {
  52494. constructor(attributes) {
  52495. super(TEMPLATE_NS_ID, "area", true);
  52496. this.colSpan = (0, _utils.getInteger)({
  52497. data: attributes.colSpan,
  52498. defaultValue: 1,
  52499. validate: n => n >= 1 || n === -1
  52500. });
  52501. this.id = attributes.id || "";
  52502. this.name = attributes.name || "";
  52503. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52504. this.use = attributes.use || "";
  52505. this.usehref = attributes.usehref || "";
  52506. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52507. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52508. this.desc = null;
  52509. this.extras = null;
  52510. this.area = new _xfa_object.XFAObjectArray();
  52511. this.draw = new _xfa_object.XFAObjectArray();
  52512. this.exObject = new _xfa_object.XFAObjectArray();
  52513. this.exclGroup = new _xfa_object.XFAObjectArray();
  52514. this.field = new _xfa_object.XFAObjectArray();
  52515. this.subform = new _xfa_object.XFAObjectArray();
  52516. this.subformSet = new _xfa_object.XFAObjectArray();
  52517. }
  52518. *[_xfa_object.$getContainedChildren]() {
  52519. yield* getContainedChildren(this);
  52520. }
  52521. [_xfa_object.$isTransparent]() {
  52522. return true;
  52523. }
  52524. [_xfa_object.$isBindable]() {
  52525. return true;
  52526. }
  52527. [_xfa_object.$addHTML](html, bbox) {
  52528. const [x, y, w, h] = bbox;
  52529. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  52530. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  52531. this[_xfa_object.$extra].children.push(html);
  52532. }
  52533. [_xfa_object.$getAvailableSpace]() {
  52534. return this[_xfa_object.$extra].availableSpace;
  52535. }
  52536. [_xfa_object.$toHTML](availableSpace) {
  52537. const style = (0, _html_utils.toStyle)(this, "position");
  52538. const attributes = {
  52539. style,
  52540. id: this[_xfa_object.$uid],
  52541. class: ["xfaArea"]
  52542. };
  52543. if ((0, _html_utils.isPrintOnly)(this)) {
  52544. attributes.class.push("xfaPrintOnly");
  52545. }
  52546. if (this.name) {
  52547. attributes.xfaName = this.name;
  52548. }
  52549. const children = [];
  52550. this[_xfa_object.$extra] = {
  52551. children,
  52552. width: 0,
  52553. height: 0,
  52554. availableSpace
  52555. };
  52556. const result = this[_xfa_object.$childrenToHTML]({
  52557. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  52558. include: true
  52559. });
  52560. if (!result.success) {
  52561. if (result.isBreak()) {
  52562. return result;
  52563. }
  52564. delete this[_xfa_object.$extra];
  52565. return _utils.HTMLResult.FAILURE;
  52566. }
  52567. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  52568. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  52569. const html = {
  52570. name: "div",
  52571. attributes,
  52572. children
  52573. };
  52574. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  52575. delete this[_xfa_object.$extra];
  52576. return _utils.HTMLResult.success(html, bbox);
  52577. }
  52578. }
  52579. class Assist extends _xfa_object.XFAObject {
  52580. constructor(attributes) {
  52581. super(TEMPLATE_NS_ID, "assist", true);
  52582. this.id = attributes.id || "";
  52583. this.role = attributes.role || "";
  52584. this.use = attributes.use || "";
  52585. this.usehref = attributes.usehref || "";
  52586. this.speak = null;
  52587. this.toolTip = null;
  52588. }
  52589. [_xfa_object.$toHTML]() {
  52590. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  52591. }
  52592. }
  52593. class Barcode extends _xfa_object.XFAObject {
  52594. constructor(attributes) {
  52595. super(TEMPLATE_NS_ID, "barcode", true);
  52596. this.charEncoding = (0, _utils.getKeyword)({
  52597. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  52598. defaultValue: "",
  52599. 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}/)
  52600. });
  52601. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  52602. this.dataColumnCount = (0, _utils.getInteger)({
  52603. data: attributes.dataColumnCount,
  52604. defaultValue: -1,
  52605. validate: x => x >= 0
  52606. });
  52607. this.dataLength = (0, _utils.getInteger)({
  52608. data: attributes.dataLength,
  52609. defaultValue: -1,
  52610. validate: x => x >= 0
  52611. });
  52612. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  52613. this.dataRowCount = (0, _utils.getInteger)({
  52614. data: attributes.dataRowCount,
  52615. defaultValue: -1,
  52616. validate: x => x >= 0
  52617. });
  52618. this.endChar = attributes.endChar || "";
  52619. this.errorCorrectionLevel = (0, _utils.getInteger)({
  52620. data: attributes.errorCorrectionLevel,
  52621. defaultValue: -1,
  52622. validate: x => x >= 0 && x <= 8
  52623. });
  52624. this.id = attributes.id || "";
  52625. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  52626. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  52627. this.printCheckDigit = (0, _utils.getInteger)({
  52628. data: attributes.printCheckDigit,
  52629. defaultValue: 0,
  52630. validate: x => x === 1
  52631. });
  52632. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  52633. this.startChar = attributes.startChar || "";
  52634. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  52635. this.truncate = (0, _utils.getInteger)({
  52636. data: attributes.truncate,
  52637. defaultValue: 0,
  52638. validate: x => x === 1
  52639. });
  52640. 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"]);
  52641. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  52642. this.use = attributes.use || "";
  52643. this.usehref = attributes.usehref || "";
  52644. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  52645. this.encrypt = null;
  52646. this.extras = null;
  52647. }
  52648. }
  52649. class Bind extends _xfa_object.XFAObject {
  52650. constructor(attributes) {
  52651. super(TEMPLATE_NS_ID, "bind", true);
  52652. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  52653. this.ref = attributes.ref || "";
  52654. this.picture = null;
  52655. }
  52656. }
  52657. class BindItems extends _xfa_object.XFAObject {
  52658. constructor(attributes) {
  52659. super(TEMPLATE_NS_ID, "bindItems");
  52660. this.connection = attributes.connection || "";
  52661. this.labelRef = attributes.labelRef || "";
  52662. this.ref = attributes.ref || "";
  52663. this.valueRef = attributes.valueRef || "";
  52664. }
  52665. }
  52666. exports.BindItems = BindItems;
  52667. class Bookend extends _xfa_object.XFAObject {
  52668. constructor(attributes) {
  52669. super(TEMPLATE_NS_ID, "bookend");
  52670. this.id = attributes.id || "";
  52671. this.leader = attributes.leader || "";
  52672. this.trailer = attributes.trailer || "";
  52673. this.use = attributes.use || "";
  52674. this.usehref = attributes.usehref || "";
  52675. }
  52676. }
  52677. class BooleanElement extends _xfa_object.Option01 {
  52678. constructor(attributes) {
  52679. super(TEMPLATE_NS_ID, "boolean");
  52680. this.id = attributes.id || "";
  52681. this.name = attributes.name || "";
  52682. this.use = attributes.use || "";
  52683. this.usehref = attributes.usehref || "";
  52684. }
  52685. [_xfa_object.$toHTML](availableSpace) {
  52686. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  52687. }
  52688. }
  52689. class Border extends _xfa_object.XFAObject {
  52690. constructor(attributes) {
  52691. super(TEMPLATE_NS_ID, "border", true);
  52692. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  52693. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52694. this.id = attributes.id || "";
  52695. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52696. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52697. this.use = attributes.use || "";
  52698. this.usehref = attributes.usehref || "";
  52699. this.corner = new _xfa_object.XFAObjectArray(4);
  52700. this.edge = new _xfa_object.XFAObjectArray(4);
  52701. this.extras = null;
  52702. this.fill = null;
  52703. this.margin = null;
  52704. }
  52705. [_xfa_object.$getExtra]() {
  52706. if (!this[_xfa_object.$extra]) {
  52707. const edges = this.edge.children.slice();
  52708. if (edges.length < 4) {
  52709. const defaultEdge = edges[edges.length - 1] || new Edge({});
  52710. for (let i = edges.length; i < 4; i++) {
  52711. edges.push(defaultEdge);
  52712. }
  52713. }
  52714. const widths = edges.map(edge => edge.thickness);
  52715. const insets = [0, 0, 0, 0];
  52716. if (this.margin) {
  52717. insets[0] = this.margin.topInset;
  52718. insets[1] = this.margin.rightInset;
  52719. insets[2] = this.margin.bottomInset;
  52720. insets[3] = this.margin.leftInset;
  52721. }
  52722. this[_xfa_object.$extra] = {
  52723. widths,
  52724. insets,
  52725. edges
  52726. };
  52727. }
  52728. return this[_xfa_object.$extra];
  52729. }
  52730. [_xfa_object.$toStyle]() {
  52731. const {
  52732. edges
  52733. } = this[_xfa_object.$getExtra]();
  52734. const edgeStyles = edges.map(node => {
  52735. const style = node[_xfa_object.$toStyle]();
  52736. style.color = style.color || "#000000";
  52737. return style;
  52738. });
  52739. const style = Object.create(null);
  52740. if (this.margin) {
  52741. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  52742. }
  52743. if (this.fill && this.fill.presence === "visible") {
  52744. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52745. }
  52746. if (this.corner.children.some(node => node.radius !== 0)) {
  52747. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  52748. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  52749. const last = cornerStyles[cornerStyles.length - 1];
  52750. for (let i = cornerStyles.length; i < 4; i++) {
  52751. cornerStyles.push(last);
  52752. }
  52753. }
  52754. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  52755. }
  52756. switch (this.presence) {
  52757. case "invisible":
  52758. case "hidden":
  52759. style.borderStyle = "";
  52760. break;
  52761. case "inactive":
  52762. style.borderStyle = "none";
  52763. break;
  52764. default:
  52765. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  52766. break;
  52767. }
  52768. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  52769. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  52770. return style;
  52771. }
  52772. }
  52773. class Break extends _xfa_object.XFAObject {
  52774. constructor(attributes) {
  52775. super(TEMPLATE_NS_ID, "break", true);
  52776. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  52777. this.afterTarget = attributes.afterTarget || "";
  52778. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  52779. this.beforeTarget = attributes.beforeTarget || "";
  52780. this.bookendLeader = attributes.bookendLeader || "";
  52781. this.bookendTrailer = attributes.bookendTrailer || "";
  52782. this.id = attributes.id || "";
  52783. this.overflowLeader = attributes.overflowLeader || "";
  52784. this.overflowTarget = attributes.overflowTarget || "";
  52785. this.overflowTrailer = attributes.overflowTrailer || "";
  52786. this.startNew = (0, _utils.getInteger)({
  52787. data: attributes.startNew,
  52788. defaultValue: 0,
  52789. validate: x => x === 1
  52790. });
  52791. this.use = attributes.use || "";
  52792. this.usehref = attributes.usehref || "";
  52793. this.extras = null;
  52794. }
  52795. }
  52796. class BreakAfter extends _xfa_object.XFAObject {
  52797. constructor(attributes) {
  52798. super(TEMPLATE_NS_ID, "breakAfter", true);
  52799. this.id = attributes.id || "";
  52800. this.leader = attributes.leader || "";
  52801. this.startNew = (0, _utils.getInteger)({
  52802. data: attributes.startNew,
  52803. defaultValue: 0,
  52804. validate: x => x === 1
  52805. });
  52806. this.target = attributes.target || "";
  52807. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  52808. this.trailer = attributes.trailer || "";
  52809. this.use = attributes.use || "";
  52810. this.usehref = attributes.usehref || "";
  52811. this.script = null;
  52812. }
  52813. }
  52814. class BreakBefore extends _xfa_object.XFAObject {
  52815. constructor(attributes) {
  52816. super(TEMPLATE_NS_ID, "breakBefore", true);
  52817. this.id = attributes.id || "";
  52818. this.leader = attributes.leader || "";
  52819. this.startNew = (0, _utils.getInteger)({
  52820. data: attributes.startNew,
  52821. defaultValue: 0,
  52822. validate: x => x === 1
  52823. });
  52824. this.target = attributes.target || "";
  52825. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  52826. this.trailer = attributes.trailer || "";
  52827. this.use = attributes.use || "";
  52828. this.usehref = attributes.usehref || "";
  52829. this.script = null;
  52830. }
  52831. [_xfa_object.$toHTML](availableSpace) {
  52832. this[_xfa_object.$extra] = {};
  52833. return _utils.HTMLResult.FAILURE;
  52834. }
  52835. }
  52836. class Button extends _xfa_object.XFAObject {
  52837. constructor(attributes) {
  52838. super(TEMPLATE_NS_ID, "button", true);
  52839. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  52840. this.id = attributes.id || "";
  52841. this.use = attributes.use || "";
  52842. this.usehref = attributes.usehref || "";
  52843. this.extras = null;
  52844. }
  52845. [_xfa_object.$toHTML](availableSpace) {
  52846. const parent = this[_xfa_object.$getParent]();
  52847. const grandpa = parent[_xfa_object.$getParent]();
  52848. const htmlButton = {
  52849. name: "button",
  52850. attributes: {
  52851. id: this[_xfa_object.$uid],
  52852. class: ["xfaButton"],
  52853. style: {}
  52854. },
  52855. children: []
  52856. };
  52857. for (const event of grandpa.event.children) {
  52858. if (event.activity !== "click" || !event.script) {
  52859. continue;
  52860. }
  52861. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  52862. if (!jsURL) {
  52863. continue;
  52864. }
  52865. const href = (0, _html_utils.fixURL)(jsURL.url);
  52866. if (!href) {
  52867. continue;
  52868. }
  52869. htmlButton.children.push({
  52870. name: "a",
  52871. attributes: {
  52872. id: "link" + this[_xfa_object.$uid],
  52873. href,
  52874. newWindow: jsURL.newWindow,
  52875. class: ["xfaLink"],
  52876. style: {}
  52877. },
  52878. children: []
  52879. });
  52880. }
  52881. return _utils.HTMLResult.success(htmlButton);
  52882. }
  52883. }
  52884. class Calculate extends _xfa_object.XFAObject {
  52885. constructor(attributes) {
  52886. super(TEMPLATE_NS_ID, "calculate", true);
  52887. this.id = attributes.id || "";
  52888. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  52889. this.use = attributes.use || "";
  52890. this.usehref = attributes.usehref || "";
  52891. this.extras = null;
  52892. this.message = null;
  52893. this.script = null;
  52894. }
  52895. }
  52896. class Caption extends _xfa_object.XFAObject {
  52897. constructor(attributes) {
  52898. super(TEMPLATE_NS_ID, "caption", true);
  52899. this.id = attributes.id || "";
  52900. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  52901. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52902. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  52903. this.use = attributes.use || "";
  52904. this.usehref = attributes.usehref || "";
  52905. this.extras = null;
  52906. this.font = null;
  52907. this.margin = null;
  52908. this.para = null;
  52909. this.value = null;
  52910. }
  52911. [_xfa_object.$setValue](value) {
  52912. _setValue(this, value);
  52913. }
  52914. [_xfa_object.$getExtra](availableSpace) {
  52915. if (!this[_xfa_object.$extra]) {
  52916. let {
  52917. width,
  52918. height
  52919. } = availableSpace;
  52920. switch (this.placement) {
  52921. case "left":
  52922. case "right":
  52923. case "inline":
  52924. width = this.reserve <= 0 ? width : this.reserve;
  52925. break;
  52926. case "top":
  52927. case "bottom":
  52928. height = this.reserve <= 0 ? height : this.reserve;
  52929. break;
  52930. }
  52931. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  52932. width,
  52933. height
  52934. });
  52935. }
  52936. return this[_xfa_object.$extra];
  52937. }
  52938. [_xfa_object.$toHTML](availableSpace) {
  52939. if (!this.value) {
  52940. return _utils.HTMLResult.EMPTY;
  52941. }
  52942. this[_xfa_object.$pushPara]();
  52943. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  52944. if (!value) {
  52945. this[_xfa_object.$popPara]();
  52946. return _utils.HTMLResult.EMPTY;
  52947. }
  52948. const savedReserve = this.reserve;
  52949. if (this.reserve <= 0) {
  52950. const {
  52951. w,
  52952. h
  52953. } = this[_xfa_object.$getExtra](availableSpace);
  52954. switch (this.placement) {
  52955. case "left":
  52956. case "right":
  52957. case "inline":
  52958. this.reserve = w;
  52959. break;
  52960. case "top":
  52961. case "bottom":
  52962. this.reserve = h;
  52963. break;
  52964. }
  52965. }
  52966. const children = [];
  52967. if (typeof value === "string") {
  52968. children.push({
  52969. name: "#text",
  52970. value
  52971. });
  52972. } else {
  52973. children.push(value);
  52974. }
  52975. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  52976. switch (this.placement) {
  52977. case "left":
  52978. case "right":
  52979. if (this.reserve > 0) {
  52980. style.width = (0, _html_utils.measureToString)(this.reserve);
  52981. }
  52982. break;
  52983. case "top":
  52984. case "bottom":
  52985. if (this.reserve > 0) {
  52986. style.height = (0, _html_utils.measureToString)(this.reserve);
  52987. }
  52988. break;
  52989. }
  52990. (0, _html_utils.setPara)(this, null, value);
  52991. this[_xfa_object.$popPara]();
  52992. this.reserve = savedReserve;
  52993. return _utils.HTMLResult.success({
  52994. name: "div",
  52995. attributes: {
  52996. style,
  52997. class: ["xfaCaption"]
  52998. },
  52999. children
  53000. });
  53001. }
  53002. }
  53003. class Certificate extends _xfa_object.StringObject {
  53004. constructor(attributes) {
  53005. super(TEMPLATE_NS_ID, "certificate");
  53006. this.id = attributes.id || "";
  53007. this.name = attributes.name || "";
  53008. this.use = attributes.use || "";
  53009. this.usehref = attributes.usehref || "";
  53010. }
  53011. }
  53012. class Certificates extends _xfa_object.XFAObject {
  53013. constructor(attributes) {
  53014. super(TEMPLATE_NS_ID, "certificates", true);
  53015. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  53016. this.id = attributes.id || "";
  53017. this.url = attributes.url || "";
  53018. this.urlPolicy = attributes.urlPolicy || "";
  53019. this.use = attributes.use || "";
  53020. this.usehref = attributes.usehref || "";
  53021. this.encryption = null;
  53022. this.issuers = null;
  53023. this.keyUsage = null;
  53024. this.oids = null;
  53025. this.signing = null;
  53026. this.subjectDNs = null;
  53027. }
  53028. }
  53029. class CheckButton extends _xfa_object.XFAObject {
  53030. constructor(attributes) {
  53031. super(TEMPLATE_NS_ID, "checkButton", true);
  53032. this.id = attributes.id || "";
  53033. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  53034. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  53035. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  53036. this.use = attributes.use || "";
  53037. this.usehref = attributes.usehref || "";
  53038. this.border = null;
  53039. this.extras = null;
  53040. this.margin = null;
  53041. }
  53042. [_xfa_object.$toHTML](availableSpace) {
  53043. const style = (0, _html_utils.toStyle)("margin");
  53044. const size = (0, _html_utils.measureToString)(this.size);
  53045. style.width = style.height = size;
  53046. let type;
  53047. let className;
  53048. let groupId;
  53049. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53050. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  53051. const exportedValue = {
  53052. on: (items[0] !== undefined ? items[0] : "on").toString(),
  53053. off: (items[1] !== undefined ? items[1] : "off").toString()
  53054. };
  53055. const value = field.value && field.value[_xfa_object.$text]() || "off";
  53056. const checked = value === exportedValue.on || undefined;
  53057. const container = field[_xfa_object.$getSubformParent]();
  53058. const fieldId = field[_xfa_object.$uid];
  53059. let dataId;
  53060. if (container instanceof ExclGroup) {
  53061. groupId = container[_xfa_object.$uid];
  53062. type = "radio";
  53063. className = "xfaRadio";
  53064. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  53065. } else {
  53066. type = "checkbox";
  53067. className = "xfaCheckbox";
  53068. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  53069. }
  53070. const input = {
  53071. name: "input",
  53072. attributes: {
  53073. class: [className],
  53074. style,
  53075. fieldId,
  53076. dataId,
  53077. type,
  53078. checked,
  53079. xfaOn: exportedValue.on,
  53080. xfaOff: exportedValue.off,
  53081. "aria-label": ariaLabel(field)
  53082. }
  53083. };
  53084. if (groupId) {
  53085. input.attributes.name = groupId;
  53086. }
  53087. return _utils.HTMLResult.success({
  53088. name: "label",
  53089. attributes: {
  53090. class: ["xfaLabel"]
  53091. },
  53092. children: [input]
  53093. });
  53094. }
  53095. }
  53096. class ChoiceList extends _xfa_object.XFAObject {
  53097. constructor(attributes) {
  53098. super(TEMPLATE_NS_ID, "choiceList", true);
  53099. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  53100. this.id = attributes.id || "";
  53101. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  53102. this.textEntry = (0, _utils.getInteger)({
  53103. data: attributes.textEntry,
  53104. defaultValue: 0,
  53105. validate: x => x === 1
  53106. });
  53107. this.use = attributes.use || "";
  53108. this.usehref = attributes.usehref || "";
  53109. this.border = null;
  53110. this.extras = null;
  53111. this.margin = null;
  53112. }
  53113. [_xfa_object.$toHTML](availableSpace) {
  53114. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  53115. const ui = this[_xfa_object.$getParent]();
  53116. const field = ui[_xfa_object.$getParent]();
  53117. const fontSize = field.font && field.font.size || 10;
  53118. const optionStyle = {
  53119. fontSize: `calc(${fontSize}px * var(--zoom-factor))`
  53120. };
  53121. const children = [];
  53122. if (field.items.children.length > 0) {
  53123. const items = field.items;
  53124. let displayedIndex = 0;
  53125. let saveIndex = 0;
  53126. if (items.children.length === 2) {
  53127. displayedIndex = items.children[0].save;
  53128. saveIndex = 1 - displayedIndex;
  53129. }
  53130. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  53131. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  53132. let selected = false;
  53133. const value = field.value && field.value[_xfa_object.$text]() || "";
  53134. for (let i = 0, ii = displayed.length; i < ii; i++) {
  53135. const option = {
  53136. name: "option",
  53137. attributes: {
  53138. value: values[i] || displayed[i],
  53139. style: optionStyle
  53140. },
  53141. value: displayed[i]
  53142. };
  53143. if (values[i] === value) {
  53144. option.attributes.selected = selected = true;
  53145. }
  53146. children.push(option);
  53147. }
  53148. if (!selected) {
  53149. children.splice(0, 0, {
  53150. name: "option",
  53151. attributes: {
  53152. hidden: true,
  53153. selected: true
  53154. },
  53155. value: " "
  53156. });
  53157. }
  53158. }
  53159. const selectAttributes = {
  53160. class: ["xfaSelect"],
  53161. fieldId: field[_xfa_object.$uid],
  53162. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53163. style,
  53164. "aria-label": ariaLabel(field)
  53165. };
  53166. if (this.open === "multiSelect") {
  53167. selectAttributes.multiple = true;
  53168. }
  53169. return _utils.HTMLResult.success({
  53170. name: "label",
  53171. attributes: {
  53172. class: ["xfaLabel"]
  53173. },
  53174. children: [{
  53175. name: "select",
  53176. children,
  53177. attributes: selectAttributes
  53178. }]
  53179. });
  53180. }
  53181. }
  53182. class Color extends _xfa_object.XFAObject {
  53183. constructor(attributes) {
  53184. super(TEMPLATE_NS_ID, "color", true);
  53185. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  53186. this.id = attributes.id || "";
  53187. this.use = attributes.use || "";
  53188. this.usehref = attributes.usehref || "";
  53189. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  53190. this.extras = null;
  53191. }
  53192. [_xfa_object.$hasSettableValue]() {
  53193. return false;
  53194. }
  53195. [_xfa_object.$toStyle]() {
  53196. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  53197. }
  53198. }
  53199. class Comb extends _xfa_object.XFAObject {
  53200. constructor(attributes) {
  53201. super(TEMPLATE_NS_ID, "comb");
  53202. this.id = attributes.id || "";
  53203. this.numberOfCells = (0, _utils.getInteger)({
  53204. data: attributes.numberOfCells,
  53205. defaultValue: 0,
  53206. validate: x => x >= 0
  53207. });
  53208. this.use = attributes.use || "";
  53209. this.usehref = attributes.usehref || "";
  53210. }
  53211. }
  53212. class Connect extends _xfa_object.XFAObject {
  53213. constructor(attributes) {
  53214. super(TEMPLATE_NS_ID, "connect", true);
  53215. this.connection = attributes.connection || "";
  53216. this.id = attributes.id || "";
  53217. this.ref = attributes.ref || "";
  53218. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  53219. this.use = attributes.use || "";
  53220. this.usehref = attributes.usehref || "";
  53221. this.picture = null;
  53222. }
  53223. }
  53224. class ContentArea extends _xfa_object.XFAObject {
  53225. constructor(attributes) {
  53226. super(TEMPLATE_NS_ID, "contentArea", true);
  53227. this.h = (0, _utils.getMeasurement)(attributes.h);
  53228. this.id = attributes.id || "";
  53229. this.name = attributes.name || "";
  53230. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53231. this.use = attributes.use || "";
  53232. this.usehref = attributes.usehref || "";
  53233. this.w = (0, _utils.getMeasurement)(attributes.w);
  53234. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53235. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53236. this.desc = null;
  53237. this.extras = null;
  53238. }
  53239. [_xfa_object.$toHTML](availableSpace) {
  53240. const left = (0, _html_utils.measureToString)(this.x);
  53241. const top = (0, _html_utils.measureToString)(this.y);
  53242. const style = {
  53243. left,
  53244. top,
  53245. width: (0, _html_utils.measureToString)(this.w),
  53246. height: (0, _html_utils.measureToString)(this.h)
  53247. };
  53248. const classNames = ["xfaContentarea"];
  53249. if ((0, _html_utils.isPrintOnly)(this)) {
  53250. classNames.push("xfaPrintOnly");
  53251. }
  53252. return _utils.HTMLResult.success({
  53253. name: "div",
  53254. children: [],
  53255. attributes: {
  53256. style,
  53257. class: classNames,
  53258. id: this[_xfa_object.$uid]
  53259. }
  53260. });
  53261. }
  53262. }
  53263. class Corner extends _xfa_object.XFAObject {
  53264. constructor(attributes) {
  53265. super(TEMPLATE_NS_ID, "corner", true);
  53266. this.id = attributes.id || "";
  53267. this.inverted = (0, _utils.getInteger)({
  53268. data: attributes.inverted,
  53269. defaultValue: 0,
  53270. validate: x => x === 1
  53271. });
  53272. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  53273. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53274. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  53275. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53276. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53277. this.use = attributes.use || "";
  53278. this.usehref = attributes.usehref || "";
  53279. this.color = null;
  53280. this.extras = null;
  53281. }
  53282. [_xfa_object.$toStyle]() {
  53283. const style = (0, _html_utils.toStyle)(this, "visibility");
  53284. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  53285. return style;
  53286. }
  53287. }
  53288. class DateElement extends _xfa_object.ContentObject {
  53289. constructor(attributes) {
  53290. super(TEMPLATE_NS_ID, "date");
  53291. this.id = attributes.id || "";
  53292. this.name = attributes.name || "";
  53293. this.use = attributes.use || "";
  53294. this.usehref = attributes.usehref || "";
  53295. }
  53296. [_xfa_object.$finalize]() {
  53297. const date = this[_xfa_object.$content].trim();
  53298. this[_xfa_object.$content] = date ? new Date(date) : null;
  53299. }
  53300. [_xfa_object.$toHTML](availableSpace) {
  53301. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53302. }
  53303. }
  53304. class DateTime extends _xfa_object.ContentObject {
  53305. constructor(attributes) {
  53306. super(TEMPLATE_NS_ID, "dateTime");
  53307. this.id = attributes.id || "";
  53308. this.name = attributes.name || "";
  53309. this.use = attributes.use || "";
  53310. this.usehref = attributes.usehref || "";
  53311. }
  53312. [_xfa_object.$finalize]() {
  53313. const date = this[_xfa_object.$content].trim();
  53314. this[_xfa_object.$content] = date ? new Date(date) : null;
  53315. }
  53316. [_xfa_object.$toHTML](availableSpace) {
  53317. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53318. }
  53319. }
  53320. class DateTimeEdit extends _xfa_object.XFAObject {
  53321. constructor(attributes) {
  53322. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  53323. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  53324. this.id = attributes.id || "";
  53325. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  53326. this.use = attributes.use || "";
  53327. this.usehref = attributes.usehref || "";
  53328. this.border = null;
  53329. this.comb = null;
  53330. this.extras = null;
  53331. this.margin = null;
  53332. }
  53333. [_xfa_object.$toHTML](availableSpace) {
  53334. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  53335. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53336. const html = {
  53337. name: "input",
  53338. attributes: {
  53339. type: "text",
  53340. fieldId: field[_xfa_object.$uid],
  53341. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53342. class: ["xfaTextfield"],
  53343. style,
  53344. "aria-label": ariaLabel(field)
  53345. }
  53346. };
  53347. return _utils.HTMLResult.success({
  53348. name: "label",
  53349. attributes: {
  53350. class: ["xfaLabel"]
  53351. },
  53352. children: [html]
  53353. });
  53354. }
  53355. }
  53356. class Decimal extends _xfa_object.ContentObject {
  53357. constructor(attributes) {
  53358. super(TEMPLATE_NS_ID, "decimal");
  53359. this.fracDigits = (0, _utils.getInteger)({
  53360. data: attributes.fracDigits,
  53361. defaultValue: 2,
  53362. validate: x => true
  53363. });
  53364. this.id = attributes.id || "";
  53365. this.leadDigits = (0, _utils.getInteger)({
  53366. data: attributes.leadDigits,
  53367. defaultValue: -1,
  53368. validate: x => true
  53369. });
  53370. this.name = attributes.name || "";
  53371. this.use = attributes.use || "";
  53372. this.usehref = attributes.usehref || "";
  53373. }
  53374. [_xfa_object.$finalize]() {
  53375. const number = parseFloat(this[_xfa_object.$content].trim());
  53376. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53377. }
  53378. [_xfa_object.$toHTML](availableSpace) {
  53379. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53380. }
  53381. }
  53382. class DefaultUi extends _xfa_object.XFAObject {
  53383. constructor(attributes) {
  53384. super(TEMPLATE_NS_ID, "defaultUi", true);
  53385. this.id = attributes.id || "";
  53386. this.use = attributes.use || "";
  53387. this.usehref = attributes.usehref || "";
  53388. this.extras = null;
  53389. }
  53390. }
  53391. class Desc extends _xfa_object.XFAObject {
  53392. constructor(attributes) {
  53393. super(TEMPLATE_NS_ID, "desc", true);
  53394. this.id = attributes.id || "";
  53395. this.use = attributes.use || "";
  53396. this.usehref = attributes.usehref || "";
  53397. this.boolean = new _xfa_object.XFAObjectArray();
  53398. this.date = new _xfa_object.XFAObjectArray();
  53399. this.dateTime = new _xfa_object.XFAObjectArray();
  53400. this.decimal = new _xfa_object.XFAObjectArray();
  53401. this.exData = new _xfa_object.XFAObjectArray();
  53402. this.float = new _xfa_object.XFAObjectArray();
  53403. this.image = new _xfa_object.XFAObjectArray();
  53404. this.integer = new _xfa_object.XFAObjectArray();
  53405. this.text = new _xfa_object.XFAObjectArray();
  53406. this.time = new _xfa_object.XFAObjectArray();
  53407. }
  53408. }
  53409. class DigestMethod extends _xfa_object.OptionObject {
  53410. constructor(attributes) {
  53411. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  53412. this.id = attributes.id || "";
  53413. this.use = attributes.use || "";
  53414. this.usehref = attributes.usehref || "";
  53415. }
  53416. }
  53417. class DigestMethods extends _xfa_object.XFAObject {
  53418. constructor(attributes) {
  53419. super(TEMPLATE_NS_ID, "digestMethods", true);
  53420. this.id = attributes.id || "";
  53421. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53422. this.use = attributes.use || "";
  53423. this.usehref = attributes.usehref || "";
  53424. this.digestMethod = new _xfa_object.XFAObjectArray();
  53425. }
  53426. }
  53427. class Draw extends _xfa_object.XFAObject {
  53428. constructor(attributes) {
  53429. super(TEMPLATE_NS_ID, "draw", true);
  53430. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53431. this.colSpan = (0, _utils.getInteger)({
  53432. data: attributes.colSpan,
  53433. defaultValue: 1,
  53434. validate: n => n >= 1 || n === -1
  53435. });
  53436. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53437. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53438. this.id = attributes.id || "";
  53439. this.locale = attributes.locale || "";
  53440. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53441. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53442. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53443. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53444. this.name = attributes.name || "";
  53445. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53446. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53447. this.rotate = (0, _utils.getInteger)({
  53448. data: attributes.rotate,
  53449. defaultValue: 0,
  53450. validate: x => x % 90 === 0
  53451. });
  53452. this.use = attributes.use || "";
  53453. this.usehref = attributes.usehref || "";
  53454. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53455. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53456. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53457. this.assist = null;
  53458. this.border = null;
  53459. this.caption = null;
  53460. this.desc = null;
  53461. this.extras = null;
  53462. this.font = null;
  53463. this.keep = null;
  53464. this.margin = null;
  53465. this.para = null;
  53466. this.traversal = null;
  53467. this.ui = null;
  53468. this.value = null;
  53469. this.setProperty = new _xfa_object.XFAObjectArray();
  53470. }
  53471. [_xfa_object.$setValue](value) {
  53472. _setValue(this, value);
  53473. }
  53474. [_xfa_object.$toHTML](availableSpace) {
  53475. setTabIndex(this);
  53476. if (this.presence === "hidden" || this.presence === "inactive") {
  53477. return _utils.HTMLResult.EMPTY;
  53478. }
  53479. (0, _html_utils.fixDimensions)(this);
  53480. this[_xfa_object.$pushPara]();
  53481. const savedW = this.w;
  53482. const savedH = this.h;
  53483. const {
  53484. w,
  53485. h,
  53486. isBroken
  53487. } = (0, _html_utils.layoutNode)(this, availableSpace);
  53488. if (w && this.w === "") {
  53489. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  53490. this[_xfa_object.$popPara]();
  53491. return _utils.HTMLResult.FAILURE;
  53492. }
  53493. this.w = w;
  53494. }
  53495. if (h && this.h === "") {
  53496. this.h = h;
  53497. }
  53498. setFirstUnsplittable(this);
  53499. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53500. this.w = savedW;
  53501. this.h = savedH;
  53502. this[_xfa_object.$popPara]();
  53503. return _utils.HTMLResult.FAILURE;
  53504. }
  53505. unsetFirstUnsplittable(this);
  53506. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  53507. (0, _html_utils.setMinMaxDimensions)(this, style);
  53508. if (style.margin) {
  53509. style.padding = style.margin;
  53510. delete style.margin;
  53511. }
  53512. const classNames = ["xfaDraw"];
  53513. if (this.font) {
  53514. classNames.push("xfaFont");
  53515. }
  53516. if ((0, _html_utils.isPrintOnly)(this)) {
  53517. classNames.push("xfaPrintOnly");
  53518. }
  53519. const attributes = {
  53520. style,
  53521. id: this[_xfa_object.$uid],
  53522. class: classNames
  53523. };
  53524. if (this.name) {
  53525. attributes.xfaName = this.name;
  53526. }
  53527. const html = {
  53528. name: "div",
  53529. attributes,
  53530. children: []
  53531. };
  53532. applyAssist(this, attributes);
  53533. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  53534. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  53535. if (value === null) {
  53536. this.w = savedW;
  53537. this.h = savedH;
  53538. this[_xfa_object.$popPara]();
  53539. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53540. }
  53541. html.children.push(value);
  53542. (0, _html_utils.setPara)(this, style, value);
  53543. this.w = savedW;
  53544. this.h = savedH;
  53545. this[_xfa_object.$popPara]();
  53546. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53547. }
  53548. }
  53549. class Edge extends _xfa_object.XFAObject {
  53550. constructor(attributes) {
  53551. super(TEMPLATE_NS_ID, "edge", true);
  53552. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  53553. this.id = attributes.id || "";
  53554. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53555. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53556. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53557. this.use = attributes.use || "";
  53558. this.usehref = attributes.usehref || "";
  53559. this.color = null;
  53560. this.extras = null;
  53561. }
  53562. [_xfa_object.$toStyle]() {
  53563. const style = (0, _html_utils.toStyle)(this, "visibility");
  53564. Object.assign(style, {
  53565. linecap: this.cap,
  53566. width: (0, _html_utils.measureToString)(this.thickness),
  53567. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  53568. style: ""
  53569. });
  53570. if (this.presence !== "visible") {
  53571. style.style = "none";
  53572. } else {
  53573. switch (this.stroke) {
  53574. case "solid":
  53575. style.style = "solid";
  53576. break;
  53577. case "dashDot":
  53578. style.style = "dashed";
  53579. break;
  53580. case "dashDotDot":
  53581. style.style = "dashed";
  53582. break;
  53583. case "dashed":
  53584. style.style = "dashed";
  53585. break;
  53586. case "dotted":
  53587. style.style = "dotted";
  53588. break;
  53589. case "embossed":
  53590. style.style = "ridge";
  53591. break;
  53592. case "etched":
  53593. style.style = "groove";
  53594. break;
  53595. case "lowered":
  53596. style.style = "inset";
  53597. break;
  53598. case "raised":
  53599. style.style = "outset";
  53600. break;
  53601. }
  53602. }
  53603. return style;
  53604. }
  53605. }
  53606. class Encoding extends _xfa_object.OptionObject {
  53607. constructor(attributes) {
  53608. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  53609. this.id = attributes.id || "";
  53610. this.use = attributes.use || "";
  53611. this.usehref = attributes.usehref || "";
  53612. }
  53613. }
  53614. class Encodings extends _xfa_object.XFAObject {
  53615. constructor(attributes) {
  53616. super(TEMPLATE_NS_ID, "encodings", true);
  53617. this.id = attributes.id || "";
  53618. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53619. this.use = attributes.use || "";
  53620. this.usehref = attributes.usehref || "";
  53621. this.encoding = new _xfa_object.XFAObjectArray();
  53622. }
  53623. }
  53624. class Encrypt extends _xfa_object.XFAObject {
  53625. constructor(attributes) {
  53626. super(TEMPLATE_NS_ID, "encrypt", true);
  53627. this.id = attributes.id || "";
  53628. this.use = attributes.use || "";
  53629. this.usehref = attributes.usehref || "";
  53630. this.certificate = null;
  53631. }
  53632. }
  53633. class EncryptData extends _xfa_object.XFAObject {
  53634. constructor(attributes) {
  53635. super(TEMPLATE_NS_ID, "encryptData", true);
  53636. this.id = attributes.id || "";
  53637. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  53638. this.target = attributes.target || "";
  53639. this.use = attributes.use || "";
  53640. this.usehref = attributes.usehref || "";
  53641. this.filter = null;
  53642. this.manifest = null;
  53643. }
  53644. }
  53645. class Encryption extends _xfa_object.XFAObject {
  53646. constructor(attributes) {
  53647. super(TEMPLATE_NS_ID, "encryption", true);
  53648. this.id = attributes.id || "";
  53649. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53650. this.use = attributes.use || "";
  53651. this.usehref = attributes.usehref || "";
  53652. this.certificate = new _xfa_object.XFAObjectArray();
  53653. }
  53654. }
  53655. class EncryptionMethod extends _xfa_object.OptionObject {
  53656. constructor(attributes) {
  53657. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  53658. this.id = attributes.id || "";
  53659. this.use = attributes.use || "";
  53660. this.usehref = attributes.usehref || "";
  53661. }
  53662. }
  53663. class EncryptionMethods extends _xfa_object.XFAObject {
  53664. constructor(attributes) {
  53665. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  53666. this.id = attributes.id || "";
  53667. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53668. this.use = attributes.use || "";
  53669. this.usehref = attributes.usehref || "";
  53670. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  53671. }
  53672. }
  53673. class Event extends _xfa_object.XFAObject {
  53674. constructor(attributes) {
  53675. super(TEMPLATE_NS_ID, "event", true);
  53676. 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"]);
  53677. this.id = attributes.id || "";
  53678. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  53679. this.name = attributes.name || "";
  53680. this.ref = attributes.ref || "";
  53681. this.use = attributes.use || "";
  53682. this.usehref = attributes.usehref || "";
  53683. this.extras = null;
  53684. this.encryptData = null;
  53685. this.execute = null;
  53686. this.script = null;
  53687. this.signData = null;
  53688. this.submit = null;
  53689. }
  53690. }
  53691. class ExData extends _xfa_object.ContentObject {
  53692. constructor(attributes) {
  53693. super(TEMPLATE_NS_ID, "exData");
  53694. this.contentType = attributes.contentType || "";
  53695. this.href = attributes.href || "";
  53696. this.id = attributes.id || "";
  53697. this.maxLength = (0, _utils.getInteger)({
  53698. data: attributes.maxLength,
  53699. defaultValue: -1,
  53700. validate: x => x >= -1
  53701. });
  53702. this.name = attributes.name || "";
  53703. this.rid = attributes.rid || "";
  53704. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  53705. this.use = attributes.use || "";
  53706. this.usehref = attributes.usehref || "";
  53707. }
  53708. [_xfa_object.$isCDATAXml]() {
  53709. return this.contentType === "text/html";
  53710. }
  53711. [_xfa_object.$onChild](child) {
  53712. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  53713. this[_xfa_object.$content] = child;
  53714. return true;
  53715. }
  53716. if (this.contentType === "text/xml") {
  53717. this[_xfa_object.$content] = child;
  53718. return true;
  53719. }
  53720. return false;
  53721. }
  53722. [_xfa_object.$toHTML](availableSpace) {
  53723. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  53724. return _utils.HTMLResult.EMPTY;
  53725. }
  53726. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  53727. }
  53728. }
  53729. class ExObject extends _xfa_object.XFAObject {
  53730. constructor(attributes) {
  53731. super(TEMPLATE_NS_ID, "exObject", true);
  53732. this.archive = attributes.archive || "";
  53733. this.classId = attributes.classId || "";
  53734. this.codeBase = attributes.codeBase || "";
  53735. this.codeType = attributes.codeType || "";
  53736. this.id = attributes.id || "";
  53737. this.name = attributes.name || "";
  53738. this.use = attributes.use || "";
  53739. this.usehref = attributes.usehref || "";
  53740. this.extras = null;
  53741. this.boolean = new _xfa_object.XFAObjectArray();
  53742. this.date = new _xfa_object.XFAObjectArray();
  53743. this.dateTime = new _xfa_object.XFAObjectArray();
  53744. this.decimal = new _xfa_object.XFAObjectArray();
  53745. this.exData = new _xfa_object.XFAObjectArray();
  53746. this.exObject = new _xfa_object.XFAObjectArray();
  53747. this.float = new _xfa_object.XFAObjectArray();
  53748. this.image = new _xfa_object.XFAObjectArray();
  53749. this.integer = new _xfa_object.XFAObjectArray();
  53750. this.text = new _xfa_object.XFAObjectArray();
  53751. this.time = new _xfa_object.XFAObjectArray();
  53752. }
  53753. }
  53754. class ExclGroup extends _xfa_object.XFAObject {
  53755. constructor(attributes) {
  53756. super(TEMPLATE_NS_ID, "exclGroup", true);
  53757. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  53758. this.accessKey = attributes.accessKey || "";
  53759. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53760. this.colSpan = (0, _utils.getInteger)({
  53761. data: attributes.colSpan,
  53762. defaultValue: 1,
  53763. validate: n => n >= 1 || n === -1
  53764. });
  53765. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53766. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53767. this.id = attributes.id || "";
  53768. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  53769. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53770. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53771. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53772. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53773. this.name = attributes.name || "";
  53774. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53775. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53776. this.use = attributes.use || "";
  53777. this.usehref = attributes.usehref || "";
  53778. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53779. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53780. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53781. this.assist = null;
  53782. this.bind = null;
  53783. this.border = null;
  53784. this.calculate = null;
  53785. this.caption = null;
  53786. this.desc = null;
  53787. this.extras = null;
  53788. this.margin = null;
  53789. this.para = null;
  53790. this.traversal = null;
  53791. this.validate = null;
  53792. this.connect = new _xfa_object.XFAObjectArray();
  53793. this.event = new _xfa_object.XFAObjectArray();
  53794. this.field = new _xfa_object.XFAObjectArray();
  53795. this.setProperty = new _xfa_object.XFAObjectArray();
  53796. }
  53797. [_xfa_object.$isBindable]() {
  53798. return true;
  53799. }
  53800. [_xfa_object.$hasSettableValue]() {
  53801. return true;
  53802. }
  53803. [_xfa_object.$setValue](value) {
  53804. for (const field of this.field.children) {
  53805. if (!field.value) {
  53806. const nodeValue = new Value({});
  53807. field[_xfa_object.$appendChild](nodeValue);
  53808. field.value = nodeValue;
  53809. }
  53810. field.value[_xfa_object.$setValue](value);
  53811. }
  53812. }
  53813. [_xfa_object.$isThereMoreWidth]() {
  53814. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  53815. }
  53816. [_xfa_object.$isSplittable]() {
  53817. const parent = this[_xfa_object.$getSubformParent]();
  53818. if (!parent[_xfa_object.$isSplittable]()) {
  53819. return false;
  53820. }
  53821. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  53822. return this[_xfa_object.$extra]._isSplittable;
  53823. }
  53824. if (this.layout === "position" || this.layout.includes("row")) {
  53825. this[_xfa_object.$extra]._isSplittable = false;
  53826. return false;
  53827. }
  53828. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  53829. return false;
  53830. }
  53831. this[_xfa_object.$extra]._isSplittable = true;
  53832. return true;
  53833. }
  53834. [_xfa_object.$flushHTML]() {
  53835. return (0, _layout.flushHTML)(this);
  53836. }
  53837. [_xfa_object.$addHTML](html, bbox) {
  53838. (0, _layout.addHTML)(this, html, bbox);
  53839. }
  53840. [_xfa_object.$getAvailableSpace]() {
  53841. return (0, _layout.getAvailableSpace)(this);
  53842. }
  53843. [_xfa_object.$toHTML](availableSpace) {
  53844. setTabIndex(this);
  53845. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  53846. return _utils.HTMLResult.EMPTY;
  53847. }
  53848. (0, _html_utils.fixDimensions)(this);
  53849. const children = [];
  53850. const attributes = {
  53851. id: this[_xfa_object.$uid],
  53852. class: []
  53853. };
  53854. (0, _html_utils.setAccess)(this, attributes.class);
  53855. if (!this[_xfa_object.$extra]) {
  53856. this[_xfa_object.$extra] = Object.create(null);
  53857. }
  53858. Object.assign(this[_xfa_object.$extra], {
  53859. children,
  53860. attributes,
  53861. attempt: 0,
  53862. line: null,
  53863. numberInLine: 0,
  53864. availableSpace: {
  53865. width: Math.min(this.w || Infinity, availableSpace.width),
  53866. height: Math.min(this.h || Infinity, availableSpace.height)
  53867. },
  53868. width: 0,
  53869. height: 0,
  53870. prevHeight: 0,
  53871. currentWidth: 0
  53872. });
  53873. const isSplittable = this[_xfa_object.$isSplittable]();
  53874. if (!isSplittable) {
  53875. setFirstUnsplittable(this);
  53876. }
  53877. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53878. return _utils.HTMLResult.FAILURE;
  53879. }
  53880. const filter = new Set(["field"]);
  53881. if (this.layout.includes("row")) {
  53882. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  53883. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  53884. this[_xfa_object.$extra].columnWidths = columnWidths;
  53885. this[_xfa_object.$extra].currentColumn = 0;
  53886. }
  53887. }
  53888. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  53889. const classNames = ["xfaExclgroup"];
  53890. const cl = (0, _html_utils.layoutClass)(this);
  53891. if (cl) {
  53892. classNames.push(cl);
  53893. }
  53894. if ((0, _html_utils.isPrintOnly)(this)) {
  53895. classNames.push("xfaPrintOnly");
  53896. }
  53897. attributes.style = style;
  53898. attributes.class = classNames;
  53899. if (this.name) {
  53900. attributes.xfaName = this.name;
  53901. }
  53902. this[_xfa_object.$pushPara]();
  53903. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  53904. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  53905. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  53906. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  53907. this[_xfa_object.$extra].numberInLine = 0;
  53908. }
  53909. const result = this[_xfa_object.$childrenToHTML]({
  53910. filter,
  53911. include: true
  53912. });
  53913. if (result.success) {
  53914. break;
  53915. }
  53916. if (result.isBreak()) {
  53917. this[_xfa_object.$popPara]();
  53918. return result;
  53919. }
  53920. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  53921. this[_xfa_object.$extra].attempt = maxRun;
  53922. break;
  53923. }
  53924. }
  53925. this[_xfa_object.$popPara]();
  53926. if (!isSplittable) {
  53927. unsetFirstUnsplittable(this);
  53928. }
  53929. if (this[_xfa_object.$extra].attempt === maxRun) {
  53930. if (!isSplittable) {
  53931. delete this[_xfa_object.$extra];
  53932. }
  53933. return _utils.HTMLResult.FAILURE;
  53934. }
  53935. let marginH = 0;
  53936. let marginV = 0;
  53937. if (this.margin) {
  53938. marginH = this.margin.leftInset + this.margin.rightInset;
  53939. marginV = this.margin.topInset + this.margin.bottomInset;
  53940. }
  53941. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  53942. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  53943. const bbox = [this.x, this.y, width, height];
  53944. if (this.w === "") {
  53945. style.width = (0, _html_utils.measureToString)(width);
  53946. }
  53947. if (this.h === "") {
  53948. style.height = (0, _html_utils.measureToString)(height);
  53949. }
  53950. const html = {
  53951. name: "div",
  53952. attributes,
  53953. children
  53954. };
  53955. applyAssist(this, attributes);
  53956. delete this[_xfa_object.$extra];
  53957. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53958. }
  53959. }
  53960. class Execute extends _xfa_object.XFAObject {
  53961. constructor(attributes) {
  53962. super(TEMPLATE_NS_ID, "execute");
  53963. this.connection = attributes.connection || "";
  53964. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  53965. this.id = attributes.id || "";
  53966. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  53967. this.use = attributes.use || "";
  53968. this.usehref = attributes.usehref || "";
  53969. }
  53970. }
  53971. class Extras extends _xfa_object.XFAObject {
  53972. constructor(attributes) {
  53973. super(TEMPLATE_NS_ID, "extras", true);
  53974. this.id = attributes.id || "";
  53975. this.name = attributes.name || "";
  53976. this.use = attributes.use || "";
  53977. this.usehref = attributes.usehref || "";
  53978. this.boolean = new _xfa_object.XFAObjectArray();
  53979. this.date = new _xfa_object.XFAObjectArray();
  53980. this.dateTime = new _xfa_object.XFAObjectArray();
  53981. this.decimal = new _xfa_object.XFAObjectArray();
  53982. this.exData = new _xfa_object.XFAObjectArray();
  53983. this.extras = new _xfa_object.XFAObjectArray();
  53984. this.float = new _xfa_object.XFAObjectArray();
  53985. this.image = new _xfa_object.XFAObjectArray();
  53986. this.integer = new _xfa_object.XFAObjectArray();
  53987. this.text = new _xfa_object.XFAObjectArray();
  53988. this.time = new _xfa_object.XFAObjectArray();
  53989. }
  53990. }
  53991. class Field extends _xfa_object.XFAObject {
  53992. constructor(attributes) {
  53993. super(TEMPLATE_NS_ID, "field", true);
  53994. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  53995. this.accessKey = attributes.accessKey || "";
  53996. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53997. this.colSpan = (0, _utils.getInteger)({
  53998. data: attributes.colSpan,
  53999. defaultValue: 1,
  54000. validate: n => n >= 1 || n === -1
  54001. });
  54002. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54003. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54004. this.id = attributes.id || "";
  54005. this.locale = attributes.locale || "";
  54006. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54007. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54008. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54009. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54010. this.name = attributes.name || "";
  54011. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54012. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54013. this.rotate = (0, _utils.getInteger)({
  54014. data: attributes.rotate,
  54015. defaultValue: 0,
  54016. validate: x => x % 90 === 0
  54017. });
  54018. this.use = attributes.use || "";
  54019. this.usehref = attributes.usehref || "";
  54020. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54021. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54022. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54023. this.assist = null;
  54024. this.bind = null;
  54025. this.border = null;
  54026. this.calculate = null;
  54027. this.caption = null;
  54028. this.desc = null;
  54029. this.extras = null;
  54030. this.font = null;
  54031. this.format = null;
  54032. this.items = new _xfa_object.XFAObjectArray(2);
  54033. this.keep = null;
  54034. this.margin = null;
  54035. this.para = null;
  54036. this.traversal = null;
  54037. this.ui = null;
  54038. this.validate = null;
  54039. this.value = null;
  54040. this.bindItems = new _xfa_object.XFAObjectArray();
  54041. this.connect = new _xfa_object.XFAObjectArray();
  54042. this.event = new _xfa_object.XFAObjectArray();
  54043. this.setProperty = new _xfa_object.XFAObjectArray();
  54044. }
  54045. [_xfa_object.$isBindable]() {
  54046. return true;
  54047. }
  54048. [_xfa_object.$setValue](value) {
  54049. _setValue(this, value);
  54050. }
  54051. [_xfa_object.$toHTML](availableSpace) {
  54052. setTabIndex(this);
  54053. if (!this.ui) {
  54054. this.ui = new Ui({});
  54055. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  54056. this[_xfa_object.$appendChild](this.ui);
  54057. let node;
  54058. switch (this.items.children.length) {
  54059. case 0:
  54060. node = new TextEdit({});
  54061. this.ui.textEdit = node;
  54062. break;
  54063. case 1:
  54064. node = new CheckButton({});
  54065. this.ui.checkButton = node;
  54066. break;
  54067. case 2:
  54068. node = new ChoiceList({});
  54069. this.ui.choiceList = node;
  54070. break;
  54071. }
  54072. this.ui[_xfa_object.$appendChild](node);
  54073. }
  54074. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  54075. return _utils.HTMLResult.EMPTY;
  54076. }
  54077. if (this.caption) {
  54078. delete this.caption[_xfa_object.$extra];
  54079. }
  54080. this[_xfa_object.$pushPara]();
  54081. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  54082. const savedW = this.w;
  54083. const savedH = this.h;
  54084. let marginH = 0;
  54085. let marginV = 0;
  54086. if (this.margin) {
  54087. marginH = this.margin.leftInset + this.margin.rightInset;
  54088. marginV = this.margin.topInset + this.margin.bottomInset;
  54089. }
  54090. let borderDims = null;
  54091. if (this.w === "" || this.h === "") {
  54092. let width = null;
  54093. let height = null;
  54094. let uiW = 0;
  54095. let uiH = 0;
  54096. if (this.ui.checkButton) {
  54097. uiW = uiH = this.ui.checkButton.size;
  54098. } else {
  54099. const {
  54100. w,
  54101. h
  54102. } = (0, _html_utils.layoutNode)(this, availableSpace);
  54103. if (w !== null) {
  54104. uiW = w;
  54105. uiH = h;
  54106. } else {
  54107. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  54108. }
  54109. }
  54110. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  54111. uiW += borderDims.w;
  54112. uiH += borderDims.h;
  54113. if (this.caption) {
  54114. const {
  54115. w,
  54116. h,
  54117. isBroken
  54118. } = this.caption[_xfa_object.$getExtra](availableSpace);
  54119. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  54120. this[_xfa_object.$popPara]();
  54121. return _utils.HTMLResult.FAILURE;
  54122. }
  54123. width = w;
  54124. height = h;
  54125. switch (this.caption.placement) {
  54126. case "left":
  54127. case "right":
  54128. case "inline":
  54129. width += uiW;
  54130. break;
  54131. case "top":
  54132. case "bottom":
  54133. height += uiH;
  54134. break;
  54135. }
  54136. } else {
  54137. width = uiW;
  54138. height = uiH;
  54139. }
  54140. if (width && this.w === "") {
  54141. width += marginH;
  54142. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  54143. }
  54144. if (height && this.h === "") {
  54145. height += marginV;
  54146. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  54147. }
  54148. }
  54149. this[_xfa_object.$popPara]();
  54150. (0, _html_utils.fixDimensions)(this);
  54151. setFirstUnsplittable(this);
  54152. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54153. this.w = savedW;
  54154. this.h = savedH;
  54155. this[_xfa_object.$popPara]();
  54156. return _utils.HTMLResult.FAILURE;
  54157. }
  54158. unsetFirstUnsplittable(this);
  54159. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  54160. (0, _html_utils.setMinMaxDimensions)(this, style);
  54161. const classNames = ["xfaField"];
  54162. if (this.font) {
  54163. classNames.push("xfaFont");
  54164. }
  54165. if ((0, _html_utils.isPrintOnly)(this)) {
  54166. classNames.push("xfaPrintOnly");
  54167. }
  54168. const attributes = {
  54169. style,
  54170. id: this[_xfa_object.$uid],
  54171. class: classNames
  54172. };
  54173. if (style.margin) {
  54174. style.padding = style.margin;
  54175. delete style.margin;
  54176. }
  54177. (0, _html_utils.setAccess)(this, classNames);
  54178. if (this.name) {
  54179. attributes.xfaName = this.name;
  54180. }
  54181. const children = [];
  54182. const html = {
  54183. name: "div",
  54184. attributes,
  54185. children
  54186. };
  54187. applyAssist(this, attributes);
  54188. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  54189. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  54190. const ui = this.ui[_xfa_object.$toHTML]().html;
  54191. if (!ui) {
  54192. Object.assign(style, borderStyle);
  54193. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54194. }
  54195. if (this[_xfa_object.$tabIndex]) {
  54196. if (ui.children && ui.children[0]) {
  54197. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  54198. } else {
  54199. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  54200. }
  54201. }
  54202. if (!ui.attributes.style) {
  54203. ui.attributes.style = Object.create(null);
  54204. }
  54205. let aElement = null;
  54206. if (this.ui.button) {
  54207. if (ui.children.length === 1) {
  54208. [aElement] = ui.children.splice(0, 1);
  54209. }
  54210. Object.assign(ui.attributes.style, borderStyle);
  54211. } else {
  54212. Object.assign(style, borderStyle);
  54213. }
  54214. children.push(ui);
  54215. if (this.value) {
  54216. if (this.ui.imageEdit) {
  54217. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  54218. } else if (!this.ui.button) {
  54219. let value = "";
  54220. if (this.value.exData) {
  54221. value = this.value.exData[_xfa_object.$text]();
  54222. } else if (this.value.text) {
  54223. value = this.value.text[_xfa_object.$getExtra]();
  54224. } else {
  54225. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  54226. if (htmlValue !== null) {
  54227. value = htmlValue.children[0].value;
  54228. }
  54229. }
  54230. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  54231. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  54232. }
  54233. if (value) {
  54234. if (this.ui.numericEdit) {
  54235. value = parseFloat(value);
  54236. value = isNaN(value) ? "" : value.toString();
  54237. }
  54238. if (ui.children[0].name === "textarea") {
  54239. ui.children[0].attributes.textContent = value;
  54240. } else {
  54241. ui.children[0].attributes.value = value;
  54242. }
  54243. }
  54244. }
  54245. }
  54246. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  54247. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  54248. let captionHeight = 0;
  54249. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  54250. captionHeight = this.caption.reserve;
  54251. if (captionHeight <= 0) {
  54252. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  54253. }
  54254. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  54255. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  54256. } else {
  54257. ui.children[0].attributes.style.height = "100%";
  54258. }
  54259. }
  54260. if (aElement) {
  54261. ui.children.push(aElement);
  54262. }
  54263. if (!caption) {
  54264. if (ui.attributes.class) {
  54265. ui.attributes.class.push("xfaLeft");
  54266. }
  54267. this.w = savedW;
  54268. this.h = savedH;
  54269. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54270. }
  54271. if (this.ui.button) {
  54272. if (style.padding) {
  54273. delete style.padding;
  54274. }
  54275. if (caption.name === "div") {
  54276. caption.name = "span";
  54277. }
  54278. ui.children.push(caption);
  54279. return _utils.HTMLResult.success(html, bbox);
  54280. } else if (this.ui.checkButton) {
  54281. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  54282. }
  54283. if (!ui.attributes.class) {
  54284. ui.attributes.class = [];
  54285. }
  54286. ui.children.splice(0, 0, caption);
  54287. switch (this.caption.placement) {
  54288. case "left":
  54289. ui.attributes.class.push("xfaLeft");
  54290. break;
  54291. case "right":
  54292. ui.attributes.class.push("xfaRight");
  54293. break;
  54294. case "top":
  54295. ui.attributes.class.push("xfaTop");
  54296. break;
  54297. case "bottom":
  54298. ui.attributes.class.push("xfaBottom");
  54299. break;
  54300. case "inline":
  54301. ui.attributes.class.push("xfaLeft");
  54302. break;
  54303. }
  54304. this.w = savedW;
  54305. this.h = savedH;
  54306. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54307. }
  54308. }
  54309. exports.Field = Field;
  54310. class Fill extends _xfa_object.XFAObject {
  54311. constructor(attributes) {
  54312. super(TEMPLATE_NS_ID, "fill", true);
  54313. this.id = attributes.id || "";
  54314. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54315. this.use = attributes.use || "";
  54316. this.usehref = attributes.usehref || "";
  54317. this.color = null;
  54318. this.extras = null;
  54319. this.linear = null;
  54320. this.pattern = null;
  54321. this.radial = null;
  54322. this.solid = null;
  54323. this.stipple = null;
  54324. }
  54325. [_xfa_object.$toStyle]() {
  54326. const parent = this[_xfa_object.$getParent]();
  54327. const grandpa = parent[_xfa_object.$getParent]();
  54328. const ggrandpa = grandpa[_xfa_object.$getParent]();
  54329. const style = Object.create(null);
  54330. let propName = "color";
  54331. let altPropName = propName;
  54332. if (parent instanceof Border) {
  54333. propName = "background-color";
  54334. altPropName = "background";
  54335. if (ggrandpa instanceof Ui) {
  54336. style.backgroundColor = "white";
  54337. }
  54338. }
  54339. if (parent instanceof Rectangle || parent instanceof Arc) {
  54340. propName = altPropName = "fill";
  54341. style.fill = "white";
  54342. }
  54343. for (const name of Object.getOwnPropertyNames(this)) {
  54344. if (name === "extras" || name === "color") {
  54345. continue;
  54346. }
  54347. const obj = this[name];
  54348. if (!(obj instanceof _xfa_object.XFAObject)) {
  54349. continue;
  54350. }
  54351. const color = obj[_xfa_object.$toStyle](this.color);
  54352. if (color) {
  54353. style[color.startsWith("#") ? propName : altPropName] = color;
  54354. }
  54355. return style;
  54356. }
  54357. if (this.color && this.color.value) {
  54358. const color = this.color[_xfa_object.$toStyle]();
  54359. style[color.startsWith("#") ? propName : altPropName] = color;
  54360. }
  54361. return style;
  54362. }
  54363. }
  54364. class Filter extends _xfa_object.XFAObject {
  54365. constructor(attributes) {
  54366. super(TEMPLATE_NS_ID, "filter", true);
  54367. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  54368. this.id = attributes.id || "";
  54369. this.name = attributes.name || "";
  54370. this.use = attributes.use || "";
  54371. this.usehref = attributes.usehref || "";
  54372. this.version = (0, _utils.getInteger)({
  54373. data: this.version,
  54374. defaultValue: 5,
  54375. validate: x => x >= 1 && x <= 5
  54376. });
  54377. this.appearanceFilter = null;
  54378. this.certificates = null;
  54379. this.digestMethods = null;
  54380. this.encodings = null;
  54381. this.encryptionMethods = null;
  54382. this.handler = null;
  54383. this.lockDocument = null;
  54384. this.mdp = null;
  54385. this.reasons = null;
  54386. this.timeStamp = null;
  54387. }
  54388. }
  54389. class Float extends _xfa_object.ContentObject {
  54390. constructor(attributes) {
  54391. super(TEMPLATE_NS_ID, "float");
  54392. this.id = attributes.id || "";
  54393. this.name = attributes.name || "";
  54394. this.use = attributes.use || "";
  54395. this.usehref = attributes.usehref || "";
  54396. }
  54397. [_xfa_object.$finalize]() {
  54398. const number = parseFloat(this[_xfa_object.$content].trim());
  54399. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54400. }
  54401. [_xfa_object.$toHTML](availableSpace) {
  54402. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54403. }
  54404. }
  54405. class Font extends _xfa_object.XFAObject {
  54406. constructor(attributes) {
  54407. super(TEMPLATE_NS_ID, "font", true);
  54408. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  54409. this.fontHorizontalScale = (0, _utils.getFloat)({
  54410. data: attributes.fontHorizontalScale,
  54411. defaultValue: 100,
  54412. validate: x => x >= 0
  54413. });
  54414. this.fontVerticalScale = (0, _utils.getFloat)({
  54415. data: attributes.fontVerticalScale,
  54416. defaultValue: 100,
  54417. validate: x => x >= 0
  54418. });
  54419. this.id = attributes.id || "";
  54420. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  54421. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  54422. this.lineThrough = (0, _utils.getInteger)({
  54423. data: attributes.lineThrough,
  54424. defaultValue: 0,
  54425. validate: x => x === 1 || x === 2
  54426. });
  54427. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  54428. this.overline = (0, _utils.getInteger)({
  54429. data: attributes.overline,
  54430. defaultValue: 0,
  54431. validate: x => x === 1 || x === 2
  54432. });
  54433. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  54434. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  54435. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54436. this.typeface = attributes.typeface || "Courier";
  54437. this.underline = (0, _utils.getInteger)({
  54438. data: attributes.underline,
  54439. defaultValue: 0,
  54440. validate: x => x === 1 || x === 2
  54441. });
  54442. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  54443. this.use = attributes.use || "";
  54444. this.usehref = attributes.usehref || "";
  54445. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  54446. this.extras = null;
  54447. this.fill = null;
  54448. }
  54449. [_xfa_object.$clean](builder) {
  54450. super[_xfa_object.$clean](builder);
  54451. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  54452. }
  54453. [_xfa_object.$toStyle]() {
  54454. const style = (0, _html_utils.toStyle)(this, "fill");
  54455. const color = style.color;
  54456. if (color) {
  54457. if (color === "#000000") {
  54458. delete style.color;
  54459. } else if (!color.startsWith("#")) {
  54460. style.background = color;
  54461. style.backgroundClip = "text";
  54462. style.color = "transparent";
  54463. }
  54464. }
  54465. if (this.baselineShift) {
  54466. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  54467. }
  54468. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  54469. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  54470. if (this.lineThrough !== 0) {
  54471. style.textDecoration = "line-through";
  54472. if (this.lineThrough === 2) {
  54473. style.textDecorationStyle = "double";
  54474. }
  54475. }
  54476. if (this.overline !== 0) {
  54477. style.textDecoration = "overline";
  54478. if (this.overline === 2) {
  54479. style.textDecorationStyle = "double";
  54480. }
  54481. }
  54482. style.fontStyle = this.posture;
  54483. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  54484. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  54485. if (this.underline !== 0) {
  54486. style.textDecoration = "underline";
  54487. if (this.underline === 2) {
  54488. style.textDecorationStyle = "double";
  54489. }
  54490. }
  54491. style.fontWeight = this.weight;
  54492. return style;
  54493. }
  54494. }
  54495. class Format extends _xfa_object.XFAObject {
  54496. constructor(attributes) {
  54497. super(TEMPLATE_NS_ID, "format", true);
  54498. this.id = attributes.id || "";
  54499. this.use = attributes.use || "";
  54500. this.usehref = attributes.usehref || "";
  54501. this.extras = null;
  54502. this.picture = null;
  54503. }
  54504. }
  54505. class Handler extends _xfa_object.StringObject {
  54506. constructor(attributes) {
  54507. super(TEMPLATE_NS_ID, "handler");
  54508. this.id = attributes.id || "";
  54509. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54510. this.use = attributes.use || "";
  54511. this.usehref = attributes.usehref || "";
  54512. }
  54513. }
  54514. class Hyphenation extends _xfa_object.XFAObject {
  54515. constructor(attributes) {
  54516. super(TEMPLATE_NS_ID, "hyphenation");
  54517. this.excludeAllCaps = (0, _utils.getInteger)({
  54518. data: attributes.excludeAllCaps,
  54519. defaultValue: 0,
  54520. validate: x => x === 1
  54521. });
  54522. this.excludeInitialCap = (0, _utils.getInteger)({
  54523. data: attributes.excludeInitialCap,
  54524. defaultValue: 0,
  54525. validate: x => x === 1
  54526. });
  54527. this.hyphenate = (0, _utils.getInteger)({
  54528. data: attributes.hyphenate,
  54529. defaultValue: 0,
  54530. validate: x => x === 1
  54531. });
  54532. this.id = attributes.id || "";
  54533. this.pushCharacterCount = (0, _utils.getInteger)({
  54534. data: attributes.pushCharacterCount,
  54535. defaultValue: 3,
  54536. validate: x => x >= 0
  54537. });
  54538. this.remainCharacterCount = (0, _utils.getInteger)({
  54539. data: attributes.remainCharacterCount,
  54540. defaultValue: 3,
  54541. validate: x => x >= 0
  54542. });
  54543. this.use = attributes.use || "";
  54544. this.usehref = attributes.usehref || "";
  54545. this.wordCharacterCount = (0, _utils.getInteger)({
  54546. data: attributes.wordCharacterCount,
  54547. defaultValue: 7,
  54548. validate: x => x >= 0
  54549. });
  54550. }
  54551. }
  54552. class Image extends _xfa_object.StringObject {
  54553. constructor(attributes) {
  54554. super(TEMPLATE_NS_ID, "image");
  54555. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  54556. this.contentType = attributes.contentType || "";
  54557. this.href = attributes.href || "";
  54558. this.id = attributes.id || "";
  54559. this.name = attributes.name || "";
  54560. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  54561. this.use = attributes.use || "";
  54562. this.usehref = attributes.usehref || "";
  54563. }
  54564. [_xfa_object.$toHTML]() {
  54565. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  54566. return _utils.HTMLResult.EMPTY;
  54567. }
  54568. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  54569. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  54570. return _utils.HTMLResult.EMPTY;
  54571. }
  54572. if (!buffer && this.transferEncoding === "base64") {
  54573. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  54574. }
  54575. if (!buffer) {
  54576. return _utils.HTMLResult.EMPTY;
  54577. }
  54578. if (!this.contentType) {
  54579. for (const [header, type] of IMAGES_HEADERS) {
  54580. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  54581. this.contentType = type;
  54582. break;
  54583. }
  54584. }
  54585. if (!this.contentType) {
  54586. return _utils.HTMLResult.EMPTY;
  54587. }
  54588. }
  54589. const blob = new Blob([buffer], {
  54590. type: this.contentType
  54591. });
  54592. let style;
  54593. switch (this.aspect) {
  54594. case "fit":
  54595. case "actual":
  54596. break;
  54597. case "height":
  54598. style = {
  54599. height: "100%",
  54600. objectFit: "fill"
  54601. };
  54602. break;
  54603. case "none":
  54604. style = {
  54605. width: "100%",
  54606. height: "100%",
  54607. objectFit: "fill"
  54608. };
  54609. break;
  54610. case "width":
  54611. style = {
  54612. width: "100%",
  54613. objectFit: "fill"
  54614. };
  54615. break;
  54616. }
  54617. const parent = this[_xfa_object.$getParent]();
  54618. return _utils.HTMLResult.success({
  54619. name: "img",
  54620. attributes: {
  54621. class: ["xfaImage"],
  54622. style,
  54623. src: URL.createObjectURL(blob),
  54624. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  54625. }
  54626. });
  54627. }
  54628. }
  54629. class ImageEdit extends _xfa_object.XFAObject {
  54630. constructor(attributes) {
  54631. super(TEMPLATE_NS_ID, "imageEdit", true);
  54632. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  54633. this.id = attributes.id || "";
  54634. this.use = attributes.use || "";
  54635. this.usehref = attributes.usehref || "";
  54636. this.border = null;
  54637. this.extras = null;
  54638. this.margin = null;
  54639. }
  54640. [_xfa_object.$toHTML](availableSpace) {
  54641. if (this.data === "embed") {
  54642. return _utils.HTMLResult.success({
  54643. name: "div",
  54644. children: [],
  54645. attributes: {}
  54646. });
  54647. }
  54648. return _utils.HTMLResult.EMPTY;
  54649. }
  54650. }
  54651. class Integer extends _xfa_object.ContentObject {
  54652. constructor(attributes) {
  54653. super(TEMPLATE_NS_ID, "integer");
  54654. this.id = attributes.id || "";
  54655. this.name = attributes.name || "";
  54656. this.use = attributes.use || "";
  54657. this.usehref = attributes.usehref || "";
  54658. }
  54659. [_xfa_object.$finalize]() {
  54660. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  54661. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54662. }
  54663. [_xfa_object.$toHTML](availableSpace) {
  54664. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54665. }
  54666. }
  54667. class Issuers extends _xfa_object.XFAObject {
  54668. constructor(attributes) {
  54669. super(TEMPLATE_NS_ID, "issuers", true);
  54670. this.id = attributes.id || "";
  54671. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54672. this.use = attributes.use || "";
  54673. this.usehref = attributes.usehref || "";
  54674. this.certificate = new _xfa_object.XFAObjectArray();
  54675. }
  54676. }
  54677. class Items extends _xfa_object.XFAObject {
  54678. constructor(attributes) {
  54679. super(TEMPLATE_NS_ID, "items", true);
  54680. this.id = attributes.id || "";
  54681. this.name = attributes.name || "";
  54682. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54683. this.ref = attributes.ref || "";
  54684. this.save = (0, _utils.getInteger)({
  54685. data: attributes.save,
  54686. defaultValue: 0,
  54687. validate: x => x === 1
  54688. });
  54689. this.use = attributes.use || "";
  54690. this.usehref = attributes.usehref || "";
  54691. this.boolean = new _xfa_object.XFAObjectArray();
  54692. this.date = new _xfa_object.XFAObjectArray();
  54693. this.dateTime = new _xfa_object.XFAObjectArray();
  54694. this.decimal = new _xfa_object.XFAObjectArray();
  54695. this.exData = new _xfa_object.XFAObjectArray();
  54696. this.float = new _xfa_object.XFAObjectArray();
  54697. this.image = new _xfa_object.XFAObjectArray();
  54698. this.integer = new _xfa_object.XFAObjectArray();
  54699. this.text = new _xfa_object.XFAObjectArray();
  54700. this.time = new _xfa_object.XFAObjectArray();
  54701. }
  54702. [_xfa_object.$toHTML]() {
  54703. const output = [];
  54704. for (const child of this[_xfa_object.$getChildren]()) {
  54705. output.push(child[_xfa_object.$text]());
  54706. }
  54707. return _utils.HTMLResult.success(output);
  54708. }
  54709. }
  54710. exports.Items = Items;
  54711. class Keep extends _xfa_object.XFAObject {
  54712. constructor(attributes) {
  54713. super(TEMPLATE_NS_ID, "keep", true);
  54714. this.id = attributes.id || "";
  54715. const options = ["none", "contentArea", "pageArea"];
  54716. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  54717. this.next = (0, _utils.getStringOption)(attributes.next, options);
  54718. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  54719. this.use = attributes.use || "";
  54720. this.usehref = attributes.usehref || "";
  54721. this.extras = null;
  54722. }
  54723. }
  54724. class KeyUsage extends _xfa_object.XFAObject {
  54725. constructor(attributes) {
  54726. super(TEMPLATE_NS_ID, "keyUsage");
  54727. const options = ["", "yes", "no"];
  54728. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  54729. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  54730. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  54731. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  54732. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  54733. this.id = attributes.id || "";
  54734. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  54735. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  54736. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  54737. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  54738. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54739. this.use = attributes.use || "";
  54740. this.usehref = attributes.usehref || "";
  54741. }
  54742. }
  54743. class Line extends _xfa_object.XFAObject {
  54744. constructor(attributes) {
  54745. super(TEMPLATE_NS_ID, "line", true);
  54746. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54747. this.id = attributes.id || "";
  54748. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  54749. this.use = attributes.use || "";
  54750. this.usehref = attributes.usehref || "";
  54751. this.edge = null;
  54752. }
  54753. [_xfa_object.$toHTML]() {
  54754. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54755. const edge = this.edge ? this.edge : new Edge({});
  54756. const edgeStyle = edge[_xfa_object.$toStyle]();
  54757. const style = Object.create(null);
  54758. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  54759. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  54760. style.stroke = edgeStyle.color;
  54761. let x1, y1, x2, y2;
  54762. let width = "100%";
  54763. let height = "100%";
  54764. if (parent.w <= thickness) {
  54765. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  54766. width = style.strokeWidth;
  54767. } else if (parent.h <= thickness) {
  54768. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  54769. height = style.strokeWidth;
  54770. } else {
  54771. if (this.slope === "\\") {
  54772. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  54773. } else {
  54774. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  54775. }
  54776. }
  54777. const line = {
  54778. name: "line",
  54779. attributes: {
  54780. xmlns: SVG_NS,
  54781. x1,
  54782. y1,
  54783. x2,
  54784. y2,
  54785. style
  54786. }
  54787. };
  54788. const svg = {
  54789. name: "svg",
  54790. children: [line],
  54791. attributes: {
  54792. xmlns: SVG_NS,
  54793. width,
  54794. height,
  54795. style: {
  54796. overflow: "visible"
  54797. }
  54798. }
  54799. };
  54800. if (hasMargin(parent)) {
  54801. return _utils.HTMLResult.success({
  54802. name: "div",
  54803. attributes: {
  54804. style: {
  54805. display: "inline",
  54806. width: "100%",
  54807. height: "100%"
  54808. }
  54809. },
  54810. children: [svg]
  54811. });
  54812. }
  54813. svg.attributes.style.position = "absolute";
  54814. return _utils.HTMLResult.success(svg);
  54815. }
  54816. }
  54817. class Linear extends _xfa_object.XFAObject {
  54818. constructor(attributes) {
  54819. super(TEMPLATE_NS_ID, "linear", true);
  54820. this.id = attributes.id || "";
  54821. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  54822. this.use = attributes.use || "";
  54823. this.usehref = attributes.usehref || "";
  54824. this.color = null;
  54825. this.extras = null;
  54826. }
  54827. [_xfa_object.$toStyle](startColor) {
  54828. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54829. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  54830. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  54831. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  54832. }
  54833. }
  54834. class LockDocument extends _xfa_object.ContentObject {
  54835. constructor(attributes) {
  54836. super(TEMPLATE_NS_ID, "lockDocument");
  54837. this.id = attributes.id || "";
  54838. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54839. this.use = attributes.use || "";
  54840. this.usehref = attributes.usehref || "";
  54841. }
  54842. [_xfa_object.$finalize]() {
  54843. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  54844. }
  54845. }
  54846. class Manifest extends _xfa_object.XFAObject {
  54847. constructor(attributes) {
  54848. super(TEMPLATE_NS_ID, "manifest", true);
  54849. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  54850. this.id = attributes.id || "";
  54851. this.name = attributes.name || "";
  54852. this.use = attributes.use || "";
  54853. this.usehref = attributes.usehref || "";
  54854. this.extras = null;
  54855. this.ref = new _xfa_object.XFAObjectArray();
  54856. }
  54857. }
  54858. class Margin extends _xfa_object.XFAObject {
  54859. constructor(attributes) {
  54860. super(TEMPLATE_NS_ID, "margin", true);
  54861. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  54862. this.id = attributes.id || "";
  54863. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  54864. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  54865. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  54866. this.use = attributes.use || "";
  54867. this.usehref = attributes.usehref || "";
  54868. this.extras = null;
  54869. }
  54870. [_xfa_object.$toStyle]() {
  54871. return {
  54872. 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)
  54873. };
  54874. }
  54875. }
  54876. class Mdp extends _xfa_object.XFAObject {
  54877. constructor(attributes) {
  54878. super(TEMPLATE_NS_ID, "mdp");
  54879. this.id = attributes.id || "";
  54880. this.permissions = (0, _utils.getInteger)({
  54881. data: attributes.permissions,
  54882. defaultValue: 2,
  54883. validate: x => x === 1 || x === 3
  54884. });
  54885. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  54886. this.use = attributes.use || "";
  54887. this.usehref = attributes.usehref || "";
  54888. }
  54889. }
  54890. class Medium extends _xfa_object.XFAObject {
  54891. constructor(attributes) {
  54892. super(TEMPLATE_NS_ID, "medium");
  54893. this.id = attributes.id || "";
  54894. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  54895. this.long = (0, _utils.getMeasurement)(attributes.long);
  54896. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  54897. this.short = (0, _utils.getMeasurement)(attributes.short);
  54898. this.stock = attributes.stock || "";
  54899. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  54900. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  54901. this.use = attributes.use || "";
  54902. this.usehref = attributes.usehref || "";
  54903. }
  54904. }
  54905. class Message extends _xfa_object.XFAObject {
  54906. constructor(attributes) {
  54907. super(TEMPLATE_NS_ID, "message", true);
  54908. this.id = attributes.id || "";
  54909. this.use = attributes.use || "";
  54910. this.usehref = attributes.usehref || "";
  54911. this.text = new _xfa_object.XFAObjectArray();
  54912. }
  54913. }
  54914. class NumericEdit extends _xfa_object.XFAObject {
  54915. constructor(attributes) {
  54916. super(TEMPLATE_NS_ID, "numericEdit", true);
  54917. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54918. this.id = attributes.id || "";
  54919. this.use = attributes.use || "";
  54920. this.usehref = attributes.usehref || "";
  54921. this.border = null;
  54922. this.comb = null;
  54923. this.extras = null;
  54924. this.margin = null;
  54925. }
  54926. [_xfa_object.$toHTML](availableSpace) {
  54927. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54928. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54929. const html = {
  54930. name: "input",
  54931. attributes: {
  54932. type: "text",
  54933. fieldId: field[_xfa_object.$uid],
  54934. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54935. class: ["xfaTextfield"],
  54936. style,
  54937. "aria-label": ariaLabel(field)
  54938. }
  54939. };
  54940. return _utils.HTMLResult.success({
  54941. name: "label",
  54942. attributes: {
  54943. class: ["xfaLabel"]
  54944. },
  54945. children: [html]
  54946. });
  54947. }
  54948. }
  54949. class Occur extends _xfa_object.XFAObject {
  54950. constructor(attributes) {
  54951. super(TEMPLATE_NS_ID, "occur", true);
  54952. this.id = attributes.id || "";
  54953. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  54954. data: attributes.initial,
  54955. defaultValue: "",
  54956. validate: x => true
  54957. }) : "";
  54958. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  54959. data: attributes.max,
  54960. defaultValue: 1,
  54961. validate: x => true
  54962. }) : "";
  54963. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  54964. data: attributes.min,
  54965. defaultValue: 1,
  54966. validate: x => true
  54967. }) : "";
  54968. this.use = attributes.use || "";
  54969. this.usehref = attributes.usehref || "";
  54970. this.extras = null;
  54971. }
  54972. [_xfa_object.$clean]() {
  54973. const parent = this[_xfa_object.$getParent]();
  54974. const originalMin = this.min;
  54975. if (this.min === "") {
  54976. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  54977. }
  54978. if (this.max === "") {
  54979. if (originalMin === "") {
  54980. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  54981. } else {
  54982. this.max = this.min;
  54983. }
  54984. }
  54985. if (this.max !== -1 && this.max < this.min) {
  54986. this.max = this.min;
  54987. }
  54988. if (this.initial === "") {
  54989. this.initial = parent instanceof Template ? 1 : this.min;
  54990. }
  54991. }
  54992. }
  54993. class Oid extends _xfa_object.StringObject {
  54994. constructor(attributes) {
  54995. super(TEMPLATE_NS_ID, "oid");
  54996. this.id = attributes.id || "";
  54997. this.name = attributes.name || "";
  54998. this.use = attributes.use || "";
  54999. this.usehref = attributes.usehref || "";
  55000. }
  55001. }
  55002. class Oids extends _xfa_object.XFAObject {
  55003. constructor(attributes) {
  55004. super(TEMPLATE_NS_ID, "oids", true);
  55005. this.id = attributes.id || "";
  55006. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55007. this.use = attributes.use || "";
  55008. this.usehref = attributes.usehref || "";
  55009. this.oid = new _xfa_object.XFAObjectArray();
  55010. }
  55011. }
  55012. class Overflow extends _xfa_object.XFAObject {
  55013. constructor(attributes) {
  55014. super(TEMPLATE_NS_ID, "overflow");
  55015. this.id = attributes.id || "";
  55016. this.leader = attributes.leader || "";
  55017. this.target = attributes.target || "";
  55018. this.trailer = attributes.trailer || "";
  55019. this.use = attributes.use || "";
  55020. this.usehref = attributes.usehref || "";
  55021. }
  55022. [_xfa_object.$getExtra]() {
  55023. if (!this[_xfa_object.$extra]) {
  55024. const parent = this[_xfa_object.$getParent]();
  55025. const root = this[_xfa_object.$getTemplateRoot]();
  55026. const target = root[_xfa_object.$searchNode](this.target, parent);
  55027. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  55028. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  55029. this[_xfa_object.$extra] = {
  55030. target: target && target[0] || null,
  55031. leader: leader && leader[0] || null,
  55032. trailer: trailer && trailer[0] || null,
  55033. addLeader: false,
  55034. addTrailer: false
  55035. };
  55036. }
  55037. return this[_xfa_object.$extra];
  55038. }
  55039. }
  55040. class PageArea extends _xfa_object.XFAObject {
  55041. constructor(attributes) {
  55042. super(TEMPLATE_NS_ID, "pageArea", true);
  55043. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  55044. this.id = attributes.id || "";
  55045. this.initialNumber = (0, _utils.getInteger)({
  55046. data: attributes.initialNumber,
  55047. defaultValue: 1,
  55048. validate: x => true
  55049. });
  55050. this.name = attributes.name || "";
  55051. this.numbered = (0, _utils.getInteger)({
  55052. data: attributes.numbered,
  55053. defaultValue: 1,
  55054. validate: x => true
  55055. });
  55056. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  55057. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  55058. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55059. this.use = attributes.use || "";
  55060. this.usehref = attributes.usehref || "";
  55061. this.desc = null;
  55062. this.extras = null;
  55063. this.medium = null;
  55064. this.occur = null;
  55065. this.area = new _xfa_object.XFAObjectArray();
  55066. this.contentArea = new _xfa_object.XFAObjectArray();
  55067. this.draw = new _xfa_object.XFAObjectArray();
  55068. this.exclGroup = new _xfa_object.XFAObjectArray();
  55069. this.field = new _xfa_object.XFAObjectArray();
  55070. this.subform = new _xfa_object.XFAObjectArray();
  55071. }
  55072. [_xfa_object.$isUsable]() {
  55073. if (!this[_xfa_object.$extra]) {
  55074. this[_xfa_object.$extra] = {
  55075. numberOfUse: 0
  55076. };
  55077. return true;
  55078. }
  55079. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  55080. }
  55081. [_xfa_object.$cleanPage]() {
  55082. delete this[_xfa_object.$extra];
  55083. }
  55084. [_xfa_object.$getNextPage]() {
  55085. if (!this[_xfa_object.$extra]) {
  55086. this[_xfa_object.$extra] = {
  55087. numberOfUse: 0
  55088. };
  55089. }
  55090. const parent = this[_xfa_object.$getParent]();
  55091. if (parent.relation === "orderedOccurrence") {
  55092. if (this[_xfa_object.$isUsable]()) {
  55093. this[_xfa_object.$extra].numberOfUse += 1;
  55094. return this;
  55095. }
  55096. }
  55097. return parent[_xfa_object.$getNextPage]();
  55098. }
  55099. [_xfa_object.$getAvailableSpace]() {
  55100. return this[_xfa_object.$extra].space || {
  55101. width: 0,
  55102. height: 0
  55103. };
  55104. }
  55105. [_xfa_object.$toHTML]() {
  55106. if (!this[_xfa_object.$extra]) {
  55107. this[_xfa_object.$extra] = {
  55108. numberOfUse: 1
  55109. };
  55110. }
  55111. const children = [];
  55112. this[_xfa_object.$extra].children = children;
  55113. const style = Object.create(null);
  55114. if (this.medium && this.medium.short && this.medium.long) {
  55115. style.width = (0, _html_utils.measureToString)(this.medium.short);
  55116. style.height = (0, _html_utils.measureToString)(this.medium.long);
  55117. this[_xfa_object.$extra].space = {
  55118. width: this.medium.short,
  55119. height: this.medium.long
  55120. };
  55121. if (this.medium.orientation === "landscape") {
  55122. const x = style.width;
  55123. style.width = style.height;
  55124. style.height = x;
  55125. this[_xfa_object.$extra].space = {
  55126. width: this.medium.long,
  55127. height: this.medium.short
  55128. };
  55129. }
  55130. } else {
  55131. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  55132. }
  55133. this[_xfa_object.$childrenToHTML]({
  55134. filter: new Set(["area", "draw", "field", "subform"]),
  55135. include: true
  55136. });
  55137. this[_xfa_object.$childrenToHTML]({
  55138. filter: new Set(["contentArea"]),
  55139. include: true
  55140. });
  55141. return _utils.HTMLResult.success({
  55142. name: "div",
  55143. children,
  55144. attributes: {
  55145. class: ["xfaPage"],
  55146. id: this[_xfa_object.$uid],
  55147. style,
  55148. xfaName: this.name
  55149. }
  55150. });
  55151. }
  55152. }
  55153. class PageSet extends _xfa_object.XFAObject {
  55154. constructor(attributes) {
  55155. super(TEMPLATE_NS_ID, "pageSet", true);
  55156. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  55157. this.id = attributes.id || "";
  55158. this.name = attributes.name || "";
  55159. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  55160. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55161. this.use = attributes.use || "";
  55162. this.usehref = attributes.usehref || "";
  55163. this.extras = null;
  55164. this.occur = null;
  55165. this.pageArea = new _xfa_object.XFAObjectArray();
  55166. this.pageSet = new _xfa_object.XFAObjectArray();
  55167. }
  55168. [_xfa_object.$cleanPage]() {
  55169. for (const page of this.pageArea.children) {
  55170. page[_xfa_object.$cleanPage]();
  55171. }
  55172. for (const page of this.pageSet.children) {
  55173. page[_xfa_object.$cleanPage]();
  55174. }
  55175. }
  55176. [_xfa_object.$isUsable]() {
  55177. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  55178. }
  55179. [_xfa_object.$getNextPage]() {
  55180. if (!this[_xfa_object.$extra]) {
  55181. this[_xfa_object.$extra] = {
  55182. numberOfUse: 1,
  55183. pageIndex: -1,
  55184. pageSetIndex: -1
  55185. };
  55186. }
  55187. if (this.relation === "orderedOccurrence") {
  55188. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  55189. this[_xfa_object.$extra].pageIndex += 1;
  55190. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  55191. return pageArea[_xfa_object.$getNextPage]();
  55192. }
  55193. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  55194. this[_xfa_object.$extra].pageSetIndex += 1;
  55195. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  55196. }
  55197. if (this[_xfa_object.$isUsable]()) {
  55198. this[_xfa_object.$extra].numberOfUse += 1;
  55199. this[_xfa_object.$extra].pageIndex = -1;
  55200. this[_xfa_object.$extra].pageSetIndex = -1;
  55201. return this[_xfa_object.$getNextPage]();
  55202. }
  55203. const parent = this[_xfa_object.$getParent]();
  55204. if (parent instanceof PageSet) {
  55205. return parent[_xfa_object.$getNextPage]();
  55206. }
  55207. this[_xfa_object.$cleanPage]();
  55208. return this[_xfa_object.$getNextPage]();
  55209. }
  55210. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  55211. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  55212. const position = pageNumber === 0 ? "first" : "rest";
  55213. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  55214. if (page) {
  55215. return page;
  55216. }
  55217. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  55218. if (page) {
  55219. return page;
  55220. }
  55221. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  55222. if (page) {
  55223. return page;
  55224. }
  55225. return this.pageArea.children[0];
  55226. }
  55227. }
  55228. class Para extends _xfa_object.XFAObject {
  55229. constructor(attributes) {
  55230. super(TEMPLATE_NS_ID, "para", true);
  55231. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55232. this.id = attributes.id || "";
  55233. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  55234. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  55235. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  55236. this.orphans = (0, _utils.getInteger)({
  55237. data: attributes.orphans,
  55238. defaultValue: 0,
  55239. validate: x => x >= 0
  55240. });
  55241. this.preserve = attributes.preserve || "";
  55242. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  55243. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  55244. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  55245. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  55246. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  55247. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  55248. this.use = attributes.use || "";
  55249. this.usehref = attributes.usehref || "";
  55250. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  55251. this.widows = (0, _utils.getInteger)({
  55252. data: attributes.widows,
  55253. defaultValue: 0,
  55254. validate: x => x >= 0
  55255. });
  55256. this.hyphenation = null;
  55257. }
  55258. [_xfa_object.$toStyle]() {
  55259. const style = (0, _html_utils.toStyle)(this, "hAlign");
  55260. if (this.marginLeft !== "") {
  55261. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  55262. }
  55263. if (this.marginRight !== "") {
  55264. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  55265. }
  55266. if (this.spaceAbove !== "") {
  55267. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  55268. }
  55269. if (this.spaceBelow !== "") {
  55270. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  55271. }
  55272. if (this.textIndent !== "") {
  55273. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  55274. (0, _html_utils.fixTextIndent)(style);
  55275. }
  55276. if (this.lineHeight > 0) {
  55277. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  55278. }
  55279. if (this.tabDefault !== "") {
  55280. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  55281. }
  55282. if (this.tabStops.length > 0) {}
  55283. if (this.hyphenatation) {
  55284. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  55285. }
  55286. return style;
  55287. }
  55288. }
  55289. class PasswordEdit extends _xfa_object.XFAObject {
  55290. constructor(attributes) {
  55291. super(TEMPLATE_NS_ID, "passwordEdit", true);
  55292. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55293. this.id = attributes.id || "";
  55294. this.passwordChar = attributes.passwordChar || "*";
  55295. this.use = attributes.use || "";
  55296. this.usehref = attributes.usehref || "";
  55297. this.border = null;
  55298. this.extras = null;
  55299. this.margin = null;
  55300. }
  55301. }
  55302. class Pattern extends _xfa_object.XFAObject {
  55303. constructor(attributes) {
  55304. super(TEMPLATE_NS_ID, "pattern", true);
  55305. this.id = attributes.id || "";
  55306. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  55307. this.use = attributes.use || "";
  55308. this.usehref = attributes.usehref || "";
  55309. this.color = null;
  55310. this.extras = null;
  55311. }
  55312. [_xfa_object.$toStyle](startColor) {
  55313. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55314. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55315. const width = 5;
  55316. const cmd = "repeating-linear-gradient";
  55317. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  55318. switch (this.type) {
  55319. case "crossHatch":
  55320. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  55321. case "crossDiagonal":
  55322. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  55323. case "diagonalLeft":
  55324. return `${cmd}(45deg,${colors})`;
  55325. case "diagonalRight":
  55326. return `${cmd}(-45deg,${colors})`;
  55327. case "horizontal":
  55328. return `${cmd}(to top,${colors})`;
  55329. case "vertical":
  55330. return `${cmd}(to right,${colors})`;
  55331. }
  55332. return "";
  55333. }
  55334. }
  55335. class Picture extends _xfa_object.StringObject {
  55336. constructor(attributes) {
  55337. super(TEMPLATE_NS_ID, "picture");
  55338. this.id = attributes.id || "";
  55339. this.use = attributes.use || "";
  55340. this.usehref = attributes.usehref || "";
  55341. }
  55342. }
  55343. class Proto extends _xfa_object.XFAObject {
  55344. constructor(attributes) {
  55345. super(TEMPLATE_NS_ID, "proto", true);
  55346. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  55347. this.arc = new _xfa_object.XFAObjectArray();
  55348. this.area = new _xfa_object.XFAObjectArray();
  55349. this.assist = new _xfa_object.XFAObjectArray();
  55350. this.barcode = new _xfa_object.XFAObjectArray();
  55351. this.bindItems = new _xfa_object.XFAObjectArray();
  55352. this.bookend = new _xfa_object.XFAObjectArray();
  55353. this.boolean = new _xfa_object.XFAObjectArray();
  55354. this.border = new _xfa_object.XFAObjectArray();
  55355. this.break = new _xfa_object.XFAObjectArray();
  55356. this.breakAfter = new _xfa_object.XFAObjectArray();
  55357. this.breakBefore = new _xfa_object.XFAObjectArray();
  55358. this.button = new _xfa_object.XFAObjectArray();
  55359. this.calculate = new _xfa_object.XFAObjectArray();
  55360. this.caption = new _xfa_object.XFAObjectArray();
  55361. this.certificate = new _xfa_object.XFAObjectArray();
  55362. this.certificates = new _xfa_object.XFAObjectArray();
  55363. this.checkButton = new _xfa_object.XFAObjectArray();
  55364. this.choiceList = new _xfa_object.XFAObjectArray();
  55365. this.color = new _xfa_object.XFAObjectArray();
  55366. this.comb = new _xfa_object.XFAObjectArray();
  55367. this.connect = new _xfa_object.XFAObjectArray();
  55368. this.contentArea = new _xfa_object.XFAObjectArray();
  55369. this.corner = new _xfa_object.XFAObjectArray();
  55370. this.date = new _xfa_object.XFAObjectArray();
  55371. this.dateTime = new _xfa_object.XFAObjectArray();
  55372. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  55373. this.decimal = new _xfa_object.XFAObjectArray();
  55374. this.defaultUi = new _xfa_object.XFAObjectArray();
  55375. this.desc = new _xfa_object.XFAObjectArray();
  55376. this.digestMethod = new _xfa_object.XFAObjectArray();
  55377. this.digestMethods = new _xfa_object.XFAObjectArray();
  55378. this.draw = new _xfa_object.XFAObjectArray();
  55379. this.edge = new _xfa_object.XFAObjectArray();
  55380. this.encoding = new _xfa_object.XFAObjectArray();
  55381. this.encodings = new _xfa_object.XFAObjectArray();
  55382. this.encrypt = new _xfa_object.XFAObjectArray();
  55383. this.encryptData = new _xfa_object.XFAObjectArray();
  55384. this.encryption = new _xfa_object.XFAObjectArray();
  55385. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55386. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  55387. this.event = new _xfa_object.XFAObjectArray();
  55388. this.exData = new _xfa_object.XFAObjectArray();
  55389. this.exObject = new _xfa_object.XFAObjectArray();
  55390. this.exclGroup = new _xfa_object.XFAObjectArray();
  55391. this.execute = new _xfa_object.XFAObjectArray();
  55392. this.extras = new _xfa_object.XFAObjectArray();
  55393. this.field = new _xfa_object.XFAObjectArray();
  55394. this.fill = new _xfa_object.XFAObjectArray();
  55395. this.filter = new _xfa_object.XFAObjectArray();
  55396. this.float = new _xfa_object.XFAObjectArray();
  55397. this.font = new _xfa_object.XFAObjectArray();
  55398. this.format = new _xfa_object.XFAObjectArray();
  55399. this.handler = new _xfa_object.XFAObjectArray();
  55400. this.hyphenation = new _xfa_object.XFAObjectArray();
  55401. this.image = new _xfa_object.XFAObjectArray();
  55402. this.imageEdit = new _xfa_object.XFAObjectArray();
  55403. this.integer = new _xfa_object.XFAObjectArray();
  55404. this.issuers = new _xfa_object.XFAObjectArray();
  55405. this.items = new _xfa_object.XFAObjectArray();
  55406. this.keep = new _xfa_object.XFAObjectArray();
  55407. this.keyUsage = new _xfa_object.XFAObjectArray();
  55408. this.line = new _xfa_object.XFAObjectArray();
  55409. this.linear = new _xfa_object.XFAObjectArray();
  55410. this.lockDocument = new _xfa_object.XFAObjectArray();
  55411. this.manifest = new _xfa_object.XFAObjectArray();
  55412. this.margin = new _xfa_object.XFAObjectArray();
  55413. this.mdp = new _xfa_object.XFAObjectArray();
  55414. this.medium = new _xfa_object.XFAObjectArray();
  55415. this.message = new _xfa_object.XFAObjectArray();
  55416. this.numericEdit = new _xfa_object.XFAObjectArray();
  55417. this.occur = new _xfa_object.XFAObjectArray();
  55418. this.oid = new _xfa_object.XFAObjectArray();
  55419. this.oids = new _xfa_object.XFAObjectArray();
  55420. this.overflow = new _xfa_object.XFAObjectArray();
  55421. this.pageArea = new _xfa_object.XFAObjectArray();
  55422. this.pageSet = new _xfa_object.XFAObjectArray();
  55423. this.para = new _xfa_object.XFAObjectArray();
  55424. this.passwordEdit = new _xfa_object.XFAObjectArray();
  55425. this.pattern = new _xfa_object.XFAObjectArray();
  55426. this.picture = new _xfa_object.XFAObjectArray();
  55427. this.radial = new _xfa_object.XFAObjectArray();
  55428. this.reason = new _xfa_object.XFAObjectArray();
  55429. this.reasons = new _xfa_object.XFAObjectArray();
  55430. this.rectangle = new _xfa_object.XFAObjectArray();
  55431. this.ref = new _xfa_object.XFAObjectArray();
  55432. this.script = new _xfa_object.XFAObjectArray();
  55433. this.setProperty = new _xfa_object.XFAObjectArray();
  55434. this.signData = new _xfa_object.XFAObjectArray();
  55435. this.signature = new _xfa_object.XFAObjectArray();
  55436. this.signing = new _xfa_object.XFAObjectArray();
  55437. this.solid = new _xfa_object.XFAObjectArray();
  55438. this.speak = new _xfa_object.XFAObjectArray();
  55439. this.stipple = new _xfa_object.XFAObjectArray();
  55440. this.subform = new _xfa_object.XFAObjectArray();
  55441. this.subformSet = new _xfa_object.XFAObjectArray();
  55442. this.subjectDN = new _xfa_object.XFAObjectArray();
  55443. this.subjectDNs = new _xfa_object.XFAObjectArray();
  55444. this.submit = new _xfa_object.XFAObjectArray();
  55445. this.text = new _xfa_object.XFAObjectArray();
  55446. this.textEdit = new _xfa_object.XFAObjectArray();
  55447. this.time = new _xfa_object.XFAObjectArray();
  55448. this.timeStamp = new _xfa_object.XFAObjectArray();
  55449. this.toolTip = new _xfa_object.XFAObjectArray();
  55450. this.traversal = new _xfa_object.XFAObjectArray();
  55451. this.traverse = new _xfa_object.XFAObjectArray();
  55452. this.ui = new _xfa_object.XFAObjectArray();
  55453. this.validate = new _xfa_object.XFAObjectArray();
  55454. this.value = new _xfa_object.XFAObjectArray();
  55455. this.variables = new _xfa_object.XFAObjectArray();
  55456. }
  55457. }
  55458. class Radial extends _xfa_object.XFAObject {
  55459. constructor(attributes) {
  55460. super(TEMPLATE_NS_ID, "radial", true);
  55461. this.id = attributes.id || "";
  55462. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  55463. this.use = attributes.use || "";
  55464. this.usehref = attributes.usehref || "";
  55465. this.color = null;
  55466. this.extras = null;
  55467. }
  55468. [_xfa_object.$toStyle](startColor) {
  55469. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55470. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55471. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  55472. return `radial-gradient(circle at center, ${colors})`;
  55473. }
  55474. }
  55475. class Reason extends _xfa_object.StringObject {
  55476. constructor(attributes) {
  55477. super(TEMPLATE_NS_ID, "reason");
  55478. this.id = attributes.id || "";
  55479. this.name = attributes.name || "";
  55480. this.use = attributes.use || "";
  55481. this.usehref = attributes.usehref || "";
  55482. }
  55483. }
  55484. class Reasons extends _xfa_object.XFAObject {
  55485. constructor(attributes) {
  55486. super(TEMPLATE_NS_ID, "reasons", true);
  55487. this.id = attributes.id || "";
  55488. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55489. this.use = attributes.use || "";
  55490. this.usehref = attributes.usehref || "";
  55491. this.reason = new _xfa_object.XFAObjectArray();
  55492. }
  55493. }
  55494. class Rectangle extends _xfa_object.XFAObject {
  55495. constructor(attributes) {
  55496. super(TEMPLATE_NS_ID, "rectangle", true);
  55497. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55498. this.id = attributes.id || "";
  55499. this.use = attributes.use || "";
  55500. this.usehref = attributes.usehref || "";
  55501. this.corner = new _xfa_object.XFAObjectArray(4);
  55502. this.edge = new _xfa_object.XFAObjectArray(4);
  55503. this.fill = null;
  55504. }
  55505. [_xfa_object.$toHTML]() {
  55506. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  55507. const edgeStyle = edge[_xfa_object.$toStyle]();
  55508. const style = Object.create(null);
  55509. if (this.fill && this.fill.presence === "visible") {
  55510. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  55511. } else {
  55512. style.fill = "transparent";
  55513. }
  55514. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  55515. style.stroke = edgeStyle.color;
  55516. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  55517. const cornerStyle = corner[_xfa_object.$toStyle]();
  55518. const rect = {
  55519. name: "rect",
  55520. attributes: {
  55521. xmlns: SVG_NS,
  55522. width: "100%",
  55523. height: "100%",
  55524. x: 0,
  55525. y: 0,
  55526. rx: cornerStyle.radius,
  55527. ry: cornerStyle.radius,
  55528. style
  55529. }
  55530. };
  55531. const svg = {
  55532. name: "svg",
  55533. children: [rect],
  55534. attributes: {
  55535. xmlns: SVG_NS,
  55536. style: {
  55537. overflow: "visible"
  55538. },
  55539. width: "100%",
  55540. height: "100%"
  55541. }
  55542. };
  55543. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55544. if (hasMargin(parent)) {
  55545. return _utils.HTMLResult.success({
  55546. name: "div",
  55547. attributes: {
  55548. style: {
  55549. display: "inline",
  55550. width: "100%",
  55551. height: "100%"
  55552. }
  55553. },
  55554. children: [svg]
  55555. });
  55556. }
  55557. svg.attributes.style.position = "absolute";
  55558. return _utils.HTMLResult.success(svg);
  55559. }
  55560. }
  55561. class RefElement extends _xfa_object.StringObject {
  55562. constructor(attributes) {
  55563. super(TEMPLATE_NS_ID, "ref");
  55564. this.id = attributes.id || "";
  55565. this.use = attributes.use || "";
  55566. this.usehref = attributes.usehref || "";
  55567. }
  55568. }
  55569. class Script extends _xfa_object.StringObject {
  55570. constructor(attributes) {
  55571. super(TEMPLATE_NS_ID, "script");
  55572. this.binding = attributes.binding || "";
  55573. this.contentType = attributes.contentType || "";
  55574. this.id = attributes.id || "";
  55575. this.name = attributes.name || "";
  55576. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55577. this.use = attributes.use || "";
  55578. this.usehref = attributes.usehref || "";
  55579. }
  55580. }
  55581. class SetProperty extends _xfa_object.XFAObject {
  55582. constructor(attributes) {
  55583. super(TEMPLATE_NS_ID, "setProperty");
  55584. this.connection = attributes.connection || "";
  55585. this.ref = attributes.ref || "";
  55586. this.target = attributes.target || "";
  55587. }
  55588. }
  55589. exports.SetProperty = SetProperty;
  55590. class SignData extends _xfa_object.XFAObject {
  55591. constructor(attributes) {
  55592. super(TEMPLATE_NS_ID, "signData", true);
  55593. this.id = attributes.id || "";
  55594. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  55595. this.ref = attributes.ref || "";
  55596. this.target = attributes.target || "";
  55597. this.use = attributes.use || "";
  55598. this.usehref = attributes.usehref || "";
  55599. this.filter = null;
  55600. this.manifest = null;
  55601. }
  55602. }
  55603. class Signature extends _xfa_object.XFAObject {
  55604. constructor(attributes) {
  55605. super(TEMPLATE_NS_ID, "signature", true);
  55606. this.id = attributes.id || "";
  55607. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  55608. this.use = attributes.use || "";
  55609. this.usehref = attributes.usehref || "";
  55610. this.border = null;
  55611. this.extras = null;
  55612. this.filter = null;
  55613. this.manifest = null;
  55614. this.margin = null;
  55615. }
  55616. }
  55617. class Signing extends _xfa_object.XFAObject {
  55618. constructor(attributes) {
  55619. super(TEMPLATE_NS_ID, "signing", true);
  55620. this.id = attributes.id || "";
  55621. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55622. this.use = attributes.use || "";
  55623. this.usehref = attributes.usehref || "";
  55624. this.certificate = new _xfa_object.XFAObjectArray();
  55625. }
  55626. }
  55627. class Solid extends _xfa_object.XFAObject {
  55628. constructor(attributes) {
  55629. super(TEMPLATE_NS_ID, "solid", true);
  55630. this.id = attributes.id || "";
  55631. this.use = attributes.use || "";
  55632. this.usehref = attributes.usehref || "";
  55633. this.extras = null;
  55634. }
  55635. [_xfa_object.$toStyle](startColor) {
  55636. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55637. }
  55638. }
  55639. class Speak extends _xfa_object.StringObject {
  55640. constructor(attributes) {
  55641. super(TEMPLATE_NS_ID, "speak");
  55642. this.disable = (0, _utils.getInteger)({
  55643. data: attributes.disable,
  55644. defaultValue: 0,
  55645. validate: x => x === 1
  55646. });
  55647. this.id = attributes.id || "";
  55648. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  55649. this.rid = attributes.rid || "";
  55650. this.use = attributes.use || "";
  55651. this.usehref = attributes.usehref || "";
  55652. }
  55653. }
  55654. class Stipple extends _xfa_object.XFAObject {
  55655. constructor(attributes) {
  55656. super(TEMPLATE_NS_ID, "stipple", true);
  55657. this.id = attributes.id || "";
  55658. this.rate = (0, _utils.getInteger)({
  55659. data: attributes.rate,
  55660. defaultValue: 50,
  55661. validate: x => x >= 0 && x <= 100
  55662. });
  55663. this.use = attributes.use || "";
  55664. this.usehref = attributes.usehref || "";
  55665. this.color = null;
  55666. this.extras = null;
  55667. }
  55668. [_xfa_object.$toStyle](bgColor) {
  55669. const alpha = this.rate / 100;
  55670. 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));
  55671. }
  55672. }
  55673. class Subform extends _xfa_object.XFAObject {
  55674. constructor(attributes) {
  55675. super(TEMPLATE_NS_ID, "subform", true);
  55676. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55677. this.allowMacro = (0, _utils.getInteger)({
  55678. data: attributes.allowMacro,
  55679. defaultValue: 0,
  55680. validate: x => x === 1
  55681. });
  55682. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55683. this.colSpan = (0, _utils.getInteger)({
  55684. data: attributes.colSpan,
  55685. defaultValue: 1,
  55686. validate: n => n >= 1 || n === -1
  55687. });
  55688. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  55689. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55690. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55691. this.id = attributes.id || "";
  55692. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55693. this.locale = attributes.locale || "";
  55694. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55695. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55696. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  55697. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55698. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55699. this.name = attributes.name || "";
  55700. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55701. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55702. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  55703. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  55704. this.use = attributes.use || "";
  55705. this.usehref = attributes.usehref || "";
  55706. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55707. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55708. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55709. this.assist = null;
  55710. this.bind = null;
  55711. this.bookend = null;
  55712. this.border = null;
  55713. this.break = null;
  55714. this.calculate = null;
  55715. this.desc = null;
  55716. this.extras = null;
  55717. this.keep = null;
  55718. this.margin = null;
  55719. this.occur = null;
  55720. this.overflow = null;
  55721. this.pageSet = null;
  55722. this.para = null;
  55723. this.traversal = null;
  55724. this.validate = null;
  55725. this.variables = null;
  55726. this.area = new _xfa_object.XFAObjectArray();
  55727. this.breakAfter = new _xfa_object.XFAObjectArray();
  55728. this.breakBefore = new _xfa_object.XFAObjectArray();
  55729. this.connect = new _xfa_object.XFAObjectArray();
  55730. this.draw = new _xfa_object.XFAObjectArray();
  55731. this.event = new _xfa_object.XFAObjectArray();
  55732. this.exObject = new _xfa_object.XFAObjectArray();
  55733. this.exclGroup = new _xfa_object.XFAObjectArray();
  55734. this.field = new _xfa_object.XFAObjectArray();
  55735. this.proto = new _xfa_object.XFAObjectArray();
  55736. this.setProperty = new _xfa_object.XFAObjectArray();
  55737. this.subform = new _xfa_object.XFAObjectArray();
  55738. this.subformSet = new _xfa_object.XFAObjectArray();
  55739. }
  55740. [_xfa_object.$getSubformParent]() {
  55741. const parent = this[_xfa_object.$getParent]();
  55742. if (parent instanceof SubformSet) {
  55743. return parent[_xfa_object.$getSubformParent]();
  55744. }
  55745. return parent;
  55746. }
  55747. [_xfa_object.$isBindable]() {
  55748. return true;
  55749. }
  55750. [_xfa_object.$isThereMoreWidth]() {
  55751. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55752. }
  55753. *[_xfa_object.$getContainedChildren]() {
  55754. yield* getContainedChildren(this);
  55755. }
  55756. [_xfa_object.$flushHTML]() {
  55757. return (0, _layout.flushHTML)(this);
  55758. }
  55759. [_xfa_object.$addHTML](html, bbox) {
  55760. (0, _layout.addHTML)(this, html, bbox);
  55761. }
  55762. [_xfa_object.$getAvailableSpace]() {
  55763. return (0, _layout.getAvailableSpace)(this);
  55764. }
  55765. [_xfa_object.$isSplittable]() {
  55766. const parent = this[_xfa_object.$getSubformParent]();
  55767. if (!parent[_xfa_object.$isSplittable]()) {
  55768. return false;
  55769. }
  55770. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55771. return this[_xfa_object.$extra]._isSplittable;
  55772. }
  55773. if (this.layout === "position" || this.layout.includes("row")) {
  55774. this[_xfa_object.$extra]._isSplittable = false;
  55775. return false;
  55776. }
  55777. if (this.keep && this.keep.intact !== "none") {
  55778. this[_xfa_object.$extra]._isSplittable = false;
  55779. return false;
  55780. }
  55781. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55782. return false;
  55783. }
  55784. this[_xfa_object.$extra]._isSplittable = true;
  55785. return true;
  55786. }
  55787. [_xfa_object.$toHTML](availableSpace) {
  55788. setTabIndex(this);
  55789. if (this.break) {
  55790. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  55791. const node = new BreakAfter({
  55792. targetType: this.break.after,
  55793. target: this.break.afterTarget,
  55794. startNew: this.break.startNew.toString()
  55795. });
  55796. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55797. this[_xfa_object.$appendChild](node);
  55798. this.breakAfter.push(node);
  55799. }
  55800. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  55801. const node = new BreakBefore({
  55802. targetType: this.break.before,
  55803. target: this.break.beforeTarget,
  55804. startNew: this.break.startNew.toString()
  55805. });
  55806. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55807. this[_xfa_object.$appendChild](node);
  55808. this.breakBefore.push(node);
  55809. }
  55810. if (this.break.overflowTarget !== "") {
  55811. const node = new Overflow({
  55812. target: this.break.overflowTarget,
  55813. leader: this.break.overflowLeader,
  55814. trailer: this.break.overflowTrailer
  55815. });
  55816. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55817. this[_xfa_object.$appendChild](node);
  55818. this.overflow.push(node);
  55819. }
  55820. this[_xfa_object.$removeChild](this.break);
  55821. this.break = null;
  55822. }
  55823. if (this.presence === "hidden" || this.presence === "inactive") {
  55824. return _utils.HTMLResult.EMPTY;
  55825. }
  55826. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  55827. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  55828. }
  55829. if (this.breakBefore.children.length >= 1) {
  55830. const breakBefore = this.breakBefore.children[0];
  55831. if (handleBreak(breakBefore)) {
  55832. return _utils.HTMLResult.breakNode(breakBefore);
  55833. }
  55834. }
  55835. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  55836. return _utils.HTMLResult.EMPTY;
  55837. }
  55838. (0, _html_utils.fixDimensions)(this);
  55839. const children = [];
  55840. const attributes = {
  55841. id: this[_xfa_object.$uid],
  55842. class: []
  55843. };
  55844. (0, _html_utils.setAccess)(this, attributes.class);
  55845. if (!this[_xfa_object.$extra]) {
  55846. this[_xfa_object.$extra] = Object.create(null);
  55847. }
  55848. Object.assign(this[_xfa_object.$extra], {
  55849. children,
  55850. line: null,
  55851. attributes,
  55852. attempt: 0,
  55853. numberInLine: 0,
  55854. availableSpace: {
  55855. width: Math.min(this.w || Infinity, availableSpace.width),
  55856. height: Math.min(this.h || Infinity, availableSpace.height)
  55857. },
  55858. width: 0,
  55859. height: 0,
  55860. prevHeight: 0,
  55861. currentWidth: 0
  55862. });
  55863. const root = this[_xfa_object.$getTemplateRoot]();
  55864. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  55865. const isSplittable = this[_xfa_object.$isSplittable]();
  55866. if (!isSplittable) {
  55867. setFirstUnsplittable(this);
  55868. }
  55869. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55870. return _utils.HTMLResult.FAILURE;
  55871. }
  55872. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  55873. if (this.layout.includes("row")) {
  55874. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55875. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55876. this[_xfa_object.$extra].columnWidths = columnWidths;
  55877. this[_xfa_object.$extra].currentColumn = 0;
  55878. }
  55879. }
  55880. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55881. const classNames = ["xfaSubform"];
  55882. const cl = (0, _html_utils.layoutClass)(this);
  55883. if (cl) {
  55884. classNames.push(cl);
  55885. }
  55886. attributes.style = style;
  55887. attributes.class = classNames;
  55888. if (this.name) {
  55889. attributes.xfaName = this.name;
  55890. }
  55891. if (this.overflow) {
  55892. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  55893. if (overflowExtra.addLeader) {
  55894. overflowExtra.addLeader = false;
  55895. handleOverflow(this, overflowExtra.leader, availableSpace);
  55896. }
  55897. }
  55898. this[_xfa_object.$pushPara]();
  55899. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55900. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55901. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55902. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55903. this[_xfa_object.$extra].numberInLine = 0;
  55904. }
  55905. const result = this[_xfa_object.$childrenToHTML]({
  55906. filter,
  55907. include: true
  55908. });
  55909. if (result.success) {
  55910. break;
  55911. }
  55912. if (result.isBreak()) {
  55913. this[_xfa_object.$popPara]();
  55914. return result;
  55915. }
  55916. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  55917. this[_xfa_object.$extra].attempt = maxRun;
  55918. break;
  55919. }
  55920. }
  55921. this[_xfa_object.$popPara]();
  55922. if (!isSplittable) {
  55923. unsetFirstUnsplittable(this);
  55924. }
  55925. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  55926. if (this[_xfa_object.$extra].attempt === maxRun) {
  55927. if (this.overflow) {
  55928. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  55929. }
  55930. if (!isSplittable) {
  55931. delete this[_xfa_object.$extra];
  55932. }
  55933. return _utils.HTMLResult.FAILURE;
  55934. }
  55935. if (this.overflow) {
  55936. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  55937. if (overflowExtra.addTrailer) {
  55938. overflowExtra.addTrailer = false;
  55939. handleOverflow(this, overflowExtra.trailer, availableSpace);
  55940. }
  55941. }
  55942. let marginH = 0;
  55943. let marginV = 0;
  55944. if (this.margin) {
  55945. marginH = this.margin.leftInset + this.margin.rightInset;
  55946. marginV = this.margin.topInset + this.margin.bottomInset;
  55947. }
  55948. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55949. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55950. const bbox = [this.x, this.y, width, height];
  55951. if (this.w === "") {
  55952. style.width = (0, _html_utils.measureToString)(width);
  55953. }
  55954. if (this.h === "") {
  55955. style.height = (0, _html_utils.measureToString)(height);
  55956. }
  55957. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  55958. return _utils.HTMLResult.EMPTY;
  55959. }
  55960. const html = {
  55961. name: "div",
  55962. attributes,
  55963. children
  55964. };
  55965. applyAssist(this, attributes);
  55966. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55967. if (this.breakAfter.children.length >= 1) {
  55968. const breakAfter = this.breakAfter.children[0];
  55969. if (handleBreak(breakAfter)) {
  55970. this[_xfa_object.$extra].afterBreakAfter = result;
  55971. return _utils.HTMLResult.breakNode(breakAfter);
  55972. }
  55973. }
  55974. delete this[_xfa_object.$extra];
  55975. return result;
  55976. }
  55977. }
  55978. class SubformSet extends _xfa_object.XFAObject {
  55979. constructor(attributes) {
  55980. super(TEMPLATE_NS_ID, "subformSet", true);
  55981. this.id = attributes.id || "";
  55982. this.name = attributes.name || "";
  55983. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  55984. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55985. this.use = attributes.use || "";
  55986. this.usehref = attributes.usehref || "";
  55987. this.bookend = null;
  55988. this.break = null;
  55989. this.desc = null;
  55990. this.extras = null;
  55991. this.occur = null;
  55992. this.overflow = null;
  55993. this.breakAfter = new _xfa_object.XFAObjectArray();
  55994. this.breakBefore = new _xfa_object.XFAObjectArray();
  55995. this.subform = new _xfa_object.XFAObjectArray();
  55996. this.subformSet = new _xfa_object.XFAObjectArray();
  55997. }
  55998. *[_xfa_object.$getContainedChildren]() {
  55999. yield* getContainedChildren(this);
  56000. }
  56001. [_xfa_object.$getSubformParent]() {
  56002. let parent = this[_xfa_object.$getParent]();
  56003. while (!(parent instanceof Subform)) {
  56004. parent = parent[_xfa_object.$getParent]();
  56005. }
  56006. return parent;
  56007. }
  56008. [_xfa_object.$isBindable]() {
  56009. return true;
  56010. }
  56011. }
  56012. class SubjectDN extends _xfa_object.ContentObject {
  56013. constructor(attributes) {
  56014. super(TEMPLATE_NS_ID, "subjectDN");
  56015. this.delimiter = attributes.delimiter || ",";
  56016. this.id = attributes.id || "";
  56017. this.name = attributes.name || "";
  56018. this.use = attributes.use || "";
  56019. this.usehref = attributes.usehref || "";
  56020. }
  56021. [_xfa_object.$finalize]() {
  56022. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  56023. kv = kv.split("=", 2);
  56024. kv[0] = kv[0].trim();
  56025. return kv;
  56026. }));
  56027. }
  56028. }
  56029. class SubjectDNs extends _xfa_object.XFAObject {
  56030. constructor(attributes) {
  56031. super(TEMPLATE_NS_ID, "subjectDNs", true);
  56032. this.id = attributes.id || "";
  56033. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56034. this.use = attributes.use || "";
  56035. this.usehref = attributes.usehref || "";
  56036. this.subjectDN = new _xfa_object.XFAObjectArray();
  56037. }
  56038. }
  56039. class Submit extends _xfa_object.XFAObject {
  56040. constructor(attributes) {
  56041. super(TEMPLATE_NS_ID, "submit", true);
  56042. this.embedPDF = (0, _utils.getInteger)({
  56043. data: attributes.embedPDF,
  56044. defaultValue: 0,
  56045. validate: x => x === 1
  56046. });
  56047. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  56048. this.id = attributes.id || "";
  56049. this.target = attributes.target || "";
  56050. this.textEncoding = (0, _utils.getKeyword)({
  56051. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  56052. defaultValue: "",
  56053. 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}/)
  56054. });
  56055. this.use = attributes.use || "";
  56056. this.usehref = attributes.usehref || "";
  56057. this.xdpContent = attributes.xdpContent || "";
  56058. this.encrypt = null;
  56059. this.encryptData = new _xfa_object.XFAObjectArray();
  56060. this.signData = new _xfa_object.XFAObjectArray();
  56061. }
  56062. }
  56063. class Template extends _xfa_object.XFAObject {
  56064. constructor(attributes) {
  56065. super(TEMPLATE_NS_ID, "template", true);
  56066. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  56067. this.extras = null;
  56068. this.subform = new _xfa_object.XFAObjectArray();
  56069. }
  56070. [_xfa_object.$finalize]() {
  56071. if (this.subform.children.length === 0) {
  56072. (0, _util.warn)("XFA - No subforms in template node.");
  56073. }
  56074. if (this.subform.children.length >= 2) {
  56075. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  56076. }
  56077. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  56078. }
  56079. [_xfa_object.$isSplittable]() {
  56080. return true;
  56081. }
  56082. [_xfa_object.$searchNode](expr, container) {
  56083. if (expr.startsWith("#")) {
  56084. return [this[_xfa_object.$ids].get(expr.slice(1))];
  56085. }
  56086. return (0, _som.searchNode)(this, container, expr, true, true);
  56087. }
  56088. *[_xfa_object.$toPages]() {
  56089. if (!this.subform.children.length) {
  56090. return _utils.HTMLResult.success({
  56091. name: "div",
  56092. children: []
  56093. });
  56094. }
  56095. this[_xfa_object.$extra] = {
  56096. overflowNode: null,
  56097. firstUnsplittable: null,
  56098. currentContentArea: null,
  56099. currentPageArea: null,
  56100. noLayoutFailure: false,
  56101. pageNumber: 1,
  56102. pagePosition: "first",
  56103. oddOrEven: "odd",
  56104. blankOrNotBlank: "nonBlank",
  56105. paraStack: []
  56106. };
  56107. const root = this.subform.children[0];
  56108. root.pageSet[_xfa_object.$cleanPage]();
  56109. const pageAreas = root.pageSet.pageArea.children;
  56110. const mainHtml = {
  56111. name: "div",
  56112. children: []
  56113. };
  56114. let pageArea = null;
  56115. let breakBefore = null;
  56116. let breakBeforeTarget = null;
  56117. if (root.breakBefore.children.length >= 1) {
  56118. breakBefore = root.breakBefore.children[0];
  56119. breakBeforeTarget = breakBefore.target;
  56120. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  56121. breakBefore = root.subform.children[0].breakBefore.children[0];
  56122. breakBeforeTarget = breakBefore.target;
  56123. } else if (root.break && root.break.beforeTarget) {
  56124. breakBefore = root.break;
  56125. breakBeforeTarget = breakBefore.beforeTarget;
  56126. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  56127. breakBefore = root.subform.children[0].break;
  56128. breakBeforeTarget = breakBefore.beforeTarget;
  56129. }
  56130. if (breakBefore) {
  56131. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  56132. if (target instanceof PageArea) {
  56133. pageArea = target;
  56134. breakBefore[_xfa_object.$extra] = {};
  56135. }
  56136. }
  56137. if (!pageArea) {
  56138. pageArea = pageAreas[0];
  56139. }
  56140. pageArea[_xfa_object.$extra] = {
  56141. numberOfUse: 1
  56142. };
  56143. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  56144. pageAreaParent[_xfa_object.$extra] = {
  56145. numberOfUse: 1,
  56146. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  56147. pageSetIndex: 0
  56148. };
  56149. let targetPageArea;
  56150. let leader = null;
  56151. let trailer = null;
  56152. let hasSomething = true;
  56153. let hasSomethingCounter = 0;
  56154. let startIndex = 0;
  56155. while (true) {
  56156. if (!hasSomething) {
  56157. mainHtml.children.pop();
  56158. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  56159. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  56160. return mainHtml;
  56161. }
  56162. } else {
  56163. hasSomethingCounter = 0;
  56164. }
  56165. targetPageArea = null;
  56166. this[_xfa_object.$extra].currentPageArea = pageArea;
  56167. const page = pageArea[_xfa_object.$toHTML]().html;
  56168. mainHtml.children.push(page);
  56169. if (leader) {
  56170. this[_xfa_object.$extra].noLayoutFailure = true;
  56171. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  56172. leader = null;
  56173. }
  56174. if (trailer) {
  56175. this[_xfa_object.$extra].noLayoutFailure = true;
  56176. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  56177. trailer = null;
  56178. }
  56179. const contentAreas = pageArea.contentArea.children;
  56180. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  56181. hasSomething = false;
  56182. this[_xfa_object.$extra].firstUnsplittable = null;
  56183. this[_xfa_object.$extra].noLayoutFailure = false;
  56184. const flush = index => {
  56185. const html = root[_xfa_object.$flushHTML]();
  56186. if (html) {
  56187. hasSomething = hasSomething || html.children && html.children.length !== 0;
  56188. htmlContentAreas[index].children.push(html);
  56189. }
  56190. };
  56191. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  56192. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  56193. const space = {
  56194. width: contentArea.w,
  56195. height: contentArea.h
  56196. };
  56197. startIndex = 0;
  56198. if (leader) {
  56199. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  56200. leader = null;
  56201. }
  56202. if (trailer) {
  56203. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  56204. trailer = null;
  56205. }
  56206. const html = root[_xfa_object.$toHTML](space);
  56207. if (html.success) {
  56208. if (html.html) {
  56209. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  56210. htmlContentAreas[i].children.push(html.html);
  56211. } else if (!hasSomething && mainHtml.children.length > 1) {
  56212. mainHtml.children.pop();
  56213. }
  56214. return mainHtml;
  56215. }
  56216. if (html.isBreak()) {
  56217. const node = html.breakNode;
  56218. flush(i);
  56219. if (node.targetType === "auto") {
  56220. continue;
  56221. }
  56222. if (node.leader) {
  56223. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  56224. leader = leader ? leader[0] : null;
  56225. }
  56226. if (node.trailer) {
  56227. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  56228. trailer = trailer ? trailer[0] : null;
  56229. }
  56230. if (node.targetType === "pageArea") {
  56231. targetPageArea = node[_xfa_object.$extra].target;
  56232. i = Infinity;
  56233. } else if (!node[_xfa_object.$extra].target) {
  56234. i = node[_xfa_object.$extra].index;
  56235. } else {
  56236. targetPageArea = node[_xfa_object.$extra].target;
  56237. startIndex = node[_xfa_object.$extra].index + 1;
  56238. i = Infinity;
  56239. }
  56240. continue;
  56241. }
  56242. if (this[_xfa_object.$extra].overflowNode) {
  56243. const node = this[_xfa_object.$extra].overflowNode;
  56244. this[_xfa_object.$extra].overflowNode = null;
  56245. const overflowExtra = node[_xfa_object.$getExtra]();
  56246. const target = overflowExtra.target;
  56247. overflowExtra.addLeader = overflowExtra.leader !== null;
  56248. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  56249. flush(i);
  56250. const currentIndex = i;
  56251. i = Infinity;
  56252. if (target instanceof PageArea) {
  56253. targetPageArea = target;
  56254. } else if (target instanceof ContentArea) {
  56255. const index = contentAreas.findIndex(e => e === target);
  56256. if (index !== -1) {
  56257. if (index > currentIndex) {
  56258. i = index - 1;
  56259. } else {
  56260. startIndex = index;
  56261. }
  56262. } else {
  56263. targetPageArea = target[_xfa_object.$getParent]();
  56264. startIndex = targetPageArea.contentArea.children.findIndex(e => e === target);
  56265. }
  56266. }
  56267. continue;
  56268. }
  56269. flush(i);
  56270. }
  56271. this[_xfa_object.$extra].pageNumber += 1;
  56272. if (targetPageArea) {
  56273. if (targetPageArea[_xfa_object.$isUsable]()) {
  56274. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  56275. } else {
  56276. targetPageArea = null;
  56277. }
  56278. }
  56279. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  56280. yield null;
  56281. }
  56282. }
  56283. }
  56284. exports.Template = Template;
  56285. class Text extends _xfa_object.ContentObject {
  56286. constructor(attributes) {
  56287. super(TEMPLATE_NS_ID, "text");
  56288. this.id = attributes.id || "";
  56289. this.maxChars = (0, _utils.getInteger)({
  56290. data: attributes.maxChars,
  56291. defaultValue: 0,
  56292. validate: x => x >= 0
  56293. });
  56294. this.name = attributes.name || "";
  56295. this.rid = attributes.rid || "";
  56296. this.use = attributes.use || "";
  56297. this.usehref = attributes.usehref || "";
  56298. }
  56299. [_xfa_object.$acceptWhitespace]() {
  56300. return true;
  56301. }
  56302. [_xfa_object.$onChild](child) {
  56303. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56304. this[_xfa_object.$content] = child;
  56305. return true;
  56306. }
  56307. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  56308. return false;
  56309. }
  56310. [_xfa_object.$onText](str) {
  56311. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  56312. return;
  56313. }
  56314. super[_xfa_object.$onText](str);
  56315. }
  56316. [_xfa_object.$finalize]() {
  56317. if (typeof this[_xfa_object.$content] === "string") {
  56318. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  56319. }
  56320. }
  56321. [_xfa_object.$getExtra]() {
  56322. if (typeof this[_xfa_object.$content] === "string") {
  56323. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  56324. if (line) {
  56325. acc.push(line);
  56326. }
  56327. return acc;
  56328. }, []).join("\n");
  56329. }
  56330. return this[_xfa_object.$content][_xfa_object.$text]();
  56331. }
  56332. [_xfa_object.$toHTML](availableSpace) {
  56333. if (typeof this[_xfa_object.$content] === "string") {
  56334. const html = valueToHtml(this[_xfa_object.$content]).html;
  56335. if (this[_xfa_object.$content].includes("\u2029")) {
  56336. html.name = "div";
  56337. html.children = [];
  56338. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  56339. acc.push({
  56340. name: "span",
  56341. value: line
  56342. }, {
  56343. name: "br"
  56344. });
  56345. return acc;
  56346. }, [])).forEach(lines => {
  56347. html.children.push({
  56348. name: "p",
  56349. children: lines
  56350. });
  56351. });
  56352. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  56353. html.name = "div";
  56354. html.children = [];
  56355. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  56356. html.children.push({
  56357. name: "span",
  56358. value: line
  56359. }, {
  56360. name: "br"
  56361. });
  56362. });
  56363. }
  56364. return _utils.HTMLResult.success(html);
  56365. }
  56366. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  56367. }
  56368. }
  56369. exports.Text = Text;
  56370. class TextEdit extends _xfa_object.XFAObject {
  56371. constructor(attributes) {
  56372. super(TEMPLATE_NS_ID, "textEdit", true);
  56373. this.allowRichText = (0, _utils.getInteger)({
  56374. data: attributes.allowRichText,
  56375. defaultValue: 0,
  56376. validate: x => x === 1
  56377. });
  56378. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56379. this.id = attributes.id || "";
  56380. this.multiLine = (0, _utils.getInteger)({
  56381. data: attributes.multiLine,
  56382. defaultValue: "",
  56383. validate: x => x === 0 || x === 1
  56384. });
  56385. this.use = attributes.use || "";
  56386. this.usehref = attributes.usehref || "";
  56387. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  56388. this.border = null;
  56389. this.comb = null;
  56390. this.extras = null;
  56391. this.margin = null;
  56392. }
  56393. [_xfa_object.$toHTML](availableSpace) {
  56394. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56395. let html;
  56396. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56397. if (this.multiLine === "") {
  56398. this.multiLine = field instanceof Draw ? 1 : 0;
  56399. }
  56400. if (this.multiLine === 1) {
  56401. html = {
  56402. name: "textarea",
  56403. attributes: {
  56404. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56405. fieldId: field[_xfa_object.$uid],
  56406. class: ["xfaTextfield"],
  56407. style,
  56408. "aria-label": ariaLabel(field)
  56409. }
  56410. };
  56411. } else {
  56412. html = {
  56413. name: "input",
  56414. attributes: {
  56415. type: "text",
  56416. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56417. fieldId: field[_xfa_object.$uid],
  56418. class: ["xfaTextfield"],
  56419. style,
  56420. "aria-label": ariaLabel(field)
  56421. }
  56422. };
  56423. }
  56424. return _utils.HTMLResult.success({
  56425. name: "label",
  56426. attributes: {
  56427. class: ["xfaLabel"]
  56428. },
  56429. children: [html]
  56430. });
  56431. }
  56432. }
  56433. class Time extends _xfa_object.StringObject {
  56434. constructor(attributes) {
  56435. super(TEMPLATE_NS_ID, "time");
  56436. this.id = attributes.id || "";
  56437. this.name = attributes.name || "";
  56438. this.use = attributes.use || "";
  56439. this.usehref = attributes.usehref || "";
  56440. }
  56441. [_xfa_object.$finalize]() {
  56442. const date = this[_xfa_object.$content].trim();
  56443. this[_xfa_object.$content] = date ? new Date(date) : null;
  56444. }
  56445. [_xfa_object.$toHTML](availableSpace) {
  56446. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  56447. }
  56448. }
  56449. class TimeStamp extends _xfa_object.XFAObject {
  56450. constructor(attributes) {
  56451. super(TEMPLATE_NS_ID, "timeStamp");
  56452. this.id = attributes.id || "";
  56453. this.server = attributes.server || "";
  56454. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56455. this.use = attributes.use || "";
  56456. this.usehref = attributes.usehref || "";
  56457. }
  56458. }
  56459. class ToolTip extends _xfa_object.StringObject {
  56460. constructor(attributes) {
  56461. super(TEMPLATE_NS_ID, "toolTip");
  56462. this.id = attributes.id || "";
  56463. this.rid = attributes.rid || "";
  56464. this.use = attributes.use || "";
  56465. this.usehref = attributes.usehref || "";
  56466. }
  56467. }
  56468. class Traversal extends _xfa_object.XFAObject {
  56469. constructor(attributes) {
  56470. super(TEMPLATE_NS_ID, "traversal", true);
  56471. this.id = attributes.id || "";
  56472. this.use = attributes.use || "";
  56473. this.usehref = attributes.usehref || "";
  56474. this.extras = null;
  56475. this.traverse = new _xfa_object.XFAObjectArray();
  56476. }
  56477. }
  56478. class Traverse extends _xfa_object.XFAObject {
  56479. constructor(attributes) {
  56480. super(TEMPLATE_NS_ID, "traverse", true);
  56481. this.id = attributes.id || "";
  56482. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  56483. this.ref = attributes.ref || "";
  56484. this.use = attributes.use || "";
  56485. this.usehref = attributes.usehref || "";
  56486. this.extras = null;
  56487. this.script = null;
  56488. }
  56489. get name() {
  56490. return this.operation;
  56491. }
  56492. [_xfa_object.$isTransparent]() {
  56493. return false;
  56494. }
  56495. }
  56496. class Ui extends _xfa_object.XFAObject {
  56497. constructor(attributes) {
  56498. super(TEMPLATE_NS_ID, "ui", true);
  56499. this.id = attributes.id || "";
  56500. this.use = attributes.use || "";
  56501. this.usehref = attributes.usehref || "";
  56502. this.extras = null;
  56503. this.picture = null;
  56504. this.barcode = null;
  56505. this.button = null;
  56506. this.checkButton = null;
  56507. this.choiceList = null;
  56508. this.dateTimeEdit = null;
  56509. this.defaultUi = null;
  56510. this.imageEdit = null;
  56511. this.numericEdit = null;
  56512. this.passwordEdit = null;
  56513. this.signature = null;
  56514. this.textEdit = null;
  56515. }
  56516. [_xfa_object.$getExtra]() {
  56517. if (this[_xfa_object.$extra] === undefined) {
  56518. for (const name of Object.getOwnPropertyNames(this)) {
  56519. if (name === "extras" || name === "picture") {
  56520. continue;
  56521. }
  56522. const obj = this[name];
  56523. if (!(obj instanceof _xfa_object.XFAObject)) {
  56524. continue;
  56525. }
  56526. this[_xfa_object.$extra] = obj;
  56527. return obj;
  56528. }
  56529. this[_xfa_object.$extra] = null;
  56530. }
  56531. return this[_xfa_object.$extra];
  56532. }
  56533. [_xfa_object.$toHTML](availableSpace) {
  56534. const obj = this[_xfa_object.$getExtra]();
  56535. if (obj) {
  56536. return obj[_xfa_object.$toHTML](availableSpace);
  56537. }
  56538. return _utils.HTMLResult.EMPTY;
  56539. }
  56540. }
  56541. class Validate extends _xfa_object.XFAObject {
  56542. constructor(attributes) {
  56543. super(TEMPLATE_NS_ID, "validate", true);
  56544. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  56545. this.id = attributes.id || "";
  56546. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  56547. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  56548. this.use = attributes.use || "";
  56549. this.usehref = attributes.usehref || "";
  56550. this.extras = null;
  56551. this.message = null;
  56552. this.picture = null;
  56553. this.script = null;
  56554. }
  56555. }
  56556. class Value extends _xfa_object.XFAObject {
  56557. constructor(attributes) {
  56558. super(TEMPLATE_NS_ID, "value", true);
  56559. this.id = attributes.id || "";
  56560. this.override = (0, _utils.getInteger)({
  56561. data: attributes.override,
  56562. defaultValue: 0,
  56563. validate: x => x === 1
  56564. });
  56565. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56566. this.use = attributes.use || "";
  56567. this.usehref = attributes.usehref || "";
  56568. this.arc = null;
  56569. this.boolean = null;
  56570. this.date = null;
  56571. this.dateTime = null;
  56572. this.decimal = null;
  56573. this.exData = null;
  56574. this.float = null;
  56575. this.image = null;
  56576. this.integer = null;
  56577. this.line = null;
  56578. this.rectangle = null;
  56579. this.text = null;
  56580. this.time = null;
  56581. }
  56582. [_xfa_object.$setValue](value) {
  56583. const parent = this[_xfa_object.$getParent]();
  56584. if (parent instanceof Field) {
  56585. if (parent.ui && parent.ui.imageEdit) {
  56586. if (!this.image) {
  56587. this.image = new Image({});
  56588. this[_xfa_object.$appendChild](this.image);
  56589. }
  56590. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  56591. return;
  56592. }
  56593. }
  56594. const valueName = value[_xfa_object.$nodeName];
  56595. if (this[valueName] !== null) {
  56596. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  56597. return;
  56598. }
  56599. for (const name of Object.getOwnPropertyNames(this)) {
  56600. const obj = this[name];
  56601. if (obj instanceof _xfa_object.XFAObject) {
  56602. this[name] = null;
  56603. this[_xfa_object.$removeChild](obj);
  56604. }
  56605. }
  56606. this[value[_xfa_object.$nodeName]] = value;
  56607. this[_xfa_object.$appendChild](value);
  56608. }
  56609. [_xfa_object.$text]() {
  56610. if (this.exData) {
  56611. if (typeof this.exData[_xfa_object.$content] === "string") {
  56612. return this.exData[_xfa_object.$content].trim();
  56613. }
  56614. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  56615. }
  56616. for (const name of Object.getOwnPropertyNames(this)) {
  56617. if (name === "image") {
  56618. continue;
  56619. }
  56620. const obj = this[name];
  56621. if (obj instanceof _xfa_object.XFAObject) {
  56622. return (obj[_xfa_object.$content] || "").toString().trim();
  56623. }
  56624. }
  56625. return null;
  56626. }
  56627. [_xfa_object.$toHTML](availableSpace) {
  56628. for (const name of Object.getOwnPropertyNames(this)) {
  56629. const obj = this[name];
  56630. if (!(obj instanceof _xfa_object.XFAObject)) {
  56631. continue;
  56632. }
  56633. return obj[_xfa_object.$toHTML](availableSpace);
  56634. }
  56635. return _utils.HTMLResult.EMPTY;
  56636. }
  56637. }
  56638. exports.Value = Value;
  56639. class Variables extends _xfa_object.XFAObject {
  56640. constructor(attributes) {
  56641. super(TEMPLATE_NS_ID, "variables", true);
  56642. this.id = attributes.id || "";
  56643. this.use = attributes.use || "";
  56644. this.usehref = attributes.usehref || "";
  56645. this.boolean = new _xfa_object.XFAObjectArray();
  56646. this.date = new _xfa_object.XFAObjectArray();
  56647. this.dateTime = new _xfa_object.XFAObjectArray();
  56648. this.decimal = new _xfa_object.XFAObjectArray();
  56649. this.exData = new _xfa_object.XFAObjectArray();
  56650. this.float = new _xfa_object.XFAObjectArray();
  56651. this.image = new _xfa_object.XFAObjectArray();
  56652. this.integer = new _xfa_object.XFAObjectArray();
  56653. this.manifest = new _xfa_object.XFAObjectArray();
  56654. this.script = new _xfa_object.XFAObjectArray();
  56655. this.text = new _xfa_object.XFAObjectArray();
  56656. this.time = new _xfa_object.XFAObjectArray();
  56657. }
  56658. [_xfa_object.$isTransparent]() {
  56659. return true;
  56660. }
  56661. }
  56662. class TemplateNamespace {
  56663. static [_namespaces.$buildXFAObject](name, attributes) {
  56664. if (TemplateNamespace.hasOwnProperty(name)) {
  56665. const node = TemplateNamespace[name](attributes);
  56666. node[_xfa_object.$setSetAttributes](attributes);
  56667. return node;
  56668. }
  56669. return undefined;
  56670. }
  56671. static appearanceFilter(attrs) {
  56672. return new AppearanceFilter(attrs);
  56673. }
  56674. static arc(attrs) {
  56675. return new Arc(attrs);
  56676. }
  56677. static area(attrs) {
  56678. return new Area(attrs);
  56679. }
  56680. static assist(attrs) {
  56681. return new Assist(attrs);
  56682. }
  56683. static barcode(attrs) {
  56684. return new Barcode(attrs);
  56685. }
  56686. static bind(attrs) {
  56687. return new Bind(attrs);
  56688. }
  56689. static bindItems(attrs) {
  56690. return new BindItems(attrs);
  56691. }
  56692. static bookend(attrs) {
  56693. return new Bookend(attrs);
  56694. }
  56695. static boolean(attrs) {
  56696. return new BooleanElement(attrs);
  56697. }
  56698. static border(attrs) {
  56699. return new Border(attrs);
  56700. }
  56701. static break(attrs) {
  56702. return new Break(attrs);
  56703. }
  56704. static breakAfter(attrs) {
  56705. return new BreakAfter(attrs);
  56706. }
  56707. static breakBefore(attrs) {
  56708. return new BreakBefore(attrs);
  56709. }
  56710. static button(attrs) {
  56711. return new Button(attrs);
  56712. }
  56713. static calculate(attrs) {
  56714. return new Calculate(attrs);
  56715. }
  56716. static caption(attrs) {
  56717. return new Caption(attrs);
  56718. }
  56719. static certificate(attrs) {
  56720. return new Certificate(attrs);
  56721. }
  56722. static certificates(attrs) {
  56723. return new Certificates(attrs);
  56724. }
  56725. static checkButton(attrs) {
  56726. return new CheckButton(attrs);
  56727. }
  56728. static choiceList(attrs) {
  56729. return new ChoiceList(attrs);
  56730. }
  56731. static color(attrs) {
  56732. return new Color(attrs);
  56733. }
  56734. static comb(attrs) {
  56735. return new Comb(attrs);
  56736. }
  56737. static connect(attrs) {
  56738. return new Connect(attrs);
  56739. }
  56740. static contentArea(attrs) {
  56741. return new ContentArea(attrs);
  56742. }
  56743. static corner(attrs) {
  56744. return new Corner(attrs);
  56745. }
  56746. static date(attrs) {
  56747. return new DateElement(attrs);
  56748. }
  56749. static dateTime(attrs) {
  56750. return new DateTime(attrs);
  56751. }
  56752. static dateTimeEdit(attrs) {
  56753. return new DateTimeEdit(attrs);
  56754. }
  56755. static decimal(attrs) {
  56756. return new Decimal(attrs);
  56757. }
  56758. static defaultUi(attrs) {
  56759. return new DefaultUi(attrs);
  56760. }
  56761. static desc(attrs) {
  56762. return new Desc(attrs);
  56763. }
  56764. static digestMethod(attrs) {
  56765. return new DigestMethod(attrs);
  56766. }
  56767. static digestMethods(attrs) {
  56768. return new DigestMethods(attrs);
  56769. }
  56770. static draw(attrs) {
  56771. return new Draw(attrs);
  56772. }
  56773. static edge(attrs) {
  56774. return new Edge(attrs);
  56775. }
  56776. static encoding(attrs) {
  56777. return new Encoding(attrs);
  56778. }
  56779. static encodings(attrs) {
  56780. return new Encodings(attrs);
  56781. }
  56782. static encrypt(attrs) {
  56783. return new Encrypt(attrs);
  56784. }
  56785. static encryptData(attrs) {
  56786. return new EncryptData(attrs);
  56787. }
  56788. static encryption(attrs) {
  56789. return new Encryption(attrs);
  56790. }
  56791. static encryptionMethod(attrs) {
  56792. return new EncryptionMethod(attrs);
  56793. }
  56794. static encryptionMethods(attrs) {
  56795. return new EncryptionMethods(attrs);
  56796. }
  56797. static event(attrs) {
  56798. return new Event(attrs);
  56799. }
  56800. static exData(attrs) {
  56801. return new ExData(attrs);
  56802. }
  56803. static exObject(attrs) {
  56804. return new ExObject(attrs);
  56805. }
  56806. static exclGroup(attrs) {
  56807. return new ExclGroup(attrs);
  56808. }
  56809. static execute(attrs) {
  56810. return new Execute(attrs);
  56811. }
  56812. static extras(attrs) {
  56813. return new Extras(attrs);
  56814. }
  56815. static field(attrs) {
  56816. return new Field(attrs);
  56817. }
  56818. static fill(attrs) {
  56819. return new Fill(attrs);
  56820. }
  56821. static filter(attrs) {
  56822. return new Filter(attrs);
  56823. }
  56824. static float(attrs) {
  56825. return new Float(attrs);
  56826. }
  56827. static font(attrs) {
  56828. return new Font(attrs);
  56829. }
  56830. static format(attrs) {
  56831. return new Format(attrs);
  56832. }
  56833. static handler(attrs) {
  56834. return new Handler(attrs);
  56835. }
  56836. static hyphenation(attrs) {
  56837. return new Hyphenation(attrs);
  56838. }
  56839. static image(attrs) {
  56840. return new Image(attrs);
  56841. }
  56842. static imageEdit(attrs) {
  56843. return new ImageEdit(attrs);
  56844. }
  56845. static integer(attrs) {
  56846. return new Integer(attrs);
  56847. }
  56848. static issuers(attrs) {
  56849. return new Issuers(attrs);
  56850. }
  56851. static items(attrs) {
  56852. return new Items(attrs);
  56853. }
  56854. static keep(attrs) {
  56855. return new Keep(attrs);
  56856. }
  56857. static keyUsage(attrs) {
  56858. return new KeyUsage(attrs);
  56859. }
  56860. static line(attrs) {
  56861. return new Line(attrs);
  56862. }
  56863. static linear(attrs) {
  56864. return new Linear(attrs);
  56865. }
  56866. static lockDocument(attrs) {
  56867. return new LockDocument(attrs);
  56868. }
  56869. static manifest(attrs) {
  56870. return new Manifest(attrs);
  56871. }
  56872. static margin(attrs) {
  56873. return new Margin(attrs);
  56874. }
  56875. static mdp(attrs) {
  56876. return new Mdp(attrs);
  56877. }
  56878. static medium(attrs) {
  56879. return new Medium(attrs);
  56880. }
  56881. static message(attrs) {
  56882. return new Message(attrs);
  56883. }
  56884. static numericEdit(attrs) {
  56885. return new NumericEdit(attrs);
  56886. }
  56887. static occur(attrs) {
  56888. return new Occur(attrs);
  56889. }
  56890. static oid(attrs) {
  56891. return new Oid(attrs);
  56892. }
  56893. static oids(attrs) {
  56894. return new Oids(attrs);
  56895. }
  56896. static overflow(attrs) {
  56897. return new Overflow(attrs);
  56898. }
  56899. static pageArea(attrs) {
  56900. return new PageArea(attrs);
  56901. }
  56902. static pageSet(attrs) {
  56903. return new PageSet(attrs);
  56904. }
  56905. static para(attrs) {
  56906. return new Para(attrs);
  56907. }
  56908. static passwordEdit(attrs) {
  56909. return new PasswordEdit(attrs);
  56910. }
  56911. static pattern(attrs) {
  56912. return new Pattern(attrs);
  56913. }
  56914. static picture(attrs) {
  56915. return new Picture(attrs);
  56916. }
  56917. static proto(attrs) {
  56918. return new Proto(attrs);
  56919. }
  56920. static radial(attrs) {
  56921. return new Radial(attrs);
  56922. }
  56923. static reason(attrs) {
  56924. return new Reason(attrs);
  56925. }
  56926. static reasons(attrs) {
  56927. return new Reasons(attrs);
  56928. }
  56929. static rectangle(attrs) {
  56930. return new Rectangle(attrs);
  56931. }
  56932. static ref(attrs) {
  56933. return new RefElement(attrs);
  56934. }
  56935. static script(attrs) {
  56936. return new Script(attrs);
  56937. }
  56938. static setProperty(attrs) {
  56939. return new SetProperty(attrs);
  56940. }
  56941. static signData(attrs) {
  56942. return new SignData(attrs);
  56943. }
  56944. static signature(attrs) {
  56945. return new Signature(attrs);
  56946. }
  56947. static signing(attrs) {
  56948. return new Signing(attrs);
  56949. }
  56950. static solid(attrs) {
  56951. return new Solid(attrs);
  56952. }
  56953. static speak(attrs) {
  56954. return new Speak(attrs);
  56955. }
  56956. static stipple(attrs) {
  56957. return new Stipple(attrs);
  56958. }
  56959. static subform(attrs) {
  56960. return new Subform(attrs);
  56961. }
  56962. static subformSet(attrs) {
  56963. return new SubformSet(attrs);
  56964. }
  56965. static subjectDN(attrs) {
  56966. return new SubjectDN(attrs);
  56967. }
  56968. static subjectDNs(attrs) {
  56969. return new SubjectDNs(attrs);
  56970. }
  56971. static submit(attrs) {
  56972. return new Submit(attrs);
  56973. }
  56974. static template(attrs) {
  56975. return new Template(attrs);
  56976. }
  56977. static text(attrs) {
  56978. return new Text(attrs);
  56979. }
  56980. static textEdit(attrs) {
  56981. return new TextEdit(attrs);
  56982. }
  56983. static time(attrs) {
  56984. return new Time(attrs);
  56985. }
  56986. static timeStamp(attrs) {
  56987. return new TimeStamp(attrs);
  56988. }
  56989. static toolTip(attrs) {
  56990. return new ToolTip(attrs);
  56991. }
  56992. static traversal(attrs) {
  56993. return new Traversal(attrs);
  56994. }
  56995. static traverse(attrs) {
  56996. return new Traverse(attrs);
  56997. }
  56998. static ui(attrs) {
  56999. return new Ui(attrs);
  57000. }
  57001. static validate(attrs) {
  57002. return new Validate(attrs);
  57003. }
  57004. static value(attrs) {
  57005. return new Value(attrs);
  57006. }
  57007. static variables(attrs) {
  57008. return new Variables(attrs);
  57009. }
  57010. }
  57011. exports.TemplateNamespace = TemplateNamespace;
  57012. /***/ }),
  57013. /* 82 */
  57014. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57015. Object.defineProperty(exports, "__esModule", ({
  57016. value: true
  57017. }));
  57018. exports.addHTML = addHTML;
  57019. exports.checkDimensions = checkDimensions;
  57020. exports.flushHTML = flushHTML;
  57021. exports.getAvailableSpace = getAvailableSpace;
  57022. var _xfa_object = __w_pdfjs_require__(76);
  57023. var _html_utils = __w_pdfjs_require__(83);
  57024. function createLine(node, children) {
  57025. return {
  57026. name: "div",
  57027. attributes: {
  57028. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  57029. },
  57030. children
  57031. };
  57032. }
  57033. function flushHTML(node) {
  57034. if (!node[_xfa_object.$extra]) {
  57035. return null;
  57036. }
  57037. const attributes = node[_xfa_object.$extra].attributes;
  57038. const html = {
  57039. name: "div",
  57040. attributes,
  57041. children: node[_xfa_object.$extra].children
  57042. };
  57043. if (node[_xfa_object.$extra].failingNode) {
  57044. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  57045. if (htmlFromFailing) {
  57046. if (node.layout.endsWith("-tb")) {
  57047. html.children.push(createLine(node, [htmlFromFailing]));
  57048. } else {
  57049. html.children.push(htmlFromFailing);
  57050. }
  57051. }
  57052. }
  57053. if (html.children.length === 0) {
  57054. return null;
  57055. }
  57056. return html;
  57057. }
  57058. function addHTML(node, html, bbox) {
  57059. const extra = node[_xfa_object.$extra];
  57060. const availableSpace = extra.availableSpace;
  57061. const [x, y, w, h] = bbox;
  57062. switch (node.layout) {
  57063. case "position":
  57064. {
  57065. extra.width = Math.max(extra.width, x + w);
  57066. extra.height = Math.max(extra.height, y + h);
  57067. extra.children.push(html);
  57068. break;
  57069. }
  57070. case "lr-tb":
  57071. case "rl-tb":
  57072. if (!extra.line || extra.attempt === 1) {
  57073. extra.line = createLine(node, []);
  57074. extra.children.push(extra.line);
  57075. extra.numberInLine = 0;
  57076. }
  57077. extra.numberInLine += 1;
  57078. extra.line.children.push(html);
  57079. if (extra.attempt === 0) {
  57080. extra.currentWidth += w;
  57081. extra.height = Math.max(extra.height, extra.prevHeight + h);
  57082. } else {
  57083. extra.currentWidth = w;
  57084. extra.prevHeight = extra.height;
  57085. extra.height += h;
  57086. extra.attempt = 0;
  57087. }
  57088. extra.width = Math.max(extra.width, extra.currentWidth);
  57089. break;
  57090. case "rl-row":
  57091. case "row":
  57092. {
  57093. extra.children.push(html);
  57094. extra.width += w;
  57095. extra.height = Math.max(extra.height, h);
  57096. const height = (0, _html_utils.measureToString)(extra.height);
  57097. for (const child of extra.children) {
  57098. child.attributes.style.height = height;
  57099. }
  57100. break;
  57101. }
  57102. case "table":
  57103. {
  57104. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  57105. extra.height += h;
  57106. extra.children.push(html);
  57107. break;
  57108. }
  57109. case "tb":
  57110. {
  57111. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  57112. extra.height += h;
  57113. extra.children.push(html);
  57114. break;
  57115. }
  57116. }
  57117. }
  57118. function getAvailableSpace(node) {
  57119. const availableSpace = node[_xfa_object.$extra].availableSpace;
  57120. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  57121. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  57122. switch (node.layout) {
  57123. case "lr-tb":
  57124. case "rl-tb":
  57125. if (node[_xfa_object.$extra].attempt === 0) {
  57126. return {
  57127. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  57128. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  57129. };
  57130. }
  57131. return {
  57132. width: availableSpace.width - marginH,
  57133. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  57134. };
  57135. case "rl-row":
  57136. case "row":
  57137. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  57138. return {
  57139. width,
  57140. height: availableSpace.height - marginH
  57141. };
  57142. case "table":
  57143. case "tb":
  57144. return {
  57145. width: availableSpace.width - marginH,
  57146. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  57147. };
  57148. case "position":
  57149. default:
  57150. return availableSpace;
  57151. }
  57152. }
  57153. function getTransformedBBox(node) {
  57154. let w = node.w === "" ? NaN : node.w;
  57155. let h = node.h === "" ? NaN : node.h;
  57156. let [centerX, centerY] = [0, 0];
  57157. switch (node.anchorType || "") {
  57158. case "bottomCenter":
  57159. [centerX, centerY] = [w / 2, h];
  57160. break;
  57161. case "bottomLeft":
  57162. [centerX, centerY] = [0, h];
  57163. break;
  57164. case "bottomRight":
  57165. [centerX, centerY] = [w, h];
  57166. break;
  57167. case "middleCenter":
  57168. [centerX, centerY] = [w / 2, h / 2];
  57169. break;
  57170. case "middleLeft":
  57171. [centerX, centerY] = [0, h / 2];
  57172. break;
  57173. case "middleRight":
  57174. [centerX, centerY] = [w, h / 2];
  57175. break;
  57176. case "topCenter":
  57177. [centerX, centerY] = [w / 2, 0];
  57178. break;
  57179. case "topRight":
  57180. [centerX, centerY] = [w, 0];
  57181. break;
  57182. }
  57183. let x, y;
  57184. switch (node.rotate || 0) {
  57185. case 0:
  57186. [x, y] = [-centerX, -centerY];
  57187. break;
  57188. case 90:
  57189. [x, y] = [-centerY, centerX];
  57190. [w, h] = [h, -w];
  57191. break;
  57192. case 180:
  57193. [x, y] = [centerX, centerY];
  57194. [w, h] = [-w, -h];
  57195. break;
  57196. case 270:
  57197. [x, y] = [centerY, -centerX];
  57198. [w, h] = [-h, w];
  57199. break;
  57200. }
  57201. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  57202. }
  57203. function checkDimensions(node, space) {
  57204. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  57205. return true;
  57206. }
  57207. if (node.w === 0 || node.h === 0) {
  57208. return true;
  57209. }
  57210. const ERROR = 2;
  57211. const parent = node[_xfa_object.$getSubformParent]();
  57212. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  57213. const [, y, w, h] = getTransformedBBox(node);
  57214. switch (parent.layout) {
  57215. case "lr-tb":
  57216. case "rl-tb":
  57217. if (attempt === 0) {
  57218. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57219. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57220. return false;
  57221. }
  57222. if (node.w !== "") {
  57223. if (Math.round(w - space.width) <= ERROR) {
  57224. return true;
  57225. }
  57226. if (parent[_xfa_object.$extra].numberInLine === 0) {
  57227. return space.height > ERROR;
  57228. }
  57229. return false;
  57230. }
  57231. return space.width > ERROR;
  57232. }
  57233. if (node.w !== "") {
  57234. return Math.round(w - space.width) <= ERROR;
  57235. }
  57236. return space.width > ERROR;
  57237. }
  57238. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57239. return true;
  57240. }
  57241. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57242. return false;
  57243. }
  57244. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57245. return space.height > ERROR;
  57246. }
  57247. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57248. return false;
  57249. }
  57250. return space.height > ERROR;
  57251. case "table":
  57252. case "tb":
  57253. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57254. return true;
  57255. }
  57256. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  57257. return Math.round(h - space.height) <= ERROR;
  57258. }
  57259. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57260. return space.height > ERROR;
  57261. }
  57262. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57263. return false;
  57264. }
  57265. return space.height > ERROR;
  57266. case "position":
  57267. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57268. return true;
  57269. }
  57270. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  57271. return true;
  57272. }
  57273. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  57274. return h + y > area.h;
  57275. case "rl-row":
  57276. case "row":
  57277. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57278. return true;
  57279. }
  57280. if (node.h !== "") {
  57281. return Math.round(h - space.height) <= ERROR;
  57282. }
  57283. return true;
  57284. default:
  57285. return true;
  57286. }
  57287. }
  57288. /***/ }),
  57289. /* 83 */
  57290. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57291. Object.defineProperty(exports, "__esModule", ({
  57292. value: true
  57293. }));
  57294. exports.computeBbox = computeBbox;
  57295. exports.createWrapper = createWrapper;
  57296. exports.fixDimensions = fixDimensions;
  57297. exports.fixTextIndent = fixTextIndent;
  57298. exports.fixURL = fixURL;
  57299. exports.isPrintOnly = isPrintOnly;
  57300. exports.layoutClass = layoutClass;
  57301. exports.layoutNode = layoutNode;
  57302. exports.measureToString = measureToString;
  57303. exports.setAccess = setAccess;
  57304. exports.setFontFamily = setFontFamily;
  57305. exports.setMinMaxDimensions = setMinMaxDimensions;
  57306. exports.setPara = setPara;
  57307. exports.toStyle = toStyle;
  57308. var _xfa_object = __w_pdfjs_require__(76);
  57309. var _util = __w_pdfjs_require__(2);
  57310. var _utils = __w_pdfjs_require__(77);
  57311. var _fonts = __w_pdfjs_require__(84);
  57312. var _text = __w_pdfjs_require__(85);
  57313. function measureToString(m) {
  57314. if (typeof m === "string") {
  57315. return "0px";
  57316. }
  57317. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  57318. }
  57319. const converters = {
  57320. anchorType(node, style) {
  57321. const parent = node[_xfa_object.$getSubformParent]();
  57322. if (!parent || parent.layout && parent.layout !== "position") {
  57323. return;
  57324. }
  57325. if (!("transform" in style)) {
  57326. style.transform = "";
  57327. }
  57328. switch (node.anchorType) {
  57329. case "bottomCenter":
  57330. style.transform += "translate(-50%, -100%)";
  57331. break;
  57332. case "bottomLeft":
  57333. style.transform += "translate(0,-100%)";
  57334. break;
  57335. case "bottomRight":
  57336. style.transform += "translate(-100%,-100%)";
  57337. break;
  57338. case "middleCenter":
  57339. style.transform += "translate(-50%,-50%)";
  57340. break;
  57341. case "middleLeft":
  57342. style.transform += "translate(0,-50%)";
  57343. break;
  57344. case "middleRight":
  57345. style.transform += "translate(-100%,-50%)";
  57346. break;
  57347. case "topCenter":
  57348. style.transform += "translate(-50%,0)";
  57349. break;
  57350. case "topRight":
  57351. style.transform += "translate(-100%,0)";
  57352. break;
  57353. }
  57354. },
  57355. dimensions(node, style) {
  57356. const parent = node[_xfa_object.$getSubformParent]();
  57357. let width = node.w;
  57358. const height = node.h;
  57359. if (parent.layout && parent.layout.includes("row")) {
  57360. const extra = parent[_xfa_object.$extra];
  57361. const colSpan = node.colSpan;
  57362. let w;
  57363. if (colSpan === -1) {
  57364. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  57365. extra.currentColumn = 0;
  57366. } else {
  57367. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  57368. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  57369. }
  57370. if (!isNaN(w)) {
  57371. width = node.w = w;
  57372. }
  57373. }
  57374. if (width !== "") {
  57375. style.width = measureToString(width);
  57376. } else {
  57377. style.width = "auto";
  57378. }
  57379. if (height !== "") {
  57380. style.height = measureToString(height);
  57381. } else {
  57382. style.height = "auto";
  57383. }
  57384. },
  57385. position(node, style) {
  57386. const parent = node[_xfa_object.$getSubformParent]();
  57387. if (parent && parent.layout && parent.layout !== "position") {
  57388. return;
  57389. }
  57390. style.position = "absolute";
  57391. style.left = measureToString(node.x);
  57392. style.top = measureToString(node.y);
  57393. },
  57394. rotate(node, style) {
  57395. if (node.rotate) {
  57396. if (!("transform" in style)) {
  57397. style.transform = "";
  57398. }
  57399. style.transform += `rotate(-${node.rotate}deg)`;
  57400. style.transformOrigin = "top left";
  57401. }
  57402. },
  57403. presence(node, style) {
  57404. switch (node.presence) {
  57405. case "invisible":
  57406. style.visibility = "hidden";
  57407. break;
  57408. case "hidden":
  57409. case "inactive":
  57410. style.display = "none";
  57411. break;
  57412. }
  57413. },
  57414. hAlign(node, style) {
  57415. if (node[_xfa_object.$nodeName] === "para") {
  57416. switch (node.hAlign) {
  57417. case "justifyAll":
  57418. style.textAlign = "justify-all";
  57419. break;
  57420. case "radix":
  57421. style.textAlign = "left";
  57422. break;
  57423. default:
  57424. style.textAlign = node.hAlign;
  57425. }
  57426. } else {
  57427. switch (node.hAlign) {
  57428. case "left":
  57429. style.alignSelf = "start";
  57430. break;
  57431. case "center":
  57432. style.alignSelf = "center";
  57433. break;
  57434. case "right":
  57435. style.alignSelf = "end";
  57436. break;
  57437. }
  57438. }
  57439. },
  57440. margin(node, style) {
  57441. if (node.margin) {
  57442. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  57443. }
  57444. }
  57445. };
  57446. function setMinMaxDimensions(node, style) {
  57447. const parent = node[_xfa_object.$getSubformParent]();
  57448. if (parent.layout === "position") {
  57449. if (node.minW > 0) {
  57450. style.minWidth = measureToString(node.minW);
  57451. }
  57452. if (node.maxW > 0) {
  57453. style.maxWidth = measureToString(node.maxW);
  57454. }
  57455. if (node.minH > 0) {
  57456. style.minHeight = measureToString(node.minH);
  57457. }
  57458. if (node.maxH > 0) {
  57459. style.maxHeight = measureToString(node.maxH);
  57460. }
  57461. }
  57462. }
  57463. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  57464. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  57465. if (typeof text === "string") {
  57466. measure.addString(text);
  57467. } else {
  57468. text[_xfa_object.$pushGlyphs](measure);
  57469. }
  57470. return measure.compute(width);
  57471. }
  57472. function layoutNode(node, availableSpace) {
  57473. let height = null;
  57474. let width = null;
  57475. let isBroken = false;
  57476. if ((!node.w || !node.h) && node.value) {
  57477. let marginH = 0;
  57478. let marginV = 0;
  57479. if (node.margin) {
  57480. marginH = node.margin.leftInset + node.margin.rightInset;
  57481. marginV = node.margin.topInset + node.margin.bottomInset;
  57482. }
  57483. let lineHeight = null;
  57484. let margin = null;
  57485. if (node.para) {
  57486. margin = Object.create(null);
  57487. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  57488. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  57489. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  57490. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  57491. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  57492. }
  57493. let font = node.font;
  57494. if (!font) {
  57495. const root = node[_xfa_object.$getTemplateRoot]();
  57496. let parent = node[_xfa_object.$getParent]();
  57497. while (parent && parent !== root) {
  57498. if (parent.font) {
  57499. font = parent.font;
  57500. break;
  57501. }
  57502. parent = parent[_xfa_object.$getParent]();
  57503. }
  57504. }
  57505. const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH;
  57506. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  57507. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  57508. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  57509. width = res.width;
  57510. height = res.height;
  57511. isBroken = res.isBroken;
  57512. } else {
  57513. const text = node.value[_xfa_object.$text]();
  57514. if (text) {
  57515. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  57516. width = res.width;
  57517. height = res.height;
  57518. isBroken = res.isBroken;
  57519. }
  57520. }
  57521. if (width !== null && !node.w) {
  57522. width += marginH;
  57523. }
  57524. if (height !== null && !node.h) {
  57525. height += marginV;
  57526. }
  57527. }
  57528. return {
  57529. w: width,
  57530. h: height,
  57531. isBroken
  57532. };
  57533. }
  57534. function computeBbox(node, html, availableSpace) {
  57535. let bbox;
  57536. if (node.w !== "" && node.h !== "") {
  57537. bbox = [node.x, node.y, node.w, node.h];
  57538. } else {
  57539. if (!availableSpace) {
  57540. return null;
  57541. }
  57542. let width = node.w;
  57543. if (width === "") {
  57544. if (node.maxW === 0) {
  57545. const parent = node[_xfa_object.$getSubformParent]();
  57546. if (parent.layout === "position" && parent.w !== "") {
  57547. width = 0;
  57548. } else {
  57549. width = node.minW;
  57550. }
  57551. } else {
  57552. width = Math.min(node.maxW, availableSpace.width);
  57553. }
  57554. html.attributes.style.width = measureToString(width);
  57555. }
  57556. let height = node.h;
  57557. if (height === "") {
  57558. if (node.maxH === 0) {
  57559. const parent = node[_xfa_object.$getSubformParent]();
  57560. if (parent.layout === "position" && parent.h !== "") {
  57561. height = 0;
  57562. } else {
  57563. height = node.minH;
  57564. }
  57565. } else {
  57566. height = Math.min(node.maxH, availableSpace.height);
  57567. }
  57568. html.attributes.style.height = measureToString(height);
  57569. }
  57570. bbox = [node.x, node.y, width, height];
  57571. }
  57572. return bbox;
  57573. }
  57574. function fixDimensions(node) {
  57575. const parent = node[_xfa_object.$getSubformParent]();
  57576. if (parent.layout && parent.layout.includes("row")) {
  57577. const extra = parent[_xfa_object.$extra];
  57578. const colSpan = node.colSpan;
  57579. let width;
  57580. if (colSpan === -1) {
  57581. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  57582. } else {
  57583. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  57584. }
  57585. if (!isNaN(width)) {
  57586. node.w = width;
  57587. }
  57588. }
  57589. if (parent.layout && parent.layout !== "position") {
  57590. node.x = node.y = 0;
  57591. }
  57592. if (node.layout === "table") {
  57593. if (node.w === "" && Array.isArray(node.columnWidths)) {
  57594. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  57595. }
  57596. }
  57597. }
  57598. function layoutClass(node) {
  57599. switch (node.layout) {
  57600. case "position":
  57601. return "xfaPosition";
  57602. case "lr-tb":
  57603. return "xfaLrTb";
  57604. case "rl-row":
  57605. return "xfaRlRow";
  57606. case "rl-tb":
  57607. return "xfaRlTb";
  57608. case "row":
  57609. return "xfaRow";
  57610. case "table":
  57611. return "xfaTable";
  57612. case "tb":
  57613. return "xfaTb";
  57614. default:
  57615. return "xfaPosition";
  57616. }
  57617. }
  57618. function toStyle(node, ...names) {
  57619. const style = Object.create(null);
  57620. for (const name of names) {
  57621. const value = node[name];
  57622. if (value === null) {
  57623. continue;
  57624. }
  57625. if (converters.hasOwnProperty(name)) {
  57626. converters[name](node, style);
  57627. continue;
  57628. }
  57629. if (value instanceof _xfa_object.XFAObject) {
  57630. const newStyle = value[_xfa_object.$toStyle]();
  57631. if (newStyle) {
  57632. Object.assign(style, newStyle);
  57633. } else {
  57634. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  57635. }
  57636. }
  57637. }
  57638. return style;
  57639. }
  57640. function createWrapper(node, html) {
  57641. const {
  57642. attributes
  57643. } = html;
  57644. const {
  57645. style
  57646. } = attributes;
  57647. const wrapper = {
  57648. name: "div",
  57649. attributes: {
  57650. class: ["xfaWrapper"],
  57651. style: Object.create(null)
  57652. },
  57653. children: []
  57654. };
  57655. attributes.class.push("xfaWrapped");
  57656. if (node.border) {
  57657. const {
  57658. widths,
  57659. insets
  57660. } = node.border[_xfa_object.$extra];
  57661. let width, height;
  57662. let top = insets[0];
  57663. let left = insets[3];
  57664. const insetsH = insets[0] + insets[2];
  57665. const insetsW = insets[1] + insets[3];
  57666. switch (node.border.hand) {
  57667. case "even":
  57668. top -= widths[0] / 2;
  57669. left -= widths[3] / 2;
  57670. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  57671. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  57672. break;
  57673. case "left":
  57674. top -= widths[0];
  57675. left -= widths[3];
  57676. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  57677. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  57678. break;
  57679. case "right":
  57680. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  57681. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  57682. break;
  57683. }
  57684. const classNames = ["xfaBorder"];
  57685. if (isPrintOnly(node.border)) {
  57686. classNames.push("xfaPrintOnly");
  57687. }
  57688. const border = {
  57689. name: "div",
  57690. attributes: {
  57691. class: classNames,
  57692. style: {
  57693. top: `${top}px`,
  57694. left: `${left}px`,
  57695. width,
  57696. height
  57697. }
  57698. },
  57699. children: []
  57700. };
  57701. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  57702. if (style[key] !== undefined) {
  57703. border.attributes.style[key] = style[key];
  57704. delete style[key];
  57705. }
  57706. }
  57707. wrapper.children.push(border, html);
  57708. } else {
  57709. wrapper.children.push(html);
  57710. }
  57711. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  57712. if (style[key] !== undefined) {
  57713. wrapper.attributes.style[key] = style[key];
  57714. delete style[key];
  57715. }
  57716. }
  57717. if (style.position === "absolute") {
  57718. wrapper.attributes.style.position = "absolute";
  57719. } else {
  57720. wrapper.attributes.style.position = "relative";
  57721. }
  57722. delete style.position;
  57723. if (style.alignSelf) {
  57724. wrapper.attributes.style.alignSelf = style.alignSelf;
  57725. delete style.alignSelf;
  57726. }
  57727. return wrapper;
  57728. }
  57729. function fixTextIndent(styles) {
  57730. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  57731. if (indent >= 0) {
  57732. return;
  57733. }
  57734. const align = styles.textAlign === "right" ? "right" : "left";
  57735. const name = "padding" + (align === "left" ? "Left" : "Right");
  57736. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  57737. styles[name] = `${padding - indent}px`;
  57738. }
  57739. function setAccess(node, classNames) {
  57740. switch (node.access) {
  57741. case "nonInteractive":
  57742. classNames.push("xfaNonInteractive");
  57743. break;
  57744. case "readOnly":
  57745. classNames.push("xfaReadOnly");
  57746. break;
  57747. case "protected":
  57748. classNames.push("xfaDisabled");
  57749. break;
  57750. }
  57751. }
  57752. function isPrintOnly(node) {
  57753. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  57754. }
  57755. function getCurrentPara(node) {
  57756. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  57757. return stack.length ? stack[stack.length - 1] : null;
  57758. }
  57759. function setPara(node, nodeStyle, value) {
  57760. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  57761. if (nodeStyle) {
  57762. if (node.h === "") {
  57763. nodeStyle.height = "auto";
  57764. }
  57765. if (node.w === "") {
  57766. nodeStyle.width = "auto";
  57767. }
  57768. }
  57769. const para = getCurrentPara(node);
  57770. if (para) {
  57771. const valueStyle = value.attributes.style;
  57772. valueStyle.display = "flex";
  57773. valueStyle.flexDirection = "column";
  57774. switch (para.vAlign) {
  57775. case "top":
  57776. valueStyle.justifyContent = "start";
  57777. break;
  57778. case "bottom":
  57779. valueStyle.justifyContent = "end";
  57780. break;
  57781. case "middle":
  57782. valueStyle.justifyContent = "center";
  57783. break;
  57784. }
  57785. const paraStyle = para[_xfa_object.$toStyle]();
  57786. for (const [key, val] of Object.entries(paraStyle)) {
  57787. if (!(key in valueStyle)) {
  57788. valueStyle[key] = val;
  57789. }
  57790. }
  57791. }
  57792. }
  57793. }
  57794. function setFontFamily(xfaFont, node, fontFinder, style) {
  57795. if (!fontFinder) {
  57796. delete style.fontFamily;
  57797. return;
  57798. }
  57799. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  57800. style.fontFamily = `"${name}"`;
  57801. const typeface = fontFinder.find(name);
  57802. if (typeface) {
  57803. const {
  57804. fontFamily
  57805. } = typeface.regular.cssFontInfo;
  57806. if (fontFamily !== name) {
  57807. style.fontFamily = `"${fontFamily}"`;
  57808. }
  57809. const para = getCurrentPara(node);
  57810. if (para && para.lineHeight !== "") {
  57811. return;
  57812. }
  57813. if (style.lineHeight) {
  57814. return;
  57815. }
  57816. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  57817. if (pdfFont) {
  57818. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  57819. }
  57820. }
  57821. }
  57822. function fixURL(str) {
  57823. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  57824. addDefaultProtocol: true,
  57825. tryConvertEncoding: true
  57826. });
  57827. return absoluteUrl ? absoluteUrl.href : null;
  57828. }
  57829. /***/ }),
  57830. /* 84 */
  57831. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57832. Object.defineProperty(exports, "__esModule", ({
  57833. value: true
  57834. }));
  57835. exports.FontFinder = void 0;
  57836. exports.getMetrics = getMetrics;
  57837. exports.selectFont = selectFont;
  57838. var _xfa_object = __w_pdfjs_require__(76);
  57839. var _utils = __w_pdfjs_require__(77);
  57840. var _util = __w_pdfjs_require__(2);
  57841. class FontFinder {
  57842. constructor(pdfFonts) {
  57843. this.fonts = new Map();
  57844. this.cache = new Map();
  57845. this.warned = new Set();
  57846. this.defaultFont = null;
  57847. this.add(pdfFonts);
  57848. }
  57849. add(pdfFonts, reallyMissingFonts = null) {
  57850. for (const pdfFont of pdfFonts) {
  57851. this.addPdfFont(pdfFont);
  57852. }
  57853. for (const pdfFont of this.fonts.values()) {
  57854. if (!pdfFont.regular) {
  57855. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  57856. }
  57857. }
  57858. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  57859. return;
  57860. }
  57861. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  57862. for (const missing of reallyMissingFonts) {
  57863. this.fonts.set(missing, myriad);
  57864. }
  57865. }
  57866. addPdfFont(pdfFont) {
  57867. const cssFontInfo = pdfFont.cssFontInfo;
  57868. const name = cssFontInfo.fontFamily;
  57869. let font = this.fonts.get(name);
  57870. if (!font) {
  57871. font = Object.create(null);
  57872. this.fonts.set(name, font);
  57873. if (!this.defaultFont) {
  57874. this.defaultFont = font;
  57875. }
  57876. }
  57877. let property = "";
  57878. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  57879. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  57880. property = fontWeight >= 700 ? "bolditalic" : "italic";
  57881. } else if (fontWeight >= 700) {
  57882. property = "bold";
  57883. }
  57884. if (!property) {
  57885. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  57886. property = "bold";
  57887. }
  57888. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  57889. property += "italic";
  57890. }
  57891. }
  57892. if (!property) {
  57893. property = "regular";
  57894. }
  57895. font[property] = pdfFont;
  57896. }
  57897. getDefault() {
  57898. return this.defaultFont;
  57899. }
  57900. find(fontName, mustWarn = true) {
  57901. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  57902. if (font) {
  57903. return font;
  57904. }
  57905. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  57906. let name = fontName.replace(pattern, "");
  57907. font = this.fonts.get(name);
  57908. if (font) {
  57909. this.cache.set(fontName, font);
  57910. return font;
  57911. }
  57912. name = name.toLowerCase();
  57913. const maybe = [];
  57914. for (const [family, pdfFont] of this.fonts.entries()) {
  57915. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  57916. maybe.push(pdfFont);
  57917. }
  57918. }
  57919. if (maybe.length === 0) {
  57920. for (const [, pdfFont] of this.fonts.entries()) {
  57921. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  57922. maybe.push(pdfFont);
  57923. }
  57924. }
  57925. }
  57926. if (maybe.length === 0) {
  57927. name = name.replace(/psmt|mt/gi, "");
  57928. for (const [family, pdfFont] of this.fonts.entries()) {
  57929. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  57930. maybe.push(pdfFont);
  57931. }
  57932. }
  57933. }
  57934. if (maybe.length === 0) {
  57935. for (const pdfFont of this.fonts.values()) {
  57936. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  57937. maybe.push(pdfFont);
  57938. }
  57939. }
  57940. }
  57941. if (maybe.length >= 1) {
  57942. if (maybe.length !== 1 && mustWarn) {
  57943. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  57944. }
  57945. this.cache.set(fontName, maybe[0]);
  57946. return maybe[0];
  57947. }
  57948. if (mustWarn && !this.warned.has(fontName)) {
  57949. this.warned.add(fontName);
  57950. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  57951. }
  57952. return null;
  57953. }
  57954. }
  57955. exports.FontFinder = FontFinder;
  57956. function selectFont(xfaFont, typeface) {
  57957. if (xfaFont.posture === "italic") {
  57958. if (xfaFont.weight === "bold") {
  57959. return typeface.bolditalic;
  57960. }
  57961. return typeface.italic;
  57962. } else if (xfaFont.weight === "bold") {
  57963. return typeface.bold;
  57964. }
  57965. return typeface.regular;
  57966. }
  57967. function getMetrics(xfaFont, real = false) {
  57968. let pdfFont = null;
  57969. if (xfaFont) {
  57970. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  57971. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  57972. pdfFont = selectFont(xfaFont, typeface);
  57973. }
  57974. if (!pdfFont) {
  57975. return {
  57976. lineHeight: 12,
  57977. lineGap: 2,
  57978. lineNoGap: 10
  57979. };
  57980. }
  57981. const size = xfaFont.size || 10;
  57982. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  57983. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  57984. return {
  57985. lineHeight: lineHeight * size,
  57986. lineGap: lineGap * size,
  57987. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  57988. };
  57989. }
  57990. /***/ }),
  57991. /* 85 */
  57992. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57993. Object.defineProperty(exports, "__esModule", ({
  57994. value: true
  57995. }));
  57996. exports.TextMeasure = void 0;
  57997. var _fonts = __w_pdfjs_require__(84);
  57998. const WIDTH_FACTOR = 1.02;
  57999. class FontInfo {
  58000. constructor(xfaFont, margin, lineHeight, fontFinder) {
  58001. this.lineHeight = lineHeight;
  58002. this.paraMargin = margin || {
  58003. top: 0,
  58004. bottom: 0,
  58005. left: 0,
  58006. right: 0
  58007. };
  58008. if (!xfaFont) {
  58009. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58010. return;
  58011. }
  58012. this.xfaFont = {
  58013. typeface: xfaFont.typeface,
  58014. posture: xfaFont.posture,
  58015. weight: xfaFont.weight,
  58016. size: xfaFont.size,
  58017. letterSpacing: xfaFont.letterSpacing
  58018. };
  58019. const typeface = fontFinder.find(xfaFont.typeface);
  58020. if (!typeface) {
  58021. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58022. return;
  58023. }
  58024. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  58025. if (!this.pdfFont) {
  58026. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58027. }
  58028. }
  58029. defaultFont(fontFinder) {
  58030. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  58031. if (font && font.regular) {
  58032. const pdfFont = font.regular;
  58033. const info = pdfFont.cssFontInfo;
  58034. const xfaFont = {
  58035. typeface: info.fontFamily,
  58036. posture: "normal",
  58037. weight: "normal",
  58038. size: 10,
  58039. letterSpacing: 0
  58040. };
  58041. return [pdfFont, xfaFont];
  58042. }
  58043. const xfaFont = {
  58044. typeface: "Courier",
  58045. posture: "normal",
  58046. weight: "normal",
  58047. size: 10,
  58048. letterSpacing: 0
  58049. };
  58050. return [null, xfaFont];
  58051. }
  58052. }
  58053. class FontSelector {
  58054. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  58055. this.fontFinder = fontFinder;
  58056. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  58057. }
  58058. pushData(xfaFont, margin, lineHeight) {
  58059. const lastFont = this.stack[this.stack.length - 1];
  58060. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  58061. if (!xfaFont[name]) {
  58062. xfaFont[name] = lastFont.xfaFont[name];
  58063. }
  58064. }
  58065. for (const name of ["top", "bottom", "left", "right"]) {
  58066. if (isNaN(margin[name])) {
  58067. margin[name] = lastFont.paraMargin[name];
  58068. }
  58069. }
  58070. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  58071. if (!fontInfo.pdfFont) {
  58072. fontInfo.pdfFont = lastFont.pdfFont;
  58073. }
  58074. this.stack.push(fontInfo);
  58075. }
  58076. popFont() {
  58077. this.stack.pop();
  58078. }
  58079. topFont() {
  58080. return this.stack[this.stack.length - 1];
  58081. }
  58082. }
  58083. class TextMeasure {
  58084. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  58085. this.glyphs = [];
  58086. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  58087. this.extraHeight = 0;
  58088. }
  58089. pushData(xfaFont, margin, lineHeight) {
  58090. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  58091. }
  58092. popFont(xfaFont) {
  58093. return this.fontSelector.popFont();
  58094. }
  58095. addPara() {
  58096. const lastFont = this.fontSelector.topFont();
  58097. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  58098. }
  58099. addString(str) {
  58100. if (!str) {
  58101. return;
  58102. }
  58103. const lastFont = this.fontSelector.topFont();
  58104. const fontSize = lastFont.xfaFont.size;
  58105. if (lastFont.pdfFont) {
  58106. const letterSpacing = lastFont.xfaFont.letterSpacing;
  58107. const pdfFont = lastFont.pdfFont;
  58108. const fontLineHeight = pdfFont.lineHeight || 1.2;
  58109. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  58110. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  58111. const noGap = fontLineHeight - lineGap;
  58112. const firstLineHeight = Math.max(1, noGap) * fontSize;
  58113. const scale = fontSize / 1000;
  58114. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  58115. for (const line of str.split(/[\u2029\n]/)) {
  58116. const encodedLine = pdfFont.encodeString(line).join("");
  58117. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  58118. for (const glyph of glyphs) {
  58119. const width = glyph.width || fallbackWidth;
  58120. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  58121. }
  58122. this.glyphs.push([0, 0, 0, "\n", true]);
  58123. }
  58124. this.glyphs.pop();
  58125. return;
  58126. }
  58127. for (const line of str.split(/[\u2029\n]/)) {
  58128. for (const char of line.split("")) {
  58129. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  58130. }
  58131. this.glyphs.push([0, 0, 0, "\n", true]);
  58132. }
  58133. this.glyphs.pop();
  58134. }
  58135. compute(maxWidth) {
  58136. let lastSpacePos = -1,
  58137. lastSpaceWidth = 0,
  58138. width = 0,
  58139. height = 0,
  58140. currentLineWidth = 0,
  58141. currentLineHeight = 0;
  58142. let isBroken = false;
  58143. let isFirstLine = true;
  58144. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  58145. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  58146. const isSpace = char === " ";
  58147. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  58148. if (isEOL) {
  58149. width = Math.max(width, currentLineWidth);
  58150. currentLineWidth = 0;
  58151. height += currentLineHeight;
  58152. currentLineHeight = glyphHeight;
  58153. lastSpacePos = -1;
  58154. lastSpaceWidth = 0;
  58155. isFirstLine = false;
  58156. continue;
  58157. }
  58158. if (isSpace) {
  58159. if (currentLineWidth + glyphWidth > maxWidth) {
  58160. width = Math.max(width, currentLineWidth);
  58161. currentLineWidth = 0;
  58162. height += currentLineHeight;
  58163. currentLineHeight = glyphHeight;
  58164. lastSpacePos = -1;
  58165. lastSpaceWidth = 0;
  58166. isBroken = true;
  58167. isFirstLine = false;
  58168. } else {
  58169. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  58170. lastSpaceWidth = currentLineWidth;
  58171. currentLineWidth += glyphWidth;
  58172. lastSpacePos = i;
  58173. }
  58174. continue;
  58175. }
  58176. if (currentLineWidth + glyphWidth > maxWidth) {
  58177. height += currentLineHeight;
  58178. currentLineHeight = glyphHeight;
  58179. if (lastSpacePos !== -1) {
  58180. i = lastSpacePos;
  58181. width = Math.max(width, lastSpaceWidth);
  58182. currentLineWidth = 0;
  58183. lastSpacePos = -1;
  58184. lastSpaceWidth = 0;
  58185. } else {
  58186. width = Math.max(width, currentLineWidth);
  58187. currentLineWidth = glyphWidth;
  58188. }
  58189. isBroken = true;
  58190. isFirstLine = false;
  58191. continue;
  58192. }
  58193. currentLineWidth += glyphWidth;
  58194. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  58195. }
  58196. width = Math.max(width, currentLineWidth);
  58197. height += currentLineHeight + this.extraHeight;
  58198. return {
  58199. width: WIDTH_FACTOR * width,
  58200. height,
  58201. isBroken
  58202. };
  58203. }
  58204. }
  58205. exports.TextMeasure = TextMeasure;
  58206. /***/ }),
  58207. /* 86 */
  58208. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58209. Object.defineProperty(exports, "__esModule", ({
  58210. value: true
  58211. }));
  58212. exports.DataHandler = void 0;
  58213. var _xfa_object = __w_pdfjs_require__(76);
  58214. class DataHandler {
  58215. constructor(root, data) {
  58216. this.data = data;
  58217. this.dataset = root.datasets || null;
  58218. }
  58219. serialize(storage) {
  58220. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  58221. while (stack.length > 0) {
  58222. const last = stack[stack.length - 1];
  58223. const [i, children] = last;
  58224. if (i + 1 === children.length) {
  58225. stack.pop();
  58226. continue;
  58227. }
  58228. const child = children[++last[0]];
  58229. const storageEntry = storage.get(child[_xfa_object.$uid]);
  58230. if (storageEntry) {
  58231. child[_xfa_object.$setValue](storageEntry);
  58232. } else {
  58233. const attributes = child[_xfa_object.$getAttributes]();
  58234. for (const value of attributes.values()) {
  58235. const entry = storage.get(value[_xfa_object.$uid]);
  58236. if (entry) {
  58237. value[_xfa_object.$setValue](entry);
  58238. break;
  58239. }
  58240. }
  58241. }
  58242. const nodes = child[_xfa_object.$getChildren]();
  58243. if (nodes.length > 0) {
  58244. stack.push([-1, nodes]);
  58245. }
  58246. }
  58247. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  58248. if (this.dataset) {
  58249. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  58250. if (child[_xfa_object.$nodeName] !== "data") {
  58251. child[_xfa_object.$toString](buf);
  58252. }
  58253. }
  58254. }
  58255. this.data[_xfa_object.$toString](buf);
  58256. buf.push("</xfa:datasets>");
  58257. return buf.join("");
  58258. }
  58259. }
  58260. exports.DataHandler = DataHandler;
  58261. /***/ }),
  58262. /* 87 */
  58263. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58264. Object.defineProperty(exports, "__esModule", ({
  58265. value: true
  58266. }));
  58267. exports.XFAParser = void 0;
  58268. var _xfa_object = __w_pdfjs_require__(76);
  58269. var _xml_parser = __w_pdfjs_require__(69);
  58270. var _builder = __w_pdfjs_require__(88);
  58271. var _util = __w_pdfjs_require__(2);
  58272. class XFAParser extends _xml_parser.XMLParserBase {
  58273. constructor(rootNameSpace = null, richText = false) {
  58274. super();
  58275. this._builder = new _builder.Builder(rootNameSpace);
  58276. this._stack = [];
  58277. this._globalData = {
  58278. usedTypefaces: new Set()
  58279. };
  58280. this._ids = new Map();
  58281. this._current = this._builder.buildRoot(this._ids);
  58282. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  58283. this._whiteRegex = /^\s+$/;
  58284. this._nbsps = /\xa0+/g;
  58285. this._richText = richText;
  58286. }
  58287. parse(data) {
  58288. this.parseXml(data);
  58289. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  58290. return undefined;
  58291. }
  58292. this._current[_xfa_object.$finalize]();
  58293. return this._current.element;
  58294. }
  58295. onText(text) {
  58296. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  58297. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  58298. this._current[_xfa_object.$onText](text, this._richText);
  58299. return;
  58300. }
  58301. if (this._whiteRegex.test(text)) {
  58302. return;
  58303. }
  58304. this._current[_xfa_object.$onText](text.trim());
  58305. }
  58306. onCdata(text) {
  58307. this._current[_xfa_object.$onText](text);
  58308. }
  58309. _mkAttributes(attributes, tagName) {
  58310. let namespace = null;
  58311. let prefixes = null;
  58312. const attributeObj = Object.create({});
  58313. for (const {
  58314. name,
  58315. value
  58316. } of attributes) {
  58317. if (name === "xmlns") {
  58318. if (!namespace) {
  58319. namespace = value;
  58320. } else {
  58321. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  58322. }
  58323. } else if (name.startsWith("xmlns:")) {
  58324. const prefix = name.substring("xmlns:".length);
  58325. if (!prefixes) {
  58326. prefixes = [];
  58327. }
  58328. prefixes.push({
  58329. prefix,
  58330. value
  58331. });
  58332. } else {
  58333. const i = name.indexOf(":");
  58334. if (i === -1) {
  58335. attributeObj[name] = value;
  58336. } else {
  58337. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  58338. if (!nsAttrs) {
  58339. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  58340. }
  58341. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  58342. let attrs = nsAttrs[ns];
  58343. if (!attrs) {
  58344. attrs = nsAttrs[ns] = Object.create(null);
  58345. }
  58346. attrs[attrName] = value;
  58347. }
  58348. }
  58349. }
  58350. return [namespace, prefixes, attributeObj];
  58351. }
  58352. _getNameAndPrefix(name, nsAgnostic) {
  58353. const i = name.indexOf(":");
  58354. if (i === -1) {
  58355. return [name, null];
  58356. }
  58357. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  58358. }
  58359. onBeginElement(tagName, attributes, isEmpty) {
  58360. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  58361. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  58362. const node = this._builder.build({
  58363. nsPrefix,
  58364. name,
  58365. attributes: attributesObj,
  58366. namespace,
  58367. prefixes
  58368. });
  58369. node[_xfa_object.$globalData] = this._globalData;
  58370. if (isEmpty) {
  58371. node[_xfa_object.$finalize]();
  58372. if (this._current[_xfa_object.$onChild](node)) {
  58373. node[_xfa_object.$setId](this._ids);
  58374. }
  58375. node[_xfa_object.$clean](this._builder);
  58376. return;
  58377. }
  58378. this._stack.push(this._current);
  58379. this._current = node;
  58380. }
  58381. onEndElement(name) {
  58382. const node = this._current;
  58383. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  58384. const parser = new XFAParser();
  58385. parser._globalData = this._globalData;
  58386. const root = parser.parse(node[_xfa_object.$content]);
  58387. node[_xfa_object.$content] = null;
  58388. node[_xfa_object.$onChild](root);
  58389. }
  58390. node[_xfa_object.$finalize]();
  58391. this._current = this._stack.pop();
  58392. if (this._current[_xfa_object.$onChild](node)) {
  58393. node[_xfa_object.$setId](this._ids);
  58394. }
  58395. node[_xfa_object.$clean](this._builder);
  58396. }
  58397. onError(code) {
  58398. this._errorCode = code;
  58399. }
  58400. }
  58401. exports.XFAParser = XFAParser;
  58402. /***/ }),
  58403. /* 88 */
  58404. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58405. Object.defineProperty(exports, "__esModule", ({
  58406. value: true
  58407. }));
  58408. exports.Builder = void 0;
  58409. var _namespaces = __w_pdfjs_require__(78);
  58410. var _xfa_object = __w_pdfjs_require__(76);
  58411. var _setup = __w_pdfjs_require__(89);
  58412. var _template = __w_pdfjs_require__(81);
  58413. var _unknown = __w_pdfjs_require__(98);
  58414. var _util = __w_pdfjs_require__(2);
  58415. class Root extends _xfa_object.XFAObject {
  58416. constructor(ids) {
  58417. super(-1, "root", Object.create(null));
  58418. this.element = null;
  58419. this[_xfa_object.$ids] = ids;
  58420. }
  58421. [_xfa_object.$onChild](child) {
  58422. this.element = child;
  58423. return true;
  58424. }
  58425. [_xfa_object.$finalize]() {
  58426. super[_xfa_object.$finalize]();
  58427. if (this.element.template instanceof _template.Template) {
  58428. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  58429. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  58430. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  58431. }
  58432. }
  58433. }
  58434. class Empty extends _xfa_object.XFAObject {
  58435. constructor() {
  58436. super(-1, "", Object.create(null));
  58437. }
  58438. [_xfa_object.$onChild](_) {
  58439. return false;
  58440. }
  58441. }
  58442. class Builder {
  58443. constructor(rootNameSpace = null) {
  58444. this._namespaceStack = [];
  58445. this._nsAgnosticLevel = 0;
  58446. this._namespacePrefixes = new Map();
  58447. this._namespaces = new Map();
  58448. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  58449. id
  58450. }) => id));
  58451. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  58452. }
  58453. buildRoot(ids) {
  58454. return new Root(ids);
  58455. }
  58456. build({
  58457. nsPrefix,
  58458. name,
  58459. attributes,
  58460. namespace,
  58461. prefixes
  58462. }) {
  58463. const hasNamespaceDef = namespace !== null;
  58464. if (hasNamespaceDef) {
  58465. this._namespaceStack.push(this._currentNamespace);
  58466. this._currentNamespace = this._searchNamespace(namespace);
  58467. }
  58468. if (prefixes) {
  58469. this._addNamespacePrefix(prefixes);
  58470. }
  58471. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  58472. const dataTemplate = _setup.NamespaceSetUp.datasets;
  58473. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  58474. let xfaAttrs = null;
  58475. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  58476. const nsToUse = this._getNamespaceToUse(ns);
  58477. if (nsToUse === dataTemplate) {
  58478. xfaAttrs = {
  58479. xfa: attrs
  58480. };
  58481. break;
  58482. }
  58483. }
  58484. if (xfaAttrs) {
  58485. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  58486. } else {
  58487. delete attributes[_xfa_object.$nsAttributes];
  58488. }
  58489. }
  58490. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  58491. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  58492. if (node[_xfa_object.$isNsAgnostic]()) {
  58493. this._nsAgnosticLevel++;
  58494. }
  58495. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  58496. node[_xfa_object.$cleanup] = {
  58497. hasNamespace: hasNamespaceDef,
  58498. prefixes,
  58499. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  58500. };
  58501. }
  58502. return node;
  58503. }
  58504. isNsAgnostic() {
  58505. return this._nsAgnosticLevel > 0;
  58506. }
  58507. _searchNamespace(nsName) {
  58508. let ns = this._namespaces.get(nsName);
  58509. if (ns) {
  58510. return ns;
  58511. }
  58512. for (const [name, {
  58513. check
  58514. }] of Object.entries(_namespaces.NamespaceIds)) {
  58515. if (check(nsName)) {
  58516. ns = _setup.NamespaceSetUp[name];
  58517. if (ns) {
  58518. this._namespaces.set(nsName, ns);
  58519. return ns;
  58520. }
  58521. break;
  58522. }
  58523. }
  58524. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  58525. this._namespaces.set(nsName, ns);
  58526. return ns;
  58527. }
  58528. _addNamespacePrefix(prefixes) {
  58529. for (const {
  58530. prefix,
  58531. value
  58532. } of prefixes) {
  58533. const namespace = this._searchNamespace(value);
  58534. let prefixStack = this._namespacePrefixes.get(prefix);
  58535. if (!prefixStack) {
  58536. prefixStack = [];
  58537. this._namespacePrefixes.set(prefix, prefixStack);
  58538. }
  58539. prefixStack.push(namespace);
  58540. }
  58541. }
  58542. _getNamespaceToUse(prefix) {
  58543. if (!prefix) {
  58544. return this._currentNamespace;
  58545. }
  58546. const prefixStack = this._namespacePrefixes.get(prefix);
  58547. if (prefixStack && prefixStack.length > 0) {
  58548. return prefixStack[prefixStack.length - 1];
  58549. }
  58550. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  58551. return null;
  58552. }
  58553. clean(data) {
  58554. const {
  58555. hasNamespace,
  58556. prefixes,
  58557. nsAgnostic
  58558. } = data;
  58559. if (hasNamespace) {
  58560. this._currentNamespace = this._namespaceStack.pop();
  58561. }
  58562. if (prefixes) {
  58563. prefixes.forEach(({
  58564. prefix
  58565. }) => {
  58566. this._namespacePrefixes.get(prefix).pop();
  58567. });
  58568. }
  58569. if (nsAgnostic) {
  58570. this._nsAgnosticLevel--;
  58571. }
  58572. }
  58573. }
  58574. exports.Builder = Builder;
  58575. /***/ }),
  58576. /* 89 */
  58577. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58578. Object.defineProperty(exports, "__esModule", ({
  58579. value: true
  58580. }));
  58581. exports.NamespaceSetUp = void 0;
  58582. var _config = __w_pdfjs_require__(90);
  58583. var _connection_set = __w_pdfjs_require__(91);
  58584. var _datasets = __w_pdfjs_require__(92);
  58585. var _locale_set = __w_pdfjs_require__(93);
  58586. var _signature = __w_pdfjs_require__(94);
  58587. var _stylesheet = __w_pdfjs_require__(95);
  58588. var _template = __w_pdfjs_require__(81);
  58589. var _xdp = __w_pdfjs_require__(96);
  58590. var _xhtml = __w_pdfjs_require__(97);
  58591. const NamespaceSetUp = {
  58592. config: _config.ConfigNamespace,
  58593. connection: _connection_set.ConnectionSetNamespace,
  58594. datasets: _datasets.DatasetsNamespace,
  58595. localeSet: _locale_set.LocaleSetNamespace,
  58596. signature: _signature.SignatureNamespace,
  58597. stylesheet: _stylesheet.StylesheetNamespace,
  58598. template: _template.TemplateNamespace,
  58599. xdp: _xdp.XdpNamespace,
  58600. xhtml: _xhtml.XhtmlNamespace
  58601. };
  58602. exports.NamespaceSetUp = NamespaceSetUp;
  58603. /***/ }),
  58604. /* 90 */
  58605. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58606. Object.defineProperty(exports, "__esModule", ({
  58607. value: true
  58608. }));
  58609. exports.ConfigNamespace = void 0;
  58610. var _namespaces = __w_pdfjs_require__(78);
  58611. var _xfa_object = __w_pdfjs_require__(76);
  58612. var _utils = __w_pdfjs_require__(77);
  58613. var _util = __w_pdfjs_require__(2);
  58614. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  58615. class Acrobat extends _xfa_object.XFAObject {
  58616. constructor(attributes) {
  58617. super(CONFIG_NS_ID, "acrobat", true);
  58618. this.acrobat7 = null;
  58619. this.autoSave = null;
  58620. this.common = null;
  58621. this.validate = null;
  58622. this.validateApprovalSignatures = null;
  58623. this.submitUrl = new _xfa_object.XFAObjectArray();
  58624. }
  58625. }
  58626. class Acrobat7 extends _xfa_object.XFAObject {
  58627. constructor(attributes) {
  58628. super(CONFIG_NS_ID, "acrobat7", true);
  58629. this.dynamicRender = null;
  58630. }
  58631. }
  58632. class ADBE_JSConsole extends _xfa_object.OptionObject {
  58633. constructor(attributes) {
  58634. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  58635. }
  58636. }
  58637. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  58638. constructor(attributes) {
  58639. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  58640. }
  58641. }
  58642. class AddSilentPrint extends _xfa_object.Option01 {
  58643. constructor(attributes) {
  58644. super(CONFIG_NS_ID, "addSilentPrint");
  58645. }
  58646. }
  58647. class AddViewerPreferences extends _xfa_object.Option01 {
  58648. constructor(attributes) {
  58649. super(CONFIG_NS_ID, "addViewerPreferences");
  58650. }
  58651. }
  58652. class AdjustData extends _xfa_object.Option10 {
  58653. constructor(attributes) {
  58654. super(CONFIG_NS_ID, "adjustData");
  58655. }
  58656. }
  58657. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  58658. constructor(attributes) {
  58659. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  58660. }
  58661. }
  58662. class Agent extends _xfa_object.XFAObject {
  58663. constructor(attributes) {
  58664. super(CONFIG_NS_ID, "agent", true);
  58665. this.name = attributes.name ? attributes.name.trim() : "";
  58666. this.common = new _xfa_object.XFAObjectArray();
  58667. }
  58668. }
  58669. class AlwaysEmbed extends _xfa_object.ContentObject {
  58670. constructor(attributes) {
  58671. super(CONFIG_NS_ID, "alwaysEmbed");
  58672. }
  58673. }
  58674. class Amd extends _xfa_object.StringObject {
  58675. constructor(attributes) {
  58676. super(CONFIG_NS_ID, "amd");
  58677. }
  58678. }
  58679. class Area extends _xfa_object.XFAObject {
  58680. constructor(attributes) {
  58681. super(CONFIG_NS_ID, "area");
  58682. this.level = (0, _utils.getInteger)({
  58683. data: attributes.level,
  58684. defaultValue: 0,
  58685. validate: n => n >= 1 && n <= 3
  58686. });
  58687. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  58688. }
  58689. }
  58690. class Attributes extends _xfa_object.OptionObject {
  58691. constructor(attributes) {
  58692. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  58693. }
  58694. }
  58695. class AutoSave extends _xfa_object.OptionObject {
  58696. constructor(attributes) {
  58697. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  58698. }
  58699. }
  58700. class Base extends _xfa_object.StringObject {
  58701. constructor(attributes) {
  58702. super(CONFIG_NS_ID, "base");
  58703. }
  58704. }
  58705. class BatchOutput extends _xfa_object.XFAObject {
  58706. constructor(attributes) {
  58707. super(CONFIG_NS_ID, "batchOutput");
  58708. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  58709. }
  58710. }
  58711. class BehaviorOverride extends _xfa_object.ContentObject {
  58712. constructor(attributes) {
  58713. super(CONFIG_NS_ID, "behaviorOverride");
  58714. }
  58715. [_xfa_object.$finalize]() {
  58716. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  58717. }
  58718. }
  58719. class Cache extends _xfa_object.XFAObject {
  58720. constructor(attributes) {
  58721. super(CONFIG_NS_ID, "cache", true);
  58722. this.templateCache = null;
  58723. }
  58724. }
  58725. class Change extends _xfa_object.Option01 {
  58726. constructor(attributes) {
  58727. super(CONFIG_NS_ID, "change");
  58728. }
  58729. }
  58730. class Common extends _xfa_object.XFAObject {
  58731. constructor(attributes) {
  58732. super(CONFIG_NS_ID, "common", true);
  58733. this.data = null;
  58734. this.locale = null;
  58735. this.localeSet = null;
  58736. this.messaging = null;
  58737. this.suppressBanner = null;
  58738. this.template = null;
  58739. this.validationMessaging = null;
  58740. this.versionControl = null;
  58741. this.log = new _xfa_object.XFAObjectArray();
  58742. }
  58743. }
  58744. class Compress extends _xfa_object.XFAObject {
  58745. constructor(attributes) {
  58746. super(CONFIG_NS_ID, "compress");
  58747. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  58748. }
  58749. }
  58750. class CompressLogicalStructure extends _xfa_object.Option01 {
  58751. constructor(attributes) {
  58752. super(CONFIG_NS_ID, "compressLogicalStructure");
  58753. }
  58754. }
  58755. class CompressObjectStream extends _xfa_object.Option10 {
  58756. constructor(attributes) {
  58757. super(CONFIG_NS_ID, "compressObjectStream");
  58758. }
  58759. }
  58760. class Compression extends _xfa_object.XFAObject {
  58761. constructor(attributes) {
  58762. super(CONFIG_NS_ID, "compression", true);
  58763. this.compressLogicalStructure = null;
  58764. this.compressObjectStream = null;
  58765. this.level = null;
  58766. this.type = null;
  58767. }
  58768. }
  58769. class Config extends _xfa_object.XFAObject {
  58770. constructor(attributes) {
  58771. super(CONFIG_NS_ID, "config", true);
  58772. this.acrobat = null;
  58773. this.present = null;
  58774. this.trace = null;
  58775. this.agent = new _xfa_object.XFAObjectArray();
  58776. }
  58777. }
  58778. class Conformance extends _xfa_object.OptionObject {
  58779. constructor(attributes) {
  58780. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  58781. }
  58782. }
  58783. class ContentCopy extends _xfa_object.Option01 {
  58784. constructor(attributes) {
  58785. super(CONFIG_NS_ID, "contentCopy");
  58786. }
  58787. }
  58788. class Copies extends _xfa_object.IntegerObject {
  58789. constructor(attributes) {
  58790. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  58791. }
  58792. }
  58793. class Creator extends _xfa_object.StringObject {
  58794. constructor(attributes) {
  58795. super(CONFIG_NS_ID, "creator");
  58796. }
  58797. }
  58798. class CurrentPage extends _xfa_object.IntegerObject {
  58799. constructor(attributes) {
  58800. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  58801. }
  58802. }
  58803. class Data extends _xfa_object.XFAObject {
  58804. constructor(attributes) {
  58805. super(CONFIG_NS_ID, "data", true);
  58806. this.adjustData = null;
  58807. this.attributes = null;
  58808. this.incrementalLoad = null;
  58809. this.outputXSL = null;
  58810. this.range = null;
  58811. this.record = null;
  58812. this.startNode = null;
  58813. this.uri = null;
  58814. this.window = null;
  58815. this.xsl = null;
  58816. this.excludeNS = new _xfa_object.XFAObjectArray();
  58817. this.transform = new _xfa_object.XFAObjectArray();
  58818. }
  58819. }
  58820. class Debug extends _xfa_object.XFAObject {
  58821. constructor(attributes) {
  58822. super(CONFIG_NS_ID, "debug", true);
  58823. this.uri = null;
  58824. }
  58825. }
  58826. class DefaultTypeface extends _xfa_object.ContentObject {
  58827. constructor(attributes) {
  58828. super(CONFIG_NS_ID, "defaultTypeface");
  58829. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  58830. }
  58831. }
  58832. class Destination extends _xfa_object.OptionObject {
  58833. constructor(attributes) {
  58834. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  58835. }
  58836. }
  58837. class DocumentAssembly extends _xfa_object.Option01 {
  58838. constructor(attributes) {
  58839. super(CONFIG_NS_ID, "documentAssembly");
  58840. }
  58841. }
  58842. class Driver extends _xfa_object.XFAObject {
  58843. constructor(attributes) {
  58844. super(CONFIG_NS_ID, "driver", true);
  58845. this.name = attributes.name ? attributes.name.trim() : "";
  58846. this.fontInfo = null;
  58847. this.xdc = null;
  58848. }
  58849. }
  58850. class DuplexOption extends _xfa_object.OptionObject {
  58851. constructor(attributes) {
  58852. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  58853. }
  58854. }
  58855. class DynamicRender extends _xfa_object.OptionObject {
  58856. constructor(attributes) {
  58857. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  58858. }
  58859. }
  58860. class Embed extends _xfa_object.Option01 {
  58861. constructor(attributes) {
  58862. super(CONFIG_NS_ID, "embed");
  58863. }
  58864. }
  58865. class Encrypt extends _xfa_object.Option01 {
  58866. constructor(attributes) {
  58867. super(CONFIG_NS_ID, "encrypt");
  58868. }
  58869. }
  58870. class Encryption extends _xfa_object.XFAObject {
  58871. constructor(attributes) {
  58872. super(CONFIG_NS_ID, "encryption", true);
  58873. this.encrypt = null;
  58874. this.encryptionLevel = null;
  58875. this.permissions = null;
  58876. }
  58877. }
  58878. class EncryptionLevel extends _xfa_object.OptionObject {
  58879. constructor(attributes) {
  58880. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  58881. }
  58882. }
  58883. class Enforce extends _xfa_object.StringObject {
  58884. constructor(attributes) {
  58885. super(CONFIG_NS_ID, "enforce");
  58886. }
  58887. }
  58888. class Equate extends _xfa_object.XFAObject {
  58889. constructor(attributes) {
  58890. super(CONFIG_NS_ID, "equate");
  58891. this.force = (0, _utils.getInteger)({
  58892. data: attributes.force,
  58893. defaultValue: 1,
  58894. validate: n => n === 0
  58895. });
  58896. this.from = attributes.from || "";
  58897. this.to = attributes.to || "";
  58898. }
  58899. }
  58900. class EquateRange extends _xfa_object.XFAObject {
  58901. constructor(attributes) {
  58902. super(CONFIG_NS_ID, "equateRange");
  58903. this.from = attributes.from || "";
  58904. this.to = attributes.to || "";
  58905. this._unicodeRange = attributes.unicodeRange || "";
  58906. }
  58907. get unicodeRange() {
  58908. const ranges = [];
  58909. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  58910. const unicodeRange = this._unicodeRange;
  58911. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  58912. range = range.split("-", 2).map(x => {
  58913. const found = x.match(unicodeRegex);
  58914. if (!found) {
  58915. return 0;
  58916. }
  58917. return parseInt(found[1], 16);
  58918. });
  58919. if (range.length === 1) {
  58920. range.push(range[0]);
  58921. }
  58922. ranges.push(range);
  58923. }
  58924. return (0, _util.shadow)(this, "unicodeRange", ranges);
  58925. }
  58926. }
  58927. class Exclude extends _xfa_object.ContentObject {
  58928. constructor(attributes) {
  58929. super(CONFIG_NS_ID, "exclude");
  58930. }
  58931. [_xfa_object.$finalize]() {
  58932. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  58933. }
  58934. }
  58935. class ExcludeNS extends _xfa_object.StringObject {
  58936. constructor(attributes) {
  58937. super(CONFIG_NS_ID, "excludeNS");
  58938. }
  58939. }
  58940. class FlipLabel extends _xfa_object.OptionObject {
  58941. constructor(attributes) {
  58942. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  58943. }
  58944. }
  58945. class FontInfo extends _xfa_object.XFAObject {
  58946. constructor(attributes) {
  58947. super(CONFIG_NS_ID, "fontInfo", true);
  58948. this.embed = null;
  58949. this.map = null;
  58950. this.subsetBelow = null;
  58951. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  58952. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  58953. this.neverEmbed = new _xfa_object.XFAObjectArray();
  58954. }
  58955. }
  58956. class FormFieldFilling extends _xfa_object.Option01 {
  58957. constructor(attributes) {
  58958. super(CONFIG_NS_ID, "formFieldFilling");
  58959. }
  58960. }
  58961. class GroupParent extends _xfa_object.StringObject {
  58962. constructor(attributes) {
  58963. super(CONFIG_NS_ID, "groupParent");
  58964. }
  58965. }
  58966. class IfEmpty extends _xfa_object.OptionObject {
  58967. constructor(attributes) {
  58968. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  58969. }
  58970. }
  58971. class IncludeXDPContent extends _xfa_object.StringObject {
  58972. constructor(attributes) {
  58973. super(CONFIG_NS_ID, "includeXDPContent");
  58974. }
  58975. }
  58976. class IncrementalLoad extends _xfa_object.OptionObject {
  58977. constructor(attributes) {
  58978. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  58979. }
  58980. }
  58981. class IncrementalMerge extends _xfa_object.Option01 {
  58982. constructor(attributes) {
  58983. super(CONFIG_NS_ID, "incrementalMerge");
  58984. }
  58985. }
  58986. class Interactive extends _xfa_object.Option01 {
  58987. constructor(attributes) {
  58988. super(CONFIG_NS_ID, "interactive");
  58989. }
  58990. }
  58991. class Jog extends _xfa_object.OptionObject {
  58992. constructor(attributes) {
  58993. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  58994. }
  58995. }
  58996. class LabelPrinter extends _xfa_object.XFAObject {
  58997. constructor(attributes) {
  58998. super(CONFIG_NS_ID, "labelPrinter", true);
  58999. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  59000. this.batchOutput = null;
  59001. this.flipLabel = null;
  59002. this.fontInfo = null;
  59003. this.xdc = null;
  59004. }
  59005. }
  59006. class Layout extends _xfa_object.OptionObject {
  59007. constructor(attributes) {
  59008. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  59009. }
  59010. }
  59011. class Level extends _xfa_object.IntegerObject {
  59012. constructor(attributes) {
  59013. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  59014. }
  59015. }
  59016. class Linearized extends _xfa_object.Option01 {
  59017. constructor(attributes) {
  59018. super(CONFIG_NS_ID, "linearized");
  59019. }
  59020. }
  59021. class Locale extends _xfa_object.StringObject {
  59022. constructor(attributes) {
  59023. super(CONFIG_NS_ID, "locale");
  59024. }
  59025. }
  59026. class LocaleSet extends _xfa_object.StringObject {
  59027. constructor(attributes) {
  59028. super(CONFIG_NS_ID, "localeSet");
  59029. }
  59030. }
  59031. class Log extends _xfa_object.XFAObject {
  59032. constructor(attributes) {
  59033. super(CONFIG_NS_ID, "log", true);
  59034. this.mode = null;
  59035. this.threshold = null;
  59036. this.to = null;
  59037. this.uri = null;
  59038. }
  59039. }
  59040. class MapElement extends _xfa_object.XFAObject {
  59041. constructor(attributes) {
  59042. super(CONFIG_NS_ID, "map", true);
  59043. this.equate = new _xfa_object.XFAObjectArray();
  59044. this.equateRange = new _xfa_object.XFAObjectArray();
  59045. }
  59046. }
  59047. class MediumInfo extends _xfa_object.XFAObject {
  59048. constructor(attributes) {
  59049. super(CONFIG_NS_ID, "mediumInfo", true);
  59050. this.map = null;
  59051. }
  59052. }
  59053. class Message extends _xfa_object.XFAObject {
  59054. constructor(attributes) {
  59055. super(CONFIG_NS_ID, "message", true);
  59056. this.msgId = null;
  59057. this.severity = null;
  59058. }
  59059. }
  59060. class Messaging extends _xfa_object.XFAObject {
  59061. constructor(attributes) {
  59062. super(CONFIG_NS_ID, "messaging", true);
  59063. this.message = new _xfa_object.XFAObjectArray();
  59064. }
  59065. }
  59066. class Mode extends _xfa_object.OptionObject {
  59067. constructor(attributes) {
  59068. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  59069. }
  59070. }
  59071. class ModifyAnnots extends _xfa_object.Option01 {
  59072. constructor(attributes) {
  59073. super(CONFIG_NS_ID, "modifyAnnots");
  59074. }
  59075. }
  59076. class MsgId extends _xfa_object.IntegerObject {
  59077. constructor(attributes) {
  59078. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  59079. }
  59080. }
  59081. class NameAttr extends _xfa_object.StringObject {
  59082. constructor(attributes) {
  59083. super(CONFIG_NS_ID, "nameAttr");
  59084. }
  59085. }
  59086. class NeverEmbed extends _xfa_object.ContentObject {
  59087. constructor(attributes) {
  59088. super(CONFIG_NS_ID, "neverEmbed");
  59089. }
  59090. }
  59091. class NumberOfCopies extends _xfa_object.IntegerObject {
  59092. constructor(attributes) {
  59093. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  59094. }
  59095. }
  59096. class OpenAction extends _xfa_object.XFAObject {
  59097. constructor(attributes) {
  59098. super(CONFIG_NS_ID, "openAction", true);
  59099. this.destination = null;
  59100. }
  59101. }
  59102. class Output extends _xfa_object.XFAObject {
  59103. constructor(attributes) {
  59104. super(CONFIG_NS_ID, "output", true);
  59105. this.to = null;
  59106. this.type = null;
  59107. this.uri = null;
  59108. }
  59109. }
  59110. class OutputBin extends _xfa_object.StringObject {
  59111. constructor(attributes) {
  59112. super(CONFIG_NS_ID, "outputBin");
  59113. }
  59114. }
  59115. class OutputXSL extends _xfa_object.XFAObject {
  59116. constructor(attributes) {
  59117. super(CONFIG_NS_ID, "outputXSL", true);
  59118. this.uri = null;
  59119. }
  59120. }
  59121. class Overprint extends _xfa_object.OptionObject {
  59122. constructor(attributes) {
  59123. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  59124. }
  59125. }
  59126. class Packets extends _xfa_object.StringObject {
  59127. constructor(attributes) {
  59128. super(CONFIG_NS_ID, "packets");
  59129. }
  59130. [_xfa_object.$finalize]() {
  59131. if (this[_xfa_object.$content] === "*") {
  59132. return;
  59133. }
  59134. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  59135. }
  59136. }
  59137. class PageOffset extends _xfa_object.XFAObject {
  59138. constructor(attributes) {
  59139. super(CONFIG_NS_ID, "pageOffset");
  59140. this.x = (0, _utils.getInteger)({
  59141. data: attributes.x,
  59142. defaultValue: "useXDCSetting",
  59143. validate: n => true
  59144. });
  59145. this.y = (0, _utils.getInteger)({
  59146. data: attributes.y,
  59147. defaultValue: "useXDCSetting",
  59148. validate: n => true
  59149. });
  59150. }
  59151. }
  59152. class PageRange extends _xfa_object.StringObject {
  59153. constructor(attributes) {
  59154. super(CONFIG_NS_ID, "pageRange");
  59155. }
  59156. [_xfa_object.$finalize]() {
  59157. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  59158. const ranges = [];
  59159. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  59160. ranges.push(numbers.slice(i, i + 2));
  59161. }
  59162. this[_xfa_object.$content] = ranges;
  59163. }
  59164. }
  59165. class Pagination extends _xfa_object.OptionObject {
  59166. constructor(attributes) {
  59167. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  59168. }
  59169. }
  59170. class PaginationOverride extends _xfa_object.OptionObject {
  59171. constructor(attributes) {
  59172. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  59173. }
  59174. }
  59175. class Part extends _xfa_object.IntegerObject {
  59176. constructor(attributes) {
  59177. super(CONFIG_NS_ID, "part", 1, n => false);
  59178. }
  59179. }
  59180. class Pcl extends _xfa_object.XFAObject {
  59181. constructor(attributes) {
  59182. super(CONFIG_NS_ID, "pcl", true);
  59183. this.name = attributes.name || "";
  59184. this.batchOutput = null;
  59185. this.fontInfo = null;
  59186. this.jog = null;
  59187. this.mediumInfo = null;
  59188. this.outputBin = null;
  59189. this.pageOffset = null;
  59190. this.staple = null;
  59191. this.xdc = null;
  59192. }
  59193. }
  59194. class Pdf extends _xfa_object.XFAObject {
  59195. constructor(attributes) {
  59196. super(CONFIG_NS_ID, "pdf", true);
  59197. this.name = attributes.name || "";
  59198. this.adobeExtensionLevel = null;
  59199. this.batchOutput = null;
  59200. this.compression = null;
  59201. this.creator = null;
  59202. this.encryption = null;
  59203. this.fontInfo = null;
  59204. this.interactive = null;
  59205. this.linearized = null;
  59206. this.openAction = null;
  59207. this.pdfa = null;
  59208. this.producer = null;
  59209. this.renderPolicy = null;
  59210. this.scriptModel = null;
  59211. this.silentPrint = null;
  59212. this.submitFormat = null;
  59213. this.tagged = null;
  59214. this.version = null;
  59215. this.viewerPreferences = null;
  59216. this.xdc = null;
  59217. }
  59218. }
  59219. class Pdfa extends _xfa_object.XFAObject {
  59220. constructor(attributes) {
  59221. super(CONFIG_NS_ID, "pdfa", true);
  59222. this.amd = null;
  59223. this.conformance = null;
  59224. this.includeXDPContent = null;
  59225. this.part = null;
  59226. }
  59227. }
  59228. class Permissions extends _xfa_object.XFAObject {
  59229. constructor(attributes) {
  59230. super(CONFIG_NS_ID, "permissions", true);
  59231. this.accessibleContent = null;
  59232. this.change = null;
  59233. this.contentCopy = null;
  59234. this.documentAssembly = null;
  59235. this.formFieldFilling = null;
  59236. this.modifyAnnots = null;
  59237. this.plaintextMetadata = null;
  59238. this.print = null;
  59239. this.printHighQuality = null;
  59240. }
  59241. }
  59242. class PickTrayByPDFSize extends _xfa_object.Option01 {
  59243. constructor(attributes) {
  59244. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  59245. }
  59246. }
  59247. class Picture extends _xfa_object.StringObject {
  59248. constructor(attributes) {
  59249. super(CONFIG_NS_ID, "picture");
  59250. }
  59251. }
  59252. class PlaintextMetadata extends _xfa_object.Option01 {
  59253. constructor(attributes) {
  59254. super(CONFIG_NS_ID, "plaintextMetadata");
  59255. }
  59256. }
  59257. class Presence extends _xfa_object.OptionObject {
  59258. constructor(attributes) {
  59259. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  59260. }
  59261. }
  59262. class Present extends _xfa_object.XFAObject {
  59263. constructor(attributes) {
  59264. super(CONFIG_NS_ID, "present", true);
  59265. this.behaviorOverride = null;
  59266. this.cache = null;
  59267. this.common = null;
  59268. this.copies = null;
  59269. this.destination = null;
  59270. this.incrementalMerge = null;
  59271. this.layout = null;
  59272. this.output = null;
  59273. this.overprint = null;
  59274. this.pagination = null;
  59275. this.paginationOverride = null;
  59276. this.script = null;
  59277. this.validate = null;
  59278. this.xdp = null;
  59279. this.driver = new _xfa_object.XFAObjectArray();
  59280. this.labelPrinter = new _xfa_object.XFAObjectArray();
  59281. this.pcl = new _xfa_object.XFAObjectArray();
  59282. this.pdf = new _xfa_object.XFAObjectArray();
  59283. this.ps = new _xfa_object.XFAObjectArray();
  59284. this.submitUrl = new _xfa_object.XFAObjectArray();
  59285. this.webClient = new _xfa_object.XFAObjectArray();
  59286. this.zpl = new _xfa_object.XFAObjectArray();
  59287. }
  59288. }
  59289. class Print extends _xfa_object.Option01 {
  59290. constructor(attributes) {
  59291. super(CONFIG_NS_ID, "print");
  59292. }
  59293. }
  59294. class PrintHighQuality extends _xfa_object.Option01 {
  59295. constructor(attributes) {
  59296. super(CONFIG_NS_ID, "printHighQuality");
  59297. }
  59298. }
  59299. class PrintScaling extends _xfa_object.OptionObject {
  59300. constructor(attributes) {
  59301. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  59302. }
  59303. }
  59304. class PrinterName extends _xfa_object.StringObject {
  59305. constructor(attributes) {
  59306. super(CONFIG_NS_ID, "printerName");
  59307. }
  59308. }
  59309. class Producer extends _xfa_object.StringObject {
  59310. constructor(attributes) {
  59311. super(CONFIG_NS_ID, "producer");
  59312. }
  59313. }
  59314. class Ps extends _xfa_object.XFAObject {
  59315. constructor(attributes) {
  59316. super(CONFIG_NS_ID, "ps", true);
  59317. this.name = attributes.name || "";
  59318. this.batchOutput = null;
  59319. this.fontInfo = null;
  59320. this.jog = null;
  59321. this.mediumInfo = null;
  59322. this.outputBin = null;
  59323. this.staple = null;
  59324. this.xdc = null;
  59325. }
  59326. }
  59327. class Range extends _xfa_object.ContentObject {
  59328. constructor(attributes) {
  59329. super(CONFIG_NS_ID, "range");
  59330. }
  59331. [_xfa_object.$finalize]() {
  59332. 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 => {
  59333. if (range.length === 1) {
  59334. range.push(range[0]);
  59335. }
  59336. return range;
  59337. });
  59338. }
  59339. }
  59340. class Record extends _xfa_object.ContentObject {
  59341. constructor(attributes) {
  59342. super(CONFIG_NS_ID, "record");
  59343. }
  59344. [_xfa_object.$finalize]() {
  59345. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59346. const n = parseInt(this[_xfa_object.$content], 10);
  59347. if (!isNaN(n) && n >= 0) {
  59348. this[_xfa_object.$content] = n;
  59349. }
  59350. }
  59351. }
  59352. class Relevant extends _xfa_object.ContentObject {
  59353. constructor(attributes) {
  59354. super(CONFIG_NS_ID, "relevant");
  59355. }
  59356. [_xfa_object.$finalize]() {
  59357. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  59358. }
  59359. }
  59360. class Rename extends _xfa_object.ContentObject {
  59361. constructor(attributes) {
  59362. super(CONFIG_NS_ID, "rename");
  59363. }
  59364. [_xfa_object.$finalize]() {
  59365. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59366. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  59367. (0, _util.warn)("XFA - Rename: invalid XFA name");
  59368. }
  59369. }
  59370. }
  59371. class RenderPolicy extends _xfa_object.OptionObject {
  59372. constructor(attributes) {
  59373. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  59374. }
  59375. }
  59376. class RunScripts extends _xfa_object.OptionObject {
  59377. constructor(attributes) {
  59378. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  59379. }
  59380. }
  59381. class Script extends _xfa_object.XFAObject {
  59382. constructor(attributes) {
  59383. super(CONFIG_NS_ID, "script", true);
  59384. this.currentPage = null;
  59385. this.exclude = null;
  59386. this.runScripts = null;
  59387. }
  59388. }
  59389. class ScriptModel extends _xfa_object.OptionObject {
  59390. constructor(attributes) {
  59391. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  59392. }
  59393. }
  59394. class Severity extends _xfa_object.OptionObject {
  59395. constructor(attributes) {
  59396. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  59397. }
  59398. }
  59399. class SilentPrint extends _xfa_object.XFAObject {
  59400. constructor(attributes) {
  59401. super(CONFIG_NS_ID, "silentPrint", true);
  59402. this.addSilentPrint = null;
  59403. this.printerName = null;
  59404. }
  59405. }
  59406. class Staple extends _xfa_object.XFAObject {
  59407. constructor(attributes) {
  59408. super(CONFIG_NS_ID, "staple");
  59409. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  59410. }
  59411. }
  59412. class StartNode extends _xfa_object.StringObject {
  59413. constructor(attributes) {
  59414. super(CONFIG_NS_ID, "startNode");
  59415. }
  59416. }
  59417. class StartPage extends _xfa_object.IntegerObject {
  59418. constructor(attributes) {
  59419. super(CONFIG_NS_ID, "startPage", 0, n => true);
  59420. }
  59421. }
  59422. class SubmitFormat extends _xfa_object.OptionObject {
  59423. constructor(attributes) {
  59424. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  59425. }
  59426. }
  59427. class SubmitUrl extends _xfa_object.StringObject {
  59428. constructor(attributes) {
  59429. super(CONFIG_NS_ID, "submitUrl");
  59430. }
  59431. }
  59432. class SubsetBelow extends _xfa_object.IntegerObject {
  59433. constructor(attributes) {
  59434. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  59435. }
  59436. }
  59437. class SuppressBanner extends _xfa_object.Option01 {
  59438. constructor(attributes) {
  59439. super(CONFIG_NS_ID, "suppressBanner");
  59440. }
  59441. }
  59442. class Tagged extends _xfa_object.Option01 {
  59443. constructor(attributes) {
  59444. super(CONFIG_NS_ID, "tagged");
  59445. }
  59446. }
  59447. class Template extends _xfa_object.XFAObject {
  59448. constructor(attributes) {
  59449. super(CONFIG_NS_ID, "template", true);
  59450. this.base = null;
  59451. this.relevant = null;
  59452. this.startPage = null;
  59453. this.uri = null;
  59454. this.xsl = null;
  59455. }
  59456. }
  59457. class Threshold extends _xfa_object.OptionObject {
  59458. constructor(attributes) {
  59459. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  59460. }
  59461. }
  59462. class To extends _xfa_object.OptionObject {
  59463. constructor(attributes) {
  59464. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  59465. }
  59466. }
  59467. class TemplateCache extends _xfa_object.XFAObject {
  59468. constructor(attributes) {
  59469. super(CONFIG_NS_ID, "templateCache");
  59470. this.maxEntries = (0, _utils.getInteger)({
  59471. data: attributes.maxEntries,
  59472. defaultValue: 5,
  59473. validate: n => n >= 0
  59474. });
  59475. }
  59476. }
  59477. class Trace extends _xfa_object.XFAObject {
  59478. constructor(attributes) {
  59479. super(CONFIG_NS_ID, "trace", true);
  59480. this.area = new _xfa_object.XFAObjectArray();
  59481. }
  59482. }
  59483. class Transform extends _xfa_object.XFAObject {
  59484. constructor(attributes) {
  59485. super(CONFIG_NS_ID, "transform", true);
  59486. this.groupParent = null;
  59487. this.ifEmpty = null;
  59488. this.nameAttr = null;
  59489. this.picture = null;
  59490. this.presence = null;
  59491. this.rename = null;
  59492. this.whitespace = null;
  59493. }
  59494. }
  59495. class Type extends _xfa_object.OptionObject {
  59496. constructor(attributes) {
  59497. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  59498. }
  59499. }
  59500. class Uri extends _xfa_object.StringObject {
  59501. constructor(attributes) {
  59502. super(CONFIG_NS_ID, "uri");
  59503. }
  59504. }
  59505. class Validate extends _xfa_object.OptionObject {
  59506. constructor(attributes) {
  59507. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  59508. }
  59509. }
  59510. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  59511. constructor(attributes) {
  59512. super(CONFIG_NS_ID, "validateApprovalSignatures");
  59513. }
  59514. [_xfa_object.$finalize]() {
  59515. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  59516. }
  59517. }
  59518. class ValidationMessaging extends _xfa_object.OptionObject {
  59519. constructor(attributes) {
  59520. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  59521. }
  59522. }
  59523. class Version extends _xfa_object.OptionObject {
  59524. constructor(attributes) {
  59525. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  59526. }
  59527. }
  59528. class VersionControl extends _xfa_object.XFAObject {
  59529. constructor(attributes) {
  59530. super(CONFIG_NS_ID, "VersionControl");
  59531. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  59532. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  59533. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  59534. }
  59535. }
  59536. class ViewerPreferences extends _xfa_object.XFAObject {
  59537. constructor(attributes) {
  59538. super(CONFIG_NS_ID, "viewerPreferences", true);
  59539. this.ADBE_JSConsole = null;
  59540. this.ADBE_JSDebugger = null;
  59541. this.addViewerPreferences = null;
  59542. this.duplexOption = null;
  59543. this.enforce = null;
  59544. this.numberOfCopies = null;
  59545. this.pageRange = null;
  59546. this.pickTrayByPDFSize = null;
  59547. this.printScaling = null;
  59548. }
  59549. }
  59550. class WebClient extends _xfa_object.XFAObject {
  59551. constructor(attributes) {
  59552. super(CONFIG_NS_ID, "webClient", true);
  59553. this.name = attributes.name ? attributes.name.trim() : "";
  59554. this.fontInfo = null;
  59555. this.xdc = null;
  59556. }
  59557. }
  59558. class Whitespace extends _xfa_object.OptionObject {
  59559. constructor(attributes) {
  59560. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  59561. }
  59562. }
  59563. class Window extends _xfa_object.ContentObject {
  59564. constructor(attributes) {
  59565. super(CONFIG_NS_ID, "window");
  59566. }
  59567. [_xfa_object.$finalize]() {
  59568. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  59569. if (pair.some(x => isNaN(x))) {
  59570. this[_xfa_object.$content] = [0, 0];
  59571. return;
  59572. }
  59573. if (pair.length === 1) {
  59574. pair.push(pair[0]);
  59575. }
  59576. this[_xfa_object.$content] = pair;
  59577. }
  59578. }
  59579. class Xdc extends _xfa_object.XFAObject {
  59580. constructor(attributes) {
  59581. super(CONFIG_NS_ID, "xdc", true);
  59582. this.uri = new _xfa_object.XFAObjectArray();
  59583. this.xsl = new _xfa_object.XFAObjectArray();
  59584. }
  59585. }
  59586. class Xdp extends _xfa_object.XFAObject {
  59587. constructor(attributes) {
  59588. super(CONFIG_NS_ID, "xdp", true);
  59589. this.packets = null;
  59590. }
  59591. }
  59592. class Xsl extends _xfa_object.XFAObject {
  59593. constructor(attributes) {
  59594. super(CONFIG_NS_ID, "xsl", true);
  59595. this.debug = null;
  59596. this.uri = null;
  59597. }
  59598. }
  59599. class Zpl extends _xfa_object.XFAObject {
  59600. constructor(attributes) {
  59601. super(CONFIG_NS_ID, "zpl", true);
  59602. this.name = attributes.name ? attributes.name.trim() : "";
  59603. this.batchOutput = null;
  59604. this.flipLabel = null;
  59605. this.fontInfo = null;
  59606. this.xdc = null;
  59607. }
  59608. }
  59609. class ConfigNamespace {
  59610. static [_namespaces.$buildXFAObject](name, attributes) {
  59611. if (ConfigNamespace.hasOwnProperty(name)) {
  59612. return ConfigNamespace[name](attributes);
  59613. }
  59614. return undefined;
  59615. }
  59616. static acrobat(attrs) {
  59617. return new Acrobat(attrs);
  59618. }
  59619. static acrobat7(attrs) {
  59620. return new Acrobat7(attrs);
  59621. }
  59622. static ADBE_JSConsole(attrs) {
  59623. return new ADBE_JSConsole(attrs);
  59624. }
  59625. static ADBE_JSDebugger(attrs) {
  59626. return new ADBE_JSDebugger(attrs);
  59627. }
  59628. static addSilentPrint(attrs) {
  59629. return new AddSilentPrint(attrs);
  59630. }
  59631. static addViewerPreferences(attrs) {
  59632. return new AddViewerPreferences(attrs);
  59633. }
  59634. static adjustData(attrs) {
  59635. return new AdjustData(attrs);
  59636. }
  59637. static adobeExtensionLevel(attrs) {
  59638. return new AdobeExtensionLevel(attrs);
  59639. }
  59640. static agent(attrs) {
  59641. return new Agent(attrs);
  59642. }
  59643. static alwaysEmbed(attrs) {
  59644. return new AlwaysEmbed(attrs);
  59645. }
  59646. static amd(attrs) {
  59647. return new Amd(attrs);
  59648. }
  59649. static area(attrs) {
  59650. return new Area(attrs);
  59651. }
  59652. static attributes(attrs) {
  59653. return new Attributes(attrs);
  59654. }
  59655. static autoSave(attrs) {
  59656. return new AutoSave(attrs);
  59657. }
  59658. static base(attrs) {
  59659. return new Base(attrs);
  59660. }
  59661. static batchOutput(attrs) {
  59662. return new BatchOutput(attrs);
  59663. }
  59664. static behaviorOverride(attrs) {
  59665. return new BehaviorOverride(attrs);
  59666. }
  59667. static cache(attrs) {
  59668. return new Cache(attrs);
  59669. }
  59670. static change(attrs) {
  59671. return new Change(attrs);
  59672. }
  59673. static common(attrs) {
  59674. return new Common(attrs);
  59675. }
  59676. static compress(attrs) {
  59677. return new Compress(attrs);
  59678. }
  59679. static compressLogicalStructure(attrs) {
  59680. return new CompressLogicalStructure(attrs);
  59681. }
  59682. static compressObjectStream(attrs) {
  59683. return new CompressObjectStream(attrs);
  59684. }
  59685. static compression(attrs) {
  59686. return new Compression(attrs);
  59687. }
  59688. static config(attrs) {
  59689. return new Config(attrs);
  59690. }
  59691. static conformance(attrs) {
  59692. return new Conformance(attrs);
  59693. }
  59694. static contentCopy(attrs) {
  59695. return new ContentCopy(attrs);
  59696. }
  59697. static copies(attrs) {
  59698. return new Copies(attrs);
  59699. }
  59700. static creator(attrs) {
  59701. return new Creator(attrs);
  59702. }
  59703. static currentPage(attrs) {
  59704. return new CurrentPage(attrs);
  59705. }
  59706. static data(attrs) {
  59707. return new Data(attrs);
  59708. }
  59709. static debug(attrs) {
  59710. return new Debug(attrs);
  59711. }
  59712. static defaultTypeface(attrs) {
  59713. return new DefaultTypeface(attrs);
  59714. }
  59715. static destination(attrs) {
  59716. return new Destination(attrs);
  59717. }
  59718. static documentAssembly(attrs) {
  59719. return new DocumentAssembly(attrs);
  59720. }
  59721. static driver(attrs) {
  59722. return new Driver(attrs);
  59723. }
  59724. static duplexOption(attrs) {
  59725. return new DuplexOption(attrs);
  59726. }
  59727. static dynamicRender(attrs) {
  59728. return new DynamicRender(attrs);
  59729. }
  59730. static embed(attrs) {
  59731. return new Embed(attrs);
  59732. }
  59733. static encrypt(attrs) {
  59734. return new Encrypt(attrs);
  59735. }
  59736. static encryption(attrs) {
  59737. return new Encryption(attrs);
  59738. }
  59739. static encryptionLevel(attrs) {
  59740. return new EncryptionLevel(attrs);
  59741. }
  59742. static enforce(attrs) {
  59743. return new Enforce(attrs);
  59744. }
  59745. static equate(attrs) {
  59746. return new Equate(attrs);
  59747. }
  59748. static equateRange(attrs) {
  59749. return new EquateRange(attrs);
  59750. }
  59751. static exclude(attrs) {
  59752. return new Exclude(attrs);
  59753. }
  59754. static excludeNS(attrs) {
  59755. return new ExcludeNS(attrs);
  59756. }
  59757. static flipLabel(attrs) {
  59758. return new FlipLabel(attrs);
  59759. }
  59760. static fontInfo(attrs) {
  59761. return new FontInfo(attrs);
  59762. }
  59763. static formFieldFilling(attrs) {
  59764. return new FormFieldFilling(attrs);
  59765. }
  59766. static groupParent(attrs) {
  59767. return new GroupParent(attrs);
  59768. }
  59769. static ifEmpty(attrs) {
  59770. return new IfEmpty(attrs);
  59771. }
  59772. static includeXDPContent(attrs) {
  59773. return new IncludeXDPContent(attrs);
  59774. }
  59775. static incrementalLoad(attrs) {
  59776. return new IncrementalLoad(attrs);
  59777. }
  59778. static incrementalMerge(attrs) {
  59779. return new IncrementalMerge(attrs);
  59780. }
  59781. static interactive(attrs) {
  59782. return new Interactive(attrs);
  59783. }
  59784. static jog(attrs) {
  59785. return new Jog(attrs);
  59786. }
  59787. static labelPrinter(attrs) {
  59788. return new LabelPrinter(attrs);
  59789. }
  59790. static layout(attrs) {
  59791. return new Layout(attrs);
  59792. }
  59793. static level(attrs) {
  59794. return new Level(attrs);
  59795. }
  59796. static linearized(attrs) {
  59797. return new Linearized(attrs);
  59798. }
  59799. static locale(attrs) {
  59800. return new Locale(attrs);
  59801. }
  59802. static localeSet(attrs) {
  59803. return new LocaleSet(attrs);
  59804. }
  59805. static log(attrs) {
  59806. return new Log(attrs);
  59807. }
  59808. static map(attrs) {
  59809. return new MapElement(attrs);
  59810. }
  59811. static mediumInfo(attrs) {
  59812. return new MediumInfo(attrs);
  59813. }
  59814. static message(attrs) {
  59815. return new Message(attrs);
  59816. }
  59817. static messaging(attrs) {
  59818. return new Messaging(attrs);
  59819. }
  59820. static mode(attrs) {
  59821. return new Mode(attrs);
  59822. }
  59823. static modifyAnnots(attrs) {
  59824. return new ModifyAnnots(attrs);
  59825. }
  59826. static msgId(attrs) {
  59827. return new MsgId(attrs);
  59828. }
  59829. static nameAttr(attrs) {
  59830. return new NameAttr(attrs);
  59831. }
  59832. static neverEmbed(attrs) {
  59833. return new NeverEmbed(attrs);
  59834. }
  59835. static numberOfCopies(attrs) {
  59836. return new NumberOfCopies(attrs);
  59837. }
  59838. static openAction(attrs) {
  59839. return new OpenAction(attrs);
  59840. }
  59841. static output(attrs) {
  59842. return new Output(attrs);
  59843. }
  59844. static outputBin(attrs) {
  59845. return new OutputBin(attrs);
  59846. }
  59847. static outputXSL(attrs) {
  59848. return new OutputXSL(attrs);
  59849. }
  59850. static overprint(attrs) {
  59851. return new Overprint(attrs);
  59852. }
  59853. static packets(attrs) {
  59854. return new Packets(attrs);
  59855. }
  59856. static pageOffset(attrs) {
  59857. return new PageOffset(attrs);
  59858. }
  59859. static pageRange(attrs) {
  59860. return new PageRange(attrs);
  59861. }
  59862. static pagination(attrs) {
  59863. return new Pagination(attrs);
  59864. }
  59865. static paginationOverride(attrs) {
  59866. return new PaginationOverride(attrs);
  59867. }
  59868. static part(attrs) {
  59869. return new Part(attrs);
  59870. }
  59871. static pcl(attrs) {
  59872. return new Pcl(attrs);
  59873. }
  59874. static pdf(attrs) {
  59875. return new Pdf(attrs);
  59876. }
  59877. static pdfa(attrs) {
  59878. return new Pdfa(attrs);
  59879. }
  59880. static permissions(attrs) {
  59881. return new Permissions(attrs);
  59882. }
  59883. static pickTrayByPDFSize(attrs) {
  59884. return new PickTrayByPDFSize(attrs);
  59885. }
  59886. static picture(attrs) {
  59887. return new Picture(attrs);
  59888. }
  59889. static plaintextMetadata(attrs) {
  59890. return new PlaintextMetadata(attrs);
  59891. }
  59892. static presence(attrs) {
  59893. return new Presence(attrs);
  59894. }
  59895. static present(attrs) {
  59896. return new Present(attrs);
  59897. }
  59898. static print(attrs) {
  59899. return new Print(attrs);
  59900. }
  59901. static printHighQuality(attrs) {
  59902. return new PrintHighQuality(attrs);
  59903. }
  59904. static printScaling(attrs) {
  59905. return new PrintScaling(attrs);
  59906. }
  59907. static printerName(attrs) {
  59908. return new PrinterName(attrs);
  59909. }
  59910. static producer(attrs) {
  59911. return new Producer(attrs);
  59912. }
  59913. static ps(attrs) {
  59914. return new Ps(attrs);
  59915. }
  59916. static range(attrs) {
  59917. return new Range(attrs);
  59918. }
  59919. static record(attrs) {
  59920. return new Record(attrs);
  59921. }
  59922. static relevant(attrs) {
  59923. return new Relevant(attrs);
  59924. }
  59925. static rename(attrs) {
  59926. return new Rename(attrs);
  59927. }
  59928. static renderPolicy(attrs) {
  59929. return new RenderPolicy(attrs);
  59930. }
  59931. static runScripts(attrs) {
  59932. return new RunScripts(attrs);
  59933. }
  59934. static script(attrs) {
  59935. return new Script(attrs);
  59936. }
  59937. static scriptModel(attrs) {
  59938. return new ScriptModel(attrs);
  59939. }
  59940. static severity(attrs) {
  59941. return new Severity(attrs);
  59942. }
  59943. static silentPrint(attrs) {
  59944. return new SilentPrint(attrs);
  59945. }
  59946. static staple(attrs) {
  59947. return new Staple(attrs);
  59948. }
  59949. static startNode(attrs) {
  59950. return new StartNode(attrs);
  59951. }
  59952. static startPage(attrs) {
  59953. return new StartPage(attrs);
  59954. }
  59955. static submitFormat(attrs) {
  59956. return new SubmitFormat(attrs);
  59957. }
  59958. static submitUrl(attrs) {
  59959. return new SubmitUrl(attrs);
  59960. }
  59961. static subsetBelow(attrs) {
  59962. return new SubsetBelow(attrs);
  59963. }
  59964. static suppressBanner(attrs) {
  59965. return new SuppressBanner(attrs);
  59966. }
  59967. static tagged(attrs) {
  59968. return new Tagged(attrs);
  59969. }
  59970. static template(attrs) {
  59971. return new Template(attrs);
  59972. }
  59973. static templateCache(attrs) {
  59974. return new TemplateCache(attrs);
  59975. }
  59976. static threshold(attrs) {
  59977. return new Threshold(attrs);
  59978. }
  59979. static to(attrs) {
  59980. return new To(attrs);
  59981. }
  59982. static trace(attrs) {
  59983. return new Trace(attrs);
  59984. }
  59985. static transform(attrs) {
  59986. return new Transform(attrs);
  59987. }
  59988. static type(attrs) {
  59989. return new Type(attrs);
  59990. }
  59991. static uri(attrs) {
  59992. return new Uri(attrs);
  59993. }
  59994. static validate(attrs) {
  59995. return new Validate(attrs);
  59996. }
  59997. static validateApprovalSignatures(attrs) {
  59998. return new ValidateApprovalSignatures(attrs);
  59999. }
  60000. static validationMessaging(attrs) {
  60001. return new ValidationMessaging(attrs);
  60002. }
  60003. static version(attrs) {
  60004. return new Version(attrs);
  60005. }
  60006. static versionControl(attrs) {
  60007. return new VersionControl(attrs);
  60008. }
  60009. static viewerPreferences(attrs) {
  60010. return new ViewerPreferences(attrs);
  60011. }
  60012. static webClient(attrs) {
  60013. return new WebClient(attrs);
  60014. }
  60015. static whitespace(attrs) {
  60016. return new Whitespace(attrs);
  60017. }
  60018. static window(attrs) {
  60019. return new Window(attrs);
  60020. }
  60021. static xdc(attrs) {
  60022. return new Xdc(attrs);
  60023. }
  60024. static xdp(attrs) {
  60025. return new Xdp(attrs);
  60026. }
  60027. static xsl(attrs) {
  60028. return new Xsl(attrs);
  60029. }
  60030. static zpl(attrs) {
  60031. return new Zpl(attrs);
  60032. }
  60033. }
  60034. exports.ConfigNamespace = ConfigNamespace;
  60035. /***/ }),
  60036. /* 91 */
  60037. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60038. Object.defineProperty(exports, "__esModule", ({
  60039. value: true
  60040. }));
  60041. exports.ConnectionSetNamespace = void 0;
  60042. var _namespaces = __w_pdfjs_require__(78);
  60043. var _xfa_object = __w_pdfjs_require__(76);
  60044. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  60045. class ConnectionSet extends _xfa_object.XFAObject {
  60046. constructor(attributes) {
  60047. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  60048. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  60049. this.xmlConnection = new _xfa_object.XFAObjectArray();
  60050. this.xsdConnection = new _xfa_object.XFAObjectArray();
  60051. }
  60052. }
  60053. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  60054. constructor(attributes) {
  60055. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  60056. this.id = attributes.id || "";
  60057. this.name = attributes.name || "";
  60058. this.use = attributes.use || "";
  60059. this.usehref = attributes.usehref || "";
  60060. }
  60061. }
  60062. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  60063. constructor(attributes) {
  60064. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  60065. this.id = attributes.id || "";
  60066. this.name = attributes.name || "";
  60067. this.use = attributes.use || "";
  60068. this.usehref = attributes.usehref || "";
  60069. }
  60070. }
  60071. class Operation extends _xfa_object.StringObject {
  60072. constructor(attributes) {
  60073. super(CONNECTION_SET_NS_ID, "operation");
  60074. this.id = attributes.id || "";
  60075. this.input = attributes.input || "";
  60076. this.name = attributes.name || "";
  60077. this.output = attributes.output || "";
  60078. this.use = attributes.use || "";
  60079. this.usehref = attributes.usehref || "";
  60080. }
  60081. }
  60082. class RootElement extends _xfa_object.StringObject {
  60083. constructor(attributes) {
  60084. super(CONNECTION_SET_NS_ID, "rootElement");
  60085. this.id = attributes.id || "";
  60086. this.name = attributes.name || "";
  60087. this.use = attributes.use || "";
  60088. this.usehref = attributes.usehref || "";
  60089. }
  60090. }
  60091. class SoapAction extends _xfa_object.StringObject {
  60092. constructor(attributes) {
  60093. super(CONNECTION_SET_NS_ID, "soapAction");
  60094. this.id = attributes.id || "";
  60095. this.name = attributes.name || "";
  60096. this.use = attributes.use || "";
  60097. this.usehref = attributes.usehref || "";
  60098. }
  60099. }
  60100. class SoapAddress extends _xfa_object.StringObject {
  60101. constructor(attributes) {
  60102. super(CONNECTION_SET_NS_ID, "soapAddress");
  60103. this.id = attributes.id || "";
  60104. this.name = attributes.name || "";
  60105. this.use = attributes.use || "";
  60106. this.usehref = attributes.usehref || "";
  60107. }
  60108. }
  60109. class Uri extends _xfa_object.StringObject {
  60110. constructor(attributes) {
  60111. super(CONNECTION_SET_NS_ID, "uri");
  60112. this.id = attributes.id || "";
  60113. this.name = attributes.name || "";
  60114. this.use = attributes.use || "";
  60115. this.usehref = attributes.usehref || "";
  60116. }
  60117. }
  60118. class WsdlAddress extends _xfa_object.StringObject {
  60119. constructor(attributes) {
  60120. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  60121. this.id = attributes.id || "";
  60122. this.name = attributes.name || "";
  60123. this.use = attributes.use || "";
  60124. this.usehref = attributes.usehref || "";
  60125. }
  60126. }
  60127. class WsdlConnection extends _xfa_object.XFAObject {
  60128. constructor(attributes) {
  60129. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  60130. this.dataDescription = attributes.dataDescription || "";
  60131. this.name = attributes.name || "";
  60132. this.effectiveInputPolicy = null;
  60133. this.effectiveOutputPolicy = null;
  60134. this.operation = null;
  60135. this.soapAction = null;
  60136. this.soapAddress = null;
  60137. this.wsdlAddress = null;
  60138. }
  60139. }
  60140. class XmlConnection extends _xfa_object.XFAObject {
  60141. constructor(attributes) {
  60142. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  60143. this.dataDescription = attributes.dataDescription || "";
  60144. this.name = attributes.name || "";
  60145. this.uri = null;
  60146. }
  60147. }
  60148. class XsdConnection extends _xfa_object.XFAObject {
  60149. constructor(attributes) {
  60150. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  60151. this.dataDescription = attributes.dataDescription || "";
  60152. this.name = attributes.name || "";
  60153. this.rootElement = null;
  60154. this.uri = null;
  60155. }
  60156. }
  60157. class ConnectionSetNamespace {
  60158. static [_namespaces.$buildXFAObject](name, attributes) {
  60159. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  60160. return ConnectionSetNamespace[name](attributes);
  60161. }
  60162. return undefined;
  60163. }
  60164. static connectionSet(attrs) {
  60165. return new ConnectionSet(attrs);
  60166. }
  60167. static effectiveInputPolicy(attrs) {
  60168. return new EffectiveInputPolicy(attrs);
  60169. }
  60170. static effectiveOutputPolicy(attrs) {
  60171. return new EffectiveOutputPolicy(attrs);
  60172. }
  60173. static operation(attrs) {
  60174. return new Operation(attrs);
  60175. }
  60176. static rootElement(attrs) {
  60177. return new RootElement(attrs);
  60178. }
  60179. static soapAction(attrs) {
  60180. return new SoapAction(attrs);
  60181. }
  60182. static soapAddress(attrs) {
  60183. return new SoapAddress(attrs);
  60184. }
  60185. static uri(attrs) {
  60186. return new Uri(attrs);
  60187. }
  60188. static wsdlAddress(attrs) {
  60189. return new WsdlAddress(attrs);
  60190. }
  60191. static wsdlConnection(attrs) {
  60192. return new WsdlConnection(attrs);
  60193. }
  60194. static xmlConnection(attrs) {
  60195. return new XmlConnection(attrs);
  60196. }
  60197. static xsdConnection(attrs) {
  60198. return new XsdConnection(attrs);
  60199. }
  60200. }
  60201. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  60202. /***/ }),
  60203. /* 92 */
  60204. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60205. Object.defineProperty(exports, "__esModule", ({
  60206. value: true
  60207. }));
  60208. exports.DatasetsNamespace = void 0;
  60209. var _xfa_object = __w_pdfjs_require__(76);
  60210. var _namespaces = __w_pdfjs_require__(78);
  60211. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  60212. class Data extends _xfa_object.XmlObject {
  60213. constructor(attributes) {
  60214. super(DATASETS_NS_ID, "data", attributes);
  60215. }
  60216. [_xfa_object.$isNsAgnostic]() {
  60217. return true;
  60218. }
  60219. }
  60220. class Datasets extends _xfa_object.XFAObject {
  60221. constructor(attributes) {
  60222. super(DATASETS_NS_ID, "datasets", true);
  60223. this.data = null;
  60224. this.Signature = null;
  60225. }
  60226. [_xfa_object.$onChild](child) {
  60227. const name = child[_xfa_object.$nodeName];
  60228. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  60229. this[name] = child;
  60230. }
  60231. this[_xfa_object.$appendChild](child);
  60232. }
  60233. }
  60234. class DatasetsNamespace {
  60235. static [_namespaces.$buildXFAObject](name, attributes) {
  60236. if (DatasetsNamespace.hasOwnProperty(name)) {
  60237. return DatasetsNamespace[name](attributes);
  60238. }
  60239. return undefined;
  60240. }
  60241. static datasets(attributes) {
  60242. return new Datasets(attributes);
  60243. }
  60244. static data(attributes) {
  60245. return new Data(attributes);
  60246. }
  60247. }
  60248. exports.DatasetsNamespace = DatasetsNamespace;
  60249. /***/ }),
  60250. /* 93 */
  60251. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60252. Object.defineProperty(exports, "__esModule", ({
  60253. value: true
  60254. }));
  60255. exports.LocaleSetNamespace = void 0;
  60256. var _namespaces = __w_pdfjs_require__(78);
  60257. var _xfa_object = __w_pdfjs_require__(76);
  60258. var _utils = __w_pdfjs_require__(77);
  60259. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  60260. class CalendarSymbols extends _xfa_object.XFAObject {
  60261. constructor(attributes) {
  60262. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  60263. this.name = "gregorian";
  60264. this.dayNames = new _xfa_object.XFAObjectArray(2);
  60265. this.eraNames = null;
  60266. this.meridiemNames = null;
  60267. this.monthNames = new _xfa_object.XFAObjectArray(2);
  60268. }
  60269. }
  60270. class CurrencySymbol extends _xfa_object.StringObject {
  60271. constructor(attributes) {
  60272. super(LOCALE_SET_NS_ID, "currencySymbol");
  60273. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  60274. }
  60275. }
  60276. class CurrencySymbols extends _xfa_object.XFAObject {
  60277. constructor(attributes) {
  60278. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  60279. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  60280. }
  60281. }
  60282. class DatePattern extends _xfa_object.StringObject {
  60283. constructor(attributes) {
  60284. super(LOCALE_SET_NS_ID, "datePattern");
  60285. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60286. }
  60287. }
  60288. class DatePatterns extends _xfa_object.XFAObject {
  60289. constructor(attributes) {
  60290. super(LOCALE_SET_NS_ID, "datePatterns", true);
  60291. this.datePattern = new _xfa_object.XFAObjectArray(4);
  60292. }
  60293. }
  60294. class DateTimeSymbols extends _xfa_object.ContentObject {
  60295. constructor(attributes) {
  60296. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  60297. }
  60298. }
  60299. class Day extends _xfa_object.StringObject {
  60300. constructor(attributes) {
  60301. super(LOCALE_SET_NS_ID, "day");
  60302. }
  60303. }
  60304. class DayNames extends _xfa_object.XFAObject {
  60305. constructor(attributes) {
  60306. super(LOCALE_SET_NS_ID, "dayNames", true);
  60307. this.abbr = (0, _utils.getInteger)({
  60308. data: attributes.abbr,
  60309. defaultValue: 0,
  60310. validate: x => x === 1
  60311. });
  60312. this.day = new _xfa_object.XFAObjectArray(7);
  60313. }
  60314. }
  60315. class Era extends _xfa_object.StringObject {
  60316. constructor(attributes) {
  60317. super(LOCALE_SET_NS_ID, "era");
  60318. }
  60319. }
  60320. class EraNames extends _xfa_object.XFAObject {
  60321. constructor(attributes) {
  60322. super(LOCALE_SET_NS_ID, "eraNames", true);
  60323. this.era = new _xfa_object.XFAObjectArray(2);
  60324. }
  60325. }
  60326. class Locale extends _xfa_object.XFAObject {
  60327. constructor(attributes) {
  60328. super(LOCALE_SET_NS_ID, "locale", true);
  60329. this.desc = attributes.desc || "";
  60330. this.name = "isoname";
  60331. this.calendarSymbols = null;
  60332. this.currencySymbols = null;
  60333. this.datePatterns = null;
  60334. this.dateTimeSymbols = null;
  60335. this.numberPatterns = null;
  60336. this.numberSymbols = null;
  60337. this.timePatterns = null;
  60338. this.typeFaces = null;
  60339. }
  60340. }
  60341. class LocaleSet extends _xfa_object.XFAObject {
  60342. constructor(attributes) {
  60343. super(LOCALE_SET_NS_ID, "localeSet", true);
  60344. this.locale = new _xfa_object.XFAObjectArray();
  60345. }
  60346. }
  60347. class Meridiem extends _xfa_object.StringObject {
  60348. constructor(attributes) {
  60349. super(LOCALE_SET_NS_ID, "meridiem");
  60350. }
  60351. }
  60352. class MeridiemNames extends _xfa_object.XFAObject {
  60353. constructor(attributes) {
  60354. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  60355. this.meridiem = new _xfa_object.XFAObjectArray(2);
  60356. }
  60357. }
  60358. class Month extends _xfa_object.StringObject {
  60359. constructor(attributes) {
  60360. super(LOCALE_SET_NS_ID, "month");
  60361. }
  60362. }
  60363. class MonthNames extends _xfa_object.XFAObject {
  60364. constructor(attributes) {
  60365. super(LOCALE_SET_NS_ID, "monthNames", true);
  60366. this.abbr = (0, _utils.getInteger)({
  60367. data: attributes.abbr,
  60368. defaultValue: 0,
  60369. validate: x => x === 1
  60370. });
  60371. this.month = new _xfa_object.XFAObjectArray(12);
  60372. }
  60373. }
  60374. class NumberPattern extends _xfa_object.StringObject {
  60375. constructor(attributes) {
  60376. super(LOCALE_SET_NS_ID, "numberPattern");
  60377. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60378. }
  60379. }
  60380. class NumberPatterns extends _xfa_object.XFAObject {
  60381. constructor(attributes) {
  60382. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  60383. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  60384. }
  60385. }
  60386. class NumberSymbol extends _xfa_object.StringObject {
  60387. constructor(attributes) {
  60388. super(LOCALE_SET_NS_ID, "numberSymbol");
  60389. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  60390. }
  60391. }
  60392. class NumberSymbols extends _xfa_object.XFAObject {
  60393. constructor(attributes) {
  60394. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  60395. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  60396. }
  60397. }
  60398. class TimePattern extends _xfa_object.StringObject {
  60399. constructor(attributes) {
  60400. super(LOCALE_SET_NS_ID, "timePattern");
  60401. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60402. }
  60403. }
  60404. class TimePatterns extends _xfa_object.XFAObject {
  60405. constructor(attributes) {
  60406. super(LOCALE_SET_NS_ID, "timePatterns", true);
  60407. this.timePattern = new _xfa_object.XFAObjectArray(4);
  60408. }
  60409. }
  60410. class TypeFace extends _xfa_object.XFAObject {
  60411. constructor(attributes) {
  60412. super(LOCALE_SET_NS_ID, "typeFace", true);
  60413. this.name = attributes.name | "";
  60414. }
  60415. }
  60416. class TypeFaces extends _xfa_object.XFAObject {
  60417. constructor(attributes) {
  60418. super(LOCALE_SET_NS_ID, "typeFaces", true);
  60419. this.typeFace = new _xfa_object.XFAObjectArray();
  60420. }
  60421. }
  60422. class LocaleSetNamespace {
  60423. static [_namespaces.$buildXFAObject](name, attributes) {
  60424. if (LocaleSetNamespace.hasOwnProperty(name)) {
  60425. return LocaleSetNamespace[name](attributes);
  60426. }
  60427. return undefined;
  60428. }
  60429. static calendarSymbols(attrs) {
  60430. return new CalendarSymbols(attrs);
  60431. }
  60432. static currencySymbol(attrs) {
  60433. return new CurrencySymbol(attrs);
  60434. }
  60435. static currencySymbols(attrs) {
  60436. return new CurrencySymbols(attrs);
  60437. }
  60438. static datePattern(attrs) {
  60439. return new DatePattern(attrs);
  60440. }
  60441. static datePatterns(attrs) {
  60442. return new DatePatterns(attrs);
  60443. }
  60444. static dateTimeSymbols(attrs) {
  60445. return new DateTimeSymbols(attrs);
  60446. }
  60447. static day(attrs) {
  60448. return new Day(attrs);
  60449. }
  60450. static dayNames(attrs) {
  60451. return new DayNames(attrs);
  60452. }
  60453. static era(attrs) {
  60454. return new Era(attrs);
  60455. }
  60456. static eraNames(attrs) {
  60457. return new EraNames(attrs);
  60458. }
  60459. static locale(attrs) {
  60460. return new Locale(attrs);
  60461. }
  60462. static localeSet(attrs) {
  60463. return new LocaleSet(attrs);
  60464. }
  60465. static meridiem(attrs) {
  60466. return new Meridiem(attrs);
  60467. }
  60468. static meridiemNames(attrs) {
  60469. return new MeridiemNames(attrs);
  60470. }
  60471. static month(attrs) {
  60472. return new Month(attrs);
  60473. }
  60474. static monthNames(attrs) {
  60475. return new MonthNames(attrs);
  60476. }
  60477. static numberPattern(attrs) {
  60478. return new NumberPattern(attrs);
  60479. }
  60480. static numberPatterns(attrs) {
  60481. return new NumberPatterns(attrs);
  60482. }
  60483. static numberSymbol(attrs) {
  60484. return new NumberSymbol(attrs);
  60485. }
  60486. static numberSymbols(attrs) {
  60487. return new NumberSymbols(attrs);
  60488. }
  60489. static timePattern(attrs) {
  60490. return new TimePattern(attrs);
  60491. }
  60492. static timePatterns(attrs) {
  60493. return new TimePatterns(attrs);
  60494. }
  60495. static typeFace(attrs) {
  60496. return new TypeFace(attrs);
  60497. }
  60498. static typeFaces(attrs) {
  60499. return new TypeFaces(attrs);
  60500. }
  60501. }
  60502. exports.LocaleSetNamespace = LocaleSetNamespace;
  60503. /***/ }),
  60504. /* 94 */
  60505. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60506. Object.defineProperty(exports, "__esModule", ({
  60507. value: true
  60508. }));
  60509. exports.SignatureNamespace = void 0;
  60510. var _namespaces = __w_pdfjs_require__(78);
  60511. var _xfa_object = __w_pdfjs_require__(76);
  60512. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  60513. class Signature extends _xfa_object.XFAObject {
  60514. constructor(attributes) {
  60515. super(SIGNATURE_NS_ID, "signature", true);
  60516. }
  60517. }
  60518. class SignatureNamespace {
  60519. static [_namespaces.$buildXFAObject](name, attributes) {
  60520. if (SignatureNamespace.hasOwnProperty(name)) {
  60521. return SignatureNamespace[name](attributes);
  60522. }
  60523. return undefined;
  60524. }
  60525. static signature(attributes) {
  60526. return new Signature(attributes);
  60527. }
  60528. }
  60529. exports.SignatureNamespace = SignatureNamespace;
  60530. /***/ }),
  60531. /* 95 */
  60532. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60533. Object.defineProperty(exports, "__esModule", ({
  60534. value: true
  60535. }));
  60536. exports.StylesheetNamespace = void 0;
  60537. var _namespaces = __w_pdfjs_require__(78);
  60538. var _xfa_object = __w_pdfjs_require__(76);
  60539. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  60540. class Stylesheet extends _xfa_object.XFAObject {
  60541. constructor(attributes) {
  60542. super(STYLESHEET_NS_ID, "stylesheet", true);
  60543. }
  60544. }
  60545. class StylesheetNamespace {
  60546. static [_namespaces.$buildXFAObject](name, attributes) {
  60547. if (StylesheetNamespace.hasOwnProperty(name)) {
  60548. return StylesheetNamespace[name](attributes);
  60549. }
  60550. return undefined;
  60551. }
  60552. static stylesheet(attributes) {
  60553. return new Stylesheet(attributes);
  60554. }
  60555. }
  60556. exports.StylesheetNamespace = StylesheetNamespace;
  60557. /***/ }),
  60558. /* 96 */
  60559. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60560. Object.defineProperty(exports, "__esModule", ({
  60561. value: true
  60562. }));
  60563. exports.XdpNamespace = void 0;
  60564. var _namespaces = __w_pdfjs_require__(78);
  60565. var _xfa_object = __w_pdfjs_require__(76);
  60566. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  60567. class Xdp extends _xfa_object.XFAObject {
  60568. constructor(attributes) {
  60569. super(XDP_NS_ID, "xdp", true);
  60570. this.uuid = attributes.uuid || "";
  60571. this.timeStamp = attributes.timeStamp || "";
  60572. this.config = null;
  60573. this.connectionSet = null;
  60574. this.datasets = null;
  60575. this.localeSet = null;
  60576. this.stylesheet = new _xfa_object.XFAObjectArray();
  60577. this.template = null;
  60578. }
  60579. [_xfa_object.$onChildCheck](child) {
  60580. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  60581. return ns && child[_xfa_object.$namespaceId] === ns.id;
  60582. }
  60583. }
  60584. class XdpNamespace {
  60585. static [_namespaces.$buildXFAObject](name, attributes) {
  60586. if (XdpNamespace.hasOwnProperty(name)) {
  60587. return XdpNamespace[name](attributes);
  60588. }
  60589. return undefined;
  60590. }
  60591. static xdp(attributes) {
  60592. return new Xdp(attributes);
  60593. }
  60594. }
  60595. exports.XdpNamespace = XdpNamespace;
  60596. /***/ }),
  60597. /* 97 */
  60598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60599. Object.defineProperty(exports, "__esModule", ({
  60600. value: true
  60601. }));
  60602. exports.XhtmlNamespace = void 0;
  60603. var _xfa_object = __w_pdfjs_require__(76);
  60604. var _namespaces = __w_pdfjs_require__(78);
  60605. var _html_utils = __w_pdfjs_require__(83);
  60606. var _utils = __w_pdfjs_require__(77);
  60607. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  60608. const $richText = Symbol();
  60609. 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"]);
  60610. 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) => {
  60611. value = original.fontSize = (0, _utils.getMeasurement)(value);
  60612. return (0, _html_utils.measureToString)(0.99 * value);
  60613. }], ["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))]]);
  60614. const spacesRegExp = /\s+/g;
  60615. const crlfRegExp = /[\r\n]+/g;
  60616. const crlfForRichTextRegExp = /\r\n?/g;
  60617. function mapStyle(styleStr, node, richText) {
  60618. const style = Object.create(null);
  60619. if (!styleStr) {
  60620. return style;
  60621. }
  60622. const original = Object.create(null);
  60623. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  60624. const mapping = StyleMapping.get(key);
  60625. if (mapping === "") {
  60626. continue;
  60627. }
  60628. let newValue = value;
  60629. if (mapping) {
  60630. if (typeof mapping === "string") {
  60631. newValue = mapping;
  60632. } else {
  60633. newValue = mapping(value, original);
  60634. }
  60635. }
  60636. if (key.endsWith("scale")) {
  60637. if (style.transform) {
  60638. style.transform = `${style[key]} ${newValue}`;
  60639. } else {
  60640. style.transform = newValue;
  60641. }
  60642. } else {
  60643. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  60644. }
  60645. }
  60646. if (style.fontFamily) {
  60647. (0, _html_utils.setFontFamily)({
  60648. typeface: style.fontFamily,
  60649. weight: style.fontWeight || "normal",
  60650. posture: style.fontStyle || "normal",
  60651. size: original.fontSize || 0
  60652. }, node, node[_xfa_object.$globalData].fontFinder, style);
  60653. }
  60654. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  60655. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  60656. const VERTICAL_FACTOR = 0.333;
  60657. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  60658. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  60659. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  60660. }
  60661. (0, _html_utils.fixTextIndent)(style);
  60662. return style;
  60663. }
  60664. function checkStyle(node) {
  60665. if (!node.style) {
  60666. return "";
  60667. }
  60668. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  60669. if (key === "font-family") {
  60670. node[_xfa_object.$globalData].usedTypefaces.add(value);
  60671. }
  60672. return VALID_STYLES.has(key);
  60673. }).map(kv => kv.join(":")).join(";");
  60674. }
  60675. const NoWhites = new Set(["body", "html"]);
  60676. class XhtmlObject extends _xfa_object.XmlObject {
  60677. constructor(attributes, name) {
  60678. super(XHTML_NS_ID, name);
  60679. this[$richText] = false;
  60680. this.style = attributes.style || "";
  60681. }
  60682. [_xfa_object.$clean](builder) {
  60683. super[_xfa_object.$clean](builder);
  60684. this.style = checkStyle(this);
  60685. }
  60686. [_xfa_object.$acceptWhitespace]() {
  60687. return !NoWhites.has(this[_xfa_object.$nodeName]);
  60688. }
  60689. [_xfa_object.$onText](str, richText = false) {
  60690. if (!richText) {
  60691. str = str.replace(crlfRegExp, "");
  60692. if (!this.style.includes("xfa-spacerun:yes")) {
  60693. str = str.replace(spacesRegExp, " ");
  60694. }
  60695. } else {
  60696. this[$richText] = true;
  60697. }
  60698. if (str) {
  60699. this[_xfa_object.$content] += str;
  60700. }
  60701. }
  60702. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  60703. const xfaFont = Object.create(null);
  60704. const margin = {
  60705. top: NaN,
  60706. bottom: NaN,
  60707. left: NaN,
  60708. right: NaN
  60709. };
  60710. let lineHeight = null;
  60711. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  60712. switch (key) {
  60713. case "font-family":
  60714. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  60715. break;
  60716. case "font-size":
  60717. xfaFont.size = (0, _utils.getMeasurement)(value);
  60718. break;
  60719. case "font-weight":
  60720. xfaFont.weight = value;
  60721. break;
  60722. case "font-style":
  60723. xfaFont.posture = value;
  60724. break;
  60725. case "letter-spacing":
  60726. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  60727. break;
  60728. case "margin":
  60729. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  60730. switch (values.length) {
  60731. case 1:
  60732. margin.top = margin.bottom = margin.left = margin.right = values[0];
  60733. break;
  60734. case 2:
  60735. margin.top = margin.bottom = values[0];
  60736. margin.left = margin.right = values[1];
  60737. break;
  60738. case 3:
  60739. margin.top = values[0];
  60740. margin.bottom = values[2];
  60741. margin.left = margin.right = values[1];
  60742. break;
  60743. case 4:
  60744. margin.top = values[0];
  60745. margin.left = values[1];
  60746. margin.bottom = values[2];
  60747. margin.right = values[3];
  60748. break;
  60749. }
  60750. break;
  60751. case "margin-top":
  60752. margin.top = (0, _utils.getMeasurement)(value);
  60753. break;
  60754. case "margin-bottom":
  60755. margin.bottom = (0, _utils.getMeasurement)(value);
  60756. break;
  60757. case "margin-left":
  60758. margin.left = (0, _utils.getMeasurement)(value);
  60759. break;
  60760. case "margin-right":
  60761. margin.right = (0, _utils.getMeasurement)(value);
  60762. break;
  60763. case "line-height":
  60764. lineHeight = (0, _utils.getMeasurement)(value);
  60765. break;
  60766. }
  60767. }
  60768. measure.pushData(xfaFont, margin, lineHeight);
  60769. if (this[_xfa_object.$content]) {
  60770. measure.addString(this[_xfa_object.$content]);
  60771. } else {
  60772. for (const child of this[_xfa_object.$getChildren]()) {
  60773. if (child[_xfa_object.$nodeName] === "#text") {
  60774. measure.addString(child[_xfa_object.$content]);
  60775. continue;
  60776. }
  60777. child[_xfa_object.$pushGlyphs](measure);
  60778. }
  60779. }
  60780. if (mustPop) {
  60781. measure.popFont();
  60782. }
  60783. }
  60784. [_xfa_object.$toHTML](availableSpace) {
  60785. const children = [];
  60786. this[_xfa_object.$extra] = {
  60787. children
  60788. };
  60789. this[_xfa_object.$childrenToHTML]({});
  60790. if (children.length === 0 && !this[_xfa_object.$content]) {
  60791. return _utils.HTMLResult.EMPTY;
  60792. }
  60793. let value;
  60794. if (this[$richText]) {
  60795. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  60796. } else {
  60797. value = this[_xfa_object.$content] || undefined;
  60798. }
  60799. return _utils.HTMLResult.success({
  60800. name: this[_xfa_object.$nodeName],
  60801. attributes: {
  60802. href: this.href,
  60803. style: mapStyle(this.style, this, this[$richText])
  60804. },
  60805. children,
  60806. value
  60807. });
  60808. }
  60809. }
  60810. class A extends XhtmlObject {
  60811. constructor(attributes) {
  60812. super(attributes, "a");
  60813. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  60814. }
  60815. }
  60816. class B extends XhtmlObject {
  60817. constructor(attributes) {
  60818. super(attributes, "b");
  60819. }
  60820. [_xfa_object.$pushGlyphs](measure) {
  60821. measure.pushFont({
  60822. weight: "bold"
  60823. });
  60824. super[_xfa_object.$pushGlyphs](measure);
  60825. measure.popFont();
  60826. }
  60827. }
  60828. class Body extends XhtmlObject {
  60829. constructor(attributes) {
  60830. super(attributes, "body");
  60831. }
  60832. [_xfa_object.$toHTML](availableSpace) {
  60833. const res = super[_xfa_object.$toHTML](availableSpace);
  60834. const {
  60835. html
  60836. } = res;
  60837. if (!html) {
  60838. return _utils.HTMLResult.EMPTY;
  60839. }
  60840. html.name = "div";
  60841. html.attributes.class = ["xfaRich"];
  60842. return res;
  60843. }
  60844. }
  60845. class Br extends XhtmlObject {
  60846. constructor(attributes) {
  60847. super(attributes, "br");
  60848. }
  60849. [_xfa_object.$text]() {
  60850. return "\n";
  60851. }
  60852. [_xfa_object.$pushGlyphs](measure) {
  60853. measure.addString("\n");
  60854. }
  60855. [_xfa_object.$toHTML](availableSpace) {
  60856. return _utils.HTMLResult.success({
  60857. name: "br"
  60858. });
  60859. }
  60860. }
  60861. class Html extends XhtmlObject {
  60862. constructor(attributes) {
  60863. super(attributes, "html");
  60864. }
  60865. [_xfa_object.$toHTML](availableSpace) {
  60866. const children = [];
  60867. this[_xfa_object.$extra] = {
  60868. children
  60869. };
  60870. this[_xfa_object.$childrenToHTML]({});
  60871. if (children.length === 0) {
  60872. return _utils.HTMLResult.success({
  60873. name: "div",
  60874. attributes: {
  60875. class: ["xfaRich"],
  60876. style: {}
  60877. },
  60878. value: this[_xfa_object.$content] || ""
  60879. });
  60880. }
  60881. if (children.length === 1) {
  60882. const child = children[0];
  60883. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  60884. return _utils.HTMLResult.success(child);
  60885. }
  60886. }
  60887. return _utils.HTMLResult.success({
  60888. name: "div",
  60889. attributes: {
  60890. class: ["xfaRich"],
  60891. style: {}
  60892. },
  60893. children
  60894. });
  60895. }
  60896. }
  60897. class I extends XhtmlObject {
  60898. constructor(attributes) {
  60899. super(attributes, "i");
  60900. }
  60901. [_xfa_object.$pushGlyphs](measure) {
  60902. measure.pushFont({
  60903. posture: "italic"
  60904. });
  60905. super[_xfa_object.$pushGlyphs](measure);
  60906. measure.popFont();
  60907. }
  60908. }
  60909. class Li extends XhtmlObject {
  60910. constructor(attributes) {
  60911. super(attributes, "li");
  60912. }
  60913. }
  60914. class Ol extends XhtmlObject {
  60915. constructor(attributes) {
  60916. super(attributes, "ol");
  60917. }
  60918. }
  60919. class P extends XhtmlObject {
  60920. constructor(attributes) {
  60921. super(attributes, "p");
  60922. }
  60923. [_xfa_object.$pushGlyphs](measure) {
  60924. super[_xfa_object.$pushGlyphs](measure, false);
  60925. measure.addString("\n");
  60926. measure.addPara();
  60927. measure.popFont();
  60928. }
  60929. [_xfa_object.$text]() {
  60930. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  60931. if (siblings[siblings.length - 1] === this) {
  60932. return super[_xfa_object.$text]();
  60933. }
  60934. return super[_xfa_object.$text]() + "\n";
  60935. }
  60936. }
  60937. class Span extends XhtmlObject {
  60938. constructor(attributes) {
  60939. super(attributes, "span");
  60940. }
  60941. }
  60942. class Sub extends XhtmlObject {
  60943. constructor(attributes) {
  60944. super(attributes, "sub");
  60945. }
  60946. }
  60947. class Sup extends XhtmlObject {
  60948. constructor(attributes) {
  60949. super(attributes, "sup");
  60950. }
  60951. }
  60952. class Ul extends XhtmlObject {
  60953. constructor(attributes) {
  60954. super(attributes, "ul");
  60955. }
  60956. }
  60957. class XhtmlNamespace {
  60958. static [_namespaces.$buildXFAObject](name, attributes) {
  60959. if (XhtmlNamespace.hasOwnProperty(name)) {
  60960. return XhtmlNamespace[name](attributes);
  60961. }
  60962. return undefined;
  60963. }
  60964. static a(attributes) {
  60965. return new A(attributes);
  60966. }
  60967. static b(attributes) {
  60968. return new B(attributes);
  60969. }
  60970. static body(attributes) {
  60971. return new Body(attributes);
  60972. }
  60973. static br(attributes) {
  60974. return new Br(attributes);
  60975. }
  60976. static html(attributes) {
  60977. return new Html(attributes);
  60978. }
  60979. static i(attributes) {
  60980. return new I(attributes);
  60981. }
  60982. static li(attributes) {
  60983. return new Li(attributes);
  60984. }
  60985. static ol(attributes) {
  60986. return new Ol(attributes);
  60987. }
  60988. static p(attributes) {
  60989. return new P(attributes);
  60990. }
  60991. static span(attributes) {
  60992. return new Span(attributes);
  60993. }
  60994. static sub(attributes) {
  60995. return new Sub(attributes);
  60996. }
  60997. static sup(attributes) {
  60998. return new Sup(attributes);
  60999. }
  61000. static ul(attributes) {
  61001. return new Ul(attributes);
  61002. }
  61003. }
  61004. exports.XhtmlNamespace = XhtmlNamespace;
  61005. /***/ }),
  61006. /* 98 */
  61007. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61008. Object.defineProperty(exports, "__esModule", ({
  61009. value: true
  61010. }));
  61011. exports.UnknownNamespace = void 0;
  61012. var _namespaces = __w_pdfjs_require__(78);
  61013. var _xfa_object = __w_pdfjs_require__(76);
  61014. class UnknownNamespace {
  61015. constructor(nsId) {
  61016. this.namespaceId = nsId;
  61017. }
  61018. [_namespaces.$buildXFAObject](name, attributes) {
  61019. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  61020. }
  61021. }
  61022. exports.UnknownNamespace = UnknownNamespace;
  61023. /***/ }),
  61024. /* 99 */
  61025. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61026. Object.defineProperty(exports, "__esModule", ({
  61027. value: true
  61028. }));
  61029. exports.XRef = void 0;
  61030. var _util = __w_pdfjs_require__(2);
  61031. var _primitives = __w_pdfjs_require__(5);
  61032. var _core_utils = __w_pdfjs_require__(8);
  61033. var _parser = __w_pdfjs_require__(27);
  61034. var _base_stream = __w_pdfjs_require__(9);
  61035. var _crypto = __w_pdfjs_require__(73);
  61036. class XRef {
  61037. constructor(stream, pdfManager) {
  61038. this.stream = stream;
  61039. this.pdfManager = pdfManager;
  61040. this.entries = [];
  61041. this.xrefstms = Object.create(null);
  61042. this._cacheMap = new Map();
  61043. this._pendingRefs = new _primitives.RefSet();
  61044. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  61045. this._newRefNum = null;
  61046. }
  61047. getNewRef() {
  61048. if (this._newRefNum === null) {
  61049. this._newRefNum = this.entries.length;
  61050. }
  61051. return _primitives.Ref.get(this._newRefNum++, 0);
  61052. }
  61053. resetNewRef() {
  61054. this._newRefNum = null;
  61055. }
  61056. setStartXRef(startXRef) {
  61057. this.startXRefQueue = [startXRef];
  61058. }
  61059. parse(recoveryMode = false) {
  61060. let trailerDict;
  61061. if (!recoveryMode) {
  61062. trailerDict = this.readXRef();
  61063. } else {
  61064. (0, _util.warn)("Indexing all PDF objects");
  61065. trailerDict = this.indexObjects();
  61066. }
  61067. trailerDict.assignXref(this);
  61068. this.trailer = trailerDict;
  61069. let encrypt;
  61070. try {
  61071. encrypt = trailerDict.get("Encrypt");
  61072. } catch (ex) {
  61073. if (ex instanceof _core_utils.MissingDataException) {
  61074. throw ex;
  61075. }
  61076. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  61077. }
  61078. if (encrypt instanceof _primitives.Dict) {
  61079. const ids = trailerDict.get("ID");
  61080. const fileId = ids && ids.length ? ids[0] : "";
  61081. encrypt.suppressEncryption = true;
  61082. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  61083. }
  61084. let root;
  61085. try {
  61086. root = trailerDict.get("Root");
  61087. } catch (ex) {
  61088. if (ex instanceof _core_utils.MissingDataException) {
  61089. throw ex;
  61090. }
  61091. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  61092. }
  61093. if (root instanceof _primitives.Dict) {
  61094. try {
  61095. const pages = root.get("Pages");
  61096. if (pages instanceof _primitives.Dict) {
  61097. this.root = root;
  61098. return;
  61099. }
  61100. } catch (ex) {
  61101. if (ex instanceof _core_utils.MissingDataException) {
  61102. throw ex;
  61103. }
  61104. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  61105. }
  61106. }
  61107. if (!recoveryMode) {
  61108. throw new _core_utils.XRefParseException();
  61109. }
  61110. throw new _util.InvalidPDFException("Invalid Root reference.");
  61111. }
  61112. processXRefTable(parser) {
  61113. if (!("tableState" in this)) {
  61114. this.tableState = {
  61115. entryNum: 0,
  61116. streamPos: parser.lexer.stream.pos,
  61117. parserBuf1: parser.buf1,
  61118. parserBuf2: parser.buf2
  61119. };
  61120. }
  61121. const obj = this.readXRefTable(parser);
  61122. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61123. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  61124. }
  61125. let dict = parser.getObj();
  61126. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  61127. dict = dict.dict;
  61128. }
  61129. if (!(dict instanceof _primitives.Dict)) {
  61130. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  61131. }
  61132. delete this.tableState;
  61133. return dict;
  61134. }
  61135. readXRefTable(parser) {
  61136. const stream = parser.lexer.stream;
  61137. const tableState = this.tableState;
  61138. stream.pos = tableState.streamPos;
  61139. parser.buf1 = tableState.parserBuf1;
  61140. parser.buf2 = tableState.parserBuf2;
  61141. let obj;
  61142. while (true) {
  61143. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  61144. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  61145. break;
  61146. }
  61147. tableState.firstEntryNum = obj;
  61148. tableState.entryCount = parser.getObj();
  61149. }
  61150. let first = tableState.firstEntryNum;
  61151. const count = tableState.entryCount;
  61152. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  61153. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  61154. }
  61155. for (let i = tableState.entryNum; i < count; i++) {
  61156. tableState.streamPos = stream.pos;
  61157. tableState.entryNum = i;
  61158. tableState.parserBuf1 = parser.buf1;
  61159. tableState.parserBuf2 = parser.buf2;
  61160. const entry = {};
  61161. entry.offset = parser.getObj();
  61162. entry.gen = parser.getObj();
  61163. const type = parser.getObj();
  61164. if (type instanceof _primitives.Cmd) {
  61165. switch (type.cmd) {
  61166. case "f":
  61167. entry.free = true;
  61168. break;
  61169. case "n":
  61170. entry.uncompressed = true;
  61171. break;
  61172. }
  61173. }
  61174. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  61175. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  61176. }
  61177. if (i === 0 && entry.free && first === 1) {
  61178. first = 0;
  61179. }
  61180. if (!this.entries[i + first]) {
  61181. this.entries[i + first] = entry;
  61182. }
  61183. }
  61184. tableState.entryNum = 0;
  61185. tableState.streamPos = stream.pos;
  61186. tableState.parserBuf1 = parser.buf1;
  61187. tableState.parserBuf2 = parser.buf2;
  61188. delete tableState.firstEntryNum;
  61189. delete tableState.entryCount;
  61190. }
  61191. if (this.entries[0] && !this.entries[0].free) {
  61192. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  61193. }
  61194. return obj;
  61195. }
  61196. processXRefStream(stream) {
  61197. if (!("streamState" in this)) {
  61198. const streamParameters = stream.dict;
  61199. const byteWidths = streamParameters.get("W");
  61200. let range = streamParameters.get("Index");
  61201. if (!range) {
  61202. range = [0, streamParameters.get("Size")];
  61203. }
  61204. this.streamState = {
  61205. entryRanges: range,
  61206. byteWidths,
  61207. entryNum: 0,
  61208. streamPos: stream.pos
  61209. };
  61210. }
  61211. this.readXRefStream(stream);
  61212. delete this.streamState;
  61213. return stream.dict;
  61214. }
  61215. readXRefStream(stream) {
  61216. const streamState = this.streamState;
  61217. stream.pos = streamState.streamPos;
  61218. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  61219. const entryRanges = streamState.entryRanges;
  61220. while (entryRanges.length > 0) {
  61221. const [first, n] = entryRanges;
  61222. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  61223. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  61224. }
  61225. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  61226. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  61227. }
  61228. for (let i = streamState.entryNum; i < n; ++i) {
  61229. streamState.entryNum = i;
  61230. streamState.streamPos = stream.pos;
  61231. let type = 0,
  61232. offset = 0,
  61233. generation = 0;
  61234. for (let j = 0; j < typeFieldWidth; ++j) {
  61235. const typeByte = stream.getByte();
  61236. if (typeByte === -1) {
  61237. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  61238. }
  61239. type = type << 8 | typeByte;
  61240. }
  61241. if (typeFieldWidth === 0) {
  61242. type = 1;
  61243. }
  61244. for (let j = 0; j < offsetFieldWidth; ++j) {
  61245. const offsetByte = stream.getByte();
  61246. if (offsetByte === -1) {
  61247. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  61248. }
  61249. offset = offset << 8 | offsetByte;
  61250. }
  61251. for (let j = 0; j < generationFieldWidth; ++j) {
  61252. const generationByte = stream.getByte();
  61253. if (generationByte === -1) {
  61254. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  61255. }
  61256. generation = generation << 8 | generationByte;
  61257. }
  61258. const entry = {};
  61259. entry.offset = offset;
  61260. entry.gen = generation;
  61261. switch (type) {
  61262. case 0:
  61263. entry.free = true;
  61264. break;
  61265. case 1:
  61266. entry.uncompressed = true;
  61267. break;
  61268. case 2:
  61269. break;
  61270. default:
  61271. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  61272. }
  61273. if (!this.entries[first + i]) {
  61274. this.entries[first + i] = entry;
  61275. }
  61276. }
  61277. streamState.entryNum = 0;
  61278. streamState.streamPos = stream.pos;
  61279. entryRanges.splice(0, 2);
  61280. }
  61281. }
  61282. indexObjects() {
  61283. const TAB = 0x9,
  61284. LF = 0xa,
  61285. CR = 0xd,
  61286. SPACE = 0x20;
  61287. const PERCENT = 0x25,
  61288. LT = 0x3c;
  61289. function readToken(data, offset) {
  61290. let token = "",
  61291. ch = data[offset];
  61292. while (ch !== LF && ch !== CR && ch !== LT) {
  61293. if (++offset >= data.length) {
  61294. break;
  61295. }
  61296. token += String.fromCharCode(ch);
  61297. ch = data[offset];
  61298. }
  61299. return token;
  61300. }
  61301. function skipUntil(data, offset, what) {
  61302. const length = what.length,
  61303. dataLength = data.length;
  61304. let skipped = 0;
  61305. while (offset < dataLength) {
  61306. let i = 0;
  61307. while (i < length && data[offset + i] === what[i]) {
  61308. ++i;
  61309. }
  61310. if (i >= length) {
  61311. break;
  61312. }
  61313. offset++;
  61314. skipped++;
  61315. }
  61316. return skipped;
  61317. }
  61318. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  61319. const endobjRegExp = /\bendobj[\b\s]$/;
  61320. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  61321. const CHECK_CONTENT_LENGTH = 25;
  61322. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  61323. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  61324. const objBytes = new Uint8Array([111, 98, 106]);
  61325. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  61326. this.entries.length = 0;
  61327. this._cacheMap.clear();
  61328. const stream = this.stream;
  61329. stream.pos = 0;
  61330. const buffer = stream.getBytes(),
  61331. length = buffer.length;
  61332. let position = stream.start;
  61333. const trailers = [],
  61334. xrefStms = [];
  61335. while (position < length) {
  61336. let ch = buffer[position];
  61337. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  61338. ++position;
  61339. continue;
  61340. }
  61341. if (ch === PERCENT) {
  61342. do {
  61343. ++position;
  61344. if (position >= length) {
  61345. break;
  61346. }
  61347. ch = buffer[position];
  61348. } while (ch !== LF && ch !== CR);
  61349. continue;
  61350. }
  61351. const token = readToken(buffer, position);
  61352. let m;
  61353. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  61354. position += skipUntil(buffer, position, trailerBytes);
  61355. trailers.push(position);
  61356. position += skipUntil(buffer, position, startxrefBytes);
  61357. } else if (m = objRegExp.exec(token)) {
  61358. const num = m[1] | 0,
  61359. gen = m[2] | 0;
  61360. let contentLength,
  61361. startPos = position + token.length,
  61362. updateEntries = false;
  61363. if (!this.entries[num]) {
  61364. updateEntries = true;
  61365. } else if (this.entries[num].gen === gen) {
  61366. try {
  61367. const parser = new _parser.Parser({
  61368. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  61369. });
  61370. parser.getObj();
  61371. updateEntries = true;
  61372. } catch (ex) {
  61373. if (ex instanceof _core_utils.ParserEOFException) {
  61374. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  61375. } else {
  61376. updateEntries = true;
  61377. }
  61378. }
  61379. }
  61380. if (updateEntries) {
  61381. this.entries[num] = {
  61382. offset: position - stream.start,
  61383. gen,
  61384. uncompressed: true
  61385. };
  61386. }
  61387. while (startPos < buffer.length) {
  61388. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  61389. contentLength = endPos - position;
  61390. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  61391. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  61392. if (endobjRegExp.test(tokenStr)) {
  61393. break;
  61394. } else {
  61395. const objToken = nestedObjRegExp.exec(tokenStr);
  61396. if (objToken && objToken[1]) {
  61397. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  61398. contentLength -= objToken[1].length;
  61399. break;
  61400. }
  61401. }
  61402. startPos = endPos;
  61403. }
  61404. const content = buffer.subarray(position, position + contentLength);
  61405. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  61406. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  61407. xrefStms.push(position - stream.start);
  61408. this.xrefstms[position - stream.start] = 1;
  61409. }
  61410. position += contentLength;
  61411. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  61412. trailers.push(position);
  61413. position += skipUntil(buffer, position, startxrefBytes);
  61414. } else {
  61415. position += token.length + 1;
  61416. }
  61417. }
  61418. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  61419. this.startXRefQueue.push(xrefStms[i]);
  61420. this.readXRef(true);
  61421. }
  61422. let trailerDict;
  61423. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  61424. stream.pos = trailers[i];
  61425. const parser = new _parser.Parser({
  61426. lexer: new _parser.Lexer(stream),
  61427. xref: this,
  61428. allowStreams: true,
  61429. recoveryMode: true
  61430. });
  61431. const obj = parser.getObj();
  61432. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61433. continue;
  61434. }
  61435. const dict = parser.getObj();
  61436. if (!(dict instanceof _primitives.Dict)) {
  61437. continue;
  61438. }
  61439. try {
  61440. const rootDict = dict.get("Root");
  61441. if (!(rootDict instanceof _primitives.Dict)) {
  61442. continue;
  61443. }
  61444. const pagesDict = rootDict.get("Pages");
  61445. if (!(pagesDict instanceof _primitives.Dict)) {
  61446. continue;
  61447. }
  61448. const pagesCount = pagesDict.get("Count");
  61449. if (!Number.isInteger(pagesCount)) {
  61450. continue;
  61451. }
  61452. } catch (ex) {
  61453. continue;
  61454. }
  61455. if (dict.has("ID")) {
  61456. return dict;
  61457. }
  61458. trailerDict = dict;
  61459. }
  61460. if (trailerDict) {
  61461. return trailerDict;
  61462. }
  61463. if (this.topDict) {
  61464. return this.topDict;
  61465. }
  61466. throw new _util.InvalidPDFException("Invalid PDF structure.");
  61467. }
  61468. readXRef(recoveryMode = false) {
  61469. const stream = this.stream;
  61470. const startXRefParsedCache = new Set();
  61471. try {
  61472. while (this.startXRefQueue.length) {
  61473. const startXRef = this.startXRefQueue[0];
  61474. if (startXRefParsedCache.has(startXRef)) {
  61475. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  61476. this.startXRefQueue.shift();
  61477. continue;
  61478. }
  61479. startXRefParsedCache.add(startXRef);
  61480. stream.pos = startXRef + stream.start;
  61481. const parser = new _parser.Parser({
  61482. lexer: new _parser.Lexer(stream),
  61483. xref: this,
  61484. allowStreams: true
  61485. });
  61486. let obj = parser.getObj();
  61487. let dict;
  61488. if ((0, _primitives.isCmd)(obj, "xref")) {
  61489. dict = this.processXRefTable(parser);
  61490. if (!this.topDict) {
  61491. this.topDict = dict;
  61492. }
  61493. obj = dict.get("XRefStm");
  61494. if (Number.isInteger(obj)) {
  61495. const pos = obj;
  61496. if (!(pos in this.xrefstms)) {
  61497. this.xrefstms[pos] = 1;
  61498. this.startXRefQueue.push(pos);
  61499. }
  61500. }
  61501. } else if (Number.isInteger(obj)) {
  61502. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  61503. throw new _util.FormatError("Invalid XRef stream");
  61504. }
  61505. dict = this.processXRefStream(obj);
  61506. if (!this.topDict) {
  61507. this.topDict = dict;
  61508. }
  61509. if (!dict) {
  61510. throw new _util.FormatError("Failed to read XRef stream");
  61511. }
  61512. } else {
  61513. throw new _util.FormatError("Invalid XRef stream header");
  61514. }
  61515. obj = dict.get("Prev");
  61516. if (Number.isInteger(obj)) {
  61517. this.startXRefQueue.push(obj);
  61518. } else if (obj instanceof _primitives.Ref) {
  61519. this.startXRefQueue.push(obj.num);
  61520. }
  61521. this.startXRefQueue.shift();
  61522. }
  61523. return this.topDict;
  61524. } catch (e) {
  61525. if (e instanceof _core_utils.MissingDataException) {
  61526. throw e;
  61527. }
  61528. (0, _util.info)("(while reading XRef): " + e);
  61529. this.startXRefQueue.shift();
  61530. }
  61531. if (recoveryMode) {
  61532. return undefined;
  61533. }
  61534. throw new _core_utils.XRefParseException();
  61535. }
  61536. getEntry(i) {
  61537. const xrefEntry = this.entries[i];
  61538. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  61539. return xrefEntry;
  61540. }
  61541. return null;
  61542. }
  61543. fetchIfRef(obj, suppressEncryption = false) {
  61544. if (obj instanceof _primitives.Ref) {
  61545. return this.fetch(obj, suppressEncryption);
  61546. }
  61547. return obj;
  61548. }
  61549. fetch(ref, suppressEncryption = false) {
  61550. if (!(ref instanceof _primitives.Ref)) {
  61551. throw new Error("ref object is not a reference");
  61552. }
  61553. const num = ref.num;
  61554. const cacheEntry = this._cacheMap.get(num);
  61555. if (cacheEntry !== undefined) {
  61556. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  61557. cacheEntry.objId = ref.toString();
  61558. }
  61559. return cacheEntry;
  61560. }
  61561. let xrefEntry = this.getEntry(num);
  61562. if (xrefEntry === null) {
  61563. this._cacheMap.set(num, xrefEntry);
  61564. return xrefEntry;
  61565. }
  61566. if (this._pendingRefs.has(ref)) {
  61567. this._pendingRefs.remove(ref);
  61568. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  61569. return _primitives.CIRCULAR_REF;
  61570. }
  61571. this._pendingRefs.put(ref);
  61572. try {
  61573. if (xrefEntry.uncompressed) {
  61574. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  61575. } else {
  61576. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  61577. }
  61578. this._pendingRefs.remove(ref);
  61579. } catch (ex) {
  61580. this._pendingRefs.remove(ref);
  61581. throw ex;
  61582. }
  61583. if (xrefEntry instanceof _primitives.Dict) {
  61584. xrefEntry.objId = ref.toString();
  61585. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  61586. xrefEntry.dict.objId = ref.toString();
  61587. }
  61588. return xrefEntry;
  61589. }
  61590. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  61591. const gen = ref.gen;
  61592. let num = ref.num;
  61593. if (xrefEntry.gen !== gen) {
  61594. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  61595. }
  61596. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  61597. const parser = new _parser.Parser({
  61598. lexer: new _parser.Lexer(stream),
  61599. xref: this,
  61600. allowStreams: true
  61601. });
  61602. const obj1 = parser.getObj();
  61603. const obj2 = parser.getObj();
  61604. const obj3 = parser.getObj();
  61605. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  61606. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  61607. }
  61608. if (obj3.cmd !== "obj") {
  61609. if (obj3.cmd.startsWith("obj")) {
  61610. num = parseInt(obj3.cmd.substring(3), 10);
  61611. if (!Number.isNaN(num)) {
  61612. return num;
  61613. }
  61614. }
  61615. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  61616. }
  61617. if (this.encrypt && !suppressEncryption) {
  61618. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  61619. } else {
  61620. xrefEntry = parser.getObj();
  61621. }
  61622. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  61623. this._cacheMap.set(num, xrefEntry);
  61624. }
  61625. return xrefEntry;
  61626. }
  61627. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  61628. const tableOffset = xrefEntry.offset;
  61629. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  61630. if (!(stream instanceof _base_stream.BaseStream)) {
  61631. throw new _util.FormatError("bad ObjStm stream");
  61632. }
  61633. const first = stream.dict.get("First");
  61634. const n = stream.dict.get("N");
  61635. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  61636. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  61637. }
  61638. let parser = new _parser.Parser({
  61639. lexer: new _parser.Lexer(stream),
  61640. xref: this,
  61641. allowStreams: true
  61642. });
  61643. const nums = new Array(n);
  61644. const offsets = new Array(n);
  61645. for (let i = 0; i < n; ++i) {
  61646. const num = parser.getObj();
  61647. if (!Number.isInteger(num)) {
  61648. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  61649. }
  61650. const offset = parser.getObj();
  61651. if (!Number.isInteger(offset)) {
  61652. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  61653. }
  61654. nums[i] = num;
  61655. offsets[i] = offset;
  61656. }
  61657. const start = (stream.start || 0) + first;
  61658. const entries = new Array(n);
  61659. for (let i = 0; i < n; ++i) {
  61660. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  61661. if (length < 0) {
  61662. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  61663. }
  61664. parser = new _parser.Parser({
  61665. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  61666. xref: this,
  61667. allowStreams: true
  61668. });
  61669. const obj = parser.getObj();
  61670. entries[i] = obj;
  61671. if (obj instanceof _base_stream.BaseStream) {
  61672. continue;
  61673. }
  61674. const num = nums[i],
  61675. entry = this.entries[num];
  61676. if (entry && entry.offset === tableOffset && entry.gen === i) {
  61677. this._cacheMap.set(num, obj);
  61678. }
  61679. }
  61680. xrefEntry = entries[xrefEntry.gen];
  61681. if (xrefEntry === undefined) {
  61682. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  61683. }
  61684. return xrefEntry;
  61685. }
  61686. async fetchIfRefAsync(obj, suppressEncryption) {
  61687. if (obj instanceof _primitives.Ref) {
  61688. return this.fetchAsync(obj, suppressEncryption);
  61689. }
  61690. return obj;
  61691. }
  61692. async fetchAsync(ref, suppressEncryption) {
  61693. try {
  61694. return this.fetch(ref, suppressEncryption);
  61695. } catch (ex) {
  61696. if (!(ex instanceof _core_utils.MissingDataException)) {
  61697. throw ex;
  61698. }
  61699. await this.pdfManager.requestRange(ex.begin, ex.end);
  61700. return this.fetchAsync(ref, suppressEncryption);
  61701. }
  61702. }
  61703. getCatalogObj() {
  61704. return this.root;
  61705. }
  61706. }
  61707. exports.XRef = XRef;
  61708. /***/ }),
  61709. /* 100 */
  61710. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61711. Object.defineProperty(exports, "__esModule", ({
  61712. value: true
  61713. }));
  61714. exports.MessageHandler = void 0;
  61715. var _util = __w_pdfjs_require__(2);
  61716. const CallbackKind = {
  61717. UNKNOWN: 0,
  61718. DATA: 1,
  61719. ERROR: 2
  61720. };
  61721. const StreamKind = {
  61722. UNKNOWN: 0,
  61723. CANCEL: 1,
  61724. CANCEL_COMPLETE: 2,
  61725. CLOSE: 3,
  61726. ENQUEUE: 4,
  61727. ERROR: 5,
  61728. PULL: 6,
  61729. PULL_COMPLETE: 7,
  61730. START_COMPLETE: 8
  61731. };
  61732. function wrapReason(reason) {
  61733. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  61734. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  61735. }
  61736. switch (reason.name) {
  61737. case "AbortException":
  61738. return new _util.AbortException(reason.message);
  61739. case "MissingPDFException":
  61740. return new _util.MissingPDFException(reason.message);
  61741. case "PasswordException":
  61742. return new _util.PasswordException(reason.message, reason.code);
  61743. case "UnexpectedResponseException":
  61744. return new _util.UnexpectedResponseException(reason.message, reason.status);
  61745. case "UnknownErrorException":
  61746. return new _util.UnknownErrorException(reason.message, reason.details);
  61747. default:
  61748. return new _util.UnknownErrorException(reason.message, reason.toString());
  61749. }
  61750. }
  61751. class MessageHandler {
  61752. constructor(sourceName, targetName, comObj) {
  61753. this.sourceName = sourceName;
  61754. this.targetName = targetName;
  61755. this.comObj = comObj;
  61756. this.callbackId = 1;
  61757. this.streamId = 1;
  61758. this.streamSinks = Object.create(null);
  61759. this.streamControllers = Object.create(null);
  61760. this.callbackCapabilities = Object.create(null);
  61761. this.actionHandler = Object.create(null);
  61762. this._onComObjOnMessage = event => {
  61763. const data = event.data;
  61764. if (data.targetName !== this.sourceName) {
  61765. return;
  61766. }
  61767. if (data.stream) {
  61768. this._processStreamMessage(data);
  61769. return;
  61770. }
  61771. if (data.callback) {
  61772. const callbackId = data.callbackId;
  61773. const capability = this.callbackCapabilities[callbackId];
  61774. if (!capability) {
  61775. throw new Error(`Cannot resolve callback ${callbackId}`);
  61776. }
  61777. delete this.callbackCapabilities[callbackId];
  61778. if (data.callback === CallbackKind.DATA) {
  61779. capability.resolve(data.data);
  61780. } else if (data.callback === CallbackKind.ERROR) {
  61781. capability.reject(wrapReason(data.reason));
  61782. } else {
  61783. throw new Error("Unexpected callback case");
  61784. }
  61785. return;
  61786. }
  61787. const action = this.actionHandler[data.action];
  61788. if (!action) {
  61789. throw new Error(`Unknown action from worker: ${data.action}`);
  61790. }
  61791. if (data.callbackId) {
  61792. const cbSourceName = this.sourceName;
  61793. const cbTargetName = data.sourceName;
  61794. new Promise(function (resolve) {
  61795. resolve(action(data.data));
  61796. }).then(function (result) {
  61797. comObj.postMessage({
  61798. sourceName: cbSourceName,
  61799. targetName: cbTargetName,
  61800. callback: CallbackKind.DATA,
  61801. callbackId: data.callbackId,
  61802. data: result
  61803. });
  61804. }, function (reason) {
  61805. comObj.postMessage({
  61806. sourceName: cbSourceName,
  61807. targetName: cbTargetName,
  61808. callback: CallbackKind.ERROR,
  61809. callbackId: data.callbackId,
  61810. reason: wrapReason(reason)
  61811. });
  61812. });
  61813. return;
  61814. }
  61815. if (data.streamId) {
  61816. this._createStreamSink(data);
  61817. return;
  61818. }
  61819. action(data.data);
  61820. };
  61821. comObj.addEventListener("message", this._onComObjOnMessage);
  61822. }
  61823. on(actionName, handler) {
  61824. const ah = this.actionHandler;
  61825. if (ah[actionName]) {
  61826. throw new Error(`There is already an actionName called "${actionName}"`);
  61827. }
  61828. ah[actionName] = handler;
  61829. }
  61830. send(actionName, data, transfers) {
  61831. this.comObj.postMessage({
  61832. sourceName: this.sourceName,
  61833. targetName: this.targetName,
  61834. action: actionName,
  61835. data
  61836. }, transfers);
  61837. }
  61838. sendWithPromise(actionName, data, transfers) {
  61839. const callbackId = this.callbackId++;
  61840. const capability = (0, _util.createPromiseCapability)();
  61841. this.callbackCapabilities[callbackId] = capability;
  61842. try {
  61843. this.comObj.postMessage({
  61844. sourceName: this.sourceName,
  61845. targetName: this.targetName,
  61846. action: actionName,
  61847. callbackId,
  61848. data
  61849. }, transfers);
  61850. } catch (ex) {
  61851. capability.reject(ex);
  61852. }
  61853. return capability.promise;
  61854. }
  61855. sendWithStream(actionName, data, queueingStrategy, transfers) {
  61856. const streamId = this.streamId++,
  61857. sourceName = this.sourceName,
  61858. targetName = this.targetName,
  61859. comObj = this.comObj;
  61860. return new ReadableStream({
  61861. start: controller => {
  61862. const startCapability = (0, _util.createPromiseCapability)();
  61863. this.streamControllers[streamId] = {
  61864. controller,
  61865. startCall: startCapability,
  61866. pullCall: null,
  61867. cancelCall: null,
  61868. isClosed: false
  61869. };
  61870. comObj.postMessage({
  61871. sourceName,
  61872. targetName,
  61873. action: actionName,
  61874. streamId,
  61875. data,
  61876. desiredSize: controller.desiredSize
  61877. }, transfers);
  61878. return startCapability.promise;
  61879. },
  61880. pull: controller => {
  61881. const pullCapability = (0, _util.createPromiseCapability)();
  61882. this.streamControllers[streamId].pullCall = pullCapability;
  61883. comObj.postMessage({
  61884. sourceName,
  61885. targetName,
  61886. stream: StreamKind.PULL,
  61887. streamId,
  61888. desiredSize: controller.desiredSize
  61889. });
  61890. return pullCapability.promise;
  61891. },
  61892. cancel: reason => {
  61893. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  61894. const cancelCapability = (0, _util.createPromiseCapability)();
  61895. this.streamControllers[streamId].cancelCall = cancelCapability;
  61896. this.streamControllers[streamId].isClosed = true;
  61897. comObj.postMessage({
  61898. sourceName,
  61899. targetName,
  61900. stream: StreamKind.CANCEL,
  61901. streamId,
  61902. reason: wrapReason(reason)
  61903. });
  61904. return cancelCapability.promise;
  61905. }
  61906. }, queueingStrategy);
  61907. }
  61908. _createStreamSink(data) {
  61909. const streamId = data.streamId,
  61910. sourceName = this.sourceName,
  61911. targetName = data.sourceName,
  61912. comObj = this.comObj;
  61913. const self = this,
  61914. action = this.actionHandler[data.action];
  61915. const streamSink = {
  61916. enqueue(chunk, size = 1, transfers) {
  61917. if (this.isCancelled) {
  61918. return;
  61919. }
  61920. const lastDesiredSize = this.desiredSize;
  61921. this.desiredSize -= size;
  61922. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  61923. this.sinkCapability = (0, _util.createPromiseCapability)();
  61924. this.ready = this.sinkCapability.promise;
  61925. }
  61926. comObj.postMessage({
  61927. sourceName,
  61928. targetName,
  61929. stream: StreamKind.ENQUEUE,
  61930. streamId,
  61931. chunk
  61932. }, transfers);
  61933. },
  61934. close() {
  61935. if (this.isCancelled) {
  61936. return;
  61937. }
  61938. this.isCancelled = true;
  61939. comObj.postMessage({
  61940. sourceName,
  61941. targetName,
  61942. stream: StreamKind.CLOSE,
  61943. streamId
  61944. });
  61945. delete self.streamSinks[streamId];
  61946. },
  61947. error(reason) {
  61948. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  61949. if (this.isCancelled) {
  61950. return;
  61951. }
  61952. this.isCancelled = true;
  61953. comObj.postMessage({
  61954. sourceName,
  61955. targetName,
  61956. stream: StreamKind.ERROR,
  61957. streamId,
  61958. reason: wrapReason(reason)
  61959. });
  61960. },
  61961. sinkCapability: (0, _util.createPromiseCapability)(),
  61962. onPull: null,
  61963. onCancel: null,
  61964. isCancelled: false,
  61965. desiredSize: data.desiredSize,
  61966. ready: null
  61967. };
  61968. streamSink.sinkCapability.resolve();
  61969. streamSink.ready = streamSink.sinkCapability.promise;
  61970. this.streamSinks[streamId] = streamSink;
  61971. new Promise(function (resolve) {
  61972. resolve(action(data.data, streamSink));
  61973. }).then(function () {
  61974. comObj.postMessage({
  61975. sourceName,
  61976. targetName,
  61977. stream: StreamKind.START_COMPLETE,
  61978. streamId,
  61979. success: true
  61980. });
  61981. }, function (reason) {
  61982. comObj.postMessage({
  61983. sourceName,
  61984. targetName,
  61985. stream: StreamKind.START_COMPLETE,
  61986. streamId,
  61987. reason: wrapReason(reason)
  61988. });
  61989. });
  61990. }
  61991. _processStreamMessage(data) {
  61992. const streamId = data.streamId,
  61993. sourceName = this.sourceName,
  61994. targetName = data.sourceName,
  61995. comObj = this.comObj;
  61996. const streamController = this.streamControllers[streamId],
  61997. streamSink = this.streamSinks[streamId];
  61998. switch (data.stream) {
  61999. case StreamKind.START_COMPLETE:
  62000. if (data.success) {
  62001. streamController.startCall.resolve();
  62002. } else {
  62003. streamController.startCall.reject(wrapReason(data.reason));
  62004. }
  62005. break;
  62006. case StreamKind.PULL_COMPLETE:
  62007. if (data.success) {
  62008. streamController.pullCall.resolve();
  62009. } else {
  62010. streamController.pullCall.reject(wrapReason(data.reason));
  62011. }
  62012. break;
  62013. case StreamKind.PULL:
  62014. if (!streamSink) {
  62015. comObj.postMessage({
  62016. sourceName,
  62017. targetName,
  62018. stream: StreamKind.PULL_COMPLETE,
  62019. streamId,
  62020. success: true
  62021. });
  62022. break;
  62023. }
  62024. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  62025. streamSink.sinkCapability.resolve();
  62026. }
  62027. streamSink.desiredSize = data.desiredSize;
  62028. new Promise(function (resolve) {
  62029. resolve(streamSink.onPull && streamSink.onPull());
  62030. }).then(function () {
  62031. comObj.postMessage({
  62032. sourceName,
  62033. targetName,
  62034. stream: StreamKind.PULL_COMPLETE,
  62035. streamId,
  62036. success: true
  62037. });
  62038. }, function (reason) {
  62039. comObj.postMessage({
  62040. sourceName,
  62041. targetName,
  62042. stream: StreamKind.PULL_COMPLETE,
  62043. streamId,
  62044. reason: wrapReason(reason)
  62045. });
  62046. });
  62047. break;
  62048. case StreamKind.ENQUEUE:
  62049. (0, _util.assert)(streamController, "enqueue should have stream controller");
  62050. if (streamController.isClosed) {
  62051. break;
  62052. }
  62053. streamController.controller.enqueue(data.chunk);
  62054. break;
  62055. case StreamKind.CLOSE:
  62056. (0, _util.assert)(streamController, "close should have stream controller");
  62057. if (streamController.isClosed) {
  62058. break;
  62059. }
  62060. streamController.isClosed = true;
  62061. streamController.controller.close();
  62062. this._deleteStreamController(streamController, streamId);
  62063. break;
  62064. case StreamKind.ERROR:
  62065. (0, _util.assert)(streamController, "error should have stream controller");
  62066. streamController.controller.error(wrapReason(data.reason));
  62067. this._deleteStreamController(streamController, streamId);
  62068. break;
  62069. case StreamKind.CANCEL_COMPLETE:
  62070. if (data.success) {
  62071. streamController.cancelCall.resolve();
  62072. } else {
  62073. streamController.cancelCall.reject(wrapReason(data.reason));
  62074. }
  62075. this._deleteStreamController(streamController, streamId);
  62076. break;
  62077. case StreamKind.CANCEL:
  62078. if (!streamSink) {
  62079. break;
  62080. }
  62081. new Promise(function (resolve) {
  62082. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  62083. }).then(function () {
  62084. comObj.postMessage({
  62085. sourceName,
  62086. targetName,
  62087. stream: StreamKind.CANCEL_COMPLETE,
  62088. streamId,
  62089. success: true
  62090. });
  62091. }, function (reason) {
  62092. comObj.postMessage({
  62093. sourceName,
  62094. targetName,
  62095. stream: StreamKind.CANCEL_COMPLETE,
  62096. streamId,
  62097. reason: wrapReason(reason)
  62098. });
  62099. });
  62100. streamSink.sinkCapability.reject(wrapReason(data.reason));
  62101. streamSink.isCancelled = true;
  62102. delete this.streamSinks[streamId];
  62103. break;
  62104. default:
  62105. throw new Error("Unexpected stream case");
  62106. }
  62107. }
  62108. async _deleteStreamController(streamController, streamId) {
  62109. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  62110. delete this.streamControllers[streamId];
  62111. }
  62112. destroy() {
  62113. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  62114. }
  62115. }
  62116. exports.MessageHandler = MessageHandler;
  62117. /***/ }),
  62118. /* 101 */
  62119. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62120. Object.defineProperty(exports, "__esModule", ({
  62121. value: true
  62122. }));
  62123. exports.PDFWorkerStream = void 0;
  62124. var _util = __w_pdfjs_require__(2);
  62125. class PDFWorkerStream {
  62126. constructor(msgHandler) {
  62127. this._msgHandler = msgHandler;
  62128. this._contentLength = null;
  62129. this._fullRequestReader = null;
  62130. this._rangeRequestReaders = [];
  62131. }
  62132. getFullReader() {
  62133. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  62134. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  62135. return this._fullRequestReader;
  62136. }
  62137. getRangeReader(begin, end) {
  62138. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  62139. this._rangeRequestReaders.push(reader);
  62140. return reader;
  62141. }
  62142. cancelAllRequests(reason) {
  62143. if (this._fullRequestReader) {
  62144. this._fullRequestReader.cancel(reason);
  62145. }
  62146. for (const reader of this._rangeRequestReaders.slice(0)) {
  62147. reader.cancel(reason);
  62148. }
  62149. }
  62150. }
  62151. exports.PDFWorkerStream = PDFWorkerStream;
  62152. class PDFWorkerStreamReader {
  62153. constructor(msgHandler) {
  62154. this._msgHandler = msgHandler;
  62155. this.onProgress = null;
  62156. this._contentLength = null;
  62157. this._isRangeSupported = false;
  62158. this._isStreamingSupported = false;
  62159. const readableStream = this._msgHandler.sendWithStream("GetReader");
  62160. this._reader = readableStream.getReader();
  62161. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  62162. this._isStreamingSupported = data.isStreamingSupported;
  62163. this._isRangeSupported = data.isRangeSupported;
  62164. this._contentLength = data.contentLength;
  62165. });
  62166. }
  62167. get headersReady() {
  62168. return this._headersReady;
  62169. }
  62170. get contentLength() {
  62171. return this._contentLength;
  62172. }
  62173. get isStreamingSupported() {
  62174. return this._isStreamingSupported;
  62175. }
  62176. get isRangeSupported() {
  62177. return this._isRangeSupported;
  62178. }
  62179. async read() {
  62180. const {
  62181. value,
  62182. done
  62183. } = await this._reader.read();
  62184. if (done) {
  62185. return {
  62186. value: undefined,
  62187. done: true
  62188. };
  62189. }
  62190. return {
  62191. value: value.buffer,
  62192. done: false
  62193. };
  62194. }
  62195. cancel(reason) {
  62196. this._reader.cancel(reason);
  62197. }
  62198. }
  62199. class PDFWorkerStreamRangeReader {
  62200. constructor(begin, end, msgHandler) {
  62201. this._msgHandler = msgHandler;
  62202. this.onProgress = null;
  62203. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  62204. begin,
  62205. end
  62206. });
  62207. this._reader = readableStream.getReader();
  62208. }
  62209. get isStreamingSupported() {
  62210. return false;
  62211. }
  62212. async read() {
  62213. const {
  62214. value,
  62215. done
  62216. } = await this._reader.read();
  62217. if (done) {
  62218. return {
  62219. value: undefined,
  62220. done: true
  62221. };
  62222. }
  62223. return {
  62224. value: value.buffer,
  62225. done: false
  62226. };
  62227. }
  62228. cancel(reason) {
  62229. this._reader.cancel(reason);
  62230. }
  62231. }
  62232. /***/ })
  62233. /******/ ]);
  62234. /************************************************************************/
  62235. /******/ // The module cache
  62236. /******/ var __webpack_module_cache__ = {};
  62237. /******/
  62238. /******/ // The require function
  62239. /******/ function __w_pdfjs_require__(moduleId) {
  62240. /******/ // Check if module is in cache
  62241. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  62242. /******/ if (cachedModule !== undefined) {
  62243. /******/ return cachedModule.exports;
  62244. /******/ }
  62245. /******/ // Create a new module (and put it into the cache)
  62246. /******/ var module = __webpack_module_cache__[moduleId] = {
  62247. /******/ // no module.id needed
  62248. /******/ // no module.loaded needed
  62249. /******/ exports: {}
  62250. /******/ };
  62251. /******/
  62252. /******/ // Execute the module function
  62253. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  62254. /******/
  62255. /******/ // Return the exports of the module
  62256. /******/ return module.exports;
  62257. /******/ }
  62258. /******/
  62259. /************************************************************************/
  62260. /******/ /* webpack/runtime/define property getters */
  62261. /******/ (() => {
  62262. /******/ // define getter functions for harmony exports
  62263. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  62264. /******/ for(var key in definition) {
  62265. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  62266. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  62267. /******/ }
  62268. /******/ }
  62269. /******/ };
  62270. /******/ })();
  62271. /******/
  62272. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  62273. /******/ (() => {
  62274. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  62275. /******/ })();
  62276. /******/
  62277. /******/ /* webpack/runtime/make namespace object */
  62278. /******/ (() => {
  62279. /******/ // define __esModule on exports
  62280. /******/ __w_pdfjs_require__.r = (exports) => {
  62281. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  62282. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  62283. /******/ }
  62284. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  62285. /******/ };
  62286. /******/ })();
  62287. /******/
  62288. /************************************************************************/
  62289. var __webpack_exports__ = {};
  62290. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  62291. (() => {
  62292. var exports = __webpack_exports__;
  62293. Object.defineProperty(exports, "__esModule", ({
  62294. value: true
  62295. }));
  62296. Object.defineProperty(exports, "WorkerMessageHandler", ({
  62297. enumerable: true,
  62298. get: function () {
  62299. return _worker.WorkerMessageHandler;
  62300. }
  62301. }));
  62302. var _worker = __w_pdfjs_require__(1);
  62303. const pdfjsVersion = '2.13.216';
  62304. const pdfjsBuild = '399a0ec60';
  62305. })();
  62306. /******/ return __webpack_exports__;
  62307. /******/ })()
  62308. ;
  62309. });
  62310. //# sourceMappingURL=pdf.worker.js.map