pdf.worker.js 1.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431
  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, () => {
  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__(67);
  46. var _writer = __w_pdfjs_require__(73);
  47. var _is_node = __w_pdfjs_require__(4);
  48. var _message_handler = __w_pdfjs_require__(102);
  49. var _worker_stream = __w_pdfjs_require__(103);
  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);
  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.14.305';
  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.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.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.objectFromMap = objectFromMap;
  633. exports.objectSize = objectSize;
  634. exports.setVerbosityLevel = setVerbosityLevel;
  635. exports.shadow = shadow;
  636. exports.string32 = string32;
  637. exports.stringToBytes = stringToBytes;
  638. exports.stringToPDFString = stringToPDFString;
  639. exports.stringToUTF16BEString = stringToUTF16BEString;
  640. exports.stringToUTF8String = stringToUTF8String;
  641. exports.unreachable = unreachable;
  642. exports.utf8StringToString = utf8StringToString;
  643. exports.warn = warn;
  644. __w_pdfjs_require__(3);
  645. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  646. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  647. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  648. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  649. const RenderingIntentFlag = {
  650. ANY: 0x01,
  651. DISPLAY: 0x02,
  652. PRINT: 0x04,
  653. ANNOTATIONS_FORMS: 0x10,
  654. ANNOTATIONS_STORAGE: 0x20,
  655. ANNOTATIONS_DISABLE: 0x40,
  656. OPLIST: 0x100
  657. };
  658. exports.RenderingIntentFlag = RenderingIntentFlag;
  659. const AnnotationMode = {
  660. DISABLE: 0,
  661. ENABLE: 1,
  662. ENABLE_FORMS: 2,
  663. ENABLE_STORAGE: 3
  664. };
  665. exports.AnnotationMode = AnnotationMode;
  666. const PermissionFlag = {
  667. PRINT: 0x04,
  668. MODIFY_CONTENTS: 0x08,
  669. COPY: 0x10,
  670. MODIFY_ANNOTATIONS: 0x20,
  671. FILL_INTERACTIVE_FORMS: 0x100,
  672. COPY_FOR_ACCESSIBILITY: 0x200,
  673. ASSEMBLE: 0x400,
  674. PRINT_HIGH_QUALITY: 0x800
  675. };
  676. exports.PermissionFlag = PermissionFlag;
  677. const TextRenderingMode = {
  678. FILL: 0,
  679. STROKE: 1,
  680. FILL_STROKE: 2,
  681. INVISIBLE: 3,
  682. FILL_ADD_TO_PATH: 4,
  683. STROKE_ADD_TO_PATH: 5,
  684. FILL_STROKE_ADD_TO_PATH: 6,
  685. ADD_TO_PATH: 7,
  686. FILL_STROKE_MASK: 3,
  687. ADD_TO_PATH_FLAG: 4
  688. };
  689. exports.TextRenderingMode = TextRenderingMode;
  690. const ImageKind = {
  691. GRAYSCALE_1BPP: 1,
  692. RGB_24BPP: 2,
  693. RGBA_32BPP: 3
  694. };
  695. exports.ImageKind = ImageKind;
  696. const AnnotationType = {
  697. TEXT: 1,
  698. LINK: 2,
  699. FREETEXT: 3,
  700. LINE: 4,
  701. SQUARE: 5,
  702. CIRCLE: 6,
  703. POLYGON: 7,
  704. POLYLINE: 8,
  705. HIGHLIGHT: 9,
  706. UNDERLINE: 10,
  707. SQUIGGLY: 11,
  708. STRIKEOUT: 12,
  709. STAMP: 13,
  710. CARET: 14,
  711. INK: 15,
  712. POPUP: 16,
  713. FILEATTACHMENT: 17,
  714. SOUND: 18,
  715. MOVIE: 19,
  716. WIDGET: 20,
  717. SCREEN: 21,
  718. PRINTERMARK: 22,
  719. TRAPNET: 23,
  720. WATERMARK: 24,
  721. THREED: 25,
  722. REDACT: 26
  723. };
  724. exports.AnnotationType = AnnotationType;
  725. const AnnotationStateModelType = {
  726. MARKED: "Marked",
  727. REVIEW: "Review"
  728. };
  729. exports.AnnotationStateModelType = AnnotationStateModelType;
  730. const AnnotationMarkedState = {
  731. MARKED: "Marked",
  732. UNMARKED: "Unmarked"
  733. };
  734. exports.AnnotationMarkedState = AnnotationMarkedState;
  735. const AnnotationReviewState = {
  736. ACCEPTED: "Accepted",
  737. REJECTED: "Rejected",
  738. CANCELLED: "Cancelled",
  739. COMPLETED: "Completed",
  740. NONE: "None"
  741. };
  742. exports.AnnotationReviewState = AnnotationReviewState;
  743. const AnnotationReplyType = {
  744. GROUP: "Group",
  745. REPLY: "R"
  746. };
  747. exports.AnnotationReplyType = AnnotationReplyType;
  748. const AnnotationFlag = {
  749. INVISIBLE: 0x01,
  750. HIDDEN: 0x02,
  751. PRINT: 0x04,
  752. NOZOOM: 0x08,
  753. NOROTATE: 0x10,
  754. NOVIEW: 0x20,
  755. READONLY: 0x40,
  756. LOCKED: 0x80,
  757. TOGGLENOVIEW: 0x100,
  758. LOCKEDCONTENTS: 0x200
  759. };
  760. exports.AnnotationFlag = AnnotationFlag;
  761. const AnnotationFieldFlag = {
  762. READONLY: 0x0000001,
  763. REQUIRED: 0x0000002,
  764. NOEXPORT: 0x0000004,
  765. MULTILINE: 0x0001000,
  766. PASSWORD: 0x0002000,
  767. NOTOGGLETOOFF: 0x0004000,
  768. RADIO: 0x0008000,
  769. PUSHBUTTON: 0x0010000,
  770. COMBO: 0x0020000,
  771. EDIT: 0x0040000,
  772. SORT: 0x0080000,
  773. FILESELECT: 0x0100000,
  774. MULTISELECT: 0x0200000,
  775. DONOTSPELLCHECK: 0x0400000,
  776. DONOTSCROLL: 0x0800000,
  777. COMB: 0x1000000,
  778. RICHTEXT: 0x2000000,
  779. RADIOSINUNISON: 0x2000000,
  780. COMMITONSELCHANGE: 0x4000000
  781. };
  782. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  783. const AnnotationBorderStyleType = {
  784. SOLID: 1,
  785. DASHED: 2,
  786. BEVELED: 3,
  787. INSET: 4,
  788. UNDERLINE: 5
  789. };
  790. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  791. const AnnotationActionEventType = {
  792. E: "Mouse Enter",
  793. X: "Mouse Exit",
  794. D: "Mouse Down",
  795. U: "Mouse Up",
  796. Fo: "Focus",
  797. Bl: "Blur",
  798. PO: "PageOpen",
  799. PC: "PageClose",
  800. PV: "PageVisible",
  801. PI: "PageInvisible",
  802. K: "Keystroke",
  803. F: "Format",
  804. V: "Validate",
  805. C: "Calculate"
  806. };
  807. exports.AnnotationActionEventType = AnnotationActionEventType;
  808. const DocumentActionEventType = {
  809. WC: "WillClose",
  810. WS: "WillSave",
  811. DS: "DidSave",
  812. WP: "WillPrint",
  813. DP: "DidPrint"
  814. };
  815. exports.DocumentActionEventType = DocumentActionEventType;
  816. const PageActionEventType = {
  817. O: "PageOpen",
  818. C: "PageClose"
  819. };
  820. exports.PageActionEventType = PageActionEventType;
  821. const StreamType = {
  822. UNKNOWN: "UNKNOWN",
  823. FLATE: "FLATE",
  824. LZW: "LZW",
  825. DCT: "DCT",
  826. JPX: "JPX",
  827. JBIG: "JBIG",
  828. A85: "A85",
  829. AHX: "AHX",
  830. CCF: "CCF",
  831. RLX: "RLX"
  832. };
  833. exports.StreamType = StreamType;
  834. const FontType = {
  835. UNKNOWN: "UNKNOWN",
  836. TYPE1: "TYPE1",
  837. TYPE1STANDARD: "TYPE1STANDARD",
  838. TYPE1C: "TYPE1C",
  839. CIDFONTTYPE0: "CIDFONTTYPE0",
  840. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  841. TRUETYPE: "TRUETYPE",
  842. CIDFONTTYPE2: "CIDFONTTYPE2",
  843. TYPE3: "TYPE3",
  844. OPENTYPE: "OPENTYPE",
  845. TYPE0: "TYPE0",
  846. MMTYPE1: "MMTYPE1"
  847. };
  848. exports.FontType = FontType;
  849. const VerbosityLevel = {
  850. ERRORS: 0,
  851. WARNINGS: 1,
  852. INFOS: 5
  853. };
  854. exports.VerbosityLevel = VerbosityLevel;
  855. const CMapCompressionType = {
  856. NONE: 0,
  857. BINARY: 1,
  858. STREAM: 2
  859. };
  860. exports.CMapCompressionType = CMapCompressionType;
  861. const OPS = {
  862. dependency: 1,
  863. setLineWidth: 2,
  864. setLineCap: 3,
  865. setLineJoin: 4,
  866. setMiterLimit: 5,
  867. setDash: 6,
  868. setRenderingIntent: 7,
  869. setFlatness: 8,
  870. setGState: 9,
  871. save: 10,
  872. restore: 11,
  873. transform: 12,
  874. moveTo: 13,
  875. lineTo: 14,
  876. curveTo: 15,
  877. curveTo2: 16,
  878. curveTo3: 17,
  879. closePath: 18,
  880. rectangle: 19,
  881. stroke: 20,
  882. closeStroke: 21,
  883. fill: 22,
  884. eoFill: 23,
  885. fillStroke: 24,
  886. eoFillStroke: 25,
  887. closeFillStroke: 26,
  888. closeEOFillStroke: 27,
  889. endPath: 28,
  890. clip: 29,
  891. eoClip: 30,
  892. beginText: 31,
  893. endText: 32,
  894. setCharSpacing: 33,
  895. setWordSpacing: 34,
  896. setHScale: 35,
  897. setLeading: 36,
  898. setFont: 37,
  899. setTextRenderingMode: 38,
  900. setTextRise: 39,
  901. moveText: 40,
  902. setLeadingMoveText: 41,
  903. setTextMatrix: 42,
  904. nextLine: 43,
  905. showText: 44,
  906. showSpacedText: 45,
  907. nextLineShowText: 46,
  908. nextLineSetSpacingShowText: 47,
  909. setCharWidth: 48,
  910. setCharWidthAndBounds: 49,
  911. setStrokeColorSpace: 50,
  912. setFillColorSpace: 51,
  913. setStrokeColor: 52,
  914. setStrokeColorN: 53,
  915. setFillColor: 54,
  916. setFillColorN: 55,
  917. setStrokeGray: 56,
  918. setFillGray: 57,
  919. setStrokeRGBColor: 58,
  920. setFillRGBColor: 59,
  921. setStrokeCMYKColor: 60,
  922. setFillCMYKColor: 61,
  923. shadingFill: 62,
  924. beginInlineImage: 63,
  925. beginImageData: 64,
  926. endInlineImage: 65,
  927. paintXObject: 66,
  928. markPoint: 67,
  929. markPointProps: 68,
  930. beginMarkedContent: 69,
  931. beginMarkedContentProps: 70,
  932. endMarkedContent: 71,
  933. beginCompat: 72,
  934. endCompat: 73,
  935. paintFormXObjectBegin: 74,
  936. paintFormXObjectEnd: 75,
  937. beginGroup: 76,
  938. endGroup: 77,
  939. beginAnnotations: 78,
  940. endAnnotations: 79,
  941. beginAnnotation: 80,
  942. endAnnotation: 81,
  943. paintJpegXObject: 82,
  944. paintImageMaskXObject: 83,
  945. paintImageMaskXObjectGroup: 84,
  946. paintImageXObject: 85,
  947. paintInlineImageXObject: 86,
  948. paintInlineImageXObjectGroup: 87,
  949. paintImageXObjectRepeat: 88,
  950. paintImageMaskXObjectRepeat: 89,
  951. paintSolidColorImageMask: 90,
  952. constructPath: 91
  953. };
  954. exports.OPS = OPS;
  955. const UNSUPPORTED_FEATURES = {
  956. unknown: "unknown",
  957. forms: "forms",
  958. javaScript: "javaScript",
  959. signatures: "signatures",
  960. smask: "smask",
  961. shadingPattern: "shadingPattern",
  962. font: "font",
  963. errorTilingPattern: "errorTilingPattern",
  964. errorExtGState: "errorExtGState",
  965. errorXObject: "errorXObject",
  966. errorFontLoadType3: "errorFontLoadType3",
  967. errorFontState: "errorFontState",
  968. errorFontMissing: "errorFontMissing",
  969. errorFontTranslate: "errorFontTranslate",
  970. errorColorSpace: "errorColorSpace",
  971. errorOperatorList: "errorOperatorList",
  972. errorFontToUnicode: "errorFontToUnicode",
  973. errorFontLoadNative: "errorFontLoadNative",
  974. errorFontBuildPath: "errorFontBuildPath",
  975. errorFontGetPath: "errorFontGetPath",
  976. errorMarkedContent: "errorMarkedContent",
  977. errorContentSubStream: "errorContentSubStream"
  978. };
  979. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  980. const PasswordResponses = {
  981. NEED_PASSWORD: 1,
  982. INCORRECT_PASSWORD: 2
  983. };
  984. exports.PasswordResponses = PasswordResponses;
  985. let verbosity = VerbosityLevel.WARNINGS;
  986. function setVerbosityLevel(level) {
  987. if (Number.isInteger(level)) {
  988. verbosity = level;
  989. }
  990. }
  991. function getVerbosityLevel() {
  992. return verbosity;
  993. }
  994. function info(msg) {
  995. if (verbosity >= VerbosityLevel.INFOS) {
  996. console.log(`Info: ${msg}`);
  997. }
  998. }
  999. function warn(msg) {
  1000. if (verbosity >= VerbosityLevel.WARNINGS) {
  1001. console.log(`Warning: ${msg}`);
  1002. }
  1003. }
  1004. function unreachable(msg) {
  1005. throw new Error(msg);
  1006. }
  1007. function assert(cond, msg) {
  1008. if (!cond) {
  1009. unreachable(msg);
  1010. }
  1011. }
  1012. function _isValidProtocol(url) {
  1013. if (!url) {
  1014. return false;
  1015. }
  1016. switch (url.protocol) {
  1017. case "http:":
  1018. case "https:":
  1019. case "ftp:":
  1020. case "mailto:":
  1021. case "tel:":
  1022. return true;
  1023. default:
  1024. return false;
  1025. }
  1026. }
  1027. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1028. if (!url) {
  1029. return null;
  1030. }
  1031. try {
  1032. if (options && typeof url === "string") {
  1033. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1034. const dots = url.match(/\./g);
  1035. if (dots && dots.length >= 2) {
  1036. url = `http://${url}`;
  1037. }
  1038. }
  1039. if (options.tryConvertEncoding) {
  1040. try {
  1041. url = stringToUTF8String(url);
  1042. } catch (ex) {}
  1043. }
  1044. }
  1045. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1046. if (_isValidProtocol(absoluteUrl)) {
  1047. return absoluteUrl;
  1048. }
  1049. } catch (ex) {}
  1050. return null;
  1051. }
  1052. function shadow(obj, prop, value) {
  1053. Object.defineProperty(obj, prop, {
  1054. value,
  1055. enumerable: true,
  1056. configurable: true,
  1057. writable: false
  1058. });
  1059. return value;
  1060. }
  1061. const BaseException = function BaseExceptionClosure() {
  1062. function BaseException(message, name) {
  1063. if (this.constructor === BaseException) {
  1064. unreachable("Cannot initialize BaseException.");
  1065. }
  1066. this.message = message;
  1067. this.name = name;
  1068. }
  1069. BaseException.prototype = new Error();
  1070. BaseException.constructor = BaseException;
  1071. return BaseException;
  1072. }();
  1073. exports.BaseException = BaseException;
  1074. class PasswordException extends BaseException {
  1075. constructor(msg, code) {
  1076. super(msg, "PasswordException");
  1077. this.code = code;
  1078. }
  1079. }
  1080. exports.PasswordException = PasswordException;
  1081. class UnknownErrorException extends BaseException {
  1082. constructor(msg, details) {
  1083. super(msg, "UnknownErrorException");
  1084. this.details = details;
  1085. }
  1086. }
  1087. exports.UnknownErrorException = UnknownErrorException;
  1088. class InvalidPDFException extends BaseException {
  1089. constructor(msg) {
  1090. super(msg, "InvalidPDFException");
  1091. }
  1092. }
  1093. exports.InvalidPDFException = InvalidPDFException;
  1094. class MissingPDFException extends BaseException {
  1095. constructor(msg) {
  1096. super(msg, "MissingPDFException");
  1097. }
  1098. }
  1099. exports.MissingPDFException = MissingPDFException;
  1100. class UnexpectedResponseException extends BaseException {
  1101. constructor(msg, status) {
  1102. super(msg, "UnexpectedResponseException");
  1103. this.status = status;
  1104. }
  1105. }
  1106. exports.UnexpectedResponseException = UnexpectedResponseException;
  1107. class FormatError extends BaseException {
  1108. constructor(msg) {
  1109. super(msg, "FormatError");
  1110. }
  1111. }
  1112. exports.FormatError = FormatError;
  1113. class AbortException extends BaseException {
  1114. constructor(msg) {
  1115. super(msg, "AbortException");
  1116. }
  1117. }
  1118. exports.AbortException = AbortException;
  1119. function bytesToString(bytes) {
  1120. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1121. unreachable("Invalid argument for bytesToString");
  1122. }
  1123. const length = bytes.length;
  1124. const MAX_ARGUMENT_COUNT = 8192;
  1125. if (length < MAX_ARGUMENT_COUNT) {
  1126. return String.fromCharCode.apply(null, bytes);
  1127. }
  1128. const strBuf = [];
  1129. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1130. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1131. const chunk = bytes.subarray(i, chunkEnd);
  1132. strBuf.push(String.fromCharCode.apply(null, chunk));
  1133. }
  1134. return strBuf.join("");
  1135. }
  1136. function stringToBytes(str) {
  1137. if (typeof str !== "string") {
  1138. unreachable("Invalid argument for stringToBytes");
  1139. }
  1140. const length = str.length;
  1141. const bytes = new Uint8Array(length);
  1142. for (let i = 0; i < length; ++i) {
  1143. bytes[i] = str.charCodeAt(i) & 0xff;
  1144. }
  1145. return bytes;
  1146. }
  1147. function arrayByteLength(arr) {
  1148. if (arr.length !== undefined) {
  1149. return arr.length;
  1150. }
  1151. if (arr.byteLength !== undefined) {
  1152. return arr.byteLength;
  1153. }
  1154. unreachable("Invalid argument for arrayByteLength");
  1155. }
  1156. function arraysToBytes(arr) {
  1157. const length = arr.length;
  1158. if (length === 1 && arr[0] instanceof Uint8Array) {
  1159. return arr[0];
  1160. }
  1161. let resultLength = 0;
  1162. for (let i = 0; i < length; i++) {
  1163. resultLength += arrayByteLength(arr[i]);
  1164. }
  1165. let pos = 0;
  1166. const data = new Uint8Array(resultLength);
  1167. for (let i = 0; i < length; i++) {
  1168. let item = arr[i];
  1169. if (!(item instanceof Uint8Array)) {
  1170. if (typeof item === "string") {
  1171. item = stringToBytes(item);
  1172. } else {
  1173. item = new Uint8Array(item);
  1174. }
  1175. }
  1176. const itemLength = item.byteLength;
  1177. data.set(item, pos);
  1178. pos += itemLength;
  1179. }
  1180. return data;
  1181. }
  1182. function string32(value) {
  1183. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1184. }
  1185. function objectSize(obj) {
  1186. return Object.keys(obj).length;
  1187. }
  1188. function objectFromMap(map) {
  1189. const obj = Object.create(null);
  1190. for (const [key, value] of map) {
  1191. obj[key] = value;
  1192. }
  1193. return obj;
  1194. }
  1195. function isLittleEndian() {
  1196. const buffer8 = new Uint8Array(4);
  1197. buffer8[0] = 1;
  1198. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1199. return view32[0] === 1;
  1200. }
  1201. function isEvalSupported() {
  1202. try {
  1203. new Function("");
  1204. return true;
  1205. } catch (e) {
  1206. return false;
  1207. }
  1208. }
  1209. class FeatureTest {
  1210. static get isLittleEndian() {
  1211. return shadow(this, "isLittleEndian", isLittleEndian());
  1212. }
  1213. static get isEvalSupported() {
  1214. return shadow(this, "isEvalSupported", isEvalSupported());
  1215. }
  1216. static get isOffscreenCanvasSupported() {
  1217. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1218. }
  1219. }
  1220. exports.FeatureTest = FeatureTest;
  1221. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1222. class Util {
  1223. static makeHexColor(r, g, b) {
  1224. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1225. }
  1226. static scaleMinMax(transform, minMax) {
  1227. let temp;
  1228. if (transform[0]) {
  1229. if (transform[0] < 0) {
  1230. temp = minMax[0];
  1231. minMax[0] = minMax[1];
  1232. minMax[1] = temp;
  1233. }
  1234. minMax[0] *= transform[0];
  1235. minMax[1] *= transform[0];
  1236. if (transform[3] < 0) {
  1237. temp = minMax[2];
  1238. minMax[2] = minMax[3];
  1239. minMax[3] = temp;
  1240. }
  1241. minMax[2] *= transform[3];
  1242. minMax[3] *= transform[3];
  1243. } else {
  1244. temp = minMax[0];
  1245. minMax[0] = minMax[2];
  1246. minMax[2] = temp;
  1247. temp = minMax[1];
  1248. minMax[1] = minMax[3];
  1249. minMax[3] = temp;
  1250. if (transform[1] < 0) {
  1251. temp = minMax[2];
  1252. minMax[2] = minMax[3];
  1253. minMax[3] = temp;
  1254. }
  1255. minMax[2] *= transform[1];
  1256. minMax[3] *= transform[1];
  1257. if (transform[2] < 0) {
  1258. temp = minMax[0];
  1259. minMax[0] = minMax[1];
  1260. minMax[1] = temp;
  1261. }
  1262. minMax[0] *= transform[2];
  1263. minMax[1] *= transform[2];
  1264. }
  1265. minMax[0] += transform[4];
  1266. minMax[1] += transform[4];
  1267. minMax[2] += transform[5];
  1268. minMax[3] += transform[5];
  1269. }
  1270. static transform(m1, m2) {
  1271. 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]];
  1272. }
  1273. static applyTransform(p, m) {
  1274. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1275. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1276. return [xt, yt];
  1277. }
  1278. static applyInverseTransform(p, m) {
  1279. const d = m[0] * m[3] - m[1] * m[2];
  1280. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1281. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1282. return [xt, yt];
  1283. }
  1284. static getAxialAlignedBoundingBox(r, m) {
  1285. const p1 = Util.applyTransform(r, m);
  1286. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1287. const p3 = Util.applyTransform([r[0], r[3]], m);
  1288. const p4 = Util.applyTransform([r[2], r[1]], m);
  1289. 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])];
  1290. }
  1291. static inverseTransform(m) {
  1292. const d = m[0] * m[3] - m[1] * m[2];
  1293. 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];
  1294. }
  1295. static apply3dTransform(m, v) {
  1296. 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]];
  1297. }
  1298. static singularValueDecompose2dScale(m) {
  1299. const transpose = [m[0], m[2], m[1], m[3]];
  1300. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1301. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1302. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1303. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1304. const first = (a + d) / 2;
  1305. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1306. const sx = first + second || 1;
  1307. const sy = first - second || 1;
  1308. return [Math.sqrt(sx), Math.sqrt(sy)];
  1309. }
  1310. static normalizeRect(rect) {
  1311. const r = rect.slice(0);
  1312. if (rect[0] > rect[2]) {
  1313. r[0] = rect[2];
  1314. r[2] = rect[0];
  1315. }
  1316. if (rect[1] > rect[3]) {
  1317. r[1] = rect[3];
  1318. r[3] = rect[1];
  1319. }
  1320. return r;
  1321. }
  1322. static intersect(rect1, rect2) {
  1323. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1324. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1325. if (xLow > xHigh) {
  1326. return null;
  1327. }
  1328. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1329. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1330. if (yLow > yHigh) {
  1331. return null;
  1332. }
  1333. return [xLow, yLow, xHigh, yHigh];
  1334. }
  1335. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1336. const tvalues = [],
  1337. bounds = [[], []];
  1338. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1339. for (let i = 0; i < 2; ++i) {
  1340. if (i === 0) {
  1341. b = 6 * x0 - 12 * x1 + 6 * x2;
  1342. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1343. c = 3 * x1 - 3 * x0;
  1344. } else {
  1345. b = 6 * y0 - 12 * y1 + 6 * y2;
  1346. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1347. c = 3 * y1 - 3 * y0;
  1348. }
  1349. if (Math.abs(a) < 1e-12) {
  1350. if (Math.abs(b) < 1e-12) {
  1351. continue;
  1352. }
  1353. t = -c / b;
  1354. if (0 < t && t < 1) {
  1355. tvalues.push(t);
  1356. }
  1357. continue;
  1358. }
  1359. b2ac = b * b - 4 * c * a;
  1360. sqrtb2ac = Math.sqrt(b2ac);
  1361. if (b2ac < 0) {
  1362. continue;
  1363. }
  1364. t1 = (-b + sqrtb2ac) / (2 * a);
  1365. if (0 < t1 && t1 < 1) {
  1366. tvalues.push(t1);
  1367. }
  1368. t2 = (-b - sqrtb2ac) / (2 * a);
  1369. if (0 < t2 && t2 < 1) {
  1370. tvalues.push(t2);
  1371. }
  1372. }
  1373. let j = tvalues.length,
  1374. mt;
  1375. const jlen = j;
  1376. while (j--) {
  1377. t = tvalues[j];
  1378. mt = 1 - t;
  1379. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1380. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1381. }
  1382. bounds[0][jlen] = x0;
  1383. bounds[1][jlen] = y0;
  1384. bounds[0][jlen + 1] = x3;
  1385. bounds[1][jlen + 1] = y3;
  1386. bounds[0].length = bounds[1].length = jlen + 2;
  1387. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1388. }
  1389. }
  1390. exports.Util = Util;
  1391. 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];
  1392. function stringToPDFString(str) {
  1393. if (str[0] >= "\xEF") {
  1394. let encoding;
  1395. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1396. encoding = "utf-16be";
  1397. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1398. encoding = "utf-16le";
  1399. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1400. encoding = "utf-8";
  1401. }
  1402. if (encoding) {
  1403. try {
  1404. const decoder = new TextDecoder(encoding, {
  1405. fatal: true
  1406. });
  1407. const buffer = stringToBytes(str);
  1408. return decoder.decode(buffer);
  1409. } catch (ex) {
  1410. warn(`stringToPDFString: "${ex}".`);
  1411. }
  1412. }
  1413. }
  1414. const strBuf = [];
  1415. for (let i = 0, ii = str.length; i < ii; i++) {
  1416. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1417. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1418. }
  1419. return strBuf.join("");
  1420. }
  1421. function escapeString(str) {
  1422. return str.replace(/([()\\\n\r])/g, match => {
  1423. if (match === "\n") {
  1424. return "\\n";
  1425. } else if (match === "\r") {
  1426. return "\\r";
  1427. }
  1428. return `\\${match}`;
  1429. });
  1430. }
  1431. function isAscii(str) {
  1432. return /^[\x00-\x7F]*$/.test(str);
  1433. }
  1434. function stringToUTF16BEString(str) {
  1435. const buf = ["\xFE\xFF"];
  1436. for (let i = 0, ii = str.length; i < ii; i++) {
  1437. const char = str.charCodeAt(i);
  1438. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1439. }
  1440. return buf.join("");
  1441. }
  1442. function stringToUTF8String(str) {
  1443. return decodeURIComponent(escape(str));
  1444. }
  1445. function utf8StringToString(str) {
  1446. return unescape(encodeURIComponent(str));
  1447. }
  1448. function isArrayBuffer(v) {
  1449. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1450. }
  1451. function isArrayEqual(arr1, arr2) {
  1452. if (arr1.length !== arr2.length) {
  1453. return false;
  1454. }
  1455. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1456. if (arr1[i] !== arr2[i]) {
  1457. return false;
  1458. }
  1459. }
  1460. return true;
  1461. }
  1462. function getModificationDate(date = new Date()) {
  1463. 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")];
  1464. return buffer.join("");
  1465. }
  1466. function createPromiseCapability() {
  1467. const capability = Object.create(null);
  1468. let isSettled = false;
  1469. Object.defineProperty(capability, "settled", {
  1470. get() {
  1471. return isSettled;
  1472. }
  1473. });
  1474. capability.promise = new Promise(function (resolve, reject) {
  1475. capability.resolve = function (data) {
  1476. isSettled = true;
  1477. resolve(data);
  1478. };
  1479. capability.reject = function (reason) {
  1480. isSettled = true;
  1481. reject(reason);
  1482. };
  1483. });
  1484. return capability;
  1485. }
  1486. /***/ }),
  1487. /* 3 */
  1488. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1489. var _is_node = __w_pdfjs_require__(4);
  1490. ;
  1491. /***/ }),
  1492. /* 4 */
  1493. /***/ ((__unused_webpack_module, exports) => {
  1494. Object.defineProperty(exports, "__esModule", ({
  1495. value: true
  1496. }));
  1497. exports.isNodeJS = void 0;
  1498. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1499. exports.isNodeJS = isNodeJS;
  1500. /***/ }),
  1501. /* 5 */
  1502. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1503. Object.defineProperty(exports, "__esModule", ({
  1504. value: true
  1505. }));
  1506. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1507. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1508. exports.isCmd = isCmd;
  1509. exports.isDict = isDict;
  1510. exports.isName = isName;
  1511. exports.isRefsEqual = isRefsEqual;
  1512. var _util = __w_pdfjs_require__(2);
  1513. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1514. exports.CIRCULAR_REF = CIRCULAR_REF;
  1515. const EOF = Symbol("EOF");
  1516. exports.EOF = EOF;
  1517. const Name = function NameClosure() {
  1518. let nameCache = Object.create(null);
  1519. class Name {
  1520. constructor(name) {
  1521. this.name = name;
  1522. }
  1523. static get(name) {
  1524. const nameValue = nameCache[name];
  1525. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1526. }
  1527. static _clearCache() {
  1528. nameCache = Object.create(null);
  1529. }
  1530. }
  1531. return Name;
  1532. }();
  1533. exports.Name = Name;
  1534. const Cmd = function CmdClosure() {
  1535. let cmdCache = Object.create(null);
  1536. class Cmd {
  1537. constructor(cmd) {
  1538. this.cmd = cmd;
  1539. }
  1540. static get(cmd) {
  1541. const cmdValue = cmdCache[cmd];
  1542. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1543. }
  1544. static _clearCache() {
  1545. cmdCache = Object.create(null);
  1546. }
  1547. }
  1548. return Cmd;
  1549. }();
  1550. exports.Cmd = Cmd;
  1551. const nonSerializable = function nonSerializableClosure() {
  1552. return nonSerializable;
  1553. };
  1554. class Dict {
  1555. constructor(xref = null) {
  1556. this._map = Object.create(null);
  1557. this.xref = xref;
  1558. this.objId = null;
  1559. this.suppressEncryption = false;
  1560. this.__nonSerializable__ = nonSerializable;
  1561. }
  1562. assignXref(newXref) {
  1563. this.xref = newXref;
  1564. }
  1565. get size() {
  1566. return Object.keys(this._map).length;
  1567. }
  1568. get(key1, key2, key3) {
  1569. let value = this._map[key1];
  1570. if (value === undefined && key2 !== undefined) {
  1571. value = this._map[key2];
  1572. if (value === undefined && key3 !== undefined) {
  1573. value = this._map[key3];
  1574. }
  1575. }
  1576. if (value instanceof Ref && this.xref) {
  1577. return this.xref.fetch(value, this.suppressEncryption);
  1578. }
  1579. return value;
  1580. }
  1581. async getAsync(key1, key2, key3) {
  1582. let value = this._map[key1];
  1583. if (value === undefined && key2 !== undefined) {
  1584. value = this._map[key2];
  1585. if (value === undefined && key3 !== undefined) {
  1586. value = this._map[key3];
  1587. }
  1588. }
  1589. if (value instanceof Ref && this.xref) {
  1590. return this.xref.fetchAsync(value, this.suppressEncryption);
  1591. }
  1592. return value;
  1593. }
  1594. getArray(key1, key2, key3) {
  1595. let value = this._map[key1];
  1596. if (value === undefined && key2 !== undefined) {
  1597. value = this._map[key2];
  1598. if (value === undefined && key3 !== undefined) {
  1599. value = this._map[key3];
  1600. }
  1601. }
  1602. if (value instanceof Ref && this.xref) {
  1603. value = this.xref.fetch(value, this.suppressEncryption);
  1604. }
  1605. if (Array.isArray(value)) {
  1606. value = value.slice();
  1607. for (let i = 0, ii = value.length; i < ii; i++) {
  1608. if (value[i] instanceof Ref && this.xref) {
  1609. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1610. }
  1611. }
  1612. }
  1613. return value;
  1614. }
  1615. getRaw(key) {
  1616. return this._map[key];
  1617. }
  1618. getKeys() {
  1619. return Object.keys(this._map);
  1620. }
  1621. getRawValues() {
  1622. return Object.values(this._map);
  1623. }
  1624. set(key, value) {
  1625. this._map[key] = value;
  1626. }
  1627. has(key) {
  1628. return this._map[key] !== undefined;
  1629. }
  1630. forEach(callback) {
  1631. for (const key in this._map) {
  1632. callback(key, this.get(key));
  1633. }
  1634. }
  1635. static get empty() {
  1636. const emptyDict = new Dict(null);
  1637. emptyDict.set = (key, value) => {
  1638. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1639. };
  1640. return (0, _util.shadow)(this, "empty", emptyDict);
  1641. }
  1642. static merge({
  1643. xref,
  1644. dictArray,
  1645. mergeSubDicts = false
  1646. }) {
  1647. const mergedDict = new Dict(xref),
  1648. properties = new Map();
  1649. for (const dict of dictArray) {
  1650. if (!(dict instanceof Dict)) {
  1651. continue;
  1652. }
  1653. for (const [key, value] of Object.entries(dict._map)) {
  1654. let property = properties.get(key);
  1655. if (property === undefined) {
  1656. property = [];
  1657. properties.set(key, property);
  1658. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1659. continue;
  1660. }
  1661. property.push(value);
  1662. }
  1663. }
  1664. for (const [name, values] of properties) {
  1665. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1666. mergedDict._map[name] = values[0];
  1667. continue;
  1668. }
  1669. const subDict = new Dict(xref);
  1670. for (const dict of values) {
  1671. for (const [key, value] of Object.entries(dict._map)) {
  1672. if (subDict._map[key] === undefined) {
  1673. subDict._map[key] = value;
  1674. }
  1675. }
  1676. }
  1677. if (subDict.size > 0) {
  1678. mergedDict._map[name] = subDict;
  1679. }
  1680. }
  1681. properties.clear();
  1682. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1683. }
  1684. }
  1685. exports.Dict = Dict;
  1686. const Ref = function RefClosure() {
  1687. let refCache = Object.create(null);
  1688. class Ref {
  1689. constructor(num, gen) {
  1690. this.num = num;
  1691. this.gen = gen;
  1692. }
  1693. toString() {
  1694. if (this.gen === 0) {
  1695. return `${this.num}R`;
  1696. }
  1697. return `${this.num}R${this.gen}`;
  1698. }
  1699. static get(num, gen) {
  1700. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1701. const refValue = refCache[key];
  1702. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1703. }
  1704. static _clearCache() {
  1705. refCache = Object.create(null);
  1706. }
  1707. }
  1708. return Ref;
  1709. }();
  1710. exports.Ref = Ref;
  1711. class RefSet {
  1712. constructor(parent = null) {
  1713. this._set = new Set(parent && parent._set);
  1714. }
  1715. has(ref) {
  1716. return this._set.has(ref.toString());
  1717. }
  1718. put(ref) {
  1719. this._set.add(ref.toString());
  1720. }
  1721. remove(ref) {
  1722. this._set.delete(ref.toString());
  1723. }
  1724. [Symbol.iterator]() {
  1725. return this._set.values();
  1726. }
  1727. clear() {
  1728. this._set.clear();
  1729. }
  1730. }
  1731. exports.RefSet = RefSet;
  1732. class RefSetCache {
  1733. constructor() {
  1734. this._map = new Map();
  1735. }
  1736. get size() {
  1737. return this._map.size;
  1738. }
  1739. get(ref) {
  1740. return this._map.get(ref.toString());
  1741. }
  1742. has(ref) {
  1743. return this._map.has(ref.toString());
  1744. }
  1745. put(ref, obj) {
  1746. this._map.set(ref.toString(), obj);
  1747. }
  1748. putAlias(ref, aliasRef) {
  1749. this._map.set(ref.toString(), this.get(aliasRef));
  1750. }
  1751. [Symbol.iterator]() {
  1752. return this._map.values();
  1753. }
  1754. clear() {
  1755. this._map.clear();
  1756. }
  1757. }
  1758. exports.RefSetCache = RefSetCache;
  1759. function isName(v, name) {
  1760. return v instanceof Name && (name === undefined || v.name === name);
  1761. }
  1762. function isCmd(v, cmd) {
  1763. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1764. }
  1765. function isDict(v, type) {
  1766. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1767. }
  1768. function isRefsEqual(v1, v2) {
  1769. return v1.num === v2.num && v1.gen === v2.gen;
  1770. }
  1771. function clearPrimitiveCaches() {
  1772. Cmd._clearCache();
  1773. Name._clearCache();
  1774. Ref._clearCache();
  1775. }
  1776. /***/ }),
  1777. /* 6 */
  1778. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1779. Object.defineProperty(exports, "__esModule", ({
  1780. value: true
  1781. }));
  1782. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1783. var _util = __w_pdfjs_require__(2);
  1784. var _chunked_stream = __w_pdfjs_require__(7);
  1785. var _core_utils = __w_pdfjs_require__(8);
  1786. var _document = __w_pdfjs_require__(11);
  1787. var _stream = __w_pdfjs_require__(10);
  1788. function parseDocBaseUrl(url) {
  1789. if (url) {
  1790. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1791. if (absoluteUrl) {
  1792. return absoluteUrl.href;
  1793. }
  1794. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1795. }
  1796. return null;
  1797. }
  1798. class BasePdfManager {
  1799. constructor() {
  1800. if (this.constructor === BasePdfManager) {
  1801. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1802. }
  1803. }
  1804. get docId() {
  1805. return this._docId;
  1806. }
  1807. get password() {
  1808. return this._password;
  1809. }
  1810. get docBaseUrl() {
  1811. const catalog = this.pdfDocument.catalog;
  1812. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  1813. }
  1814. onLoadedStream() {
  1815. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1816. }
  1817. ensureDoc(prop, args) {
  1818. return this.ensure(this.pdfDocument, prop, args);
  1819. }
  1820. ensureXRef(prop, args) {
  1821. return this.ensure(this.pdfDocument.xref, prop, args);
  1822. }
  1823. ensureCatalog(prop, args) {
  1824. return this.ensure(this.pdfDocument.catalog, prop, args);
  1825. }
  1826. getPage(pageIndex) {
  1827. return this.pdfDocument.getPage(pageIndex);
  1828. }
  1829. fontFallback(id, handler) {
  1830. return this.pdfDocument.fontFallback(id, handler);
  1831. }
  1832. loadXfaFonts(handler, task) {
  1833. return this.pdfDocument.loadXfaFonts(handler, task);
  1834. }
  1835. loadXfaImages() {
  1836. return this.pdfDocument.loadXfaImages();
  1837. }
  1838. serializeXfaData(annotationStorage) {
  1839. return this.pdfDocument.serializeXfaData(annotationStorage);
  1840. }
  1841. cleanup(manuallyTriggered = false) {
  1842. return this.pdfDocument.cleanup(manuallyTriggered);
  1843. }
  1844. async ensure(obj, prop, args) {
  1845. (0, _util.unreachable)("Abstract method `ensure` called");
  1846. }
  1847. requestRange(begin, end) {
  1848. (0, _util.unreachable)("Abstract method `requestRange` called");
  1849. }
  1850. requestLoadedStream() {
  1851. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1852. }
  1853. sendProgressiveData(chunk) {
  1854. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1855. }
  1856. updatePassword(password) {
  1857. this._password = password;
  1858. }
  1859. terminate(reason) {
  1860. (0, _util.unreachable)("Abstract method `terminate` called");
  1861. }
  1862. }
  1863. class LocalPdfManager extends BasePdfManager {
  1864. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  1865. super();
  1866. this._docId = docId;
  1867. this._password = password;
  1868. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1869. this.msgHandler = msgHandler;
  1870. this.evaluatorOptions = evaluatorOptions;
  1871. this.enableXfa = enableXfa;
  1872. const stream = new _stream.Stream(data);
  1873. this.pdfDocument = new _document.PDFDocument(this, stream);
  1874. this._loadedStreamPromise = Promise.resolve(stream);
  1875. }
  1876. async ensure(obj, prop, args) {
  1877. const value = obj[prop];
  1878. if (typeof value === "function") {
  1879. return value.apply(obj, args);
  1880. }
  1881. return value;
  1882. }
  1883. requestRange(begin, end) {
  1884. return Promise.resolve();
  1885. }
  1886. requestLoadedStream() {}
  1887. onLoadedStream() {
  1888. return this._loadedStreamPromise;
  1889. }
  1890. terminate(reason) {}
  1891. }
  1892. exports.LocalPdfManager = LocalPdfManager;
  1893. class NetworkPdfManager extends BasePdfManager {
  1894. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1895. super();
  1896. this._docId = docId;
  1897. this._password = args.password;
  1898. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1899. this.msgHandler = args.msgHandler;
  1900. this.evaluatorOptions = evaluatorOptions;
  1901. this.enableXfa = enableXfa;
  1902. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1903. msgHandler: args.msgHandler,
  1904. length: args.length,
  1905. disableAutoFetch: args.disableAutoFetch,
  1906. rangeChunkSize: args.rangeChunkSize
  1907. });
  1908. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1909. }
  1910. async ensure(obj, prop, args) {
  1911. try {
  1912. const value = obj[prop];
  1913. if (typeof value === "function") {
  1914. return value.apply(obj, args);
  1915. }
  1916. return value;
  1917. } catch (ex) {
  1918. if (!(ex instanceof _core_utils.MissingDataException)) {
  1919. throw ex;
  1920. }
  1921. await this.requestRange(ex.begin, ex.end);
  1922. return this.ensure(obj, prop, args);
  1923. }
  1924. }
  1925. requestRange(begin, end) {
  1926. return this.streamManager.requestRange(begin, end);
  1927. }
  1928. requestLoadedStream() {
  1929. this.streamManager.requestAllChunks();
  1930. }
  1931. sendProgressiveData(chunk) {
  1932. this.streamManager.onReceiveData({
  1933. chunk
  1934. });
  1935. }
  1936. onLoadedStream() {
  1937. return this.streamManager.onLoadedStream();
  1938. }
  1939. terminate(reason) {
  1940. this.streamManager.abort(reason);
  1941. }
  1942. }
  1943. exports.NetworkPdfManager = NetworkPdfManager;
  1944. /***/ }),
  1945. /* 7 */
  1946. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1947. Object.defineProperty(exports, "__esModule", ({
  1948. value: true
  1949. }));
  1950. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1951. var _util = __w_pdfjs_require__(2);
  1952. var _core_utils = __w_pdfjs_require__(8);
  1953. var _stream = __w_pdfjs_require__(10);
  1954. class ChunkedStream extends _stream.Stream {
  1955. constructor(length, chunkSize, manager) {
  1956. super(new Uint8Array(length), 0, length, null);
  1957. this.chunkSize = chunkSize;
  1958. this._loadedChunks = new Set();
  1959. this.numChunks = Math.ceil(length / chunkSize);
  1960. this.manager = manager;
  1961. this.progressiveDataLength = 0;
  1962. this.lastSuccessfulEnsureByteChunk = -1;
  1963. }
  1964. getMissingChunks() {
  1965. const chunks = [];
  1966. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1967. if (!this._loadedChunks.has(chunk)) {
  1968. chunks.push(chunk);
  1969. }
  1970. }
  1971. return chunks;
  1972. }
  1973. get numChunksLoaded() {
  1974. return this._loadedChunks.size;
  1975. }
  1976. get isDataLoaded() {
  1977. return this.numChunksLoaded === this.numChunks;
  1978. }
  1979. onReceiveData(begin, chunk) {
  1980. const chunkSize = this.chunkSize;
  1981. if (begin % chunkSize !== 0) {
  1982. throw new Error(`Bad begin offset: ${begin}`);
  1983. }
  1984. const end = begin + chunk.byteLength;
  1985. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1986. throw new Error(`Bad end offset: ${end}`);
  1987. }
  1988. this.bytes.set(new Uint8Array(chunk), begin);
  1989. const beginChunk = Math.floor(begin / chunkSize);
  1990. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1991. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1992. this._loadedChunks.add(curChunk);
  1993. }
  1994. }
  1995. onReceiveProgressiveData(data) {
  1996. let position = this.progressiveDataLength;
  1997. const beginChunk = Math.floor(position / this.chunkSize);
  1998. this.bytes.set(new Uint8Array(data), position);
  1999. position += data.byteLength;
  2000. this.progressiveDataLength = position;
  2001. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2002. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2003. this._loadedChunks.add(curChunk);
  2004. }
  2005. }
  2006. ensureByte(pos) {
  2007. if (pos < this.progressiveDataLength) {
  2008. return;
  2009. }
  2010. const chunk = Math.floor(pos / this.chunkSize);
  2011. if (chunk > this.numChunks) {
  2012. return;
  2013. }
  2014. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2015. return;
  2016. }
  2017. if (!this._loadedChunks.has(chunk)) {
  2018. throw new _core_utils.MissingDataException(pos, pos + 1);
  2019. }
  2020. this.lastSuccessfulEnsureByteChunk = chunk;
  2021. }
  2022. ensureRange(begin, end) {
  2023. if (begin >= end) {
  2024. return;
  2025. }
  2026. if (end <= this.progressiveDataLength) {
  2027. return;
  2028. }
  2029. const beginChunk = Math.floor(begin / this.chunkSize);
  2030. if (beginChunk > this.numChunks) {
  2031. return;
  2032. }
  2033. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2034. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2035. if (!this._loadedChunks.has(chunk)) {
  2036. throw new _core_utils.MissingDataException(begin, end);
  2037. }
  2038. }
  2039. }
  2040. nextEmptyChunk(beginChunk) {
  2041. const numChunks = this.numChunks;
  2042. for (let i = 0; i < numChunks; ++i) {
  2043. const chunk = (beginChunk + i) % numChunks;
  2044. if (!this._loadedChunks.has(chunk)) {
  2045. return chunk;
  2046. }
  2047. }
  2048. return null;
  2049. }
  2050. hasChunk(chunk) {
  2051. return this._loadedChunks.has(chunk);
  2052. }
  2053. getByte() {
  2054. const pos = this.pos;
  2055. if (pos >= this.end) {
  2056. return -1;
  2057. }
  2058. if (pos >= this.progressiveDataLength) {
  2059. this.ensureByte(pos);
  2060. }
  2061. return this.bytes[this.pos++];
  2062. }
  2063. getBytes(length) {
  2064. const bytes = this.bytes;
  2065. const pos = this.pos;
  2066. const strEnd = this.end;
  2067. if (!length) {
  2068. if (strEnd > this.progressiveDataLength) {
  2069. this.ensureRange(pos, strEnd);
  2070. }
  2071. return bytes.subarray(pos, strEnd);
  2072. }
  2073. let end = pos + length;
  2074. if (end > strEnd) {
  2075. end = strEnd;
  2076. }
  2077. if (end > this.progressiveDataLength) {
  2078. this.ensureRange(pos, end);
  2079. }
  2080. this.pos = end;
  2081. return bytes.subarray(pos, end);
  2082. }
  2083. getByteRange(begin, end) {
  2084. if (begin < 0) {
  2085. begin = 0;
  2086. }
  2087. if (end > this.end) {
  2088. end = this.end;
  2089. }
  2090. if (end > this.progressiveDataLength) {
  2091. this.ensureRange(begin, end);
  2092. }
  2093. return this.bytes.subarray(begin, end);
  2094. }
  2095. makeSubStream(start, length, dict = null) {
  2096. if (length) {
  2097. if (start + length > this.progressiveDataLength) {
  2098. this.ensureRange(start, start + length);
  2099. }
  2100. } else {
  2101. if (start >= this.progressiveDataLength) {
  2102. this.ensureByte(start);
  2103. }
  2104. }
  2105. function ChunkedStreamSubstream() {}
  2106. ChunkedStreamSubstream.prototype = Object.create(this);
  2107. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2108. const chunkSize = this.chunkSize;
  2109. const beginChunk = Math.floor(this.start / chunkSize);
  2110. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2111. const missingChunks = [];
  2112. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2113. if (!this._loadedChunks.has(chunk)) {
  2114. missingChunks.push(chunk);
  2115. }
  2116. }
  2117. return missingChunks;
  2118. };
  2119. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2120. get() {
  2121. if (this.numChunksLoaded === this.numChunks) {
  2122. return true;
  2123. }
  2124. return this.getMissingChunks().length === 0;
  2125. },
  2126. configurable: true
  2127. });
  2128. const subStream = new ChunkedStreamSubstream();
  2129. subStream.pos = subStream.start = start;
  2130. subStream.end = start + length || this.end;
  2131. subStream.dict = dict;
  2132. return subStream;
  2133. }
  2134. getBaseStreams() {
  2135. return [this];
  2136. }
  2137. }
  2138. exports.ChunkedStream = ChunkedStream;
  2139. class ChunkedStreamManager {
  2140. constructor(pdfNetworkStream, args) {
  2141. this.length = args.length;
  2142. this.chunkSize = args.rangeChunkSize;
  2143. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2144. this.pdfNetworkStream = pdfNetworkStream;
  2145. this.disableAutoFetch = args.disableAutoFetch;
  2146. this.msgHandler = args.msgHandler;
  2147. this.currRequestId = 0;
  2148. this._chunksNeededByRequest = new Map();
  2149. this._requestsByChunk = new Map();
  2150. this._promisesByRequest = new Map();
  2151. this.progressiveDataLength = 0;
  2152. this.aborted = false;
  2153. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2154. }
  2155. onLoadedStream() {
  2156. return this._loadedStreamCapability.promise;
  2157. }
  2158. sendRequest(begin, end) {
  2159. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2160. if (!rangeReader.isStreamingSupported) {
  2161. rangeReader.onProgress = this.onProgress.bind(this);
  2162. }
  2163. let chunks = [],
  2164. loaded = 0;
  2165. return new Promise((resolve, reject) => {
  2166. const readChunk = chunk => {
  2167. try {
  2168. if (!chunk.done) {
  2169. const data = chunk.value;
  2170. chunks.push(data);
  2171. loaded += (0, _util.arrayByteLength)(data);
  2172. if (rangeReader.isStreamingSupported) {
  2173. this.onProgress({
  2174. loaded
  2175. });
  2176. }
  2177. rangeReader.read().then(readChunk, reject);
  2178. return;
  2179. }
  2180. const chunkData = (0, _util.arraysToBytes)(chunks);
  2181. chunks = null;
  2182. resolve(chunkData);
  2183. } catch (e) {
  2184. reject(e);
  2185. }
  2186. };
  2187. rangeReader.read().then(readChunk, reject);
  2188. }).then(data => {
  2189. if (this.aborted) {
  2190. return;
  2191. }
  2192. this.onReceiveData({
  2193. chunk: data,
  2194. begin
  2195. });
  2196. });
  2197. }
  2198. requestAllChunks() {
  2199. const missingChunks = this.stream.getMissingChunks();
  2200. this._requestChunks(missingChunks);
  2201. return this._loadedStreamCapability.promise;
  2202. }
  2203. _requestChunks(chunks) {
  2204. const requestId = this.currRequestId++;
  2205. const chunksNeeded = new Set();
  2206. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2207. for (const chunk of chunks) {
  2208. if (!this.stream.hasChunk(chunk)) {
  2209. chunksNeeded.add(chunk);
  2210. }
  2211. }
  2212. if (chunksNeeded.size === 0) {
  2213. return Promise.resolve();
  2214. }
  2215. const capability = (0, _util.createPromiseCapability)();
  2216. this._promisesByRequest.set(requestId, capability);
  2217. const chunksToRequest = [];
  2218. for (const chunk of chunksNeeded) {
  2219. let requestIds = this._requestsByChunk.get(chunk);
  2220. if (!requestIds) {
  2221. requestIds = [];
  2222. this._requestsByChunk.set(chunk, requestIds);
  2223. chunksToRequest.push(chunk);
  2224. }
  2225. requestIds.push(requestId);
  2226. }
  2227. if (chunksToRequest.length > 0) {
  2228. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2229. for (const groupedChunk of groupedChunksToRequest) {
  2230. const begin = groupedChunk.beginChunk * this.chunkSize;
  2231. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2232. this.sendRequest(begin, end).catch(capability.reject);
  2233. }
  2234. }
  2235. return capability.promise.catch(reason => {
  2236. if (this.aborted) {
  2237. return;
  2238. }
  2239. throw reason;
  2240. });
  2241. }
  2242. getStream() {
  2243. return this.stream;
  2244. }
  2245. requestRange(begin, end) {
  2246. end = Math.min(end, this.length);
  2247. const beginChunk = this.getBeginChunk(begin);
  2248. const endChunk = this.getEndChunk(end);
  2249. const chunks = [];
  2250. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2251. chunks.push(chunk);
  2252. }
  2253. return this._requestChunks(chunks);
  2254. }
  2255. requestRanges(ranges = []) {
  2256. const chunksToRequest = [];
  2257. for (const range of ranges) {
  2258. const beginChunk = this.getBeginChunk(range.begin);
  2259. const endChunk = this.getEndChunk(range.end);
  2260. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2261. if (!chunksToRequest.includes(chunk)) {
  2262. chunksToRequest.push(chunk);
  2263. }
  2264. }
  2265. }
  2266. chunksToRequest.sort(function (a, b) {
  2267. return a - b;
  2268. });
  2269. return this._requestChunks(chunksToRequest);
  2270. }
  2271. groupChunks(chunks) {
  2272. const groupedChunks = [];
  2273. let beginChunk = -1;
  2274. let prevChunk = -1;
  2275. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2276. const chunk = chunks[i];
  2277. if (beginChunk < 0) {
  2278. beginChunk = chunk;
  2279. }
  2280. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2281. groupedChunks.push({
  2282. beginChunk,
  2283. endChunk: prevChunk + 1
  2284. });
  2285. beginChunk = chunk;
  2286. }
  2287. if (i + 1 === chunks.length) {
  2288. groupedChunks.push({
  2289. beginChunk,
  2290. endChunk: chunk + 1
  2291. });
  2292. }
  2293. prevChunk = chunk;
  2294. }
  2295. return groupedChunks;
  2296. }
  2297. onProgress(args) {
  2298. this.msgHandler.send("DocProgress", {
  2299. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2300. total: this.length
  2301. });
  2302. }
  2303. onReceiveData(args) {
  2304. const chunk = args.chunk;
  2305. const isProgressive = args.begin === undefined;
  2306. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2307. const end = begin + chunk.byteLength;
  2308. const beginChunk = Math.floor(begin / this.chunkSize);
  2309. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2310. if (isProgressive) {
  2311. this.stream.onReceiveProgressiveData(chunk);
  2312. this.progressiveDataLength = end;
  2313. } else {
  2314. this.stream.onReceiveData(begin, chunk);
  2315. }
  2316. if (this.stream.isDataLoaded) {
  2317. this._loadedStreamCapability.resolve(this.stream);
  2318. }
  2319. const loadedRequests = [];
  2320. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2321. const requestIds = this._requestsByChunk.get(curChunk);
  2322. if (!requestIds) {
  2323. continue;
  2324. }
  2325. this._requestsByChunk.delete(curChunk);
  2326. for (const requestId of requestIds) {
  2327. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2328. if (chunksNeeded.has(curChunk)) {
  2329. chunksNeeded.delete(curChunk);
  2330. }
  2331. if (chunksNeeded.size > 0) {
  2332. continue;
  2333. }
  2334. loadedRequests.push(requestId);
  2335. }
  2336. }
  2337. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2338. let nextEmptyChunk;
  2339. if (this.stream.numChunksLoaded === 1) {
  2340. const lastChunk = this.stream.numChunks - 1;
  2341. if (!this.stream.hasChunk(lastChunk)) {
  2342. nextEmptyChunk = lastChunk;
  2343. }
  2344. } else {
  2345. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2346. }
  2347. if (Number.isInteger(nextEmptyChunk)) {
  2348. this._requestChunks([nextEmptyChunk]);
  2349. }
  2350. }
  2351. for (const requestId of loadedRequests) {
  2352. const capability = this._promisesByRequest.get(requestId);
  2353. this._promisesByRequest.delete(requestId);
  2354. capability.resolve();
  2355. }
  2356. this.msgHandler.send("DocProgress", {
  2357. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2358. total: this.length
  2359. });
  2360. }
  2361. onError(err) {
  2362. this._loadedStreamCapability.reject(err);
  2363. }
  2364. getBeginChunk(begin) {
  2365. return Math.floor(begin / this.chunkSize);
  2366. }
  2367. getEndChunk(end) {
  2368. return Math.floor((end - 1) / this.chunkSize) + 1;
  2369. }
  2370. abort(reason) {
  2371. this.aborted = true;
  2372. if (this.pdfNetworkStream) {
  2373. this.pdfNetworkStream.cancelAllRequests(reason);
  2374. }
  2375. for (const capability of this._promisesByRequest.values()) {
  2376. capability.reject(reason);
  2377. }
  2378. }
  2379. }
  2380. exports.ChunkedStreamManager = ChunkedStreamManager;
  2381. /***/ }),
  2382. /* 8 */
  2383. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2384. Object.defineProperty(exports, "__esModule", ({
  2385. value: true
  2386. }));
  2387. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  2388. exports.collectActions = collectActions;
  2389. exports.encodeToXmlString = encodeToXmlString;
  2390. exports.escapePDFName = escapePDFName;
  2391. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2392. exports.getInheritableProperty = getInheritableProperty;
  2393. exports.getLookupTableFactory = getLookupTableFactory;
  2394. exports.isWhiteSpace = isWhiteSpace;
  2395. exports.log2 = log2;
  2396. exports.parseXFAPath = parseXFAPath;
  2397. exports.readInt8 = readInt8;
  2398. exports.readUint16 = readUint16;
  2399. exports.readUint32 = readUint32;
  2400. exports.recoverJsURL = recoverJsURL;
  2401. exports.toRomanNumerals = toRomanNumerals;
  2402. exports.validateCSSFont = validateCSSFont;
  2403. var _util = __w_pdfjs_require__(2);
  2404. var _primitives = __w_pdfjs_require__(5);
  2405. var _base_stream = __w_pdfjs_require__(9);
  2406. function getLookupTableFactory(initializer) {
  2407. let lookup;
  2408. return function () {
  2409. if (initializer) {
  2410. lookup = Object.create(null);
  2411. initializer(lookup);
  2412. initializer = null;
  2413. }
  2414. return lookup;
  2415. };
  2416. }
  2417. function getArrayLookupTableFactory(initializer) {
  2418. let lookup;
  2419. return function () {
  2420. if (initializer) {
  2421. let arr = initializer();
  2422. initializer = null;
  2423. lookup = Object.create(null);
  2424. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2425. lookup[arr[i]] = arr[i + 1];
  2426. }
  2427. arr = null;
  2428. }
  2429. return lookup;
  2430. };
  2431. }
  2432. class MissingDataException extends _util.BaseException {
  2433. constructor(begin, end) {
  2434. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  2435. this.begin = begin;
  2436. this.end = end;
  2437. }
  2438. }
  2439. exports.MissingDataException = MissingDataException;
  2440. class ParserEOFException extends _util.BaseException {
  2441. constructor(msg) {
  2442. super(msg, "ParserEOFException");
  2443. }
  2444. }
  2445. exports.ParserEOFException = ParserEOFException;
  2446. class XRefEntryException extends _util.BaseException {
  2447. constructor(msg) {
  2448. super(msg, "XRefEntryException");
  2449. }
  2450. }
  2451. exports.XRefEntryException = XRefEntryException;
  2452. class XRefParseException extends _util.BaseException {
  2453. constructor(msg) {
  2454. super(msg, "XRefParseException");
  2455. }
  2456. }
  2457. exports.XRefParseException = XRefParseException;
  2458. class DocStats {
  2459. constructor(handler) {
  2460. this._handler = handler;
  2461. this._streamTypes = new Set();
  2462. this._fontTypes = new Set();
  2463. }
  2464. _send() {
  2465. const streamTypes = Object.create(null),
  2466. fontTypes = Object.create(null);
  2467. for (const type of this._streamTypes) {
  2468. streamTypes[type] = true;
  2469. }
  2470. for (const type of this._fontTypes) {
  2471. fontTypes[type] = true;
  2472. }
  2473. this._handler.send("DocStats", {
  2474. streamTypes,
  2475. fontTypes
  2476. });
  2477. }
  2478. addStreamType(type) {
  2479. if (this._streamTypes.has(type)) {
  2480. return;
  2481. }
  2482. this._streamTypes.add(type);
  2483. this._send();
  2484. }
  2485. addFontType(type) {
  2486. if (this._fontTypes.has(type)) {
  2487. return;
  2488. }
  2489. this._fontTypes.add(type);
  2490. this._send();
  2491. }
  2492. }
  2493. exports.DocStats = DocStats;
  2494. function getInheritableProperty({
  2495. dict,
  2496. key,
  2497. getArray = false,
  2498. stopWhenFound = true
  2499. }) {
  2500. let values;
  2501. const visited = new _primitives.RefSet();
  2502. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2503. if (dict.objId) {
  2504. visited.put(dict.objId);
  2505. }
  2506. const value = getArray ? dict.getArray(key) : dict.get(key);
  2507. if (value !== undefined) {
  2508. if (stopWhenFound) {
  2509. return value;
  2510. }
  2511. if (!values) {
  2512. values = [];
  2513. }
  2514. values.push(value);
  2515. }
  2516. dict = dict.get("Parent");
  2517. }
  2518. return values;
  2519. }
  2520. 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"];
  2521. function toRomanNumerals(number, lowerCase = false) {
  2522. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2523. const romanBuf = [];
  2524. let pos;
  2525. while (number >= 1000) {
  2526. number -= 1000;
  2527. romanBuf.push("M");
  2528. }
  2529. pos = number / 100 | 0;
  2530. number %= 100;
  2531. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2532. pos = number / 10 | 0;
  2533. number %= 10;
  2534. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2535. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2536. const romanStr = romanBuf.join("");
  2537. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2538. }
  2539. function log2(x) {
  2540. if (x <= 0) {
  2541. return 0;
  2542. }
  2543. return Math.ceil(Math.log2(x));
  2544. }
  2545. function readInt8(data, offset) {
  2546. return data[offset] << 24 >> 24;
  2547. }
  2548. function readUint16(data, offset) {
  2549. return data[offset] << 8 | data[offset + 1];
  2550. }
  2551. function readUint32(data, offset) {
  2552. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2553. }
  2554. function isWhiteSpace(ch) {
  2555. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2556. }
  2557. function parseXFAPath(path) {
  2558. const positionPattern = /(.+)\[(\d+)\]$/;
  2559. return path.split(".").map(component => {
  2560. const m = component.match(positionPattern);
  2561. if (m) {
  2562. return {
  2563. name: m[1],
  2564. pos: parseInt(m[2], 10)
  2565. };
  2566. }
  2567. return {
  2568. name: component,
  2569. pos: 0
  2570. };
  2571. });
  2572. }
  2573. function escapePDFName(str) {
  2574. const buffer = [];
  2575. let start = 0;
  2576. for (let i = 0, ii = str.length; i < ii; i++) {
  2577. const char = str.charCodeAt(i);
  2578. 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) {
  2579. if (start < i) {
  2580. buffer.push(str.substring(start, i));
  2581. }
  2582. buffer.push(`#${char.toString(16)}`);
  2583. start = i + 1;
  2584. }
  2585. }
  2586. if (buffer.length === 0) {
  2587. return str;
  2588. }
  2589. if (start < str.length) {
  2590. buffer.push(str.substring(start, str.length));
  2591. }
  2592. return buffer.join("");
  2593. }
  2594. function _collectJS(entry, xref, list, parents) {
  2595. if (!entry) {
  2596. return;
  2597. }
  2598. let parent = null;
  2599. if (entry instanceof _primitives.Ref) {
  2600. if (parents.has(entry)) {
  2601. return;
  2602. }
  2603. parent = entry;
  2604. parents.put(parent);
  2605. entry = xref.fetch(entry);
  2606. }
  2607. if (Array.isArray(entry)) {
  2608. for (const element of entry) {
  2609. _collectJS(element, xref, list, parents);
  2610. }
  2611. } else if (entry instanceof _primitives.Dict) {
  2612. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2613. const js = entry.get("JS");
  2614. let code;
  2615. if (js instanceof _base_stream.BaseStream) {
  2616. code = js.getString();
  2617. } else if (typeof js === "string") {
  2618. code = js;
  2619. }
  2620. code = code && (0, _util.stringToPDFString)(code);
  2621. if (code) {
  2622. list.push(code);
  2623. }
  2624. }
  2625. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2626. }
  2627. if (parent) {
  2628. parents.remove(parent);
  2629. }
  2630. }
  2631. function collectActions(xref, dict, eventType) {
  2632. const actions = Object.create(null);
  2633. const additionalActionsDicts = getInheritableProperty({
  2634. dict,
  2635. key: "AA",
  2636. stopWhenFound: false
  2637. });
  2638. if (additionalActionsDicts) {
  2639. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2640. const additionalActions = additionalActionsDicts[i];
  2641. if (!(additionalActions instanceof _primitives.Dict)) {
  2642. continue;
  2643. }
  2644. for (const key of additionalActions.getKeys()) {
  2645. const action = eventType[key];
  2646. if (!action) {
  2647. continue;
  2648. }
  2649. const actionDict = additionalActions.getRaw(key);
  2650. const parents = new _primitives.RefSet();
  2651. const list = [];
  2652. _collectJS(actionDict, xref, list, parents);
  2653. if (list.length > 0) {
  2654. actions[action] = list;
  2655. }
  2656. }
  2657. }
  2658. }
  2659. if (dict.has("A")) {
  2660. const actionDict = dict.get("A");
  2661. const parents = new _primitives.RefSet();
  2662. const list = [];
  2663. _collectJS(actionDict, xref, list, parents);
  2664. if (list.length > 0) {
  2665. actions.Action = list;
  2666. }
  2667. }
  2668. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2669. }
  2670. const XMLEntities = {
  2671. 0x3c: "&lt;",
  2672. 0x3e: "&gt;",
  2673. 0x26: "&amp;",
  2674. 0x22: "&quot;",
  2675. 0x27: "&apos;"
  2676. };
  2677. function encodeToXmlString(str) {
  2678. const buffer = [];
  2679. let start = 0;
  2680. for (let i = 0, ii = str.length; i < ii; i++) {
  2681. const char = str.codePointAt(i);
  2682. if (0x20 <= char && char <= 0x7e) {
  2683. const entity = XMLEntities[char];
  2684. if (entity) {
  2685. if (start < i) {
  2686. buffer.push(str.substring(start, i));
  2687. }
  2688. buffer.push(entity);
  2689. start = i + 1;
  2690. }
  2691. } else {
  2692. if (start < i) {
  2693. buffer.push(str.substring(start, i));
  2694. }
  2695. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2696. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2697. i++;
  2698. }
  2699. start = i + 1;
  2700. }
  2701. }
  2702. if (buffer.length === 0) {
  2703. return str;
  2704. }
  2705. if (start < str.length) {
  2706. buffer.push(str.substring(start, str.length));
  2707. }
  2708. return buffer.join("");
  2709. }
  2710. function validateCSSFont(cssFontInfo) {
  2711. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2712. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2713. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2714. const {
  2715. fontFamily,
  2716. fontWeight,
  2717. italicAngle
  2718. } = cssFontInfo;
  2719. if (/^".*"$/.test(fontFamily)) {
  2720. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2721. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2722. return false;
  2723. }
  2724. } else if (/^'.*'$/.test(fontFamily)) {
  2725. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2726. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2727. return false;
  2728. }
  2729. } else {
  2730. for (const ident of fontFamily.split(/[ \t]+/)) {
  2731. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2732. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2733. return false;
  2734. }
  2735. }
  2736. }
  2737. const weight = fontWeight ? fontWeight.toString() : "";
  2738. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2739. const angle = parseFloat(italicAngle);
  2740. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2741. return true;
  2742. }
  2743. function recoverJsURL(str) {
  2744. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2745. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2746. const jsUrl = regex.exec(str);
  2747. if (jsUrl && jsUrl[2]) {
  2748. const url = jsUrl[2];
  2749. let newWindow = false;
  2750. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2751. newWindow = true;
  2752. }
  2753. return {
  2754. url,
  2755. newWindow
  2756. };
  2757. }
  2758. return null;
  2759. }
  2760. /***/ }),
  2761. /* 9 */
  2762. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2763. Object.defineProperty(exports, "__esModule", ({
  2764. value: true
  2765. }));
  2766. exports.BaseStream = void 0;
  2767. var _util = __w_pdfjs_require__(2);
  2768. class BaseStream {
  2769. constructor() {
  2770. if (this.constructor === BaseStream) {
  2771. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2772. }
  2773. }
  2774. get length() {
  2775. (0, _util.unreachable)("Abstract getter `length` accessed");
  2776. }
  2777. get isEmpty() {
  2778. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2779. }
  2780. get isDataLoaded() {
  2781. return (0, _util.shadow)(this, "isDataLoaded", true);
  2782. }
  2783. getByte() {
  2784. (0, _util.unreachable)("Abstract method `getByte` called");
  2785. }
  2786. getBytes(length) {
  2787. (0, _util.unreachable)("Abstract method `getBytes` called");
  2788. }
  2789. peekByte() {
  2790. const peekedByte = this.getByte();
  2791. if (peekedByte !== -1) {
  2792. this.pos--;
  2793. }
  2794. return peekedByte;
  2795. }
  2796. peekBytes(length) {
  2797. const bytes = this.getBytes(length);
  2798. this.pos -= bytes.length;
  2799. return bytes;
  2800. }
  2801. getUint16() {
  2802. const b0 = this.getByte();
  2803. const b1 = this.getByte();
  2804. if (b0 === -1 || b1 === -1) {
  2805. return -1;
  2806. }
  2807. return (b0 << 8) + b1;
  2808. }
  2809. getInt32() {
  2810. const b0 = this.getByte();
  2811. const b1 = this.getByte();
  2812. const b2 = this.getByte();
  2813. const b3 = this.getByte();
  2814. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2815. }
  2816. getByteRange(begin, end) {
  2817. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2818. }
  2819. getString(length) {
  2820. return (0, _util.bytesToString)(this.getBytes(length));
  2821. }
  2822. skip(n) {
  2823. this.pos += n || 1;
  2824. }
  2825. reset() {
  2826. (0, _util.unreachable)("Abstract method `reset` called");
  2827. }
  2828. moveStart() {
  2829. (0, _util.unreachable)("Abstract method `moveStart` called");
  2830. }
  2831. makeSubStream(start, length, dict = null) {
  2832. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2833. }
  2834. getBaseStreams() {
  2835. return null;
  2836. }
  2837. }
  2838. exports.BaseStream = BaseStream;
  2839. /***/ }),
  2840. /* 10 */
  2841. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2842. Object.defineProperty(exports, "__esModule", ({
  2843. value: true
  2844. }));
  2845. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2846. var _base_stream = __w_pdfjs_require__(9);
  2847. var _util = __w_pdfjs_require__(2);
  2848. class Stream extends _base_stream.BaseStream {
  2849. constructor(arrayBuffer, start, length, dict) {
  2850. super();
  2851. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2852. this.start = start || 0;
  2853. this.pos = this.start;
  2854. this.end = start + length || this.bytes.length;
  2855. this.dict = dict;
  2856. }
  2857. get length() {
  2858. return this.end - this.start;
  2859. }
  2860. get isEmpty() {
  2861. return this.length === 0;
  2862. }
  2863. getByte() {
  2864. if (this.pos >= this.end) {
  2865. return -1;
  2866. }
  2867. return this.bytes[this.pos++];
  2868. }
  2869. getBytes(length) {
  2870. const bytes = this.bytes;
  2871. const pos = this.pos;
  2872. const strEnd = this.end;
  2873. if (!length) {
  2874. return bytes.subarray(pos, strEnd);
  2875. }
  2876. let end = pos + length;
  2877. if (end > strEnd) {
  2878. end = strEnd;
  2879. }
  2880. this.pos = end;
  2881. return bytes.subarray(pos, end);
  2882. }
  2883. getByteRange(begin, end) {
  2884. if (begin < 0) {
  2885. begin = 0;
  2886. }
  2887. if (end > this.end) {
  2888. end = this.end;
  2889. }
  2890. return this.bytes.subarray(begin, end);
  2891. }
  2892. reset() {
  2893. this.pos = this.start;
  2894. }
  2895. moveStart() {
  2896. this.start = this.pos;
  2897. }
  2898. makeSubStream(start, length, dict = null) {
  2899. return new Stream(this.bytes.buffer, start, length, dict);
  2900. }
  2901. }
  2902. exports.Stream = Stream;
  2903. class StringStream extends Stream {
  2904. constructor(str) {
  2905. super((0, _util.stringToBytes)(str));
  2906. }
  2907. }
  2908. exports.StringStream = StringStream;
  2909. class NullStream extends Stream {
  2910. constructor() {
  2911. super(new Uint8Array(0));
  2912. }
  2913. }
  2914. exports.NullStream = NullStream;
  2915. /***/ }),
  2916. /* 11 */
  2917. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2918. Object.defineProperty(exports, "__esModule", ({
  2919. value: true
  2920. }));
  2921. exports.Page = exports.PDFDocument = void 0;
  2922. var _util = __w_pdfjs_require__(2);
  2923. var _core_utils = __w_pdfjs_require__(8);
  2924. var _primitives = __w_pdfjs_require__(5);
  2925. var _xfa_fonts = __w_pdfjs_require__(12);
  2926. var _annotation = __w_pdfjs_require__(22);
  2927. var _base_stream = __w_pdfjs_require__(9);
  2928. var _crypto = __w_pdfjs_require__(74);
  2929. var _catalog = __w_pdfjs_require__(65);
  2930. var _cleanup_helper = __w_pdfjs_require__(67);
  2931. var _dataset_reader = __w_pdfjs_require__(100);
  2932. var _parser = __w_pdfjs_require__(27);
  2933. var _stream = __w_pdfjs_require__(10);
  2934. var _object_loader = __w_pdfjs_require__(72);
  2935. var _operator_list = __w_pdfjs_require__(62);
  2936. var _evaluator = __w_pdfjs_require__(25);
  2937. var _decode_stream = __w_pdfjs_require__(29);
  2938. var _struct_tree = __w_pdfjs_require__(71);
  2939. var _factory = __w_pdfjs_require__(76);
  2940. var _xref = __w_pdfjs_require__(101);
  2941. const DEFAULT_USER_UNIT = 1.0;
  2942. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2943. class Page {
  2944. constructor({
  2945. pdfManager,
  2946. xref,
  2947. pageIndex,
  2948. pageDict,
  2949. ref,
  2950. globalIdFactory,
  2951. fontCache,
  2952. builtInCMapCache,
  2953. standardFontDataCache,
  2954. globalImageCache,
  2955. nonBlendModesSet,
  2956. xfaFactory
  2957. }) {
  2958. this.pdfManager = pdfManager;
  2959. this.pageIndex = pageIndex;
  2960. this.pageDict = pageDict;
  2961. this.xref = xref;
  2962. this.ref = ref;
  2963. this.fontCache = fontCache;
  2964. this.builtInCMapCache = builtInCMapCache;
  2965. this.standardFontDataCache = standardFontDataCache;
  2966. this.globalImageCache = globalImageCache;
  2967. this.nonBlendModesSet = nonBlendModesSet;
  2968. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2969. this.resourcesPromise = null;
  2970. this.xfaFactory = xfaFactory;
  2971. const idCounters = {
  2972. obj: 0
  2973. };
  2974. this._localIdFactory = class extends globalIdFactory {
  2975. static createObjId() {
  2976. return `p${pageIndex}_${++idCounters.obj}`;
  2977. }
  2978. static getPageObjId() {
  2979. return `page${ref.toString()}`;
  2980. }
  2981. };
  2982. }
  2983. _getInheritableProperty(key, getArray = false) {
  2984. const value = (0, _core_utils.getInheritableProperty)({
  2985. dict: this.pageDict,
  2986. key,
  2987. getArray,
  2988. stopWhenFound: false
  2989. });
  2990. if (!Array.isArray(value)) {
  2991. return value;
  2992. }
  2993. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  2994. return value[0];
  2995. }
  2996. return _primitives.Dict.merge({
  2997. xref: this.xref,
  2998. dictArray: value
  2999. });
  3000. }
  3001. get content() {
  3002. return this.pageDict.getArray("Contents");
  3003. }
  3004. get resources() {
  3005. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  3006. }
  3007. _getBoundingBox(name) {
  3008. if (this.xfaData) {
  3009. return this.xfaData.bbox;
  3010. }
  3011. const box = this._getInheritableProperty(name, true);
  3012. if (Array.isArray(box) && box.length === 4) {
  3013. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3014. return box;
  3015. }
  3016. (0, _util.warn)(`Empty /${name} entry.`);
  3017. }
  3018. return null;
  3019. }
  3020. get mediaBox() {
  3021. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3022. }
  3023. get cropBox() {
  3024. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3025. }
  3026. get userUnit() {
  3027. let obj = this.pageDict.get("UserUnit");
  3028. if (typeof obj !== "number" || obj <= 0) {
  3029. obj = DEFAULT_USER_UNIT;
  3030. }
  3031. return (0, _util.shadow)(this, "userUnit", obj);
  3032. }
  3033. get view() {
  3034. const {
  3035. cropBox,
  3036. mediaBox
  3037. } = this;
  3038. let view;
  3039. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3040. view = mediaBox;
  3041. } else {
  3042. const box = _util.Util.intersect(cropBox, mediaBox);
  3043. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3044. view = box;
  3045. } else {
  3046. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3047. }
  3048. }
  3049. return (0, _util.shadow)(this, "view", view || mediaBox);
  3050. }
  3051. get rotate() {
  3052. let rotate = this._getInheritableProperty("Rotate") || 0;
  3053. if (rotate % 90 !== 0) {
  3054. rotate = 0;
  3055. } else if (rotate >= 360) {
  3056. rotate %= 360;
  3057. } else if (rotate < 0) {
  3058. rotate = (rotate % 360 + 360) % 360;
  3059. }
  3060. return (0, _util.shadow)(this, "rotate", rotate);
  3061. }
  3062. _onSubStreamError(handler, reason, objId) {
  3063. if (this.evaluatorOptions.ignoreErrors) {
  3064. handler.send("UnsupportedFeature", {
  3065. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3066. });
  3067. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3068. return;
  3069. }
  3070. throw reason;
  3071. }
  3072. getContentStream(handler) {
  3073. return this.pdfManager.ensure(this, "content").then(content => {
  3074. if (content instanceof _base_stream.BaseStream) {
  3075. return content;
  3076. }
  3077. if (Array.isArray(content)) {
  3078. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3079. }
  3080. return new _stream.NullStream();
  3081. });
  3082. }
  3083. get xfaData() {
  3084. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3085. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3086. } : null);
  3087. }
  3088. save(handler, task, annotationStorage) {
  3089. const partialEvaluator = new _evaluator.PartialEvaluator({
  3090. xref: this.xref,
  3091. handler,
  3092. pageIndex: this.pageIndex,
  3093. idFactory: this._localIdFactory,
  3094. fontCache: this.fontCache,
  3095. builtInCMapCache: this.builtInCMapCache,
  3096. standardFontDataCache: this.standardFontDataCache,
  3097. globalImageCache: this.globalImageCache,
  3098. options: this.evaluatorOptions
  3099. });
  3100. return this._parsedAnnotations.then(function (annotations) {
  3101. const newRefsPromises = [];
  3102. for (const annotation of annotations) {
  3103. if (!annotation.mustBePrinted(annotationStorage)) {
  3104. continue;
  3105. }
  3106. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3107. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3108. return null;
  3109. }));
  3110. }
  3111. return Promise.all(newRefsPromises);
  3112. });
  3113. }
  3114. loadResources(keys) {
  3115. if (!this.resourcesPromise) {
  3116. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3117. }
  3118. return this.resourcesPromise.then(() => {
  3119. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3120. return objectLoader.load();
  3121. });
  3122. }
  3123. getOperatorList({
  3124. handler,
  3125. sink,
  3126. task,
  3127. intent,
  3128. cacheKey,
  3129. annotationStorage = null
  3130. }) {
  3131. const contentStreamPromise = this.getContentStream(handler);
  3132. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3133. const partialEvaluator = new _evaluator.PartialEvaluator({
  3134. xref: this.xref,
  3135. handler,
  3136. pageIndex: this.pageIndex,
  3137. idFactory: this._localIdFactory,
  3138. fontCache: this.fontCache,
  3139. builtInCMapCache: this.builtInCMapCache,
  3140. standardFontDataCache: this.standardFontDataCache,
  3141. globalImageCache: this.globalImageCache,
  3142. options: this.evaluatorOptions
  3143. });
  3144. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3145. const pageListPromise = dataPromises.then(([contentStream]) => {
  3146. const opList = new _operator_list.OperatorList(intent, sink);
  3147. handler.send("StartRenderPage", {
  3148. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3149. pageIndex: this.pageIndex,
  3150. cacheKey
  3151. });
  3152. return partialEvaluator.getOperatorList({
  3153. stream: contentStream,
  3154. task,
  3155. resources: this.resources,
  3156. operatorList: opList
  3157. }).then(function () {
  3158. return opList;
  3159. });
  3160. });
  3161. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  3162. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3163. pageOpList.flush(true);
  3164. return {
  3165. length: pageOpList.totalLength
  3166. };
  3167. }
  3168. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3169. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3170. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3171. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3172. const opListPromises = [];
  3173. for (const annotation of annotations) {
  3174. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3175. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3176. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3177. return null;
  3178. }));
  3179. }
  3180. }
  3181. return Promise.all(opListPromises).then(function (opLists) {
  3182. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3183. for (const opList of opLists) {
  3184. pageOpList.addOpList(opList);
  3185. }
  3186. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3187. pageOpList.flush(true);
  3188. return {
  3189. length: pageOpList.totalLength
  3190. };
  3191. });
  3192. });
  3193. }
  3194. extractTextContent({
  3195. handler,
  3196. task,
  3197. includeMarkedContent,
  3198. sink,
  3199. combineTextItems
  3200. }) {
  3201. const contentStreamPromise = this.getContentStream(handler);
  3202. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3203. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3204. return dataPromises.then(([contentStream]) => {
  3205. const partialEvaluator = new _evaluator.PartialEvaluator({
  3206. xref: this.xref,
  3207. handler,
  3208. pageIndex: this.pageIndex,
  3209. idFactory: this._localIdFactory,
  3210. fontCache: this.fontCache,
  3211. builtInCMapCache: this.builtInCMapCache,
  3212. standardFontDataCache: this.standardFontDataCache,
  3213. globalImageCache: this.globalImageCache,
  3214. options: this.evaluatorOptions
  3215. });
  3216. return partialEvaluator.getTextContent({
  3217. stream: contentStream,
  3218. task,
  3219. resources: this.resources,
  3220. includeMarkedContent,
  3221. combineTextItems,
  3222. sink,
  3223. viewBox: this.view
  3224. });
  3225. });
  3226. }
  3227. async getStructTree() {
  3228. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3229. if (!structTreeRoot) {
  3230. return null;
  3231. }
  3232. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3233. return structTree.serializable;
  3234. }
  3235. _parseStructTree(structTreeRoot) {
  3236. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3237. tree.parse();
  3238. return tree;
  3239. }
  3240. getAnnotationsData(intent) {
  3241. return this._parsedAnnotations.then(function (annotations) {
  3242. const annotationsData = [];
  3243. if (annotations.length === 0) {
  3244. return annotationsData;
  3245. }
  3246. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3247. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3248. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3249. for (const annotation of annotations) {
  3250. if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
  3251. annotationsData.push(annotation.data);
  3252. }
  3253. }
  3254. return annotationsData;
  3255. });
  3256. }
  3257. get annotations() {
  3258. const annots = this._getInheritableProperty("Annots");
  3259. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3260. }
  3261. get _parsedAnnotations() {
  3262. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3263. const annotationPromises = [];
  3264. for (const annotationRef of this.annotations) {
  3265. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3266. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3267. return null;
  3268. }));
  3269. }
  3270. return Promise.all(annotationPromises).then(function (annotations) {
  3271. return annotations.filter(annotation => !!annotation);
  3272. });
  3273. });
  3274. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3275. }
  3276. get jsActions() {
  3277. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3278. return (0, _util.shadow)(this, "jsActions", actions);
  3279. }
  3280. }
  3281. exports.Page = Page;
  3282. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3283. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3284. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3285. const FINGERPRINT_FIRST_BYTES = 1024;
  3286. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3287. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3288. function find(stream, signature, limit = 1024, backwards = false) {
  3289. const signatureLength = signature.length;
  3290. const scanBytes = stream.peekBytes(limit);
  3291. const scanLength = scanBytes.length - signatureLength;
  3292. if (scanLength <= 0) {
  3293. return false;
  3294. }
  3295. if (backwards) {
  3296. const signatureEnd = signatureLength - 1;
  3297. let pos = scanBytes.length - 1;
  3298. while (pos >= signatureEnd) {
  3299. let j = 0;
  3300. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3301. j++;
  3302. }
  3303. if (j >= signatureLength) {
  3304. stream.pos += pos - signatureEnd;
  3305. return true;
  3306. }
  3307. pos--;
  3308. }
  3309. } else {
  3310. let pos = 0;
  3311. while (pos <= scanLength) {
  3312. let j = 0;
  3313. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3314. j++;
  3315. }
  3316. if (j >= signatureLength) {
  3317. stream.pos += pos;
  3318. return true;
  3319. }
  3320. pos++;
  3321. }
  3322. }
  3323. return false;
  3324. }
  3325. class PDFDocument {
  3326. constructor(pdfManager, stream) {
  3327. if (stream.length <= 0) {
  3328. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3329. }
  3330. this.pdfManager = pdfManager;
  3331. this.stream = stream;
  3332. this.xref = new _xref.XRef(stream, pdfManager);
  3333. this._pagePromises = new Map();
  3334. this._version = null;
  3335. const idCounters = {
  3336. font: 0
  3337. };
  3338. this._globalIdFactory = class {
  3339. static getDocId() {
  3340. return `g_${pdfManager.docId}`;
  3341. }
  3342. static createFontId() {
  3343. return `f${++idCounters.font}`;
  3344. }
  3345. static createObjId() {
  3346. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3347. }
  3348. static getPageObjId() {
  3349. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3350. }
  3351. };
  3352. }
  3353. parse(recoveryMode) {
  3354. this.xref.parse(recoveryMode);
  3355. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3356. if (this.catalog.version) {
  3357. this._version = this.catalog.version;
  3358. }
  3359. }
  3360. get linearization() {
  3361. let linearization = null;
  3362. try {
  3363. linearization = _parser.Linearization.create(this.stream);
  3364. } catch (err) {
  3365. if (err instanceof _core_utils.MissingDataException) {
  3366. throw err;
  3367. }
  3368. (0, _util.info)(err);
  3369. }
  3370. return (0, _util.shadow)(this, "linearization", linearization);
  3371. }
  3372. get startXRef() {
  3373. const stream = this.stream;
  3374. let startXRef = 0;
  3375. if (this.linearization) {
  3376. stream.reset();
  3377. if (find(stream, ENDOBJ_SIGNATURE)) {
  3378. startXRef = stream.pos + 6 - stream.start;
  3379. }
  3380. } else {
  3381. const step = 1024;
  3382. const startXRefLength = STARTXREF_SIGNATURE.length;
  3383. let found = false,
  3384. pos = stream.end;
  3385. while (!found && pos > 0) {
  3386. pos -= step - startXRefLength;
  3387. if (pos < 0) {
  3388. pos = 0;
  3389. }
  3390. stream.pos = pos;
  3391. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3392. }
  3393. if (found) {
  3394. stream.skip(9);
  3395. let ch;
  3396. do {
  3397. ch = stream.getByte();
  3398. } while ((0, _core_utils.isWhiteSpace)(ch));
  3399. let str = "";
  3400. while (ch >= 0x20 && ch <= 0x39) {
  3401. str += String.fromCharCode(ch);
  3402. ch = stream.getByte();
  3403. }
  3404. startXRef = parseInt(str, 10);
  3405. if (isNaN(startXRef)) {
  3406. startXRef = 0;
  3407. }
  3408. }
  3409. }
  3410. return (0, _util.shadow)(this, "startXRef", startXRef);
  3411. }
  3412. checkHeader() {
  3413. const stream = this.stream;
  3414. stream.reset();
  3415. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3416. return;
  3417. }
  3418. stream.moveStart();
  3419. const MAX_PDF_VERSION_LENGTH = 12;
  3420. let version = "",
  3421. ch;
  3422. while ((ch = stream.getByte()) > 0x20) {
  3423. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3424. break;
  3425. }
  3426. version += String.fromCharCode(ch);
  3427. }
  3428. if (!this._version) {
  3429. this._version = version.substring(5);
  3430. }
  3431. }
  3432. parseStartXRef() {
  3433. this.xref.setStartXRef(this.startXRef);
  3434. }
  3435. get numPages() {
  3436. let num = 0;
  3437. if (this.catalog.hasActualNumPages) {
  3438. num = this.catalog.numPages;
  3439. } else if (this.xfaFactory) {
  3440. num = this.xfaFactory.getNumPages();
  3441. } else if (this.linearization) {
  3442. num = this.linearization.numPages;
  3443. } else {
  3444. num = this.catalog.numPages;
  3445. }
  3446. return (0, _util.shadow)(this, "numPages", num);
  3447. }
  3448. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3449. const RECURSION_LIMIT = 10;
  3450. if (!Array.isArray(fields)) {
  3451. return false;
  3452. }
  3453. return fields.every(field => {
  3454. field = this.xref.fetchIfRef(field);
  3455. if (!(field instanceof _primitives.Dict)) {
  3456. return false;
  3457. }
  3458. if (field.has("Kids")) {
  3459. if (++recursionDepth > RECURSION_LIMIT) {
  3460. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3461. return false;
  3462. }
  3463. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3464. }
  3465. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3466. const rectangle = field.get("Rect");
  3467. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3468. return isSignature && isInvisible;
  3469. });
  3470. }
  3471. get _xfaStreams() {
  3472. const acroForm = this.catalog.acroForm;
  3473. if (!acroForm) {
  3474. return null;
  3475. }
  3476. const xfa = acroForm.get("XFA");
  3477. const entries = {
  3478. "xdp:xdp": "",
  3479. template: "",
  3480. datasets: "",
  3481. config: "",
  3482. connectionSet: "",
  3483. localeSet: "",
  3484. stylesheet: "",
  3485. "/xdp:xdp": ""
  3486. };
  3487. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3488. entries["xdp:xdp"] = xfa;
  3489. return entries;
  3490. }
  3491. if (!Array.isArray(xfa) || xfa.length === 0) {
  3492. return null;
  3493. }
  3494. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3495. let name;
  3496. if (i === 0) {
  3497. name = "xdp:xdp";
  3498. } else if (i === ii - 2) {
  3499. name = "/xdp:xdp";
  3500. } else {
  3501. name = xfa[i];
  3502. }
  3503. if (!entries.hasOwnProperty(name)) {
  3504. continue;
  3505. }
  3506. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3507. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3508. continue;
  3509. }
  3510. entries[name] = data;
  3511. }
  3512. return entries;
  3513. }
  3514. get xfaDatasets() {
  3515. const streams = this._xfaStreams;
  3516. if (!streams) {
  3517. return (0, _util.shadow)(this, "xfaDatasets", null);
  3518. }
  3519. for (const key of ["datasets", "xdp:xdp"]) {
  3520. const stream = streams[key];
  3521. if (!stream) {
  3522. continue;
  3523. }
  3524. try {
  3525. const str = (0, _util.stringToUTF8String)(stream.getString());
  3526. const data = {
  3527. [key]: str
  3528. };
  3529. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3530. } catch (_) {
  3531. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3532. break;
  3533. }
  3534. }
  3535. return (0, _util.shadow)(this, "xfaDatasets", null);
  3536. }
  3537. get xfaData() {
  3538. const streams = this._xfaStreams;
  3539. if (!streams) {
  3540. return null;
  3541. }
  3542. const data = Object.create(null);
  3543. for (const [key, stream] of Object.entries(streams)) {
  3544. if (!stream) {
  3545. continue;
  3546. }
  3547. try {
  3548. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3549. } catch (_) {
  3550. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3551. return null;
  3552. }
  3553. }
  3554. return data;
  3555. }
  3556. get xfaFactory() {
  3557. let data;
  3558. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3559. data = this.xfaData;
  3560. }
  3561. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3562. }
  3563. get isPureXfa() {
  3564. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3565. }
  3566. get htmlForXfa() {
  3567. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3568. }
  3569. async loadXfaImages() {
  3570. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3571. if (!xfaImagesDict) {
  3572. return;
  3573. }
  3574. const keys = xfaImagesDict.getKeys();
  3575. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3576. await objectLoader.load();
  3577. const xfaImages = new Map();
  3578. for (const key of keys) {
  3579. const stream = xfaImagesDict.get(key);
  3580. if (stream instanceof _base_stream.BaseStream) {
  3581. xfaImages.set(key, stream.getBytes());
  3582. }
  3583. }
  3584. this.xfaFactory.setImages(xfaImages);
  3585. }
  3586. async loadXfaFonts(handler, task) {
  3587. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3588. if (!acroForm) {
  3589. return;
  3590. }
  3591. const resources = await acroForm.getAsync("DR");
  3592. if (!(resources instanceof _primitives.Dict)) {
  3593. return;
  3594. }
  3595. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3596. await objectLoader.load();
  3597. const fontRes = resources.get("Font");
  3598. if (!(fontRes instanceof _primitives.Dict)) {
  3599. return;
  3600. }
  3601. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3602. options.useSystemFonts = false;
  3603. const partialEvaluator = new _evaluator.PartialEvaluator({
  3604. xref: this.xref,
  3605. handler,
  3606. pageIndex: -1,
  3607. idFactory: this._globalIdFactory,
  3608. fontCache: this.catalog.fontCache,
  3609. builtInCMapCache: this.catalog.builtInCMapCache,
  3610. standardFontDataCache: this.catalog.standardFontDataCache,
  3611. options
  3612. });
  3613. const operatorList = new _operator_list.OperatorList();
  3614. const pdfFonts = [];
  3615. const initialState = {
  3616. get font() {
  3617. return pdfFonts[pdfFonts.length - 1];
  3618. },
  3619. set font(font) {
  3620. pdfFonts.push(font);
  3621. },
  3622. clone() {
  3623. return this;
  3624. }
  3625. };
  3626. const fonts = new Map();
  3627. fontRes.forEach((fontName, font) => {
  3628. fonts.set(fontName, font);
  3629. });
  3630. const promises = [];
  3631. for (const [fontName, font] of fonts) {
  3632. const descriptor = font.get("FontDescriptor");
  3633. if (!(descriptor instanceof _primitives.Dict)) {
  3634. continue;
  3635. }
  3636. let fontFamily = descriptor.get("FontFamily");
  3637. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3638. const fontWeight = descriptor.get("FontWeight");
  3639. const italicAngle = -descriptor.get("ItalicAngle");
  3640. const cssFontInfo = {
  3641. fontFamily,
  3642. fontWeight,
  3643. italicAngle
  3644. };
  3645. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3646. continue;
  3647. }
  3648. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3649. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3650. return null;
  3651. }));
  3652. }
  3653. await Promise.all(promises);
  3654. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3655. if (!missingFonts) {
  3656. return;
  3657. }
  3658. options.ignoreErrors = true;
  3659. promises.length = 0;
  3660. pdfFonts.length = 0;
  3661. const reallyMissingFonts = new Set();
  3662. for (const missing of missingFonts) {
  3663. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3664. reallyMissingFonts.add(missing);
  3665. }
  3666. }
  3667. if (reallyMissingFonts.size) {
  3668. missingFonts.push("PdfJS-Fallback");
  3669. }
  3670. for (const missing of missingFonts) {
  3671. if (reallyMissingFonts.has(missing)) {
  3672. continue;
  3673. }
  3674. for (const fontInfo of [{
  3675. name: "Regular",
  3676. fontWeight: 400,
  3677. italicAngle: 0
  3678. }, {
  3679. name: "Bold",
  3680. fontWeight: 700,
  3681. italicAngle: 0
  3682. }, {
  3683. name: "Italic",
  3684. fontWeight: 400,
  3685. italicAngle: 12
  3686. }, {
  3687. name: "BoldItalic",
  3688. fontWeight: 700,
  3689. italicAngle: 12
  3690. }]) {
  3691. const name = `${missing}-${fontInfo.name}`;
  3692. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3693. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3694. fontFamily: missing,
  3695. fontWeight: fontInfo.fontWeight,
  3696. italicAngle: fontInfo.italicAngle
  3697. }).catch(function (reason) {
  3698. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3699. return null;
  3700. }));
  3701. }
  3702. }
  3703. await Promise.all(promises);
  3704. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3705. }
  3706. async serializeXfaData(annotationStorage) {
  3707. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3708. }
  3709. get formInfo() {
  3710. const formInfo = {
  3711. hasFields: false,
  3712. hasAcroForm: false,
  3713. hasXfa: false,
  3714. hasSignatures: false
  3715. };
  3716. const acroForm = this.catalog.acroForm;
  3717. if (!acroForm) {
  3718. return (0, _util.shadow)(this, "formInfo", formInfo);
  3719. }
  3720. try {
  3721. const fields = acroForm.get("Fields");
  3722. const hasFields = Array.isArray(fields) && fields.length > 0;
  3723. formInfo.hasFields = hasFields;
  3724. const xfa = acroForm.get("XFA");
  3725. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3726. const sigFlags = acroForm.get("SigFlags");
  3727. const hasSignatures = !!(sigFlags & 0x1);
  3728. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3729. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3730. formInfo.hasSignatures = hasSignatures;
  3731. } catch (ex) {
  3732. if (ex instanceof _core_utils.MissingDataException) {
  3733. throw ex;
  3734. }
  3735. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3736. }
  3737. return (0, _util.shadow)(this, "formInfo", formInfo);
  3738. }
  3739. get documentInfo() {
  3740. let version = this._version;
  3741. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3742. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3743. version = null;
  3744. }
  3745. const docInfo = {
  3746. PDFFormatVersion: version,
  3747. Language: this.catalog.lang,
  3748. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3749. IsLinearized: !!this.linearization,
  3750. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3751. IsXFAPresent: this.formInfo.hasXfa,
  3752. IsCollectionPresent: !!this.catalog.collection,
  3753. IsSignaturesPresent: this.formInfo.hasSignatures
  3754. };
  3755. let infoDict;
  3756. try {
  3757. infoDict = this.xref.trailer.get("Info");
  3758. } catch (err) {
  3759. if (err instanceof _core_utils.MissingDataException) {
  3760. throw err;
  3761. }
  3762. (0, _util.info)("The document information dictionary is invalid.");
  3763. }
  3764. if (!(infoDict instanceof _primitives.Dict)) {
  3765. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3766. }
  3767. for (const key of infoDict.getKeys()) {
  3768. const value = infoDict.get(key);
  3769. switch (key) {
  3770. case "Title":
  3771. case "Author":
  3772. case "Subject":
  3773. case "Keywords":
  3774. case "Creator":
  3775. case "Producer":
  3776. case "CreationDate":
  3777. case "ModDate":
  3778. if (typeof value === "string") {
  3779. docInfo[key] = (0, _util.stringToPDFString)(value);
  3780. continue;
  3781. }
  3782. break;
  3783. case "Trapped":
  3784. if (value instanceof _primitives.Name) {
  3785. docInfo[key] = value;
  3786. continue;
  3787. }
  3788. break;
  3789. default:
  3790. let customValue;
  3791. switch (typeof value) {
  3792. case "string":
  3793. customValue = (0, _util.stringToPDFString)(value);
  3794. break;
  3795. case "number":
  3796. case "boolean":
  3797. customValue = value;
  3798. break;
  3799. default:
  3800. if (value instanceof _primitives.Name) {
  3801. customValue = value;
  3802. }
  3803. break;
  3804. }
  3805. if (customValue === undefined) {
  3806. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3807. continue;
  3808. }
  3809. if (!docInfo.Custom) {
  3810. docInfo.Custom = Object.create(null);
  3811. }
  3812. docInfo.Custom[key] = customValue;
  3813. continue;
  3814. }
  3815. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3816. }
  3817. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3818. }
  3819. get fingerprints() {
  3820. function validate(data) {
  3821. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3822. }
  3823. function hexString(hash) {
  3824. const buf = [];
  3825. for (let i = 0, ii = hash.length; i < ii; i++) {
  3826. const hex = hash[i].toString(16);
  3827. buf.push(hex.padStart(2, "0"));
  3828. }
  3829. return buf.join("");
  3830. }
  3831. const idArray = this.xref.trailer.get("ID");
  3832. let hashOriginal, hashModified;
  3833. if (Array.isArray(idArray) && validate(idArray[0])) {
  3834. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3835. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3836. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3837. }
  3838. } else {
  3839. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3840. }
  3841. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3842. }
  3843. async _getLinearizationPage(pageIndex) {
  3844. const {
  3845. catalog,
  3846. linearization,
  3847. xref
  3848. } = this;
  3849. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3850. try {
  3851. const obj = await xref.fetchAsync(ref);
  3852. if (obj instanceof _primitives.Dict) {
  3853. let type = obj.getRaw("Type");
  3854. if (type instanceof _primitives.Ref) {
  3855. type = await xref.fetchAsync(type);
  3856. }
  3857. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  3858. if (!catalog.pageKidsCountCache.has(ref)) {
  3859. catalog.pageKidsCountCache.put(ref, 1);
  3860. }
  3861. if (!catalog.pageIndexCache.has(ref)) {
  3862. catalog.pageIndexCache.put(ref, 0);
  3863. }
  3864. return [obj, ref];
  3865. }
  3866. }
  3867. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  3868. } catch (reason) {
  3869. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  3870. return catalog.getPageDict(pageIndex);
  3871. }
  3872. }
  3873. getPage(pageIndex) {
  3874. const cachedPromise = this._pagePromises.get(pageIndex);
  3875. if (cachedPromise) {
  3876. return cachedPromise;
  3877. }
  3878. const {
  3879. catalog,
  3880. linearization,
  3881. xfaFactory
  3882. } = this;
  3883. let promise;
  3884. if (xfaFactory) {
  3885. promise = Promise.resolve([_primitives.Dict.empty, null]);
  3886. } else if (linearization && linearization.pageFirst === pageIndex) {
  3887. promise = this._getLinearizationPage(pageIndex);
  3888. } else {
  3889. promise = catalog.getPageDict(pageIndex);
  3890. }
  3891. promise = promise.then(([pageDict, ref]) => {
  3892. return new Page({
  3893. pdfManager: this.pdfManager,
  3894. xref: this.xref,
  3895. pageIndex,
  3896. pageDict,
  3897. ref,
  3898. globalIdFactory: this._globalIdFactory,
  3899. fontCache: catalog.fontCache,
  3900. builtInCMapCache: catalog.builtInCMapCache,
  3901. standardFontDataCache: catalog.standardFontDataCache,
  3902. globalImageCache: catalog.globalImageCache,
  3903. nonBlendModesSet: catalog.nonBlendModesSet,
  3904. xfaFactory
  3905. });
  3906. });
  3907. this._pagePromises.set(pageIndex, promise);
  3908. return promise;
  3909. }
  3910. async checkFirstPage(recoveryMode = false) {
  3911. if (recoveryMode) {
  3912. return;
  3913. }
  3914. try {
  3915. await this.getPage(0);
  3916. } catch (reason) {
  3917. if (reason instanceof _core_utils.XRefEntryException) {
  3918. this._pagePromises.delete(0);
  3919. await this.cleanup();
  3920. throw new _core_utils.XRefParseException();
  3921. }
  3922. }
  3923. }
  3924. async checkLastPage(recoveryMode = false) {
  3925. const {
  3926. catalog,
  3927. pdfManager
  3928. } = this;
  3929. catalog.setActualNumPages();
  3930. let numPages;
  3931. try {
  3932. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  3933. if (this.xfaFactory) {
  3934. return;
  3935. } else if (this.linearization) {
  3936. numPages = this.linearization.numPages;
  3937. } else {
  3938. numPages = catalog.numPages;
  3939. }
  3940. if (!Number.isInteger(numPages)) {
  3941. throw new _util.FormatError("Page count is not an integer.");
  3942. } else if (numPages <= 1) {
  3943. return;
  3944. }
  3945. await this.getPage(numPages - 1);
  3946. } catch (reason) {
  3947. this._pagePromises.delete(numPages - 1);
  3948. await this.cleanup();
  3949. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3950. throw new _core_utils.XRefParseException();
  3951. }
  3952. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  3953. let pagesTree;
  3954. try {
  3955. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  3956. } catch (reasonAll) {
  3957. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3958. throw new _core_utils.XRefParseException();
  3959. }
  3960. catalog.setActualNumPages(1);
  3961. return;
  3962. }
  3963. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  3964. let promise;
  3965. if (pageDict instanceof Error) {
  3966. promise = Promise.reject(pageDict);
  3967. promise.catch(() => {});
  3968. } else {
  3969. promise = Promise.resolve(new Page({
  3970. pdfManager,
  3971. xref: this.xref,
  3972. pageIndex,
  3973. pageDict,
  3974. ref,
  3975. globalIdFactory: this._globalIdFactory,
  3976. fontCache: catalog.fontCache,
  3977. builtInCMapCache: catalog.builtInCMapCache,
  3978. standardFontDataCache: catalog.standardFontDataCache,
  3979. globalImageCache: catalog.globalImageCache,
  3980. nonBlendModesSet: catalog.nonBlendModesSet,
  3981. xfaFactory: null
  3982. }));
  3983. }
  3984. this._pagePromises.set(pageIndex, promise);
  3985. }
  3986. catalog.setActualNumPages(pagesTree.size);
  3987. }
  3988. }
  3989. fontFallback(id, handler) {
  3990. return this.catalog.fontFallback(id, handler);
  3991. }
  3992. async cleanup(manuallyTriggered = false) {
  3993. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  3994. }
  3995. _collectFieldObjects(name, fieldRef, promises) {
  3996. const field = this.xref.fetchIfRef(fieldRef);
  3997. if (field.has("T")) {
  3998. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3999. if (name === "") {
  4000. name = partName;
  4001. } else {
  4002. name = `${name}.${partName}`;
  4003. }
  4004. }
  4005. if (!promises.has(name)) {
  4006. promises.set(name, []);
  4007. }
  4008. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4009. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4010. return null;
  4011. }));
  4012. if (field.has("Kids")) {
  4013. const kids = field.get("Kids");
  4014. for (const kid of kids) {
  4015. this._collectFieldObjects(name, kid, promises);
  4016. }
  4017. }
  4018. }
  4019. get fieldObjects() {
  4020. if (!this.formInfo.hasFields) {
  4021. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4022. }
  4023. const allFields = Object.create(null);
  4024. const fieldPromises = new Map();
  4025. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4026. this._collectFieldObjects("", fieldRef, fieldPromises);
  4027. }
  4028. const allPromises = [];
  4029. for (const [name, promises] of fieldPromises) {
  4030. allPromises.push(Promise.all(promises).then(fields => {
  4031. fields = fields.filter(field => !!field);
  4032. if (fields.length > 0) {
  4033. allFields[name] = fields;
  4034. }
  4035. }));
  4036. }
  4037. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4038. }
  4039. get hasJSActions() {
  4040. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4041. return (0, _util.shadow)(this, "hasJSActions", promise);
  4042. }
  4043. async _parseHasJSActions() {
  4044. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4045. if (catalogJsActions) {
  4046. return true;
  4047. }
  4048. if (fieldObjects) {
  4049. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4050. }
  4051. return false;
  4052. }
  4053. get calculationOrderIds() {
  4054. const acroForm = this.catalog.acroForm;
  4055. if (!acroForm || !acroForm.has("CO")) {
  4056. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4057. }
  4058. const calculationOrder = acroForm.get("CO");
  4059. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4060. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4061. }
  4062. const ids = [];
  4063. for (const id of calculationOrder) {
  4064. if (id instanceof _primitives.Ref) {
  4065. ids.push(id.toString());
  4066. }
  4067. }
  4068. if (ids.length === 0) {
  4069. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4070. }
  4071. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4072. }
  4073. }
  4074. exports.PDFDocument = PDFDocument;
  4075. /***/ }),
  4076. /* 12 */
  4077. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4078. Object.defineProperty(exports, "__esModule", ({
  4079. value: true
  4080. }));
  4081. exports.getXfaFontDict = getXfaFontDict;
  4082. exports.getXfaFontName = getXfaFontName;
  4083. var _calibri_factors = __w_pdfjs_require__(13);
  4084. var _primitives = __w_pdfjs_require__(5);
  4085. var _helvetica_factors = __w_pdfjs_require__(14);
  4086. var _liberationsans_widths = __w_pdfjs_require__(15);
  4087. var _myriadpro_factors = __w_pdfjs_require__(16);
  4088. var _segoeui_factors = __w_pdfjs_require__(17);
  4089. var _core_utils = __w_pdfjs_require__(8);
  4090. var _fonts_utils = __w_pdfjs_require__(18);
  4091. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  4092. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  4093. name: "LiberationSans-Regular",
  4094. factors: _myriadpro_factors.MyriadProRegularFactors,
  4095. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4096. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4097. metrics: _myriadpro_factors.MyriadProRegularMetrics
  4098. };
  4099. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  4100. name: "LiberationSans-Bold",
  4101. factors: _myriadpro_factors.MyriadProBoldFactors,
  4102. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4103. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4104. metrics: _myriadpro_factors.MyriadProBoldMetrics
  4105. };
  4106. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  4107. name: "LiberationSans-Italic",
  4108. factors: _myriadpro_factors.MyriadProItalicFactors,
  4109. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4110. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4111. metrics: _myriadpro_factors.MyriadProItalicMetrics
  4112. };
  4113. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  4114. name: "LiberationSans-BoldItalic",
  4115. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  4116. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4117. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4118. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  4119. };
  4120. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  4121. name: "LiberationSans-Regular",
  4122. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4123. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  4124. };
  4125. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  4126. name: "LiberationSans-Bold",
  4127. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4128. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  4129. };
  4130. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  4131. name: "LiberationSans-Italic",
  4132. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4133. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  4134. };
  4135. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  4136. name: "LiberationSans-BoldItalic",
  4137. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4138. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  4139. };
  4140. t["Calibri-Regular"] = {
  4141. name: "LiberationSans-Regular",
  4142. factors: _calibri_factors.CalibriRegularFactors,
  4143. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4144. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4145. metrics: _calibri_factors.CalibriRegularMetrics
  4146. };
  4147. t["Calibri-Bold"] = {
  4148. name: "LiberationSans-Bold",
  4149. factors: _calibri_factors.CalibriBoldFactors,
  4150. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4151. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4152. metrics: _calibri_factors.CalibriBoldMetrics
  4153. };
  4154. t["Calibri-Italic"] = {
  4155. name: "LiberationSans-Italic",
  4156. factors: _calibri_factors.CalibriItalicFactors,
  4157. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4158. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4159. metrics: _calibri_factors.CalibriItalicMetrics
  4160. };
  4161. t["Calibri-BoldItalic"] = {
  4162. name: "LiberationSans-BoldItalic",
  4163. factors: _calibri_factors.CalibriBoldItalicFactors,
  4164. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4165. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4166. metrics: _calibri_factors.CalibriBoldItalicMetrics
  4167. };
  4168. t["Segoeui-Regular"] = {
  4169. name: "LiberationSans-Regular",
  4170. factors: _segoeui_factors.SegoeuiRegularFactors,
  4171. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4172. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4173. metrics: _segoeui_factors.SegoeuiRegularMetrics
  4174. };
  4175. t["Segoeui-Bold"] = {
  4176. name: "LiberationSans-Bold",
  4177. factors: _segoeui_factors.SegoeuiBoldFactors,
  4178. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4179. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4180. metrics: _segoeui_factors.SegoeuiBoldMetrics
  4181. };
  4182. t["Segoeui-Italic"] = {
  4183. name: "LiberationSans-Italic",
  4184. factors: _segoeui_factors.SegoeuiItalicFactors,
  4185. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4186. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4187. metrics: _segoeui_factors.SegoeuiItalicMetrics
  4188. };
  4189. t["Segoeui-BoldItalic"] = {
  4190. name: "LiberationSans-BoldItalic",
  4191. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  4192. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4193. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4194. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  4195. };
  4196. t["Helvetica-Regular"] = t.Helvetica = {
  4197. name: "LiberationSans-Regular",
  4198. factors: _helvetica_factors.HelveticaRegularFactors,
  4199. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4200. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4201. metrics: _helvetica_factors.HelveticaRegularMetrics
  4202. };
  4203. t["Helvetica-Bold"] = {
  4204. name: "LiberationSans-Bold",
  4205. factors: _helvetica_factors.HelveticaBoldFactors,
  4206. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4207. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4208. metrics: _helvetica_factors.HelveticaBoldMetrics
  4209. };
  4210. t["Helvetica-Italic"] = {
  4211. name: "LiberationSans-Italic",
  4212. factors: _helvetica_factors.HelveticaItalicFactors,
  4213. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4214. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4215. metrics: _helvetica_factors.HelveticaItalicMetrics
  4216. };
  4217. t["Helvetica-BoldItalic"] = {
  4218. name: "LiberationSans-BoldItalic",
  4219. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  4220. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4221. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4222. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  4223. };
  4224. });
  4225. function getXfaFontName(name) {
  4226. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  4227. const fontMap = getXFAFontMap();
  4228. return fontMap[fontName];
  4229. }
  4230. function getXfaFontWidths(name) {
  4231. const info = getXfaFontName(name);
  4232. if (!info) {
  4233. return null;
  4234. }
  4235. const {
  4236. baseWidths,
  4237. baseMapping,
  4238. factors
  4239. } = info;
  4240. let rescaledBaseWidths;
  4241. if (!factors) {
  4242. rescaledBaseWidths = baseWidths;
  4243. } else {
  4244. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  4245. }
  4246. let currentCode = -2;
  4247. let currentArray;
  4248. const newWidths = [];
  4249. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  4250. if (unicode === -1) {
  4251. continue;
  4252. }
  4253. if (unicode === currentCode + 1) {
  4254. currentArray.push(rescaledBaseWidths[glyphIndex]);
  4255. currentCode += 1;
  4256. } else {
  4257. currentCode = unicode;
  4258. currentArray = [rescaledBaseWidths[glyphIndex]];
  4259. newWidths.push(unicode, currentArray);
  4260. }
  4261. }
  4262. return newWidths;
  4263. }
  4264. function getXfaFontDict(name) {
  4265. const widths = getXfaFontWidths(name);
  4266. const dict = new _primitives.Dict(null);
  4267. dict.set("BaseFont", _primitives.Name.get(name));
  4268. dict.set("Type", _primitives.Name.get("Font"));
  4269. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  4270. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  4271. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  4272. dict.set("W", widths);
  4273. dict.set("FirstChar", widths[0]);
  4274. dict.set("LastChar", widths[widths.length - 2] + widths[widths.length - 1].length - 1);
  4275. const descriptor = new _primitives.Dict(null);
  4276. dict.set("FontDescriptor", descriptor);
  4277. const systemInfo = new _primitives.Dict(null);
  4278. systemInfo.set("Ordering", "Identity");
  4279. systemInfo.set("Registry", "Adobe");
  4280. systemInfo.set("Supplement", 0);
  4281. dict.set("CIDSystemInfo", systemInfo);
  4282. return dict;
  4283. }
  4284. /***/ }),
  4285. /* 13 */
  4286. /***/ ((__unused_webpack_module, exports) => {
  4287. Object.defineProperty(exports, "__esModule", ({
  4288. value: true
  4289. }));
  4290. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  4291. 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];
  4292. exports.CalibriBoldFactors = CalibriBoldFactors;
  4293. const CalibriBoldMetrics = {
  4294. lineHeight: 1.2207,
  4295. lineGap: 0.2207
  4296. };
  4297. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  4298. 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];
  4299. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  4300. const CalibriBoldItalicMetrics = {
  4301. lineHeight: 1.2207,
  4302. lineGap: 0.2207
  4303. };
  4304. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  4305. 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];
  4306. exports.CalibriItalicFactors = CalibriItalicFactors;
  4307. const CalibriItalicMetrics = {
  4308. lineHeight: 1.2207,
  4309. lineGap: 0.2207
  4310. };
  4311. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  4312. 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];
  4313. exports.CalibriRegularFactors = CalibriRegularFactors;
  4314. const CalibriRegularMetrics = {
  4315. lineHeight: 1.2207,
  4316. lineGap: 0.2207
  4317. };
  4318. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  4319. /***/ }),
  4320. /* 14 */
  4321. /***/ ((__unused_webpack_module, exports) => {
  4322. Object.defineProperty(exports, "__esModule", ({
  4323. value: true
  4324. }));
  4325. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  4326. 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];
  4327. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  4328. const HelveticaBoldMetrics = {
  4329. lineHeight: 1.2,
  4330. lineGap: 0.2
  4331. };
  4332. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  4333. 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];
  4334. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  4335. const HelveticaBoldItalicMetrics = {
  4336. lineHeight: 1.35,
  4337. lineGap: 0.2
  4338. };
  4339. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  4340. 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];
  4341. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  4342. const HelveticaItalicMetrics = {
  4343. lineHeight: 1.35,
  4344. lineGap: 0.2
  4345. };
  4346. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  4347. 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];
  4348. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  4349. const HelveticaRegularMetrics = {
  4350. lineHeight: 1.2,
  4351. lineGap: 0.2
  4352. };
  4353. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  4354. /***/ }),
  4355. /* 15 */
  4356. /***/ ((__unused_webpack_module, exports) => {
  4357. Object.defineProperty(exports, "__esModule", ({
  4358. value: true
  4359. }));
  4360. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  4361. 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];
  4362. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  4363. 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];
  4364. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  4365. 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];
  4366. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  4367. 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];
  4368. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  4369. 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];
  4370. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  4371. 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];
  4372. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  4373. 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];
  4374. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  4375. 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];
  4376. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  4377. /***/ }),
  4378. /* 16 */
  4379. /***/ ((__unused_webpack_module, exports) => {
  4380. Object.defineProperty(exports, "__esModule", ({
  4381. value: true
  4382. }));
  4383. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  4384. 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];
  4385. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  4386. const MyriadProBoldMetrics = {
  4387. lineHeight: 1.2,
  4388. lineGap: 0.2
  4389. };
  4390. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  4391. 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];
  4392. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  4393. const MyriadProBoldItalicMetrics = {
  4394. lineHeight: 1.2,
  4395. lineGap: 0.2
  4396. };
  4397. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  4398. 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];
  4399. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  4400. const MyriadProItalicMetrics = {
  4401. lineHeight: 1.2,
  4402. lineGap: 0.2
  4403. };
  4404. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  4405. 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];
  4406. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  4407. const MyriadProRegularMetrics = {
  4408. lineHeight: 1.2,
  4409. lineGap: 0.2
  4410. };
  4411. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  4412. /***/ }),
  4413. /* 17 */
  4414. /***/ ((__unused_webpack_module, exports) => {
  4415. Object.defineProperty(exports, "__esModule", ({
  4416. value: true
  4417. }));
  4418. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  4419. 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];
  4420. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  4421. const SegoeuiBoldMetrics = {
  4422. lineHeight: 1.33008,
  4423. lineGap: 0
  4424. };
  4425. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  4426. 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];
  4427. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  4428. const SegoeuiBoldItalicMetrics = {
  4429. lineHeight: 1.33008,
  4430. lineGap: 0
  4431. };
  4432. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  4433. 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];
  4434. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  4435. const SegoeuiItalicMetrics = {
  4436. lineHeight: 1.33008,
  4437. lineGap: 0
  4438. };
  4439. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  4440. 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];
  4441. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  4442. const SegoeuiRegularMetrics = {
  4443. lineHeight: 1.33008,
  4444. lineGap: 0
  4445. };
  4446. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  4447. /***/ }),
  4448. /* 18 */
  4449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4450. Object.defineProperty(exports, "__esModule", ({
  4451. value: true
  4452. }));
  4453. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  4454. exports.getFontType = getFontType;
  4455. exports.normalizeFontName = normalizeFontName;
  4456. exports.recoverGlyphName = recoverGlyphName;
  4457. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  4458. var _util = __w_pdfjs_require__(2);
  4459. var _encodings = __w_pdfjs_require__(19);
  4460. var _glyphlist = __w_pdfjs_require__(20);
  4461. var _unicode = __w_pdfjs_require__(21);
  4462. const SEAC_ANALYSIS_ENABLED = true;
  4463. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  4464. const FontFlags = {
  4465. FixedPitch: 1,
  4466. Serif: 2,
  4467. Symbolic: 4,
  4468. Script: 8,
  4469. Nonsymbolic: 32,
  4470. Italic: 64,
  4471. AllCap: 65536,
  4472. SmallCap: 131072,
  4473. ForceBold: 262144
  4474. };
  4475. exports.FontFlags = FontFlags;
  4476. 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"];
  4477. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  4478. function getFontType(type, subtype, isStandardFont = false) {
  4479. switch (type) {
  4480. case "Type1":
  4481. if (isStandardFont) {
  4482. return _util.FontType.TYPE1STANDARD;
  4483. }
  4484. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  4485. case "CIDFontType0":
  4486. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  4487. case "OpenType":
  4488. return _util.FontType.OPENTYPE;
  4489. case "TrueType":
  4490. return _util.FontType.TRUETYPE;
  4491. case "CIDFontType2":
  4492. return _util.FontType.CIDFONTTYPE2;
  4493. case "MMType1":
  4494. return _util.FontType.MMTYPE1;
  4495. case "Type0":
  4496. return _util.FontType.TYPE0;
  4497. default:
  4498. return _util.FontType.UNKNOWN;
  4499. }
  4500. }
  4501. function recoverGlyphName(name, glyphsUnicodeMap) {
  4502. if (glyphsUnicodeMap[name] !== undefined) {
  4503. return name;
  4504. }
  4505. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  4506. if (unicode !== -1) {
  4507. for (const key in glyphsUnicodeMap) {
  4508. if (glyphsUnicodeMap[key] === unicode) {
  4509. return key;
  4510. }
  4511. }
  4512. }
  4513. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  4514. return name;
  4515. }
  4516. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  4517. const charCodeToGlyphId = Object.create(null);
  4518. let glyphId, charCode, baseEncoding;
  4519. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  4520. if (properties.isInternalFont) {
  4521. baseEncoding = builtInEncoding;
  4522. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4523. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4524. if (glyphId >= 0) {
  4525. charCodeToGlyphId[charCode] = glyphId;
  4526. } else {
  4527. charCodeToGlyphId[charCode] = 0;
  4528. }
  4529. }
  4530. } else if (properties.baseEncodingName) {
  4531. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  4532. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4533. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4534. if (glyphId >= 0) {
  4535. charCodeToGlyphId[charCode] = glyphId;
  4536. } else {
  4537. charCodeToGlyphId[charCode] = 0;
  4538. }
  4539. }
  4540. } else if (isSymbolicFont) {
  4541. for (charCode in builtInEncoding) {
  4542. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  4543. }
  4544. } else {
  4545. baseEncoding = _encodings.StandardEncoding;
  4546. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4547. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4548. if (glyphId >= 0) {
  4549. charCodeToGlyphId[charCode] = glyphId;
  4550. } else {
  4551. charCodeToGlyphId[charCode] = 0;
  4552. }
  4553. }
  4554. }
  4555. const differences = properties.differences;
  4556. let glyphsUnicodeMap;
  4557. if (differences) {
  4558. for (charCode in differences) {
  4559. const glyphName = differences[charCode];
  4560. glyphId = glyphNames.indexOf(glyphName);
  4561. if (glyphId === -1) {
  4562. if (!glyphsUnicodeMap) {
  4563. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  4564. }
  4565. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  4566. if (standardGlyphName !== glyphName) {
  4567. glyphId = glyphNames.indexOf(standardGlyphName);
  4568. }
  4569. }
  4570. if (glyphId >= 0) {
  4571. charCodeToGlyphId[charCode] = glyphId;
  4572. } else {
  4573. charCodeToGlyphId[charCode] = 0;
  4574. }
  4575. }
  4576. }
  4577. return charCodeToGlyphId;
  4578. }
  4579. function normalizeFontName(name) {
  4580. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  4581. }
  4582. /***/ }),
  4583. /* 19 */
  4584. /***/ ((__unused_webpack_module, exports) => {
  4585. Object.defineProperty(exports, "__esModule", ({
  4586. value: true
  4587. }));
  4588. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  4589. exports.getEncoding = getEncoding;
  4590. 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"];
  4591. exports.ExpertEncoding = ExpertEncoding;
  4592. 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", "", "", "", ""];
  4593. 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"];
  4594. exports.MacRomanEncoding = MacRomanEncoding;
  4595. 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", "", "", "", ""];
  4596. exports.StandardEncoding = StandardEncoding;
  4597. 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"];
  4598. exports.WinAnsiEncoding = WinAnsiEncoding;
  4599. 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", ""];
  4600. exports.SymbolSetEncoding = SymbolSetEncoding;
  4601. 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", ""];
  4602. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4603. function getEncoding(encodingName) {
  4604. switch (encodingName) {
  4605. case "WinAnsiEncoding":
  4606. return WinAnsiEncoding;
  4607. case "StandardEncoding":
  4608. return StandardEncoding;
  4609. case "MacRomanEncoding":
  4610. return MacRomanEncoding;
  4611. case "SymbolSetEncoding":
  4612. return SymbolSetEncoding;
  4613. case "ZapfDingbatsEncoding":
  4614. return ZapfDingbatsEncoding;
  4615. case "ExpertEncoding":
  4616. return ExpertEncoding;
  4617. case "MacExpertEncoding":
  4618. return MacExpertEncoding;
  4619. default:
  4620. return null;
  4621. }
  4622. }
  4623. /***/ }),
  4624. /* 20 */
  4625. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  4626. __w_pdfjs_require__.r(__webpack_exports__);
  4627. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  4628. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  4629. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  4630. /* harmony export */ });
  4631. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  4632. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  4633. return [
  4634. "A",
  4635. 0x0041,
  4636. "AE",
  4637. 0x00c6,
  4638. "AEacute",
  4639. 0x01fc,
  4640. "AEmacron",
  4641. 0x01e2,
  4642. "AEsmall",
  4643. 0xf7e6,
  4644. "Aacute",
  4645. 0x00c1,
  4646. "Aacutesmall",
  4647. 0xf7e1,
  4648. "Abreve",
  4649. 0x0102,
  4650. "Abreveacute",
  4651. 0x1eae,
  4652. "Abrevecyrillic",
  4653. 0x04d0,
  4654. "Abrevedotbelow",
  4655. 0x1eb6,
  4656. "Abrevegrave",
  4657. 0x1eb0,
  4658. "Abrevehookabove",
  4659. 0x1eb2,
  4660. "Abrevetilde",
  4661. 0x1eb4,
  4662. "Acaron",
  4663. 0x01cd,
  4664. "Acircle",
  4665. 0x24b6,
  4666. "Acircumflex",
  4667. 0x00c2,
  4668. "Acircumflexacute",
  4669. 0x1ea4,
  4670. "Acircumflexdotbelow",
  4671. 0x1eac,
  4672. "Acircumflexgrave",
  4673. 0x1ea6,
  4674. "Acircumflexhookabove",
  4675. 0x1ea8,
  4676. "Acircumflexsmall",
  4677. 0xf7e2,
  4678. "Acircumflextilde",
  4679. 0x1eaa,
  4680. "Acute",
  4681. 0xf6c9,
  4682. "Acutesmall",
  4683. 0xf7b4,
  4684. "Acyrillic",
  4685. 0x0410,
  4686. "Adblgrave",
  4687. 0x0200,
  4688. "Adieresis",
  4689. 0x00c4,
  4690. "Adieresiscyrillic",
  4691. 0x04d2,
  4692. "Adieresismacron",
  4693. 0x01de,
  4694. "Adieresissmall",
  4695. 0xf7e4,
  4696. "Adotbelow",
  4697. 0x1ea0,
  4698. "Adotmacron",
  4699. 0x01e0,
  4700. "Agrave",
  4701. 0x00c0,
  4702. "Agravesmall",
  4703. 0xf7e0,
  4704. "Ahookabove",
  4705. 0x1ea2,
  4706. "Aiecyrillic",
  4707. 0x04d4,
  4708. "Ainvertedbreve",
  4709. 0x0202,
  4710. "Alpha",
  4711. 0x0391,
  4712. "Alphatonos",
  4713. 0x0386,
  4714. "Amacron",
  4715. 0x0100,
  4716. "Amonospace",
  4717. 0xff21,
  4718. "Aogonek",
  4719. 0x0104,
  4720. "Aring",
  4721. 0x00c5,
  4722. "Aringacute",
  4723. 0x01fa,
  4724. "Aringbelow",
  4725. 0x1e00,
  4726. "Aringsmall",
  4727. 0xf7e5,
  4728. "Asmall",
  4729. 0xf761,
  4730. "Atilde",
  4731. 0x00c3,
  4732. "Atildesmall",
  4733. 0xf7e3,
  4734. "Aybarmenian",
  4735. 0x0531,
  4736. "B",
  4737. 0x0042,
  4738. "Bcircle",
  4739. 0x24b7,
  4740. "Bdotaccent",
  4741. 0x1e02,
  4742. "Bdotbelow",
  4743. 0x1e04,
  4744. "Becyrillic",
  4745. 0x0411,
  4746. "Benarmenian",
  4747. 0x0532,
  4748. "Beta",
  4749. 0x0392,
  4750. "Bhook",
  4751. 0x0181,
  4752. "Blinebelow",
  4753. 0x1e06,
  4754. "Bmonospace",
  4755. 0xff22,
  4756. "Brevesmall",
  4757. 0xf6f4,
  4758. "Bsmall",
  4759. 0xf762,
  4760. "Btopbar",
  4761. 0x0182,
  4762. "C",
  4763. 0x0043,
  4764. "Caarmenian",
  4765. 0x053e,
  4766. "Cacute",
  4767. 0x0106,
  4768. "Caron",
  4769. 0xf6ca,
  4770. "Caronsmall",
  4771. 0xf6f5,
  4772. "Ccaron",
  4773. 0x010c,
  4774. "Ccedilla",
  4775. 0x00c7,
  4776. "Ccedillaacute",
  4777. 0x1e08,
  4778. "Ccedillasmall",
  4779. 0xf7e7,
  4780. "Ccircle",
  4781. 0x24b8,
  4782. "Ccircumflex",
  4783. 0x0108,
  4784. "Cdot",
  4785. 0x010a,
  4786. "Cdotaccent",
  4787. 0x010a,
  4788. "Cedillasmall",
  4789. 0xf7b8,
  4790. "Chaarmenian",
  4791. 0x0549,
  4792. "Cheabkhasiancyrillic",
  4793. 0x04bc,
  4794. "Checyrillic",
  4795. 0x0427,
  4796. "Chedescenderabkhasiancyrillic",
  4797. 0x04be,
  4798. "Chedescendercyrillic",
  4799. 0x04b6,
  4800. "Chedieresiscyrillic",
  4801. 0x04f4,
  4802. "Cheharmenian",
  4803. 0x0543,
  4804. "Chekhakassiancyrillic",
  4805. 0x04cb,
  4806. "Cheverticalstrokecyrillic",
  4807. 0x04b8,
  4808. "Chi",
  4809. 0x03a7,
  4810. "Chook",
  4811. 0x0187,
  4812. "Circumflexsmall",
  4813. 0xf6f6,
  4814. "Cmonospace",
  4815. 0xff23,
  4816. "Coarmenian",
  4817. 0x0551,
  4818. "Csmall",
  4819. 0xf763,
  4820. "D",
  4821. 0x0044,
  4822. "DZ",
  4823. 0x01f1,
  4824. "DZcaron",
  4825. 0x01c4,
  4826. "Daarmenian",
  4827. 0x0534,
  4828. "Dafrican",
  4829. 0x0189,
  4830. "Dcaron",
  4831. 0x010e,
  4832. "Dcedilla",
  4833. 0x1e10,
  4834. "Dcircle",
  4835. 0x24b9,
  4836. "Dcircumflexbelow",
  4837. 0x1e12,
  4838. "Dcroat",
  4839. 0x0110,
  4840. "Ddotaccent",
  4841. 0x1e0a,
  4842. "Ddotbelow",
  4843. 0x1e0c,
  4844. "Decyrillic",
  4845. 0x0414,
  4846. "Deicoptic",
  4847. 0x03ee,
  4848. "Delta",
  4849. 0x2206,
  4850. "Deltagreek",
  4851. 0x0394,
  4852. "Dhook",
  4853. 0x018a,
  4854. "Dieresis",
  4855. 0xf6cb,
  4856. "DieresisAcute",
  4857. 0xf6cc,
  4858. "DieresisGrave",
  4859. 0xf6cd,
  4860. "Dieresissmall",
  4861. 0xf7a8,
  4862. "Digammagreek",
  4863. 0x03dc,
  4864. "Djecyrillic",
  4865. 0x0402,
  4866. "Dlinebelow",
  4867. 0x1e0e,
  4868. "Dmonospace",
  4869. 0xff24,
  4870. "Dotaccentsmall",
  4871. 0xf6f7,
  4872. "Dslash",
  4873. 0x0110,
  4874. "Dsmall",
  4875. 0xf764,
  4876. "Dtopbar",
  4877. 0x018b,
  4878. "Dz",
  4879. 0x01f2,
  4880. "Dzcaron",
  4881. 0x01c5,
  4882. "Dzeabkhasiancyrillic",
  4883. 0x04e0,
  4884. "Dzecyrillic",
  4885. 0x0405,
  4886. "Dzhecyrillic",
  4887. 0x040f,
  4888. "E",
  4889. 0x0045,
  4890. "Eacute",
  4891. 0x00c9,
  4892. "Eacutesmall",
  4893. 0xf7e9,
  4894. "Ebreve",
  4895. 0x0114,
  4896. "Ecaron",
  4897. 0x011a,
  4898. "Ecedillabreve",
  4899. 0x1e1c,
  4900. "Echarmenian",
  4901. 0x0535,
  4902. "Ecircle",
  4903. 0x24ba,
  4904. "Ecircumflex",
  4905. 0x00ca,
  4906. "Ecircumflexacute",
  4907. 0x1ebe,
  4908. "Ecircumflexbelow",
  4909. 0x1e18,
  4910. "Ecircumflexdotbelow",
  4911. 0x1ec6,
  4912. "Ecircumflexgrave",
  4913. 0x1ec0,
  4914. "Ecircumflexhookabove",
  4915. 0x1ec2,
  4916. "Ecircumflexsmall",
  4917. 0xf7ea,
  4918. "Ecircumflextilde",
  4919. 0x1ec4,
  4920. "Ecyrillic",
  4921. 0x0404,
  4922. "Edblgrave",
  4923. 0x0204,
  4924. "Edieresis",
  4925. 0x00cb,
  4926. "Edieresissmall",
  4927. 0xf7eb,
  4928. "Edot",
  4929. 0x0116,
  4930. "Edotaccent",
  4931. 0x0116,
  4932. "Edotbelow",
  4933. 0x1eb8,
  4934. "Efcyrillic",
  4935. 0x0424,
  4936. "Egrave",
  4937. 0x00c8,
  4938. "Egravesmall",
  4939. 0xf7e8,
  4940. "Eharmenian",
  4941. 0x0537,
  4942. "Ehookabove",
  4943. 0x1eba,
  4944. "Eightroman",
  4945. 0x2167,
  4946. "Einvertedbreve",
  4947. 0x0206,
  4948. "Eiotifiedcyrillic",
  4949. 0x0464,
  4950. "Elcyrillic",
  4951. 0x041b,
  4952. "Elevenroman",
  4953. 0x216a,
  4954. "Emacron",
  4955. 0x0112,
  4956. "Emacronacute",
  4957. 0x1e16,
  4958. "Emacrongrave",
  4959. 0x1e14,
  4960. "Emcyrillic",
  4961. 0x041c,
  4962. "Emonospace",
  4963. 0xff25,
  4964. "Encyrillic",
  4965. 0x041d,
  4966. "Endescendercyrillic",
  4967. 0x04a2,
  4968. "Eng",
  4969. 0x014a,
  4970. "Enghecyrillic",
  4971. 0x04a4,
  4972. "Enhookcyrillic",
  4973. 0x04c7,
  4974. "Eogonek",
  4975. 0x0118,
  4976. "Eopen",
  4977. 0x0190,
  4978. "Epsilon",
  4979. 0x0395,
  4980. "Epsilontonos",
  4981. 0x0388,
  4982. "Ercyrillic",
  4983. 0x0420,
  4984. "Ereversed",
  4985. 0x018e,
  4986. "Ereversedcyrillic",
  4987. 0x042d,
  4988. "Escyrillic",
  4989. 0x0421,
  4990. "Esdescendercyrillic",
  4991. 0x04aa,
  4992. "Esh",
  4993. 0x01a9,
  4994. "Esmall",
  4995. 0xf765,
  4996. "Eta",
  4997. 0x0397,
  4998. "Etarmenian",
  4999. 0x0538,
  5000. "Etatonos",
  5001. 0x0389,
  5002. "Eth",
  5003. 0x00d0,
  5004. "Ethsmall",
  5005. 0xf7f0,
  5006. "Etilde",
  5007. 0x1ebc,
  5008. "Etildebelow",
  5009. 0x1e1a,
  5010. "Euro",
  5011. 0x20ac,
  5012. "Ezh",
  5013. 0x01b7,
  5014. "Ezhcaron",
  5015. 0x01ee,
  5016. "Ezhreversed",
  5017. 0x01b8,
  5018. "F",
  5019. 0x0046,
  5020. "Fcircle",
  5021. 0x24bb,
  5022. "Fdotaccent",
  5023. 0x1e1e,
  5024. "Feharmenian",
  5025. 0x0556,
  5026. "Feicoptic",
  5027. 0x03e4,
  5028. "Fhook",
  5029. 0x0191,
  5030. "Fitacyrillic",
  5031. 0x0472,
  5032. "Fiveroman",
  5033. 0x2164,
  5034. "Fmonospace",
  5035. 0xff26,
  5036. "Fourroman",
  5037. 0x2163,
  5038. "Fsmall",
  5039. 0xf766,
  5040. "G",
  5041. 0x0047,
  5042. "GBsquare",
  5043. 0x3387,
  5044. "Gacute",
  5045. 0x01f4,
  5046. "Gamma",
  5047. 0x0393,
  5048. "Gammaafrican",
  5049. 0x0194,
  5050. "Gangiacoptic",
  5051. 0x03ea,
  5052. "Gbreve",
  5053. 0x011e,
  5054. "Gcaron",
  5055. 0x01e6,
  5056. "Gcedilla",
  5057. 0x0122,
  5058. "Gcircle",
  5059. 0x24bc,
  5060. "Gcircumflex",
  5061. 0x011c,
  5062. "Gcommaaccent",
  5063. 0x0122,
  5064. "Gdot",
  5065. 0x0120,
  5066. "Gdotaccent",
  5067. 0x0120,
  5068. "Gecyrillic",
  5069. 0x0413,
  5070. "Ghadarmenian",
  5071. 0x0542,
  5072. "Ghemiddlehookcyrillic",
  5073. 0x0494,
  5074. "Ghestrokecyrillic",
  5075. 0x0492,
  5076. "Gheupturncyrillic",
  5077. 0x0490,
  5078. "Ghook",
  5079. 0x0193,
  5080. "Gimarmenian",
  5081. 0x0533,
  5082. "Gjecyrillic",
  5083. 0x0403,
  5084. "Gmacron",
  5085. 0x1e20,
  5086. "Gmonospace",
  5087. 0xff27,
  5088. "Grave",
  5089. 0xf6ce,
  5090. "Gravesmall",
  5091. 0xf760,
  5092. "Gsmall",
  5093. 0xf767,
  5094. "Gsmallhook",
  5095. 0x029b,
  5096. "Gstroke",
  5097. 0x01e4,
  5098. "H",
  5099. 0x0048,
  5100. "H18533",
  5101. 0x25cf,
  5102. "H18543",
  5103. 0x25aa,
  5104. "H18551",
  5105. 0x25ab,
  5106. "H22073",
  5107. 0x25a1,
  5108. "HPsquare",
  5109. 0x33cb,
  5110. "Haabkhasiancyrillic",
  5111. 0x04a8,
  5112. "Hadescendercyrillic",
  5113. 0x04b2,
  5114. "Hardsigncyrillic",
  5115. 0x042a,
  5116. "Hbar",
  5117. 0x0126,
  5118. "Hbrevebelow",
  5119. 0x1e2a,
  5120. "Hcedilla",
  5121. 0x1e28,
  5122. "Hcircle",
  5123. 0x24bd,
  5124. "Hcircumflex",
  5125. 0x0124,
  5126. "Hdieresis",
  5127. 0x1e26,
  5128. "Hdotaccent",
  5129. 0x1e22,
  5130. "Hdotbelow",
  5131. 0x1e24,
  5132. "Hmonospace",
  5133. 0xff28,
  5134. "Hoarmenian",
  5135. 0x0540,
  5136. "Horicoptic",
  5137. 0x03e8,
  5138. "Hsmall",
  5139. 0xf768,
  5140. "Hungarumlaut",
  5141. 0xf6cf,
  5142. "Hungarumlautsmall",
  5143. 0xf6f8,
  5144. "Hzsquare",
  5145. 0x3390,
  5146. "I",
  5147. 0x0049,
  5148. "IAcyrillic",
  5149. 0x042f,
  5150. "IJ",
  5151. 0x0132,
  5152. "IUcyrillic",
  5153. 0x042e,
  5154. "Iacute",
  5155. 0x00cd,
  5156. "Iacutesmall",
  5157. 0xf7ed,
  5158. "Ibreve",
  5159. 0x012c,
  5160. "Icaron",
  5161. 0x01cf,
  5162. "Icircle",
  5163. 0x24be,
  5164. "Icircumflex",
  5165. 0x00ce,
  5166. "Icircumflexsmall",
  5167. 0xf7ee,
  5168. "Icyrillic",
  5169. 0x0406,
  5170. "Idblgrave",
  5171. 0x0208,
  5172. "Idieresis",
  5173. 0x00cf,
  5174. "Idieresisacute",
  5175. 0x1e2e,
  5176. "Idieresiscyrillic",
  5177. 0x04e4,
  5178. "Idieresissmall",
  5179. 0xf7ef,
  5180. "Idot",
  5181. 0x0130,
  5182. "Idotaccent",
  5183. 0x0130,
  5184. "Idotbelow",
  5185. 0x1eca,
  5186. "Iebrevecyrillic",
  5187. 0x04d6,
  5188. "Iecyrillic",
  5189. 0x0415,
  5190. "Ifraktur",
  5191. 0x2111,
  5192. "Igrave",
  5193. 0x00cc,
  5194. "Igravesmall",
  5195. 0xf7ec,
  5196. "Ihookabove",
  5197. 0x1ec8,
  5198. "Iicyrillic",
  5199. 0x0418,
  5200. "Iinvertedbreve",
  5201. 0x020a,
  5202. "Iishortcyrillic",
  5203. 0x0419,
  5204. "Imacron",
  5205. 0x012a,
  5206. "Imacroncyrillic",
  5207. 0x04e2,
  5208. "Imonospace",
  5209. 0xff29,
  5210. "Iniarmenian",
  5211. 0x053b,
  5212. "Iocyrillic",
  5213. 0x0401,
  5214. "Iogonek",
  5215. 0x012e,
  5216. "Iota",
  5217. 0x0399,
  5218. "Iotaafrican",
  5219. 0x0196,
  5220. "Iotadieresis",
  5221. 0x03aa,
  5222. "Iotatonos",
  5223. 0x038a,
  5224. "Ismall",
  5225. 0xf769,
  5226. "Istroke",
  5227. 0x0197,
  5228. "Itilde",
  5229. 0x0128,
  5230. "Itildebelow",
  5231. 0x1e2c,
  5232. "Izhitsacyrillic",
  5233. 0x0474,
  5234. "Izhitsadblgravecyrillic",
  5235. 0x0476,
  5236. "J",
  5237. 0x004a,
  5238. "Jaarmenian",
  5239. 0x0541,
  5240. "Jcircle",
  5241. 0x24bf,
  5242. "Jcircumflex",
  5243. 0x0134,
  5244. "Jecyrillic",
  5245. 0x0408,
  5246. "Jheharmenian",
  5247. 0x054b,
  5248. "Jmonospace",
  5249. 0xff2a,
  5250. "Jsmall",
  5251. 0xf76a,
  5252. "K",
  5253. 0x004b,
  5254. "KBsquare",
  5255. 0x3385,
  5256. "KKsquare",
  5257. 0x33cd,
  5258. "Kabashkircyrillic",
  5259. 0x04a0,
  5260. "Kacute",
  5261. 0x1e30,
  5262. "Kacyrillic",
  5263. 0x041a,
  5264. "Kadescendercyrillic",
  5265. 0x049a,
  5266. "Kahookcyrillic",
  5267. 0x04c3,
  5268. "Kappa",
  5269. 0x039a,
  5270. "Kastrokecyrillic",
  5271. 0x049e,
  5272. "Kaverticalstrokecyrillic",
  5273. 0x049c,
  5274. "Kcaron",
  5275. 0x01e8,
  5276. "Kcedilla",
  5277. 0x0136,
  5278. "Kcircle",
  5279. 0x24c0,
  5280. "Kcommaaccent",
  5281. 0x0136,
  5282. "Kdotbelow",
  5283. 0x1e32,
  5284. "Keharmenian",
  5285. 0x0554,
  5286. "Kenarmenian",
  5287. 0x053f,
  5288. "Khacyrillic",
  5289. 0x0425,
  5290. "Kheicoptic",
  5291. 0x03e6,
  5292. "Khook",
  5293. 0x0198,
  5294. "Kjecyrillic",
  5295. 0x040c,
  5296. "Klinebelow",
  5297. 0x1e34,
  5298. "Kmonospace",
  5299. 0xff2b,
  5300. "Koppacyrillic",
  5301. 0x0480,
  5302. "Koppagreek",
  5303. 0x03de,
  5304. "Ksicyrillic",
  5305. 0x046e,
  5306. "Ksmall",
  5307. 0xf76b,
  5308. "L",
  5309. 0x004c,
  5310. "LJ",
  5311. 0x01c7,
  5312. "LL",
  5313. 0xf6bf,
  5314. "Lacute",
  5315. 0x0139,
  5316. "Lambda",
  5317. 0x039b,
  5318. "Lcaron",
  5319. 0x013d,
  5320. "Lcedilla",
  5321. 0x013b,
  5322. "Lcircle",
  5323. 0x24c1,
  5324. "Lcircumflexbelow",
  5325. 0x1e3c,
  5326. "Lcommaaccent",
  5327. 0x013b,
  5328. "Ldot",
  5329. 0x013f,
  5330. "Ldotaccent",
  5331. 0x013f,
  5332. "Ldotbelow",
  5333. 0x1e36,
  5334. "Ldotbelowmacron",
  5335. 0x1e38,
  5336. "Liwnarmenian",
  5337. 0x053c,
  5338. "Lj",
  5339. 0x01c8,
  5340. "Ljecyrillic",
  5341. 0x0409,
  5342. "Llinebelow",
  5343. 0x1e3a,
  5344. "Lmonospace",
  5345. 0xff2c,
  5346. "Lslash",
  5347. 0x0141,
  5348. "Lslashsmall",
  5349. 0xf6f9,
  5350. "Lsmall",
  5351. 0xf76c,
  5352. "M",
  5353. 0x004d,
  5354. "MBsquare",
  5355. 0x3386,
  5356. "Macron",
  5357. 0xf6d0,
  5358. "Macronsmall",
  5359. 0xf7af,
  5360. "Macute",
  5361. 0x1e3e,
  5362. "Mcircle",
  5363. 0x24c2,
  5364. "Mdotaccent",
  5365. 0x1e40,
  5366. "Mdotbelow",
  5367. 0x1e42,
  5368. "Menarmenian",
  5369. 0x0544,
  5370. "Mmonospace",
  5371. 0xff2d,
  5372. "Msmall",
  5373. 0xf76d,
  5374. "Mturned",
  5375. 0x019c,
  5376. "Mu",
  5377. 0x039c,
  5378. "N",
  5379. 0x004e,
  5380. "NJ",
  5381. 0x01ca,
  5382. "Nacute",
  5383. 0x0143,
  5384. "Ncaron",
  5385. 0x0147,
  5386. "Ncedilla",
  5387. 0x0145,
  5388. "Ncircle",
  5389. 0x24c3,
  5390. "Ncircumflexbelow",
  5391. 0x1e4a,
  5392. "Ncommaaccent",
  5393. 0x0145,
  5394. "Ndotaccent",
  5395. 0x1e44,
  5396. "Ndotbelow",
  5397. 0x1e46,
  5398. "Nhookleft",
  5399. 0x019d,
  5400. "Nineroman",
  5401. 0x2168,
  5402. "Nj",
  5403. 0x01cb,
  5404. "Njecyrillic",
  5405. 0x040a,
  5406. "Nlinebelow",
  5407. 0x1e48,
  5408. "Nmonospace",
  5409. 0xff2e,
  5410. "Nowarmenian",
  5411. 0x0546,
  5412. "Nsmall",
  5413. 0xf76e,
  5414. "Ntilde",
  5415. 0x00d1,
  5416. "Ntildesmall",
  5417. 0xf7f1,
  5418. "Nu",
  5419. 0x039d,
  5420. "O",
  5421. 0x004f,
  5422. "OE",
  5423. 0x0152,
  5424. "OEsmall",
  5425. 0xf6fa,
  5426. "Oacute",
  5427. 0x00d3,
  5428. "Oacutesmall",
  5429. 0xf7f3,
  5430. "Obarredcyrillic",
  5431. 0x04e8,
  5432. "Obarreddieresiscyrillic",
  5433. 0x04ea,
  5434. "Obreve",
  5435. 0x014e,
  5436. "Ocaron",
  5437. 0x01d1,
  5438. "Ocenteredtilde",
  5439. 0x019f,
  5440. "Ocircle",
  5441. 0x24c4,
  5442. "Ocircumflex",
  5443. 0x00d4,
  5444. "Ocircumflexacute",
  5445. 0x1ed0,
  5446. "Ocircumflexdotbelow",
  5447. 0x1ed8,
  5448. "Ocircumflexgrave",
  5449. 0x1ed2,
  5450. "Ocircumflexhookabove",
  5451. 0x1ed4,
  5452. "Ocircumflexsmall",
  5453. 0xf7f4,
  5454. "Ocircumflextilde",
  5455. 0x1ed6,
  5456. "Ocyrillic",
  5457. 0x041e,
  5458. "Odblacute",
  5459. 0x0150,
  5460. "Odblgrave",
  5461. 0x020c,
  5462. "Odieresis",
  5463. 0x00d6,
  5464. "Odieresiscyrillic",
  5465. 0x04e6,
  5466. "Odieresissmall",
  5467. 0xf7f6,
  5468. "Odotbelow",
  5469. 0x1ecc,
  5470. "Ogoneksmall",
  5471. 0xf6fb,
  5472. "Ograve",
  5473. 0x00d2,
  5474. "Ogravesmall",
  5475. 0xf7f2,
  5476. "Oharmenian",
  5477. 0x0555,
  5478. "Ohm",
  5479. 0x2126,
  5480. "Ohookabove",
  5481. 0x1ece,
  5482. "Ohorn",
  5483. 0x01a0,
  5484. "Ohornacute",
  5485. 0x1eda,
  5486. "Ohorndotbelow",
  5487. 0x1ee2,
  5488. "Ohorngrave",
  5489. 0x1edc,
  5490. "Ohornhookabove",
  5491. 0x1ede,
  5492. "Ohorntilde",
  5493. 0x1ee0,
  5494. "Ohungarumlaut",
  5495. 0x0150,
  5496. "Oi",
  5497. 0x01a2,
  5498. "Oinvertedbreve",
  5499. 0x020e,
  5500. "Omacron",
  5501. 0x014c,
  5502. "Omacronacute",
  5503. 0x1e52,
  5504. "Omacrongrave",
  5505. 0x1e50,
  5506. "Omega",
  5507. 0x2126,
  5508. "Omegacyrillic",
  5509. 0x0460,
  5510. "Omegagreek",
  5511. 0x03a9,
  5512. "Omegaroundcyrillic",
  5513. 0x047a,
  5514. "Omegatitlocyrillic",
  5515. 0x047c,
  5516. "Omegatonos",
  5517. 0x038f,
  5518. "Omicron",
  5519. 0x039f,
  5520. "Omicrontonos",
  5521. 0x038c,
  5522. "Omonospace",
  5523. 0xff2f,
  5524. "Oneroman",
  5525. 0x2160,
  5526. "Oogonek",
  5527. 0x01ea,
  5528. "Oogonekmacron",
  5529. 0x01ec,
  5530. "Oopen",
  5531. 0x0186,
  5532. "Oslash",
  5533. 0x00d8,
  5534. "Oslashacute",
  5535. 0x01fe,
  5536. "Oslashsmall",
  5537. 0xf7f8,
  5538. "Osmall",
  5539. 0xf76f,
  5540. "Ostrokeacute",
  5541. 0x01fe,
  5542. "Otcyrillic",
  5543. 0x047e,
  5544. "Otilde",
  5545. 0x00d5,
  5546. "Otildeacute",
  5547. 0x1e4c,
  5548. "Otildedieresis",
  5549. 0x1e4e,
  5550. "Otildesmall",
  5551. 0xf7f5,
  5552. "P",
  5553. 0x0050,
  5554. "Pacute",
  5555. 0x1e54,
  5556. "Pcircle",
  5557. 0x24c5,
  5558. "Pdotaccent",
  5559. 0x1e56,
  5560. "Pecyrillic",
  5561. 0x041f,
  5562. "Peharmenian",
  5563. 0x054a,
  5564. "Pemiddlehookcyrillic",
  5565. 0x04a6,
  5566. "Phi",
  5567. 0x03a6,
  5568. "Phook",
  5569. 0x01a4,
  5570. "Pi",
  5571. 0x03a0,
  5572. "Piwrarmenian",
  5573. 0x0553,
  5574. "Pmonospace",
  5575. 0xff30,
  5576. "Psi",
  5577. 0x03a8,
  5578. "Psicyrillic",
  5579. 0x0470,
  5580. "Psmall",
  5581. 0xf770,
  5582. "Q",
  5583. 0x0051,
  5584. "Qcircle",
  5585. 0x24c6,
  5586. "Qmonospace",
  5587. 0xff31,
  5588. "Qsmall",
  5589. 0xf771,
  5590. "R",
  5591. 0x0052,
  5592. "Raarmenian",
  5593. 0x054c,
  5594. "Racute",
  5595. 0x0154,
  5596. "Rcaron",
  5597. 0x0158,
  5598. "Rcedilla",
  5599. 0x0156,
  5600. "Rcircle",
  5601. 0x24c7,
  5602. "Rcommaaccent",
  5603. 0x0156,
  5604. "Rdblgrave",
  5605. 0x0210,
  5606. "Rdotaccent",
  5607. 0x1e58,
  5608. "Rdotbelow",
  5609. 0x1e5a,
  5610. "Rdotbelowmacron",
  5611. 0x1e5c,
  5612. "Reharmenian",
  5613. 0x0550,
  5614. "Rfraktur",
  5615. 0x211c,
  5616. "Rho",
  5617. 0x03a1,
  5618. "Ringsmall",
  5619. 0xf6fc,
  5620. "Rinvertedbreve",
  5621. 0x0212,
  5622. "Rlinebelow",
  5623. 0x1e5e,
  5624. "Rmonospace",
  5625. 0xff32,
  5626. "Rsmall",
  5627. 0xf772,
  5628. "Rsmallinverted",
  5629. 0x0281,
  5630. "Rsmallinvertedsuperior",
  5631. 0x02b6,
  5632. "S",
  5633. 0x0053,
  5634. "SF010000",
  5635. 0x250c,
  5636. "SF020000",
  5637. 0x2514,
  5638. "SF030000",
  5639. 0x2510,
  5640. "SF040000",
  5641. 0x2518,
  5642. "SF050000",
  5643. 0x253c,
  5644. "SF060000",
  5645. 0x252c,
  5646. "SF070000",
  5647. 0x2534,
  5648. "SF080000",
  5649. 0x251c,
  5650. "SF090000",
  5651. 0x2524,
  5652. "SF100000",
  5653. 0x2500,
  5654. "SF110000",
  5655. 0x2502,
  5656. "SF190000",
  5657. 0x2561,
  5658. "SF200000",
  5659. 0x2562,
  5660. "SF210000",
  5661. 0x2556,
  5662. "SF220000",
  5663. 0x2555,
  5664. "SF230000",
  5665. 0x2563,
  5666. "SF240000",
  5667. 0x2551,
  5668. "SF250000",
  5669. 0x2557,
  5670. "SF260000",
  5671. 0x255d,
  5672. "SF270000",
  5673. 0x255c,
  5674. "SF280000",
  5675. 0x255b,
  5676. "SF360000",
  5677. 0x255e,
  5678. "SF370000",
  5679. 0x255f,
  5680. "SF380000",
  5681. 0x255a,
  5682. "SF390000",
  5683. 0x2554,
  5684. "SF400000",
  5685. 0x2569,
  5686. "SF410000",
  5687. 0x2566,
  5688. "SF420000",
  5689. 0x2560,
  5690. "SF430000",
  5691. 0x2550,
  5692. "SF440000",
  5693. 0x256c,
  5694. "SF450000",
  5695. 0x2567,
  5696. "SF460000",
  5697. 0x2568,
  5698. "SF470000",
  5699. 0x2564,
  5700. "SF480000",
  5701. 0x2565,
  5702. "SF490000",
  5703. 0x2559,
  5704. "SF500000",
  5705. 0x2558,
  5706. "SF510000",
  5707. 0x2552,
  5708. "SF520000",
  5709. 0x2553,
  5710. "SF530000",
  5711. 0x256b,
  5712. "SF540000",
  5713. 0x256a,
  5714. "Sacute",
  5715. 0x015a,
  5716. "Sacutedotaccent",
  5717. 0x1e64,
  5718. "Sampigreek",
  5719. 0x03e0,
  5720. "Scaron",
  5721. 0x0160,
  5722. "Scarondotaccent",
  5723. 0x1e66,
  5724. "Scaronsmall",
  5725. 0xf6fd,
  5726. "Scedilla",
  5727. 0x015e,
  5728. "Schwa",
  5729. 0x018f,
  5730. "Schwacyrillic",
  5731. 0x04d8,
  5732. "Schwadieresiscyrillic",
  5733. 0x04da,
  5734. "Scircle",
  5735. 0x24c8,
  5736. "Scircumflex",
  5737. 0x015c,
  5738. "Scommaaccent",
  5739. 0x0218,
  5740. "Sdotaccent",
  5741. 0x1e60,
  5742. "Sdotbelow",
  5743. 0x1e62,
  5744. "Sdotbelowdotaccent",
  5745. 0x1e68,
  5746. "Seharmenian",
  5747. 0x054d,
  5748. "Sevenroman",
  5749. 0x2166,
  5750. "Shaarmenian",
  5751. 0x0547,
  5752. "Shacyrillic",
  5753. 0x0428,
  5754. "Shchacyrillic",
  5755. 0x0429,
  5756. "Sheicoptic",
  5757. 0x03e2,
  5758. "Shhacyrillic",
  5759. 0x04ba,
  5760. "Shimacoptic",
  5761. 0x03ec,
  5762. "Sigma",
  5763. 0x03a3,
  5764. "Sixroman",
  5765. 0x2165,
  5766. "Smonospace",
  5767. 0xff33,
  5768. "Softsigncyrillic",
  5769. 0x042c,
  5770. "Ssmall",
  5771. 0xf773,
  5772. "Stigmagreek",
  5773. 0x03da,
  5774. "T",
  5775. 0x0054,
  5776. "Tau",
  5777. 0x03a4,
  5778. "Tbar",
  5779. 0x0166,
  5780. "Tcaron",
  5781. 0x0164,
  5782. "Tcedilla",
  5783. 0x0162,
  5784. "Tcircle",
  5785. 0x24c9,
  5786. "Tcircumflexbelow",
  5787. 0x1e70,
  5788. "Tcommaaccent",
  5789. 0x0162,
  5790. "Tdotaccent",
  5791. 0x1e6a,
  5792. "Tdotbelow",
  5793. 0x1e6c,
  5794. "Tecyrillic",
  5795. 0x0422,
  5796. "Tedescendercyrillic",
  5797. 0x04ac,
  5798. "Tenroman",
  5799. 0x2169,
  5800. "Tetsecyrillic",
  5801. 0x04b4,
  5802. "Theta",
  5803. 0x0398,
  5804. "Thook",
  5805. 0x01ac,
  5806. "Thorn",
  5807. 0x00de,
  5808. "Thornsmall",
  5809. 0xf7fe,
  5810. "Threeroman",
  5811. 0x2162,
  5812. "Tildesmall",
  5813. 0xf6fe,
  5814. "Tiwnarmenian",
  5815. 0x054f,
  5816. "Tlinebelow",
  5817. 0x1e6e,
  5818. "Tmonospace",
  5819. 0xff34,
  5820. "Toarmenian",
  5821. 0x0539,
  5822. "Tonefive",
  5823. 0x01bc,
  5824. "Tonesix",
  5825. 0x0184,
  5826. "Tonetwo",
  5827. 0x01a7,
  5828. "Tretroflexhook",
  5829. 0x01ae,
  5830. "Tsecyrillic",
  5831. 0x0426,
  5832. "Tshecyrillic",
  5833. 0x040b,
  5834. "Tsmall",
  5835. 0xf774,
  5836. "Twelveroman",
  5837. 0x216b,
  5838. "Tworoman",
  5839. 0x2161,
  5840. "U",
  5841. 0x0055,
  5842. "Uacute",
  5843. 0x00da,
  5844. "Uacutesmall",
  5845. 0xf7fa,
  5846. "Ubreve",
  5847. 0x016c,
  5848. "Ucaron",
  5849. 0x01d3,
  5850. "Ucircle",
  5851. 0x24ca,
  5852. "Ucircumflex",
  5853. 0x00db,
  5854. "Ucircumflexbelow",
  5855. 0x1e76,
  5856. "Ucircumflexsmall",
  5857. 0xf7fb,
  5858. "Ucyrillic",
  5859. 0x0423,
  5860. "Udblacute",
  5861. 0x0170,
  5862. "Udblgrave",
  5863. 0x0214,
  5864. "Udieresis",
  5865. 0x00dc,
  5866. "Udieresisacute",
  5867. 0x01d7,
  5868. "Udieresisbelow",
  5869. 0x1e72,
  5870. "Udieresiscaron",
  5871. 0x01d9,
  5872. "Udieresiscyrillic",
  5873. 0x04f0,
  5874. "Udieresisgrave",
  5875. 0x01db,
  5876. "Udieresismacron",
  5877. 0x01d5,
  5878. "Udieresissmall",
  5879. 0xf7fc,
  5880. "Udotbelow",
  5881. 0x1ee4,
  5882. "Ugrave",
  5883. 0x00d9,
  5884. "Ugravesmall",
  5885. 0xf7f9,
  5886. "Uhookabove",
  5887. 0x1ee6,
  5888. "Uhorn",
  5889. 0x01af,
  5890. "Uhornacute",
  5891. 0x1ee8,
  5892. "Uhorndotbelow",
  5893. 0x1ef0,
  5894. "Uhorngrave",
  5895. 0x1eea,
  5896. "Uhornhookabove",
  5897. 0x1eec,
  5898. "Uhorntilde",
  5899. 0x1eee,
  5900. "Uhungarumlaut",
  5901. 0x0170,
  5902. "Uhungarumlautcyrillic",
  5903. 0x04f2,
  5904. "Uinvertedbreve",
  5905. 0x0216,
  5906. "Ukcyrillic",
  5907. 0x0478,
  5908. "Umacron",
  5909. 0x016a,
  5910. "Umacroncyrillic",
  5911. 0x04ee,
  5912. "Umacrondieresis",
  5913. 0x1e7a,
  5914. "Umonospace",
  5915. 0xff35,
  5916. "Uogonek",
  5917. 0x0172,
  5918. "Upsilon",
  5919. 0x03a5,
  5920. "Upsilon1",
  5921. 0x03d2,
  5922. "Upsilonacutehooksymbolgreek",
  5923. 0x03d3,
  5924. "Upsilonafrican",
  5925. 0x01b1,
  5926. "Upsilondieresis",
  5927. 0x03ab,
  5928. "Upsilondieresishooksymbolgreek",
  5929. 0x03d4,
  5930. "Upsilonhooksymbol",
  5931. 0x03d2,
  5932. "Upsilontonos",
  5933. 0x038e,
  5934. "Uring",
  5935. 0x016e,
  5936. "Ushortcyrillic",
  5937. 0x040e,
  5938. "Usmall",
  5939. 0xf775,
  5940. "Ustraightcyrillic",
  5941. 0x04ae,
  5942. "Ustraightstrokecyrillic",
  5943. 0x04b0,
  5944. "Utilde",
  5945. 0x0168,
  5946. "Utildeacute",
  5947. 0x1e78,
  5948. "Utildebelow",
  5949. 0x1e74,
  5950. "V",
  5951. 0x0056,
  5952. "Vcircle",
  5953. 0x24cb,
  5954. "Vdotbelow",
  5955. 0x1e7e,
  5956. "Vecyrillic",
  5957. 0x0412,
  5958. "Vewarmenian",
  5959. 0x054e,
  5960. "Vhook",
  5961. 0x01b2,
  5962. "Vmonospace",
  5963. 0xff36,
  5964. "Voarmenian",
  5965. 0x0548,
  5966. "Vsmall",
  5967. 0xf776,
  5968. "Vtilde",
  5969. 0x1e7c,
  5970. "W",
  5971. 0x0057,
  5972. "Wacute",
  5973. 0x1e82,
  5974. "Wcircle",
  5975. 0x24cc,
  5976. "Wcircumflex",
  5977. 0x0174,
  5978. "Wdieresis",
  5979. 0x1e84,
  5980. "Wdotaccent",
  5981. 0x1e86,
  5982. "Wdotbelow",
  5983. 0x1e88,
  5984. "Wgrave",
  5985. 0x1e80,
  5986. "Wmonospace",
  5987. 0xff37,
  5988. "Wsmall",
  5989. 0xf777,
  5990. "X",
  5991. 0x0058,
  5992. "Xcircle",
  5993. 0x24cd,
  5994. "Xdieresis",
  5995. 0x1e8c,
  5996. "Xdotaccent",
  5997. 0x1e8a,
  5998. "Xeharmenian",
  5999. 0x053d,
  6000. "Xi",
  6001. 0x039e,
  6002. "Xmonospace",
  6003. 0xff38,
  6004. "Xsmall",
  6005. 0xf778,
  6006. "Y",
  6007. 0x0059,
  6008. "Yacute",
  6009. 0x00dd,
  6010. "Yacutesmall",
  6011. 0xf7fd,
  6012. "Yatcyrillic",
  6013. 0x0462,
  6014. "Ycircle",
  6015. 0x24ce,
  6016. "Ycircumflex",
  6017. 0x0176,
  6018. "Ydieresis",
  6019. 0x0178,
  6020. "Ydieresissmall",
  6021. 0xf7ff,
  6022. "Ydotaccent",
  6023. 0x1e8e,
  6024. "Ydotbelow",
  6025. 0x1ef4,
  6026. "Yericyrillic",
  6027. 0x042b,
  6028. "Yerudieresiscyrillic",
  6029. 0x04f8,
  6030. "Ygrave",
  6031. 0x1ef2,
  6032. "Yhook",
  6033. 0x01b3,
  6034. "Yhookabove",
  6035. 0x1ef6,
  6036. "Yiarmenian",
  6037. 0x0545,
  6038. "Yicyrillic",
  6039. 0x0407,
  6040. "Yiwnarmenian",
  6041. 0x0552,
  6042. "Ymonospace",
  6043. 0xff39,
  6044. "Ysmall",
  6045. 0xf779,
  6046. "Ytilde",
  6047. 0x1ef8,
  6048. "Yusbigcyrillic",
  6049. 0x046a,
  6050. "Yusbigiotifiedcyrillic",
  6051. 0x046c,
  6052. "Yuslittlecyrillic",
  6053. 0x0466,
  6054. "Yuslittleiotifiedcyrillic",
  6055. 0x0468,
  6056. "Z",
  6057. 0x005a,
  6058. "Zaarmenian",
  6059. 0x0536,
  6060. "Zacute",
  6061. 0x0179,
  6062. "Zcaron",
  6063. 0x017d,
  6064. "Zcaronsmall",
  6065. 0xf6ff,
  6066. "Zcircle",
  6067. 0x24cf,
  6068. "Zcircumflex",
  6069. 0x1e90,
  6070. "Zdot",
  6071. 0x017b,
  6072. "Zdotaccent",
  6073. 0x017b,
  6074. "Zdotbelow",
  6075. 0x1e92,
  6076. "Zecyrillic",
  6077. 0x0417,
  6078. "Zedescendercyrillic",
  6079. 0x0498,
  6080. "Zedieresiscyrillic",
  6081. 0x04de,
  6082. "Zeta",
  6083. 0x0396,
  6084. "Zhearmenian",
  6085. 0x053a,
  6086. "Zhebrevecyrillic",
  6087. 0x04c1,
  6088. "Zhecyrillic",
  6089. 0x0416,
  6090. "Zhedescendercyrillic",
  6091. 0x0496,
  6092. "Zhedieresiscyrillic",
  6093. 0x04dc,
  6094. "Zlinebelow",
  6095. 0x1e94,
  6096. "Zmonospace",
  6097. 0xff3a,
  6098. "Zsmall",
  6099. 0xf77a,
  6100. "Zstroke",
  6101. 0x01b5,
  6102. "a",
  6103. 0x0061,
  6104. "aabengali",
  6105. 0x0986,
  6106. "aacute",
  6107. 0x00e1,
  6108. "aadeva",
  6109. 0x0906,
  6110. "aagujarati",
  6111. 0x0a86,
  6112. "aagurmukhi",
  6113. 0x0a06,
  6114. "aamatragurmukhi",
  6115. 0x0a3e,
  6116. "aarusquare",
  6117. 0x3303,
  6118. "aavowelsignbengali",
  6119. 0x09be,
  6120. "aavowelsigndeva",
  6121. 0x093e,
  6122. "aavowelsigngujarati",
  6123. 0x0abe,
  6124. "abbreviationmarkarmenian",
  6125. 0x055f,
  6126. "abbreviationsigndeva",
  6127. 0x0970,
  6128. "abengali",
  6129. 0x0985,
  6130. "abopomofo",
  6131. 0x311a,
  6132. "abreve",
  6133. 0x0103,
  6134. "abreveacute",
  6135. 0x1eaf,
  6136. "abrevecyrillic",
  6137. 0x04d1,
  6138. "abrevedotbelow",
  6139. 0x1eb7,
  6140. "abrevegrave",
  6141. 0x1eb1,
  6142. "abrevehookabove",
  6143. 0x1eb3,
  6144. "abrevetilde",
  6145. 0x1eb5,
  6146. "acaron",
  6147. 0x01ce,
  6148. "acircle",
  6149. 0x24d0,
  6150. "acircumflex",
  6151. 0x00e2,
  6152. "acircumflexacute",
  6153. 0x1ea5,
  6154. "acircumflexdotbelow",
  6155. 0x1ead,
  6156. "acircumflexgrave",
  6157. 0x1ea7,
  6158. "acircumflexhookabove",
  6159. 0x1ea9,
  6160. "acircumflextilde",
  6161. 0x1eab,
  6162. "acute",
  6163. 0x00b4,
  6164. "acutebelowcmb",
  6165. 0x0317,
  6166. "acutecmb",
  6167. 0x0301,
  6168. "acutecomb",
  6169. 0x0301,
  6170. "acutedeva",
  6171. 0x0954,
  6172. "acutelowmod",
  6173. 0x02cf,
  6174. "acutetonecmb",
  6175. 0x0341,
  6176. "acyrillic",
  6177. 0x0430,
  6178. "adblgrave",
  6179. 0x0201,
  6180. "addakgurmukhi",
  6181. 0x0a71,
  6182. "adeva",
  6183. 0x0905,
  6184. "adieresis",
  6185. 0x00e4,
  6186. "adieresiscyrillic",
  6187. 0x04d3,
  6188. "adieresismacron",
  6189. 0x01df,
  6190. "adotbelow",
  6191. 0x1ea1,
  6192. "adotmacron",
  6193. 0x01e1,
  6194. "ae",
  6195. 0x00e6,
  6196. "aeacute",
  6197. 0x01fd,
  6198. "aekorean",
  6199. 0x3150,
  6200. "aemacron",
  6201. 0x01e3,
  6202. "afii00208",
  6203. 0x2015,
  6204. "afii08941",
  6205. 0x20a4,
  6206. "afii10017",
  6207. 0x0410,
  6208. "afii10018",
  6209. 0x0411,
  6210. "afii10019",
  6211. 0x0412,
  6212. "afii10020",
  6213. 0x0413,
  6214. "afii10021",
  6215. 0x0414,
  6216. "afii10022",
  6217. 0x0415,
  6218. "afii10023",
  6219. 0x0401,
  6220. "afii10024",
  6221. 0x0416,
  6222. "afii10025",
  6223. 0x0417,
  6224. "afii10026",
  6225. 0x0418,
  6226. "afii10027",
  6227. 0x0419,
  6228. "afii10028",
  6229. 0x041a,
  6230. "afii10029",
  6231. 0x041b,
  6232. "afii10030",
  6233. 0x041c,
  6234. "afii10031",
  6235. 0x041d,
  6236. "afii10032",
  6237. 0x041e,
  6238. "afii10033",
  6239. 0x041f,
  6240. "afii10034",
  6241. 0x0420,
  6242. "afii10035",
  6243. 0x0421,
  6244. "afii10036",
  6245. 0x0422,
  6246. "afii10037",
  6247. 0x0423,
  6248. "afii10038",
  6249. 0x0424,
  6250. "afii10039",
  6251. 0x0425,
  6252. "afii10040",
  6253. 0x0426,
  6254. "afii10041",
  6255. 0x0427,
  6256. "afii10042",
  6257. 0x0428,
  6258. "afii10043",
  6259. 0x0429,
  6260. "afii10044",
  6261. 0x042a,
  6262. "afii10045",
  6263. 0x042b,
  6264. "afii10046",
  6265. 0x042c,
  6266. "afii10047",
  6267. 0x042d,
  6268. "afii10048",
  6269. 0x042e,
  6270. "afii10049",
  6271. 0x042f,
  6272. "afii10050",
  6273. 0x0490,
  6274. "afii10051",
  6275. 0x0402,
  6276. "afii10052",
  6277. 0x0403,
  6278. "afii10053",
  6279. 0x0404,
  6280. "afii10054",
  6281. 0x0405,
  6282. "afii10055",
  6283. 0x0406,
  6284. "afii10056",
  6285. 0x0407,
  6286. "afii10057",
  6287. 0x0408,
  6288. "afii10058",
  6289. 0x0409,
  6290. "afii10059",
  6291. 0x040a,
  6292. "afii10060",
  6293. 0x040b,
  6294. "afii10061",
  6295. 0x040c,
  6296. "afii10062",
  6297. 0x040e,
  6298. "afii10063",
  6299. 0xf6c4,
  6300. "afii10064",
  6301. 0xf6c5,
  6302. "afii10065",
  6303. 0x0430,
  6304. "afii10066",
  6305. 0x0431,
  6306. "afii10067",
  6307. 0x0432,
  6308. "afii10068",
  6309. 0x0433,
  6310. "afii10069",
  6311. 0x0434,
  6312. "afii10070",
  6313. 0x0435,
  6314. "afii10071",
  6315. 0x0451,
  6316. "afii10072",
  6317. 0x0436,
  6318. "afii10073",
  6319. 0x0437,
  6320. "afii10074",
  6321. 0x0438,
  6322. "afii10075",
  6323. 0x0439,
  6324. "afii10076",
  6325. 0x043a,
  6326. "afii10077",
  6327. 0x043b,
  6328. "afii10078",
  6329. 0x043c,
  6330. "afii10079",
  6331. 0x043d,
  6332. "afii10080",
  6333. 0x043e,
  6334. "afii10081",
  6335. 0x043f,
  6336. "afii10082",
  6337. 0x0440,
  6338. "afii10083",
  6339. 0x0441,
  6340. "afii10084",
  6341. 0x0442,
  6342. "afii10085",
  6343. 0x0443,
  6344. "afii10086",
  6345. 0x0444,
  6346. "afii10087",
  6347. 0x0445,
  6348. "afii10088",
  6349. 0x0446,
  6350. "afii10089",
  6351. 0x0447,
  6352. "afii10090",
  6353. 0x0448,
  6354. "afii10091",
  6355. 0x0449,
  6356. "afii10092",
  6357. 0x044a,
  6358. "afii10093",
  6359. 0x044b,
  6360. "afii10094",
  6361. 0x044c,
  6362. "afii10095",
  6363. 0x044d,
  6364. "afii10096",
  6365. 0x044e,
  6366. "afii10097",
  6367. 0x044f,
  6368. "afii10098",
  6369. 0x0491,
  6370. "afii10099",
  6371. 0x0452,
  6372. "afii10100",
  6373. 0x0453,
  6374. "afii10101",
  6375. 0x0454,
  6376. "afii10102",
  6377. 0x0455,
  6378. "afii10103",
  6379. 0x0456,
  6380. "afii10104",
  6381. 0x0457,
  6382. "afii10105",
  6383. 0x0458,
  6384. "afii10106",
  6385. 0x0459,
  6386. "afii10107",
  6387. 0x045a,
  6388. "afii10108",
  6389. 0x045b,
  6390. "afii10109",
  6391. 0x045c,
  6392. "afii10110",
  6393. 0x045e,
  6394. "afii10145",
  6395. 0x040f,
  6396. "afii10146",
  6397. 0x0462,
  6398. "afii10147",
  6399. 0x0472,
  6400. "afii10148",
  6401. 0x0474,
  6402. "afii10192",
  6403. 0xf6c6,
  6404. "afii10193",
  6405. 0x045f,
  6406. "afii10194",
  6407. 0x0463,
  6408. "afii10195",
  6409. 0x0473,
  6410. "afii10196",
  6411. 0x0475,
  6412. "afii10831",
  6413. 0xf6c7,
  6414. "afii10832",
  6415. 0xf6c8,
  6416. "afii10846",
  6417. 0x04d9,
  6418. "afii299",
  6419. 0x200e,
  6420. "afii300",
  6421. 0x200f,
  6422. "afii301",
  6423. 0x200d,
  6424. "afii57381",
  6425. 0x066a,
  6426. "afii57388",
  6427. 0x060c,
  6428. "afii57392",
  6429. 0x0660,
  6430. "afii57393",
  6431. 0x0661,
  6432. "afii57394",
  6433. 0x0662,
  6434. "afii57395",
  6435. 0x0663,
  6436. "afii57396",
  6437. 0x0664,
  6438. "afii57397",
  6439. 0x0665,
  6440. "afii57398",
  6441. 0x0666,
  6442. "afii57399",
  6443. 0x0667,
  6444. "afii57400",
  6445. 0x0668,
  6446. "afii57401",
  6447. 0x0669,
  6448. "afii57403",
  6449. 0x061b,
  6450. "afii57407",
  6451. 0x061f,
  6452. "afii57409",
  6453. 0x0621,
  6454. "afii57410",
  6455. 0x0622,
  6456. "afii57411",
  6457. 0x0623,
  6458. "afii57412",
  6459. 0x0624,
  6460. "afii57413",
  6461. 0x0625,
  6462. "afii57414",
  6463. 0x0626,
  6464. "afii57415",
  6465. 0x0627,
  6466. "afii57416",
  6467. 0x0628,
  6468. "afii57417",
  6469. 0x0629,
  6470. "afii57418",
  6471. 0x062a,
  6472. "afii57419",
  6473. 0x062b,
  6474. "afii57420",
  6475. 0x062c,
  6476. "afii57421",
  6477. 0x062d,
  6478. "afii57422",
  6479. 0x062e,
  6480. "afii57423",
  6481. 0x062f,
  6482. "afii57424",
  6483. 0x0630,
  6484. "afii57425",
  6485. 0x0631,
  6486. "afii57426",
  6487. 0x0632,
  6488. "afii57427",
  6489. 0x0633,
  6490. "afii57428",
  6491. 0x0634,
  6492. "afii57429",
  6493. 0x0635,
  6494. "afii57430",
  6495. 0x0636,
  6496. "afii57431",
  6497. 0x0637,
  6498. "afii57432",
  6499. 0x0638,
  6500. "afii57433",
  6501. 0x0639,
  6502. "afii57434",
  6503. 0x063a,
  6504. "afii57440",
  6505. 0x0640,
  6506. "afii57441",
  6507. 0x0641,
  6508. "afii57442",
  6509. 0x0642,
  6510. "afii57443",
  6511. 0x0643,
  6512. "afii57444",
  6513. 0x0644,
  6514. "afii57445",
  6515. 0x0645,
  6516. "afii57446",
  6517. 0x0646,
  6518. "afii57448",
  6519. 0x0648,
  6520. "afii57449",
  6521. 0x0649,
  6522. "afii57450",
  6523. 0x064a,
  6524. "afii57451",
  6525. 0x064b,
  6526. "afii57452",
  6527. 0x064c,
  6528. "afii57453",
  6529. 0x064d,
  6530. "afii57454",
  6531. 0x064e,
  6532. "afii57455",
  6533. 0x064f,
  6534. "afii57456",
  6535. 0x0650,
  6536. "afii57457",
  6537. 0x0651,
  6538. "afii57458",
  6539. 0x0652,
  6540. "afii57470",
  6541. 0x0647,
  6542. "afii57505",
  6543. 0x06a4,
  6544. "afii57506",
  6545. 0x067e,
  6546. "afii57507",
  6547. 0x0686,
  6548. "afii57508",
  6549. 0x0698,
  6550. "afii57509",
  6551. 0x06af,
  6552. "afii57511",
  6553. 0x0679,
  6554. "afii57512",
  6555. 0x0688,
  6556. "afii57513",
  6557. 0x0691,
  6558. "afii57514",
  6559. 0x06ba,
  6560. "afii57519",
  6561. 0x06d2,
  6562. "afii57534",
  6563. 0x06d5,
  6564. "afii57636",
  6565. 0x20aa,
  6566. "afii57645",
  6567. 0x05be,
  6568. "afii57658",
  6569. 0x05c3,
  6570. "afii57664",
  6571. 0x05d0,
  6572. "afii57665",
  6573. 0x05d1,
  6574. "afii57666",
  6575. 0x05d2,
  6576. "afii57667",
  6577. 0x05d3,
  6578. "afii57668",
  6579. 0x05d4,
  6580. "afii57669",
  6581. 0x05d5,
  6582. "afii57670",
  6583. 0x05d6,
  6584. "afii57671",
  6585. 0x05d7,
  6586. "afii57672",
  6587. 0x05d8,
  6588. "afii57673",
  6589. 0x05d9,
  6590. "afii57674",
  6591. 0x05da,
  6592. "afii57675",
  6593. 0x05db,
  6594. "afii57676",
  6595. 0x05dc,
  6596. "afii57677",
  6597. 0x05dd,
  6598. "afii57678",
  6599. 0x05de,
  6600. "afii57679",
  6601. 0x05df,
  6602. "afii57680",
  6603. 0x05e0,
  6604. "afii57681",
  6605. 0x05e1,
  6606. "afii57682",
  6607. 0x05e2,
  6608. "afii57683",
  6609. 0x05e3,
  6610. "afii57684",
  6611. 0x05e4,
  6612. "afii57685",
  6613. 0x05e5,
  6614. "afii57686",
  6615. 0x05e6,
  6616. "afii57687",
  6617. 0x05e7,
  6618. "afii57688",
  6619. 0x05e8,
  6620. "afii57689",
  6621. 0x05e9,
  6622. "afii57690",
  6623. 0x05ea,
  6624. "afii57694",
  6625. 0xfb2a,
  6626. "afii57695",
  6627. 0xfb2b,
  6628. "afii57700",
  6629. 0xfb4b,
  6630. "afii57705",
  6631. 0xfb1f,
  6632. "afii57716",
  6633. 0x05f0,
  6634. "afii57717",
  6635. 0x05f1,
  6636. "afii57718",
  6637. 0x05f2,
  6638. "afii57723",
  6639. 0xfb35,
  6640. "afii57793",
  6641. 0x05b4,
  6642. "afii57794",
  6643. 0x05b5,
  6644. "afii57795",
  6645. 0x05b6,
  6646. "afii57796",
  6647. 0x05bb,
  6648. "afii57797",
  6649. 0x05b8,
  6650. "afii57798",
  6651. 0x05b7,
  6652. "afii57799",
  6653. 0x05b0,
  6654. "afii57800",
  6655. 0x05b2,
  6656. "afii57801",
  6657. 0x05b1,
  6658. "afii57802",
  6659. 0x05b3,
  6660. "afii57803",
  6661. 0x05c2,
  6662. "afii57804",
  6663. 0x05c1,
  6664. "afii57806",
  6665. 0x05b9,
  6666. "afii57807",
  6667. 0x05bc,
  6668. "afii57839",
  6669. 0x05bd,
  6670. "afii57841",
  6671. 0x05bf,
  6672. "afii57842",
  6673. 0x05c0,
  6674. "afii57929",
  6675. 0x02bc,
  6676. "afii61248",
  6677. 0x2105,
  6678. "afii61289",
  6679. 0x2113,
  6680. "afii61352",
  6681. 0x2116,
  6682. "afii61573",
  6683. 0x202c,
  6684. "afii61574",
  6685. 0x202d,
  6686. "afii61575",
  6687. 0x202e,
  6688. "afii61664",
  6689. 0x200c,
  6690. "afii63167",
  6691. 0x066d,
  6692. "afii64937",
  6693. 0x02bd,
  6694. "agrave",
  6695. 0x00e0,
  6696. "agujarati",
  6697. 0x0a85,
  6698. "agurmukhi",
  6699. 0x0a05,
  6700. "ahiragana",
  6701. 0x3042,
  6702. "ahookabove",
  6703. 0x1ea3,
  6704. "aibengali",
  6705. 0x0990,
  6706. "aibopomofo",
  6707. 0x311e,
  6708. "aideva",
  6709. 0x0910,
  6710. "aiecyrillic",
  6711. 0x04d5,
  6712. "aigujarati",
  6713. 0x0a90,
  6714. "aigurmukhi",
  6715. 0x0a10,
  6716. "aimatragurmukhi",
  6717. 0x0a48,
  6718. "ainarabic",
  6719. 0x0639,
  6720. "ainfinalarabic",
  6721. 0xfeca,
  6722. "aininitialarabic",
  6723. 0xfecb,
  6724. "ainmedialarabic",
  6725. 0xfecc,
  6726. "ainvertedbreve",
  6727. 0x0203,
  6728. "aivowelsignbengali",
  6729. 0x09c8,
  6730. "aivowelsigndeva",
  6731. 0x0948,
  6732. "aivowelsigngujarati",
  6733. 0x0ac8,
  6734. "akatakana",
  6735. 0x30a2,
  6736. "akatakanahalfwidth",
  6737. 0xff71,
  6738. "akorean",
  6739. 0x314f,
  6740. "alef",
  6741. 0x05d0,
  6742. "alefarabic",
  6743. 0x0627,
  6744. "alefdageshhebrew",
  6745. 0xfb30,
  6746. "aleffinalarabic",
  6747. 0xfe8e,
  6748. "alefhamzaabovearabic",
  6749. 0x0623,
  6750. "alefhamzaabovefinalarabic",
  6751. 0xfe84,
  6752. "alefhamzabelowarabic",
  6753. 0x0625,
  6754. "alefhamzabelowfinalarabic",
  6755. 0xfe88,
  6756. "alefhebrew",
  6757. 0x05d0,
  6758. "aleflamedhebrew",
  6759. 0xfb4f,
  6760. "alefmaddaabovearabic",
  6761. 0x0622,
  6762. "alefmaddaabovefinalarabic",
  6763. 0xfe82,
  6764. "alefmaksuraarabic",
  6765. 0x0649,
  6766. "alefmaksurafinalarabic",
  6767. 0xfef0,
  6768. "alefmaksurainitialarabic",
  6769. 0xfef3,
  6770. "alefmaksuramedialarabic",
  6771. 0xfef4,
  6772. "alefpatahhebrew",
  6773. 0xfb2e,
  6774. "alefqamatshebrew",
  6775. 0xfb2f,
  6776. "aleph",
  6777. 0x2135,
  6778. "allequal",
  6779. 0x224c,
  6780. "alpha",
  6781. 0x03b1,
  6782. "alphatonos",
  6783. 0x03ac,
  6784. "amacron",
  6785. 0x0101,
  6786. "amonospace",
  6787. 0xff41,
  6788. "ampersand",
  6789. 0x0026,
  6790. "ampersandmonospace",
  6791. 0xff06,
  6792. "ampersandsmall",
  6793. 0xf726,
  6794. "amsquare",
  6795. 0x33c2,
  6796. "anbopomofo",
  6797. 0x3122,
  6798. "angbopomofo",
  6799. 0x3124,
  6800. "angbracketleft",
  6801. 0x3008,
  6802. "angbracketright",
  6803. 0x3009,
  6804. "angkhankhuthai",
  6805. 0x0e5a,
  6806. "angle",
  6807. 0x2220,
  6808. "anglebracketleft",
  6809. 0x3008,
  6810. "anglebracketleftvertical",
  6811. 0xfe3f,
  6812. "anglebracketright",
  6813. 0x3009,
  6814. "anglebracketrightvertical",
  6815. 0xfe40,
  6816. "angleleft",
  6817. 0x2329,
  6818. "angleright",
  6819. 0x232a,
  6820. "angstrom",
  6821. 0x212b,
  6822. "anoteleia",
  6823. 0x0387,
  6824. "anudattadeva",
  6825. 0x0952,
  6826. "anusvarabengali",
  6827. 0x0982,
  6828. "anusvaradeva",
  6829. 0x0902,
  6830. "anusvaragujarati",
  6831. 0x0a82,
  6832. "aogonek",
  6833. 0x0105,
  6834. "apaatosquare",
  6835. 0x3300,
  6836. "aparen",
  6837. 0x249c,
  6838. "apostrophearmenian",
  6839. 0x055a,
  6840. "apostrophemod",
  6841. 0x02bc,
  6842. "apple",
  6843. 0xf8ff,
  6844. "approaches",
  6845. 0x2250,
  6846. "approxequal",
  6847. 0x2248,
  6848. "approxequalorimage",
  6849. 0x2252,
  6850. "approximatelyequal",
  6851. 0x2245,
  6852. "araeaekorean",
  6853. 0x318e,
  6854. "araeakorean",
  6855. 0x318d,
  6856. "arc",
  6857. 0x2312,
  6858. "arighthalfring",
  6859. 0x1e9a,
  6860. "aring",
  6861. 0x00e5,
  6862. "aringacute",
  6863. 0x01fb,
  6864. "aringbelow",
  6865. 0x1e01,
  6866. "arrowboth",
  6867. 0x2194,
  6868. "arrowdashdown",
  6869. 0x21e3,
  6870. "arrowdashleft",
  6871. 0x21e0,
  6872. "arrowdashright",
  6873. 0x21e2,
  6874. "arrowdashup",
  6875. 0x21e1,
  6876. "arrowdblboth",
  6877. 0x21d4,
  6878. "arrowdbldown",
  6879. 0x21d3,
  6880. "arrowdblleft",
  6881. 0x21d0,
  6882. "arrowdblright",
  6883. 0x21d2,
  6884. "arrowdblup",
  6885. 0x21d1,
  6886. "arrowdown",
  6887. 0x2193,
  6888. "arrowdownleft",
  6889. 0x2199,
  6890. "arrowdownright",
  6891. 0x2198,
  6892. "arrowdownwhite",
  6893. 0x21e9,
  6894. "arrowheaddownmod",
  6895. 0x02c5,
  6896. "arrowheadleftmod",
  6897. 0x02c2,
  6898. "arrowheadrightmod",
  6899. 0x02c3,
  6900. "arrowheadupmod",
  6901. 0x02c4,
  6902. "arrowhorizex",
  6903. 0xf8e7,
  6904. "arrowleft",
  6905. 0x2190,
  6906. "arrowleftdbl",
  6907. 0x21d0,
  6908. "arrowleftdblstroke",
  6909. 0x21cd,
  6910. "arrowleftoverright",
  6911. 0x21c6,
  6912. "arrowleftwhite",
  6913. 0x21e6,
  6914. "arrowright",
  6915. 0x2192,
  6916. "arrowrightdblstroke",
  6917. 0x21cf,
  6918. "arrowrightheavy",
  6919. 0x279e,
  6920. "arrowrightoverleft",
  6921. 0x21c4,
  6922. "arrowrightwhite",
  6923. 0x21e8,
  6924. "arrowtableft",
  6925. 0x21e4,
  6926. "arrowtabright",
  6927. 0x21e5,
  6928. "arrowup",
  6929. 0x2191,
  6930. "arrowupdn",
  6931. 0x2195,
  6932. "arrowupdnbse",
  6933. 0x21a8,
  6934. "arrowupdownbase",
  6935. 0x21a8,
  6936. "arrowupleft",
  6937. 0x2196,
  6938. "arrowupleftofdown",
  6939. 0x21c5,
  6940. "arrowupright",
  6941. 0x2197,
  6942. "arrowupwhite",
  6943. 0x21e7,
  6944. "arrowvertex",
  6945. 0xf8e6,
  6946. "asciicircum",
  6947. 0x005e,
  6948. "asciicircummonospace",
  6949. 0xff3e,
  6950. "asciitilde",
  6951. 0x007e,
  6952. "asciitildemonospace",
  6953. 0xff5e,
  6954. "ascript",
  6955. 0x0251,
  6956. "ascriptturned",
  6957. 0x0252,
  6958. "asmallhiragana",
  6959. 0x3041,
  6960. "asmallkatakana",
  6961. 0x30a1,
  6962. "asmallkatakanahalfwidth",
  6963. 0xff67,
  6964. "asterisk",
  6965. 0x002a,
  6966. "asteriskaltonearabic",
  6967. 0x066d,
  6968. "asteriskarabic",
  6969. 0x066d,
  6970. "asteriskmath",
  6971. 0x2217,
  6972. "asteriskmonospace",
  6973. 0xff0a,
  6974. "asterisksmall",
  6975. 0xfe61,
  6976. "asterism",
  6977. 0x2042,
  6978. "asuperior",
  6979. 0xf6e9,
  6980. "asymptoticallyequal",
  6981. 0x2243,
  6982. "at",
  6983. 0x0040,
  6984. "atilde",
  6985. 0x00e3,
  6986. "atmonospace",
  6987. 0xff20,
  6988. "atsmall",
  6989. 0xfe6b,
  6990. "aturned",
  6991. 0x0250,
  6992. "aubengali",
  6993. 0x0994,
  6994. "aubopomofo",
  6995. 0x3120,
  6996. "audeva",
  6997. 0x0914,
  6998. "augujarati",
  6999. 0x0a94,
  7000. "augurmukhi",
  7001. 0x0a14,
  7002. "aulengthmarkbengali",
  7003. 0x09d7,
  7004. "aumatragurmukhi",
  7005. 0x0a4c,
  7006. "auvowelsignbengali",
  7007. 0x09cc,
  7008. "auvowelsigndeva",
  7009. 0x094c,
  7010. "auvowelsigngujarati",
  7011. 0x0acc,
  7012. "avagrahadeva",
  7013. 0x093d,
  7014. "aybarmenian",
  7015. 0x0561,
  7016. "ayin",
  7017. 0x05e2,
  7018. "ayinaltonehebrew",
  7019. 0xfb20,
  7020. "ayinhebrew",
  7021. 0x05e2,
  7022. "b",
  7023. 0x0062,
  7024. "babengali",
  7025. 0x09ac,
  7026. "backslash",
  7027. 0x005c,
  7028. "backslashmonospace",
  7029. 0xff3c,
  7030. "badeva",
  7031. 0x092c,
  7032. "bagujarati",
  7033. 0x0aac,
  7034. "bagurmukhi",
  7035. 0x0a2c,
  7036. "bahiragana",
  7037. 0x3070,
  7038. "bahtthai",
  7039. 0x0e3f,
  7040. "bakatakana",
  7041. 0x30d0,
  7042. "bar",
  7043. 0x007c,
  7044. "barmonospace",
  7045. 0xff5c,
  7046. "bbopomofo",
  7047. 0x3105,
  7048. "bcircle",
  7049. 0x24d1,
  7050. "bdotaccent",
  7051. 0x1e03,
  7052. "bdotbelow",
  7053. 0x1e05,
  7054. "beamedsixteenthnotes",
  7055. 0x266c,
  7056. "because",
  7057. 0x2235,
  7058. "becyrillic",
  7059. 0x0431,
  7060. "beharabic",
  7061. 0x0628,
  7062. "behfinalarabic",
  7063. 0xfe90,
  7064. "behinitialarabic",
  7065. 0xfe91,
  7066. "behiragana",
  7067. 0x3079,
  7068. "behmedialarabic",
  7069. 0xfe92,
  7070. "behmeeminitialarabic",
  7071. 0xfc9f,
  7072. "behmeemisolatedarabic",
  7073. 0xfc08,
  7074. "behnoonfinalarabic",
  7075. 0xfc6d,
  7076. "bekatakana",
  7077. 0x30d9,
  7078. "benarmenian",
  7079. 0x0562,
  7080. "bet",
  7081. 0x05d1,
  7082. "beta",
  7083. 0x03b2,
  7084. "betasymbolgreek",
  7085. 0x03d0,
  7086. "betdagesh",
  7087. 0xfb31,
  7088. "betdageshhebrew",
  7089. 0xfb31,
  7090. "bethebrew",
  7091. 0x05d1,
  7092. "betrafehebrew",
  7093. 0xfb4c,
  7094. "bhabengali",
  7095. 0x09ad,
  7096. "bhadeva",
  7097. 0x092d,
  7098. "bhagujarati",
  7099. 0x0aad,
  7100. "bhagurmukhi",
  7101. 0x0a2d,
  7102. "bhook",
  7103. 0x0253,
  7104. "bihiragana",
  7105. 0x3073,
  7106. "bikatakana",
  7107. 0x30d3,
  7108. "bilabialclick",
  7109. 0x0298,
  7110. "bindigurmukhi",
  7111. 0x0a02,
  7112. "birusquare",
  7113. 0x3331,
  7114. "blackcircle",
  7115. 0x25cf,
  7116. "blackdiamond",
  7117. 0x25c6,
  7118. "blackdownpointingtriangle",
  7119. 0x25bc,
  7120. "blackleftpointingpointer",
  7121. 0x25c4,
  7122. "blackleftpointingtriangle",
  7123. 0x25c0,
  7124. "blacklenticularbracketleft",
  7125. 0x3010,
  7126. "blacklenticularbracketleftvertical",
  7127. 0xfe3b,
  7128. "blacklenticularbracketright",
  7129. 0x3011,
  7130. "blacklenticularbracketrightvertical",
  7131. 0xfe3c,
  7132. "blacklowerlefttriangle",
  7133. 0x25e3,
  7134. "blacklowerrighttriangle",
  7135. 0x25e2,
  7136. "blackrectangle",
  7137. 0x25ac,
  7138. "blackrightpointingpointer",
  7139. 0x25ba,
  7140. "blackrightpointingtriangle",
  7141. 0x25b6,
  7142. "blacksmallsquare",
  7143. 0x25aa,
  7144. "blacksmilingface",
  7145. 0x263b,
  7146. "blacksquare",
  7147. 0x25a0,
  7148. "blackstar",
  7149. 0x2605,
  7150. "blackupperlefttriangle",
  7151. 0x25e4,
  7152. "blackupperrighttriangle",
  7153. 0x25e5,
  7154. "blackuppointingsmalltriangle",
  7155. 0x25b4,
  7156. "blackuppointingtriangle",
  7157. 0x25b2,
  7158. "blank",
  7159. 0x2423,
  7160. "blinebelow",
  7161. 0x1e07,
  7162. "block",
  7163. 0x2588,
  7164. "bmonospace",
  7165. 0xff42,
  7166. "bobaimaithai",
  7167. 0x0e1a,
  7168. "bohiragana",
  7169. 0x307c,
  7170. "bokatakana",
  7171. 0x30dc,
  7172. "bparen",
  7173. 0x249d,
  7174. "bqsquare",
  7175. 0x33c3,
  7176. "braceex",
  7177. 0xf8f4,
  7178. "braceleft",
  7179. 0x007b,
  7180. "braceleftbt",
  7181. 0xf8f3,
  7182. "braceleftmid",
  7183. 0xf8f2,
  7184. "braceleftmonospace",
  7185. 0xff5b,
  7186. "braceleftsmall",
  7187. 0xfe5b,
  7188. "bracelefttp",
  7189. 0xf8f1,
  7190. "braceleftvertical",
  7191. 0xfe37,
  7192. "braceright",
  7193. 0x007d,
  7194. "bracerightbt",
  7195. 0xf8fe,
  7196. "bracerightmid",
  7197. 0xf8fd,
  7198. "bracerightmonospace",
  7199. 0xff5d,
  7200. "bracerightsmall",
  7201. 0xfe5c,
  7202. "bracerighttp",
  7203. 0xf8fc,
  7204. "bracerightvertical",
  7205. 0xfe38,
  7206. "bracketleft",
  7207. 0x005b,
  7208. "bracketleftbt",
  7209. 0xf8f0,
  7210. "bracketleftex",
  7211. 0xf8ef,
  7212. "bracketleftmonospace",
  7213. 0xff3b,
  7214. "bracketlefttp",
  7215. 0xf8ee,
  7216. "bracketright",
  7217. 0x005d,
  7218. "bracketrightbt",
  7219. 0xf8fb,
  7220. "bracketrightex",
  7221. 0xf8fa,
  7222. "bracketrightmonospace",
  7223. 0xff3d,
  7224. "bracketrighttp",
  7225. 0xf8f9,
  7226. "breve",
  7227. 0x02d8,
  7228. "brevebelowcmb",
  7229. 0x032e,
  7230. "brevecmb",
  7231. 0x0306,
  7232. "breveinvertedbelowcmb",
  7233. 0x032f,
  7234. "breveinvertedcmb",
  7235. 0x0311,
  7236. "breveinverteddoublecmb",
  7237. 0x0361,
  7238. "bridgebelowcmb",
  7239. 0x032a,
  7240. "bridgeinvertedbelowcmb",
  7241. 0x033a,
  7242. "brokenbar",
  7243. 0x00a6,
  7244. "bstroke",
  7245. 0x0180,
  7246. "bsuperior",
  7247. 0xf6ea,
  7248. "btopbar",
  7249. 0x0183,
  7250. "buhiragana",
  7251. 0x3076,
  7252. "bukatakana",
  7253. 0x30d6,
  7254. "bullet",
  7255. 0x2022,
  7256. "bulletinverse",
  7257. 0x25d8,
  7258. "bulletoperator",
  7259. 0x2219,
  7260. "bullseye",
  7261. 0x25ce,
  7262. "c",
  7263. 0x0063,
  7264. "caarmenian",
  7265. 0x056e,
  7266. "cabengali",
  7267. 0x099a,
  7268. "cacute",
  7269. 0x0107,
  7270. "cadeva",
  7271. 0x091a,
  7272. "cagujarati",
  7273. 0x0a9a,
  7274. "cagurmukhi",
  7275. 0x0a1a,
  7276. "calsquare",
  7277. 0x3388,
  7278. "candrabindubengali",
  7279. 0x0981,
  7280. "candrabinducmb",
  7281. 0x0310,
  7282. "candrabindudeva",
  7283. 0x0901,
  7284. "candrabindugujarati",
  7285. 0x0a81,
  7286. "capslock",
  7287. 0x21ea,
  7288. "careof",
  7289. 0x2105,
  7290. "caron",
  7291. 0x02c7,
  7292. "caronbelowcmb",
  7293. 0x032c,
  7294. "caroncmb",
  7295. 0x030c,
  7296. "carriagereturn",
  7297. 0x21b5,
  7298. "cbopomofo",
  7299. 0x3118,
  7300. "ccaron",
  7301. 0x010d,
  7302. "ccedilla",
  7303. 0x00e7,
  7304. "ccedillaacute",
  7305. 0x1e09,
  7306. "ccircle",
  7307. 0x24d2,
  7308. "ccircumflex",
  7309. 0x0109,
  7310. "ccurl",
  7311. 0x0255,
  7312. "cdot",
  7313. 0x010b,
  7314. "cdotaccent",
  7315. 0x010b,
  7316. "cdsquare",
  7317. 0x33c5,
  7318. "cedilla",
  7319. 0x00b8,
  7320. "cedillacmb",
  7321. 0x0327,
  7322. "cent",
  7323. 0x00a2,
  7324. "centigrade",
  7325. 0x2103,
  7326. "centinferior",
  7327. 0xf6df,
  7328. "centmonospace",
  7329. 0xffe0,
  7330. "centoldstyle",
  7331. 0xf7a2,
  7332. "centsuperior",
  7333. 0xf6e0,
  7334. "chaarmenian",
  7335. 0x0579,
  7336. "chabengali",
  7337. 0x099b,
  7338. "chadeva",
  7339. 0x091b,
  7340. "chagujarati",
  7341. 0x0a9b,
  7342. "chagurmukhi",
  7343. 0x0a1b,
  7344. "chbopomofo",
  7345. 0x3114,
  7346. "cheabkhasiancyrillic",
  7347. 0x04bd,
  7348. "checkmark",
  7349. 0x2713,
  7350. "checyrillic",
  7351. 0x0447,
  7352. "chedescenderabkhasiancyrillic",
  7353. 0x04bf,
  7354. "chedescendercyrillic",
  7355. 0x04b7,
  7356. "chedieresiscyrillic",
  7357. 0x04f5,
  7358. "cheharmenian",
  7359. 0x0573,
  7360. "chekhakassiancyrillic",
  7361. 0x04cc,
  7362. "cheverticalstrokecyrillic",
  7363. 0x04b9,
  7364. "chi",
  7365. 0x03c7,
  7366. "chieuchacirclekorean",
  7367. 0x3277,
  7368. "chieuchaparenkorean",
  7369. 0x3217,
  7370. "chieuchcirclekorean",
  7371. 0x3269,
  7372. "chieuchkorean",
  7373. 0x314a,
  7374. "chieuchparenkorean",
  7375. 0x3209,
  7376. "chochangthai",
  7377. 0x0e0a,
  7378. "chochanthai",
  7379. 0x0e08,
  7380. "chochingthai",
  7381. 0x0e09,
  7382. "chochoethai",
  7383. 0x0e0c,
  7384. "chook",
  7385. 0x0188,
  7386. "cieucacirclekorean",
  7387. 0x3276,
  7388. "cieucaparenkorean",
  7389. 0x3216,
  7390. "cieuccirclekorean",
  7391. 0x3268,
  7392. "cieuckorean",
  7393. 0x3148,
  7394. "cieucparenkorean",
  7395. 0x3208,
  7396. "cieucuparenkorean",
  7397. 0x321c,
  7398. "circle",
  7399. 0x25cb,
  7400. "circlecopyrt",
  7401. 0x00a9,
  7402. "circlemultiply",
  7403. 0x2297,
  7404. "circleot",
  7405. 0x2299,
  7406. "circleplus",
  7407. 0x2295,
  7408. "circlepostalmark",
  7409. 0x3036,
  7410. "circlewithlefthalfblack",
  7411. 0x25d0,
  7412. "circlewithrighthalfblack",
  7413. 0x25d1,
  7414. "circumflex",
  7415. 0x02c6,
  7416. "circumflexbelowcmb",
  7417. 0x032d,
  7418. "circumflexcmb",
  7419. 0x0302,
  7420. "clear",
  7421. 0x2327,
  7422. "clickalveolar",
  7423. 0x01c2,
  7424. "clickdental",
  7425. 0x01c0,
  7426. "clicklateral",
  7427. 0x01c1,
  7428. "clickretroflex",
  7429. 0x01c3,
  7430. "club",
  7431. 0x2663,
  7432. "clubsuitblack",
  7433. 0x2663,
  7434. "clubsuitwhite",
  7435. 0x2667,
  7436. "cmcubedsquare",
  7437. 0x33a4,
  7438. "cmonospace",
  7439. 0xff43,
  7440. "cmsquaredsquare",
  7441. 0x33a0,
  7442. "coarmenian",
  7443. 0x0581,
  7444. "colon",
  7445. 0x003a,
  7446. "colonmonetary",
  7447. 0x20a1,
  7448. "colonmonospace",
  7449. 0xff1a,
  7450. "colonsign",
  7451. 0x20a1,
  7452. "colonsmall",
  7453. 0xfe55,
  7454. "colontriangularhalfmod",
  7455. 0x02d1,
  7456. "colontriangularmod",
  7457. 0x02d0,
  7458. "comma",
  7459. 0x002c,
  7460. "commaabovecmb",
  7461. 0x0313,
  7462. "commaaboverightcmb",
  7463. 0x0315,
  7464. "commaaccent",
  7465. 0xf6c3,
  7466. "commaarabic",
  7467. 0x060c,
  7468. "commaarmenian",
  7469. 0x055d,
  7470. "commainferior",
  7471. 0xf6e1,
  7472. "commamonospace",
  7473. 0xff0c,
  7474. "commareversedabovecmb",
  7475. 0x0314,
  7476. "commareversedmod",
  7477. 0x02bd,
  7478. "commasmall",
  7479. 0xfe50,
  7480. "commasuperior",
  7481. 0xf6e2,
  7482. "commaturnedabovecmb",
  7483. 0x0312,
  7484. "commaturnedmod",
  7485. 0x02bb,
  7486. "compass",
  7487. 0x263c,
  7488. "congruent",
  7489. 0x2245,
  7490. "contourintegral",
  7491. 0x222e,
  7492. "control",
  7493. 0x2303,
  7494. "controlACK",
  7495. 0x0006,
  7496. "controlBEL",
  7497. 0x0007,
  7498. "controlBS",
  7499. 0x0008,
  7500. "controlCAN",
  7501. 0x0018,
  7502. "controlCR",
  7503. 0x000d,
  7504. "controlDC1",
  7505. 0x0011,
  7506. "controlDC2",
  7507. 0x0012,
  7508. "controlDC3",
  7509. 0x0013,
  7510. "controlDC4",
  7511. 0x0014,
  7512. "controlDEL",
  7513. 0x007f,
  7514. "controlDLE",
  7515. 0x0010,
  7516. "controlEM",
  7517. 0x0019,
  7518. "controlENQ",
  7519. 0x0005,
  7520. "controlEOT",
  7521. 0x0004,
  7522. "controlESC",
  7523. 0x001b,
  7524. "controlETB",
  7525. 0x0017,
  7526. "controlETX",
  7527. 0x0003,
  7528. "controlFF",
  7529. 0x000c,
  7530. "controlFS",
  7531. 0x001c,
  7532. "controlGS",
  7533. 0x001d,
  7534. "controlHT",
  7535. 0x0009,
  7536. "controlLF",
  7537. 0x000a,
  7538. "controlNAK",
  7539. 0x0015,
  7540. "controlNULL",
  7541. 0x0000,
  7542. "controlRS",
  7543. 0x001e,
  7544. "controlSI",
  7545. 0x000f,
  7546. "controlSO",
  7547. 0x000e,
  7548. "controlSOT",
  7549. 0x0002,
  7550. "controlSTX",
  7551. 0x0001,
  7552. "controlSUB",
  7553. 0x001a,
  7554. "controlSYN",
  7555. 0x0016,
  7556. "controlUS",
  7557. 0x001f,
  7558. "controlVT",
  7559. 0x000b,
  7560. "copyright",
  7561. 0x00a9,
  7562. "copyrightsans",
  7563. 0xf8e9,
  7564. "copyrightserif",
  7565. 0xf6d9,
  7566. "cornerbracketleft",
  7567. 0x300c,
  7568. "cornerbracketlefthalfwidth",
  7569. 0xff62,
  7570. "cornerbracketleftvertical",
  7571. 0xfe41,
  7572. "cornerbracketright",
  7573. 0x300d,
  7574. "cornerbracketrighthalfwidth",
  7575. 0xff63,
  7576. "cornerbracketrightvertical",
  7577. 0xfe42,
  7578. "corporationsquare",
  7579. 0x337f,
  7580. "cosquare",
  7581. 0x33c7,
  7582. "coverkgsquare",
  7583. 0x33c6,
  7584. "cparen",
  7585. 0x249e,
  7586. "cruzeiro",
  7587. 0x20a2,
  7588. "cstretched",
  7589. 0x0297,
  7590. "curlyand",
  7591. 0x22cf,
  7592. "curlyor",
  7593. 0x22ce,
  7594. "currency",
  7595. 0x00a4,
  7596. "cyrBreve",
  7597. 0xf6d1,
  7598. "cyrFlex",
  7599. 0xf6d2,
  7600. "cyrbreve",
  7601. 0xf6d4,
  7602. "cyrflex",
  7603. 0xf6d5,
  7604. "d",
  7605. 0x0064,
  7606. "daarmenian",
  7607. 0x0564,
  7608. "dabengali",
  7609. 0x09a6,
  7610. "dadarabic",
  7611. 0x0636,
  7612. "dadeva",
  7613. 0x0926,
  7614. "dadfinalarabic",
  7615. 0xfebe,
  7616. "dadinitialarabic",
  7617. 0xfebf,
  7618. "dadmedialarabic",
  7619. 0xfec0,
  7620. "dagesh",
  7621. 0x05bc,
  7622. "dageshhebrew",
  7623. 0x05bc,
  7624. "dagger",
  7625. 0x2020,
  7626. "daggerdbl",
  7627. 0x2021,
  7628. "dagujarati",
  7629. 0x0aa6,
  7630. "dagurmukhi",
  7631. 0x0a26,
  7632. "dahiragana",
  7633. 0x3060,
  7634. "dakatakana",
  7635. 0x30c0,
  7636. "dalarabic",
  7637. 0x062f,
  7638. "dalet",
  7639. 0x05d3,
  7640. "daletdagesh",
  7641. 0xfb33,
  7642. "daletdageshhebrew",
  7643. 0xfb33,
  7644. "dalethebrew",
  7645. 0x05d3,
  7646. "dalfinalarabic",
  7647. 0xfeaa,
  7648. "dammaarabic",
  7649. 0x064f,
  7650. "dammalowarabic",
  7651. 0x064f,
  7652. "dammatanaltonearabic",
  7653. 0x064c,
  7654. "dammatanarabic",
  7655. 0x064c,
  7656. "danda",
  7657. 0x0964,
  7658. "dargahebrew",
  7659. 0x05a7,
  7660. "dargalefthebrew",
  7661. 0x05a7,
  7662. "dasiapneumatacyrilliccmb",
  7663. 0x0485,
  7664. "dblGrave",
  7665. 0xf6d3,
  7666. "dblanglebracketleft",
  7667. 0x300a,
  7668. "dblanglebracketleftvertical",
  7669. 0xfe3d,
  7670. "dblanglebracketright",
  7671. 0x300b,
  7672. "dblanglebracketrightvertical",
  7673. 0xfe3e,
  7674. "dblarchinvertedbelowcmb",
  7675. 0x032b,
  7676. "dblarrowleft",
  7677. 0x21d4,
  7678. "dblarrowright",
  7679. 0x21d2,
  7680. "dbldanda",
  7681. 0x0965,
  7682. "dblgrave",
  7683. 0xf6d6,
  7684. "dblgravecmb",
  7685. 0x030f,
  7686. "dblintegral",
  7687. 0x222c,
  7688. "dbllowline",
  7689. 0x2017,
  7690. "dbllowlinecmb",
  7691. 0x0333,
  7692. "dbloverlinecmb",
  7693. 0x033f,
  7694. "dblprimemod",
  7695. 0x02ba,
  7696. "dblverticalbar",
  7697. 0x2016,
  7698. "dblverticallineabovecmb",
  7699. 0x030e,
  7700. "dbopomofo",
  7701. 0x3109,
  7702. "dbsquare",
  7703. 0x33c8,
  7704. "dcaron",
  7705. 0x010f,
  7706. "dcedilla",
  7707. 0x1e11,
  7708. "dcircle",
  7709. 0x24d3,
  7710. "dcircumflexbelow",
  7711. 0x1e13,
  7712. "dcroat",
  7713. 0x0111,
  7714. "ddabengali",
  7715. 0x09a1,
  7716. "ddadeva",
  7717. 0x0921,
  7718. "ddagujarati",
  7719. 0x0aa1,
  7720. "ddagurmukhi",
  7721. 0x0a21,
  7722. "ddalarabic",
  7723. 0x0688,
  7724. "ddalfinalarabic",
  7725. 0xfb89,
  7726. "dddhadeva",
  7727. 0x095c,
  7728. "ddhabengali",
  7729. 0x09a2,
  7730. "ddhadeva",
  7731. 0x0922,
  7732. "ddhagujarati",
  7733. 0x0aa2,
  7734. "ddhagurmukhi",
  7735. 0x0a22,
  7736. "ddotaccent",
  7737. 0x1e0b,
  7738. "ddotbelow",
  7739. 0x1e0d,
  7740. "decimalseparatorarabic",
  7741. 0x066b,
  7742. "decimalseparatorpersian",
  7743. 0x066b,
  7744. "decyrillic",
  7745. 0x0434,
  7746. "degree",
  7747. 0x00b0,
  7748. "dehihebrew",
  7749. 0x05ad,
  7750. "dehiragana",
  7751. 0x3067,
  7752. "deicoptic",
  7753. 0x03ef,
  7754. "dekatakana",
  7755. 0x30c7,
  7756. "deleteleft",
  7757. 0x232b,
  7758. "deleteright",
  7759. 0x2326,
  7760. "delta",
  7761. 0x03b4,
  7762. "deltaturned",
  7763. 0x018d,
  7764. "denominatorminusonenumeratorbengali",
  7765. 0x09f8,
  7766. "dezh",
  7767. 0x02a4,
  7768. "dhabengali",
  7769. 0x09a7,
  7770. "dhadeva",
  7771. 0x0927,
  7772. "dhagujarati",
  7773. 0x0aa7,
  7774. "dhagurmukhi",
  7775. 0x0a27,
  7776. "dhook",
  7777. 0x0257,
  7778. "dialytikatonos",
  7779. 0x0385,
  7780. "dialytikatonoscmb",
  7781. 0x0344,
  7782. "diamond",
  7783. 0x2666,
  7784. "diamondsuitwhite",
  7785. 0x2662,
  7786. "dieresis",
  7787. 0x00a8,
  7788. "dieresisacute",
  7789. 0xf6d7,
  7790. "dieresisbelowcmb",
  7791. 0x0324,
  7792. "dieresiscmb",
  7793. 0x0308,
  7794. "dieresisgrave",
  7795. 0xf6d8,
  7796. "dieresistonos",
  7797. 0x0385,
  7798. "dihiragana",
  7799. 0x3062,
  7800. "dikatakana",
  7801. 0x30c2,
  7802. "dittomark",
  7803. 0x3003,
  7804. "divide",
  7805. 0x00f7,
  7806. "divides",
  7807. 0x2223,
  7808. "divisionslash",
  7809. 0x2215,
  7810. "djecyrillic",
  7811. 0x0452,
  7812. "dkshade",
  7813. 0x2593,
  7814. "dlinebelow",
  7815. 0x1e0f,
  7816. "dlsquare",
  7817. 0x3397,
  7818. "dmacron",
  7819. 0x0111,
  7820. "dmonospace",
  7821. 0xff44,
  7822. "dnblock",
  7823. 0x2584,
  7824. "dochadathai",
  7825. 0x0e0e,
  7826. "dodekthai",
  7827. 0x0e14,
  7828. "dohiragana",
  7829. 0x3069,
  7830. "dokatakana",
  7831. 0x30c9,
  7832. "dollar",
  7833. 0x0024,
  7834. "dollarinferior",
  7835. 0xf6e3,
  7836. "dollarmonospace",
  7837. 0xff04,
  7838. "dollaroldstyle",
  7839. 0xf724,
  7840. "dollarsmall",
  7841. 0xfe69,
  7842. "dollarsuperior",
  7843. 0xf6e4,
  7844. "dong",
  7845. 0x20ab,
  7846. "dorusquare",
  7847. 0x3326,
  7848. "dotaccent",
  7849. 0x02d9,
  7850. "dotaccentcmb",
  7851. 0x0307,
  7852. "dotbelowcmb",
  7853. 0x0323,
  7854. "dotbelowcomb",
  7855. 0x0323,
  7856. "dotkatakana",
  7857. 0x30fb,
  7858. "dotlessi",
  7859. 0x0131,
  7860. "dotlessj",
  7861. 0xf6be,
  7862. "dotlessjstrokehook",
  7863. 0x0284,
  7864. "dotmath",
  7865. 0x22c5,
  7866. "dottedcircle",
  7867. 0x25cc,
  7868. "doubleyodpatah",
  7869. 0xfb1f,
  7870. "doubleyodpatahhebrew",
  7871. 0xfb1f,
  7872. "downtackbelowcmb",
  7873. 0x031e,
  7874. "downtackmod",
  7875. 0x02d5,
  7876. "dparen",
  7877. 0x249f,
  7878. "dsuperior",
  7879. 0xf6eb,
  7880. "dtail",
  7881. 0x0256,
  7882. "dtopbar",
  7883. 0x018c,
  7884. "duhiragana",
  7885. 0x3065,
  7886. "dukatakana",
  7887. 0x30c5,
  7888. "dz",
  7889. 0x01f3,
  7890. "dzaltone",
  7891. 0x02a3,
  7892. "dzcaron",
  7893. 0x01c6,
  7894. "dzcurl",
  7895. 0x02a5,
  7896. "dzeabkhasiancyrillic",
  7897. 0x04e1,
  7898. "dzecyrillic",
  7899. 0x0455,
  7900. "dzhecyrillic",
  7901. 0x045f,
  7902. "e",
  7903. 0x0065,
  7904. "eacute",
  7905. 0x00e9,
  7906. "earth",
  7907. 0x2641,
  7908. "ebengali",
  7909. 0x098f,
  7910. "ebopomofo",
  7911. 0x311c,
  7912. "ebreve",
  7913. 0x0115,
  7914. "ecandradeva",
  7915. 0x090d,
  7916. "ecandragujarati",
  7917. 0x0a8d,
  7918. "ecandravowelsigndeva",
  7919. 0x0945,
  7920. "ecandravowelsigngujarati",
  7921. 0x0ac5,
  7922. "ecaron",
  7923. 0x011b,
  7924. "ecedillabreve",
  7925. 0x1e1d,
  7926. "echarmenian",
  7927. 0x0565,
  7928. "echyiwnarmenian",
  7929. 0x0587,
  7930. "ecircle",
  7931. 0x24d4,
  7932. "ecircumflex",
  7933. 0x00ea,
  7934. "ecircumflexacute",
  7935. 0x1ebf,
  7936. "ecircumflexbelow",
  7937. 0x1e19,
  7938. "ecircumflexdotbelow",
  7939. 0x1ec7,
  7940. "ecircumflexgrave",
  7941. 0x1ec1,
  7942. "ecircumflexhookabove",
  7943. 0x1ec3,
  7944. "ecircumflextilde",
  7945. 0x1ec5,
  7946. "ecyrillic",
  7947. 0x0454,
  7948. "edblgrave",
  7949. 0x0205,
  7950. "edeva",
  7951. 0x090f,
  7952. "edieresis",
  7953. 0x00eb,
  7954. "edot",
  7955. 0x0117,
  7956. "edotaccent",
  7957. 0x0117,
  7958. "edotbelow",
  7959. 0x1eb9,
  7960. "eegurmukhi",
  7961. 0x0a0f,
  7962. "eematragurmukhi",
  7963. 0x0a47,
  7964. "efcyrillic",
  7965. 0x0444,
  7966. "egrave",
  7967. 0x00e8,
  7968. "egujarati",
  7969. 0x0a8f,
  7970. "eharmenian",
  7971. 0x0567,
  7972. "ehbopomofo",
  7973. 0x311d,
  7974. "ehiragana",
  7975. 0x3048,
  7976. "ehookabove",
  7977. 0x1ebb,
  7978. "eibopomofo",
  7979. 0x311f,
  7980. "eight",
  7981. 0x0038,
  7982. "eightarabic",
  7983. 0x0668,
  7984. "eightbengali",
  7985. 0x09ee,
  7986. "eightcircle",
  7987. 0x2467,
  7988. "eightcircleinversesansserif",
  7989. 0x2791,
  7990. "eightdeva",
  7991. 0x096e,
  7992. "eighteencircle",
  7993. 0x2471,
  7994. "eighteenparen",
  7995. 0x2485,
  7996. "eighteenperiod",
  7997. 0x2499,
  7998. "eightgujarati",
  7999. 0x0aee,
  8000. "eightgurmukhi",
  8001. 0x0a6e,
  8002. "eighthackarabic",
  8003. 0x0668,
  8004. "eighthangzhou",
  8005. 0x3028,
  8006. "eighthnotebeamed",
  8007. 0x266b,
  8008. "eightideographicparen",
  8009. 0x3227,
  8010. "eightinferior",
  8011. 0x2088,
  8012. "eightmonospace",
  8013. 0xff18,
  8014. "eightoldstyle",
  8015. 0xf738,
  8016. "eightparen",
  8017. 0x247b,
  8018. "eightperiod",
  8019. 0x248f,
  8020. "eightpersian",
  8021. 0x06f8,
  8022. "eightroman",
  8023. 0x2177,
  8024. "eightsuperior",
  8025. 0x2078,
  8026. "eightthai",
  8027. 0x0e58,
  8028. "einvertedbreve",
  8029. 0x0207,
  8030. "eiotifiedcyrillic",
  8031. 0x0465,
  8032. "ekatakana",
  8033. 0x30a8,
  8034. "ekatakanahalfwidth",
  8035. 0xff74,
  8036. "ekonkargurmukhi",
  8037. 0x0a74,
  8038. "ekorean",
  8039. 0x3154,
  8040. "elcyrillic",
  8041. 0x043b,
  8042. "element",
  8043. 0x2208,
  8044. "elevencircle",
  8045. 0x246a,
  8046. "elevenparen",
  8047. 0x247e,
  8048. "elevenperiod",
  8049. 0x2492,
  8050. "elevenroman",
  8051. 0x217a,
  8052. "ellipsis",
  8053. 0x2026,
  8054. "ellipsisvertical",
  8055. 0x22ee,
  8056. "emacron",
  8057. 0x0113,
  8058. "emacronacute",
  8059. 0x1e17,
  8060. "emacrongrave",
  8061. 0x1e15,
  8062. "emcyrillic",
  8063. 0x043c,
  8064. "emdash",
  8065. 0x2014,
  8066. "emdashvertical",
  8067. 0xfe31,
  8068. "emonospace",
  8069. 0xff45,
  8070. "emphasismarkarmenian",
  8071. 0x055b,
  8072. "emptyset",
  8073. 0x2205,
  8074. "enbopomofo",
  8075. 0x3123,
  8076. "encyrillic",
  8077. 0x043d,
  8078. "endash",
  8079. 0x2013,
  8080. "endashvertical",
  8081. 0xfe32,
  8082. "endescendercyrillic",
  8083. 0x04a3,
  8084. "eng",
  8085. 0x014b,
  8086. "engbopomofo",
  8087. 0x3125,
  8088. "enghecyrillic",
  8089. 0x04a5,
  8090. "enhookcyrillic",
  8091. 0x04c8,
  8092. "enspace",
  8093. 0x2002,
  8094. "eogonek",
  8095. 0x0119,
  8096. "eokorean",
  8097. 0x3153,
  8098. "eopen",
  8099. 0x025b,
  8100. "eopenclosed",
  8101. 0x029a,
  8102. "eopenreversed",
  8103. 0x025c,
  8104. "eopenreversedclosed",
  8105. 0x025e,
  8106. "eopenreversedhook",
  8107. 0x025d,
  8108. "eparen",
  8109. 0x24a0,
  8110. "epsilon",
  8111. 0x03b5,
  8112. "epsilontonos",
  8113. 0x03ad,
  8114. "equal",
  8115. 0x003d,
  8116. "equalmonospace",
  8117. 0xff1d,
  8118. "equalsmall",
  8119. 0xfe66,
  8120. "equalsuperior",
  8121. 0x207c,
  8122. "equivalence",
  8123. 0x2261,
  8124. "erbopomofo",
  8125. 0x3126,
  8126. "ercyrillic",
  8127. 0x0440,
  8128. "ereversed",
  8129. 0x0258,
  8130. "ereversedcyrillic",
  8131. 0x044d,
  8132. "escyrillic",
  8133. 0x0441,
  8134. "esdescendercyrillic",
  8135. 0x04ab,
  8136. "esh",
  8137. 0x0283,
  8138. "eshcurl",
  8139. 0x0286,
  8140. "eshortdeva",
  8141. 0x090e,
  8142. "eshortvowelsigndeva",
  8143. 0x0946,
  8144. "eshreversedloop",
  8145. 0x01aa,
  8146. "eshsquatreversed",
  8147. 0x0285,
  8148. "esmallhiragana",
  8149. 0x3047,
  8150. "esmallkatakana",
  8151. 0x30a7,
  8152. "esmallkatakanahalfwidth",
  8153. 0xff6a,
  8154. "estimated",
  8155. 0x212e,
  8156. "esuperior",
  8157. 0xf6ec,
  8158. "eta",
  8159. 0x03b7,
  8160. "etarmenian",
  8161. 0x0568,
  8162. "etatonos",
  8163. 0x03ae,
  8164. "eth",
  8165. 0x00f0,
  8166. "etilde",
  8167. 0x1ebd,
  8168. "etildebelow",
  8169. 0x1e1b,
  8170. "etnahtafoukhhebrew",
  8171. 0x0591,
  8172. "etnahtafoukhlefthebrew",
  8173. 0x0591,
  8174. "etnahtahebrew",
  8175. 0x0591,
  8176. "etnahtalefthebrew",
  8177. 0x0591,
  8178. "eturned",
  8179. 0x01dd,
  8180. "eukorean",
  8181. 0x3161,
  8182. "euro",
  8183. 0x20ac,
  8184. "evowelsignbengali",
  8185. 0x09c7,
  8186. "evowelsigndeva",
  8187. 0x0947,
  8188. "evowelsigngujarati",
  8189. 0x0ac7,
  8190. "exclam",
  8191. 0x0021,
  8192. "exclamarmenian",
  8193. 0x055c,
  8194. "exclamdbl",
  8195. 0x203c,
  8196. "exclamdown",
  8197. 0x00a1,
  8198. "exclamdownsmall",
  8199. 0xf7a1,
  8200. "exclammonospace",
  8201. 0xff01,
  8202. "exclamsmall",
  8203. 0xf721,
  8204. "existential",
  8205. 0x2203,
  8206. "ezh",
  8207. 0x0292,
  8208. "ezhcaron",
  8209. 0x01ef,
  8210. "ezhcurl",
  8211. 0x0293,
  8212. "ezhreversed",
  8213. 0x01b9,
  8214. "ezhtail",
  8215. 0x01ba,
  8216. "f",
  8217. 0x0066,
  8218. "fadeva",
  8219. 0x095e,
  8220. "fagurmukhi",
  8221. 0x0a5e,
  8222. "fahrenheit",
  8223. 0x2109,
  8224. "fathaarabic",
  8225. 0x064e,
  8226. "fathalowarabic",
  8227. 0x064e,
  8228. "fathatanarabic",
  8229. 0x064b,
  8230. "fbopomofo",
  8231. 0x3108,
  8232. "fcircle",
  8233. 0x24d5,
  8234. "fdotaccent",
  8235. 0x1e1f,
  8236. "feharabic",
  8237. 0x0641,
  8238. "feharmenian",
  8239. 0x0586,
  8240. "fehfinalarabic",
  8241. 0xfed2,
  8242. "fehinitialarabic",
  8243. 0xfed3,
  8244. "fehmedialarabic",
  8245. 0xfed4,
  8246. "feicoptic",
  8247. 0x03e5,
  8248. "female",
  8249. 0x2640,
  8250. "ff",
  8251. 0xfb00,
  8252. "f_f",
  8253. 0xfb00,
  8254. "ffi",
  8255. 0xfb03,
  8256. "ffl",
  8257. 0xfb04,
  8258. "fi",
  8259. 0xfb01,
  8260. "fifteencircle",
  8261. 0x246e,
  8262. "fifteenparen",
  8263. 0x2482,
  8264. "fifteenperiod",
  8265. 0x2496,
  8266. "figuredash",
  8267. 0x2012,
  8268. "filledbox",
  8269. 0x25a0,
  8270. "filledrect",
  8271. 0x25ac,
  8272. "finalkaf",
  8273. 0x05da,
  8274. "finalkafdagesh",
  8275. 0xfb3a,
  8276. "finalkafdageshhebrew",
  8277. 0xfb3a,
  8278. "finalkafhebrew",
  8279. 0x05da,
  8280. "finalmem",
  8281. 0x05dd,
  8282. "finalmemhebrew",
  8283. 0x05dd,
  8284. "finalnun",
  8285. 0x05df,
  8286. "finalnunhebrew",
  8287. 0x05df,
  8288. "finalpe",
  8289. 0x05e3,
  8290. "finalpehebrew",
  8291. 0x05e3,
  8292. "finaltsadi",
  8293. 0x05e5,
  8294. "finaltsadihebrew",
  8295. 0x05e5,
  8296. "firsttonechinese",
  8297. 0x02c9,
  8298. "fisheye",
  8299. 0x25c9,
  8300. "fitacyrillic",
  8301. 0x0473,
  8302. "five",
  8303. 0x0035,
  8304. "fivearabic",
  8305. 0x0665,
  8306. "fivebengali",
  8307. 0x09eb,
  8308. "fivecircle",
  8309. 0x2464,
  8310. "fivecircleinversesansserif",
  8311. 0x278e,
  8312. "fivedeva",
  8313. 0x096b,
  8314. "fiveeighths",
  8315. 0x215d,
  8316. "fivegujarati",
  8317. 0x0aeb,
  8318. "fivegurmukhi",
  8319. 0x0a6b,
  8320. "fivehackarabic",
  8321. 0x0665,
  8322. "fivehangzhou",
  8323. 0x3025,
  8324. "fiveideographicparen",
  8325. 0x3224,
  8326. "fiveinferior",
  8327. 0x2085,
  8328. "fivemonospace",
  8329. 0xff15,
  8330. "fiveoldstyle",
  8331. 0xf735,
  8332. "fiveparen",
  8333. 0x2478,
  8334. "fiveperiod",
  8335. 0x248c,
  8336. "fivepersian",
  8337. 0x06f5,
  8338. "fiveroman",
  8339. 0x2174,
  8340. "fivesuperior",
  8341. 0x2075,
  8342. "fivethai",
  8343. 0x0e55,
  8344. "fl",
  8345. 0xfb02,
  8346. "florin",
  8347. 0x0192,
  8348. "fmonospace",
  8349. 0xff46,
  8350. "fmsquare",
  8351. 0x3399,
  8352. "fofanthai",
  8353. 0x0e1f,
  8354. "fofathai",
  8355. 0x0e1d,
  8356. "fongmanthai",
  8357. 0x0e4f,
  8358. "forall",
  8359. 0x2200,
  8360. "four",
  8361. 0x0034,
  8362. "fourarabic",
  8363. 0x0664,
  8364. "fourbengali",
  8365. 0x09ea,
  8366. "fourcircle",
  8367. 0x2463,
  8368. "fourcircleinversesansserif",
  8369. 0x278d,
  8370. "fourdeva",
  8371. 0x096a,
  8372. "fourgujarati",
  8373. 0x0aea,
  8374. "fourgurmukhi",
  8375. 0x0a6a,
  8376. "fourhackarabic",
  8377. 0x0664,
  8378. "fourhangzhou",
  8379. 0x3024,
  8380. "fourideographicparen",
  8381. 0x3223,
  8382. "fourinferior",
  8383. 0x2084,
  8384. "fourmonospace",
  8385. 0xff14,
  8386. "fournumeratorbengali",
  8387. 0x09f7,
  8388. "fouroldstyle",
  8389. 0xf734,
  8390. "fourparen",
  8391. 0x2477,
  8392. "fourperiod",
  8393. 0x248b,
  8394. "fourpersian",
  8395. 0x06f4,
  8396. "fourroman",
  8397. 0x2173,
  8398. "foursuperior",
  8399. 0x2074,
  8400. "fourteencircle",
  8401. 0x246d,
  8402. "fourteenparen",
  8403. 0x2481,
  8404. "fourteenperiod",
  8405. 0x2495,
  8406. "fourthai",
  8407. 0x0e54,
  8408. "fourthtonechinese",
  8409. 0x02cb,
  8410. "fparen",
  8411. 0x24a1,
  8412. "fraction",
  8413. 0x2044,
  8414. "franc",
  8415. 0x20a3,
  8416. "g",
  8417. 0x0067,
  8418. "gabengali",
  8419. 0x0997,
  8420. "gacute",
  8421. 0x01f5,
  8422. "gadeva",
  8423. 0x0917,
  8424. "gafarabic",
  8425. 0x06af,
  8426. "gaffinalarabic",
  8427. 0xfb93,
  8428. "gafinitialarabic",
  8429. 0xfb94,
  8430. "gafmedialarabic",
  8431. 0xfb95,
  8432. "gagujarati",
  8433. 0x0a97,
  8434. "gagurmukhi",
  8435. 0x0a17,
  8436. "gahiragana",
  8437. 0x304c,
  8438. "gakatakana",
  8439. 0x30ac,
  8440. "gamma",
  8441. 0x03b3,
  8442. "gammalatinsmall",
  8443. 0x0263,
  8444. "gammasuperior",
  8445. 0x02e0,
  8446. "gangiacoptic",
  8447. 0x03eb,
  8448. "gbopomofo",
  8449. 0x310d,
  8450. "gbreve",
  8451. 0x011f,
  8452. "gcaron",
  8453. 0x01e7,
  8454. "gcedilla",
  8455. 0x0123,
  8456. "gcircle",
  8457. 0x24d6,
  8458. "gcircumflex",
  8459. 0x011d,
  8460. "gcommaaccent",
  8461. 0x0123,
  8462. "gdot",
  8463. 0x0121,
  8464. "gdotaccent",
  8465. 0x0121,
  8466. "gecyrillic",
  8467. 0x0433,
  8468. "gehiragana",
  8469. 0x3052,
  8470. "gekatakana",
  8471. 0x30b2,
  8472. "geometricallyequal",
  8473. 0x2251,
  8474. "gereshaccenthebrew",
  8475. 0x059c,
  8476. "gereshhebrew",
  8477. 0x05f3,
  8478. "gereshmuqdamhebrew",
  8479. 0x059d,
  8480. "germandbls",
  8481. 0x00df,
  8482. "gershayimaccenthebrew",
  8483. 0x059e,
  8484. "gershayimhebrew",
  8485. 0x05f4,
  8486. "getamark",
  8487. 0x3013,
  8488. "ghabengali",
  8489. 0x0998,
  8490. "ghadarmenian",
  8491. 0x0572,
  8492. "ghadeva",
  8493. 0x0918,
  8494. "ghagujarati",
  8495. 0x0a98,
  8496. "ghagurmukhi",
  8497. 0x0a18,
  8498. "ghainarabic",
  8499. 0x063a,
  8500. "ghainfinalarabic",
  8501. 0xfece,
  8502. "ghaininitialarabic",
  8503. 0xfecf,
  8504. "ghainmedialarabic",
  8505. 0xfed0,
  8506. "ghemiddlehookcyrillic",
  8507. 0x0495,
  8508. "ghestrokecyrillic",
  8509. 0x0493,
  8510. "gheupturncyrillic",
  8511. 0x0491,
  8512. "ghhadeva",
  8513. 0x095a,
  8514. "ghhagurmukhi",
  8515. 0x0a5a,
  8516. "ghook",
  8517. 0x0260,
  8518. "ghzsquare",
  8519. 0x3393,
  8520. "gihiragana",
  8521. 0x304e,
  8522. "gikatakana",
  8523. 0x30ae,
  8524. "gimarmenian",
  8525. 0x0563,
  8526. "gimel",
  8527. 0x05d2,
  8528. "gimeldagesh",
  8529. 0xfb32,
  8530. "gimeldageshhebrew",
  8531. 0xfb32,
  8532. "gimelhebrew",
  8533. 0x05d2,
  8534. "gjecyrillic",
  8535. 0x0453,
  8536. "glottalinvertedstroke",
  8537. 0x01be,
  8538. "glottalstop",
  8539. 0x0294,
  8540. "glottalstopinverted",
  8541. 0x0296,
  8542. "glottalstopmod",
  8543. 0x02c0,
  8544. "glottalstopreversed",
  8545. 0x0295,
  8546. "glottalstopreversedmod",
  8547. 0x02c1,
  8548. "glottalstopreversedsuperior",
  8549. 0x02e4,
  8550. "glottalstopstroke",
  8551. 0x02a1,
  8552. "glottalstopstrokereversed",
  8553. 0x02a2,
  8554. "gmacron",
  8555. 0x1e21,
  8556. "gmonospace",
  8557. 0xff47,
  8558. "gohiragana",
  8559. 0x3054,
  8560. "gokatakana",
  8561. 0x30b4,
  8562. "gparen",
  8563. 0x24a2,
  8564. "gpasquare",
  8565. 0x33ac,
  8566. "gradient",
  8567. 0x2207,
  8568. "grave",
  8569. 0x0060,
  8570. "gravebelowcmb",
  8571. 0x0316,
  8572. "gravecmb",
  8573. 0x0300,
  8574. "gravecomb",
  8575. 0x0300,
  8576. "gravedeva",
  8577. 0x0953,
  8578. "gravelowmod",
  8579. 0x02ce,
  8580. "gravemonospace",
  8581. 0xff40,
  8582. "gravetonecmb",
  8583. 0x0340,
  8584. "greater",
  8585. 0x003e,
  8586. "greaterequal",
  8587. 0x2265,
  8588. "greaterequalorless",
  8589. 0x22db,
  8590. "greatermonospace",
  8591. 0xff1e,
  8592. "greaterorequivalent",
  8593. 0x2273,
  8594. "greaterorless",
  8595. 0x2277,
  8596. "greateroverequal",
  8597. 0x2267,
  8598. "greatersmall",
  8599. 0xfe65,
  8600. "gscript",
  8601. 0x0261,
  8602. "gstroke",
  8603. 0x01e5,
  8604. "guhiragana",
  8605. 0x3050,
  8606. "guillemotleft",
  8607. 0x00ab,
  8608. "guillemotright",
  8609. 0x00bb,
  8610. "guilsinglleft",
  8611. 0x2039,
  8612. "guilsinglright",
  8613. 0x203a,
  8614. "gukatakana",
  8615. 0x30b0,
  8616. "guramusquare",
  8617. 0x3318,
  8618. "gysquare",
  8619. 0x33c9,
  8620. "h",
  8621. 0x0068,
  8622. "haabkhasiancyrillic",
  8623. 0x04a9,
  8624. "haaltonearabic",
  8625. 0x06c1,
  8626. "habengali",
  8627. 0x09b9,
  8628. "hadescendercyrillic",
  8629. 0x04b3,
  8630. "hadeva",
  8631. 0x0939,
  8632. "hagujarati",
  8633. 0x0ab9,
  8634. "hagurmukhi",
  8635. 0x0a39,
  8636. "haharabic",
  8637. 0x062d,
  8638. "hahfinalarabic",
  8639. 0xfea2,
  8640. "hahinitialarabic",
  8641. 0xfea3,
  8642. "hahiragana",
  8643. 0x306f,
  8644. "hahmedialarabic",
  8645. 0xfea4,
  8646. "haitusquare",
  8647. 0x332a,
  8648. "hakatakana",
  8649. 0x30cf,
  8650. "hakatakanahalfwidth",
  8651. 0xff8a,
  8652. "halantgurmukhi",
  8653. 0x0a4d,
  8654. "hamzaarabic",
  8655. 0x0621,
  8656. "hamzalowarabic",
  8657. 0x0621,
  8658. "hangulfiller",
  8659. 0x3164,
  8660. "hardsigncyrillic",
  8661. 0x044a,
  8662. "harpoonleftbarbup",
  8663. 0x21bc,
  8664. "harpoonrightbarbup",
  8665. 0x21c0,
  8666. "hasquare",
  8667. 0x33ca,
  8668. "hatafpatah",
  8669. 0x05b2,
  8670. "hatafpatah16",
  8671. 0x05b2,
  8672. "hatafpatah23",
  8673. 0x05b2,
  8674. "hatafpatah2f",
  8675. 0x05b2,
  8676. "hatafpatahhebrew",
  8677. 0x05b2,
  8678. "hatafpatahnarrowhebrew",
  8679. 0x05b2,
  8680. "hatafpatahquarterhebrew",
  8681. 0x05b2,
  8682. "hatafpatahwidehebrew",
  8683. 0x05b2,
  8684. "hatafqamats",
  8685. 0x05b3,
  8686. "hatafqamats1b",
  8687. 0x05b3,
  8688. "hatafqamats28",
  8689. 0x05b3,
  8690. "hatafqamats34",
  8691. 0x05b3,
  8692. "hatafqamatshebrew",
  8693. 0x05b3,
  8694. "hatafqamatsnarrowhebrew",
  8695. 0x05b3,
  8696. "hatafqamatsquarterhebrew",
  8697. 0x05b3,
  8698. "hatafqamatswidehebrew",
  8699. 0x05b3,
  8700. "hatafsegol",
  8701. 0x05b1,
  8702. "hatafsegol17",
  8703. 0x05b1,
  8704. "hatafsegol24",
  8705. 0x05b1,
  8706. "hatafsegol30",
  8707. 0x05b1,
  8708. "hatafsegolhebrew",
  8709. 0x05b1,
  8710. "hatafsegolnarrowhebrew",
  8711. 0x05b1,
  8712. "hatafsegolquarterhebrew",
  8713. 0x05b1,
  8714. "hatafsegolwidehebrew",
  8715. 0x05b1,
  8716. "hbar",
  8717. 0x0127,
  8718. "hbopomofo",
  8719. 0x310f,
  8720. "hbrevebelow",
  8721. 0x1e2b,
  8722. "hcedilla",
  8723. 0x1e29,
  8724. "hcircle",
  8725. 0x24d7,
  8726. "hcircumflex",
  8727. 0x0125,
  8728. "hdieresis",
  8729. 0x1e27,
  8730. "hdotaccent",
  8731. 0x1e23,
  8732. "hdotbelow",
  8733. 0x1e25,
  8734. "he",
  8735. 0x05d4,
  8736. "heart",
  8737. 0x2665,
  8738. "heartsuitblack",
  8739. 0x2665,
  8740. "heartsuitwhite",
  8741. 0x2661,
  8742. "hedagesh",
  8743. 0xfb34,
  8744. "hedageshhebrew",
  8745. 0xfb34,
  8746. "hehaltonearabic",
  8747. 0x06c1,
  8748. "heharabic",
  8749. 0x0647,
  8750. "hehebrew",
  8751. 0x05d4,
  8752. "hehfinalaltonearabic",
  8753. 0xfba7,
  8754. "hehfinalalttwoarabic",
  8755. 0xfeea,
  8756. "hehfinalarabic",
  8757. 0xfeea,
  8758. "hehhamzaabovefinalarabic",
  8759. 0xfba5,
  8760. "hehhamzaaboveisolatedarabic",
  8761. 0xfba4,
  8762. "hehinitialaltonearabic",
  8763. 0xfba8,
  8764. "hehinitialarabic",
  8765. 0xfeeb,
  8766. "hehiragana",
  8767. 0x3078,
  8768. "hehmedialaltonearabic",
  8769. 0xfba9,
  8770. "hehmedialarabic",
  8771. 0xfeec,
  8772. "heiseierasquare",
  8773. 0x337b,
  8774. "hekatakana",
  8775. 0x30d8,
  8776. "hekatakanahalfwidth",
  8777. 0xff8d,
  8778. "hekutaarusquare",
  8779. 0x3336,
  8780. "henghook",
  8781. 0x0267,
  8782. "herutusquare",
  8783. 0x3339,
  8784. "het",
  8785. 0x05d7,
  8786. "hethebrew",
  8787. 0x05d7,
  8788. "hhook",
  8789. 0x0266,
  8790. "hhooksuperior",
  8791. 0x02b1,
  8792. "hieuhacirclekorean",
  8793. 0x327b,
  8794. "hieuhaparenkorean",
  8795. 0x321b,
  8796. "hieuhcirclekorean",
  8797. 0x326d,
  8798. "hieuhkorean",
  8799. 0x314e,
  8800. "hieuhparenkorean",
  8801. 0x320d,
  8802. "hihiragana",
  8803. 0x3072,
  8804. "hikatakana",
  8805. 0x30d2,
  8806. "hikatakanahalfwidth",
  8807. 0xff8b,
  8808. "hiriq",
  8809. 0x05b4,
  8810. "hiriq14",
  8811. 0x05b4,
  8812. "hiriq21",
  8813. 0x05b4,
  8814. "hiriq2d",
  8815. 0x05b4,
  8816. "hiriqhebrew",
  8817. 0x05b4,
  8818. "hiriqnarrowhebrew",
  8819. 0x05b4,
  8820. "hiriqquarterhebrew",
  8821. 0x05b4,
  8822. "hiriqwidehebrew",
  8823. 0x05b4,
  8824. "hlinebelow",
  8825. 0x1e96,
  8826. "hmonospace",
  8827. 0xff48,
  8828. "hoarmenian",
  8829. 0x0570,
  8830. "hohipthai",
  8831. 0x0e2b,
  8832. "hohiragana",
  8833. 0x307b,
  8834. "hokatakana",
  8835. 0x30db,
  8836. "hokatakanahalfwidth",
  8837. 0xff8e,
  8838. "holam",
  8839. 0x05b9,
  8840. "holam19",
  8841. 0x05b9,
  8842. "holam26",
  8843. 0x05b9,
  8844. "holam32",
  8845. 0x05b9,
  8846. "holamhebrew",
  8847. 0x05b9,
  8848. "holamnarrowhebrew",
  8849. 0x05b9,
  8850. "holamquarterhebrew",
  8851. 0x05b9,
  8852. "holamwidehebrew",
  8853. 0x05b9,
  8854. "honokhukthai",
  8855. 0x0e2e,
  8856. "hookabovecomb",
  8857. 0x0309,
  8858. "hookcmb",
  8859. 0x0309,
  8860. "hookpalatalizedbelowcmb",
  8861. 0x0321,
  8862. "hookretroflexbelowcmb",
  8863. 0x0322,
  8864. "hoonsquare",
  8865. 0x3342,
  8866. "horicoptic",
  8867. 0x03e9,
  8868. "horizontalbar",
  8869. 0x2015,
  8870. "horncmb",
  8871. 0x031b,
  8872. "hotsprings",
  8873. 0x2668,
  8874. "house",
  8875. 0x2302,
  8876. "hparen",
  8877. 0x24a3,
  8878. "hsuperior",
  8879. 0x02b0,
  8880. "hturned",
  8881. 0x0265,
  8882. "huhiragana",
  8883. 0x3075,
  8884. "huiitosquare",
  8885. 0x3333,
  8886. "hukatakana",
  8887. 0x30d5,
  8888. "hukatakanahalfwidth",
  8889. 0xff8c,
  8890. "hungarumlaut",
  8891. 0x02dd,
  8892. "hungarumlautcmb",
  8893. 0x030b,
  8894. "hv",
  8895. 0x0195,
  8896. "hyphen",
  8897. 0x002d,
  8898. "hypheninferior",
  8899. 0xf6e5,
  8900. "hyphenmonospace",
  8901. 0xff0d,
  8902. "hyphensmall",
  8903. 0xfe63,
  8904. "hyphensuperior",
  8905. 0xf6e6,
  8906. "hyphentwo",
  8907. 0x2010,
  8908. "i",
  8909. 0x0069,
  8910. "iacute",
  8911. 0x00ed,
  8912. "iacyrillic",
  8913. 0x044f,
  8914. "ibengali",
  8915. 0x0987,
  8916. "ibopomofo",
  8917. 0x3127,
  8918. "ibreve",
  8919. 0x012d,
  8920. "icaron",
  8921. 0x01d0,
  8922. "icircle",
  8923. 0x24d8,
  8924. "icircumflex",
  8925. 0x00ee,
  8926. "icyrillic",
  8927. 0x0456,
  8928. "idblgrave",
  8929. 0x0209,
  8930. "ideographearthcircle",
  8931. 0x328f,
  8932. "ideographfirecircle",
  8933. 0x328b,
  8934. "ideographicallianceparen",
  8935. 0x323f,
  8936. "ideographiccallparen",
  8937. 0x323a,
  8938. "ideographiccentrecircle",
  8939. 0x32a5,
  8940. "ideographicclose",
  8941. 0x3006,
  8942. "ideographiccomma",
  8943. 0x3001,
  8944. "ideographiccommaleft",
  8945. 0xff64,
  8946. "ideographiccongratulationparen",
  8947. 0x3237,
  8948. "ideographiccorrectcircle",
  8949. 0x32a3,
  8950. "ideographicearthparen",
  8951. 0x322f,
  8952. "ideographicenterpriseparen",
  8953. 0x323d,
  8954. "ideographicexcellentcircle",
  8955. 0x329d,
  8956. "ideographicfestivalparen",
  8957. 0x3240,
  8958. "ideographicfinancialcircle",
  8959. 0x3296,
  8960. "ideographicfinancialparen",
  8961. 0x3236,
  8962. "ideographicfireparen",
  8963. 0x322b,
  8964. "ideographichaveparen",
  8965. 0x3232,
  8966. "ideographichighcircle",
  8967. 0x32a4,
  8968. "ideographiciterationmark",
  8969. 0x3005,
  8970. "ideographiclaborcircle",
  8971. 0x3298,
  8972. "ideographiclaborparen",
  8973. 0x3238,
  8974. "ideographicleftcircle",
  8975. 0x32a7,
  8976. "ideographiclowcircle",
  8977. 0x32a6,
  8978. "ideographicmedicinecircle",
  8979. 0x32a9,
  8980. "ideographicmetalparen",
  8981. 0x322e,
  8982. "ideographicmoonparen",
  8983. 0x322a,
  8984. "ideographicnameparen",
  8985. 0x3234,
  8986. "ideographicperiod",
  8987. 0x3002,
  8988. "ideographicprintcircle",
  8989. 0x329e,
  8990. "ideographicreachparen",
  8991. 0x3243,
  8992. "ideographicrepresentparen",
  8993. 0x3239,
  8994. "ideographicresourceparen",
  8995. 0x323e,
  8996. "ideographicrightcircle",
  8997. 0x32a8,
  8998. "ideographicsecretcircle",
  8999. 0x3299,
  9000. "ideographicselfparen",
  9001. 0x3242,
  9002. "ideographicsocietyparen",
  9003. 0x3233,
  9004. "ideographicspace",
  9005. 0x3000,
  9006. "ideographicspecialparen",
  9007. 0x3235,
  9008. "ideographicstockparen",
  9009. 0x3231,
  9010. "ideographicstudyparen",
  9011. 0x323b,
  9012. "ideographicsunparen",
  9013. 0x3230,
  9014. "ideographicsuperviseparen",
  9015. 0x323c,
  9016. "ideographicwaterparen",
  9017. 0x322c,
  9018. "ideographicwoodparen",
  9019. 0x322d,
  9020. "ideographiczero",
  9021. 0x3007,
  9022. "ideographmetalcircle",
  9023. 0x328e,
  9024. "ideographmooncircle",
  9025. 0x328a,
  9026. "ideographnamecircle",
  9027. 0x3294,
  9028. "ideographsuncircle",
  9029. 0x3290,
  9030. "ideographwatercircle",
  9031. 0x328c,
  9032. "ideographwoodcircle",
  9033. 0x328d,
  9034. "ideva",
  9035. 0x0907,
  9036. "idieresis",
  9037. 0x00ef,
  9038. "idieresisacute",
  9039. 0x1e2f,
  9040. "idieresiscyrillic",
  9041. 0x04e5,
  9042. "idotbelow",
  9043. 0x1ecb,
  9044. "iebrevecyrillic",
  9045. 0x04d7,
  9046. "iecyrillic",
  9047. 0x0435,
  9048. "ieungacirclekorean",
  9049. 0x3275,
  9050. "ieungaparenkorean",
  9051. 0x3215,
  9052. "ieungcirclekorean",
  9053. 0x3267,
  9054. "ieungkorean",
  9055. 0x3147,
  9056. "ieungparenkorean",
  9057. 0x3207,
  9058. "igrave",
  9059. 0x00ec,
  9060. "igujarati",
  9061. 0x0a87,
  9062. "igurmukhi",
  9063. 0x0a07,
  9064. "ihiragana",
  9065. 0x3044,
  9066. "ihookabove",
  9067. 0x1ec9,
  9068. "iibengali",
  9069. 0x0988,
  9070. "iicyrillic",
  9071. 0x0438,
  9072. "iideva",
  9073. 0x0908,
  9074. "iigujarati",
  9075. 0x0a88,
  9076. "iigurmukhi",
  9077. 0x0a08,
  9078. "iimatragurmukhi",
  9079. 0x0a40,
  9080. "iinvertedbreve",
  9081. 0x020b,
  9082. "iishortcyrillic",
  9083. 0x0439,
  9084. "iivowelsignbengali",
  9085. 0x09c0,
  9086. "iivowelsigndeva",
  9087. 0x0940,
  9088. "iivowelsigngujarati",
  9089. 0x0ac0,
  9090. "ij",
  9091. 0x0133,
  9092. "ikatakana",
  9093. 0x30a4,
  9094. "ikatakanahalfwidth",
  9095. 0xff72,
  9096. "ikorean",
  9097. 0x3163,
  9098. "ilde",
  9099. 0x02dc,
  9100. "iluyhebrew",
  9101. 0x05ac,
  9102. "imacron",
  9103. 0x012b,
  9104. "imacroncyrillic",
  9105. 0x04e3,
  9106. "imageorapproximatelyequal",
  9107. 0x2253,
  9108. "imatragurmukhi",
  9109. 0x0a3f,
  9110. "imonospace",
  9111. 0xff49,
  9112. "increment",
  9113. 0x2206,
  9114. "infinity",
  9115. 0x221e,
  9116. "iniarmenian",
  9117. 0x056b,
  9118. "integral",
  9119. 0x222b,
  9120. "integralbottom",
  9121. 0x2321,
  9122. "integralbt",
  9123. 0x2321,
  9124. "integralex",
  9125. 0xf8f5,
  9126. "integraltop",
  9127. 0x2320,
  9128. "integraltp",
  9129. 0x2320,
  9130. "intersection",
  9131. 0x2229,
  9132. "intisquare",
  9133. 0x3305,
  9134. "invbullet",
  9135. 0x25d8,
  9136. "invcircle",
  9137. 0x25d9,
  9138. "invsmileface",
  9139. 0x263b,
  9140. "iocyrillic",
  9141. 0x0451,
  9142. "iogonek",
  9143. 0x012f,
  9144. "iota",
  9145. 0x03b9,
  9146. "iotadieresis",
  9147. 0x03ca,
  9148. "iotadieresistonos",
  9149. 0x0390,
  9150. "iotalatin",
  9151. 0x0269,
  9152. "iotatonos",
  9153. 0x03af,
  9154. "iparen",
  9155. 0x24a4,
  9156. "irigurmukhi",
  9157. 0x0a72,
  9158. "ismallhiragana",
  9159. 0x3043,
  9160. "ismallkatakana",
  9161. 0x30a3,
  9162. "ismallkatakanahalfwidth",
  9163. 0xff68,
  9164. "issharbengali",
  9165. 0x09fa,
  9166. "istroke",
  9167. 0x0268,
  9168. "isuperior",
  9169. 0xf6ed,
  9170. "iterationhiragana",
  9171. 0x309d,
  9172. "iterationkatakana",
  9173. 0x30fd,
  9174. "itilde",
  9175. 0x0129,
  9176. "itildebelow",
  9177. 0x1e2d,
  9178. "iubopomofo",
  9179. 0x3129,
  9180. "iucyrillic",
  9181. 0x044e,
  9182. "ivowelsignbengali",
  9183. 0x09bf,
  9184. "ivowelsigndeva",
  9185. 0x093f,
  9186. "ivowelsigngujarati",
  9187. 0x0abf,
  9188. "izhitsacyrillic",
  9189. 0x0475,
  9190. "izhitsadblgravecyrillic",
  9191. 0x0477,
  9192. "j",
  9193. 0x006a,
  9194. "jaarmenian",
  9195. 0x0571,
  9196. "jabengali",
  9197. 0x099c,
  9198. "jadeva",
  9199. 0x091c,
  9200. "jagujarati",
  9201. 0x0a9c,
  9202. "jagurmukhi",
  9203. 0x0a1c,
  9204. "jbopomofo",
  9205. 0x3110,
  9206. "jcaron",
  9207. 0x01f0,
  9208. "jcircle",
  9209. 0x24d9,
  9210. "jcircumflex",
  9211. 0x0135,
  9212. "jcrossedtail",
  9213. 0x029d,
  9214. "jdotlessstroke",
  9215. 0x025f,
  9216. "jecyrillic",
  9217. 0x0458,
  9218. "jeemarabic",
  9219. 0x062c,
  9220. "jeemfinalarabic",
  9221. 0xfe9e,
  9222. "jeeminitialarabic",
  9223. 0xfe9f,
  9224. "jeemmedialarabic",
  9225. 0xfea0,
  9226. "jeharabic",
  9227. 0x0698,
  9228. "jehfinalarabic",
  9229. 0xfb8b,
  9230. "jhabengali",
  9231. 0x099d,
  9232. "jhadeva",
  9233. 0x091d,
  9234. "jhagujarati",
  9235. 0x0a9d,
  9236. "jhagurmukhi",
  9237. 0x0a1d,
  9238. "jheharmenian",
  9239. 0x057b,
  9240. "jis",
  9241. 0x3004,
  9242. "jmonospace",
  9243. 0xff4a,
  9244. "jparen",
  9245. 0x24a5,
  9246. "jsuperior",
  9247. 0x02b2,
  9248. "k",
  9249. 0x006b,
  9250. "kabashkircyrillic",
  9251. 0x04a1,
  9252. "kabengali",
  9253. 0x0995,
  9254. "kacute",
  9255. 0x1e31,
  9256. "kacyrillic",
  9257. 0x043a,
  9258. "kadescendercyrillic",
  9259. 0x049b,
  9260. "kadeva",
  9261. 0x0915,
  9262. "kaf",
  9263. 0x05db,
  9264. "kafarabic",
  9265. 0x0643,
  9266. "kafdagesh",
  9267. 0xfb3b,
  9268. "kafdageshhebrew",
  9269. 0xfb3b,
  9270. "kaffinalarabic",
  9271. 0xfeda,
  9272. "kafhebrew",
  9273. 0x05db,
  9274. "kafinitialarabic",
  9275. 0xfedb,
  9276. "kafmedialarabic",
  9277. 0xfedc,
  9278. "kafrafehebrew",
  9279. 0xfb4d,
  9280. "kagujarati",
  9281. 0x0a95,
  9282. "kagurmukhi",
  9283. 0x0a15,
  9284. "kahiragana",
  9285. 0x304b,
  9286. "kahookcyrillic",
  9287. 0x04c4,
  9288. "kakatakana",
  9289. 0x30ab,
  9290. "kakatakanahalfwidth",
  9291. 0xff76,
  9292. "kappa",
  9293. 0x03ba,
  9294. "kappasymbolgreek",
  9295. 0x03f0,
  9296. "kapyeounmieumkorean",
  9297. 0x3171,
  9298. "kapyeounphieuphkorean",
  9299. 0x3184,
  9300. "kapyeounpieupkorean",
  9301. 0x3178,
  9302. "kapyeounssangpieupkorean",
  9303. 0x3179,
  9304. "karoriisquare",
  9305. 0x330d,
  9306. "kashidaautoarabic",
  9307. 0x0640,
  9308. "kashidaautonosidebearingarabic",
  9309. 0x0640,
  9310. "kasmallkatakana",
  9311. 0x30f5,
  9312. "kasquare",
  9313. 0x3384,
  9314. "kasraarabic",
  9315. 0x0650,
  9316. "kasratanarabic",
  9317. 0x064d,
  9318. "kastrokecyrillic",
  9319. 0x049f,
  9320. "katahiraprolongmarkhalfwidth",
  9321. 0xff70,
  9322. "kaverticalstrokecyrillic",
  9323. 0x049d,
  9324. "kbopomofo",
  9325. 0x310e,
  9326. "kcalsquare",
  9327. 0x3389,
  9328. "kcaron",
  9329. 0x01e9,
  9330. "kcedilla",
  9331. 0x0137,
  9332. "kcircle",
  9333. 0x24da,
  9334. "kcommaaccent",
  9335. 0x0137,
  9336. "kdotbelow",
  9337. 0x1e33,
  9338. "keharmenian",
  9339. 0x0584,
  9340. "kehiragana",
  9341. 0x3051,
  9342. "kekatakana",
  9343. 0x30b1,
  9344. "kekatakanahalfwidth",
  9345. 0xff79,
  9346. "kenarmenian",
  9347. 0x056f,
  9348. "kesmallkatakana",
  9349. 0x30f6,
  9350. "kgreenlandic",
  9351. 0x0138,
  9352. "khabengali",
  9353. 0x0996,
  9354. "khacyrillic",
  9355. 0x0445,
  9356. "khadeva",
  9357. 0x0916,
  9358. "khagujarati",
  9359. 0x0a96,
  9360. "khagurmukhi",
  9361. 0x0a16,
  9362. "khaharabic",
  9363. 0x062e,
  9364. "khahfinalarabic",
  9365. 0xfea6,
  9366. "khahinitialarabic",
  9367. 0xfea7,
  9368. "khahmedialarabic",
  9369. 0xfea8,
  9370. "kheicoptic",
  9371. 0x03e7,
  9372. "khhadeva",
  9373. 0x0959,
  9374. "khhagurmukhi",
  9375. 0x0a59,
  9376. "khieukhacirclekorean",
  9377. 0x3278,
  9378. "khieukhaparenkorean",
  9379. 0x3218,
  9380. "khieukhcirclekorean",
  9381. 0x326a,
  9382. "khieukhkorean",
  9383. 0x314b,
  9384. "khieukhparenkorean",
  9385. 0x320a,
  9386. "khokhaithai",
  9387. 0x0e02,
  9388. "khokhonthai",
  9389. 0x0e05,
  9390. "khokhuatthai",
  9391. 0x0e03,
  9392. "khokhwaithai",
  9393. 0x0e04,
  9394. "khomutthai",
  9395. 0x0e5b,
  9396. "khook",
  9397. 0x0199,
  9398. "khorakhangthai",
  9399. 0x0e06,
  9400. "khzsquare",
  9401. 0x3391,
  9402. "kihiragana",
  9403. 0x304d,
  9404. "kikatakana",
  9405. 0x30ad,
  9406. "kikatakanahalfwidth",
  9407. 0xff77,
  9408. "kiroguramusquare",
  9409. 0x3315,
  9410. "kiromeetorusquare",
  9411. 0x3316,
  9412. "kirosquare",
  9413. 0x3314,
  9414. "kiyeokacirclekorean",
  9415. 0x326e,
  9416. "kiyeokaparenkorean",
  9417. 0x320e,
  9418. "kiyeokcirclekorean",
  9419. 0x3260,
  9420. "kiyeokkorean",
  9421. 0x3131,
  9422. "kiyeokparenkorean",
  9423. 0x3200,
  9424. "kiyeoksioskorean",
  9425. 0x3133,
  9426. "kjecyrillic",
  9427. 0x045c,
  9428. "klinebelow",
  9429. 0x1e35,
  9430. "klsquare",
  9431. 0x3398,
  9432. "kmcubedsquare",
  9433. 0x33a6,
  9434. "kmonospace",
  9435. 0xff4b,
  9436. "kmsquaredsquare",
  9437. 0x33a2,
  9438. "kohiragana",
  9439. 0x3053,
  9440. "kohmsquare",
  9441. 0x33c0,
  9442. "kokaithai",
  9443. 0x0e01,
  9444. "kokatakana",
  9445. 0x30b3,
  9446. "kokatakanahalfwidth",
  9447. 0xff7a,
  9448. "kooposquare",
  9449. 0x331e,
  9450. "koppacyrillic",
  9451. 0x0481,
  9452. "koreanstandardsymbol",
  9453. 0x327f,
  9454. "koroniscmb",
  9455. 0x0343,
  9456. "kparen",
  9457. 0x24a6,
  9458. "kpasquare",
  9459. 0x33aa,
  9460. "ksicyrillic",
  9461. 0x046f,
  9462. "ktsquare",
  9463. 0x33cf,
  9464. "kturned",
  9465. 0x029e,
  9466. "kuhiragana",
  9467. 0x304f,
  9468. "kukatakana",
  9469. 0x30af,
  9470. "kukatakanahalfwidth",
  9471. 0xff78,
  9472. "kvsquare",
  9473. 0x33b8,
  9474. "kwsquare",
  9475. 0x33be,
  9476. "l",
  9477. 0x006c,
  9478. "labengali",
  9479. 0x09b2,
  9480. "lacute",
  9481. 0x013a,
  9482. "ladeva",
  9483. 0x0932,
  9484. "lagujarati",
  9485. 0x0ab2,
  9486. "lagurmukhi",
  9487. 0x0a32,
  9488. "lakkhangyaothai",
  9489. 0x0e45,
  9490. "lamaleffinalarabic",
  9491. 0xfefc,
  9492. "lamalefhamzaabovefinalarabic",
  9493. 0xfef8,
  9494. "lamalefhamzaaboveisolatedarabic",
  9495. 0xfef7,
  9496. "lamalefhamzabelowfinalarabic",
  9497. 0xfefa,
  9498. "lamalefhamzabelowisolatedarabic",
  9499. 0xfef9,
  9500. "lamalefisolatedarabic",
  9501. 0xfefb,
  9502. "lamalefmaddaabovefinalarabic",
  9503. 0xfef6,
  9504. "lamalefmaddaaboveisolatedarabic",
  9505. 0xfef5,
  9506. "lamarabic",
  9507. 0x0644,
  9508. "lambda",
  9509. 0x03bb,
  9510. "lambdastroke",
  9511. 0x019b,
  9512. "lamed",
  9513. 0x05dc,
  9514. "lameddagesh",
  9515. 0xfb3c,
  9516. "lameddageshhebrew",
  9517. 0xfb3c,
  9518. "lamedhebrew",
  9519. 0x05dc,
  9520. "lamfinalarabic",
  9521. 0xfede,
  9522. "lamhahinitialarabic",
  9523. 0xfcca,
  9524. "laminitialarabic",
  9525. 0xfedf,
  9526. "lamjeeminitialarabic",
  9527. 0xfcc9,
  9528. "lamkhahinitialarabic",
  9529. 0xfccb,
  9530. "lamlamhehisolatedarabic",
  9531. 0xfdf2,
  9532. "lammedialarabic",
  9533. 0xfee0,
  9534. "lammeemhahinitialarabic",
  9535. 0xfd88,
  9536. "lammeeminitialarabic",
  9537. 0xfccc,
  9538. "largecircle",
  9539. 0x25ef,
  9540. "lbar",
  9541. 0x019a,
  9542. "lbelt",
  9543. 0x026c,
  9544. "lbopomofo",
  9545. 0x310c,
  9546. "lcaron",
  9547. 0x013e,
  9548. "lcedilla",
  9549. 0x013c,
  9550. "lcircle",
  9551. 0x24db,
  9552. "lcircumflexbelow",
  9553. 0x1e3d,
  9554. "lcommaaccent",
  9555. 0x013c,
  9556. "ldot",
  9557. 0x0140,
  9558. "ldotaccent",
  9559. 0x0140,
  9560. "ldotbelow",
  9561. 0x1e37,
  9562. "ldotbelowmacron",
  9563. 0x1e39,
  9564. "leftangleabovecmb",
  9565. 0x031a,
  9566. "lefttackbelowcmb",
  9567. 0x0318,
  9568. "less",
  9569. 0x003c,
  9570. "lessequal",
  9571. 0x2264,
  9572. "lessequalorgreater",
  9573. 0x22da,
  9574. "lessmonospace",
  9575. 0xff1c,
  9576. "lessorequivalent",
  9577. 0x2272,
  9578. "lessorgreater",
  9579. 0x2276,
  9580. "lessoverequal",
  9581. 0x2266,
  9582. "lesssmall",
  9583. 0xfe64,
  9584. "lezh",
  9585. 0x026e,
  9586. "lfblock",
  9587. 0x258c,
  9588. "lhookretroflex",
  9589. 0x026d,
  9590. "lira",
  9591. 0x20a4,
  9592. "liwnarmenian",
  9593. 0x056c,
  9594. "lj",
  9595. 0x01c9,
  9596. "ljecyrillic",
  9597. 0x0459,
  9598. "ll",
  9599. 0xf6c0,
  9600. "lladeva",
  9601. 0x0933,
  9602. "llagujarati",
  9603. 0x0ab3,
  9604. "llinebelow",
  9605. 0x1e3b,
  9606. "llladeva",
  9607. 0x0934,
  9608. "llvocalicbengali",
  9609. 0x09e1,
  9610. "llvocalicdeva",
  9611. 0x0961,
  9612. "llvocalicvowelsignbengali",
  9613. 0x09e3,
  9614. "llvocalicvowelsigndeva",
  9615. 0x0963,
  9616. "lmiddletilde",
  9617. 0x026b,
  9618. "lmonospace",
  9619. 0xff4c,
  9620. "lmsquare",
  9621. 0x33d0,
  9622. "lochulathai",
  9623. 0x0e2c,
  9624. "logicaland",
  9625. 0x2227,
  9626. "logicalnot",
  9627. 0x00ac,
  9628. "logicalnotreversed",
  9629. 0x2310,
  9630. "logicalor",
  9631. 0x2228,
  9632. "lolingthai",
  9633. 0x0e25,
  9634. "longs",
  9635. 0x017f,
  9636. "lowlinecenterline",
  9637. 0xfe4e,
  9638. "lowlinecmb",
  9639. 0x0332,
  9640. "lowlinedashed",
  9641. 0xfe4d,
  9642. "lozenge",
  9643. 0x25ca,
  9644. "lparen",
  9645. 0x24a7,
  9646. "lslash",
  9647. 0x0142,
  9648. "lsquare",
  9649. 0x2113,
  9650. "lsuperior",
  9651. 0xf6ee,
  9652. "ltshade",
  9653. 0x2591,
  9654. "luthai",
  9655. 0x0e26,
  9656. "lvocalicbengali",
  9657. 0x098c,
  9658. "lvocalicdeva",
  9659. 0x090c,
  9660. "lvocalicvowelsignbengali",
  9661. 0x09e2,
  9662. "lvocalicvowelsigndeva",
  9663. 0x0962,
  9664. "lxsquare",
  9665. 0x33d3,
  9666. "m",
  9667. 0x006d,
  9668. "mabengali",
  9669. 0x09ae,
  9670. "macron",
  9671. 0x00af,
  9672. "macronbelowcmb",
  9673. 0x0331,
  9674. "macroncmb",
  9675. 0x0304,
  9676. "macronlowmod",
  9677. 0x02cd,
  9678. "macronmonospace",
  9679. 0xffe3,
  9680. "macute",
  9681. 0x1e3f,
  9682. "madeva",
  9683. 0x092e,
  9684. "magujarati",
  9685. 0x0aae,
  9686. "magurmukhi",
  9687. 0x0a2e,
  9688. "mahapakhhebrew",
  9689. 0x05a4,
  9690. "mahapakhlefthebrew",
  9691. 0x05a4,
  9692. "mahiragana",
  9693. 0x307e,
  9694. "maichattawalowleftthai",
  9695. 0xf895,
  9696. "maichattawalowrightthai",
  9697. 0xf894,
  9698. "maichattawathai",
  9699. 0x0e4b,
  9700. "maichattawaupperleftthai",
  9701. 0xf893,
  9702. "maieklowleftthai",
  9703. 0xf88c,
  9704. "maieklowrightthai",
  9705. 0xf88b,
  9706. "maiekthai",
  9707. 0x0e48,
  9708. "maiekupperleftthai",
  9709. 0xf88a,
  9710. "maihanakatleftthai",
  9711. 0xf884,
  9712. "maihanakatthai",
  9713. 0x0e31,
  9714. "maitaikhuleftthai",
  9715. 0xf889,
  9716. "maitaikhuthai",
  9717. 0x0e47,
  9718. "maitholowleftthai",
  9719. 0xf88f,
  9720. "maitholowrightthai",
  9721. 0xf88e,
  9722. "maithothai",
  9723. 0x0e49,
  9724. "maithoupperleftthai",
  9725. 0xf88d,
  9726. "maitrilowleftthai",
  9727. 0xf892,
  9728. "maitrilowrightthai",
  9729. 0xf891,
  9730. "maitrithai",
  9731. 0x0e4a,
  9732. "maitriupperleftthai",
  9733. 0xf890,
  9734. "maiyamokthai",
  9735. 0x0e46,
  9736. "makatakana",
  9737. 0x30de,
  9738. "makatakanahalfwidth",
  9739. 0xff8f,
  9740. "male",
  9741. 0x2642,
  9742. "mansyonsquare",
  9743. 0x3347,
  9744. "maqafhebrew",
  9745. 0x05be,
  9746. "mars",
  9747. 0x2642,
  9748. "masoracirclehebrew",
  9749. 0x05af,
  9750. "masquare",
  9751. 0x3383,
  9752. "mbopomofo",
  9753. 0x3107,
  9754. "mbsquare",
  9755. 0x33d4,
  9756. "mcircle",
  9757. 0x24dc,
  9758. "mcubedsquare",
  9759. 0x33a5,
  9760. "mdotaccent",
  9761. 0x1e41,
  9762. "mdotbelow",
  9763. 0x1e43,
  9764. "meemarabic",
  9765. 0x0645,
  9766. "meemfinalarabic",
  9767. 0xfee2,
  9768. "meeminitialarabic",
  9769. 0xfee3,
  9770. "meemmedialarabic",
  9771. 0xfee4,
  9772. "meemmeeminitialarabic",
  9773. 0xfcd1,
  9774. "meemmeemisolatedarabic",
  9775. 0xfc48,
  9776. "meetorusquare",
  9777. 0x334d,
  9778. "mehiragana",
  9779. 0x3081,
  9780. "meizierasquare",
  9781. 0x337e,
  9782. "mekatakana",
  9783. 0x30e1,
  9784. "mekatakanahalfwidth",
  9785. 0xff92,
  9786. "mem",
  9787. 0x05de,
  9788. "memdagesh",
  9789. 0xfb3e,
  9790. "memdageshhebrew",
  9791. 0xfb3e,
  9792. "memhebrew",
  9793. 0x05de,
  9794. "menarmenian",
  9795. 0x0574,
  9796. "merkhahebrew",
  9797. 0x05a5,
  9798. "merkhakefulahebrew",
  9799. 0x05a6,
  9800. "merkhakefulalefthebrew",
  9801. 0x05a6,
  9802. "merkhalefthebrew",
  9803. 0x05a5,
  9804. "mhook",
  9805. 0x0271,
  9806. "mhzsquare",
  9807. 0x3392,
  9808. "middledotkatakanahalfwidth",
  9809. 0xff65,
  9810. "middot",
  9811. 0x00b7,
  9812. "mieumacirclekorean",
  9813. 0x3272,
  9814. "mieumaparenkorean",
  9815. 0x3212,
  9816. "mieumcirclekorean",
  9817. 0x3264,
  9818. "mieumkorean",
  9819. 0x3141,
  9820. "mieumpansioskorean",
  9821. 0x3170,
  9822. "mieumparenkorean",
  9823. 0x3204,
  9824. "mieumpieupkorean",
  9825. 0x316e,
  9826. "mieumsioskorean",
  9827. 0x316f,
  9828. "mihiragana",
  9829. 0x307f,
  9830. "mikatakana",
  9831. 0x30df,
  9832. "mikatakanahalfwidth",
  9833. 0xff90,
  9834. "minus",
  9835. 0x2212,
  9836. "minusbelowcmb",
  9837. 0x0320,
  9838. "minuscircle",
  9839. 0x2296,
  9840. "minusmod",
  9841. 0x02d7,
  9842. "minusplus",
  9843. 0x2213,
  9844. "minute",
  9845. 0x2032,
  9846. "miribaarusquare",
  9847. 0x334a,
  9848. "mirisquare",
  9849. 0x3349,
  9850. "mlonglegturned",
  9851. 0x0270,
  9852. "mlsquare",
  9853. 0x3396,
  9854. "mmcubedsquare",
  9855. 0x33a3,
  9856. "mmonospace",
  9857. 0xff4d,
  9858. "mmsquaredsquare",
  9859. 0x339f,
  9860. "mohiragana",
  9861. 0x3082,
  9862. "mohmsquare",
  9863. 0x33c1,
  9864. "mokatakana",
  9865. 0x30e2,
  9866. "mokatakanahalfwidth",
  9867. 0xff93,
  9868. "molsquare",
  9869. 0x33d6,
  9870. "momathai",
  9871. 0x0e21,
  9872. "moverssquare",
  9873. 0x33a7,
  9874. "moverssquaredsquare",
  9875. 0x33a8,
  9876. "mparen",
  9877. 0x24a8,
  9878. "mpasquare",
  9879. 0x33ab,
  9880. "mssquare",
  9881. 0x33b3,
  9882. "msuperior",
  9883. 0xf6ef,
  9884. "mturned",
  9885. 0x026f,
  9886. "mu",
  9887. 0x00b5,
  9888. "mu1",
  9889. 0x00b5,
  9890. "muasquare",
  9891. 0x3382,
  9892. "muchgreater",
  9893. 0x226b,
  9894. "muchless",
  9895. 0x226a,
  9896. "mufsquare",
  9897. 0x338c,
  9898. "mugreek",
  9899. 0x03bc,
  9900. "mugsquare",
  9901. 0x338d,
  9902. "muhiragana",
  9903. 0x3080,
  9904. "mukatakana",
  9905. 0x30e0,
  9906. "mukatakanahalfwidth",
  9907. 0xff91,
  9908. "mulsquare",
  9909. 0x3395,
  9910. "multiply",
  9911. 0x00d7,
  9912. "mumsquare",
  9913. 0x339b,
  9914. "munahhebrew",
  9915. 0x05a3,
  9916. "munahlefthebrew",
  9917. 0x05a3,
  9918. "musicalnote",
  9919. 0x266a,
  9920. "musicalnotedbl",
  9921. 0x266b,
  9922. "musicflatsign",
  9923. 0x266d,
  9924. "musicsharpsign",
  9925. 0x266f,
  9926. "mussquare",
  9927. 0x33b2,
  9928. "muvsquare",
  9929. 0x33b6,
  9930. "muwsquare",
  9931. 0x33bc,
  9932. "mvmegasquare",
  9933. 0x33b9,
  9934. "mvsquare",
  9935. 0x33b7,
  9936. "mwmegasquare",
  9937. 0x33bf,
  9938. "mwsquare",
  9939. 0x33bd,
  9940. "n",
  9941. 0x006e,
  9942. "nabengali",
  9943. 0x09a8,
  9944. "nabla",
  9945. 0x2207,
  9946. "nacute",
  9947. 0x0144,
  9948. "nadeva",
  9949. 0x0928,
  9950. "nagujarati",
  9951. 0x0aa8,
  9952. "nagurmukhi",
  9953. 0x0a28,
  9954. "nahiragana",
  9955. 0x306a,
  9956. "nakatakana",
  9957. 0x30ca,
  9958. "nakatakanahalfwidth",
  9959. 0xff85,
  9960. "napostrophe",
  9961. 0x0149,
  9962. "nasquare",
  9963. 0x3381,
  9964. "nbopomofo",
  9965. 0x310b,
  9966. "nbspace",
  9967. 0x00a0,
  9968. "ncaron",
  9969. 0x0148,
  9970. "ncedilla",
  9971. 0x0146,
  9972. "ncircle",
  9973. 0x24dd,
  9974. "ncircumflexbelow",
  9975. 0x1e4b,
  9976. "ncommaaccent",
  9977. 0x0146,
  9978. "ndotaccent",
  9979. 0x1e45,
  9980. "ndotbelow",
  9981. 0x1e47,
  9982. "nehiragana",
  9983. 0x306d,
  9984. "nekatakana",
  9985. 0x30cd,
  9986. "nekatakanahalfwidth",
  9987. 0xff88,
  9988. "newsheqelsign",
  9989. 0x20aa,
  9990. "nfsquare",
  9991. 0x338b,
  9992. "ngabengali",
  9993. 0x0999,
  9994. "ngadeva",
  9995. 0x0919,
  9996. "ngagujarati",
  9997. 0x0a99,
  9998. "ngagurmukhi",
  9999. 0x0a19,
  10000. "ngonguthai",
  10001. 0x0e07,
  10002. "nhiragana",
  10003. 0x3093,
  10004. "nhookleft",
  10005. 0x0272,
  10006. "nhookretroflex",
  10007. 0x0273,
  10008. "nieunacirclekorean",
  10009. 0x326f,
  10010. "nieunaparenkorean",
  10011. 0x320f,
  10012. "nieuncieuckorean",
  10013. 0x3135,
  10014. "nieuncirclekorean",
  10015. 0x3261,
  10016. "nieunhieuhkorean",
  10017. 0x3136,
  10018. "nieunkorean",
  10019. 0x3134,
  10020. "nieunpansioskorean",
  10021. 0x3168,
  10022. "nieunparenkorean",
  10023. 0x3201,
  10024. "nieunsioskorean",
  10025. 0x3167,
  10026. "nieuntikeutkorean",
  10027. 0x3166,
  10028. "nihiragana",
  10029. 0x306b,
  10030. "nikatakana",
  10031. 0x30cb,
  10032. "nikatakanahalfwidth",
  10033. 0xff86,
  10034. "nikhahitleftthai",
  10035. 0xf899,
  10036. "nikhahitthai",
  10037. 0x0e4d,
  10038. "nine",
  10039. 0x0039,
  10040. "ninearabic",
  10041. 0x0669,
  10042. "ninebengali",
  10043. 0x09ef,
  10044. "ninecircle",
  10045. 0x2468,
  10046. "ninecircleinversesansserif",
  10047. 0x2792,
  10048. "ninedeva",
  10049. 0x096f,
  10050. "ninegujarati",
  10051. 0x0aef,
  10052. "ninegurmukhi",
  10053. 0x0a6f,
  10054. "ninehackarabic",
  10055. 0x0669,
  10056. "ninehangzhou",
  10057. 0x3029,
  10058. "nineideographicparen",
  10059. 0x3228,
  10060. "nineinferior",
  10061. 0x2089,
  10062. "ninemonospace",
  10063. 0xff19,
  10064. "nineoldstyle",
  10065. 0xf739,
  10066. "nineparen",
  10067. 0x247c,
  10068. "nineperiod",
  10069. 0x2490,
  10070. "ninepersian",
  10071. 0x06f9,
  10072. "nineroman",
  10073. 0x2178,
  10074. "ninesuperior",
  10075. 0x2079,
  10076. "nineteencircle",
  10077. 0x2472,
  10078. "nineteenparen",
  10079. 0x2486,
  10080. "nineteenperiod",
  10081. 0x249a,
  10082. "ninethai",
  10083. 0x0e59,
  10084. "nj",
  10085. 0x01cc,
  10086. "njecyrillic",
  10087. 0x045a,
  10088. "nkatakana",
  10089. 0x30f3,
  10090. "nkatakanahalfwidth",
  10091. 0xff9d,
  10092. "nlegrightlong",
  10093. 0x019e,
  10094. "nlinebelow",
  10095. 0x1e49,
  10096. "nmonospace",
  10097. 0xff4e,
  10098. "nmsquare",
  10099. 0x339a,
  10100. "nnabengali",
  10101. 0x09a3,
  10102. "nnadeva",
  10103. 0x0923,
  10104. "nnagujarati",
  10105. 0x0aa3,
  10106. "nnagurmukhi",
  10107. 0x0a23,
  10108. "nnnadeva",
  10109. 0x0929,
  10110. "nohiragana",
  10111. 0x306e,
  10112. "nokatakana",
  10113. 0x30ce,
  10114. "nokatakanahalfwidth",
  10115. 0xff89,
  10116. "nonbreakingspace",
  10117. 0x00a0,
  10118. "nonenthai",
  10119. 0x0e13,
  10120. "nonuthai",
  10121. 0x0e19,
  10122. "noonarabic",
  10123. 0x0646,
  10124. "noonfinalarabic",
  10125. 0xfee6,
  10126. "noonghunnaarabic",
  10127. 0x06ba,
  10128. "noonghunnafinalarabic",
  10129. 0xfb9f,
  10130. "nooninitialarabic",
  10131. 0xfee7,
  10132. "noonjeeminitialarabic",
  10133. 0xfcd2,
  10134. "noonjeemisolatedarabic",
  10135. 0xfc4b,
  10136. "noonmedialarabic",
  10137. 0xfee8,
  10138. "noonmeeminitialarabic",
  10139. 0xfcd5,
  10140. "noonmeemisolatedarabic",
  10141. 0xfc4e,
  10142. "noonnoonfinalarabic",
  10143. 0xfc8d,
  10144. "notcontains",
  10145. 0x220c,
  10146. "notelement",
  10147. 0x2209,
  10148. "notelementof",
  10149. 0x2209,
  10150. "notequal",
  10151. 0x2260,
  10152. "notgreater",
  10153. 0x226f,
  10154. "notgreaternorequal",
  10155. 0x2271,
  10156. "notgreaternorless",
  10157. 0x2279,
  10158. "notidentical",
  10159. 0x2262,
  10160. "notless",
  10161. 0x226e,
  10162. "notlessnorequal",
  10163. 0x2270,
  10164. "notparallel",
  10165. 0x2226,
  10166. "notprecedes",
  10167. 0x2280,
  10168. "notsubset",
  10169. 0x2284,
  10170. "notsucceeds",
  10171. 0x2281,
  10172. "notsuperset",
  10173. 0x2285,
  10174. "nowarmenian",
  10175. 0x0576,
  10176. "nparen",
  10177. 0x24a9,
  10178. "nssquare",
  10179. 0x33b1,
  10180. "nsuperior",
  10181. 0x207f,
  10182. "ntilde",
  10183. 0x00f1,
  10184. "nu",
  10185. 0x03bd,
  10186. "nuhiragana",
  10187. 0x306c,
  10188. "nukatakana",
  10189. 0x30cc,
  10190. "nukatakanahalfwidth",
  10191. 0xff87,
  10192. "nuktabengali",
  10193. 0x09bc,
  10194. "nuktadeva",
  10195. 0x093c,
  10196. "nuktagujarati",
  10197. 0x0abc,
  10198. "nuktagurmukhi",
  10199. 0x0a3c,
  10200. "numbersign",
  10201. 0x0023,
  10202. "numbersignmonospace",
  10203. 0xff03,
  10204. "numbersignsmall",
  10205. 0xfe5f,
  10206. "numeralsigngreek",
  10207. 0x0374,
  10208. "numeralsignlowergreek",
  10209. 0x0375,
  10210. "numero",
  10211. 0x2116,
  10212. "nun",
  10213. 0x05e0,
  10214. "nundagesh",
  10215. 0xfb40,
  10216. "nundageshhebrew",
  10217. 0xfb40,
  10218. "nunhebrew",
  10219. 0x05e0,
  10220. "nvsquare",
  10221. 0x33b5,
  10222. "nwsquare",
  10223. 0x33bb,
  10224. "nyabengali",
  10225. 0x099e,
  10226. "nyadeva",
  10227. 0x091e,
  10228. "nyagujarati",
  10229. 0x0a9e,
  10230. "nyagurmukhi",
  10231. 0x0a1e,
  10232. "o",
  10233. 0x006f,
  10234. "oacute",
  10235. 0x00f3,
  10236. "oangthai",
  10237. 0x0e2d,
  10238. "obarred",
  10239. 0x0275,
  10240. "obarredcyrillic",
  10241. 0x04e9,
  10242. "obarreddieresiscyrillic",
  10243. 0x04eb,
  10244. "obengali",
  10245. 0x0993,
  10246. "obopomofo",
  10247. 0x311b,
  10248. "obreve",
  10249. 0x014f,
  10250. "ocandradeva",
  10251. 0x0911,
  10252. "ocandragujarati",
  10253. 0x0a91,
  10254. "ocandravowelsigndeva",
  10255. 0x0949,
  10256. "ocandravowelsigngujarati",
  10257. 0x0ac9,
  10258. "ocaron",
  10259. 0x01d2,
  10260. "ocircle",
  10261. 0x24de,
  10262. "ocircumflex",
  10263. 0x00f4,
  10264. "ocircumflexacute",
  10265. 0x1ed1,
  10266. "ocircumflexdotbelow",
  10267. 0x1ed9,
  10268. "ocircumflexgrave",
  10269. 0x1ed3,
  10270. "ocircumflexhookabove",
  10271. 0x1ed5,
  10272. "ocircumflextilde",
  10273. 0x1ed7,
  10274. "ocyrillic",
  10275. 0x043e,
  10276. "odblacute",
  10277. 0x0151,
  10278. "odblgrave",
  10279. 0x020d,
  10280. "odeva",
  10281. 0x0913,
  10282. "odieresis",
  10283. 0x00f6,
  10284. "odieresiscyrillic",
  10285. 0x04e7,
  10286. "odotbelow",
  10287. 0x1ecd,
  10288. "oe",
  10289. 0x0153,
  10290. "oekorean",
  10291. 0x315a,
  10292. "ogonek",
  10293. 0x02db,
  10294. "ogonekcmb",
  10295. 0x0328,
  10296. "ograve",
  10297. 0x00f2,
  10298. "ogujarati",
  10299. 0x0a93,
  10300. "oharmenian",
  10301. 0x0585,
  10302. "ohiragana",
  10303. 0x304a,
  10304. "ohookabove",
  10305. 0x1ecf,
  10306. "ohorn",
  10307. 0x01a1,
  10308. "ohornacute",
  10309. 0x1edb,
  10310. "ohorndotbelow",
  10311. 0x1ee3,
  10312. "ohorngrave",
  10313. 0x1edd,
  10314. "ohornhookabove",
  10315. 0x1edf,
  10316. "ohorntilde",
  10317. 0x1ee1,
  10318. "ohungarumlaut",
  10319. 0x0151,
  10320. "oi",
  10321. 0x01a3,
  10322. "oinvertedbreve",
  10323. 0x020f,
  10324. "okatakana",
  10325. 0x30aa,
  10326. "okatakanahalfwidth",
  10327. 0xff75,
  10328. "okorean",
  10329. 0x3157,
  10330. "olehebrew",
  10331. 0x05ab,
  10332. "omacron",
  10333. 0x014d,
  10334. "omacronacute",
  10335. 0x1e53,
  10336. "omacrongrave",
  10337. 0x1e51,
  10338. "omdeva",
  10339. 0x0950,
  10340. "omega",
  10341. 0x03c9,
  10342. "omega1",
  10343. 0x03d6,
  10344. "omegacyrillic",
  10345. 0x0461,
  10346. "omegalatinclosed",
  10347. 0x0277,
  10348. "omegaroundcyrillic",
  10349. 0x047b,
  10350. "omegatitlocyrillic",
  10351. 0x047d,
  10352. "omegatonos",
  10353. 0x03ce,
  10354. "omgujarati",
  10355. 0x0ad0,
  10356. "omicron",
  10357. 0x03bf,
  10358. "omicrontonos",
  10359. 0x03cc,
  10360. "omonospace",
  10361. 0xff4f,
  10362. "one",
  10363. 0x0031,
  10364. "onearabic",
  10365. 0x0661,
  10366. "onebengali",
  10367. 0x09e7,
  10368. "onecircle",
  10369. 0x2460,
  10370. "onecircleinversesansserif",
  10371. 0x278a,
  10372. "onedeva",
  10373. 0x0967,
  10374. "onedotenleader",
  10375. 0x2024,
  10376. "oneeighth",
  10377. 0x215b,
  10378. "onefitted",
  10379. 0xf6dc,
  10380. "onegujarati",
  10381. 0x0ae7,
  10382. "onegurmukhi",
  10383. 0x0a67,
  10384. "onehackarabic",
  10385. 0x0661,
  10386. "onehalf",
  10387. 0x00bd,
  10388. "onehangzhou",
  10389. 0x3021,
  10390. "oneideographicparen",
  10391. 0x3220,
  10392. "oneinferior",
  10393. 0x2081,
  10394. "onemonospace",
  10395. 0xff11,
  10396. "onenumeratorbengali",
  10397. 0x09f4,
  10398. "oneoldstyle",
  10399. 0xf731,
  10400. "oneparen",
  10401. 0x2474,
  10402. "oneperiod",
  10403. 0x2488,
  10404. "onepersian",
  10405. 0x06f1,
  10406. "onequarter",
  10407. 0x00bc,
  10408. "oneroman",
  10409. 0x2170,
  10410. "onesuperior",
  10411. 0x00b9,
  10412. "onethai",
  10413. 0x0e51,
  10414. "onethird",
  10415. 0x2153,
  10416. "oogonek",
  10417. 0x01eb,
  10418. "oogonekmacron",
  10419. 0x01ed,
  10420. "oogurmukhi",
  10421. 0x0a13,
  10422. "oomatragurmukhi",
  10423. 0x0a4b,
  10424. "oopen",
  10425. 0x0254,
  10426. "oparen",
  10427. 0x24aa,
  10428. "openbullet",
  10429. 0x25e6,
  10430. "option",
  10431. 0x2325,
  10432. "ordfeminine",
  10433. 0x00aa,
  10434. "ordmasculine",
  10435. 0x00ba,
  10436. "orthogonal",
  10437. 0x221f,
  10438. "oshortdeva",
  10439. 0x0912,
  10440. "oshortvowelsigndeva",
  10441. 0x094a,
  10442. "oslash",
  10443. 0x00f8,
  10444. "oslashacute",
  10445. 0x01ff,
  10446. "osmallhiragana",
  10447. 0x3049,
  10448. "osmallkatakana",
  10449. 0x30a9,
  10450. "osmallkatakanahalfwidth",
  10451. 0xff6b,
  10452. "ostrokeacute",
  10453. 0x01ff,
  10454. "osuperior",
  10455. 0xf6f0,
  10456. "otcyrillic",
  10457. 0x047f,
  10458. "otilde",
  10459. 0x00f5,
  10460. "otildeacute",
  10461. 0x1e4d,
  10462. "otildedieresis",
  10463. 0x1e4f,
  10464. "oubopomofo",
  10465. 0x3121,
  10466. "overline",
  10467. 0x203e,
  10468. "overlinecenterline",
  10469. 0xfe4a,
  10470. "overlinecmb",
  10471. 0x0305,
  10472. "overlinedashed",
  10473. 0xfe49,
  10474. "overlinedblwavy",
  10475. 0xfe4c,
  10476. "overlinewavy",
  10477. 0xfe4b,
  10478. "overscore",
  10479. 0x00af,
  10480. "ovowelsignbengali",
  10481. 0x09cb,
  10482. "ovowelsigndeva",
  10483. 0x094b,
  10484. "ovowelsigngujarati",
  10485. 0x0acb,
  10486. "p",
  10487. 0x0070,
  10488. "paampssquare",
  10489. 0x3380,
  10490. "paasentosquare",
  10491. 0x332b,
  10492. "pabengali",
  10493. 0x09aa,
  10494. "pacute",
  10495. 0x1e55,
  10496. "padeva",
  10497. 0x092a,
  10498. "pagedown",
  10499. 0x21df,
  10500. "pageup",
  10501. 0x21de,
  10502. "pagujarati",
  10503. 0x0aaa,
  10504. "pagurmukhi",
  10505. 0x0a2a,
  10506. "pahiragana",
  10507. 0x3071,
  10508. "paiyannoithai",
  10509. 0x0e2f,
  10510. "pakatakana",
  10511. 0x30d1,
  10512. "palatalizationcyrilliccmb",
  10513. 0x0484,
  10514. "palochkacyrillic",
  10515. 0x04c0,
  10516. "pansioskorean",
  10517. 0x317f,
  10518. "paragraph",
  10519. 0x00b6,
  10520. "parallel",
  10521. 0x2225,
  10522. "parenleft",
  10523. 0x0028,
  10524. "parenleftaltonearabic",
  10525. 0xfd3e,
  10526. "parenleftbt",
  10527. 0xf8ed,
  10528. "parenleftex",
  10529. 0xf8ec,
  10530. "parenleftinferior",
  10531. 0x208d,
  10532. "parenleftmonospace",
  10533. 0xff08,
  10534. "parenleftsmall",
  10535. 0xfe59,
  10536. "parenleftsuperior",
  10537. 0x207d,
  10538. "parenlefttp",
  10539. 0xf8eb,
  10540. "parenleftvertical",
  10541. 0xfe35,
  10542. "parenright",
  10543. 0x0029,
  10544. "parenrightaltonearabic",
  10545. 0xfd3f,
  10546. "parenrightbt",
  10547. 0xf8f8,
  10548. "parenrightex",
  10549. 0xf8f7,
  10550. "parenrightinferior",
  10551. 0x208e,
  10552. "parenrightmonospace",
  10553. 0xff09,
  10554. "parenrightsmall",
  10555. 0xfe5a,
  10556. "parenrightsuperior",
  10557. 0x207e,
  10558. "parenrighttp",
  10559. 0xf8f6,
  10560. "parenrightvertical",
  10561. 0xfe36,
  10562. "partialdiff",
  10563. 0x2202,
  10564. "paseqhebrew",
  10565. 0x05c0,
  10566. "pashtahebrew",
  10567. 0x0599,
  10568. "pasquare",
  10569. 0x33a9,
  10570. "patah",
  10571. 0x05b7,
  10572. "patah11",
  10573. 0x05b7,
  10574. "patah1d",
  10575. 0x05b7,
  10576. "patah2a",
  10577. 0x05b7,
  10578. "patahhebrew",
  10579. 0x05b7,
  10580. "patahnarrowhebrew",
  10581. 0x05b7,
  10582. "patahquarterhebrew",
  10583. 0x05b7,
  10584. "patahwidehebrew",
  10585. 0x05b7,
  10586. "pazerhebrew",
  10587. 0x05a1,
  10588. "pbopomofo",
  10589. 0x3106,
  10590. "pcircle",
  10591. 0x24df,
  10592. "pdotaccent",
  10593. 0x1e57,
  10594. "pe",
  10595. 0x05e4,
  10596. "pecyrillic",
  10597. 0x043f,
  10598. "pedagesh",
  10599. 0xfb44,
  10600. "pedageshhebrew",
  10601. 0xfb44,
  10602. "peezisquare",
  10603. 0x333b,
  10604. "pefinaldageshhebrew",
  10605. 0xfb43,
  10606. "peharabic",
  10607. 0x067e,
  10608. "peharmenian",
  10609. 0x057a,
  10610. "pehebrew",
  10611. 0x05e4,
  10612. "pehfinalarabic",
  10613. 0xfb57,
  10614. "pehinitialarabic",
  10615. 0xfb58,
  10616. "pehiragana",
  10617. 0x307a,
  10618. "pehmedialarabic",
  10619. 0xfb59,
  10620. "pekatakana",
  10621. 0x30da,
  10622. "pemiddlehookcyrillic",
  10623. 0x04a7,
  10624. "perafehebrew",
  10625. 0xfb4e,
  10626. "percent",
  10627. 0x0025,
  10628. "percentarabic",
  10629. 0x066a,
  10630. "percentmonospace",
  10631. 0xff05,
  10632. "percentsmall",
  10633. 0xfe6a,
  10634. "period",
  10635. 0x002e,
  10636. "periodarmenian",
  10637. 0x0589,
  10638. "periodcentered",
  10639. 0x00b7,
  10640. "periodhalfwidth",
  10641. 0xff61,
  10642. "periodinferior",
  10643. 0xf6e7,
  10644. "periodmonospace",
  10645. 0xff0e,
  10646. "periodsmall",
  10647. 0xfe52,
  10648. "periodsuperior",
  10649. 0xf6e8,
  10650. "perispomenigreekcmb",
  10651. 0x0342,
  10652. "perpendicular",
  10653. 0x22a5,
  10654. "perthousand",
  10655. 0x2030,
  10656. "peseta",
  10657. 0x20a7,
  10658. "pfsquare",
  10659. 0x338a,
  10660. "phabengali",
  10661. 0x09ab,
  10662. "phadeva",
  10663. 0x092b,
  10664. "phagujarati",
  10665. 0x0aab,
  10666. "phagurmukhi",
  10667. 0x0a2b,
  10668. "phi",
  10669. 0x03c6,
  10670. "phi1",
  10671. 0x03d5,
  10672. "phieuphacirclekorean",
  10673. 0x327a,
  10674. "phieuphaparenkorean",
  10675. 0x321a,
  10676. "phieuphcirclekorean",
  10677. 0x326c,
  10678. "phieuphkorean",
  10679. 0x314d,
  10680. "phieuphparenkorean",
  10681. 0x320c,
  10682. "philatin",
  10683. 0x0278,
  10684. "phinthuthai",
  10685. 0x0e3a,
  10686. "phisymbolgreek",
  10687. 0x03d5,
  10688. "phook",
  10689. 0x01a5,
  10690. "phophanthai",
  10691. 0x0e1e,
  10692. "phophungthai",
  10693. 0x0e1c,
  10694. "phosamphaothai",
  10695. 0x0e20,
  10696. "pi",
  10697. 0x03c0,
  10698. "pieupacirclekorean",
  10699. 0x3273,
  10700. "pieupaparenkorean",
  10701. 0x3213,
  10702. "pieupcieuckorean",
  10703. 0x3176,
  10704. "pieupcirclekorean",
  10705. 0x3265,
  10706. "pieupkiyeokkorean",
  10707. 0x3172,
  10708. "pieupkorean",
  10709. 0x3142,
  10710. "pieupparenkorean",
  10711. 0x3205,
  10712. "pieupsioskiyeokkorean",
  10713. 0x3174,
  10714. "pieupsioskorean",
  10715. 0x3144,
  10716. "pieupsiostikeutkorean",
  10717. 0x3175,
  10718. "pieupthieuthkorean",
  10719. 0x3177,
  10720. "pieuptikeutkorean",
  10721. 0x3173,
  10722. "pihiragana",
  10723. 0x3074,
  10724. "pikatakana",
  10725. 0x30d4,
  10726. "pisymbolgreek",
  10727. 0x03d6,
  10728. "piwrarmenian",
  10729. 0x0583,
  10730. "plus",
  10731. 0x002b,
  10732. "plusbelowcmb",
  10733. 0x031f,
  10734. "pluscircle",
  10735. 0x2295,
  10736. "plusminus",
  10737. 0x00b1,
  10738. "plusmod",
  10739. 0x02d6,
  10740. "plusmonospace",
  10741. 0xff0b,
  10742. "plussmall",
  10743. 0xfe62,
  10744. "plussuperior",
  10745. 0x207a,
  10746. "pmonospace",
  10747. 0xff50,
  10748. "pmsquare",
  10749. 0x33d8,
  10750. "pohiragana",
  10751. 0x307d,
  10752. "pointingindexdownwhite",
  10753. 0x261f,
  10754. "pointingindexleftwhite",
  10755. 0x261c,
  10756. "pointingindexrightwhite",
  10757. 0x261e,
  10758. "pointingindexupwhite",
  10759. 0x261d,
  10760. "pokatakana",
  10761. 0x30dd,
  10762. "poplathai",
  10763. 0x0e1b,
  10764. "postalmark",
  10765. 0x3012,
  10766. "postalmarkface",
  10767. 0x3020,
  10768. "pparen",
  10769. 0x24ab,
  10770. "precedes",
  10771. 0x227a,
  10772. "prescription",
  10773. 0x211e,
  10774. "primemod",
  10775. 0x02b9,
  10776. "primereversed",
  10777. 0x2035,
  10778. "product",
  10779. 0x220f,
  10780. "projective",
  10781. 0x2305,
  10782. "prolongedkana",
  10783. 0x30fc,
  10784. "propellor",
  10785. 0x2318,
  10786. "propersubset",
  10787. 0x2282,
  10788. "propersuperset",
  10789. 0x2283,
  10790. "proportion",
  10791. 0x2237,
  10792. "proportional",
  10793. 0x221d,
  10794. "psi",
  10795. 0x03c8,
  10796. "psicyrillic",
  10797. 0x0471,
  10798. "psilipneumatacyrilliccmb",
  10799. 0x0486,
  10800. "pssquare",
  10801. 0x33b0,
  10802. "puhiragana",
  10803. 0x3077,
  10804. "pukatakana",
  10805. 0x30d7,
  10806. "pvsquare",
  10807. 0x33b4,
  10808. "pwsquare",
  10809. 0x33ba,
  10810. "q",
  10811. 0x0071,
  10812. "qadeva",
  10813. 0x0958,
  10814. "qadmahebrew",
  10815. 0x05a8,
  10816. "qafarabic",
  10817. 0x0642,
  10818. "qaffinalarabic",
  10819. 0xfed6,
  10820. "qafinitialarabic",
  10821. 0xfed7,
  10822. "qafmedialarabic",
  10823. 0xfed8,
  10824. "qamats",
  10825. 0x05b8,
  10826. "qamats10",
  10827. 0x05b8,
  10828. "qamats1a",
  10829. 0x05b8,
  10830. "qamats1c",
  10831. 0x05b8,
  10832. "qamats27",
  10833. 0x05b8,
  10834. "qamats29",
  10835. 0x05b8,
  10836. "qamats33",
  10837. 0x05b8,
  10838. "qamatsde",
  10839. 0x05b8,
  10840. "qamatshebrew",
  10841. 0x05b8,
  10842. "qamatsnarrowhebrew",
  10843. 0x05b8,
  10844. "qamatsqatanhebrew",
  10845. 0x05b8,
  10846. "qamatsqatannarrowhebrew",
  10847. 0x05b8,
  10848. "qamatsqatanquarterhebrew",
  10849. 0x05b8,
  10850. "qamatsqatanwidehebrew",
  10851. 0x05b8,
  10852. "qamatsquarterhebrew",
  10853. 0x05b8,
  10854. "qamatswidehebrew",
  10855. 0x05b8,
  10856. "qarneyparahebrew",
  10857. 0x059f,
  10858. "qbopomofo",
  10859. 0x3111,
  10860. "qcircle",
  10861. 0x24e0,
  10862. "qhook",
  10863. 0x02a0,
  10864. "qmonospace",
  10865. 0xff51,
  10866. "qof",
  10867. 0x05e7,
  10868. "qofdagesh",
  10869. 0xfb47,
  10870. "qofdageshhebrew",
  10871. 0xfb47,
  10872. "qofhebrew",
  10873. 0x05e7,
  10874. "qparen",
  10875. 0x24ac,
  10876. "quarternote",
  10877. 0x2669,
  10878. "qubuts",
  10879. 0x05bb,
  10880. "qubuts18",
  10881. 0x05bb,
  10882. "qubuts25",
  10883. 0x05bb,
  10884. "qubuts31",
  10885. 0x05bb,
  10886. "qubutshebrew",
  10887. 0x05bb,
  10888. "qubutsnarrowhebrew",
  10889. 0x05bb,
  10890. "qubutsquarterhebrew",
  10891. 0x05bb,
  10892. "qubutswidehebrew",
  10893. 0x05bb,
  10894. "question",
  10895. 0x003f,
  10896. "questionarabic",
  10897. 0x061f,
  10898. "questionarmenian",
  10899. 0x055e,
  10900. "questiondown",
  10901. 0x00bf,
  10902. "questiondownsmall",
  10903. 0xf7bf,
  10904. "questiongreek",
  10905. 0x037e,
  10906. "questionmonospace",
  10907. 0xff1f,
  10908. "questionsmall",
  10909. 0xf73f,
  10910. "quotedbl",
  10911. 0x0022,
  10912. "quotedblbase",
  10913. 0x201e,
  10914. "quotedblleft",
  10915. 0x201c,
  10916. "quotedblmonospace",
  10917. 0xff02,
  10918. "quotedblprime",
  10919. 0x301e,
  10920. "quotedblprimereversed",
  10921. 0x301d,
  10922. "quotedblright",
  10923. 0x201d,
  10924. "quoteleft",
  10925. 0x2018,
  10926. "quoteleftreversed",
  10927. 0x201b,
  10928. "quotereversed",
  10929. 0x201b,
  10930. "quoteright",
  10931. 0x2019,
  10932. "quoterightn",
  10933. 0x0149,
  10934. "quotesinglbase",
  10935. 0x201a,
  10936. "quotesingle",
  10937. 0x0027,
  10938. "quotesinglemonospace",
  10939. 0xff07,
  10940. "r",
  10941. 0x0072,
  10942. "raarmenian",
  10943. 0x057c,
  10944. "rabengali",
  10945. 0x09b0,
  10946. "racute",
  10947. 0x0155,
  10948. "radeva",
  10949. 0x0930,
  10950. "radical",
  10951. 0x221a,
  10952. "radicalex",
  10953. 0xf8e5,
  10954. "radoverssquare",
  10955. 0x33ae,
  10956. "radoverssquaredsquare",
  10957. 0x33af,
  10958. "radsquare",
  10959. 0x33ad,
  10960. "rafe",
  10961. 0x05bf,
  10962. "rafehebrew",
  10963. 0x05bf,
  10964. "ragujarati",
  10965. 0x0ab0,
  10966. "ragurmukhi",
  10967. 0x0a30,
  10968. "rahiragana",
  10969. 0x3089,
  10970. "rakatakana",
  10971. 0x30e9,
  10972. "rakatakanahalfwidth",
  10973. 0xff97,
  10974. "ralowerdiagonalbengali",
  10975. 0x09f1,
  10976. "ramiddlediagonalbengali",
  10977. 0x09f0,
  10978. "ramshorn",
  10979. 0x0264,
  10980. "ratio",
  10981. 0x2236,
  10982. "rbopomofo",
  10983. 0x3116,
  10984. "rcaron",
  10985. 0x0159,
  10986. "rcedilla",
  10987. 0x0157,
  10988. "rcircle",
  10989. 0x24e1,
  10990. "rcommaaccent",
  10991. 0x0157,
  10992. "rdblgrave",
  10993. 0x0211,
  10994. "rdotaccent",
  10995. 0x1e59,
  10996. "rdotbelow",
  10997. 0x1e5b,
  10998. "rdotbelowmacron",
  10999. 0x1e5d,
  11000. "referencemark",
  11001. 0x203b,
  11002. "reflexsubset",
  11003. 0x2286,
  11004. "reflexsuperset",
  11005. 0x2287,
  11006. "registered",
  11007. 0x00ae,
  11008. "registersans",
  11009. 0xf8e8,
  11010. "registerserif",
  11011. 0xf6da,
  11012. "reharabic",
  11013. 0x0631,
  11014. "reharmenian",
  11015. 0x0580,
  11016. "rehfinalarabic",
  11017. 0xfeae,
  11018. "rehiragana",
  11019. 0x308c,
  11020. "rekatakana",
  11021. 0x30ec,
  11022. "rekatakanahalfwidth",
  11023. 0xff9a,
  11024. "resh",
  11025. 0x05e8,
  11026. "reshdageshhebrew",
  11027. 0xfb48,
  11028. "reshhebrew",
  11029. 0x05e8,
  11030. "reversedtilde",
  11031. 0x223d,
  11032. "reviahebrew",
  11033. 0x0597,
  11034. "reviamugrashhebrew",
  11035. 0x0597,
  11036. "revlogicalnot",
  11037. 0x2310,
  11038. "rfishhook",
  11039. 0x027e,
  11040. "rfishhookreversed",
  11041. 0x027f,
  11042. "rhabengali",
  11043. 0x09dd,
  11044. "rhadeva",
  11045. 0x095d,
  11046. "rho",
  11047. 0x03c1,
  11048. "rhook",
  11049. 0x027d,
  11050. "rhookturned",
  11051. 0x027b,
  11052. "rhookturnedsuperior",
  11053. 0x02b5,
  11054. "rhosymbolgreek",
  11055. 0x03f1,
  11056. "rhotichookmod",
  11057. 0x02de,
  11058. "rieulacirclekorean",
  11059. 0x3271,
  11060. "rieulaparenkorean",
  11061. 0x3211,
  11062. "rieulcirclekorean",
  11063. 0x3263,
  11064. "rieulhieuhkorean",
  11065. 0x3140,
  11066. "rieulkiyeokkorean",
  11067. 0x313a,
  11068. "rieulkiyeoksioskorean",
  11069. 0x3169,
  11070. "rieulkorean",
  11071. 0x3139,
  11072. "rieulmieumkorean",
  11073. 0x313b,
  11074. "rieulpansioskorean",
  11075. 0x316c,
  11076. "rieulparenkorean",
  11077. 0x3203,
  11078. "rieulphieuphkorean",
  11079. 0x313f,
  11080. "rieulpieupkorean",
  11081. 0x313c,
  11082. "rieulpieupsioskorean",
  11083. 0x316b,
  11084. "rieulsioskorean",
  11085. 0x313d,
  11086. "rieulthieuthkorean",
  11087. 0x313e,
  11088. "rieultikeutkorean",
  11089. 0x316a,
  11090. "rieulyeorinhieuhkorean",
  11091. 0x316d,
  11092. "rightangle",
  11093. 0x221f,
  11094. "righttackbelowcmb",
  11095. 0x0319,
  11096. "righttriangle",
  11097. 0x22bf,
  11098. "rihiragana",
  11099. 0x308a,
  11100. "rikatakana",
  11101. 0x30ea,
  11102. "rikatakanahalfwidth",
  11103. 0xff98,
  11104. "ring",
  11105. 0x02da,
  11106. "ringbelowcmb",
  11107. 0x0325,
  11108. "ringcmb",
  11109. 0x030a,
  11110. "ringhalfleft",
  11111. 0x02bf,
  11112. "ringhalfleftarmenian",
  11113. 0x0559,
  11114. "ringhalfleftbelowcmb",
  11115. 0x031c,
  11116. "ringhalfleftcentered",
  11117. 0x02d3,
  11118. "ringhalfright",
  11119. 0x02be,
  11120. "ringhalfrightbelowcmb",
  11121. 0x0339,
  11122. "ringhalfrightcentered",
  11123. 0x02d2,
  11124. "rinvertedbreve",
  11125. 0x0213,
  11126. "rittorusquare",
  11127. 0x3351,
  11128. "rlinebelow",
  11129. 0x1e5f,
  11130. "rlongleg",
  11131. 0x027c,
  11132. "rlonglegturned",
  11133. 0x027a,
  11134. "rmonospace",
  11135. 0xff52,
  11136. "rohiragana",
  11137. 0x308d,
  11138. "rokatakana",
  11139. 0x30ed,
  11140. "rokatakanahalfwidth",
  11141. 0xff9b,
  11142. "roruathai",
  11143. 0x0e23,
  11144. "rparen",
  11145. 0x24ad,
  11146. "rrabengali",
  11147. 0x09dc,
  11148. "rradeva",
  11149. 0x0931,
  11150. "rragurmukhi",
  11151. 0x0a5c,
  11152. "rreharabic",
  11153. 0x0691,
  11154. "rrehfinalarabic",
  11155. 0xfb8d,
  11156. "rrvocalicbengali",
  11157. 0x09e0,
  11158. "rrvocalicdeva",
  11159. 0x0960,
  11160. "rrvocalicgujarati",
  11161. 0x0ae0,
  11162. "rrvocalicvowelsignbengali",
  11163. 0x09c4,
  11164. "rrvocalicvowelsigndeva",
  11165. 0x0944,
  11166. "rrvocalicvowelsigngujarati",
  11167. 0x0ac4,
  11168. "rsuperior",
  11169. 0xf6f1,
  11170. "rtblock",
  11171. 0x2590,
  11172. "rturned",
  11173. 0x0279,
  11174. "rturnedsuperior",
  11175. 0x02b4,
  11176. "ruhiragana",
  11177. 0x308b,
  11178. "rukatakana",
  11179. 0x30eb,
  11180. "rukatakanahalfwidth",
  11181. 0xff99,
  11182. "rupeemarkbengali",
  11183. 0x09f2,
  11184. "rupeesignbengali",
  11185. 0x09f3,
  11186. "rupiah",
  11187. 0xf6dd,
  11188. "ruthai",
  11189. 0x0e24,
  11190. "rvocalicbengali",
  11191. 0x098b,
  11192. "rvocalicdeva",
  11193. 0x090b,
  11194. "rvocalicgujarati",
  11195. 0x0a8b,
  11196. "rvocalicvowelsignbengali",
  11197. 0x09c3,
  11198. "rvocalicvowelsigndeva",
  11199. 0x0943,
  11200. "rvocalicvowelsigngujarati",
  11201. 0x0ac3,
  11202. "s",
  11203. 0x0073,
  11204. "sabengali",
  11205. 0x09b8,
  11206. "sacute",
  11207. 0x015b,
  11208. "sacutedotaccent",
  11209. 0x1e65,
  11210. "sadarabic",
  11211. 0x0635,
  11212. "sadeva",
  11213. 0x0938,
  11214. "sadfinalarabic",
  11215. 0xfeba,
  11216. "sadinitialarabic",
  11217. 0xfebb,
  11218. "sadmedialarabic",
  11219. 0xfebc,
  11220. "sagujarati",
  11221. 0x0ab8,
  11222. "sagurmukhi",
  11223. 0x0a38,
  11224. "sahiragana",
  11225. 0x3055,
  11226. "sakatakana",
  11227. 0x30b5,
  11228. "sakatakanahalfwidth",
  11229. 0xff7b,
  11230. "sallallahoualayhewasallamarabic",
  11231. 0xfdfa,
  11232. "samekh",
  11233. 0x05e1,
  11234. "samekhdagesh",
  11235. 0xfb41,
  11236. "samekhdageshhebrew",
  11237. 0xfb41,
  11238. "samekhhebrew",
  11239. 0x05e1,
  11240. "saraaathai",
  11241. 0x0e32,
  11242. "saraaethai",
  11243. 0x0e41,
  11244. "saraaimaimalaithai",
  11245. 0x0e44,
  11246. "saraaimaimuanthai",
  11247. 0x0e43,
  11248. "saraamthai",
  11249. 0x0e33,
  11250. "saraathai",
  11251. 0x0e30,
  11252. "saraethai",
  11253. 0x0e40,
  11254. "saraiileftthai",
  11255. 0xf886,
  11256. "saraiithai",
  11257. 0x0e35,
  11258. "saraileftthai",
  11259. 0xf885,
  11260. "saraithai",
  11261. 0x0e34,
  11262. "saraothai",
  11263. 0x0e42,
  11264. "saraueeleftthai",
  11265. 0xf888,
  11266. "saraueethai",
  11267. 0x0e37,
  11268. "saraueleftthai",
  11269. 0xf887,
  11270. "sarauethai",
  11271. 0x0e36,
  11272. "sarauthai",
  11273. 0x0e38,
  11274. "sarauuthai",
  11275. 0x0e39,
  11276. "sbopomofo",
  11277. 0x3119,
  11278. "scaron",
  11279. 0x0161,
  11280. "scarondotaccent",
  11281. 0x1e67,
  11282. "scedilla",
  11283. 0x015f,
  11284. "schwa",
  11285. 0x0259,
  11286. "schwacyrillic",
  11287. 0x04d9,
  11288. "schwadieresiscyrillic",
  11289. 0x04db,
  11290. "schwahook",
  11291. 0x025a,
  11292. "scircle",
  11293. 0x24e2,
  11294. "scircumflex",
  11295. 0x015d,
  11296. "scommaaccent",
  11297. 0x0219,
  11298. "sdotaccent",
  11299. 0x1e61,
  11300. "sdotbelow",
  11301. 0x1e63,
  11302. "sdotbelowdotaccent",
  11303. 0x1e69,
  11304. "seagullbelowcmb",
  11305. 0x033c,
  11306. "second",
  11307. 0x2033,
  11308. "secondtonechinese",
  11309. 0x02ca,
  11310. "section",
  11311. 0x00a7,
  11312. "seenarabic",
  11313. 0x0633,
  11314. "seenfinalarabic",
  11315. 0xfeb2,
  11316. "seeninitialarabic",
  11317. 0xfeb3,
  11318. "seenmedialarabic",
  11319. 0xfeb4,
  11320. "segol",
  11321. 0x05b6,
  11322. "segol13",
  11323. 0x05b6,
  11324. "segol1f",
  11325. 0x05b6,
  11326. "segol2c",
  11327. 0x05b6,
  11328. "segolhebrew",
  11329. 0x05b6,
  11330. "segolnarrowhebrew",
  11331. 0x05b6,
  11332. "segolquarterhebrew",
  11333. 0x05b6,
  11334. "segoltahebrew",
  11335. 0x0592,
  11336. "segolwidehebrew",
  11337. 0x05b6,
  11338. "seharmenian",
  11339. 0x057d,
  11340. "sehiragana",
  11341. 0x305b,
  11342. "sekatakana",
  11343. 0x30bb,
  11344. "sekatakanahalfwidth",
  11345. 0xff7e,
  11346. "semicolon",
  11347. 0x003b,
  11348. "semicolonarabic",
  11349. 0x061b,
  11350. "semicolonmonospace",
  11351. 0xff1b,
  11352. "semicolonsmall",
  11353. 0xfe54,
  11354. "semivoicedmarkkana",
  11355. 0x309c,
  11356. "semivoicedmarkkanahalfwidth",
  11357. 0xff9f,
  11358. "sentisquare",
  11359. 0x3322,
  11360. "sentosquare",
  11361. 0x3323,
  11362. "seven",
  11363. 0x0037,
  11364. "sevenarabic",
  11365. 0x0667,
  11366. "sevenbengali",
  11367. 0x09ed,
  11368. "sevencircle",
  11369. 0x2466,
  11370. "sevencircleinversesansserif",
  11371. 0x2790,
  11372. "sevendeva",
  11373. 0x096d,
  11374. "seveneighths",
  11375. 0x215e,
  11376. "sevengujarati",
  11377. 0x0aed,
  11378. "sevengurmukhi",
  11379. 0x0a6d,
  11380. "sevenhackarabic",
  11381. 0x0667,
  11382. "sevenhangzhou",
  11383. 0x3027,
  11384. "sevenideographicparen",
  11385. 0x3226,
  11386. "seveninferior",
  11387. 0x2087,
  11388. "sevenmonospace",
  11389. 0xff17,
  11390. "sevenoldstyle",
  11391. 0xf737,
  11392. "sevenparen",
  11393. 0x247a,
  11394. "sevenperiod",
  11395. 0x248e,
  11396. "sevenpersian",
  11397. 0x06f7,
  11398. "sevenroman",
  11399. 0x2176,
  11400. "sevensuperior",
  11401. 0x2077,
  11402. "seventeencircle",
  11403. 0x2470,
  11404. "seventeenparen",
  11405. 0x2484,
  11406. "seventeenperiod",
  11407. 0x2498,
  11408. "seventhai",
  11409. 0x0e57,
  11410. "sfthyphen",
  11411. 0x00ad,
  11412. "shaarmenian",
  11413. 0x0577,
  11414. "shabengali",
  11415. 0x09b6,
  11416. "shacyrillic",
  11417. 0x0448,
  11418. "shaddaarabic",
  11419. 0x0651,
  11420. "shaddadammaarabic",
  11421. 0xfc61,
  11422. "shaddadammatanarabic",
  11423. 0xfc5e,
  11424. "shaddafathaarabic",
  11425. 0xfc60,
  11426. "shaddakasraarabic",
  11427. 0xfc62,
  11428. "shaddakasratanarabic",
  11429. 0xfc5f,
  11430. "shade",
  11431. 0x2592,
  11432. "shadedark",
  11433. 0x2593,
  11434. "shadelight",
  11435. 0x2591,
  11436. "shademedium",
  11437. 0x2592,
  11438. "shadeva",
  11439. 0x0936,
  11440. "shagujarati",
  11441. 0x0ab6,
  11442. "shagurmukhi",
  11443. 0x0a36,
  11444. "shalshelethebrew",
  11445. 0x0593,
  11446. "shbopomofo",
  11447. 0x3115,
  11448. "shchacyrillic",
  11449. 0x0449,
  11450. "sheenarabic",
  11451. 0x0634,
  11452. "sheenfinalarabic",
  11453. 0xfeb6,
  11454. "sheeninitialarabic",
  11455. 0xfeb7,
  11456. "sheenmedialarabic",
  11457. 0xfeb8,
  11458. "sheicoptic",
  11459. 0x03e3,
  11460. "sheqel",
  11461. 0x20aa,
  11462. "sheqelhebrew",
  11463. 0x20aa,
  11464. "sheva",
  11465. 0x05b0,
  11466. "sheva115",
  11467. 0x05b0,
  11468. "sheva15",
  11469. 0x05b0,
  11470. "sheva22",
  11471. 0x05b0,
  11472. "sheva2e",
  11473. 0x05b0,
  11474. "shevahebrew",
  11475. 0x05b0,
  11476. "shevanarrowhebrew",
  11477. 0x05b0,
  11478. "shevaquarterhebrew",
  11479. 0x05b0,
  11480. "shevawidehebrew",
  11481. 0x05b0,
  11482. "shhacyrillic",
  11483. 0x04bb,
  11484. "shimacoptic",
  11485. 0x03ed,
  11486. "shin",
  11487. 0x05e9,
  11488. "shindagesh",
  11489. 0xfb49,
  11490. "shindageshhebrew",
  11491. 0xfb49,
  11492. "shindageshshindot",
  11493. 0xfb2c,
  11494. "shindageshshindothebrew",
  11495. 0xfb2c,
  11496. "shindageshsindot",
  11497. 0xfb2d,
  11498. "shindageshsindothebrew",
  11499. 0xfb2d,
  11500. "shindothebrew",
  11501. 0x05c1,
  11502. "shinhebrew",
  11503. 0x05e9,
  11504. "shinshindot",
  11505. 0xfb2a,
  11506. "shinshindothebrew",
  11507. 0xfb2a,
  11508. "shinsindot",
  11509. 0xfb2b,
  11510. "shinsindothebrew",
  11511. 0xfb2b,
  11512. "shook",
  11513. 0x0282,
  11514. "sigma",
  11515. 0x03c3,
  11516. "sigma1",
  11517. 0x03c2,
  11518. "sigmafinal",
  11519. 0x03c2,
  11520. "sigmalunatesymbolgreek",
  11521. 0x03f2,
  11522. "sihiragana",
  11523. 0x3057,
  11524. "sikatakana",
  11525. 0x30b7,
  11526. "sikatakanahalfwidth",
  11527. 0xff7c,
  11528. "siluqhebrew",
  11529. 0x05bd,
  11530. "siluqlefthebrew",
  11531. 0x05bd,
  11532. "similar",
  11533. 0x223c,
  11534. "sindothebrew",
  11535. 0x05c2,
  11536. "siosacirclekorean",
  11537. 0x3274,
  11538. "siosaparenkorean",
  11539. 0x3214,
  11540. "sioscieuckorean",
  11541. 0x317e,
  11542. "sioscirclekorean",
  11543. 0x3266,
  11544. "sioskiyeokkorean",
  11545. 0x317a,
  11546. "sioskorean",
  11547. 0x3145,
  11548. "siosnieunkorean",
  11549. 0x317b,
  11550. "siosparenkorean",
  11551. 0x3206,
  11552. "siospieupkorean",
  11553. 0x317d,
  11554. "siostikeutkorean",
  11555. 0x317c,
  11556. "six",
  11557. 0x0036,
  11558. "sixarabic",
  11559. 0x0666,
  11560. "sixbengali",
  11561. 0x09ec,
  11562. "sixcircle",
  11563. 0x2465,
  11564. "sixcircleinversesansserif",
  11565. 0x278f,
  11566. "sixdeva",
  11567. 0x096c,
  11568. "sixgujarati",
  11569. 0x0aec,
  11570. "sixgurmukhi",
  11571. 0x0a6c,
  11572. "sixhackarabic",
  11573. 0x0666,
  11574. "sixhangzhou",
  11575. 0x3026,
  11576. "sixideographicparen",
  11577. 0x3225,
  11578. "sixinferior",
  11579. 0x2086,
  11580. "sixmonospace",
  11581. 0xff16,
  11582. "sixoldstyle",
  11583. 0xf736,
  11584. "sixparen",
  11585. 0x2479,
  11586. "sixperiod",
  11587. 0x248d,
  11588. "sixpersian",
  11589. 0x06f6,
  11590. "sixroman",
  11591. 0x2175,
  11592. "sixsuperior",
  11593. 0x2076,
  11594. "sixteencircle",
  11595. 0x246f,
  11596. "sixteencurrencydenominatorbengali",
  11597. 0x09f9,
  11598. "sixteenparen",
  11599. 0x2483,
  11600. "sixteenperiod",
  11601. 0x2497,
  11602. "sixthai",
  11603. 0x0e56,
  11604. "slash",
  11605. 0x002f,
  11606. "slashmonospace",
  11607. 0xff0f,
  11608. "slong",
  11609. 0x017f,
  11610. "slongdotaccent",
  11611. 0x1e9b,
  11612. "smileface",
  11613. 0x263a,
  11614. "smonospace",
  11615. 0xff53,
  11616. "sofpasuqhebrew",
  11617. 0x05c3,
  11618. "softhyphen",
  11619. 0x00ad,
  11620. "softsigncyrillic",
  11621. 0x044c,
  11622. "sohiragana",
  11623. 0x305d,
  11624. "sokatakana",
  11625. 0x30bd,
  11626. "sokatakanahalfwidth",
  11627. 0xff7f,
  11628. "soliduslongoverlaycmb",
  11629. 0x0338,
  11630. "solidusshortoverlaycmb",
  11631. 0x0337,
  11632. "sorusithai",
  11633. 0x0e29,
  11634. "sosalathai",
  11635. 0x0e28,
  11636. "sosothai",
  11637. 0x0e0b,
  11638. "sosuathai",
  11639. 0x0e2a,
  11640. "space",
  11641. 0x0020,
  11642. "spacehackarabic",
  11643. 0x0020,
  11644. "spade",
  11645. 0x2660,
  11646. "spadesuitblack",
  11647. 0x2660,
  11648. "spadesuitwhite",
  11649. 0x2664,
  11650. "sparen",
  11651. 0x24ae,
  11652. "squarebelowcmb",
  11653. 0x033b,
  11654. "squarecc",
  11655. 0x33c4,
  11656. "squarecm",
  11657. 0x339d,
  11658. "squarediagonalcrosshatchfill",
  11659. 0x25a9,
  11660. "squarehorizontalfill",
  11661. 0x25a4,
  11662. "squarekg",
  11663. 0x338f,
  11664. "squarekm",
  11665. 0x339e,
  11666. "squarekmcapital",
  11667. 0x33ce,
  11668. "squareln",
  11669. 0x33d1,
  11670. "squarelog",
  11671. 0x33d2,
  11672. "squaremg",
  11673. 0x338e,
  11674. "squaremil",
  11675. 0x33d5,
  11676. "squaremm",
  11677. 0x339c,
  11678. "squaremsquared",
  11679. 0x33a1,
  11680. "squareorthogonalcrosshatchfill",
  11681. 0x25a6,
  11682. "squareupperlefttolowerrightfill",
  11683. 0x25a7,
  11684. "squareupperrighttolowerleftfill",
  11685. 0x25a8,
  11686. "squareverticalfill",
  11687. 0x25a5,
  11688. "squarewhitewithsmallblack",
  11689. 0x25a3,
  11690. "srsquare",
  11691. 0x33db,
  11692. "ssabengali",
  11693. 0x09b7,
  11694. "ssadeva",
  11695. 0x0937,
  11696. "ssagujarati",
  11697. 0x0ab7,
  11698. "ssangcieuckorean",
  11699. 0x3149,
  11700. "ssanghieuhkorean",
  11701. 0x3185,
  11702. "ssangieungkorean",
  11703. 0x3180,
  11704. "ssangkiyeokkorean",
  11705. 0x3132,
  11706. "ssangnieunkorean",
  11707. 0x3165,
  11708. "ssangpieupkorean",
  11709. 0x3143,
  11710. "ssangsioskorean",
  11711. 0x3146,
  11712. "ssangtikeutkorean",
  11713. 0x3138,
  11714. "ssuperior",
  11715. 0xf6f2,
  11716. "sterling",
  11717. 0x00a3,
  11718. "sterlingmonospace",
  11719. 0xffe1,
  11720. "strokelongoverlaycmb",
  11721. 0x0336,
  11722. "strokeshortoverlaycmb",
  11723. 0x0335,
  11724. "subset",
  11725. 0x2282,
  11726. "subsetnotequal",
  11727. 0x228a,
  11728. "subsetorequal",
  11729. 0x2286,
  11730. "succeeds",
  11731. 0x227b,
  11732. "suchthat",
  11733. 0x220b,
  11734. "suhiragana",
  11735. 0x3059,
  11736. "sukatakana",
  11737. 0x30b9,
  11738. "sukatakanahalfwidth",
  11739. 0xff7d,
  11740. "sukunarabic",
  11741. 0x0652,
  11742. "summation",
  11743. 0x2211,
  11744. "sun",
  11745. 0x263c,
  11746. "superset",
  11747. 0x2283,
  11748. "supersetnotequal",
  11749. 0x228b,
  11750. "supersetorequal",
  11751. 0x2287,
  11752. "svsquare",
  11753. 0x33dc,
  11754. "syouwaerasquare",
  11755. 0x337c,
  11756. "t",
  11757. 0x0074,
  11758. "tabengali",
  11759. 0x09a4,
  11760. "tackdown",
  11761. 0x22a4,
  11762. "tackleft",
  11763. 0x22a3,
  11764. "tadeva",
  11765. 0x0924,
  11766. "tagujarati",
  11767. 0x0aa4,
  11768. "tagurmukhi",
  11769. 0x0a24,
  11770. "taharabic",
  11771. 0x0637,
  11772. "tahfinalarabic",
  11773. 0xfec2,
  11774. "tahinitialarabic",
  11775. 0xfec3,
  11776. "tahiragana",
  11777. 0x305f,
  11778. "tahmedialarabic",
  11779. 0xfec4,
  11780. "taisyouerasquare",
  11781. 0x337d,
  11782. "takatakana",
  11783. 0x30bf,
  11784. "takatakanahalfwidth",
  11785. 0xff80,
  11786. "tatweelarabic",
  11787. 0x0640,
  11788. "tau",
  11789. 0x03c4,
  11790. "tav",
  11791. 0x05ea,
  11792. "tavdages",
  11793. 0xfb4a,
  11794. "tavdagesh",
  11795. 0xfb4a,
  11796. "tavdageshhebrew",
  11797. 0xfb4a,
  11798. "tavhebrew",
  11799. 0x05ea,
  11800. "tbar",
  11801. 0x0167,
  11802. "tbopomofo",
  11803. 0x310a,
  11804. "tcaron",
  11805. 0x0165,
  11806. "tccurl",
  11807. 0x02a8,
  11808. "tcedilla",
  11809. 0x0163,
  11810. "tcheharabic",
  11811. 0x0686,
  11812. "tchehfinalarabic",
  11813. 0xfb7b,
  11814. "tchehinitialarabic",
  11815. 0xfb7c,
  11816. "tchehmedialarabic",
  11817. 0xfb7d,
  11818. "tcircle",
  11819. 0x24e3,
  11820. "tcircumflexbelow",
  11821. 0x1e71,
  11822. "tcommaaccent",
  11823. 0x0163,
  11824. "tdieresis",
  11825. 0x1e97,
  11826. "tdotaccent",
  11827. 0x1e6b,
  11828. "tdotbelow",
  11829. 0x1e6d,
  11830. "tecyrillic",
  11831. 0x0442,
  11832. "tedescendercyrillic",
  11833. 0x04ad,
  11834. "teharabic",
  11835. 0x062a,
  11836. "tehfinalarabic",
  11837. 0xfe96,
  11838. "tehhahinitialarabic",
  11839. 0xfca2,
  11840. "tehhahisolatedarabic",
  11841. 0xfc0c,
  11842. "tehinitialarabic",
  11843. 0xfe97,
  11844. "tehiragana",
  11845. 0x3066,
  11846. "tehjeeminitialarabic",
  11847. 0xfca1,
  11848. "tehjeemisolatedarabic",
  11849. 0xfc0b,
  11850. "tehmarbutaarabic",
  11851. 0x0629,
  11852. "tehmarbutafinalarabic",
  11853. 0xfe94,
  11854. "tehmedialarabic",
  11855. 0xfe98,
  11856. "tehmeeminitialarabic",
  11857. 0xfca4,
  11858. "tehmeemisolatedarabic",
  11859. 0xfc0e,
  11860. "tehnoonfinalarabic",
  11861. 0xfc73,
  11862. "tekatakana",
  11863. 0x30c6,
  11864. "tekatakanahalfwidth",
  11865. 0xff83,
  11866. "telephone",
  11867. 0x2121,
  11868. "telephoneblack",
  11869. 0x260e,
  11870. "telishagedolahebrew",
  11871. 0x05a0,
  11872. "telishaqetanahebrew",
  11873. 0x05a9,
  11874. "tencircle",
  11875. 0x2469,
  11876. "tenideographicparen",
  11877. 0x3229,
  11878. "tenparen",
  11879. 0x247d,
  11880. "tenperiod",
  11881. 0x2491,
  11882. "tenroman",
  11883. 0x2179,
  11884. "tesh",
  11885. 0x02a7,
  11886. "tet",
  11887. 0x05d8,
  11888. "tetdagesh",
  11889. 0xfb38,
  11890. "tetdageshhebrew",
  11891. 0xfb38,
  11892. "tethebrew",
  11893. 0x05d8,
  11894. "tetsecyrillic",
  11895. 0x04b5,
  11896. "tevirhebrew",
  11897. 0x059b,
  11898. "tevirlefthebrew",
  11899. 0x059b,
  11900. "thabengali",
  11901. 0x09a5,
  11902. "thadeva",
  11903. 0x0925,
  11904. "thagujarati",
  11905. 0x0aa5,
  11906. "thagurmukhi",
  11907. 0x0a25,
  11908. "thalarabic",
  11909. 0x0630,
  11910. "thalfinalarabic",
  11911. 0xfeac,
  11912. "thanthakhatlowleftthai",
  11913. 0xf898,
  11914. "thanthakhatlowrightthai",
  11915. 0xf897,
  11916. "thanthakhatthai",
  11917. 0x0e4c,
  11918. "thanthakhatupperleftthai",
  11919. 0xf896,
  11920. "theharabic",
  11921. 0x062b,
  11922. "thehfinalarabic",
  11923. 0xfe9a,
  11924. "thehinitialarabic",
  11925. 0xfe9b,
  11926. "thehmedialarabic",
  11927. 0xfe9c,
  11928. "thereexists",
  11929. 0x2203,
  11930. "therefore",
  11931. 0x2234,
  11932. "theta",
  11933. 0x03b8,
  11934. "theta1",
  11935. 0x03d1,
  11936. "thetasymbolgreek",
  11937. 0x03d1,
  11938. "thieuthacirclekorean",
  11939. 0x3279,
  11940. "thieuthaparenkorean",
  11941. 0x3219,
  11942. "thieuthcirclekorean",
  11943. 0x326b,
  11944. "thieuthkorean",
  11945. 0x314c,
  11946. "thieuthparenkorean",
  11947. 0x320b,
  11948. "thirteencircle",
  11949. 0x246c,
  11950. "thirteenparen",
  11951. 0x2480,
  11952. "thirteenperiod",
  11953. 0x2494,
  11954. "thonangmonthothai",
  11955. 0x0e11,
  11956. "thook",
  11957. 0x01ad,
  11958. "thophuthaothai",
  11959. 0x0e12,
  11960. "thorn",
  11961. 0x00fe,
  11962. "thothahanthai",
  11963. 0x0e17,
  11964. "thothanthai",
  11965. 0x0e10,
  11966. "thothongthai",
  11967. 0x0e18,
  11968. "thothungthai",
  11969. 0x0e16,
  11970. "thousandcyrillic",
  11971. 0x0482,
  11972. "thousandsseparatorarabic",
  11973. 0x066c,
  11974. "thousandsseparatorpersian",
  11975. 0x066c,
  11976. "three",
  11977. 0x0033,
  11978. "threearabic",
  11979. 0x0663,
  11980. "threebengali",
  11981. 0x09e9,
  11982. "threecircle",
  11983. 0x2462,
  11984. "threecircleinversesansserif",
  11985. 0x278c,
  11986. "threedeva",
  11987. 0x0969,
  11988. "threeeighths",
  11989. 0x215c,
  11990. "threegujarati",
  11991. 0x0ae9,
  11992. "threegurmukhi",
  11993. 0x0a69,
  11994. "threehackarabic",
  11995. 0x0663,
  11996. "threehangzhou",
  11997. 0x3023,
  11998. "threeideographicparen",
  11999. 0x3222,
  12000. "threeinferior",
  12001. 0x2083,
  12002. "threemonospace",
  12003. 0xff13,
  12004. "threenumeratorbengali",
  12005. 0x09f6,
  12006. "threeoldstyle",
  12007. 0xf733,
  12008. "threeparen",
  12009. 0x2476,
  12010. "threeperiod",
  12011. 0x248a,
  12012. "threepersian",
  12013. 0x06f3,
  12014. "threequarters",
  12015. 0x00be,
  12016. "threequartersemdash",
  12017. 0xf6de,
  12018. "threeroman",
  12019. 0x2172,
  12020. "threesuperior",
  12021. 0x00b3,
  12022. "threethai",
  12023. 0x0e53,
  12024. "thzsquare",
  12025. 0x3394,
  12026. "tihiragana",
  12027. 0x3061,
  12028. "tikatakana",
  12029. 0x30c1,
  12030. "tikatakanahalfwidth",
  12031. 0xff81,
  12032. "tikeutacirclekorean",
  12033. 0x3270,
  12034. "tikeutaparenkorean",
  12035. 0x3210,
  12036. "tikeutcirclekorean",
  12037. 0x3262,
  12038. "tikeutkorean",
  12039. 0x3137,
  12040. "tikeutparenkorean",
  12041. 0x3202,
  12042. "tilde",
  12043. 0x02dc,
  12044. "tildebelowcmb",
  12045. 0x0330,
  12046. "tildecmb",
  12047. 0x0303,
  12048. "tildecomb",
  12049. 0x0303,
  12050. "tildedoublecmb",
  12051. 0x0360,
  12052. "tildeoperator",
  12053. 0x223c,
  12054. "tildeoverlaycmb",
  12055. 0x0334,
  12056. "tildeverticalcmb",
  12057. 0x033e,
  12058. "timescircle",
  12059. 0x2297,
  12060. "tipehahebrew",
  12061. 0x0596,
  12062. "tipehalefthebrew",
  12063. 0x0596,
  12064. "tippigurmukhi",
  12065. 0x0a70,
  12066. "titlocyrilliccmb",
  12067. 0x0483,
  12068. "tiwnarmenian",
  12069. 0x057f,
  12070. "tlinebelow",
  12071. 0x1e6f,
  12072. "tmonospace",
  12073. 0xff54,
  12074. "toarmenian",
  12075. 0x0569,
  12076. "tohiragana",
  12077. 0x3068,
  12078. "tokatakana",
  12079. 0x30c8,
  12080. "tokatakanahalfwidth",
  12081. 0xff84,
  12082. "tonebarextrahighmod",
  12083. 0x02e5,
  12084. "tonebarextralowmod",
  12085. 0x02e9,
  12086. "tonebarhighmod",
  12087. 0x02e6,
  12088. "tonebarlowmod",
  12089. 0x02e8,
  12090. "tonebarmidmod",
  12091. 0x02e7,
  12092. "tonefive",
  12093. 0x01bd,
  12094. "tonesix",
  12095. 0x0185,
  12096. "tonetwo",
  12097. 0x01a8,
  12098. "tonos",
  12099. 0x0384,
  12100. "tonsquare",
  12101. 0x3327,
  12102. "topatakthai",
  12103. 0x0e0f,
  12104. "tortoiseshellbracketleft",
  12105. 0x3014,
  12106. "tortoiseshellbracketleftsmall",
  12107. 0xfe5d,
  12108. "tortoiseshellbracketleftvertical",
  12109. 0xfe39,
  12110. "tortoiseshellbracketright",
  12111. 0x3015,
  12112. "tortoiseshellbracketrightsmall",
  12113. 0xfe5e,
  12114. "tortoiseshellbracketrightvertical",
  12115. 0xfe3a,
  12116. "totaothai",
  12117. 0x0e15,
  12118. "tpalatalhook",
  12119. 0x01ab,
  12120. "tparen",
  12121. 0x24af,
  12122. "trademark",
  12123. 0x2122,
  12124. "trademarksans",
  12125. 0xf8ea,
  12126. "trademarkserif",
  12127. 0xf6db,
  12128. "tretroflexhook",
  12129. 0x0288,
  12130. "triagdn",
  12131. 0x25bc,
  12132. "triaglf",
  12133. 0x25c4,
  12134. "triagrt",
  12135. 0x25ba,
  12136. "triagup",
  12137. 0x25b2,
  12138. "ts",
  12139. 0x02a6,
  12140. "tsadi",
  12141. 0x05e6,
  12142. "tsadidagesh",
  12143. 0xfb46,
  12144. "tsadidageshhebrew",
  12145. 0xfb46,
  12146. "tsadihebrew",
  12147. 0x05e6,
  12148. "tsecyrillic",
  12149. 0x0446,
  12150. "tsere",
  12151. 0x05b5,
  12152. "tsere12",
  12153. 0x05b5,
  12154. "tsere1e",
  12155. 0x05b5,
  12156. "tsere2b",
  12157. 0x05b5,
  12158. "tserehebrew",
  12159. 0x05b5,
  12160. "tserenarrowhebrew",
  12161. 0x05b5,
  12162. "tserequarterhebrew",
  12163. 0x05b5,
  12164. "tserewidehebrew",
  12165. 0x05b5,
  12166. "tshecyrillic",
  12167. 0x045b,
  12168. "tsuperior",
  12169. 0xf6f3,
  12170. "ttabengali",
  12171. 0x099f,
  12172. "ttadeva",
  12173. 0x091f,
  12174. "ttagujarati",
  12175. 0x0a9f,
  12176. "ttagurmukhi",
  12177. 0x0a1f,
  12178. "tteharabic",
  12179. 0x0679,
  12180. "ttehfinalarabic",
  12181. 0xfb67,
  12182. "ttehinitialarabic",
  12183. 0xfb68,
  12184. "ttehmedialarabic",
  12185. 0xfb69,
  12186. "tthabengali",
  12187. 0x09a0,
  12188. "tthadeva",
  12189. 0x0920,
  12190. "tthagujarati",
  12191. 0x0aa0,
  12192. "tthagurmukhi",
  12193. 0x0a20,
  12194. "tturned",
  12195. 0x0287,
  12196. "tuhiragana",
  12197. 0x3064,
  12198. "tukatakana",
  12199. 0x30c4,
  12200. "tukatakanahalfwidth",
  12201. 0xff82,
  12202. "tusmallhiragana",
  12203. 0x3063,
  12204. "tusmallkatakana",
  12205. 0x30c3,
  12206. "tusmallkatakanahalfwidth",
  12207. 0xff6f,
  12208. "twelvecircle",
  12209. 0x246b,
  12210. "twelveparen",
  12211. 0x247f,
  12212. "twelveperiod",
  12213. 0x2493,
  12214. "twelveroman",
  12215. 0x217b,
  12216. "twentycircle",
  12217. 0x2473,
  12218. "twentyhangzhou",
  12219. 0x5344,
  12220. "twentyparen",
  12221. 0x2487,
  12222. "twentyperiod",
  12223. 0x249b,
  12224. "two",
  12225. 0x0032,
  12226. "twoarabic",
  12227. 0x0662,
  12228. "twobengali",
  12229. 0x09e8,
  12230. "twocircle",
  12231. 0x2461,
  12232. "twocircleinversesansserif",
  12233. 0x278b,
  12234. "twodeva",
  12235. 0x0968,
  12236. "twodotenleader",
  12237. 0x2025,
  12238. "twodotleader",
  12239. 0x2025,
  12240. "twodotleadervertical",
  12241. 0xfe30,
  12242. "twogujarati",
  12243. 0x0ae8,
  12244. "twogurmukhi",
  12245. 0x0a68,
  12246. "twohackarabic",
  12247. 0x0662,
  12248. "twohangzhou",
  12249. 0x3022,
  12250. "twoideographicparen",
  12251. 0x3221,
  12252. "twoinferior",
  12253. 0x2082,
  12254. "twomonospace",
  12255. 0xff12,
  12256. "twonumeratorbengali",
  12257. 0x09f5,
  12258. "twooldstyle",
  12259. 0xf732,
  12260. "twoparen",
  12261. 0x2475,
  12262. "twoperiod",
  12263. 0x2489,
  12264. "twopersian",
  12265. 0x06f2,
  12266. "tworoman",
  12267. 0x2171,
  12268. "twostroke",
  12269. 0x01bb,
  12270. "twosuperior",
  12271. 0x00b2,
  12272. "twothai",
  12273. 0x0e52,
  12274. "twothirds",
  12275. 0x2154,
  12276. "u",
  12277. 0x0075,
  12278. "uacute",
  12279. 0x00fa,
  12280. "ubar",
  12281. 0x0289,
  12282. "ubengali",
  12283. 0x0989,
  12284. "ubopomofo",
  12285. 0x3128,
  12286. "ubreve",
  12287. 0x016d,
  12288. "ucaron",
  12289. 0x01d4,
  12290. "ucircle",
  12291. 0x24e4,
  12292. "ucircumflex",
  12293. 0x00fb,
  12294. "ucircumflexbelow",
  12295. 0x1e77,
  12296. "ucyrillic",
  12297. 0x0443,
  12298. "udattadeva",
  12299. 0x0951,
  12300. "udblacute",
  12301. 0x0171,
  12302. "udblgrave",
  12303. 0x0215,
  12304. "udeva",
  12305. 0x0909,
  12306. "udieresis",
  12307. 0x00fc,
  12308. "udieresisacute",
  12309. 0x01d8,
  12310. "udieresisbelow",
  12311. 0x1e73,
  12312. "udieresiscaron",
  12313. 0x01da,
  12314. "udieresiscyrillic",
  12315. 0x04f1,
  12316. "udieresisgrave",
  12317. 0x01dc,
  12318. "udieresismacron",
  12319. 0x01d6,
  12320. "udotbelow",
  12321. 0x1ee5,
  12322. "ugrave",
  12323. 0x00f9,
  12324. "ugujarati",
  12325. 0x0a89,
  12326. "ugurmukhi",
  12327. 0x0a09,
  12328. "uhiragana",
  12329. 0x3046,
  12330. "uhookabove",
  12331. 0x1ee7,
  12332. "uhorn",
  12333. 0x01b0,
  12334. "uhornacute",
  12335. 0x1ee9,
  12336. "uhorndotbelow",
  12337. 0x1ef1,
  12338. "uhorngrave",
  12339. 0x1eeb,
  12340. "uhornhookabove",
  12341. 0x1eed,
  12342. "uhorntilde",
  12343. 0x1eef,
  12344. "uhungarumlaut",
  12345. 0x0171,
  12346. "uhungarumlautcyrillic",
  12347. 0x04f3,
  12348. "uinvertedbreve",
  12349. 0x0217,
  12350. "ukatakana",
  12351. 0x30a6,
  12352. "ukatakanahalfwidth",
  12353. 0xff73,
  12354. "ukcyrillic",
  12355. 0x0479,
  12356. "ukorean",
  12357. 0x315c,
  12358. "umacron",
  12359. 0x016b,
  12360. "umacroncyrillic",
  12361. 0x04ef,
  12362. "umacrondieresis",
  12363. 0x1e7b,
  12364. "umatragurmukhi",
  12365. 0x0a41,
  12366. "umonospace",
  12367. 0xff55,
  12368. "underscore",
  12369. 0x005f,
  12370. "underscoredbl",
  12371. 0x2017,
  12372. "underscoremonospace",
  12373. 0xff3f,
  12374. "underscorevertical",
  12375. 0xfe33,
  12376. "underscorewavy",
  12377. 0xfe4f,
  12378. "union",
  12379. 0x222a,
  12380. "universal",
  12381. 0x2200,
  12382. "uogonek",
  12383. 0x0173,
  12384. "uparen",
  12385. 0x24b0,
  12386. "upblock",
  12387. 0x2580,
  12388. "upperdothebrew",
  12389. 0x05c4,
  12390. "upsilon",
  12391. 0x03c5,
  12392. "upsilondieresis",
  12393. 0x03cb,
  12394. "upsilondieresistonos",
  12395. 0x03b0,
  12396. "upsilonlatin",
  12397. 0x028a,
  12398. "upsilontonos",
  12399. 0x03cd,
  12400. "uptackbelowcmb",
  12401. 0x031d,
  12402. "uptackmod",
  12403. 0x02d4,
  12404. "uragurmukhi",
  12405. 0x0a73,
  12406. "uring",
  12407. 0x016f,
  12408. "ushortcyrillic",
  12409. 0x045e,
  12410. "usmallhiragana",
  12411. 0x3045,
  12412. "usmallkatakana",
  12413. 0x30a5,
  12414. "usmallkatakanahalfwidth",
  12415. 0xff69,
  12416. "ustraightcyrillic",
  12417. 0x04af,
  12418. "ustraightstrokecyrillic",
  12419. 0x04b1,
  12420. "utilde",
  12421. 0x0169,
  12422. "utildeacute",
  12423. 0x1e79,
  12424. "utildebelow",
  12425. 0x1e75,
  12426. "uubengali",
  12427. 0x098a,
  12428. "uudeva",
  12429. 0x090a,
  12430. "uugujarati",
  12431. 0x0a8a,
  12432. "uugurmukhi",
  12433. 0x0a0a,
  12434. "uumatragurmukhi",
  12435. 0x0a42,
  12436. "uuvowelsignbengali",
  12437. 0x09c2,
  12438. "uuvowelsigndeva",
  12439. 0x0942,
  12440. "uuvowelsigngujarati",
  12441. 0x0ac2,
  12442. "uvowelsignbengali",
  12443. 0x09c1,
  12444. "uvowelsigndeva",
  12445. 0x0941,
  12446. "uvowelsigngujarati",
  12447. 0x0ac1,
  12448. "v",
  12449. 0x0076,
  12450. "vadeva",
  12451. 0x0935,
  12452. "vagujarati",
  12453. 0x0ab5,
  12454. "vagurmukhi",
  12455. 0x0a35,
  12456. "vakatakana",
  12457. 0x30f7,
  12458. "vav",
  12459. 0x05d5,
  12460. "vavdagesh",
  12461. 0xfb35,
  12462. "vavdagesh65",
  12463. 0xfb35,
  12464. "vavdageshhebrew",
  12465. 0xfb35,
  12466. "vavhebrew",
  12467. 0x05d5,
  12468. "vavholam",
  12469. 0xfb4b,
  12470. "vavholamhebrew",
  12471. 0xfb4b,
  12472. "vavvavhebrew",
  12473. 0x05f0,
  12474. "vavyodhebrew",
  12475. 0x05f1,
  12476. "vcircle",
  12477. 0x24e5,
  12478. "vdotbelow",
  12479. 0x1e7f,
  12480. "vecyrillic",
  12481. 0x0432,
  12482. "veharabic",
  12483. 0x06a4,
  12484. "vehfinalarabic",
  12485. 0xfb6b,
  12486. "vehinitialarabic",
  12487. 0xfb6c,
  12488. "vehmedialarabic",
  12489. 0xfb6d,
  12490. "vekatakana",
  12491. 0x30f9,
  12492. "venus",
  12493. 0x2640,
  12494. "verticalbar",
  12495. 0x007c,
  12496. "verticallineabovecmb",
  12497. 0x030d,
  12498. "verticallinebelowcmb",
  12499. 0x0329,
  12500. "verticallinelowmod",
  12501. 0x02cc,
  12502. "verticallinemod",
  12503. 0x02c8,
  12504. "vewarmenian",
  12505. 0x057e,
  12506. "vhook",
  12507. 0x028b,
  12508. "vikatakana",
  12509. 0x30f8,
  12510. "viramabengali",
  12511. 0x09cd,
  12512. "viramadeva",
  12513. 0x094d,
  12514. "viramagujarati",
  12515. 0x0acd,
  12516. "visargabengali",
  12517. 0x0983,
  12518. "visargadeva",
  12519. 0x0903,
  12520. "visargagujarati",
  12521. 0x0a83,
  12522. "vmonospace",
  12523. 0xff56,
  12524. "voarmenian",
  12525. 0x0578,
  12526. "voicediterationhiragana",
  12527. 0x309e,
  12528. "voicediterationkatakana",
  12529. 0x30fe,
  12530. "voicedmarkkana",
  12531. 0x309b,
  12532. "voicedmarkkanahalfwidth",
  12533. 0xff9e,
  12534. "vokatakana",
  12535. 0x30fa,
  12536. "vparen",
  12537. 0x24b1,
  12538. "vtilde",
  12539. 0x1e7d,
  12540. "vturned",
  12541. 0x028c,
  12542. "vuhiragana",
  12543. 0x3094,
  12544. "vukatakana",
  12545. 0x30f4,
  12546. "w",
  12547. 0x0077,
  12548. "wacute",
  12549. 0x1e83,
  12550. "waekorean",
  12551. 0x3159,
  12552. "wahiragana",
  12553. 0x308f,
  12554. "wakatakana",
  12555. 0x30ef,
  12556. "wakatakanahalfwidth",
  12557. 0xff9c,
  12558. "wakorean",
  12559. 0x3158,
  12560. "wasmallhiragana",
  12561. 0x308e,
  12562. "wasmallkatakana",
  12563. 0x30ee,
  12564. "wattosquare",
  12565. 0x3357,
  12566. "wavedash",
  12567. 0x301c,
  12568. "wavyunderscorevertical",
  12569. 0xfe34,
  12570. "wawarabic",
  12571. 0x0648,
  12572. "wawfinalarabic",
  12573. 0xfeee,
  12574. "wawhamzaabovearabic",
  12575. 0x0624,
  12576. "wawhamzaabovefinalarabic",
  12577. 0xfe86,
  12578. "wbsquare",
  12579. 0x33dd,
  12580. "wcircle",
  12581. 0x24e6,
  12582. "wcircumflex",
  12583. 0x0175,
  12584. "wdieresis",
  12585. 0x1e85,
  12586. "wdotaccent",
  12587. 0x1e87,
  12588. "wdotbelow",
  12589. 0x1e89,
  12590. "wehiragana",
  12591. 0x3091,
  12592. "weierstrass",
  12593. 0x2118,
  12594. "wekatakana",
  12595. 0x30f1,
  12596. "wekorean",
  12597. 0x315e,
  12598. "weokorean",
  12599. 0x315d,
  12600. "wgrave",
  12601. 0x1e81,
  12602. "whitebullet",
  12603. 0x25e6,
  12604. "whitecircle",
  12605. 0x25cb,
  12606. "whitecircleinverse",
  12607. 0x25d9,
  12608. "whitecornerbracketleft",
  12609. 0x300e,
  12610. "whitecornerbracketleftvertical",
  12611. 0xfe43,
  12612. "whitecornerbracketright",
  12613. 0x300f,
  12614. "whitecornerbracketrightvertical",
  12615. 0xfe44,
  12616. "whitediamond",
  12617. 0x25c7,
  12618. "whitediamondcontainingblacksmalldiamond",
  12619. 0x25c8,
  12620. "whitedownpointingsmalltriangle",
  12621. 0x25bf,
  12622. "whitedownpointingtriangle",
  12623. 0x25bd,
  12624. "whiteleftpointingsmalltriangle",
  12625. 0x25c3,
  12626. "whiteleftpointingtriangle",
  12627. 0x25c1,
  12628. "whitelenticularbracketleft",
  12629. 0x3016,
  12630. "whitelenticularbracketright",
  12631. 0x3017,
  12632. "whiterightpointingsmalltriangle",
  12633. 0x25b9,
  12634. "whiterightpointingtriangle",
  12635. 0x25b7,
  12636. "whitesmallsquare",
  12637. 0x25ab,
  12638. "whitesmilingface",
  12639. 0x263a,
  12640. "whitesquare",
  12641. 0x25a1,
  12642. "whitestar",
  12643. 0x2606,
  12644. "whitetelephone",
  12645. 0x260f,
  12646. "whitetortoiseshellbracketleft",
  12647. 0x3018,
  12648. "whitetortoiseshellbracketright",
  12649. 0x3019,
  12650. "whiteuppointingsmalltriangle",
  12651. 0x25b5,
  12652. "whiteuppointingtriangle",
  12653. 0x25b3,
  12654. "wihiragana",
  12655. 0x3090,
  12656. "wikatakana",
  12657. 0x30f0,
  12658. "wikorean",
  12659. 0x315f,
  12660. "wmonospace",
  12661. 0xff57,
  12662. "wohiragana",
  12663. 0x3092,
  12664. "wokatakana",
  12665. 0x30f2,
  12666. "wokatakanahalfwidth",
  12667. 0xff66,
  12668. "won",
  12669. 0x20a9,
  12670. "wonmonospace",
  12671. 0xffe6,
  12672. "wowaenthai",
  12673. 0x0e27,
  12674. "wparen",
  12675. 0x24b2,
  12676. "wring",
  12677. 0x1e98,
  12678. "wsuperior",
  12679. 0x02b7,
  12680. "wturned",
  12681. 0x028d,
  12682. "wynn",
  12683. 0x01bf,
  12684. "x",
  12685. 0x0078,
  12686. "xabovecmb",
  12687. 0x033d,
  12688. "xbopomofo",
  12689. 0x3112,
  12690. "xcircle",
  12691. 0x24e7,
  12692. "xdieresis",
  12693. 0x1e8d,
  12694. "xdotaccent",
  12695. 0x1e8b,
  12696. "xeharmenian",
  12697. 0x056d,
  12698. "xi",
  12699. 0x03be,
  12700. "xmonospace",
  12701. 0xff58,
  12702. "xparen",
  12703. 0x24b3,
  12704. "xsuperior",
  12705. 0x02e3,
  12706. "y",
  12707. 0x0079,
  12708. "yaadosquare",
  12709. 0x334e,
  12710. "yabengali",
  12711. 0x09af,
  12712. "yacute",
  12713. 0x00fd,
  12714. "yadeva",
  12715. 0x092f,
  12716. "yaekorean",
  12717. 0x3152,
  12718. "yagujarati",
  12719. 0x0aaf,
  12720. "yagurmukhi",
  12721. 0x0a2f,
  12722. "yahiragana",
  12723. 0x3084,
  12724. "yakatakana",
  12725. 0x30e4,
  12726. "yakatakanahalfwidth",
  12727. 0xff94,
  12728. "yakorean",
  12729. 0x3151,
  12730. "yamakkanthai",
  12731. 0x0e4e,
  12732. "yasmallhiragana",
  12733. 0x3083,
  12734. "yasmallkatakana",
  12735. 0x30e3,
  12736. "yasmallkatakanahalfwidth",
  12737. 0xff6c,
  12738. "yatcyrillic",
  12739. 0x0463,
  12740. "ycircle",
  12741. 0x24e8,
  12742. "ycircumflex",
  12743. 0x0177,
  12744. "ydieresis",
  12745. 0x00ff,
  12746. "ydotaccent",
  12747. 0x1e8f,
  12748. "ydotbelow",
  12749. 0x1ef5,
  12750. "yeharabic",
  12751. 0x064a,
  12752. "yehbarreearabic",
  12753. 0x06d2,
  12754. "yehbarreefinalarabic",
  12755. 0xfbaf,
  12756. "yehfinalarabic",
  12757. 0xfef2,
  12758. "yehhamzaabovearabic",
  12759. 0x0626,
  12760. "yehhamzaabovefinalarabic",
  12761. 0xfe8a,
  12762. "yehhamzaaboveinitialarabic",
  12763. 0xfe8b,
  12764. "yehhamzaabovemedialarabic",
  12765. 0xfe8c,
  12766. "yehinitialarabic",
  12767. 0xfef3,
  12768. "yehmedialarabic",
  12769. 0xfef4,
  12770. "yehmeeminitialarabic",
  12771. 0xfcdd,
  12772. "yehmeemisolatedarabic",
  12773. 0xfc58,
  12774. "yehnoonfinalarabic",
  12775. 0xfc94,
  12776. "yehthreedotsbelowarabic",
  12777. 0x06d1,
  12778. "yekorean",
  12779. 0x3156,
  12780. "yen",
  12781. 0x00a5,
  12782. "yenmonospace",
  12783. 0xffe5,
  12784. "yeokorean",
  12785. 0x3155,
  12786. "yeorinhieuhkorean",
  12787. 0x3186,
  12788. "yerahbenyomohebrew",
  12789. 0x05aa,
  12790. "yerahbenyomolefthebrew",
  12791. 0x05aa,
  12792. "yericyrillic",
  12793. 0x044b,
  12794. "yerudieresiscyrillic",
  12795. 0x04f9,
  12796. "yesieungkorean",
  12797. 0x3181,
  12798. "yesieungpansioskorean",
  12799. 0x3183,
  12800. "yesieungsioskorean",
  12801. 0x3182,
  12802. "yetivhebrew",
  12803. 0x059a,
  12804. "ygrave",
  12805. 0x1ef3,
  12806. "yhook",
  12807. 0x01b4,
  12808. "yhookabove",
  12809. 0x1ef7,
  12810. "yiarmenian",
  12811. 0x0575,
  12812. "yicyrillic",
  12813. 0x0457,
  12814. "yikorean",
  12815. 0x3162,
  12816. "yinyang",
  12817. 0x262f,
  12818. "yiwnarmenian",
  12819. 0x0582,
  12820. "ymonospace",
  12821. 0xff59,
  12822. "yod",
  12823. 0x05d9,
  12824. "yoddagesh",
  12825. 0xfb39,
  12826. "yoddageshhebrew",
  12827. 0xfb39,
  12828. "yodhebrew",
  12829. 0x05d9,
  12830. "yodyodhebrew",
  12831. 0x05f2,
  12832. "yodyodpatahhebrew",
  12833. 0xfb1f,
  12834. "yohiragana",
  12835. 0x3088,
  12836. "yoikorean",
  12837. 0x3189,
  12838. "yokatakana",
  12839. 0x30e8,
  12840. "yokatakanahalfwidth",
  12841. 0xff96,
  12842. "yokorean",
  12843. 0x315b,
  12844. "yosmallhiragana",
  12845. 0x3087,
  12846. "yosmallkatakana",
  12847. 0x30e7,
  12848. "yosmallkatakanahalfwidth",
  12849. 0xff6e,
  12850. "yotgreek",
  12851. 0x03f3,
  12852. "yoyaekorean",
  12853. 0x3188,
  12854. "yoyakorean",
  12855. 0x3187,
  12856. "yoyakthai",
  12857. 0x0e22,
  12858. "yoyingthai",
  12859. 0x0e0d,
  12860. "yparen",
  12861. 0x24b4,
  12862. "ypogegrammeni",
  12863. 0x037a,
  12864. "ypogegrammenigreekcmb",
  12865. 0x0345,
  12866. "yr",
  12867. 0x01a6,
  12868. "yring",
  12869. 0x1e99,
  12870. "ysuperior",
  12871. 0x02b8,
  12872. "ytilde",
  12873. 0x1ef9,
  12874. "yturned",
  12875. 0x028e,
  12876. "yuhiragana",
  12877. 0x3086,
  12878. "yuikorean",
  12879. 0x318c,
  12880. "yukatakana",
  12881. 0x30e6,
  12882. "yukatakanahalfwidth",
  12883. 0xff95,
  12884. "yukorean",
  12885. 0x3160,
  12886. "yusbigcyrillic",
  12887. 0x046b,
  12888. "yusbigiotifiedcyrillic",
  12889. 0x046d,
  12890. "yuslittlecyrillic",
  12891. 0x0467,
  12892. "yuslittleiotifiedcyrillic",
  12893. 0x0469,
  12894. "yusmallhiragana",
  12895. 0x3085,
  12896. "yusmallkatakana",
  12897. 0x30e5,
  12898. "yusmallkatakanahalfwidth",
  12899. 0xff6d,
  12900. "yuyekorean",
  12901. 0x318b,
  12902. "yuyeokorean",
  12903. 0x318a,
  12904. "yyabengali",
  12905. 0x09df,
  12906. "yyadeva",
  12907. 0x095f,
  12908. "z",
  12909. 0x007a,
  12910. "zaarmenian",
  12911. 0x0566,
  12912. "zacute",
  12913. 0x017a,
  12914. "zadeva",
  12915. 0x095b,
  12916. "zagurmukhi",
  12917. 0x0a5b,
  12918. "zaharabic",
  12919. 0x0638,
  12920. "zahfinalarabic",
  12921. 0xfec6,
  12922. "zahinitialarabic",
  12923. 0xfec7,
  12924. "zahiragana",
  12925. 0x3056,
  12926. "zahmedialarabic",
  12927. 0xfec8,
  12928. "zainarabic",
  12929. 0x0632,
  12930. "zainfinalarabic",
  12931. 0xfeb0,
  12932. "zakatakana",
  12933. 0x30b6,
  12934. "zaqefgadolhebrew",
  12935. 0x0595,
  12936. "zaqefqatanhebrew",
  12937. 0x0594,
  12938. "zarqahebrew",
  12939. 0x0598,
  12940. "zayin",
  12941. 0x05d6,
  12942. "zayindagesh",
  12943. 0xfb36,
  12944. "zayindageshhebrew",
  12945. 0xfb36,
  12946. "zayinhebrew",
  12947. 0x05d6,
  12948. "zbopomofo",
  12949. 0x3117,
  12950. "zcaron",
  12951. 0x017e,
  12952. "zcircle",
  12953. 0x24e9,
  12954. "zcircumflex",
  12955. 0x1e91,
  12956. "zcurl",
  12957. 0x0291,
  12958. "zdot",
  12959. 0x017c,
  12960. "zdotaccent",
  12961. 0x017c,
  12962. "zdotbelow",
  12963. 0x1e93,
  12964. "zecyrillic",
  12965. 0x0437,
  12966. "zedescendercyrillic",
  12967. 0x0499,
  12968. "zedieresiscyrillic",
  12969. 0x04df,
  12970. "zehiragana",
  12971. 0x305c,
  12972. "zekatakana",
  12973. 0x30bc,
  12974. "zero",
  12975. 0x0030,
  12976. "zeroarabic",
  12977. 0x0660,
  12978. "zerobengali",
  12979. 0x09e6,
  12980. "zerodeva",
  12981. 0x0966,
  12982. "zerogujarati",
  12983. 0x0ae6,
  12984. "zerogurmukhi",
  12985. 0x0a66,
  12986. "zerohackarabic",
  12987. 0x0660,
  12988. "zeroinferior",
  12989. 0x2080,
  12990. "zeromonospace",
  12991. 0xff10,
  12992. "zerooldstyle",
  12993. 0xf730,
  12994. "zeropersian",
  12995. 0x06f0,
  12996. "zerosuperior",
  12997. 0x2070,
  12998. "zerothai",
  12999. 0x0e50,
  13000. "zerowidthjoiner",
  13001. 0xfeff,
  13002. "zerowidthnonjoiner",
  13003. 0x200c,
  13004. "zerowidthspace",
  13005. 0x200b,
  13006. "zeta",
  13007. 0x03b6,
  13008. "zhbopomofo",
  13009. 0x3113,
  13010. "zhearmenian",
  13011. 0x056a,
  13012. "zhebrevecyrillic",
  13013. 0x04c2,
  13014. "zhecyrillic",
  13015. 0x0436,
  13016. "zhedescendercyrillic",
  13017. 0x0497,
  13018. "zhedieresiscyrillic",
  13019. 0x04dd,
  13020. "zihiragana",
  13021. 0x3058,
  13022. "zikatakana",
  13023. 0x30b8,
  13024. "zinorhebrew",
  13025. 0x05ae,
  13026. "zlinebelow",
  13027. 0x1e95,
  13028. "zmonospace",
  13029. 0xff5a,
  13030. "zohiragana",
  13031. 0x305e,
  13032. "zokatakana",
  13033. 0x30be,
  13034. "zparen",
  13035. 0x24b5,
  13036. "zretroflexhook",
  13037. 0x0290,
  13038. "zstroke",
  13039. 0x01b6,
  13040. "zuhiragana",
  13041. 0x305a,
  13042. "zukatakana",
  13043. 0x30ba,
  13044. ".notdef",
  13045. 0x0000,
  13046. "angbracketleftbig",
  13047. 0x2329,
  13048. "angbracketleftBig",
  13049. 0x2329,
  13050. "angbracketleftbigg",
  13051. 0x2329,
  13052. "angbracketleftBigg",
  13053. 0x2329,
  13054. "angbracketrightBig",
  13055. 0x232a,
  13056. "angbracketrightbig",
  13057. 0x232a,
  13058. "angbracketrightBigg",
  13059. 0x232a,
  13060. "angbracketrightbigg",
  13061. 0x232a,
  13062. "arrowhookleft",
  13063. 0x21aa,
  13064. "arrowhookright",
  13065. 0x21a9,
  13066. "arrowlefttophalf",
  13067. 0x21bc,
  13068. "arrowleftbothalf",
  13069. 0x21bd,
  13070. "arrownortheast",
  13071. 0x2197,
  13072. "arrownorthwest",
  13073. 0x2196,
  13074. "arrowrighttophalf",
  13075. 0x21c0,
  13076. "arrowrightbothalf",
  13077. 0x21c1,
  13078. "arrowsoutheast",
  13079. 0x2198,
  13080. "arrowsouthwest",
  13081. 0x2199,
  13082. "backslashbig",
  13083. 0x2216,
  13084. "backslashBig",
  13085. 0x2216,
  13086. "backslashBigg",
  13087. 0x2216,
  13088. "backslashbigg",
  13089. 0x2216,
  13090. "bardbl",
  13091. 0x2016,
  13092. "bracehtipdownleft",
  13093. 0xfe37,
  13094. "bracehtipdownright",
  13095. 0xfe37,
  13096. "bracehtipupleft",
  13097. 0xfe38,
  13098. "bracehtipupright",
  13099. 0xfe38,
  13100. "braceleftBig",
  13101. 0x007b,
  13102. "braceleftbig",
  13103. 0x007b,
  13104. "braceleftbigg",
  13105. 0x007b,
  13106. "braceleftBigg",
  13107. 0x007b,
  13108. "bracerightBig",
  13109. 0x007d,
  13110. "bracerightbig",
  13111. 0x007d,
  13112. "bracerightbigg",
  13113. 0x007d,
  13114. "bracerightBigg",
  13115. 0x007d,
  13116. "bracketleftbig",
  13117. 0x005b,
  13118. "bracketleftBig",
  13119. 0x005b,
  13120. "bracketleftbigg",
  13121. 0x005b,
  13122. "bracketleftBigg",
  13123. 0x005b,
  13124. "bracketrightBig",
  13125. 0x005d,
  13126. "bracketrightbig",
  13127. 0x005d,
  13128. "bracketrightbigg",
  13129. 0x005d,
  13130. "bracketrightBigg",
  13131. 0x005d,
  13132. "ceilingleftbig",
  13133. 0x2308,
  13134. "ceilingleftBig",
  13135. 0x2308,
  13136. "ceilingleftBigg",
  13137. 0x2308,
  13138. "ceilingleftbigg",
  13139. 0x2308,
  13140. "ceilingrightbig",
  13141. 0x2309,
  13142. "ceilingrightBig",
  13143. 0x2309,
  13144. "ceilingrightbigg",
  13145. 0x2309,
  13146. "ceilingrightBigg",
  13147. 0x2309,
  13148. "circledotdisplay",
  13149. 0x2299,
  13150. "circledottext",
  13151. 0x2299,
  13152. "circlemultiplydisplay",
  13153. 0x2297,
  13154. "circlemultiplytext",
  13155. 0x2297,
  13156. "circleplusdisplay",
  13157. 0x2295,
  13158. "circleplustext",
  13159. 0x2295,
  13160. "contintegraldisplay",
  13161. 0x222e,
  13162. "contintegraltext",
  13163. 0x222e,
  13164. "coproductdisplay",
  13165. 0x2210,
  13166. "coproducttext",
  13167. 0x2210,
  13168. "floorleftBig",
  13169. 0x230a,
  13170. "floorleftbig",
  13171. 0x230a,
  13172. "floorleftbigg",
  13173. 0x230a,
  13174. "floorleftBigg",
  13175. 0x230a,
  13176. "floorrightbig",
  13177. 0x230b,
  13178. "floorrightBig",
  13179. 0x230b,
  13180. "floorrightBigg",
  13181. 0x230b,
  13182. "floorrightbigg",
  13183. 0x230b,
  13184. "hatwide",
  13185. 0x0302,
  13186. "hatwider",
  13187. 0x0302,
  13188. "hatwidest",
  13189. 0x0302,
  13190. "intercal",
  13191. 0x1d40,
  13192. "integraldisplay",
  13193. 0x222b,
  13194. "integraltext",
  13195. 0x222b,
  13196. "intersectiondisplay",
  13197. 0x22c2,
  13198. "intersectiontext",
  13199. 0x22c2,
  13200. "logicalanddisplay",
  13201. 0x2227,
  13202. "logicalandtext",
  13203. 0x2227,
  13204. "logicalordisplay",
  13205. 0x2228,
  13206. "logicalortext",
  13207. 0x2228,
  13208. "parenleftBig",
  13209. 0x0028,
  13210. "parenleftbig",
  13211. 0x0028,
  13212. "parenleftBigg",
  13213. 0x0028,
  13214. "parenleftbigg",
  13215. 0x0028,
  13216. "parenrightBig",
  13217. 0x0029,
  13218. "parenrightbig",
  13219. 0x0029,
  13220. "parenrightBigg",
  13221. 0x0029,
  13222. "parenrightbigg",
  13223. 0x0029,
  13224. "prime",
  13225. 0x2032,
  13226. "productdisplay",
  13227. 0x220f,
  13228. "producttext",
  13229. 0x220f,
  13230. "radicalbig",
  13231. 0x221a,
  13232. "radicalBig",
  13233. 0x221a,
  13234. "radicalBigg",
  13235. 0x221a,
  13236. "radicalbigg",
  13237. 0x221a,
  13238. "radicalbt",
  13239. 0x221a,
  13240. "radicaltp",
  13241. 0x221a,
  13242. "radicalvertex",
  13243. 0x221a,
  13244. "slashbig",
  13245. 0x002f,
  13246. "slashBig",
  13247. 0x002f,
  13248. "slashBigg",
  13249. 0x002f,
  13250. "slashbigg",
  13251. 0x002f,
  13252. "summationdisplay",
  13253. 0x2211,
  13254. "summationtext",
  13255. 0x2211,
  13256. "tildewide",
  13257. 0x02dc,
  13258. "tildewider",
  13259. 0x02dc,
  13260. "tildewidest",
  13261. 0x02dc,
  13262. "uniondisplay",
  13263. 0x22c3,
  13264. "unionmultidisplay",
  13265. 0x228e,
  13266. "unionmultitext",
  13267. 0x228e,
  13268. "unionsqdisplay",
  13269. 0x2294,
  13270. "unionsqtext",
  13271. 0x2294,
  13272. "uniontext",
  13273. 0x22c3,
  13274. "vextenddouble",
  13275. 0x2225,
  13276. "vextendsingle",
  13277. 0x2223
  13278. ];
  13279. });
  13280. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  13281. return [
  13282. "space",
  13283. 0x0020,
  13284. "a1",
  13285. 0x2701,
  13286. "a2",
  13287. 0x2702,
  13288. "a202",
  13289. 0x2703,
  13290. "a3",
  13291. 0x2704,
  13292. "a4",
  13293. 0x260e,
  13294. "a5",
  13295. 0x2706,
  13296. "a119",
  13297. 0x2707,
  13298. "a118",
  13299. 0x2708,
  13300. "a117",
  13301. 0x2709,
  13302. "a11",
  13303. 0x261b,
  13304. "a12",
  13305. 0x261e,
  13306. "a13",
  13307. 0x270c,
  13308. "a14",
  13309. 0x270d,
  13310. "a15",
  13311. 0x270e,
  13312. "a16",
  13313. 0x270f,
  13314. "a105",
  13315. 0x2710,
  13316. "a17",
  13317. 0x2711,
  13318. "a18",
  13319. 0x2712,
  13320. "a19",
  13321. 0x2713,
  13322. "a20",
  13323. 0x2714,
  13324. "a21",
  13325. 0x2715,
  13326. "a22",
  13327. 0x2716,
  13328. "a23",
  13329. 0x2717,
  13330. "a24",
  13331. 0x2718,
  13332. "a25",
  13333. 0x2719,
  13334. "a26",
  13335. 0x271a,
  13336. "a27",
  13337. 0x271b,
  13338. "a28",
  13339. 0x271c,
  13340. "a6",
  13341. 0x271d,
  13342. "a7",
  13343. 0x271e,
  13344. "a8",
  13345. 0x271f,
  13346. "a9",
  13347. 0x2720,
  13348. "a10",
  13349. 0x2721,
  13350. "a29",
  13351. 0x2722,
  13352. "a30",
  13353. 0x2723,
  13354. "a31",
  13355. 0x2724,
  13356. "a32",
  13357. 0x2725,
  13358. "a33",
  13359. 0x2726,
  13360. "a34",
  13361. 0x2727,
  13362. "a35",
  13363. 0x2605,
  13364. "a36",
  13365. 0x2729,
  13366. "a37",
  13367. 0x272a,
  13368. "a38",
  13369. 0x272b,
  13370. "a39",
  13371. 0x272c,
  13372. "a40",
  13373. 0x272d,
  13374. "a41",
  13375. 0x272e,
  13376. "a42",
  13377. 0x272f,
  13378. "a43",
  13379. 0x2730,
  13380. "a44",
  13381. 0x2731,
  13382. "a45",
  13383. 0x2732,
  13384. "a46",
  13385. 0x2733,
  13386. "a47",
  13387. 0x2734,
  13388. "a48",
  13389. 0x2735,
  13390. "a49",
  13391. 0x2736,
  13392. "a50",
  13393. 0x2737,
  13394. "a51",
  13395. 0x2738,
  13396. "a52",
  13397. 0x2739,
  13398. "a53",
  13399. 0x273a,
  13400. "a54",
  13401. 0x273b,
  13402. "a55",
  13403. 0x273c,
  13404. "a56",
  13405. 0x273d,
  13406. "a57",
  13407. 0x273e,
  13408. "a58",
  13409. 0x273f,
  13410. "a59",
  13411. 0x2740,
  13412. "a60",
  13413. 0x2741,
  13414. "a61",
  13415. 0x2742,
  13416. "a62",
  13417. 0x2743,
  13418. "a63",
  13419. 0x2744,
  13420. "a64",
  13421. 0x2745,
  13422. "a65",
  13423. 0x2746,
  13424. "a66",
  13425. 0x2747,
  13426. "a67",
  13427. 0x2748,
  13428. "a68",
  13429. 0x2749,
  13430. "a69",
  13431. 0x274a,
  13432. "a70",
  13433. 0x274b,
  13434. "a71",
  13435. 0x25cf,
  13436. "a72",
  13437. 0x274d,
  13438. "a73",
  13439. 0x25a0,
  13440. "a74",
  13441. 0x274f,
  13442. "a203",
  13443. 0x2750,
  13444. "a75",
  13445. 0x2751,
  13446. "a204",
  13447. 0x2752,
  13448. "a76",
  13449. 0x25b2,
  13450. "a77",
  13451. 0x25bc,
  13452. "a78",
  13453. 0x25c6,
  13454. "a79",
  13455. 0x2756,
  13456. "a81",
  13457. 0x25d7,
  13458. "a82",
  13459. 0x2758,
  13460. "a83",
  13461. 0x2759,
  13462. "a84",
  13463. 0x275a,
  13464. "a97",
  13465. 0x275b,
  13466. "a98",
  13467. 0x275c,
  13468. "a99",
  13469. 0x275d,
  13470. "a100",
  13471. 0x275e,
  13472. "a101",
  13473. 0x2761,
  13474. "a102",
  13475. 0x2762,
  13476. "a103",
  13477. 0x2763,
  13478. "a104",
  13479. 0x2764,
  13480. "a106",
  13481. 0x2765,
  13482. "a107",
  13483. 0x2766,
  13484. "a108",
  13485. 0x2767,
  13486. "a112",
  13487. 0x2663,
  13488. "a111",
  13489. 0x2666,
  13490. "a110",
  13491. 0x2665,
  13492. "a109",
  13493. 0x2660,
  13494. "a120",
  13495. 0x2460,
  13496. "a121",
  13497. 0x2461,
  13498. "a122",
  13499. 0x2462,
  13500. "a123",
  13501. 0x2463,
  13502. "a124",
  13503. 0x2464,
  13504. "a125",
  13505. 0x2465,
  13506. "a126",
  13507. 0x2466,
  13508. "a127",
  13509. 0x2467,
  13510. "a128",
  13511. 0x2468,
  13512. "a129",
  13513. 0x2469,
  13514. "a130",
  13515. 0x2776,
  13516. "a131",
  13517. 0x2777,
  13518. "a132",
  13519. 0x2778,
  13520. "a133",
  13521. 0x2779,
  13522. "a134",
  13523. 0x277a,
  13524. "a135",
  13525. 0x277b,
  13526. "a136",
  13527. 0x277c,
  13528. "a137",
  13529. 0x277d,
  13530. "a138",
  13531. 0x277e,
  13532. "a139",
  13533. 0x277f,
  13534. "a140",
  13535. 0x2780,
  13536. "a141",
  13537. 0x2781,
  13538. "a142",
  13539. 0x2782,
  13540. "a143",
  13541. 0x2783,
  13542. "a144",
  13543. 0x2784,
  13544. "a145",
  13545. 0x2785,
  13546. "a146",
  13547. 0x2786,
  13548. "a147",
  13549. 0x2787,
  13550. "a148",
  13551. 0x2788,
  13552. "a149",
  13553. 0x2789,
  13554. "a150",
  13555. 0x278a,
  13556. "a151",
  13557. 0x278b,
  13558. "a152",
  13559. 0x278c,
  13560. "a153",
  13561. 0x278d,
  13562. "a154",
  13563. 0x278e,
  13564. "a155",
  13565. 0x278f,
  13566. "a156",
  13567. 0x2790,
  13568. "a157",
  13569. 0x2791,
  13570. "a158",
  13571. 0x2792,
  13572. "a159",
  13573. 0x2793,
  13574. "a160",
  13575. 0x2794,
  13576. "a161",
  13577. 0x2192,
  13578. "a163",
  13579. 0x2194,
  13580. "a164",
  13581. 0x2195,
  13582. "a196",
  13583. 0x2798,
  13584. "a165",
  13585. 0x2799,
  13586. "a192",
  13587. 0x279a,
  13588. "a166",
  13589. 0x279b,
  13590. "a167",
  13591. 0x279c,
  13592. "a168",
  13593. 0x279d,
  13594. "a169",
  13595. 0x279e,
  13596. "a170",
  13597. 0x279f,
  13598. "a171",
  13599. 0x27a0,
  13600. "a172",
  13601. 0x27a1,
  13602. "a173",
  13603. 0x27a2,
  13604. "a162",
  13605. 0x27a3,
  13606. "a174",
  13607. 0x27a4,
  13608. "a175",
  13609. 0x27a5,
  13610. "a176",
  13611. 0x27a6,
  13612. "a177",
  13613. 0x27a7,
  13614. "a178",
  13615. 0x27a8,
  13616. "a179",
  13617. 0x27a9,
  13618. "a193",
  13619. 0x27aa,
  13620. "a180",
  13621. 0x27ab,
  13622. "a199",
  13623. 0x27ac,
  13624. "a181",
  13625. 0x27ad,
  13626. "a200",
  13627. 0x27ae,
  13628. "a182",
  13629. 0x27af,
  13630. "a201",
  13631. 0x27b1,
  13632. "a183",
  13633. 0x27b2,
  13634. "a184",
  13635. 0x27b3,
  13636. "a197",
  13637. 0x27b4,
  13638. "a185",
  13639. 0x27b5,
  13640. "a194",
  13641. 0x27b6,
  13642. "a198",
  13643. 0x27b7,
  13644. "a186",
  13645. 0x27b8,
  13646. "a195",
  13647. 0x27b9,
  13648. "a187",
  13649. 0x27ba,
  13650. "a188",
  13651. 0x27bb,
  13652. "a189",
  13653. 0x27bc,
  13654. "a190",
  13655. 0x27bd,
  13656. "a191",
  13657. 0x27be,
  13658. "a89",
  13659. 0x2768,
  13660. "a90",
  13661. 0x2769,
  13662. "a93",
  13663. 0x276a,
  13664. "a94",
  13665. 0x276b,
  13666. "a91",
  13667. 0x276c,
  13668. "a92",
  13669. 0x276d,
  13670. "a205",
  13671. 0x276e,
  13672. "a85",
  13673. 0x276f,
  13674. "a206",
  13675. 0x2770,
  13676. "a86",
  13677. 0x2771,
  13678. "a87",
  13679. 0x2772,
  13680. "a88",
  13681. 0x2773,
  13682. "a95",
  13683. 0x2774,
  13684. "a96",
  13685. 0x2775,
  13686. ".notdef",
  13687. 0x0000
  13688. ];
  13689. });
  13690. /***/ }),
  13691. /* 21 */
  13692. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  13693. __w_pdfjs_require__.r(__webpack_exports__);
  13694. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  13695. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  13696. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  13697. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  13698. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  13699. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  13700. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  13701. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  13702. /* harmony export */ });
  13703. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  13704. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  13705. t[63721] = 0x00a9;
  13706. t[63193] = 0x00a9;
  13707. t[63720] = 0x00ae;
  13708. t[63194] = 0x00ae;
  13709. t[63722] = 0x2122;
  13710. t[63195] = 0x2122;
  13711. t[63729] = 0x23a7;
  13712. t[63730] = 0x23a8;
  13713. t[63731] = 0x23a9;
  13714. t[63740] = 0x23ab;
  13715. t[63741] = 0x23ac;
  13716. t[63742] = 0x23ad;
  13717. t[63726] = 0x23a1;
  13718. t[63727] = 0x23a2;
  13719. t[63728] = 0x23a3;
  13720. t[63737] = 0x23a4;
  13721. t[63738] = 0x23a5;
  13722. t[63739] = 0x23a6;
  13723. t[63723] = 0x239b;
  13724. t[63724] = 0x239c;
  13725. t[63725] = 0x239d;
  13726. t[63734] = 0x239e;
  13727. t[63735] = 0x239f;
  13728. t[63736] = 0x23a0;
  13729. });
  13730. function mapSpecialUnicodeValues(code) {
  13731. if (code >= 0xfff0 && code <= 0xffff) {
  13732. return 0;
  13733. } else if (code >= 0xf600 && code <= 0xf8ff) {
  13734. return getSpecialPUASymbols()[code] || code;
  13735. } else if (code === 0x00ad) {
  13736. return 0x002d;
  13737. }
  13738. return code;
  13739. }
  13740. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  13741. let unicode = glyphsUnicodeMap[name];
  13742. if (unicode !== undefined) {
  13743. return unicode;
  13744. }
  13745. if (!name) {
  13746. return -1;
  13747. }
  13748. if (name[0] === "u") {
  13749. const nameLen = name.length;
  13750. let hexStr;
  13751. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  13752. hexStr = name.substring(3);
  13753. } else if (nameLen >= 5 && nameLen <= 7) {
  13754. hexStr = name.substring(1);
  13755. } else {
  13756. return -1;
  13757. }
  13758. if (hexStr === hexStr.toUpperCase()) {
  13759. unicode = parseInt(hexStr, 16);
  13760. if (unicode >= 0) {
  13761. return unicode;
  13762. }
  13763. }
  13764. }
  13765. return -1;
  13766. }
  13767. const UnicodeRanges = [
  13768. {
  13769. begin: 0x0000,
  13770. end: 0x007f
  13771. },
  13772. {
  13773. begin: 0x0080,
  13774. end: 0x00ff
  13775. },
  13776. {
  13777. begin: 0x0100,
  13778. end: 0x017f
  13779. },
  13780. {
  13781. begin: 0x0180,
  13782. end: 0x024f
  13783. },
  13784. {
  13785. begin: 0x0250,
  13786. end: 0x02af
  13787. },
  13788. {
  13789. begin: 0x02b0,
  13790. end: 0x02ff
  13791. },
  13792. {
  13793. begin: 0x0300,
  13794. end: 0x036f
  13795. },
  13796. {
  13797. begin: 0x0370,
  13798. end: 0x03ff
  13799. },
  13800. {
  13801. begin: 0x2c80,
  13802. end: 0x2cff
  13803. },
  13804. {
  13805. begin: 0x0400,
  13806. end: 0x04ff
  13807. },
  13808. {
  13809. begin: 0x0530,
  13810. end: 0x058f
  13811. },
  13812. {
  13813. begin: 0x0590,
  13814. end: 0x05ff
  13815. },
  13816. {
  13817. begin: 0xa500,
  13818. end: 0xa63f
  13819. },
  13820. {
  13821. begin: 0x0600,
  13822. end: 0x06ff
  13823. },
  13824. {
  13825. begin: 0x07c0,
  13826. end: 0x07ff
  13827. },
  13828. {
  13829. begin: 0x0900,
  13830. end: 0x097f
  13831. },
  13832. {
  13833. begin: 0x0980,
  13834. end: 0x09ff
  13835. },
  13836. {
  13837. begin: 0x0a00,
  13838. end: 0x0a7f
  13839. },
  13840. {
  13841. begin: 0x0a80,
  13842. end: 0x0aff
  13843. },
  13844. {
  13845. begin: 0x0b00,
  13846. end: 0x0b7f
  13847. },
  13848. {
  13849. begin: 0x0b80,
  13850. end: 0x0bff
  13851. },
  13852. {
  13853. begin: 0x0c00,
  13854. end: 0x0c7f
  13855. },
  13856. {
  13857. begin: 0x0c80,
  13858. end: 0x0cff
  13859. },
  13860. {
  13861. begin: 0x0d00,
  13862. end: 0x0d7f
  13863. },
  13864. {
  13865. begin: 0x0e00,
  13866. end: 0x0e7f
  13867. },
  13868. {
  13869. begin: 0x0e80,
  13870. end: 0x0eff
  13871. },
  13872. {
  13873. begin: 0x10a0,
  13874. end: 0x10ff
  13875. },
  13876. {
  13877. begin: 0x1b00,
  13878. end: 0x1b7f
  13879. },
  13880. {
  13881. begin: 0x1100,
  13882. end: 0x11ff
  13883. },
  13884. {
  13885. begin: 0x1e00,
  13886. end: 0x1eff
  13887. },
  13888. {
  13889. begin: 0x1f00,
  13890. end: 0x1fff
  13891. },
  13892. {
  13893. begin: 0x2000,
  13894. end: 0x206f
  13895. },
  13896. {
  13897. begin: 0x2070,
  13898. end: 0x209f
  13899. },
  13900. {
  13901. begin: 0x20a0,
  13902. end: 0x20cf
  13903. },
  13904. {
  13905. begin: 0x20d0,
  13906. end: 0x20ff
  13907. },
  13908. {
  13909. begin: 0x2100,
  13910. end: 0x214f
  13911. },
  13912. {
  13913. begin: 0x2150,
  13914. end: 0x218f
  13915. },
  13916. {
  13917. begin: 0x2190,
  13918. end: 0x21ff
  13919. },
  13920. {
  13921. begin: 0x2200,
  13922. end: 0x22ff
  13923. },
  13924. {
  13925. begin: 0x2300,
  13926. end: 0x23ff
  13927. },
  13928. {
  13929. begin: 0x2400,
  13930. end: 0x243f
  13931. },
  13932. {
  13933. begin: 0x2440,
  13934. end: 0x245f
  13935. },
  13936. {
  13937. begin: 0x2460,
  13938. end: 0x24ff
  13939. },
  13940. {
  13941. begin: 0x2500,
  13942. end: 0x257f
  13943. },
  13944. {
  13945. begin: 0x2580,
  13946. end: 0x259f
  13947. },
  13948. {
  13949. begin: 0x25a0,
  13950. end: 0x25ff
  13951. },
  13952. {
  13953. begin: 0x2600,
  13954. end: 0x26ff
  13955. },
  13956. {
  13957. begin: 0x2700,
  13958. end: 0x27bf
  13959. },
  13960. {
  13961. begin: 0x3000,
  13962. end: 0x303f
  13963. },
  13964. {
  13965. begin: 0x3040,
  13966. end: 0x309f
  13967. },
  13968. {
  13969. begin: 0x30a0,
  13970. end: 0x30ff
  13971. },
  13972. {
  13973. begin: 0x3100,
  13974. end: 0x312f
  13975. },
  13976. {
  13977. begin: 0x3130,
  13978. end: 0x318f
  13979. },
  13980. {
  13981. begin: 0xa840,
  13982. end: 0xa87f
  13983. },
  13984. {
  13985. begin: 0x3200,
  13986. end: 0x32ff
  13987. },
  13988. {
  13989. begin: 0x3300,
  13990. end: 0x33ff
  13991. },
  13992. {
  13993. begin: 0xac00,
  13994. end: 0xd7af
  13995. },
  13996. {
  13997. begin: 0xd800,
  13998. end: 0xdfff
  13999. },
  14000. {
  14001. begin: 0x10900,
  14002. end: 0x1091f
  14003. },
  14004. {
  14005. begin: 0x4e00,
  14006. end: 0x9fff
  14007. },
  14008. {
  14009. begin: 0xe000,
  14010. end: 0xf8ff
  14011. },
  14012. {
  14013. begin: 0x31c0,
  14014. end: 0x31ef
  14015. },
  14016. {
  14017. begin: 0xfb00,
  14018. end: 0xfb4f
  14019. },
  14020. {
  14021. begin: 0xfb50,
  14022. end: 0xfdff
  14023. },
  14024. {
  14025. begin: 0xfe20,
  14026. end: 0xfe2f
  14027. },
  14028. {
  14029. begin: 0xfe10,
  14030. end: 0xfe1f
  14031. },
  14032. {
  14033. begin: 0xfe50,
  14034. end: 0xfe6f
  14035. },
  14036. {
  14037. begin: 0xfe70,
  14038. end: 0xfeff
  14039. },
  14040. {
  14041. begin: 0xff00,
  14042. end: 0xffef
  14043. },
  14044. {
  14045. begin: 0xfff0,
  14046. end: 0xffff
  14047. },
  14048. {
  14049. begin: 0x0f00,
  14050. end: 0x0fff
  14051. },
  14052. {
  14053. begin: 0x0700,
  14054. end: 0x074f
  14055. },
  14056. {
  14057. begin: 0x0780,
  14058. end: 0x07bf
  14059. },
  14060. {
  14061. begin: 0x0d80,
  14062. end: 0x0dff
  14063. },
  14064. {
  14065. begin: 0x1000,
  14066. end: 0x109f
  14067. },
  14068. {
  14069. begin: 0x1200,
  14070. end: 0x137f
  14071. },
  14072. {
  14073. begin: 0x13a0,
  14074. end: 0x13ff
  14075. },
  14076. {
  14077. begin: 0x1400,
  14078. end: 0x167f
  14079. },
  14080. {
  14081. begin: 0x1680,
  14082. end: 0x169f
  14083. },
  14084. {
  14085. begin: 0x16a0,
  14086. end: 0x16ff
  14087. },
  14088. {
  14089. begin: 0x1780,
  14090. end: 0x17ff
  14091. },
  14092. {
  14093. begin: 0x1800,
  14094. end: 0x18af
  14095. },
  14096. {
  14097. begin: 0x2800,
  14098. end: 0x28ff
  14099. },
  14100. {
  14101. begin: 0xa000,
  14102. end: 0xa48f
  14103. },
  14104. {
  14105. begin: 0x1700,
  14106. end: 0x171f
  14107. },
  14108. {
  14109. begin: 0x10300,
  14110. end: 0x1032f
  14111. },
  14112. {
  14113. begin: 0x10330,
  14114. end: 0x1034f
  14115. },
  14116. {
  14117. begin: 0x10400,
  14118. end: 0x1044f
  14119. },
  14120. {
  14121. begin: 0x1d000,
  14122. end: 0x1d0ff
  14123. },
  14124. {
  14125. begin: 0x1d400,
  14126. end: 0x1d7ff
  14127. },
  14128. {
  14129. begin: 0xff000,
  14130. end: 0xffffd
  14131. },
  14132. {
  14133. begin: 0xfe00,
  14134. end: 0xfe0f
  14135. },
  14136. {
  14137. begin: 0xe0000,
  14138. end: 0xe007f
  14139. },
  14140. {
  14141. begin: 0x1900,
  14142. end: 0x194f
  14143. },
  14144. {
  14145. begin: 0x1950,
  14146. end: 0x197f
  14147. },
  14148. {
  14149. begin: 0x1980,
  14150. end: 0x19df
  14151. },
  14152. {
  14153. begin: 0x1a00,
  14154. end: 0x1a1f
  14155. },
  14156. {
  14157. begin: 0x2c00,
  14158. end: 0x2c5f
  14159. },
  14160. {
  14161. begin: 0x2d30,
  14162. end: 0x2d7f
  14163. },
  14164. {
  14165. begin: 0x4dc0,
  14166. end: 0x4dff
  14167. },
  14168. {
  14169. begin: 0xa800,
  14170. end: 0xa82f
  14171. },
  14172. {
  14173. begin: 0x10000,
  14174. end: 0x1007f
  14175. },
  14176. {
  14177. begin: 0x10140,
  14178. end: 0x1018f
  14179. },
  14180. {
  14181. begin: 0x10380,
  14182. end: 0x1039f
  14183. },
  14184. {
  14185. begin: 0x103a0,
  14186. end: 0x103df
  14187. },
  14188. {
  14189. begin: 0x10450,
  14190. end: 0x1047f
  14191. },
  14192. {
  14193. begin: 0x10480,
  14194. end: 0x104af
  14195. },
  14196. {
  14197. begin: 0x10800,
  14198. end: 0x1083f
  14199. },
  14200. {
  14201. begin: 0x10a00,
  14202. end: 0x10a5f
  14203. },
  14204. {
  14205. begin: 0x1d300,
  14206. end: 0x1d35f
  14207. },
  14208. {
  14209. begin: 0x12000,
  14210. end: 0x123ff
  14211. },
  14212. {
  14213. begin: 0x1d360,
  14214. end: 0x1d37f
  14215. },
  14216. {
  14217. begin: 0x1b80,
  14218. end: 0x1bbf
  14219. },
  14220. {
  14221. begin: 0x1c00,
  14222. end: 0x1c4f
  14223. },
  14224. {
  14225. begin: 0x1c50,
  14226. end: 0x1c7f
  14227. },
  14228. {
  14229. begin: 0xa880,
  14230. end: 0xa8df
  14231. },
  14232. {
  14233. begin: 0xa900,
  14234. end: 0xa92f
  14235. },
  14236. {
  14237. begin: 0xa930,
  14238. end: 0xa95f
  14239. },
  14240. {
  14241. begin: 0xaa00,
  14242. end: 0xaa5f
  14243. },
  14244. {
  14245. begin: 0x10190,
  14246. end: 0x101cf
  14247. },
  14248. {
  14249. begin: 0x101d0,
  14250. end: 0x101ff
  14251. },
  14252. {
  14253. begin: 0x102a0,
  14254. end: 0x102df
  14255. },
  14256. {
  14257. begin: 0x1f030,
  14258. end: 0x1f09f
  14259. }
  14260. ];
  14261. function getUnicodeRangeFor(value) {
  14262. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  14263. const range = UnicodeRanges[i];
  14264. if (value >= range.begin && value < range.end) {
  14265. return i;
  14266. }
  14267. }
  14268. return -1;
  14269. }
  14270. function isRTLRangeFor(value) {
  14271. let range = UnicodeRanges[13];
  14272. if (value >= range.begin && value < range.end) {
  14273. return true;
  14274. }
  14275. range = UnicodeRanges[11];
  14276. if (value >= range.begin && value < range.end) {
  14277. return true;
  14278. }
  14279. return false;
  14280. }
  14281. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  14282. return [
  14283. "\u00A8",
  14284. "\u0020\u0308",
  14285. "\u00AF",
  14286. "\u0020\u0304",
  14287. "\u00B4",
  14288. "\u0020\u0301",
  14289. "\u00B5",
  14290. "\u03BC",
  14291. "\u00B8",
  14292. "\u0020\u0327",
  14293. "\u0132",
  14294. "\u0049\u004A",
  14295. "\u0133",
  14296. "\u0069\u006A",
  14297. "\u013F",
  14298. "\u004C\u00B7",
  14299. "\u0140",
  14300. "\u006C\u00B7",
  14301. "\u0149",
  14302. "\u02BC\u006E",
  14303. "\u017F",
  14304. "\u0073",
  14305. "\u01C4",
  14306. "\u0044\u017D",
  14307. "\u01C5",
  14308. "\u0044\u017E",
  14309. "\u01C6",
  14310. "\u0064\u017E",
  14311. "\u01C7",
  14312. "\u004C\u004A",
  14313. "\u01C8",
  14314. "\u004C\u006A",
  14315. "\u01C9",
  14316. "\u006C\u006A",
  14317. "\u01CA",
  14318. "\u004E\u004A",
  14319. "\u01CB",
  14320. "\u004E\u006A",
  14321. "\u01CC",
  14322. "\u006E\u006A",
  14323. "\u01F1",
  14324. "\u0044\u005A",
  14325. "\u01F2",
  14326. "\u0044\u007A",
  14327. "\u01F3",
  14328. "\u0064\u007A",
  14329. "\u02D8",
  14330. "\u0020\u0306",
  14331. "\u02D9",
  14332. "\u0020\u0307",
  14333. "\u02DA",
  14334. "\u0020\u030A",
  14335. "\u02DB",
  14336. "\u0020\u0328",
  14337. "\u02DC",
  14338. "\u0020\u0303",
  14339. "\u02DD",
  14340. "\u0020\u030B",
  14341. "\u037A",
  14342. "\u0020\u0345",
  14343. "\u0384",
  14344. "\u0020\u0301",
  14345. "\u03D0",
  14346. "\u03B2",
  14347. "\u03D1",
  14348. "\u03B8",
  14349. "\u03D2",
  14350. "\u03A5",
  14351. "\u03D5",
  14352. "\u03C6",
  14353. "\u03D6",
  14354. "\u03C0",
  14355. "\u03F0",
  14356. "\u03BA",
  14357. "\u03F1",
  14358. "\u03C1",
  14359. "\u03F2",
  14360. "\u03C2",
  14361. "\u03F4",
  14362. "\u0398",
  14363. "\u03F5",
  14364. "\u03B5",
  14365. "\u03F9",
  14366. "\u03A3",
  14367. "\u0587",
  14368. "\u0565\u0582",
  14369. "\u0675",
  14370. "\u0627\u0674",
  14371. "\u0676",
  14372. "\u0648\u0674",
  14373. "\u0677",
  14374. "\u06C7\u0674",
  14375. "\u0678",
  14376. "\u064A\u0674",
  14377. "\u0E33",
  14378. "\u0E4D\u0E32",
  14379. "\u0EB3",
  14380. "\u0ECD\u0EB2",
  14381. "\u0EDC",
  14382. "\u0EAB\u0E99",
  14383. "\u0EDD",
  14384. "\u0EAB\u0EA1",
  14385. "\u0F77",
  14386. "\u0FB2\u0F81",
  14387. "\u0F79",
  14388. "\u0FB3\u0F81",
  14389. "\u1E9A",
  14390. "\u0061\u02BE",
  14391. "\u1FBD",
  14392. "\u0020\u0313",
  14393. "\u1FBF",
  14394. "\u0020\u0313",
  14395. "\u1FC0",
  14396. "\u0020\u0342",
  14397. "\u1FFE",
  14398. "\u0020\u0314",
  14399. "\u2002",
  14400. "\u0020",
  14401. "\u2003",
  14402. "\u0020",
  14403. "\u2004",
  14404. "\u0020",
  14405. "\u2005",
  14406. "\u0020",
  14407. "\u2006",
  14408. "\u0020",
  14409. "\u2008",
  14410. "\u0020",
  14411. "\u2009",
  14412. "\u0020",
  14413. "\u200A",
  14414. "\u0020",
  14415. "\u2017",
  14416. "\u0020\u0333",
  14417. "\u2024",
  14418. "\u002E",
  14419. "\u2025",
  14420. "\u002E\u002E",
  14421. "\u2026",
  14422. "\u002E\u002E\u002E",
  14423. "\u2033",
  14424. "\u2032\u2032",
  14425. "\u2034",
  14426. "\u2032\u2032\u2032",
  14427. "\u2036",
  14428. "\u2035\u2035",
  14429. "\u2037",
  14430. "\u2035\u2035\u2035",
  14431. "\u203C",
  14432. "\u0021\u0021",
  14433. "\u203E",
  14434. "\u0020\u0305",
  14435. "\u2047",
  14436. "\u003F\u003F",
  14437. "\u2048",
  14438. "\u003F\u0021",
  14439. "\u2049",
  14440. "\u0021\u003F",
  14441. "\u2057",
  14442. "\u2032\u2032\u2032\u2032",
  14443. "\u205F",
  14444. "\u0020",
  14445. "\u20A8",
  14446. "\u0052\u0073",
  14447. "\u2100",
  14448. "\u0061\u002F\u0063",
  14449. "\u2101",
  14450. "\u0061\u002F\u0073",
  14451. "\u2103",
  14452. "\u00B0\u0043",
  14453. "\u2105",
  14454. "\u0063\u002F\u006F",
  14455. "\u2106",
  14456. "\u0063\u002F\u0075",
  14457. "\u2107",
  14458. "\u0190",
  14459. "\u2109",
  14460. "\u00B0\u0046",
  14461. "\u2116",
  14462. "\u004E\u006F",
  14463. "\u2121",
  14464. "\u0054\u0045\u004C",
  14465. "\u2135",
  14466. "\u05D0",
  14467. "\u2136",
  14468. "\u05D1",
  14469. "\u2137",
  14470. "\u05D2",
  14471. "\u2138",
  14472. "\u05D3",
  14473. "\u213B",
  14474. "\u0046\u0041\u0058",
  14475. "\u2160",
  14476. "\u0049",
  14477. "\u2161",
  14478. "\u0049\u0049",
  14479. "\u2162",
  14480. "\u0049\u0049\u0049",
  14481. "\u2163",
  14482. "\u0049\u0056",
  14483. "\u2164",
  14484. "\u0056",
  14485. "\u2165",
  14486. "\u0056\u0049",
  14487. "\u2166",
  14488. "\u0056\u0049\u0049",
  14489. "\u2167",
  14490. "\u0056\u0049\u0049\u0049",
  14491. "\u2168",
  14492. "\u0049\u0058",
  14493. "\u2169",
  14494. "\u0058",
  14495. "\u216A",
  14496. "\u0058\u0049",
  14497. "\u216B",
  14498. "\u0058\u0049\u0049",
  14499. "\u216C",
  14500. "\u004C",
  14501. "\u216D",
  14502. "\u0043",
  14503. "\u216E",
  14504. "\u0044",
  14505. "\u216F",
  14506. "\u004D",
  14507. "\u2170",
  14508. "\u0069",
  14509. "\u2171",
  14510. "\u0069\u0069",
  14511. "\u2172",
  14512. "\u0069\u0069\u0069",
  14513. "\u2173",
  14514. "\u0069\u0076",
  14515. "\u2174",
  14516. "\u0076",
  14517. "\u2175",
  14518. "\u0076\u0069",
  14519. "\u2176",
  14520. "\u0076\u0069\u0069",
  14521. "\u2177",
  14522. "\u0076\u0069\u0069\u0069",
  14523. "\u2178",
  14524. "\u0069\u0078",
  14525. "\u2179",
  14526. "\u0078",
  14527. "\u217A",
  14528. "\u0078\u0069",
  14529. "\u217B",
  14530. "\u0078\u0069\u0069",
  14531. "\u217C",
  14532. "\u006C",
  14533. "\u217D",
  14534. "\u0063",
  14535. "\u217E",
  14536. "\u0064",
  14537. "\u217F",
  14538. "\u006D",
  14539. "\u222C",
  14540. "\u222B\u222B",
  14541. "\u222D",
  14542. "\u222B\u222B\u222B",
  14543. "\u222F",
  14544. "\u222E\u222E",
  14545. "\u2230",
  14546. "\u222E\u222E\u222E",
  14547. "\u2474",
  14548. "\u0028\u0031\u0029",
  14549. "\u2475",
  14550. "\u0028\u0032\u0029",
  14551. "\u2476",
  14552. "\u0028\u0033\u0029",
  14553. "\u2477",
  14554. "\u0028\u0034\u0029",
  14555. "\u2478",
  14556. "\u0028\u0035\u0029",
  14557. "\u2479",
  14558. "\u0028\u0036\u0029",
  14559. "\u247A",
  14560. "\u0028\u0037\u0029",
  14561. "\u247B",
  14562. "\u0028\u0038\u0029",
  14563. "\u247C",
  14564. "\u0028\u0039\u0029",
  14565. "\u247D",
  14566. "\u0028\u0031\u0030\u0029",
  14567. "\u247E",
  14568. "\u0028\u0031\u0031\u0029",
  14569. "\u247F",
  14570. "\u0028\u0031\u0032\u0029",
  14571. "\u2480",
  14572. "\u0028\u0031\u0033\u0029",
  14573. "\u2481",
  14574. "\u0028\u0031\u0034\u0029",
  14575. "\u2482",
  14576. "\u0028\u0031\u0035\u0029",
  14577. "\u2483",
  14578. "\u0028\u0031\u0036\u0029",
  14579. "\u2484",
  14580. "\u0028\u0031\u0037\u0029",
  14581. "\u2485",
  14582. "\u0028\u0031\u0038\u0029",
  14583. "\u2486",
  14584. "\u0028\u0031\u0039\u0029",
  14585. "\u2487",
  14586. "\u0028\u0032\u0030\u0029",
  14587. "\u2488",
  14588. "\u0031\u002E",
  14589. "\u2489",
  14590. "\u0032\u002E",
  14591. "\u248A",
  14592. "\u0033\u002E",
  14593. "\u248B",
  14594. "\u0034\u002E",
  14595. "\u248C",
  14596. "\u0035\u002E",
  14597. "\u248D",
  14598. "\u0036\u002E",
  14599. "\u248E",
  14600. "\u0037\u002E",
  14601. "\u248F",
  14602. "\u0038\u002E",
  14603. "\u2490",
  14604. "\u0039\u002E",
  14605. "\u2491",
  14606. "\u0031\u0030\u002E",
  14607. "\u2492",
  14608. "\u0031\u0031\u002E",
  14609. "\u2493",
  14610. "\u0031\u0032\u002E",
  14611. "\u2494",
  14612. "\u0031\u0033\u002E",
  14613. "\u2495",
  14614. "\u0031\u0034\u002E",
  14615. "\u2496",
  14616. "\u0031\u0035\u002E",
  14617. "\u2497",
  14618. "\u0031\u0036\u002E",
  14619. "\u2498",
  14620. "\u0031\u0037\u002E",
  14621. "\u2499",
  14622. "\u0031\u0038\u002E",
  14623. "\u249A",
  14624. "\u0031\u0039\u002E",
  14625. "\u249B",
  14626. "\u0032\u0030\u002E",
  14627. "\u249C",
  14628. "\u0028\u0061\u0029",
  14629. "\u249D",
  14630. "\u0028\u0062\u0029",
  14631. "\u249E",
  14632. "\u0028\u0063\u0029",
  14633. "\u249F",
  14634. "\u0028\u0064\u0029",
  14635. "\u24A0",
  14636. "\u0028\u0065\u0029",
  14637. "\u24A1",
  14638. "\u0028\u0066\u0029",
  14639. "\u24A2",
  14640. "\u0028\u0067\u0029",
  14641. "\u24A3",
  14642. "\u0028\u0068\u0029",
  14643. "\u24A4",
  14644. "\u0028\u0069\u0029",
  14645. "\u24A5",
  14646. "\u0028\u006A\u0029",
  14647. "\u24A6",
  14648. "\u0028\u006B\u0029",
  14649. "\u24A7",
  14650. "\u0028\u006C\u0029",
  14651. "\u24A8",
  14652. "\u0028\u006D\u0029",
  14653. "\u24A9",
  14654. "\u0028\u006E\u0029",
  14655. "\u24AA",
  14656. "\u0028\u006F\u0029",
  14657. "\u24AB",
  14658. "\u0028\u0070\u0029",
  14659. "\u24AC",
  14660. "\u0028\u0071\u0029",
  14661. "\u24AD",
  14662. "\u0028\u0072\u0029",
  14663. "\u24AE",
  14664. "\u0028\u0073\u0029",
  14665. "\u24AF",
  14666. "\u0028\u0074\u0029",
  14667. "\u24B0",
  14668. "\u0028\u0075\u0029",
  14669. "\u24B1",
  14670. "\u0028\u0076\u0029",
  14671. "\u24B2",
  14672. "\u0028\u0077\u0029",
  14673. "\u24B3",
  14674. "\u0028\u0078\u0029",
  14675. "\u24B4",
  14676. "\u0028\u0079\u0029",
  14677. "\u24B5",
  14678. "\u0028\u007A\u0029",
  14679. "\u2A0C",
  14680. "\u222B\u222B\u222B\u222B",
  14681. "\u2A74",
  14682. "\u003A\u003A\u003D",
  14683. "\u2A75",
  14684. "\u003D\u003D",
  14685. "\u2A76",
  14686. "\u003D\u003D\u003D",
  14687. "\u2E9F",
  14688. "\u6BCD",
  14689. "\u2EF3",
  14690. "\u9F9F",
  14691. "\u2F00",
  14692. "\u4E00",
  14693. "\u2F01",
  14694. "\u4E28",
  14695. "\u2F02",
  14696. "\u4E36",
  14697. "\u2F03",
  14698. "\u4E3F",
  14699. "\u2F04",
  14700. "\u4E59",
  14701. "\u2F05",
  14702. "\u4E85",
  14703. "\u2F06",
  14704. "\u4E8C",
  14705. "\u2F07",
  14706. "\u4EA0",
  14707. "\u2F08",
  14708. "\u4EBA",
  14709. "\u2F09",
  14710. "\u513F",
  14711. "\u2F0A",
  14712. "\u5165",
  14713. "\u2F0B",
  14714. "\u516B",
  14715. "\u2F0C",
  14716. "\u5182",
  14717. "\u2F0D",
  14718. "\u5196",
  14719. "\u2F0E",
  14720. "\u51AB",
  14721. "\u2F0F",
  14722. "\u51E0",
  14723. "\u2F10",
  14724. "\u51F5",
  14725. "\u2F11",
  14726. "\u5200",
  14727. "\u2F12",
  14728. "\u529B",
  14729. "\u2F13",
  14730. "\u52F9",
  14731. "\u2F14",
  14732. "\u5315",
  14733. "\u2F15",
  14734. "\u531A",
  14735. "\u2F16",
  14736. "\u5338",
  14737. "\u2F17",
  14738. "\u5341",
  14739. "\u2F18",
  14740. "\u535C",
  14741. "\u2F19",
  14742. "\u5369",
  14743. "\u2F1A",
  14744. "\u5382",
  14745. "\u2F1B",
  14746. "\u53B6",
  14747. "\u2F1C",
  14748. "\u53C8",
  14749. "\u2F1D",
  14750. "\u53E3",
  14751. "\u2F1E",
  14752. "\u56D7",
  14753. "\u2F1F",
  14754. "\u571F",
  14755. "\u2F20",
  14756. "\u58EB",
  14757. "\u2F21",
  14758. "\u5902",
  14759. "\u2F22",
  14760. "\u590A",
  14761. "\u2F23",
  14762. "\u5915",
  14763. "\u2F24",
  14764. "\u5927",
  14765. "\u2F25",
  14766. "\u5973",
  14767. "\u2F26",
  14768. "\u5B50",
  14769. "\u2F27",
  14770. "\u5B80",
  14771. "\u2F28",
  14772. "\u5BF8",
  14773. "\u2F29",
  14774. "\u5C0F",
  14775. "\u2F2A",
  14776. "\u5C22",
  14777. "\u2F2B",
  14778. "\u5C38",
  14779. "\u2F2C",
  14780. "\u5C6E",
  14781. "\u2F2D",
  14782. "\u5C71",
  14783. "\u2F2E",
  14784. "\u5DDB",
  14785. "\u2F2F",
  14786. "\u5DE5",
  14787. "\u2F30",
  14788. "\u5DF1",
  14789. "\u2F31",
  14790. "\u5DFE",
  14791. "\u2F32",
  14792. "\u5E72",
  14793. "\u2F33",
  14794. "\u5E7A",
  14795. "\u2F34",
  14796. "\u5E7F",
  14797. "\u2F35",
  14798. "\u5EF4",
  14799. "\u2F36",
  14800. "\u5EFE",
  14801. "\u2F37",
  14802. "\u5F0B",
  14803. "\u2F38",
  14804. "\u5F13",
  14805. "\u2F39",
  14806. "\u5F50",
  14807. "\u2F3A",
  14808. "\u5F61",
  14809. "\u2F3B",
  14810. "\u5F73",
  14811. "\u2F3C",
  14812. "\u5FC3",
  14813. "\u2F3D",
  14814. "\u6208",
  14815. "\u2F3E",
  14816. "\u6236",
  14817. "\u2F3F",
  14818. "\u624B",
  14819. "\u2F40",
  14820. "\u652F",
  14821. "\u2F41",
  14822. "\u6534",
  14823. "\u2F42",
  14824. "\u6587",
  14825. "\u2F43",
  14826. "\u6597",
  14827. "\u2F44",
  14828. "\u65A4",
  14829. "\u2F45",
  14830. "\u65B9",
  14831. "\u2F46",
  14832. "\u65E0",
  14833. "\u2F47",
  14834. "\u65E5",
  14835. "\u2F48",
  14836. "\u66F0",
  14837. "\u2F49",
  14838. "\u6708",
  14839. "\u2F4A",
  14840. "\u6728",
  14841. "\u2F4B",
  14842. "\u6B20",
  14843. "\u2F4C",
  14844. "\u6B62",
  14845. "\u2F4D",
  14846. "\u6B79",
  14847. "\u2F4E",
  14848. "\u6BB3",
  14849. "\u2F4F",
  14850. "\u6BCB",
  14851. "\u2F50",
  14852. "\u6BD4",
  14853. "\u2F51",
  14854. "\u6BDB",
  14855. "\u2F52",
  14856. "\u6C0F",
  14857. "\u2F53",
  14858. "\u6C14",
  14859. "\u2F54",
  14860. "\u6C34",
  14861. "\u2F55",
  14862. "\u706B",
  14863. "\u2F56",
  14864. "\u722A",
  14865. "\u2F57",
  14866. "\u7236",
  14867. "\u2F58",
  14868. "\u723B",
  14869. "\u2F59",
  14870. "\u723F",
  14871. "\u2F5A",
  14872. "\u7247",
  14873. "\u2F5B",
  14874. "\u7259",
  14875. "\u2F5C",
  14876. "\u725B",
  14877. "\u2F5D",
  14878. "\u72AC",
  14879. "\u2F5E",
  14880. "\u7384",
  14881. "\u2F5F",
  14882. "\u7389",
  14883. "\u2F60",
  14884. "\u74DC",
  14885. "\u2F61",
  14886. "\u74E6",
  14887. "\u2F62",
  14888. "\u7518",
  14889. "\u2F63",
  14890. "\u751F",
  14891. "\u2F64",
  14892. "\u7528",
  14893. "\u2F65",
  14894. "\u7530",
  14895. "\u2F66",
  14896. "\u758B",
  14897. "\u2F67",
  14898. "\u7592",
  14899. "\u2F68",
  14900. "\u7676",
  14901. "\u2F69",
  14902. "\u767D",
  14903. "\u2F6A",
  14904. "\u76AE",
  14905. "\u2F6B",
  14906. "\u76BF",
  14907. "\u2F6C",
  14908. "\u76EE",
  14909. "\u2F6D",
  14910. "\u77DB",
  14911. "\u2F6E",
  14912. "\u77E2",
  14913. "\u2F6F",
  14914. "\u77F3",
  14915. "\u2F70",
  14916. "\u793A",
  14917. "\u2F71",
  14918. "\u79B8",
  14919. "\u2F72",
  14920. "\u79BE",
  14921. "\u2F73",
  14922. "\u7A74",
  14923. "\u2F74",
  14924. "\u7ACB",
  14925. "\u2F75",
  14926. "\u7AF9",
  14927. "\u2F76",
  14928. "\u7C73",
  14929. "\u2F77",
  14930. "\u7CF8",
  14931. "\u2F78",
  14932. "\u7F36",
  14933. "\u2F79",
  14934. "\u7F51",
  14935. "\u2F7A",
  14936. "\u7F8A",
  14937. "\u2F7B",
  14938. "\u7FBD",
  14939. "\u2F7C",
  14940. "\u8001",
  14941. "\u2F7D",
  14942. "\u800C",
  14943. "\u2F7E",
  14944. "\u8012",
  14945. "\u2F7F",
  14946. "\u8033",
  14947. "\u2F80",
  14948. "\u807F",
  14949. "\u2F81",
  14950. "\u8089",
  14951. "\u2F82",
  14952. "\u81E3",
  14953. "\u2F83",
  14954. "\u81EA",
  14955. "\u2F84",
  14956. "\u81F3",
  14957. "\u2F85",
  14958. "\u81FC",
  14959. "\u2F86",
  14960. "\u820C",
  14961. "\u2F87",
  14962. "\u821B",
  14963. "\u2F88",
  14964. "\u821F",
  14965. "\u2F89",
  14966. "\u826E",
  14967. "\u2F8A",
  14968. "\u8272",
  14969. "\u2F8B",
  14970. "\u8278",
  14971. "\u2F8C",
  14972. "\u864D",
  14973. "\u2F8D",
  14974. "\u866B",
  14975. "\u2F8E",
  14976. "\u8840",
  14977. "\u2F8F",
  14978. "\u884C",
  14979. "\u2F90",
  14980. "\u8863",
  14981. "\u2F91",
  14982. "\u897E",
  14983. "\u2F92",
  14984. "\u898B",
  14985. "\u2F93",
  14986. "\u89D2",
  14987. "\u2F94",
  14988. "\u8A00",
  14989. "\u2F95",
  14990. "\u8C37",
  14991. "\u2F96",
  14992. "\u8C46",
  14993. "\u2F97",
  14994. "\u8C55",
  14995. "\u2F98",
  14996. "\u8C78",
  14997. "\u2F99",
  14998. "\u8C9D",
  14999. "\u2F9A",
  15000. "\u8D64",
  15001. "\u2F9B",
  15002. "\u8D70",
  15003. "\u2F9C",
  15004. "\u8DB3",
  15005. "\u2F9D",
  15006. "\u8EAB",
  15007. "\u2F9E",
  15008. "\u8ECA",
  15009. "\u2F9F",
  15010. "\u8F9B",
  15011. "\u2FA0",
  15012. "\u8FB0",
  15013. "\u2FA1",
  15014. "\u8FB5",
  15015. "\u2FA2",
  15016. "\u9091",
  15017. "\u2FA3",
  15018. "\u9149",
  15019. "\u2FA4",
  15020. "\u91C6",
  15021. "\u2FA5",
  15022. "\u91CC",
  15023. "\u2FA6",
  15024. "\u91D1",
  15025. "\u2FA7",
  15026. "\u9577",
  15027. "\u2FA8",
  15028. "\u9580",
  15029. "\u2FA9",
  15030. "\u961C",
  15031. "\u2FAA",
  15032. "\u96B6",
  15033. "\u2FAB",
  15034. "\u96B9",
  15035. "\u2FAC",
  15036. "\u96E8",
  15037. "\u2FAD",
  15038. "\u9751",
  15039. "\u2FAE",
  15040. "\u975E",
  15041. "\u2FAF",
  15042. "\u9762",
  15043. "\u2FB0",
  15044. "\u9769",
  15045. "\u2FB1",
  15046. "\u97CB",
  15047. "\u2FB2",
  15048. "\u97ED",
  15049. "\u2FB3",
  15050. "\u97F3",
  15051. "\u2FB4",
  15052. "\u9801",
  15053. "\u2FB5",
  15054. "\u98A8",
  15055. "\u2FB6",
  15056. "\u98DB",
  15057. "\u2FB7",
  15058. "\u98DF",
  15059. "\u2FB8",
  15060. "\u9996",
  15061. "\u2FB9",
  15062. "\u9999",
  15063. "\u2FBA",
  15064. "\u99AC",
  15065. "\u2FBB",
  15066. "\u9AA8",
  15067. "\u2FBC",
  15068. "\u9AD8",
  15069. "\u2FBD",
  15070. "\u9ADF",
  15071. "\u2FBE",
  15072. "\u9B25",
  15073. "\u2FBF",
  15074. "\u9B2F",
  15075. "\u2FC0",
  15076. "\u9B32",
  15077. "\u2FC1",
  15078. "\u9B3C",
  15079. "\u2FC2",
  15080. "\u9B5A",
  15081. "\u2FC3",
  15082. "\u9CE5",
  15083. "\u2FC4",
  15084. "\u9E75",
  15085. "\u2FC5",
  15086. "\u9E7F",
  15087. "\u2FC6",
  15088. "\u9EA5",
  15089. "\u2FC7",
  15090. "\u9EBB",
  15091. "\u2FC8",
  15092. "\u9EC3",
  15093. "\u2FC9",
  15094. "\u9ECD",
  15095. "\u2FCA",
  15096. "\u9ED1",
  15097. "\u2FCB",
  15098. "\u9EF9",
  15099. "\u2FCC",
  15100. "\u9EFD",
  15101. "\u2FCD",
  15102. "\u9F0E",
  15103. "\u2FCE",
  15104. "\u9F13",
  15105. "\u2FCF",
  15106. "\u9F20",
  15107. "\u2FD0",
  15108. "\u9F3B",
  15109. "\u2FD1",
  15110. "\u9F4A",
  15111. "\u2FD2",
  15112. "\u9F52",
  15113. "\u2FD3",
  15114. "\u9F8D",
  15115. "\u2FD4",
  15116. "\u9F9C",
  15117. "\u2FD5",
  15118. "\u9FA0",
  15119. "\u3036",
  15120. "\u3012",
  15121. "\u3038",
  15122. "\u5341",
  15123. "\u3039",
  15124. "\u5344",
  15125. "\u303A",
  15126. "\u5345",
  15127. "\u309B",
  15128. "\u0020\u3099",
  15129. "\u309C",
  15130. "\u0020\u309A",
  15131. "\u3131",
  15132. "\u1100",
  15133. "\u3132",
  15134. "\u1101",
  15135. "\u3133",
  15136. "\u11AA",
  15137. "\u3134",
  15138. "\u1102",
  15139. "\u3135",
  15140. "\u11AC",
  15141. "\u3136",
  15142. "\u11AD",
  15143. "\u3137",
  15144. "\u1103",
  15145. "\u3138",
  15146. "\u1104",
  15147. "\u3139",
  15148. "\u1105",
  15149. "\u313A",
  15150. "\u11B0",
  15151. "\u313B",
  15152. "\u11B1",
  15153. "\u313C",
  15154. "\u11B2",
  15155. "\u313D",
  15156. "\u11B3",
  15157. "\u313E",
  15158. "\u11B4",
  15159. "\u313F",
  15160. "\u11B5",
  15161. "\u3140",
  15162. "\u111A",
  15163. "\u3141",
  15164. "\u1106",
  15165. "\u3142",
  15166. "\u1107",
  15167. "\u3143",
  15168. "\u1108",
  15169. "\u3144",
  15170. "\u1121",
  15171. "\u3145",
  15172. "\u1109",
  15173. "\u3146",
  15174. "\u110A",
  15175. "\u3147",
  15176. "\u110B",
  15177. "\u3148",
  15178. "\u110C",
  15179. "\u3149",
  15180. "\u110D",
  15181. "\u314A",
  15182. "\u110E",
  15183. "\u314B",
  15184. "\u110F",
  15185. "\u314C",
  15186. "\u1110",
  15187. "\u314D",
  15188. "\u1111",
  15189. "\u314E",
  15190. "\u1112",
  15191. "\u314F",
  15192. "\u1161",
  15193. "\u3150",
  15194. "\u1162",
  15195. "\u3151",
  15196. "\u1163",
  15197. "\u3152",
  15198. "\u1164",
  15199. "\u3153",
  15200. "\u1165",
  15201. "\u3154",
  15202. "\u1166",
  15203. "\u3155",
  15204. "\u1167",
  15205. "\u3156",
  15206. "\u1168",
  15207. "\u3157",
  15208. "\u1169",
  15209. "\u3158",
  15210. "\u116A",
  15211. "\u3159",
  15212. "\u116B",
  15213. "\u315A",
  15214. "\u116C",
  15215. "\u315B",
  15216. "\u116D",
  15217. "\u315C",
  15218. "\u116E",
  15219. "\u315D",
  15220. "\u116F",
  15221. "\u315E",
  15222. "\u1170",
  15223. "\u315F",
  15224. "\u1171",
  15225. "\u3160",
  15226. "\u1172",
  15227. "\u3161",
  15228. "\u1173",
  15229. "\u3162",
  15230. "\u1174",
  15231. "\u3163",
  15232. "\u1175",
  15233. "\u3164",
  15234. "\u1160",
  15235. "\u3165",
  15236. "\u1114",
  15237. "\u3166",
  15238. "\u1115",
  15239. "\u3167",
  15240. "\u11C7",
  15241. "\u3168",
  15242. "\u11C8",
  15243. "\u3169",
  15244. "\u11CC",
  15245. "\u316A",
  15246. "\u11CE",
  15247. "\u316B",
  15248. "\u11D3",
  15249. "\u316C",
  15250. "\u11D7",
  15251. "\u316D",
  15252. "\u11D9",
  15253. "\u316E",
  15254. "\u111C",
  15255. "\u316F",
  15256. "\u11DD",
  15257. "\u3170",
  15258. "\u11DF",
  15259. "\u3171",
  15260. "\u111D",
  15261. "\u3172",
  15262. "\u111E",
  15263. "\u3173",
  15264. "\u1120",
  15265. "\u3174",
  15266. "\u1122",
  15267. "\u3175",
  15268. "\u1123",
  15269. "\u3176",
  15270. "\u1127",
  15271. "\u3177",
  15272. "\u1129",
  15273. "\u3178",
  15274. "\u112B",
  15275. "\u3179",
  15276. "\u112C",
  15277. "\u317A",
  15278. "\u112D",
  15279. "\u317B",
  15280. "\u112E",
  15281. "\u317C",
  15282. "\u112F",
  15283. "\u317D",
  15284. "\u1132",
  15285. "\u317E",
  15286. "\u1136",
  15287. "\u317F",
  15288. "\u1140",
  15289. "\u3180",
  15290. "\u1147",
  15291. "\u3181",
  15292. "\u114C",
  15293. "\u3182",
  15294. "\u11F1",
  15295. "\u3183",
  15296. "\u11F2",
  15297. "\u3184",
  15298. "\u1157",
  15299. "\u3185",
  15300. "\u1158",
  15301. "\u3186",
  15302. "\u1159",
  15303. "\u3187",
  15304. "\u1184",
  15305. "\u3188",
  15306. "\u1185",
  15307. "\u3189",
  15308. "\u1188",
  15309. "\u318A",
  15310. "\u1191",
  15311. "\u318B",
  15312. "\u1192",
  15313. "\u318C",
  15314. "\u1194",
  15315. "\u318D",
  15316. "\u119E",
  15317. "\u318E",
  15318. "\u11A1",
  15319. "\u3200",
  15320. "\u0028\u1100\u0029",
  15321. "\u3201",
  15322. "\u0028\u1102\u0029",
  15323. "\u3202",
  15324. "\u0028\u1103\u0029",
  15325. "\u3203",
  15326. "\u0028\u1105\u0029",
  15327. "\u3204",
  15328. "\u0028\u1106\u0029",
  15329. "\u3205",
  15330. "\u0028\u1107\u0029",
  15331. "\u3206",
  15332. "\u0028\u1109\u0029",
  15333. "\u3207",
  15334. "\u0028\u110B\u0029",
  15335. "\u3208",
  15336. "\u0028\u110C\u0029",
  15337. "\u3209",
  15338. "\u0028\u110E\u0029",
  15339. "\u320A",
  15340. "\u0028\u110F\u0029",
  15341. "\u320B",
  15342. "\u0028\u1110\u0029",
  15343. "\u320C",
  15344. "\u0028\u1111\u0029",
  15345. "\u320D",
  15346. "\u0028\u1112\u0029",
  15347. "\u320E",
  15348. "\u0028\u1100\u1161\u0029",
  15349. "\u320F",
  15350. "\u0028\u1102\u1161\u0029",
  15351. "\u3210",
  15352. "\u0028\u1103\u1161\u0029",
  15353. "\u3211",
  15354. "\u0028\u1105\u1161\u0029",
  15355. "\u3212",
  15356. "\u0028\u1106\u1161\u0029",
  15357. "\u3213",
  15358. "\u0028\u1107\u1161\u0029",
  15359. "\u3214",
  15360. "\u0028\u1109\u1161\u0029",
  15361. "\u3215",
  15362. "\u0028\u110B\u1161\u0029",
  15363. "\u3216",
  15364. "\u0028\u110C\u1161\u0029",
  15365. "\u3217",
  15366. "\u0028\u110E\u1161\u0029",
  15367. "\u3218",
  15368. "\u0028\u110F\u1161\u0029",
  15369. "\u3219",
  15370. "\u0028\u1110\u1161\u0029",
  15371. "\u321A",
  15372. "\u0028\u1111\u1161\u0029",
  15373. "\u321B",
  15374. "\u0028\u1112\u1161\u0029",
  15375. "\u321C",
  15376. "\u0028\u110C\u116E\u0029",
  15377. "\u321D",
  15378. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  15379. "\u321E",
  15380. "\u0028\u110B\u1169\u1112\u116E\u0029",
  15381. "\u3220",
  15382. "\u0028\u4E00\u0029",
  15383. "\u3221",
  15384. "\u0028\u4E8C\u0029",
  15385. "\u3222",
  15386. "\u0028\u4E09\u0029",
  15387. "\u3223",
  15388. "\u0028\u56DB\u0029",
  15389. "\u3224",
  15390. "\u0028\u4E94\u0029",
  15391. "\u3225",
  15392. "\u0028\u516D\u0029",
  15393. "\u3226",
  15394. "\u0028\u4E03\u0029",
  15395. "\u3227",
  15396. "\u0028\u516B\u0029",
  15397. "\u3228",
  15398. "\u0028\u4E5D\u0029",
  15399. "\u3229",
  15400. "\u0028\u5341\u0029",
  15401. "\u322A",
  15402. "\u0028\u6708\u0029",
  15403. "\u322B",
  15404. "\u0028\u706B\u0029",
  15405. "\u322C",
  15406. "\u0028\u6C34\u0029",
  15407. "\u322D",
  15408. "\u0028\u6728\u0029",
  15409. "\u322E",
  15410. "\u0028\u91D1\u0029",
  15411. "\u322F",
  15412. "\u0028\u571F\u0029",
  15413. "\u3230",
  15414. "\u0028\u65E5\u0029",
  15415. "\u3231",
  15416. "\u0028\u682A\u0029",
  15417. "\u3232",
  15418. "\u0028\u6709\u0029",
  15419. "\u3233",
  15420. "\u0028\u793E\u0029",
  15421. "\u3234",
  15422. "\u0028\u540D\u0029",
  15423. "\u3235",
  15424. "\u0028\u7279\u0029",
  15425. "\u3236",
  15426. "\u0028\u8CA1\u0029",
  15427. "\u3237",
  15428. "\u0028\u795D\u0029",
  15429. "\u3238",
  15430. "\u0028\u52B4\u0029",
  15431. "\u3239",
  15432. "\u0028\u4EE3\u0029",
  15433. "\u323A",
  15434. "\u0028\u547C\u0029",
  15435. "\u323B",
  15436. "\u0028\u5B66\u0029",
  15437. "\u323C",
  15438. "\u0028\u76E3\u0029",
  15439. "\u323D",
  15440. "\u0028\u4F01\u0029",
  15441. "\u323E",
  15442. "\u0028\u8CC7\u0029",
  15443. "\u323F",
  15444. "\u0028\u5354\u0029",
  15445. "\u3240",
  15446. "\u0028\u796D\u0029",
  15447. "\u3241",
  15448. "\u0028\u4F11\u0029",
  15449. "\u3242",
  15450. "\u0028\u81EA\u0029",
  15451. "\u3243",
  15452. "\u0028\u81F3\u0029",
  15453. "\u32C0",
  15454. "\u0031\u6708",
  15455. "\u32C1",
  15456. "\u0032\u6708",
  15457. "\u32C2",
  15458. "\u0033\u6708",
  15459. "\u32C3",
  15460. "\u0034\u6708",
  15461. "\u32C4",
  15462. "\u0035\u6708",
  15463. "\u32C5",
  15464. "\u0036\u6708",
  15465. "\u32C6",
  15466. "\u0037\u6708",
  15467. "\u32C7",
  15468. "\u0038\u6708",
  15469. "\u32C8",
  15470. "\u0039\u6708",
  15471. "\u32C9",
  15472. "\u0031\u0030\u6708",
  15473. "\u32CA",
  15474. "\u0031\u0031\u6708",
  15475. "\u32CB",
  15476. "\u0031\u0032\u6708",
  15477. "\u3358",
  15478. "\u0030\u70B9",
  15479. "\u3359",
  15480. "\u0031\u70B9",
  15481. "\u335A",
  15482. "\u0032\u70B9",
  15483. "\u335B",
  15484. "\u0033\u70B9",
  15485. "\u335C",
  15486. "\u0034\u70B9",
  15487. "\u335D",
  15488. "\u0035\u70B9",
  15489. "\u335E",
  15490. "\u0036\u70B9",
  15491. "\u335F",
  15492. "\u0037\u70B9",
  15493. "\u3360",
  15494. "\u0038\u70B9",
  15495. "\u3361",
  15496. "\u0039\u70B9",
  15497. "\u3362",
  15498. "\u0031\u0030\u70B9",
  15499. "\u3363",
  15500. "\u0031\u0031\u70B9",
  15501. "\u3364",
  15502. "\u0031\u0032\u70B9",
  15503. "\u3365",
  15504. "\u0031\u0033\u70B9",
  15505. "\u3366",
  15506. "\u0031\u0034\u70B9",
  15507. "\u3367",
  15508. "\u0031\u0035\u70B9",
  15509. "\u3368",
  15510. "\u0031\u0036\u70B9",
  15511. "\u3369",
  15512. "\u0031\u0037\u70B9",
  15513. "\u336A",
  15514. "\u0031\u0038\u70B9",
  15515. "\u336B",
  15516. "\u0031\u0039\u70B9",
  15517. "\u336C",
  15518. "\u0032\u0030\u70B9",
  15519. "\u336D",
  15520. "\u0032\u0031\u70B9",
  15521. "\u336E",
  15522. "\u0032\u0032\u70B9",
  15523. "\u336F",
  15524. "\u0032\u0033\u70B9",
  15525. "\u3370",
  15526. "\u0032\u0034\u70B9",
  15527. "\u33E0",
  15528. "\u0031\u65E5",
  15529. "\u33E1",
  15530. "\u0032\u65E5",
  15531. "\u33E2",
  15532. "\u0033\u65E5",
  15533. "\u33E3",
  15534. "\u0034\u65E5",
  15535. "\u33E4",
  15536. "\u0035\u65E5",
  15537. "\u33E5",
  15538. "\u0036\u65E5",
  15539. "\u33E6",
  15540. "\u0037\u65E5",
  15541. "\u33E7",
  15542. "\u0038\u65E5",
  15543. "\u33E8",
  15544. "\u0039\u65E5",
  15545. "\u33E9",
  15546. "\u0031\u0030\u65E5",
  15547. "\u33EA",
  15548. "\u0031\u0031\u65E5",
  15549. "\u33EB",
  15550. "\u0031\u0032\u65E5",
  15551. "\u33EC",
  15552. "\u0031\u0033\u65E5",
  15553. "\u33ED",
  15554. "\u0031\u0034\u65E5",
  15555. "\u33EE",
  15556. "\u0031\u0035\u65E5",
  15557. "\u33EF",
  15558. "\u0031\u0036\u65E5",
  15559. "\u33F0",
  15560. "\u0031\u0037\u65E5",
  15561. "\u33F1",
  15562. "\u0031\u0038\u65E5",
  15563. "\u33F2",
  15564. "\u0031\u0039\u65E5",
  15565. "\u33F3",
  15566. "\u0032\u0030\u65E5",
  15567. "\u33F4",
  15568. "\u0032\u0031\u65E5",
  15569. "\u33F5",
  15570. "\u0032\u0032\u65E5",
  15571. "\u33F6",
  15572. "\u0032\u0033\u65E5",
  15573. "\u33F7",
  15574. "\u0032\u0034\u65E5",
  15575. "\u33F8",
  15576. "\u0032\u0035\u65E5",
  15577. "\u33F9",
  15578. "\u0032\u0036\u65E5",
  15579. "\u33FA",
  15580. "\u0032\u0037\u65E5",
  15581. "\u33FB",
  15582. "\u0032\u0038\u65E5",
  15583. "\u33FC",
  15584. "\u0032\u0039\u65E5",
  15585. "\u33FD",
  15586. "\u0033\u0030\u65E5",
  15587. "\u33FE",
  15588. "\u0033\u0031\u65E5",
  15589. "\uFB00",
  15590. "\u0066\u0066",
  15591. "\uFB01",
  15592. "\u0066\u0069",
  15593. "\uFB02",
  15594. "\u0066\u006C",
  15595. "\uFB03",
  15596. "\u0066\u0066\u0069",
  15597. "\uFB04",
  15598. "\u0066\u0066\u006C",
  15599. "\uFB05",
  15600. "\u017F\u0074",
  15601. "\uFB06",
  15602. "\u0073\u0074",
  15603. "\uFB13",
  15604. "\u0574\u0576",
  15605. "\uFB14",
  15606. "\u0574\u0565",
  15607. "\uFB15",
  15608. "\u0574\u056B",
  15609. "\uFB16",
  15610. "\u057E\u0576",
  15611. "\uFB17",
  15612. "\u0574\u056D",
  15613. "\uFB4F",
  15614. "\u05D0\u05DC",
  15615. "\uFB50",
  15616. "\u0671",
  15617. "\uFB51",
  15618. "\u0671",
  15619. "\uFB52",
  15620. "\u067B",
  15621. "\uFB53",
  15622. "\u067B",
  15623. "\uFB54",
  15624. "\u067B",
  15625. "\uFB55",
  15626. "\u067B",
  15627. "\uFB56",
  15628. "\u067E",
  15629. "\uFB57",
  15630. "\u067E",
  15631. "\uFB58",
  15632. "\u067E",
  15633. "\uFB59",
  15634. "\u067E",
  15635. "\uFB5A",
  15636. "\u0680",
  15637. "\uFB5B",
  15638. "\u0680",
  15639. "\uFB5C",
  15640. "\u0680",
  15641. "\uFB5D",
  15642. "\u0680",
  15643. "\uFB5E",
  15644. "\u067A",
  15645. "\uFB5F",
  15646. "\u067A",
  15647. "\uFB60",
  15648. "\u067A",
  15649. "\uFB61",
  15650. "\u067A",
  15651. "\uFB62",
  15652. "\u067F",
  15653. "\uFB63",
  15654. "\u067F",
  15655. "\uFB64",
  15656. "\u067F",
  15657. "\uFB65",
  15658. "\u067F",
  15659. "\uFB66",
  15660. "\u0679",
  15661. "\uFB67",
  15662. "\u0679",
  15663. "\uFB68",
  15664. "\u0679",
  15665. "\uFB69",
  15666. "\u0679",
  15667. "\uFB6A",
  15668. "\u06A4",
  15669. "\uFB6B",
  15670. "\u06A4",
  15671. "\uFB6C",
  15672. "\u06A4",
  15673. "\uFB6D",
  15674. "\u06A4",
  15675. "\uFB6E",
  15676. "\u06A6",
  15677. "\uFB6F",
  15678. "\u06A6",
  15679. "\uFB70",
  15680. "\u06A6",
  15681. "\uFB71",
  15682. "\u06A6",
  15683. "\uFB72",
  15684. "\u0684",
  15685. "\uFB73",
  15686. "\u0684",
  15687. "\uFB74",
  15688. "\u0684",
  15689. "\uFB75",
  15690. "\u0684",
  15691. "\uFB76",
  15692. "\u0683",
  15693. "\uFB77",
  15694. "\u0683",
  15695. "\uFB78",
  15696. "\u0683",
  15697. "\uFB79",
  15698. "\u0683",
  15699. "\uFB7A",
  15700. "\u0686",
  15701. "\uFB7B",
  15702. "\u0686",
  15703. "\uFB7C",
  15704. "\u0686",
  15705. "\uFB7D",
  15706. "\u0686",
  15707. "\uFB7E",
  15708. "\u0687",
  15709. "\uFB7F",
  15710. "\u0687",
  15711. "\uFB80",
  15712. "\u0687",
  15713. "\uFB81",
  15714. "\u0687",
  15715. "\uFB82",
  15716. "\u068D",
  15717. "\uFB83",
  15718. "\u068D",
  15719. "\uFB84",
  15720. "\u068C",
  15721. "\uFB85",
  15722. "\u068C",
  15723. "\uFB86",
  15724. "\u068E",
  15725. "\uFB87",
  15726. "\u068E",
  15727. "\uFB88",
  15728. "\u0688",
  15729. "\uFB89",
  15730. "\u0688",
  15731. "\uFB8A",
  15732. "\u0698",
  15733. "\uFB8B",
  15734. "\u0698",
  15735. "\uFB8C",
  15736. "\u0691",
  15737. "\uFB8D",
  15738. "\u0691",
  15739. "\uFB8E",
  15740. "\u06A9",
  15741. "\uFB8F",
  15742. "\u06A9",
  15743. "\uFB90",
  15744. "\u06A9",
  15745. "\uFB91",
  15746. "\u06A9",
  15747. "\uFB92",
  15748. "\u06AF",
  15749. "\uFB93",
  15750. "\u06AF",
  15751. "\uFB94",
  15752. "\u06AF",
  15753. "\uFB95",
  15754. "\u06AF",
  15755. "\uFB96",
  15756. "\u06B3",
  15757. "\uFB97",
  15758. "\u06B3",
  15759. "\uFB98",
  15760. "\u06B3",
  15761. "\uFB99",
  15762. "\u06B3",
  15763. "\uFB9A",
  15764. "\u06B1",
  15765. "\uFB9B",
  15766. "\u06B1",
  15767. "\uFB9C",
  15768. "\u06B1",
  15769. "\uFB9D",
  15770. "\u06B1",
  15771. "\uFB9E",
  15772. "\u06BA",
  15773. "\uFB9F",
  15774. "\u06BA",
  15775. "\uFBA0",
  15776. "\u06BB",
  15777. "\uFBA1",
  15778. "\u06BB",
  15779. "\uFBA2",
  15780. "\u06BB",
  15781. "\uFBA3",
  15782. "\u06BB",
  15783. "\uFBA4",
  15784. "\u06C0",
  15785. "\uFBA5",
  15786. "\u06C0",
  15787. "\uFBA6",
  15788. "\u06C1",
  15789. "\uFBA7",
  15790. "\u06C1",
  15791. "\uFBA8",
  15792. "\u06C1",
  15793. "\uFBA9",
  15794. "\u06C1",
  15795. "\uFBAA",
  15796. "\u06BE",
  15797. "\uFBAB",
  15798. "\u06BE",
  15799. "\uFBAC",
  15800. "\u06BE",
  15801. "\uFBAD",
  15802. "\u06BE",
  15803. "\uFBAE",
  15804. "\u06D2",
  15805. "\uFBAF",
  15806. "\u06D2",
  15807. "\uFBB0",
  15808. "\u06D3",
  15809. "\uFBB1",
  15810. "\u06D3",
  15811. "\uFBD3",
  15812. "\u06AD",
  15813. "\uFBD4",
  15814. "\u06AD",
  15815. "\uFBD5",
  15816. "\u06AD",
  15817. "\uFBD6",
  15818. "\u06AD",
  15819. "\uFBD7",
  15820. "\u06C7",
  15821. "\uFBD8",
  15822. "\u06C7",
  15823. "\uFBD9",
  15824. "\u06C6",
  15825. "\uFBDA",
  15826. "\u06C6",
  15827. "\uFBDB",
  15828. "\u06C8",
  15829. "\uFBDC",
  15830. "\u06C8",
  15831. "\uFBDD",
  15832. "\u0677",
  15833. "\uFBDE",
  15834. "\u06CB",
  15835. "\uFBDF",
  15836. "\u06CB",
  15837. "\uFBE0",
  15838. "\u06C5",
  15839. "\uFBE1",
  15840. "\u06C5",
  15841. "\uFBE2",
  15842. "\u06C9",
  15843. "\uFBE3",
  15844. "\u06C9",
  15845. "\uFBE4",
  15846. "\u06D0",
  15847. "\uFBE5",
  15848. "\u06D0",
  15849. "\uFBE6",
  15850. "\u06D0",
  15851. "\uFBE7",
  15852. "\u06D0",
  15853. "\uFBE8",
  15854. "\u0649",
  15855. "\uFBE9",
  15856. "\u0649",
  15857. "\uFBEA",
  15858. "\u0626\u0627",
  15859. "\uFBEB",
  15860. "\u0626\u0627",
  15861. "\uFBEC",
  15862. "\u0626\u06D5",
  15863. "\uFBED",
  15864. "\u0626\u06D5",
  15865. "\uFBEE",
  15866. "\u0626\u0648",
  15867. "\uFBEF",
  15868. "\u0626\u0648",
  15869. "\uFBF0",
  15870. "\u0626\u06C7",
  15871. "\uFBF1",
  15872. "\u0626\u06C7",
  15873. "\uFBF2",
  15874. "\u0626\u06C6",
  15875. "\uFBF3",
  15876. "\u0626\u06C6",
  15877. "\uFBF4",
  15878. "\u0626\u06C8",
  15879. "\uFBF5",
  15880. "\u0626\u06C8",
  15881. "\uFBF6",
  15882. "\u0626\u06D0",
  15883. "\uFBF7",
  15884. "\u0626\u06D0",
  15885. "\uFBF8",
  15886. "\u0626\u06D0",
  15887. "\uFBF9",
  15888. "\u0626\u0649",
  15889. "\uFBFA",
  15890. "\u0626\u0649",
  15891. "\uFBFB",
  15892. "\u0626\u0649",
  15893. "\uFBFC",
  15894. "\u06CC",
  15895. "\uFBFD",
  15896. "\u06CC",
  15897. "\uFBFE",
  15898. "\u06CC",
  15899. "\uFBFF",
  15900. "\u06CC",
  15901. "\uFC00",
  15902. "\u0626\u062C",
  15903. "\uFC01",
  15904. "\u0626\u062D",
  15905. "\uFC02",
  15906. "\u0626\u0645",
  15907. "\uFC03",
  15908. "\u0626\u0649",
  15909. "\uFC04",
  15910. "\u0626\u064A",
  15911. "\uFC05",
  15912. "\u0628\u062C",
  15913. "\uFC06",
  15914. "\u0628\u062D",
  15915. "\uFC07",
  15916. "\u0628\u062E",
  15917. "\uFC08",
  15918. "\u0628\u0645",
  15919. "\uFC09",
  15920. "\u0628\u0649",
  15921. "\uFC0A",
  15922. "\u0628\u064A",
  15923. "\uFC0B",
  15924. "\u062A\u062C",
  15925. "\uFC0C",
  15926. "\u062A\u062D",
  15927. "\uFC0D",
  15928. "\u062A\u062E",
  15929. "\uFC0E",
  15930. "\u062A\u0645",
  15931. "\uFC0F",
  15932. "\u062A\u0649",
  15933. "\uFC10",
  15934. "\u062A\u064A",
  15935. "\uFC11",
  15936. "\u062B\u062C",
  15937. "\uFC12",
  15938. "\u062B\u0645",
  15939. "\uFC13",
  15940. "\u062B\u0649",
  15941. "\uFC14",
  15942. "\u062B\u064A",
  15943. "\uFC15",
  15944. "\u062C\u062D",
  15945. "\uFC16",
  15946. "\u062C\u0645",
  15947. "\uFC17",
  15948. "\u062D\u062C",
  15949. "\uFC18",
  15950. "\u062D\u0645",
  15951. "\uFC19",
  15952. "\u062E\u062C",
  15953. "\uFC1A",
  15954. "\u062E\u062D",
  15955. "\uFC1B",
  15956. "\u062E\u0645",
  15957. "\uFC1C",
  15958. "\u0633\u062C",
  15959. "\uFC1D",
  15960. "\u0633\u062D",
  15961. "\uFC1E",
  15962. "\u0633\u062E",
  15963. "\uFC1F",
  15964. "\u0633\u0645",
  15965. "\uFC20",
  15966. "\u0635\u062D",
  15967. "\uFC21",
  15968. "\u0635\u0645",
  15969. "\uFC22",
  15970. "\u0636\u062C",
  15971. "\uFC23",
  15972. "\u0636\u062D",
  15973. "\uFC24",
  15974. "\u0636\u062E",
  15975. "\uFC25",
  15976. "\u0636\u0645",
  15977. "\uFC26",
  15978. "\u0637\u062D",
  15979. "\uFC27",
  15980. "\u0637\u0645",
  15981. "\uFC28",
  15982. "\u0638\u0645",
  15983. "\uFC29",
  15984. "\u0639\u062C",
  15985. "\uFC2A",
  15986. "\u0639\u0645",
  15987. "\uFC2B",
  15988. "\u063A\u062C",
  15989. "\uFC2C",
  15990. "\u063A\u0645",
  15991. "\uFC2D",
  15992. "\u0641\u062C",
  15993. "\uFC2E",
  15994. "\u0641\u062D",
  15995. "\uFC2F",
  15996. "\u0641\u062E",
  15997. "\uFC30",
  15998. "\u0641\u0645",
  15999. "\uFC31",
  16000. "\u0641\u0649",
  16001. "\uFC32",
  16002. "\u0641\u064A",
  16003. "\uFC33",
  16004. "\u0642\u062D",
  16005. "\uFC34",
  16006. "\u0642\u0645",
  16007. "\uFC35",
  16008. "\u0642\u0649",
  16009. "\uFC36",
  16010. "\u0642\u064A",
  16011. "\uFC37",
  16012. "\u0643\u0627",
  16013. "\uFC38",
  16014. "\u0643\u062C",
  16015. "\uFC39",
  16016. "\u0643\u062D",
  16017. "\uFC3A",
  16018. "\u0643\u062E",
  16019. "\uFC3B",
  16020. "\u0643\u0644",
  16021. "\uFC3C",
  16022. "\u0643\u0645",
  16023. "\uFC3D",
  16024. "\u0643\u0649",
  16025. "\uFC3E",
  16026. "\u0643\u064A",
  16027. "\uFC3F",
  16028. "\u0644\u062C",
  16029. "\uFC40",
  16030. "\u0644\u062D",
  16031. "\uFC41",
  16032. "\u0644\u062E",
  16033. "\uFC42",
  16034. "\u0644\u0645",
  16035. "\uFC43",
  16036. "\u0644\u0649",
  16037. "\uFC44",
  16038. "\u0644\u064A",
  16039. "\uFC45",
  16040. "\u0645\u062C",
  16041. "\uFC46",
  16042. "\u0645\u062D",
  16043. "\uFC47",
  16044. "\u0645\u062E",
  16045. "\uFC48",
  16046. "\u0645\u0645",
  16047. "\uFC49",
  16048. "\u0645\u0649",
  16049. "\uFC4A",
  16050. "\u0645\u064A",
  16051. "\uFC4B",
  16052. "\u0646\u062C",
  16053. "\uFC4C",
  16054. "\u0646\u062D",
  16055. "\uFC4D",
  16056. "\u0646\u062E",
  16057. "\uFC4E",
  16058. "\u0646\u0645",
  16059. "\uFC4F",
  16060. "\u0646\u0649",
  16061. "\uFC50",
  16062. "\u0646\u064A",
  16063. "\uFC51",
  16064. "\u0647\u062C",
  16065. "\uFC52",
  16066. "\u0647\u0645",
  16067. "\uFC53",
  16068. "\u0647\u0649",
  16069. "\uFC54",
  16070. "\u0647\u064A",
  16071. "\uFC55",
  16072. "\u064A\u062C",
  16073. "\uFC56",
  16074. "\u064A\u062D",
  16075. "\uFC57",
  16076. "\u064A\u062E",
  16077. "\uFC58",
  16078. "\u064A\u0645",
  16079. "\uFC59",
  16080. "\u064A\u0649",
  16081. "\uFC5A",
  16082. "\u064A\u064A",
  16083. "\uFC5B",
  16084. "\u0630\u0670",
  16085. "\uFC5C",
  16086. "\u0631\u0670",
  16087. "\uFC5D",
  16088. "\u0649\u0670",
  16089. "\uFC5E",
  16090. "\u0020\u064C\u0651",
  16091. "\uFC5F",
  16092. "\u0020\u064D\u0651",
  16093. "\uFC60",
  16094. "\u0020\u064E\u0651",
  16095. "\uFC61",
  16096. "\u0020\u064F\u0651",
  16097. "\uFC62",
  16098. "\u0020\u0650\u0651",
  16099. "\uFC63",
  16100. "\u0020\u0651\u0670",
  16101. "\uFC64",
  16102. "\u0626\u0631",
  16103. "\uFC65",
  16104. "\u0626\u0632",
  16105. "\uFC66",
  16106. "\u0626\u0645",
  16107. "\uFC67",
  16108. "\u0626\u0646",
  16109. "\uFC68",
  16110. "\u0626\u0649",
  16111. "\uFC69",
  16112. "\u0626\u064A",
  16113. "\uFC6A",
  16114. "\u0628\u0631",
  16115. "\uFC6B",
  16116. "\u0628\u0632",
  16117. "\uFC6C",
  16118. "\u0628\u0645",
  16119. "\uFC6D",
  16120. "\u0628\u0646",
  16121. "\uFC6E",
  16122. "\u0628\u0649",
  16123. "\uFC6F",
  16124. "\u0628\u064A",
  16125. "\uFC70",
  16126. "\u062A\u0631",
  16127. "\uFC71",
  16128. "\u062A\u0632",
  16129. "\uFC72",
  16130. "\u062A\u0645",
  16131. "\uFC73",
  16132. "\u062A\u0646",
  16133. "\uFC74",
  16134. "\u062A\u0649",
  16135. "\uFC75",
  16136. "\u062A\u064A",
  16137. "\uFC76",
  16138. "\u062B\u0631",
  16139. "\uFC77",
  16140. "\u062B\u0632",
  16141. "\uFC78",
  16142. "\u062B\u0645",
  16143. "\uFC79",
  16144. "\u062B\u0646",
  16145. "\uFC7A",
  16146. "\u062B\u0649",
  16147. "\uFC7B",
  16148. "\u062B\u064A",
  16149. "\uFC7C",
  16150. "\u0641\u0649",
  16151. "\uFC7D",
  16152. "\u0641\u064A",
  16153. "\uFC7E",
  16154. "\u0642\u0649",
  16155. "\uFC7F",
  16156. "\u0642\u064A",
  16157. "\uFC80",
  16158. "\u0643\u0627",
  16159. "\uFC81",
  16160. "\u0643\u0644",
  16161. "\uFC82",
  16162. "\u0643\u0645",
  16163. "\uFC83",
  16164. "\u0643\u0649",
  16165. "\uFC84",
  16166. "\u0643\u064A",
  16167. "\uFC85",
  16168. "\u0644\u0645",
  16169. "\uFC86",
  16170. "\u0644\u0649",
  16171. "\uFC87",
  16172. "\u0644\u064A",
  16173. "\uFC88",
  16174. "\u0645\u0627",
  16175. "\uFC89",
  16176. "\u0645\u0645",
  16177. "\uFC8A",
  16178. "\u0646\u0631",
  16179. "\uFC8B",
  16180. "\u0646\u0632",
  16181. "\uFC8C",
  16182. "\u0646\u0645",
  16183. "\uFC8D",
  16184. "\u0646\u0646",
  16185. "\uFC8E",
  16186. "\u0646\u0649",
  16187. "\uFC8F",
  16188. "\u0646\u064A",
  16189. "\uFC90",
  16190. "\u0649\u0670",
  16191. "\uFC91",
  16192. "\u064A\u0631",
  16193. "\uFC92",
  16194. "\u064A\u0632",
  16195. "\uFC93",
  16196. "\u064A\u0645",
  16197. "\uFC94",
  16198. "\u064A\u0646",
  16199. "\uFC95",
  16200. "\u064A\u0649",
  16201. "\uFC96",
  16202. "\u064A\u064A",
  16203. "\uFC97",
  16204. "\u0626\u062C",
  16205. "\uFC98",
  16206. "\u0626\u062D",
  16207. "\uFC99",
  16208. "\u0626\u062E",
  16209. "\uFC9A",
  16210. "\u0626\u0645",
  16211. "\uFC9B",
  16212. "\u0626\u0647",
  16213. "\uFC9C",
  16214. "\u0628\u062C",
  16215. "\uFC9D",
  16216. "\u0628\u062D",
  16217. "\uFC9E",
  16218. "\u0628\u062E",
  16219. "\uFC9F",
  16220. "\u0628\u0645",
  16221. "\uFCA0",
  16222. "\u0628\u0647",
  16223. "\uFCA1",
  16224. "\u062A\u062C",
  16225. "\uFCA2",
  16226. "\u062A\u062D",
  16227. "\uFCA3",
  16228. "\u062A\u062E",
  16229. "\uFCA4",
  16230. "\u062A\u0645",
  16231. "\uFCA5",
  16232. "\u062A\u0647",
  16233. "\uFCA6",
  16234. "\u062B\u0645",
  16235. "\uFCA7",
  16236. "\u062C\u062D",
  16237. "\uFCA8",
  16238. "\u062C\u0645",
  16239. "\uFCA9",
  16240. "\u062D\u062C",
  16241. "\uFCAA",
  16242. "\u062D\u0645",
  16243. "\uFCAB",
  16244. "\u062E\u062C",
  16245. "\uFCAC",
  16246. "\u062E\u0645",
  16247. "\uFCAD",
  16248. "\u0633\u062C",
  16249. "\uFCAE",
  16250. "\u0633\u062D",
  16251. "\uFCAF",
  16252. "\u0633\u062E",
  16253. "\uFCB0",
  16254. "\u0633\u0645",
  16255. "\uFCB1",
  16256. "\u0635\u062D",
  16257. "\uFCB2",
  16258. "\u0635\u062E",
  16259. "\uFCB3",
  16260. "\u0635\u0645",
  16261. "\uFCB4",
  16262. "\u0636\u062C",
  16263. "\uFCB5",
  16264. "\u0636\u062D",
  16265. "\uFCB6",
  16266. "\u0636\u062E",
  16267. "\uFCB7",
  16268. "\u0636\u0645",
  16269. "\uFCB8",
  16270. "\u0637\u062D",
  16271. "\uFCB9",
  16272. "\u0638\u0645",
  16273. "\uFCBA",
  16274. "\u0639\u062C",
  16275. "\uFCBB",
  16276. "\u0639\u0645",
  16277. "\uFCBC",
  16278. "\u063A\u062C",
  16279. "\uFCBD",
  16280. "\u063A\u0645",
  16281. "\uFCBE",
  16282. "\u0641\u062C",
  16283. "\uFCBF",
  16284. "\u0641\u062D",
  16285. "\uFCC0",
  16286. "\u0641\u062E",
  16287. "\uFCC1",
  16288. "\u0641\u0645",
  16289. "\uFCC2",
  16290. "\u0642\u062D",
  16291. "\uFCC3",
  16292. "\u0642\u0645",
  16293. "\uFCC4",
  16294. "\u0643\u062C",
  16295. "\uFCC5",
  16296. "\u0643\u062D",
  16297. "\uFCC6",
  16298. "\u0643\u062E",
  16299. "\uFCC7",
  16300. "\u0643\u0644",
  16301. "\uFCC8",
  16302. "\u0643\u0645",
  16303. "\uFCC9",
  16304. "\u0644\u062C",
  16305. "\uFCCA",
  16306. "\u0644\u062D",
  16307. "\uFCCB",
  16308. "\u0644\u062E",
  16309. "\uFCCC",
  16310. "\u0644\u0645",
  16311. "\uFCCD",
  16312. "\u0644\u0647",
  16313. "\uFCCE",
  16314. "\u0645\u062C",
  16315. "\uFCCF",
  16316. "\u0645\u062D",
  16317. "\uFCD0",
  16318. "\u0645\u062E",
  16319. "\uFCD1",
  16320. "\u0645\u0645",
  16321. "\uFCD2",
  16322. "\u0646\u062C",
  16323. "\uFCD3",
  16324. "\u0646\u062D",
  16325. "\uFCD4",
  16326. "\u0646\u062E",
  16327. "\uFCD5",
  16328. "\u0646\u0645",
  16329. "\uFCD6",
  16330. "\u0646\u0647",
  16331. "\uFCD7",
  16332. "\u0647\u062C",
  16333. "\uFCD8",
  16334. "\u0647\u0645",
  16335. "\uFCD9",
  16336. "\u0647\u0670",
  16337. "\uFCDA",
  16338. "\u064A\u062C",
  16339. "\uFCDB",
  16340. "\u064A\u062D",
  16341. "\uFCDC",
  16342. "\u064A\u062E",
  16343. "\uFCDD",
  16344. "\u064A\u0645",
  16345. "\uFCDE",
  16346. "\u064A\u0647",
  16347. "\uFCDF",
  16348. "\u0626\u0645",
  16349. "\uFCE0",
  16350. "\u0626\u0647",
  16351. "\uFCE1",
  16352. "\u0628\u0645",
  16353. "\uFCE2",
  16354. "\u0628\u0647",
  16355. "\uFCE3",
  16356. "\u062A\u0645",
  16357. "\uFCE4",
  16358. "\u062A\u0647",
  16359. "\uFCE5",
  16360. "\u062B\u0645",
  16361. "\uFCE6",
  16362. "\u062B\u0647",
  16363. "\uFCE7",
  16364. "\u0633\u0645",
  16365. "\uFCE8",
  16366. "\u0633\u0647",
  16367. "\uFCE9",
  16368. "\u0634\u0645",
  16369. "\uFCEA",
  16370. "\u0634\u0647",
  16371. "\uFCEB",
  16372. "\u0643\u0644",
  16373. "\uFCEC",
  16374. "\u0643\u0645",
  16375. "\uFCED",
  16376. "\u0644\u0645",
  16377. "\uFCEE",
  16378. "\u0646\u0645",
  16379. "\uFCEF",
  16380. "\u0646\u0647",
  16381. "\uFCF0",
  16382. "\u064A\u0645",
  16383. "\uFCF1",
  16384. "\u064A\u0647",
  16385. "\uFCF2",
  16386. "\u0640\u064E\u0651",
  16387. "\uFCF3",
  16388. "\u0640\u064F\u0651",
  16389. "\uFCF4",
  16390. "\u0640\u0650\u0651",
  16391. "\uFCF5",
  16392. "\u0637\u0649",
  16393. "\uFCF6",
  16394. "\u0637\u064A",
  16395. "\uFCF7",
  16396. "\u0639\u0649",
  16397. "\uFCF8",
  16398. "\u0639\u064A",
  16399. "\uFCF9",
  16400. "\u063A\u0649",
  16401. "\uFCFA",
  16402. "\u063A\u064A",
  16403. "\uFCFB",
  16404. "\u0633\u0649",
  16405. "\uFCFC",
  16406. "\u0633\u064A",
  16407. "\uFCFD",
  16408. "\u0634\u0649",
  16409. "\uFCFE",
  16410. "\u0634\u064A",
  16411. "\uFCFF",
  16412. "\u062D\u0649",
  16413. "\uFD00",
  16414. "\u062D\u064A",
  16415. "\uFD01",
  16416. "\u062C\u0649",
  16417. "\uFD02",
  16418. "\u062C\u064A",
  16419. "\uFD03",
  16420. "\u062E\u0649",
  16421. "\uFD04",
  16422. "\u062E\u064A",
  16423. "\uFD05",
  16424. "\u0635\u0649",
  16425. "\uFD06",
  16426. "\u0635\u064A",
  16427. "\uFD07",
  16428. "\u0636\u0649",
  16429. "\uFD08",
  16430. "\u0636\u064A",
  16431. "\uFD09",
  16432. "\u0634\u062C",
  16433. "\uFD0A",
  16434. "\u0634\u062D",
  16435. "\uFD0B",
  16436. "\u0634\u062E",
  16437. "\uFD0C",
  16438. "\u0634\u0645",
  16439. "\uFD0D",
  16440. "\u0634\u0631",
  16441. "\uFD0E",
  16442. "\u0633\u0631",
  16443. "\uFD0F",
  16444. "\u0635\u0631",
  16445. "\uFD10",
  16446. "\u0636\u0631",
  16447. "\uFD11",
  16448. "\u0637\u0649",
  16449. "\uFD12",
  16450. "\u0637\u064A",
  16451. "\uFD13",
  16452. "\u0639\u0649",
  16453. "\uFD14",
  16454. "\u0639\u064A",
  16455. "\uFD15",
  16456. "\u063A\u0649",
  16457. "\uFD16",
  16458. "\u063A\u064A",
  16459. "\uFD17",
  16460. "\u0633\u0649",
  16461. "\uFD18",
  16462. "\u0633\u064A",
  16463. "\uFD19",
  16464. "\u0634\u0649",
  16465. "\uFD1A",
  16466. "\u0634\u064A",
  16467. "\uFD1B",
  16468. "\u062D\u0649",
  16469. "\uFD1C",
  16470. "\u062D\u064A",
  16471. "\uFD1D",
  16472. "\u062C\u0649",
  16473. "\uFD1E",
  16474. "\u062C\u064A",
  16475. "\uFD1F",
  16476. "\u062E\u0649",
  16477. "\uFD20",
  16478. "\u062E\u064A",
  16479. "\uFD21",
  16480. "\u0635\u0649",
  16481. "\uFD22",
  16482. "\u0635\u064A",
  16483. "\uFD23",
  16484. "\u0636\u0649",
  16485. "\uFD24",
  16486. "\u0636\u064A",
  16487. "\uFD25",
  16488. "\u0634\u062C",
  16489. "\uFD26",
  16490. "\u0634\u062D",
  16491. "\uFD27",
  16492. "\u0634\u062E",
  16493. "\uFD28",
  16494. "\u0634\u0645",
  16495. "\uFD29",
  16496. "\u0634\u0631",
  16497. "\uFD2A",
  16498. "\u0633\u0631",
  16499. "\uFD2B",
  16500. "\u0635\u0631",
  16501. "\uFD2C",
  16502. "\u0636\u0631",
  16503. "\uFD2D",
  16504. "\u0634\u062C",
  16505. "\uFD2E",
  16506. "\u0634\u062D",
  16507. "\uFD2F",
  16508. "\u0634\u062E",
  16509. "\uFD30",
  16510. "\u0634\u0645",
  16511. "\uFD31",
  16512. "\u0633\u0647",
  16513. "\uFD32",
  16514. "\u0634\u0647",
  16515. "\uFD33",
  16516. "\u0637\u0645",
  16517. "\uFD34",
  16518. "\u0633\u062C",
  16519. "\uFD35",
  16520. "\u0633\u062D",
  16521. "\uFD36",
  16522. "\u0633\u062E",
  16523. "\uFD37",
  16524. "\u0634\u062C",
  16525. "\uFD38",
  16526. "\u0634\u062D",
  16527. "\uFD39",
  16528. "\u0634\u062E",
  16529. "\uFD3A",
  16530. "\u0637\u0645",
  16531. "\uFD3B",
  16532. "\u0638\u0645",
  16533. "\uFD3C",
  16534. "\u0627\u064B",
  16535. "\uFD3D",
  16536. "\u0627\u064B",
  16537. "\uFD50",
  16538. "\u062A\u062C\u0645",
  16539. "\uFD51",
  16540. "\u062A\u062D\u062C",
  16541. "\uFD52",
  16542. "\u062A\u062D\u062C",
  16543. "\uFD53",
  16544. "\u062A\u062D\u0645",
  16545. "\uFD54",
  16546. "\u062A\u062E\u0645",
  16547. "\uFD55",
  16548. "\u062A\u0645\u062C",
  16549. "\uFD56",
  16550. "\u062A\u0645\u062D",
  16551. "\uFD57",
  16552. "\u062A\u0645\u062E",
  16553. "\uFD58",
  16554. "\u062C\u0645\u062D",
  16555. "\uFD59",
  16556. "\u062C\u0645\u062D",
  16557. "\uFD5A",
  16558. "\u062D\u0645\u064A",
  16559. "\uFD5B",
  16560. "\u062D\u0645\u0649",
  16561. "\uFD5C",
  16562. "\u0633\u062D\u062C",
  16563. "\uFD5D",
  16564. "\u0633\u062C\u062D",
  16565. "\uFD5E",
  16566. "\u0633\u062C\u0649",
  16567. "\uFD5F",
  16568. "\u0633\u0645\u062D",
  16569. "\uFD60",
  16570. "\u0633\u0645\u062D",
  16571. "\uFD61",
  16572. "\u0633\u0645\u062C",
  16573. "\uFD62",
  16574. "\u0633\u0645\u0645",
  16575. "\uFD63",
  16576. "\u0633\u0645\u0645",
  16577. "\uFD64",
  16578. "\u0635\u062D\u062D",
  16579. "\uFD65",
  16580. "\u0635\u062D\u062D",
  16581. "\uFD66",
  16582. "\u0635\u0645\u0645",
  16583. "\uFD67",
  16584. "\u0634\u062D\u0645",
  16585. "\uFD68",
  16586. "\u0634\u062D\u0645",
  16587. "\uFD69",
  16588. "\u0634\u062C\u064A",
  16589. "\uFD6A",
  16590. "\u0634\u0645\u062E",
  16591. "\uFD6B",
  16592. "\u0634\u0645\u062E",
  16593. "\uFD6C",
  16594. "\u0634\u0645\u0645",
  16595. "\uFD6D",
  16596. "\u0634\u0645\u0645",
  16597. "\uFD6E",
  16598. "\u0636\u062D\u0649",
  16599. "\uFD6F",
  16600. "\u0636\u062E\u0645",
  16601. "\uFD70",
  16602. "\u0636\u062E\u0645",
  16603. "\uFD71",
  16604. "\u0637\u0645\u062D",
  16605. "\uFD72",
  16606. "\u0637\u0645\u062D",
  16607. "\uFD73",
  16608. "\u0637\u0645\u0645",
  16609. "\uFD74",
  16610. "\u0637\u0645\u064A",
  16611. "\uFD75",
  16612. "\u0639\u062C\u0645",
  16613. "\uFD76",
  16614. "\u0639\u0645\u0645",
  16615. "\uFD77",
  16616. "\u0639\u0645\u0645",
  16617. "\uFD78",
  16618. "\u0639\u0645\u0649",
  16619. "\uFD79",
  16620. "\u063A\u0645\u0645",
  16621. "\uFD7A",
  16622. "\u063A\u0645\u064A",
  16623. "\uFD7B",
  16624. "\u063A\u0645\u0649",
  16625. "\uFD7C",
  16626. "\u0641\u062E\u0645",
  16627. "\uFD7D",
  16628. "\u0641\u062E\u0645",
  16629. "\uFD7E",
  16630. "\u0642\u0645\u062D",
  16631. "\uFD7F",
  16632. "\u0642\u0645\u0645",
  16633. "\uFD80",
  16634. "\u0644\u062D\u0645",
  16635. "\uFD81",
  16636. "\u0644\u062D\u064A",
  16637. "\uFD82",
  16638. "\u0644\u062D\u0649",
  16639. "\uFD83",
  16640. "\u0644\u062C\u062C",
  16641. "\uFD84",
  16642. "\u0644\u062C\u062C",
  16643. "\uFD85",
  16644. "\u0644\u062E\u0645",
  16645. "\uFD86",
  16646. "\u0644\u062E\u0645",
  16647. "\uFD87",
  16648. "\u0644\u0645\u062D",
  16649. "\uFD88",
  16650. "\u0644\u0645\u062D",
  16651. "\uFD89",
  16652. "\u0645\u062D\u062C",
  16653. "\uFD8A",
  16654. "\u0645\u062D\u0645",
  16655. "\uFD8B",
  16656. "\u0645\u062D\u064A",
  16657. "\uFD8C",
  16658. "\u0645\u062C\u062D",
  16659. "\uFD8D",
  16660. "\u0645\u062C\u0645",
  16661. "\uFD8E",
  16662. "\u0645\u062E\u062C",
  16663. "\uFD8F",
  16664. "\u0645\u062E\u0645",
  16665. "\uFD92",
  16666. "\u0645\u062C\u062E",
  16667. "\uFD93",
  16668. "\u0647\u0645\u062C",
  16669. "\uFD94",
  16670. "\u0647\u0645\u0645",
  16671. "\uFD95",
  16672. "\u0646\u062D\u0645",
  16673. "\uFD96",
  16674. "\u0646\u062D\u0649",
  16675. "\uFD97",
  16676. "\u0646\u062C\u0645",
  16677. "\uFD98",
  16678. "\u0646\u062C\u0645",
  16679. "\uFD99",
  16680. "\u0646\u062C\u0649",
  16681. "\uFD9A",
  16682. "\u0646\u0645\u064A",
  16683. "\uFD9B",
  16684. "\u0646\u0645\u0649",
  16685. "\uFD9C",
  16686. "\u064A\u0645\u0645",
  16687. "\uFD9D",
  16688. "\u064A\u0645\u0645",
  16689. "\uFD9E",
  16690. "\u0628\u062E\u064A",
  16691. "\uFD9F",
  16692. "\u062A\u062C\u064A",
  16693. "\uFDA0",
  16694. "\u062A\u062C\u0649",
  16695. "\uFDA1",
  16696. "\u062A\u062E\u064A",
  16697. "\uFDA2",
  16698. "\u062A\u062E\u0649",
  16699. "\uFDA3",
  16700. "\u062A\u0645\u064A",
  16701. "\uFDA4",
  16702. "\u062A\u0645\u0649",
  16703. "\uFDA5",
  16704. "\u062C\u0645\u064A",
  16705. "\uFDA6",
  16706. "\u062C\u062D\u0649",
  16707. "\uFDA7",
  16708. "\u062C\u0645\u0649",
  16709. "\uFDA8",
  16710. "\u0633\u062E\u0649",
  16711. "\uFDA9",
  16712. "\u0635\u062D\u064A",
  16713. "\uFDAA",
  16714. "\u0634\u062D\u064A",
  16715. "\uFDAB",
  16716. "\u0636\u062D\u064A",
  16717. "\uFDAC",
  16718. "\u0644\u062C\u064A",
  16719. "\uFDAD",
  16720. "\u0644\u0645\u064A",
  16721. "\uFDAE",
  16722. "\u064A\u062D\u064A",
  16723. "\uFDAF",
  16724. "\u064A\u062C\u064A",
  16725. "\uFDB0",
  16726. "\u064A\u0645\u064A",
  16727. "\uFDB1",
  16728. "\u0645\u0645\u064A",
  16729. "\uFDB2",
  16730. "\u0642\u0645\u064A",
  16731. "\uFDB3",
  16732. "\u0646\u062D\u064A",
  16733. "\uFDB4",
  16734. "\u0642\u0645\u062D",
  16735. "\uFDB5",
  16736. "\u0644\u062D\u0645",
  16737. "\uFDB6",
  16738. "\u0639\u0645\u064A",
  16739. "\uFDB7",
  16740. "\u0643\u0645\u064A",
  16741. "\uFDB8",
  16742. "\u0646\u062C\u062D",
  16743. "\uFDB9",
  16744. "\u0645\u062E\u064A",
  16745. "\uFDBA",
  16746. "\u0644\u062C\u0645",
  16747. "\uFDBB",
  16748. "\u0643\u0645\u0645",
  16749. "\uFDBC",
  16750. "\u0644\u062C\u0645",
  16751. "\uFDBD",
  16752. "\u0646\u062C\u062D",
  16753. "\uFDBE",
  16754. "\u062C\u062D\u064A",
  16755. "\uFDBF",
  16756. "\u062D\u062C\u064A",
  16757. "\uFDC0",
  16758. "\u0645\u062C\u064A",
  16759. "\uFDC1",
  16760. "\u0641\u0645\u064A",
  16761. "\uFDC2",
  16762. "\u0628\u062D\u064A",
  16763. "\uFDC3",
  16764. "\u0643\u0645\u0645",
  16765. "\uFDC4",
  16766. "\u0639\u062C\u0645",
  16767. "\uFDC5",
  16768. "\u0635\u0645\u0645",
  16769. "\uFDC6",
  16770. "\u0633\u062E\u064A",
  16771. "\uFDC7",
  16772. "\u0646\u062C\u064A",
  16773. "\uFE49",
  16774. "\u203E",
  16775. "\uFE4A",
  16776. "\u203E",
  16777. "\uFE4B",
  16778. "\u203E",
  16779. "\uFE4C",
  16780. "\u203E",
  16781. "\uFE4D",
  16782. "\u005F",
  16783. "\uFE4E",
  16784. "\u005F",
  16785. "\uFE4F",
  16786. "\u005F",
  16787. "\uFE80",
  16788. "\u0621",
  16789. "\uFE81",
  16790. "\u0622",
  16791. "\uFE82",
  16792. "\u0622",
  16793. "\uFE83",
  16794. "\u0623",
  16795. "\uFE84",
  16796. "\u0623",
  16797. "\uFE85",
  16798. "\u0624",
  16799. "\uFE86",
  16800. "\u0624",
  16801. "\uFE87",
  16802. "\u0625",
  16803. "\uFE88",
  16804. "\u0625",
  16805. "\uFE89",
  16806. "\u0626",
  16807. "\uFE8A",
  16808. "\u0626",
  16809. "\uFE8B",
  16810. "\u0626",
  16811. "\uFE8C",
  16812. "\u0626",
  16813. "\uFE8D",
  16814. "\u0627",
  16815. "\uFE8E",
  16816. "\u0627",
  16817. "\uFE8F",
  16818. "\u0628",
  16819. "\uFE90",
  16820. "\u0628",
  16821. "\uFE91",
  16822. "\u0628",
  16823. "\uFE92",
  16824. "\u0628",
  16825. "\uFE93",
  16826. "\u0629",
  16827. "\uFE94",
  16828. "\u0629",
  16829. "\uFE95",
  16830. "\u062A",
  16831. "\uFE96",
  16832. "\u062A",
  16833. "\uFE97",
  16834. "\u062A",
  16835. "\uFE98",
  16836. "\u062A",
  16837. "\uFE99",
  16838. "\u062B",
  16839. "\uFE9A",
  16840. "\u062B",
  16841. "\uFE9B",
  16842. "\u062B",
  16843. "\uFE9C",
  16844. "\u062B",
  16845. "\uFE9D",
  16846. "\u062C",
  16847. "\uFE9E",
  16848. "\u062C",
  16849. "\uFE9F",
  16850. "\u062C",
  16851. "\uFEA0",
  16852. "\u062C",
  16853. "\uFEA1",
  16854. "\u062D",
  16855. "\uFEA2",
  16856. "\u062D",
  16857. "\uFEA3",
  16858. "\u062D",
  16859. "\uFEA4",
  16860. "\u062D",
  16861. "\uFEA5",
  16862. "\u062E",
  16863. "\uFEA6",
  16864. "\u062E",
  16865. "\uFEA7",
  16866. "\u062E",
  16867. "\uFEA8",
  16868. "\u062E",
  16869. "\uFEA9",
  16870. "\u062F",
  16871. "\uFEAA",
  16872. "\u062F",
  16873. "\uFEAB",
  16874. "\u0630",
  16875. "\uFEAC",
  16876. "\u0630",
  16877. "\uFEAD",
  16878. "\u0631",
  16879. "\uFEAE",
  16880. "\u0631",
  16881. "\uFEAF",
  16882. "\u0632",
  16883. "\uFEB0",
  16884. "\u0632",
  16885. "\uFEB1",
  16886. "\u0633",
  16887. "\uFEB2",
  16888. "\u0633",
  16889. "\uFEB3",
  16890. "\u0633",
  16891. "\uFEB4",
  16892. "\u0633",
  16893. "\uFEB5",
  16894. "\u0634",
  16895. "\uFEB6",
  16896. "\u0634",
  16897. "\uFEB7",
  16898. "\u0634",
  16899. "\uFEB8",
  16900. "\u0634",
  16901. "\uFEB9",
  16902. "\u0635",
  16903. "\uFEBA",
  16904. "\u0635",
  16905. "\uFEBB",
  16906. "\u0635",
  16907. "\uFEBC",
  16908. "\u0635",
  16909. "\uFEBD",
  16910. "\u0636",
  16911. "\uFEBE",
  16912. "\u0636",
  16913. "\uFEBF",
  16914. "\u0636",
  16915. "\uFEC0",
  16916. "\u0636",
  16917. "\uFEC1",
  16918. "\u0637",
  16919. "\uFEC2",
  16920. "\u0637",
  16921. "\uFEC3",
  16922. "\u0637",
  16923. "\uFEC4",
  16924. "\u0637",
  16925. "\uFEC5",
  16926. "\u0638",
  16927. "\uFEC6",
  16928. "\u0638",
  16929. "\uFEC7",
  16930. "\u0638",
  16931. "\uFEC8",
  16932. "\u0638",
  16933. "\uFEC9",
  16934. "\u0639",
  16935. "\uFECA",
  16936. "\u0639",
  16937. "\uFECB",
  16938. "\u0639",
  16939. "\uFECC",
  16940. "\u0639",
  16941. "\uFECD",
  16942. "\u063A",
  16943. "\uFECE",
  16944. "\u063A",
  16945. "\uFECF",
  16946. "\u063A",
  16947. "\uFED0",
  16948. "\u063A",
  16949. "\uFED1",
  16950. "\u0641",
  16951. "\uFED2",
  16952. "\u0641",
  16953. "\uFED3",
  16954. "\u0641",
  16955. "\uFED4",
  16956. "\u0641",
  16957. "\uFED5",
  16958. "\u0642",
  16959. "\uFED6",
  16960. "\u0642",
  16961. "\uFED7",
  16962. "\u0642",
  16963. "\uFED8",
  16964. "\u0642",
  16965. "\uFED9",
  16966. "\u0643",
  16967. "\uFEDA",
  16968. "\u0643",
  16969. "\uFEDB",
  16970. "\u0643",
  16971. "\uFEDC",
  16972. "\u0643",
  16973. "\uFEDD",
  16974. "\u0644",
  16975. "\uFEDE",
  16976. "\u0644",
  16977. "\uFEDF",
  16978. "\u0644",
  16979. "\uFEE0",
  16980. "\u0644",
  16981. "\uFEE1",
  16982. "\u0645",
  16983. "\uFEE2",
  16984. "\u0645",
  16985. "\uFEE3",
  16986. "\u0645",
  16987. "\uFEE4",
  16988. "\u0645",
  16989. "\uFEE5",
  16990. "\u0646",
  16991. "\uFEE6",
  16992. "\u0646",
  16993. "\uFEE7",
  16994. "\u0646",
  16995. "\uFEE8",
  16996. "\u0646",
  16997. "\uFEE9",
  16998. "\u0647",
  16999. "\uFEEA",
  17000. "\u0647",
  17001. "\uFEEB",
  17002. "\u0647",
  17003. "\uFEEC",
  17004. "\u0647",
  17005. "\uFEED",
  17006. "\u0648",
  17007. "\uFEEE",
  17008. "\u0648",
  17009. "\uFEEF",
  17010. "\u0649",
  17011. "\uFEF0",
  17012. "\u0649",
  17013. "\uFEF1",
  17014. "\u064A",
  17015. "\uFEF2",
  17016. "\u064A",
  17017. "\uFEF3",
  17018. "\u064A",
  17019. "\uFEF4",
  17020. "\u064A",
  17021. "\uFEF5",
  17022. "\u0644\u0622",
  17023. "\uFEF6",
  17024. "\u0644\u0622",
  17025. "\uFEF7",
  17026. "\u0644\u0623",
  17027. "\uFEF8",
  17028. "\u0644\u0623",
  17029. "\uFEF9",
  17030. "\u0644\u0625",
  17031. "\uFEFA",
  17032. "\u0644\u0625",
  17033. "\uFEFB",
  17034. "\u0644\u0627",
  17035. "\uFEFC",
  17036. "\u0644\u0627"
  17037. ];
  17038. });
  17039. function reverseIfRtl(chars) {
  17040. const charsLength = chars.length;
  17041. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  17042. return chars;
  17043. }
  17044. const buf = [];
  17045. for (let ii = charsLength - 1; ii >= 0; ii--) {
  17046. buf.push(chars[ii]);
  17047. }
  17048. return buf.join("");
  17049. }
  17050. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  17051. const CategoryCache = new Map();
  17052. function getCharUnicodeCategory(char) {
  17053. const cachedCategory = CategoryCache.get(char);
  17054. if (cachedCategory) {
  17055. return cachedCategory;
  17056. }
  17057. const groups = char.match(SpecialCharRegExp);
  17058. const category = {
  17059. isWhitespace: !!(groups && groups[1]),
  17060. isZeroWidthDiacritic: !!(groups && groups[2]),
  17061. isInvisibleFormatMark: !!(groups && groups[3])
  17062. };
  17063. CategoryCache.set(char, category);
  17064. return category;
  17065. }
  17066. function clearUnicodeCaches() {
  17067. CategoryCache.clear();
  17068. }
  17069. /***/ }),
  17070. /* 22 */
  17071. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17072. Object.defineProperty(exports, "__esModule", ({
  17073. value: true
  17074. }));
  17075. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  17076. exports.getQuadPoints = getQuadPoints;
  17077. var _util = __w_pdfjs_require__(2);
  17078. var _core_utils = __w_pdfjs_require__(8);
  17079. var _default_appearance = __w_pdfjs_require__(23);
  17080. var _primitives = __w_pdfjs_require__(5);
  17081. var _base_stream = __w_pdfjs_require__(9);
  17082. var _bidi = __w_pdfjs_require__(60);
  17083. var _catalog = __w_pdfjs_require__(65);
  17084. var _colorspace = __w_pdfjs_require__(24);
  17085. var _file_spec = __w_pdfjs_require__(68);
  17086. var _object_loader = __w_pdfjs_require__(72);
  17087. var _operator_list = __w_pdfjs_require__(62);
  17088. var _stream = __w_pdfjs_require__(10);
  17089. var _writer = __w_pdfjs_require__(73);
  17090. var _factory = __w_pdfjs_require__(76);
  17091. const LINE_FACTOR = 1.35;
  17092. class AnnotationFactory {
  17093. static create(xref, ref, pdfManager, idFactory, collectFields) {
  17094. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex]));
  17095. }
  17096. static _create(xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex = -1) {
  17097. const dict = xref.fetchIfRef(ref);
  17098. if (!(dict instanceof _primitives.Dict)) {
  17099. return undefined;
  17100. }
  17101. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  17102. let subtype = dict.get("Subtype");
  17103. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  17104. const parameters = {
  17105. xref,
  17106. ref,
  17107. dict,
  17108. subtype,
  17109. id,
  17110. pdfManager,
  17111. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  17112. xfaDatasets,
  17113. collectFields,
  17114. pageIndex
  17115. };
  17116. switch (subtype) {
  17117. case "Link":
  17118. return new LinkAnnotation(parameters);
  17119. case "Text":
  17120. return new TextAnnotation(parameters);
  17121. case "Widget":
  17122. let fieldType = (0, _core_utils.getInheritableProperty)({
  17123. dict,
  17124. key: "FT"
  17125. });
  17126. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17127. switch (fieldType) {
  17128. case "Tx":
  17129. return new TextWidgetAnnotation(parameters);
  17130. case "Btn":
  17131. return new ButtonWidgetAnnotation(parameters);
  17132. case "Ch":
  17133. return new ChoiceWidgetAnnotation(parameters);
  17134. case "Sig":
  17135. return new SignatureWidgetAnnotation(parameters);
  17136. }
  17137. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  17138. return new WidgetAnnotation(parameters);
  17139. case "Popup":
  17140. return new PopupAnnotation(parameters);
  17141. case "FreeText":
  17142. return new FreeTextAnnotation(parameters);
  17143. case "Line":
  17144. return new LineAnnotation(parameters);
  17145. case "Square":
  17146. return new SquareAnnotation(parameters);
  17147. case "Circle":
  17148. return new CircleAnnotation(parameters);
  17149. case "PolyLine":
  17150. return new PolylineAnnotation(parameters);
  17151. case "Polygon":
  17152. return new PolygonAnnotation(parameters);
  17153. case "Caret":
  17154. return new CaretAnnotation(parameters);
  17155. case "Ink":
  17156. return new InkAnnotation(parameters);
  17157. case "Highlight":
  17158. return new HighlightAnnotation(parameters);
  17159. case "Underline":
  17160. return new UnderlineAnnotation(parameters);
  17161. case "Squiggly":
  17162. return new SquigglyAnnotation(parameters);
  17163. case "StrikeOut":
  17164. return new StrikeOutAnnotation(parameters);
  17165. case "Stamp":
  17166. return new StampAnnotation(parameters);
  17167. case "FileAttachment":
  17168. return new FileAttachmentAnnotation(parameters);
  17169. default:
  17170. if (!collectFields) {
  17171. if (!subtype) {
  17172. (0, _util.warn)("Annotation is missing the required /Subtype.");
  17173. } else {
  17174. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  17175. }
  17176. }
  17177. return new Annotation(parameters);
  17178. }
  17179. }
  17180. static async _getPageIndex(xref, ref, pdfManager) {
  17181. try {
  17182. const annotDict = await xref.fetchIfRefAsync(ref);
  17183. if (!(annotDict instanceof _primitives.Dict)) {
  17184. return -1;
  17185. }
  17186. const pageRef = annotDict.getRaw("P");
  17187. if (!(pageRef instanceof _primitives.Ref)) {
  17188. return -1;
  17189. }
  17190. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  17191. return pageIndex;
  17192. } catch (ex) {
  17193. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  17194. return -1;
  17195. }
  17196. }
  17197. }
  17198. exports.AnnotationFactory = AnnotationFactory;
  17199. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  17200. if (!Array.isArray(color)) {
  17201. return defaultColor;
  17202. }
  17203. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  17204. switch (color.length) {
  17205. case 0:
  17206. return null;
  17207. case 1:
  17208. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  17209. return rgbColor;
  17210. case 3:
  17211. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  17212. return rgbColor;
  17213. case 4:
  17214. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  17215. return rgbColor;
  17216. default:
  17217. return defaultColor;
  17218. }
  17219. }
  17220. function getQuadPoints(dict, rect) {
  17221. if (!dict.has("QuadPoints")) {
  17222. return null;
  17223. }
  17224. const quadPoints = dict.getArray("QuadPoints");
  17225. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  17226. return null;
  17227. }
  17228. const quadPointsLists = [];
  17229. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  17230. quadPointsLists.push([]);
  17231. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  17232. const x = quadPoints[j];
  17233. const y = quadPoints[j + 1];
  17234. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  17235. return null;
  17236. }
  17237. quadPointsLists[i].push({
  17238. x,
  17239. y
  17240. });
  17241. }
  17242. }
  17243. return quadPointsLists.map(quadPointsList => {
  17244. 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]);
  17245. return [{
  17246. x: minX,
  17247. y: maxY
  17248. }, {
  17249. x: maxX,
  17250. y: maxY
  17251. }, {
  17252. x: minX,
  17253. y: minY
  17254. }, {
  17255. x: maxX,
  17256. y: minY
  17257. }];
  17258. });
  17259. }
  17260. function getTransformMatrix(rect, bbox, matrix) {
  17261. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  17262. if (minX === maxX || minY === maxY) {
  17263. return [1, 0, 0, 1, rect[0], rect[1]];
  17264. }
  17265. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  17266. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  17267. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  17268. }
  17269. class Annotation {
  17270. constructor(params) {
  17271. const dict = params.dict;
  17272. this.setTitle(dict.get("T"));
  17273. this.setContents(dict.get("Contents"));
  17274. this.setModificationDate(dict.get("M"));
  17275. this.setFlags(dict.get("F"));
  17276. this.setRectangle(dict.getArray("Rect"));
  17277. this.setColor(dict.getArray("C"));
  17278. this.setBorderStyle(dict);
  17279. this.setAppearance(dict);
  17280. this.setBorderAndBackgroundColors(dict.get("MK"));
  17281. this._streams = [];
  17282. if (this.appearance) {
  17283. this._streams.push(this.appearance);
  17284. }
  17285. this.data = {
  17286. annotationFlags: this.flags,
  17287. borderStyle: this.borderStyle,
  17288. color: this.color,
  17289. backgroundColor: this.backgroundColor,
  17290. borderColor: this.borderColor,
  17291. contentsObj: this._contents,
  17292. hasAppearance: !!this.appearance,
  17293. id: params.id,
  17294. modificationDate: this.modificationDate,
  17295. rect: this.rectangle,
  17296. subtype: params.subtype,
  17297. hasOwnCanvas: false
  17298. };
  17299. if (params.collectFields) {
  17300. const kids = dict.get("Kids");
  17301. if (Array.isArray(kids)) {
  17302. const kidIds = [];
  17303. for (const kid of kids) {
  17304. if (kid instanceof _primitives.Ref) {
  17305. kidIds.push(kid.toString());
  17306. }
  17307. }
  17308. if (kidIds.length !== 0) {
  17309. this.data.kidIds = kidIds;
  17310. }
  17311. }
  17312. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17313. this.data.fieldName = this._constructFieldName(dict);
  17314. this.data.pageIndex = params.pageIndex;
  17315. }
  17316. this._fallbackFontDict = null;
  17317. }
  17318. _hasFlag(flags, flag) {
  17319. return !!(flags & flag);
  17320. }
  17321. _isViewable(flags) {
  17322. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  17323. }
  17324. _isPrintable(flags) {
  17325. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  17326. }
  17327. mustBeViewed(annotationStorage) {
  17328. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17329. if (storageEntry && storageEntry.hidden !== undefined) {
  17330. return !storageEntry.hidden;
  17331. }
  17332. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  17333. }
  17334. mustBePrinted(annotationStorage) {
  17335. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17336. if (storageEntry && storageEntry.print !== undefined) {
  17337. return storageEntry.print;
  17338. }
  17339. return this.printable;
  17340. }
  17341. get viewable() {
  17342. if (this.data.quadPoints === null) {
  17343. return false;
  17344. }
  17345. if (this.flags === 0) {
  17346. return true;
  17347. }
  17348. return this._isViewable(this.flags);
  17349. }
  17350. get printable() {
  17351. if (this.data.quadPoints === null) {
  17352. return false;
  17353. }
  17354. if (this.flags === 0) {
  17355. return false;
  17356. }
  17357. return this._isPrintable(this.flags);
  17358. }
  17359. _parseStringHelper(data) {
  17360. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  17361. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  17362. return {
  17363. str,
  17364. dir
  17365. };
  17366. }
  17367. setTitle(title) {
  17368. this._title = this._parseStringHelper(title);
  17369. }
  17370. setContents(contents) {
  17371. this._contents = this._parseStringHelper(contents);
  17372. }
  17373. setModificationDate(modificationDate) {
  17374. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  17375. }
  17376. setFlags(flags) {
  17377. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  17378. }
  17379. hasFlag(flag) {
  17380. return this._hasFlag(this.flags, flag);
  17381. }
  17382. setRectangle(rectangle) {
  17383. if (Array.isArray(rectangle) && rectangle.length === 4) {
  17384. this.rectangle = _util.Util.normalizeRect(rectangle);
  17385. } else {
  17386. this.rectangle = [0, 0, 0, 0];
  17387. }
  17388. }
  17389. setColor(color) {
  17390. this.color = getRgbColor(color);
  17391. }
  17392. setLineEndings(lineEndings) {
  17393. this.lineEndings = ["None", "None"];
  17394. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  17395. for (let i = 0; i < 2; i++) {
  17396. const obj = lineEndings[i];
  17397. if (obj instanceof _primitives.Name) {
  17398. switch (obj.name) {
  17399. case "None":
  17400. continue;
  17401. case "Square":
  17402. case "Circle":
  17403. case "Diamond":
  17404. case "OpenArrow":
  17405. case "ClosedArrow":
  17406. case "Butt":
  17407. case "ROpenArrow":
  17408. case "RClosedArrow":
  17409. case "Slash":
  17410. this.lineEndings[i] = obj.name;
  17411. continue;
  17412. }
  17413. }
  17414. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  17415. }
  17416. }
  17417. }
  17418. setBorderAndBackgroundColors(mk) {
  17419. if (mk instanceof _primitives.Dict) {
  17420. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  17421. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  17422. } else {
  17423. this.borderColor = this.backgroundColor = null;
  17424. }
  17425. }
  17426. setBorderStyle(borderStyle) {
  17427. this.borderStyle = new AnnotationBorderStyle();
  17428. if (!(borderStyle instanceof _primitives.Dict)) {
  17429. return;
  17430. }
  17431. if (borderStyle.has("BS")) {
  17432. const dict = borderStyle.get("BS");
  17433. const dictType = dict.get("Type");
  17434. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  17435. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  17436. this.borderStyle.setStyle(dict.get("S"));
  17437. this.borderStyle.setDashArray(dict.getArray("D"));
  17438. }
  17439. } else if (borderStyle.has("Border")) {
  17440. const array = borderStyle.getArray("Border");
  17441. if (Array.isArray(array) && array.length >= 3) {
  17442. this.borderStyle.setHorizontalCornerRadius(array[0]);
  17443. this.borderStyle.setVerticalCornerRadius(array[1]);
  17444. this.borderStyle.setWidth(array[2], this.rectangle);
  17445. if (array.length === 4) {
  17446. this.borderStyle.setDashArray(array[3], true);
  17447. }
  17448. }
  17449. } else {
  17450. this.borderStyle.setWidth(0);
  17451. }
  17452. }
  17453. setAppearance(dict) {
  17454. this.appearance = null;
  17455. const appearanceStates = dict.get("AP");
  17456. if (!(appearanceStates instanceof _primitives.Dict)) {
  17457. return;
  17458. }
  17459. const normalAppearanceState = appearanceStates.get("N");
  17460. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  17461. this.appearance = normalAppearanceState;
  17462. return;
  17463. }
  17464. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  17465. return;
  17466. }
  17467. const as = dict.get("AS");
  17468. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  17469. return;
  17470. }
  17471. this.appearance = normalAppearanceState.get(as.name);
  17472. }
  17473. loadResources(keys, appearance) {
  17474. return appearance.dict.getAsync("Resources").then(resources => {
  17475. if (!resources) {
  17476. return undefined;
  17477. }
  17478. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  17479. return objectLoader.load().then(function () {
  17480. return resources;
  17481. });
  17482. });
  17483. }
  17484. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17485. const data = this.data;
  17486. let appearance = this.appearance;
  17487. const isUsingOwnCanvas = data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY;
  17488. if (!appearance) {
  17489. if (!isUsingOwnCanvas) {
  17490. return Promise.resolve(new _operator_list.OperatorList());
  17491. }
  17492. appearance = new _stream.StringStream("");
  17493. appearance.dict = new _primitives.Dict();
  17494. }
  17495. const appearanceDict = appearance.dict;
  17496. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  17497. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  17498. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  17499. const transform = getTransformMatrix(data.rect, bbox, matrix);
  17500. return resourcesPromise.then(resources => {
  17501. const opList = new _operator_list.OperatorList();
  17502. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  17503. return evaluator.getOperatorList({
  17504. stream: appearance,
  17505. task,
  17506. resources,
  17507. operatorList: opList,
  17508. fallbackFontDict: this._fallbackFontDict
  17509. }).then(() => {
  17510. opList.addOp(_util.OPS.endAnnotation, []);
  17511. this.reset();
  17512. return opList;
  17513. });
  17514. });
  17515. }
  17516. async save(evaluator, task, annotationStorage) {
  17517. return null;
  17518. }
  17519. getFieldObject() {
  17520. if (this.data.kidIds) {
  17521. return {
  17522. id: this.data.id,
  17523. actions: this.data.actions,
  17524. name: this.data.fieldName,
  17525. strokeColor: this.data.borderColor,
  17526. fillColor: this.data.backgroundColor,
  17527. type: "",
  17528. kidIds: this.data.kidIds,
  17529. page: this.data.pageIndex
  17530. };
  17531. }
  17532. return null;
  17533. }
  17534. reset() {
  17535. for (const stream of this._streams) {
  17536. stream.reset();
  17537. }
  17538. }
  17539. _constructFieldName(dict) {
  17540. if (!dict.has("T") && !dict.has("Parent")) {
  17541. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  17542. return "";
  17543. }
  17544. if (!dict.has("Parent")) {
  17545. return (0, _util.stringToPDFString)(dict.get("T"));
  17546. }
  17547. const fieldName = [];
  17548. if (dict.has("T")) {
  17549. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  17550. }
  17551. let loopDict = dict;
  17552. const visited = new _primitives.RefSet();
  17553. if (dict.objId) {
  17554. visited.put(dict.objId);
  17555. }
  17556. while (loopDict.has("Parent")) {
  17557. loopDict = loopDict.get("Parent");
  17558. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  17559. break;
  17560. }
  17561. if (loopDict.objId) {
  17562. visited.put(loopDict.objId);
  17563. }
  17564. if (loopDict.has("T")) {
  17565. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  17566. }
  17567. }
  17568. return fieldName.join(".");
  17569. }
  17570. }
  17571. exports.Annotation = Annotation;
  17572. class AnnotationBorderStyle {
  17573. constructor() {
  17574. this.width = 1;
  17575. this.style = _util.AnnotationBorderStyleType.SOLID;
  17576. this.dashArray = [3];
  17577. this.horizontalCornerRadius = 0;
  17578. this.verticalCornerRadius = 0;
  17579. }
  17580. setWidth(width, rect = [0, 0, 0, 0]) {
  17581. if (width instanceof _primitives.Name) {
  17582. this.width = 0;
  17583. return;
  17584. }
  17585. if (typeof width === "number") {
  17586. if (width > 0) {
  17587. const maxWidth = (rect[2] - rect[0]) / 2;
  17588. const maxHeight = (rect[3] - rect[1]) / 2;
  17589. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  17590. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  17591. width = 1;
  17592. }
  17593. }
  17594. this.width = width;
  17595. }
  17596. }
  17597. setStyle(style) {
  17598. if (!(style instanceof _primitives.Name)) {
  17599. return;
  17600. }
  17601. switch (style.name) {
  17602. case "S":
  17603. this.style = _util.AnnotationBorderStyleType.SOLID;
  17604. break;
  17605. case "D":
  17606. this.style = _util.AnnotationBorderStyleType.DASHED;
  17607. break;
  17608. case "B":
  17609. this.style = _util.AnnotationBorderStyleType.BEVELED;
  17610. break;
  17611. case "I":
  17612. this.style = _util.AnnotationBorderStyleType.INSET;
  17613. break;
  17614. case "U":
  17615. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  17616. break;
  17617. default:
  17618. break;
  17619. }
  17620. }
  17621. setDashArray(dashArray, forceStyle = false) {
  17622. if (Array.isArray(dashArray) && dashArray.length > 0) {
  17623. let isValid = true;
  17624. let allZeros = true;
  17625. for (const element of dashArray) {
  17626. const validNumber = +element >= 0;
  17627. if (!validNumber) {
  17628. isValid = false;
  17629. break;
  17630. } else if (element > 0) {
  17631. allZeros = false;
  17632. }
  17633. }
  17634. if (isValid && !allZeros) {
  17635. this.dashArray = dashArray;
  17636. if (forceStyle) {
  17637. this.setStyle(_primitives.Name.get("D"));
  17638. }
  17639. } else {
  17640. this.width = 0;
  17641. }
  17642. } else if (dashArray) {
  17643. this.width = 0;
  17644. }
  17645. }
  17646. setHorizontalCornerRadius(radius) {
  17647. if (Number.isInteger(radius)) {
  17648. this.horizontalCornerRadius = radius;
  17649. }
  17650. }
  17651. setVerticalCornerRadius(radius) {
  17652. if (Number.isInteger(radius)) {
  17653. this.verticalCornerRadius = radius;
  17654. }
  17655. }
  17656. }
  17657. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  17658. class MarkupAnnotation extends Annotation {
  17659. constructor(parameters) {
  17660. super(parameters);
  17661. const dict = parameters.dict;
  17662. if (dict.has("IRT")) {
  17663. const rawIRT = dict.getRaw("IRT");
  17664. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  17665. const rt = dict.get("RT");
  17666. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  17667. }
  17668. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  17669. const parent = dict.get("IRT");
  17670. this.setTitle(parent.get("T"));
  17671. this.data.titleObj = this._title;
  17672. this.setContents(parent.get("Contents"));
  17673. this.data.contentsObj = this._contents;
  17674. if (!parent.has("CreationDate")) {
  17675. this.data.creationDate = null;
  17676. } else {
  17677. this.setCreationDate(parent.get("CreationDate"));
  17678. this.data.creationDate = this.creationDate;
  17679. }
  17680. if (!parent.has("M")) {
  17681. this.data.modificationDate = null;
  17682. } else {
  17683. this.setModificationDate(parent.get("M"));
  17684. this.data.modificationDate = this.modificationDate;
  17685. }
  17686. this.data.hasPopup = parent.has("Popup");
  17687. if (!parent.has("C")) {
  17688. this.data.color = null;
  17689. } else {
  17690. this.setColor(parent.getArray("C"));
  17691. this.data.color = this.color;
  17692. }
  17693. } else {
  17694. this.data.titleObj = this._title;
  17695. this.setCreationDate(dict.get("CreationDate"));
  17696. this.data.creationDate = this.creationDate;
  17697. this.data.hasPopup = dict.has("Popup");
  17698. if (!dict.has("C")) {
  17699. this.data.color = null;
  17700. }
  17701. }
  17702. if (dict.has("RC")) {
  17703. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  17704. }
  17705. }
  17706. setCreationDate(creationDate) {
  17707. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  17708. }
  17709. _setDefaultAppearance({
  17710. xref,
  17711. extra,
  17712. strokeColor,
  17713. fillColor,
  17714. blendMode,
  17715. strokeAlpha,
  17716. fillAlpha,
  17717. pointsCallback
  17718. }) {
  17719. let minX = Number.MAX_VALUE;
  17720. let minY = Number.MAX_VALUE;
  17721. let maxX = Number.MIN_VALUE;
  17722. let maxY = Number.MIN_VALUE;
  17723. const buffer = ["q"];
  17724. if (extra) {
  17725. buffer.push(extra);
  17726. }
  17727. if (strokeColor) {
  17728. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  17729. }
  17730. if (fillColor) {
  17731. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  17732. }
  17733. let pointsArray = this.data.quadPoints;
  17734. if (!pointsArray) {
  17735. pointsArray = [[{
  17736. x: this.rectangle[0],
  17737. y: this.rectangle[3]
  17738. }, {
  17739. x: this.rectangle[2],
  17740. y: this.rectangle[3]
  17741. }, {
  17742. x: this.rectangle[0],
  17743. y: this.rectangle[1]
  17744. }, {
  17745. x: this.rectangle[2],
  17746. y: this.rectangle[1]
  17747. }]];
  17748. }
  17749. for (const points of pointsArray) {
  17750. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  17751. minX = Math.min(minX, mX);
  17752. maxX = Math.max(maxX, MX);
  17753. minY = Math.min(minY, mY);
  17754. maxY = Math.max(maxY, MY);
  17755. }
  17756. buffer.push("Q");
  17757. const formDict = new _primitives.Dict(xref);
  17758. const appearanceStreamDict = new _primitives.Dict(xref);
  17759. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  17760. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  17761. appearanceStream.dict = appearanceStreamDict;
  17762. formDict.set("Fm0", appearanceStream);
  17763. const gsDict = new _primitives.Dict(xref);
  17764. if (blendMode) {
  17765. gsDict.set("BM", _primitives.Name.get(blendMode));
  17766. }
  17767. if (typeof strokeAlpha === "number") {
  17768. gsDict.set("CA", strokeAlpha);
  17769. }
  17770. if (typeof fillAlpha === "number") {
  17771. gsDict.set("ca", fillAlpha);
  17772. }
  17773. const stateDict = new _primitives.Dict(xref);
  17774. stateDict.set("GS0", gsDict);
  17775. const resources = new _primitives.Dict(xref);
  17776. resources.set("ExtGState", stateDict);
  17777. resources.set("XObject", formDict);
  17778. const appearanceDict = new _primitives.Dict(xref);
  17779. appearanceDict.set("Resources", resources);
  17780. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  17781. appearanceDict.set("BBox", bbox);
  17782. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  17783. this.appearance.dict = appearanceDict;
  17784. this._streams.push(this.appearance, appearanceStream);
  17785. }
  17786. }
  17787. exports.MarkupAnnotation = MarkupAnnotation;
  17788. class WidgetAnnotation extends Annotation {
  17789. constructor(params) {
  17790. super(params);
  17791. const dict = params.dict;
  17792. const data = this.data;
  17793. this.ref = params.ref;
  17794. data.annotationType = _util.AnnotationType.WIDGET;
  17795. if (data.fieldName === undefined) {
  17796. data.fieldName = this._constructFieldName(dict);
  17797. }
  17798. if (data.actions === undefined) {
  17799. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17800. }
  17801. let fieldValue = (0, _core_utils.getInheritableProperty)({
  17802. dict,
  17803. key: "V",
  17804. getArray: true
  17805. });
  17806. data.fieldValue = this._decodeFormValue(fieldValue);
  17807. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  17808. dict,
  17809. key: "DV",
  17810. getArray: true
  17811. });
  17812. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  17813. if (fieldValue === undefined && params.xfaDatasets) {
  17814. const path = this._title.str;
  17815. if (path) {
  17816. this._hasValueFromXFA = true;
  17817. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  17818. }
  17819. }
  17820. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  17821. data.fieldValue = data.defaultFieldValue;
  17822. }
  17823. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  17824. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  17825. dict,
  17826. key: "DA"
  17827. }) || params.acroForm.get("DA");
  17828. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  17829. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  17830. const fieldType = (0, _core_utils.getInheritableProperty)({
  17831. dict,
  17832. key: "FT"
  17833. });
  17834. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17835. const localResources = (0, _core_utils.getInheritableProperty)({
  17836. dict,
  17837. key: "DR"
  17838. });
  17839. const acroFormResources = params.acroForm.get("DR");
  17840. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  17841. this._fieldResources = {
  17842. localResources,
  17843. acroFormResources,
  17844. appearanceResources,
  17845. mergedResources: _primitives.Dict.merge({
  17846. xref: params.xref,
  17847. dictArray: [localResources, appearanceResources, acroFormResources],
  17848. mergeSubDicts: true
  17849. })
  17850. };
  17851. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  17852. dict,
  17853. key: "Ff"
  17854. });
  17855. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  17856. data.fieldFlags = 0;
  17857. }
  17858. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  17859. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  17860. }
  17861. _decodeFormValue(formValue) {
  17862. if (Array.isArray(formValue)) {
  17863. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  17864. } else if (formValue instanceof _primitives.Name) {
  17865. return (0, _util.stringToPDFString)(formValue.name);
  17866. } else if (typeof formValue === "string") {
  17867. return (0, _util.stringToPDFString)(formValue);
  17868. }
  17869. return null;
  17870. }
  17871. hasFieldFlag(flag) {
  17872. return !!(this.data.fieldFlags & flag);
  17873. }
  17874. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17875. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  17876. return Promise.resolve(new _operator_list.OperatorList());
  17877. }
  17878. if (!this._hasText) {
  17879. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17880. }
  17881. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  17882. if (this.appearance && content === null) {
  17883. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17884. }
  17885. const operatorList = new _operator_list.OperatorList();
  17886. if (!this._defaultAppearance || content === null) {
  17887. return operatorList;
  17888. }
  17889. const matrix = [1, 0, 0, 1, 0, 0];
  17890. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17891. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  17892. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]);
  17893. const stream = new _stream.StringStream(content);
  17894. return evaluator.getOperatorList({
  17895. stream,
  17896. task,
  17897. resources: this._fieldResources.mergedResources,
  17898. operatorList
  17899. }).then(function () {
  17900. operatorList.addOp(_util.OPS.endAnnotation, []);
  17901. return operatorList;
  17902. });
  17903. });
  17904. }
  17905. async save(evaluator, task, annotationStorage) {
  17906. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  17907. let value = storageEntry && storageEntry.value;
  17908. if (value === this.data.fieldValue || value === undefined) {
  17909. if (!this._hasValueFromXFA) {
  17910. return null;
  17911. }
  17912. value = value || this.data.fieldValue;
  17913. }
  17914. if (!this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) {
  17915. return null;
  17916. }
  17917. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  17918. if (appearance === null) {
  17919. return null;
  17920. }
  17921. const {
  17922. xref
  17923. } = evaluator;
  17924. const dict = xref.fetchIfRef(this.ref);
  17925. if (!(dict instanceof _primitives.Dict)) {
  17926. return null;
  17927. }
  17928. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17929. const xfa = {
  17930. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17931. value
  17932. };
  17933. const newRef = xref.getNewRef();
  17934. const AP = new _primitives.Dict(xref);
  17935. AP.set("N", newRef);
  17936. const encrypt = xref.encrypt;
  17937. let originalTransform = null;
  17938. let newTransform = null;
  17939. if (encrypt) {
  17940. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17941. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  17942. appearance = newTransform.encryptString(appearance);
  17943. }
  17944. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  17945. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  17946. dict.set("AP", AP);
  17947. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17948. const appearanceDict = new _primitives.Dict(xref);
  17949. appearanceDict.set("Length", appearance.length);
  17950. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  17951. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  17952. appearanceDict.set("BBox", bbox);
  17953. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17954. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  17955. bufferOriginal.push("\nendobj\n");
  17956. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  17957. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  17958. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  17959. return [{
  17960. ref: this.ref,
  17961. data: bufferOriginal.join(""),
  17962. xfa
  17963. }, {
  17964. ref: newRef,
  17965. data: bufferNew.join(""),
  17966. xfa: null
  17967. }];
  17968. }
  17969. async _getAppearance(evaluator, task, annotationStorage) {
  17970. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  17971. if (isPassword) {
  17972. return null;
  17973. }
  17974. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  17975. let value = storageEntry && (storageEntry.formattedValue || storageEntry.value);
  17976. if (value === undefined) {
  17977. if (!this._hasValueFromXFA || this.appearance) {
  17978. return null;
  17979. }
  17980. value = this.data.fieldValue;
  17981. if (!value) {
  17982. return "";
  17983. }
  17984. }
  17985. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  17986. value = value.trim();
  17987. if (value === "") {
  17988. return "";
  17989. }
  17990. let lineCount = -1;
  17991. if (this.data.multiLine) {
  17992. lineCount = value.split(/\r\n|\r|\n/).length;
  17993. }
  17994. const defaultPadding = 2;
  17995. const hPadding = defaultPadding;
  17996. const totalHeight = this.data.rect[3] - this.data.rect[1];
  17997. const totalWidth = this.data.rect[2] - this.data.rect[0];
  17998. if (!this._defaultAppearance) {
  17999. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  18000. }
  18001. const font = await this._getFontData(evaluator, task);
  18002. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  18003. let descent = font.descent;
  18004. if (isNaN(descent)) {
  18005. descent = 0;
  18006. }
  18007. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  18008. const alignment = this.data.textAlignment;
  18009. if (this.data.multiLine) {
  18010. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  18011. }
  18012. const encodedString = font.encodeString(value).join("");
  18013. if (this.data.comb) {
  18014. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  18015. }
  18016. if (alignment === 0 || alignment > 2) {
  18017. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  18018. }
  18019. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  18020. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  18021. }
  18022. async _getFontData(evaluator, task) {
  18023. const operatorList = new _operator_list.OperatorList();
  18024. const initialState = {
  18025. font: null,
  18026. clone() {
  18027. return this;
  18028. }
  18029. };
  18030. const {
  18031. fontName,
  18032. fontSize
  18033. } = this.data.defaultAppearanceData;
  18034. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  18035. return initialState.font;
  18036. }
  18037. _getTextWidth(text, font) {
  18038. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  18039. }
  18040. _computeFontSize(height, width, text, font, lineCount) {
  18041. let {
  18042. fontSize
  18043. } = this.data.defaultAppearanceData;
  18044. if (!fontSize) {
  18045. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  18046. if (lineCount === -1) {
  18047. const textWidth = this._getTextWidth(text, font);
  18048. fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth));
  18049. } else {
  18050. const lines = text.split(/\r\n?|\n/);
  18051. const cachedLines = [];
  18052. for (const line of lines) {
  18053. const encoded = font.encodeString(line).join("");
  18054. const glyphs = font.charsToGlyphs(encoded);
  18055. const positions = font.getCharPositions(encoded);
  18056. cachedLines.push({
  18057. line: encoded,
  18058. glyphs,
  18059. positions
  18060. });
  18061. }
  18062. const isTooBig = fsize => {
  18063. let totalHeight = 0;
  18064. for (const cache of cachedLines) {
  18065. const chunks = this._splitLine(null, font, fsize, width, cache);
  18066. totalHeight += chunks.length * fsize;
  18067. if (totalHeight > height) {
  18068. return true;
  18069. }
  18070. }
  18071. return false;
  18072. };
  18073. fontSize = 12;
  18074. let lineHeight = fontSize * LINE_FACTOR;
  18075. let numberOfLines = Math.round(height / lineHeight);
  18076. numberOfLines = Math.max(numberOfLines, lineCount);
  18077. while (true) {
  18078. lineHeight = height / numberOfLines;
  18079. fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR);
  18080. if (isTooBig(fontSize)) {
  18081. numberOfLines++;
  18082. continue;
  18083. }
  18084. break;
  18085. }
  18086. }
  18087. const {
  18088. fontName,
  18089. fontColor
  18090. } = this.data.defaultAppearanceData;
  18091. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  18092. fontSize,
  18093. fontName,
  18094. fontColor
  18095. });
  18096. }
  18097. return [this._defaultAppearance, fontSize];
  18098. }
  18099. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  18100. let shift;
  18101. if (alignment === 1) {
  18102. const width = this._getTextWidth(text, font) * fontSize;
  18103. shift = (totalWidth - width) / 2;
  18104. } else if (alignment === 2) {
  18105. const width = this._getTextWidth(text, font) * fontSize;
  18106. shift = totalWidth - width - hPadding;
  18107. } else {
  18108. shift = hPadding;
  18109. }
  18110. shift = shift.toFixed(2);
  18111. vPadding = vPadding.toFixed(2);
  18112. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  18113. }
  18114. _getSaveFieldResources(xref) {
  18115. const {
  18116. localResources,
  18117. appearanceResources,
  18118. acroFormResources
  18119. } = this._fieldResources;
  18120. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  18121. if (!fontName) {
  18122. return localResources || _primitives.Dict.empty;
  18123. }
  18124. for (const resources of [localResources, appearanceResources]) {
  18125. if (resources instanceof _primitives.Dict) {
  18126. const localFont = resources.get("Font");
  18127. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  18128. return resources;
  18129. }
  18130. }
  18131. }
  18132. if (acroFormResources instanceof _primitives.Dict) {
  18133. const acroFormFont = acroFormResources.get("Font");
  18134. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  18135. const subFontDict = new _primitives.Dict(xref);
  18136. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  18137. const subResourcesDict = new _primitives.Dict(xref);
  18138. subResourcesDict.set("Font", subFontDict);
  18139. return _primitives.Dict.merge({
  18140. xref,
  18141. dictArray: [subResourcesDict, localResources],
  18142. mergeSubDicts: true
  18143. });
  18144. }
  18145. }
  18146. return localResources || _primitives.Dict.empty;
  18147. }
  18148. getFieldObject() {
  18149. return null;
  18150. }
  18151. }
  18152. class TextWidgetAnnotation extends WidgetAnnotation {
  18153. constructor(params) {
  18154. super(params);
  18155. this._hasText = true;
  18156. const dict = params.dict;
  18157. if (typeof this.data.fieldValue !== "string") {
  18158. this.data.fieldValue = "";
  18159. }
  18160. let alignment = (0, _core_utils.getInheritableProperty)({
  18161. dict,
  18162. key: "Q"
  18163. });
  18164. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  18165. alignment = null;
  18166. }
  18167. this.data.textAlignment = alignment;
  18168. let maximumLength = (0, _core_utils.getInheritableProperty)({
  18169. dict,
  18170. key: "MaxLen"
  18171. });
  18172. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  18173. maximumLength = null;
  18174. }
  18175. this.data.maxLen = maximumLength;
  18176. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  18177. 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;
  18178. }
  18179. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  18180. const combWidth = (width / this.data.maxLen).toFixed(2);
  18181. const buf = [];
  18182. const positions = font.getCharPositions(text);
  18183. for (const [start, end] of positions) {
  18184. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  18185. }
  18186. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  18187. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  18188. }
  18189. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  18190. const lines = text.split(/\r\n?|\n/);
  18191. const buf = [];
  18192. const totalWidth = width - 2 * hPadding;
  18193. for (const line of lines) {
  18194. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  18195. for (const chunk of chunks) {
  18196. const padding = buf.length === 0 ? hPadding : 0;
  18197. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  18198. }
  18199. }
  18200. const renderedText = buf.join("\n");
  18201. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  18202. }
  18203. _splitLine(line, font, fontSize, width, cache = {}) {
  18204. line = cache.line || font.encodeString(line).join("");
  18205. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  18206. if (glyphs.length <= 1) {
  18207. return [line];
  18208. }
  18209. const positions = cache.positions || font.getCharPositions(line);
  18210. const scale = fontSize / 1000;
  18211. const chunks = [];
  18212. let lastSpacePosInStringStart = -1,
  18213. lastSpacePosInStringEnd = -1,
  18214. lastSpacePos = -1,
  18215. startChunk = 0,
  18216. currentWidth = 0;
  18217. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  18218. const [start, end] = positions[i];
  18219. const glyph = glyphs[i];
  18220. const glyphWidth = glyph.width * scale;
  18221. if (glyph.unicode === " ") {
  18222. if (currentWidth + glyphWidth > width) {
  18223. chunks.push(line.substring(startChunk, start));
  18224. startChunk = start;
  18225. currentWidth = glyphWidth;
  18226. lastSpacePosInStringStart = -1;
  18227. lastSpacePos = -1;
  18228. } else {
  18229. currentWidth += glyphWidth;
  18230. lastSpacePosInStringStart = start;
  18231. lastSpacePosInStringEnd = end;
  18232. lastSpacePos = i;
  18233. }
  18234. } else {
  18235. if (currentWidth + glyphWidth > width) {
  18236. if (lastSpacePosInStringStart !== -1) {
  18237. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  18238. startChunk = lastSpacePosInStringEnd;
  18239. i = lastSpacePos + 1;
  18240. lastSpacePosInStringStart = -1;
  18241. currentWidth = 0;
  18242. } else {
  18243. chunks.push(line.substring(startChunk, start));
  18244. startChunk = start;
  18245. currentWidth = glyphWidth;
  18246. }
  18247. } else {
  18248. currentWidth += glyphWidth;
  18249. }
  18250. }
  18251. }
  18252. if (startChunk < line.length) {
  18253. chunks.push(line.substring(startChunk, line.length));
  18254. }
  18255. return chunks;
  18256. }
  18257. getFieldObject() {
  18258. return {
  18259. id: this.data.id,
  18260. value: this.data.fieldValue,
  18261. defaultValue: this.data.defaultFieldValue || "",
  18262. multiline: this.data.multiLine,
  18263. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  18264. charLimit: this.data.maxLen,
  18265. comb: this.data.comb,
  18266. editable: !this.data.readOnly,
  18267. hidden: this.data.hidden,
  18268. name: this.data.fieldName,
  18269. rect: this.data.rect,
  18270. actions: this.data.actions,
  18271. page: this.data.pageIndex,
  18272. strokeColor: this.data.borderColor,
  18273. fillColor: this.data.backgroundColor,
  18274. type: "text"
  18275. };
  18276. }
  18277. }
  18278. class ButtonWidgetAnnotation extends WidgetAnnotation {
  18279. constructor(params) {
  18280. super(params);
  18281. this.checkedAppearance = null;
  18282. this.uncheckedAppearance = null;
  18283. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18284. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18285. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18286. this.data.isTooltipOnly = false;
  18287. if (this.data.checkBox) {
  18288. this._processCheckBox(params);
  18289. } else if (this.data.radioButton) {
  18290. this._processRadioButton(params);
  18291. } else if (this.data.pushButton) {
  18292. this.data.hasOwnCanvas = true;
  18293. this._processPushButton(params);
  18294. } else {
  18295. (0, _util.warn)("Invalid field flags for button widget annotation");
  18296. }
  18297. }
  18298. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  18299. if (this.data.pushButton) {
  18300. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  18301. }
  18302. let value = null;
  18303. if (annotationStorage) {
  18304. const storageEntry = annotationStorage.get(this.data.id);
  18305. value = storageEntry ? storageEntry.value : null;
  18306. }
  18307. if (value === null) {
  18308. if (this.appearance) {
  18309. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18310. }
  18311. if (this.data.checkBox) {
  18312. value = this.data.fieldValue === this.data.exportValue;
  18313. } else {
  18314. value = this.data.fieldValue === this.data.buttonValue;
  18315. }
  18316. }
  18317. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  18318. if (appearance) {
  18319. const savedAppearance = this.appearance;
  18320. this.appearance = appearance;
  18321. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18322. this.appearance = savedAppearance;
  18323. return operatorList;
  18324. }
  18325. return new _operator_list.OperatorList();
  18326. }
  18327. async save(evaluator, task, annotationStorage) {
  18328. if (this.data.checkBox) {
  18329. return this._saveCheckbox(evaluator, task, annotationStorage);
  18330. }
  18331. if (this.data.radioButton) {
  18332. return this._saveRadioButton(evaluator, task, annotationStorage);
  18333. }
  18334. return null;
  18335. }
  18336. async _saveCheckbox(evaluator, task, annotationStorage) {
  18337. if (!annotationStorage) {
  18338. return null;
  18339. }
  18340. const storageEntry = annotationStorage.get(this.data.id);
  18341. const value = storageEntry && storageEntry.value;
  18342. if (value === undefined) {
  18343. return null;
  18344. }
  18345. const defaultValue = this.data.fieldValue === this.data.exportValue;
  18346. if (defaultValue === value) {
  18347. return null;
  18348. }
  18349. const dict = evaluator.xref.fetchIfRef(this.ref);
  18350. if (!(dict instanceof _primitives.Dict)) {
  18351. return null;
  18352. }
  18353. const xfa = {
  18354. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18355. value: value ? this.data.exportValue : ""
  18356. };
  18357. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  18358. dict.set("V", name);
  18359. dict.set("AS", name);
  18360. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18361. const encrypt = evaluator.xref.encrypt;
  18362. let originalTransform = null;
  18363. if (encrypt) {
  18364. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18365. }
  18366. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18367. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18368. buffer.push("\nendobj\n");
  18369. return [{
  18370. ref: this.ref,
  18371. data: buffer.join(""),
  18372. xfa
  18373. }];
  18374. }
  18375. async _saveRadioButton(evaluator, task, annotationStorage) {
  18376. if (!annotationStorage) {
  18377. return null;
  18378. }
  18379. const storageEntry = annotationStorage.get(this.data.id);
  18380. const value = storageEntry && storageEntry.value;
  18381. if (value === undefined) {
  18382. return null;
  18383. }
  18384. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  18385. if (defaultValue === value) {
  18386. return null;
  18387. }
  18388. const dict = evaluator.xref.fetchIfRef(this.ref);
  18389. if (!(dict instanceof _primitives.Dict)) {
  18390. return null;
  18391. }
  18392. const xfa = {
  18393. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18394. value: value ? this.data.buttonValue : ""
  18395. };
  18396. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  18397. let parentBuffer = null;
  18398. const encrypt = evaluator.xref.encrypt;
  18399. if (value) {
  18400. if (this.parent instanceof _primitives.Ref) {
  18401. const parent = evaluator.xref.fetch(this.parent);
  18402. let parentTransform = null;
  18403. if (encrypt) {
  18404. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  18405. }
  18406. parent.set("V", name);
  18407. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  18408. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  18409. parentBuffer.push("\nendobj\n");
  18410. } else if (this.parent instanceof _primitives.Dict) {
  18411. this.parent.set("V", name);
  18412. }
  18413. }
  18414. dict.set("AS", name);
  18415. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18416. let originalTransform = null;
  18417. if (encrypt) {
  18418. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18419. }
  18420. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18421. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18422. buffer.push("\nendobj\n");
  18423. const newRefs = [{
  18424. ref: this.ref,
  18425. data: buffer.join(""),
  18426. xfa
  18427. }];
  18428. if (parentBuffer !== null) {
  18429. newRefs.push({
  18430. ref: this.parent,
  18431. data: parentBuffer.join(""),
  18432. xfa: null
  18433. });
  18434. }
  18435. return newRefs;
  18436. }
  18437. _getDefaultCheckedAppearance(params, type) {
  18438. const width = this.data.rect[2] - this.data.rect[0];
  18439. const height = this.data.rect[3] - this.data.rect[1];
  18440. const bbox = [0, 0, width, height];
  18441. const FONT_RATIO = 0.8;
  18442. const fontSize = Math.min(width, height) * FONT_RATIO;
  18443. let metrics, char;
  18444. if (type === "check") {
  18445. metrics = {
  18446. width: 0.755 * fontSize,
  18447. height: 0.705 * fontSize
  18448. };
  18449. char = "\x33";
  18450. } else if (type === "disc") {
  18451. metrics = {
  18452. width: 0.791 * fontSize,
  18453. height: 0.705 * fontSize
  18454. };
  18455. char = "\x6C";
  18456. } else {
  18457. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  18458. }
  18459. const xShift = (width - metrics.width) / 2;
  18460. const yShift = (height - metrics.height) / 2;
  18461. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  18462. const appearanceStreamDict = new _primitives.Dict(params.xref);
  18463. appearanceStreamDict.set("FormType", 1);
  18464. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  18465. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  18466. appearanceStreamDict.set("BBox", bbox);
  18467. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  18468. appearanceStreamDict.set("Length", appearance.length);
  18469. const resources = new _primitives.Dict(params.xref);
  18470. const font = new _primitives.Dict(params.xref);
  18471. font.set("PdfJsZaDb", this.fallbackFontDict);
  18472. resources.set("Font", font);
  18473. appearanceStreamDict.set("Resources", resources);
  18474. this.checkedAppearance = new _stream.StringStream(appearance);
  18475. this.checkedAppearance.dict = appearanceStreamDict;
  18476. this._streams.push(this.checkedAppearance);
  18477. }
  18478. _processCheckBox(params) {
  18479. const customAppearance = params.dict.get("AP");
  18480. if (!(customAppearance instanceof _primitives.Dict)) {
  18481. return;
  18482. }
  18483. const normalAppearance = customAppearance.get("N");
  18484. if (!(normalAppearance instanceof _primitives.Dict)) {
  18485. return;
  18486. }
  18487. const asValue = this._decodeFormValue(params.dict.get("AS"));
  18488. if (typeof asValue === "string") {
  18489. this.data.fieldValue = asValue;
  18490. }
  18491. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  18492. const exportValues = normalAppearance.getKeys();
  18493. if (exportValues.length === 0) {
  18494. exportValues.push("Off", yes);
  18495. } else if (exportValues.length === 1) {
  18496. if (exportValues[0] === "Off") {
  18497. exportValues.push(yes);
  18498. } else {
  18499. exportValues.unshift("Off");
  18500. }
  18501. } else if (exportValues.includes(yes)) {
  18502. exportValues.length = 0;
  18503. exportValues.push("Off", yes);
  18504. } else {
  18505. const otherYes = exportValues.find(v => v !== "Off");
  18506. exportValues.length = 0;
  18507. exportValues.push("Off", otherYes);
  18508. }
  18509. if (!exportValues.includes(this.data.fieldValue)) {
  18510. this.data.fieldValue = "Off";
  18511. }
  18512. this.data.exportValue = exportValues[1];
  18513. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  18514. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18515. if (this.checkedAppearance) {
  18516. this._streams.push(this.checkedAppearance);
  18517. } else {
  18518. this._getDefaultCheckedAppearance(params, "check");
  18519. }
  18520. if (this.uncheckedAppearance) {
  18521. this._streams.push(this.uncheckedAppearance);
  18522. }
  18523. this._fallbackFontDict = this.fallbackFontDict;
  18524. }
  18525. _processRadioButton(params) {
  18526. this.data.fieldValue = this.data.buttonValue = null;
  18527. const fieldParent = params.dict.get("Parent");
  18528. if (fieldParent instanceof _primitives.Dict) {
  18529. this.parent = params.dict.getRaw("Parent");
  18530. const fieldParentValue = fieldParent.get("V");
  18531. if (fieldParentValue instanceof _primitives.Name) {
  18532. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  18533. }
  18534. }
  18535. const appearanceStates = params.dict.get("AP");
  18536. if (!(appearanceStates instanceof _primitives.Dict)) {
  18537. return;
  18538. }
  18539. const normalAppearance = appearanceStates.get("N");
  18540. if (!(normalAppearance instanceof _primitives.Dict)) {
  18541. return;
  18542. }
  18543. for (const key of normalAppearance.getKeys()) {
  18544. if (key !== "Off") {
  18545. this.data.buttonValue = this._decodeFormValue(key);
  18546. break;
  18547. }
  18548. }
  18549. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  18550. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18551. if (this.checkedAppearance) {
  18552. this._streams.push(this.checkedAppearance);
  18553. } else {
  18554. this._getDefaultCheckedAppearance(params, "disc");
  18555. }
  18556. if (this.uncheckedAppearance) {
  18557. this._streams.push(this.uncheckedAppearance);
  18558. }
  18559. this._fallbackFontDict = this.fallbackFontDict;
  18560. }
  18561. _processPushButton(params) {
  18562. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  18563. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  18564. return;
  18565. }
  18566. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  18567. _catalog.Catalog.parseDestDictionary({
  18568. destDict: params.dict,
  18569. resultObj: this.data,
  18570. docBaseUrl: params.pdfManager.docBaseUrl
  18571. });
  18572. }
  18573. getFieldObject() {
  18574. let type = "button";
  18575. let exportValues;
  18576. if (this.data.checkBox) {
  18577. type = "checkbox";
  18578. exportValues = this.data.exportValue;
  18579. } else if (this.data.radioButton) {
  18580. type = "radiobutton";
  18581. exportValues = this.data.buttonValue;
  18582. }
  18583. return {
  18584. id: this.data.id,
  18585. value: this.data.fieldValue || "Off",
  18586. defaultValue: this.data.defaultFieldValue,
  18587. exportValues,
  18588. editable: !this.data.readOnly,
  18589. name: this.data.fieldName,
  18590. rect: this.data.rect,
  18591. hidden: this.data.hidden,
  18592. actions: this.data.actions,
  18593. page: this.data.pageIndex,
  18594. strokeColor: this.data.borderColor,
  18595. fillColor: this.data.backgroundColor,
  18596. type
  18597. };
  18598. }
  18599. get fallbackFontDict() {
  18600. const dict = new _primitives.Dict();
  18601. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  18602. dict.set("Type", _primitives.Name.get("FallbackType"));
  18603. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18604. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  18605. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  18606. }
  18607. }
  18608. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  18609. constructor(params) {
  18610. super(params);
  18611. this.data.options = [];
  18612. const options = (0, _core_utils.getInheritableProperty)({
  18613. dict: params.dict,
  18614. key: "Opt"
  18615. });
  18616. if (Array.isArray(options)) {
  18617. const xref = params.xref;
  18618. for (let i = 0, ii = options.length; i < ii; i++) {
  18619. const option = xref.fetchIfRef(options[i]);
  18620. const isOptionArray = Array.isArray(option);
  18621. this.data.options[i] = {
  18622. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  18623. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  18624. };
  18625. }
  18626. }
  18627. if (typeof this.data.fieldValue === "string") {
  18628. this.data.fieldValue = [this.data.fieldValue];
  18629. } else if (!this.data.fieldValue) {
  18630. this.data.fieldValue = [];
  18631. }
  18632. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  18633. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  18634. this._hasText = true;
  18635. }
  18636. getFieldObject() {
  18637. const type = this.data.combo ? "combobox" : "listbox";
  18638. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  18639. return {
  18640. id: this.data.id,
  18641. value,
  18642. defaultValue: this.data.defaultFieldValue,
  18643. editable: !this.data.readOnly,
  18644. name: this.data.fieldName,
  18645. rect: this.data.rect,
  18646. numItems: this.data.fieldValue.length,
  18647. multipleSelection: this.data.multiSelect,
  18648. hidden: this.data.hidden,
  18649. actions: this.data.actions,
  18650. items: this.data.options,
  18651. page: this.data.pageIndex,
  18652. strokeColor: this.data.borderColor,
  18653. fillColor: this.data.backgroundColor,
  18654. type
  18655. };
  18656. }
  18657. async _getAppearance(evaluator, task, annotationStorage) {
  18658. if (this.data.combo) {
  18659. return super._getAppearance(evaluator, task, annotationStorage);
  18660. }
  18661. if (!annotationStorage) {
  18662. return null;
  18663. }
  18664. const storageEntry = annotationStorage.get(this.data.id);
  18665. let exportedValue = storageEntry && storageEntry.value;
  18666. if (exportedValue === undefined) {
  18667. return null;
  18668. }
  18669. if (!Array.isArray(exportedValue)) {
  18670. exportedValue = [exportedValue];
  18671. }
  18672. const defaultPadding = 2;
  18673. const hPadding = defaultPadding;
  18674. const totalHeight = this.data.rect[3] - this.data.rect[1];
  18675. const totalWidth = this.data.rect[2] - this.data.rect[0];
  18676. const lineCount = this.data.options.length;
  18677. const valueIndices = [];
  18678. for (let i = 0; i < lineCount; i++) {
  18679. const {
  18680. exportValue
  18681. } = this.data.options[i];
  18682. if (exportedValue.includes(exportValue)) {
  18683. valueIndices.push(i);
  18684. }
  18685. }
  18686. if (!this._defaultAppearance) {
  18687. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  18688. }
  18689. const font = await this._getFontData(evaluator, task);
  18690. let defaultAppearance;
  18691. let {
  18692. fontSize
  18693. } = this.data.defaultAppearanceData;
  18694. if (!fontSize) {
  18695. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  18696. let lineWidth = -1;
  18697. let value;
  18698. for (const {
  18699. displayValue
  18700. } of this.data.options) {
  18701. const width = this._getTextWidth(displayValue);
  18702. if (width > lineWidth) {
  18703. lineWidth = width;
  18704. value = displayValue;
  18705. }
  18706. }
  18707. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  18708. } else {
  18709. defaultAppearance = this._defaultAppearance;
  18710. }
  18711. const lineHeight = fontSize * LINE_FACTOR;
  18712. const vPadding = (lineHeight - fontSize) / 2;
  18713. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  18714. let firstIndex;
  18715. if (valueIndices.length === 1) {
  18716. const valuePosition = valueIndices[0];
  18717. const indexInPage = valuePosition % numberOfVisibleLines;
  18718. firstIndex = valuePosition - indexInPage;
  18719. } else {
  18720. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  18721. }
  18722. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  18723. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  18724. if (valueIndices.length) {
  18725. buf.push("0.600006 0.756866 0.854904 rg");
  18726. for (const index of valueIndices) {
  18727. if (firstIndex <= index && index < end) {
  18728. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  18729. }
  18730. }
  18731. }
  18732. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  18733. for (let i = firstIndex; i < end; i++) {
  18734. const {
  18735. displayValue
  18736. } = this.data.options[i];
  18737. const hpadding = i === firstIndex ? hPadding : 0;
  18738. const vpadding = i === firstIndex ? vPadding : 0;
  18739. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  18740. }
  18741. buf.push("ET Q EMC");
  18742. return buf.join("\n");
  18743. }
  18744. }
  18745. class SignatureWidgetAnnotation extends WidgetAnnotation {
  18746. constructor(params) {
  18747. super(params);
  18748. this.data.fieldValue = null;
  18749. }
  18750. getFieldObject() {
  18751. return {
  18752. id: this.data.id,
  18753. value: null,
  18754. page: this.data.pageIndex,
  18755. type: "signature"
  18756. };
  18757. }
  18758. }
  18759. class TextAnnotation extends MarkupAnnotation {
  18760. constructor(parameters) {
  18761. const DEFAULT_ICON_SIZE = 22;
  18762. super(parameters);
  18763. const dict = parameters.dict;
  18764. this.data.annotationType = _util.AnnotationType.TEXT;
  18765. if (this.data.hasAppearance) {
  18766. this.data.name = "NoIcon";
  18767. } else {
  18768. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  18769. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  18770. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  18771. }
  18772. if (dict.has("State")) {
  18773. this.data.state = dict.get("State") || null;
  18774. this.data.stateModel = dict.get("StateModel") || null;
  18775. } else {
  18776. this.data.state = null;
  18777. this.data.stateModel = null;
  18778. }
  18779. }
  18780. }
  18781. class LinkAnnotation extends Annotation {
  18782. constructor(params) {
  18783. super(params);
  18784. this.data.annotationType = _util.AnnotationType.LINK;
  18785. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  18786. if (quadPoints) {
  18787. this.data.quadPoints = quadPoints;
  18788. }
  18789. _catalog.Catalog.parseDestDictionary({
  18790. destDict: params.dict,
  18791. resultObj: this.data,
  18792. docBaseUrl: params.pdfManager.docBaseUrl
  18793. });
  18794. }
  18795. }
  18796. class PopupAnnotation extends Annotation {
  18797. constructor(parameters) {
  18798. super(parameters);
  18799. this.data.annotationType = _util.AnnotationType.POPUP;
  18800. let parentItem = parameters.dict.get("Parent");
  18801. if (!parentItem) {
  18802. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  18803. return;
  18804. }
  18805. const parentSubtype = parentItem.get("Subtype");
  18806. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  18807. const rawParent = parameters.dict.getRaw("Parent");
  18808. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  18809. const parentRect = parentItem.getArray("Rect");
  18810. if (Array.isArray(parentRect) && parentRect.length === 4) {
  18811. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  18812. } else {
  18813. this.data.parentRect = [0, 0, 0, 0];
  18814. }
  18815. const rt = parentItem.get("RT");
  18816. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  18817. parentItem = parentItem.get("IRT");
  18818. }
  18819. if (!parentItem.has("M")) {
  18820. this.data.modificationDate = null;
  18821. } else {
  18822. this.setModificationDate(parentItem.get("M"));
  18823. this.data.modificationDate = this.modificationDate;
  18824. }
  18825. if (!parentItem.has("C")) {
  18826. this.data.color = null;
  18827. } else {
  18828. this.setColor(parentItem.getArray("C"));
  18829. this.data.color = this.color;
  18830. }
  18831. if (!this.viewable) {
  18832. const parentFlags = parentItem.get("F");
  18833. if (this._isViewable(parentFlags)) {
  18834. this.setFlags(parentFlags);
  18835. }
  18836. }
  18837. this.setTitle(parentItem.get("T"));
  18838. this.data.titleObj = this._title;
  18839. this.setContents(parentItem.get("Contents"));
  18840. this.data.contentsObj = this._contents;
  18841. if (parentItem.has("RC")) {
  18842. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  18843. }
  18844. }
  18845. }
  18846. class FreeTextAnnotation extends MarkupAnnotation {
  18847. constructor(parameters) {
  18848. super(parameters);
  18849. this.data.annotationType = _util.AnnotationType.FREETEXT;
  18850. }
  18851. }
  18852. class LineAnnotation extends MarkupAnnotation {
  18853. constructor(parameters) {
  18854. super(parameters);
  18855. const {
  18856. dict
  18857. } = parameters;
  18858. this.data.annotationType = _util.AnnotationType.LINE;
  18859. const lineCoordinates = dict.getArray("L");
  18860. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  18861. this.setLineEndings(dict.getArray("LE"));
  18862. this.data.lineEndings = this.lineEndings;
  18863. if (!this.appearance) {
  18864. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18865. const strokeAlpha = dict.get("CA");
  18866. let fillColor = null,
  18867. interiorColor = dict.getArray("IC");
  18868. if (interiorColor) {
  18869. interiorColor = getRgbColor(interiorColor, null);
  18870. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18871. }
  18872. const fillAlpha = fillColor ? strokeAlpha : null;
  18873. const borderWidth = this.borderStyle.width || 1,
  18874. borderAdjust = 2 * borderWidth;
  18875. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  18876. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18877. this.rectangle = bbox;
  18878. }
  18879. this._setDefaultAppearance({
  18880. xref: parameters.xref,
  18881. extra: `${borderWidth} w`,
  18882. strokeColor,
  18883. fillColor,
  18884. strokeAlpha,
  18885. fillAlpha,
  18886. pointsCallback: (buffer, points) => {
  18887. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  18888. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  18889. }
  18890. });
  18891. }
  18892. }
  18893. }
  18894. class SquareAnnotation extends MarkupAnnotation {
  18895. constructor(parameters) {
  18896. super(parameters);
  18897. this.data.annotationType = _util.AnnotationType.SQUARE;
  18898. if (!this.appearance) {
  18899. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18900. const strokeAlpha = parameters.dict.get("CA");
  18901. let fillColor = null,
  18902. interiorColor = parameters.dict.getArray("IC");
  18903. if (interiorColor) {
  18904. interiorColor = getRgbColor(interiorColor, null);
  18905. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18906. }
  18907. const fillAlpha = fillColor ? strokeAlpha : null;
  18908. if (this.borderStyle.width === 0 && !fillColor) {
  18909. return;
  18910. }
  18911. this._setDefaultAppearance({
  18912. xref: parameters.xref,
  18913. extra: `${this.borderStyle.width} w`,
  18914. strokeColor,
  18915. fillColor,
  18916. strokeAlpha,
  18917. fillAlpha,
  18918. pointsCallback: (buffer, points) => {
  18919. const x = points[2].x + this.borderStyle.width / 2;
  18920. const y = points[2].y + this.borderStyle.width / 2;
  18921. const width = points[3].x - points[2].x - this.borderStyle.width;
  18922. const height = points[1].y - points[3].y - this.borderStyle.width;
  18923. buffer.push(`${x} ${y} ${width} ${height} re`);
  18924. if (fillColor) {
  18925. buffer.push("B");
  18926. } else {
  18927. buffer.push("S");
  18928. }
  18929. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18930. }
  18931. });
  18932. }
  18933. }
  18934. }
  18935. class CircleAnnotation extends MarkupAnnotation {
  18936. constructor(parameters) {
  18937. super(parameters);
  18938. this.data.annotationType = _util.AnnotationType.CIRCLE;
  18939. if (!this.appearance) {
  18940. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18941. const strokeAlpha = parameters.dict.get("CA");
  18942. let fillColor = null;
  18943. let interiorColor = parameters.dict.getArray("IC");
  18944. if (interiorColor) {
  18945. interiorColor = getRgbColor(interiorColor, null);
  18946. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18947. }
  18948. const fillAlpha = fillColor ? strokeAlpha : null;
  18949. if (this.borderStyle.width === 0 && !fillColor) {
  18950. return;
  18951. }
  18952. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  18953. this._setDefaultAppearance({
  18954. xref: parameters.xref,
  18955. extra: `${this.borderStyle.width} w`,
  18956. strokeColor,
  18957. fillColor,
  18958. strokeAlpha,
  18959. fillAlpha,
  18960. pointsCallback: (buffer, points) => {
  18961. const x0 = points[0].x + this.borderStyle.width / 2;
  18962. const y0 = points[0].y - this.borderStyle.width / 2;
  18963. const x1 = points[3].x - this.borderStyle.width / 2;
  18964. const y1 = points[3].y + this.borderStyle.width / 2;
  18965. const xMid = x0 + (x1 - x0) / 2;
  18966. const yMid = y0 + (y1 - y0) / 2;
  18967. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  18968. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  18969. 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");
  18970. if (fillColor) {
  18971. buffer.push("B");
  18972. } else {
  18973. buffer.push("S");
  18974. }
  18975. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18976. }
  18977. });
  18978. }
  18979. }
  18980. }
  18981. class PolylineAnnotation extends MarkupAnnotation {
  18982. constructor(parameters) {
  18983. super(parameters);
  18984. const {
  18985. dict
  18986. } = parameters;
  18987. this.data.annotationType = _util.AnnotationType.POLYLINE;
  18988. this.data.vertices = [];
  18989. if (!(this instanceof PolygonAnnotation)) {
  18990. this.setLineEndings(dict.getArray("LE"));
  18991. this.data.lineEndings = this.lineEndings;
  18992. }
  18993. const rawVertices = dict.getArray("Vertices");
  18994. if (!Array.isArray(rawVertices)) {
  18995. return;
  18996. }
  18997. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  18998. this.data.vertices.push({
  18999. x: rawVertices[i],
  19000. y: rawVertices[i + 1]
  19001. });
  19002. }
  19003. if (!this.appearance) {
  19004. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19005. const strokeAlpha = dict.get("CA");
  19006. const borderWidth = this.borderStyle.width || 1,
  19007. borderAdjust = 2 * borderWidth;
  19008. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  19009. for (const vertex of this.data.vertices) {
  19010. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  19011. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  19012. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  19013. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  19014. }
  19015. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19016. this.rectangle = bbox;
  19017. }
  19018. this._setDefaultAppearance({
  19019. xref: parameters.xref,
  19020. extra: `${borderWidth} w`,
  19021. strokeColor,
  19022. strokeAlpha,
  19023. pointsCallback: (buffer, points) => {
  19024. const vertices = this.data.vertices;
  19025. for (let i = 0, ii = vertices.length; i < ii; i++) {
  19026. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  19027. }
  19028. buffer.push("S");
  19029. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19030. }
  19031. });
  19032. }
  19033. }
  19034. }
  19035. class PolygonAnnotation extends PolylineAnnotation {
  19036. constructor(parameters) {
  19037. super(parameters);
  19038. this.data.annotationType = _util.AnnotationType.POLYGON;
  19039. }
  19040. }
  19041. class CaretAnnotation extends MarkupAnnotation {
  19042. constructor(parameters) {
  19043. super(parameters);
  19044. this.data.annotationType = _util.AnnotationType.CARET;
  19045. }
  19046. }
  19047. class InkAnnotation extends MarkupAnnotation {
  19048. constructor(parameters) {
  19049. super(parameters);
  19050. this.data.annotationType = _util.AnnotationType.INK;
  19051. this.data.inkLists = [];
  19052. const rawInkLists = parameters.dict.getArray("InkList");
  19053. if (!Array.isArray(rawInkLists)) {
  19054. return;
  19055. }
  19056. const xref = parameters.xref;
  19057. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  19058. this.data.inkLists.push([]);
  19059. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  19060. this.data.inkLists[i].push({
  19061. x: xref.fetchIfRef(rawInkLists[i][j]),
  19062. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  19063. });
  19064. }
  19065. }
  19066. if (!this.appearance) {
  19067. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19068. const strokeAlpha = parameters.dict.get("CA");
  19069. const borderWidth = this.borderStyle.width || 1,
  19070. borderAdjust = 2 * borderWidth;
  19071. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  19072. for (const inkLists of this.data.inkLists) {
  19073. for (const vertex of inkLists) {
  19074. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  19075. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  19076. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  19077. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  19078. }
  19079. }
  19080. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19081. this.rectangle = bbox;
  19082. }
  19083. this._setDefaultAppearance({
  19084. xref: parameters.xref,
  19085. extra: `${borderWidth} w`,
  19086. strokeColor,
  19087. strokeAlpha,
  19088. pointsCallback: (buffer, points) => {
  19089. for (const inkList of this.data.inkLists) {
  19090. for (let i = 0, ii = inkList.length; i < ii; i++) {
  19091. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  19092. }
  19093. buffer.push("S");
  19094. }
  19095. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19096. }
  19097. });
  19098. }
  19099. }
  19100. }
  19101. class HighlightAnnotation extends MarkupAnnotation {
  19102. constructor(parameters) {
  19103. super(parameters);
  19104. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  19105. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19106. if (quadPoints) {
  19107. const resources = this.appearance && this.appearance.dict.get("Resources");
  19108. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  19109. if (this.appearance) {
  19110. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  19111. }
  19112. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  19113. const fillAlpha = parameters.dict.get("CA");
  19114. this._setDefaultAppearance({
  19115. xref: parameters.xref,
  19116. fillColor,
  19117. blendMode: "Multiply",
  19118. fillAlpha,
  19119. pointsCallback: (buffer, points) => {
  19120. 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");
  19121. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19122. }
  19123. });
  19124. }
  19125. } else {
  19126. this.data.hasPopup = false;
  19127. }
  19128. }
  19129. }
  19130. class UnderlineAnnotation extends MarkupAnnotation {
  19131. constructor(parameters) {
  19132. super(parameters);
  19133. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  19134. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19135. if (quadPoints) {
  19136. if (!this.appearance) {
  19137. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19138. const strokeAlpha = parameters.dict.get("CA");
  19139. this._setDefaultAppearance({
  19140. xref: parameters.xref,
  19141. extra: "[] 0 d 1 w",
  19142. strokeColor,
  19143. strokeAlpha,
  19144. pointsCallback: (buffer, points) => {
  19145. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  19146. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19147. }
  19148. });
  19149. }
  19150. } else {
  19151. this.data.hasPopup = false;
  19152. }
  19153. }
  19154. }
  19155. class SquigglyAnnotation extends MarkupAnnotation {
  19156. constructor(parameters) {
  19157. super(parameters);
  19158. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  19159. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19160. if (quadPoints) {
  19161. if (!this.appearance) {
  19162. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19163. const strokeAlpha = parameters.dict.get("CA");
  19164. this._setDefaultAppearance({
  19165. xref: parameters.xref,
  19166. extra: "[] 0 d 1 w",
  19167. strokeColor,
  19168. strokeAlpha,
  19169. pointsCallback: (buffer, points) => {
  19170. const dy = (points[0].y - points[2].y) / 6;
  19171. let shift = dy;
  19172. let x = points[2].x;
  19173. const y = points[2].y;
  19174. const xEnd = points[3].x;
  19175. buffer.push(`${x} ${y + shift} m`);
  19176. do {
  19177. x += 2;
  19178. shift = shift === 0 ? dy : 0;
  19179. buffer.push(`${x} ${y + shift} l`);
  19180. } while (x < xEnd);
  19181. buffer.push("S");
  19182. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  19183. }
  19184. });
  19185. }
  19186. } else {
  19187. this.data.hasPopup = false;
  19188. }
  19189. }
  19190. }
  19191. class StrikeOutAnnotation extends MarkupAnnotation {
  19192. constructor(parameters) {
  19193. super(parameters);
  19194. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  19195. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19196. if (quadPoints) {
  19197. if (!this.appearance) {
  19198. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19199. const strokeAlpha = parameters.dict.get("CA");
  19200. this._setDefaultAppearance({
  19201. xref: parameters.xref,
  19202. extra: "[] 0 d 1 w",
  19203. strokeColor,
  19204. strokeAlpha,
  19205. pointsCallback: (buffer, points) => {
  19206. 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");
  19207. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19208. }
  19209. });
  19210. }
  19211. } else {
  19212. this.data.hasPopup = false;
  19213. }
  19214. }
  19215. }
  19216. class StampAnnotation extends MarkupAnnotation {
  19217. constructor(parameters) {
  19218. super(parameters);
  19219. this.data.annotationType = _util.AnnotationType.STAMP;
  19220. }
  19221. }
  19222. class FileAttachmentAnnotation extends MarkupAnnotation {
  19223. constructor(parameters) {
  19224. super(parameters);
  19225. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  19226. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  19227. this.data.file = file.serializable;
  19228. }
  19229. }
  19230. /***/ }),
  19231. /* 23 */
  19232. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19233. Object.defineProperty(exports, "__esModule", ({
  19234. value: true
  19235. }));
  19236. exports.createDefaultAppearance = createDefaultAppearance;
  19237. exports.parseDefaultAppearance = parseDefaultAppearance;
  19238. var _util = __w_pdfjs_require__(2);
  19239. var _colorspace = __w_pdfjs_require__(24);
  19240. var _core_utils = __w_pdfjs_require__(8);
  19241. var _evaluator = __w_pdfjs_require__(25);
  19242. var _primitives = __w_pdfjs_require__(5);
  19243. var _stream = __w_pdfjs_require__(10);
  19244. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  19245. constructor(str) {
  19246. super(new _stream.StringStream(str));
  19247. }
  19248. parse() {
  19249. const operation = {
  19250. fn: 0,
  19251. args: []
  19252. };
  19253. const result = {
  19254. fontSize: 0,
  19255. fontName: "",
  19256. fontColor: new Uint8ClampedArray(3)
  19257. };
  19258. try {
  19259. while (true) {
  19260. operation.args.length = 0;
  19261. if (!this.read(operation)) {
  19262. break;
  19263. }
  19264. if (this.savedStatesDepth !== 0) {
  19265. continue;
  19266. }
  19267. const {
  19268. fn,
  19269. args
  19270. } = operation;
  19271. switch (fn | 0) {
  19272. case _util.OPS.setFont:
  19273. const [fontName, fontSize] = args;
  19274. if (fontName instanceof _primitives.Name) {
  19275. result.fontName = fontName.name;
  19276. }
  19277. if (typeof fontSize === "number" && fontSize > 0) {
  19278. result.fontSize = fontSize;
  19279. }
  19280. break;
  19281. case _util.OPS.setFillRGBColor:
  19282. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  19283. break;
  19284. case _util.OPS.setFillGray:
  19285. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  19286. break;
  19287. case _util.OPS.setFillColorSpace:
  19288. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  19289. break;
  19290. }
  19291. }
  19292. } catch (reason) {
  19293. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  19294. }
  19295. return result;
  19296. }
  19297. }
  19298. function parseDefaultAppearance(str) {
  19299. return new DefaultAppearanceEvaluator(str).parse();
  19300. }
  19301. function createDefaultAppearance({
  19302. fontSize,
  19303. fontName,
  19304. fontColor
  19305. }) {
  19306. let colorCmd;
  19307. if (fontColor.every(c => c === 0)) {
  19308. colorCmd = "0 g";
  19309. } else {
  19310. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  19311. }
  19312. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  19313. }
  19314. /***/ }),
  19315. /* 24 */
  19316. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19317. Object.defineProperty(exports, "__esModule", ({
  19318. value: true
  19319. }));
  19320. exports.ColorSpace = void 0;
  19321. var _util = __w_pdfjs_require__(2);
  19322. var _primitives = __w_pdfjs_require__(5);
  19323. var _base_stream = __w_pdfjs_require__(9);
  19324. var _core_utils = __w_pdfjs_require__(8);
  19325. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  19326. const COMPONENTS = 3;
  19327. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  19328. const xRatio = w1 / w2;
  19329. const yRatio = h1 / h2;
  19330. let newIndex = 0,
  19331. oldIndex;
  19332. const xScaled = new Uint16Array(w2);
  19333. const w1Scanline = w1 * COMPONENTS;
  19334. for (let i = 0; i < w2; i++) {
  19335. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  19336. }
  19337. for (let i = 0; i < h2; i++) {
  19338. const py = Math.floor(i * yRatio) * w1Scanline;
  19339. for (let j = 0; j < w2; j++) {
  19340. oldIndex = py + xScaled[j];
  19341. dest[newIndex++] = src[oldIndex++];
  19342. dest[newIndex++] = src[oldIndex++];
  19343. dest[newIndex++] = src[oldIndex++];
  19344. newIndex += alpha01;
  19345. }
  19346. }
  19347. }
  19348. class ColorSpace {
  19349. constructor(name, numComps) {
  19350. if (this.constructor === ColorSpace) {
  19351. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  19352. }
  19353. this.name = name;
  19354. this.numComps = numComps;
  19355. }
  19356. getRgb(src, srcOffset) {
  19357. const rgb = new Uint8ClampedArray(3);
  19358. this.getRgbItem(src, srcOffset, rgb, 0);
  19359. return rgb;
  19360. }
  19361. getRgbItem(src, srcOffset, dest, destOffset) {
  19362. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  19363. }
  19364. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19365. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  19366. }
  19367. getOutputLength(inputLength, alpha01) {
  19368. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  19369. }
  19370. isPassthrough(bits) {
  19371. return false;
  19372. }
  19373. isDefaultDecode(decodeMap, bpc) {
  19374. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  19375. }
  19376. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  19377. const count = originalWidth * originalHeight;
  19378. let rgbBuf = null;
  19379. const numComponentColors = 1 << bpc;
  19380. const needsResizing = originalHeight !== height || originalWidth !== width;
  19381. if (this.isPassthrough(bpc)) {
  19382. rgbBuf = comps;
  19383. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  19384. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  19385. for (let i = 0; i < numComponentColors; i++) {
  19386. allColors[i] = i;
  19387. }
  19388. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  19389. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  19390. if (!needsResizing) {
  19391. let destPos = 0;
  19392. for (let i = 0; i < count; ++i) {
  19393. const key = comps[i] * 3;
  19394. dest[destPos++] = colorMap[key];
  19395. dest[destPos++] = colorMap[key + 1];
  19396. dest[destPos++] = colorMap[key + 2];
  19397. destPos += alpha01;
  19398. }
  19399. } else {
  19400. rgbBuf = new Uint8Array(count * 3);
  19401. let rgbPos = 0;
  19402. for (let i = 0; i < count; ++i) {
  19403. const key = comps[i] * 3;
  19404. rgbBuf[rgbPos++] = colorMap[key];
  19405. rgbBuf[rgbPos++] = colorMap[key + 1];
  19406. rgbBuf[rgbPos++] = colorMap[key + 2];
  19407. }
  19408. }
  19409. } else {
  19410. if (!needsResizing) {
  19411. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  19412. } else {
  19413. rgbBuf = new Uint8ClampedArray(count * 3);
  19414. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  19415. }
  19416. }
  19417. if (rgbBuf) {
  19418. if (needsResizing) {
  19419. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  19420. } else {
  19421. let destPos = 0,
  19422. rgbPos = 0;
  19423. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  19424. dest[destPos++] = rgbBuf[rgbPos++];
  19425. dest[destPos++] = rgbBuf[rgbPos++];
  19426. dest[destPos++] = rgbBuf[rgbPos++];
  19427. destPos += alpha01;
  19428. }
  19429. }
  19430. }
  19431. }
  19432. get usesZeroToOneRange() {
  19433. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  19434. }
  19435. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  19436. if (!localColorSpaceCache) {
  19437. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  19438. }
  19439. if (!parsedColorSpace) {
  19440. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  19441. }
  19442. let csName, csRef;
  19443. if (cacheKey instanceof _primitives.Ref) {
  19444. csRef = cacheKey;
  19445. cacheKey = xref.fetch(cacheKey);
  19446. }
  19447. if (cacheKey instanceof _primitives.Name) {
  19448. csName = cacheKey.name;
  19449. }
  19450. if (csName || csRef) {
  19451. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  19452. }
  19453. }
  19454. static getCached(cacheKey, xref, localColorSpaceCache) {
  19455. if (!localColorSpaceCache) {
  19456. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  19457. }
  19458. if (cacheKey instanceof _primitives.Ref) {
  19459. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  19460. if (localColorSpace) {
  19461. return localColorSpace;
  19462. }
  19463. try {
  19464. cacheKey = xref.fetch(cacheKey);
  19465. } catch (ex) {
  19466. if (ex instanceof _core_utils.MissingDataException) {
  19467. throw ex;
  19468. }
  19469. }
  19470. }
  19471. if (cacheKey instanceof _primitives.Name) {
  19472. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  19473. if (localColorSpace) {
  19474. return localColorSpace;
  19475. }
  19476. }
  19477. return null;
  19478. }
  19479. static async parseAsync({
  19480. cs,
  19481. xref,
  19482. resources = null,
  19483. pdfFunctionFactory,
  19484. localColorSpaceCache
  19485. }) {
  19486. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19487. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19488. return parsedColorSpace;
  19489. }
  19490. static parse({
  19491. cs,
  19492. xref,
  19493. resources = null,
  19494. pdfFunctionFactory,
  19495. localColorSpaceCache
  19496. }) {
  19497. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  19498. if (cachedColorSpace) {
  19499. return cachedColorSpace;
  19500. }
  19501. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19502. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19503. return parsedColorSpace;
  19504. }
  19505. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  19506. cs = xref.fetchIfRef(cs);
  19507. if (cs instanceof _primitives.Name) {
  19508. switch (cs.name) {
  19509. case "G":
  19510. case "DeviceGray":
  19511. return this.singletons.gray;
  19512. case "RGB":
  19513. case "DeviceRGB":
  19514. return this.singletons.rgb;
  19515. case "CMYK":
  19516. case "DeviceCMYK":
  19517. return this.singletons.cmyk;
  19518. case "Pattern":
  19519. return new PatternCS(null);
  19520. default:
  19521. if (resources instanceof _primitives.Dict) {
  19522. const colorSpaces = resources.get("ColorSpace");
  19523. if (colorSpaces instanceof _primitives.Dict) {
  19524. const resourcesCS = colorSpaces.get(cs.name);
  19525. if (resourcesCS) {
  19526. if (resourcesCS instanceof _primitives.Name) {
  19527. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  19528. }
  19529. cs = resourcesCS;
  19530. break;
  19531. }
  19532. }
  19533. }
  19534. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  19535. }
  19536. }
  19537. if (Array.isArray(cs)) {
  19538. const mode = xref.fetchIfRef(cs[0]).name;
  19539. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  19540. switch (mode) {
  19541. case "G":
  19542. case "DeviceGray":
  19543. return this.singletons.gray;
  19544. case "RGB":
  19545. case "DeviceRGB":
  19546. return this.singletons.rgb;
  19547. case "CMYK":
  19548. case "DeviceCMYK":
  19549. return this.singletons.cmyk;
  19550. case "CalGray":
  19551. params = xref.fetchIfRef(cs[1]);
  19552. whitePoint = params.getArray("WhitePoint");
  19553. blackPoint = params.getArray("BlackPoint");
  19554. gamma = params.get("Gamma");
  19555. return new CalGrayCS(whitePoint, blackPoint, gamma);
  19556. case "CalRGB":
  19557. params = xref.fetchIfRef(cs[1]);
  19558. whitePoint = params.getArray("WhitePoint");
  19559. blackPoint = params.getArray("BlackPoint");
  19560. gamma = params.getArray("Gamma");
  19561. const matrix = params.getArray("Matrix");
  19562. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  19563. case "ICCBased":
  19564. const stream = xref.fetchIfRef(cs[1]);
  19565. const dict = stream.dict;
  19566. numComps = dict.get("N");
  19567. const alt = dict.get("Alternate");
  19568. if (alt) {
  19569. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  19570. if (altCS.numComps === numComps) {
  19571. return altCS;
  19572. }
  19573. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  19574. }
  19575. if (numComps === 1) {
  19576. return this.singletons.gray;
  19577. } else if (numComps === 3) {
  19578. return this.singletons.rgb;
  19579. } else if (numComps === 4) {
  19580. return this.singletons.cmyk;
  19581. }
  19582. break;
  19583. case "Pattern":
  19584. baseCS = cs[1] || null;
  19585. if (baseCS) {
  19586. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  19587. }
  19588. return new PatternCS(baseCS);
  19589. case "I":
  19590. case "Indexed":
  19591. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  19592. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  19593. const lookup = xref.fetchIfRef(cs[3]);
  19594. return new IndexedCS(baseCS, hiVal, lookup);
  19595. case "Separation":
  19596. case "DeviceN":
  19597. const name = xref.fetchIfRef(cs[1]);
  19598. numComps = Array.isArray(name) ? name.length : 1;
  19599. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  19600. const tintFn = pdfFunctionFactory.create(cs[3]);
  19601. return new AlternateCS(numComps, baseCS, tintFn);
  19602. case "Lab":
  19603. params = xref.fetchIfRef(cs[1]);
  19604. whitePoint = params.getArray("WhitePoint");
  19605. blackPoint = params.getArray("BlackPoint");
  19606. const range = params.getArray("Range");
  19607. return new LabCS(whitePoint, blackPoint, range);
  19608. default:
  19609. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  19610. }
  19611. }
  19612. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  19613. }
  19614. static isDefaultDecode(decode, numComps) {
  19615. if (!Array.isArray(decode)) {
  19616. return true;
  19617. }
  19618. if (numComps * 2 !== decode.length) {
  19619. (0, _util.warn)("The decode map is not the correct length");
  19620. return true;
  19621. }
  19622. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  19623. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  19624. return false;
  19625. }
  19626. }
  19627. return true;
  19628. }
  19629. static get singletons() {
  19630. return (0, _util.shadow)(this, "singletons", {
  19631. get gray() {
  19632. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  19633. },
  19634. get rgb() {
  19635. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  19636. },
  19637. get cmyk() {
  19638. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  19639. }
  19640. });
  19641. }
  19642. }
  19643. exports.ColorSpace = ColorSpace;
  19644. class AlternateCS extends ColorSpace {
  19645. constructor(numComps, base, tintFn) {
  19646. super("Alternate", numComps);
  19647. this.base = base;
  19648. this.tintFn = tintFn;
  19649. this.tmpBuf = new Float32Array(base.numComps);
  19650. }
  19651. getRgbItem(src, srcOffset, dest, destOffset) {
  19652. const tmpBuf = this.tmpBuf;
  19653. this.tintFn(src, srcOffset, tmpBuf, 0);
  19654. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  19655. }
  19656. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19657. const tintFn = this.tintFn;
  19658. const base = this.base;
  19659. const scale = 1 / ((1 << bits) - 1);
  19660. const baseNumComps = base.numComps;
  19661. const usesZeroToOneRange = base.usesZeroToOneRange;
  19662. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  19663. let pos = isPassthrough ? destOffset : 0;
  19664. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  19665. const numComps = this.numComps;
  19666. const scaled = new Float32Array(numComps);
  19667. const tinted = new Float32Array(baseNumComps);
  19668. let i, j;
  19669. for (i = 0; i < count; i++) {
  19670. for (j = 0; j < numComps; j++) {
  19671. scaled[j] = src[srcOffset++] * scale;
  19672. }
  19673. tintFn(scaled, 0, tinted, 0);
  19674. if (usesZeroToOneRange) {
  19675. for (j = 0; j < baseNumComps; j++) {
  19676. baseBuf[pos++] = tinted[j] * 255;
  19677. }
  19678. } else {
  19679. base.getRgbItem(tinted, 0, baseBuf, pos);
  19680. pos += baseNumComps;
  19681. }
  19682. }
  19683. if (!isPassthrough) {
  19684. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  19685. }
  19686. }
  19687. getOutputLength(inputLength, alpha01) {
  19688. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  19689. }
  19690. }
  19691. class PatternCS extends ColorSpace {
  19692. constructor(baseCS) {
  19693. super("Pattern", null);
  19694. this.base = baseCS;
  19695. }
  19696. isDefaultDecode(decodeMap, bpc) {
  19697. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  19698. }
  19699. }
  19700. class IndexedCS extends ColorSpace {
  19701. constructor(base, highVal, lookup) {
  19702. super("Indexed", 1);
  19703. this.base = base;
  19704. this.highVal = highVal;
  19705. const length = base.numComps * highVal;
  19706. this.lookup = new Uint8Array(length);
  19707. if (lookup instanceof _base_stream.BaseStream) {
  19708. const bytes = lookup.getBytes(length);
  19709. this.lookup.set(bytes);
  19710. } else if (typeof lookup === "string") {
  19711. for (let i = 0; i < length; ++i) {
  19712. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  19713. }
  19714. } else {
  19715. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  19716. }
  19717. }
  19718. getRgbItem(src, srcOffset, dest, destOffset) {
  19719. const numComps = this.base.numComps;
  19720. const start = src[srcOffset] * numComps;
  19721. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  19722. }
  19723. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19724. const base = this.base;
  19725. const numComps = base.numComps;
  19726. const outputDelta = base.getOutputLength(numComps, alpha01);
  19727. const lookup = this.lookup;
  19728. for (let i = 0; i < count; ++i) {
  19729. const lookupPos = src[srcOffset++] * numComps;
  19730. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  19731. destOffset += outputDelta;
  19732. }
  19733. }
  19734. getOutputLength(inputLength, alpha01) {
  19735. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  19736. }
  19737. isDefaultDecode(decodeMap, bpc) {
  19738. if (!Array.isArray(decodeMap)) {
  19739. return true;
  19740. }
  19741. if (decodeMap.length !== 2) {
  19742. (0, _util.warn)("Decode map length is not correct");
  19743. return true;
  19744. }
  19745. if (!Number.isInteger(bpc) || bpc < 1) {
  19746. (0, _util.warn)("Bits per component is not correct");
  19747. return true;
  19748. }
  19749. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  19750. }
  19751. }
  19752. class DeviceGrayCS extends ColorSpace {
  19753. constructor() {
  19754. super("DeviceGray", 1);
  19755. }
  19756. getRgbItem(src, srcOffset, dest, destOffset) {
  19757. const c = src[srcOffset] * 255;
  19758. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  19759. }
  19760. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19761. const scale = 255 / ((1 << bits) - 1);
  19762. let j = srcOffset,
  19763. q = destOffset;
  19764. for (let i = 0; i < count; ++i) {
  19765. const c = scale * src[j++];
  19766. dest[q++] = c;
  19767. dest[q++] = c;
  19768. dest[q++] = c;
  19769. q += alpha01;
  19770. }
  19771. }
  19772. getOutputLength(inputLength, alpha01) {
  19773. return inputLength * (3 + alpha01);
  19774. }
  19775. }
  19776. class DeviceRgbCS extends ColorSpace {
  19777. constructor() {
  19778. super("DeviceRGB", 3);
  19779. }
  19780. getRgbItem(src, srcOffset, dest, destOffset) {
  19781. dest[destOffset] = src[srcOffset] * 255;
  19782. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  19783. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  19784. }
  19785. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19786. if (bits === 8 && alpha01 === 0) {
  19787. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  19788. return;
  19789. }
  19790. const scale = 255 / ((1 << bits) - 1);
  19791. let j = srcOffset,
  19792. q = destOffset;
  19793. for (let i = 0; i < count; ++i) {
  19794. dest[q++] = scale * src[j++];
  19795. dest[q++] = scale * src[j++];
  19796. dest[q++] = scale * src[j++];
  19797. q += alpha01;
  19798. }
  19799. }
  19800. getOutputLength(inputLength, alpha01) {
  19801. return inputLength * (3 + alpha01) / 3 | 0;
  19802. }
  19803. isPassthrough(bits) {
  19804. return bits === 8;
  19805. }
  19806. }
  19807. const DeviceCmykCS = function DeviceCmykCSClosure() {
  19808. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  19809. const c = src[srcOffset] * srcScale;
  19810. const m = src[srcOffset + 1] * srcScale;
  19811. const y = src[srcOffset + 2] * srcScale;
  19812. const k = src[srcOffset + 3] * srcScale;
  19813. 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);
  19814. 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);
  19815. 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);
  19816. }
  19817. class DeviceCmykCS extends ColorSpace {
  19818. constructor() {
  19819. super("DeviceCMYK", 4);
  19820. }
  19821. getRgbItem(src, srcOffset, dest, destOffset) {
  19822. convertToRgb(src, srcOffset, 1, dest, destOffset);
  19823. }
  19824. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19825. const scale = 1 / ((1 << bits) - 1);
  19826. for (let i = 0; i < count; i++) {
  19827. convertToRgb(src, srcOffset, scale, dest, destOffset);
  19828. srcOffset += 4;
  19829. destOffset += 3 + alpha01;
  19830. }
  19831. }
  19832. getOutputLength(inputLength, alpha01) {
  19833. return inputLength / 4 * (3 + alpha01) | 0;
  19834. }
  19835. }
  19836. return DeviceCmykCS;
  19837. }();
  19838. const CalGrayCS = function CalGrayCSClosure() {
  19839. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19840. const A = src[srcOffset] * scale;
  19841. const AG = A ** cs.G;
  19842. const L = cs.YW * AG;
  19843. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  19844. dest[destOffset] = val;
  19845. dest[destOffset + 1] = val;
  19846. dest[destOffset + 2] = val;
  19847. }
  19848. class CalGrayCS extends ColorSpace {
  19849. constructor(whitePoint, blackPoint, gamma) {
  19850. super("CalGray", 1);
  19851. if (!whitePoint) {
  19852. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  19853. }
  19854. blackPoint = blackPoint || [0, 0, 0];
  19855. gamma = gamma || 1;
  19856. this.XW = whitePoint[0];
  19857. this.YW = whitePoint[1];
  19858. this.ZW = whitePoint[2];
  19859. this.XB = blackPoint[0];
  19860. this.YB = blackPoint[1];
  19861. this.ZB = blackPoint[2];
  19862. this.G = gamma;
  19863. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19864. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19865. }
  19866. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19867. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  19868. this.XB = this.YB = this.ZB = 0;
  19869. }
  19870. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  19871. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  19872. }
  19873. if (this.G < 1) {
  19874. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  19875. this.G = 1;
  19876. }
  19877. }
  19878. getRgbItem(src, srcOffset, dest, destOffset) {
  19879. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19880. }
  19881. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19882. const scale = 1 / ((1 << bits) - 1);
  19883. for (let i = 0; i < count; ++i) {
  19884. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19885. srcOffset += 1;
  19886. destOffset += 3 + alpha01;
  19887. }
  19888. }
  19889. getOutputLength(inputLength, alpha01) {
  19890. return inputLength * (3 + alpha01);
  19891. }
  19892. }
  19893. return CalGrayCS;
  19894. }();
  19895. const CalRGBCS = function CalRGBCSClosure() {
  19896. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  19897. 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]);
  19898. 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]);
  19899. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  19900. const tempNormalizeMatrix = new Float32Array(3);
  19901. const tempConvertMatrix1 = new Float32Array(3);
  19902. const tempConvertMatrix2 = new Float32Array(3);
  19903. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  19904. function matrixProduct(a, b, result) {
  19905. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  19906. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  19907. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  19908. }
  19909. function convertToFlat(sourceWhitePoint, LMS, result) {
  19910. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  19911. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  19912. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  19913. }
  19914. function convertToD65(sourceWhitePoint, LMS, result) {
  19915. const D65X = 0.95047;
  19916. const D65Y = 1;
  19917. const D65Z = 1.08883;
  19918. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  19919. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  19920. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  19921. }
  19922. function sRGBTransferFunction(color) {
  19923. if (color <= 0.0031308) {
  19924. return adjustToRange(0, 1, 12.92 * color);
  19925. }
  19926. if (color >= 0.99554525) {
  19927. return 1;
  19928. }
  19929. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  19930. }
  19931. function adjustToRange(min, max, value) {
  19932. return Math.max(min, Math.min(max, value));
  19933. }
  19934. function decodeL(L) {
  19935. if (L < 0) {
  19936. return -decodeL(-L);
  19937. }
  19938. if (L > 8.0) {
  19939. return ((L + 16) / 116) ** 3;
  19940. }
  19941. return L * DECODE_L_CONSTANT;
  19942. }
  19943. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  19944. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  19945. result[0] = XYZ_Flat[0];
  19946. result[1] = XYZ_Flat[1];
  19947. result[2] = XYZ_Flat[2];
  19948. return;
  19949. }
  19950. const zeroDecodeL = decodeL(0);
  19951. const X_DST = zeroDecodeL;
  19952. const X_SRC = decodeL(sourceBlackPoint[0]);
  19953. const Y_DST = zeroDecodeL;
  19954. const Y_SRC = decodeL(sourceBlackPoint[1]);
  19955. const Z_DST = zeroDecodeL;
  19956. const Z_SRC = decodeL(sourceBlackPoint[2]);
  19957. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  19958. const X_Offset = 1 - X_Scale;
  19959. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  19960. const Y_Offset = 1 - Y_Scale;
  19961. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  19962. const Z_Offset = 1 - Z_Scale;
  19963. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  19964. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  19965. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  19966. }
  19967. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  19968. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  19969. result[0] = XYZ_In[0];
  19970. result[1] = XYZ_In[1];
  19971. result[2] = XYZ_In[2];
  19972. return;
  19973. }
  19974. const LMS = result;
  19975. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19976. const LMS_Flat = tempNormalizeMatrix;
  19977. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  19978. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  19979. }
  19980. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  19981. const LMS = result;
  19982. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19983. const LMS_D65 = tempNormalizeMatrix;
  19984. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  19985. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  19986. }
  19987. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19988. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  19989. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  19990. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  19991. const AGR = A === 1 ? 1 : A ** cs.GR;
  19992. const BGG = B === 1 ? 1 : B ** cs.GG;
  19993. const CGB = C === 1 ? 1 : C ** cs.GB;
  19994. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  19995. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  19996. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  19997. const XYZ = tempConvertMatrix1;
  19998. XYZ[0] = X;
  19999. XYZ[1] = Y;
  20000. XYZ[2] = Z;
  20001. const XYZ_Flat = tempConvertMatrix2;
  20002. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  20003. const XYZ_Black = tempConvertMatrix1;
  20004. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  20005. const XYZ_D65 = tempConvertMatrix2;
  20006. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  20007. const SRGB = tempConvertMatrix1;
  20008. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  20009. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  20010. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  20011. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  20012. }
  20013. class CalRGBCS extends ColorSpace {
  20014. constructor(whitePoint, blackPoint, gamma, matrix) {
  20015. super("CalRGB", 3);
  20016. if (!whitePoint) {
  20017. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  20018. }
  20019. blackPoint = blackPoint || new Float32Array(3);
  20020. gamma = gamma || new Float32Array([1, 1, 1]);
  20021. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  20022. const XW = whitePoint[0];
  20023. const YW = whitePoint[1];
  20024. const ZW = whitePoint[2];
  20025. this.whitePoint = whitePoint;
  20026. const XB = blackPoint[0];
  20027. const YB = blackPoint[1];
  20028. const ZB = blackPoint[2];
  20029. this.blackPoint = blackPoint;
  20030. this.GR = gamma[0];
  20031. this.GG = gamma[1];
  20032. this.GB = gamma[2];
  20033. this.MXA = matrix[0];
  20034. this.MYA = matrix[1];
  20035. this.MZA = matrix[2];
  20036. this.MXB = matrix[3];
  20037. this.MYB = matrix[4];
  20038. this.MZB = matrix[5];
  20039. this.MXC = matrix[6];
  20040. this.MYC = matrix[7];
  20041. this.MZC = matrix[8];
  20042. if (XW < 0 || ZW < 0 || YW !== 1) {
  20043. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  20044. }
  20045. if (XB < 0 || YB < 0 || ZB < 0) {
  20046. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  20047. this.blackPoint = new Float32Array(3);
  20048. }
  20049. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  20050. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  20051. this.GR = this.GG = this.GB = 1;
  20052. }
  20053. }
  20054. getRgbItem(src, srcOffset, dest, destOffset) {
  20055. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  20056. }
  20057. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20058. const scale = 1 / ((1 << bits) - 1);
  20059. for (let i = 0; i < count; ++i) {
  20060. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  20061. srcOffset += 3;
  20062. destOffset += 3 + alpha01;
  20063. }
  20064. }
  20065. getOutputLength(inputLength, alpha01) {
  20066. return inputLength * (3 + alpha01) / 3 | 0;
  20067. }
  20068. }
  20069. return CalRGBCS;
  20070. }();
  20071. const LabCS = function LabCSClosure() {
  20072. function fn_g(x) {
  20073. let result;
  20074. if (x >= 6 / 29) {
  20075. result = x ** 3;
  20076. } else {
  20077. result = 108 / 841 * (x - 4 / 29);
  20078. }
  20079. return result;
  20080. }
  20081. function decode(value, high1, low2, high2) {
  20082. return low2 + value * (high2 - low2) / high1;
  20083. }
  20084. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  20085. let Ls = src[srcOffset];
  20086. let as = src[srcOffset + 1];
  20087. let bs = src[srcOffset + 2];
  20088. if (maxVal !== false) {
  20089. Ls = decode(Ls, maxVal, 0, 100);
  20090. as = decode(as, maxVal, cs.amin, cs.amax);
  20091. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  20092. }
  20093. if (as > cs.amax) {
  20094. as = cs.amax;
  20095. } else if (as < cs.amin) {
  20096. as = cs.amin;
  20097. }
  20098. if (bs > cs.bmax) {
  20099. bs = cs.bmax;
  20100. } else if (bs < cs.bmin) {
  20101. bs = cs.bmin;
  20102. }
  20103. const M = (Ls + 16) / 116;
  20104. const L = M + as / 500;
  20105. const N = M - bs / 200;
  20106. const X = cs.XW * fn_g(L);
  20107. const Y = cs.YW * fn_g(M);
  20108. const Z = cs.ZW * fn_g(N);
  20109. let r, g, b;
  20110. if (cs.ZW < 1) {
  20111. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  20112. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  20113. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  20114. } else {
  20115. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  20116. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  20117. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  20118. }
  20119. dest[destOffset] = Math.sqrt(r) * 255;
  20120. dest[destOffset + 1] = Math.sqrt(g) * 255;
  20121. dest[destOffset + 2] = Math.sqrt(b) * 255;
  20122. }
  20123. class LabCS extends ColorSpace {
  20124. constructor(whitePoint, blackPoint, range) {
  20125. super("Lab", 3);
  20126. if (!whitePoint) {
  20127. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  20128. }
  20129. blackPoint = blackPoint || [0, 0, 0];
  20130. range = range || [-100, 100, -100, 100];
  20131. this.XW = whitePoint[0];
  20132. this.YW = whitePoint[1];
  20133. this.ZW = whitePoint[2];
  20134. this.amin = range[0];
  20135. this.amax = range[1];
  20136. this.bmin = range[2];
  20137. this.bmax = range[3];
  20138. this.XB = blackPoint[0];
  20139. this.YB = blackPoint[1];
  20140. this.ZB = blackPoint[2];
  20141. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  20142. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  20143. }
  20144. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  20145. (0, _util.info)("Invalid BlackPoint, falling back to default");
  20146. this.XB = this.YB = this.ZB = 0;
  20147. }
  20148. if (this.amin > this.amax || this.bmin > this.bmax) {
  20149. (0, _util.info)("Invalid Range, falling back to defaults");
  20150. this.amin = -100;
  20151. this.amax = 100;
  20152. this.bmin = -100;
  20153. this.bmax = 100;
  20154. }
  20155. }
  20156. getRgbItem(src, srcOffset, dest, destOffset) {
  20157. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  20158. }
  20159. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20160. const maxVal = (1 << bits) - 1;
  20161. for (let i = 0; i < count; i++) {
  20162. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  20163. srcOffset += 3;
  20164. destOffset += 3 + alpha01;
  20165. }
  20166. }
  20167. getOutputLength(inputLength, alpha01) {
  20168. return inputLength * (3 + alpha01) / 3 | 0;
  20169. }
  20170. isDefaultDecode(decodeMap, bpc) {
  20171. return true;
  20172. }
  20173. get usesZeroToOneRange() {
  20174. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  20175. }
  20176. }
  20177. return LabCS;
  20178. }();
  20179. /***/ }),
  20180. /* 25 */
  20181. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20182. Object.defineProperty(exports, "__esModule", ({
  20183. value: true
  20184. }));
  20185. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  20186. var _util = __w_pdfjs_require__(2);
  20187. var _cmap = __w_pdfjs_require__(26);
  20188. var _primitives = __w_pdfjs_require__(5);
  20189. var _fonts = __w_pdfjs_require__(44);
  20190. var _fonts_utils = __w_pdfjs_require__(18);
  20191. var _encodings = __w_pdfjs_require__(19);
  20192. var _standard_fonts = __w_pdfjs_require__(47);
  20193. var _unicode = __w_pdfjs_require__(21);
  20194. var _pattern = __w_pdfjs_require__(56);
  20195. var _xfa_fonts = __w_pdfjs_require__(12);
  20196. var _to_unicode_map = __w_pdfjs_require__(48);
  20197. var _function = __w_pdfjs_require__(57);
  20198. var _parser = __w_pdfjs_require__(27);
  20199. var _image_utils = __w_pdfjs_require__(59);
  20200. var _stream = __w_pdfjs_require__(10);
  20201. var _base_stream = __w_pdfjs_require__(9);
  20202. var _bidi = __w_pdfjs_require__(60);
  20203. var _colorspace = __w_pdfjs_require__(24);
  20204. var _decode_stream = __w_pdfjs_require__(29);
  20205. var _glyphlist = __w_pdfjs_require__(20);
  20206. var _core_utils = __w_pdfjs_require__(8);
  20207. var _metrics = __w_pdfjs_require__(51);
  20208. var _murmurhash = __w_pdfjs_require__(61);
  20209. var _operator_list = __w_pdfjs_require__(62);
  20210. var _image = __w_pdfjs_require__(63);
  20211. const DefaultPartialEvaluatorOptions = Object.freeze({
  20212. maxImageSize: -1,
  20213. disableFontFace: false,
  20214. ignoreErrors: false,
  20215. isEvalSupported: true,
  20216. fontExtraProperties: false,
  20217. useSystemFonts: true,
  20218. cMapUrl: null,
  20219. standardFontDataUrl: null
  20220. });
  20221. const PatternType = {
  20222. TILING: 1,
  20223. SHADING: 2
  20224. };
  20225. const TEXT_CHUNK_BATCH_SIZE = 10;
  20226. const deferred = Promise.resolve();
  20227. function normalizeBlendMode(value, parsingArray = false) {
  20228. if (Array.isArray(value)) {
  20229. for (let i = 0, ii = value.length; i < ii; i++) {
  20230. const maybeBM = normalizeBlendMode(value[i], true);
  20231. if (maybeBM) {
  20232. return maybeBM;
  20233. }
  20234. }
  20235. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  20236. return "source-over";
  20237. }
  20238. if (!(value instanceof _primitives.Name)) {
  20239. if (parsingArray) {
  20240. return null;
  20241. }
  20242. return "source-over";
  20243. }
  20244. switch (value.name) {
  20245. case "Normal":
  20246. case "Compatible":
  20247. return "source-over";
  20248. case "Multiply":
  20249. return "multiply";
  20250. case "Screen":
  20251. return "screen";
  20252. case "Overlay":
  20253. return "overlay";
  20254. case "Darken":
  20255. return "darken";
  20256. case "Lighten":
  20257. return "lighten";
  20258. case "ColorDodge":
  20259. return "color-dodge";
  20260. case "ColorBurn":
  20261. return "color-burn";
  20262. case "HardLight":
  20263. return "hard-light";
  20264. case "SoftLight":
  20265. return "soft-light";
  20266. case "Difference":
  20267. return "difference";
  20268. case "Exclusion":
  20269. return "exclusion";
  20270. case "Hue":
  20271. return "hue";
  20272. case "Saturation":
  20273. return "saturation";
  20274. case "Color":
  20275. return "color";
  20276. case "Luminosity":
  20277. return "luminosity";
  20278. }
  20279. if (parsingArray) {
  20280. return null;
  20281. }
  20282. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  20283. return "source-over";
  20284. }
  20285. function incrementCachedImageMaskCount(data) {
  20286. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  20287. data.args[0].count++;
  20288. }
  20289. }
  20290. class TimeSlotManager {
  20291. static get TIME_SLOT_DURATION_MS() {
  20292. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  20293. }
  20294. static get CHECK_TIME_EVERY() {
  20295. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  20296. }
  20297. constructor() {
  20298. this.reset();
  20299. }
  20300. check() {
  20301. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  20302. return false;
  20303. }
  20304. this.checked = 0;
  20305. return this.endTime <= Date.now();
  20306. }
  20307. reset() {
  20308. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  20309. this.checked = 0;
  20310. }
  20311. }
  20312. class PartialEvaluator {
  20313. constructor({
  20314. xref,
  20315. handler,
  20316. pageIndex,
  20317. idFactory,
  20318. fontCache,
  20319. builtInCMapCache,
  20320. standardFontDataCache,
  20321. globalImageCache,
  20322. options = null
  20323. }) {
  20324. this.xref = xref;
  20325. this.handler = handler;
  20326. this.pageIndex = pageIndex;
  20327. this.idFactory = idFactory;
  20328. this.fontCache = fontCache;
  20329. this.builtInCMapCache = builtInCMapCache;
  20330. this.standardFontDataCache = standardFontDataCache;
  20331. this.globalImageCache = globalImageCache;
  20332. this.options = options || DefaultPartialEvaluatorOptions;
  20333. this.parsingType3Font = false;
  20334. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  20335. }
  20336. get _pdfFunctionFactory() {
  20337. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  20338. xref: this.xref,
  20339. isEvalSupported: this.options.isEvalSupported
  20340. });
  20341. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  20342. }
  20343. clone(newOptions = null) {
  20344. const newEvaluator = Object.create(this);
  20345. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  20346. return newEvaluator;
  20347. }
  20348. hasBlendModes(resources, nonBlendModesSet) {
  20349. if (!(resources instanceof _primitives.Dict)) {
  20350. return false;
  20351. }
  20352. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  20353. return false;
  20354. }
  20355. const processed = new _primitives.RefSet(nonBlendModesSet);
  20356. if (resources.objId) {
  20357. processed.put(resources.objId);
  20358. }
  20359. const nodes = [resources],
  20360. xref = this.xref;
  20361. while (nodes.length) {
  20362. const node = nodes.shift();
  20363. const graphicStates = node.get("ExtGState");
  20364. if (graphicStates instanceof _primitives.Dict) {
  20365. for (let graphicState of graphicStates.getRawValues()) {
  20366. if (graphicState instanceof _primitives.Ref) {
  20367. if (processed.has(graphicState)) {
  20368. continue;
  20369. }
  20370. try {
  20371. graphicState = xref.fetch(graphicState);
  20372. } catch (ex) {
  20373. processed.put(graphicState);
  20374. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  20375. continue;
  20376. }
  20377. }
  20378. if (!(graphicState instanceof _primitives.Dict)) {
  20379. continue;
  20380. }
  20381. if (graphicState.objId) {
  20382. processed.put(graphicState.objId);
  20383. }
  20384. const bm = graphicState.get("BM");
  20385. if (bm instanceof _primitives.Name) {
  20386. if (bm.name !== "Normal") {
  20387. return true;
  20388. }
  20389. continue;
  20390. }
  20391. if (bm !== undefined && Array.isArray(bm)) {
  20392. for (const element of bm) {
  20393. if (element instanceof _primitives.Name && element.name !== "Normal") {
  20394. return true;
  20395. }
  20396. }
  20397. }
  20398. }
  20399. }
  20400. const xObjects = node.get("XObject");
  20401. if (!(xObjects instanceof _primitives.Dict)) {
  20402. continue;
  20403. }
  20404. for (let xObject of xObjects.getRawValues()) {
  20405. if (xObject instanceof _primitives.Ref) {
  20406. if (processed.has(xObject)) {
  20407. continue;
  20408. }
  20409. try {
  20410. xObject = xref.fetch(xObject);
  20411. } catch (ex) {
  20412. processed.put(xObject);
  20413. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  20414. continue;
  20415. }
  20416. }
  20417. if (!(xObject instanceof _base_stream.BaseStream)) {
  20418. continue;
  20419. }
  20420. if (xObject.dict.objId) {
  20421. processed.put(xObject.dict.objId);
  20422. }
  20423. const xResources = xObject.dict.get("Resources");
  20424. if (!(xResources instanceof _primitives.Dict)) {
  20425. continue;
  20426. }
  20427. if (xResources.objId && processed.has(xResources.objId)) {
  20428. continue;
  20429. }
  20430. nodes.push(xResources);
  20431. if (xResources.objId) {
  20432. processed.put(xResources.objId);
  20433. }
  20434. }
  20435. }
  20436. for (const ref of processed) {
  20437. nonBlendModesSet.put(ref);
  20438. }
  20439. return false;
  20440. }
  20441. async fetchBuiltInCMap(name) {
  20442. const cachedData = this.builtInCMapCache.get(name);
  20443. if (cachedData) {
  20444. return cachedData;
  20445. }
  20446. let data;
  20447. if (this.options.cMapUrl !== null) {
  20448. const url = `${this.options.cMapUrl}${name}.bcmap`;
  20449. const response = await fetch(url);
  20450. if (!response.ok) {
  20451. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  20452. }
  20453. data = {
  20454. cMapData: new Uint8Array(await response.arrayBuffer()),
  20455. compressionType: _util.CMapCompressionType.BINARY
  20456. };
  20457. } else {
  20458. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  20459. name
  20460. });
  20461. }
  20462. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  20463. this.builtInCMapCache.set(name, data);
  20464. }
  20465. return data;
  20466. }
  20467. async fetchStandardFontData(name) {
  20468. const cachedData = this.standardFontDataCache.get(name);
  20469. if (cachedData) {
  20470. return new _stream.Stream(cachedData);
  20471. }
  20472. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  20473. return null;
  20474. }
  20475. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  20476. filename = standardFontNameToFileName[name];
  20477. let data;
  20478. if (this.options.standardFontDataUrl !== null) {
  20479. const url = `${this.options.standardFontDataUrl}${filename}`;
  20480. const response = await fetch(url);
  20481. if (!response.ok) {
  20482. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  20483. } else {
  20484. data = await response.arrayBuffer();
  20485. }
  20486. } else {
  20487. try {
  20488. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  20489. filename
  20490. });
  20491. } catch (e) {
  20492. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  20493. }
  20494. }
  20495. if (!data) {
  20496. return null;
  20497. }
  20498. this.standardFontDataCache.set(name, data);
  20499. return new _stream.Stream(data);
  20500. }
  20501. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  20502. const dict = xobj.dict;
  20503. const matrix = dict.getArray("Matrix");
  20504. let bbox = dict.getArray("BBox");
  20505. if (Array.isArray(bbox) && bbox.length === 4) {
  20506. bbox = _util.Util.normalizeRect(bbox);
  20507. } else {
  20508. bbox = null;
  20509. }
  20510. let optionalContent, groupOptions;
  20511. if (dict.has("OC")) {
  20512. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20513. }
  20514. if (optionalContent !== undefined) {
  20515. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20516. }
  20517. const group = dict.get("Group");
  20518. if (group) {
  20519. groupOptions = {
  20520. matrix,
  20521. bbox,
  20522. smask,
  20523. isolated: false,
  20524. knockout: false
  20525. };
  20526. const groupSubtype = group.get("S");
  20527. let colorSpace = null;
  20528. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  20529. groupOptions.isolated = group.get("I") || false;
  20530. groupOptions.knockout = group.get("K") || false;
  20531. if (group.has("CS")) {
  20532. const cs = group.getRaw("CS");
  20533. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  20534. if (cachedColorSpace) {
  20535. colorSpace = cachedColorSpace;
  20536. } else {
  20537. colorSpace = await this.parseColorSpace({
  20538. cs,
  20539. resources,
  20540. localColorSpaceCache
  20541. });
  20542. }
  20543. }
  20544. }
  20545. if (smask && smask.backdrop) {
  20546. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  20547. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  20548. }
  20549. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  20550. }
  20551. const args = group ? [matrix, null] : [matrix, bbox];
  20552. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  20553. return this.getOperatorList({
  20554. stream: xobj,
  20555. task,
  20556. resources: dict.get("Resources") || resources,
  20557. operatorList,
  20558. initialState
  20559. }).then(function () {
  20560. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  20561. if (group) {
  20562. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  20563. }
  20564. if (optionalContent !== undefined) {
  20565. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20566. }
  20567. });
  20568. }
  20569. _sendImgData(objId, imgData, cacheGlobally = false) {
  20570. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  20571. if (this.parsingType3Font || cacheGlobally) {
  20572. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  20573. }
  20574. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  20575. }
  20576. async buildPaintImageXObject({
  20577. resources,
  20578. image,
  20579. isInline = false,
  20580. operatorList,
  20581. cacheKey,
  20582. localImageCache,
  20583. localColorSpaceCache
  20584. }) {
  20585. const dict = image.dict;
  20586. const imageRef = dict.objId;
  20587. const w = dict.get("W", "Width");
  20588. const h = dict.get("H", "Height");
  20589. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  20590. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  20591. return;
  20592. }
  20593. const maxImageSize = this.options.maxImageSize;
  20594. if (maxImageSize !== -1 && w * h > maxImageSize) {
  20595. const msg = "Image exceeded maximum allowed size and was removed.";
  20596. if (this.options.ignoreErrors) {
  20597. (0, _util.warn)(msg);
  20598. return;
  20599. }
  20600. throw new Error(msg);
  20601. }
  20602. let optionalContent;
  20603. if (dict.has("OC")) {
  20604. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20605. }
  20606. const imageMask = dict.get("IM", "ImageMask") || false;
  20607. let imgData, args;
  20608. if (imageMask) {
  20609. const interpolate = dict.get("I", "Interpolate");
  20610. const bitStrideLength = w + 7 >> 3;
  20611. const imgArray = image.getBytes(bitStrideLength * h);
  20612. const decode = dict.getArray("D", "Decode");
  20613. if (this.parsingType3Font) {
  20614. imgData = _image.PDFImage.createRawMask({
  20615. imgArray,
  20616. width: w,
  20617. height: h,
  20618. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20619. inverseDecode: !!decode && decode[0] > 0,
  20620. interpolate
  20621. });
  20622. imgData.cached = !!cacheKey;
  20623. args = [imgData];
  20624. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  20625. if (cacheKey) {
  20626. localImageCache.set(cacheKey, imageRef, {
  20627. fn: _util.OPS.paintImageMaskXObject,
  20628. args,
  20629. optionalContent
  20630. });
  20631. }
  20632. return;
  20633. }
  20634. imgData = _image.PDFImage.createMask({
  20635. imgArray,
  20636. width: w,
  20637. height: h,
  20638. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20639. inverseDecode: !!decode && decode[0] > 0,
  20640. interpolate
  20641. });
  20642. if (imgData.isSingleOpaquePixel) {
  20643. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  20644. if (cacheKey) {
  20645. localImageCache.set(cacheKey, imageRef, {
  20646. fn: _util.OPS.paintSolidColorImageMask,
  20647. args: [],
  20648. optionalContent
  20649. });
  20650. }
  20651. return;
  20652. }
  20653. const objId = `mask_${this.idFactory.createObjId()}`;
  20654. operatorList.addDependency(objId);
  20655. this._sendImgData(objId, imgData);
  20656. args = [{
  20657. data: objId,
  20658. width: imgData.width,
  20659. height: imgData.height,
  20660. interpolate: imgData.interpolate,
  20661. count: 1
  20662. }];
  20663. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  20664. if (cacheKey) {
  20665. localImageCache.set(cacheKey, imageRef, {
  20666. fn: _util.OPS.paintImageMaskXObject,
  20667. args,
  20668. optionalContent
  20669. });
  20670. }
  20671. return;
  20672. }
  20673. const softMask = dict.get("SM", "SMask") || false;
  20674. const mask = dict.get("Mask") || false;
  20675. const SMALL_IMAGE_DIMENSIONS = 200;
  20676. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  20677. const imageObj = new _image.PDFImage({
  20678. xref: this.xref,
  20679. res: resources,
  20680. image,
  20681. isInline,
  20682. pdfFunctionFactory: this._pdfFunctionFactory,
  20683. localColorSpaceCache
  20684. });
  20685. imgData = imageObj.createImageData(true);
  20686. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  20687. return;
  20688. }
  20689. let objId = `img_${this.idFactory.createObjId()}`,
  20690. cacheGlobally = false;
  20691. if (this.parsingType3Font) {
  20692. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  20693. } else if (imageRef) {
  20694. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  20695. if (cacheGlobally) {
  20696. objId = `${this.idFactory.getDocId()}_${objId}`;
  20697. }
  20698. }
  20699. operatorList.addDependency(objId);
  20700. args = [objId, w, h];
  20701. _image.PDFImage.buildImage({
  20702. xref: this.xref,
  20703. res: resources,
  20704. image,
  20705. isInline,
  20706. pdfFunctionFactory: this._pdfFunctionFactory,
  20707. localColorSpaceCache
  20708. }).then(imageObj => {
  20709. imgData = imageObj.createImageData(false);
  20710. if (cacheKey && imageRef && cacheGlobally) {
  20711. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  20712. }
  20713. return this._sendImgData(objId, imgData, cacheGlobally);
  20714. }).catch(reason => {
  20715. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  20716. return this._sendImgData(objId, null, cacheGlobally);
  20717. });
  20718. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  20719. if (cacheKey) {
  20720. localImageCache.set(cacheKey, imageRef, {
  20721. fn: _util.OPS.paintImageXObject,
  20722. args,
  20723. optionalContent
  20724. });
  20725. if (imageRef) {
  20726. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  20727. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  20728. if (cacheGlobally) {
  20729. this.globalImageCache.setData(imageRef, {
  20730. objId,
  20731. fn: _util.OPS.paintImageXObject,
  20732. args,
  20733. optionalContent,
  20734. byteSize: 0
  20735. });
  20736. }
  20737. }
  20738. }
  20739. }
  20740. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  20741. const smaskContent = smask.get("G");
  20742. const smaskOptions = {
  20743. subtype: smask.get("S").name,
  20744. backdrop: smask.get("BC")
  20745. };
  20746. const transferObj = smask.get("TR");
  20747. if ((0, _function.isPDFFunction)(transferObj)) {
  20748. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20749. const transferMap = new Uint8Array(256);
  20750. const tmp = new Float32Array(1);
  20751. for (let i = 0; i < 256; i++) {
  20752. tmp[0] = i / 255;
  20753. transferFn(tmp, 0, tmp, 0);
  20754. transferMap[i] = tmp[0] * 255 | 0;
  20755. }
  20756. smaskOptions.transferMap = transferMap;
  20757. }
  20758. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  20759. }
  20760. handleTransferFunction(tr) {
  20761. let transferArray;
  20762. if (Array.isArray(tr)) {
  20763. transferArray = tr;
  20764. } else if ((0, _function.isPDFFunction)(tr)) {
  20765. transferArray = [tr];
  20766. } else {
  20767. return null;
  20768. }
  20769. const transferMaps = [];
  20770. let numFns = 0,
  20771. numEffectfulFns = 0;
  20772. for (const entry of transferArray) {
  20773. const transferObj = this.xref.fetchIfRef(entry);
  20774. numFns++;
  20775. if ((0, _primitives.isName)(transferObj, "Identity")) {
  20776. transferMaps.push(null);
  20777. continue;
  20778. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  20779. return null;
  20780. }
  20781. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20782. const transferMap = new Uint8Array(256),
  20783. tmp = new Float32Array(1);
  20784. for (let j = 0; j < 256; j++) {
  20785. tmp[0] = j / 255;
  20786. transferFn(tmp, 0, tmp, 0);
  20787. transferMap[j] = tmp[0] * 255 | 0;
  20788. }
  20789. transferMaps.push(transferMap);
  20790. numEffectfulFns++;
  20791. }
  20792. if (!(numFns === 1 || numFns === 4)) {
  20793. return null;
  20794. }
  20795. if (numEffectfulFns === 0) {
  20796. return null;
  20797. }
  20798. return transferMaps;
  20799. }
  20800. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  20801. const tilingOpList = new _operator_list.OperatorList();
  20802. const patternResources = _primitives.Dict.merge({
  20803. xref: this.xref,
  20804. dictArray: [patternDict.get("Resources"), resources]
  20805. });
  20806. return this.getOperatorList({
  20807. stream: pattern,
  20808. task,
  20809. resources: patternResources,
  20810. operatorList: tilingOpList
  20811. }).then(function () {
  20812. const operatorListIR = tilingOpList.getIR();
  20813. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  20814. operatorList.addDependencies(tilingOpList.dependencies);
  20815. operatorList.addOp(fn, tilingPatternIR);
  20816. if (patternDict.objId) {
  20817. localTilingPatternCache.set(null, patternDict.objId, {
  20818. operatorListIR,
  20819. dict: patternDict
  20820. });
  20821. }
  20822. }).catch(reason => {
  20823. if (reason instanceof _util.AbortException) {
  20824. return;
  20825. }
  20826. if (this.options.ignoreErrors) {
  20827. this.handler.send("UnsupportedFeature", {
  20828. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  20829. });
  20830. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  20831. return;
  20832. }
  20833. throw reason;
  20834. });
  20835. }
  20836. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  20837. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  20838. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  20839. if (!translated.font.isType3Font) {
  20840. return translated;
  20841. }
  20842. return translated.loadType3Data(this, resources, task).then(function () {
  20843. operatorList.addDependencies(translated.type3Dependencies);
  20844. return translated;
  20845. }).catch(reason => {
  20846. this.handler.send("UnsupportedFeature", {
  20847. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  20848. });
  20849. return new TranslatedFont({
  20850. loadedName: "g_font_error",
  20851. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  20852. dict: translated.font,
  20853. evaluatorOptions: this.options
  20854. });
  20855. });
  20856. }).then(translated => {
  20857. state.font = translated.font;
  20858. translated.send(this.handler);
  20859. return translated.loadedName;
  20860. });
  20861. }
  20862. handleText(chars, state) {
  20863. const font = state.font;
  20864. const glyphs = font.charsToGlyphs(chars);
  20865. if (font.data) {
  20866. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  20867. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  20868. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  20869. }
  20870. }
  20871. return glyphs;
  20872. }
  20873. ensureStateFont(state) {
  20874. if (state.font) {
  20875. return;
  20876. }
  20877. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  20878. if (this.options.ignoreErrors) {
  20879. this.handler.send("UnsupportedFeature", {
  20880. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  20881. });
  20882. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  20883. return;
  20884. }
  20885. throw reason;
  20886. }
  20887. async setGState({
  20888. resources,
  20889. gState,
  20890. operatorList,
  20891. cacheKey,
  20892. task,
  20893. stateManager,
  20894. localGStateCache,
  20895. localColorSpaceCache
  20896. }) {
  20897. const gStateRef = gState.objId;
  20898. let isSimpleGState = true;
  20899. const gStateObj = [];
  20900. const gStateKeys = gState.getKeys();
  20901. let promise = Promise.resolve();
  20902. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  20903. const key = gStateKeys[i];
  20904. const value = gState.get(key);
  20905. switch (key) {
  20906. case "Type":
  20907. break;
  20908. case "LW":
  20909. case "LC":
  20910. case "LJ":
  20911. case "ML":
  20912. case "D":
  20913. case "RI":
  20914. case "FL":
  20915. case "CA":
  20916. case "ca":
  20917. gStateObj.push([key, value]);
  20918. break;
  20919. case "Font":
  20920. isSimpleGState = false;
  20921. promise = promise.then(() => {
  20922. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  20923. operatorList.addDependency(loadedName);
  20924. gStateObj.push([key, [loadedName, value[1]]]);
  20925. });
  20926. });
  20927. break;
  20928. case "BM":
  20929. gStateObj.push([key, normalizeBlendMode(value)]);
  20930. break;
  20931. case "SMask":
  20932. if ((0, _primitives.isName)(value, "None")) {
  20933. gStateObj.push([key, false]);
  20934. break;
  20935. }
  20936. if (value instanceof _primitives.Dict) {
  20937. isSimpleGState = false;
  20938. promise = promise.then(() => {
  20939. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  20940. });
  20941. gStateObj.push([key, true]);
  20942. } else {
  20943. (0, _util.warn)("Unsupported SMask type");
  20944. }
  20945. break;
  20946. case "TR":
  20947. const transferMaps = this.handleTransferFunction(value);
  20948. gStateObj.push([key, transferMaps]);
  20949. break;
  20950. case "OP":
  20951. case "op":
  20952. case "OPM":
  20953. case "BG":
  20954. case "BG2":
  20955. case "UCR":
  20956. case "UCR2":
  20957. case "TR2":
  20958. case "HT":
  20959. case "SM":
  20960. case "SA":
  20961. case "AIS":
  20962. case "TK":
  20963. (0, _util.info)("graphic state operator " + key);
  20964. break;
  20965. default:
  20966. (0, _util.info)("Unknown graphic state operator " + key);
  20967. break;
  20968. }
  20969. }
  20970. return promise.then(function () {
  20971. if (gStateObj.length > 0) {
  20972. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  20973. }
  20974. if (isSimpleGState) {
  20975. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  20976. }
  20977. });
  20978. }
  20979. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  20980. const errorFont = async () => {
  20981. return new TranslatedFont({
  20982. loadedName: "g_font_error",
  20983. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  20984. dict: font,
  20985. evaluatorOptions: this.options
  20986. });
  20987. };
  20988. const xref = this.xref;
  20989. let fontRef;
  20990. if (font) {
  20991. if (!(font instanceof _primitives.Ref)) {
  20992. throw new _util.FormatError('The "font" object should be a reference.');
  20993. }
  20994. fontRef = font;
  20995. } else {
  20996. const fontRes = resources.get("Font");
  20997. if (fontRes) {
  20998. fontRef = fontRes.getRaw(fontName);
  20999. }
  21000. }
  21001. if (!fontRef) {
  21002. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  21003. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  21004. (0, _util.warn)(`${partialMsg}.`);
  21005. return errorFont();
  21006. }
  21007. this.handler.send("UnsupportedFeature", {
  21008. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  21009. });
  21010. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  21011. if (fallbackFontDict) {
  21012. fontRef = fallbackFontDict;
  21013. } else {
  21014. fontRef = PartialEvaluator.fallbackFontDict;
  21015. }
  21016. }
  21017. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  21018. return errorFont();
  21019. }
  21020. if (this.fontCache.has(fontRef)) {
  21021. return this.fontCache.get(fontRef);
  21022. }
  21023. font = xref.fetchIfRef(fontRef);
  21024. if (!(font instanceof _primitives.Dict)) {
  21025. return errorFont();
  21026. }
  21027. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  21028. return this.fontCache.get(font.cacheKey);
  21029. }
  21030. const fontCapability = (0, _util.createPromiseCapability)();
  21031. let preEvaluatedFont;
  21032. try {
  21033. preEvaluatedFont = this.preEvaluateFont(font);
  21034. preEvaluatedFont.cssFontInfo = cssFontInfo;
  21035. } catch (reason) {
  21036. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  21037. return errorFont();
  21038. }
  21039. const {
  21040. descriptor,
  21041. hash
  21042. } = preEvaluatedFont;
  21043. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  21044. let fontID;
  21045. if (fontRefIsRef) {
  21046. fontID = `f${fontRef.toString()}`;
  21047. }
  21048. if (hash && descriptor instanceof _primitives.Dict) {
  21049. if (!descriptor.fontAliases) {
  21050. descriptor.fontAliases = Object.create(null);
  21051. }
  21052. const fontAliases = descriptor.fontAliases;
  21053. if (fontAliases[hash]) {
  21054. const aliasFontRef = fontAliases[hash].aliasRef;
  21055. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  21056. this.fontCache.putAlias(fontRef, aliasFontRef);
  21057. return this.fontCache.get(fontRef);
  21058. }
  21059. } else {
  21060. fontAliases[hash] = {
  21061. fontID: this.idFactory.createFontId()
  21062. };
  21063. }
  21064. if (fontRefIsRef) {
  21065. fontAliases[hash].aliasRef = fontRef;
  21066. }
  21067. fontID = fontAliases[hash].fontID;
  21068. }
  21069. if (fontRefIsRef) {
  21070. this.fontCache.put(fontRef, fontCapability.promise);
  21071. } else {
  21072. if (!fontID) {
  21073. fontID = this.idFactory.createFontId();
  21074. }
  21075. font.cacheKey = `cacheKey_${fontID}`;
  21076. this.fontCache.put(font.cacheKey, fontCapability.promise);
  21077. }
  21078. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  21079. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  21080. this.translateFont(preEvaluatedFont).then(translatedFont => {
  21081. if (translatedFont.fontType !== undefined) {
  21082. xref.stats.addFontType(translatedFont.fontType);
  21083. }
  21084. fontCapability.resolve(new TranslatedFont({
  21085. loadedName: font.loadedName,
  21086. font: translatedFont,
  21087. dict: font,
  21088. evaluatorOptions: this.options
  21089. }));
  21090. }).catch(reason => {
  21091. this.handler.send("UnsupportedFeature", {
  21092. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  21093. });
  21094. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  21095. try {
  21096. const fontFile3 = descriptor && descriptor.get("FontFile3");
  21097. const subtype = fontFile3 && fontFile3.get("Subtype");
  21098. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  21099. if (fontType !== undefined) {
  21100. xref.stats.addFontType(fontType);
  21101. }
  21102. } catch (ex) {}
  21103. fontCapability.resolve(new TranslatedFont({
  21104. loadedName: font.loadedName,
  21105. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  21106. dict: font,
  21107. evaluatorOptions: this.options
  21108. }));
  21109. });
  21110. return fontCapability.promise;
  21111. }
  21112. buildPath(operatorList, fn, args, parsingText = false) {
  21113. const lastIndex = operatorList.length - 1;
  21114. if (!args) {
  21115. args = [];
  21116. }
  21117. let minMax;
  21118. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  21119. if (parsingText) {
  21120. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  21121. operatorList.addOp(_util.OPS.save, null);
  21122. }
  21123. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  21124. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  21125. if (parsingText) {
  21126. operatorList.addOp(_util.OPS.restore, null);
  21127. }
  21128. } else {
  21129. const opArgs = operatorList.argsArray[lastIndex];
  21130. opArgs[0].push(fn);
  21131. Array.prototype.push.apply(opArgs[1], args);
  21132. minMax = opArgs[2];
  21133. }
  21134. switch (fn) {
  21135. case _util.OPS.rectangle:
  21136. minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]);
  21137. minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]);
  21138. minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]);
  21139. minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]);
  21140. break;
  21141. case _util.OPS.moveTo:
  21142. case _util.OPS.lineTo:
  21143. minMax[0] = Math.min(minMax[0], args[0]);
  21144. minMax[1] = Math.max(minMax[1], args[0]);
  21145. minMax[2] = Math.min(minMax[2], args[1]);
  21146. minMax[3] = Math.max(minMax[3], args[1]);
  21147. break;
  21148. }
  21149. }
  21150. parseColorSpace({
  21151. cs,
  21152. resources,
  21153. localColorSpaceCache
  21154. }) {
  21155. return _colorspace.ColorSpace.parseAsync({
  21156. cs,
  21157. xref: this.xref,
  21158. resources,
  21159. pdfFunctionFactory: this._pdfFunctionFactory,
  21160. localColorSpaceCache
  21161. }).catch(reason => {
  21162. if (reason instanceof _util.AbortException) {
  21163. return null;
  21164. }
  21165. if (this.options.ignoreErrors) {
  21166. this.handler.send("UnsupportedFeature", {
  21167. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  21168. });
  21169. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  21170. return null;
  21171. }
  21172. throw reason;
  21173. });
  21174. }
  21175. parseShading({
  21176. shading,
  21177. resources,
  21178. localColorSpaceCache,
  21179. localShadingPatternCache
  21180. }) {
  21181. let id = localShadingPatternCache.get(shading);
  21182. if (!id) {
  21183. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  21184. const patternIR = shadingFill.getIR();
  21185. id = `pattern_${this.idFactory.createObjId()}`;
  21186. localShadingPatternCache.set(shading, id);
  21187. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  21188. }
  21189. return id;
  21190. }
  21191. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  21192. const patternName = args.pop();
  21193. if (patternName instanceof _primitives.Name) {
  21194. const rawPattern = patterns.getRaw(patternName.name);
  21195. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  21196. if (localTilingPattern) {
  21197. try {
  21198. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  21199. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  21200. operatorList.addOp(fn, tilingPatternIR);
  21201. return undefined;
  21202. } catch (ex) {}
  21203. }
  21204. const pattern = this.xref.fetchIfRef(rawPattern);
  21205. if (pattern) {
  21206. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  21207. const typeNum = dict.get("PatternType");
  21208. if (typeNum === PatternType.TILING) {
  21209. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  21210. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  21211. } else if (typeNum === PatternType.SHADING) {
  21212. const shading = dict.get("Shading");
  21213. const matrix = dict.getArray("Matrix");
  21214. const objId = this.parseShading({
  21215. shading,
  21216. resources,
  21217. localColorSpaceCache,
  21218. localShadingPatternCache
  21219. });
  21220. operatorList.addOp(fn, ["Shading", objId, matrix]);
  21221. return undefined;
  21222. }
  21223. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  21224. }
  21225. }
  21226. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  21227. }
  21228. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  21229. const MAX_NESTING = 10;
  21230. if (++nestingCounter > MAX_NESTING) {
  21231. (0, _util.warn)("Visibility expression is too deeply nested");
  21232. return;
  21233. }
  21234. const length = array.length;
  21235. const operator = this.xref.fetchIfRef(array[0]);
  21236. if (length < 2 || !(operator instanceof _primitives.Name)) {
  21237. (0, _util.warn)("Invalid visibility expression");
  21238. return;
  21239. }
  21240. switch (operator.name) {
  21241. case "And":
  21242. case "Or":
  21243. case "Not":
  21244. currentResult.push(operator.name);
  21245. break;
  21246. default:
  21247. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  21248. return;
  21249. }
  21250. for (let i = 1; i < length; i++) {
  21251. const raw = array[i];
  21252. const object = this.xref.fetchIfRef(raw);
  21253. if (Array.isArray(object)) {
  21254. const nestedResult = [];
  21255. currentResult.push(nestedResult);
  21256. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  21257. } else if (raw instanceof _primitives.Ref) {
  21258. currentResult.push(raw.toString());
  21259. }
  21260. }
  21261. }
  21262. async parseMarkedContentProps(contentProperties, resources) {
  21263. let optionalContent;
  21264. if (contentProperties instanceof _primitives.Name) {
  21265. const properties = resources.get("Properties");
  21266. optionalContent = properties.get(contentProperties.name);
  21267. } else if (contentProperties instanceof _primitives.Dict) {
  21268. optionalContent = contentProperties;
  21269. } else {
  21270. throw new _util.FormatError("Optional content properties malformed.");
  21271. }
  21272. const optionalContentType = optionalContent.get("Type").name;
  21273. if (optionalContentType === "OCG") {
  21274. return {
  21275. type: optionalContentType,
  21276. id: optionalContent.objId
  21277. };
  21278. } else if (optionalContentType === "OCMD") {
  21279. const expression = optionalContent.get("VE");
  21280. if (Array.isArray(expression)) {
  21281. const result = [];
  21282. this._parseVisibilityExpression(expression, 0, result);
  21283. if (result.length > 0) {
  21284. return {
  21285. type: "OCMD",
  21286. expression: result
  21287. };
  21288. }
  21289. }
  21290. const optionalContentGroups = optionalContent.get("OCGs");
  21291. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  21292. const groupIds = [];
  21293. if (Array.isArray(optionalContentGroups)) {
  21294. for (const ocg of optionalContentGroups) {
  21295. groupIds.push(ocg.toString());
  21296. }
  21297. } else {
  21298. groupIds.push(optionalContentGroups.objId);
  21299. }
  21300. return {
  21301. type: optionalContentType,
  21302. ids: groupIds,
  21303. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  21304. expression: null
  21305. };
  21306. } else if (optionalContentGroups instanceof _primitives.Ref) {
  21307. return {
  21308. type: optionalContentType,
  21309. id: optionalContentGroups.toString()
  21310. };
  21311. }
  21312. }
  21313. return null;
  21314. }
  21315. getOperatorList({
  21316. stream,
  21317. task,
  21318. resources,
  21319. operatorList,
  21320. initialState = null,
  21321. fallbackFontDict = null
  21322. }) {
  21323. resources = resources || _primitives.Dict.empty;
  21324. initialState = initialState || new EvalState();
  21325. if (!operatorList) {
  21326. throw new Error('getOperatorList: missing "operatorList" parameter');
  21327. }
  21328. const self = this;
  21329. const xref = this.xref;
  21330. let parsingText = false;
  21331. const localImageCache = new _image_utils.LocalImageCache();
  21332. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  21333. const localGStateCache = new _image_utils.LocalGStateCache();
  21334. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  21335. const localShadingPatternCache = new Map();
  21336. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  21337. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  21338. const stateManager = new StateManager(initialState);
  21339. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21340. const timeSlotManager = new TimeSlotManager();
  21341. function closePendingRestoreOPS(argument) {
  21342. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  21343. operatorList.addOp(_util.OPS.restore, []);
  21344. }
  21345. }
  21346. return new Promise(function promiseBody(resolve, reject) {
  21347. const next = function (promise) {
  21348. Promise.all([promise, operatorList.ready]).then(function () {
  21349. try {
  21350. promiseBody(resolve, reject);
  21351. } catch (ex) {
  21352. reject(ex);
  21353. }
  21354. }, reject);
  21355. };
  21356. task.ensureNotTerminated();
  21357. timeSlotManager.reset();
  21358. const operation = {};
  21359. let stop, i, ii, cs, name, isValidName;
  21360. while (!(stop = timeSlotManager.check())) {
  21361. operation.args = null;
  21362. if (!preprocessor.read(operation)) {
  21363. break;
  21364. }
  21365. let args = operation.args;
  21366. let fn = operation.fn;
  21367. switch (fn | 0) {
  21368. case _util.OPS.paintXObject:
  21369. isValidName = args[0] instanceof _primitives.Name;
  21370. name = args[0].name;
  21371. if (isValidName) {
  21372. const localImage = localImageCache.getByName(name);
  21373. if (localImage) {
  21374. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  21375. incrementCachedImageMaskCount(localImage);
  21376. args = null;
  21377. continue;
  21378. }
  21379. }
  21380. next(new Promise(function (resolveXObject, rejectXObject) {
  21381. if (!isValidName) {
  21382. throw new _util.FormatError("XObject must be referred to by name.");
  21383. }
  21384. let xobj = xobjs.getRaw(name);
  21385. if (xobj instanceof _primitives.Ref) {
  21386. const localImage = localImageCache.getByRef(xobj);
  21387. if (localImage) {
  21388. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  21389. incrementCachedImageMaskCount(localImage);
  21390. resolveXObject();
  21391. return;
  21392. }
  21393. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  21394. if (globalImage) {
  21395. operatorList.addDependency(globalImage.objId);
  21396. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  21397. resolveXObject();
  21398. return;
  21399. }
  21400. xobj = xref.fetch(xobj);
  21401. }
  21402. if (!(xobj instanceof _base_stream.BaseStream)) {
  21403. throw new _util.FormatError("XObject should be a stream");
  21404. }
  21405. const type = xobj.dict.get("Subtype");
  21406. if (!(type instanceof _primitives.Name)) {
  21407. throw new _util.FormatError("XObject should have a Name subtype");
  21408. }
  21409. if (type.name === "Form") {
  21410. stateManager.save();
  21411. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  21412. stateManager.restore();
  21413. resolveXObject();
  21414. }, rejectXObject);
  21415. return;
  21416. } else if (type.name === "Image") {
  21417. self.buildPaintImageXObject({
  21418. resources,
  21419. image: xobj,
  21420. operatorList,
  21421. cacheKey: name,
  21422. localImageCache,
  21423. localColorSpaceCache
  21424. }).then(resolveXObject, rejectXObject);
  21425. return;
  21426. } else if (type.name === "PS") {
  21427. (0, _util.info)("Ignored XObject subtype PS");
  21428. } else {
  21429. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  21430. }
  21431. resolveXObject();
  21432. }).catch(function (reason) {
  21433. if (reason instanceof _util.AbortException) {
  21434. return;
  21435. }
  21436. if (self.options.ignoreErrors) {
  21437. self.handler.send("UnsupportedFeature", {
  21438. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  21439. });
  21440. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  21441. return;
  21442. }
  21443. throw reason;
  21444. }));
  21445. return;
  21446. case _util.OPS.setFont:
  21447. var fontSize = args[1];
  21448. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  21449. operatorList.addDependency(loadedName);
  21450. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  21451. }));
  21452. return;
  21453. case _util.OPS.beginText:
  21454. parsingText = true;
  21455. break;
  21456. case _util.OPS.endText:
  21457. parsingText = false;
  21458. break;
  21459. case _util.OPS.endInlineImage:
  21460. var cacheKey = args[0].cacheKey;
  21461. if (cacheKey) {
  21462. const localImage = localImageCache.getByName(cacheKey);
  21463. if (localImage) {
  21464. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  21465. incrementCachedImageMaskCount(localImage);
  21466. args = null;
  21467. continue;
  21468. }
  21469. }
  21470. next(self.buildPaintImageXObject({
  21471. resources,
  21472. image: args[0],
  21473. isInline: true,
  21474. operatorList,
  21475. cacheKey,
  21476. localImageCache,
  21477. localColorSpaceCache
  21478. }));
  21479. return;
  21480. case _util.OPS.showText:
  21481. if (!stateManager.state.font) {
  21482. self.ensureStateFont(stateManager.state);
  21483. continue;
  21484. }
  21485. args[0] = self.handleText(args[0], stateManager.state);
  21486. break;
  21487. case _util.OPS.showSpacedText:
  21488. if (!stateManager.state.font) {
  21489. self.ensureStateFont(stateManager.state);
  21490. continue;
  21491. }
  21492. var arr = args[0];
  21493. var combinedGlyphs = [];
  21494. var arrLength = arr.length;
  21495. var state = stateManager.state;
  21496. for (i = 0; i < arrLength; ++i) {
  21497. const arrItem = arr[i];
  21498. if (typeof arrItem === "string") {
  21499. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  21500. } else if (typeof arrItem === "number") {
  21501. combinedGlyphs.push(arrItem);
  21502. }
  21503. }
  21504. args[0] = combinedGlyphs;
  21505. fn = _util.OPS.showText;
  21506. break;
  21507. case _util.OPS.nextLineShowText:
  21508. if (!stateManager.state.font) {
  21509. self.ensureStateFont(stateManager.state);
  21510. continue;
  21511. }
  21512. operatorList.addOp(_util.OPS.nextLine);
  21513. args[0] = self.handleText(args[0], stateManager.state);
  21514. fn = _util.OPS.showText;
  21515. break;
  21516. case _util.OPS.nextLineSetSpacingShowText:
  21517. if (!stateManager.state.font) {
  21518. self.ensureStateFont(stateManager.state);
  21519. continue;
  21520. }
  21521. operatorList.addOp(_util.OPS.nextLine);
  21522. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  21523. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  21524. args[0] = self.handleText(args[0], stateManager.state);
  21525. fn = _util.OPS.showText;
  21526. break;
  21527. case _util.OPS.setTextRenderingMode:
  21528. stateManager.state.textRenderingMode = args[0];
  21529. break;
  21530. case _util.OPS.setFillColorSpace:
  21531. {
  21532. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21533. if (cachedColorSpace) {
  21534. stateManager.state.fillColorSpace = cachedColorSpace;
  21535. continue;
  21536. }
  21537. next(self.parseColorSpace({
  21538. cs: args[0],
  21539. resources,
  21540. localColorSpaceCache
  21541. }).then(function (colorSpace) {
  21542. if (colorSpace) {
  21543. stateManager.state.fillColorSpace = colorSpace;
  21544. }
  21545. }));
  21546. return;
  21547. }
  21548. case _util.OPS.setStrokeColorSpace:
  21549. {
  21550. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21551. if (cachedColorSpace) {
  21552. stateManager.state.strokeColorSpace = cachedColorSpace;
  21553. continue;
  21554. }
  21555. next(self.parseColorSpace({
  21556. cs: args[0],
  21557. resources,
  21558. localColorSpaceCache
  21559. }).then(function (colorSpace) {
  21560. if (colorSpace) {
  21561. stateManager.state.strokeColorSpace = colorSpace;
  21562. }
  21563. }));
  21564. return;
  21565. }
  21566. case _util.OPS.setFillColor:
  21567. cs = stateManager.state.fillColorSpace;
  21568. args = cs.getRgb(args, 0);
  21569. fn = _util.OPS.setFillRGBColor;
  21570. break;
  21571. case _util.OPS.setStrokeColor:
  21572. cs = stateManager.state.strokeColorSpace;
  21573. args = cs.getRgb(args, 0);
  21574. fn = _util.OPS.setStrokeRGBColor;
  21575. break;
  21576. case _util.OPS.setFillGray:
  21577. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  21578. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21579. fn = _util.OPS.setFillRGBColor;
  21580. break;
  21581. case _util.OPS.setStrokeGray:
  21582. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  21583. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21584. fn = _util.OPS.setStrokeRGBColor;
  21585. break;
  21586. case _util.OPS.setFillCMYKColor:
  21587. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21588. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21589. fn = _util.OPS.setFillRGBColor;
  21590. break;
  21591. case _util.OPS.setStrokeCMYKColor:
  21592. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21593. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21594. fn = _util.OPS.setStrokeRGBColor;
  21595. break;
  21596. case _util.OPS.setFillRGBColor:
  21597. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21598. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21599. break;
  21600. case _util.OPS.setStrokeRGBColor:
  21601. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21602. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21603. break;
  21604. case _util.OPS.setFillColorN:
  21605. cs = stateManager.state.fillColorSpace;
  21606. if (cs.name === "Pattern") {
  21607. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21608. return;
  21609. }
  21610. args = cs.getRgb(args, 0);
  21611. fn = _util.OPS.setFillRGBColor;
  21612. break;
  21613. case _util.OPS.setStrokeColorN:
  21614. cs = stateManager.state.strokeColorSpace;
  21615. if (cs.name === "Pattern") {
  21616. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21617. return;
  21618. }
  21619. args = cs.getRgb(args, 0);
  21620. fn = _util.OPS.setStrokeRGBColor;
  21621. break;
  21622. case _util.OPS.shadingFill:
  21623. var shadingRes = resources.get("Shading");
  21624. if (!shadingRes) {
  21625. throw new _util.FormatError("No shading resource found");
  21626. }
  21627. var shading = shadingRes.get(args[0].name);
  21628. if (!shading) {
  21629. throw new _util.FormatError("No shading object found");
  21630. }
  21631. const patternId = self.parseShading({
  21632. shading,
  21633. resources,
  21634. localColorSpaceCache,
  21635. localShadingPatternCache
  21636. });
  21637. args = [patternId];
  21638. fn = _util.OPS.shadingFill;
  21639. break;
  21640. case _util.OPS.setGState:
  21641. isValidName = args[0] instanceof _primitives.Name;
  21642. name = args[0].name;
  21643. if (isValidName) {
  21644. const localGStateObj = localGStateCache.getByName(name);
  21645. if (localGStateObj) {
  21646. if (localGStateObj.length > 0) {
  21647. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  21648. }
  21649. args = null;
  21650. continue;
  21651. }
  21652. }
  21653. next(new Promise(function (resolveGState, rejectGState) {
  21654. if (!isValidName) {
  21655. throw new _util.FormatError("GState must be referred to by name.");
  21656. }
  21657. const extGState = resources.get("ExtGState");
  21658. if (!(extGState instanceof _primitives.Dict)) {
  21659. throw new _util.FormatError("ExtGState should be a dictionary.");
  21660. }
  21661. const gState = extGState.get(name);
  21662. if (!(gState instanceof _primitives.Dict)) {
  21663. throw new _util.FormatError("GState should be a dictionary.");
  21664. }
  21665. self.setGState({
  21666. resources,
  21667. gState,
  21668. operatorList,
  21669. cacheKey: name,
  21670. task,
  21671. stateManager,
  21672. localGStateCache,
  21673. localColorSpaceCache
  21674. }).then(resolveGState, rejectGState);
  21675. }).catch(function (reason) {
  21676. if (reason instanceof _util.AbortException) {
  21677. return;
  21678. }
  21679. if (self.options.ignoreErrors) {
  21680. self.handler.send("UnsupportedFeature", {
  21681. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  21682. });
  21683. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  21684. return;
  21685. }
  21686. throw reason;
  21687. }));
  21688. return;
  21689. case _util.OPS.moveTo:
  21690. case _util.OPS.lineTo:
  21691. case _util.OPS.curveTo:
  21692. case _util.OPS.curveTo2:
  21693. case _util.OPS.curveTo3:
  21694. case _util.OPS.closePath:
  21695. case _util.OPS.rectangle:
  21696. self.buildPath(operatorList, fn, args, parsingText);
  21697. continue;
  21698. case _util.OPS.markPoint:
  21699. case _util.OPS.markPointProps:
  21700. case _util.OPS.beginCompat:
  21701. case _util.OPS.endCompat:
  21702. continue;
  21703. case _util.OPS.beginMarkedContentProps:
  21704. if (!(args[0] instanceof _primitives.Name)) {
  21705. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  21706. continue;
  21707. }
  21708. if (args[0].name === "OC") {
  21709. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  21710. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  21711. }).catch(reason => {
  21712. if (reason instanceof _util.AbortException) {
  21713. return;
  21714. }
  21715. if (self.options.ignoreErrors) {
  21716. self.handler.send("UnsupportedFeature", {
  21717. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  21718. });
  21719. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  21720. return;
  21721. }
  21722. throw reason;
  21723. }));
  21724. return;
  21725. }
  21726. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  21727. break;
  21728. case _util.OPS.beginMarkedContent:
  21729. case _util.OPS.endMarkedContent:
  21730. default:
  21731. if (args !== null) {
  21732. for (i = 0, ii = args.length; i < ii; i++) {
  21733. if (args[i] instanceof _primitives.Dict) {
  21734. break;
  21735. }
  21736. }
  21737. if (i < ii) {
  21738. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  21739. continue;
  21740. }
  21741. }
  21742. }
  21743. operatorList.addOp(fn, args);
  21744. }
  21745. if (stop) {
  21746. next(deferred);
  21747. return;
  21748. }
  21749. closePendingRestoreOPS();
  21750. resolve();
  21751. }).catch(reason => {
  21752. if (reason instanceof _util.AbortException) {
  21753. return;
  21754. }
  21755. if (this.options.ignoreErrors) {
  21756. this.handler.send("UnsupportedFeature", {
  21757. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  21758. });
  21759. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  21760. closePendingRestoreOPS();
  21761. return;
  21762. }
  21763. throw reason;
  21764. });
  21765. }
  21766. getTextContent({
  21767. stream,
  21768. task,
  21769. resources,
  21770. stateManager = null,
  21771. combineTextItems = false,
  21772. includeMarkedContent = false,
  21773. sink,
  21774. seenStyles = new Set(),
  21775. viewBox
  21776. }) {
  21777. resources = resources || _primitives.Dict.empty;
  21778. stateManager = stateManager || new StateManager(new TextState());
  21779. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  21780. const textContent = {
  21781. items: [],
  21782. styles: Object.create(null)
  21783. };
  21784. const textContentItem = {
  21785. initialized: false,
  21786. str: [],
  21787. totalWidth: 0,
  21788. totalHeight: 0,
  21789. width: 0,
  21790. height: 0,
  21791. vertical: false,
  21792. prevTransform: null,
  21793. textAdvanceScale: 0,
  21794. spaceInFlowMin: 0,
  21795. spaceInFlowMax: 0,
  21796. trackingSpaceMin: Infinity,
  21797. negativeSpaceMax: -Infinity,
  21798. notASpace: -Infinity,
  21799. transform: null,
  21800. fontName: null,
  21801. hasEOL: false
  21802. };
  21803. const twoLastChars = [" ", " "];
  21804. let twoLastCharsPos = 0;
  21805. function saveLastChar(char) {
  21806. const nextPos = (twoLastCharsPos + 1) % 2;
  21807. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  21808. twoLastChars[twoLastCharsPos] = char;
  21809. twoLastCharsPos = nextPos;
  21810. return ret;
  21811. }
  21812. function resetLastChars() {
  21813. twoLastChars[0] = twoLastChars[1] = " ";
  21814. twoLastCharsPos = 0;
  21815. }
  21816. const TRACKING_SPACE_FACTOR = 0.1;
  21817. const NOT_A_SPACE_FACTOR = 0.03;
  21818. const NEGATIVE_SPACE_FACTOR = -0.2;
  21819. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  21820. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  21821. const self = this;
  21822. const xref = this.xref;
  21823. const showSpacedTextBuffer = [];
  21824. let xobjs = null;
  21825. const emptyXObjectCache = new _image_utils.LocalImageCache();
  21826. const emptyGStateCache = new _image_utils.LocalGStateCache();
  21827. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21828. let textState;
  21829. function getCurrentTextTransform() {
  21830. const font = textState.font;
  21831. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  21832. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  21833. const glyphHeight = font.bbox[3] - font.bbox[1];
  21834. if (glyphHeight > 0) {
  21835. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  21836. }
  21837. }
  21838. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  21839. }
  21840. function ensureTextContentItem() {
  21841. if (textContentItem.initialized) {
  21842. return textContentItem;
  21843. }
  21844. const font = textState.font,
  21845. loadedName = font.loadedName;
  21846. if (!seenStyles.has(loadedName)) {
  21847. seenStyles.add(loadedName);
  21848. textContent.styles[loadedName] = {
  21849. fontFamily: font.fallbackName,
  21850. ascent: font.ascent,
  21851. descent: font.descent,
  21852. vertical: font.vertical
  21853. };
  21854. }
  21855. textContentItem.fontName = loadedName;
  21856. const trm = textContentItem.transform = getCurrentTextTransform();
  21857. if (!font.vertical) {
  21858. textContentItem.width = textContentItem.totalWidth = 0;
  21859. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  21860. textContentItem.vertical = false;
  21861. } else {
  21862. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  21863. textContentItem.height = textContentItem.totalHeight = 0;
  21864. textContentItem.vertical = true;
  21865. }
  21866. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21867. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21868. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  21869. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  21870. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  21871. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  21872. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  21873. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  21874. textContentItem.hasEOL = false;
  21875. textContentItem.initialized = true;
  21876. return textContentItem;
  21877. }
  21878. function updateAdvanceScale() {
  21879. if (!textContentItem.initialized) {
  21880. return;
  21881. }
  21882. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21883. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21884. const scaleFactor = scaleCtmX * scaleLineX;
  21885. if (scaleFactor === textContentItem.textAdvanceScale) {
  21886. return;
  21887. }
  21888. if (!textContentItem.vertical) {
  21889. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21890. textContentItem.width = 0;
  21891. } else {
  21892. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21893. textContentItem.height = 0;
  21894. }
  21895. textContentItem.textAdvanceScale = scaleFactor;
  21896. }
  21897. function runBidiTransform(textChunk) {
  21898. const text = textChunk.str.join("");
  21899. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  21900. return {
  21901. str: bidiResult.str,
  21902. dir: bidiResult.dir,
  21903. width: Math.abs(textChunk.totalWidth),
  21904. height: Math.abs(textChunk.totalHeight),
  21905. transform: textChunk.transform,
  21906. fontName: textChunk.fontName,
  21907. hasEOL: textChunk.hasEOL
  21908. };
  21909. }
  21910. function handleSetFont(fontName, fontRef) {
  21911. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  21912. if (!translated.font.isType3Font) {
  21913. return translated;
  21914. }
  21915. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  21916. return translated;
  21917. });
  21918. }).then(function (translated) {
  21919. textState.font = translated.font;
  21920. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  21921. });
  21922. }
  21923. function applyInverseRotation(x, y, matrix) {
  21924. const scale = Math.hypot(matrix[0], matrix[1]);
  21925. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  21926. }
  21927. function compareWithLastPosition() {
  21928. const currentTransform = getCurrentTextTransform();
  21929. let posX = currentTransform[4];
  21930. let posY = currentTransform[5];
  21931. const shiftedX = posX - viewBox[0];
  21932. const shiftedY = posY - viewBox[1];
  21933. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  21934. return false;
  21935. }
  21936. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  21937. return true;
  21938. }
  21939. let lastPosX = textContentItem.prevTransform[4];
  21940. let lastPosY = textContentItem.prevTransform[5];
  21941. if (lastPosX === posX && lastPosY === posY) {
  21942. return true;
  21943. }
  21944. let rotate = -1;
  21945. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  21946. rotate = currentTransform[0] > 0 ? 0 : 180;
  21947. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  21948. rotate = currentTransform[1] > 0 ? 90 : 270;
  21949. }
  21950. switch (rotate) {
  21951. case 0:
  21952. break;
  21953. case 90:
  21954. [posX, posY] = [posY, posX];
  21955. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  21956. break;
  21957. case 180:
  21958. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  21959. break;
  21960. case 270:
  21961. [posX, posY] = [-posY, -posX];
  21962. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  21963. break;
  21964. default:
  21965. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  21966. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  21967. }
  21968. if (textState.font.vertical) {
  21969. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  21970. const advanceX = posX - lastPosX;
  21971. const textOrientation = Math.sign(textContentItem.height);
  21972. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  21973. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  21974. appendEOL();
  21975. return true;
  21976. }
  21977. resetLastChars();
  21978. flushTextContentItem();
  21979. return true;
  21980. }
  21981. if (Math.abs(advanceX) > textContentItem.width) {
  21982. appendEOL();
  21983. return true;
  21984. }
  21985. if (advanceY <= textOrientation * textContentItem.notASpace) {
  21986. resetLastChars();
  21987. }
  21988. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  21989. textContentItem.height += advanceY;
  21990. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  21991. if (textContentItem.str.length === 0) {
  21992. resetLastChars();
  21993. textContent.items.push({
  21994. str: " ",
  21995. dir: "ltr",
  21996. width: 0,
  21997. height: Math.abs(advanceY),
  21998. transform: textContentItem.prevTransform,
  21999. fontName: textContentItem.fontName,
  22000. hasEOL: false
  22001. });
  22002. } else {
  22003. textContentItem.height += advanceY;
  22004. }
  22005. }
  22006. return true;
  22007. }
  22008. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  22009. const advanceY = posY - lastPosY;
  22010. const textOrientation = Math.sign(textContentItem.width);
  22011. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  22012. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  22013. appendEOL();
  22014. return true;
  22015. }
  22016. resetLastChars();
  22017. flushTextContentItem();
  22018. return true;
  22019. }
  22020. if (Math.abs(advanceY) > textContentItem.height) {
  22021. appendEOL();
  22022. return true;
  22023. }
  22024. if (advanceX <= textOrientation * textContentItem.notASpace) {
  22025. resetLastChars();
  22026. }
  22027. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  22028. textContentItem.width += advanceX;
  22029. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  22030. if (textContentItem.str.length === 0) {
  22031. resetLastChars();
  22032. textContent.items.push({
  22033. str: " ",
  22034. dir: "ltr",
  22035. width: Math.abs(advanceX),
  22036. height: 0,
  22037. transform: textContentItem.prevTransform,
  22038. fontName: textContentItem.fontName,
  22039. hasEOL: false
  22040. });
  22041. } else {
  22042. textContentItem.width += advanceX;
  22043. }
  22044. }
  22045. return true;
  22046. }
  22047. function buildTextContentItem({
  22048. chars,
  22049. extraSpacing
  22050. }) {
  22051. const font = textState.font;
  22052. if (!chars) {
  22053. const charSpacing = textState.charSpacing + extraSpacing;
  22054. if (charSpacing) {
  22055. if (!font.vertical) {
  22056. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22057. } else {
  22058. textState.translateTextMatrix(0, -charSpacing);
  22059. }
  22060. }
  22061. return;
  22062. }
  22063. const glyphs = font.charsToGlyphs(chars);
  22064. const scale = textState.fontMatrix[0] * textState.fontSize;
  22065. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  22066. const glyph = glyphs[i];
  22067. if (glyph.isInvisibleFormatMark) {
  22068. continue;
  22069. }
  22070. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  22071. let glyphWidth = glyph.width;
  22072. if (font.vertical) {
  22073. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  22074. }
  22075. let scaledDim = glyphWidth * scale;
  22076. if (glyph.isWhitespace) {
  22077. if (!font.vertical) {
  22078. charSpacing += scaledDim + textState.wordSpacing;
  22079. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22080. } else {
  22081. charSpacing += -scaledDim + textState.wordSpacing;
  22082. textState.translateTextMatrix(0, -charSpacing);
  22083. }
  22084. saveLastChar(" ");
  22085. continue;
  22086. }
  22087. if (!compareWithLastPosition()) {
  22088. continue;
  22089. }
  22090. const textChunk = ensureTextContentItem();
  22091. if (glyph.isZeroWidthDiacritic) {
  22092. scaledDim = 0;
  22093. }
  22094. if (!font.vertical) {
  22095. scaledDim *= textState.textHScale;
  22096. textState.translateTextMatrix(scaledDim, 0);
  22097. textChunk.width += scaledDim;
  22098. } else {
  22099. textState.translateTextMatrix(0, scaledDim);
  22100. scaledDim = Math.abs(scaledDim);
  22101. textChunk.height += scaledDim;
  22102. }
  22103. if (scaledDim) {
  22104. textChunk.prevTransform = getCurrentTextTransform();
  22105. }
  22106. let glyphUnicode = glyph.unicode;
  22107. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  22108. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  22109. if (saveLastChar(glyphUnicode)) {
  22110. textChunk.str.push(" ");
  22111. }
  22112. textChunk.str.push(glyphUnicode);
  22113. if (charSpacing) {
  22114. if (!font.vertical) {
  22115. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22116. } else {
  22117. textState.translateTextMatrix(0, -charSpacing);
  22118. }
  22119. }
  22120. }
  22121. }
  22122. function appendEOL() {
  22123. resetLastChars();
  22124. if (textContentItem.initialized) {
  22125. textContentItem.hasEOL = true;
  22126. flushTextContentItem();
  22127. } else {
  22128. textContent.items.push({
  22129. str: "",
  22130. dir: "ltr",
  22131. width: 0,
  22132. height: 0,
  22133. transform: getCurrentTextTransform(),
  22134. fontName: textState.font.loadedName,
  22135. hasEOL: true
  22136. });
  22137. }
  22138. }
  22139. function addFakeSpaces(width, transf, textOrientation) {
  22140. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  22141. if (textContentItem.initialized) {
  22142. resetLastChars();
  22143. textContentItem.str.push(" ");
  22144. }
  22145. return false;
  22146. }
  22147. const fontName = textContentItem.fontName;
  22148. let height = 0;
  22149. if (textContentItem.vertical) {
  22150. height = width;
  22151. width = 0;
  22152. }
  22153. flushTextContentItem();
  22154. resetLastChars();
  22155. textContent.items.push({
  22156. str: " ",
  22157. dir: "ltr",
  22158. width: Math.abs(width),
  22159. height: Math.abs(height),
  22160. transform: transf || getCurrentTextTransform(),
  22161. fontName,
  22162. hasEOL: false
  22163. });
  22164. return true;
  22165. }
  22166. function flushTextContentItem() {
  22167. if (!textContentItem.initialized || !textContentItem.str) {
  22168. return;
  22169. }
  22170. if (!textContentItem.vertical) {
  22171. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  22172. } else {
  22173. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  22174. }
  22175. textContent.items.push(runBidiTransform(textContentItem));
  22176. textContentItem.initialized = false;
  22177. textContentItem.str.length = 0;
  22178. }
  22179. function enqueueChunk(batch = false) {
  22180. const length = textContent.items.length;
  22181. if (length === 0) {
  22182. return;
  22183. }
  22184. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  22185. return;
  22186. }
  22187. sink.enqueue(textContent, length);
  22188. textContent.items = [];
  22189. textContent.styles = Object.create(null);
  22190. }
  22191. const timeSlotManager = new TimeSlotManager();
  22192. return new Promise(function promiseBody(resolve, reject) {
  22193. const next = function (promise) {
  22194. enqueueChunk(true);
  22195. Promise.all([promise, sink.ready]).then(function () {
  22196. try {
  22197. promiseBody(resolve, reject);
  22198. } catch (ex) {
  22199. reject(ex);
  22200. }
  22201. }, reject);
  22202. };
  22203. task.ensureNotTerminated();
  22204. timeSlotManager.reset();
  22205. const operation = {};
  22206. let stop,
  22207. args = [];
  22208. while (!(stop = timeSlotManager.check())) {
  22209. args.length = 0;
  22210. operation.args = args;
  22211. if (!preprocessor.read(operation)) {
  22212. break;
  22213. }
  22214. textState = stateManager.state;
  22215. const fn = operation.fn;
  22216. args = operation.args;
  22217. switch (fn | 0) {
  22218. case _util.OPS.setFont:
  22219. var fontNameArg = args[0].name,
  22220. fontSizeArg = args[1];
  22221. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  22222. break;
  22223. }
  22224. flushTextContentItem();
  22225. textState.fontName = fontNameArg;
  22226. textState.fontSize = fontSizeArg;
  22227. next(handleSetFont(fontNameArg, null));
  22228. return;
  22229. case _util.OPS.setTextRise:
  22230. textState.textRise = args[0];
  22231. break;
  22232. case _util.OPS.setHScale:
  22233. textState.textHScale = args[0] / 100;
  22234. break;
  22235. case _util.OPS.setLeading:
  22236. textState.leading = args[0];
  22237. break;
  22238. case _util.OPS.moveText:
  22239. textState.translateTextLineMatrix(args[0], args[1]);
  22240. textState.textMatrix = textState.textLineMatrix.slice();
  22241. break;
  22242. case _util.OPS.setLeadingMoveText:
  22243. textState.leading = -args[1];
  22244. textState.translateTextLineMatrix(args[0], args[1]);
  22245. textState.textMatrix = textState.textLineMatrix.slice();
  22246. break;
  22247. case _util.OPS.nextLine:
  22248. textState.carriageReturn();
  22249. break;
  22250. case _util.OPS.setTextMatrix:
  22251. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  22252. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  22253. updateAdvanceScale();
  22254. break;
  22255. case _util.OPS.setCharSpacing:
  22256. textState.charSpacing = args[0];
  22257. break;
  22258. case _util.OPS.setWordSpacing:
  22259. textState.wordSpacing = args[0];
  22260. break;
  22261. case _util.OPS.beginText:
  22262. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  22263. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  22264. break;
  22265. case _util.OPS.showSpacedText:
  22266. if (!stateManager.state.font) {
  22267. self.ensureStateFont(stateManager.state);
  22268. continue;
  22269. }
  22270. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  22271. const elements = args[0];
  22272. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  22273. const item = elements[i];
  22274. if (typeof item === "string") {
  22275. showSpacedTextBuffer.push(item);
  22276. } else if (typeof item === "number" && item !== 0) {
  22277. const str = showSpacedTextBuffer.join("");
  22278. showSpacedTextBuffer.length = 0;
  22279. buildTextContentItem({
  22280. chars: str,
  22281. extraSpacing: item * spaceFactor
  22282. });
  22283. }
  22284. }
  22285. const item = elements[elements.length - 1];
  22286. if (typeof item === "string") {
  22287. showSpacedTextBuffer.push(item);
  22288. }
  22289. if (showSpacedTextBuffer.length > 0) {
  22290. const str = showSpacedTextBuffer.join("");
  22291. showSpacedTextBuffer.length = 0;
  22292. buildTextContentItem({
  22293. chars: str,
  22294. extraSpacing: 0
  22295. });
  22296. }
  22297. break;
  22298. case _util.OPS.showText:
  22299. if (!stateManager.state.font) {
  22300. self.ensureStateFont(stateManager.state);
  22301. continue;
  22302. }
  22303. buildTextContentItem({
  22304. chars: args[0],
  22305. extraSpacing: 0
  22306. });
  22307. break;
  22308. case _util.OPS.nextLineShowText:
  22309. if (!stateManager.state.font) {
  22310. self.ensureStateFont(stateManager.state);
  22311. continue;
  22312. }
  22313. textState.carriageReturn();
  22314. buildTextContentItem({
  22315. chars: args[0],
  22316. extraSpacing: 0
  22317. });
  22318. break;
  22319. case _util.OPS.nextLineSetSpacingShowText:
  22320. if (!stateManager.state.font) {
  22321. self.ensureStateFont(stateManager.state);
  22322. continue;
  22323. }
  22324. textState.wordSpacing = args[0];
  22325. textState.charSpacing = args[1];
  22326. textState.carriageReturn();
  22327. buildTextContentItem({
  22328. chars: args[2],
  22329. extraSpacing: 0
  22330. });
  22331. break;
  22332. case _util.OPS.paintXObject:
  22333. flushTextContentItem();
  22334. if (!xobjs) {
  22335. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  22336. }
  22337. var isValidName = args[0] instanceof _primitives.Name;
  22338. var name = args[0].name;
  22339. if (isValidName && emptyXObjectCache.getByName(name)) {
  22340. break;
  22341. }
  22342. next(new Promise(function (resolveXObject, rejectXObject) {
  22343. if (!isValidName) {
  22344. throw new _util.FormatError("XObject must be referred to by name.");
  22345. }
  22346. let xobj = xobjs.getRaw(name);
  22347. if (xobj instanceof _primitives.Ref) {
  22348. if (emptyXObjectCache.getByRef(xobj)) {
  22349. resolveXObject();
  22350. return;
  22351. }
  22352. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  22353. if (globalImage) {
  22354. resolveXObject();
  22355. return;
  22356. }
  22357. xobj = xref.fetch(xobj);
  22358. }
  22359. if (!(xobj instanceof _base_stream.BaseStream)) {
  22360. throw new _util.FormatError("XObject should be a stream");
  22361. }
  22362. const type = xobj.dict.get("Subtype");
  22363. if (!(type instanceof _primitives.Name)) {
  22364. throw new _util.FormatError("XObject should have a Name subtype");
  22365. }
  22366. if (type.name !== "Form") {
  22367. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22368. resolveXObject();
  22369. return;
  22370. }
  22371. const currentState = stateManager.state.clone();
  22372. const xObjStateManager = new StateManager(currentState);
  22373. const matrix = xobj.dict.getArray("Matrix");
  22374. if (Array.isArray(matrix) && matrix.length === 6) {
  22375. xObjStateManager.transform(matrix);
  22376. }
  22377. enqueueChunk();
  22378. const sinkWrapper = {
  22379. enqueueInvoked: false,
  22380. enqueue(chunk, size) {
  22381. this.enqueueInvoked = true;
  22382. sink.enqueue(chunk, size);
  22383. },
  22384. get desiredSize() {
  22385. return sink.desiredSize;
  22386. },
  22387. get ready() {
  22388. return sink.ready;
  22389. }
  22390. };
  22391. self.getTextContent({
  22392. stream: xobj,
  22393. task,
  22394. resources: xobj.dict.get("Resources") || resources,
  22395. stateManager: xObjStateManager,
  22396. combineTextItems,
  22397. includeMarkedContent,
  22398. sink: sinkWrapper,
  22399. seenStyles,
  22400. viewBox
  22401. }).then(function () {
  22402. if (!sinkWrapper.enqueueInvoked) {
  22403. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22404. }
  22405. resolveXObject();
  22406. }, rejectXObject);
  22407. }).catch(function (reason) {
  22408. if (reason instanceof _util.AbortException) {
  22409. return;
  22410. }
  22411. if (self.options.ignoreErrors) {
  22412. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  22413. return;
  22414. }
  22415. throw reason;
  22416. }));
  22417. return;
  22418. case _util.OPS.setGState:
  22419. isValidName = args[0] instanceof _primitives.Name;
  22420. name = args[0].name;
  22421. if (isValidName && emptyGStateCache.getByName(name)) {
  22422. break;
  22423. }
  22424. next(new Promise(function (resolveGState, rejectGState) {
  22425. if (!isValidName) {
  22426. throw new _util.FormatError("GState must be referred to by name.");
  22427. }
  22428. const extGState = resources.get("ExtGState");
  22429. if (!(extGState instanceof _primitives.Dict)) {
  22430. throw new _util.FormatError("ExtGState should be a dictionary.");
  22431. }
  22432. const gState = extGState.get(name);
  22433. if (!(gState instanceof _primitives.Dict)) {
  22434. throw new _util.FormatError("GState should be a dictionary.");
  22435. }
  22436. const gStateFont = gState.get("Font");
  22437. if (!gStateFont) {
  22438. emptyGStateCache.set(name, gState.objId, true);
  22439. resolveGState();
  22440. return;
  22441. }
  22442. flushTextContentItem();
  22443. textState.fontName = null;
  22444. textState.fontSize = gStateFont[1];
  22445. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  22446. }).catch(function (reason) {
  22447. if (reason instanceof _util.AbortException) {
  22448. return;
  22449. }
  22450. if (self.options.ignoreErrors) {
  22451. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  22452. return;
  22453. }
  22454. throw reason;
  22455. }));
  22456. return;
  22457. case _util.OPS.beginMarkedContent:
  22458. if (includeMarkedContent) {
  22459. textContent.items.push({
  22460. type: "beginMarkedContent",
  22461. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  22462. });
  22463. }
  22464. break;
  22465. case _util.OPS.beginMarkedContentProps:
  22466. if (includeMarkedContent) {
  22467. flushTextContentItem();
  22468. let mcid = null;
  22469. if (args[1] instanceof _primitives.Dict) {
  22470. mcid = args[1].get("MCID");
  22471. }
  22472. textContent.items.push({
  22473. type: "beginMarkedContentProps",
  22474. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  22475. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  22476. });
  22477. }
  22478. break;
  22479. case _util.OPS.endMarkedContent:
  22480. if (includeMarkedContent) {
  22481. flushTextContentItem();
  22482. textContent.items.push({
  22483. type: "endMarkedContent"
  22484. });
  22485. }
  22486. break;
  22487. }
  22488. if (textContent.items.length >= sink.desiredSize) {
  22489. stop = true;
  22490. break;
  22491. }
  22492. }
  22493. if (stop) {
  22494. next(deferred);
  22495. return;
  22496. }
  22497. flushTextContentItem();
  22498. enqueueChunk();
  22499. resolve();
  22500. }).catch(reason => {
  22501. if (reason instanceof _util.AbortException) {
  22502. return;
  22503. }
  22504. if (this.options.ignoreErrors) {
  22505. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  22506. flushTextContentItem();
  22507. enqueueChunk();
  22508. return;
  22509. }
  22510. throw reason;
  22511. });
  22512. }
  22513. extractDataStructures(dict, baseDict, properties) {
  22514. const xref = this.xref;
  22515. let cidToGidBytes;
  22516. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  22517. if (properties.composite) {
  22518. const cidSystemInfo = dict.get("CIDSystemInfo");
  22519. if (cidSystemInfo instanceof _primitives.Dict) {
  22520. properties.cidSystemInfo = {
  22521. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  22522. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  22523. supplement: cidSystemInfo.get("Supplement")
  22524. };
  22525. }
  22526. const cidToGidMap = dict.get("CIDToGIDMap");
  22527. if (cidToGidMap instanceof _base_stream.BaseStream) {
  22528. cidToGidBytes = cidToGidMap.getBytes();
  22529. }
  22530. }
  22531. const differences = [];
  22532. let baseEncodingName = null;
  22533. let encoding;
  22534. if (dict.has("Encoding")) {
  22535. encoding = dict.get("Encoding");
  22536. if (encoding instanceof _primitives.Dict) {
  22537. baseEncodingName = encoding.get("BaseEncoding");
  22538. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  22539. if (encoding.has("Differences")) {
  22540. const diffEncoding = encoding.get("Differences");
  22541. let index = 0;
  22542. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  22543. const data = xref.fetchIfRef(diffEncoding[j]);
  22544. if (typeof data === "number") {
  22545. index = data;
  22546. } else if (data instanceof _primitives.Name) {
  22547. differences[index++] = data.name;
  22548. } else {
  22549. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  22550. }
  22551. }
  22552. }
  22553. } else if (encoding instanceof _primitives.Name) {
  22554. baseEncodingName = encoding.name;
  22555. } else {
  22556. const msg = "Encoding is not a Name nor a Dict";
  22557. if (!this.options.ignoreErrors) {
  22558. throw new _util.FormatError(msg);
  22559. }
  22560. (0, _util.warn)(msg);
  22561. }
  22562. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  22563. baseEncodingName = null;
  22564. }
  22565. }
  22566. if (baseEncodingName) {
  22567. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22568. } else {
  22569. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  22570. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  22571. encoding = _encodings.StandardEncoding;
  22572. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  22573. encoding = _encodings.WinAnsiEncoding;
  22574. }
  22575. if (isSymbolicFont) {
  22576. encoding = _encodings.MacRomanEncoding;
  22577. if (!properties.file || properties.isInternalFont) {
  22578. if (/Symbol/i.test(properties.name)) {
  22579. encoding = _encodings.SymbolSetEncoding;
  22580. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  22581. encoding = _encodings.ZapfDingbatsEncoding;
  22582. }
  22583. }
  22584. }
  22585. properties.defaultEncoding = encoding;
  22586. }
  22587. properties.differences = differences;
  22588. properties.baseEncodingName = baseEncodingName;
  22589. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  22590. properties.dict = dict;
  22591. return toUnicodePromise.then(readToUnicode => {
  22592. properties.toUnicode = readToUnicode;
  22593. return this.buildToUnicode(properties);
  22594. }).then(builtToUnicode => {
  22595. properties.toUnicode = builtToUnicode;
  22596. if (cidToGidBytes) {
  22597. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  22598. }
  22599. return properties;
  22600. });
  22601. }
  22602. _simpleFontToUnicode(properties, forceGlyphs = false) {
  22603. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  22604. const toUnicode = [];
  22605. const encoding = properties.defaultEncoding.slice();
  22606. const baseEncodingName = properties.baseEncodingName;
  22607. const differences = properties.differences;
  22608. for (const charcode in differences) {
  22609. const glyphName = differences[charcode];
  22610. if (glyphName === ".notdef") {
  22611. continue;
  22612. }
  22613. encoding[charcode] = glyphName;
  22614. }
  22615. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22616. for (const charcode in encoding) {
  22617. let glyphName = encoding[charcode];
  22618. if (glyphName === "") {
  22619. continue;
  22620. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  22621. let code = 0;
  22622. switch (glyphName[0]) {
  22623. case "G":
  22624. if (glyphName.length === 3) {
  22625. code = parseInt(glyphName.substring(1), 16);
  22626. }
  22627. break;
  22628. case "g":
  22629. if (glyphName.length === 5) {
  22630. code = parseInt(glyphName.substring(1), 16);
  22631. }
  22632. break;
  22633. case "C":
  22634. case "c":
  22635. if (glyphName.length >= 3 && glyphName.length <= 4) {
  22636. const codeStr = glyphName.substring(1);
  22637. if (forceGlyphs) {
  22638. code = parseInt(codeStr, 16);
  22639. break;
  22640. }
  22641. code = +codeStr;
  22642. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  22643. return this._simpleFontToUnicode(properties, true);
  22644. }
  22645. }
  22646. break;
  22647. default:
  22648. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22649. if (unicode !== -1) {
  22650. code = unicode;
  22651. }
  22652. }
  22653. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  22654. if (baseEncodingName && code === +charcode) {
  22655. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22656. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  22657. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22658. continue;
  22659. }
  22660. }
  22661. toUnicode[charcode] = String.fromCodePoint(code);
  22662. }
  22663. continue;
  22664. }
  22665. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22666. }
  22667. return toUnicode;
  22668. }
  22669. async buildToUnicode(properties) {
  22670. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  22671. if (properties.hasIncludedToUnicodeMap) {
  22672. if (!properties.composite && properties.hasEncoding) {
  22673. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  22674. }
  22675. return properties.toUnicode;
  22676. }
  22677. if (!properties.composite) {
  22678. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  22679. }
  22680. 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"))) {
  22681. const {
  22682. registry,
  22683. ordering
  22684. } = properties.cidSystemInfo;
  22685. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  22686. const ucs2CMap = await _cmap.CMapFactory.create({
  22687. encoding: ucs2CMapName,
  22688. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22689. useCMap: null
  22690. });
  22691. const toUnicode = [];
  22692. properties.cMap.forEach(function (charcode, cid) {
  22693. if (cid > 0xffff) {
  22694. throw new _util.FormatError("Max size of CID is 65,535");
  22695. }
  22696. const ucs2 = ucs2CMap.lookup(cid);
  22697. if (ucs2) {
  22698. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  22699. }
  22700. });
  22701. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  22702. }
  22703. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  22704. }
  22705. readToUnicode(cmapObj) {
  22706. if (!cmapObj) {
  22707. return Promise.resolve(null);
  22708. }
  22709. if (cmapObj instanceof _primitives.Name) {
  22710. return _cmap.CMapFactory.create({
  22711. encoding: cmapObj,
  22712. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22713. useCMap: null
  22714. }).then(function (cmap) {
  22715. if (cmap instanceof _cmap.IdentityCMap) {
  22716. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22717. }
  22718. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  22719. });
  22720. } else if (cmapObj instanceof _base_stream.BaseStream) {
  22721. return _cmap.CMapFactory.create({
  22722. encoding: cmapObj,
  22723. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22724. useCMap: null
  22725. }).then(function (cmap) {
  22726. if (cmap instanceof _cmap.IdentityCMap) {
  22727. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22728. }
  22729. const map = new Array(cmap.length);
  22730. cmap.forEach(function (charCode, token) {
  22731. if (typeof token === "number") {
  22732. map[charCode] = String.fromCodePoint(token);
  22733. return;
  22734. }
  22735. const str = [];
  22736. for (let k = 0; k < token.length; k += 2) {
  22737. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22738. if ((w1 & 0xf800) !== 0xd800) {
  22739. str.push(w1);
  22740. continue;
  22741. }
  22742. k += 2;
  22743. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22744. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  22745. }
  22746. map[charCode] = String.fromCodePoint.apply(String, str);
  22747. });
  22748. return new _to_unicode_map.ToUnicodeMap(map);
  22749. }, reason => {
  22750. if (reason instanceof _util.AbortException) {
  22751. return null;
  22752. }
  22753. if (this.options.ignoreErrors) {
  22754. this.handler.send("UnsupportedFeature", {
  22755. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  22756. });
  22757. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  22758. return null;
  22759. }
  22760. throw reason;
  22761. });
  22762. }
  22763. return Promise.resolve(null);
  22764. }
  22765. readCidToGidMap(glyphsData, toUnicode) {
  22766. const result = [];
  22767. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  22768. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  22769. const code = j >> 1;
  22770. if (glyphID === 0 && !toUnicode.has(code)) {
  22771. continue;
  22772. }
  22773. result[code] = glyphID;
  22774. }
  22775. return result;
  22776. }
  22777. extractWidths(dict, descriptor, properties) {
  22778. const xref = this.xref;
  22779. let glyphsWidths = [];
  22780. let defaultWidth = 0;
  22781. const glyphsVMetrics = [];
  22782. let defaultVMetrics;
  22783. let i, ii, j, jj, start, code, widths;
  22784. if (properties.composite) {
  22785. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  22786. widths = dict.get("W");
  22787. if (widths) {
  22788. for (i = 0, ii = widths.length; i < ii; i++) {
  22789. start = xref.fetchIfRef(widths[i++]);
  22790. code = xref.fetchIfRef(widths[i]);
  22791. if (Array.isArray(code)) {
  22792. for (j = 0, jj = code.length; j < jj; j++) {
  22793. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  22794. }
  22795. } else {
  22796. const width = xref.fetchIfRef(widths[++i]);
  22797. for (j = start; j <= code; j++) {
  22798. glyphsWidths[j] = width;
  22799. }
  22800. }
  22801. }
  22802. }
  22803. if (properties.vertical) {
  22804. let vmetrics = dict.getArray("DW2") || [880, -1000];
  22805. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  22806. vmetrics = dict.get("W2");
  22807. if (vmetrics) {
  22808. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  22809. start = xref.fetchIfRef(vmetrics[i++]);
  22810. code = xref.fetchIfRef(vmetrics[i]);
  22811. if (Array.isArray(code)) {
  22812. for (j = 0, jj = code.length; j < jj; j++) {
  22813. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  22814. }
  22815. } else {
  22816. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  22817. for (j = start; j <= code; j++) {
  22818. glyphsVMetrics[j] = vmetric;
  22819. }
  22820. }
  22821. }
  22822. }
  22823. }
  22824. } else {
  22825. const firstChar = properties.firstChar;
  22826. widths = dict.get("Widths");
  22827. if (widths) {
  22828. j = firstChar;
  22829. for (i = 0, ii = widths.length; i < ii; i++) {
  22830. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  22831. }
  22832. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  22833. } else {
  22834. const baseFontName = dict.get("BaseFont");
  22835. if (baseFontName instanceof _primitives.Name) {
  22836. const metrics = this.getBaseFontMetrics(baseFontName.name);
  22837. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  22838. defaultWidth = metrics.defaultWidth;
  22839. }
  22840. }
  22841. }
  22842. let isMonospace = true;
  22843. let firstWidth = defaultWidth;
  22844. for (const glyph in glyphsWidths) {
  22845. const glyphWidth = glyphsWidths[glyph];
  22846. if (!glyphWidth) {
  22847. continue;
  22848. }
  22849. if (!firstWidth) {
  22850. firstWidth = glyphWidth;
  22851. continue;
  22852. }
  22853. if (firstWidth !== glyphWidth) {
  22854. isMonospace = false;
  22855. break;
  22856. }
  22857. }
  22858. if (isMonospace) {
  22859. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  22860. }
  22861. properties.defaultWidth = defaultWidth;
  22862. properties.widths = glyphsWidths;
  22863. properties.defaultVMetrics = defaultVMetrics;
  22864. properties.vmetrics = glyphsVMetrics;
  22865. }
  22866. isSerifFont(baseFontName) {
  22867. const fontNameWoStyle = baseFontName.split("-")[0];
  22868. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  22869. }
  22870. getBaseFontMetrics(name) {
  22871. let defaultWidth = 0;
  22872. let widths = Object.create(null);
  22873. let monospace = false;
  22874. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  22875. let lookupName = stdFontMap[name] || name;
  22876. const Metrics = (0, _metrics.getMetrics)();
  22877. if (!(lookupName in Metrics)) {
  22878. if (this.isSerifFont(name)) {
  22879. lookupName = "Times-Roman";
  22880. } else {
  22881. lookupName = "Helvetica";
  22882. }
  22883. }
  22884. const glyphWidths = Metrics[lookupName];
  22885. if (typeof glyphWidths === "number") {
  22886. defaultWidth = glyphWidths;
  22887. monospace = true;
  22888. } else {
  22889. widths = glyphWidths();
  22890. }
  22891. return {
  22892. defaultWidth,
  22893. monospace,
  22894. widths
  22895. };
  22896. }
  22897. buildCharCodeToWidth(widthsByGlyphName, properties) {
  22898. const widths = Object.create(null);
  22899. const differences = properties.differences;
  22900. const encoding = properties.defaultEncoding;
  22901. for (let charCode = 0; charCode < 256; charCode++) {
  22902. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  22903. widths[charCode] = widthsByGlyphName[differences[charCode]];
  22904. continue;
  22905. }
  22906. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  22907. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  22908. continue;
  22909. }
  22910. }
  22911. return widths;
  22912. }
  22913. preEvaluateFont(dict) {
  22914. const baseDict = dict;
  22915. let type = dict.get("Subtype");
  22916. if (!(type instanceof _primitives.Name)) {
  22917. throw new _util.FormatError("invalid font Subtype");
  22918. }
  22919. let composite = false;
  22920. let hash, toUnicode;
  22921. if (type.name === "Type0") {
  22922. const df = dict.get("DescendantFonts");
  22923. if (!df) {
  22924. throw new _util.FormatError("Descendant fonts are not specified");
  22925. }
  22926. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  22927. if (!(dict instanceof _primitives.Dict)) {
  22928. throw new _util.FormatError("Descendant font is not a dictionary.");
  22929. }
  22930. type = dict.get("Subtype");
  22931. if (!(type instanceof _primitives.Name)) {
  22932. throw new _util.FormatError("invalid font Subtype");
  22933. }
  22934. composite = true;
  22935. }
  22936. const firstChar = dict.get("FirstChar") || 0,
  22937. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  22938. const descriptor = dict.get("FontDescriptor");
  22939. if (descriptor) {
  22940. hash = new _murmurhash.MurmurHash3_64();
  22941. const encoding = baseDict.getRaw("Encoding");
  22942. if (encoding instanceof _primitives.Name) {
  22943. hash.update(encoding.name);
  22944. } else if (encoding instanceof _primitives.Ref) {
  22945. hash.update(encoding.toString());
  22946. } else if (encoding instanceof _primitives.Dict) {
  22947. for (const entry of encoding.getRawValues()) {
  22948. if (entry instanceof _primitives.Name) {
  22949. hash.update(entry.name);
  22950. } else if (entry instanceof _primitives.Ref) {
  22951. hash.update(entry.toString());
  22952. } else if (Array.isArray(entry)) {
  22953. const diffLength = entry.length,
  22954. diffBuf = new Array(diffLength);
  22955. for (let j = 0; j < diffLength; j++) {
  22956. const diffEntry = entry[j];
  22957. if (diffEntry instanceof _primitives.Name) {
  22958. diffBuf[j] = diffEntry.name;
  22959. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  22960. diffBuf[j] = diffEntry.toString();
  22961. }
  22962. }
  22963. hash.update(diffBuf.join());
  22964. }
  22965. }
  22966. }
  22967. hash.update(`${firstChar}-${lastChar}`);
  22968. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  22969. if (toUnicode instanceof _base_stream.BaseStream) {
  22970. const stream = toUnicode.str || toUnicode;
  22971. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  22972. hash.update(uint8array);
  22973. } else if (toUnicode instanceof _primitives.Name) {
  22974. hash.update(toUnicode.name);
  22975. }
  22976. const widths = dict.get("Widths") || baseDict.get("Widths");
  22977. if (Array.isArray(widths)) {
  22978. const widthsBuf = [];
  22979. for (const entry of widths) {
  22980. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  22981. widthsBuf.push(entry.toString());
  22982. }
  22983. }
  22984. hash.update(widthsBuf.join());
  22985. }
  22986. if (composite) {
  22987. hash.update("compositeFont");
  22988. const compositeWidths = dict.get("W") || baseDict.get("W");
  22989. if (Array.isArray(compositeWidths)) {
  22990. const widthsBuf = [];
  22991. for (const entry of compositeWidths) {
  22992. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  22993. widthsBuf.push(entry.toString());
  22994. } else if (Array.isArray(entry)) {
  22995. const subWidthsBuf = [];
  22996. for (const element of entry) {
  22997. if (typeof element === "number" || element instanceof _primitives.Ref) {
  22998. subWidthsBuf.push(element.toString());
  22999. }
  23000. }
  23001. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  23002. }
  23003. }
  23004. hash.update(widthsBuf.join());
  23005. }
  23006. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  23007. if (cidToGidMap instanceof _primitives.Name) {
  23008. hash.update(cidToGidMap.name);
  23009. } else if (cidToGidMap instanceof _primitives.Ref) {
  23010. hash.update(cidToGidMap.toString());
  23011. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  23012. hash.update(cidToGidMap.peekBytes());
  23013. }
  23014. }
  23015. }
  23016. return {
  23017. descriptor,
  23018. dict,
  23019. baseDict,
  23020. composite,
  23021. type: type.name,
  23022. firstChar,
  23023. lastChar,
  23024. toUnicode,
  23025. hash: hash ? hash.hexdigest() : ""
  23026. };
  23027. }
  23028. async translateFont({
  23029. descriptor,
  23030. dict,
  23031. baseDict,
  23032. composite,
  23033. type,
  23034. firstChar,
  23035. lastChar,
  23036. toUnicode,
  23037. cssFontInfo
  23038. }) {
  23039. const isType3Font = type === "Type3";
  23040. let properties;
  23041. if (!descriptor) {
  23042. if (isType3Font) {
  23043. descriptor = new _primitives.Dict(null);
  23044. descriptor.set("FontName", _primitives.Name.get(type));
  23045. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  23046. } else {
  23047. let baseFontName = dict.get("BaseFont");
  23048. if (!(baseFontName instanceof _primitives.Name)) {
  23049. throw new _util.FormatError("Base font is not specified");
  23050. }
  23051. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  23052. const metrics = this.getBaseFontMetrics(baseFontName);
  23053. const fontNameWoStyle = baseFontName.split("-")[0];
  23054. 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);
  23055. properties = {
  23056. type,
  23057. name: baseFontName,
  23058. loadedName: baseDict.loadedName,
  23059. widths: metrics.widths,
  23060. defaultWidth: metrics.defaultWidth,
  23061. isSimulatedFlags: true,
  23062. flags,
  23063. firstChar,
  23064. lastChar,
  23065. toUnicode,
  23066. xHeight: 0,
  23067. capHeight: 0,
  23068. italicAngle: 0,
  23069. isType3Font
  23070. };
  23071. const widths = dict.get("Widths");
  23072. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  23073. let file = null;
  23074. if (standardFontName) {
  23075. properties.isStandardFont = true;
  23076. file = await this.fetchStandardFontData(standardFontName);
  23077. properties.isInternalFont = !!file;
  23078. }
  23079. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  23080. if (widths) {
  23081. const glyphWidths = [];
  23082. let j = firstChar;
  23083. for (let i = 0, ii = widths.length; i < ii; i++) {
  23084. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  23085. }
  23086. newProperties.widths = glyphWidths;
  23087. } else {
  23088. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  23089. }
  23090. return new _fonts.Font(baseFontName, file, newProperties);
  23091. });
  23092. }
  23093. }
  23094. let fontName = descriptor.get("FontName");
  23095. let baseFont = dict.get("BaseFont");
  23096. if (typeof fontName === "string") {
  23097. fontName = _primitives.Name.get(fontName);
  23098. }
  23099. if (typeof baseFont === "string") {
  23100. baseFont = _primitives.Name.get(baseFont);
  23101. }
  23102. if (!isType3Font) {
  23103. const fontNameStr = fontName && fontName.name;
  23104. const baseFontStr = baseFont && baseFont.name;
  23105. if (fontNameStr !== baseFontStr) {
  23106. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  23107. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  23108. fontName = baseFont;
  23109. }
  23110. }
  23111. }
  23112. fontName = fontName || baseFont;
  23113. if (!(fontName instanceof _primitives.Name)) {
  23114. throw new _util.FormatError("invalid font name");
  23115. }
  23116. let fontFile, subtype, length1, length2, length3;
  23117. try {
  23118. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  23119. } catch (ex) {
  23120. if (!this.options.ignoreErrors) {
  23121. throw ex;
  23122. }
  23123. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  23124. fontFile = new _stream.NullStream();
  23125. }
  23126. let isStandardFont = false;
  23127. let isInternalFont = false;
  23128. let glyphScaleFactors = null;
  23129. if (fontFile) {
  23130. if (fontFile.dict) {
  23131. const subtypeEntry = fontFile.dict.get("Subtype");
  23132. if (subtypeEntry instanceof _primitives.Name) {
  23133. subtype = subtypeEntry.name;
  23134. }
  23135. length1 = fontFile.dict.get("Length1");
  23136. length2 = fontFile.dict.get("Length2");
  23137. length3 = fontFile.dict.get("Length3");
  23138. }
  23139. } else if (cssFontInfo) {
  23140. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  23141. if (standardFontName) {
  23142. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  23143. cssFontInfo.metrics = standardFontName.metrics || null;
  23144. glyphScaleFactors = standardFontName.factors || null;
  23145. fontFile = await this.fetchStandardFontData(standardFontName.name);
  23146. isInternalFont = !!fontFile;
  23147. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  23148. composite = true;
  23149. }
  23150. } else if (!isType3Font) {
  23151. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  23152. if (standardFontName) {
  23153. isStandardFont = true;
  23154. fontFile = await this.fetchStandardFontData(standardFontName);
  23155. isInternalFont = !!fontFile;
  23156. }
  23157. }
  23158. properties = {
  23159. type,
  23160. name: fontName.name,
  23161. subtype,
  23162. file: fontFile,
  23163. length1,
  23164. length2,
  23165. length3,
  23166. isStandardFont,
  23167. isInternalFont,
  23168. loadedName: baseDict.loadedName,
  23169. composite,
  23170. fixedPitch: false,
  23171. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  23172. firstChar,
  23173. lastChar,
  23174. toUnicode,
  23175. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  23176. ascent: descriptor.get("Ascent"),
  23177. descent: descriptor.get("Descent"),
  23178. xHeight: descriptor.get("XHeight") || 0,
  23179. capHeight: descriptor.get("CapHeight") || 0,
  23180. flags: descriptor.get("Flags"),
  23181. italicAngle: descriptor.get("ItalicAngle") || 0,
  23182. isType3Font,
  23183. cssFontInfo,
  23184. scaleFactors: glyphScaleFactors
  23185. };
  23186. if (composite) {
  23187. const cidEncoding = baseDict.get("Encoding");
  23188. if (cidEncoding instanceof _primitives.Name) {
  23189. properties.cidEncoding = cidEncoding.name;
  23190. }
  23191. const cMap = await _cmap.CMapFactory.create({
  23192. encoding: cidEncoding,
  23193. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  23194. useCMap: null
  23195. });
  23196. properties.cMap = cMap;
  23197. properties.vertical = properties.cMap.vertical;
  23198. }
  23199. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  23200. this.extractWidths(dict, descriptor, newProperties);
  23201. return new _fonts.Font(fontName.name, fontFile, newProperties);
  23202. });
  23203. }
  23204. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  23205. function buildPath(fontChar) {
  23206. const glyphName = `${font.loadedName}_path_${fontChar}`;
  23207. try {
  23208. if (font.renderer.hasBuiltPath(fontChar)) {
  23209. return;
  23210. }
  23211. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  23212. } catch (reason) {
  23213. if (evaluatorOptions.ignoreErrors) {
  23214. handler.send("UnsupportedFeature", {
  23215. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  23216. });
  23217. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  23218. return;
  23219. }
  23220. throw reason;
  23221. }
  23222. }
  23223. for (const glyph of glyphs) {
  23224. buildPath(glyph.fontChar);
  23225. const accent = glyph.accent;
  23226. if (accent && accent.fontChar) {
  23227. buildPath(accent.fontChar);
  23228. }
  23229. }
  23230. }
  23231. static get fallbackFontDict() {
  23232. const dict = new _primitives.Dict();
  23233. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  23234. dict.set("Type", _primitives.Name.get("FallbackType"));
  23235. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  23236. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  23237. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  23238. }
  23239. }
  23240. exports.PartialEvaluator = PartialEvaluator;
  23241. class TranslatedFont {
  23242. constructor({
  23243. loadedName,
  23244. font,
  23245. dict,
  23246. evaluatorOptions
  23247. }) {
  23248. this.loadedName = loadedName;
  23249. this.font = font;
  23250. this.dict = dict;
  23251. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  23252. this.type3Loaded = null;
  23253. this.type3Dependencies = font.isType3Font ? new Set() : null;
  23254. this.sent = false;
  23255. }
  23256. send(handler) {
  23257. if (this.sent) {
  23258. return;
  23259. }
  23260. this.sent = true;
  23261. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  23262. }
  23263. fallback(handler) {
  23264. if (!this.font.data) {
  23265. return;
  23266. }
  23267. this.font.disableFontFace = true;
  23268. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  23269. }
  23270. loadType3Data(evaluator, resources, task) {
  23271. if (this.type3Loaded) {
  23272. return this.type3Loaded;
  23273. }
  23274. if (!this.font.isType3Font) {
  23275. throw new Error("Must be a Type3 font.");
  23276. }
  23277. const type3Evaluator = evaluator.clone({
  23278. ignoreErrors: false
  23279. });
  23280. type3Evaluator.parsingType3Font = true;
  23281. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  23282. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  23283. type3FontRefs.put(this.dict.objId);
  23284. }
  23285. type3Evaluator.type3FontRefs = type3FontRefs;
  23286. const translatedFont = this.font,
  23287. type3Dependencies = this.type3Dependencies;
  23288. let loadCharProcsPromise = Promise.resolve();
  23289. const charProcs = this.dict.get("CharProcs");
  23290. const fontResources = this.dict.get("Resources") || resources;
  23291. const charProcOperatorList = Object.create(null);
  23292. const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]);
  23293. for (const key of charProcs.getKeys()) {
  23294. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  23295. const glyphStream = charProcs.get(key);
  23296. const operatorList = new _operator_list.OperatorList();
  23297. return type3Evaluator.getOperatorList({
  23298. stream: glyphStream,
  23299. task,
  23300. resources: fontResources,
  23301. operatorList
  23302. }).then(() => {
  23303. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  23304. this._removeType3ColorOperators(operatorList, isEmptyBBox);
  23305. }
  23306. charProcOperatorList[key] = operatorList.getIR();
  23307. for (const dependency of operatorList.dependencies) {
  23308. type3Dependencies.add(dependency);
  23309. }
  23310. }).catch(function (reason) {
  23311. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  23312. const dummyOperatorList = new _operator_list.OperatorList();
  23313. charProcOperatorList[key] = dummyOperatorList.getIR();
  23314. });
  23315. });
  23316. }
  23317. this.type3Loaded = loadCharProcsPromise.then(() => {
  23318. translatedFont.charProcOperatorList = charProcOperatorList;
  23319. if (this._bbox) {
  23320. translatedFont.isCharBBox = true;
  23321. translatedFont.bbox = this._bbox;
  23322. }
  23323. });
  23324. return this.type3Loaded;
  23325. }
  23326. _removeType3ColorOperators(operatorList, isEmptyBBox = false) {
  23327. if (isEmptyBBox) {
  23328. if (!this._bbox) {
  23329. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  23330. }
  23331. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2));
  23332. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  23333. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  23334. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  23335. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  23336. }
  23337. let i = 1,
  23338. ii = operatorList.length;
  23339. while (i < ii) {
  23340. switch (operatorList.fnArray[i]) {
  23341. case _util.OPS.setStrokeColorSpace:
  23342. case _util.OPS.setFillColorSpace:
  23343. case _util.OPS.setStrokeColor:
  23344. case _util.OPS.setStrokeColorN:
  23345. case _util.OPS.setFillColor:
  23346. case _util.OPS.setFillColorN:
  23347. case _util.OPS.setStrokeGray:
  23348. case _util.OPS.setFillGray:
  23349. case _util.OPS.setStrokeRGBColor:
  23350. case _util.OPS.setFillRGBColor:
  23351. case _util.OPS.setStrokeCMYKColor:
  23352. case _util.OPS.setFillCMYKColor:
  23353. case _util.OPS.shadingFill:
  23354. case _util.OPS.setRenderingIntent:
  23355. operatorList.fnArray.splice(i, 1);
  23356. operatorList.argsArray.splice(i, 1);
  23357. ii--;
  23358. continue;
  23359. case _util.OPS.setGState:
  23360. const [gStateObj] = operatorList.argsArray[i];
  23361. let j = 0,
  23362. jj = gStateObj.length;
  23363. while (j < jj) {
  23364. const [gStateKey] = gStateObj[j];
  23365. switch (gStateKey) {
  23366. case "TR":
  23367. case "TR2":
  23368. case "HT":
  23369. case "BG":
  23370. case "BG2":
  23371. case "UCR":
  23372. case "UCR2":
  23373. gStateObj.splice(j, 1);
  23374. jj--;
  23375. continue;
  23376. }
  23377. j++;
  23378. }
  23379. break;
  23380. }
  23381. i++;
  23382. }
  23383. }
  23384. }
  23385. class StateManager {
  23386. constructor(initialState = new EvalState()) {
  23387. this.state = initialState;
  23388. this.stateStack = [];
  23389. }
  23390. save() {
  23391. const old = this.state;
  23392. this.stateStack.push(this.state);
  23393. this.state = old.clone();
  23394. }
  23395. restore() {
  23396. const prev = this.stateStack.pop();
  23397. if (prev) {
  23398. this.state = prev;
  23399. }
  23400. }
  23401. transform(args) {
  23402. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  23403. }
  23404. }
  23405. class TextState {
  23406. constructor() {
  23407. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23408. this.fontName = null;
  23409. this.fontSize = 0;
  23410. this.font = null;
  23411. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  23412. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  23413. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  23414. this.charSpacing = 0;
  23415. this.wordSpacing = 0;
  23416. this.leading = 0;
  23417. this.textHScale = 1;
  23418. this.textRise = 0;
  23419. }
  23420. setTextMatrix(a, b, c, d, e, f) {
  23421. const m = this.textMatrix;
  23422. m[0] = a;
  23423. m[1] = b;
  23424. m[2] = c;
  23425. m[3] = d;
  23426. m[4] = e;
  23427. m[5] = f;
  23428. }
  23429. setTextLineMatrix(a, b, c, d, e, f) {
  23430. const m = this.textLineMatrix;
  23431. m[0] = a;
  23432. m[1] = b;
  23433. m[2] = c;
  23434. m[3] = d;
  23435. m[4] = e;
  23436. m[5] = f;
  23437. }
  23438. translateTextMatrix(x, y) {
  23439. const m = this.textMatrix;
  23440. m[4] = m[0] * x + m[2] * y + m[4];
  23441. m[5] = m[1] * x + m[3] * y + m[5];
  23442. }
  23443. translateTextLineMatrix(x, y) {
  23444. const m = this.textLineMatrix;
  23445. m[4] = m[0] * x + m[2] * y + m[4];
  23446. m[5] = m[1] * x + m[3] * y + m[5];
  23447. }
  23448. carriageReturn() {
  23449. this.translateTextLineMatrix(0, -this.leading);
  23450. this.textMatrix = this.textLineMatrix.slice();
  23451. }
  23452. clone() {
  23453. const clone = Object.create(this);
  23454. clone.textMatrix = this.textMatrix.slice();
  23455. clone.textLineMatrix = this.textLineMatrix.slice();
  23456. clone.fontMatrix = this.fontMatrix.slice();
  23457. return clone;
  23458. }
  23459. }
  23460. class EvalState {
  23461. constructor() {
  23462. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23463. this.font = null;
  23464. this.textRenderingMode = _util.TextRenderingMode.FILL;
  23465. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  23466. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  23467. }
  23468. clone() {
  23469. return Object.create(this);
  23470. }
  23471. }
  23472. class EvaluatorPreprocessor {
  23473. static get opMap() {
  23474. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  23475. t.w = {
  23476. id: _util.OPS.setLineWidth,
  23477. numArgs: 1,
  23478. variableArgs: false
  23479. };
  23480. t.J = {
  23481. id: _util.OPS.setLineCap,
  23482. numArgs: 1,
  23483. variableArgs: false
  23484. };
  23485. t.j = {
  23486. id: _util.OPS.setLineJoin,
  23487. numArgs: 1,
  23488. variableArgs: false
  23489. };
  23490. t.M = {
  23491. id: _util.OPS.setMiterLimit,
  23492. numArgs: 1,
  23493. variableArgs: false
  23494. };
  23495. t.d = {
  23496. id: _util.OPS.setDash,
  23497. numArgs: 2,
  23498. variableArgs: false
  23499. };
  23500. t.ri = {
  23501. id: _util.OPS.setRenderingIntent,
  23502. numArgs: 1,
  23503. variableArgs: false
  23504. };
  23505. t.i = {
  23506. id: _util.OPS.setFlatness,
  23507. numArgs: 1,
  23508. variableArgs: false
  23509. };
  23510. t.gs = {
  23511. id: _util.OPS.setGState,
  23512. numArgs: 1,
  23513. variableArgs: false
  23514. };
  23515. t.q = {
  23516. id: _util.OPS.save,
  23517. numArgs: 0,
  23518. variableArgs: false
  23519. };
  23520. t.Q = {
  23521. id: _util.OPS.restore,
  23522. numArgs: 0,
  23523. variableArgs: false
  23524. };
  23525. t.cm = {
  23526. id: _util.OPS.transform,
  23527. numArgs: 6,
  23528. variableArgs: false
  23529. };
  23530. t.m = {
  23531. id: _util.OPS.moveTo,
  23532. numArgs: 2,
  23533. variableArgs: false
  23534. };
  23535. t.l = {
  23536. id: _util.OPS.lineTo,
  23537. numArgs: 2,
  23538. variableArgs: false
  23539. };
  23540. t.c = {
  23541. id: _util.OPS.curveTo,
  23542. numArgs: 6,
  23543. variableArgs: false
  23544. };
  23545. t.v = {
  23546. id: _util.OPS.curveTo2,
  23547. numArgs: 4,
  23548. variableArgs: false
  23549. };
  23550. t.y = {
  23551. id: _util.OPS.curveTo3,
  23552. numArgs: 4,
  23553. variableArgs: false
  23554. };
  23555. t.h = {
  23556. id: _util.OPS.closePath,
  23557. numArgs: 0,
  23558. variableArgs: false
  23559. };
  23560. t.re = {
  23561. id: _util.OPS.rectangle,
  23562. numArgs: 4,
  23563. variableArgs: false
  23564. };
  23565. t.S = {
  23566. id: _util.OPS.stroke,
  23567. numArgs: 0,
  23568. variableArgs: false
  23569. };
  23570. t.s = {
  23571. id: _util.OPS.closeStroke,
  23572. numArgs: 0,
  23573. variableArgs: false
  23574. };
  23575. t.f = {
  23576. id: _util.OPS.fill,
  23577. numArgs: 0,
  23578. variableArgs: false
  23579. };
  23580. t.F = {
  23581. id: _util.OPS.fill,
  23582. numArgs: 0,
  23583. variableArgs: false
  23584. };
  23585. t["f*"] = {
  23586. id: _util.OPS.eoFill,
  23587. numArgs: 0,
  23588. variableArgs: false
  23589. };
  23590. t.B = {
  23591. id: _util.OPS.fillStroke,
  23592. numArgs: 0,
  23593. variableArgs: false
  23594. };
  23595. t["B*"] = {
  23596. id: _util.OPS.eoFillStroke,
  23597. numArgs: 0,
  23598. variableArgs: false
  23599. };
  23600. t.b = {
  23601. id: _util.OPS.closeFillStroke,
  23602. numArgs: 0,
  23603. variableArgs: false
  23604. };
  23605. t["b*"] = {
  23606. id: _util.OPS.closeEOFillStroke,
  23607. numArgs: 0,
  23608. variableArgs: false
  23609. };
  23610. t.n = {
  23611. id: _util.OPS.endPath,
  23612. numArgs: 0,
  23613. variableArgs: false
  23614. };
  23615. t.W = {
  23616. id: _util.OPS.clip,
  23617. numArgs: 0,
  23618. variableArgs: false
  23619. };
  23620. t["W*"] = {
  23621. id: _util.OPS.eoClip,
  23622. numArgs: 0,
  23623. variableArgs: false
  23624. };
  23625. t.BT = {
  23626. id: _util.OPS.beginText,
  23627. numArgs: 0,
  23628. variableArgs: false
  23629. };
  23630. t.ET = {
  23631. id: _util.OPS.endText,
  23632. numArgs: 0,
  23633. variableArgs: false
  23634. };
  23635. t.Tc = {
  23636. id: _util.OPS.setCharSpacing,
  23637. numArgs: 1,
  23638. variableArgs: false
  23639. };
  23640. t.Tw = {
  23641. id: _util.OPS.setWordSpacing,
  23642. numArgs: 1,
  23643. variableArgs: false
  23644. };
  23645. t.Tz = {
  23646. id: _util.OPS.setHScale,
  23647. numArgs: 1,
  23648. variableArgs: false
  23649. };
  23650. t.TL = {
  23651. id: _util.OPS.setLeading,
  23652. numArgs: 1,
  23653. variableArgs: false
  23654. };
  23655. t.Tf = {
  23656. id: _util.OPS.setFont,
  23657. numArgs: 2,
  23658. variableArgs: false
  23659. };
  23660. t.Tr = {
  23661. id: _util.OPS.setTextRenderingMode,
  23662. numArgs: 1,
  23663. variableArgs: false
  23664. };
  23665. t.Ts = {
  23666. id: _util.OPS.setTextRise,
  23667. numArgs: 1,
  23668. variableArgs: false
  23669. };
  23670. t.Td = {
  23671. id: _util.OPS.moveText,
  23672. numArgs: 2,
  23673. variableArgs: false
  23674. };
  23675. t.TD = {
  23676. id: _util.OPS.setLeadingMoveText,
  23677. numArgs: 2,
  23678. variableArgs: false
  23679. };
  23680. t.Tm = {
  23681. id: _util.OPS.setTextMatrix,
  23682. numArgs: 6,
  23683. variableArgs: false
  23684. };
  23685. t["T*"] = {
  23686. id: _util.OPS.nextLine,
  23687. numArgs: 0,
  23688. variableArgs: false
  23689. };
  23690. t.Tj = {
  23691. id: _util.OPS.showText,
  23692. numArgs: 1,
  23693. variableArgs: false
  23694. };
  23695. t.TJ = {
  23696. id: _util.OPS.showSpacedText,
  23697. numArgs: 1,
  23698. variableArgs: false
  23699. };
  23700. t["'"] = {
  23701. id: _util.OPS.nextLineShowText,
  23702. numArgs: 1,
  23703. variableArgs: false
  23704. };
  23705. t['"'] = {
  23706. id: _util.OPS.nextLineSetSpacingShowText,
  23707. numArgs: 3,
  23708. variableArgs: false
  23709. };
  23710. t.d0 = {
  23711. id: _util.OPS.setCharWidth,
  23712. numArgs: 2,
  23713. variableArgs: false
  23714. };
  23715. t.d1 = {
  23716. id: _util.OPS.setCharWidthAndBounds,
  23717. numArgs: 6,
  23718. variableArgs: false
  23719. };
  23720. t.CS = {
  23721. id: _util.OPS.setStrokeColorSpace,
  23722. numArgs: 1,
  23723. variableArgs: false
  23724. };
  23725. t.cs = {
  23726. id: _util.OPS.setFillColorSpace,
  23727. numArgs: 1,
  23728. variableArgs: false
  23729. };
  23730. t.SC = {
  23731. id: _util.OPS.setStrokeColor,
  23732. numArgs: 4,
  23733. variableArgs: true
  23734. };
  23735. t.SCN = {
  23736. id: _util.OPS.setStrokeColorN,
  23737. numArgs: 33,
  23738. variableArgs: true
  23739. };
  23740. t.sc = {
  23741. id: _util.OPS.setFillColor,
  23742. numArgs: 4,
  23743. variableArgs: true
  23744. };
  23745. t.scn = {
  23746. id: _util.OPS.setFillColorN,
  23747. numArgs: 33,
  23748. variableArgs: true
  23749. };
  23750. t.G = {
  23751. id: _util.OPS.setStrokeGray,
  23752. numArgs: 1,
  23753. variableArgs: false
  23754. };
  23755. t.g = {
  23756. id: _util.OPS.setFillGray,
  23757. numArgs: 1,
  23758. variableArgs: false
  23759. };
  23760. t.RG = {
  23761. id: _util.OPS.setStrokeRGBColor,
  23762. numArgs: 3,
  23763. variableArgs: false
  23764. };
  23765. t.rg = {
  23766. id: _util.OPS.setFillRGBColor,
  23767. numArgs: 3,
  23768. variableArgs: false
  23769. };
  23770. t.K = {
  23771. id: _util.OPS.setStrokeCMYKColor,
  23772. numArgs: 4,
  23773. variableArgs: false
  23774. };
  23775. t.k = {
  23776. id: _util.OPS.setFillCMYKColor,
  23777. numArgs: 4,
  23778. variableArgs: false
  23779. };
  23780. t.sh = {
  23781. id: _util.OPS.shadingFill,
  23782. numArgs: 1,
  23783. variableArgs: false
  23784. };
  23785. t.BI = {
  23786. id: _util.OPS.beginInlineImage,
  23787. numArgs: 0,
  23788. variableArgs: false
  23789. };
  23790. t.ID = {
  23791. id: _util.OPS.beginImageData,
  23792. numArgs: 0,
  23793. variableArgs: false
  23794. };
  23795. t.EI = {
  23796. id: _util.OPS.endInlineImage,
  23797. numArgs: 1,
  23798. variableArgs: false
  23799. };
  23800. t.Do = {
  23801. id: _util.OPS.paintXObject,
  23802. numArgs: 1,
  23803. variableArgs: false
  23804. };
  23805. t.MP = {
  23806. id: _util.OPS.markPoint,
  23807. numArgs: 1,
  23808. variableArgs: false
  23809. };
  23810. t.DP = {
  23811. id: _util.OPS.markPointProps,
  23812. numArgs: 2,
  23813. variableArgs: false
  23814. };
  23815. t.BMC = {
  23816. id: _util.OPS.beginMarkedContent,
  23817. numArgs: 1,
  23818. variableArgs: false
  23819. };
  23820. t.BDC = {
  23821. id: _util.OPS.beginMarkedContentProps,
  23822. numArgs: 2,
  23823. variableArgs: false
  23824. };
  23825. t.EMC = {
  23826. id: _util.OPS.endMarkedContent,
  23827. numArgs: 0,
  23828. variableArgs: false
  23829. };
  23830. t.BX = {
  23831. id: _util.OPS.beginCompat,
  23832. numArgs: 0,
  23833. variableArgs: false
  23834. };
  23835. t.EX = {
  23836. id: _util.OPS.endCompat,
  23837. numArgs: 0,
  23838. variableArgs: false
  23839. };
  23840. t.BM = null;
  23841. t.BD = null;
  23842. t.true = null;
  23843. t.fa = null;
  23844. t.fal = null;
  23845. t.fals = null;
  23846. t.false = null;
  23847. t.nu = null;
  23848. t.nul = null;
  23849. t.null = null;
  23850. });
  23851. return (0, _util.shadow)(this, "opMap", getOPMap());
  23852. }
  23853. static get MAX_INVALID_PATH_OPS() {
  23854. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  23855. }
  23856. constructor(stream, xref, stateManager = new StateManager()) {
  23857. this.parser = new _parser.Parser({
  23858. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  23859. xref
  23860. });
  23861. this.stateManager = stateManager;
  23862. this.nonProcessedArgs = [];
  23863. this._numInvalidPathOPS = 0;
  23864. }
  23865. get savedStatesDepth() {
  23866. return this.stateManager.stateStack.length;
  23867. }
  23868. read(operation) {
  23869. let args = operation.args;
  23870. while (true) {
  23871. const obj = this.parser.getObj();
  23872. if (obj instanceof _primitives.Cmd) {
  23873. const cmd = obj.cmd;
  23874. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  23875. if (!opSpec) {
  23876. (0, _util.warn)(`Unknown command "${cmd}".`);
  23877. continue;
  23878. }
  23879. const fn = opSpec.id;
  23880. const numArgs = opSpec.numArgs;
  23881. let argsLength = args !== null ? args.length : 0;
  23882. if (!opSpec.variableArgs) {
  23883. if (argsLength !== numArgs) {
  23884. const nonProcessedArgs = this.nonProcessedArgs;
  23885. while (argsLength > numArgs) {
  23886. nonProcessedArgs.push(args.shift());
  23887. argsLength--;
  23888. }
  23889. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  23890. if (args === null) {
  23891. args = [];
  23892. }
  23893. args.unshift(nonProcessedArgs.pop());
  23894. argsLength++;
  23895. }
  23896. }
  23897. if (argsLength < numArgs) {
  23898. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  23899. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  23900. throw new _util.FormatError(`Invalid ${partialMsg}`);
  23901. }
  23902. (0, _util.warn)(`Skipping ${partialMsg}`);
  23903. if (args !== null) {
  23904. args.length = 0;
  23905. }
  23906. continue;
  23907. }
  23908. } else if (argsLength > numArgs) {
  23909. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  23910. }
  23911. this.preprocessCommand(fn, args);
  23912. operation.fn = fn;
  23913. operation.args = args;
  23914. return true;
  23915. }
  23916. if (obj === _primitives.EOF) {
  23917. return false;
  23918. }
  23919. if (obj !== null) {
  23920. if (args === null) {
  23921. args = [];
  23922. }
  23923. args.push(obj);
  23924. if (args.length > 33) {
  23925. throw new _util.FormatError("Too many arguments");
  23926. }
  23927. }
  23928. }
  23929. }
  23930. preprocessCommand(fn, args) {
  23931. switch (fn | 0) {
  23932. case _util.OPS.save:
  23933. this.stateManager.save();
  23934. break;
  23935. case _util.OPS.restore:
  23936. this.stateManager.restore();
  23937. break;
  23938. case _util.OPS.transform:
  23939. this.stateManager.transform(args);
  23940. break;
  23941. }
  23942. }
  23943. }
  23944. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  23945. /***/ }),
  23946. /* 26 */
  23947. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23948. Object.defineProperty(exports, "__esModule", ({
  23949. value: true
  23950. }));
  23951. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  23952. var _util = __w_pdfjs_require__(2);
  23953. var _primitives = __w_pdfjs_require__(5);
  23954. var _base_stream = __w_pdfjs_require__(9);
  23955. var _parser = __w_pdfjs_require__(27);
  23956. var _core_utils = __w_pdfjs_require__(8);
  23957. var _stream = __w_pdfjs_require__(10);
  23958. 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"];
  23959. const MAX_MAP_RANGE = 2 ** 24 - 1;
  23960. class CMap {
  23961. constructor(builtInCMap = false) {
  23962. this.codespaceRanges = [[], [], [], []];
  23963. this.numCodespaceRanges = 0;
  23964. this._map = [];
  23965. this.name = "";
  23966. this.vertical = false;
  23967. this.useCMap = null;
  23968. this.builtInCMap = builtInCMap;
  23969. }
  23970. addCodespaceRange(n, low, high) {
  23971. this.codespaceRanges[n - 1].push(low, high);
  23972. this.numCodespaceRanges++;
  23973. }
  23974. mapCidRange(low, high, dstLow) {
  23975. if (high - low > MAX_MAP_RANGE) {
  23976. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  23977. }
  23978. while (low <= high) {
  23979. this._map[low++] = dstLow++;
  23980. }
  23981. }
  23982. mapBfRange(low, high, dstLow) {
  23983. if (high - low > MAX_MAP_RANGE) {
  23984. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  23985. }
  23986. const lastByte = dstLow.length - 1;
  23987. while (low <= high) {
  23988. this._map[low++] = dstLow;
  23989. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  23990. if (nextCharCode > 0xff) {
  23991. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  23992. continue;
  23993. }
  23994. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  23995. }
  23996. }
  23997. mapBfRangeToArray(low, high, array) {
  23998. if (high - low > MAX_MAP_RANGE) {
  23999. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  24000. }
  24001. const ii = array.length;
  24002. let i = 0;
  24003. while (low <= high && i < ii) {
  24004. this._map[low] = array[i++];
  24005. ++low;
  24006. }
  24007. }
  24008. mapOne(src, dst) {
  24009. this._map[src] = dst;
  24010. }
  24011. lookup(code) {
  24012. return this._map[code];
  24013. }
  24014. contains(code) {
  24015. return this._map[code] !== undefined;
  24016. }
  24017. forEach(callback) {
  24018. const map = this._map;
  24019. const length = map.length;
  24020. if (length <= 0x10000) {
  24021. for (let i = 0; i < length; i++) {
  24022. if (map[i] !== undefined) {
  24023. callback(i, map[i]);
  24024. }
  24025. }
  24026. } else {
  24027. for (const i in map) {
  24028. callback(i, map[i]);
  24029. }
  24030. }
  24031. }
  24032. charCodeOf(value) {
  24033. const map = this._map;
  24034. if (map.length <= 0x10000) {
  24035. return map.indexOf(value);
  24036. }
  24037. for (const charCode in map) {
  24038. if (map[charCode] === value) {
  24039. return charCode | 0;
  24040. }
  24041. }
  24042. return -1;
  24043. }
  24044. getMap() {
  24045. return this._map;
  24046. }
  24047. readCharCode(str, offset, out) {
  24048. let c = 0;
  24049. const codespaceRanges = this.codespaceRanges;
  24050. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  24051. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  24052. const codespaceRange = codespaceRanges[n];
  24053. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  24054. const low = codespaceRange[k++];
  24055. const high = codespaceRange[k++];
  24056. if (c >= low && c <= high) {
  24057. out.charcode = c;
  24058. out.length = n + 1;
  24059. return;
  24060. }
  24061. }
  24062. }
  24063. out.charcode = 0;
  24064. out.length = 1;
  24065. }
  24066. getCharCodeLength(charCode) {
  24067. const codespaceRanges = this.codespaceRanges;
  24068. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  24069. const codespaceRange = codespaceRanges[n];
  24070. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  24071. const low = codespaceRange[k++];
  24072. const high = codespaceRange[k++];
  24073. if (charCode >= low && charCode <= high) {
  24074. return n + 1;
  24075. }
  24076. }
  24077. }
  24078. return 1;
  24079. }
  24080. get length() {
  24081. return this._map.length;
  24082. }
  24083. get isIdentityCMap() {
  24084. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  24085. return false;
  24086. }
  24087. if (this._map.length !== 0x10000) {
  24088. return false;
  24089. }
  24090. for (let i = 0; i < 0x10000; i++) {
  24091. if (this._map[i] !== i) {
  24092. return false;
  24093. }
  24094. }
  24095. return true;
  24096. }
  24097. }
  24098. exports.CMap = CMap;
  24099. class IdentityCMap extends CMap {
  24100. constructor(vertical, n) {
  24101. super();
  24102. this.vertical = vertical;
  24103. this.addCodespaceRange(n, 0, 0xffff);
  24104. }
  24105. mapCidRange(low, high, dstLow) {
  24106. (0, _util.unreachable)("should not call mapCidRange");
  24107. }
  24108. mapBfRange(low, high, dstLow) {
  24109. (0, _util.unreachable)("should not call mapBfRange");
  24110. }
  24111. mapBfRangeToArray(low, high, array) {
  24112. (0, _util.unreachable)("should not call mapBfRangeToArray");
  24113. }
  24114. mapOne(src, dst) {
  24115. (0, _util.unreachable)("should not call mapCidOne");
  24116. }
  24117. lookup(code) {
  24118. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  24119. }
  24120. contains(code) {
  24121. return Number.isInteger(code) && code <= 0xffff;
  24122. }
  24123. forEach(callback) {
  24124. for (let i = 0; i <= 0xffff; i++) {
  24125. callback(i, i);
  24126. }
  24127. }
  24128. charCodeOf(value) {
  24129. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  24130. }
  24131. getMap() {
  24132. const map = new Array(0x10000);
  24133. for (let i = 0; i <= 0xffff; i++) {
  24134. map[i] = i;
  24135. }
  24136. return map;
  24137. }
  24138. get length() {
  24139. return 0x10000;
  24140. }
  24141. get isIdentityCMap() {
  24142. (0, _util.unreachable)("should not access .isIdentityCMap");
  24143. }
  24144. }
  24145. exports.IdentityCMap = IdentityCMap;
  24146. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  24147. function hexToInt(a, size) {
  24148. let n = 0;
  24149. for (let i = 0; i <= size; i++) {
  24150. n = n << 8 | a[i];
  24151. }
  24152. return n >>> 0;
  24153. }
  24154. function hexToStr(a, size) {
  24155. if (size === 1) {
  24156. return String.fromCharCode(a[0], a[1]);
  24157. }
  24158. if (size === 3) {
  24159. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  24160. }
  24161. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  24162. }
  24163. function addHex(a, b, size) {
  24164. let c = 0;
  24165. for (let i = size; i >= 0; i--) {
  24166. c += a[i] + b[i];
  24167. a[i] = c & 255;
  24168. c >>= 8;
  24169. }
  24170. }
  24171. function incHex(a, size) {
  24172. let c = 1;
  24173. for (let i = size; i >= 0 && c > 0; i--) {
  24174. c += a[i];
  24175. a[i] = c & 255;
  24176. c >>= 8;
  24177. }
  24178. }
  24179. const MAX_NUM_SIZE = 16;
  24180. const MAX_ENCODED_NUM_SIZE = 19;
  24181. class BinaryCMapStream {
  24182. constructor(data) {
  24183. this.buffer = data;
  24184. this.pos = 0;
  24185. this.end = data.length;
  24186. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  24187. }
  24188. readByte() {
  24189. if (this.pos >= this.end) {
  24190. return -1;
  24191. }
  24192. return this.buffer[this.pos++];
  24193. }
  24194. readNumber() {
  24195. let n = 0;
  24196. let last;
  24197. do {
  24198. const b = this.readByte();
  24199. if (b < 0) {
  24200. throw new _util.FormatError("unexpected EOF in bcmap");
  24201. }
  24202. last = !(b & 0x80);
  24203. n = n << 7 | b & 0x7f;
  24204. } while (!last);
  24205. return n;
  24206. }
  24207. readSigned() {
  24208. const n = this.readNumber();
  24209. return n & 1 ? ~(n >>> 1) : n >>> 1;
  24210. }
  24211. readHex(num, size) {
  24212. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  24213. this.pos += size + 1;
  24214. }
  24215. readHexNumber(num, size) {
  24216. let last;
  24217. const stack = this.tmpBuf;
  24218. let sp = 0;
  24219. do {
  24220. const b = this.readByte();
  24221. if (b < 0) {
  24222. throw new _util.FormatError("unexpected EOF in bcmap");
  24223. }
  24224. last = !(b & 0x80);
  24225. stack[sp++] = b & 0x7f;
  24226. } while (!last);
  24227. let i = size,
  24228. buffer = 0,
  24229. bufferSize = 0;
  24230. while (i >= 0) {
  24231. while (bufferSize < 8 && stack.length > 0) {
  24232. buffer |= stack[--sp] << bufferSize;
  24233. bufferSize += 7;
  24234. }
  24235. num[i] = buffer & 255;
  24236. i--;
  24237. buffer >>= 8;
  24238. bufferSize -= 8;
  24239. }
  24240. }
  24241. readHexSigned(num, size) {
  24242. this.readHexNumber(num, size);
  24243. const sign = num[size] & 1 ? 255 : 0;
  24244. let c = 0;
  24245. for (let i = 0; i <= size; i++) {
  24246. c = (c & 1) << 8 | num[i];
  24247. num[i] = c >> 1 ^ sign;
  24248. }
  24249. }
  24250. readString() {
  24251. const len = this.readNumber();
  24252. let s = "";
  24253. for (let i = 0; i < len; i++) {
  24254. s += String.fromCharCode(this.readNumber());
  24255. }
  24256. return s;
  24257. }
  24258. }
  24259. class BinaryCMapReader {
  24260. async process(data, cMap, extend) {
  24261. const stream = new BinaryCMapStream(data);
  24262. const header = stream.readByte();
  24263. cMap.vertical = !!(header & 1);
  24264. let useCMap = null;
  24265. const start = new Uint8Array(MAX_NUM_SIZE);
  24266. const end = new Uint8Array(MAX_NUM_SIZE);
  24267. const char = new Uint8Array(MAX_NUM_SIZE);
  24268. const charCode = new Uint8Array(MAX_NUM_SIZE);
  24269. const tmp = new Uint8Array(MAX_NUM_SIZE);
  24270. let code;
  24271. let b;
  24272. while ((b = stream.readByte()) >= 0) {
  24273. const type = b >> 5;
  24274. if (type === 7) {
  24275. switch (b & 0x1f) {
  24276. case 0:
  24277. stream.readString();
  24278. break;
  24279. case 1:
  24280. useCMap = stream.readString();
  24281. break;
  24282. }
  24283. continue;
  24284. }
  24285. const sequence = !!(b & 0x10);
  24286. const dataSize = b & 15;
  24287. if (dataSize + 1 > MAX_NUM_SIZE) {
  24288. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  24289. }
  24290. const ucs2DataSize = 1;
  24291. const subitemsCount = stream.readNumber();
  24292. switch (type) {
  24293. case 0:
  24294. stream.readHex(start, dataSize);
  24295. stream.readHexNumber(end, dataSize);
  24296. addHex(end, start, dataSize);
  24297. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24298. for (let i = 1; i < subitemsCount; i++) {
  24299. incHex(end, dataSize);
  24300. stream.readHexNumber(start, dataSize);
  24301. addHex(start, end, dataSize);
  24302. stream.readHexNumber(end, dataSize);
  24303. addHex(end, start, dataSize);
  24304. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24305. }
  24306. break;
  24307. case 1:
  24308. stream.readHex(start, dataSize);
  24309. stream.readHexNumber(end, dataSize);
  24310. addHex(end, start, dataSize);
  24311. stream.readNumber();
  24312. for (let i = 1; i < subitemsCount; i++) {
  24313. incHex(end, dataSize);
  24314. stream.readHexNumber(start, dataSize);
  24315. addHex(start, end, dataSize);
  24316. stream.readHexNumber(end, dataSize);
  24317. addHex(end, start, dataSize);
  24318. stream.readNumber();
  24319. }
  24320. break;
  24321. case 2:
  24322. stream.readHex(char, dataSize);
  24323. code = stream.readNumber();
  24324. cMap.mapOne(hexToInt(char, dataSize), code);
  24325. for (let i = 1; i < subitemsCount; i++) {
  24326. incHex(char, dataSize);
  24327. if (!sequence) {
  24328. stream.readHexNumber(tmp, dataSize);
  24329. addHex(char, tmp, dataSize);
  24330. }
  24331. code = stream.readSigned() + (code + 1);
  24332. cMap.mapOne(hexToInt(char, dataSize), code);
  24333. }
  24334. break;
  24335. case 3:
  24336. stream.readHex(start, dataSize);
  24337. stream.readHexNumber(end, dataSize);
  24338. addHex(end, start, dataSize);
  24339. code = stream.readNumber();
  24340. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24341. for (let i = 1; i < subitemsCount; i++) {
  24342. incHex(end, dataSize);
  24343. if (!sequence) {
  24344. stream.readHexNumber(start, dataSize);
  24345. addHex(start, end, dataSize);
  24346. } else {
  24347. start.set(end);
  24348. }
  24349. stream.readHexNumber(end, dataSize);
  24350. addHex(end, start, dataSize);
  24351. code = stream.readNumber();
  24352. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24353. }
  24354. break;
  24355. case 4:
  24356. stream.readHex(char, ucs2DataSize);
  24357. stream.readHex(charCode, dataSize);
  24358. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24359. for (let i = 1; i < subitemsCount; i++) {
  24360. incHex(char, ucs2DataSize);
  24361. if (!sequence) {
  24362. stream.readHexNumber(tmp, ucs2DataSize);
  24363. addHex(char, tmp, ucs2DataSize);
  24364. }
  24365. incHex(charCode, dataSize);
  24366. stream.readHexSigned(tmp, dataSize);
  24367. addHex(charCode, tmp, dataSize);
  24368. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24369. }
  24370. break;
  24371. case 5:
  24372. stream.readHex(start, ucs2DataSize);
  24373. stream.readHexNumber(end, ucs2DataSize);
  24374. addHex(end, start, ucs2DataSize);
  24375. stream.readHex(charCode, dataSize);
  24376. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24377. for (let i = 1; i < subitemsCount; i++) {
  24378. incHex(end, ucs2DataSize);
  24379. if (!sequence) {
  24380. stream.readHexNumber(start, ucs2DataSize);
  24381. addHex(start, end, ucs2DataSize);
  24382. } else {
  24383. start.set(end);
  24384. }
  24385. stream.readHexNumber(end, ucs2DataSize);
  24386. addHex(end, start, ucs2DataSize);
  24387. stream.readHex(charCode, dataSize);
  24388. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24389. }
  24390. break;
  24391. default:
  24392. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  24393. }
  24394. }
  24395. if (useCMap) {
  24396. return extend(useCMap);
  24397. }
  24398. return cMap;
  24399. }
  24400. }
  24401. return BinaryCMapReader;
  24402. }();
  24403. const CMapFactory = function CMapFactoryClosure() {
  24404. function strToInt(str) {
  24405. let a = 0;
  24406. for (let i = 0; i < str.length; i++) {
  24407. a = a << 8 | str.charCodeAt(i);
  24408. }
  24409. return a >>> 0;
  24410. }
  24411. function expectString(obj) {
  24412. if (typeof obj !== "string") {
  24413. throw new _util.FormatError("Malformed CMap: expected string.");
  24414. }
  24415. }
  24416. function expectInt(obj) {
  24417. if (!Number.isInteger(obj)) {
  24418. throw new _util.FormatError("Malformed CMap: expected int.");
  24419. }
  24420. }
  24421. function parseBfChar(cMap, lexer) {
  24422. while (true) {
  24423. let obj = lexer.getObj();
  24424. if (obj === _primitives.EOF) {
  24425. break;
  24426. }
  24427. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  24428. return;
  24429. }
  24430. expectString(obj);
  24431. const src = strToInt(obj);
  24432. obj = lexer.getObj();
  24433. expectString(obj);
  24434. const dst = obj;
  24435. cMap.mapOne(src, dst);
  24436. }
  24437. }
  24438. function parseBfRange(cMap, lexer) {
  24439. while (true) {
  24440. let obj = lexer.getObj();
  24441. if (obj === _primitives.EOF) {
  24442. break;
  24443. }
  24444. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  24445. return;
  24446. }
  24447. expectString(obj);
  24448. const low = strToInt(obj);
  24449. obj = lexer.getObj();
  24450. expectString(obj);
  24451. const high = strToInt(obj);
  24452. obj = lexer.getObj();
  24453. if (Number.isInteger(obj) || typeof obj === "string") {
  24454. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  24455. cMap.mapBfRange(low, high, dstLow);
  24456. } else if ((0, _primitives.isCmd)(obj, "[")) {
  24457. obj = lexer.getObj();
  24458. const array = [];
  24459. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  24460. array.push(obj);
  24461. obj = lexer.getObj();
  24462. }
  24463. cMap.mapBfRangeToArray(low, high, array);
  24464. } else {
  24465. break;
  24466. }
  24467. }
  24468. throw new _util.FormatError("Invalid bf range.");
  24469. }
  24470. function parseCidChar(cMap, lexer) {
  24471. while (true) {
  24472. let obj = lexer.getObj();
  24473. if (obj === _primitives.EOF) {
  24474. break;
  24475. }
  24476. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  24477. return;
  24478. }
  24479. expectString(obj);
  24480. const src = strToInt(obj);
  24481. obj = lexer.getObj();
  24482. expectInt(obj);
  24483. const dst = obj;
  24484. cMap.mapOne(src, dst);
  24485. }
  24486. }
  24487. function parseCidRange(cMap, lexer) {
  24488. while (true) {
  24489. let obj = lexer.getObj();
  24490. if (obj === _primitives.EOF) {
  24491. break;
  24492. }
  24493. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  24494. return;
  24495. }
  24496. expectString(obj);
  24497. const low = strToInt(obj);
  24498. obj = lexer.getObj();
  24499. expectString(obj);
  24500. const high = strToInt(obj);
  24501. obj = lexer.getObj();
  24502. expectInt(obj);
  24503. const dstLow = obj;
  24504. cMap.mapCidRange(low, high, dstLow);
  24505. }
  24506. }
  24507. function parseCodespaceRange(cMap, lexer) {
  24508. while (true) {
  24509. let obj = lexer.getObj();
  24510. if (obj === _primitives.EOF) {
  24511. break;
  24512. }
  24513. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  24514. return;
  24515. }
  24516. if (typeof obj !== "string") {
  24517. break;
  24518. }
  24519. const low = strToInt(obj);
  24520. obj = lexer.getObj();
  24521. if (typeof obj !== "string") {
  24522. break;
  24523. }
  24524. const high = strToInt(obj);
  24525. cMap.addCodespaceRange(obj.length, low, high);
  24526. }
  24527. throw new _util.FormatError("Invalid codespace range.");
  24528. }
  24529. function parseWMode(cMap, lexer) {
  24530. const obj = lexer.getObj();
  24531. if (Number.isInteger(obj)) {
  24532. cMap.vertical = !!obj;
  24533. }
  24534. }
  24535. function parseCMapName(cMap, lexer) {
  24536. const obj = lexer.getObj();
  24537. if (obj instanceof _primitives.Name) {
  24538. cMap.name = obj.name;
  24539. }
  24540. }
  24541. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  24542. let previous, embeddedUseCMap;
  24543. objLoop: while (true) {
  24544. try {
  24545. const obj = lexer.getObj();
  24546. if (obj === _primitives.EOF) {
  24547. break;
  24548. } else if (obj instanceof _primitives.Name) {
  24549. if (obj.name === "WMode") {
  24550. parseWMode(cMap, lexer);
  24551. } else if (obj.name === "CMapName") {
  24552. parseCMapName(cMap, lexer);
  24553. }
  24554. previous = obj;
  24555. } else if (obj instanceof _primitives.Cmd) {
  24556. switch (obj.cmd) {
  24557. case "endcmap":
  24558. break objLoop;
  24559. case "usecmap":
  24560. if (previous instanceof _primitives.Name) {
  24561. embeddedUseCMap = previous.name;
  24562. }
  24563. break;
  24564. case "begincodespacerange":
  24565. parseCodespaceRange(cMap, lexer);
  24566. break;
  24567. case "beginbfchar":
  24568. parseBfChar(cMap, lexer);
  24569. break;
  24570. case "begincidchar":
  24571. parseCidChar(cMap, lexer);
  24572. break;
  24573. case "beginbfrange":
  24574. parseBfRange(cMap, lexer);
  24575. break;
  24576. case "begincidrange":
  24577. parseCidRange(cMap, lexer);
  24578. break;
  24579. }
  24580. }
  24581. } catch (ex) {
  24582. if (ex instanceof _core_utils.MissingDataException) {
  24583. throw ex;
  24584. }
  24585. (0, _util.warn)("Invalid cMap data: " + ex);
  24586. continue;
  24587. }
  24588. }
  24589. if (!useCMap && embeddedUseCMap) {
  24590. useCMap = embeddedUseCMap;
  24591. }
  24592. if (useCMap) {
  24593. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24594. }
  24595. return cMap;
  24596. }
  24597. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  24598. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  24599. if (cMap.numCodespaceRanges === 0) {
  24600. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  24601. for (let i = 0; i < useCodespaceRanges.length; i++) {
  24602. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  24603. }
  24604. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  24605. }
  24606. cMap.useCMap.forEach(function (key, value) {
  24607. if (!cMap.contains(key)) {
  24608. cMap.mapOne(key, cMap.useCMap.lookup(key));
  24609. }
  24610. });
  24611. return cMap;
  24612. }
  24613. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  24614. if (name === "Identity-H") {
  24615. return new IdentityCMap(false, 2);
  24616. } else if (name === "Identity-V") {
  24617. return new IdentityCMap(true, 2);
  24618. }
  24619. if (!BUILT_IN_CMAPS.includes(name)) {
  24620. throw new Error("Unknown CMap name: " + name);
  24621. }
  24622. if (!fetchBuiltInCMap) {
  24623. throw new Error("Built-in CMap parameters are not provided.");
  24624. }
  24625. const {
  24626. cMapData,
  24627. compressionType
  24628. } = await fetchBuiltInCMap(name);
  24629. const cMap = new CMap(true);
  24630. if (compressionType === _util.CMapCompressionType.BINARY) {
  24631. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  24632. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24633. });
  24634. }
  24635. if (compressionType === _util.CMapCompressionType.NONE) {
  24636. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  24637. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  24638. }
  24639. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  24640. }
  24641. return {
  24642. async create(params) {
  24643. const encoding = params.encoding;
  24644. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  24645. const useCMap = params.useCMap;
  24646. if (encoding instanceof _primitives.Name) {
  24647. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  24648. } else if (encoding instanceof _base_stream.BaseStream) {
  24649. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  24650. if (parsedCMap.isIdentityCMap) {
  24651. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  24652. }
  24653. return parsedCMap;
  24654. }
  24655. throw new Error("Encoding required.");
  24656. }
  24657. };
  24658. }();
  24659. exports.CMapFactory = CMapFactory;
  24660. /***/ }),
  24661. /* 27 */
  24662. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24663. Object.defineProperty(exports, "__esModule", ({
  24664. value: true
  24665. }));
  24666. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  24667. var _util = __w_pdfjs_require__(2);
  24668. var _primitives = __w_pdfjs_require__(5);
  24669. var _core_utils = __w_pdfjs_require__(8);
  24670. var _ascii_85_stream = __w_pdfjs_require__(28);
  24671. var _ascii_hex_stream = __w_pdfjs_require__(30);
  24672. var _ccitt_stream = __w_pdfjs_require__(31);
  24673. var _flate_stream = __w_pdfjs_require__(33);
  24674. var _jbig2_stream = __w_pdfjs_require__(34);
  24675. var _jpeg_stream = __w_pdfjs_require__(37);
  24676. var _jpx_stream = __w_pdfjs_require__(39);
  24677. var _lzw_stream = __w_pdfjs_require__(41);
  24678. var _stream = __w_pdfjs_require__(10);
  24679. var _predictor_stream = __w_pdfjs_require__(42);
  24680. var _run_length_stream = __w_pdfjs_require__(43);
  24681. const MAX_LENGTH_TO_CACHE = 1000;
  24682. const MAX_ADLER32_LENGTH = 5552;
  24683. function computeAdler32(bytes) {
  24684. const bytesLength = bytes.length;
  24685. let a = 1,
  24686. b = 0;
  24687. for (let i = 0; i < bytesLength; ++i) {
  24688. a += bytes[i] & 0xff;
  24689. b += a;
  24690. }
  24691. return b % 65521 << 16 | a % 65521;
  24692. }
  24693. class Parser {
  24694. constructor({
  24695. lexer,
  24696. xref,
  24697. allowStreams = false,
  24698. recoveryMode = false
  24699. }) {
  24700. this.lexer = lexer;
  24701. this.xref = xref;
  24702. this.allowStreams = allowStreams;
  24703. this.recoveryMode = recoveryMode;
  24704. this.imageCache = Object.create(null);
  24705. this.refill();
  24706. }
  24707. refill() {
  24708. this.buf1 = this.lexer.getObj();
  24709. this.buf2 = this.lexer.getObj();
  24710. }
  24711. shift() {
  24712. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  24713. this.buf1 = this.buf2;
  24714. this.buf2 = null;
  24715. } else {
  24716. this.buf1 = this.buf2;
  24717. this.buf2 = this.lexer.getObj();
  24718. }
  24719. }
  24720. tryShift() {
  24721. try {
  24722. this.shift();
  24723. return true;
  24724. } catch (e) {
  24725. if (e instanceof _core_utils.MissingDataException) {
  24726. throw e;
  24727. }
  24728. return false;
  24729. }
  24730. }
  24731. getObj(cipherTransform = null) {
  24732. const buf1 = this.buf1;
  24733. this.shift();
  24734. if (buf1 instanceof _primitives.Cmd) {
  24735. switch (buf1.cmd) {
  24736. case "BI":
  24737. return this.makeInlineImage(cipherTransform);
  24738. case "[":
  24739. const array = [];
  24740. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  24741. array.push(this.getObj(cipherTransform));
  24742. }
  24743. if (this.buf1 === _primitives.EOF) {
  24744. if (this.recoveryMode) {
  24745. return array;
  24746. }
  24747. throw new _core_utils.ParserEOFException("End of file inside array.");
  24748. }
  24749. this.shift();
  24750. return array;
  24751. case "<<":
  24752. const dict = new _primitives.Dict(this.xref);
  24753. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  24754. if (!(this.buf1 instanceof _primitives.Name)) {
  24755. (0, _util.info)("Malformed dictionary: key must be a name object");
  24756. this.shift();
  24757. continue;
  24758. }
  24759. const key = this.buf1.name;
  24760. this.shift();
  24761. if (this.buf1 === _primitives.EOF) {
  24762. break;
  24763. }
  24764. dict.set(key, this.getObj(cipherTransform));
  24765. }
  24766. if (this.buf1 === _primitives.EOF) {
  24767. if (this.recoveryMode) {
  24768. return dict;
  24769. }
  24770. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  24771. }
  24772. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  24773. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  24774. }
  24775. this.shift();
  24776. return dict;
  24777. default:
  24778. return buf1;
  24779. }
  24780. }
  24781. if (Number.isInteger(buf1)) {
  24782. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  24783. const ref = _primitives.Ref.get(buf1, this.buf1);
  24784. this.shift();
  24785. this.shift();
  24786. return ref;
  24787. }
  24788. return buf1;
  24789. }
  24790. if (typeof buf1 === "string") {
  24791. if (cipherTransform) {
  24792. return cipherTransform.decryptString(buf1);
  24793. }
  24794. return buf1;
  24795. }
  24796. return buf1;
  24797. }
  24798. findDefaultInlineStreamEnd(stream) {
  24799. const E = 0x45,
  24800. I = 0x49,
  24801. SPACE = 0x20,
  24802. LF = 0xa,
  24803. CR = 0xd,
  24804. NUL = 0x0;
  24805. const lexer = this.lexer,
  24806. startPos = stream.pos,
  24807. n = 10;
  24808. let state = 0,
  24809. ch,
  24810. maybeEIPos;
  24811. while ((ch = stream.getByte()) !== -1) {
  24812. if (state === 0) {
  24813. state = ch === E ? 1 : 0;
  24814. } else if (state === 1) {
  24815. state = ch === I ? 2 : 0;
  24816. } else {
  24817. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  24818. if (ch === SPACE || ch === LF || ch === CR) {
  24819. maybeEIPos = stream.pos;
  24820. const followingBytes = stream.peekBytes(n);
  24821. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  24822. ch = followingBytes[i];
  24823. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  24824. continue;
  24825. }
  24826. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  24827. state = 0;
  24828. break;
  24829. }
  24830. }
  24831. if (state !== 2) {
  24832. continue;
  24833. }
  24834. if (lexer.knownCommands) {
  24835. const nextObj = lexer.peekObj();
  24836. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  24837. state = 0;
  24838. }
  24839. } else {
  24840. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  24841. }
  24842. if (state === 2) {
  24843. break;
  24844. }
  24845. } else {
  24846. state = 0;
  24847. }
  24848. }
  24849. }
  24850. if (ch === -1) {
  24851. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  24852. if (maybeEIPos) {
  24853. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  24854. stream.skip(-(stream.pos - maybeEIPos));
  24855. }
  24856. }
  24857. let endOffset = 4;
  24858. stream.skip(-endOffset);
  24859. ch = stream.peekByte();
  24860. stream.skip(endOffset);
  24861. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  24862. endOffset--;
  24863. }
  24864. return stream.pos - endOffset - startPos;
  24865. }
  24866. findDCTDecodeInlineStreamEnd(stream) {
  24867. const startPos = stream.pos;
  24868. let foundEOI = false,
  24869. b,
  24870. markerLength;
  24871. while ((b = stream.getByte()) !== -1) {
  24872. if (b !== 0xff) {
  24873. continue;
  24874. }
  24875. switch (stream.getByte()) {
  24876. case 0x00:
  24877. break;
  24878. case 0xff:
  24879. stream.skip(-1);
  24880. break;
  24881. case 0xd9:
  24882. foundEOI = true;
  24883. break;
  24884. case 0xc0:
  24885. case 0xc1:
  24886. case 0xc2:
  24887. case 0xc3:
  24888. case 0xc5:
  24889. case 0xc6:
  24890. case 0xc7:
  24891. case 0xc9:
  24892. case 0xca:
  24893. case 0xcb:
  24894. case 0xcd:
  24895. case 0xce:
  24896. case 0xcf:
  24897. case 0xc4:
  24898. case 0xcc:
  24899. case 0xda:
  24900. case 0xdb:
  24901. case 0xdc:
  24902. case 0xdd:
  24903. case 0xde:
  24904. case 0xdf:
  24905. case 0xe0:
  24906. case 0xe1:
  24907. case 0xe2:
  24908. case 0xe3:
  24909. case 0xe4:
  24910. case 0xe5:
  24911. case 0xe6:
  24912. case 0xe7:
  24913. case 0xe8:
  24914. case 0xe9:
  24915. case 0xea:
  24916. case 0xeb:
  24917. case 0xec:
  24918. case 0xed:
  24919. case 0xee:
  24920. case 0xef:
  24921. case 0xfe:
  24922. markerLength = stream.getUint16();
  24923. if (markerLength > 2) {
  24924. stream.skip(markerLength - 2);
  24925. } else {
  24926. stream.skip(-2);
  24927. }
  24928. break;
  24929. }
  24930. if (foundEOI) {
  24931. break;
  24932. }
  24933. }
  24934. const length = stream.pos - startPos;
  24935. if (b === -1) {
  24936. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  24937. stream.skip(-length);
  24938. return this.findDefaultInlineStreamEnd(stream);
  24939. }
  24940. this.inlineStreamSkipEI(stream);
  24941. return length;
  24942. }
  24943. findASCII85DecodeInlineStreamEnd(stream) {
  24944. const TILDE = 0x7e,
  24945. GT = 0x3e;
  24946. const startPos = stream.pos;
  24947. let ch;
  24948. while ((ch = stream.getByte()) !== -1) {
  24949. if (ch === TILDE) {
  24950. const tildePos = stream.pos;
  24951. ch = stream.peekByte();
  24952. while ((0, _core_utils.isWhiteSpace)(ch)) {
  24953. stream.skip();
  24954. ch = stream.peekByte();
  24955. }
  24956. if (ch === GT) {
  24957. stream.skip();
  24958. break;
  24959. }
  24960. if (stream.pos > tildePos) {
  24961. const maybeEI = stream.peekBytes(2);
  24962. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  24963. break;
  24964. }
  24965. }
  24966. }
  24967. }
  24968. const length = stream.pos - startPos;
  24969. if (ch === -1) {
  24970. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24971. stream.skip(-length);
  24972. return this.findDefaultInlineStreamEnd(stream);
  24973. }
  24974. this.inlineStreamSkipEI(stream);
  24975. return length;
  24976. }
  24977. findASCIIHexDecodeInlineStreamEnd(stream) {
  24978. const GT = 0x3e;
  24979. const startPos = stream.pos;
  24980. let ch;
  24981. while ((ch = stream.getByte()) !== -1) {
  24982. if (ch === GT) {
  24983. break;
  24984. }
  24985. }
  24986. const length = stream.pos - startPos;
  24987. if (ch === -1) {
  24988. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24989. stream.skip(-length);
  24990. return this.findDefaultInlineStreamEnd(stream);
  24991. }
  24992. this.inlineStreamSkipEI(stream);
  24993. return length;
  24994. }
  24995. inlineStreamSkipEI(stream) {
  24996. const E = 0x45,
  24997. I = 0x49;
  24998. let state = 0,
  24999. ch;
  25000. while ((ch = stream.getByte()) !== -1) {
  25001. if (state === 0) {
  25002. state = ch === E ? 1 : 0;
  25003. } else if (state === 1) {
  25004. state = ch === I ? 2 : 0;
  25005. } else if (state === 2) {
  25006. break;
  25007. }
  25008. }
  25009. }
  25010. makeInlineImage(cipherTransform) {
  25011. const lexer = this.lexer;
  25012. const stream = lexer.stream;
  25013. const dict = new _primitives.Dict(this.xref);
  25014. let dictLength;
  25015. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  25016. if (!(this.buf1 instanceof _primitives.Name)) {
  25017. throw new _util.FormatError("Dictionary key must be a name object");
  25018. }
  25019. const key = this.buf1.name;
  25020. this.shift();
  25021. if (this.buf1 === _primitives.EOF) {
  25022. break;
  25023. }
  25024. dict.set(key, this.getObj(cipherTransform));
  25025. }
  25026. if (lexer.beginInlineImagePos !== -1) {
  25027. dictLength = stream.pos - lexer.beginInlineImagePos;
  25028. }
  25029. const filter = dict.get("F", "Filter");
  25030. let filterName;
  25031. if (filter instanceof _primitives.Name) {
  25032. filterName = filter.name;
  25033. } else if (Array.isArray(filter)) {
  25034. const filterZero = this.xref.fetchIfRef(filter[0]);
  25035. if (filterZero instanceof _primitives.Name) {
  25036. filterName = filterZero.name;
  25037. }
  25038. }
  25039. const startPos = stream.pos;
  25040. let length;
  25041. switch (filterName) {
  25042. case "DCT":
  25043. case "DCTDecode":
  25044. length = this.findDCTDecodeInlineStreamEnd(stream);
  25045. break;
  25046. case "A85":
  25047. case "ASCII85Decode":
  25048. length = this.findASCII85DecodeInlineStreamEnd(stream);
  25049. break;
  25050. case "AHx":
  25051. case "ASCIIHexDecode":
  25052. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  25053. break;
  25054. default:
  25055. length = this.findDefaultInlineStreamEnd(stream);
  25056. }
  25057. let imageStream = stream.makeSubStream(startPos, length, dict);
  25058. let cacheKey;
  25059. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  25060. const imageBytes = imageStream.getBytes();
  25061. imageStream.reset();
  25062. const initialStreamPos = stream.pos;
  25063. stream.pos = lexer.beginInlineImagePos;
  25064. const dictBytes = stream.getBytes(dictLength);
  25065. stream.pos = initialStreamPos;
  25066. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  25067. const cacheEntry = this.imageCache[cacheKey];
  25068. if (cacheEntry !== undefined) {
  25069. this.buf2 = _primitives.Cmd.get("EI");
  25070. this.shift();
  25071. cacheEntry.reset();
  25072. return cacheEntry;
  25073. }
  25074. }
  25075. if (cipherTransform) {
  25076. imageStream = cipherTransform.createStream(imageStream, length);
  25077. }
  25078. imageStream = this.filter(imageStream, dict, length);
  25079. imageStream.dict = dict;
  25080. if (cacheKey !== undefined) {
  25081. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  25082. this.imageCache[cacheKey] = imageStream;
  25083. }
  25084. this.buf2 = _primitives.Cmd.get("EI");
  25085. this.shift();
  25086. return imageStream;
  25087. }
  25088. _findStreamLength(startPos, signature) {
  25089. const {
  25090. stream
  25091. } = this.lexer;
  25092. stream.pos = startPos;
  25093. const SCAN_BLOCK_LENGTH = 2048;
  25094. const signatureLength = signature.length;
  25095. while (stream.pos < stream.end) {
  25096. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  25097. const scanLength = scanBytes.length - signatureLength;
  25098. if (scanLength <= 0) {
  25099. break;
  25100. }
  25101. let pos = 0;
  25102. while (pos < scanLength) {
  25103. let j = 0;
  25104. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  25105. j++;
  25106. }
  25107. if (j >= signatureLength) {
  25108. stream.pos += pos;
  25109. return stream.pos - startPos;
  25110. }
  25111. pos++;
  25112. }
  25113. stream.pos += scanLength;
  25114. }
  25115. return -1;
  25116. }
  25117. makeStream(dict, cipherTransform) {
  25118. const lexer = this.lexer;
  25119. let stream = lexer.stream;
  25120. lexer.skipToNextLine();
  25121. const startPos = stream.pos - 1;
  25122. let length = dict.get("Length");
  25123. if (!Number.isInteger(length)) {
  25124. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  25125. length = 0;
  25126. }
  25127. stream.pos = startPos + length;
  25128. lexer.nextChar();
  25129. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  25130. this.shift();
  25131. } else {
  25132. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  25133. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  25134. if (actualLength < 0) {
  25135. const MAX_TRUNCATION = 1;
  25136. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  25137. const end = ENDSTREAM_SIGNATURE.length - i;
  25138. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  25139. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  25140. if (maybeLength >= 0) {
  25141. const lastByte = stream.peekBytes(end + 1)[end];
  25142. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  25143. break;
  25144. }
  25145. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  25146. actualLength = maybeLength;
  25147. break;
  25148. }
  25149. }
  25150. if (actualLength < 0) {
  25151. throw new _util.FormatError("Missing endstream command.");
  25152. }
  25153. }
  25154. length = actualLength;
  25155. lexer.nextChar();
  25156. this.shift();
  25157. this.shift();
  25158. }
  25159. this.shift();
  25160. stream = stream.makeSubStream(startPos, length, dict);
  25161. if (cipherTransform) {
  25162. stream = cipherTransform.createStream(stream, length);
  25163. }
  25164. stream = this.filter(stream, dict, length);
  25165. stream.dict = dict;
  25166. return stream;
  25167. }
  25168. filter(stream, dict, length) {
  25169. let filter = dict.get("F", "Filter");
  25170. let params = dict.get("DP", "DecodeParms");
  25171. if (filter instanceof _primitives.Name) {
  25172. if (Array.isArray(params)) {
  25173. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  25174. }
  25175. return this.makeFilter(stream, filter.name, length, params);
  25176. }
  25177. let maybeLength = length;
  25178. if (Array.isArray(filter)) {
  25179. const filterArray = filter;
  25180. const paramsArray = params;
  25181. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  25182. filter = this.xref.fetchIfRef(filterArray[i]);
  25183. if (!(filter instanceof _primitives.Name)) {
  25184. throw new _util.FormatError(`Bad filter name "${filter}"`);
  25185. }
  25186. params = null;
  25187. if (Array.isArray(paramsArray) && i in paramsArray) {
  25188. params = this.xref.fetchIfRef(paramsArray[i]);
  25189. }
  25190. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  25191. maybeLength = null;
  25192. }
  25193. }
  25194. return stream;
  25195. }
  25196. makeFilter(stream, name, maybeLength, params) {
  25197. if (maybeLength === 0) {
  25198. (0, _util.warn)(`Empty "${name}" stream.`);
  25199. return new _stream.NullStream();
  25200. }
  25201. const xrefStats = this.xref.stats;
  25202. try {
  25203. switch (name) {
  25204. case "Fl":
  25205. case "FlateDecode":
  25206. xrefStats.addStreamType(_util.StreamType.FLATE);
  25207. if (params) {
  25208. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  25209. }
  25210. return new _flate_stream.FlateStream(stream, maybeLength);
  25211. case "LZW":
  25212. case "LZWDecode":
  25213. xrefStats.addStreamType(_util.StreamType.LZW);
  25214. let earlyChange = 1;
  25215. if (params) {
  25216. if (params.has("EarlyChange")) {
  25217. earlyChange = params.get("EarlyChange");
  25218. }
  25219. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  25220. }
  25221. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  25222. case "DCT":
  25223. case "DCTDecode":
  25224. xrefStats.addStreamType(_util.StreamType.DCT);
  25225. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  25226. case "JPX":
  25227. case "JPXDecode":
  25228. xrefStats.addStreamType(_util.StreamType.JPX);
  25229. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  25230. case "A85":
  25231. case "ASCII85Decode":
  25232. xrefStats.addStreamType(_util.StreamType.A85);
  25233. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  25234. case "AHx":
  25235. case "ASCIIHexDecode":
  25236. xrefStats.addStreamType(_util.StreamType.AHX);
  25237. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  25238. case "CCF":
  25239. case "CCITTFaxDecode":
  25240. xrefStats.addStreamType(_util.StreamType.CCF);
  25241. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  25242. case "RL":
  25243. case "RunLengthDecode":
  25244. xrefStats.addStreamType(_util.StreamType.RLX);
  25245. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  25246. case "JBIG2Decode":
  25247. xrefStats.addStreamType(_util.StreamType.JBIG);
  25248. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  25249. }
  25250. (0, _util.warn)(`Filter "${name}" is not supported.`);
  25251. return stream;
  25252. } catch (ex) {
  25253. if (ex instanceof _core_utils.MissingDataException) {
  25254. throw ex;
  25255. }
  25256. (0, _util.warn)(`Invalid stream: "${ex}"`);
  25257. return new _stream.NullStream();
  25258. }
  25259. }
  25260. }
  25261. exports.Parser = Parser;
  25262. 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];
  25263. function toHexDigit(ch) {
  25264. if (ch >= 0x30 && ch <= 0x39) {
  25265. return ch & 0x0f;
  25266. }
  25267. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25268. return (ch & 0x0f) + 9;
  25269. }
  25270. return -1;
  25271. }
  25272. class Lexer {
  25273. constructor(stream, knownCommands = null) {
  25274. this.stream = stream;
  25275. this.nextChar();
  25276. this.strBuf = [];
  25277. this.knownCommands = knownCommands;
  25278. this._hexStringNumWarn = 0;
  25279. this.beginInlineImagePos = -1;
  25280. }
  25281. nextChar() {
  25282. return this.currentChar = this.stream.getByte();
  25283. }
  25284. peekChar() {
  25285. return this.stream.peekByte();
  25286. }
  25287. getNumber() {
  25288. let ch = this.currentChar;
  25289. let eNotation = false;
  25290. let divideBy = 0;
  25291. let sign = 0;
  25292. if (ch === 0x2d) {
  25293. sign = -1;
  25294. ch = this.nextChar();
  25295. if (ch === 0x2d) {
  25296. ch = this.nextChar();
  25297. }
  25298. } else if (ch === 0x2b) {
  25299. sign = 1;
  25300. ch = this.nextChar();
  25301. }
  25302. if (ch === 0x0a || ch === 0x0d) {
  25303. do {
  25304. ch = this.nextChar();
  25305. } while (ch === 0x0a || ch === 0x0d);
  25306. }
  25307. if (ch === 0x2e) {
  25308. divideBy = 10;
  25309. ch = this.nextChar();
  25310. }
  25311. if (ch < 0x30 || ch > 0x39) {
  25312. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  25313. if (divideBy === 10 && sign === 0) {
  25314. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  25315. return 0;
  25316. }
  25317. if (divideBy === 0 && sign === -1) {
  25318. (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero.");
  25319. return 0;
  25320. }
  25321. }
  25322. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  25323. }
  25324. sign = sign || 1;
  25325. let baseValue = ch - 0x30;
  25326. let powerValue = 0;
  25327. let powerValueSign = 1;
  25328. while ((ch = this.nextChar()) >= 0) {
  25329. if (ch >= 0x30 && ch <= 0x39) {
  25330. const currentDigit = ch - 0x30;
  25331. if (eNotation) {
  25332. powerValue = powerValue * 10 + currentDigit;
  25333. } else {
  25334. if (divideBy !== 0) {
  25335. divideBy *= 10;
  25336. }
  25337. baseValue = baseValue * 10 + currentDigit;
  25338. }
  25339. } else if (ch === 0x2e) {
  25340. if (divideBy === 0) {
  25341. divideBy = 1;
  25342. } else {
  25343. break;
  25344. }
  25345. } else if (ch === 0x2d) {
  25346. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  25347. } else if (ch === 0x45 || ch === 0x65) {
  25348. ch = this.peekChar();
  25349. if (ch === 0x2b || ch === 0x2d) {
  25350. powerValueSign = ch === 0x2d ? -1 : 1;
  25351. this.nextChar();
  25352. } else if (ch < 0x30 || ch > 0x39) {
  25353. break;
  25354. }
  25355. eNotation = true;
  25356. } else {
  25357. break;
  25358. }
  25359. }
  25360. if (divideBy !== 0) {
  25361. baseValue /= divideBy;
  25362. }
  25363. if (eNotation) {
  25364. baseValue *= 10 ** (powerValueSign * powerValue);
  25365. }
  25366. return sign * baseValue;
  25367. }
  25368. getString() {
  25369. let numParen = 1;
  25370. let done = false;
  25371. const strBuf = this.strBuf;
  25372. strBuf.length = 0;
  25373. let ch = this.nextChar();
  25374. while (true) {
  25375. let charBuffered = false;
  25376. switch (ch | 0) {
  25377. case -1:
  25378. (0, _util.warn)("Unterminated string");
  25379. done = true;
  25380. break;
  25381. case 0x28:
  25382. ++numParen;
  25383. strBuf.push("(");
  25384. break;
  25385. case 0x29:
  25386. if (--numParen === 0) {
  25387. this.nextChar();
  25388. done = true;
  25389. } else {
  25390. strBuf.push(")");
  25391. }
  25392. break;
  25393. case 0x5c:
  25394. ch = this.nextChar();
  25395. switch (ch) {
  25396. case -1:
  25397. (0, _util.warn)("Unterminated string");
  25398. done = true;
  25399. break;
  25400. case 0x6e:
  25401. strBuf.push("\n");
  25402. break;
  25403. case 0x72:
  25404. strBuf.push("\r");
  25405. break;
  25406. case 0x74:
  25407. strBuf.push("\t");
  25408. break;
  25409. case 0x62:
  25410. strBuf.push("\b");
  25411. break;
  25412. case 0x66:
  25413. strBuf.push("\f");
  25414. break;
  25415. case 0x5c:
  25416. case 0x28:
  25417. case 0x29:
  25418. strBuf.push(String.fromCharCode(ch));
  25419. break;
  25420. case 0x30:
  25421. case 0x31:
  25422. case 0x32:
  25423. case 0x33:
  25424. case 0x34:
  25425. case 0x35:
  25426. case 0x36:
  25427. case 0x37:
  25428. let x = ch & 0x0f;
  25429. ch = this.nextChar();
  25430. charBuffered = true;
  25431. if (ch >= 0x30 && ch <= 0x37) {
  25432. x = (x << 3) + (ch & 0x0f);
  25433. ch = this.nextChar();
  25434. if (ch >= 0x30 && ch <= 0x37) {
  25435. charBuffered = false;
  25436. x = (x << 3) + (ch & 0x0f);
  25437. }
  25438. }
  25439. strBuf.push(String.fromCharCode(x));
  25440. break;
  25441. case 0x0d:
  25442. if (this.peekChar() === 0x0a) {
  25443. this.nextChar();
  25444. }
  25445. break;
  25446. case 0x0a:
  25447. break;
  25448. default:
  25449. strBuf.push(String.fromCharCode(ch));
  25450. break;
  25451. }
  25452. break;
  25453. default:
  25454. strBuf.push(String.fromCharCode(ch));
  25455. break;
  25456. }
  25457. if (done) {
  25458. break;
  25459. }
  25460. if (!charBuffered) {
  25461. ch = this.nextChar();
  25462. }
  25463. }
  25464. return strBuf.join("");
  25465. }
  25466. getName() {
  25467. let ch, previousCh;
  25468. const strBuf = this.strBuf;
  25469. strBuf.length = 0;
  25470. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25471. if (ch === 0x23) {
  25472. ch = this.nextChar();
  25473. if (specialChars[ch]) {
  25474. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  25475. strBuf.push("#");
  25476. break;
  25477. }
  25478. const x = toHexDigit(ch);
  25479. if (x !== -1) {
  25480. previousCh = ch;
  25481. ch = this.nextChar();
  25482. const x2 = toHexDigit(ch);
  25483. if (x2 === -1) {
  25484. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  25485. strBuf.push("#", String.fromCharCode(previousCh));
  25486. if (specialChars[ch]) {
  25487. break;
  25488. }
  25489. strBuf.push(String.fromCharCode(ch));
  25490. continue;
  25491. }
  25492. strBuf.push(String.fromCharCode(x << 4 | x2));
  25493. } else {
  25494. strBuf.push("#", String.fromCharCode(ch));
  25495. }
  25496. } else {
  25497. strBuf.push(String.fromCharCode(ch));
  25498. }
  25499. }
  25500. if (strBuf.length > 127) {
  25501. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  25502. }
  25503. return _primitives.Name.get(strBuf.join(""));
  25504. }
  25505. _hexStringWarn(ch) {
  25506. const MAX_HEX_STRING_NUM_WARN = 5;
  25507. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  25508. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  25509. return;
  25510. }
  25511. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  25512. return;
  25513. }
  25514. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  25515. }
  25516. getHexString() {
  25517. const strBuf = this.strBuf;
  25518. strBuf.length = 0;
  25519. let ch = this.currentChar;
  25520. let isFirstHex = true;
  25521. let firstDigit, secondDigit;
  25522. this._hexStringNumWarn = 0;
  25523. while (true) {
  25524. if (ch < 0) {
  25525. (0, _util.warn)("Unterminated hex string");
  25526. break;
  25527. } else if (ch === 0x3e) {
  25528. this.nextChar();
  25529. break;
  25530. } else if (specialChars[ch] === 1) {
  25531. ch = this.nextChar();
  25532. continue;
  25533. } else {
  25534. if (isFirstHex) {
  25535. firstDigit = toHexDigit(ch);
  25536. if (firstDigit === -1) {
  25537. this._hexStringWarn(ch);
  25538. ch = this.nextChar();
  25539. continue;
  25540. }
  25541. } else {
  25542. secondDigit = toHexDigit(ch);
  25543. if (secondDigit === -1) {
  25544. this._hexStringWarn(ch);
  25545. ch = this.nextChar();
  25546. continue;
  25547. }
  25548. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  25549. }
  25550. isFirstHex = !isFirstHex;
  25551. ch = this.nextChar();
  25552. }
  25553. }
  25554. return strBuf.join("");
  25555. }
  25556. getObj() {
  25557. let comment = false;
  25558. let ch = this.currentChar;
  25559. while (true) {
  25560. if (ch < 0) {
  25561. return _primitives.EOF;
  25562. }
  25563. if (comment) {
  25564. if (ch === 0x0a || ch === 0x0d) {
  25565. comment = false;
  25566. }
  25567. } else if (ch === 0x25) {
  25568. comment = true;
  25569. } else if (specialChars[ch] !== 1) {
  25570. break;
  25571. }
  25572. ch = this.nextChar();
  25573. }
  25574. switch (ch | 0) {
  25575. case 0x30:
  25576. case 0x31:
  25577. case 0x32:
  25578. case 0x33:
  25579. case 0x34:
  25580. case 0x35:
  25581. case 0x36:
  25582. case 0x37:
  25583. case 0x38:
  25584. case 0x39:
  25585. case 0x2b:
  25586. case 0x2d:
  25587. case 0x2e:
  25588. return this.getNumber();
  25589. case 0x28:
  25590. return this.getString();
  25591. case 0x2f:
  25592. return this.getName();
  25593. case 0x5b:
  25594. this.nextChar();
  25595. return _primitives.Cmd.get("[");
  25596. case 0x5d:
  25597. this.nextChar();
  25598. return _primitives.Cmd.get("]");
  25599. case 0x3c:
  25600. ch = this.nextChar();
  25601. if (ch === 0x3c) {
  25602. this.nextChar();
  25603. return _primitives.Cmd.get("<<");
  25604. }
  25605. return this.getHexString();
  25606. case 0x3e:
  25607. ch = this.nextChar();
  25608. if (ch === 0x3e) {
  25609. this.nextChar();
  25610. return _primitives.Cmd.get(">>");
  25611. }
  25612. return _primitives.Cmd.get(">");
  25613. case 0x7b:
  25614. this.nextChar();
  25615. return _primitives.Cmd.get("{");
  25616. case 0x7d:
  25617. this.nextChar();
  25618. return _primitives.Cmd.get("}");
  25619. case 0x29:
  25620. this.nextChar();
  25621. throw new _util.FormatError(`Illegal character: ${ch}`);
  25622. }
  25623. let str = String.fromCharCode(ch);
  25624. if (ch < 0x20 || ch > 0x7f) {
  25625. const nextCh = this.peekChar();
  25626. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  25627. this.nextChar();
  25628. return _primitives.Cmd.get(str);
  25629. }
  25630. }
  25631. const knownCommands = this.knownCommands;
  25632. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25633. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25634. const possibleCommand = str + String.fromCharCode(ch);
  25635. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  25636. break;
  25637. }
  25638. if (str.length === 128) {
  25639. throw new _util.FormatError(`Command token too long: ${str.length}`);
  25640. }
  25641. str = possibleCommand;
  25642. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25643. }
  25644. if (str === "true") {
  25645. return true;
  25646. }
  25647. if (str === "false") {
  25648. return false;
  25649. }
  25650. if (str === "null") {
  25651. return null;
  25652. }
  25653. if (str === "BI") {
  25654. this.beginInlineImagePos = this.stream.pos;
  25655. }
  25656. return _primitives.Cmd.get(str);
  25657. }
  25658. peekObj() {
  25659. const streamPos = this.stream.pos,
  25660. currentChar = this.currentChar,
  25661. beginInlineImagePos = this.beginInlineImagePos;
  25662. let nextObj;
  25663. try {
  25664. nextObj = this.getObj();
  25665. } catch (ex) {
  25666. if (ex instanceof _core_utils.MissingDataException) {
  25667. throw ex;
  25668. }
  25669. (0, _util.warn)(`peekObj: ${ex}`);
  25670. }
  25671. this.stream.pos = streamPos;
  25672. this.currentChar = currentChar;
  25673. this.beginInlineImagePos = beginInlineImagePos;
  25674. return nextObj;
  25675. }
  25676. skipToNextLine() {
  25677. let ch = this.currentChar;
  25678. while (ch >= 0) {
  25679. if (ch === 0x0d) {
  25680. ch = this.nextChar();
  25681. if (ch === 0x0a) {
  25682. this.nextChar();
  25683. }
  25684. break;
  25685. } else if (ch === 0x0a) {
  25686. this.nextChar();
  25687. break;
  25688. }
  25689. ch = this.nextChar();
  25690. }
  25691. }
  25692. }
  25693. exports.Lexer = Lexer;
  25694. class Linearization {
  25695. static create(stream) {
  25696. function getInt(linDict, name, allowZeroValue = false) {
  25697. const obj = linDict.get(name);
  25698. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  25699. return obj;
  25700. }
  25701. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  25702. }
  25703. function getHints(linDict) {
  25704. const hints = linDict.get("H");
  25705. let hintsLength;
  25706. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  25707. for (let index = 0; index < hintsLength; index++) {
  25708. const hint = hints[index];
  25709. if (!(Number.isInteger(hint) && hint > 0)) {
  25710. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  25711. }
  25712. }
  25713. return hints;
  25714. }
  25715. throw new Error("Hint array in the linearization dictionary is invalid.");
  25716. }
  25717. const parser = new Parser({
  25718. lexer: new Lexer(stream),
  25719. xref: null
  25720. });
  25721. const obj1 = parser.getObj();
  25722. const obj2 = parser.getObj();
  25723. const obj3 = parser.getObj();
  25724. const linDict = parser.getObj();
  25725. let obj, length;
  25726. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  25727. return null;
  25728. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  25729. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  25730. }
  25731. return {
  25732. length,
  25733. hints: getHints(linDict),
  25734. objectNumberFirst: getInt(linDict, "O"),
  25735. endFirst: getInt(linDict, "E"),
  25736. numPages: getInt(linDict, "N"),
  25737. mainXRefEntriesOffset: getInt(linDict, "T"),
  25738. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  25739. };
  25740. }
  25741. }
  25742. exports.Linearization = Linearization;
  25743. /***/ }),
  25744. /* 28 */
  25745. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25746. Object.defineProperty(exports, "__esModule", ({
  25747. value: true
  25748. }));
  25749. exports.Ascii85Stream = void 0;
  25750. var _decode_stream = __w_pdfjs_require__(29);
  25751. var _core_utils = __w_pdfjs_require__(8);
  25752. class Ascii85Stream extends _decode_stream.DecodeStream {
  25753. constructor(str, maybeLength) {
  25754. if (maybeLength) {
  25755. maybeLength *= 0.8;
  25756. }
  25757. super(maybeLength);
  25758. this.str = str;
  25759. this.dict = str.dict;
  25760. this.input = new Uint8Array(5);
  25761. }
  25762. readBlock() {
  25763. const TILDA_CHAR = 0x7e;
  25764. const Z_LOWER_CHAR = 0x7a;
  25765. const EOF = -1;
  25766. const str = this.str;
  25767. let c = str.getByte();
  25768. while ((0, _core_utils.isWhiteSpace)(c)) {
  25769. c = str.getByte();
  25770. }
  25771. if (c === EOF || c === TILDA_CHAR) {
  25772. this.eof = true;
  25773. return;
  25774. }
  25775. const bufferLength = this.bufferLength;
  25776. let buffer, i;
  25777. if (c === Z_LOWER_CHAR) {
  25778. buffer = this.ensureBuffer(bufferLength + 4);
  25779. for (i = 0; i < 4; ++i) {
  25780. buffer[bufferLength + i] = 0;
  25781. }
  25782. this.bufferLength += 4;
  25783. } else {
  25784. const input = this.input;
  25785. input[0] = c;
  25786. for (i = 1; i < 5; ++i) {
  25787. c = str.getByte();
  25788. while ((0, _core_utils.isWhiteSpace)(c)) {
  25789. c = str.getByte();
  25790. }
  25791. input[i] = c;
  25792. if (c === EOF || c === TILDA_CHAR) {
  25793. break;
  25794. }
  25795. }
  25796. buffer = this.ensureBuffer(bufferLength + i - 1);
  25797. this.bufferLength += i - 1;
  25798. if (i < 5) {
  25799. for (; i < 5; ++i) {
  25800. input[i] = 0x21 + 84;
  25801. }
  25802. this.eof = true;
  25803. }
  25804. let t = 0;
  25805. for (i = 0; i < 5; ++i) {
  25806. t = t * 85 + (input[i] - 0x21);
  25807. }
  25808. for (i = 3; i >= 0; --i) {
  25809. buffer[bufferLength + i] = t & 0xff;
  25810. t >>= 8;
  25811. }
  25812. }
  25813. }
  25814. }
  25815. exports.Ascii85Stream = Ascii85Stream;
  25816. /***/ }),
  25817. /* 29 */
  25818. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25819. Object.defineProperty(exports, "__esModule", ({
  25820. value: true
  25821. }));
  25822. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  25823. var _base_stream = __w_pdfjs_require__(9);
  25824. var _stream = __w_pdfjs_require__(10);
  25825. const emptyBuffer = new Uint8Array(0);
  25826. class DecodeStream extends _base_stream.BaseStream {
  25827. constructor(maybeMinBufferLength) {
  25828. super();
  25829. this._rawMinBufferLength = maybeMinBufferLength || 0;
  25830. this.pos = 0;
  25831. this.bufferLength = 0;
  25832. this.eof = false;
  25833. this.buffer = emptyBuffer;
  25834. this.minBufferLength = 512;
  25835. if (maybeMinBufferLength) {
  25836. while (this.minBufferLength < maybeMinBufferLength) {
  25837. this.minBufferLength *= 2;
  25838. }
  25839. }
  25840. }
  25841. get isEmpty() {
  25842. while (!this.eof && this.bufferLength === 0) {
  25843. this.readBlock();
  25844. }
  25845. return this.bufferLength === 0;
  25846. }
  25847. ensureBuffer(requested) {
  25848. const buffer = this.buffer;
  25849. if (requested <= buffer.byteLength) {
  25850. return buffer;
  25851. }
  25852. let size = this.minBufferLength;
  25853. while (size < requested) {
  25854. size *= 2;
  25855. }
  25856. const buffer2 = new Uint8Array(size);
  25857. buffer2.set(buffer);
  25858. return this.buffer = buffer2;
  25859. }
  25860. getByte() {
  25861. const pos = this.pos;
  25862. while (this.bufferLength <= pos) {
  25863. if (this.eof) {
  25864. return -1;
  25865. }
  25866. this.readBlock();
  25867. }
  25868. return this.buffer[this.pos++];
  25869. }
  25870. getBytes(length) {
  25871. const pos = this.pos;
  25872. let end;
  25873. if (length) {
  25874. this.ensureBuffer(pos + length);
  25875. end = pos + length;
  25876. while (!this.eof && this.bufferLength < end) {
  25877. this.readBlock();
  25878. }
  25879. const bufEnd = this.bufferLength;
  25880. if (end > bufEnd) {
  25881. end = bufEnd;
  25882. }
  25883. } else {
  25884. while (!this.eof) {
  25885. this.readBlock();
  25886. }
  25887. end = this.bufferLength;
  25888. }
  25889. this.pos = end;
  25890. return this.buffer.subarray(pos, end);
  25891. }
  25892. reset() {
  25893. this.pos = 0;
  25894. }
  25895. makeSubStream(start, length, dict = null) {
  25896. if (length === undefined) {
  25897. while (!this.eof) {
  25898. this.readBlock();
  25899. }
  25900. } else {
  25901. const end = start + length;
  25902. while (this.bufferLength <= end && !this.eof) {
  25903. this.readBlock();
  25904. }
  25905. }
  25906. return new _stream.Stream(this.buffer, start, length, dict);
  25907. }
  25908. getBaseStreams() {
  25909. return this.str ? this.str.getBaseStreams() : null;
  25910. }
  25911. }
  25912. exports.DecodeStream = DecodeStream;
  25913. class StreamsSequenceStream extends DecodeStream {
  25914. constructor(streams, onError = null) {
  25915. let maybeLength = 0;
  25916. for (const stream of streams) {
  25917. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  25918. }
  25919. super(maybeLength);
  25920. this.streams = streams;
  25921. this._onError = onError;
  25922. }
  25923. readBlock() {
  25924. const streams = this.streams;
  25925. if (streams.length === 0) {
  25926. this.eof = true;
  25927. return;
  25928. }
  25929. const stream = streams.shift();
  25930. let chunk;
  25931. try {
  25932. chunk = stream.getBytes();
  25933. } catch (reason) {
  25934. if (this._onError) {
  25935. this._onError(reason, stream.dict && stream.dict.objId);
  25936. return;
  25937. }
  25938. throw reason;
  25939. }
  25940. const bufferLength = this.bufferLength;
  25941. const newLength = bufferLength + chunk.length;
  25942. const buffer = this.ensureBuffer(newLength);
  25943. buffer.set(chunk, bufferLength);
  25944. this.bufferLength = newLength;
  25945. }
  25946. getBaseStreams() {
  25947. const baseStreamsBuf = [];
  25948. for (const stream of this.streams) {
  25949. const baseStreams = stream.getBaseStreams();
  25950. if (baseStreams) {
  25951. baseStreamsBuf.push(...baseStreams);
  25952. }
  25953. }
  25954. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  25955. }
  25956. }
  25957. exports.StreamsSequenceStream = StreamsSequenceStream;
  25958. /***/ }),
  25959. /* 30 */
  25960. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25961. Object.defineProperty(exports, "__esModule", ({
  25962. value: true
  25963. }));
  25964. exports.AsciiHexStream = void 0;
  25965. var _decode_stream = __w_pdfjs_require__(29);
  25966. class AsciiHexStream extends _decode_stream.DecodeStream {
  25967. constructor(str, maybeLength) {
  25968. if (maybeLength) {
  25969. maybeLength *= 0.5;
  25970. }
  25971. super(maybeLength);
  25972. this.str = str;
  25973. this.dict = str.dict;
  25974. this.firstDigit = -1;
  25975. }
  25976. readBlock() {
  25977. const UPSTREAM_BLOCK_SIZE = 8000;
  25978. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  25979. if (!bytes.length) {
  25980. this.eof = true;
  25981. return;
  25982. }
  25983. const maxDecodeLength = bytes.length + 1 >> 1;
  25984. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  25985. let bufferLength = this.bufferLength;
  25986. let firstDigit = this.firstDigit;
  25987. for (const ch of bytes) {
  25988. let digit;
  25989. if (ch >= 0x30 && ch <= 0x39) {
  25990. digit = ch & 0x0f;
  25991. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25992. digit = (ch & 0x0f) + 9;
  25993. } else if (ch === 0x3e) {
  25994. this.eof = true;
  25995. break;
  25996. } else {
  25997. continue;
  25998. }
  25999. if (firstDigit < 0) {
  26000. firstDigit = digit;
  26001. } else {
  26002. buffer[bufferLength++] = firstDigit << 4 | digit;
  26003. firstDigit = -1;
  26004. }
  26005. }
  26006. if (firstDigit >= 0 && this.eof) {
  26007. buffer[bufferLength++] = firstDigit << 4;
  26008. firstDigit = -1;
  26009. }
  26010. this.firstDigit = firstDigit;
  26011. this.bufferLength = bufferLength;
  26012. }
  26013. }
  26014. exports.AsciiHexStream = AsciiHexStream;
  26015. /***/ }),
  26016. /* 31 */
  26017. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26018. Object.defineProperty(exports, "__esModule", ({
  26019. value: true
  26020. }));
  26021. exports.CCITTFaxStream = void 0;
  26022. var _ccitt = __w_pdfjs_require__(32);
  26023. var _decode_stream = __w_pdfjs_require__(29);
  26024. var _primitives = __w_pdfjs_require__(5);
  26025. class CCITTFaxStream extends _decode_stream.DecodeStream {
  26026. constructor(str, maybeLength, params) {
  26027. super(maybeLength);
  26028. this.str = str;
  26029. this.dict = str.dict;
  26030. if (!(params instanceof _primitives.Dict)) {
  26031. params = _primitives.Dict.empty;
  26032. }
  26033. const source = {
  26034. next() {
  26035. return str.getByte();
  26036. }
  26037. };
  26038. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  26039. K: params.get("K"),
  26040. EndOfLine: params.get("EndOfLine"),
  26041. EncodedByteAlign: params.get("EncodedByteAlign"),
  26042. Columns: params.get("Columns"),
  26043. Rows: params.get("Rows"),
  26044. EndOfBlock: params.get("EndOfBlock"),
  26045. BlackIs1: params.get("BlackIs1")
  26046. });
  26047. }
  26048. readBlock() {
  26049. while (!this.eof) {
  26050. const c = this.ccittFaxDecoder.readNextChar();
  26051. if (c === -1) {
  26052. this.eof = true;
  26053. return;
  26054. }
  26055. this.ensureBuffer(this.bufferLength + 1);
  26056. this.buffer[this.bufferLength++] = c;
  26057. }
  26058. }
  26059. }
  26060. exports.CCITTFaxStream = CCITTFaxStream;
  26061. /***/ }),
  26062. /* 32 */
  26063. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26064. Object.defineProperty(exports, "__esModule", ({
  26065. value: true
  26066. }));
  26067. exports.CCITTFaxDecoder = void 0;
  26068. var _util = __w_pdfjs_require__(2);
  26069. const ccittEOL = -2;
  26070. const ccittEOF = -1;
  26071. const twoDimPass = 0;
  26072. const twoDimHoriz = 1;
  26073. const twoDimVert0 = 2;
  26074. const twoDimVertR1 = 3;
  26075. const twoDimVertL1 = 4;
  26076. const twoDimVertR2 = 5;
  26077. const twoDimVertL2 = 6;
  26078. const twoDimVertR3 = 7;
  26079. const twoDimVertL3 = 8;
  26080. 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]];
  26081. 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]];
  26082. 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]];
  26083. 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]];
  26084. 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]];
  26085. 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]];
  26086. class CCITTFaxDecoder {
  26087. constructor(source, options = {}) {
  26088. if (!source || typeof source.next !== "function") {
  26089. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  26090. }
  26091. this.source = source;
  26092. this.eof = false;
  26093. this.encoding = options.K || 0;
  26094. this.eoline = options.EndOfLine || false;
  26095. this.byteAlign = options.EncodedByteAlign || false;
  26096. this.columns = options.Columns || 1728;
  26097. this.rows = options.Rows || 0;
  26098. let eoblock = options.EndOfBlock;
  26099. if (eoblock === null || eoblock === undefined) {
  26100. eoblock = true;
  26101. }
  26102. this.eoblock = eoblock;
  26103. this.black = options.BlackIs1 || false;
  26104. this.codingLine = new Uint32Array(this.columns + 1);
  26105. this.refLine = new Uint32Array(this.columns + 2);
  26106. this.codingLine[0] = this.columns;
  26107. this.codingPos = 0;
  26108. this.row = 0;
  26109. this.nextLine2D = this.encoding < 0;
  26110. this.inputBits = 0;
  26111. this.inputBuf = 0;
  26112. this.outputBits = 0;
  26113. this.rowsDone = false;
  26114. let code1;
  26115. while ((code1 = this._lookBits(12)) === 0) {
  26116. this._eatBits(1);
  26117. }
  26118. if (code1 === 1) {
  26119. this._eatBits(12);
  26120. }
  26121. if (this.encoding > 0) {
  26122. this.nextLine2D = !this._lookBits(1);
  26123. this._eatBits(1);
  26124. }
  26125. }
  26126. readNextChar() {
  26127. if (this.eof) {
  26128. return -1;
  26129. }
  26130. const refLine = this.refLine;
  26131. const codingLine = this.codingLine;
  26132. const columns = this.columns;
  26133. let refPos, blackPixels, bits, i;
  26134. if (this.outputBits === 0) {
  26135. if (this.rowsDone) {
  26136. this.eof = true;
  26137. }
  26138. if (this.eof) {
  26139. return -1;
  26140. }
  26141. this.err = false;
  26142. let code1, code2, code3;
  26143. if (this.nextLine2D) {
  26144. for (i = 0; codingLine[i] < columns; ++i) {
  26145. refLine[i] = codingLine[i];
  26146. }
  26147. refLine[i++] = columns;
  26148. refLine[i] = columns;
  26149. codingLine[0] = 0;
  26150. this.codingPos = 0;
  26151. refPos = 0;
  26152. blackPixels = 0;
  26153. while (codingLine[this.codingPos] < columns) {
  26154. code1 = this._getTwoDimCode();
  26155. switch (code1) {
  26156. case twoDimPass:
  26157. this._addPixels(refLine[refPos + 1], blackPixels);
  26158. if (refLine[refPos + 1] < columns) {
  26159. refPos += 2;
  26160. }
  26161. break;
  26162. case twoDimHoriz:
  26163. code1 = code2 = 0;
  26164. if (blackPixels) {
  26165. do {
  26166. code1 += code3 = this._getBlackCode();
  26167. } while (code3 >= 64);
  26168. do {
  26169. code2 += code3 = this._getWhiteCode();
  26170. } while (code3 >= 64);
  26171. } else {
  26172. do {
  26173. code1 += code3 = this._getWhiteCode();
  26174. } while (code3 >= 64);
  26175. do {
  26176. code2 += code3 = this._getBlackCode();
  26177. } while (code3 >= 64);
  26178. }
  26179. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26180. if (codingLine[this.codingPos] < columns) {
  26181. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  26182. }
  26183. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26184. refPos += 2;
  26185. }
  26186. break;
  26187. case twoDimVertR3:
  26188. this._addPixels(refLine[refPos] + 3, blackPixels);
  26189. blackPixels ^= 1;
  26190. if (codingLine[this.codingPos] < columns) {
  26191. ++refPos;
  26192. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26193. refPos += 2;
  26194. }
  26195. }
  26196. break;
  26197. case twoDimVertR2:
  26198. this._addPixels(refLine[refPos] + 2, blackPixels);
  26199. blackPixels ^= 1;
  26200. if (codingLine[this.codingPos] < columns) {
  26201. ++refPos;
  26202. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26203. refPos += 2;
  26204. }
  26205. }
  26206. break;
  26207. case twoDimVertR1:
  26208. this._addPixels(refLine[refPos] + 1, blackPixels);
  26209. blackPixels ^= 1;
  26210. if (codingLine[this.codingPos] < columns) {
  26211. ++refPos;
  26212. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26213. refPos += 2;
  26214. }
  26215. }
  26216. break;
  26217. case twoDimVert0:
  26218. this._addPixels(refLine[refPos], blackPixels);
  26219. blackPixels ^= 1;
  26220. if (codingLine[this.codingPos] < columns) {
  26221. ++refPos;
  26222. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26223. refPos += 2;
  26224. }
  26225. }
  26226. break;
  26227. case twoDimVertL3:
  26228. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  26229. blackPixels ^= 1;
  26230. if (codingLine[this.codingPos] < columns) {
  26231. if (refPos > 0) {
  26232. --refPos;
  26233. } else {
  26234. ++refPos;
  26235. }
  26236. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26237. refPos += 2;
  26238. }
  26239. }
  26240. break;
  26241. case twoDimVertL2:
  26242. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  26243. blackPixels ^= 1;
  26244. if (codingLine[this.codingPos] < columns) {
  26245. if (refPos > 0) {
  26246. --refPos;
  26247. } else {
  26248. ++refPos;
  26249. }
  26250. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26251. refPos += 2;
  26252. }
  26253. }
  26254. break;
  26255. case twoDimVertL1:
  26256. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  26257. blackPixels ^= 1;
  26258. if (codingLine[this.codingPos] < columns) {
  26259. if (refPos > 0) {
  26260. --refPos;
  26261. } else {
  26262. ++refPos;
  26263. }
  26264. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26265. refPos += 2;
  26266. }
  26267. }
  26268. break;
  26269. case ccittEOF:
  26270. this._addPixels(columns, 0);
  26271. this.eof = true;
  26272. break;
  26273. default:
  26274. (0, _util.info)("bad 2d code");
  26275. this._addPixels(columns, 0);
  26276. this.err = true;
  26277. }
  26278. }
  26279. } else {
  26280. codingLine[0] = 0;
  26281. this.codingPos = 0;
  26282. blackPixels = 0;
  26283. while (codingLine[this.codingPos] < columns) {
  26284. code1 = 0;
  26285. if (blackPixels) {
  26286. do {
  26287. code1 += code3 = this._getBlackCode();
  26288. } while (code3 >= 64);
  26289. } else {
  26290. do {
  26291. code1 += code3 = this._getWhiteCode();
  26292. } while (code3 >= 64);
  26293. }
  26294. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26295. blackPixels ^= 1;
  26296. }
  26297. }
  26298. let gotEOL = false;
  26299. if (this.byteAlign) {
  26300. this.inputBits &= ~7;
  26301. }
  26302. if (!this.eoblock && this.row === this.rows - 1) {
  26303. this.rowsDone = true;
  26304. } else {
  26305. code1 = this._lookBits(12);
  26306. if (this.eoline) {
  26307. while (code1 !== ccittEOF && code1 !== 1) {
  26308. this._eatBits(1);
  26309. code1 = this._lookBits(12);
  26310. }
  26311. } else {
  26312. while (code1 === 0) {
  26313. this._eatBits(1);
  26314. code1 = this._lookBits(12);
  26315. }
  26316. }
  26317. if (code1 === 1) {
  26318. this._eatBits(12);
  26319. gotEOL = true;
  26320. } else if (code1 === ccittEOF) {
  26321. this.eof = true;
  26322. }
  26323. }
  26324. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  26325. this.nextLine2D = !this._lookBits(1);
  26326. this._eatBits(1);
  26327. }
  26328. if (this.eoblock && gotEOL && this.byteAlign) {
  26329. code1 = this._lookBits(12);
  26330. if (code1 === 1) {
  26331. this._eatBits(12);
  26332. if (this.encoding > 0) {
  26333. this._lookBits(1);
  26334. this._eatBits(1);
  26335. }
  26336. if (this.encoding >= 0) {
  26337. for (i = 0; i < 4; ++i) {
  26338. code1 = this._lookBits(12);
  26339. if (code1 !== 1) {
  26340. (0, _util.info)("bad rtc code: " + code1);
  26341. }
  26342. this._eatBits(12);
  26343. if (this.encoding > 0) {
  26344. this._lookBits(1);
  26345. this._eatBits(1);
  26346. }
  26347. }
  26348. }
  26349. this.eof = true;
  26350. }
  26351. } else if (this.err && this.eoline) {
  26352. while (true) {
  26353. code1 = this._lookBits(13);
  26354. if (code1 === ccittEOF) {
  26355. this.eof = true;
  26356. return -1;
  26357. }
  26358. if (code1 >> 1 === 1) {
  26359. break;
  26360. }
  26361. this._eatBits(1);
  26362. }
  26363. this._eatBits(12);
  26364. if (this.encoding > 0) {
  26365. this._eatBits(1);
  26366. this.nextLine2D = !(code1 & 1);
  26367. }
  26368. }
  26369. if (codingLine[0] > 0) {
  26370. this.outputBits = codingLine[this.codingPos = 0];
  26371. } else {
  26372. this.outputBits = codingLine[this.codingPos = 1];
  26373. }
  26374. this.row++;
  26375. }
  26376. let c;
  26377. if (this.outputBits >= 8) {
  26378. c = this.codingPos & 1 ? 0 : 0xff;
  26379. this.outputBits -= 8;
  26380. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  26381. this.codingPos++;
  26382. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26383. }
  26384. } else {
  26385. bits = 8;
  26386. c = 0;
  26387. do {
  26388. if (typeof this.outputBits !== "number") {
  26389. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  26390. }
  26391. if (this.outputBits > bits) {
  26392. c <<= bits;
  26393. if (!(this.codingPos & 1)) {
  26394. c |= 0xff >> 8 - bits;
  26395. }
  26396. this.outputBits -= bits;
  26397. bits = 0;
  26398. } else {
  26399. c <<= this.outputBits;
  26400. if (!(this.codingPos & 1)) {
  26401. c |= 0xff >> 8 - this.outputBits;
  26402. }
  26403. bits -= this.outputBits;
  26404. this.outputBits = 0;
  26405. if (codingLine[this.codingPos] < columns) {
  26406. this.codingPos++;
  26407. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26408. } else if (bits > 0) {
  26409. c <<= bits;
  26410. bits = 0;
  26411. }
  26412. }
  26413. } while (bits);
  26414. }
  26415. if (this.black) {
  26416. c ^= 0xff;
  26417. }
  26418. return c;
  26419. }
  26420. _addPixels(a1, blackPixels) {
  26421. const codingLine = this.codingLine;
  26422. let codingPos = this.codingPos;
  26423. if (a1 > codingLine[codingPos]) {
  26424. if (a1 > this.columns) {
  26425. (0, _util.info)("row is wrong length");
  26426. this.err = true;
  26427. a1 = this.columns;
  26428. }
  26429. if (codingPos & 1 ^ blackPixels) {
  26430. ++codingPos;
  26431. }
  26432. codingLine[codingPos] = a1;
  26433. }
  26434. this.codingPos = codingPos;
  26435. }
  26436. _addPixelsNeg(a1, blackPixels) {
  26437. const codingLine = this.codingLine;
  26438. let codingPos = this.codingPos;
  26439. if (a1 > codingLine[codingPos]) {
  26440. if (a1 > this.columns) {
  26441. (0, _util.info)("row is wrong length");
  26442. this.err = true;
  26443. a1 = this.columns;
  26444. }
  26445. if (codingPos & 1 ^ blackPixels) {
  26446. ++codingPos;
  26447. }
  26448. codingLine[codingPos] = a1;
  26449. } else if (a1 < codingLine[codingPos]) {
  26450. if (a1 < 0) {
  26451. (0, _util.info)("invalid code");
  26452. this.err = true;
  26453. a1 = 0;
  26454. }
  26455. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  26456. --codingPos;
  26457. }
  26458. codingLine[codingPos] = a1;
  26459. }
  26460. this.codingPos = codingPos;
  26461. }
  26462. _findTableCode(start, end, table, limit) {
  26463. const limitValue = limit || 0;
  26464. for (let i = start; i <= end; ++i) {
  26465. let code = this._lookBits(i);
  26466. if (code === ccittEOF) {
  26467. return [true, 1, false];
  26468. }
  26469. if (i < end) {
  26470. code <<= end - i;
  26471. }
  26472. if (!limitValue || code >= limitValue) {
  26473. const p = table[code - limitValue];
  26474. if (p[0] === i) {
  26475. this._eatBits(i);
  26476. return [true, p[1], true];
  26477. }
  26478. }
  26479. }
  26480. return [false, 0, false];
  26481. }
  26482. _getTwoDimCode() {
  26483. let code = 0;
  26484. let p;
  26485. if (this.eoblock) {
  26486. code = this._lookBits(7);
  26487. p = twoDimTable[code];
  26488. if (p && p[0] > 0) {
  26489. this._eatBits(p[0]);
  26490. return p[1];
  26491. }
  26492. } else {
  26493. const result = this._findTableCode(1, 7, twoDimTable);
  26494. if (result[0] && result[2]) {
  26495. return result[1];
  26496. }
  26497. }
  26498. (0, _util.info)("Bad two dim code");
  26499. return ccittEOF;
  26500. }
  26501. _getWhiteCode() {
  26502. let code = 0;
  26503. let p;
  26504. if (this.eoblock) {
  26505. code = this._lookBits(12);
  26506. if (code === ccittEOF) {
  26507. return 1;
  26508. }
  26509. if (code >> 5 === 0) {
  26510. p = whiteTable1[code];
  26511. } else {
  26512. p = whiteTable2[code >> 3];
  26513. }
  26514. if (p[0] > 0) {
  26515. this._eatBits(p[0]);
  26516. return p[1];
  26517. }
  26518. } else {
  26519. let result = this._findTableCode(1, 9, whiteTable2);
  26520. if (result[0]) {
  26521. return result[1];
  26522. }
  26523. result = this._findTableCode(11, 12, whiteTable1);
  26524. if (result[0]) {
  26525. return result[1];
  26526. }
  26527. }
  26528. (0, _util.info)("bad white code");
  26529. this._eatBits(1);
  26530. return 1;
  26531. }
  26532. _getBlackCode() {
  26533. let code, p;
  26534. if (this.eoblock) {
  26535. code = this._lookBits(13);
  26536. if (code === ccittEOF) {
  26537. return 1;
  26538. }
  26539. if (code >> 7 === 0) {
  26540. p = blackTable1[code];
  26541. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  26542. p = blackTable2[(code >> 1) - 64];
  26543. } else {
  26544. p = blackTable3[code >> 7];
  26545. }
  26546. if (p[0] > 0) {
  26547. this._eatBits(p[0]);
  26548. return p[1];
  26549. }
  26550. } else {
  26551. let result = this._findTableCode(2, 6, blackTable3);
  26552. if (result[0]) {
  26553. return result[1];
  26554. }
  26555. result = this._findTableCode(7, 12, blackTable2, 64);
  26556. if (result[0]) {
  26557. return result[1];
  26558. }
  26559. result = this._findTableCode(10, 13, blackTable1);
  26560. if (result[0]) {
  26561. return result[1];
  26562. }
  26563. }
  26564. (0, _util.info)("bad black code");
  26565. this._eatBits(1);
  26566. return 1;
  26567. }
  26568. _lookBits(n) {
  26569. let c;
  26570. while (this.inputBits < n) {
  26571. if ((c = this.source.next()) === -1) {
  26572. if (this.inputBits === 0) {
  26573. return ccittEOF;
  26574. }
  26575. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  26576. }
  26577. this.inputBuf = this.inputBuf << 8 | c;
  26578. this.inputBits += 8;
  26579. }
  26580. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  26581. }
  26582. _eatBits(n) {
  26583. if ((this.inputBits -= n) < 0) {
  26584. this.inputBits = 0;
  26585. }
  26586. }
  26587. }
  26588. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  26589. /***/ }),
  26590. /* 33 */
  26591. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26592. Object.defineProperty(exports, "__esModule", ({
  26593. value: true
  26594. }));
  26595. exports.FlateStream = void 0;
  26596. var _decode_stream = __w_pdfjs_require__(29);
  26597. var _util = __w_pdfjs_require__(2);
  26598. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  26599. 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]);
  26600. 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]);
  26601. 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];
  26602. 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];
  26603. class FlateStream extends _decode_stream.DecodeStream {
  26604. constructor(str, maybeLength) {
  26605. super(maybeLength);
  26606. this.str = str;
  26607. this.dict = str.dict;
  26608. const cmf = str.getByte();
  26609. const flg = str.getByte();
  26610. if (cmf === -1 || flg === -1) {
  26611. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  26612. }
  26613. if ((cmf & 0x0f) !== 0x08) {
  26614. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  26615. }
  26616. if (((cmf << 8) + flg) % 31 !== 0) {
  26617. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  26618. }
  26619. if (flg & 0x20) {
  26620. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  26621. }
  26622. this.codeSize = 0;
  26623. this.codeBuf = 0;
  26624. }
  26625. getBits(bits) {
  26626. const str = this.str;
  26627. let codeSize = this.codeSize;
  26628. let codeBuf = this.codeBuf;
  26629. let b;
  26630. while (codeSize < bits) {
  26631. if ((b = str.getByte()) === -1) {
  26632. throw new _util.FormatError("Bad encoding in flate stream");
  26633. }
  26634. codeBuf |= b << codeSize;
  26635. codeSize += 8;
  26636. }
  26637. b = codeBuf & (1 << bits) - 1;
  26638. this.codeBuf = codeBuf >> bits;
  26639. this.codeSize = codeSize -= bits;
  26640. return b;
  26641. }
  26642. getCode(table) {
  26643. const str = this.str;
  26644. const codes = table[0];
  26645. const maxLen = table[1];
  26646. let codeSize = this.codeSize;
  26647. let codeBuf = this.codeBuf;
  26648. let b;
  26649. while (codeSize < maxLen) {
  26650. if ((b = str.getByte()) === -1) {
  26651. break;
  26652. }
  26653. codeBuf |= b << codeSize;
  26654. codeSize += 8;
  26655. }
  26656. const code = codes[codeBuf & (1 << maxLen) - 1];
  26657. const codeLen = code >> 16;
  26658. const codeVal = code & 0xffff;
  26659. if (codeLen < 1 || codeSize < codeLen) {
  26660. throw new _util.FormatError("Bad encoding in flate stream");
  26661. }
  26662. this.codeBuf = codeBuf >> codeLen;
  26663. this.codeSize = codeSize - codeLen;
  26664. return codeVal;
  26665. }
  26666. generateHuffmanTable(lengths) {
  26667. const n = lengths.length;
  26668. let maxLen = 0;
  26669. let i;
  26670. for (i = 0; i < n; ++i) {
  26671. if (lengths[i] > maxLen) {
  26672. maxLen = lengths[i];
  26673. }
  26674. }
  26675. const size = 1 << maxLen;
  26676. const codes = new Int32Array(size);
  26677. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  26678. for (let val = 0; val < n; ++val) {
  26679. if (lengths[val] === len) {
  26680. let code2 = 0;
  26681. let t = code;
  26682. for (i = 0; i < len; ++i) {
  26683. code2 = code2 << 1 | t & 1;
  26684. t >>= 1;
  26685. }
  26686. for (i = code2; i < size; i += skip) {
  26687. codes[i] = len << 16 | val;
  26688. }
  26689. ++code;
  26690. }
  26691. }
  26692. }
  26693. return [codes, maxLen];
  26694. }
  26695. readBlock() {
  26696. let buffer, len;
  26697. const str = this.str;
  26698. let hdr = this.getBits(3);
  26699. if (hdr & 1) {
  26700. this.eof = true;
  26701. }
  26702. hdr >>= 1;
  26703. if (hdr === 0) {
  26704. let b;
  26705. if ((b = str.getByte()) === -1) {
  26706. throw new _util.FormatError("Bad block header in flate stream");
  26707. }
  26708. let blockLen = b;
  26709. if ((b = str.getByte()) === -1) {
  26710. throw new _util.FormatError("Bad block header in flate stream");
  26711. }
  26712. blockLen |= b << 8;
  26713. if ((b = str.getByte()) === -1) {
  26714. throw new _util.FormatError("Bad block header in flate stream");
  26715. }
  26716. let check = b;
  26717. if ((b = str.getByte()) === -1) {
  26718. throw new _util.FormatError("Bad block header in flate stream");
  26719. }
  26720. check |= b << 8;
  26721. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  26722. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  26723. }
  26724. this.codeBuf = 0;
  26725. this.codeSize = 0;
  26726. const bufferLength = this.bufferLength,
  26727. end = bufferLength + blockLen;
  26728. buffer = this.ensureBuffer(end);
  26729. this.bufferLength = end;
  26730. if (blockLen === 0) {
  26731. if (str.peekByte() === -1) {
  26732. this.eof = true;
  26733. }
  26734. } else {
  26735. const block = str.getBytes(blockLen);
  26736. buffer.set(block, bufferLength);
  26737. if (block.length < blockLen) {
  26738. this.eof = true;
  26739. }
  26740. }
  26741. return;
  26742. }
  26743. let litCodeTable;
  26744. let distCodeTable;
  26745. if (hdr === 1) {
  26746. litCodeTable = fixedLitCodeTab;
  26747. distCodeTable = fixedDistCodeTab;
  26748. } else if (hdr === 2) {
  26749. const numLitCodes = this.getBits(5) + 257;
  26750. const numDistCodes = this.getBits(5) + 1;
  26751. const numCodeLenCodes = this.getBits(4) + 4;
  26752. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  26753. let i;
  26754. for (i = 0; i < numCodeLenCodes; ++i) {
  26755. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  26756. }
  26757. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  26758. len = 0;
  26759. i = 0;
  26760. const codes = numLitCodes + numDistCodes;
  26761. const codeLengths = new Uint8Array(codes);
  26762. let bitsLength, bitsOffset, what;
  26763. while (i < codes) {
  26764. const code = this.getCode(codeLenCodeTab);
  26765. if (code === 16) {
  26766. bitsLength = 2;
  26767. bitsOffset = 3;
  26768. what = len;
  26769. } else if (code === 17) {
  26770. bitsLength = 3;
  26771. bitsOffset = 3;
  26772. what = len = 0;
  26773. } else if (code === 18) {
  26774. bitsLength = 7;
  26775. bitsOffset = 11;
  26776. what = len = 0;
  26777. } else {
  26778. codeLengths[i++] = len = code;
  26779. continue;
  26780. }
  26781. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  26782. while (repeatLength-- > 0) {
  26783. codeLengths[i++] = what;
  26784. }
  26785. }
  26786. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  26787. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  26788. } else {
  26789. throw new _util.FormatError("Unknown block type in flate stream");
  26790. }
  26791. buffer = this.buffer;
  26792. let limit = buffer ? buffer.length : 0;
  26793. let pos = this.bufferLength;
  26794. while (true) {
  26795. let code1 = this.getCode(litCodeTable);
  26796. if (code1 < 256) {
  26797. if (pos + 1 >= limit) {
  26798. buffer = this.ensureBuffer(pos + 1);
  26799. limit = buffer.length;
  26800. }
  26801. buffer[pos++] = code1;
  26802. continue;
  26803. }
  26804. if (code1 === 256) {
  26805. this.bufferLength = pos;
  26806. return;
  26807. }
  26808. code1 -= 257;
  26809. code1 = lengthDecode[code1];
  26810. let code2 = code1 >> 16;
  26811. if (code2 > 0) {
  26812. code2 = this.getBits(code2);
  26813. }
  26814. len = (code1 & 0xffff) + code2;
  26815. code1 = this.getCode(distCodeTable);
  26816. code1 = distDecode[code1];
  26817. code2 = code1 >> 16;
  26818. if (code2 > 0) {
  26819. code2 = this.getBits(code2);
  26820. }
  26821. const dist = (code1 & 0xffff) + code2;
  26822. if (pos + len >= limit) {
  26823. buffer = this.ensureBuffer(pos + len);
  26824. limit = buffer.length;
  26825. }
  26826. for (let k = 0; k < len; ++k, ++pos) {
  26827. buffer[pos] = buffer[pos - dist];
  26828. }
  26829. }
  26830. }
  26831. }
  26832. exports.FlateStream = FlateStream;
  26833. /***/ }),
  26834. /* 34 */
  26835. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26836. Object.defineProperty(exports, "__esModule", ({
  26837. value: true
  26838. }));
  26839. exports.Jbig2Stream = void 0;
  26840. var _base_stream = __w_pdfjs_require__(9);
  26841. var _decode_stream = __w_pdfjs_require__(29);
  26842. var _primitives = __w_pdfjs_require__(5);
  26843. var _jbig = __w_pdfjs_require__(35);
  26844. var _util = __w_pdfjs_require__(2);
  26845. class Jbig2Stream extends _decode_stream.DecodeStream {
  26846. constructor(stream, maybeLength, params) {
  26847. super(maybeLength);
  26848. this.stream = stream;
  26849. this.dict = stream.dict;
  26850. this.maybeLength = maybeLength;
  26851. this.params = params;
  26852. }
  26853. get bytes() {
  26854. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  26855. }
  26856. ensureBuffer(requested) {}
  26857. readBlock() {
  26858. if (this.eof) {
  26859. return;
  26860. }
  26861. const jbig2Image = new _jbig.Jbig2Image();
  26862. const chunks = [];
  26863. if (this.params instanceof _primitives.Dict) {
  26864. const globalsStream = this.params.get("JBIG2Globals");
  26865. if (globalsStream instanceof _base_stream.BaseStream) {
  26866. const globals = globalsStream.getBytes();
  26867. chunks.push({
  26868. data: globals,
  26869. start: 0,
  26870. end: globals.length
  26871. });
  26872. }
  26873. }
  26874. chunks.push({
  26875. data: this.bytes,
  26876. start: 0,
  26877. end: this.bytes.length
  26878. });
  26879. const data = jbig2Image.parseChunks(chunks);
  26880. const dataLength = data.length;
  26881. for (let i = 0; i < dataLength; i++) {
  26882. data[i] ^= 0xff;
  26883. }
  26884. this.buffer = data;
  26885. this.bufferLength = dataLength;
  26886. this.eof = true;
  26887. }
  26888. }
  26889. exports.Jbig2Stream = Jbig2Stream;
  26890. /***/ }),
  26891. /* 35 */
  26892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26893. Object.defineProperty(exports, "__esModule", ({
  26894. value: true
  26895. }));
  26896. exports.Jbig2Image = void 0;
  26897. var _util = __w_pdfjs_require__(2);
  26898. var _core_utils = __w_pdfjs_require__(8);
  26899. var _arithmetic_decoder = __w_pdfjs_require__(36);
  26900. var _ccitt = __w_pdfjs_require__(32);
  26901. class Jbig2Error extends _util.BaseException {
  26902. constructor(msg) {
  26903. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  26904. }
  26905. }
  26906. class ContextCache {
  26907. getContexts(id) {
  26908. if (id in this) {
  26909. return this[id];
  26910. }
  26911. return this[id] = new Int8Array(1 << 16);
  26912. }
  26913. }
  26914. class DecodingContext {
  26915. constructor(data, start, end) {
  26916. this.data = data;
  26917. this.start = start;
  26918. this.end = end;
  26919. }
  26920. get decoder() {
  26921. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  26922. return (0, _util.shadow)(this, "decoder", decoder);
  26923. }
  26924. get contextCache() {
  26925. const cache = new ContextCache();
  26926. return (0, _util.shadow)(this, "contextCache", cache);
  26927. }
  26928. }
  26929. function decodeInteger(contextCache, procedure, decoder) {
  26930. const contexts = contextCache.getContexts(procedure);
  26931. let prev = 1;
  26932. function readBits(length) {
  26933. let v = 0;
  26934. for (let i = 0; i < length; i++) {
  26935. const bit = decoder.readBit(contexts, prev);
  26936. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  26937. v = v << 1 | bit;
  26938. }
  26939. return v >>> 0;
  26940. }
  26941. const sign = readBits(1);
  26942. 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);
  26943. if (sign === 0) {
  26944. return value;
  26945. } else if (value > 0) {
  26946. return -value;
  26947. }
  26948. return null;
  26949. }
  26950. function decodeIAID(contextCache, decoder, codeLength) {
  26951. const contexts = contextCache.getContexts("IAID");
  26952. let prev = 1;
  26953. for (let i = 0; i < codeLength; i++) {
  26954. const bit = decoder.readBit(contexts, prev);
  26955. prev = prev << 1 | bit;
  26956. }
  26957. if (codeLength < 31) {
  26958. return prev & (1 << codeLength) - 1;
  26959. }
  26960. return prev & 0x7fffffff;
  26961. }
  26962. 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"];
  26963. const CodingTemplates = [[{
  26964. x: -1,
  26965. y: -2
  26966. }, {
  26967. x: 0,
  26968. y: -2
  26969. }, {
  26970. x: 1,
  26971. y: -2
  26972. }, {
  26973. x: -2,
  26974. y: -1
  26975. }, {
  26976. x: -1,
  26977. y: -1
  26978. }, {
  26979. x: 0,
  26980. y: -1
  26981. }, {
  26982. x: 1,
  26983. y: -1
  26984. }, {
  26985. x: 2,
  26986. y: -1
  26987. }, {
  26988. x: -4,
  26989. y: 0
  26990. }, {
  26991. x: -3,
  26992. y: 0
  26993. }, {
  26994. x: -2,
  26995. y: 0
  26996. }, {
  26997. x: -1,
  26998. y: 0
  26999. }], [{
  27000. x: -1,
  27001. y: -2
  27002. }, {
  27003. x: 0,
  27004. y: -2
  27005. }, {
  27006. x: 1,
  27007. y: -2
  27008. }, {
  27009. x: 2,
  27010. y: -2
  27011. }, {
  27012. x: -2,
  27013. y: -1
  27014. }, {
  27015. x: -1,
  27016. y: -1
  27017. }, {
  27018. x: 0,
  27019. y: -1
  27020. }, {
  27021. x: 1,
  27022. y: -1
  27023. }, {
  27024. x: 2,
  27025. y: -1
  27026. }, {
  27027. x: -3,
  27028. y: 0
  27029. }, {
  27030. x: -2,
  27031. y: 0
  27032. }, {
  27033. x: -1,
  27034. y: 0
  27035. }], [{
  27036. x: -1,
  27037. y: -2
  27038. }, {
  27039. x: 0,
  27040. y: -2
  27041. }, {
  27042. x: 1,
  27043. y: -2
  27044. }, {
  27045. x: -2,
  27046. y: -1
  27047. }, {
  27048. x: -1,
  27049. y: -1
  27050. }, {
  27051. x: 0,
  27052. y: -1
  27053. }, {
  27054. x: 1,
  27055. y: -1
  27056. }, {
  27057. x: -2,
  27058. y: 0
  27059. }, {
  27060. x: -1,
  27061. y: 0
  27062. }], [{
  27063. x: -3,
  27064. y: -1
  27065. }, {
  27066. x: -2,
  27067. y: -1
  27068. }, {
  27069. x: -1,
  27070. y: -1
  27071. }, {
  27072. x: 0,
  27073. y: -1
  27074. }, {
  27075. x: 1,
  27076. y: -1
  27077. }, {
  27078. x: -4,
  27079. y: 0
  27080. }, {
  27081. x: -3,
  27082. y: 0
  27083. }, {
  27084. x: -2,
  27085. y: 0
  27086. }, {
  27087. x: -1,
  27088. y: 0
  27089. }]];
  27090. const RefinementTemplates = [{
  27091. coding: [{
  27092. x: 0,
  27093. y: -1
  27094. }, {
  27095. x: 1,
  27096. y: -1
  27097. }, {
  27098. x: -1,
  27099. y: 0
  27100. }],
  27101. reference: [{
  27102. x: 0,
  27103. y: -1
  27104. }, {
  27105. x: 1,
  27106. y: -1
  27107. }, {
  27108. x: -1,
  27109. y: 0
  27110. }, {
  27111. x: 0,
  27112. y: 0
  27113. }, {
  27114. x: 1,
  27115. y: 0
  27116. }, {
  27117. x: -1,
  27118. y: 1
  27119. }, {
  27120. x: 0,
  27121. y: 1
  27122. }, {
  27123. x: 1,
  27124. y: 1
  27125. }]
  27126. }, {
  27127. coding: [{
  27128. x: -1,
  27129. y: -1
  27130. }, {
  27131. x: 0,
  27132. y: -1
  27133. }, {
  27134. x: 1,
  27135. y: -1
  27136. }, {
  27137. x: -1,
  27138. y: 0
  27139. }],
  27140. reference: [{
  27141. x: 0,
  27142. y: -1
  27143. }, {
  27144. x: -1,
  27145. y: 0
  27146. }, {
  27147. x: 0,
  27148. y: 0
  27149. }, {
  27150. x: 1,
  27151. y: 0
  27152. }, {
  27153. x: 0,
  27154. y: 1
  27155. }, {
  27156. x: 1,
  27157. y: 1
  27158. }]
  27159. }];
  27160. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  27161. const RefinementReusedContexts = [0x0020, 0x0008];
  27162. function decodeBitmapTemplate0(width, height, decodingContext) {
  27163. const decoder = decodingContext.decoder;
  27164. const contexts = decodingContext.contextCache.getContexts("GB");
  27165. const bitmap = [];
  27166. let contextLabel, i, j, pixel, row, row1, row2;
  27167. const OLD_PIXEL_MASK = 0x7bf7;
  27168. for (i = 0; i < height; i++) {
  27169. row = bitmap[i] = new Uint8Array(width);
  27170. row1 = i < 1 ? row : bitmap[i - 1];
  27171. row2 = i < 2 ? row : bitmap[i - 2];
  27172. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  27173. for (j = 0; j < width; j++) {
  27174. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  27175. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  27176. }
  27177. }
  27178. return bitmap;
  27179. }
  27180. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  27181. if (mmr) {
  27182. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27183. return decodeMMRBitmap(input, width, height, false);
  27184. }
  27185. 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) {
  27186. return decodeBitmapTemplate0(width, height, decodingContext);
  27187. }
  27188. const useskip = !!skip;
  27189. const template = CodingTemplates[templateIndex].concat(at);
  27190. template.sort(function (a, b) {
  27191. return a.y - b.y || a.x - b.x;
  27192. });
  27193. const templateLength = template.length;
  27194. const templateX = new Int8Array(templateLength);
  27195. const templateY = new Int8Array(templateLength);
  27196. const changingTemplateEntries = [];
  27197. let reuseMask = 0,
  27198. minX = 0,
  27199. maxX = 0,
  27200. minY = 0;
  27201. let c, k;
  27202. for (k = 0; k < templateLength; k++) {
  27203. templateX[k] = template[k].x;
  27204. templateY[k] = template[k].y;
  27205. minX = Math.min(minX, template[k].x);
  27206. maxX = Math.max(maxX, template[k].x);
  27207. minY = Math.min(minY, template[k].y);
  27208. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  27209. reuseMask |= 1 << templateLength - 1 - k;
  27210. } else {
  27211. changingTemplateEntries.push(k);
  27212. }
  27213. }
  27214. const changingEntriesLength = changingTemplateEntries.length;
  27215. const changingTemplateX = new Int8Array(changingEntriesLength);
  27216. const changingTemplateY = new Int8Array(changingEntriesLength);
  27217. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  27218. for (c = 0; c < changingEntriesLength; c++) {
  27219. k = changingTemplateEntries[c];
  27220. changingTemplateX[c] = template[k].x;
  27221. changingTemplateY[c] = template[k].y;
  27222. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  27223. }
  27224. const sbb_left = -minX;
  27225. const sbb_top = -minY;
  27226. const sbb_right = width - maxX;
  27227. const pseudoPixelContext = ReusedContexts[templateIndex];
  27228. let row = new Uint8Array(width);
  27229. const bitmap = [];
  27230. const decoder = decodingContext.decoder;
  27231. const contexts = decodingContext.contextCache.getContexts("GB");
  27232. let ltp = 0,
  27233. j,
  27234. i0,
  27235. j0,
  27236. contextLabel = 0,
  27237. bit,
  27238. shift;
  27239. for (let i = 0; i < height; i++) {
  27240. if (prediction) {
  27241. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27242. ltp ^= sltp;
  27243. if (ltp) {
  27244. bitmap.push(row);
  27245. continue;
  27246. }
  27247. }
  27248. row = new Uint8Array(row);
  27249. bitmap.push(row);
  27250. for (j = 0; j < width; j++) {
  27251. if (useskip && skip[i][j]) {
  27252. row[j] = 0;
  27253. continue;
  27254. }
  27255. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  27256. contextLabel = contextLabel << 1 & reuseMask;
  27257. for (k = 0; k < changingEntriesLength; k++) {
  27258. i0 = i + changingTemplateY[k];
  27259. j0 = j + changingTemplateX[k];
  27260. bit = bitmap[i0][j0];
  27261. if (bit) {
  27262. bit = changingTemplateBit[k];
  27263. contextLabel |= bit;
  27264. }
  27265. }
  27266. } else {
  27267. contextLabel = 0;
  27268. shift = templateLength - 1;
  27269. for (k = 0; k < templateLength; k++, shift--) {
  27270. j0 = j + templateX[k];
  27271. if (j0 >= 0 && j0 < width) {
  27272. i0 = i + templateY[k];
  27273. if (i0 >= 0) {
  27274. bit = bitmap[i0][j0];
  27275. if (bit) {
  27276. contextLabel |= bit << shift;
  27277. }
  27278. }
  27279. }
  27280. }
  27281. }
  27282. const pixel = decoder.readBit(contexts, contextLabel);
  27283. row[j] = pixel;
  27284. }
  27285. }
  27286. return bitmap;
  27287. }
  27288. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  27289. let codingTemplate = RefinementTemplates[templateIndex].coding;
  27290. if (templateIndex === 0) {
  27291. codingTemplate = codingTemplate.concat([at[0]]);
  27292. }
  27293. const codingTemplateLength = codingTemplate.length;
  27294. const codingTemplateX = new Int32Array(codingTemplateLength);
  27295. const codingTemplateY = new Int32Array(codingTemplateLength);
  27296. let k;
  27297. for (k = 0; k < codingTemplateLength; k++) {
  27298. codingTemplateX[k] = codingTemplate[k].x;
  27299. codingTemplateY[k] = codingTemplate[k].y;
  27300. }
  27301. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  27302. if (templateIndex === 0) {
  27303. referenceTemplate = referenceTemplate.concat([at[1]]);
  27304. }
  27305. const referenceTemplateLength = referenceTemplate.length;
  27306. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  27307. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  27308. for (k = 0; k < referenceTemplateLength; k++) {
  27309. referenceTemplateX[k] = referenceTemplate[k].x;
  27310. referenceTemplateY[k] = referenceTemplate[k].y;
  27311. }
  27312. const referenceWidth = referenceBitmap[0].length;
  27313. const referenceHeight = referenceBitmap.length;
  27314. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  27315. const bitmap = [];
  27316. const decoder = decodingContext.decoder;
  27317. const contexts = decodingContext.contextCache.getContexts("GR");
  27318. let ltp = 0;
  27319. for (let i = 0; i < height; i++) {
  27320. if (prediction) {
  27321. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27322. ltp ^= sltp;
  27323. if (ltp) {
  27324. throw new Jbig2Error("prediction is not supported");
  27325. }
  27326. }
  27327. const row = new Uint8Array(width);
  27328. bitmap.push(row);
  27329. for (let j = 0; j < width; j++) {
  27330. let i0, j0;
  27331. let contextLabel = 0;
  27332. for (k = 0; k < codingTemplateLength; k++) {
  27333. i0 = i + codingTemplateY[k];
  27334. j0 = j + codingTemplateX[k];
  27335. if (i0 < 0 || j0 < 0 || j0 >= width) {
  27336. contextLabel <<= 1;
  27337. } else {
  27338. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  27339. }
  27340. }
  27341. for (k = 0; k < referenceTemplateLength; k++) {
  27342. i0 = i + referenceTemplateY[k] - offsetY;
  27343. j0 = j + referenceTemplateX[k] - offsetX;
  27344. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  27345. contextLabel <<= 1;
  27346. } else {
  27347. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  27348. }
  27349. }
  27350. const pixel = decoder.readBit(contexts, contextLabel);
  27351. row[j] = pixel;
  27352. }
  27353. }
  27354. return bitmap;
  27355. }
  27356. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  27357. if (huffman && refinement) {
  27358. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  27359. }
  27360. const newSymbols = [];
  27361. let currentHeight = 0;
  27362. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  27363. const decoder = decodingContext.decoder;
  27364. const contextCache = decodingContext.contextCache;
  27365. let tableB1, symbolWidths;
  27366. if (huffman) {
  27367. tableB1 = getStandardTable(1);
  27368. symbolWidths = [];
  27369. symbolCodeLength = Math.max(symbolCodeLength, 1);
  27370. }
  27371. while (newSymbols.length < numberOfNewSymbols) {
  27372. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  27373. currentHeight += deltaHeight;
  27374. let currentWidth = 0,
  27375. totalWidth = 0;
  27376. const firstSymbol = huffman ? symbolWidths.length : 0;
  27377. while (true) {
  27378. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  27379. if (deltaWidth === null) {
  27380. break;
  27381. }
  27382. currentWidth += deltaWidth;
  27383. totalWidth += currentWidth;
  27384. let bitmap;
  27385. if (refinement) {
  27386. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  27387. if (numberOfInstances > 1) {
  27388. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  27389. } else {
  27390. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  27391. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27392. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27393. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  27394. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  27395. }
  27396. newSymbols.push(bitmap);
  27397. } else if (huffman) {
  27398. symbolWidths.push(currentWidth);
  27399. } else {
  27400. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  27401. newSymbols.push(bitmap);
  27402. }
  27403. }
  27404. if (huffman && !refinement) {
  27405. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  27406. huffmanInput.byteAlign();
  27407. let collectiveBitmap;
  27408. if (bitmapSize === 0) {
  27409. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  27410. } else {
  27411. const originalEnd = huffmanInput.end;
  27412. const bitmapEnd = huffmanInput.position + bitmapSize;
  27413. huffmanInput.end = bitmapEnd;
  27414. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  27415. huffmanInput.end = originalEnd;
  27416. huffmanInput.position = bitmapEnd;
  27417. }
  27418. const numberOfSymbolsDecoded = symbolWidths.length;
  27419. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  27420. newSymbols.push(collectiveBitmap);
  27421. } else {
  27422. let i,
  27423. y,
  27424. xMin = 0,
  27425. xMax,
  27426. bitmapWidth,
  27427. symbolBitmap;
  27428. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  27429. bitmapWidth = symbolWidths[i];
  27430. xMax = xMin + bitmapWidth;
  27431. symbolBitmap = [];
  27432. for (y = 0; y < currentHeight; y++) {
  27433. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27434. }
  27435. newSymbols.push(symbolBitmap);
  27436. xMin = xMax;
  27437. }
  27438. }
  27439. }
  27440. }
  27441. const exportedSymbols = [],
  27442. flags = [];
  27443. let currentFlag = false,
  27444. i,
  27445. ii;
  27446. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  27447. while (flags.length < totalSymbolsLength) {
  27448. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  27449. while (runLength--) {
  27450. flags.push(currentFlag);
  27451. }
  27452. currentFlag = !currentFlag;
  27453. }
  27454. for (i = 0, ii = symbols.length; i < ii; i++) {
  27455. if (flags[i]) {
  27456. exportedSymbols.push(symbols[i]);
  27457. }
  27458. }
  27459. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  27460. if (flags[i]) {
  27461. exportedSymbols.push(newSymbols[j]);
  27462. }
  27463. }
  27464. return exportedSymbols;
  27465. }
  27466. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  27467. if (huffman && refinement) {
  27468. throw new Jbig2Error("refinement with Huffman is not supported");
  27469. }
  27470. const bitmap = [];
  27471. let i, row;
  27472. for (i = 0; i < height; i++) {
  27473. row = new Uint8Array(width);
  27474. if (defaultPixelValue) {
  27475. for (let j = 0; j < width; j++) {
  27476. row[j] = defaultPixelValue;
  27477. }
  27478. }
  27479. bitmap.push(row);
  27480. }
  27481. const decoder = decodingContext.decoder;
  27482. const contextCache = decodingContext.contextCache;
  27483. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  27484. let firstS = 0;
  27485. i = 0;
  27486. while (i < numberOfSymbolInstances) {
  27487. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  27488. stripT += deltaT;
  27489. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  27490. firstS += deltaFirstS;
  27491. let currentS = firstS;
  27492. do {
  27493. let currentT = 0;
  27494. if (stripSize > 1) {
  27495. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  27496. }
  27497. const t = stripSize * stripT + currentT;
  27498. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  27499. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  27500. let symbolBitmap = inputSymbols[symbolId];
  27501. let symbolWidth = symbolBitmap[0].length;
  27502. let symbolHeight = symbolBitmap.length;
  27503. if (applyRefinement) {
  27504. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  27505. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  27506. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27507. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27508. symbolWidth += rdw;
  27509. symbolHeight += rdh;
  27510. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  27511. }
  27512. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  27513. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  27514. let s2, t2, symbolRow;
  27515. if (transposed) {
  27516. for (s2 = 0; s2 < symbolHeight; s2++) {
  27517. row = bitmap[offsetS + s2];
  27518. if (!row) {
  27519. continue;
  27520. }
  27521. symbolRow = symbolBitmap[s2];
  27522. const maxWidth = Math.min(width - offsetT, symbolWidth);
  27523. switch (combinationOperator) {
  27524. case 0:
  27525. for (t2 = 0; t2 < maxWidth; t2++) {
  27526. row[offsetT + t2] |= symbolRow[t2];
  27527. }
  27528. break;
  27529. case 2:
  27530. for (t2 = 0; t2 < maxWidth; t2++) {
  27531. row[offsetT + t2] ^= symbolRow[t2];
  27532. }
  27533. break;
  27534. default:
  27535. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27536. }
  27537. }
  27538. currentS += symbolHeight - 1;
  27539. } else {
  27540. for (t2 = 0; t2 < symbolHeight; t2++) {
  27541. row = bitmap[offsetT + t2];
  27542. if (!row) {
  27543. continue;
  27544. }
  27545. symbolRow = symbolBitmap[t2];
  27546. switch (combinationOperator) {
  27547. case 0:
  27548. for (s2 = 0; s2 < symbolWidth; s2++) {
  27549. row[offsetS + s2] |= symbolRow[s2];
  27550. }
  27551. break;
  27552. case 2:
  27553. for (s2 = 0; s2 < symbolWidth; s2++) {
  27554. row[offsetS + s2] ^= symbolRow[s2];
  27555. }
  27556. break;
  27557. default:
  27558. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27559. }
  27560. }
  27561. currentS += symbolWidth - 1;
  27562. }
  27563. i++;
  27564. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  27565. if (deltaS === null) {
  27566. break;
  27567. }
  27568. currentS += deltaS + dsOffset;
  27569. } while (true);
  27570. }
  27571. return bitmap;
  27572. }
  27573. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  27574. const at = [];
  27575. if (!mmr) {
  27576. at.push({
  27577. x: -patternWidth,
  27578. y: 0
  27579. });
  27580. if (template === 0) {
  27581. at.push({
  27582. x: -3,
  27583. y: -1
  27584. }, {
  27585. x: 2,
  27586. y: -2
  27587. }, {
  27588. x: -2,
  27589. y: -2
  27590. });
  27591. }
  27592. }
  27593. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  27594. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  27595. const patterns = [];
  27596. for (let i = 0; i <= maxPatternIndex; i++) {
  27597. const patternBitmap = [];
  27598. const xMin = patternWidth * i;
  27599. const xMax = xMin + patternWidth;
  27600. for (let y = 0; y < patternHeight; y++) {
  27601. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27602. }
  27603. patterns.push(patternBitmap);
  27604. }
  27605. return patterns;
  27606. }
  27607. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  27608. const skip = null;
  27609. if (enableSkip) {
  27610. throw new Jbig2Error("skip is not supported");
  27611. }
  27612. if (combinationOperator !== 0) {
  27613. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  27614. }
  27615. const regionBitmap = [];
  27616. let i, j, row;
  27617. for (i = 0; i < regionHeight; i++) {
  27618. row = new Uint8Array(regionWidth);
  27619. if (defaultPixelValue) {
  27620. for (j = 0; j < regionWidth; j++) {
  27621. row[j] = defaultPixelValue;
  27622. }
  27623. }
  27624. regionBitmap.push(row);
  27625. }
  27626. const numberOfPatterns = patterns.length;
  27627. const pattern0 = patterns[0];
  27628. const patternWidth = pattern0[0].length,
  27629. patternHeight = pattern0.length;
  27630. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  27631. const at = [];
  27632. if (!mmr) {
  27633. at.push({
  27634. x: template <= 1 ? 3 : 2,
  27635. y: -1
  27636. });
  27637. if (template === 0) {
  27638. at.push({
  27639. x: -3,
  27640. y: -1
  27641. }, {
  27642. x: 2,
  27643. y: -2
  27644. }, {
  27645. x: -2,
  27646. y: -2
  27647. });
  27648. }
  27649. }
  27650. const grayScaleBitPlanes = [];
  27651. let mmrInput, bitmap;
  27652. if (mmr) {
  27653. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27654. }
  27655. for (i = bitsPerValue - 1; i >= 0; i--) {
  27656. if (mmr) {
  27657. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  27658. } else {
  27659. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  27660. }
  27661. grayScaleBitPlanes[i] = bitmap;
  27662. }
  27663. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  27664. for (mg = 0; mg < gridHeight; mg++) {
  27665. for (ng = 0; ng < gridWidth; ng++) {
  27666. bit = 0;
  27667. patternIndex = 0;
  27668. for (j = bitsPerValue - 1; j >= 0; j--) {
  27669. bit ^= grayScaleBitPlanes[j][mg][ng];
  27670. patternIndex |= bit << j;
  27671. }
  27672. patternBitmap = patterns[patternIndex];
  27673. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  27674. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  27675. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  27676. for (i = 0; i < patternHeight; i++) {
  27677. regionRow = regionBitmap[y + i];
  27678. patternRow = patternBitmap[i];
  27679. for (j = 0; j < patternWidth; j++) {
  27680. regionRow[x + j] |= patternRow[j];
  27681. }
  27682. }
  27683. } else {
  27684. let regionX, regionY;
  27685. for (i = 0; i < patternHeight; i++) {
  27686. regionY = y + i;
  27687. if (regionY < 0 || regionY >= regionHeight) {
  27688. continue;
  27689. }
  27690. regionRow = regionBitmap[regionY];
  27691. patternRow = patternBitmap[i];
  27692. for (j = 0; j < patternWidth; j++) {
  27693. regionX = x + j;
  27694. if (regionX >= 0 && regionX < regionWidth) {
  27695. regionRow[regionX] |= patternRow[j];
  27696. }
  27697. }
  27698. }
  27699. }
  27700. }
  27701. }
  27702. return regionBitmap;
  27703. }
  27704. function readSegmentHeader(data, start) {
  27705. const segmentHeader = {};
  27706. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  27707. const flags = data[start + 4];
  27708. const segmentType = flags & 0x3f;
  27709. if (!SegmentTypes[segmentType]) {
  27710. throw new Jbig2Error("invalid segment type: " + segmentType);
  27711. }
  27712. segmentHeader.type = segmentType;
  27713. segmentHeader.typeName = SegmentTypes[segmentType];
  27714. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  27715. const pageAssociationFieldSize = !!(flags & 0x40);
  27716. const referredFlags = data[start + 5];
  27717. let referredToCount = referredFlags >> 5 & 7;
  27718. const retainBits = [referredFlags & 31];
  27719. let position = start + 6;
  27720. if (referredFlags === 7) {
  27721. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  27722. position += 3;
  27723. let bytes = referredToCount + 7 >> 3;
  27724. retainBits[0] = data[position++];
  27725. while (--bytes > 0) {
  27726. retainBits.push(data[position++]);
  27727. }
  27728. } else if (referredFlags === 5 || referredFlags === 6) {
  27729. throw new Jbig2Error("invalid referred-to flags");
  27730. }
  27731. segmentHeader.retainBits = retainBits;
  27732. let referredToSegmentNumberSize = 4;
  27733. if (segmentHeader.number <= 256) {
  27734. referredToSegmentNumberSize = 1;
  27735. } else if (segmentHeader.number <= 65536) {
  27736. referredToSegmentNumberSize = 2;
  27737. }
  27738. const referredTo = [];
  27739. let i, ii;
  27740. for (i = 0; i < referredToCount; i++) {
  27741. let number;
  27742. if (referredToSegmentNumberSize === 1) {
  27743. number = data[position];
  27744. } else if (referredToSegmentNumberSize === 2) {
  27745. number = (0, _core_utils.readUint16)(data, position);
  27746. } else {
  27747. number = (0, _core_utils.readUint32)(data, position);
  27748. }
  27749. referredTo.push(number);
  27750. position += referredToSegmentNumberSize;
  27751. }
  27752. segmentHeader.referredTo = referredTo;
  27753. if (!pageAssociationFieldSize) {
  27754. segmentHeader.pageAssociation = data[position++];
  27755. } else {
  27756. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  27757. position += 4;
  27758. }
  27759. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  27760. position += 4;
  27761. if (segmentHeader.length === 0xffffffff) {
  27762. if (segmentType === 38) {
  27763. const genericRegionInfo = readRegionSegmentInformation(data, position);
  27764. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  27765. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  27766. const searchPatternLength = 6;
  27767. const searchPattern = new Uint8Array(searchPatternLength);
  27768. if (!genericRegionMmr) {
  27769. searchPattern[0] = 0xff;
  27770. searchPattern[1] = 0xac;
  27771. }
  27772. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  27773. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  27774. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  27775. searchPattern[5] = genericRegionInfo.height & 0xff;
  27776. for (i = position, ii = data.length; i < ii; i++) {
  27777. let j = 0;
  27778. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  27779. j++;
  27780. }
  27781. if (j === searchPatternLength) {
  27782. segmentHeader.length = i + searchPatternLength;
  27783. break;
  27784. }
  27785. }
  27786. if (segmentHeader.length === 0xffffffff) {
  27787. throw new Jbig2Error("segment end was not found");
  27788. }
  27789. } else {
  27790. throw new Jbig2Error("invalid unknown segment length");
  27791. }
  27792. }
  27793. segmentHeader.headerEnd = position;
  27794. return segmentHeader;
  27795. }
  27796. function readSegments(header, data, start, end) {
  27797. const segments = [];
  27798. let position = start;
  27799. while (position < end) {
  27800. const segmentHeader = readSegmentHeader(data, position);
  27801. position = segmentHeader.headerEnd;
  27802. const segment = {
  27803. header: segmentHeader,
  27804. data
  27805. };
  27806. if (!header.randomAccess) {
  27807. segment.start = position;
  27808. position += segmentHeader.length;
  27809. segment.end = position;
  27810. }
  27811. segments.push(segment);
  27812. if (segmentHeader.type === 51) {
  27813. break;
  27814. }
  27815. }
  27816. if (header.randomAccess) {
  27817. for (let i = 0, ii = segments.length; i < ii; i++) {
  27818. segments[i].start = position;
  27819. position += segments[i].header.length;
  27820. segments[i].end = position;
  27821. }
  27822. }
  27823. return segments;
  27824. }
  27825. function readRegionSegmentInformation(data, start) {
  27826. return {
  27827. width: (0, _core_utils.readUint32)(data, start),
  27828. height: (0, _core_utils.readUint32)(data, start + 4),
  27829. x: (0, _core_utils.readUint32)(data, start + 8),
  27830. y: (0, _core_utils.readUint32)(data, start + 12),
  27831. combinationOperator: data[start + 16] & 7
  27832. };
  27833. }
  27834. const RegionSegmentInformationFieldLength = 17;
  27835. function processSegment(segment, visitor) {
  27836. const header = segment.header;
  27837. const data = segment.data,
  27838. end = segment.end;
  27839. let position = segment.start;
  27840. let args, at, i, atLength;
  27841. switch (header.type) {
  27842. case 0:
  27843. const dictionary = {};
  27844. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  27845. dictionary.huffman = !!(dictionaryFlags & 1);
  27846. dictionary.refinement = !!(dictionaryFlags & 2);
  27847. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  27848. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  27849. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  27850. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  27851. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  27852. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  27853. dictionary.template = dictionaryFlags >> 10 & 3;
  27854. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  27855. position += 2;
  27856. if (!dictionary.huffman) {
  27857. atLength = dictionary.template === 0 ? 4 : 1;
  27858. at = [];
  27859. for (i = 0; i < atLength; i++) {
  27860. at.push({
  27861. x: (0, _core_utils.readInt8)(data, position),
  27862. y: (0, _core_utils.readInt8)(data, position + 1)
  27863. });
  27864. position += 2;
  27865. }
  27866. dictionary.at = at;
  27867. }
  27868. if (dictionary.refinement && !dictionary.refinementTemplate) {
  27869. at = [];
  27870. for (i = 0; i < 2; i++) {
  27871. at.push({
  27872. x: (0, _core_utils.readInt8)(data, position),
  27873. y: (0, _core_utils.readInt8)(data, position + 1)
  27874. });
  27875. position += 2;
  27876. }
  27877. dictionary.refinementAt = at;
  27878. }
  27879. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  27880. position += 4;
  27881. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  27882. position += 4;
  27883. args = [dictionary, header.number, header.referredTo, data, position, end];
  27884. break;
  27885. case 6:
  27886. case 7:
  27887. const textRegion = {};
  27888. textRegion.info = readRegionSegmentInformation(data, position);
  27889. position += RegionSegmentInformationFieldLength;
  27890. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  27891. position += 2;
  27892. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  27893. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  27894. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  27895. textRegion.stripSize = 1 << textRegion.logStripSize;
  27896. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  27897. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  27898. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  27899. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  27900. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  27901. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  27902. if (textRegion.huffman) {
  27903. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  27904. position += 2;
  27905. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  27906. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  27907. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  27908. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  27909. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  27910. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  27911. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  27912. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  27913. }
  27914. if (textRegion.refinement && !textRegion.refinementTemplate) {
  27915. at = [];
  27916. for (i = 0; i < 2; i++) {
  27917. at.push({
  27918. x: (0, _core_utils.readInt8)(data, position),
  27919. y: (0, _core_utils.readInt8)(data, position + 1)
  27920. });
  27921. position += 2;
  27922. }
  27923. textRegion.refinementAt = at;
  27924. }
  27925. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  27926. position += 4;
  27927. args = [textRegion, header.referredTo, data, position, end];
  27928. break;
  27929. case 16:
  27930. const patternDictionary = {};
  27931. const patternDictionaryFlags = data[position++];
  27932. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  27933. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  27934. patternDictionary.patternWidth = data[position++];
  27935. patternDictionary.patternHeight = data[position++];
  27936. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  27937. position += 4;
  27938. args = [patternDictionary, header.number, data, position, end];
  27939. break;
  27940. case 22:
  27941. case 23:
  27942. const halftoneRegion = {};
  27943. halftoneRegion.info = readRegionSegmentInformation(data, position);
  27944. position += RegionSegmentInformationFieldLength;
  27945. const halftoneRegionFlags = data[position++];
  27946. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  27947. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  27948. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  27949. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  27950. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  27951. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  27952. position += 4;
  27953. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  27954. position += 4;
  27955. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27956. position += 4;
  27957. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27958. position += 4;
  27959. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  27960. position += 2;
  27961. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  27962. position += 2;
  27963. args = [halftoneRegion, header.referredTo, data, position, end];
  27964. break;
  27965. case 38:
  27966. case 39:
  27967. const genericRegion = {};
  27968. genericRegion.info = readRegionSegmentInformation(data, position);
  27969. position += RegionSegmentInformationFieldLength;
  27970. const genericRegionSegmentFlags = data[position++];
  27971. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  27972. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  27973. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  27974. if (!genericRegion.mmr) {
  27975. atLength = genericRegion.template === 0 ? 4 : 1;
  27976. at = [];
  27977. for (i = 0; i < atLength; i++) {
  27978. at.push({
  27979. x: (0, _core_utils.readInt8)(data, position),
  27980. y: (0, _core_utils.readInt8)(data, position + 1)
  27981. });
  27982. position += 2;
  27983. }
  27984. genericRegion.at = at;
  27985. }
  27986. args = [genericRegion, data, position, end];
  27987. break;
  27988. case 48:
  27989. const pageInfo = {
  27990. width: (0, _core_utils.readUint32)(data, position),
  27991. height: (0, _core_utils.readUint32)(data, position + 4),
  27992. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  27993. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  27994. };
  27995. if (pageInfo.height === 0xffffffff) {
  27996. delete pageInfo.height;
  27997. }
  27998. const pageSegmentFlags = data[position + 16];
  27999. (0, _core_utils.readUint16)(data, position + 17);
  28000. pageInfo.lossless = !!(pageSegmentFlags & 1);
  28001. pageInfo.refinement = !!(pageSegmentFlags & 2);
  28002. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  28003. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  28004. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  28005. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  28006. args = [pageInfo];
  28007. break;
  28008. case 49:
  28009. break;
  28010. case 50:
  28011. break;
  28012. case 51:
  28013. break;
  28014. case 53:
  28015. args = [header.number, data, position, end];
  28016. break;
  28017. case 62:
  28018. break;
  28019. default:
  28020. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  28021. }
  28022. const callbackName = "on" + header.typeName;
  28023. if (callbackName in visitor) {
  28024. visitor[callbackName].apply(visitor, args);
  28025. }
  28026. }
  28027. function processSegments(segments, visitor) {
  28028. for (let i = 0, ii = segments.length; i < ii; i++) {
  28029. processSegment(segments[i], visitor);
  28030. }
  28031. }
  28032. function parseJbig2Chunks(chunks) {
  28033. const visitor = new SimpleSegmentVisitor();
  28034. for (let i = 0, ii = chunks.length; i < ii; i++) {
  28035. const chunk = chunks[i];
  28036. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  28037. processSegments(segments, visitor);
  28038. }
  28039. return visitor.buffer;
  28040. }
  28041. function parseJbig2(data) {
  28042. const end = data.length;
  28043. let position = 0;
  28044. 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) {
  28045. throw new Jbig2Error("parseJbig2 - invalid header.");
  28046. }
  28047. const header = Object.create(null);
  28048. position += 8;
  28049. const flags = data[position++];
  28050. header.randomAccess = !(flags & 1);
  28051. if (!(flags & 2)) {
  28052. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  28053. position += 4;
  28054. }
  28055. const segments = readSegments(header, data, position, end);
  28056. const visitor = new SimpleSegmentVisitor();
  28057. processSegments(segments, visitor);
  28058. const {
  28059. width,
  28060. height
  28061. } = visitor.currentPageInfo;
  28062. const bitPacked = visitor.buffer;
  28063. const imgData = new Uint8ClampedArray(width * height);
  28064. let q = 0,
  28065. k = 0;
  28066. for (let i = 0; i < height; i++) {
  28067. let mask = 0,
  28068. buffer;
  28069. for (let j = 0; j < width; j++) {
  28070. if (!mask) {
  28071. mask = 128;
  28072. buffer = bitPacked[k++];
  28073. }
  28074. imgData[q++] = buffer & mask ? 0 : 255;
  28075. mask >>= 1;
  28076. }
  28077. }
  28078. return {
  28079. imgData,
  28080. width,
  28081. height
  28082. };
  28083. }
  28084. class SimpleSegmentVisitor {
  28085. onPageInformation(info) {
  28086. this.currentPageInfo = info;
  28087. const rowSize = info.width + 7 >> 3;
  28088. const buffer = new Uint8ClampedArray(rowSize * info.height);
  28089. if (info.defaultPixelValue) {
  28090. buffer.fill(0xff);
  28091. }
  28092. this.buffer = buffer;
  28093. }
  28094. drawBitmap(regionInfo, bitmap) {
  28095. const pageInfo = this.currentPageInfo;
  28096. const width = regionInfo.width,
  28097. height = regionInfo.height;
  28098. const rowSize = pageInfo.width + 7 >> 3;
  28099. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  28100. const buffer = this.buffer;
  28101. const mask0 = 128 >> (regionInfo.x & 7);
  28102. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  28103. let i, j, mask, offset;
  28104. switch (combinationOperator) {
  28105. case 0:
  28106. for (i = 0; i < height; i++) {
  28107. mask = mask0;
  28108. offset = offset0;
  28109. for (j = 0; j < width; j++) {
  28110. if (bitmap[i][j]) {
  28111. buffer[offset] |= mask;
  28112. }
  28113. mask >>= 1;
  28114. if (!mask) {
  28115. mask = 128;
  28116. offset++;
  28117. }
  28118. }
  28119. offset0 += rowSize;
  28120. }
  28121. break;
  28122. case 2:
  28123. for (i = 0; i < height; i++) {
  28124. mask = mask0;
  28125. offset = offset0;
  28126. for (j = 0; j < width; j++) {
  28127. if (bitmap[i][j]) {
  28128. buffer[offset] ^= mask;
  28129. }
  28130. mask >>= 1;
  28131. if (!mask) {
  28132. mask = 128;
  28133. offset++;
  28134. }
  28135. }
  28136. offset0 += rowSize;
  28137. }
  28138. break;
  28139. default:
  28140. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  28141. }
  28142. }
  28143. onImmediateGenericRegion(region, data, start, end) {
  28144. const regionInfo = region.info;
  28145. const decodingContext = new DecodingContext(data, start, end);
  28146. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  28147. this.drawBitmap(regionInfo, bitmap);
  28148. }
  28149. onImmediateLosslessGenericRegion() {
  28150. this.onImmediateGenericRegion.apply(this, arguments);
  28151. }
  28152. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  28153. let huffmanTables, huffmanInput;
  28154. if (dictionary.huffman) {
  28155. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  28156. huffmanInput = new Reader(data, start, end);
  28157. }
  28158. let symbols = this.symbols;
  28159. if (!symbols) {
  28160. this.symbols = symbols = {};
  28161. }
  28162. let inputSymbols = [];
  28163. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  28164. const referredSymbols = symbols[referredSegments[i]];
  28165. if (referredSymbols) {
  28166. inputSymbols = inputSymbols.concat(referredSymbols);
  28167. }
  28168. }
  28169. const decodingContext = new DecodingContext(data, start, end);
  28170. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  28171. }
  28172. onImmediateTextRegion(region, referredSegments, data, start, end) {
  28173. const regionInfo = region.info;
  28174. let huffmanTables, huffmanInput;
  28175. const symbols = this.symbols;
  28176. let inputSymbols = [];
  28177. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  28178. const referredSymbols = symbols[referredSegments[i]];
  28179. if (referredSymbols) {
  28180. inputSymbols = inputSymbols.concat(referredSymbols);
  28181. }
  28182. }
  28183. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  28184. if (region.huffman) {
  28185. huffmanInput = new Reader(data, start, end);
  28186. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  28187. }
  28188. const decodingContext = new DecodingContext(data, start, end);
  28189. 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);
  28190. this.drawBitmap(regionInfo, bitmap);
  28191. }
  28192. onImmediateLosslessTextRegion() {
  28193. this.onImmediateTextRegion.apply(this, arguments);
  28194. }
  28195. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  28196. let patterns = this.patterns;
  28197. if (!patterns) {
  28198. this.patterns = patterns = {};
  28199. }
  28200. const decodingContext = new DecodingContext(data, start, end);
  28201. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  28202. }
  28203. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  28204. const patterns = this.patterns[referredSegments[0]];
  28205. const regionInfo = region.info;
  28206. const decodingContext = new DecodingContext(data, start, end);
  28207. 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);
  28208. this.drawBitmap(regionInfo, bitmap);
  28209. }
  28210. onImmediateLosslessHalftoneRegion() {
  28211. this.onImmediateHalftoneRegion.apply(this, arguments);
  28212. }
  28213. onTables(currentSegment, data, start, end) {
  28214. let customTables = this.customTables;
  28215. if (!customTables) {
  28216. this.customTables = customTables = {};
  28217. }
  28218. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  28219. }
  28220. }
  28221. class HuffmanLine {
  28222. constructor(lineData) {
  28223. if (lineData.length === 2) {
  28224. this.isOOB = true;
  28225. this.rangeLow = 0;
  28226. this.prefixLength = lineData[0];
  28227. this.rangeLength = 0;
  28228. this.prefixCode = lineData[1];
  28229. this.isLowerRange = false;
  28230. } else {
  28231. this.isOOB = false;
  28232. this.rangeLow = lineData[0];
  28233. this.prefixLength = lineData[1];
  28234. this.rangeLength = lineData[2];
  28235. this.prefixCode = lineData[3];
  28236. this.isLowerRange = lineData[4] === "lower";
  28237. }
  28238. }
  28239. }
  28240. class HuffmanTreeNode {
  28241. constructor(line) {
  28242. this.children = [];
  28243. if (line) {
  28244. this.isLeaf = true;
  28245. this.rangeLength = line.rangeLength;
  28246. this.rangeLow = line.rangeLow;
  28247. this.isLowerRange = line.isLowerRange;
  28248. this.isOOB = line.isOOB;
  28249. } else {
  28250. this.isLeaf = false;
  28251. }
  28252. }
  28253. buildTree(line, shift) {
  28254. const bit = line.prefixCode >> shift & 1;
  28255. if (shift <= 0) {
  28256. this.children[bit] = new HuffmanTreeNode(line);
  28257. } else {
  28258. let node = this.children[bit];
  28259. if (!node) {
  28260. this.children[bit] = node = new HuffmanTreeNode(null);
  28261. }
  28262. node.buildTree(line, shift - 1);
  28263. }
  28264. }
  28265. decodeNode(reader) {
  28266. if (this.isLeaf) {
  28267. if (this.isOOB) {
  28268. return null;
  28269. }
  28270. const htOffset = reader.readBits(this.rangeLength);
  28271. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  28272. }
  28273. const node = this.children[reader.readBit()];
  28274. if (!node) {
  28275. throw new Jbig2Error("invalid Huffman data");
  28276. }
  28277. return node.decodeNode(reader);
  28278. }
  28279. }
  28280. class HuffmanTable {
  28281. constructor(lines, prefixCodesDone) {
  28282. if (!prefixCodesDone) {
  28283. this.assignPrefixCodes(lines);
  28284. }
  28285. this.rootNode = new HuffmanTreeNode(null);
  28286. for (let i = 0, ii = lines.length; i < ii; i++) {
  28287. const line = lines[i];
  28288. if (line.prefixLength > 0) {
  28289. this.rootNode.buildTree(line, line.prefixLength - 1);
  28290. }
  28291. }
  28292. }
  28293. decode(reader) {
  28294. return this.rootNode.decodeNode(reader);
  28295. }
  28296. assignPrefixCodes(lines) {
  28297. const linesLength = lines.length;
  28298. let prefixLengthMax = 0;
  28299. for (let i = 0; i < linesLength; i++) {
  28300. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  28301. }
  28302. const histogram = new Uint32Array(prefixLengthMax + 1);
  28303. for (let i = 0; i < linesLength; i++) {
  28304. histogram[lines[i].prefixLength]++;
  28305. }
  28306. let currentLength = 1,
  28307. firstCode = 0,
  28308. currentCode,
  28309. currentTemp,
  28310. line;
  28311. histogram[0] = 0;
  28312. while (currentLength <= prefixLengthMax) {
  28313. firstCode = firstCode + histogram[currentLength - 1] << 1;
  28314. currentCode = firstCode;
  28315. currentTemp = 0;
  28316. while (currentTemp < linesLength) {
  28317. line = lines[currentTemp];
  28318. if (line.prefixLength === currentLength) {
  28319. line.prefixCode = currentCode;
  28320. currentCode++;
  28321. }
  28322. currentTemp++;
  28323. }
  28324. currentLength++;
  28325. }
  28326. }
  28327. }
  28328. function decodeTablesSegment(data, start, end) {
  28329. const flags = data[start];
  28330. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  28331. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  28332. const reader = new Reader(data, start + 9, end);
  28333. const prefixSizeBits = (flags >> 1 & 7) + 1;
  28334. const rangeSizeBits = (flags >> 4 & 7) + 1;
  28335. const lines = [];
  28336. let prefixLength,
  28337. rangeLength,
  28338. currentRangeLow = lowestValue;
  28339. do {
  28340. prefixLength = reader.readBits(prefixSizeBits);
  28341. rangeLength = reader.readBits(rangeSizeBits);
  28342. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  28343. currentRangeLow += 1 << rangeLength;
  28344. } while (currentRangeLow < highestValue);
  28345. prefixLength = reader.readBits(prefixSizeBits);
  28346. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  28347. prefixLength = reader.readBits(prefixSizeBits);
  28348. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  28349. if (flags & 1) {
  28350. prefixLength = reader.readBits(prefixSizeBits);
  28351. lines.push(new HuffmanLine([prefixLength, 0]));
  28352. }
  28353. return new HuffmanTable(lines, false);
  28354. }
  28355. const standardTablesCache = {};
  28356. function getStandardTable(number) {
  28357. let table = standardTablesCache[number];
  28358. if (table) {
  28359. return table;
  28360. }
  28361. let lines;
  28362. switch (number) {
  28363. case 1:
  28364. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  28365. break;
  28366. case 2:
  28367. 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]];
  28368. break;
  28369. case 3:
  28370. 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]];
  28371. break;
  28372. case 4:
  28373. 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]];
  28374. break;
  28375. case 5:
  28376. 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]];
  28377. break;
  28378. case 6:
  28379. 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]];
  28380. break;
  28381. case 7:
  28382. 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]];
  28383. break;
  28384. case 8:
  28385. 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]];
  28386. break;
  28387. case 9:
  28388. 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]];
  28389. break;
  28390. case 10:
  28391. 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]];
  28392. break;
  28393. case 11:
  28394. 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]];
  28395. break;
  28396. case 12:
  28397. 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]];
  28398. break;
  28399. case 13:
  28400. 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]];
  28401. break;
  28402. case 14:
  28403. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  28404. break;
  28405. case 15:
  28406. 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]];
  28407. break;
  28408. default:
  28409. throw new Jbig2Error(`standard table B.${number} does not exist`);
  28410. }
  28411. for (let i = 0, ii = lines.length; i < ii; i++) {
  28412. lines[i] = new HuffmanLine(lines[i]);
  28413. }
  28414. table = new HuffmanTable(lines, true);
  28415. standardTablesCache[number] = table;
  28416. return table;
  28417. }
  28418. class Reader {
  28419. constructor(data, start, end) {
  28420. this.data = data;
  28421. this.start = start;
  28422. this.end = end;
  28423. this.position = start;
  28424. this.shift = -1;
  28425. this.currentByte = 0;
  28426. }
  28427. readBit() {
  28428. if (this.shift < 0) {
  28429. if (this.position >= this.end) {
  28430. throw new Jbig2Error("end of data while reading bit");
  28431. }
  28432. this.currentByte = this.data[this.position++];
  28433. this.shift = 7;
  28434. }
  28435. const bit = this.currentByte >> this.shift & 1;
  28436. this.shift--;
  28437. return bit;
  28438. }
  28439. readBits(numBits) {
  28440. let result = 0,
  28441. i;
  28442. for (i = numBits - 1; i >= 0; i--) {
  28443. result |= this.readBit() << i;
  28444. }
  28445. return result;
  28446. }
  28447. byteAlign() {
  28448. this.shift = -1;
  28449. }
  28450. next() {
  28451. if (this.position >= this.end) {
  28452. return -1;
  28453. }
  28454. return this.data[this.position++];
  28455. }
  28456. }
  28457. function getCustomHuffmanTable(index, referredTo, customTables) {
  28458. let currentIndex = 0;
  28459. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  28460. const table = customTables[referredTo[i]];
  28461. if (table) {
  28462. if (index === currentIndex) {
  28463. return table;
  28464. }
  28465. currentIndex++;
  28466. }
  28467. }
  28468. throw new Jbig2Error("can't find custom Huffman table");
  28469. }
  28470. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  28471. const codes = [];
  28472. for (let i = 0; i <= 34; i++) {
  28473. const codeLength = reader.readBits(4);
  28474. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28475. }
  28476. const runCodesTable = new HuffmanTable(codes, false);
  28477. codes.length = 0;
  28478. for (let i = 0; i < numberOfSymbols;) {
  28479. const codeLength = runCodesTable.decode(reader);
  28480. if (codeLength >= 32) {
  28481. let repeatedLength, numberOfRepeats, j;
  28482. switch (codeLength) {
  28483. case 32:
  28484. if (i === 0) {
  28485. throw new Jbig2Error("no previous value in symbol ID table");
  28486. }
  28487. numberOfRepeats = reader.readBits(2) + 3;
  28488. repeatedLength = codes[i - 1].prefixLength;
  28489. break;
  28490. case 33:
  28491. numberOfRepeats = reader.readBits(3) + 3;
  28492. repeatedLength = 0;
  28493. break;
  28494. case 34:
  28495. numberOfRepeats = reader.readBits(7) + 11;
  28496. repeatedLength = 0;
  28497. break;
  28498. default:
  28499. throw new Jbig2Error("invalid code length in symbol ID table");
  28500. }
  28501. for (j = 0; j < numberOfRepeats; j++) {
  28502. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  28503. i++;
  28504. }
  28505. } else {
  28506. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28507. i++;
  28508. }
  28509. }
  28510. reader.byteAlign();
  28511. const symbolIDTable = new HuffmanTable(codes, false);
  28512. let customIndex = 0,
  28513. tableFirstS,
  28514. tableDeltaS,
  28515. tableDeltaT;
  28516. switch (textRegion.huffmanFS) {
  28517. case 0:
  28518. case 1:
  28519. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  28520. break;
  28521. case 3:
  28522. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28523. customIndex++;
  28524. break;
  28525. default:
  28526. throw new Jbig2Error("invalid Huffman FS selector");
  28527. }
  28528. switch (textRegion.huffmanDS) {
  28529. case 0:
  28530. case 1:
  28531. case 2:
  28532. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  28533. break;
  28534. case 3:
  28535. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28536. customIndex++;
  28537. break;
  28538. default:
  28539. throw new Jbig2Error("invalid Huffman DS selector");
  28540. }
  28541. switch (textRegion.huffmanDT) {
  28542. case 0:
  28543. case 1:
  28544. case 2:
  28545. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  28546. break;
  28547. case 3:
  28548. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28549. customIndex++;
  28550. break;
  28551. default:
  28552. throw new Jbig2Error("invalid Huffman DT selector");
  28553. }
  28554. if (textRegion.refinement) {
  28555. throw new Jbig2Error("refinement with Huffman is not supported");
  28556. }
  28557. return {
  28558. symbolIDTable,
  28559. tableFirstS,
  28560. tableDeltaS,
  28561. tableDeltaT
  28562. };
  28563. }
  28564. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  28565. let customIndex = 0,
  28566. tableDeltaHeight,
  28567. tableDeltaWidth;
  28568. switch (dictionary.huffmanDHSelector) {
  28569. case 0:
  28570. case 1:
  28571. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  28572. break;
  28573. case 3:
  28574. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28575. customIndex++;
  28576. break;
  28577. default:
  28578. throw new Jbig2Error("invalid Huffman DH selector");
  28579. }
  28580. switch (dictionary.huffmanDWSelector) {
  28581. case 0:
  28582. case 1:
  28583. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  28584. break;
  28585. case 3:
  28586. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28587. customIndex++;
  28588. break;
  28589. default:
  28590. throw new Jbig2Error("invalid Huffman DW selector");
  28591. }
  28592. let tableBitmapSize, tableAggregateInstances;
  28593. if (dictionary.bitmapSizeSelector) {
  28594. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28595. customIndex++;
  28596. } else {
  28597. tableBitmapSize = getStandardTable(1);
  28598. }
  28599. if (dictionary.aggregationInstancesSelector) {
  28600. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28601. } else {
  28602. tableAggregateInstances = getStandardTable(1);
  28603. }
  28604. return {
  28605. tableDeltaHeight,
  28606. tableDeltaWidth,
  28607. tableBitmapSize,
  28608. tableAggregateInstances
  28609. };
  28610. }
  28611. function readUncompressedBitmap(reader, width, height) {
  28612. const bitmap = [];
  28613. for (let y = 0; y < height; y++) {
  28614. const row = new Uint8Array(width);
  28615. bitmap.push(row);
  28616. for (let x = 0; x < width; x++) {
  28617. row[x] = reader.readBit();
  28618. }
  28619. reader.byteAlign();
  28620. }
  28621. return bitmap;
  28622. }
  28623. function decodeMMRBitmap(input, width, height, endOfBlock) {
  28624. const params = {
  28625. K: -1,
  28626. Columns: width,
  28627. Rows: height,
  28628. BlackIs1: true,
  28629. EndOfBlock: endOfBlock
  28630. };
  28631. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  28632. const bitmap = [];
  28633. let currentByte,
  28634. eof = false;
  28635. for (let y = 0; y < height; y++) {
  28636. const row = new Uint8Array(width);
  28637. bitmap.push(row);
  28638. let shift = -1;
  28639. for (let x = 0; x < width; x++) {
  28640. if (shift < 0) {
  28641. currentByte = decoder.readNextChar();
  28642. if (currentByte === -1) {
  28643. currentByte = 0;
  28644. eof = true;
  28645. }
  28646. shift = 7;
  28647. }
  28648. row[x] = currentByte >> shift & 1;
  28649. shift--;
  28650. }
  28651. }
  28652. if (endOfBlock && !eof) {
  28653. const lookForEOFLimit = 5;
  28654. for (let i = 0; i < lookForEOFLimit; i++) {
  28655. if (decoder.readNextChar() === -1) {
  28656. break;
  28657. }
  28658. }
  28659. }
  28660. return bitmap;
  28661. }
  28662. class Jbig2Image {
  28663. parseChunks(chunks) {
  28664. return parseJbig2Chunks(chunks);
  28665. }
  28666. parse(data) {
  28667. const {
  28668. imgData,
  28669. width,
  28670. height
  28671. } = parseJbig2(data);
  28672. this.width = width;
  28673. this.height = height;
  28674. return imgData;
  28675. }
  28676. }
  28677. exports.Jbig2Image = Jbig2Image;
  28678. /***/ }),
  28679. /* 36 */
  28680. /***/ ((__unused_webpack_module, exports) => {
  28681. Object.defineProperty(exports, "__esModule", ({
  28682. value: true
  28683. }));
  28684. exports.ArithmeticDecoder = void 0;
  28685. const QeTable = [{
  28686. qe: 0x5601,
  28687. nmps: 1,
  28688. nlps: 1,
  28689. switchFlag: 1
  28690. }, {
  28691. qe: 0x3401,
  28692. nmps: 2,
  28693. nlps: 6,
  28694. switchFlag: 0
  28695. }, {
  28696. qe: 0x1801,
  28697. nmps: 3,
  28698. nlps: 9,
  28699. switchFlag: 0
  28700. }, {
  28701. qe: 0x0ac1,
  28702. nmps: 4,
  28703. nlps: 12,
  28704. switchFlag: 0
  28705. }, {
  28706. qe: 0x0521,
  28707. nmps: 5,
  28708. nlps: 29,
  28709. switchFlag: 0
  28710. }, {
  28711. qe: 0x0221,
  28712. nmps: 38,
  28713. nlps: 33,
  28714. switchFlag: 0
  28715. }, {
  28716. qe: 0x5601,
  28717. nmps: 7,
  28718. nlps: 6,
  28719. switchFlag: 1
  28720. }, {
  28721. qe: 0x5401,
  28722. nmps: 8,
  28723. nlps: 14,
  28724. switchFlag: 0
  28725. }, {
  28726. qe: 0x4801,
  28727. nmps: 9,
  28728. nlps: 14,
  28729. switchFlag: 0
  28730. }, {
  28731. qe: 0x3801,
  28732. nmps: 10,
  28733. nlps: 14,
  28734. switchFlag: 0
  28735. }, {
  28736. qe: 0x3001,
  28737. nmps: 11,
  28738. nlps: 17,
  28739. switchFlag: 0
  28740. }, {
  28741. qe: 0x2401,
  28742. nmps: 12,
  28743. nlps: 18,
  28744. switchFlag: 0
  28745. }, {
  28746. qe: 0x1c01,
  28747. nmps: 13,
  28748. nlps: 20,
  28749. switchFlag: 0
  28750. }, {
  28751. qe: 0x1601,
  28752. nmps: 29,
  28753. nlps: 21,
  28754. switchFlag: 0
  28755. }, {
  28756. qe: 0x5601,
  28757. nmps: 15,
  28758. nlps: 14,
  28759. switchFlag: 1
  28760. }, {
  28761. qe: 0x5401,
  28762. nmps: 16,
  28763. nlps: 14,
  28764. switchFlag: 0
  28765. }, {
  28766. qe: 0x5101,
  28767. nmps: 17,
  28768. nlps: 15,
  28769. switchFlag: 0
  28770. }, {
  28771. qe: 0x4801,
  28772. nmps: 18,
  28773. nlps: 16,
  28774. switchFlag: 0
  28775. }, {
  28776. qe: 0x3801,
  28777. nmps: 19,
  28778. nlps: 17,
  28779. switchFlag: 0
  28780. }, {
  28781. qe: 0x3401,
  28782. nmps: 20,
  28783. nlps: 18,
  28784. switchFlag: 0
  28785. }, {
  28786. qe: 0x3001,
  28787. nmps: 21,
  28788. nlps: 19,
  28789. switchFlag: 0
  28790. }, {
  28791. qe: 0x2801,
  28792. nmps: 22,
  28793. nlps: 19,
  28794. switchFlag: 0
  28795. }, {
  28796. qe: 0x2401,
  28797. nmps: 23,
  28798. nlps: 20,
  28799. switchFlag: 0
  28800. }, {
  28801. qe: 0x2201,
  28802. nmps: 24,
  28803. nlps: 21,
  28804. switchFlag: 0
  28805. }, {
  28806. qe: 0x1c01,
  28807. nmps: 25,
  28808. nlps: 22,
  28809. switchFlag: 0
  28810. }, {
  28811. qe: 0x1801,
  28812. nmps: 26,
  28813. nlps: 23,
  28814. switchFlag: 0
  28815. }, {
  28816. qe: 0x1601,
  28817. nmps: 27,
  28818. nlps: 24,
  28819. switchFlag: 0
  28820. }, {
  28821. qe: 0x1401,
  28822. nmps: 28,
  28823. nlps: 25,
  28824. switchFlag: 0
  28825. }, {
  28826. qe: 0x1201,
  28827. nmps: 29,
  28828. nlps: 26,
  28829. switchFlag: 0
  28830. }, {
  28831. qe: 0x1101,
  28832. nmps: 30,
  28833. nlps: 27,
  28834. switchFlag: 0
  28835. }, {
  28836. qe: 0x0ac1,
  28837. nmps: 31,
  28838. nlps: 28,
  28839. switchFlag: 0
  28840. }, {
  28841. qe: 0x09c1,
  28842. nmps: 32,
  28843. nlps: 29,
  28844. switchFlag: 0
  28845. }, {
  28846. qe: 0x08a1,
  28847. nmps: 33,
  28848. nlps: 30,
  28849. switchFlag: 0
  28850. }, {
  28851. qe: 0x0521,
  28852. nmps: 34,
  28853. nlps: 31,
  28854. switchFlag: 0
  28855. }, {
  28856. qe: 0x0441,
  28857. nmps: 35,
  28858. nlps: 32,
  28859. switchFlag: 0
  28860. }, {
  28861. qe: 0x02a1,
  28862. nmps: 36,
  28863. nlps: 33,
  28864. switchFlag: 0
  28865. }, {
  28866. qe: 0x0221,
  28867. nmps: 37,
  28868. nlps: 34,
  28869. switchFlag: 0
  28870. }, {
  28871. qe: 0x0141,
  28872. nmps: 38,
  28873. nlps: 35,
  28874. switchFlag: 0
  28875. }, {
  28876. qe: 0x0111,
  28877. nmps: 39,
  28878. nlps: 36,
  28879. switchFlag: 0
  28880. }, {
  28881. qe: 0x0085,
  28882. nmps: 40,
  28883. nlps: 37,
  28884. switchFlag: 0
  28885. }, {
  28886. qe: 0x0049,
  28887. nmps: 41,
  28888. nlps: 38,
  28889. switchFlag: 0
  28890. }, {
  28891. qe: 0x0025,
  28892. nmps: 42,
  28893. nlps: 39,
  28894. switchFlag: 0
  28895. }, {
  28896. qe: 0x0015,
  28897. nmps: 43,
  28898. nlps: 40,
  28899. switchFlag: 0
  28900. }, {
  28901. qe: 0x0009,
  28902. nmps: 44,
  28903. nlps: 41,
  28904. switchFlag: 0
  28905. }, {
  28906. qe: 0x0005,
  28907. nmps: 45,
  28908. nlps: 42,
  28909. switchFlag: 0
  28910. }, {
  28911. qe: 0x0001,
  28912. nmps: 45,
  28913. nlps: 43,
  28914. switchFlag: 0
  28915. }, {
  28916. qe: 0x5601,
  28917. nmps: 46,
  28918. nlps: 46,
  28919. switchFlag: 0
  28920. }];
  28921. class ArithmeticDecoder {
  28922. constructor(data, start, end) {
  28923. this.data = data;
  28924. this.bp = start;
  28925. this.dataEnd = end;
  28926. this.chigh = data[start];
  28927. this.clow = 0;
  28928. this.byteIn();
  28929. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  28930. this.clow = this.clow << 7 & 0xffff;
  28931. this.ct -= 7;
  28932. this.a = 0x8000;
  28933. }
  28934. byteIn() {
  28935. const data = this.data;
  28936. let bp = this.bp;
  28937. if (data[bp] === 0xff) {
  28938. if (data[bp + 1] > 0x8f) {
  28939. this.clow += 0xff00;
  28940. this.ct = 8;
  28941. } else {
  28942. bp++;
  28943. this.clow += data[bp] << 9;
  28944. this.ct = 7;
  28945. this.bp = bp;
  28946. }
  28947. } else {
  28948. bp++;
  28949. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  28950. this.ct = 8;
  28951. this.bp = bp;
  28952. }
  28953. if (this.clow > 0xffff) {
  28954. this.chigh += this.clow >> 16;
  28955. this.clow &= 0xffff;
  28956. }
  28957. }
  28958. readBit(contexts, pos) {
  28959. let cx_index = contexts[pos] >> 1,
  28960. cx_mps = contexts[pos] & 1;
  28961. const qeTableIcx = QeTable[cx_index];
  28962. const qeIcx = qeTableIcx.qe;
  28963. let d;
  28964. let a = this.a - qeIcx;
  28965. if (this.chigh < qeIcx) {
  28966. if (a < qeIcx) {
  28967. a = qeIcx;
  28968. d = cx_mps;
  28969. cx_index = qeTableIcx.nmps;
  28970. } else {
  28971. a = qeIcx;
  28972. d = 1 ^ cx_mps;
  28973. if (qeTableIcx.switchFlag === 1) {
  28974. cx_mps = d;
  28975. }
  28976. cx_index = qeTableIcx.nlps;
  28977. }
  28978. } else {
  28979. this.chigh -= qeIcx;
  28980. if ((a & 0x8000) !== 0) {
  28981. this.a = a;
  28982. return cx_mps;
  28983. }
  28984. if (a < qeIcx) {
  28985. d = 1 ^ cx_mps;
  28986. if (qeTableIcx.switchFlag === 1) {
  28987. cx_mps = d;
  28988. }
  28989. cx_index = qeTableIcx.nlps;
  28990. } else {
  28991. d = cx_mps;
  28992. cx_index = qeTableIcx.nmps;
  28993. }
  28994. }
  28995. do {
  28996. if (this.ct === 0) {
  28997. this.byteIn();
  28998. }
  28999. a <<= 1;
  29000. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  29001. this.clow = this.clow << 1 & 0xffff;
  29002. this.ct--;
  29003. } while ((a & 0x8000) === 0);
  29004. this.a = a;
  29005. contexts[pos] = cx_index << 1 | cx_mps;
  29006. return d;
  29007. }
  29008. }
  29009. exports.ArithmeticDecoder = ArithmeticDecoder;
  29010. /***/ }),
  29011. /* 37 */
  29012. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29013. Object.defineProperty(exports, "__esModule", ({
  29014. value: true
  29015. }));
  29016. exports.JpegStream = void 0;
  29017. var _decode_stream = __w_pdfjs_require__(29);
  29018. var _primitives = __w_pdfjs_require__(5);
  29019. var _jpg = __w_pdfjs_require__(38);
  29020. var _util = __w_pdfjs_require__(2);
  29021. class JpegStream extends _decode_stream.DecodeStream {
  29022. constructor(stream, maybeLength, params) {
  29023. let ch;
  29024. while ((ch = stream.getByte()) !== -1) {
  29025. if (ch === 0xff) {
  29026. stream.skip(-1);
  29027. break;
  29028. }
  29029. }
  29030. super(maybeLength);
  29031. this.stream = stream;
  29032. this.dict = stream.dict;
  29033. this.maybeLength = maybeLength;
  29034. this.params = params;
  29035. }
  29036. get bytes() {
  29037. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  29038. }
  29039. ensureBuffer(requested) {}
  29040. readBlock() {
  29041. if (this.eof) {
  29042. return;
  29043. }
  29044. const jpegOptions = {
  29045. decodeTransform: undefined,
  29046. colorTransform: undefined
  29047. };
  29048. const decodeArr = this.dict.getArray("D", "Decode");
  29049. if (this.forceRGB && Array.isArray(decodeArr)) {
  29050. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  29051. const decodeArrLength = decodeArr.length;
  29052. const transform = new Int32Array(decodeArrLength);
  29053. let transformNeeded = false;
  29054. const maxValue = (1 << bitsPerComponent) - 1;
  29055. for (let i = 0; i < decodeArrLength; i += 2) {
  29056. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  29057. transform[i + 1] = decodeArr[i] * maxValue | 0;
  29058. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  29059. transformNeeded = true;
  29060. }
  29061. }
  29062. if (transformNeeded) {
  29063. jpegOptions.decodeTransform = transform;
  29064. }
  29065. }
  29066. if (this.params instanceof _primitives.Dict) {
  29067. const colorTransform = this.params.get("ColorTransform");
  29068. if (Number.isInteger(colorTransform)) {
  29069. jpegOptions.colorTransform = colorTransform;
  29070. }
  29071. }
  29072. const jpegImage = new _jpg.JpegImage(jpegOptions);
  29073. jpegImage.parse(this.bytes);
  29074. const data = jpegImage.getData({
  29075. width: this.drawWidth,
  29076. height: this.drawHeight,
  29077. forceRGB: this.forceRGB,
  29078. isSourcePDF: true
  29079. });
  29080. this.buffer = data;
  29081. this.bufferLength = data.length;
  29082. this.eof = true;
  29083. }
  29084. }
  29085. exports.JpegStream = JpegStream;
  29086. /***/ }),
  29087. /* 38 */
  29088. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29089. Object.defineProperty(exports, "__esModule", ({
  29090. value: true
  29091. }));
  29092. exports.JpegImage = void 0;
  29093. var _util = __w_pdfjs_require__(2);
  29094. var _core_utils = __w_pdfjs_require__(8);
  29095. class JpegError extends _util.BaseException {
  29096. constructor(msg) {
  29097. super(`JPEG error: ${msg}`, "JpegError");
  29098. }
  29099. }
  29100. class DNLMarkerError extends _util.BaseException {
  29101. constructor(message, scanLines) {
  29102. super(message, "DNLMarkerError");
  29103. this.scanLines = scanLines;
  29104. }
  29105. }
  29106. class EOIMarkerError extends _util.BaseException {
  29107. constructor(msg) {
  29108. super(msg, "EOIMarkerError");
  29109. }
  29110. }
  29111. 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]);
  29112. const dctCos1 = 4017;
  29113. const dctSin1 = 799;
  29114. const dctCos3 = 3406;
  29115. const dctSin3 = 2276;
  29116. const dctCos6 = 1567;
  29117. const dctSin6 = 3784;
  29118. const dctSqrt2 = 5793;
  29119. const dctSqrt1d2 = 2896;
  29120. function buildHuffmanTable(codeLengths, values) {
  29121. let k = 0,
  29122. i,
  29123. j,
  29124. length = 16;
  29125. while (length > 0 && !codeLengths[length - 1]) {
  29126. length--;
  29127. }
  29128. const code = [{
  29129. children: [],
  29130. index: 0
  29131. }];
  29132. let p = code[0],
  29133. q;
  29134. for (i = 0; i < length; i++) {
  29135. for (j = 0; j < codeLengths[i]; j++) {
  29136. p = code.pop();
  29137. p.children[p.index] = values[k];
  29138. while (p.index > 0) {
  29139. p = code.pop();
  29140. }
  29141. p.index++;
  29142. code.push(p);
  29143. while (code.length <= i) {
  29144. code.push(q = {
  29145. children: [],
  29146. index: 0
  29147. });
  29148. p.children[p.index] = q.children;
  29149. p = q;
  29150. }
  29151. k++;
  29152. }
  29153. if (i + 1 < length) {
  29154. code.push(q = {
  29155. children: [],
  29156. index: 0
  29157. });
  29158. p.children[p.index] = q.children;
  29159. p = q;
  29160. }
  29161. }
  29162. return code[0].children;
  29163. }
  29164. function getBlockBufferOffset(component, row, col) {
  29165. return 64 * ((component.blocksPerLine + 1) * row + col);
  29166. }
  29167. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  29168. const mcusPerLine = frame.mcusPerLine;
  29169. const progressive = frame.progressive;
  29170. const startOffset = offset;
  29171. let bitsData = 0,
  29172. bitsCount = 0;
  29173. function readBit() {
  29174. if (bitsCount > 0) {
  29175. bitsCount--;
  29176. return bitsData >> bitsCount & 1;
  29177. }
  29178. bitsData = data[offset++];
  29179. if (bitsData === 0xff) {
  29180. const nextByte = data[offset++];
  29181. if (nextByte) {
  29182. if (nextByte === 0xdc && parseDNLMarker) {
  29183. offset += 2;
  29184. const scanLines = (0, _core_utils.readUint16)(data, offset);
  29185. offset += 2;
  29186. if (scanLines > 0 && scanLines !== frame.scanLines) {
  29187. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  29188. }
  29189. } else if (nextByte === 0xd9) {
  29190. if (parseDNLMarker) {
  29191. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  29192. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  29193. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  29194. }
  29195. }
  29196. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  29197. }
  29198. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  29199. }
  29200. }
  29201. bitsCount = 7;
  29202. return bitsData >>> 7;
  29203. }
  29204. function decodeHuffman(tree) {
  29205. let node = tree;
  29206. while (true) {
  29207. node = node[readBit()];
  29208. switch (typeof node) {
  29209. case "number":
  29210. return node;
  29211. case "object":
  29212. continue;
  29213. }
  29214. throw new JpegError("invalid huffman sequence");
  29215. }
  29216. }
  29217. function receive(length) {
  29218. let n = 0;
  29219. while (length > 0) {
  29220. n = n << 1 | readBit();
  29221. length--;
  29222. }
  29223. return n;
  29224. }
  29225. function receiveAndExtend(length) {
  29226. if (length === 1) {
  29227. return readBit() === 1 ? 1 : -1;
  29228. }
  29229. const n = receive(length);
  29230. if (n >= 1 << length - 1) {
  29231. return n;
  29232. }
  29233. return n + (-1 << length) + 1;
  29234. }
  29235. function decodeBaseline(component, blockOffset) {
  29236. const t = decodeHuffman(component.huffmanTableDC);
  29237. const diff = t === 0 ? 0 : receiveAndExtend(t);
  29238. component.blockData[blockOffset] = component.pred += diff;
  29239. let k = 1;
  29240. while (k < 64) {
  29241. const rs = decodeHuffman(component.huffmanTableAC);
  29242. const s = rs & 15,
  29243. r = rs >> 4;
  29244. if (s === 0) {
  29245. if (r < 15) {
  29246. break;
  29247. }
  29248. k += 16;
  29249. continue;
  29250. }
  29251. k += r;
  29252. const z = dctZigZag[k];
  29253. component.blockData[blockOffset + z] = receiveAndExtend(s);
  29254. k++;
  29255. }
  29256. }
  29257. function decodeDCFirst(component, blockOffset) {
  29258. const t = decodeHuffman(component.huffmanTableDC);
  29259. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  29260. component.blockData[blockOffset] = component.pred += diff;
  29261. }
  29262. function decodeDCSuccessive(component, blockOffset) {
  29263. component.blockData[blockOffset] |= readBit() << successive;
  29264. }
  29265. let eobrun = 0;
  29266. function decodeACFirst(component, blockOffset) {
  29267. if (eobrun > 0) {
  29268. eobrun--;
  29269. return;
  29270. }
  29271. let k = spectralStart;
  29272. const e = spectralEnd;
  29273. while (k <= e) {
  29274. const rs = decodeHuffman(component.huffmanTableAC);
  29275. const s = rs & 15,
  29276. r = rs >> 4;
  29277. if (s === 0) {
  29278. if (r < 15) {
  29279. eobrun = receive(r) + (1 << r) - 1;
  29280. break;
  29281. }
  29282. k += 16;
  29283. continue;
  29284. }
  29285. k += r;
  29286. const z = dctZigZag[k];
  29287. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  29288. k++;
  29289. }
  29290. }
  29291. let successiveACState = 0,
  29292. successiveACNextValue;
  29293. function decodeACSuccessive(component, blockOffset) {
  29294. let k = spectralStart;
  29295. const e = spectralEnd;
  29296. let r = 0;
  29297. let s;
  29298. let rs;
  29299. while (k <= e) {
  29300. const offsetZ = blockOffset + dctZigZag[k];
  29301. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  29302. switch (successiveACState) {
  29303. case 0:
  29304. rs = decodeHuffman(component.huffmanTableAC);
  29305. s = rs & 15;
  29306. r = rs >> 4;
  29307. if (s === 0) {
  29308. if (r < 15) {
  29309. eobrun = receive(r) + (1 << r);
  29310. successiveACState = 4;
  29311. } else {
  29312. r = 16;
  29313. successiveACState = 1;
  29314. }
  29315. } else {
  29316. if (s !== 1) {
  29317. throw new JpegError("invalid ACn encoding");
  29318. }
  29319. successiveACNextValue = receiveAndExtend(s);
  29320. successiveACState = r ? 2 : 3;
  29321. }
  29322. continue;
  29323. case 1:
  29324. case 2:
  29325. if (component.blockData[offsetZ]) {
  29326. component.blockData[offsetZ] += sign * (readBit() << successive);
  29327. } else {
  29328. r--;
  29329. if (r === 0) {
  29330. successiveACState = successiveACState === 2 ? 3 : 0;
  29331. }
  29332. }
  29333. break;
  29334. case 3:
  29335. if (component.blockData[offsetZ]) {
  29336. component.blockData[offsetZ] += sign * (readBit() << successive);
  29337. } else {
  29338. component.blockData[offsetZ] = successiveACNextValue << successive;
  29339. successiveACState = 0;
  29340. }
  29341. break;
  29342. case 4:
  29343. if (component.blockData[offsetZ]) {
  29344. component.blockData[offsetZ] += sign * (readBit() << successive);
  29345. }
  29346. break;
  29347. }
  29348. k++;
  29349. }
  29350. if (successiveACState === 4) {
  29351. eobrun--;
  29352. if (eobrun === 0) {
  29353. successiveACState = 0;
  29354. }
  29355. }
  29356. }
  29357. let blockRow = 0;
  29358. function decodeMcu(component, decode, mcu, row, col) {
  29359. const mcuRow = mcu / mcusPerLine | 0;
  29360. const mcuCol = mcu % mcusPerLine;
  29361. blockRow = mcuRow * component.v + row;
  29362. const blockCol = mcuCol * component.h + col;
  29363. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29364. decode(component, blockOffset);
  29365. }
  29366. function decodeBlock(component, decode, mcu) {
  29367. blockRow = mcu / component.blocksPerLine | 0;
  29368. const blockCol = mcu % component.blocksPerLine;
  29369. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29370. decode(component, blockOffset);
  29371. }
  29372. const componentsLength = components.length;
  29373. let component, i, j, k, n;
  29374. let decodeFn;
  29375. if (progressive) {
  29376. if (spectralStart === 0) {
  29377. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  29378. } else {
  29379. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  29380. }
  29381. } else {
  29382. decodeFn = decodeBaseline;
  29383. }
  29384. let mcu = 0,
  29385. fileMarker;
  29386. let mcuExpected;
  29387. if (componentsLength === 1) {
  29388. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  29389. } else {
  29390. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  29391. }
  29392. let h, v;
  29393. while (mcu <= mcuExpected) {
  29394. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  29395. if (mcuToRead > 0) {
  29396. for (i = 0; i < componentsLength; i++) {
  29397. components[i].pred = 0;
  29398. }
  29399. eobrun = 0;
  29400. if (componentsLength === 1) {
  29401. component = components[0];
  29402. for (n = 0; n < mcuToRead; n++) {
  29403. decodeBlock(component, decodeFn, mcu);
  29404. mcu++;
  29405. }
  29406. } else {
  29407. for (n = 0; n < mcuToRead; n++) {
  29408. for (i = 0; i < componentsLength; i++) {
  29409. component = components[i];
  29410. h = component.h;
  29411. v = component.v;
  29412. for (j = 0; j < v; j++) {
  29413. for (k = 0; k < h; k++) {
  29414. decodeMcu(component, decodeFn, mcu, j, k);
  29415. }
  29416. }
  29417. }
  29418. mcu++;
  29419. }
  29420. }
  29421. }
  29422. bitsCount = 0;
  29423. fileMarker = findNextFileMarker(data, offset);
  29424. if (!fileMarker) {
  29425. break;
  29426. }
  29427. if (fileMarker.invalid) {
  29428. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  29429. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  29430. offset = fileMarker.offset;
  29431. }
  29432. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  29433. offset += 2;
  29434. } else {
  29435. break;
  29436. }
  29437. }
  29438. return offset - startOffset;
  29439. }
  29440. function quantizeAndInverse(component, blockBufferOffset, p) {
  29441. const qt = component.quantizationTable,
  29442. blockData = component.blockData;
  29443. let v0, v1, v2, v3, v4, v5, v6, v7;
  29444. let p0, p1, p2, p3, p4, p5, p6, p7;
  29445. let t;
  29446. if (!qt) {
  29447. throw new JpegError("missing required Quantization Table.");
  29448. }
  29449. for (let row = 0; row < 64; row += 8) {
  29450. p0 = blockData[blockBufferOffset + row];
  29451. p1 = blockData[blockBufferOffset + row + 1];
  29452. p2 = blockData[blockBufferOffset + row + 2];
  29453. p3 = blockData[blockBufferOffset + row + 3];
  29454. p4 = blockData[blockBufferOffset + row + 4];
  29455. p5 = blockData[blockBufferOffset + row + 5];
  29456. p6 = blockData[blockBufferOffset + row + 6];
  29457. p7 = blockData[blockBufferOffset + row + 7];
  29458. p0 *= qt[row];
  29459. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29460. t = dctSqrt2 * p0 + 512 >> 10;
  29461. p[row] = t;
  29462. p[row + 1] = t;
  29463. p[row + 2] = t;
  29464. p[row + 3] = t;
  29465. p[row + 4] = t;
  29466. p[row + 5] = t;
  29467. p[row + 6] = t;
  29468. p[row + 7] = t;
  29469. continue;
  29470. }
  29471. p1 *= qt[row + 1];
  29472. p2 *= qt[row + 2];
  29473. p3 *= qt[row + 3];
  29474. p4 *= qt[row + 4];
  29475. p5 *= qt[row + 5];
  29476. p6 *= qt[row + 6];
  29477. p7 *= qt[row + 7];
  29478. v0 = dctSqrt2 * p0 + 128 >> 8;
  29479. v1 = dctSqrt2 * p4 + 128 >> 8;
  29480. v2 = p2;
  29481. v3 = p6;
  29482. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  29483. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  29484. v5 = p3 << 4;
  29485. v6 = p5 << 4;
  29486. v0 = v0 + v1 + 1 >> 1;
  29487. v1 = v0 - v1;
  29488. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  29489. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  29490. v3 = t;
  29491. v4 = v4 + v6 + 1 >> 1;
  29492. v6 = v4 - v6;
  29493. v7 = v7 + v5 + 1 >> 1;
  29494. v5 = v7 - v5;
  29495. v0 = v0 + v3 + 1 >> 1;
  29496. v3 = v0 - v3;
  29497. v1 = v1 + v2 + 1 >> 1;
  29498. v2 = v1 - v2;
  29499. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29500. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29501. v7 = t;
  29502. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29503. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29504. v6 = t;
  29505. p[row] = v0 + v7;
  29506. p[row + 7] = v0 - v7;
  29507. p[row + 1] = v1 + v6;
  29508. p[row + 6] = v1 - v6;
  29509. p[row + 2] = v2 + v5;
  29510. p[row + 5] = v2 - v5;
  29511. p[row + 3] = v3 + v4;
  29512. p[row + 4] = v3 - v4;
  29513. }
  29514. for (let col = 0; col < 8; ++col) {
  29515. p0 = p[col];
  29516. p1 = p[col + 8];
  29517. p2 = p[col + 16];
  29518. p3 = p[col + 24];
  29519. p4 = p[col + 32];
  29520. p5 = p[col + 40];
  29521. p6 = p[col + 48];
  29522. p7 = p[col + 56];
  29523. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29524. t = dctSqrt2 * p0 + 8192 >> 14;
  29525. if (t < -2040) {
  29526. t = 0;
  29527. } else if (t >= 2024) {
  29528. t = 255;
  29529. } else {
  29530. t = t + 2056 >> 4;
  29531. }
  29532. blockData[blockBufferOffset + col] = t;
  29533. blockData[blockBufferOffset + col + 8] = t;
  29534. blockData[blockBufferOffset + col + 16] = t;
  29535. blockData[blockBufferOffset + col + 24] = t;
  29536. blockData[blockBufferOffset + col + 32] = t;
  29537. blockData[blockBufferOffset + col + 40] = t;
  29538. blockData[blockBufferOffset + col + 48] = t;
  29539. blockData[blockBufferOffset + col + 56] = t;
  29540. continue;
  29541. }
  29542. v0 = dctSqrt2 * p0 + 2048 >> 12;
  29543. v1 = dctSqrt2 * p4 + 2048 >> 12;
  29544. v2 = p2;
  29545. v3 = p6;
  29546. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  29547. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  29548. v5 = p3;
  29549. v6 = p5;
  29550. v0 = (v0 + v1 + 1 >> 1) + 4112;
  29551. v1 = v0 - v1;
  29552. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  29553. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  29554. v3 = t;
  29555. v4 = v4 + v6 + 1 >> 1;
  29556. v6 = v4 - v6;
  29557. v7 = v7 + v5 + 1 >> 1;
  29558. v5 = v7 - v5;
  29559. v0 = v0 + v3 + 1 >> 1;
  29560. v3 = v0 - v3;
  29561. v1 = v1 + v2 + 1 >> 1;
  29562. v2 = v1 - v2;
  29563. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29564. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29565. v7 = t;
  29566. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29567. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29568. v6 = t;
  29569. p0 = v0 + v7;
  29570. p7 = v0 - v7;
  29571. p1 = v1 + v6;
  29572. p6 = v1 - v6;
  29573. p2 = v2 + v5;
  29574. p5 = v2 - v5;
  29575. p3 = v3 + v4;
  29576. p4 = v3 - v4;
  29577. if (p0 < 16) {
  29578. p0 = 0;
  29579. } else if (p0 >= 4080) {
  29580. p0 = 255;
  29581. } else {
  29582. p0 >>= 4;
  29583. }
  29584. if (p1 < 16) {
  29585. p1 = 0;
  29586. } else if (p1 >= 4080) {
  29587. p1 = 255;
  29588. } else {
  29589. p1 >>= 4;
  29590. }
  29591. if (p2 < 16) {
  29592. p2 = 0;
  29593. } else if (p2 >= 4080) {
  29594. p2 = 255;
  29595. } else {
  29596. p2 >>= 4;
  29597. }
  29598. if (p3 < 16) {
  29599. p3 = 0;
  29600. } else if (p3 >= 4080) {
  29601. p3 = 255;
  29602. } else {
  29603. p3 >>= 4;
  29604. }
  29605. if (p4 < 16) {
  29606. p4 = 0;
  29607. } else if (p4 >= 4080) {
  29608. p4 = 255;
  29609. } else {
  29610. p4 >>= 4;
  29611. }
  29612. if (p5 < 16) {
  29613. p5 = 0;
  29614. } else if (p5 >= 4080) {
  29615. p5 = 255;
  29616. } else {
  29617. p5 >>= 4;
  29618. }
  29619. if (p6 < 16) {
  29620. p6 = 0;
  29621. } else if (p6 >= 4080) {
  29622. p6 = 255;
  29623. } else {
  29624. p6 >>= 4;
  29625. }
  29626. if (p7 < 16) {
  29627. p7 = 0;
  29628. } else if (p7 >= 4080) {
  29629. p7 = 255;
  29630. } else {
  29631. p7 >>= 4;
  29632. }
  29633. blockData[blockBufferOffset + col] = p0;
  29634. blockData[blockBufferOffset + col + 8] = p1;
  29635. blockData[blockBufferOffset + col + 16] = p2;
  29636. blockData[blockBufferOffset + col + 24] = p3;
  29637. blockData[blockBufferOffset + col + 32] = p4;
  29638. blockData[blockBufferOffset + col + 40] = p5;
  29639. blockData[blockBufferOffset + col + 48] = p6;
  29640. blockData[blockBufferOffset + col + 56] = p7;
  29641. }
  29642. }
  29643. function buildComponentData(frame, component) {
  29644. const blocksPerLine = component.blocksPerLine;
  29645. const blocksPerColumn = component.blocksPerColumn;
  29646. const computationBuffer = new Int16Array(64);
  29647. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  29648. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  29649. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  29650. quantizeAndInverse(component, offset, computationBuffer);
  29651. }
  29652. }
  29653. return component.blockData;
  29654. }
  29655. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  29656. const maxPos = data.length - 1;
  29657. let newPos = startPos < currentPos ? startPos : currentPos;
  29658. if (currentPos >= maxPos) {
  29659. return null;
  29660. }
  29661. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  29662. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  29663. return {
  29664. invalid: null,
  29665. marker: currentMarker,
  29666. offset: currentPos
  29667. };
  29668. }
  29669. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  29670. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  29671. if (++newPos >= maxPos) {
  29672. return null;
  29673. }
  29674. newMarker = (0, _core_utils.readUint16)(data, newPos);
  29675. }
  29676. return {
  29677. invalid: currentMarker.toString(16),
  29678. marker: newMarker,
  29679. offset: newPos
  29680. };
  29681. }
  29682. class JpegImage {
  29683. constructor({
  29684. decodeTransform = null,
  29685. colorTransform = -1
  29686. } = {}) {
  29687. this._decodeTransform = decodeTransform;
  29688. this._colorTransform = colorTransform;
  29689. }
  29690. parse(data, {
  29691. dnlScanLines = null
  29692. } = {}) {
  29693. function readDataBlock() {
  29694. const length = (0, _core_utils.readUint16)(data, offset);
  29695. offset += 2;
  29696. let endOffset = offset + length - 2;
  29697. const fileMarker = findNextFileMarker(data, endOffset, offset);
  29698. if (fileMarker && fileMarker.invalid) {
  29699. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  29700. endOffset = fileMarker.offset;
  29701. }
  29702. const array = data.subarray(offset, endOffset);
  29703. offset += array.length;
  29704. return array;
  29705. }
  29706. function prepareComponents(frame) {
  29707. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  29708. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  29709. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29710. const component = frame.components[i];
  29711. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  29712. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  29713. const blocksPerLineForMcu = mcusPerLine * component.h;
  29714. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  29715. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  29716. component.blockData = new Int16Array(blocksBufferSize);
  29717. component.blocksPerLine = blocksPerLine;
  29718. component.blocksPerColumn = blocksPerColumn;
  29719. }
  29720. frame.mcusPerLine = mcusPerLine;
  29721. frame.mcusPerColumn = mcusPerColumn;
  29722. }
  29723. let offset = 0;
  29724. let jfif = null;
  29725. let adobe = null;
  29726. let frame, resetInterval;
  29727. let numSOSMarkers = 0;
  29728. const quantizationTables = [];
  29729. const huffmanTablesAC = [],
  29730. huffmanTablesDC = [];
  29731. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  29732. offset += 2;
  29733. if (fileMarker !== 0xffd8) {
  29734. throw new JpegError("SOI not found");
  29735. }
  29736. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29737. offset += 2;
  29738. markerLoop: while (fileMarker !== 0xffd9) {
  29739. let i, j, l;
  29740. switch (fileMarker) {
  29741. case 0xffe0:
  29742. case 0xffe1:
  29743. case 0xffe2:
  29744. case 0xffe3:
  29745. case 0xffe4:
  29746. case 0xffe5:
  29747. case 0xffe6:
  29748. case 0xffe7:
  29749. case 0xffe8:
  29750. case 0xffe9:
  29751. case 0xffea:
  29752. case 0xffeb:
  29753. case 0xffec:
  29754. case 0xffed:
  29755. case 0xffee:
  29756. case 0xffef:
  29757. case 0xfffe:
  29758. const appData = readDataBlock();
  29759. if (fileMarker === 0xffe0) {
  29760. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  29761. jfif = {
  29762. version: {
  29763. major: appData[5],
  29764. minor: appData[6]
  29765. },
  29766. densityUnits: appData[7],
  29767. xDensity: appData[8] << 8 | appData[9],
  29768. yDensity: appData[10] << 8 | appData[11],
  29769. thumbWidth: appData[12],
  29770. thumbHeight: appData[13],
  29771. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  29772. };
  29773. }
  29774. }
  29775. if (fileMarker === 0xffee) {
  29776. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  29777. adobe = {
  29778. version: appData[5] << 8 | appData[6],
  29779. flags0: appData[7] << 8 | appData[8],
  29780. flags1: appData[9] << 8 | appData[10],
  29781. transformCode: appData[11]
  29782. };
  29783. }
  29784. }
  29785. break;
  29786. case 0xffdb:
  29787. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  29788. offset += 2;
  29789. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  29790. let z;
  29791. while (offset < quantizationTablesEnd) {
  29792. const quantizationTableSpec = data[offset++];
  29793. const tableData = new Uint16Array(64);
  29794. if (quantizationTableSpec >> 4 === 0) {
  29795. for (j = 0; j < 64; j++) {
  29796. z = dctZigZag[j];
  29797. tableData[z] = data[offset++];
  29798. }
  29799. } else if (quantizationTableSpec >> 4 === 1) {
  29800. for (j = 0; j < 64; j++) {
  29801. z = dctZigZag[j];
  29802. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  29803. offset += 2;
  29804. }
  29805. } else {
  29806. throw new JpegError("DQT - invalid table spec");
  29807. }
  29808. quantizationTables[quantizationTableSpec & 15] = tableData;
  29809. }
  29810. break;
  29811. case 0xffc0:
  29812. case 0xffc1:
  29813. case 0xffc2:
  29814. if (frame) {
  29815. throw new JpegError("Only single frame JPEGs supported");
  29816. }
  29817. offset += 2;
  29818. frame = {};
  29819. frame.extended = fileMarker === 0xffc1;
  29820. frame.progressive = fileMarker === 0xffc2;
  29821. frame.precision = data[offset++];
  29822. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  29823. offset += 2;
  29824. frame.scanLines = dnlScanLines || sofScanLines;
  29825. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  29826. offset += 2;
  29827. frame.components = [];
  29828. frame.componentIds = {};
  29829. const componentsCount = data[offset++];
  29830. let maxH = 0,
  29831. maxV = 0;
  29832. for (i = 0; i < componentsCount; i++) {
  29833. const componentId = data[offset];
  29834. const h = data[offset + 1] >> 4;
  29835. const v = data[offset + 1] & 15;
  29836. if (maxH < h) {
  29837. maxH = h;
  29838. }
  29839. if (maxV < v) {
  29840. maxV = v;
  29841. }
  29842. const qId = data[offset + 2];
  29843. l = frame.components.push({
  29844. h,
  29845. v,
  29846. quantizationId: qId,
  29847. quantizationTable: null
  29848. });
  29849. frame.componentIds[componentId] = l - 1;
  29850. offset += 3;
  29851. }
  29852. frame.maxH = maxH;
  29853. frame.maxV = maxV;
  29854. prepareComponents(frame);
  29855. break;
  29856. case 0xffc4:
  29857. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  29858. offset += 2;
  29859. for (i = 2; i < huffmanLength;) {
  29860. const huffmanTableSpec = data[offset++];
  29861. const codeLengths = new Uint8Array(16);
  29862. let codeLengthSum = 0;
  29863. for (j = 0; j < 16; j++, offset++) {
  29864. codeLengthSum += codeLengths[j] = data[offset];
  29865. }
  29866. const huffmanValues = new Uint8Array(codeLengthSum);
  29867. for (j = 0; j < codeLengthSum; j++, offset++) {
  29868. huffmanValues[j] = data[offset];
  29869. }
  29870. i += 17 + codeLengthSum;
  29871. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  29872. }
  29873. break;
  29874. case 0xffdd:
  29875. offset += 2;
  29876. resetInterval = (0, _core_utils.readUint16)(data, offset);
  29877. offset += 2;
  29878. break;
  29879. case 0xffda:
  29880. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  29881. offset += 2;
  29882. const selectorsCount = data[offset++],
  29883. components = [];
  29884. for (i = 0; i < selectorsCount; i++) {
  29885. const index = data[offset++];
  29886. const componentIndex = frame.componentIds[index];
  29887. const component = frame.components[componentIndex];
  29888. component.index = index;
  29889. const tableSpec = data[offset++];
  29890. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  29891. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  29892. components.push(component);
  29893. }
  29894. const spectralStart = data[offset++],
  29895. spectralEnd = data[offset++],
  29896. successiveApproximation = data[offset++];
  29897. try {
  29898. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  29899. offset += processed;
  29900. } catch (ex) {
  29901. if (ex instanceof DNLMarkerError) {
  29902. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  29903. return this.parse(data, {
  29904. dnlScanLines: ex.scanLines
  29905. });
  29906. } else if (ex instanceof EOIMarkerError) {
  29907. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  29908. break markerLoop;
  29909. }
  29910. throw ex;
  29911. }
  29912. break;
  29913. case 0xffdc:
  29914. offset += 4;
  29915. break;
  29916. case 0xffff:
  29917. if (data[offset] !== 0xff) {
  29918. offset--;
  29919. }
  29920. break;
  29921. default:
  29922. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  29923. if (nextFileMarker && nextFileMarker.invalid) {
  29924. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  29925. offset = nextFileMarker.offset;
  29926. break;
  29927. }
  29928. if (!nextFileMarker || offset >= data.length - 1) {
  29929. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  29930. break markerLoop;
  29931. }
  29932. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  29933. }
  29934. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29935. offset += 2;
  29936. }
  29937. this.width = frame.samplesPerLine;
  29938. this.height = frame.scanLines;
  29939. this.jfif = jfif;
  29940. this.adobe = adobe;
  29941. this.components = [];
  29942. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29943. const component = frame.components[i];
  29944. const quantizationTable = quantizationTables[component.quantizationId];
  29945. if (quantizationTable) {
  29946. component.quantizationTable = quantizationTable;
  29947. }
  29948. this.components.push({
  29949. index: component.index,
  29950. output: buildComponentData(frame, component),
  29951. scaleX: component.h / frame.maxH,
  29952. scaleY: component.v / frame.maxV,
  29953. blocksPerLine: component.blocksPerLine,
  29954. blocksPerColumn: component.blocksPerColumn
  29955. });
  29956. }
  29957. this.numComponents = this.components.length;
  29958. return undefined;
  29959. }
  29960. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  29961. const scaleX = this.width / width,
  29962. scaleY = this.height / height;
  29963. let component, componentScaleX, componentScaleY, blocksPerScanline;
  29964. let x, y, i, j, k;
  29965. let index;
  29966. let offset = 0;
  29967. let output;
  29968. const numComponents = this.components.length;
  29969. const dataLength = width * height * numComponents;
  29970. const data = new Uint8ClampedArray(dataLength);
  29971. const xScaleBlockOffset = new Uint32Array(width);
  29972. const mask3LSB = 0xfffffff8;
  29973. let lastComponentScaleX;
  29974. for (i = 0; i < numComponents; i++) {
  29975. component = this.components[i];
  29976. componentScaleX = component.scaleX * scaleX;
  29977. componentScaleY = component.scaleY * scaleY;
  29978. offset = i;
  29979. output = component.output;
  29980. blocksPerScanline = component.blocksPerLine + 1 << 3;
  29981. if (componentScaleX !== lastComponentScaleX) {
  29982. for (x = 0; x < width; x++) {
  29983. j = 0 | x * componentScaleX;
  29984. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  29985. }
  29986. lastComponentScaleX = componentScaleX;
  29987. }
  29988. for (y = 0; y < height; y++) {
  29989. j = 0 | y * componentScaleY;
  29990. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  29991. for (x = 0; x < width; x++) {
  29992. data[offset] = output[index + xScaleBlockOffset[x]];
  29993. offset += numComponents;
  29994. }
  29995. }
  29996. }
  29997. let transform = this._decodeTransform;
  29998. if (!isSourcePDF && numComponents === 4 && !transform) {
  29999. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  30000. }
  30001. if (transform) {
  30002. for (i = 0; i < dataLength;) {
  30003. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  30004. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  30005. }
  30006. }
  30007. }
  30008. return data;
  30009. }
  30010. get _isColorConversionNeeded() {
  30011. if (this.adobe) {
  30012. return !!this.adobe.transformCode;
  30013. }
  30014. if (this.numComponents === 3) {
  30015. if (this._colorTransform === 0) {
  30016. return false;
  30017. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  30018. return false;
  30019. }
  30020. return true;
  30021. }
  30022. if (this._colorTransform === 1) {
  30023. return true;
  30024. }
  30025. return false;
  30026. }
  30027. _convertYccToRgb(data) {
  30028. let Y, Cb, Cr;
  30029. for (let i = 0, length = data.length; i < length; i += 3) {
  30030. Y = data[i];
  30031. Cb = data[i + 1];
  30032. Cr = data[i + 2];
  30033. data[i] = Y - 179.456 + 1.402 * Cr;
  30034. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  30035. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  30036. }
  30037. return data;
  30038. }
  30039. _convertYcckToRgb(data) {
  30040. let Y, Cb, Cr, k;
  30041. let offset = 0;
  30042. for (let i = 0, length = data.length; i < length; i += 4) {
  30043. Y = data[i];
  30044. Cb = data[i + 1];
  30045. Cr = data[i + 2];
  30046. k = data[i + 3];
  30047. 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);
  30048. 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);
  30049. 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);
  30050. }
  30051. return data.subarray(0, offset);
  30052. }
  30053. _convertYcckToCmyk(data) {
  30054. let Y, Cb, Cr;
  30055. for (let i = 0, length = data.length; i < length; i += 4) {
  30056. Y = data[i];
  30057. Cb = data[i + 1];
  30058. Cr = data[i + 2];
  30059. data[i] = 434.456 - Y - 1.402 * Cr;
  30060. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  30061. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  30062. }
  30063. return data;
  30064. }
  30065. _convertCmykToRgb(data) {
  30066. let c, m, y, k;
  30067. let offset = 0;
  30068. for (let i = 0, length = data.length; i < length; i += 4) {
  30069. c = data[i];
  30070. m = data[i + 1];
  30071. y = data[i + 2];
  30072. k = data[i + 3];
  30073. 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);
  30074. 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);
  30075. 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);
  30076. }
  30077. return data.subarray(0, offset);
  30078. }
  30079. getData({
  30080. width,
  30081. height,
  30082. forceRGB = false,
  30083. isSourcePDF = false
  30084. }) {
  30085. if (this.numComponents > 4) {
  30086. throw new JpegError("Unsupported color mode");
  30087. }
  30088. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  30089. if (this.numComponents === 1 && forceRGB) {
  30090. const dataLength = data.length;
  30091. const rgbData = new Uint8ClampedArray(dataLength * 3);
  30092. let offset = 0;
  30093. for (let i = 0; i < dataLength; i++) {
  30094. const grayColor = data[i];
  30095. rgbData[offset++] = grayColor;
  30096. rgbData[offset++] = grayColor;
  30097. rgbData[offset++] = grayColor;
  30098. }
  30099. return rgbData;
  30100. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  30101. return this._convertYccToRgb(data);
  30102. } else if (this.numComponents === 4) {
  30103. if (this._isColorConversionNeeded) {
  30104. if (forceRGB) {
  30105. return this._convertYcckToRgb(data);
  30106. }
  30107. return this._convertYcckToCmyk(data);
  30108. } else if (forceRGB) {
  30109. return this._convertCmykToRgb(data);
  30110. }
  30111. }
  30112. return data;
  30113. }
  30114. }
  30115. exports.JpegImage = JpegImage;
  30116. /***/ }),
  30117. /* 39 */
  30118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  30119. Object.defineProperty(exports, "__esModule", ({
  30120. value: true
  30121. }));
  30122. exports.JpxStream = void 0;
  30123. var _decode_stream = __w_pdfjs_require__(29);
  30124. var _jpx = __w_pdfjs_require__(40);
  30125. var _util = __w_pdfjs_require__(2);
  30126. class JpxStream extends _decode_stream.DecodeStream {
  30127. constructor(stream, maybeLength, params) {
  30128. super(maybeLength);
  30129. this.stream = stream;
  30130. this.dict = stream.dict;
  30131. this.maybeLength = maybeLength;
  30132. this.params = params;
  30133. }
  30134. get bytes() {
  30135. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  30136. }
  30137. ensureBuffer(requested) {}
  30138. readBlock() {
  30139. if (this.eof) {
  30140. return;
  30141. }
  30142. const jpxImage = new _jpx.JpxImage();
  30143. jpxImage.parse(this.bytes);
  30144. const width = jpxImage.width;
  30145. const height = jpxImage.height;
  30146. const componentsCount = jpxImage.componentsCount;
  30147. const tileCount = jpxImage.tiles.length;
  30148. if (tileCount === 1) {
  30149. this.buffer = jpxImage.tiles[0].items;
  30150. } else {
  30151. const data = new Uint8ClampedArray(width * height * componentsCount);
  30152. for (let k = 0; k < tileCount; k++) {
  30153. const tileComponents = jpxImage.tiles[k];
  30154. const tileWidth = tileComponents.width;
  30155. const tileHeight = tileComponents.height;
  30156. const tileLeft = tileComponents.left;
  30157. const tileTop = tileComponents.top;
  30158. const src = tileComponents.items;
  30159. let srcPosition = 0;
  30160. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  30161. const imgRowSize = width * componentsCount;
  30162. const tileRowSize = tileWidth * componentsCount;
  30163. for (let j = 0; j < tileHeight; j++) {
  30164. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  30165. data.set(rowBytes, dataPosition);
  30166. srcPosition += tileRowSize;
  30167. dataPosition += imgRowSize;
  30168. }
  30169. }
  30170. this.buffer = data;
  30171. }
  30172. this.bufferLength = this.buffer.length;
  30173. this.eof = true;
  30174. }
  30175. }
  30176. exports.JpxStream = JpxStream;
  30177. /***/ }),
  30178. /* 40 */
  30179. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  30180. Object.defineProperty(exports, "__esModule", ({
  30181. value: true
  30182. }));
  30183. exports.JpxImage = void 0;
  30184. var _util = __w_pdfjs_require__(2);
  30185. var _core_utils = __w_pdfjs_require__(8);
  30186. var _arithmetic_decoder = __w_pdfjs_require__(36);
  30187. class JpxError extends _util.BaseException {
  30188. constructor(msg) {
  30189. super(`JPX error: ${msg}`, "JpxError");
  30190. }
  30191. }
  30192. const SubbandsGainLog2 = {
  30193. LL: 0,
  30194. LH: 1,
  30195. HL: 1,
  30196. HH: 2
  30197. };
  30198. class JpxImage {
  30199. constructor() {
  30200. this.failOnCorruptedImage = false;
  30201. }
  30202. parse(data) {
  30203. const head = (0, _core_utils.readUint16)(data, 0);
  30204. if (head === 0xff4f) {
  30205. this.parseCodestream(data, 0, data.length);
  30206. return;
  30207. }
  30208. const length = data.length;
  30209. let position = 0;
  30210. while (position < length) {
  30211. let headerSize = 8;
  30212. let lbox = (0, _core_utils.readUint32)(data, position);
  30213. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  30214. position += headerSize;
  30215. if (lbox === 1) {
  30216. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  30217. position += 8;
  30218. headerSize += 8;
  30219. }
  30220. if (lbox === 0) {
  30221. lbox = length - position + headerSize;
  30222. }
  30223. if (lbox < headerSize) {
  30224. throw new JpxError("Invalid box field size");
  30225. }
  30226. const dataLength = lbox - headerSize;
  30227. let jumpDataLength = true;
  30228. switch (tbox) {
  30229. case 0x6a703268:
  30230. jumpDataLength = false;
  30231. break;
  30232. case 0x636f6c72:
  30233. const method = data[position];
  30234. if (method === 1) {
  30235. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  30236. switch (colorspace) {
  30237. case 16:
  30238. case 17:
  30239. case 18:
  30240. break;
  30241. default:
  30242. (0, _util.warn)("Unknown colorspace " + colorspace);
  30243. break;
  30244. }
  30245. } else if (method === 2) {
  30246. (0, _util.info)("ICC profile not supported");
  30247. }
  30248. break;
  30249. case 0x6a703263:
  30250. this.parseCodestream(data, position, position + dataLength);
  30251. break;
  30252. case 0x6a502020:
  30253. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  30254. (0, _util.warn)("Invalid JP2 signature");
  30255. }
  30256. break;
  30257. case 0x6a501a1a:
  30258. case 0x66747970:
  30259. case 0x72726571:
  30260. case 0x72657320:
  30261. case 0x69686472:
  30262. break;
  30263. default:
  30264. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  30265. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  30266. break;
  30267. }
  30268. if (jumpDataLength) {
  30269. position += dataLength;
  30270. }
  30271. }
  30272. }
  30273. parseImageProperties(stream) {
  30274. let newByte = stream.getByte();
  30275. while (newByte >= 0) {
  30276. const oldByte = newByte;
  30277. newByte = stream.getByte();
  30278. const code = oldByte << 8 | newByte;
  30279. if (code === 0xff51) {
  30280. stream.skip(4);
  30281. const Xsiz = stream.getInt32() >>> 0;
  30282. const Ysiz = stream.getInt32() >>> 0;
  30283. const XOsiz = stream.getInt32() >>> 0;
  30284. const YOsiz = stream.getInt32() >>> 0;
  30285. stream.skip(16);
  30286. const Csiz = stream.getUint16();
  30287. this.width = Xsiz - XOsiz;
  30288. this.height = Ysiz - YOsiz;
  30289. this.componentsCount = Csiz;
  30290. this.bitsPerComponent = 8;
  30291. return;
  30292. }
  30293. }
  30294. throw new JpxError("No size marker found in JPX stream");
  30295. }
  30296. parseCodestream(data, start, end) {
  30297. const context = {};
  30298. let doNotRecover = false;
  30299. try {
  30300. let position = start;
  30301. while (position + 1 < end) {
  30302. const code = (0, _core_utils.readUint16)(data, position);
  30303. position += 2;
  30304. let length = 0,
  30305. j,
  30306. sqcd,
  30307. spqcds,
  30308. spqcdSize,
  30309. scalarExpounded,
  30310. tile;
  30311. switch (code) {
  30312. case 0xff4f:
  30313. context.mainHeader = true;
  30314. break;
  30315. case 0xffd9:
  30316. break;
  30317. case 0xff51:
  30318. length = (0, _core_utils.readUint16)(data, position);
  30319. const siz = {};
  30320. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  30321. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  30322. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  30323. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  30324. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  30325. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  30326. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  30327. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  30328. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  30329. siz.Csiz = componentsCount;
  30330. const components = [];
  30331. j = position + 38;
  30332. for (let i = 0; i < componentsCount; i++) {
  30333. const component = {
  30334. precision: (data[j] & 0x7f) + 1,
  30335. isSigned: !!(data[j] & 0x80),
  30336. XRsiz: data[j + 1],
  30337. YRsiz: data[j + 2]
  30338. };
  30339. j += 3;
  30340. calculateComponentDimensions(component, siz);
  30341. components.push(component);
  30342. }
  30343. context.SIZ = siz;
  30344. context.components = components;
  30345. calculateTileGrids(context, components);
  30346. context.QCC = [];
  30347. context.COC = [];
  30348. break;
  30349. case 0xff5c:
  30350. length = (0, _core_utils.readUint16)(data, position);
  30351. const qcd = {};
  30352. j = position + 2;
  30353. sqcd = data[j++];
  30354. switch (sqcd & 0x1f) {
  30355. case 0:
  30356. spqcdSize = 8;
  30357. scalarExpounded = true;
  30358. break;
  30359. case 1:
  30360. spqcdSize = 16;
  30361. scalarExpounded = false;
  30362. break;
  30363. case 2:
  30364. spqcdSize = 16;
  30365. scalarExpounded = true;
  30366. break;
  30367. default:
  30368. throw new Error("Invalid SQcd value " + sqcd);
  30369. }
  30370. qcd.noQuantization = spqcdSize === 8;
  30371. qcd.scalarExpounded = scalarExpounded;
  30372. qcd.guardBits = sqcd >> 5;
  30373. spqcds = [];
  30374. while (j < length + position) {
  30375. const spqcd = {};
  30376. if (spqcdSize === 8) {
  30377. spqcd.epsilon = data[j++] >> 3;
  30378. spqcd.mu = 0;
  30379. } else {
  30380. spqcd.epsilon = data[j] >> 3;
  30381. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30382. j += 2;
  30383. }
  30384. spqcds.push(spqcd);
  30385. }
  30386. qcd.SPqcds = spqcds;
  30387. if (context.mainHeader) {
  30388. context.QCD = qcd;
  30389. } else {
  30390. context.currentTile.QCD = qcd;
  30391. context.currentTile.QCC = [];
  30392. }
  30393. break;
  30394. case 0xff5d:
  30395. length = (0, _core_utils.readUint16)(data, position);
  30396. const qcc = {};
  30397. j = position + 2;
  30398. let cqcc;
  30399. if (context.SIZ.Csiz < 257) {
  30400. cqcc = data[j++];
  30401. } else {
  30402. cqcc = (0, _core_utils.readUint16)(data, j);
  30403. j += 2;
  30404. }
  30405. sqcd = data[j++];
  30406. switch (sqcd & 0x1f) {
  30407. case 0:
  30408. spqcdSize = 8;
  30409. scalarExpounded = true;
  30410. break;
  30411. case 1:
  30412. spqcdSize = 16;
  30413. scalarExpounded = false;
  30414. break;
  30415. case 2:
  30416. spqcdSize = 16;
  30417. scalarExpounded = true;
  30418. break;
  30419. default:
  30420. throw new Error("Invalid SQcd value " + sqcd);
  30421. }
  30422. qcc.noQuantization = spqcdSize === 8;
  30423. qcc.scalarExpounded = scalarExpounded;
  30424. qcc.guardBits = sqcd >> 5;
  30425. spqcds = [];
  30426. while (j < length + position) {
  30427. const spqcd = {};
  30428. if (spqcdSize === 8) {
  30429. spqcd.epsilon = data[j++] >> 3;
  30430. spqcd.mu = 0;
  30431. } else {
  30432. spqcd.epsilon = data[j] >> 3;
  30433. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30434. j += 2;
  30435. }
  30436. spqcds.push(spqcd);
  30437. }
  30438. qcc.SPqcds = spqcds;
  30439. if (context.mainHeader) {
  30440. context.QCC[cqcc] = qcc;
  30441. } else {
  30442. context.currentTile.QCC[cqcc] = qcc;
  30443. }
  30444. break;
  30445. case 0xff52:
  30446. length = (0, _core_utils.readUint16)(data, position);
  30447. const cod = {};
  30448. j = position + 2;
  30449. const scod = data[j++];
  30450. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  30451. cod.sopMarkerUsed = !!(scod & 2);
  30452. cod.ephMarkerUsed = !!(scod & 4);
  30453. cod.progressionOrder = data[j++];
  30454. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  30455. j += 2;
  30456. cod.multipleComponentTransform = data[j++];
  30457. cod.decompositionLevelsCount = data[j++];
  30458. cod.xcb = (data[j++] & 0xf) + 2;
  30459. cod.ycb = (data[j++] & 0xf) + 2;
  30460. const blockStyle = data[j++];
  30461. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  30462. cod.resetContextProbabilities = !!(blockStyle & 2);
  30463. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  30464. cod.verticallyStripe = !!(blockStyle & 8);
  30465. cod.predictableTermination = !!(blockStyle & 16);
  30466. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  30467. cod.reversibleTransformation = data[j++];
  30468. if (cod.entropyCoderWithCustomPrecincts) {
  30469. const precinctsSizes = [];
  30470. while (j < length + position) {
  30471. const precinctsSize = data[j++];
  30472. precinctsSizes.push({
  30473. PPx: precinctsSize & 0xf,
  30474. PPy: precinctsSize >> 4
  30475. });
  30476. }
  30477. cod.precinctsSizes = precinctsSizes;
  30478. }
  30479. const unsupported = [];
  30480. if (cod.selectiveArithmeticCodingBypass) {
  30481. unsupported.push("selectiveArithmeticCodingBypass");
  30482. }
  30483. if (cod.terminationOnEachCodingPass) {
  30484. unsupported.push("terminationOnEachCodingPass");
  30485. }
  30486. if (cod.verticallyStripe) {
  30487. unsupported.push("verticallyStripe");
  30488. }
  30489. if (cod.predictableTermination) {
  30490. unsupported.push("predictableTermination");
  30491. }
  30492. if (unsupported.length > 0) {
  30493. doNotRecover = true;
  30494. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  30495. }
  30496. if (context.mainHeader) {
  30497. context.COD = cod;
  30498. } else {
  30499. context.currentTile.COD = cod;
  30500. context.currentTile.COC = [];
  30501. }
  30502. break;
  30503. case 0xff90:
  30504. length = (0, _core_utils.readUint16)(data, position);
  30505. tile = {};
  30506. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  30507. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  30508. tile.dataEnd = tile.length + position - 2;
  30509. tile.partIndex = data[position + 8];
  30510. tile.partsCount = data[position + 9];
  30511. context.mainHeader = false;
  30512. if (tile.partIndex === 0) {
  30513. tile.COD = context.COD;
  30514. tile.COC = context.COC.slice(0);
  30515. tile.QCD = context.QCD;
  30516. tile.QCC = context.QCC.slice(0);
  30517. }
  30518. context.currentTile = tile;
  30519. break;
  30520. case 0xff93:
  30521. tile = context.currentTile;
  30522. if (tile.partIndex === 0) {
  30523. initializeTile(context, tile.index);
  30524. buildPackets(context);
  30525. }
  30526. length = tile.dataEnd - position;
  30527. parseTilePackets(context, data, position, length);
  30528. break;
  30529. case 0xff53:
  30530. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  30531. case 0xff55:
  30532. case 0xff57:
  30533. case 0xff58:
  30534. case 0xff64:
  30535. length = (0, _core_utils.readUint16)(data, position);
  30536. break;
  30537. default:
  30538. throw new Error("Unknown codestream code: " + code.toString(16));
  30539. }
  30540. position += length;
  30541. }
  30542. } catch (e) {
  30543. if (doNotRecover || this.failOnCorruptedImage) {
  30544. throw new JpxError(e.message);
  30545. } else {
  30546. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  30547. }
  30548. }
  30549. this.tiles = transformComponents(context);
  30550. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  30551. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  30552. this.componentsCount = context.SIZ.Csiz;
  30553. }
  30554. }
  30555. exports.JpxImage = JpxImage;
  30556. function calculateComponentDimensions(component, siz) {
  30557. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  30558. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  30559. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  30560. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  30561. component.width = component.x1 - component.x0;
  30562. component.height = component.y1 - component.y0;
  30563. }
  30564. function calculateTileGrids(context, components) {
  30565. const siz = context.SIZ;
  30566. const tiles = [];
  30567. let tile;
  30568. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  30569. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  30570. for (let q = 0; q < numYtiles; q++) {
  30571. for (let p = 0; p < numXtiles; p++) {
  30572. tile = {};
  30573. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  30574. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  30575. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  30576. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  30577. tile.width = tile.tx1 - tile.tx0;
  30578. tile.height = tile.ty1 - tile.ty0;
  30579. tile.components = [];
  30580. tiles.push(tile);
  30581. }
  30582. }
  30583. context.tiles = tiles;
  30584. const componentsCount = siz.Csiz;
  30585. for (let i = 0, ii = componentsCount; i < ii; i++) {
  30586. const component = components[i];
  30587. for (let j = 0, jj = tiles.length; j < jj; j++) {
  30588. const tileComponent = {};
  30589. tile = tiles[j];
  30590. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  30591. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  30592. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  30593. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  30594. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  30595. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  30596. tile.components[i] = tileComponent;
  30597. }
  30598. }
  30599. }
  30600. function getBlocksDimensions(context, component, r) {
  30601. const codOrCoc = component.codingStyleParameters;
  30602. const result = {};
  30603. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  30604. result.PPx = 15;
  30605. result.PPy = 15;
  30606. } else {
  30607. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  30608. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  30609. }
  30610. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  30611. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  30612. return result;
  30613. }
  30614. function buildPrecincts(context, resolution, dimensions) {
  30615. const precinctWidth = 1 << dimensions.PPx;
  30616. const precinctHeight = 1 << dimensions.PPy;
  30617. const isZeroRes = resolution.resLevel === 0;
  30618. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  30619. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  30620. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  30621. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  30622. const numprecincts = numprecinctswide * numprecinctshigh;
  30623. resolution.precinctParameters = {
  30624. precinctWidth,
  30625. precinctHeight,
  30626. numprecinctswide,
  30627. numprecinctshigh,
  30628. numprecincts,
  30629. precinctWidthInSubband,
  30630. precinctHeightInSubband
  30631. };
  30632. }
  30633. function buildCodeblocks(context, subband, dimensions) {
  30634. const xcb_ = dimensions.xcb_;
  30635. const ycb_ = dimensions.ycb_;
  30636. const codeblockWidth = 1 << xcb_;
  30637. const codeblockHeight = 1 << ycb_;
  30638. const cbx0 = subband.tbx0 >> xcb_;
  30639. const cby0 = subband.tby0 >> ycb_;
  30640. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  30641. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  30642. const precinctParameters = subband.resolution.precinctParameters;
  30643. const codeblocks = [];
  30644. const precincts = [];
  30645. let i, j, codeblock, precinctNumber;
  30646. for (j = cby0; j < cby1; j++) {
  30647. for (i = cbx0; i < cbx1; i++) {
  30648. codeblock = {
  30649. cbx: i,
  30650. cby: j,
  30651. tbx0: codeblockWidth * i,
  30652. tby0: codeblockHeight * j,
  30653. tbx1: codeblockWidth * (i + 1),
  30654. tby1: codeblockHeight * (j + 1)
  30655. };
  30656. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  30657. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  30658. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  30659. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  30660. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  30661. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  30662. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  30663. codeblock.precinctNumber = precinctNumber;
  30664. codeblock.subbandType = subband.type;
  30665. codeblock.Lblock = 3;
  30666. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  30667. continue;
  30668. }
  30669. codeblocks.push(codeblock);
  30670. let precinct = precincts[precinctNumber];
  30671. if (precinct !== undefined) {
  30672. if (i < precinct.cbxMin) {
  30673. precinct.cbxMin = i;
  30674. } else if (i > precinct.cbxMax) {
  30675. precinct.cbxMax = i;
  30676. }
  30677. if (j < precinct.cbyMin) {
  30678. precinct.cbxMin = j;
  30679. } else if (j > precinct.cbyMax) {
  30680. precinct.cbyMax = j;
  30681. }
  30682. } else {
  30683. precincts[precinctNumber] = precinct = {
  30684. cbxMin: i,
  30685. cbyMin: j,
  30686. cbxMax: i,
  30687. cbyMax: j
  30688. };
  30689. }
  30690. codeblock.precinct = precinct;
  30691. }
  30692. }
  30693. subband.codeblockParameters = {
  30694. codeblockWidth: xcb_,
  30695. codeblockHeight: ycb_,
  30696. numcodeblockwide: cbx1 - cbx0 + 1,
  30697. numcodeblockhigh: cby1 - cby0 + 1
  30698. };
  30699. subband.codeblocks = codeblocks;
  30700. subband.precincts = precincts;
  30701. }
  30702. function createPacket(resolution, precinctNumber, layerNumber) {
  30703. const precinctCodeblocks = [];
  30704. const subbands = resolution.subbands;
  30705. for (let i = 0, ii = subbands.length; i < ii; i++) {
  30706. const subband = subbands[i];
  30707. const codeblocks = subband.codeblocks;
  30708. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  30709. const codeblock = codeblocks[j];
  30710. if (codeblock.precinctNumber !== precinctNumber) {
  30711. continue;
  30712. }
  30713. precinctCodeblocks.push(codeblock);
  30714. }
  30715. }
  30716. return {
  30717. layerNumber,
  30718. codeblocks: precinctCodeblocks
  30719. };
  30720. }
  30721. function LayerResolutionComponentPositionIterator(context) {
  30722. const siz = context.SIZ;
  30723. const tileIndex = context.currentTile.index;
  30724. const tile = context.tiles[tileIndex];
  30725. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30726. const componentsCount = siz.Csiz;
  30727. let maxDecompositionLevelsCount = 0;
  30728. for (let q = 0; q < componentsCount; q++) {
  30729. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30730. }
  30731. let l = 0,
  30732. r = 0,
  30733. i = 0,
  30734. k = 0;
  30735. this.nextPacket = function JpxImage_nextPacket() {
  30736. for (; l < layersCount; l++) {
  30737. for (; r <= maxDecompositionLevelsCount; r++) {
  30738. for (; i < componentsCount; i++) {
  30739. const component = tile.components[i];
  30740. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30741. continue;
  30742. }
  30743. const resolution = component.resolutions[r];
  30744. const numprecincts = resolution.precinctParameters.numprecincts;
  30745. for (; k < numprecincts;) {
  30746. const packet = createPacket(resolution, k, l);
  30747. k++;
  30748. return packet;
  30749. }
  30750. k = 0;
  30751. }
  30752. i = 0;
  30753. }
  30754. r = 0;
  30755. }
  30756. throw new JpxError("Out of packets");
  30757. };
  30758. }
  30759. function ResolutionLayerComponentPositionIterator(context) {
  30760. const siz = context.SIZ;
  30761. const tileIndex = context.currentTile.index;
  30762. const tile = context.tiles[tileIndex];
  30763. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30764. const componentsCount = siz.Csiz;
  30765. let maxDecompositionLevelsCount = 0;
  30766. for (let q = 0; q < componentsCount; q++) {
  30767. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30768. }
  30769. let r = 0,
  30770. l = 0,
  30771. i = 0,
  30772. k = 0;
  30773. this.nextPacket = function JpxImage_nextPacket() {
  30774. for (; r <= maxDecompositionLevelsCount; r++) {
  30775. for (; l < layersCount; l++) {
  30776. for (; i < componentsCount; i++) {
  30777. const component = tile.components[i];
  30778. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30779. continue;
  30780. }
  30781. const resolution = component.resolutions[r];
  30782. const numprecincts = resolution.precinctParameters.numprecincts;
  30783. for (; k < numprecincts;) {
  30784. const packet = createPacket(resolution, k, l);
  30785. k++;
  30786. return packet;
  30787. }
  30788. k = 0;
  30789. }
  30790. i = 0;
  30791. }
  30792. l = 0;
  30793. }
  30794. throw new JpxError("Out of packets");
  30795. };
  30796. }
  30797. function ResolutionPositionComponentLayerIterator(context) {
  30798. const siz = context.SIZ;
  30799. const tileIndex = context.currentTile.index;
  30800. const tile = context.tiles[tileIndex];
  30801. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30802. const componentsCount = siz.Csiz;
  30803. let l, r, c, p;
  30804. let maxDecompositionLevelsCount = 0;
  30805. for (c = 0; c < componentsCount; c++) {
  30806. const component = tile.components[c];
  30807. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  30808. }
  30809. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  30810. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  30811. let maxNumPrecincts = 0;
  30812. for (c = 0; c < componentsCount; ++c) {
  30813. const resolutions = tile.components[c].resolutions;
  30814. if (r < resolutions.length) {
  30815. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  30816. }
  30817. }
  30818. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  30819. }
  30820. l = 0;
  30821. r = 0;
  30822. c = 0;
  30823. p = 0;
  30824. this.nextPacket = function JpxImage_nextPacket() {
  30825. for (; r <= maxDecompositionLevelsCount; r++) {
  30826. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  30827. for (; c < componentsCount; c++) {
  30828. const component = tile.components[c];
  30829. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30830. continue;
  30831. }
  30832. const resolution = component.resolutions[r];
  30833. const numprecincts = resolution.precinctParameters.numprecincts;
  30834. if (p >= numprecincts) {
  30835. continue;
  30836. }
  30837. for (; l < layersCount;) {
  30838. const packet = createPacket(resolution, p, l);
  30839. l++;
  30840. return packet;
  30841. }
  30842. l = 0;
  30843. }
  30844. c = 0;
  30845. }
  30846. p = 0;
  30847. }
  30848. throw new JpxError("Out of packets");
  30849. };
  30850. }
  30851. function PositionComponentResolutionLayerIterator(context) {
  30852. const siz = context.SIZ;
  30853. const tileIndex = context.currentTile.index;
  30854. const tile = context.tiles[tileIndex];
  30855. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30856. const componentsCount = siz.Csiz;
  30857. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30858. const precinctsIterationSizes = precinctsSizes;
  30859. let l = 0,
  30860. r = 0,
  30861. c = 0,
  30862. px = 0,
  30863. py = 0;
  30864. this.nextPacket = function JpxImage_nextPacket() {
  30865. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30866. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30867. for (; c < componentsCount; c++) {
  30868. const component = tile.components[c];
  30869. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30870. for (; r <= decompositionLevelsCount; r++) {
  30871. const resolution = component.resolutions[r];
  30872. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  30873. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30874. if (k === null) {
  30875. continue;
  30876. }
  30877. for (; l < layersCount;) {
  30878. const packet = createPacket(resolution, k, l);
  30879. l++;
  30880. return packet;
  30881. }
  30882. l = 0;
  30883. }
  30884. r = 0;
  30885. }
  30886. c = 0;
  30887. }
  30888. px = 0;
  30889. }
  30890. throw new JpxError("Out of packets");
  30891. };
  30892. }
  30893. function ComponentPositionResolutionLayerIterator(context) {
  30894. const siz = context.SIZ;
  30895. const tileIndex = context.currentTile.index;
  30896. const tile = context.tiles[tileIndex];
  30897. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30898. const componentsCount = siz.Csiz;
  30899. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30900. let l = 0,
  30901. r = 0,
  30902. c = 0,
  30903. px = 0,
  30904. py = 0;
  30905. this.nextPacket = function JpxImage_nextPacket() {
  30906. for (; c < componentsCount; ++c) {
  30907. const component = tile.components[c];
  30908. const precinctsIterationSizes = precinctsSizes.components[c];
  30909. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30910. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30911. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30912. for (; r <= decompositionLevelsCount; r++) {
  30913. const resolution = component.resolutions[r];
  30914. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  30915. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30916. if (k === null) {
  30917. continue;
  30918. }
  30919. for (; l < layersCount;) {
  30920. const packet = createPacket(resolution, k, l);
  30921. l++;
  30922. return packet;
  30923. }
  30924. l = 0;
  30925. }
  30926. r = 0;
  30927. }
  30928. px = 0;
  30929. }
  30930. py = 0;
  30931. }
  30932. throw new JpxError("Out of packets");
  30933. };
  30934. }
  30935. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  30936. const posX = pxIndex * precinctIterationSizes.minWidth;
  30937. const posY = pyIndex * precinctIterationSizes.minHeight;
  30938. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  30939. return null;
  30940. }
  30941. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  30942. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  30943. }
  30944. function getPrecinctSizesInImageScale(tile) {
  30945. const componentsCount = tile.components.length;
  30946. let minWidth = Number.MAX_VALUE;
  30947. let minHeight = Number.MAX_VALUE;
  30948. let maxNumWide = 0;
  30949. let maxNumHigh = 0;
  30950. const sizePerComponent = new Array(componentsCount);
  30951. for (let c = 0; c < componentsCount; c++) {
  30952. const component = tile.components[c];
  30953. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30954. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  30955. let minWidthCurrentComponent = Number.MAX_VALUE;
  30956. let minHeightCurrentComponent = Number.MAX_VALUE;
  30957. let maxNumWideCurrentComponent = 0;
  30958. let maxNumHighCurrentComponent = 0;
  30959. let scale = 1;
  30960. for (let r = decompositionLevelsCount; r >= 0; --r) {
  30961. const resolution = component.resolutions[r];
  30962. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  30963. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30964. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30965. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30966. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30967. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30968. sizePerResolution[r] = {
  30969. width: widthCurrentResolution,
  30970. height: heightCurrentResolution
  30971. };
  30972. scale <<= 1;
  30973. }
  30974. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30975. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30976. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30977. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30978. sizePerComponent[c] = {
  30979. resolutions: sizePerResolution,
  30980. minWidth: minWidthCurrentComponent,
  30981. minHeight: minHeightCurrentComponent,
  30982. maxNumWide: maxNumWideCurrentComponent,
  30983. maxNumHigh: maxNumHighCurrentComponent
  30984. };
  30985. }
  30986. return {
  30987. components: sizePerComponent,
  30988. minWidth,
  30989. minHeight,
  30990. maxNumWide,
  30991. maxNumHigh
  30992. };
  30993. }
  30994. function buildPackets(context) {
  30995. const siz = context.SIZ;
  30996. const tileIndex = context.currentTile.index;
  30997. const tile = context.tiles[tileIndex];
  30998. const componentsCount = siz.Csiz;
  30999. for (let c = 0; c < componentsCount; c++) {
  31000. const component = tile.components[c];
  31001. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  31002. const resolutions = [];
  31003. const subbands = [];
  31004. for (let r = 0; r <= decompositionLevelsCount; r++) {
  31005. const blocksDimensions = getBlocksDimensions(context, component, r);
  31006. const resolution = {};
  31007. const scale = 1 << decompositionLevelsCount - r;
  31008. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  31009. resolution.try0 = Math.ceil(component.tcy0 / scale);
  31010. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  31011. resolution.try1 = Math.ceil(component.tcy1 / scale);
  31012. resolution.resLevel = r;
  31013. buildPrecincts(context, resolution, blocksDimensions);
  31014. resolutions.push(resolution);
  31015. let subband;
  31016. if (r === 0) {
  31017. subband = {};
  31018. subband.type = "LL";
  31019. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  31020. subband.tby0 = Math.ceil(component.tcy0 / scale);
  31021. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  31022. subband.tby1 = Math.ceil(component.tcy1 / scale);
  31023. subband.resolution = resolution;
  31024. buildCodeblocks(context, subband, blocksDimensions);
  31025. subbands.push(subband);
  31026. resolution.subbands = [subband];
  31027. } else {
  31028. const bscale = 1 << decompositionLevelsCount - r + 1;
  31029. const resolutionSubbands = [];
  31030. subband = {};
  31031. subband.type = "HL";
  31032. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  31033. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  31034. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  31035. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  31036. subband.resolution = resolution;
  31037. buildCodeblocks(context, subband, blocksDimensions);
  31038. subbands.push(subband);
  31039. resolutionSubbands.push(subband);
  31040. subband = {};
  31041. subband.type = "LH";
  31042. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  31043. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  31044. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  31045. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  31046. subband.resolution = resolution;
  31047. buildCodeblocks(context, subband, blocksDimensions);
  31048. subbands.push(subband);
  31049. resolutionSubbands.push(subband);
  31050. subband = {};
  31051. subband.type = "HH";
  31052. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  31053. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  31054. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  31055. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  31056. subband.resolution = resolution;
  31057. buildCodeblocks(context, subband, blocksDimensions);
  31058. subbands.push(subband);
  31059. resolutionSubbands.push(subband);
  31060. resolution.subbands = resolutionSubbands;
  31061. }
  31062. }
  31063. component.resolutions = resolutions;
  31064. component.subbands = subbands;
  31065. }
  31066. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  31067. switch (progressionOrder) {
  31068. case 0:
  31069. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  31070. break;
  31071. case 1:
  31072. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  31073. break;
  31074. case 2:
  31075. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  31076. break;
  31077. case 3:
  31078. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  31079. break;
  31080. case 4:
  31081. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  31082. break;
  31083. default:
  31084. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  31085. }
  31086. }
  31087. function parseTilePackets(context, data, offset, dataLength) {
  31088. let position = 0;
  31089. let buffer,
  31090. bufferSize = 0,
  31091. skipNextBit = false;
  31092. function readBits(count) {
  31093. while (bufferSize < count) {
  31094. const b = data[offset + position];
  31095. position++;
  31096. if (skipNextBit) {
  31097. buffer = buffer << 7 | b;
  31098. bufferSize += 7;
  31099. skipNextBit = false;
  31100. } else {
  31101. buffer = buffer << 8 | b;
  31102. bufferSize += 8;
  31103. }
  31104. if (b === 0xff) {
  31105. skipNextBit = true;
  31106. }
  31107. }
  31108. bufferSize -= count;
  31109. return buffer >>> bufferSize & (1 << count) - 1;
  31110. }
  31111. function skipMarkerIfEqual(value) {
  31112. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  31113. skipBytes(1);
  31114. return true;
  31115. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  31116. skipBytes(2);
  31117. return true;
  31118. }
  31119. return false;
  31120. }
  31121. function skipBytes(count) {
  31122. position += count;
  31123. }
  31124. function alignToByte() {
  31125. bufferSize = 0;
  31126. if (skipNextBit) {
  31127. position++;
  31128. skipNextBit = false;
  31129. }
  31130. }
  31131. function readCodingpasses() {
  31132. if (readBits(1) === 0) {
  31133. return 1;
  31134. }
  31135. if (readBits(1) === 0) {
  31136. return 2;
  31137. }
  31138. let value = readBits(2);
  31139. if (value < 3) {
  31140. return value + 3;
  31141. }
  31142. value = readBits(5);
  31143. if (value < 31) {
  31144. return value + 6;
  31145. }
  31146. value = readBits(7);
  31147. return value + 37;
  31148. }
  31149. const tileIndex = context.currentTile.index;
  31150. const tile = context.tiles[tileIndex];
  31151. const sopMarkerUsed = context.COD.sopMarkerUsed;
  31152. const ephMarkerUsed = context.COD.ephMarkerUsed;
  31153. const packetsIterator = tile.packetsIterator;
  31154. while (position < dataLength) {
  31155. alignToByte();
  31156. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  31157. skipBytes(4);
  31158. }
  31159. const packet = packetsIterator.nextPacket();
  31160. if (!readBits(1)) {
  31161. continue;
  31162. }
  31163. const layerNumber = packet.layerNumber,
  31164. queue = [];
  31165. let codeblock;
  31166. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  31167. codeblock = packet.codeblocks[i];
  31168. let precinct = codeblock.precinct;
  31169. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  31170. const codeblockRow = codeblock.cby - precinct.cbyMin;
  31171. let codeblockIncluded = false;
  31172. let firstTimeInclusion = false;
  31173. let valueReady, zeroBitPlanesTree;
  31174. if (codeblock.included !== undefined) {
  31175. codeblockIncluded = !!readBits(1);
  31176. } else {
  31177. precinct = codeblock.precinct;
  31178. let inclusionTree;
  31179. if (precinct.inclusionTree !== undefined) {
  31180. inclusionTree = precinct.inclusionTree;
  31181. } else {
  31182. const width = precinct.cbxMax - precinct.cbxMin + 1;
  31183. const height = precinct.cbyMax - precinct.cbyMin + 1;
  31184. inclusionTree = new InclusionTree(width, height, layerNumber);
  31185. zeroBitPlanesTree = new TagTree(width, height);
  31186. precinct.inclusionTree = inclusionTree;
  31187. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  31188. for (let l = 0; l < layerNumber; l++) {
  31189. if (readBits(1) !== 0) {
  31190. throw new JpxError("Invalid tag tree");
  31191. }
  31192. }
  31193. }
  31194. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  31195. while (true) {
  31196. if (readBits(1)) {
  31197. valueReady = !inclusionTree.nextLevel();
  31198. if (valueReady) {
  31199. codeblock.included = true;
  31200. codeblockIncluded = firstTimeInclusion = true;
  31201. break;
  31202. }
  31203. } else {
  31204. inclusionTree.incrementValue(layerNumber);
  31205. break;
  31206. }
  31207. }
  31208. }
  31209. }
  31210. if (!codeblockIncluded) {
  31211. continue;
  31212. }
  31213. if (firstTimeInclusion) {
  31214. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  31215. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  31216. while (true) {
  31217. if (readBits(1)) {
  31218. valueReady = !zeroBitPlanesTree.nextLevel();
  31219. if (valueReady) {
  31220. break;
  31221. }
  31222. } else {
  31223. zeroBitPlanesTree.incrementValue();
  31224. }
  31225. }
  31226. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  31227. }
  31228. const codingpasses = readCodingpasses();
  31229. while (readBits(1)) {
  31230. codeblock.Lblock++;
  31231. }
  31232. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  31233. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  31234. const codedDataLength = readBits(bits);
  31235. queue.push({
  31236. codeblock,
  31237. codingpasses,
  31238. dataLength: codedDataLength
  31239. });
  31240. }
  31241. alignToByte();
  31242. if (ephMarkerUsed) {
  31243. skipMarkerIfEqual(0x92);
  31244. }
  31245. while (queue.length > 0) {
  31246. const packetItem = queue.shift();
  31247. codeblock = packetItem.codeblock;
  31248. if (codeblock.data === undefined) {
  31249. codeblock.data = [];
  31250. }
  31251. codeblock.data.push({
  31252. data,
  31253. start: offset + position,
  31254. end: offset + position + packetItem.dataLength,
  31255. codingpasses: packetItem.codingpasses
  31256. });
  31257. position += packetItem.dataLength;
  31258. }
  31259. }
  31260. return position;
  31261. }
  31262. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  31263. const x0 = subband.tbx0;
  31264. const y0 = subband.tby0;
  31265. const width = subband.tbx1 - subband.tbx0;
  31266. const codeblocks = subband.codeblocks;
  31267. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  31268. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  31269. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  31270. const codeblock = codeblocks[i];
  31271. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  31272. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  31273. if (blockWidth === 0 || blockHeight === 0) {
  31274. continue;
  31275. }
  31276. if (codeblock.data === undefined) {
  31277. continue;
  31278. }
  31279. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  31280. let currentCodingpassType = 2;
  31281. const data = codeblock.data;
  31282. let totalLength = 0,
  31283. codingpasses = 0;
  31284. let j, jj, dataItem;
  31285. for (j = 0, jj = data.length; j < jj; j++) {
  31286. dataItem = data[j];
  31287. totalLength += dataItem.end - dataItem.start;
  31288. codingpasses += dataItem.codingpasses;
  31289. }
  31290. const encodedData = new Uint8Array(totalLength);
  31291. let position = 0;
  31292. for (j = 0, jj = data.length; j < jj; j++) {
  31293. dataItem = data[j];
  31294. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  31295. encodedData.set(chunk, position);
  31296. position += chunk.length;
  31297. }
  31298. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  31299. bitModel.setDecoder(decoder);
  31300. for (j = 0; j < codingpasses; j++) {
  31301. switch (currentCodingpassType) {
  31302. case 0:
  31303. bitModel.runSignificancePropagationPass();
  31304. break;
  31305. case 1:
  31306. bitModel.runMagnitudeRefinementPass();
  31307. break;
  31308. case 2:
  31309. bitModel.runCleanupPass();
  31310. if (segmentationSymbolUsed) {
  31311. bitModel.checkSegmentationSymbol();
  31312. }
  31313. break;
  31314. }
  31315. if (resetContextProbabilities) {
  31316. bitModel.reset();
  31317. }
  31318. currentCodingpassType = (currentCodingpassType + 1) % 3;
  31319. }
  31320. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  31321. const sign = bitModel.coefficentsSign;
  31322. const magnitude = bitModel.coefficentsMagnitude;
  31323. const bitsDecoded = bitModel.bitsDecoded;
  31324. const magnitudeCorrection = reversible ? 0 : 0.5;
  31325. let k, n, nb;
  31326. position = 0;
  31327. const interleave = subband.type !== "LL";
  31328. for (j = 0; j < blockHeight; j++) {
  31329. const row = offset / width | 0;
  31330. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  31331. for (k = 0; k < blockWidth; k++) {
  31332. n = magnitude[position];
  31333. if (n !== 0) {
  31334. n = (n + magnitudeCorrection) * delta;
  31335. if (sign[position] !== 0) {
  31336. n = -n;
  31337. }
  31338. nb = bitsDecoded[position];
  31339. const pos = interleave ? levelOffset + (offset << 1) : offset;
  31340. if (reversible && nb >= mb) {
  31341. coefficients[pos] = n;
  31342. } else {
  31343. coefficients[pos] = n * (1 << mb - nb);
  31344. }
  31345. }
  31346. offset++;
  31347. position++;
  31348. }
  31349. offset += width - blockWidth;
  31350. }
  31351. }
  31352. }
  31353. function transformTile(context, tile, c) {
  31354. const component = tile.components[c];
  31355. const codingStyleParameters = component.codingStyleParameters;
  31356. const quantizationParameters = component.quantizationParameters;
  31357. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  31358. const spqcds = quantizationParameters.SPqcds;
  31359. const scalarExpounded = quantizationParameters.scalarExpounded;
  31360. const guardBits = quantizationParameters.guardBits;
  31361. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  31362. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  31363. const precision = context.components[c].precision;
  31364. const reversible = codingStyleParameters.reversibleTransformation;
  31365. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  31366. const subbandCoefficients = [];
  31367. let b = 0;
  31368. for (let i = 0; i <= decompositionLevelsCount; i++) {
  31369. const resolution = component.resolutions[i];
  31370. const width = resolution.trx1 - resolution.trx0;
  31371. const height = resolution.try1 - resolution.try0;
  31372. const coefficients = new Float32Array(width * height);
  31373. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  31374. let mu, epsilon;
  31375. if (!scalarExpounded) {
  31376. mu = spqcds[0].mu;
  31377. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  31378. } else {
  31379. mu = spqcds[b].mu;
  31380. epsilon = spqcds[b].epsilon;
  31381. b++;
  31382. }
  31383. const subband = resolution.subbands[j];
  31384. const gainLog2 = SubbandsGainLog2[subband.type];
  31385. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  31386. const mb = guardBits + epsilon - 1;
  31387. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  31388. }
  31389. subbandCoefficients.push({
  31390. width,
  31391. height,
  31392. items: coefficients
  31393. });
  31394. }
  31395. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  31396. return {
  31397. left: component.tcx0,
  31398. top: component.tcy0,
  31399. width: result.width,
  31400. height: result.height,
  31401. items: result.items
  31402. };
  31403. }
  31404. function transformComponents(context) {
  31405. const siz = context.SIZ;
  31406. const components = context.components;
  31407. const componentsCount = siz.Csiz;
  31408. const resultImages = [];
  31409. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  31410. const tile = context.tiles[i];
  31411. const transformedTiles = [];
  31412. for (let c = 0; c < componentsCount; c++) {
  31413. transformedTiles[c] = transformTile(context, tile, c);
  31414. }
  31415. const tile0 = transformedTiles[0];
  31416. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  31417. const result = {
  31418. left: tile0.left,
  31419. top: tile0.top,
  31420. width: tile0.width,
  31421. height: tile0.height,
  31422. items: out
  31423. };
  31424. let shift, offset;
  31425. let pos = 0,
  31426. j,
  31427. jj,
  31428. y0,
  31429. y1,
  31430. y2;
  31431. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  31432. const fourComponents = componentsCount === 4;
  31433. const y0items = transformedTiles[0].items;
  31434. const y1items = transformedTiles[1].items;
  31435. const y2items = transformedTiles[2].items;
  31436. const y3items = fourComponents ? transformedTiles[3].items : null;
  31437. shift = components[0].precision - 8;
  31438. offset = (128 << shift) + 0.5;
  31439. const component0 = tile.components[0];
  31440. const alpha01 = componentsCount - 3;
  31441. jj = y0items.length;
  31442. if (!component0.codingStyleParameters.reversibleTransformation) {
  31443. for (j = 0; j < jj; j++, pos += alpha01) {
  31444. y0 = y0items[j] + offset;
  31445. y1 = y1items[j];
  31446. y2 = y2items[j];
  31447. out[pos++] = y0 + 1.402 * y2 >> shift;
  31448. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  31449. out[pos++] = y0 + 1.772 * y1 >> shift;
  31450. }
  31451. } else {
  31452. for (j = 0; j < jj; j++, pos += alpha01) {
  31453. y0 = y0items[j] + offset;
  31454. y1 = y1items[j];
  31455. y2 = y2items[j];
  31456. const g = y0 - (y2 + y1 >> 2);
  31457. out[pos++] = g + y2 >> shift;
  31458. out[pos++] = g >> shift;
  31459. out[pos++] = g + y1 >> shift;
  31460. }
  31461. }
  31462. if (fourComponents) {
  31463. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  31464. out[pos] = y3items[j] + offset >> shift;
  31465. }
  31466. }
  31467. } else {
  31468. for (let c = 0; c < componentsCount; c++) {
  31469. const items = transformedTiles[c].items;
  31470. shift = components[c].precision - 8;
  31471. offset = (128 << shift) + 0.5;
  31472. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  31473. out[pos] = items[j] + offset >> shift;
  31474. pos += componentsCount;
  31475. }
  31476. }
  31477. }
  31478. resultImages.push(result);
  31479. }
  31480. return resultImages;
  31481. }
  31482. function initializeTile(context, tileIndex) {
  31483. const siz = context.SIZ;
  31484. const componentsCount = siz.Csiz;
  31485. const tile = context.tiles[tileIndex];
  31486. for (let c = 0; c < componentsCount; c++) {
  31487. const component = tile.components[c];
  31488. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  31489. component.quantizationParameters = qcdOrQcc;
  31490. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  31491. component.codingStyleParameters = codOrCoc;
  31492. }
  31493. tile.codingStyleDefaultParameters = context.currentTile.COD;
  31494. }
  31495. class TagTree {
  31496. constructor(width, height) {
  31497. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31498. this.levels = [];
  31499. for (let i = 0; i < levelsLength; i++) {
  31500. const level = {
  31501. width,
  31502. height,
  31503. items: []
  31504. };
  31505. this.levels.push(level);
  31506. width = Math.ceil(width / 2);
  31507. height = Math.ceil(height / 2);
  31508. }
  31509. }
  31510. reset(i, j) {
  31511. let currentLevel = 0,
  31512. value = 0,
  31513. level;
  31514. while (currentLevel < this.levels.length) {
  31515. level = this.levels[currentLevel];
  31516. const index = i + j * level.width;
  31517. if (level.items[index] !== undefined) {
  31518. value = level.items[index];
  31519. break;
  31520. }
  31521. level.index = index;
  31522. i >>= 1;
  31523. j >>= 1;
  31524. currentLevel++;
  31525. }
  31526. currentLevel--;
  31527. level = this.levels[currentLevel];
  31528. level.items[level.index] = value;
  31529. this.currentLevel = currentLevel;
  31530. delete this.value;
  31531. }
  31532. incrementValue() {
  31533. const level = this.levels[this.currentLevel];
  31534. level.items[level.index]++;
  31535. }
  31536. nextLevel() {
  31537. let currentLevel = this.currentLevel;
  31538. let level = this.levels[currentLevel];
  31539. const value = level.items[level.index];
  31540. currentLevel--;
  31541. if (currentLevel < 0) {
  31542. this.value = value;
  31543. return false;
  31544. }
  31545. this.currentLevel = currentLevel;
  31546. level = this.levels[currentLevel];
  31547. level.items[level.index] = value;
  31548. return true;
  31549. }
  31550. }
  31551. class InclusionTree {
  31552. constructor(width, height, defaultValue) {
  31553. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31554. this.levels = [];
  31555. for (let i = 0; i < levelsLength; i++) {
  31556. const items = new Uint8Array(width * height);
  31557. for (let j = 0, jj = items.length; j < jj; j++) {
  31558. items[j] = defaultValue;
  31559. }
  31560. const level = {
  31561. width,
  31562. height,
  31563. items
  31564. };
  31565. this.levels.push(level);
  31566. width = Math.ceil(width / 2);
  31567. height = Math.ceil(height / 2);
  31568. }
  31569. }
  31570. reset(i, j, stopValue) {
  31571. let currentLevel = 0;
  31572. while (currentLevel < this.levels.length) {
  31573. const level = this.levels[currentLevel];
  31574. const index = i + j * level.width;
  31575. level.index = index;
  31576. const value = level.items[index];
  31577. if (value === 0xff) {
  31578. break;
  31579. }
  31580. if (value > stopValue) {
  31581. this.currentLevel = currentLevel;
  31582. this.propagateValues();
  31583. return false;
  31584. }
  31585. i >>= 1;
  31586. j >>= 1;
  31587. currentLevel++;
  31588. }
  31589. this.currentLevel = currentLevel - 1;
  31590. return true;
  31591. }
  31592. incrementValue(stopValue) {
  31593. const level = this.levels[this.currentLevel];
  31594. level.items[level.index] = stopValue + 1;
  31595. this.propagateValues();
  31596. }
  31597. propagateValues() {
  31598. let levelIndex = this.currentLevel;
  31599. let level = this.levels[levelIndex];
  31600. const currentValue = level.items[level.index];
  31601. while (--levelIndex >= 0) {
  31602. level = this.levels[levelIndex];
  31603. level.items[level.index] = currentValue;
  31604. }
  31605. }
  31606. nextLevel() {
  31607. let currentLevel = this.currentLevel;
  31608. let level = this.levels[currentLevel];
  31609. const value = level.items[level.index];
  31610. level.items[level.index] = 0xff;
  31611. currentLevel--;
  31612. if (currentLevel < 0) {
  31613. return false;
  31614. }
  31615. this.currentLevel = currentLevel;
  31616. level = this.levels[currentLevel];
  31617. level.items[level.index] = value;
  31618. return true;
  31619. }
  31620. }
  31621. const BitModel = function BitModelClosure() {
  31622. const UNIFORM_CONTEXT = 17;
  31623. const RUNLENGTH_CONTEXT = 18;
  31624. 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]);
  31625. 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]);
  31626. 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]);
  31627. class BitModel {
  31628. constructor(width, height, subband, zeroBitPlanes, mb) {
  31629. this.width = width;
  31630. this.height = height;
  31631. let contextLabelTable;
  31632. if (subband === "HH") {
  31633. contextLabelTable = HHContextLabel;
  31634. } else if (subband === "HL") {
  31635. contextLabelTable = HLContextLabel;
  31636. } else {
  31637. contextLabelTable = LLAndLHContextsLabel;
  31638. }
  31639. this.contextLabelTable = contextLabelTable;
  31640. const coefficientCount = width * height;
  31641. this.neighborsSignificance = new Uint8Array(coefficientCount);
  31642. this.coefficentsSign = new Uint8Array(coefficientCount);
  31643. let coefficentsMagnitude;
  31644. if (mb > 14) {
  31645. coefficentsMagnitude = new Uint32Array(coefficientCount);
  31646. } else if (mb > 6) {
  31647. coefficentsMagnitude = new Uint16Array(coefficientCount);
  31648. } else {
  31649. coefficentsMagnitude = new Uint8Array(coefficientCount);
  31650. }
  31651. this.coefficentsMagnitude = coefficentsMagnitude;
  31652. this.processingFlags = new Uint8Array(coefficientCount);
  31653. const bitsDecoded = new Uint8Array(coefficientCount);
  31654. if (zeroBitPlanes !== 0) {
  31655. for (let i = 0; i < coefficientCount; i++) {
  31656. bitsDecoded[i] = zeroBitPlanes;
  31657. }
  31658. }
  31659. this.bitsDecoded = bitsDecoded;
  31660. this.reset();
  31661. }
  31662. setDecoder(decoder) {
  31663. this.decoder = decoder;
  31664. }
  31665. reset() {
  31666. this.contexts = new Int8Array(19);
  31667. this.contexts[0] = 4 << 1 | 0;
  31668. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  31669. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  31670. }
  31671. setNeighborsSignificance(row, column, index) {
  31672. const neighborsSignificance = this.neighborsSignificance;
  31673. const width = this.width,
  31674. height = this.height;
  31675. const left = column > 0;
  31676. const right = column + 1 < width;
  31677. let i;
  31678. if (row > 0) {
  31679. i = index - width;
  31680. if (left) {
  31681. neighborsSignificance[i - 1] += 0x10;
  31682. }
  31683. if (right) {
  31684. neighborsSignificance[i + 1] += 0x10;
  31685. }
  31686. neighborsSignificance[i] += 0x04;
  31687. }
  31688. if (row + 1 < height) {
  31689. i = index + width;
  31690. if (left) {
  31691. neighborsSignificance[i - 1] += 0x10;
  31692. }
  31693. if (right) {
  31694. neighborsSignificance[i + 1] += 0x10;
  31695. }
  31696. neighborsSignificance[i] += 0x04;
  31697. }
  31698. if (left) {
  31699. neighborsSignificance[index - 1] += 0x01;
  31700. }
  31701. if (right) {
  31702. neighborsSignificance[index + 1] += 0x01;
  31703. }
  31704. neighborsSignificance[index] |= 0x80;
  31705. }
  31706. runSignificancePropagationPass() {
  31707. const decoder = this.decoder;
  31708. const width = this.width,
  31709. height = this.height;
  31710. const coefficentsMagnitude = this.coefficentsMagnitude;
  31711. const coefficentsSign = this.coefficentsSign;
  31712. const neighborsSignificance = this.neighborsSignificance;
  31713. const processingFlags = this.processingFlags;
  31714. const contexts = this.contexts;
  31715. const labels = this.contextLabelTable;
  31716. const bitsDecoded = this.bitsDecoded;
  31717. const processedInverseMask = ~1;
  31718. const processedMask = 1;
  31719. const firstMagnitudeBitMask = 2;
  31720. for (let i0 = 0; i0 < height; i0 += 4) {
  31721. for (let j = 0; j < width; j++) {
  31722. let index = i0 * width + j;
  31723. for (let i1 = 0; i1 < 4; i1++, index += width) {
  31724. const i = i0 + i1;
  31725. if (i >= height) {
  31726. break;
  31727. }
  31728. processingFlags[index] &= processedInverseMask;
  31729. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  31730. continue;
  31731. }
  31732. const contextLabel = labels[neighborsSignificance[index]];
  31733. const decision = decoder.readBit(contexts, contextLabel);
  31734. if (decision) {
  31735. const sign = this.decodeSignBit(i, j, index);
  31736. coefficentsSign[index] = sign;
  31737. coefficentsMagnitude[index] = 1;
  31738. this.setNeighborsSignificance(i, j, index);
  31739. processingFlags[index] |= firstMagnitudeBitMask;
  31740. }
  31741. bitsDecoded[index]++;
  31742. processingFlags[index] |= processedMask;
  31743. }
  31744. }
  31745. }
  31746. }
  31747. decodeSignBit(row, column, index) {
  31748. const width = this.width,
  31749. height = this.height;
  31750. const coefficentsMagnitude = this.coefficentsMagnitude;
  31751. const coefficentsSign = this.coefficentsSign;
  31752. let contribution, sign0, sign1, significance1;
  31753. let contextLabel, decoded;
  31754. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  31755. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31756. sign1 = coefficentsSign[index + 1];
  31757. if (significance1) {
  31758. sign0 = coefficentsSign[index - 1];
  31759. contribution = 1 - sign1 - sign0;
  31760. } else {
  31761. contribution = 1 - sign1 - sign1;
  31762. }
  31763. } else if (significance1) {
  31764. sign0 = coefficentsSign[index - 1];
  31765. contribution = 1 - sign0 - sign0;
  31766. } else {
  31767. contribution = 0;
  31768. }
  31769. const horizontalContribution = 3 * contribution;
  31770. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31771. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31772. sign1 = coefficentsSign[index + width];
  31773. if (significance1) {
  31774. sign0 = coefficentsSign[index - width];
  31775. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31776. } else {
  31777. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31778. }
  31779. } else if (significance1) {
  31780. sign0 = coefficentsSign[index - width];
  31781. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31782. } else {
  31783. contribution = horizontalContribution;
  31784. }
  31785. if (contribution >= 0) {
  31786. contextLabel = 9 + contribution;
  31787. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31788. } else {
  31789. contextLabel = 9 - contribution;
  31790. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31791. }
  31792. return decoded;
  31793. }
  31794. runMagnitudeRefinementPass() {
  31795. const decoder = this.decoder;
  31796. const width = this.width,
  31797. height = this.height;
  31798. const coefficentsMagnitude = this.coefficentsMagnitude;
  31799. const neighborsSignificance = this.neighborsSignificance;
  31800. const contexts = this.contexts;
  31801. const bitsDecoded = this.bitsDecoded;
  31802. const processingFlags = this.processingFlags;
  31803. const processedMask = 1;
  31804. const firstMagnitudeBitMask = 2;
  31805. const length = width * height;
  31806. const width4 = width * 4;
  31807. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31808. indexNext = Math.min(length, index0 + width4);
  31809. for (let j = 0; j < width; j++) {
  31810. for (let index = index0 + j; index < indexNext; index += width) {
  31811. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31812. continue;
  31813. }
  31814. let contextLabel = 16;
  31815. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31816. processingFlags[index] ^= firstMagnitudeBitMask;
  31817. const significance = neighborsSignificance[index] & 127;
  31818. contextLabel = significance === 0 ? 15 : 14;
  31819. }
  31820. const bit = decoder.readBit(contexts, contextLabel);
  31821. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31822. bitsDecoded[index]++;
  31823. processingFlags[index] |= processedMask;
  31824. }
  31825. }
  31826. }
  31827. }
  31828. runCleanupPass() {
  31829. const decoder = this.decoder;
  31830. const width = this.width,
  31831. height = this.height;
  31832. const neighborsSignificance = this.neighborsSignificance;
  31833. const coefficentsMagnitude = this.coefficentsMagnitude;
  31834. const coefficentsSign = this.coefficentsSign;
  31835. const contexts = this.contexts;
  31836. const labels = this.contextLabelTable;
  31837. const bitsDecoded = this.bitsDecoded;
  31838. const processingFlags = this.processingFlags;
  31839. const processedMask = 1;
  31840. const firstMagnitudeBitMask = 2;
  31841. const oneRowDown = width;
  31842. const twoRowsDown = width * 2;
  31843. const threeRowsDown = width * 3;
  31844. let iNext;
  31845. for (let i0 = 0; i0 < height; i0 = iNext) {
  31846. iNext = Math.min(i0 + 4, height);
  31847. const indexBase = i0 * width;
  31848. const checkAllEmpty = i0 + 3 < height;
  31849. for (let j = 0; j < width; j++) {
  31850. const index0 = indexBase + j;
  31851. 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;
  31852. let i1 = 0,
  31853. index = index0;
  31854. let i = i0,
  31855. sign;
  31856. if (allEmpty) {
  31857. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31858. if (!hasSignificantCoefficent) {
  31859. bitsDecoded[index0]++;
  31860. bitsDecoded[index0 + oneRowDown]++;
  31861. bitsDecoded[index0 + twoRowsDown]++;
  31862. bitsDecoded[index0 + threeRowsDown]++;
  31863. continue;
  31864. }
  31865. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31866. if (i1 !== 0) {
  31867. i = i0 + i1;
  31868. index += i1 * width;
  31869. }
  31870. sign = this.decodeSignBit(i, j, index);
  31871. coefficentsSign[index] = sign;
  31872. coefficentsMagnitude[index] = 1;
  31873. this.setNeighborsSignificance(i, j, index);
  31874. processingFlags[index] |= firstMagnitudeBitMask;
  31875. index = index0;
  31876. for (let i2 = i0; i2 <= i; i2++, index += width) {
  31877. bitsDecoded[index]++;
  31878. }
  31879. i1++;
  31880. }
  31881. for (i = i0 + i1; i < iNext; i++, index += width) {
  31882. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31883. continue;
  31884. }
  31885. const contextLabel = labels[neighborsSignificance[index]];
  31886. const decision = decoder.readBit(contexts, contextLabel);
  31887. if (decision === 1) {
  31888. sign = this.decodeSignBit(i, j, index);
  31889. coefficentsSign[index] = sign;
  31890. coefficentsMagnitude[index] = 1;
  31891. this.setNeighborsSignificance(i, j, index);
  31892. processingFlags[index] |= firstMagnitudeBitMask;
  31893. }
  31894. bitsDecoded[index]++;
  31895. }
  31896. }
  31897. }
  31898. }
  31899. checkSegmentationSymbol() {
  31900. const decoder = this.decoder;
  31901. const contexts = this.contexts;
  31902. 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);
  31903. if (symbol !== 0xa) {
  31904. throw new JpxError("Invalid segmentation symbol");
  31905. }
  31906. }
  31907. }
  31908. return BitModel;
  31909. }();
  31910. class Transform {
  31911. constructor() {
  31912. if (this.constructor === Transform) {
  31913. (0, _util.unreachable)("Cannot initialize Transform.");
  31914. }
  31915. }
  31916. calculate(subbands, u0, v0) {
  31917. let ll = subbands[0];
  31918. for (let i = 1, ii = subbands.length; i < ii; i++) {
  31919. ll = this.iterate(ll, subbands[i], u0, v0);
  31920. }
  31921. return ll;
  31922. }
  31923. extend(buffer, offset, size) {
  31924. let i1 = offset - 1,
  31925. j1 = offset + 1;
  31926. let i2 = offset + size - 2,
  31927. j2 = offset + size;
  31928. buffer[i1--] = buffer[j1++];
  31929. buffer[j2++] = buffer[i2--];
  31930. buffer[i1--] = buffer[j1++];
  31931. buffer[j2++] = buffer[i2--];
  31932. buffer[i1--] = buffer[j1++];
  31933. buffer[j2++] = buffer[i2--];
  31934. buffer[i1] = buffer[j1];
  31935. buffer[j2] = buffer[i2];
  31936. }
  31937. filter(x, offset, length) {
  31938. (0, _util.unreachable)("Abstract method `filter` called");
  31939. }
  31940. iterate(ll, hl_lh_hh, u0, v0) {
  31941. const llWidth = ll.width,
  31942. llHeight = ll.height;
  31943. let llItems = ll.items;
  31944. const width = hl_lh_hh.width;
  31945. const height = hl_lh_hh.height;
  31946. const items = hl_lh_hh.items;
  31947. let i, j, k, l, u, v;
  31948. for (k = 0, i = 0; i < llHeight; i++) {
  31949. l = i * 2 * width;
  31950. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31951. items[l] = llItems[k];
  31952. }
  31953. }
  31954. llItems = ll.items = null;
  31955. const bufferPadding = 4;
  31956. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31957. if (width === 1) {
  31958. if ((u0 & 1) !== 0) {
  31959. for (v = 0, k = 0; v < height; v++, k += width) {
  31960. items[k] *= 0.5;
  31961. }
  31962. }
  31963. } else {
  31964. for (v = 0, k = 0; v < height; v++, k += width) {
  31965. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31966. this.extend(rowBuffer, bufferPadding, width);
  31967. this.filter(rowBuffer, bufferPadding, width);
  31968. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31969. }
  31970. }
  31971. let numBuffers = 16;
  31972. const colBuffers = [];
  31973. for (i = 0; i < numBuffers; i++) {
  31974. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31975. }
  31976. let b,
  31977. currentBuffer = 0;
  31978. ll = bufferPadding + height;
  31979. if (height === 1) {
  31980. if ((v0 & 1) !== 0) {
  31981. for (u = 0; u < width; u++) {
  31982. items[u] *= 0.5;
  31983. }
  31984. }
  31985. } else {
  31986. for (u = 0; u < width; u++) {
  31987. if (currentBuffer === 0) {
  31988. numBuffers = Math.min(width - u, numBuffers);
  31989. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31990. for (b = 0; b < numBuffers; b++) {
  31991. colBuffers[b][l] = items[k + b];
  31992. }
  31993. }
  31994. currentBuffer = numBuffers;
  31995. }
  31996. currentBuffer--;
  31997. const buffer = colBuffers[currentBuffer];
  31998. this.extend(buffer, bufferPadding, height);
  31999. this.filter(buffer, bufferPadding, height);
  32000. if (currentBuffer === 0) {
  32001. k = u - numBuffers + 1;
  32002. for (l = bufferPadding; l < ll; k += width, l++) {
  32003. for (b = 0; b < numBuffers; b++) {
  32004. items[k + b] = colBuffers[b][l];
  32005. }
  32006. }
  32007. }
  32008. }
  32009. }
  32010. return {
  32011. width,
  32012. height,
  32013. items
  32014. };
  32015. }
  32016. }
  32017. class IrreversibleTransform extends Transform {
  32018. filter(x, offset, length) {
  32019. const len = length >> 1;
  32020. offset |= 0;
  32021. let j, n, current, next;
  32022. const alpha = -1.586134342059924;
  32023. const beta = -0.052980118572961;
  32024. const gamma = 0.882911075530934;
  32025. const delta = 0.443506852043971;
  32026. const K = 1.230174104914001;
  32027. const K_ = 1 / K;
  32028. j = offset - 3;
  32029. for (n = len + 4; n--; j += 2) {
  32030. x[j] *= K_;
  32031. }
  32032. j = offset - 2;
  32033. current = delta * x[j - 1];
  32034. for (n = len + 3; n--; j += 2) {
  32035. next = delta * x[j + 1];
  32036. x[j] = K * x[j] - current - next;
  32037. if (n--) {
  32038. j += 2;
  32039. current = delta * x[j + 1];
  32040. x[j] = K * x[j] - current - next;
  32041. } else {
  32042. break;
  32043. }
  32044. }
  32045. j = offset - 1;
  32046. current = gamma * x[j - 1];
  32047. for (n = len + 2; n--; j += 2) {
  32048. next = gamma * x[j + 1];
  32049. x[j] -= current + next;
  32050. if (n--) {
  32051. j += 2;
  32052. current = gamma * x[j + 1];
  32053. x[j] -= current + next;
  32054. } else {
  32055. break;
  32056. }
  32057. }
  32058. j = offset;
  32059. current = beta * x[j - 1];
  32060. for (n = len + 1; n--; j += 2) {
  32061. next = beta * x[j + 1];
  32062. x[j] -= current + next;
  32063. if (n--) {
  32064. j += 2;
  32065. current = beta * x[j + 1];
  32066. x[j] -= current + next;
  32067. } else {
  32068. break;
  32069. }
  32070. }
  32071. if (len !== 0) {
  32072. j = offset + 1;
  32073. current = alpha * x[j - 1];
  32074. for (n = len; n--; j += 2) {
  32075. next = alpha * x[j + 1];
  32076. x[j] -= current + next;
  32077. if (n--) {
  32078. j += 2;
  32079. current = alpha * x[j + 1];
  32080. x[j] -= current + next;
  32081. } else {
  32082. break;
  32083. }
  32084. }
  32085. }
  32086. }
  32087. }
  32088. class ReversibleTransform extends Transform {
  32089. filter(x, offset, length) {
  32090. const len = length >> 1;
  32091. offset |= 0;
  32092. let j, n;
  32093. for (j = offset, n = len + 1; n--; j += 2) {
  32094. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  32095. }
  32096. for (j = offset + 1, n = len; n--; j += 2) {
  32097. x[j] += x[j - 1] + x[j + 1] >> 1;
  32098. }
  32099. }
  32100. }
  32101. /***/ }),
  32102. /* 41 */
  32103. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32104. Object.defineProperty(exports, "__esModule", ({
  32105. value: true
  32106. }));
  32107. exports.LZWStream = void 0;
  32108. var _decode_stream = __w_pdfjs_require__(29);
  32109. class LZWStream extends _decode_stream.DecodeStream {
  32110. constructor(str, maybeLength, earlyChange) {
  32111. super(maybeLength);
  32112. this.str = str;
  32113. this.dict = str.dict;
  32114. this.cachedData = 0;
  32115. this.bitsCached = 0;
  32116. const maxLzwDictionarySize = 4096;
  32117. const lzwState = {
  32118. earlyChange,
  32119. codeLength: 9,
  32120. nextCode: 258,
  32121. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  32122. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  32123. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  32124. currentSequence: new Uint8Array(maxLzwDictionarySize),
  32125. currentSequenceLength: 0
  32126. };
  32127. for (let i = 0; i < 256; ++i) {
  32128. lzwState.dictionaryValues[i] = i;
  32129. lzwState.dictionaryLengths[i] = 1;
  32130. }
  32131. this.lzwState = lzwState;
  32132. }
  32133. readBits(n) {
  32134. let bitsCached = this.bitsCached;
  32135. let cachedData = this.cachedData;
  32136. while (bitsCached < n) {
  32137. const c = this.str.getByte();
  32138. if (c === -1) {
  32139. this.eof = true;
  32140. return null;
  32141. }
  32142. cachedData = cachedData << 8 | c;
  32143. bitsCached += 8;
  32144. }
  32145. this.bitsCached = bitsCached -= n;
  32146. this.cachedData = cachedData;
  32147. this.lastCode = null;
  32148. return cachedData >>> bitsCached & (1 << n) - 1;
  32149. }
  32150. readBlock() {
  32151. const blockSize = 512,
  32152. decodedSizeDelta = blockSize;
  32153. let estimatedDecodedSize = blockSize * 2;
  32154. let i, j, q;
  32155. const lzwState = this.lzwState;
  32156. if (!lzwState) {
  32157. return;
  32158. }
  32159. const earlyChange = lzwState.earlyChange;
  32160. let nextCode = lzwState.nextCode;
  32161. const dictionaryValues = lzwState.dictionaryValues;
  32162. const dictionaryLengths = lzwState.dictionaryLengths;
  32163. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  32164. let codeLength = lzwState.codeLength;
  32165. let prevCode = lzwState.prevCode;
  32166. const currentSequence = lzwState.currentSequence;
  32167. let currentSequenceLength = lzwState.currentSequenceLength;
  32168. let decodedLength = 0;
  32169. let currentBufferLength = this.bufferLength;
  32170. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  32171. for (i = 0; i < blockSize; i++) {
  32172. const code = this.readBits(codeLength);
  32173. const hasPrev = currentSequenceLength > 0;
  32174. if (code < 256) {
  32175. currentSequence[0] = code;
  32176. currentSequenceLength = 1;
  32177. } else if (code >= 258) {
  32178. if (code < nextCode) {
  32179. currentSequenceLength = dictionaryLengths[code];
  32180. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  32181. currentSequence[j] = dictionaryValues[q];
  32182. q = dictionaryPrevCodes[q];
  32183. }
  32184. } else {
  32185. currentSequence[currentSequenceLength++] = currentSequence[0];
  32186. }
  32187. } else if (code === 256) {
  32188. codeLength = 9;
  32189. nextCode = 258;
  32190. currentSequenceLength = 0;
  32191. continue;
  32192. } else {
  32193. this.eof = true;
  32194. delete this.lzwState;
  32195. break;
  32196. }
  32197. if (hasPrev) {
  32198. dictionaryPrevCodes[nextCode] = prevCode;
  32199. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  32200. dictionaryValues[nextCode] = currentSequence[0];
  32201. nextCode++;
  32202. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  32203. }
  32204. prevCode = code;
  32205. decodedLength += currentSequenceLength;
  32206. if (estimatedDecodedSize < decodedLength) {
  32207. do {
  32208. estimatedDecodedSize += decodedSizeDelta;
  32209. } while (estimatedDecodedSize < decodedLength);
  32210. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  32211. }
  32212. for (j = 0; j < currentSequenceLength; j++) {
  32213. buffer[currentBufferLength++] = currentSequence[j];
  32214. }
  32215. }
  32216. lzwState.nextCode = nextCode;
  32217. lzwState.codeLength = codeLength;
  32218. lzwState.prevCode = prevCode;
  32219. lzwState.currentSequenceLength = currentSequenceLength;
  32220. this.bufferLength = currentBufferLength;
  32221. }
  32222. }
  32223. exports.LZWStream = LZWStream;
  32224. /***/ }),
  32225. /* 42 */
  32226. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32227. Object.defineProperty(exports, "__esModule", ({
  32228. value: true
  32229. }));
  32230. exports.PredictorStream = void 0;
  32231. var _decode_stream = __w_pdfjs_require__(29);
  32232. var _primitives = __w_pdfjs_require__(5);
  32233. var _util = __w_pdfjs_require__(2);
  32234. class PredictorStream extends _decode_stream.DecodeStream {
  32235. constructor(str, maybeLength, params) {
  32236. super(maybeLength);
  32237. if (!(params instanceof _primitives.Dict)) {
  32238. return str;
  32239. }
  32240. const predictor = this.predictor = params.get("Predictor") || 1;
  32241. if (predictor <= 1) {
  32242. return str;
  32243. }
  32244. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  32245. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32246. }
  32247. if (predictor === 2) {
  32248. this.readBlock = this.readBlockTiff;
  32249. } else {
  32250. this.readBlock = this.readBlockPng;
  32251. }
  32252. this.str = str;
  32253. this.dict = str.dict;
  32254. const colors = this.colors = params.get("Colors") || 1;
  32255. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  32256. const columns = this.columns = params.get("Columns") || 1;
  32257. this.pixBytes = colors * bits + 7 >> 3;
  32258. this.rowBytes = columns * colors * bits + 7 >> 3;
  32259. return this;
  32260. }
  32261. readBlockTiff() {
  32262. const rowBytes = this.rowBytes;
  32263. const bufferLength = this.bufferLength;
  32264. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32265. const bits = this.bits;
  32266. const colors = this.colors;
  32267. const rawBytes = this.str.getBytes(rowBytes);
  32268. this.eof = !rawBytes.length;
  32269. if (this.eof) {
  32270. return;
  32271. }
  32272. let inbuf = 0,
  32273. outbuf = 0;
  32274. let inbits = 0,
  32275. outbits = 0;
  32276. let pos = bufferLength;
  32277. let i;
  32278. if (bits === 1 && colors === 1) {
  32279. for (i = 0; i < rowBytes; ++i) {
  32280. let c = rawBytes[i] ^ inbuf;
  32281. c ^= c >> 1;
  32282. c ^= c >> 2;
  32283. c ^= c >> 4;
  32284. inbuf = (c & 1) << 7;
  32285. buffer[pos++] = c;
  32286. }
  32287. } else if (bits === 8) {
  32288. for (i = 0; i < colors; ++i) {
  32289. buffer[pos++] = rawBytes[i];
  32290. }
  32291. for (; i < rowBytes; ++i) {
  32292. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  32293. pos++;
  32294. }
  32295. } else if (bits === 16) {
  32296. const bytesPerPixel = colors * 2;
  32297. for (i = 0; i < bytesPerPixel; ++i) {
  32298. buffer[pos++] = rawBytes[i];
  32299. }
  32300. for (; i < rowBytes; i += 2) {
  32301. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  32302. buffer[pos++] = sum >> 8 & 0xff;
  32303. buffer[pos++] = sum & 0xff;
  32304. }
  32305. } else {
  32306. const compArray = new Uint8Array(colors + 1);
  32307. const bitMask = (1 << bits) - 1;
  32308. let j = 0,
  32309. k = bufferLength;
  32310. const columns = this.columns;
  32311. for (i = 0; i < columns; ++i) {
  32312. for (let kk = 0; kk < colors; ++kk) {
  32313. if (inbits < bits) {
  32314. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  32315. inbits += 8;
  32316. }
  32317. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  32318. inbits -= bits;
  32319. outbuf = outbuf << bits | compArray[kk];
  32320. outbits += bits;
  32321. if (outbits >= 8) {
  32322. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  32323. outbits -= 8;
  32324. }
  32325. }
  32326. }
  32327. if (outbits > 0) {
  32328. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  32329. }
  32330. }
  32331. this.bufferLength += rowBytes;
  32332. }
  32333. readBlockPng() {
  32334. const rowBytes = this.rowBytes;
  32335. const pixBytes = this.pixBytes;
  32336. const predictor = this.str.getByte();
  32337. const rawBytes = this.str.getBytes(rowBytes);
  32338. this.eof = !rawBytes.length;
  32339. if (this.eof) {
  32340. return;
  32341. }
  32342. const bufferLength = this.bufferLength;
  32343. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32344. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  32345. if (prevRow.length === 0) {
  32346. prevRow = new Uint8Array(rowBytes);
  32347. }
  32348. let i,
  32349. j = bufferLength,
  32350. up,
  32351. c;
  32352. switch (predictor) {
  32353. case 0:
  32354. for (i = 0; i < rowBytes; ++i) {
  32355. buffer[j++] = rawBytes[i];
  32356. }
  32357. break;
  32358. case 1:
  32359. for (i = 0; i < pixBytes; ++i) {
  32360. buffer[j++] = rawBytes[i];
  32361. }
  32362. for (; i < rowBytes; ++i) {
  32363. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  32364. j++;
  32365. }
  32366. break;
  32367. case 2:
  32368. for (i = 0; i < rowBytes; ++i) {
  32369. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  32370. }
  32371. break;
  32372. case 3:
  32373. for (i = 0; i < pixBytes; ++i) {
  32374. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  32375. }
  32376. for (; i < rowBytes; ++i) {
  32377. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  32378. j++;
  32379. }
  32380. break;
  32381. case 4:
  32382. for (i = 0; i < pixBytes; ++i) {
  32383. up = prevRow[i];
  32384. c = rawBytes[i];
  32385. buffer[j++] = up + c;
  32386. }
  32387. for (; i < rowBytes; ++i) {
  32388. up = prevRow[i];
  32389. const upLeft = prevRow[i - pixBytes];
  32390. const left = buffer[j - pixBytes];
  32391. const p = left + up - upLeft;
  32392. let pa = p - left;
  32393. if (pa < 0) {
  32394. pa = -pa;
  32395. }
  32396. let pb = p - up;
  32397. if (pb < 0) {
  32398. pb = -pb;
  32399. }
  32400. let pc = p - upLeft;
  32401. if (pc < 0) {
  32402. pc = -pc;
  32403. }
  32404. c = rawBytes[i];
  32405. if (pa <= pb && pa <= pc) {
  32406. buffer[j++] = left + c;
  32407. } else if (pb <= pc) {
  32408. buffer[j++] = up + c;
  32409. } else {
  32410. buffer[j++] = upLeft + c;
  32411. }
  32412. }
  32413. break;
  32414. default:
  32415. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32416. }
  32417. this.bufferLength += rowBytes;
  32418. }
  32419. }
  32420. exports.PredictorStream = PredictorStream;
  32421. /***/ }),
  32422. /* 43 */
  32423. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32424. Object.defineProperty(exports, "__esModule", ({
  32425. value: true
  32426. }));
  32427. exports.RunLengthStream = void 0;
  32428. var _decode_stream = __w_pdfjs_require__(29);
  32429. class RunLengthStream extends _decode_stream.DecodeStream {
  32430. constructor(str, maybeLength) {
  32431. super(maybeLength);
  32432. this.str = str;
  32433. this.dict = str.dict;
  32434. }
  32435. readBlock() {
  32436. const repeatHeader = this.str.getBytes(2);
  32437. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  32438. this.eof = true;
  32439. return;
  32440. }
  32441. let buffer;
  32442. let bufferLength = this.bufferLength;
  32443. let n = repeatHeader[0];
  32444. if (n < 128) {
  32445. buffer = this.ensureBuffer(bufferLength + n + 1);
  32446. buffer[bufferLength++] = repeatHeader[1];
  32447. if (n > 0) {
  32448. const source = this.str.getBytes(n);
  32449. buffer.set(source, bufferLength);
  32450. bufferLength += n;
  32451. }
  32452. } else {
  32453. n = 257 - n;
  32454. const b = repeatHeader[1];
  32455. buffer = this.ensureBuffer(bufferLength + n + 1);
  32456. for (let i = 0; i < n; i++) {
  32457. buffer[bufferLength++] = b;
  32458. }
  32459. }
  32460. this.bufferLength = bufferLength;
  32461. }
  32462. }
  32463. exports.RunLengthStream = RunLengthStream;
  32464. /***/ }),
  32465. /* 44 */
  32466. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32467. Object.defineProperty(exports, "__esModule", ({
  32468. value: true
  32469. }));
  32470. exports.Font = exports.ErrorFont = void 0;
  32471. var _util = __w_pdfjs_require__(2);
  32472. var _cff_parser = __w_pdfjs_require__(45);
  32473. var _fonts_utils = __w_pdfjs_require__(18);
  32474. var _unicode = __w_pdfjs_require__(21);
  32475. var _glyphlist = __w_pdfjs_require__(20);
  32476. var _encodings = __w_pdfjs_require__(19);
  32477. var _standard_fonts = __w_pdfjs_require__(47);
  32478. var _to_unicode_map = __w_pdfjs_require__(48);
  32479. var _cff_font = __w_pdfjs_require__(49);
  32480. var _font_renderer = __w_pdfjs_require__(50);
  32481. var _metrics = __w_pdfjs_require__(51);
  32482. var _glyf = __w_pdfjs_require__(52);
  32483. var _cmap = __w_pdfjs_require__(26);
  32484. var _opentype_file_builder = __w_pdfjs_require__(53);
  32485. var _core_utils = __w_pdfjs_require__(8);
  32486. var _stream = __w_pdfjs_require__(10);
  32487. var _type1_font = __w_pdfjs_require__(54);
  32488. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  32489. const PDF_GLYPH_SPACE_UNITS = 1000;
  32490. 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"];
  32491. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  32492. function adjustWidths(properties) {
  32493. if (!properties.fontMatrix) {
  32494. return;
  32495. }
  32496. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  32497. return;
  32498. }
  32499. const scale = 0.001 / properties.fontMatrix[0];
  32500. const glyphsWidths = properties.widths;
  32501. for (const glyph in glyphsWidths) {
  32502. glyphsWidths[glyph] *= scale;
  32503. }
  32504. properties.defaultWidth *= scale;
  32505. }
  32506. function adjustToUnicode(properties, builtInEncoding) {
  32507. if (properties.isInternalFont) {
  32508. return;
  32509. }
  32510. if (builtInEncoding === properties.defaultEncoding) {
  32511. return;
  32512. }
  32513. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32514. return;
  32515. }
  32516. const toUnicode = [],
  32517. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32518. for (const charCode in builtInEncoding) {
  32519. if (properties.hasIncludedToUnicodeMap) {
  32520. if (properties.toUnicode.has(charCode)) {
  32521. continue;
  32522. }
  32523. } else if (properties.hasEncoding) {
  32524. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  32525. continue;
  32526. }
  32527. }
  32528. const glyphName = builtInEncoding[charCode];
  32529. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32530. if (unicode !== -1) {
  32531. toUnicode[charCode] = String.fromCharCode(unicode);
  32532. }
  32533. }
  32534. if (toUnicode.length > 0) {
  32535. properties.toUnicode.amend(toUnicode);
  32536. }
  32537. }
  32538. function amendFallbackToUnicode(properties) {
  32539. if (!properties.fallbackToUnicode) {
  32540. return;
  32541. }
  32542. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32543. return;
  32544. }
  32545. const toUnicode = [];
  32546. for (const charCode in properties.fallbackToUnicode) {
  32547. if (properties.toUnicode.has(charCode)) {
  32548. continue;
  32549. }
  32550. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  32551. }
  32552. if (toUnicode.length > 0) {
  32553. properties.toUnicode.amend(toUnicode);
  32554. }
  32555. }
  32556. class Glyph {
  32557. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32558. this.originalCharCode = originalCharCode;
  32559. this.fontChar = fontChar;
  32560. this.unicode = unicode;
  32561. this.accent = accent;
  32562. this.width = width;
  32563. this.vmetric = vmetric;
  32564. this.operatorListId = operatorListId;
  32565. this.isSpace = isSpace;
  32566. this.isInFont = isInFont;
  32567. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  32568. this.isWhitespace = category.isWhitespace;
  32569. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  32570. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  32571. }
  32572. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32573. 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;
  32574. }
  32575. }
  32576. function int16(b0, b1) {
  32577. return (b0 << 8) + b1;
  32578. }
  32579. function writeSignedInt16(bytes, index, value) {
  32580. bytes[index + 1] = value;
  32581. bytes[index] = value >>> 8;
  32582. }
  32583. function signedInt16(b0, b1) {
  32584. const value = (b0 << 8) + b1;
  32585. return value & 1 << 15 ? value - 0x10000 : value;
  32586. }
  32587. function int32(b0, b1, b2, b3) {
  32588. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  32589. }
  32590. function string16(value) {
  32591. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32592. }
  32593. function safeString16(value) {
  32594. if (value > 0x7fff) {
  32595. value = 0x7fff;
  32596. } else if (value < -0x8000) {
  32597. value = -0x8000;
  32598. }
  32599. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32600. }
  32601. function isTrueTypeFile(file) {
  32602. const header = file.peekBytes(4);
  32603. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  32604. }
  32605. function isTrueTypeCollectionFile(file) {
  32606. const header = file.peekBytes(4);
  32607. return (0, _util.bytesToString)(header) === "ttcf";
  32608. }
  32609. function isOpenTypeFile(file) {
  32610. const header = file.peekBytes(4);
  32611. return (0, _util.bytesToString)(header) === "OTTO";
  32612. }
  32613. function isType1File(file) {
  32614. const header = file.peekBytes(2);
  32615. if (header[0] === 0x25 && header[1] === 0x21) {
  32616. return true;
  32617. }
  32618. if (header[0] === 0x80 && header[1] === 0x01) {
  32619. return true;
  32620. }
  32621. return false;
  32622. }
  32623. function isCFFFile(file) {
  32624. const header = file.peekBytes(4);
  32625. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  32626. return true;
  32627. }
  32628. return false;
  32629. }
  32630. function getFontFileType(file, {
  32631. type,
  32632. subtype,
  32633. composite
  32634. }) {
  32635. let fileType, fileSubtype;
  32636. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  32637. if (composite) {
  32638. fileType = "CIDFontType2";
  32639. } else {
  32640. fileType = "TrueType";
  32641. }
  32642. } else if (isOpenTypeFile(file)) {
  32643. if (composite) {
  32644. fileType = "CIDFontType2";
  32645. } else {
  32646. fileType = "OpenType";
  32647. }
  32648. } else if (isType1File(file)) {
  32649. if (composite) {
  32650. fileType = "CIDFontType0";
  32651. } else {
  32652. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32653. }
  32654. } else if (isCFFFile(file)) {
  32655. if (composite) {
  32656. fileType = "CIDFontType0";
  32657. fileSubtype = "CIDFontType0C";
  32658. } else {
  32659. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32660. fileSubtype = "Type1C";
  32661. }
  32662. } else {
  32663. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  32664. fileType = type;
  32665. fileSubtype = subtype;
  32666. }
  32667. return [fileType, fileSubtype];
  32668. }
  32669. function applyStandardFontGlyphMap(map, glyphMap) {
  32670. for (const charCode in glyphMap) {
  32671. map[+charCode] = glyphMap[charCode];
  32672. }
  32673. }
  32674. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  32675. const toFontChar = [];
  32676. let unicode;
  32677. for (let i = 0, ii = encoding.length; i < ii; i++) {
  32678. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  32679. if (unicode !== -1) {
  32680. toFontChar[i] = unicode;
  32681. }
  32682. }
  32683. for (const charCode in differences) {
  32684. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  32685. if (unicode !== -1) {
  32686. toFontChar[+charCode] = unicode;
  32687. }
  32688. }
  32689. return toFontChar;
  32690. }
  32691. function convertCidString(charCode, cid, shouldThrow = false) {
  32692. switch (cid.length) {
  32693. case 1:
  32694. return cid.charCodeAt(0);
  32695. case 2:
  32696. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  32697. }
  32698. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  32699. if (shouldThrow) {
  32700. throw new _util.FormatError(msg);
  32701. }
  32702. (0, _util.warn)(msg);
  32703. return cid;
  32704. }
  32705. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  32706. const newMap = Object.create(null);
  32707. const toFontChar = [];
  32708. let privateUseAreaIndex = 0;
  32709. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32710. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32711. for (let originalCharCode in charCodeToGlyphId) {
  32712. originalCharCode |= 0;
  32713. let glyphId = charCodeToGlyphId[originalCharCode];
  32714. if (!hasGlyph(glyphId)) {
  32715. continue;
  32716. }
  32717. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  32718. privateUseAreaIndex++;
  32719. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  32720. (0, _util.warn)("Ran out of space in font private use area.");
  32721. break;
  32722. }
  32723. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32724. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32725. }
  32726. const fontCharCode = nextAvailableFontCharCode++;
  32727. if (glyphId === 0) {
  32728. glyphId = newGlyphZeroId;
  32729. }
  32730. newMap[fontCharCode] = glyphId;
  32731. toFontChar[originalCharCode] = fontCharCode;
  32732. }
  32733. return {
  32734. toFontChar,
  32735. charCodeToGlyphId: newMap,
  32736. nextAvailableFontCharCode
  32737. };
  32738. }
  32739. function getRanges(glyphs, numGlyphs) {
  32740. const codes = [];
  32741. for (const charCode in glyphs) {
  32742. if (glyphs[charCode] >= numGlyphs) {
  32743. continue;
  32744. }
  32745. codes.push({
  32746. fontCharCode: charCode | 0,
  32747. glyphId: glyphs[charCode]
  32748. });
  32749. }
  32750. if (codes.length === 0) {
  32751. codes.push({
  32752. fontCharCode: 0,
  32753. glyphId: 0
  32754. });
  32755. }
  32756. codes.sort(function fontGetRangesSort(a, b) {
  32757. return a.fontCharCode - b.fontCharCode;
  32758. });
  32759. const ranges = [];
  32760. const length = codes.length;
  32761. for (let n = 0; n < length;) {
  32762. const start = codes[n].fontCharCode;
  32763. const codeIndices = [codes[n].glyphId];
  32764. ++n;
  32765. let end = start;
  32766. while (n < length && end + 1 === codes[n].fontCharCode) {
  32767. codeIndices.push(codes[n].glyphId);
  32768. ++end;
  32769. ++n;
  32770. if (end === 0xffff) {
  32771. break;
  32772. }
  32773. }
  32774. ranges.push([start, end, codeIndices]);
  32775. }
  32776. return ranges;
  32777. }
  32778. function createCmapTable(glyphs, numGlyphs) {
  32779. const ranges = getRanges(glyphs, numGlyphs);
  32780. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  32781. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  32782. let i, ii, j, jj;
  32783. for (i = ranges.length - 1; i >= 0; --i) {
  32784. if (ranges[i][0] <= 0xffff) {
  32785. break;
  32786. }
  32787. }
  32788. const bmpLength = i + 1;
  32789. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  32790. ranges[i][1] = 0xfffe;
  32791. }
  32792. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  32793. const segCount = bmpLength + trailingRangesCount;
  32794. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  32795. let startCount = "";
  32796. let endCount = "";
  32797. let idDeltas = "";
  32798. let idRangeOffsets = "";
  32799. let glyphsIds = "";
  32800. let bias = 0;
  32801. let range, start, end, codes;
  32802. for (i = 0, ii = bmpLength; i < ii; i++) {
  32803. range = ranges[i];
  32804. start = range[0];
  32805. end = range[1];
  32806. startCount += string16(start);
  32807. endCount += string16(end);
  32808. codes = range[2];
  32809. let contiguous = true;
  32810. for (j = 1, jj = codes.length; j < jj; ++j) {
  32811. if (codes[j] !== codes[j - 1] + 1) {
  32812. contiguous = false;
  32813. break;
  32814. }
  32815. }
  32816. if (!contiguous) {
  32817. const offset = (segCount - i) * 2 + bias * 2;
  32818. bias += end - start + 1;
  32819. idDeltas += string16(0);
  32820. idRangeOffsets += string16(offset);
  32821. for (j = 0, jj = codes.length; j < jj; ++j) {
  32822. glyphsIds += string16(codes[j]);
  32823. }
  32824. } else {
  32825. const startCode = codes[0];
  32826. idDeltas += string16(startCode - start & 0xffff);
  32827. idRangeOffsets += string16(0);
  32828. }
  32829. }
  32830. if (trailingRangesCount > 0) {
  32831. endCount += "\xFF\xFF";
  32832. startCount += "\xFF\xFF";
  32833. idDeltas += "\x00\x01";
  32834. idRangeOffsets += "\x00\x00";
  32835. }
  32836. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  32837. let format31012 = "";
  32838. let header31012 = "";
  32839. if (numTables > 1) {
  32840. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  32841. format31012 = "";
  32842. for (i = 0, ii = ranges.length; i < ii; i++) {
  32843. range = ranges[i];
  32844. start = range[0];
  32845. codes = range[2];
  32846. let code = codes[0];
  32847. for (j = 1, jj = codes.length; j < jj; ++j) {
  32848. if (codes[j] !== codes[j - 1] + 1) {
  32849. end = range[0] + j - 1;
  32850. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  32851. start = end + 1;
  32852. code = codes[j];
  32853. }
  32854. }
  32855. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  32856. }
  32857. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  32858. }
  32859. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  32860. }
  32861. function validateOS2Table(os2, file) {
  32862. file.pos = (file.start || 0) + os2.offset;
  32863. const version = file.getUint16();
  32864. file.skip(60);
  32865. const selection = file.getUint16();
  32866. if (version < 4 && selection & 0x0300) {
  32867. return false;
  32868. }
  32869. const firstChar = file.getUint16();
  32870. const lastChar = file.getUint16();
  32871. if (firstChar > lastChar) {
  32872. return false;
  32873. }
  32874. file.skip(6);
  32875. const usWinAscent = file.getUint16();
  32876. if (usWinAscent === 0) {
  32877. return false;
  32878. }
  32879. os2.data[8] = os2.data[9] = 0;
  32880. return true;
  32881. }
  32882. function createOS2Table(properties, charstrings, override) {
  32883. override = override || {
  32884. unitsPerEm: 0,
  32885. yMax: 0,
  32886. yMin: 0,
  32887. ascent: 0,
  32888. descent: 0
  32889. };
  32890. let ulUnicodeRange1 = 0;
  32891. let ulUnicodeRange2 = 0;
  32892. let ulUnicodeRange3 = 0;
  32893. let ulUnicodeRange4 = 0;
  32894. let firstCharIndex = null;
  32895. let lastCharIndex = 0;
  32896. if (charstrings) {
  32897. for (let code in charstrings) {
  32898. code |= 0;
  32899. if (firstCharIndex > code || !firstCharIndex) {
  32900. firstCharIndex = code;
  32901. }
  32902. if (lastCharIndex < code) {
  32903. lastCharIndex = code;
  32904. }
  32905. const position = (0, _unicode.getUnicodeRangeFor)(code);
  32906. if (position < 32) {
  32907. ulUnicodeRange1 |= 1 << position;
  32908. } else if (position < 64) {
  32909. ulUnicodeRange2 |= 1 << position - 32;
  32910. } else if (position < 96) {
  32911. ulUnicodeRange3 |= 1 << position - 64;
  32912. } else if (position < 123) {
  32913. ulUnicodeRange4 |= 1 << position - 96;
  32914. } else {
  32915. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  32916. }
  32917. }
  32918. if (lastCharIndex > 0xffff) {
  32919. lastCharIndex = 0xffff;
  32920. }
  32921. } else {
  32922. firstCharIndex = 0;
  32923. lastCharIndex = 255;
  32924. }
  32925. const bbox = properties.bbox || [0, 0, 0, 0];
  32926. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  32927. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  32928. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  32929. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  32930. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  32931. typoDescent = -typoDescent;
  32932. }
  32933. const winAscent = override.yMax || typoAscent;
  32934. const winDescent = -override.yMin || -typoDescent;
  32935. 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";
  32936. }
  32937. function createPostTable(properties) {
  32938. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  32939. 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";
  32940. }
  32941. function createPostscriptName(name) {
  32942. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  32943. }
  32944. function createNameTable(name, proto) {
  32945. if (!proto) {
  32946. proto = [[], []];
  32947. }
  32948. 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"];
  32949. const stringsUnicode = [];
  32950. let i, ii, j, jj, str;
  32951. for (i = 0, ii = strings.length; i < ii; i++) {
  32952. str = proto[1][i] || strings[i];
  32953. const strBufUnicode = [];
  32954. for (j = 0, jj = str.length; j < jj; j++) {
  32955. strBufUnicode.push(string16(str.charCodeAt(j)));
  32956. }
  32957. stringsUnicode.push(strBufUnicode.join(""));
  32958. }
  32959. const names = [strings, stringsUnicode];
  32960. const platforms = ["\x00\x01", "\x00\x03"];
  32961. const encodings = ["\x00\x00", "\x00\x01"];
  32962. const languages = ["\x00\x00", "\x04\x09"];
  32963. const namesRecordCount = strings.length * platforms.length;
  32964. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  32965. let strOffset = 0;
  32966. for (i = 0, ii = platforms.length; i < ii; i++) {
  32967. const strs = names[i];
  32968. for (j = 0, jj = strs.length; j < jj; j++) {
  32969. str = strs[j];
  32970. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  32971. nameTable += nameRecord;
  32972. strOffset += str.length;
  32973. }
  32974. }
  32975. nameTable += strings.join("") + stringsUnicode.join("");
  32976. return nameTable;
  32977. }
  32978. class Font {
  32979. constructor(name, file, properties) {
  32980. this.name = name;
  32981. this.psName = null;
  32982. this.mimetype = null;
  32983. this.disableFontFace = false;
  32984. this.loadedName = properties.loadedName;
  32985. this.isType3Font = properties.isType3Font;
  32986. this.missingFile = false;
  32987. this.cssFontInfo = properties.cssFontInfo;
  32988. this._charsCache = Object.create(null);
  32989. this._glyphCache = Object.create(null);
  32990. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  32991. if (!isSerifFont && !properties.isSimulatedFlags) {
  32992. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  32993. serifFonts = (0, _standard_fonts.getSerifFonts)();
  32994. for (const namePart of baseName.split("+")) {
  32995. if (serifFonts[namePart]) {
  32996. isSerifFont = true;
  32997. break;
  32998. }
  32999. }
  33000. }
  33001. this.isSerifFont = isSerifFont;
  33002. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  33003. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  33004. let type = properties.type;
  33005. let subtype = properties.subtype;
  33006. this.type = type;
  33007. this.subtype = subtype;
  33008. let fallbackName = "sans-serif";
  33009. if (this.isMonospace) {
  33010. fallbackName = "monospace";
  33011. } else if (this.isSerifFont) {
  33012. fallbackName = "serif";
  33013. }
  33014. this.fallbackName = fallbackName;
  33015. this.differences = properties.differences;
  33016. this.widths = properties.widths;
  33017. this.defaultWidth = properties.defaultWidth;
  33018. this.composite = properties.composite;
  33019. this.cMap = properties.cMap;
  33020. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  33021. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  33022. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  33023. this.lineHeight = this.ascent - this.descent;
  33024. this.fontMatrix = properties.fontMatrix;
  33025. this.bbox = properties.bbox;
  33026. this.defaultEncoding = properties.defaultEncoding;
  33027. this.toUnicode = properties.toUnicode;
  33028. this.toFontChar = [];
  33029. if (properties.type === "Type3") {
  33030. for (let charCode = 0; charCode < 256; charCode++) {
  33031. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  33032. }
  33033. this.fontType = _util.FontType.TYPE3;
  33034. return;
  33035. }
  33036. this.cidEncoding = properties.cidEncoding || "";
  33037. this.vertical = !!properties.vertical;
  33038. if (this.vertical) {
  33039. this.vmetrics = properties.vmetrics;
  33040. this.defaultVMetrics = properties.defaultVMetrics;
  33041. }
  33042. if (!file || file.isEmpty) {
  33043. if (file) {
  33044. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  33045. }
  33046. this.fallbackToSystemFont(properties);
  33047. return;
  33048. }
  33049. [type, subtype] = getFontFileType(file, properties);
  33050. if (type !== this.type || subtype !== this.subtype) {
  33051. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  33052. }
  33053. let data;
  33054. try {
  33055. switch (type) {
  33056. case "MMType1":
  33057. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  33058. case "Type1":
  33059. case "CIDFontType0":
  33060. this.mimetype = "font/opentype";
  33061. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  33062. adjustWidths(properties);
  33063. data = this.convert(name, cff, properties);
  33064. break;
  33065. case "OpenType":
  33066. case "TrueType":
  33067. case "CIDFontType2":
  33068. this.mimetype = "font/opentype";
  33069. data = this.checkAndRepair(name, file, properties);
  33070. if (this.isOpenType) {
  33071. adjustWidths(properties);
  33072. type = "OpenType";
  33073. }
  33074. break;
  33075. default:
  33076. throw new _util.FormatError(`Font ${type} is not supported`);
  33077. }
  33078. } catch (e) {
  33079. (0, _util.warn)(e);
  33080. this.fallbackToSystemFont(properties);
  33081. return;
  33082. }
  33083. amendFallbackToUnicode(properties);
  33084. this.data = data;
  33085. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  33086. this.fontMatrix = properties.fontMatrix;
  33087. this.widths = properties.widths;
  33088. this.defaultWidth = properties.defaultWidth;
  33089. this.toUnicode = properties.toUnicode;
  33090. this.seacMap = properties.seacMap;
  33091. }
  33092. get renderer() {
  33093. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  33094. return (0, _util.shadow)(this, "renderer", renderer);
  33095. }
  33096. exportData(extraProperties = false) {
  33097. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  33098. const data = Object.create(null);
  33099. let property, value;
  33100. for (property of exportDataProperties) {
  33101. value = this[property];
  33102. if (value !== undefined) {
  33103. data[property] = value;
  33104. }
  33105. }
  33106. return data;
  33107. }
  33108. fallbackToSystemFont(properties) {
  33109. this.missingFile = true;
  33110. const name = this.name;
  33111. const type = this.type;
  33112. const subtype = this.subtype;
  33113. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  33114. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  33115. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  33116. const isStandardFont = !!stdFontMap[fontName];
  33117. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  33118. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  33119. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  33120. const metrics = fontBasicMetricsMap[fontName];
  33121. if (metrics) {
  33122. if (isNaN(this.ascent)) {
  33123. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  33124. }
  33125. if (isNaN(this.descent)) {
  33126. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  33127. }
  33128. if (isNaN(this.capHeight)) {
  33129. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  33130. }
  33131. }
  33132. this.bold = fontName.search(/bold/gi) !== -1;
  33133. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  33134. this.black = name.search(/Black/g) !== -1;
  33135. const isNarrow = name.search(/Narrow/g) !== -1;
  33136. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  33137. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  33138. const cidToGidMap = properties.cidToGidMap;
  33139. const map = [];
  33140. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  33141. if (/Arial-?Black/i.test(name)) {
  33142. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  33143. } else if (/Calibri/i.test(name)) {
  33144. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  33145. }
  33146. if (cidToGidMap) {
  33147. for (const charCode in map) {
  33148. const cid = map[charCode];
  33149. if (cidToGidMap[cid] !== undefined) {
  33150. map[+charCode] = cidToGidMap[cid];
  33151. }
  33152. }
  33153. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33154. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33155. const cid = map[charCode];
  33156. if (cidToGidMap[cid] === undefined) {
  33157. map[+charCode] = unicodeCharCode;
  33158. }
  33159. });
  33160. }
  33161. }
  33162. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33163. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33164. map[+charCode] = unicodeCharCode;
  33165. });
  33166. }
  33167. this.toFontChar = map;
  33168. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  33169. } else if (/Symbol/i.test(fontName)) {
  33170. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  33171. } else if (/Dingbats/i.test(fontName)) {
  33172. if (/Wingdings/i.test(name)) {
  33173. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  33174. }
  33175. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  33176. } else if (isStandardFont) {
  33177. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  33178. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33179. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33180. map[+charCode] = unicodeCharCode;
  33181. });
  33182. }
  33183. this.toFontChar = map;
  33184. } else {
  33185. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33186. const map = [];
  33187. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  33188. if (!this.composite) {
  33189. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  33190. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  33191. if (unicode !== -1) {
  33192. unicodeCharCode = unicode;
  33193. }
  33194. }
  33195. map[+charCode] = unicodeCharCode;
  33196. });
  33197. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33198. if (/Verdana/i.test(name)) {
  33199. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  33200. }
  33201. }
  33202. this.toFontChar = map;
  33203. }
  33204. amendFallbackToUnicode(properties);
  33205. this.loadedName = fontName.split("-")[0];
  33206. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  33207. }
  33208. checkAndRepair(name, font, properties) {
  33209. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  33210. function readTables(file, numTables) {
  33211. const tables = Object.create(null);
  33212. tables["OS/2"] = null;
  33213. tables.cmap = null;
  33214. tables.head = null;
  33215. tables.hhea = null;
  33216. tables.hmtx = null;
  33217. tables.maxp = null;
  33218. tables.name = null;
  33219. tables.post = null;
  33220. for (let i = 0; i < numTables; i++) {
  33221. const table = readTableEntry(file);
  33222. if (!VALID_TABLES.includes(table.tag)) {
  33223. continue;
  33224. }
  33225. if (table.length === 0) {
  33226. continue;
  33227. }
  33228. tables[table.tag] = table;
  33229. }
  33230. return tables;
  33231. }
  33232. function readTableEntry(file) {
  33233. const tag = file.getString(4);
  33234. const checksum = file.getInt32() >>> 0;
  33235. const offset = file.getInt32() >>> 0;
  33236. const length = file.getInt32() >>> 0;
  33237. const previousPosition = file.pos;
  33238. file.pos = file.start ? file.start : 0;
  33239. file.skip(offset);
  33240. const data = file.getBytes(length);
  33241. file.pos = previousPosition;
  33242. if (tag === "head") {
  33243. data[8] = data[9] = data[10] = data[11] = 0;
  33244. data[17] |= 0x20;
  33245. }
  33246. return {
  33247. tag,
  33248. checksum,
  33249. length,
  33250. offset,
  33251. data
  33252. };
  33253. }
  33254. function readOpenTypeHeader(ttf) {
  33255. return {
  33256. version: ttf.getString(4),
  33257. numTables: ttf.getUint16(),
  33258. searchRange: ttf.getUint16(),
  33259. entrySelector: ttf.getUint16(),
  33260. rangeShift: ttf.getUint16()
  33261. };
  33262. }
  33263. function readTrueTypeCollectionHeader(ttc) {
  33264. const ttcTag = ttc.getString(4);
  33265. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  33266. const majorVersion = ttc.getUint16();
  33267. const minorVersion = ttc.getUint16();
  33268. const numFonts = ttc.getInt32() >>> 0;
  33269. const offsetTable = [];
  33270. for (let i = 0; i < numFonts; i++) {
  33271. offsetTable.push(ttc.getInt32() >>> 0);
  33272. }
  33273. const header = {
  33274. ttcTag,
  33275. majorVersion,
  33276. minorVersion,
  33277. numFonts,
  33278. offsetTable
  33279. };
  33280. switch (majorVersion) {
  33281. case 1:
  33282. return header;
  33283. case 2:
  33284. header.dsigTag = ttc.getInt32() >>> 0;
  33285. header.dsigLength = ttc.getInt32() >>> 0;
  33286. header.dsigOffset = ttc.getInt32() >>> 0;
  33287. return header;
  33288. }
  33289. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  33290. }
  33291. function readTrueTypeCollectionData(ttc, fontName) {
  33292. const {
  33293. numFonts,
  33294. offsetTable
  33295. } = readTrueTypeCollectionHeader(ttc);
  33296. const fontNameParts = fontName.split("+");
  33297. let fallbackData;
  33298. for (let i = 0; i < numFonts; i++) {
  33299. ttc.pos = (ttc.start || 0) + offsetTable[i];
  33300. const potentialHeader = readOpenTypeHeader(ttc);
  33301. const potentialTables = readTables(ttc, potentialHeader.numTables);
  33302. if (!potentialTables.name) {
  33303. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  33304. }
  33305. const nameTable = readNameTable(potentialTables.name);
  33306. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  33307. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  33308. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  33309. if (!nameEntry) {
  33310. continue;
  33311. }
  33312. if (nameEntry === fontName) {
  33313. return {
  33314. header: potentialHeader,
  33315. tables: potentialTables
  33316. };
  33317. }
  33318. if (fontNameParts.length < 2) {
  33319. continue;
  33320. }
  33321. for (const part of fontNameParts) {
  33322. if (nameEntry === part) {
  33323. fallbackData = {
  33324. name: part,
  33325. header: potentialHeader,
  33326. tables: potentialTables
  33327. };
  33328. }
  33329. }
  33330. }
  33331. }
  33332. }
  33333. if (fallbackData) {
  33334. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  33335. return {
  33336. header: fallbackData.header,
  33337. tables: fallbackData.tables
  33338. };
  33339. }
  33340. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  33341. }
  33342. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  33343. if (!cmap) {
  33344. (0, _util.warn)("No cmap table available.");
  33345. return {
  33346. platformId: -1,
  33347. encodingId: -1,
  33348. mappings: [],
  33349. hasShortCmap: false
  33350. };
  33351. }
  33352. let segment;
  33353. let start = (file.start ? file.start : 0) + cmap.offset;
  33354. file.pos = start;
  33355. file.skip(2);
  33356. const numTables = file.getUint16();
  33357. let potentialTable;
  33358. let canBreak = false;
  33359. for (let i = 0; i < numTables; i++) {
  33360. const platformId = file.getUint16();
  33361. const encodingId = file.getUint16();
  33362. const offset = file.getInt32() >>> 0;
  33363. let useTable = false;
  33364. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  33365. continue;
  33366. }
  33367. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  33368. useTable = true;
  33369. } else if (platformId === 1 && encodingId === 0) {
  33370. useTable = true;
  33371. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  33372. useTable = true;
  33373. if (!isSymbolicFont) {
  33374. canBreak = true;
  33375. }
  33376. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  33377. useTable = true;
  33378. let correctlySorted = true;
  33379. if (i < numTables - 1) {
  33380. const nextBytes = file.peekBytes(2),
  33381. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  33382. if (nextPlatformId < platformId) {
  33383. correctlySorted = false;
  33384. }
  33385. }
  33386. if (correctlySorted) {
  33387. canBreak = true;
  33388. }
  33389. }
  33390. if (useTable) {
  33391. potentialTable = {
  33392. platformId,
  33393. encodingId,
  33394. offset
  33395. };
  33396. }
  33397. if (canBreak) {
  33398. break;
  33399. }
  33400. }
  33401. if (potentialTable) {
  33402. file.pos = start + potentialTable.offset;
  33403. }
  33404. if (!potentialTable || file.peekByte() === -1) {
  33405. (0, _util.warn)("Could not find a preferred cmap table.");
  33406. return {
  33407. platformId: -1,
  33408. encodingId: -1,
  33409. mappings: [],
  33410. hasShortCmap: false
  33411. };
  33412. }
  33413. const format = file.getUint16();
  33414. let hasShortCmap = false;
  33415. const mappings = [];
  33416. let j, glyphId;
  33417. if (format === 0) {
  33418. file.skip(2 + 2);
  33419. for (j = 0; j < 256; j++) {
  33420. const index = file.getByte();
  33421. if (!index) {
  33422. continue;
  33423. }
  33424. mappings.push({
  33425. charCode: j,
  33426. glyphId: index
  33427. });
  33428. }
  33429. hasShortCmap = true;
  33430. } else if (format === 2) {
  33431. file.skip(2 + 2);
  33432. const subHeaderKeys = [];
  33433. let maxSubHeaderKey = 0;
  33434. for (let i = 0; i < 256; i++) {
  33435. const subHeaderKey = file.getUint16() >> 3;
  33436. subHeaderKeys.push(subHeaderKey);
  33437. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  33438. }
  33439. const subHeaders = [];
  33440. for (let i = 0; i <= maxSubHeaderKey; i++) {
  33441. subHeaders.push({
  33442. firstCode: file.getUint16(),
  33443. entryCount: file.getUint16(),
  33444. idDelta: signedInt16(file.getByte(), file.getByte()),
  33445. idRangePos: file.pos + file.getUint16()
  33446. });
  33447. }
  33448. for (let i = 0; i < 256; i++) {
  33449. if (subHeaderKeys[i] === 0) {
  33450. file.pos = subHeaders[0].idRangePos + 2 * i;
  33451. glyphId = file.getUint16();
  33452. mappings.push({
  33453. charCode: i,
  33454. glyphId
  33455. });
  33456. } else {
  33457. const s = subHeaders[subHeaderKeys[i]];
  33458. for (j = 0; j < s.entryCount; j++) {
  33459. const charCode = (i << 8) + j + s.firstCode;
  33460. file.pos = s.idRangePos + 2 * j;
  33461. glyphId = file.getUint16();
  33462. if (glyphId !== 0) {
  33463. glyphId = (glyphId + s.idDelta) % 65536;
  33464. }
  33465. mappings.push({
  33466. charCode,
  33467. glyphId
  33468. });
  33469. }
  33470. }
  33471. }
  33472. } else if (format === 4) {
  33473. file.skip(2 + 2);
  33474. const segCount = file.getUint16() >> 1;
  33475. file.skip(6);
  33476. const segments = [];
  33477. let segIndex;
  33478. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33479. segments.push({
  33480. end: file.getUint16()
  33481. });
  33482. }
  33483. file.skip(2);
  33484. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33485. segments[segIndex].start = file.getUint16();
  33486. }
  33487. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33488. segments[segIndex].delta = file.getUint16();
  33489. }
  33490. let offsetsCount = 0,
  33491. offsetIndex;
  33492. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33493. segment = segments[segIndex];
  33494. const rangeOffset = file.getUint16();
  33495. if (!rangeOffset) {
  33496. segment.offsetIndex = -1;
  33497. continue;
  33498. }
  33499. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  33500. segment.offsetIndex = offsetIndex;
  33501. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  33502. }
  33503. const offsets = [];
  33504. for (j = 0; j < offsetsCount; j++) {
  33505. offsets.push(file.getUint16());
  33506. }
  33507. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33508. segment = segments[segIndex];
  33509. start = segment.start;
  33510. const end = segment.end;
  33511. const delta = segment.delta;
  33512. offsetIndex = segment.offsetIndex;
  33513. for (j = start; j <= end; j++) {
  33514. if (j === 0xffff) {
  33515. continue;
  33516. }
  33517. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  33518. glyphId = glyphId + delta & 0xffff;
  33519. mappings.push({
  33520. charCode: j,
  33521. glyphId
  33522. });
  33523. }
  33524. }
  33525. } else if (format === 6) {
  33526. file.skip(2 + 2);
  33527. const firstCode = file.getUint16();
  33528. const entryCount = file.getUint16();
  33529. for (j = 0; j < entryCount; j++) {
  33530. glyphId = file.getUint16();
  33531. const charCode = firstCode + j;
  33532. mappings.push({
  33533. charCode,
  33534. glyphId
  33535. });
  33536. }
  33537. } else if (format === 12) {
  33538. file.skip(2 + 4 + 4);
  33539. const nGroups = file.getInt32() >>> 0;
  33540. for (j = 0; j < nGroups; j++) {
  33541. const startCharCode = file.getInt32() >>> 0;
  33542. const endCharCode = file.getInt32() >>> 0;
  33543. let glyphCode = file.getInt32() >>> 0;
  33544. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  33545. mappings.push({
  33546. charCode,
  33547. glyphId: glyphCode++
  33548. });
  33549. }
  33550. }
  33551. } else {
  33552. (0, _util.warn)("cmap table has unsupported format: " + format);
  33553. return {
  33554. platformId: -1,
  33555. encodingId: -1,
  33556. mappings: [],
  33557. hasShortCmap: false
  33558. };
  33559. }
  33560. mappings.sort(function (a, b) {
  33561. return a.charCode - b.charCode;
  33562. });
  33563. for (let i = 1; i < mappings.length; i++) {
  33564. if (mappings[i - 1].charCode === mappings[i].charCode) {
  33565. mappings.splice(i, 1);
  33566. i--;
  33567. }
  33568. }
  33569. return {
  33570. platformId: potentialTable.platformId,
  33571. encodingId: potentialTable.encodingId,
  33572. mappings,
  33573. hasShortCmap
  33574. };
  33575. }
  33576. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  33577. if (!header) {
  33578. if (metrics) {
  33579. metrics.data = null;
  33580. }
  33581. return;
  33582. }
  33583. file.pos = (file.start ? file.start : 0) + header.offset;
  33584. file.pos += 4;
  33585. file.pos += 2;
  33586. file.pos += 2;
  33587. file.pos += 2;
  33588. file.pos += 2;
  33589. file.pos += 2;
  33590. file.pos += 2;
  33591. file.pos += 2;
  33592. file.pos += 2;
  33593. file.pos += 2;
  33594. const caretOffset = file.getUint16();
  33595. file.pos += 8;
  33596. file.pos += 2;
  33597. let numOfMetrics = file.getUint16();
  33598. if (caretOffset !== 0) {
  33599. const macStyle = int16(headTable.data[44], headTable.data[45]);
  33600. if (!(macStyle & 2)) {
  33601. header.data[22] = 0;
  33602. header.data[23] = 0;
  33603. }
  33604. }
  33605. if (numOfMetrics > numGlyphs) {
  33606. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  33607. numOfMetrics = numGlyphs;
  33608. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  33609. header.data[35] = numOfMetrics & 0x00ff;
  33610. }
  33611. const numOfSidebearings = numGlyphs - numOfMetrics;
  33612. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  33613. if (numMissing > 0) {
  33614. const entries = new Uint8Array(metrics.length + numMissing * 2);
  33615. entries.set(metrics.data);
  33616. if (dupFirstEntry) {
  33617. entries[metrics.length] = metrics.data[2];
  33618. entries[metrics.length + 1] = metrics.data[3];
  33619. }
  33620. metrics.data = entries;
  33621. }
  33622. }
  33623. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  33624. const glyphProfile = {
  33625. length: 0,
  33626. sizeOfInstructions: 0
  33627. };
  33628. if (sourceEnd - sourceStart <= 12) {
  33629. return glyphProfile;
  33630. }
  33631. const glyf = source.subarray(sourceStart, sourceEnd);
  33632. let contoursCount = signedInt16(glyf[0], glyf[1]);
  33633. if (contoursCount < 0) {
  33634. contoursCount = -1;
  33635. writeSignedInt16(glyf, 0, contoursCount);
  33636. dest.set(glyf, destStart);
  33637. glyphProfile.length = glyf.length;
  33638. return glyphProfile;
  33639. }
  33640. let i,
  33641. j = 10,
  33642. flagsCount = 0;
  33643. for (i = 0; i < contoursCount; i++) {
  33644. const endPoint = glyf[j] << 8 | glyf[j + 1];
  33645. flagsCount = endPoint + 1;
  33646. j += 2;
  33647. }
  33648. const instructionsStart = j;
  33649. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  33650. glyphProfile.sizeOfInstructions = instructionsLength;
  33651. j += 2 + instructionsLength;
  33652. const instructionsEnd = j;
  33653. let coordinatesLength = 0;
  33654. for (i = 0; i < flagsCount; i++) {
  33655. const flag = glyf[j++];
  33656. if (flag & 0xc0) {
  33657. glyf[j - 1] = flag & 0x3f;
  33658. }
  33659. let xLength = 2;
  33660. if (flag & 2) {
  33661. xLength = 1;
  33662. } else if (flag & 16) {
  33663. xLength = 0;
  33664. }
  33665. let yLength = 2;
  33666. if (flag & 4) {
  33667. yLength = 1;
  33668. } else if (flag & 32) {
  33669. yLength = 0;
  33670. }
  33671. const xyLength = xLength + yLength;
  33672. coordinatesLength += xyLength;
  33673. if (flag & 8) {
  33674. const repeat = glyf[j++];
  33675. i += repeat;
  33676. coordinatesLength += repeat * xyLength;
  33677. }
  33678. }
  33679. if (coordinatesLength === 0) {
  33680. return glyphProfile;
  33681. }
  33682. let glyphDataLength = j + coordinatesLength;
  33683. if (glyphDataLength > glyf.length) {
  33684. return glyphProfile;
  33685. }
  33686. if (!hintsValid && instructionsLength > 0) {
  33687. dest.set(glyf.subarray(0, instructionsStart), destStart);
  33688. dest.set([0, 0], destStart + instructionsStart);
  33689. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  33690. glyphDataLength -= instructionsLength;
  33691. if (glyf.length - glyphDataLength > 3) {
  33692. glyphDataLength = glyphDataLength + 3 & ~3;
  33693. }
  33694. glyphProfile.length = glyphDataLength;
  33695. return glyphProfile;
  33696. }
  33697. if (glyf.length - glyphDataLength > 3) {
  33698. glyphDataLength = glyphDataLength + 3 & ~3;
  33699. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  33700. glyphProfile.length = glyphDataLength;
  33701. return glyphProfile;
  33702. }
  33703. dest.set(glyf, destStart);
  33704. glyphProfile.length = glyf.length;
  33705. return glyphProfile;
  33706. }
  33707. function sanitizeHead(head, numGlyphs, locaLength) {
  33708. const data = head.data;
  33709. const version = int32(data[0], data[1], data[2], data[3]);
  33710. if (version >> 16 !== 1) {
  33711. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  33712. data[0] = 0;
  33713. data[1] = 1;
  33714. data[2] = 0;
  33715. data[3] = 0;
  33716. }
  33717. const indexToLocFormat = int16(data[50], data[51]);
  33718. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  33719. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  33720. const numGlyphsPlusOne = numGlyphs + 1;
  33721. if (locaLength === numGlyphsPlusOne << 1) {
  33722. data[50] = 0;
  33723. data[51] = 0;
  33724. } else if (locaLength === numGlyphsPlusOne << 2) {
  33725. data[50] = 0;
  33726. data[51] = 1;
  33727. } else {
  33728. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  33729. }
  33730. }
  33731. }
  33732. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  33733. let itemSize, itemDecode, itemEncode;
  33734. if (isGlyphLocationsLong) {
  33735. itemSize = 4;
  33736. itemDecode = function fontItemDecodeLong(data, offset) {
  33737. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  33738. };
  33739. itemEncode = function fontItemEncodeLong(data, offset, value) {
  33740. data[offset] = value >>> 24 & 0xff;
  33741. data[offset + 1] = value >> 16 & 0xff;
  33742. data[offset + 2] = value >> 8 & 0xff;
  33743. data[offset + 3] = value & 0xff;
  33744. };
  33745. } else {
  33746. itemSize = 2;
  33747. itemDecode = function fontItemDecode(data, offset) {
  33748. return data[offset] << 9 | data[offset + 1] << 1;
  33749. };
  33750. itemEncode = function fontItemEncode(data, offset, value) {
  33751. data[offset] = value >> 9 & 0xff;
  33752. data[offset + 1] = value >> 1 & 0xff;
  33753. };
  33754. }
  33755. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  33756. const locaDataSize = itemSize * (1 + numGlyphsOut);
  33757. const locaData = new Uint8Array(locaDataSize);
  33758. locaData.set(loca.data.subarray(0, locaDataSize));
  33759. loca.data = locaData;
  33760. const oldGlyfData = glyf.data;
  33761. const oldGlyfDataLength = oldGlyfData.length;
  33762. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  33763. let i, j;
  33764. const locaEntries = [];
  33765. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  33766. let offset = itemDecode(locaData, j);
  33767. if (offset > oldGlyfDataLength) {
  33768. offset = oldGlyfDataLength;
  33769. }
  33770. locaEntries.push({
  33771. index: i,
  33772. offset,
  33773. endOffset: 0
  33774. });
  33775. }
  33776. locaEntries.sort((a, b) => {
  33777. return a.offset - b.offset;
  33778. });
  33779. for (i = 0; i < numGlyphs; i++) {
  33780. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  33781. }
  33782. locaEntries.sort((a, b) => {
  33783. return a.index - b.index;
  33784. });
  33785. for (i = 0; i < numGlyphs; i++) {
  33786. const {
  33787. offset,
  33788. endOffset
  33789. } = locaEntries[i];
  33790. if (offset !== 0 || endOffset !== 0) {
  33791. break;
  33792. }
  33793. const nextOffset = locaEntries[i + 1].offset;
  33794. if (nextOffset === 0) {
  33795. continue;
  33796. }
  33797. locaEntries[i].endOffset = nextOffset;
  33798. break;
  33799. }
  33800. const missingGlyphs = Object.create(null);
  33801. let writeOffset = 0;
  33802. itemEncode(locaData, 0, writeOffset);
  33803. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  33804. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  33805. const newLength = glyphProfile.length;
  33806. if (newLength === 0) {
  33807. missingGlyphs[i] = true;
  33808. }
  33809. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  33810. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  33811. }
  33812. writeOffset += newLength;
  33813. itemEncode(locaData, j, writeOffset);
  33814. }
  33815. if (writeOffset === 0) {
  33816. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  33817. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  33818. itemEncode(locaData, j, simpleGlyph.length);
  33819. }
  33820. glyf.data = simpleGlyph;
  33821. } else if (dupFirstEntry) {
  33822. const firstEntryLength = itemDecode(locaData, itemSize);
  33823. if (newGlyfData.length > firstEntryLength + writeOffset) {
  33824. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  33825. } else {
  33826. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  33827. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  33828. }
  33829. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  33830. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  33831. } else {
  33832. glyf.data = newGlyfData.subarray(0, writeOffset);
  33833. }
  33834. return {
  33835. missingGlyphs,
  33836. maxSizeOfInstructions
  33837. };
  33838. }
  33839. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  33840. const start = (font.start ? font.start : 0) + post.offset;
  33841. font.pos = start;
  33842. const length = post.length,
  33843. end = start + length;
  33844. const version = font.getInt32();
  33845. font.skip(28);
  33846. let glyphNames;
  33847. let valid = true;
  33848. let i;
  33849. switch (version) {
  33850. case 0x00010000:
  33851. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  33852. break;
  33853. case 0x00020000:
  33854. const numGlyphs = font.getUint16();
  33855. if (numGlyphs !== maxpNumGlyphs) {
  33856. valid = false;
  33857. break;
  33858. }
  33859. const glyphNameIndexes = [];
  33860. for (i = 0; i < numGlyphs; ++i) {
  33861. const index = font.getUint16();
  33862. if (index >= 32768) {
  33863. valid = false;
  33864. break;
  33865. }
  33866. glyphNameIndexes.push(index);
  33867. }
  33868. if (!valid) {
  33869. break;
  33870. }
  33871. const customNames = [],
  33872. strBuf = [];
  33873. while (font.pos < end) {
  33874. const stringLength = font.getByte();
  33875. strBuf.length = stringLength;
  33876. for (i = 0; i < stringLength; ++i) {
  33877. strBuf[i] = String.fromCharCode(font.getByte());
  33878. }
  33879. customNames.push(strBuf.join(""));
  33880. }
  33881. glyphNames = [];
  33882. for (i = 0; i < numGlyphs; ++i) {
  33883. const j = glyphNameIndexes[i];
  33884. if (j < 258) {
  33885. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  33886. continue;
  33887. }
  33888. glyphNames.push(customNames[j - 258]);
  33889. }
  33890. break;
  33891. case 0x00030000:
  33892. break;
  33893. default:
  33894. (0, _util.warn)("Unknown/unsupported post table version " + version);
  33895. valid = false;
  33896. if (propertiesObj.defaultEncoding) {
  33897. glyphNames = propertiesObj.defaultEncoding;
  33898. }
  33899. break;
  33900. }
  33901. propertiesObj.glyphNames = glyphNames;
  33902. return valid;
  33903. }
  33904. function readNameTable(nameTable) {
  33905. const start = (font.start ? font.start : 0) + nameTable.offset;
  33906. font.pos = start;
  33907. const names = [[], []];
  33908. const length = nameTable.length,
  33909. end = start + length;
  33910. const format = font.getUint16();
  33911. const FORMAT_0_HEADER_LENGTH = 6;
  33912. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  33913. return names;
  33914. }
  33915. const numRecords = font.getUint16();
  33916. const stringsStart = font.getUint16();
  33917. const records = [];
  33918. const NAME_RECORD_LENGTH = 12;
  33919. let i, ii;
  33920. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  33921. const r = {
  33922. platform: font.getUint16(),
  33923. encoding: font.getUint16(),
  33924. language: font.getUint16(),
  33925. name: font.getUint16(),
  33926. length: font.getUint16(),
  33927. offset: font.getUint16()
  33928. };
  33929. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  33930. records.push(r);
  33931. }
  33932. }
  33933. for (i = 0, ii = records.length; i < ii; i++) {
  33934. const record = records[i];
  33935. if (record.length <= 0) {
  33936. continue;
  33937. }
  33938. const pos = start + stringsStart + record.offset;
  33939. if (pos + record.length > end) {
  33940. continue;
  33941. }
  33942. font.pos = pos;
  33943. const nameIndex = record.name;
  33944. if (record.encoding) {
  33945. let str = "";
  33946. for (let j = 0, jj = record.length; j < jj; j += 2) {
  33947. str += String.fromCharCode(font.getUint16());
  33948. }
  33949. names[1][nameIndex] = str;
  33950. } else {
  33951. names[0][nameIndex] = font.getString(record.length);
  33952. }
  33953. }
  33954. return names;
  33955. }
  33956. 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];
  33957. function sanitizeTTProgram(table, ttContext) {
  33958. let data = table.data;
  33959. let i = 0,
  33960. j,
  33961. n,
  33962. b,
  33963. funcId,
  33964. pc,
  33965. lastEndf = 0,
  33966. lastDeff = 0;
  33967. const stack = [];
  33968. const callstack = [];
  33969. const functionsCalled = [];
  33970. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  33971. let inFDEF = false,
  33972. ifLevel = 0,
  33973. inELSE = 0;
  33974. for (let ii = data.length; i < ii;) {
  33975. const op = data[i++];
  33976. if (op === 0x40) {
  33977. n = data[i++];
  33978. if (inFDEF || inELSE) {
  33979. i += n;
  33980. } else {
  33981. for (j = 0; j < n; j++) {
  33982. stack.push(data[i++]);
  33983. }
  33984. }
  33985. } else if (op === 0x41) {
  33986. n = data[i++];
  33987. if (inFDEF || inELSE) {
  33988. i += n * 2;
  33989. } else {
  33990. for (j = 0; j < n; j++) {
  33991. b = data[i++];
  33992. stack.push(b << 8 | data[i++]);
  33993. }
  33994. }
  33995. } else if ((op & 0xf8) === 0xb0) {
  33996. n = op - 0xb0 + 1;
  33997. if (inFDEF || inELSE) {
  33998. i += n;
  33999. } else {
  34000. for (j = 0; j < n; j++) {
  34001. stack.push(data[i++]);
  34002. }
  34003. }
  34004. } else if ((op & 0xf8) === 0xb8) {
  34005. n = op - 0xb8 + 1;
  34006. if (inFDEF || inELSE) {
  34007. i += n * 2;
  34008. } else {
  34009. for (j = 0; j < n; j++) {
  34010. b = data[i++];
  34011. stack.push(b << 8 | data[i++]);
  34012. }
  34013. }
  34014. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  34015. if (!inFDEF && !inELSE) {
  34016. funcId = stack[stack.length - 1];
  34017. if (isNaN(funcId)) {
  34018. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  34019. } else {
  34020. ttContext.functionsUsed[funcId] = true;
  34021. if (funcId in ttContext.functionsStackDeltas) {
  34022. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  34023. if (newStackLength < 0) {
  34024. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  34025. ttContext.hintsValid = false;
  34026. return;
  34027. }
  34028. stack.length = newStackLength;
  34029. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  34030. callstack.push({
  34031. data,
  34032. i,
  34033. stackTop: stack.length - 1
  34034. });
  34035. functionsCalled.push(funcId);
  34036. pc = ttContext.functionsDefined[funcId];
  34037. if (!pc) {
  34038. (0, _util.warn)("TT: CALL non-existent function");
  34039. ttContext.hintsValid = false;
  34040. return;
  34041. }
  34042. data = pc.data;
  34043. i = pc.i;
  34044. }
  34045. }
  34046. }
  34047. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  34048. if (inFDEF || inELSE) {
  34049. (0, _util.warn)("TT: nested FDEFs not allowed");
  34050. tooComplexToFollowFunctions = true;
  34051. }
  34052. inFDEF = true;
  34053. lastDeff = i;
  34054. funcId = stack.pop();
  34055. ttContext.functionsDefined[funcId] = {
  34056. data,
  34057. i
  34058. };
  34059. } else if (op === 0x2d) {
  34060. if (inFDEF) {
  34061. inFDEF = false;
  34062. lastEndf = i;
  34063. } else {
  34064. pc = callstack.pop();
  34065. if (!pc) {
  34066. (0, _util.warn)("TT: ENDF bad stack");
  34067. ttContext.hintsValid = false;
  34068. return;
  34069. }
  34070. funcId = functionsCalled.pop();
  34071. data = pc.data;
  34072. i = pc.i;
  34073. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  34074. }
  34075. } else if (op === 0x89) {
  34076. if (inFDEF || inELSE) {
  34077. (0, _util.warn)("TT: nested IDEFs not allowed");
  34078. tooComplexToFollowFunctions = true;
  34079. }
  34080. inFDEF = true;
  34081. lastDeff = i;
  34082. } else if (op === 0x58) {
  34083. ++ifLevel;
  34084. } else if (op === 0x1b) {
  34085. inELSE = ifLevel;
  34086. } else if (op === 0x59) {
  34087. if (inELSE === ifLevel) {
  34088. inELSE = 0;
  34089. }
  34090. --ifLevel;
  34091. } else if (op === 0x1c) {
  34092. if (!inFDEF && !inELSE) {
  34093. const offset = stack[stack.length - 1];
  34094. if (offset > 0) {
  34095. i += offset - 1;
  34096. }
  34097. }
  34098. }
  34099. if (!inFDEF && !inELSE) {
  34100. let stackDelta = 0;
  34101. if (op <= 0x8e) {
  34102. stackDelta = TTOpsStackDeltas[op];
  34103. } else if (op >= 0xc0 && op <= 0xdf) {
  34104. stackDelta = -1;
  34105. } else if (op >= 0xe0) {
  34106. stackDelta = -2;
  34107. }
  34108. if (op >= 0x71 && op <= 0x75) {
  34109. n = stack.pop();
  34110. if (!isNaN(n)) {
  34111. stackDelta = -n * 2;
  34112. }
  34113. }
  34114. while (stackDelta < 0 && stack.length > 0) {
  34115. stack.pop();
  34116. stackDelta++;
  34117. }
  34118. while (stackDelta > 0) {
  34119. stack.push(NaN);
  34120. stackDelta--;
  34121. }
  34122. }
  34123. }
  34124. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  34125. const content = [data];
  34126. if (i > data.length) {
  34127. content.push(new Uint8Array(i - data.length));
  34128. }
  34129. if (lastDeff > lastEndf) {
  34130. (0, _util.warn)("TT: complementing a missing function tail");
  34131. content.push(new Uint8Array([0x22, 0x2d]));
  34132. }
  34133. foldTTTable(table, content);
  34134. }
  34135. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  34136. if (ttContext.tooComplexToFollowFunctions) {
  34137. return;
  34138. }
  34139. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  34140. (0, _util.warn)("TT: more functions defined than expected");
  34141. ttContext.hintsValid = false;
  34142. return;
  34143. }
  34144. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  34145. if (j > maxFunctionDefs) {
  34146. (0, _util.warn)("TT: invalid function id: " + j);
  34147. ttContext.hintsValid = false;
  34148. return;
  34149. }
  34150. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  34151. (0, _util.warn)("TT: undefined function: " + j);
  34152. ttContext.hintsValid = false;
  34153. return;
  34154. }
  34155. }
  34156. }
  34157. function foldTTTable(table, content) {
  34158. if (content.length > 1) {
  34159. let newLength = 0;
  34160. let j, jj;
  34161. for (j = 0, jj = content.length; j < jj; j++) {
  34162. newLength += content[j].length;
  34163. }
  34164. newLength = newLength + 3 & ~3;
  34165. const result = new Uint8Array(newLength);
  34166. let pos = 0;
  34167. for (j = 0, jj = content.length; j < jj; j++) {
  34168. result.set(content[j], pos);
  34169. pos += content[j].length;
  34170. }
  34171. table.data = result;
  34172. table.length = newLength;
  34173. }
  34174. }
  34175. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  34176. const ttContext = {
  34177. functionsDefined: [],
  34178. functionsUsed: [],
  34179. functionsStackDeltas: [],
  34180. tooComplexToFollowFunctions: false,
  34181. hintsValid: true
  34182. };
  34183. if (fpgm) {
  34184. sanitizeTTProgram(fpgm, ttContext);
  34185. }
  34186. if (prep) {
  34187. sanitizeTTProgram(prep, ttContext);
  34188. }
  34189. if (fpgm) {
  34190. checkInvalidFunctions(ttContext, maxFunctionDefs);
  34191. }
  34192. if (cvt && cvt.length & 1) {
  34193. const cvtData = new Uint8Array(cvt.length + 1);
  34194. cvtData.set(cvt.data);
  34195. cvt.data = cvtData;
  34196. }
  34197. return ttContext.hintsValid;
  34198. }
  34199. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  34200. let header, tables;
  34201. if (isTrueTypeCollectionFile(font)) {
  34202. const ttcData = readTrueTypeCollectionData(font, this.name);
  34203. header = ttcData.header;
  34204. tables = ttcData.tables;
  34205. } else {
  34206. header = readOpenTypeHeader(font);
  34207. tables = readTables(font, header.numTables);
  34208. }
  34209. let cff, cffFile;
  34210. const isTrueType = !tables["CFF "];
  34211. if (!isTrueType) {
  34212. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  34213. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  34214. cffFile = new _stream.Stream(tables["CFF "].data);
  34215. cff = new _cff_font.CFFFont(cffFile, properties);
  34216. adjustWidths(properties);
  34217. return this.convert(name, cff, properties);
  34218. }
  34219. delete tables.glyf;
  34220. delete tables.loca;
  34221. delete tables.fpgm;
  34222. delete tables.prep;
  34223. delete tables["cvt "];
  34224. this.isOpenType = true;
  34225. } else {
  34226. if (!tables.loca) {
  34227. throw new _util.FormatError('Required "loca" table is not found');
  34228. }
  34229. if (!tables.glyf) {
  34230. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  34231. tables.glyf = {
  34232. tag: "glyf",
  34233. data: new Uint8Array(0)
  34234. };
  34235. }
  34236. this.isOpenType = false;
  34237. }
  34238. if (!tables.maxp) {
  34239. throw new _util.FormatError('Required "maxp" table is not found');
  34240. }
  34241. font.pos = (font.start || 0) + tables.maxp.offset;
  34242. const version = font.getInt32();
  34243. const numGlyphs = font.getUint16();
  34244. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  34245. const {
  34246. scaleFactors
  34247. } = properties;
  34248. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34249. const glyphs = new _glyf.GlyfTable({
  34250. glyfTable: tables.glyf.data,
  34251. isGlyphLocationsLong,
  34252. locaTable: tables.loca.data,
  34253. numGlyphs
  34254. });
  34255. glyphs.scale(scaleFactors);
  34256. const {
  34257. glyf,
  34258. loca,
  34259. isLocationLong
  34260. } = glyphs.write();
  34261. tables.glyf.data = glyf;
  34262. tables.loca.data = loca;
  34263. if (isLocationLong !== !!isGlyphLocationsLong) {
  34264. tables.head.data[50] = 0;
  34265. tables.head.data[51] = isLocationLong ? 1 : 0;
  34266. }
  34267. const metrics = tables.hmtx.data;
  34268. for (let i = 0; i < numGlyphs; i++) {
  34269. const j = 4 * i;
  34270. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  34271. metrics[j] = advanceWidth >> 8 & 0xff;
  34272. metrics[j + 1] = advanceWidth & 0xff;
  34273. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  34274. writeSignedInt16(metrics, j + 2, lsb);
  34275. }
  34276. }
  34277. let numGlyphsOut = numGlyphs + 1;
  34278. let dupFirstEntry = true;
  34279. if (numGlyphsOut > 0xffff) {
  34280. dupFirstEntry = false;
  34281. numGlyphsOut = numGlyphs;
  34282. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  34283. }
  34284. let maxFunctionDefs = 0;
  34285. let maxSizeOfInstructions = 0;
  34286. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34287. font.pos += 8;
  34288. const maxZones = font.getUint16();
  34289. if (maxZones > 2) {
  34290. tables.maxp.data[14] = 0;
  34291. tables.maxp.data[15] = 2;
  34292. }
  34293. font.pos += 4;
  34294. maxFunctionDefs = font.getUint16();
  34295. font.pos += 4;
  34296. maxSizeOfInstructions = font.getUint16();
  34297. }
  34298. tables.maxp.data[4] = numGlyphsOut >> 8;
  34299. tables.maxp.data[5] = numGlyphsOut & 255;
  34300. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  34301. if (!hintsValid) {
  34302. delete tables.fpgm;
  34303. delete tables.prep;
  34304. delete tables["cvt "];
  34305. }
  34306. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  34307. if (!tables.head) {
  34308. throw new _util.FormatError('Required "head" table is not found');
  34309. }
  34310. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  34311. let missingGlyphs = Object.create(null);
  34312. if (isTrueType) {
  34313. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34314. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  34315. missingGlyphs = glyphsInfo.missingGlyphs;
  34316. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34317. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  34318. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  34319. }
  34320. }
  34321. if (!tables.hhea) {
  34322. throw new _util.FormatError('Required "hhea" table is not found');
  34323. }
  34324. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  34325. tables.hhea.data[10] = 0xff;
  34326. tables.hhea.data[11] = 0xff;
  34327. }
  34328. const metricsOverride = {
  34329. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  34330. yMax: int16(tables.head.data[42], tables.head.data[43]),
  34331. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  34332. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  34333. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  34334. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  34335. };
  34336. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  34337. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  34338. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  34339. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  34340. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  34341. this.lineGap = this.cssFontInfo.metrics.lineGap;
  34342. } else {
  34343. this.lineHeight = this.ascent - this.descent + this.lineGap;
  34344. }
  34345. if (tables.post) {
  34346. readPostScriptTable(tables.post, properties, numGlyphs);
  34347. }
  34348. tables.post = {
  34349. tag: "post",
  34350. data: createPostTable(properties)
  34351. };
  34352. const charCodeToGlyphId = [];
  34353. function hasGlyph(glyphId) {
  34354. return !missingGlyphs[glyphId];
  34355. }
  34356. if (properties.composite) {
  34357. const cidToGidMap = properties.cidToGidMap || [];
  34358. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  34359. properties.cMap.forEach(function (charCode, cid) {
  34360. if (typeof cid === "string") {
  34361. cid = convertCidString(charCode, cid, true);
  34362. }
  34363. if (cid > 0xffff) {
  34364. throw new _util.FormatError("Max size of CID is 65,535");
  34365. }
  34366. let glyphId = -1;
  34367. if (isCidToGidMapEmpty) {
  34368. glyphId = cid;
  34369. } else if (cidToGidMap[cid] !== undefined) {
  34370. glyphId = cidToGidMap[cid];
  34371. }
  34372. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  34373. charCodeToGlyphId[charCode] = glyphId;
  34374. }
  34375. });
  34376. } else {
  34377. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  34378. const cmapPlatformId = cmapTable.platformId;
  34379. const cmapEncodingId = cmapTable.encodingId;
  34380. const cmapMappings = cmapTable.mappings;
  34381. const cmapMappingsLength = cmapMappings.length;
  34382. let baseEncoding = [],
  34383. forcePostTable = false;
  34384. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  34385. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  34386. }
  34387. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  34388. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34389. for (let charCode = 0; charCode < 256; charCode++) {
  34390. let glyphName;
  34391. if (this.differences[charCode] !== undefined) {
  34392. glyphName = this.differences[charCode];
  34393. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  34394. glyphName = baseEncoding[charCode];
  34395. } else {
  34396. glyphName = _encodings.StandardEncoding[charCode];
  34397. }
  34398. if (!glyphName) {
  34399. continue;
  34400. }
  34401. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  34402. let unicodeOrCharCode;
  34403. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  34404. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  34405. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  34406. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  34407. }
  34408. if (unicodeOrCharCode === undefined) {
  34409. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  34410. const unicode = this.toUnicode.get(charCode);
  34411. if (unicode) {
  34412. unicodeOrCharCode = unicode.codePointAt(0);
  34413. }
  34414. }
  34415. if (unicodeOrCharCode === undefined) {
  34416. continue;
  34417. }
  34418. }
  34419. for (let i = 0; i < cmapMappingsLength; ++i) {
  34420. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  34421. continue;
  34422. }
  34423. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34424. break;
  34425. }
  34426. }
  34427. } else if (cmapPlatformId === 0) {
  34428. for (let i = 0; i < cmapMappingsLength; ++i) {
  34429. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  34430. }
  34431. forcePostTable = true;
  34432. } else {
  34433. for (let i = 0; i < cmapMappingsLength; ++i) {
  34434. let charCode = cmapMappings[i].charCode;
  34435. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  34436. charCode &= 0xff;
  34437. }
  34438. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34439. }
  34440. }
  34441. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  34442. for (let i = 0; i < 256; ++i) {
  34443. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  34444. continue;
  34445. }
  34446. const glyphName = this.differences[i] || baseEncoding[i];
  34447. if (!glyphName) {
  34448. continue;
  34449. }
  34450. const glyphId = properties.glyphNames.indexOf(glyphName);
  34451. if (glyphId > 0 && hasGlyph(glyphId)) {
  34452. charCodeToGlyphId[i] = glyphId;
  34453. }
  34454. }
  34455. }
  34456. }
  34457. if (charCodeToGlyphId.length === 0) {
  34458. charCodeToGlyphId[0] = 0;
  34459. }
  34460. let glyphZeroId = numGlyphsOut - 1;
  34461. if (!dupFirstEntry) {
  34462. glyphZeroId = 0;
  34463. }
  34464. if (!properties.cssFontInfo) {
  34465. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  34466. this.toFontChar = newMapping.toFontChar;
  34467. tables.cmap = {
  34468. tag: "cmap",
  34469. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  34470. };
  34471. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  34472. tables["OS/2"] = {
  34473. tag: "OS/2",
  34474. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  34475. };
  34476. }
  34477. }
  34478. if (!isTrueType) {
  34479. try {
  34480. cffFile = new _stream.Stream(tables["CFF "].data);
  34481. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  34482. cff = parser.parse();
  34483. cff.duplicateFirstGlyph();
  34484. const compiler = new _cff_parser.CFFCompiler(cff);
  34485. tables["CFF "].data = compiler.compile();
  34486. } catch (e) {
  34487. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  34488. }
  34489. }
  34490. if (!tables.name) {
  34491. tables.name = {
  34492. tag: "name",
  34493. data: createNameTable(this.name)
  34494. };
  34495. } else {
  34496. const namePrototype = readNameTable(tables.name);
  34497. tables.name.data = createNameTable(name, namePrototype);
  34498. this.psName = namePrototype[0][6] || null;
  34499. }
  34500. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  34501. for (const tableTag in tables) {
  34502. builder.addTable(tableTag, tables[tableTag].data);
  34503. }
  34504. return builder.toArray();
  34505. }
  34506. convert(fontName, font, properties) {
  34507. properties.fixedPitch = false;
  34508. if (properties.builtInEncoding) {
  34509. adjustToUnicode(properties, properties.builtInEncoding);
  34510. }
  34511. let glyphZeroId = 1;
  34512. if (font instanceof _cff_font.CFFFont) {
  34513. glyphZeroId = font.numGlyphs - 1;
  34514. }
  34515. const mapping = font.getGlyphMapping(properties);
  34516. let newMapping = null;
  34517. let newCharCodeToGlyphId = mapping;
  34518. if (!properties.cssFontInfo) {
  34519. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  34520. this.toFontChar = newMapping.toFontChar;
  34521. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  34522. }
  34523. const numGlyphs = font.numGlyphs;
  34524. function getCharCodes(charCodeToGlyphId, glyphId) {
  34525. let charCodes = null;
  34526. for (const charCode in charCodeToGlyphId) {
  34527. if (glyphId === charCodeToGlyphId[charCode]) {
  34528. if (!charCodes) {
  34529. charCodes = [];
  34530. }
  34531. charCodes.push(charCode | 0);
  34532. }
  34533. }
  34534. return charCodes;
  34535. }
  34536. function createCharCode(charCodeToGlyphId, glyphId) {
  34537. for (const charCode in charCodeToGlyphId) {
  34538. if (glyphId === charCodeToGlyphId[charCode]) {
  34539. return charCode | 0;
  34540. }
  34541. }
  34542. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  34543. return newMapping.nextAvailableFontCharCode++;
  34544. }
  34545. const seacs = font.seacs;
  34546. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  34547. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  34548. const charset = font.getCharset();
  34549. const seacMap = Object.create(null);
  34550. for (let glyphId in seacs) {
  34551. glyphId |= 0;
  34552. const seac = seacs[glyphId];
  34553. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  34554. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  34555. const baseGlyphId = charset.indexOf(baseGlyphName);
  34556. const accentGlyphId = charset.indexOf(accentGlyphName);
  34557. if (baseGlyphId < 0 || accentGlyphId < 0) {
  34558. continue;
  34559. }
  34560. const accentOffset = {
  34561. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  34562. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  34563. };
  34564. const charCodes = getCharCodes(mapping, glyphId);
  34565. if (!charCodes) {
  34566. continue;
  34567. }
  34568. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  34569. const charCode = charCodes[i];
  34570. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  34571. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  34572. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  34573. seacMap[charCode] = {
  34574. baseFontCharCode,
  34575. accentFontCharCode,
  34576. accentOffset
  34577. };
  34578. }
  34579. }
  34580. properties.seacMap = seacMap;
  34581. }
  34582. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  34583. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  34584. builder.addTable("CFF ", font.data);
  34585. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  34586. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  34587. 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");
  34588. 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));
  34589. builder.addTable("hmtx", function fontFieldsHmtx() {
  34590. const charstrings = font.charstrings;
  34591. const cffWidths = font.cff ? font.cff.widths : null;
  34592. let hmtx = "\x00\x00\x00\x00";
  34593. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  34594. let width = 0;
  34595. if (charstrings) {
  34596. const charstring = charstrings[i - 1];
  34597. width = "width" in charstring ? charstring.width : 0;
  34598. } else if (cffWidths) {
  34599. width = Math.ceil(cffWidths[i] || 0);
  34600. }
  34601. hmtx += string16(width) + string16(0);
  34602. }
  34603. return hmtx;
  34604. }());
  34605. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  34606. builder.addTable("name", createNameTable(fontName));
  34607. builder.addTable("post", createPostTable(properties));
  34608. return builder.toArray();
  34609. }
  34610. get spaceWidth() {
  34611. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  34612. let width;
  34613. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  34614. const glyphName = possibleSpaceReplacements[i];
  34615. if (glyphName in this.widths) {
  34616. width = this.widths[glyphName];
  34617. break;
  34618. }
  34619. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34620. const glyphUnicode = glyphsUnicodeMap[glyphName];
  34621. let charcode = 0;
  34622. if (this.composite && this.cMap.contains(glyphUnicode)) {
  34623. charcode = this.cMap.lookup(glyphUnicode);
  34624. if (typeof charcode === "string") {
  34625. charcode = convertCidString(glyphUnicode, charcode);
  34626. }
  34627. }
  34628. if (!charcode && this.toUnicode) {
  34629. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  34630. }
  34631. if (charcode <= 0) {
  34632. charcode = glyphUnicode;
  34633. }
  34634. width = this.widths[charcode];
  34635. if (width) {
  34636. break;
  34637. }
  34638. }
  34639. width = width || this.defaultWidth;
  34640. return (0, _util.shadow)(this, "spaceWidth", width);
  34641. }
  34642. _charToGlyph(charcode, isSpace = false) {
  34643. let fontCharCode, width, operatorListId;
  34644. let widthCode = charcode;
  34645. if (this.cMap && this.cMap.contains(charcode)) {
  34646. widthCode = this.cMap.lookup(charcode);
  34647. if (typeof widthCode === "string") {
  34648. widthCode = convertCidString(charcode, widthCode);
  34649. }
  34650. }
  34651. width = this.widths[widthCode];
  34652. if (typeof width !== "number") {
  34653. width = this.defaultWidth;
  34654. }
  34655. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  34656. let unicode = this.toUnicode.get(charcode) || charcode;
  34657. if (typeof unicode === "number") {
  34658. unicode = String.fromCharCode(unicode);
  34659. }
  34660. let isInFont = this.toFontChar[charcode] !== undefined;
  34661. fontCharCode = this.toFontChar[charcode] || charcode;
  34662. if (this.missingFile) {
  34663. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  34664. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  34665. fontCharCode = 0x20;
  34666. }
  34667. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  34668. }
  34669. if (this.isType3Font) {
  34670. operatorListId = fontCharCode;
  34671. }
  34672. let accent = null;
  34673. if (this.seacMap && this.seacMap[charcode]) {
  34674. isInFont = true;
  34675. const seac = this.seacMap[charcode];
  34676. fontCharCode = seac.baseFontCharCode;
  34677. accent = {
  34678. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  34679. offset: seac.accentOffset
  34680. };
  34681. }
  34682. let fontChar = "";
  34683. if (typeof fontCharCode === "number") {
  34684. if (fontCharCode <= 0x10ffff) {
  34685. fontChar = String.fromCodePoint(fontCharCode);
  34686. } else {
  34687. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  34688. }
  34689. }
  34690. let glyph = this._glyphCache[charcode];
  34691. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  34692. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  34693. this._glyphCache[charcode] = glyph;
  34694. }
  34695. return glyph;
  34696. }
  34697. charsToGlyphs(chars) {
  34698. let glyphs = this._charsCache[chars];
  34699. if (glyphs) {
  34700. return glyphs;
  34701. }
  34702. glyphs = [];
  34703. if (this.cMap) {
  34704. const c = Object.create(null),
  34705. ii = chars.length;
  34706. let i = 0;
  34707. while (i < ii) {
  34708. this.cMap.readCharCode(chars, i, c);
  34709. const {
  34710. charcode,
  34711. length
  34712. } = c;
  34713. i += length;
  34714. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  34715. glyphs.push(glyph);
  34716. }
  34717. } else {
  34718. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34719. const charcode = chars.charCodeAt(i);
  34720. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  34721. glyphs.push(glyph);
  34722. }
  34723. }
  34724. return this._charsCache[chars] = glyphs;
  34725. }
  34726. getCharPositions(chars) {
  34727. const positions = [];
  34728. if (this.cMap) {
  34729. const c = Object.create(null);
  34730. let i = 0;
  34731. while (i < chars.length) {
  34732. this.cMap.readCharCode(chars, i, c);
  34733. const length = c.length;
  34734. positions.push([i, i + length]);
  34735. i += length;
  34736. }
  34737. } else {
  34738. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34739. positions.push([i, i + 1]);
  34740. }
  34741. }
  34742. return positions;
  34743. }
  34744. get glyphCacheValues() {
  34745. return Object.values(this._glyphCache);
  34746. }
  34747. encodeString(str) {
  34748. const buffers = [];
  34749. const currentBuf = [];
  34750. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  34751. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  34752. for (let i = 0, ii = str.length; i < ii; i++) {
  34753. const unicode = str.codePointAt(i);
  34754. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  34755. i++;
  34756. }
  34757. if (this.toUnicode) {
  34758. const charCode = getCharCode(unicode);
  34759. if (charCode !== -1) {
  34760. if (hasCurrentBufErrors()) {
  34761. buffers.push(currentBuf.join(""));
  34762. currentBuf.length = 0;
  34763. }
  34764. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  34765. for (let j = charCodeLength - 1; j >= 0; j--) {
  34766. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  34767. }
  34768. continue;
  34769. }
  34770. }
  34771. if (!hasCurrentBufErrors()) {
  34772. buffers.push(currentBuf.join(""));
  34773. currentBuf.length = 0;
  34774. }
  34775. currentBuf.push(String.fromCodePoint(unicode));
  34776. }
  34777. buffers.push(currentBuf.join(""));
  34778. return buffers;
  34779. }
  34780. }
  34781. exports.Font = Font;
  34782. class ErrorFont {
  34783. constructor(error) {
  34784. this.error = error;
  34785. this.loadedName = "g_font_error";
  34786. this.missingFile = true;
  34787. }
  34788. charsToGlyphs() {
  34789. return [];
  34790. }
  34791. encodeString(chars) {
  34792. return [chars];
  34793. }
  34794. exportData(extraProperties = false) {
  34795. return {
  34796. error: this.error
  34797. };
  34798. }
  34799. }
  34800. exports.ErrorFont = ErrorFont;
  34801. /***/ }),
  34802. /* 45 */
  34803. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34804. Object.defineProperty(exports, "__esModule", ({
  34805. value: true
  34806. }));
  34807. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  34808. var _util = __w_pdfjs_require__(2);
  34809. var _charsets = __w_pdfjs_require__(46);
  34810. var _encodings = __w_pdfjs_require__(19);
  34811. const MAX_SUBR_NESTING = 10;
  34812. 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"];
  34813. exports.CFFStandardStrings = CFFStandardStrings;
  34814. const NUM_STANDARD_CFF_STRINGS = 391;
  34815. const CFFParser = function CFFParserClosure() {
  34816. const CharstringValidationData = [null, {
  34817. id: "hstem",
  34818. min: 2,
  34819. stackClearing: true,
  34820. stem: true
  34821. }, null, {
  34822. id: "vstem",
  34823. min: 2,
  34824. stackClearing: true,
  34825. stem: true
  34826. }, {
  34827. id: "vmoveto",
  34828. min: 1,
  34829. stackClearing: true
  34830. }, {
  34831. id: "rlineto",
  34832. min: 2,
  34833. resetStack: true
  34834. }, {
  34835. id: "hlineto",
  34836. min: 1,
  34837. resetStack: true
  34838. }, {
  34839. id: "vlineto",
  34840. min: 1,
  34841. resetStack: true
  34842. }, {
  34843. id: "rrcurveto",
  34844. min: 6,
  34845. resetStack: true
  34846. }, null, {
  34847. id: "callsubr",
  34848. min: 1,
  34849. undefStack: true
  34850. }, {
  34851. id: "return",
  34852. min: 0,
  34853. undefStack: true
  34854. }, null, null, {
  34855. id: "endchar",
  34856. min: 0,
  34857. stackClearing: true
  34858. }, null, null, null, {
  34859. id: "hstemhm",
  34860. min: 2,
  34861. stackClearing: true,
  34862. stem: true
  34863. }, {
  34864. id: "hintmask",
  34865. min: 0,
  34866. stackClearing: true
  34867. }, {
  34868. id: "cntrmask",
  34869. min: 0,
  34870. stackClearing: true
  34871. }, {
  34872. id: "rmoveto",
  34873. min: 2,
  34874. stackClearing: true
  34875. }, {
  34876. id: "hmoveto",
  34877. min: 1,
  34878. stackClearing: true
  34879. }, {
  34880. id: "vstemhm",
  34881. min: 2,
  34882. stackClearing: true,
  34883. stem: true
  34884. }, {
  34885. id: "rcurveline",
  34886. min: 8,
  34887. resetStack: true
  34888. }, {
  34889. id: "rlinecurve",
  34890. min: 8,
  34891. resetStack: true
  34892. }, {
  34893. id: "vvcurveto",
  34894. min: 4,
  34895. resetStack: true
  34896. }, {
  34897. id: "hhcurveto",
  34898. min: 4,
  34899. resetStack: true
  34900. }, null, {
  34901. id: "callgsubr",
  34902. min: 1,
  34903. undefStack: true
  34904. }, {
  34905. id: "vhcurveto",
  34906. min: 4,
  34907. resetStack: true
  34908. }, {
  34909. id: "hvcurveto",
  34910. min: 4,
  34911. resetStack: true
  34912. }];
  34913. const CharstringValidationData12 = [null, null, null, {
  34914. id: "and",
  34915. min: 2,
  34916. stackDelta: -1
  34917. }, {
  34918. id: "or",
  34919. min: 2,
  34920. stackDelta: -1
  34921. }, {
  34922. id: "not",
  34923. min: 1,
  34924. stackDelta: 0
  34925. }, null, null, null, {
  34926. id: "abs",
  34927. min: 1,
  34928. stackDelta: 0
  34929. }, {
  34930. id: "add",
  34931. min: 2,
  34932. stackDelta: -1,
  34933. stackFn: function stack_div(stack, index) {
  34934. stack[index - 2] = stack[index - 2] + stack[index - 1];
  34935. }
  34936. }, {
  34937. id: "sub",
  34938. min: 2,
  34939. stackDelta: -1,
  34940. stackFn: function stack_div(stack, index) {
  34941. stack[index - 2] = stack[index - 2] - stack[index - 1];
  34942. }
  34943. }, {
  34944. id: "div",
  34945. min: 2,
  34946. stackDelta: -1,
  34947. stackFn: function stack_div(stack, index) {
  34948. stack[index - 2] = stack[index - 2] / stack[index - 1];
  34949. }
  34950. }, null, {
  34951. id: "neg",
  34952. min: 1,
  34953. stackDelta: 0,
  34954. stackFn: function stack_div(stack, index) {
  34955. stack[index - 1] = -stack[index - 1];
  34956. }
  34957. }, {
  34958. id: "eq",
  34959. min: 2,
  34960. stackDelta: -1
  34961. }, null, null, {
  34962. id: "drop",
  34963. min: 1,
  34964. stackDelta: -1
  34965. }, null, {
  34966. id: "put",
  34967. min: 2,
  34968. stackDelta: -2
  34969. }, {
  34970. id: "get",
  34971. min: 1,
  34972. stackDelta: 0
  34973. }, {
  34974. id: "ifelse",
  34975. min: 4,
  34976. stackDelta: -3
  34977. }, {
  34978. id: "random",
  34979. min: 0,
  34980. stackDelta: 1
  34981. }, {
  34982. id: "mul",
  34983. min: 2,
  34984. stackDelta: -1,
  34985. stackFn: function stack_div(stack, index) {
  34986. stack[index - 2] = stack[index - 2] * stack[index - 1];
  34987. }
  34988. }, null, {
  34989. id: "sqrt",
  34990. min: 1,
  34991. stackDelta: 0
  34992. }, {
  34993. id: "dup",
  34994. min: 1,
  34995. stackDelta: 1
  34996. }, {
  34997. id: "exch",
  34998. min: 2,
  34999. stackDelta: 0
  35000. }, {
  35001. id: "index",
  35002. min: 2,
  35003. stackDelta: 0
  35004. }, {
  35005. id: "roll",
  35006. min: 3,
  35007. stackDelta: -2
  35008. }, null, null, null, {
  35009. id: "hflex",
  35010. min: 7,
  35011. resetStack: true
  35012. }, {
  35013. id: "flex",
  35014. min: 13,
  35015. resetStack: true
  35016. }, {
  35017. id: "hflex1",
  35018. min: 9,
  35019. resetStack: true
  35020. }, {
  35021. id: "flex1",
  35022. min: 11,
  35023. resetStack: true
  35024. }];
  35025. class CFFParser {
  35026. constructor(file, properties, seacAnalysisEnabled) {
  35027. this.bytes = file.getBytes();
  35028. this.properties = properties;
  35029. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  35030. }
  35031. parse() {
  35032. const properties = this.properties;
  35033. const cff = new CFF();
  35034. this.cff = cff;
  35035. const header = this.parseHeader();
  35036. const nameIndex = this.parseIndex(header.endPos);
  35037. const topDictIndex = this.parseIndex(nameIndex.endPos);
  35038. const stringIndex = this.parseIndex(topDictIndex.endPos);
  35039. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  35040. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  35041. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  35042. cff.header = header.obj;
  35043. cff.names = this.parseNameIndex(nameIndex.obj);
  35044. cff.strings = this.parseStringIndex(stringIndex.obj);
  35045. cff.topDict = topDict;
  35046. cff.globalSubrIndex = globalSubrIndex.obj;
  35047. this.parsePrivateDict(cff.topDict);
  35048. cff.isCIDFont = topDict.hasName("ROS");
  35049. const charStringOffset = topDict.getByName("CharStrings");
  35050. const charStringIndex = this.parseIndex(charStringOffset).obj;
  35051. const fontMatrix = topDict.getByName("FontMatrix");
  35052. if (fontMatrix) {
  35053. properties.fontMatrix = fontMatrix;
  35054. }
  35055. const fontBBox = topDict.getByName("FontBBox");
  35056. if (fontBBox) {
  35057. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  35058. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  35059. properties.ascentScaled = true;
  35060. }
  35061. let charset, encoding;
  35062. if (cff.isCIDFont) {
  35063. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  35064. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  35065. const dictRaw = fdArrayIndex.get(i);
  35066. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  35067. this.parsePrivateDict(fontDict);
  35068. cff.fdArray.push(fontDict);
  35069. }
  35070. encoding = null;
  35071. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  35072. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  35073. } else {
  35074. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  35075. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  35076. }
  35077. cff.charset = charset;
  35078. cff.encoding = encoding;
  35079. const charStringsAndSeacs = this.parseCharStrings({
  35080. charStrings: charStringIndex,
  35081. localSubrIndex: topDict.privateDict.subrsIndex,
  35082. globalSubrIndex: globalSubrIndex.obj,
  35083. fdSelect: cff.fdSelect,
  35084. fdArray: cff.fdArray,
  35085. privateDict: topDict.privateDict
  35086. });
  35087. cff.charStrings = charStringsAndSeacs.charStrings;
  35088. cff.seacs = charStringsAndSeacs.seacs;
  35089. cff.widths = charStringsAndSeacs.widths;
  35090. return cff;
  35091. }
  35092. parseHeader() {
  35093. let bytes = this.bytes;
  35094. const bytesLength = bytes.length;
  35095. let offset = 0;
  35096. while (offset < bytesLength && bytes[offset] !== 1) {
  35097. ++offset;
  35098. }
  35099. if (offset >= bytesLength) {
  35100. throw new _util.FormatError("Invalid CFF header");
  35101. }
  35102. if (offset !== 0) {
  35103. (0, _util.info)("cff data is shifted");
  35104. bytes = bytes.subarray(offset);
  35105. this.bytes = bytes;
  35106. }
  35107. const major = bytes[0];
  35108. const minor = bytes[1];
  35109. const hdrSize = bytes[2];
  35110. const offSize = bytes[3];
  35111. const header = new CFFHeader(major, minor, hdrSize, offSize);
  35112. return {
  35113. obj: header,
  35114. endPos: hdrSize
  35115. };
  35116. }
  35117. parseDict(dict) {
  35118. let pos = 0;
  35119. function parseOperand() {
  35120. let value = dict[pos++];
  35121. if (value === 30) {
  35122. return parseFloatOperand();
  35123. } else if (value === 28) {
  35124. value = dict[pos++];
  35125. value = (value << 24 | dict[pos++] << 16) >> 16;
  35126. return value;
  35127. } else if (value === 29) {
  35128. value = dict[pos++];
  35129. value = value << 8 | dict[pos++];
  35130. value = value << 8 | dict[pos++];
  35131. value = value << 8 | dict[pos++];
  35132. return value;
  35133. } else if (value >= 32 && value <= 246) {
  35134. return value - 139;
  35135. } else if (value >= 247 && value <= 250) {
  35136. return (value - 247) * 256 + dict[pos++] + 108;
  35137. } else if (value >= 251 && value <= 254) {
  35138. return -((value - 251) * 256) - dict[pos++] - 108;
  35139. }
  35140. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  35141. return NaN;
  35142. }
  35143. function parseFloatOperand() {
  35144. let str = "";
  35145. const eof = 15;
  35146. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  35147. const length = dict.length;
  35148. while (pos < length) {
  35149. const b = dict[pos++];
  35150. const b1 = b >> 4;
  35151. const b2 = b & 15;
  35152. if (b1 === eof) {
  35153. break;
  35154. }
  35155. str += lookup[b1];
  35156. if (b2 === eof) {
  35157. break;
  35158. }
  35159. str += lookup[b2];
  35160. }
  35161. return parseFloat(str);
  35162. }
  35163. let operands = [];
  35164. const entries = [];
  35165. pos = 0;
  35166. const end = dict.length;
  35167. while (pos < end) {
  35168. let b = dict[pos];
  35169. if (b <= 21) {
  35170. if (b === 12) {
  35171. b = b << 8 | dict[++pos];
  35172. }
  35173. entries.push([b, operands]);
  35174. operands = [];
  35175. ++pos;
  35176. } else {
  35177. operands.push(parseOperand());
  35178. }
  35179. }
  35180. return entries;
  35181. }
  35182. parseIndex(pos) {
  35183. const cffIndex = new CFFIndex();
  35184. const bytes = this.bytes;
  35185. const count = bytes[pos++] << 8 | bytes[pos++];
  35186. const offsets = [];
  35187. let end = pos;
  35188. let i, ii;
  35189. if (count !== 0) {
  35190. const offsetSize = bytes[pos++];
  35191. const startPos = pos + (count + 1) * offsetSize - 1;
  35192. for (i = 0, ii = count + 1; i < ii; ++i) {
  35193. let offset = 0;
  35194. for (let j = 0; j < offsetSize; ++j) {
  35195. offset <<= 8;
  35196. offset += bytes[pos++];
  35197. }
  35198. offsets.push(startPos + offset);
  35199. }
  35200. end = offsets[count];
  35201. }
  35202. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  35203. const offsetStart = offsets[i];
  35204. const offsetEnd = offsets[i + 1];
  35205. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  35206. }
  35207. return {
  35208. obj: cffIndex,
  35209. endPos: end
  35210. };
  35211. }
  35212. parseNameIndex(index) {
  35213. const names = [];
  35214. for (let i = 0, ii = index.count; i < ii; ++i) {
  35215. const name = index.get(i);
  35216. names.push((0, _util.bytesToString)(name));
  35217. }
  35218. return names;
  35219. }
  35220. parseStringIndex(index) {
  35221. const strings = new CFFStrings();
  35222. for (let i = 0, ii = index.count; i < ii; ++i) {
  35223. const data = index.get(i);
  35224. strings.add((0, _util.bytesToString)(data));
  35225. }
  35226. return strings;
  35227. }
  35228. createDict(Type, dict, strings) {
  35229. const cffDict = new Type(strings);
  35230. for (let i = 0, ii = dict.length; i < ii; ++i) {
  35231. const pair = dict[i];
  35232. const key = pair[0];
  35233. const value = pair[1];
  35234. cffDict.setByKey(key, value);
  35235. }
  35236. return cffDict;
  35237. }
  35238. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  35239. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  35240. return false;
  35241. }
  35242. let stackSize = state.stackSize;
  35243. const stack = state.stack;
  35244. const length = data.length;
  35245. for (let j = 0; j < length;) {
  35246. const value = data[j++];
  35247. let validationCommand = null;
  35248. if (value === 12) {
  35249. const q = data[j++];
  35250. if (q === 0) {
  35251. data[j - 2] = 139;
  35252. data[j - 1] = 22;
  35253. stackSize = 0;
  35254. } else {
  35255. validationCommand = CharstringValidationData12[q];
  35256. }
  35257. } else if (value === 28) {
  35258. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  35259. j += 2;
  35260. stackSize++;
  35261. } else if (value === 14) {
  35262. if (stackSize >= 4) {
  35263. stackSize -= 4;
  35264. if (this.seacAnalysisEnabled) {
  35265. state.seac = stack.slice(stackSize, stackSize + 4);
  35266. return false;
  35267. }
  35268. }
  35269. validationCommand = CharstringValidationData[value];
  35270. } else if (value >= 32 && value <= 246) {
  35271. stack[stackSize] = value - 139;
  35272. stackSize++;
  35273. } else if (value >= 247 && value <= 254) {
  35274. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  35275. j++;
  35276. stackSize++;
  35277. } else if (value === 255) {
  35278. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  35279. j += 4;
  35280. stackSize++;
  35281. } else if (value === 19 || value === 20) {
  35282. state.hints += stackSize >> 1;
  35283. j += state.hints + 7 >> 3;
  35284. stackSize %= 2;
  35285. validationCommand = CharstringValidationData[value];
  35286. } else if (value === 10 || value === 29) {
  35287. let subrsIndex;
  35288. if (value === 10) {
  35289. subrsIndex = localSubrIndex;
  35290. } else {
  35291. subrsIndex = globalSubrIndex;
  35292. }
  35293. if (!subrsIndex) {
  35294. validationCommand = CharstringValidationData[value];
  35295. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  35296. return false;
  35297. }
  35298. let bias = 32768;
  35299. if (subrsIndex.count < 1240) {
  35300. bias = 107;
  35301. } else if (subrsIndex.count < 33900) {
  35302. bias = 1131;
  35303. }
  35304. const subrNumber = stack[--stackSize] + bias;
  35305. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  35306. validationCommand = CharstringValidationData[value];
  35307. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  35308. return false;
  35309. }
  35310. state.stackSize = stackSize;
  35311. state.callDepth++;
  35312. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  35313. if (!valid) {
  35314. return false;
  35315. }
  35316. state.callDepth--;
  35317. stackSize = state.stackSize;
  35318. continue;
  35319. } else if (value === 11) {
  35320. state.stackSize = stackSize;
  35321. return true;
  35322. } else if (value === 0 && j === data.length) {
  35323. data[j - 1] = 14;
  35324. validationCommand = CharstringValidationData[14];
  35325. } else {
  35326. validationCommand = CharstringValidationData[value];
  35327. }
  35328. if (validationCommand) {
  35329. if (validationCommand.stem) {
  35330. state.hints += stackSize >> 1;
  35331. if (value === 3 || value === 23) {
  35332. state.hasVStems = true;
  35333. } else if (state.hasVStems && (value === 1 || value === 18)) {
  35334. (0, _util.warn)("CFF stem hints are in wrong order");
  35335. data[j - 1] = value === 1 ? 3 : 23;
  35336. }
  35337. }
  35338. if ("min" in validationCommand) {
  35339. if (!state.undefStack && stackSize < validationCommand.min) {
  35340. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  35341. if (stackSize === 0) {
  35342. data[j - 1] = 14;
  35343. return true;
  35344. }
  35345. return false;
  35346. }
  35347. }
  35348. if (state.firstStackClearing && validationCommand.stackClearing) {
  35349. state.firstStackClearing = false;
  35350. stackSize -= validationCommand.min;
  35351. if (stackSize >= 2 && validationCommand.stem) {
  35352. stackSize %= 2;
  35353. } else if (stackSize > 1) {
  35354. (0, _util.warn)("Found too many parameters for stack-clearing command");
  35355. }
  35356. if (stackSize > 0) {
  35357. state.width = stack[stackSize - 1];
  35358. }
  35359. }
  35360. if ("stackDelta" in validationCommand) {
  35361. if ("stackFn" in validationCommand) {
  35362. validationCommand.stackFn(stack, stackSize);
  35363. }
  35364. stackSize += validationCommand.stackDelta;
  35365. } else if (validationCommand.stackClearing) {
  35366. stackSize = 0;
  35367. } else if (validationCommand.resetStack) {
  35368. stackSize = 0;
  35369. state.undefStack = false;
  35370. } else if (validationCommand.undefStack) {
  35371. stackSize = 0;
  35372. state.undefStack = true;
  35373. state.firstStackClearing = false;
  35374. }
  35375. }
  35376. }
  35377. state.stackSize = stackSize;
  35378. return true;
  35379. }
  35380. parseCharStrings({
  35381. charStrings,
  35382. localSubrIndex,
  35383. globalSubrIndex,
  35384. fdSelect,
  35385. fdArray,
  35386. privateDict
  35387. }) {
  35388. const seacs = [];
  35389. const widths = [];
  35390. const count = charStrings.count;
  35391. for (let i = 0; i < count; i++) {
  35392. const charstring = charStrings.get(i);
  35393. const state = {
  35394. callDepth: 0,
  35395. stackSize: 0,
  35396. stack: [],
  35397. undefStack: true,
  35398. hints: 0,
  35399. firstStackClearing: true,
  35400. seac: null,
  35401. width: null,
  35402. hasVStems: false
  35403. };
  35404. let valid = true;
  35405. let localSubrToUse = null;
  35406. let privateDictToUse = privateDict;
  35407. if (fdSelect && fdArray.length) {
  35408. const fdIndex = fdSelect.getFDIndex(i);
  35409. if (fdIndex === -1) {
  35410. (0, _util.warn)("Glyph index is not in fd select.");
  35411. valid = false;
  35412. }
  35413. if (fdIndex >= fdArray.length) {
  35414. (0, _util.warn)("Invalid fd index for glyph index.");
  35415. valid = false;
  35416. }
  35417. if (valid) {
  35418. privateDictToUse = fdArray[fdIndex].privateDict;
  35419. localSubrToUse = privateDictToUse.subrsIndex;
  35420. }
  35421. } else if (localSubrIndex) {
  35422. localSubrToUse = localSubrIndex;
  35423. }
  35424. if (valid) {
  35425. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  35426. }
  35427. if (state.width !== null) {
  35428. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  35429. widths[i] = nominalWidth + state.width;
  35430. } else {
  35431. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  35432. widths[i] = defaultWidth;
  35433. }
  35434. if (state.seac !== null) {
  35435. seacs[i] = state.seac;
  35436. }
  35437. if (!valid) {
  35438. charStrings.set(i, new Uint8Array([14]));
  35439. }
  35440. }
  35441. return {
  35442. charStrings,
  35443. seacs,
  35444. widths
  35445. };
  35446. }
  35447. emptyPrivateDictionary(parentDict) {
  35448. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  35449. parentDict.setByKey(18, [0, 0]);
  35450. parentDict.privateDict = privateDict;
  35451. }
  35452. parsePrivateDict(parentDict) {
  35453. if (!parentDict.hasName("Private")) {
  35454. this.emptyPrivateDictionary(parentDict);
  35455. return;
  35456. }
  35457. const privateOffset = parentDict.getByName("Private");
  35458. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  35459. parentDict.removeByName("Private");
  35460. return;
  35461. }
  35462. const size = privateOffset[0];
  35463. const offset = privateOffset[1];
  35464. if (size === 0 || offset >= this.bytes.length) {
  35465. this.emptyPrivateDictionary(parentDict);
  35466. return;
  35467. }
  35468. const privateDictEnd = offset + size;
  35469. const dictData = this.bytes.subarray(offset, privateDictEnd);
  35470. const dict = this.parseDict(dictData);
  35471. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  35472. parentDict.privateDict = privateDict;
  35473. if (!privateDict.getByName("Subrs")) {
  35474. return;
  35475. }
  35476. const subrsOffset = privateDict.getByName("Subrs");
  35477. const relativeOffset = offset + subrsOffset;
  35478. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  35479. this.emptyPrivateDictionary(parentDict);
  35480. return;
  35481. }
  35482. const subrsIndex = this.parseIndex(relativeOffset);
  35483. privateDict.subrsIndex = subrsIndex.obj;
  35484. }
  35485. parseCharsets(pos, length, strings, cid) {
  35486. if (pos === 0) {
  35487. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  35488. } else if (pos === 1) {
  35489. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  35490. } else if (pos === 2) {
  35491. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  35492. }
  35493. const bytes = this.bytes;
  35494. const start = pos;
  35495. const format = bytes[pos++];
  35496. const charset = [cid ? 0 : ".notdef"];
  35497. let id, count, i;
  35498. length -= 1;
  35499. switch (format) {
  35500. case 0:
  35501. for (i = 0; i < length; i++) {
  35502. id = bytes[pos++] << 8 | bytes[pos++];
  35503. charset.push(cid ? id : strings.get(id));
  35504. }
  35505. break;
  35506. case 1:
  35507. while (charset.length <= length) {
  35508. id = bytes[pos++] << 8 | bytes[pos++];
  35509. count = bytes[pos++];
  35510. for (i = 0; i <= count; i++) {
  35511. charset.push(cid ? id++ : strings.get(id++));
  35512. }
  35513. }
  35514. break;
  35515. case 2:
  35516. while (charset.length <= length) {
  35517. id = bytes[pos++] << 8 | bytes[pos++];
  35518. count = bytes[pos++] << 8 | bytes[pos++];
  35519. for (i = 0; i <= count; i++) {
  35520. charset.push(cid ? id++ : strings.get(id++));
  35521. }
  35522. }
  35523. break;
  35524. default:
  35525. throw new _util.FormatError("Unknown charset format");
  35526. }
  35527. const end = pos;
  35528. const raw = bytes.subarray(start, end);
  35529. return new CFFCharset(false, format, charset, raw);
  35530. }
  35531. parseEncoding(pos, properties, strings, charset) {
  35532. const encoding = Object.create(null);
  35533. const bytes = this.bytes;
  35534. let predefined = false;
  35535. let format, i, ii;
  35536. let raw = null;
  35537. function readSupplement() {
  35538. const supplementsCount = bytes[pos++];
  35539. for (i = 0; i < supplementsCount; i++) {
  35540. const code = bytes[pos++];
  35541. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  35542. encoding[code] = charset.indexOf(strings.get(sid));
  35543. }
  35544. }
  35545. if (pos === 0 || pos === 1) {
  35546. predefined = true;
  35547. format = pos;
  35548. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  35549. for (i = 0, ii = charset.length; i < ii; i++) {
  35550. const index = baseEncoding.indexOf(charset[i]);
  35551. if (index !== -1) {
  35552. encoding[index] = i;
  35553. }
  35554. }
  35555. } else {
  35556. const dataStart = pos;
  35557. format = bytes[pos++];
  35558. switch (format & 0x7f) {
  35559. case 0:
  35560. const glyphsCount = bytes[pos++];
  35561. for (i = 1; i <= glyphsCount; i++) {
  35562. encoding[bytes[pos++]] = i;
  35563. }
  35564. break;
  35565. case 1:
  35566. const rangesCount = bytes[pos++];
  35567. let gid = 1;
  35568. for (i = 0; i < rangesCount; i++) {
  35569. const start = bytes[pos++];
  35570. const left = bytes[pos++];
  35571. for (let j = start; j <= start + left; j++) {
  35572. encoding[j] = gid++;
  35573. }
  35574. }
  35575. break;
  35576. default:
  35577. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  35578. }
  35579. const dataEnd = pos;
  35580. if (format & 0x80) {
  35581. bytes[dataStart] &= 0x7f;
  35582. readSupplement();
  35583. }
  35584. raw = bytes.subarray(dataStart, dataEnd);
  35585. }
  35586. format &= 0x7f;
  35587. return new CFFEncoding(predefined, format, encoding, raw);
  35588. }
  35589. parseFDSelect(pos, length) {
  35590. const bytes = this.bytes;
  35591. const format = bytes[pos++];
  35592. const fdSelect = [];
  35593. let i;
  35594. switch (format) {
  35595. case 0:
  35596. for (i = 0; i < length; ++i) {
  35597. const id = bytes[pos++];
  35598. fdSelect.push(id);
  35599. }
  35600. break;
  35601. case 3:
  35602. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  35603. for (i = 0; i < rangesCount; ++i) {
  35604. let first = bytes[pos++] << 8 | bytes[pos++];
  35605. if (i === 0 && first !== 0) {
  35606. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  35607. first = 0;
  35608. }
  35609. const fdIndex = bytes[pos++];
  35610. const next = bytes[pos] << 8 | bytes[pos + 1];
  35611. for (let j = first; j < next; ++j) {
  35612. fdSelect.push(fdIndex);
  35613. }
  35614. }
  35615. pos += 2;
  35616. break;
  35617. default:
  35618. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  35619. }
  35620. if (fdSelect.length !== length) {
  35621. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  35622. }
  35623. return new CFFFDSelect(format, fdSelect);
  35624. }
  35625. }
  35626. return CFFParser;
  35627. }();
  35628. exports.CFFParser = CFFParser;
  35629. class CFF {
  35630. constructor() {
  35631. this.header = null;
  35632. this.names = [];
  35633. this.topDict = null;
  35634. this.strings = new CFFStrings();
  35635. this.globalSubrIndex = null;
  35636. this.encoding = null;
  35637. this.charset = null;
  35638. this.charStrings = null;
  35639. this.fdArray = [];
  35640. this.fdSelect = null;
  35641. this.isCIDFont = false;
  35642. }
  35643. duplicateFirstGlyph() {
  35644. if (this.charStrings.count >= 65535) {
  35645. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  35646. return;
  35647. }
  35648. const glyphZero = this.charStrings.get(0);
  35649. this.charStrings.add(glyphZero);
  35650. if (this.isCIDFont) {
  35651. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  35652. }
  35653. }
  35654. hasGlyphId(id) {
  35655. if (id < 0 || id >= this.charStrings.count) {
  35656. return false;
  35657. }
  35658. const glyph = this.charStrings.get(id);
  35659. return glyph.length > 0;
  35660. }
  35661. }
  35662. exports.CFF = CFF;
  35663. class CFFHeader {
  35664. constructor(major, minor, hdrSize, offSize) {
  35665. this.major = major;
  35666. this.minor = minor;
  35667. this.hdrSize = hdrSize;
  35668. this.offSize = offSize;
  35669. }
  35670. }
  35671. exports.CFFHeader = CFFHeader;
  35672. class CFFStrings {
  35673. constructor() {
  35674. this.strings = [];
  35675. }
  35676. get(index) {
  35677. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  35678. return CFFStandardStrings[index];
  35679. }
  35680. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  35681. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  35682. }
  35683. return CFFStandardStrings[0];
  35684. }
  35685. getSID(str) {
  35686. let index = CFFStandardStrings.indexOf(str);
  35687. if (index !== -1) {
  35688. return index;
  35689. }
  35690. index = this.strings.indexOf(str);
  35691. if (index !== -1) {
  35692. return index + NUM_STANDARD_CFF_STRINGS;
  35693. }
  35694. return -1;
  35695. }
  35696. add(value) {
  35697. this.strings.push(value);
  35698. }
  35699. get count() {
  35700. return this.strings.length;
  35701. }
  35702. }
  35703. exports.CFFStrings = CFFStrings;
  35704. class CFFIndex {
  35705. constructor() {
  35706. this.objects = [];
  35707. this.length = 0;
  35708. }
  35709. add(data) {
  35710. this.length += data.length;
  35711. this.objects.push(data);
  35712. }
  35713. set(index, data) {
  35714. this.length += data.length - this.objects[index].length;
  35715. this.objects[index] = data;
  35716. }
  35717. get(index) {
  35718. return this.objects[index];
  35719. }
  35720. get count() {
  35721. return this.objects.length;
  35722. }
  35723. }
  35724. exports.CFFIndex = CFFIndex;
  35725. class CFFDict {
  35726. constructor(tables, strings) {
  35727. this.keyToNameMap = tables.keyToNameMap;
  35728. this.nameToKeyMap = tables.nameToKeyMap;
  35729. this.defaults = tables.defaults;
  35730. this.types = tables.types;
  35731. this.opcodes = tables.opcodes;
  35732. this.order = tables.order;
  35733. this.strings = strings;
  35734. this.values = Object.create(null);
  35735. }
  35736. setByKey(key, value) {
  35737. if (!(key in this.keyToNameMap)) {
  35738. return false;
  35739. }
  35740. const valueLength = value.length;
  35741. if (valueLength === 0) {
  35742. return true;
  35743. }
  35744. for (let i = 0; i < valueLength; i++) {
  35745. if (isNaN(value[i])) {
  35746. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  35747. return true;
  35748. }
  35749. }
  35750. const type = this.types[key];
  35751. if (type === "num" || type === "sid" || type === "offset") {
  35752. value = value[0];
  35753. }
  35754. this.values[key] = value;
  35755. return true;
  35756. }
  35757. setByName(name, value) {
  35758. if (!(name in this.nameToKeyMap)) {
  35759. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  35760. }
  35761. this.values[this.nameToKeyMap[name]] = value;
  35762. }
  35763. hasName(name) {
  35764. return this.nameToKeyMap[name] in this.values;
  35765. }
  35766. getByName(name) {
  35767. if (!(name in this.nameToKeyMap)) {
  35768. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  35769. }
  35770. const key = this.nameToKeyMap[name];
  35771. if (!(key in this.values)) {
  35772. return this.defaults[key];
  35773. }
  35774. return this.values[key];
  35775. }
  35776. removeByName(name) {
  35777. delete this.values[this.nameToKeyMap[name]];
  35778. }
  35779. static createTables(layout) {
  35780. const tables = {
  35781. keyToNameMap: {},
  35782. nameToKeyMap: {},
  35783. defaults: {},
  35784. types: {},
  35785. opcodes: {},
  35786. order: []
  35787. };
  35788. for (let i = 0, ii = layout.length; i < ii; ++i) {
  35789. const entry = layout[i];
  35790. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  35791. tables.keyToNameMap[key] = entry[1];
  35792. tables.nameToKeyMap[entry[1]] = key;
  35793. tables.types[key] = entry[2];
  35794. tables.defaults[key] = entry[3];
  35795. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  35796. tables.order.push(key);
  35797. }
  35798. return tables;
  35799. }
  35800. }
  35801. const CFFTopDict = function CFFTopDictClosure() {
  35802. 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]];
  35803. let tables = null;
  35804. class CFFTopDict extends CFFDict {
  35805. constructor(strings) {
  35806. if (tables === null) {
  35807. tables = CFFDict.createTables(layout);
  35808. }
  35809. super(tables, strings);
  35810. this.privateDict = null;
  35811. }
  35812. }
  35813. return CFFTopDict;
  35814. }();
  35815. exports.CFFTopDict = CFFTopDict;
  35816. const CFFPrivateDict = function CFFPrivateDictClosure() {
  35817. 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]];
  35818. let tables = null;
  35819. class CFFPrivateDict extends CFFDict {
  35820. constructor(strings) {
  35821. if (tables === null) {
  35822. tables = CFFDict.createTables(layout);
  35823. }
  35824. super(tables, strings);
  35825. this.subrsIndex = null;
  35826. }
  35827. }
  35828. return CFFPrivateDict;
  35829. }();
  35830. exports.CFFPrivateDict = CFFPrivateDict;
  35831. const CFFCharsetPredefinedTypes = {
  35832. ISO_ADOBE: 0,
  35833. EXPERT: 1,
  35834. EXPERT_SUBSET: 2
  35835. };
  35836. class CFFCharset {
  35837. constructor(predefined, format, charset, raw) {
  35838. this.predefined = predefined;
  35839. this.format = format;
  35840. this.charset = charset;
  35841. this.raw = raw;
  35842. }
  35843. }
  35844. exports.CFFCharset = CFFCharset;
  35845. class CFFEncoding {
  35846. constructor(predefined, format, encoding, raw) {
  35847. this.predefined = predefined;
  35848. this.format = format;
  35849. this.encoding = encoding;
  35850. this.raw = raw;
  35851. }
  35852. }
  35853. class CFFFDSelect {
  35854. constructor(format, fdSelect) {
  35855. this.format = format;
  35856. this.fdSelect = fdSelect;
  35857. }
  35858. getFDIndex(glyphIndex) {
  35859. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  35860. return -1;
  35861. }
  35862. return this.fdSelect[glyphIndex];
  35863. }
  35864. }
  35865. exports.CFFFDSelect = CFFFDSelect;
  35866. class CFFOffsetTracker {
  35867. constructor() {
  35868. this.offsets = Object.create(null);
  35869. }
  35870. isTracking(key) {
  35871. return key in this.offsets;
  35872. }
  35873. track(key, location) {
  35874. if (key in this.offsets) {
  35875. throw new _util.FormatError(`Already tracking location of ${key}`);
  35876. }
  35877. this.offsets[key] = location;
  35878. }
  35879. offset(value) {
  35880. for (const key in this.offsets) {
  35881. this.offsets[key] += value;
  35882. }
  35883. }
  35884. setEntryLocation(key, values, output) {
  35885. if (!(key in this.offsets)) {
  35886. throw new _util.FormatError(`Not tracking location of ${key}`);
  35887. }
  35888. const data = output.data;
  35889. const dataOffset = this.offsets[key];
  35890. const size = 5;
  35891. for (let i = 0, ii = values.length; i < ii; ++i) {
  35892. const offset0 = i * size + dataOffset;
  35893. const offset1 = offset0 + 1;
  35894. const offset2 = offset0 + 2;
  35895. const offset3 = offset0 + 3;
  35896. const offset4 = offset0 + 4;
  35897. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  35898. throw new _util.FormatError("writing to an offset that is not empty");
  35899. }
  35900. const value = values[i];
  35901. data[offset0] = 0x1d;
  35902. data[offset1] = value >> 24 & 0xff;
  35903. data[offset2] = value >> 16 & 0xff;
  35904. data[offset3] = value >> 8 & 0xff;
  35905. data[offset4] = value & 0xff;
  35906. }
  35907. }
  35908. }
  35909. class CFFCompiler {
  35910. constructor(cff) {
  35911. this.cff = cff;
  35912. }
  35913. compile() {
  35914. const cff = this.cff;
  35915. const output = {
  35916. data: [],
  35917. length: 0,
  35918. add: function CFFCompiler_add(data) {
  35919. this.data = this.data.concat(data);
  35920. this.length = this.data.length;
  35921. }
  35922. };
  35923. const header = this.compileHeader(cff.header);
  35924. output.add(header);
  35925. const nameIndex = this.compileNameIndex(cff.names);
  35926. output.add(nameIndex);
  35927. if (cff.isCIDFont) {
  35928. if (cff.topDict.hasName("FontMatrix")) {
  35929. const base = cff.topDict.getByName("FontMatrix");
  35930. cff.topDict.removeByName("FontMatrix");
  35931. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  35932. const subDict = cff.fdArray[i];
  35933. let matrix = base.slice(0);
  35934. if (subDict.hasName("FontMatrix")) {
  35935. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  35936. }
  35937. subDict.setByName("FontMatrix", matrix);
  35938. }
  35939. }
  35940. }
  35941. const xuid = cff.topDict.getByName("XUID");
  35942. if (xuid && xuid.length > 16) {
  35943. cff.topDict.removeByName("XUID");
  35944. }
  35945. cff.topDict.setByName("charset", 0);
  35946. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  35947. output.add(compiled.output);
  35948. const topDictTracker = compiled.trackers[0];
  35949. const stringIndex = this.compileStringIndex(cff.strings.strings);
  35950. output.add(stringIndex);
  35951. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  35952. output.add(globalSubrIndex);
  35953. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  35954. if (cff.encoding.predefined) {
  35955. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  35956. } else {
  35957. const encoding = this.compileEncoding(cff.encoding);
  35958. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  35959. output.add(encoding);
  35960. }
  35961. }
  35962. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  35963. topDictTracker.setEntryLocation("charset", [output.length], output);
  35964. output.add(charset);
  35965. const charStrings = this.compileCharStrings(cff.charStrings);
  35966. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  35967. output.add(charStrings);
  35968. if (cff.isCIDFont) {
  35969. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  35970. const fdSelect = this.compileFDSelect(cff.fdSelect);
  35971. output.add(fdSelect);
  35972. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  35973. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  35974. output.add(compiled.output);
  35975. const fontDictTrackers = compiled.trackers;
  35976. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  35977. }
  35978. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  35979. output.add([0]);
  35980. return output.data;
  35981. }
  35982. encodeNumber(value) {
  35983. if (Number.isInteger(value)) {
  35984. return this.encodeInteger(value);
  35985. }
  35986. return this.encodeFloat(value);
  35987. }
  35988. static get EncodeFloatRegExp() {
  35989. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  35990. }
  35991. encodeFloat(num) {
  35992. let value = num.toString();
  35993. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  35994. if (m) {
  35995. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  35996. value = (Math.round(num * epsilon) / epsilon).toString();
  35997. }
  35998. let nibbles = "";
  35999. let i, ii;
  36000. for (i = 0, ii = value.length; i < ii; ++i) {
  36001. const a = value[i];
  36002. if (a === "e") {
  36003. nibbles += value[++i] === "-" ? "c" : "b";
  36004. } else if (a === ".") {
  36005. nibbles += "a";
  36006. } else if (a === "-") {
  36007. nibbles += "e";
  36008. } else {
  36009. nibbles += a;
  36010. }
  36011. }
  36012. nibbles += nibbles.length & 1 ? "f" : "ff";
  36013. const out = [30];
  36014. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  36015. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  36016. }
  36017. return out;
  36018. }
  36019. encodeInteger(value) {
  36020. let code;
  36021. if (value >= -107 && value <= 107) {
  36022. code = [value + 139];
  36023. } else if (value >= 108 && value <= 1131) {
  36024. value -= 108;
  36025. code = [(value >> 8) + 247, value & 0xff];
  36026. } else if (value >= -1131 && value <= -108) {
  36027. value = -value - 108;
  36028. code = [(value >> 8) + 251, value & 0xff];
  36029. } else if (value >= -32768 && value <= 32767) {
  36030. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  36031. } else {
  36032. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  36033. }
  36034. return code;
  36035. }
  36036. compileHeader(header) {
  36037. return [header.major, header.minor, 4, header.offSize];
  36038. }
  36039. compileNameIndex(names) {
  36040. const nameIndex = new CFFIndex();
  36041. for (let i = 0, ii = names.length; i < ii; ++i) {
  36042. const name = names[i];
  36043. const length = Math.min(name.length, 127);
  36044. let sanitizedName = new Array(length);
  36045. for (let j = 0; j < length; j++) {
  36046. let char = name[j];
  36047. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  36048. char = "_";
  36049. }
  36050. sanitizedName[j] = char;
  36051. }
  36052. sanitizedName = sanitizedName.join("");
  36053. if (sanitizedName === "") {
  36054. sanitizedName = "Bad_Font_Name";
  36055. }
  36056. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  36057. }
  36058. return this.compileIndex(nameIndex);
  36059. }
  36060. compileTopDicts(dicts, length, removeCidKeys) {
  36061. const fontDictTrackers = [];
  36062. let fdArrayIndex = new CFFIndex();
  36063. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  36064. const fontDict = dicts[i];
  36065. if (removeCidKeys) {
  36066. fontDict.removeByName("CIDFontVersion");
  36067. fontDict.removeByName("CIDFontRevision");
  36068. fontDict.removeByName("CIDFontType");
  36069. fontDict.removeByName("CIDCount");
  36070. fontDict.removeByName("UIDBase");
  36071. }
  36072. const fontDictTracker = new CFFOffsetTracker();
  36073. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  36074. fontDictTrackers.push(fontDictTracker);
  36075. fdArrayIndex.add(fontDictData);
  36076. fontDictTracker.offset(length);
  36077. }
  36078. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  36079. return {
  36080. trackers: fontDictTrackers,
  36081. output: fdArrayIndex
  36082. };
  36083. }
  36084. compilePrivateDicts(dicts, trackers, output) {
  36085. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  36086. const fontDict = dicts[i];
  36087. const privateDict = fontDict.privateDict;
  36088. if (!privateDict || !fontDict.hasName("Private")) {
  36089. throw new _util.FormatError("There must be a private dictionary.");
  36090. }
  36091. const privateDictTracker = new CFFOffsetTracker();
  36092. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  36093. let outputLength = output.length;
  36094. privateDictTracker.offset(outputLength);
  36095. if (!privateDictData.length) {
  36096. outputLength = 0;
  36097. }
  36098. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  36099. output.add(privateDictData);
  36100. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  36101. const subrs = this.compileIndex(privateDict.subrsIndex);
  36102. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  36103. output.add(subrs);
  36104. }
  36105. }
  36106. }
  36107. compileDict(dict, offsetTracker) {
  36108. let out = [];
  36109. const order = dict.order;
  36110. for (let i = 0; i < order.length; ++i) {
  36111. const key = order[i];
  36112. if (!(key in dict.values)) {
  36113. continue;
  36114. }
  36115. let values = dict.values[key];
  36116. let types = dict.types[key];
  36117. if (!Array.isArray(types)) {
  36118. types = [types];
  36119. }
  36120. if (!Array.isArray(values)) {
  36121. values = [values];
  36122. }
  36123. if (values.length === 0) {
  36124. continue;
  36125. }
  36126. for (let j = 0, jj = types.length; j < jj; ++j) {
  36127. const type = types[j];
  36128. const value = values[j];
  36129. switch (type) {
  36130. case "num":
  36131. case "sid":
  36132. out = out.concat(this.encodeNumber(value));
  36133. break;
  36134. case "offset":
  36135. const name = dict.keyToNameMap[key];
  36136. if (!offsetTracker.isTracking(name)) {
  36137. offsetTracker.track(name, out.length);
  36138. }
  36139. out = out.concat([0x1d, 0, 0, 0, 0]);
  36140. break;
  36141. case "array":
  36142. case "delta":
  36143. out = out.concat(this.encodeNumber(value));
  36144. for (let k = 1, kk = values.length; k < kk; ++k) {
  36145. out = out.concat(this.encodeNumber(values[k]));
  36146. }
  36147. break;
  36148. default:
  36149. throw new _util.FormatError(`Unknown data type of ${type}`);
  36150. }
  36151. }
  36152. out = out.concat(dict.opcodes[key]);
  36153. }
  36154. return out;
  36155. }
  36156. compileStringIndex(strings) {
  36157. const stringIndex = new CFFIndex();
  36158. for (let i = 0, ii = strings.length; i < ii; ++i) {
  36159. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  36160. }
  36161. return this.compileIndex(stringIndex);
  36162. }
  36163. compileGlobalSubrIndex() {
  36164. const globalSubrIndex = this.cff.globalSubrIndex;
  36165. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  36166. }
  36167. compileCharStrings(charStrings) {
  36168. const charStringsIndex = new CFFIndex();
  36169. for (let i = 0; i < charStrings.count; i++) {
  36170. const glyph = charStrings.get(i);
  36171. if (glyph.length === 0) {
  36172. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  36173. continue;
  36174. }
  36175. charStringsIndex.add(glyph);
  36176. }
  36177. return this.compileIndex(charStringsIndex);
  36178. }
  36179. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  36180. let out;
  36181. const numGlyphsLessNotDef = numGlyphs - 1;
  36182. if (isCIDFont) {
  36183. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  36184. } else {
  36185. const length = 1 + numGlyphsLessNotDef * 2;
  36186. out = new Uint8Array(length);
  36187. out[0] = 0;
  36188. let charsetIndex = 0;
  36189. const numCharsets = charset.charset.length;
  36190. let warned = false;
  36191. for (let i = 1; i < out.length; i += 2) {
  36192. let sid = 0;
  36193. if (charsetIndex < numCharsets) {
  36194. const name = charset.charset[charsetIndex++];
  36195. sid = strings.getSID(name);
  36196. if (sid === -1) {
  36197. sid = 0;
  36198. if (!warned) {
  36199. warned = true;
  36200. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  36201. }
  36202. }
  36203. }
  36204. out[i] = sid >> 8 & 0xff;
  36205. out[i + 1] = sid & 0xff;
  36206. }
  36207. }
  36208. return this.compileTypedArray(out);
  36209. }
  36210. compileEncoding(encoding) {
  36211. return this.compileTypedArray(encoding.raw);
  36212. }
  36213. compileFDSelect(fdSelect) {
  36214. const format = fdSelect.format;
  36215. let out, i;
  36216. switch (format) {
  36217. case 0:
  36218. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  36219. out[0] = format;
  36220. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  36221. out[i + 1] = fdSelect.fdSelect[i];
  36222. }
  36223. break;
  36224. case 3:
  36225. const start = 0;
  36226. let lastFD = fdSelect.fdSelect[0];
  36227. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  36228. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  36229. const currentFD = fdSelect.fdSelect[i];
  36230. if (currentFD !== lastFD) {
  36231. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  36232. lastFD = currentFD;
  36233. }
  36234. }
  36235. const numRanges = (ranges.length - 3) / 3;
  36236. ranges[1] = numRanges >> 8 & 0xff;
  36237. ranges[2] = numRanges & 0xff;
  36238. ranges.push(i >> 8 & 0xff, i & 0xff);
  36239. out = new Uint8Array(ranges);
  36240. break;
  36241. }
  36242. return this.compileTypedArray(out);
  36243. }
  36244. compileTypedArray(data) {
  36245. const out = [];
  36246. for (let i = 0, ii = data.length; i < ii; ++i) {
  36247. out[i] = data[i];
  36248. }
  36249. return out;
  36250. }
  36251. compileIndex(index, trackers = []) {
  36252. const objects = index.objects;
  36253. const count = objects.length;
  36254. if (count === 0) {
  36255. return [0, 0, 0];
  36256. }
  36257. const data = [count >> 8 & 0xff, count & 0xff];
  36258. let lastOffset = 1,
  36259. i;
  36260. for (i = 0; i < count; ++i) {
  36261. lastOffset += objects[i].length;
  36262. }
  36263. let offsetSize;
  36264. if (lastOffset < 0x100) {
  36265. offsetSize = 1;
  36266. } else if (lastOffset < 0x10000) {
  36267. offsetSize = 2;
  36268. } else if (lastOffset < 0x1000000) {
  36269. offsetSize = 3;
  36270. } else {
  36271. offsetSize = 4;
  36272. }
  36273. data.push(offsetSize);
  36274. let relativeOffset = 1;
  36275. for (i = 0; i < count + 1; i++) {
  36276. if (offsetSize === 1) {
  36277. data.push(relativeOffset & 0xff);
  36278. } else if (offsetSize === 2) {
  36279. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36280. } else if (offsetSize === 3) {
  36281. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36282. } else {
  36283. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36284. }
  36285. if (objects[i]) {
  36286. relativeOffset += objects[i].length;
  36287. }
  36288. }
  36289. for (i = 0; i < count; i++) {
  36290. if (trackers[i]) {
  36291. trackers[i].offset(data.length);
  36292. }
  36293. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  36294. data.push(objects[i][j]);
  36295. }
  36296. }
  36297. return data;
  36298. }
  36299. }
  36300. exports.CFFCompiler = CFFCompiler;
  36301. /***/ }),
  36302. /* 46 */
  36303. /***/ ((__unused_webpack_module, exports) => {
  36304. Object.defineProperty(exports, "__esModule", ({
  36305. value: true
  36306. }));
  36307. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  36308. 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"];
  36309. exports.ISOAdobeCharset = ISOAdobeCharset;
  36310. 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"];
  36311. exports.ExpertCharset = ExpertCharset;
  36312. 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"];
  36313. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36314. /***/ }),
  36315. /* 47 */
  36316. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36317. Object.defineProperty(exports, "__esModule", ({
  36318. value: true
  36319. }));
  36320. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  36321. exports.getStandardFontName = getStandardFontName;
  36322. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  36323. var _core_utils = __w_pdfjs_require__(8);
  36324. var _fonts_utils = __w_pdfjs_require__(18);
  36325. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36326. t["Times-Roman"] = "Times-Roman";
  36327. t.Helvetica = "Helvetica";
  36328. t.Courier = "Courier";
  36329. t.Symbol = "Symbol";
  36330. t["Times-Bold"] = "Times-Bold";
  36331. t["Helvetica-Bold"] = "Helvetica-Bold";
  36332. t["Courier-Bold"] = "Courier-Bold";
  36333. t.ZapfDingbats = "ZapfDingbats";
  36334. t["Times-Italic"] = "Times-Italic";
  36335. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  36336. t["Courier-Oblique"] = "Courier-Oblique";
  36337. t["Times-BoldItalic"] = "Times-BoldItalic";
  36338. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  36339. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  36340. t.ArialNarrow = "Helvetica";
  36341. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  36342. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  36343. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  36344. t.ArialBlack = "Helvetica";
  36345. t["ArialBlack-Bold"] = "Helvetica-Bold";
  36346. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  36347. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  36348. t["Arial-Black"] = "Helvetica";
  36349. t["Arial-Black-Bold"] = "Helvetica-Bold";
  36350. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  36351. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  36352. t.Arial = "Helvetica";
  36353. t["Arial-Bold"] = "Helvetica-Bold";
  36354. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  36355. t["Arial-Italic"] = "Helvetica-Oblique";
  36356. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  36357. t["Arial-BoldMT"] = "Helvetica-Bold";
  36358. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  36359. t.ArialMT = "Helvetica";
  36360. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  36361. t["Courier-Italic"] = "Courier-Oblique";
  36362. t.CourierNew = "Courier";
  36363. t["CourierNew-Bold"] = "Courier-Bold";
  36364. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  36365. t["CourierNew-Italic"] = "Courier-Oblique";
  36366. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  36367. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  36368. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  36369. t.CourierNewPSMT = "Courier";
  36370. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  36371. t["Helvetica-Italic"] = "Helvetica-Oblique";
  36372. t["Symbol-Bold"] = "Symbol";
  36373. t["Symbol-BoldItalic"] = "Symbol";
  36374. t["Symbol-Italic"] = "Symbol";
  36375. t.TimesNewRoman = "Times-Roman";
  36376. t["TimesNewRoman-Bold"] = "Times-Bold";
  36377. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  36378. t["TimesNewRoman-Italic"] = "Times-Italic";
  36379. t.TimesNewRomanPS = "Times-Roman";
  36380. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  36381. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  36382. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  36383. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  36384. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  36385. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  36386. t.TimesNewRomanPSMT = "Times-Roman";
  36387. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  36388. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  36389. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  36390. });
  36391. exports.getStdFontMap = getStdFontMap;
  36392. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36393. t.Courier = "FoxitFixed.pfb";
  36394. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  36395. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  36396. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  36397. t.Helvetica = "FoxitSans.pfb";
  36398. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  36399. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  36400. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  36401. t["Times-Roman"] = "FoxitSerif.pfb";
  36402. t["Times-Bold"] = "FoxitSerifBold.pfb";
  36403. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  36404. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  36405. t.Symbol = "FoxitSymbol.pfb";
  36406. t.ZapfDingbats = "FoxitDingbats.pfb";
  36407. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  36408. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  36409. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  36410. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  36411. });
  36412. exports.getFontNameToFileMap = getFontNameToFileMap;
  36413. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36414. t.Calibri = "Helvetica";
  36415. t["Calibri-Bold"] = "Helvetica-Bold";
  36416. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  36417. t["Calibri-Italic"] = "Helvetica-Oblique";
  36418. t.CenturyGothic = "Helvetica";
  36419. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  36420. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  36421. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  36422. t.ComicSansMS = "Comic Sans MS";
  36423. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  36424. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  36425. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  36426. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  36427. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  36428. t["ItcSymbol-Book"] = "Helvetica";
  36429. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  36430. t["ItcSymbol-Medium"] = "Helvetica";
  36431. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  36432. t.LucidaConsole = "Courier";
  36433. t["LucidaConsole-Bold"] = "Courier-Bold";
  36434. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  36435. t["LucidaConsole-Italic"] = "Courier-Oblique";
  36436. t["LucidaSans-Demi"] = "Helvetica-Bold";
  36437. t["MS-Gothic"] = "MS Gothic";
  36438. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  36439. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  36440. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  36441. t["MS-Mincho"] = "MS Mincho";
  36442. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  36443. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  36444. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  36445. t["MS-PGothic"] = "MS PGothic";
  36446. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  36447. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  36448. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  36449. t["MS-PMincho"] = "MS PMincho";
  36450. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  36451. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  36452. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  36453. t.NuptialScript = "Times-Italic";
  36454. t.SegoeUISymbol = "Helvetica";
  36455. t.Wingdings = "ZapfDingbats";
  36456. t["Wingdings-Regular"] = "ZapfDingbats";
  36457. });
  36458. exports.getNonStdFontMap = getNonStdFontMap;
  36459. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36460. t["Adobe Jenson"] = true;
  36461. t["Adobe Text"] = true;
  36462. t.Albertus = true;
  36463. t.Aldus = true;
  36464. t.Alexandria = true;
  36465. t.Algerian = true;
  36466. t["American Typewriter"] = true;
  36467. t.Antiqua = true;
  36468. t.Apex = true;
  36469. t.Arno = true;
  36470. t.Aster = true;
  36471. t.Aurora = true;
  36472. t.Baskerville = true;
  36473. t.Bell = true;
  36474. t.Bembo = true;
  36475. t["Bembo Schoolbook"] = true;
  36476. t.Benguiat = true;
  36477. t["Berkeley Old Style"] = true;
  36478. t["Bernhard Modern"] = true;
  36479. t["Berthold City"] = true;
  36480. t.Bodoni = true;
  36481. t["Bauer Bodoni"] = true;
  36482. t["Book Antiqua"] = true;
  36483. t.Bookman = true;
  36484. t["Bordeaux Roman"] = true;
  36485. t["Californian FB"] = true;
  36486. t.Calisto = true;
  36487. t.Calvert = true;
  36488. t.Capitals = true;
  36489. t.Cambria = true;
  36490. t.Cartier = true;
  36491. t.Caslon = true;
  36492. t.Catull = true;
  36493. t.Centaur = true;
  36494. t["Century Old Style"] = true;
  36495. t["Century Schoolbook"] = true;
  36496. t.Chaparral = true;
  36497. t["Charis SIL"] = true;
  36498. t.Cheltenham = true;
  36499. t["Cholla Slab"] = true;
  36500. t.Clarendon = true;
  36501. t.Clearface = true;
  36502. t.Cochin = true;
  36503. t.Colonna = true;
  36504. t["Computer Modern"] = true;
  36505. t["Concrete Roman"] = true;
  36506. t.Constantia = true;
  36507. t["Cooper Black"] = true;
  36508. t.Corona = true;
  36509. t.Ecotype = true;
  36510. t.Egyptienne = true;
  36511. t.Elephant = true;
  36512. t.Excelsior = true;
  36513. t.Fairfield = true;
  36514. t["FF Scala"] = true;
  36515. t.Folkard = true;
  36516. t.Footlight = true;
  36517. t.FreeSerif = true;
  36518. t["Friz Quadrata"] = true;
  36519. t.Garamond = true;
  36520. t.Gentium = true;
  36521. t.Georgia = true;
  36522. t.Gloucester = true;
  36523. t["Goudy Old Style"] = true;
  36524. t["Goudy Schoolbook"] = true;
  36525. t["Goudy Pro Font"] = true;
  36526. t.Granjon = true;
  36527. t["Guardian Egyptian"] = true;
  36528. t.Heather = true;
  36529. t.Hercules = true;
  36530. t["High Tower Text"] = true;
  36531. t.Hiroshige = true;
  36532. t["Hoefler Text"] = true;
  36533. t["Humana Serif"] = true;
  36534. t.Imprint = true;
  36535. t["Ionic No. 5"] = true;
  36536. t.Janson = true;
  36537. t.Joanna = true;
  36538. t.Korinna = true;
  36539. t.Lexicon = true;
  36540. t.LiberationSerif = true;
  36541. t["Liberation Serif"] = true;
  36542. t["Linux Libertine"] = true;
  36543. t.Literaturnaya = true;
  36544. t.Lucida = true;
  36545. t["Lucida Bright"] = true;
  36546. t.Melior = true;
  36547. t.Memphis = true;
  36548. t.Miller = true;
  36549. t.Minion = true;
  36550. t.Modern = true;
  36551. t["Mona Lisa"] = true;
  36552. t["Mrs Eaves"] = true;
  36553. t["MS Serif"] = true;
  36554. t["Museo Slab"] = true;
  36555. t["New York"] = true;
  36556. t["Nimbus Roman"] = true;
  36557. t["NPS Rawlinson Roadway"] = true;
  36558. t.NuptialScript = true;
  36559. t.Palatino = true;
  36560. t.Perpetua = true;
  36561. t.Plantin = true;
  36562. t["Plantin Schoolbook"] = true;
  36563. t.Playbill = true;
  36564. t["Poor Richard"] = true;
  36565. t["Rawlinson Roadway"] = true;
  36566. t.Renault = true;
  36567. t.Requiem = true;
  36568. t.Rockwell = true;
  36569. t.Roman = true;
  36570. t["Rotis Serif"] = true;
  36571. t.Sabon = true;
  36572. t.Scala = true;
  36573. t.Seagull = true;
  36574. t.Sistina = true;
  36575. t.Souvenir = true;
  36576. t.STIX = true;
  36577. t["Stone Informal"] = true;
  36578. t["Stone Serif"] = true;
  36579. t.Sylfaen = true;
  36580. t.Times = true;
  36581. t.Trajan = true;
  36582. t["Trinité"] = true;
  36583. t["Trump Mediaeval"] = true;
  36584. t.Utopia = true;
  36585. t["Vale Type"] = true;
  36586. t["Bitstream Vera"] = true;
  36587. t["Vera Serif"] = true;
  36588. t.Versailles = true;
  36589. t.Wanted = true;
  36590. t.Weiss = true;
  36591. t["Wide Latin"] = true;
  36592. t.Windsor = true;
  36593. t.XITS = true;
  36594. });
  36595. exports.getSerifFonts = getSerifFonts;
  36596. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36597. t.Dingbats = true;
  36598. t.Symbol = true;
  36599. t.ZapfDingbats = true;
  36600. });
  36601. exports.getSymbolsFonts = getSymbolsFonts;
  36602. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36603. t[2] = 10;
  36604. t[3] = 32;
  36605. t[4] = 33;
  36606. t[5] = 34;
  36607. t[6] = 35;
  36608. t[7] = 36;
  36609. t[8] = 37;
  36610. t[9] = 38;
  36611. t[10] = 39;
  36612. t[11] = 40;
  36613. t[12] = 41;
  36614. t[13] = 42;
  36615. t[14] = 43;
  36616. t[15] = 44;
  36617. t[16] = 45;
  36618. t[17] = 46;
  36619. t[18] = 47;
  36620. t[19] = 48;
  36621. t[20] = 49;
  36622. t[21] = 50;
  36623. t[22] = 51;
  36624. t[23] = 52;
  36625. t[24] = 53;
  36626. t[25] = 54;
  36627. t[26] = 55;
  36628. t[27] = 56;
  36629. t[28] = 57;
  36630. t[29] = 58;
  36631. t[30] = 894;
  36632. t[31] = 60;
  36633. t[32] = 61;
  36634. t[33] = 62;
  36635. t[34] = 63;
  36636. t[35] = 64;
  36637. t[36] = 65;
  36638. t[37] = 66;
  36639. t[38] = 67;
  36640. t[39] = 68;
  36641. t[40] = 69;
  36642. t[41] = 70;
  36643. t[42] = 71;
  36644. t[43] = 72;
  36645. t[44] = 73;
  36646. t[45] = 74;
  36647. t[46] = 75;
  36648. t[47] = 76;
  36649. t[48] = 77;
  36650. t[49] = 78;
  36651. t[50] = 79;
  36652. t[51] = 80;
  36653. t[52] = 81;
  36654. t[53] = 82;
  36655. t[54] = 83;
  36656. t[55] = 84;
  36657. t[56] = 85;
  36658. t[57] = 86;
  36659. t[58] = 87;
  36660. t[59] = 88;
  36661. t[60] = 89;
  36662. t[61] = 90;
  36663. t[62] = 91;
  36664. t[63] = 92;
  36665. t[64] = 93;
  36666. t[65] = 94;
  36667. t[66] = 95;
  36668. t[67] = 96;
  36669. t[68] = 97;
  36670. t[69] = 98;
  36671. t[70] = 99;
  36672. t[71] = 100;
  36673. t[72] = 101;
  36674. t[73] = 102;
  36675. t[74] = 103;
  36676. t[75] = 104;
  36677. t[76] = 105;
  36678. t[77] = 106;
  36679. t[78] = 107;
  36680. t[79] = 108;
  36681. t[80] = 109;
  36682. t[81] = 110;
  36683. t[82] = 111;
  36684. t[83] = 112;
  36685. t[84] = 113;
  36686. t[85] = 114;
  36687. t[86] = 115;
  36688. t[87] = 116;
  36689. t[88] = 117;
  36690. t[89] = 118;
  36691. t[90] = 119;
  36692. t[91] = 120;
  36693. t[92] = 121;
  36694. t[93] = 122;
  36695. t[94] = 123;
  36696. t[95] = 124;
  36697. t[96] = 125;
  36698. t[97] = 126;
  36699. t[98] = 196;
  36700. t[99] = 197;
  36701. t[100] = 199;
  36702. t[101] = 201;
  36703. t[102] = 209;
  36704. t[103] = 214;
  36705. t[104] = 220;
  36706. t[105] = 225;
  36707. t[106] = 224;
  36708. t[107] = 226;
  36709. t[108] = 228;
  36710. t[109] = 227;
  36711. t[110] = 229;
  36712. t[111] = 231;
  36713. t[112] = 233;
  36714. t[113] = 232;
  36715. t[114] = 234;
  36716. t[115] = 235;
  36717. t[116] = 237;
  36718. t[117] = 236;
  36719. t[118] = 238;
  36720. t[119] = 239;
  36721. t[120] = 241;
  36722. t[121] = 243;
  36723. t[122] = 242;
  36724. t[123] = 244;
  36725. t[124] = 246;
  36726. t[125] = 245;
  36727. t[126] = 250;
  36728. t[127] = 249;
  36729. t[128] = 251;
  36730. t[129] = 252;
  36731. t[130] = 8224;
  36732. t[131] = 176;
  36733. t[132] = 162;
  36734. t[133] = 163;
  36735. t[134] = 167;
  36736. t[135] = 8226;
  36737. t[136] = 182;
  36738. t[137] = 223;
  36739. t[138] = 174;
  36740. t[139] = 169;
  36741. t[140] = 8482;
  36742. t[141] = 180;
  36743. t[142] = 168;
  36744. t[143] = 8800;
  36745. t[144] = 198;
  36746. t[145] = 216;
  36747. t[146] = 8734;
  36748. t[147] = 177;
  36749. t[148] = 8804;
  36750. t[149] = 8805;
  36751. t[150] = 165;
  36752. t[151] = 181;
  36753. t[152] = 8706;
  36754. t[153] = 8721;
  36755. t[154] = 8719;
  36756. t[156] = 8747;
  36757. t[157] = 170;
  36758. t[158] = 186;
  36759. t[159] = 8486;
  36760. t[160] = 230;
  36761. t[161] = 248;
  36762. t[162] = 191;
  36763. t[163] = 161;
  36764. t[164] = 172;
  36765. t[165] = 8730;
  36766. t[166] = 402;
  36767. t[167] = 8776;
  36768. t[168] = 8710;
  36769. t[169] = 171;
  36770. t[170] = 187;
  36771. t[171] = 8230;
  36772. t[200] = 193;
  36773. t[203] = 205;
  36774. t[210] = 218;
  36775. t[223] = 711;
  36776. t[224] = 321;
  36777. t[225] = 322;
  36778. t[226] = 352;
  36779. t[227] = 353;
  36780. t[228] = 381;
  36781. t[229] = 382;
  36782. t[233] = 221;
  36783. t[234] = 253;
  36784. t[252] = 263;
  36785. t[253] = 268;
  36786. t[254] = 269;
  36787. t[258] = 258;
  36788. t[260] = 260;
  36789. t[261] = 261;
  36790. t[265] = 280;
  36791. t[266] = 281;
  36792. t[267] = 282;
  36793. t[268] = 283;
  36794. t[269] = 313;
  36795. t[275] = 323;
  36796. t[276] = 324;
  36797. t[278] = 328;
  36798. t[283] = 344;
  36799. t[284] = 345;
  36800. t[285] = 346;
  36801. t[286] = 347;
  36802. t[292] = 367;
  36803. t[295] = 377;
  36804. t[296] = 378;
  36805. t[298] = 380;
  36806. t[305] = 963;
  36807. t[306] = 964;
  36808. t[307] = 966;
  36809. t[308] = 8215;
  36810. t[309] = 8252;
  36811. t[310] = 8319;
  36812. t[311] = 8359;
  36813. t[312] = 8592;
  36814. t[313] = 8593;
  36815. t[337] = 9552;
  36816. t[493] = 1039;
  36817. t[494] = 1040;
  36818. t[705] = 1524;
  36819. t[706] = 8362;
  36820. t[710] = 64288;
  36821. t[711] = 64298;
  36822. t[759] = 1617;
  36823. t[761] = 1776;
  36824. t[763] = 1778;
  36825. t[775] = 1652;
  36826. t[777] = 1764;
  36827. t[778] = 1780;
  36828. t[779] = 1781;
  36829. t[780] = 1782;
  36830. t[782] = 771;
  36831. t[783] = 64726;
  36832. t[786] = 8363;
  36833. t[788] = 8532;
  36834. t[790] = 768;
  36835. t[791] = 769;
  36836. t[792] = 768;
  36837. t[795] = 803;
  36838. t[797] = 64336;
  36839. t[798] = 64337;
  36840. t[799] = 64342;
  36841. t[800] = 64343;
  36842. t[801] = 64344;
  36843. t[802] = 64345;
  36844. t[803] = 64362;
  36845. t[804] = 64363;
  36846. t[805] = 64364;
  36847. t[2424] = 7821;
  36848. t[2425] = 7822;
  36849. t[2426] = 7823;
  36850. t[2427] = 7824;
  36851. t[2428] = 7825;
  36852. t[2429] = 7826;
  36853. t[2430] = 7827;
  36854. t[2433] = 7682;
  36855. t[2678] = 8045;
  36856. t[2679] = 8046;
  36857. t[2830] = 1552;
  36858. t[2838] = 686;
  36859. t[2840] = 751;
  36860. t[2842] = 753;
  36861. t[2843] = 754;
  36862. t[2844] = 755;
  36863. t[2846] = 757;
  36864. t[2856] = 767;
  36865. t[2857] = 848;
  36866. t[2858] = 849;
  36867. t[2862] = 853;
  36868. t[2863] = 854;
  36869. t[2864] = 855;
  36870. t[2865] = 861;
  36871. t[2866] = 862;
  36872. t[2906] = 7460;
  36873. t[2908] = 7462;
  36874. t[2909] = 7463;
  36875. t[2910] = 7464;
  36876. t[2912] = 7466;
  36877. t[2913] = 7467;
  36878. t[2914] = 7468;
  36879. t[2916] = 7470;
  36880. t[2917] = 7471;
  36881. t[2918] = 7472;
  36882. t[2920] = 7474;
  36883. t[2921] = 7475;
  36884. t[2922] = 7476;
  36885. t[2924] = 7478;
  36886. t[2925] = 7479;
  36887. t[2926] = 7480;
  36888. t[2928] = 7482;
  36889. t[2929] = 7483;
  36890. t[2930] = 7484;
  36891. t[2932] = 7486;
  36892. t[2933] = 7487;
  36893. t[2934] = 7488;
  36894. t[2936] = 7490;
  36895. t[2937] = 7491;
  36896. t[2938] = 7492;
  36897. t[2940] = 7494;
  36898. t[2941] = 7495;
  36899. t[2942] = 7496;
  36900. t[2944] = 7498;
  36901. t[2946] = 7500;
  36902. t[2948] = 7502;
  36903. t[2950] = 7504;
  36904. t[2951] = 7505;
  36905. t[2952] = 7506;
  36906. t[2954] = 7508;
  36907. t[2955] = 7509;
  36908. t[2956] = 7510;
  36909. t[2958] = 7512;
  36910. t[2959] = 7513;
  36911. t[2960] = 7514;
  36912. t[2962] = 7516;
  36913. t[2963] = 7517;
  36914. t[2964] = 7518;
  36915. t[2966] = 7520;
  36916. t[2967] = 7521;
  36917. t[2968] = 7522;
  36918. t[2970] = 7524;
  36919. t[2971] = 7525;
  36920. t[2972] = 7526;
  36921. t[2974] = 7528;
  36922. t[2975] = 7529;
  36923. t[2976] = 7530;
  36924. t[2978] = 1537;
  36925. t[2979] = 1538;
  36926. t[2980] = 1539;
  36927. t[2982] = 1549;
  36928. t[2983] = 1551;
  36929. t[2984] = 1552;
  36930. t[2986] = 1554;
  36931. t[2987] = 1555;
  36932. t[2988] = 1556;
  36933. t[2990] = 1623;
  36934. t[2991] = 1624;
  36935. t[2995] = 1775;
  36936. t[2999] = 1791;
  36937. t[3002] = 64290;
  36938. t[3003] = 64291;
  36939. t[3004] = 64292;
  36940. t[3006] = 64294;
  36941. t[3007] = 64295;
  36942. t[3008] = 64296;
  36943. t[3011] = 1900;
  36944. t[3014] = 8223;
  36945. t[3015] = 8244;
  36946. t[3017] = 7532;
  36947. t[3018] = 7533;
  36948. t[3019] = 7534;
  36949. t[3075] = 7590;
  36950. t[3076] = 7591;
  36951. t[3079] = 7594;
  36952. t[3080] = 7595;
  36953. t[3083] = 7598;
  36954. t[3084] = 7599;
  36955. t[3087] = 7602;
  36956. t[3088] = 7603;
  36957. t[3091] = 7606;
  36958. t[3092] = 7607;
  36959. t[3095] = 7610;
  36960. t[3096] = 7611;
  36961. t[3099] = 7614;
  36962. t[3100] = 7615;
  36963. t[3103] = 7618;
  36964. t[3104] = 7619;
  36965. t[3107] = 8337;
  36966. t[3108] = 8338;
  36967. t[3116] = 1884;
  36968. t[3119] = 1885;
  36969. t[3120] = 1885;
  36970. t[3123] = 1886;
  36971. t[3124] = 1886;
  36972. t[3127] = 1887;
  36973. t[3128] = 1887;
  36974. t[3131] = 1888;
  36975. t[3132] = 1888;
  36976. t[3135] = 1889;
  36977. t[3136] = 1889;
  36978. t[3139] = 1890;
  36979. t[3140] = 1890;
  36980. t[3143] = 1891;
  36981. t[3144] = 1891;
  36982. t[3147] = 1892;
  36983. t[3148] = 1892;
  36984. t[3153] = 580;
  36985. t[3154] = 581;
  36986. t[3157] = 584;
  36987. t[3158] = 585;
  36988. t[3161] = 588;
  36989. t[3162] = 589;
  36990. t[3165] = 891;
  36991. t[3166] = 892;
  36992. t[3169] = 1274;
  36993. t[3170] = 1275;
  36994. t[3173] = 1278;
  36995. t[3174] = 1279;
  36996. t[3181] = 7622;
  36997. t[3182] = 7623;
  36998. t[3282] = 11799;
  36999. t[3316] = 578;
  37000. t[3379] = 42785;
  37001. t[3393] = 1159;
  37002. t[3416] = 8377;
  37003. });
  37004. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37005. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37006. t[227] = 322;
  37007. t[264] = 261;
  37008. t[291] = 346;
  37009. });
  37010. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37011. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37012. t[1] = 32;
  37013. t[4] = 65;
  37014. t[6] = 193;
  37015. t[17] = 66;
  37016. t[18] = 67;
  37017. t[21] = 268;
  37018. t[24] = 68;
  37019. t[28] = 69;
  37020. t[30] = 201;
  37021. t[32] = 282;
  37022. t[38] = 70;
  37023. t[39] = 71;
  37024. t[44] = 72;
  37025. t[47] = 73;
  37026. t[49] = 205;
  37027. t[58] = 74;
  37028. t[60] = 75;
  37029. t[62] = 76;
  37030. t[68] = 77;
  37031. t[69] = 78;
  37032. t[75] = 79;
  37033. t[87] = 80;
  37034. t[89] = 81;
  37035. t[90] = 82;
  37036. t[92] = 344;
  37037. t[94] = 83;
  37038. t[97] = 352;
  37039. t[100] = 84;
  37040. t[104] = 85;
  37041. t[115] = 86;
  37042. t[116] = 87;
  37043. t[121] = 88;
  37044. t[122] = 89;
  37045. t[124] = 221;
  37046. t[127] = 90;
  37047. t[129] = 381;
  37048. t[258] = 97;
  37049. t[260] = 225;
  37050. t[268] = 261;
  37051. t[271] = 98;
  37052. t[272] = 99;
  37053. t[273] = 263;
  37054. t[275] = 269;
  37055. t[282] = 100;
  37056. t[286] = 101;
  37057. t[288] = 233;
  37058. t[290] = 283;
  37059. t[295] = 281;
  37060. t[296] = 102;
  37061. t[336] = 103;
  37062. t[346] = 104;
  37063. t[349] = 105;
  37064. t[351] = 237;
  37065. t[361] = 106;
  37066. t[364] = 107;
  37067. t[367] = 108;
  37068. t[371] = 322;
  37069. t[373] = 109;
  37070. t[374] = 110;
  37071. t[381] = 111;
  37072. t[383] = 243;
  37073. t[393] = 112;
  37074. t[395] = 113;
  37075. t[396] = 114;
  37076. t[398] = 345;
  37077. t[400] = 115;
  37078. t[401] = 347;
  37079. t[403] = 353;
  37080. t[410] = 116;
  37081. t[437] = 117;
  37082. t[448] = 118;
  37083. t[449] = 119;
  37084. t[454] = 120;
  37085. t[455] = 121;
  37086. t[457] = 253;
  37087. t[460] = 122;
  37088. t[462] = 382;
  37089. t[463] = 380;
  37090. t[853] = 44;
  37091. t[855] = 58;
  37092. t[856] = 46;
  37093. t[876] = 47;
  37094. t[878] = 45;
  37095. t[882] = 45;
  37096. t[894] = 40;
  37097. t[895] = 41;
  37098. t[896] = 91;
  37099. t[897] = 93;
  37100. t[923] = 64;
  37101. t[1004] = 48;
  37102. t[1005] = 49;
  37103. t[1006] = 50;
  37104. t[1007] = 51;
  37105. t[1008] = 52;
  37106. t[1009] = 53;
  37107. t[1010] = 54;
  37108. t[1011] = 55;
  37109. t[1012] = 56;
  37110. t[1013] = 57;
  37111. t[1081] = 37;
  37112. t[1085] = 43;
  37113. t[1086] = 45;
  37114. });
  37115. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37116. function getStandardFontName(name) {
  37117. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37118. const stdFontMap = getStdFontMap();
  37119. return stdFontMap[fontName];
  37120. }
  37121. /***/ }),
  37122. /* 48 */
  37123. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37124. Object.defineProperty(exports, "__esModule", ({
  37125. value: true
  37126. }));
  37127. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37128. var _util = __w_pdfjs_require__(2);
  37129. class ToUnicodeMap {
  37130. constructor(cmap = []) {
  37131. this._map = cmap;
  37132. }
  37133. get length() {
  37134. return this._map.length;
  37135. }
  37136. forEach(callback) {
  37137. for (const charCode in this._map) {
  37138. callback(charCode, this._map[charCode].charCodeAt(0));
  37139. }
  37140. }
  37141. has(i) {
  37142. return this._map[i] !== undefined;
  37143. }
  37144. get(i) {
  37145. return this._map[i];
  37146. }
  37147. charCodeOf(value) {
  37148. const map = this._map;
  37149. if (map.length <= 0x10000) {
  37150. return map.indexOf(value);
  37151. }
  37152. for (const charCode in map) {
  37153. if (map[charCode] === value) {
  37154. return charCode | 0;
  37155. }
  37156. }
  37157. return -1;
  37158. }
  37159. amend(map) {
  37160. for (const charCode in map) {
  37161. this._map[charCode] = map[charCode];
  37162. }
  37163. }
  37164. }
  37165. exports.ToUnicodeMap = ToUnicodeMap;
  37166. class IdentityToUnicodeMap {
  37167. constructor(firstChar, lastChar) {
  37168. this.firstChar = firstChar;
  37169. this.lastChar = lastChar;
  37170. }
  37171. get length() {
  37172. return this.lastChar + 1 - this.firstChar;
  37173. }
  37174. forEach(callback) {
  37175. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37176. callback(i, i);
  37177. }
  37178. }
  37179. has(i) {
  37180. return this.firstChar <= i && i <= this.lastChar;
  37181. }
  37182. get(i) {
  37183. if (this.firstChar <= i && i <= this.lastChar) {
  37184. return String.fromCharCode(i);
  37185. }
  37186. return undefined;
  37187. }
  37188. charCodeOf(v) {
  37189. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37190. }
  37191. amend(map) {
  37192. (0, _util.unreachable)("Should not call amend()");
  37193. }
  37194. }
  37195. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37196. /***/ }),
  37197. /* 49 */
  37198. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37199. Object.defineProperty(exports, "__esModule", ({
  37200. value: true
  37201. }));
  37202. exports.CFFFont = void 0;
  37203. var _cff_parser = __w_pdfjs_require__(45);
  37204. var _fonts_utils = __w_pdfjs_require__(18);
  37205. var _util = __w_pdfjs_require__(2);
  37206. class CFFFont {
  37207. constructor(file, properties) {
  37208. this.properties = properties;
  37209. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37210. this.cff = parser.parse();
  37211. this.cff.duplicateFirstGlyph();
  37212. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37213. this.seacs = this.cff.seacs;
  37214. try {
  37215. this.data = compiler.compile();
  37216. } catch (e) {
  37217. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37218. this.data = file;
  37219. }
  37220. this._createBuiltInEncoding();
  37221. }
  37222. get numGlyphs() {
  37223. return this.cff.charStrings.count;
  37224. }
  37225. getCharset() {
  37226. return this.cff.charset.charset;
  37227. }
  37228. getGlyphMapping() {
  37229. const cff = this.cff;
  37230. const properties = this.properties;
  37231. const charsets = cff.charset.charset;
  37232. let charCodeToGlyphId;
  37233. let glyphId;
  37234. if (properties.composite) {
  37235. charCodeToGlyphId = Object.create(null);
  37236. let charCode;
  37237. if (cff.isCIDFont) {
  37238. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37239. const cid = charsets[glyphId];
  37240. charCode = properties.cMap.charCodeOf(cid);
  37241. charCodeToGlyphId[charCode] = glyphId;
  37242. }
  37243. } else {
  37244. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  37245. charCode = properties.cMap.charCodeOf(glyphId);
  37246. charCodeToGlyphId[charCode] = glyphId;
  37247. }
  37248. }
  37249. return charCodeToGlyphId;
  37250. }
  37251. let encoding = cff.encoding ? cff.encoding.encoding : null;
  37252. if (properties.isInternalFont) {
  37253. encoding = properties.defaultEncoding;
  37254. }
  37255. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  37256. return charCodeToGlyphId;
  37257. }
  37258. hasGlyphId(id) {
  37259. return this.cff.hasGlyphId(id);
  37260. }
  37261. _createBuiltInEncoding() {
  37262. const {
  37263. charset,
  37264. encoding
  37265. } = this.cff;
  37266. if (!charset || !encoding) {
  37267. return;
  37268. }
  37269. const charsets = charset.charset,
  37270. encodings = encoding.encoding;
  37271. const map = [];
  37272. for (const charCode in encodings) {
  37273. const glyphId = encodings[charCode];
  37274. if (glyphId >= 0) {
  37275. const glyphName = charsets[glyphId];
  37276. if (glyphName) {
  37277. map[charCode] = glyphName;
  37278. }
  37279. }
  37280. }
  37281. if (map.length > 0) {
  37282. this.properties.builtInEncoding = map;
  37283. }
  37284. }
  37285. }
  37286. exports.CFFFont = CFFFont;
  37287. /***/ }),
  37288. /* 50 */
  37289. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37290. Object.defineProperty(exports, "__esModule", ({
  37291. value: true
  37292. }));
  37293. exports.FontRendererFactory = void 0;
  37294. var _util = __w_pdfjs_require__(2);
  37295. var _cff_parser = __w_pdfjs_require__(45);
  37296. var _glyphlist = __w_pdfjs_require__(20);
  37297. var _encodings = __w_pdfjs_require__(19);
  37298. var _stream = __w_pdfjs_require__(10);
  37299. function getUint32(data, offset) {
  37300. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  37301. }
  37302. function getUint16(data, offset) {
  37303. return data[offset] << 8 | data[offset + 1];
  37304. }
  37305. function getInt16(data, offset) {
  37306. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  37307. }
  37308. function getInt8(data, offset) {
  37309. return data[offset] << 24 >> 24;
  37310. }
  37311. function getFloat214(data, offset) {
  37312. return getInt16(data, offset) / 16384;
  37313. }
  37314. function getSubroutineBias(subrs) {
  37315. const numSubrs = subrs.length;
  37316. let bias = 32768;
  37317. if (numSubrs < 1240) {
  37318. bias = 107;
  37319. } else if (numSubrs < 33900) {
  37320. bias = 1131;
  37321. }
  37322. return bias;
  37323. }
  37324. function parseCmap(data, start, end) {
  37325. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  37326. const format = getUint16(data, start + offset);
  37327. let ranges, p, i;
  37328. if (format === 4) {
  37329. getUint16(data, start + offset + 2);
  37330. const segCount = getUint16(data, start + offset + 6) >> 1;
  37331. p = start + offset + 14;
  37332. ranges = [];
  37333. for (i = 0; i < segCount; i++, p += 2) {
  37334. ranges[i] = {
  37335. end: getUint16(data, p)
  37336. };
  37337. }
  37338. p += 2;
  37339. for (i = 0; i < segCount; i++, p += 2) {
  37340. ranges[i].start = getUint16(data, p);
  37341. }
  37342. for (i = 0; i < segCount; i++, p += 2) {
  37343. ranges[i].idDelta = getUint16(data, p);
  37344. }
  37345. for (i = 0; i < segCount; i++, p += 2) {
  37346. let idOffset = getUint16(data, p);
  37347. if (idOffset === 0) {
  37348. continue;
  37349. }
  37350. ranges[i].ids = [];
  37351. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  37352. ranges[i].ids[j] = getUint16(data, p + idOffset);
  37353. idOffset += 2;
  37354. }
  37355. }
  37356. return ranges;
  37357. } else if (format === 12) {
  37358. const groups = getUint32(data, start + offset + 12);
  37359. p = start + offset + 16;
  37360. ranges = [];
  37361. for (i = 0; i < groups; i++) {
  37362. start = getUint32(data, p);
  37363. ranges.push({
  37364. start,
  37365. end: getUint32(data, p + 4),
  37366. idDelta: getUint32(data, p + 8) - start
  37367. });
  37368. p += 12;
  37369. }
  37370. return ranges;
  37371. }
  37372. throw new _util.FormatError(`unsupported cmap: ${format}`);
  37373. }
  37374. function parseCff(data, start, end, seacAnalysisEnabled) {
  37375. const properties = {};
  37376. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  37377. const cff = parser.parse();
  37378. return {
  37379. glyphs: cff.charStrings.objects,
  37380. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  37381. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  37382. isCFFCIDFont: cff.isCIDFont,
  37383. fdSelect: cff.fdSelect,
  37384. fdArray: cff.fdArray
  37385. };
  37386. }
  37387. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  37388. let itemSize, itemDecode;
  37389. if (isGlyphLocationsLong) {
  37390. itemSize = 4;
  37391. itemDecode = getUint32;
  37392. } else {
  37393. itemSize = 2;
  37394. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  37395. }
  37396. const glyphs = [];
  37397. let startOffset = itemDecode(loca, 0);
  37398. for (let j = itemSize; j < loca.length; j += itemSize) {
  37399. const endOffset = itemDecode(loca, j);
  37400. glyphs.push(glyf.subarray(startOffset, endOffset));
  37401. startOffset = endOffset;
  37402. }
  37403. return glyphs;
  37404. }
  37405. function lookupCmap(ranges, unicode) {
  37406. const code = unicode.codePointAt(0);
  37407. let gid = 0,
  37408. l = 0,
  37409. r = ranges.length - 1;
  37410. while (l < r) {
  37411. const c = l + r + 1 >> 1;
  37412. if (code < ranges[c].start) {
  37413. r = c - 1;
  37414. } else {
  37415. l = c;
  37416. }
  37417. }
  37418. if (ranges[l].start <= code && code <= ranges[l].end) {
  37419. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  37420. }
  37421. return {
  37422. charCode: code,
  37423. glyphId: gid
  37424. };
  37425. }
  37426. function compileGlyf(code, cmds, font) {
  37427. function moveTo(x, y) {
  37428. cmds.push({
  37429. cmd: "moveTo",
  37430. args: [x, y]
  37431. });
  37432. }
  37433. function lineTo(x, y) {
  37434. cmds.push({
  37435. cmd: "lineTo",
  37436. args: [x, y]
  37437. });
  37438. }
  37439. function quadraticCurveTo(xa, ya, x, y) {
  37440. cmds.push({
  37441. cmd: "quadraticCurveTo",
  37442. args: [xa, ya, x, y]
  37443. });
  37444. }
  37445. let i = 0;
  37446. const numberOfContours = getInt16(code, i);
  37447. let flags;
  37448. let x = 0,
  37449. y = 0;
  37450. i += 10;
  37451. if (numberOfContours < 0) {
  37452. do {
  37453. flags = getUint16(code, i);
  37454. const glyphIndex = getUint16(code, i + 2);
  37455. i += 4;
  37456. let arg1, arg2;
  37457. if (flags & 0x01) {
  37458. if (flags & 0x02) {
  37459. arg1 = getInt16(code, i);
  37460. arg2 = getInt16(code, i + 2);
  37461. } else {
  37462. arg1 = getUint16(code, i);
  37463. arg2 = getUint16(code, i + 2);
  37464. }
  37465. i += 4;
  37466. } else {
  37467. if (flags & 0x02) {
  37468. arg1 = getInt8(code, i++);
  37469. arg2 = getInt8(code, i++);
  37470. } else {
  37471. arg1 = code[i++];
  37472. arg2 = code[i++];
  37473. }
  37474. }
  37475. if (flags & 0x02) {
  37476. x = arg1;
  37477. y = arg2;
  37478. } else {
  37479. x = 0;
  37480. y = 0;
  37481. }
  37482. let scaleX = 1,
  37483. scaleY = 1,
  37484. scale01 = 0,
  37485. scale10 = 0;
  37486. if (flags & 0x08) {
  37487. scaleX = scaleY = getFloat214(code, i);
  37488. i += 2;
  37489. } else if (flags & 0x40) {
  37490. scaleX = getFloat214(code, i);
  37491. scaleY = getFloat214(code, i + 2);
  37492. i += 4;
  37493. } else if (flags & 0x80) {
  37494. scaleX = getFloat214(code, i);
  37495. scale01 = getFloat214(code, i + 2);
  37496. scale10 = getFloat214(code, i + 4);
  37497. scaleY = getFloat214(code, i + 6);
  37498. i += 8;
  37499. }
  37500. const subglyph = font.glyphs[glyphIndex];
  37501. if (subglyph) {
  37502. cmds.push({
  37503. cmd: "save"
  37504. }, {
  37505. cmd: "transform",
  37506. args: [scaleX, scale01, scale10, scaleY, x, y]
  37507. });
  37508. if (!(flags & 0x02)) {}
  37509. compileGlyf(subglyph, cmds, font);
  37510. cmds.push({
  37511. cmd: "restore"
  37512. });
  37513. }
  37514. } while (flags & 0x20);
  37515. } else {
  37516. const endPtsOfContours = [];
  37517. let j, jj;
  37518. for (j = 0; j < numberOfContours; j++) {
  37519. endPtsOfContours.push(getUint16(code, i));
  37520. i += 2;
  37521. }
  37522. const instructionLength = getUint16(code, i);
  37523. i += 2 + instructionLength;
  37524. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  37525. const points = [];
  37526. while (points.length < numberOfPoints) {
  37527. flags = code[i++];
  37528. let repeat = 1;
  37529. if (flags & 0x08) {
  37530. repeat += code[i++];
  37531. }
  37532. while (repeat-- > 0) {
  37533. points.push({
  37534. flags
  37535. });
  37536. }
  37537. }
  37538. for (j = 0; j < numberOfPoints; j++) {
  37539. switch (points[j].flags & 0x12) {
  37540. case 0x00:
  37541. x += getInt16(code, i);
  37542. i += 2;
  37543. break;
  37544. case 0x02:
  37545. x -= code[i++];
  37546. break;
  37547. case 0x12:
  37548. x += code[i++];
  37549. break;
  37550. }
  37551. points[j].x = x;
  37552. }
  37553. for (j = 0; j < numberOfPoints; j++) {
  37554. switch (points[j].flags & 0x24) {
  37555. case 0x00:
  37556. y += getInt16(code, i);
  37557. i += 2;
  37558. break;
  37559. case 0x04:
  37560. y -= code[i++];
  37561. break;
  37562. case 0x24:
  37563. y += code[i++];
  37564. break;
  37565. }
  37566. points[j].y = y;
  37567. }
  37568. let startPoint = 0;
  37569. for (i = 0; i < numberOfContours; i++) {
  37570. const endPoint = endPtsOfContours[i];
  37571. const contour = points.slice(startPoint, endPoint + 1);
  37572. if (contour[0].flags & 1) {
  37573. contour.push(contour[0]);
  37574. } else if (contour[contour.length - 1].flags & 1) {
  37575. contour.unshift(contour[contour.length - 1]);
  37576. } else {
  37577. const p = {
  37578. flags: 1,
  37579. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  37580. y: (contour[0].y + contour[contour.length - 1].y) / 2
  37581. };
  37582. contour.unshift(p);
  37583. contour.push(p);
  37584. }
  37585. moveTo(contour[0].x, contour[0].y);
  37586. for (j = 1, jj = contour.length; j < jj; j++) {
  37587. if (contour[j].flags & 1) {
  37588. lineTo(contour[j].x, contour[j].y);
  37589. } else if (contour[j + 1].flags & 1) {
  37590. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  37591. j++;
  37592. } else {
  37593. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  37594. }
  37595. }
  37596. startPoint = endPoint + 1;
  37597. }
  37598. }
  37599. }
  37600. function compileCharString(charStringCode, cmds, font, glyphId) {
  37601. function moveTo(x, y) {
  37602. cmds.push({
  37603. cmd: "moveTo",
  37604. args: [x, y]
  37605. });
  37606. }
  37607. function lineTo(x, y) {
  37608. cmds.push({
  37609. cmd: "lineTo",
  37610. args: [x, y]
  37611. });
  37612. }
  37613. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  37614. cmds.push({
  37615. cmd: "bezierCurveTo",
  37616. args: [x1, y1, x2, y2, x, y]
  37617. });
  37618. }
  37619. const stack = [];
  37620. let x = 0,
  37621. y = 0;
  37622. let stems = 0;
  37623. function parse(code) {
  37624. let i = 0;
  37625. while (i < code.length) {
  37626. let stackClean = false;
  37627. let v = code[i++];
  37628. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  37629. switch (v) {
  37630. case 1:
  37631. stems += stack.length >> 1;
  37632. stackClean = true;
  37633. break;
  37634. case 3:
  37635. stems += stack.length >> 1;
  37636. stackClean = true;
  37637. break;
  37638. case 4:
  37639. y += stack.pop();
  37640. moveTo(x, y);
  37641. stackClean = true;
  37642. break;
  37643. case 5:
  37644. while (stack.length > 0) {
  37645. x += stack.shift();
  37646. y += stack.shift();
  37647. lineTo(x, y);
  37648. }
  37649. break;
  37650. case 6:
  37651. while (stack.length > 0) {
  37652. x += stack.shift();
  37653. lineTo(x, y);
  37654. if (stack.length === 0) {
  37655. break;
  37656. }
  37657. y += stack.shift();
  37658. lineTo(x, y);
  37659. }
  37660. break;
  37661. case 7:
  37662. while (stack.length > 0) {
  37663. y += stack.shift();
  37664. lineTo(x, y);
  37665. if (stack.length === 0) {
  37666. break;
  37667. }
  37668. x += stack.shift();
  37669. lineTo(x, y);
  37670. }
  37671. break;
  37672. case 8:
  37673. while (stack.length > 0) {
  37674. xa = x + stack.shift();
  37675. ya = y + stack.shift();
  37676. xb = xa + stack.shift();
  37677. yb = ya + stack.shift();
  37678. x = xb + stack.shift();
  37679. y = yb + stack.shift();
  37680. bezierCurveTo(xa, ya, xb, yb, x, y);
  37681. }
  37682. break;
  37683. case 10:
  37684. n = stack.pop();
  37685. subrCode = null;
  37686. if (font.isCFFCIDFont) {
  37687. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  37688. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  37689. const fontDict = font.fdArray[fdIndex];
  37690. let subrs;
  37691. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  37692. subrs = fontDict.privateDict.subrsIndex.objects;
  37693. }
  37694. if (subrs) {
  37695. n += getSubroutineBias(subrs);
  37696. subrCode = subrs[n];
  37697. }
  37698. } else {
  37699. (0, _util.warn)("Invalid fd index for glyph index.");
  37700. }
  37701. } else {
  37702. subrCode = font.subrs[n + font.subrsBias];
  37703. }
  37704. if (subrCode) {
  37705. parse(subrCode);
  37706. }
  37707. break;
  37708. case 11:
  37709. return;
  37710. case 12:
  37711. v = code[i++];
  37712. switch (v) {
  37713. case 34:
  37714. xa = x + stack.shift();
  37715. xb = xa + stack.shift();
  37716. y1 = y + stack.shift();
  37717. x = xb + stack.shift();
  37718. bezierCurveTo(xa, y, xb, y1, x, y1);
  37719. xa = x + stack.shift();
  37720. xb = xa + stack.shift();
  37721. x = xb + stack.shift();
  37722. bezierCurveTo(xa, y1, xb, y, x, y);
  37723. break;
  37724. case 35:
  37725. xa = x + stack.shift();
  37726. ya = y + stack.shift();
  37727. xb = xa + stack.shift();
  37728. yb = ya + stack.shift();
  37729. x = xb + stack.shift();
  37730. y = yb + stack.shift();
  37731. bezierCurveTo(xa, ya, xb, yb, x, y);
  37732. xa = x + stack.shift();
  37733. ya = y + stack.shift();
  37734. xb = xa + stack.shift();
  37735. yb = ya + stack.shift();
  37736. x = xb + stack.shift();
  37737. y = yb + stack.shift();
  37738. bezierCurveTo(xa, ya, xb, yb, x, y);
  37739. stack.pop();
  37740. break;
  37741. case 36:
  37742. xa = x + stack.shift();
  37743. y1 = y + stack.shift();
  37744. xb = xa + stack.shift();
  37745. y2 = y1 + stack.shift();
  37746. x = xb + stack.shift();
  37747. bezierCurveTo(xa, y1, xb, y2, x, y2);
  37748. xa = x + stack.shift();
  37749. xb = xa + stack.shift();
  37750. y3 = y2 + stack.shift();
  37751. x = xb + stack.shift();
  37752. bezierCurveTo(xa, y2, xb, y3, x, y);
  37753. break;
  37754. case 37:
  37755. const x0 = x,
  37756. y0 = y;
  37757. xa = x + stack.shift();
  37758. ya = y + stack.shift();
  37759. xb = xa + stack.shift();
  37760. yb = ya + stack.shift();
  37761. x = xb + stack.shift();
  37762. y = yb + stack.shift();
  37763. bezierCurveTo(xa, ya, xb, yb, x, y);
  37764. xa = x + stack.shift();
  37765. ya = y + stack.shift();
  37766. xb = xa + stack.shift();
  37767. yb = ya + stack.shift();
  37768. x = xb;
  37769. y = yb;
  37770. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  37771. x += stack.shift();
  37772. } else {
  37773. y += stack.shift();
  37774. }
  37775. bezierCurveTo(xa, ya, xb, yb, x, y);
  37776. break;
  37777. default:
  37778. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  37779. }
  37780. break;
  37781. case 14:
  37782. if (stack.length >= 4) {
  37783. const achar = stack.pop();
  37784. const bchar = stack.pop();
  37785. y = stack.pop();
  37786. x = stack.pop();
  37787. cmds.push({
  37788. cmd: "save"
  37789. }, {
  37790. cmd: "translate",
  37791. args: [x, y]
  37792. });
  37793. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  37794. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37795. cmds.push({
  37796. cmd: "restore"
  37797. });
  37798. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  37799. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37800. }
  37801. return;
  37802. case 18:
  37803. stems += stack.length >> 1;
  37804. stackClean = true;
  37805. break;
  37806. case 19:
  37807. stems += stack.length >> 1;
  37808. i += stems + 7 >> 3;
  37809. stackClean = true;
  37810. break;
  37811. case 20:
  37812. stems += stack.length >> 1;
  37813. i += stems + 7 >> 3;
  37814. stackClean = true;
  37815. break;
  37816. case 21:
  37817. y += stack.pop();
  37818. x += stack.pop();
  37819. moveTo(x, y);
  37820. stackClean = true;
  37821. break;
  37822. case 22:
  37823. x += stack.pop();
  37824. moveTo(x, y);
  37825. stackClean = true;
  37826. break;
  37827. case 23:
  37828. stems += stack.length >> 1;
  37829. stackClean = true;
  37830. break;
  37831. case 24:
  37832. while (stack.length > 2) {
  37833. xa = x + stack.shift();
  37834. ya = y + stack.shift();
  37835. xb = xa + stack.shift();
  37836. yb = ya + stack.shift();
  37837. x = xb + stack.shift();
  37838. y = yb + stack.shift();
  37839. bezierCurveTo(xa, ya, xb, yb, x, y);
  37840. }
  37841. x += stack.shift();
  37842. y += stack.shift();
  37843. lineTo(x, y);
  37844. break;
  37845. case 25:
  37846. while (stack.length > 6) {
  37847. x += stack.shift();
  37848. y += stack.shift();
  37849. lineTo(x, y);
  37850. }
  37851. xa = x + stack.shift();
  37852. ya = y + stack.shift();
  37853. xb = xa + stack.shift();
  37854. yb = ya + stack.shift();
  37855. x = xb + stack.shift();
  37856. y = yb + stack.shift();
  37857. bezierCurveTo(xa, ya, xb, yb, x, y);
  37858. break;
  37859. case 26:
  37860. if (stack.length % 2) {
  37861. x += stack.shift();
  37862. }
  37863. while (stack.length > 0) {
  37864. xa = x;
  37865. ya = y + stack.shift();
  37866. xb = xa + stack.shift();
  37867. yb = ya + stack.shift();
  37868. x = xb;
  37869. y = yb + stack.shift();
  37870. bezierCurveTo(xa, ya, xb, yb, x, y);
  37871. }
  37872. break;
  37873. case 27:
  37874. if (stack.length % 2) {
  37875. y += stack.shift();
  37876. }
  37877. while (stack.length > 0) {
  37878. xa = x + stack.shift();
  37879. ya = y;
  37880. xb = xa + stack.shift();
  37881. yb = ya + stack.shift();
  37882. x = xb + stack.shift();
  37883. y = yb;
  37884. bezierCurveTo(xa, ya, xb, yb, x, y);
  37885. }
  37886. break;
  37887. case 28:
  37888. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  37889. i += 2;
  37890. break;
  37891. case 29:
  37892. n = stack.pop() + font.gsubrsBias;
  37893. subrCode = font.gsubrs[n];
  37894. if (subrCode) {
  37895. parse(subrCode);
  37896. }
  37897. break;
  37898. case 30:
  37899. while (stack.length > 0) {
  37900. xa = x;
  37901. ya = y + stack.shift();
  37902. xb = xa + stack.shift();
  37903. yb = ya + stack.shift();
  37904. x = xb + stack.shift();
  37905. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37906. bezierCurveTo(xa, ya, xb, yb, x, y);
  37907. if (stack.length === 0) {
  37908. break;
  37909. }
  37910. xa = x + stack.shift();
  37911. ya = y;
  37912. xb = xa + stack.shift();
  37913. yb = ya + stack.shift();
  37914. y = yb + stack.shift();
  37915. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37916. bezierCurveTo(xa, ya, xb, yb, x, y);
  37917. }
  37918. break;
  37919. case 31:
  37920. while (stack.length > 0) {
  37921. xa = x + stack.shift();
  37922. ya = y;
  37923. xb = xa + stack.shift();
  37924. yb = ya + stack.shift();
  37925. y = yb + stack.shift();
  37926. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37927. bezierCurveTo(xa, ya, xb, yb, x, y);
  37928. if (stack.length === 0) {
  37929. break;
  37930. }
  37931. xa = x;
  37932. ya = y + stack.shift();
  37933. xb = xa + stack.shift();
  37934. yb = ya + stack.shift();
  37935. x = xb + stack.shift();
  37936. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37937. bezierCurveTo(xa, ya, xb, yb, x, y);
  37938. }
  37939. break;
  37940. default:
  37941. if (v < 32) {
  37942. throw new _util.FormatError(`unknown operator: ${v}`);
  37943. }
  37944. if (v < 247) {
  37945. stack.push(v - 139);
  37946. } else if (v < 251) {
  37947. stack.push((v - 247) * 256 + code[i++] + 108);
  37948. } else if (v < 255) {
  37949. stack.push(-(v - 251) * 256 - code[i++] - 108);
  37950. } else {
  37951. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  37952. i += 4;
  37953. }
  37954. break;
  37955. }
  37956. if (stackClean) {
  37957. stack.length = 0;
  37958. }
  37959. }
  37960. }
  37961. parse(charStringCode);
  37962. }
  37963. const NOOP = [];
  37964. class CompiledFont {
  37965. constructor(fontMatrix) {
  37966. if (this.constructor === CompiledFont) {
  37967. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  37968. }
  37969. this.fontMatrix = fontMatrix;
  37970. this.compiledGlyphs = Object.create(null);
  37971. this.compiledCharCodeToGlyphId = Object.create(null);
  37972. }
  37973. getPathJs(unicode) {
  37974. const {
  37975. charCode,
  37976. glyphId
  37977. } = lookupCmap(this.cmap, unicode);
  37978. let fn = this.compiledGlyphs[glyphId];
  37979. if (!fn) {
  37980. try {
  37981. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  37982. this.compiledGlyphs[glyphId] = fn;
  37983. } catch (ex) {
  37984. this.compiledGlyphs[glyphId] = NOOP;
  37985. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37986. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37987. }
  37988. throw ex;
  37989. }
  37990. }
  37991. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37992. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37993. }
  37994. return fn;
  37995. }
  37996. compileGlyph(code, glyphId) {
  37997. if (!code || code.length === 0 || code[0] === 14) {
  37998. return NOOP;
  37999. }
  38000. let fontMatrix = this.fontMatrix;
  38001. if (this.isCFFCIDFont) {
  38002. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38003. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38004. const fontDict = this.fdArray[fdIndex];
  38005. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38006. } else {
  38007. (0, _util.warn)("Invalid fd index for glyph index.");
  38008. }
  38009. }
  38010. const cmds = [{
  38011. cmd: "save"
  38012. }, {
  38013. cmd: "transform",
  38014. args: fontMatrix.slice()
  38015. }, {
  38016. cmd: "scale",
  38017. args: ["size", "-size"]
  38018. }];
  38019. this.compileGlyphImpl(code, cmds, glyphId);
  38020. cmds.push({
  38021. cmd: "restore"
  38022. });
  38023. return cmds;
  38024. }
  38025. compileGlyphImpl() {
  38026. (0, _util.unreachable)("Children classes should implement this.");
  38027. }
  38028. hasBuiltPath(unicode) {
  38029. const {
  38030. charCode,
  38031. glyphId
  38032. } = lookupCmap(this.cmap, unicode);
  38033. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38034. }
  38035. }
  38036. class TrueTypeCompiled extends CompiledFont {
  38037. constructor(glyphs, cmap, fontMatrix) {
  38038. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38039. this.glyphs = glyphs;
  38040. this.cmap = cmap;
  38041. }
  38042. compileGlyphImpl(code, cmds) {
  38043. compileGlyf(code, cmds, this);
  38044. }
  38045. }
  38046. class Type2Compiled extends CompiledFont {
  38047. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38048. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38049. this.glyphs = cffInfo.glyphs;
  38050. this.gsubrs = cffInfo.gsubrs || [];
  38051. this.subrs = cffInfo.subrs || [];
  38052. this.cmap = cmap;
  38053. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38054. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38055. this.subrsBias = getSubroutineBias(this.subrs);
  38056. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38057. this.fdSelect = cffInfo.fdSelect;
  38058. this.fdArray = cffInfo.fdArray;
  38059. }
  38060. compileGlyphImpl(code, cmds, glyphId) {
  38061. compileCharString(code, cmds, this, glyphId);
  38062. }
  38063. }
  38064. class FontRendererFactory {
  38065. static create(font, seacAnalysisEnabled) {
  38066. const data = new Uint8Array(font.data);
  38067. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38068. const numTables = getUint16(data, 4);
  38069. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38070. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38071. const offset = getUint32(data, p + 8);
  38072. const length = getUint32(data, p + 12);
  38073. switch (tag) {
  38074. case "cmap":
  38075. cmap = parseCmap(data, offset, offset + length);
  38076. break;
  38077. case "glyf":
  38078. glyf = data.subarray(offset, offset + length);
  38079. break;
  38080. case "loca":
  38081. loca = data.subarray(offset, offset + length);
  38082. break;
  38083. case "head":
  38084. unitsPerEm = getUint16(data, offset + 18);
  38085. indexToLocFormat = getUint16(data, offset + 50);
  38086. break;
  38087. case "CFF ":
  38088. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38089. break;
  38090. }
  38091. }
  38092. if (glyf) {
  38093. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38094. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38095. }
  38096. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38097. }
  38098. }
  38099. exports.FontRendererFactory = FontRendererFactory;
  38100. /***/ }),
  38101. /* 51 */
  38102. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38103. Object.defineProperty(exports, "__esModule", ({
  38104. value: true
  38105. }));
  38106. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38107. var _core_utils = __w_pdfjs_require__(8);
  38108. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38109. t.Courier = 600;
  38110. t["Courier-Bold"] = 600;
  38111. t["Courier-BoldOblique"] = 600;
  38112. t["Courier-Oblique"] = 600;
  38113. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38114. t.space = 278;
  38115. t.exclam = 278;
  38116. t.quotedbl = 355;
  38117. t.numbersign = 556;
  38118. t.dollar = 556;
  38119. t.percent = 889;
  38120. t.ampersand = 667;
  38121. t.quoteright = 222;
  38122. t.parenleft = 333;
  38123. t.parenright = 333;
  38124. t.asterisk = 389;
  38125. t.plus = 584;
  38126. t.comma = 278;
  38127. t.hyphen = 333;
  38128. t.period = 278;
  38129. t.slash = 278;
  38130. t.zero = 556;
  38131. t.one = 556;
  38132. t.two = 556;
  38133. t.three = 556;
  38134. t.four = 556;
  38135. t.five = 556;
  38136. t.six = 556;
  38137. t.seven = 556;
  38138. t.eight = 556;
  38139. t.nine = 556;
  38140. t.colon = 278;
  38141. t.semicolon = 278;
  38142. t.less = 584;
  38143. t.equal = 584;
  38144. t.greater = 584;
  38145. t.question = 556;
  38146. t.at = 1015;
  38147. t.A = 667;
  38148. t.B = 667;
  38149. t.C = 722;
  38150. t.D = 722;
  38151. t.E = 667;
  38152. t.F = 611;
  38153. t.G = 778;
  38154. t.H = 722;
  38155. t.I = 278;
  38156. t.J = 500;
  38157. t.K = 667;
  38158. t.L = 556;
  38159. t.M = 833;
  38160. t.N = 722;
  38161. t.O = 778;
  38162. t.P = 667;
  38163. t.Q = 778;
  38164. t.R = 722;
  38165. t.S = 667;
  38166. t.T = 611;
  38167. t.U = 722;
  38168. t.V = 667;
  38169. t.W = 944;
  38170. t.X = 667;
  38171. t.Y = 667;
  38172. t.Z = 611;
  38173. t.bracketleft = 278;
  38174. t.backslash = 278;
  38175. t.bracketright = 278;
  38176. t.asciicircum = 469;
  38177. t.underscore = 556;
  38178. t.quoteleft = 222;
  38179. t.a = 556;
  38180. t.b = 556;
  38181. t.c = 500;
  38182. t.d = 556;
  38183. t.e = 556;
  38184. t.f = 278;
  38185. t.g = 556;
  38186. t.h = 556;
  38187. t.i = 222;
  38188. t.j = 222;
  38189. t.k = 500;
  38190. t.l = 222;
  38191. t.m = 833;
  38192. t.n = 556;
  38193. t.o = 556;
  38194. t.p = 556;
  38195. t.q = 556;
  38196. t.r = 333;
  38197. t.s = 500;
  38198. t.t = 278;
  38199. t.u = 556;
  38200. t.v = 500;
  38201. t.w = 722;
  38202. t.x = 500;
  38203. t.y = 500;
  38204. t.z = 500;
  38205. t.braceleft = 334;
  38206. t.bar = 260;
  38207. t.braceright = 334;
  38208. t.asciitilde = 584;
  38209. t.exclamdown = 333;
  38210. t.cent = 556;
  38211. t.sterling = 556;
  38212. t.fraction = 167;
  38213. t.yen = 556;
  38214. t.florin = 556;
  38215. t.section = 556;
  38216. t.currency = 556;
  38217. t.quotesingle = 191;
  38218. t.quotedblleft = 333;
  38219. t.guillemotleft = 556;
  38220. t.guilsinglleft = 333;
  38221. t.guilsinglright = 333;
  38222. t.fi = 500;
  38223. t.fl = 500;
  38224. t.endash = 556;
  38225. t.dagger = 556;
  38226. t.daggerdbl = 556;
  38227. t.periodcentered = 278;
  38228. t.paragraph = 537;
  38229. t.bullet = 350;
  38230. t.quotesinglbase = 222;
  38231. t.quotedblbase = 333;
  38232. t.quotedblright = 333;
  38233. t.guillemotright = 556;
  38234. t.ellipsis = 1000;
  38235. t.perthousand = 1000;
  38236. t.questiondown = 611;
  38237. t.grave = 333;
  38238. t.acute = 333;
  38239. t.circumflex = 333;
  38240. t.tilde = 333;
  38241. t.macron = 333;
  38242. t.breve = 333;
  38243. t.dotaccent = 333;
  38244. t.dieresis = 333;
  38245. t.ring = 333;
  38246. t.cedilla = 333;
  38247. t.hungarumlaut = 333;
  38248. t.ogonek = 333;
  38249. t.caron = 333;
  38250. t.emdash = 1000;
  38251. t.AE = 1000;
  38252. t.ordfeminine = 370;
  38253. t.Lslash = 556;
  38254. t.Oslash = 778;
  38255. t.OE = 1000;
  38256. t.ordmasculine = 365;
  38257. t.ae = 889;
  38258. t.dotlessi = 278;
  38259. t.lslash = 222;
  38260. t.oslash = 611;
  38261. t.oe = 944;
  38262. t.germandbls = 611;
  38263. t.Idieresis = 278;
  38264. t.eacute = 556;
  38265. t.abreve = 556;
  38266. t.uhungarumlaut = 556;
  38267. t.ecaron = 556;
  38268. t.Ydieresis = 667;
  38269. t.divide = 584;
  38270. t.Yacute = 667;
  38271. t.Acircumflex = 667;
  38272. t.aacute = 556;
  38273. t.Ucircumflex = 722;
  38274. t.yacute = 500;
  38275. t.scommaaccent = 500;
  38276. t.ecircumflex = 556;
  38277. t.Uring = 722;
  38278. t.Udieresis = 722;
  38279. t.aogonek = 556;
  38280. t.Uacute = 722;
  38281. t.uogonek = 556;
  38282. t.Edieresis = 667;
  38283. t.Dcroat = 722;
  38284. t.commaaccent = 250;
  38285. t.copyright = 737;
  38286. t.Emacron = 667;
  38287. t.ccaron = 500;
  38288. t.aring = 556;
  38289. t.Ncommaaccent = 722;
  38290. t.lacute = 222;
  38291. t.agrave = 556;
  38292. t.Tcommaaccent = 611;
  38293. t.Cacute = 722;
  38294. t.atilde = 556;
  38295. t.Edotaccent = 667;
  38296. t.scaron = 500;
  38297. t.scedilla = 500;
  38298. t.iacute = 278;
  38299. t.lozenge = 471;
  38300. t.Rcaron = 722;
  38301. t.Gcommaaccent = 778;
  38302. t.ucircumflex = 556;
  38303. t.acircumflex = 556;
  38304. t.Amacron = 667;
  38305. t.rcaron = 333;
  38306. t.ccedilla = 500;
  38307. t.Zdotaccent = 611;
  38308. t.Thorn = 667;
  38309. t.Omacron = 778;
  38310. t.Racute = 722;
  38311. t.Sacute = 667;
  38312. t.dcaron = 643;
  38313. t.Umacron = 722;
  38314. t.uring = 556;
  38315. t.threesuperior = 333;
  38316. t.Ograve = 778;
  38317. t.Agrave = 667;
  38318. t.Abreve = 667;
  38319. t.multiply = 584;
  38320. t.uacute = 556;
  38321. t.Tcaron = 611;
  38322. t.partialdiff = 476;
  38323. t.ydieresis = 500;
  38324. t.Nacute = 722;
  38325. t.icircumflex = 278;
  38326. t.Ecircumflex = 667;
  38327. t.adieresis = 556;
  38328. t.edieresis = 556;
  38329. t.cacute = 500;
  38330. t.nacute = 556;
  38331. t.umacron = 556;
  38332. t.Ncaron = 722;
  38333. t.Iacute = 278;
  38334. t.plusminus = 584;
  38335. t.brokenbar = 260;
  38336. t.registered = 737;
  38337. t.Gbreve = 778;
  38338. t.Idotaccent = 278;
  38339. t.summation = 600;
  38340. t.Egrave = 667;
  38341. t.racute = 333;
  38342. t.omacron = 556;
  38343. t.Zacute = 611;
  38344. t.Zcaron = 611;
  38345. t.greaterequal = 549;
  38346. t.Eth = 722;
  38347. t.Ccedilla = 722;
  38348. t.lcommaaccent = 222;
  38349. t.tcaron = 317;
  38350. t.eogonek = 556;
  38351. t.Uogonek = 722;
  38352. t.Aacute = 667;
  38353. t.Adieresis = 667;
  38354. t.egrave = 556;
  38355. t.zacute = 500;
  38356. t.iogonek = 222;
  38357. t.Oacute = 778;
  38358. t.oacute = 556;
  38359. t.amacron = 556;
  38360. t.sacute = 500;
  38361. t.idieresis = 278;
  38362. t.Ocircumflex = 778;
  38363. t.Ugrave = 722;
  38364. t.Delta = 612;
  38365. t.thorn = 556;
  38366. t.twosuperior = 333;
  38367. t.Odieresis = 778;
  38368. t.mu = 556;
  38369. t.igrave = 278;
  38370. t.ohungarumlaut = 556;
  38371. t.Eogonek = 667;
  38372. t.dcroat = 556;
  38373. t.threequarters = 834;
  38374. t.Scedilla = 667;
  38375. t.lcaron = 299;
  38376. t.Kcommaaccent = 667;
  38377. t.Lacute = 556;
  38378. t.trademark = 1000;
  38379. t.edotaccent = 556;
  38380. t.Igrave = 278;
  38381. t.Imacron = 278;
  38382. t.Lcaron = 556;
  38383. t.onehalf = 834;
  38384. t.lessequal = 549;
  38385. t.ocircumflex = 556;
  38386. t.ntilde = 556;
  38387. t.Uhungarumlaut = 722;
  38388. t.Eacute = 667;
  38389. t.emacron = 556;
  38390. t.gbreve = 556;
  38391. t.onequarter = 834;
  38392. t.Scaron = 667;
  38393. t.Scommaaccent = 667;
  38394. t.Ohungarumlaut = 778;
  38395. t.degree = 400;
  38396. t.ograve = 556;
  38397. t.Ccaron = 722;
  38398. t.ugrave = 556;
  38399. t.radical = 453;
  38400. t.Dcaron = 722;
  38401. t.rcommaaccent = 333;
  38402. t.Ntilde = 722;
  38403. t.otilde = 556;
  38404. t.Rcommaaccent = 722;
  38405. t.Lcommaaccent = 556;
  38406. t.Atilde = 667;
  38407. t.Aogonek = 667;
  38408. t.Aring = 667;
  38409. t.Otilde = 778;
  38410. t.zdotaccent = 500;
  38411. t.Ecaron = 667;
  38412. t.Iogonek = 278;
  38413. t.kcommaaccent = 500;
  38414. t.minus = 584;
  38415. t.Icircumflex = 278;
  38416. t.ncaron = 556;
  38417. t.tcommaaccent = 278;
  38418. t.logicalnot = 584;
  38419. t.odieresis = 556;
  38420. t.udieresis = 556;
  38421. t.notequal = 549;
  38422. t.gcommaaccent = 556;
  38423. t.eth = 556;
  38424. t.zcaron = 500;
  38425. t.ncommaaccent = 556;
  38426. t.onesuperior = 333;
  38427. t.imacron = 278;
  38428. t.Euro = 556;
  38429. });
  38430. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38431. t.space = 278;
  38432. t.exclam = 333;
  38433. t.quotedbl = 474;
  38434. t.numbersign = 556;
  38435. t.dollar = 556;
  38436. t.percent = 889;
  38437. t.ampersand = 722;
  38438. t.quoteright = 278;
  38439. t.parenleft = 333;
  38440. t.parenright = 333;
  38441. t.asterisk = 389;
  38442. t.plus = 584;
  38443. t.comma = 278;
  38444. t.hyphen = 333;
  38445. t.period = 278;
  38446. t.slash = 278;
  38447. t.zero = 556;
  38448. t.one = 556;
  38449. t.two = 556;
  38450. t.three = 556;
  38451. t.four = 556;
  38452. t.five = 556;
  38453. t.six = 556;
  38454. t.seven = 556;
  38455. t.eight = 556;
  38456. t.nine = 556;
  38457. t.colon = 333;
  38458. t.semicolon = 333;
  38459. t.less = 584;
  38460. t.equal = 584;
  38461. t.greater = 584;
  38462. t.question = 611;
  38463. t.at = 975;
  38464. t.A = 722;
  38465. t.B = 722;
  38466. t.C = 722;
  38467. t.D = 722;
  38468. t.E = 667;
  38469. t.F = 611;
  38470. t.G = 778;
  38471. t.H = 722;
  38472. t.I = 278;
  38473. t.J = 556;
  38474. t.K = 722;
  38475. t.L = 611;
  38476. t.M = 833;
  38477. t.N = 722;
  38478. t.O = 778;
  38479. t.P = 667;
  38480. t.Q = 778;
  38481. t.R = 722;
  38482. t.S = 667;
  38483. t.T = 611;
  38484. t.U = 722;
  38485. t.V = 667;
  38486. t.W = 944;
  38487. t.X = 667;
  38488. t.Y = 667;
  38489. t.Z = 611;
  38490. t.bracketleft = 333;
  38491. t.backslash = 278;
  38492. t.bracketright = 333;
  38493. t.asciicircum = 584;
  38494. t.underscore = 556;
  38495. t.quoteleft = 278;
  38496. t.a = 556;
  38497. t.b = 611;
  38498. t.c = 556;
  38499. t.d = 611;
  38500. t.e = 556;
  38501. t.f = 333;
  38502. t.g = 611;
  38503. t.h = 611;
  38504. t.i = 278;
  38505. t.j = 278;
  38506. t.k = 556;
  38507. t.l = 278;
  38508. t.m = 889;
  38509. t.n = 611;
  38510. t.o = 611;
  38511. t.p = 611;
  38512. t.q = 611;
  38513. t.r = 389;
  38514. t.s = 556;
  38515. t.t = 333;
  38516. t.u = 611;
  38517. t.v = 556;
  38518. t.w = 778;
  38519. t.x = 556;
  38520. t.y = 556;
  38521. t.z = 500;
  38522. t.braceleft = 389;
  38523. t.bar = 280;
  38524. t.braceright = 389;
  38525. t.asciitilde = 584;
  38526. t.exclamdown = 333;
  38527. t.cent = 556;
  38528. t.sterling = 556;
  38529. t.fraction = 167;
  38530. t.yen = 556;
  38531. t.florin = 556;
  38532. t.section = 556;
  38533. t.currency = 556;
  38534. t.quotesingle = 238;
  38535. t.quotedblleft = 500;
  38536. t.guillemotleft = 556;
  38537. t.guilsinglleft = 333;
  38538. t.guilsinglright = 333;
  38539. t.fi = 611;
  38540. t.fl = 611;
  38541. t.endash = 556;
  38542. t.dagger = 556;
  38543. t.daggerdbl = 556;
  38544. t.periodcentered = 278;
  38545. t.paragraph = 556;
  38546. t.bullet = 350;
  38547. t.quotesinglbase = 278;
  38548. t.quotedblbase = 500;
  38549. t.quotedblright = 500;
  38550. t.guillemotright = 556;
  38551. t.ellipsis = 1000;
  38552. t.perthousand = 1000;
  38553. t.questiondown = 611;
  38554. t.grave = 333;
  38555. t.acute = 333;
  38556. t.circumflex = 333;
  38557. t.tilde = 333;
  38558. t.macron = 333;
  38559. t.breve = 333;
  38560. t.dotaccent = 333;
  38561. t.dieresis = 333;
  38562. t.ring = 333;
  38563. t.cedilla = 333;
  38564. t.hungarumlaut = 333;
  38565. t.ogonek = 333;
  38566. t.caron = 333;
  38567. t.emdash = 1000;
  38568. t.AE = 1000;
  38569. t.ordfeminine = 370;
  38570. t.Lslash = 611;
  38571. t.Oslash = 778;
  38572. t.OE = 1000;
  38573. t.ordmasculine = 365;
  38574. t.ae = 889;
  38575. t.dotlessi = 278;
  38576. t.lslash = 278;
  38577. t.oslash = 611;
  38578. t.oe = 944;
  38579. t.germandbls = 611;
  38580. t.Idieresis = 278;
  38581. t.eacute = 556;
  38582. t.abreve = 556;
  38583. t.uhungarumlaut = 611;
  38584. t.ecaron = 556;
  38585. t.Ydieresis = 667;
  38586. t.divide = 584;
  38587. t.Yacute = 667;
  38588. t.Acircumflex = 722;
  38589. t.aacute = 556;
  38590. t.Ucircumflex = 722;
  38591. t.yacute = 556;
  38592. t.scommaaccent = 556;
  38593. t.ecircumflex = 556;
  38594. t.Uring = 722;
  38595. t.Udieresis = 722;
  38596. t.aogonek = 556;
  38597. t.Uacute = 722;
  38598. t.uogonek = 611;
  38599. t.Edieresis = 667;
  38600. t.Dcroat = 722;
  38601. t.commaaccent = 250;
  38602. t.copyright = 737;
  38603. t.Emacron = 667;
  38604. t.ccaron = 556;
  38605. t.aring = 556;
  38606. t.Ncommaaccent = 722;
  38607. t.lacute = 278;
  38608. t.agrave = 556;
  38609. t.Tcommaaccent = 611;
  38610. t.Cacute = 722;
  38611. t.atilde = 556;
  38612. t.Edotaccent = 667;
  38613. t.scaron = 556;
  38614. t.scedilla = 556;
  38615. t.iacute = 278;
  38616. t.lozenge = 494;
  38617. t.Rcaron = 722;
  38618. t.Gcommaaccent = 778;
  38619. t.ucircumflex = 611;
  38620. t.acircumflex = 556;
  38621. t.Amacron = 722;
  38622. t.rcaron = 389;
  38623. t.ccedilla = 556;
  38624. t.Zdotaccent = 611;
  38625. t.Thorn = 667;
  38626. t.Omacron = 778;
  38627. t.Racute = 722;
  38628. t.Sacute = 667;
  38629. t.dcaron = 743;
  38630. t.Umacron = 722;
  38631. t.uring = 611;
  38632. t.threesuperior = 333;
  38633. t.Ograve = 778;
  38634. t.Agrave = 722;
  38635. t.Abreve = 722;
  38636. t.multiply = 584;
  38637. t.uacute = 611;
  38638. t.Tcaron = 611;
  38639. t.partialdiff = 494;
  38640. t.ydieresis = 556;
  38641. t.Nacute = 722;
  38642. t.icircumflex = 278;
  38643. t.Ecircumflex = 667;
  38644. t.adieresis = 556;
  38645. t.edieresis = 556;
  38646. t.cacute = 556;
  38647. t.nacute = 611;
  38648. t.umacron = 611;
  38649. t.Ncaron = 722;
  38650. t.Iacute = 278;
  38651. t.plusminus = 584;
  38652. t.brokenbar = 280;
  38653. t.registered = 737;
  38654. t.Gbreve = 778;
  38655. t.Idotaccent = 278;
  38656. t.summation = 600;
  38657. t.Egrave = 667;
  38658. t.racute = 389;
  38659. t.omacron = 611;
  38660. t.Zacute = 611;
  38661. t.Zcaron = 611;
  38662. t.greaterequal = 549;
  38663. t.Eth = 722;
  38664. t.Ccedilla = 722;
  38665. t.lcommaaccent = 278;
  38666. t.tcaron = 389;
  38667. t.eogonek = 556;
  38668. t.Uogonek = 722;
  38669. t.Aacute = 722;
  38670. t.Adieresis = 722;
  38671. t.egrave = 556;
  38672. t.zacute = 500;
  38673. t.iogonek = 278;
  38674. t.Oacute = 778;
  38675. t.oacute = 611;
  38676. t.amacron = 556;
  38677. t.sacute = 556;
  38678. t.idieresis = 278;
  38679. t.Ocircumflex = 778;
  38680. t.Ugrave = 722;
  38681. t.Delta = 612;
  38682. t.thorn = 611;
  38683. t.twosuperior = 333;
  38684. t.Odieresis = 778;
  38685. t.mu = 611;
  38686. t.igrave = 278;
  38687. t.ohungarumlaut = 611;
  38688. t.Eogonek = 667;
  38689. t.dcroat = 611;
  38690. t.threequarters = 834;
  38691. t.Scedilla = 667;
  38692. t.lcaron = 400;
  38693. t.Kcommaaccent = 722;
  38694. t.Lacute = 611;
  38695. t.trademark = 1000;
  38696. t.edotaccent = 556;
  38697. t.Igrave = 278;
  38698. t.Imacron = 278;
  38699. t.Lcaron = 611;
  38700. t.onehalf = 834;
  38701. t.lessequal = 549;
  38702. t.ocircumflex = 611;
  38703. t.ntilde = 611;
  38704. t.Uhungarumlaut = 722;
  38705. t.Eacute = 667;
  38706. t.emacron = 556;
  38707. t.gbreve = 611;
  38708. t.onequarter = 834;
  38709. t.Scaron = 667;
  38710. t.Scommaaccent = 667;
  38711. t.Ohungarumlaut = 778;
  38712. t.degree = 400;
  38713. t.ograve = 611;
  38714. t.Ccaron = 722;
  38715. t.ugrave = 611;
  38716. t.radical = 549;
  38717. t.Dcaron = 722;
  38718. t.rcommaaccent = 389;
  38719. t.Ntilde = 722;
  38720. t.otilde = 611;
  38721. t.Rcommaaccent = 722;
  38722. t.Lcommaaccent = 611;
  38723. t.Atilde = 722;
  38724. t.Aogonek = 722;
  38725. t.Aring = 722;
  38726. t.Otilde = 778;
  38727. t.zdotaccent = 500;
  38728. t.Ecaron = 667;
  38729. t.Iogonek = 278;
  38730. t.kcommaaccent = 556;
  38731. t.minus = 584;
  38732. t.Icircumflex = 278;
  38733. t.ncaron = 611;
  38734. t.tcommaaccent = 333;
  38735. t.logicalnot = 584;
  38736. t.odieresis = 611;
  38737. t.udieresis = 611;
  38738. t.notequal = 549;
  38739. t.gcommaaccent = 611;
  38740. t.eth = 611;
  38741. t.zcaron = 500;
  38742. t.ncommaaccent = 611;
  38743. t.onesuperior = 333;
  38744. t.imacron = 278;
  38745. t.Euro = 556;
  38746. });
  38747. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38748. t.space = 278;
  38749. t.exclam = 333;
  38750. t.quotedbl = 474;
  38751. t.numbersign = 556;
  38752. t.dollar = 556;
  38753. t.percent = 889;
  38754. t.ampersand = 722;
  38755. t.quoteright = 278;
  38756. t.parenleft = 333;
  38757. t.parenright = 333;
  38758. t.asterisk = 389;
  38759. t.plus = 584;
  38760. t.comma = 278;
  38761. t.hyphen = 333;
  38762. t.period = 278;
  38763. t.slash = 278;
  38764. t.zero = 556;
  38765. t.one = 556;
  38766. t.two = 556;
  38767. t.three = 556;
  38768. t.four = 556;
  38769. t.five = 556;
  38770. t.six = 556;
  38771. t.seven = 556;
  38772. t.eight = 556;
  38773. t.nine = 556;
  38774. t.colon = 333;
  38775. t.semicolon = 333;
  38776. t.less = 584;
  38777. t.equal = 584;
  38778. t.greater = 584;
  38779. t.question = 611;
  38780. t.at = 975;
  38781. t.A = 722;
  38782. t.B = 722;
  38783. t.C = 722;
  38784. t.D = 722;
  38785. t.E = 667;
  38786. t.F = 611;
  38787. t.G = 778;
  38788. t.H = 722;
  38789. t.I = 278;
  38790. t.J = 556;
  38791. t.K = 722;
  38792. t.L = 611;
  38793. t.M = 833;
  38794. t.N = 722;
  38795. t.O = 778;
  38796. t.P = 667;
  38797. t.Q = 778;
  38798. t.R = 722;
  38799. t.S = 667;
  38800. t.T = 611;
  38801. t.U = 722;
  38802. t.V = 667;
  38803. t.W = 944;
  38804. t.X = 667;
  38805. t.Y = 667;
  38806. t.Z = 611;
  38807. t.bracketleft = 333;
  38808. t.backslash = 278;
  38809. t.bracketright = 333;
  38810. t.asciicircum = 584;
  38811. t.underscore = 556;
  38812. t.quoteleft = 278;
  38813. t.a = 556;
  38814. t.b = 611;
  38815. t.c = 556;
  38816. t.d = 611;
  38817. t.e = 556;
  38818. t.f = 333;
  38819. t.g = 611;
  38820. t.h = 611;
  38821. t.i = 278;
  38822. t.j = 278;
  38823. t.k = 556;
  38824. t.l = 278;
  38825. t.m = 889;
  38826. t.n = 611;
  38827. t.o = 611;
  38828. t.p = 611;
  38829. t.q = 611;
  38830. t.r = 389;
  38831. t.s = 556;
  38832. t.t = 333;
  38833. t.u = 611;
  38834. t.v = 556;
  38835. t.w = 778;
  38836. t.x = 556;
  38837. t.y = 556;
  38838. t.z = 500;
  38839. t.braceleft = 389;
  38840. t.bar = 280;
  38841. t.braceright = 389;
  38842. t.asciitilde = 584;
  38843. t.exclamdown = 333;
  38844. t.cent = 556;
  38845. t.sterling = 556;
  38846. t.fraction = 167;
  38847. t.yen = 556;
  38848. t.florin = 556;
  38849. t.section = 556;
  38850. t.currency = 556;
  38851. t.quotesingle = 238;
  38852. t.quotedblleft = 500;
  38853. t.guillemotleft = 556;
  38854. t.guilsinglleft = 333;
  38855. t.guilsinglright = 333;
  38856. t.fi = 611;
  38857. t.fl = 611;
  38858. t.endash = 556;
  38859. t.dagger = 556;
  38860. t.daggerdbl = 556;
  38861. t.periodcentered = 278;
  38862. t.paragraph = 556;
  38863. t.bullet = 350;
  38864. t.quotesinglbase = 278;
  38865. t.quotedblbase = 500;
  38866. t.quotedblright = 500;
  38867. t.guillemotright = 556;
  38868. t.ellipsis = 1000;
  38869. t.perthousand = 1000;
  38870. t.questiondown = 611;
  38871. t.grave = 333;
  38872. t.acute = 333;
  38873. t.circumflex = 333;
  38874. t.tilde = 333;
  38875. t.macron = 333;
  38876. t.breve = 333;
  38877. t.dotaccent = 333;
  38878. t.dieresis = 333;
  38879. t.ring = 333;
  38880. t.cedilla = 333;
  38881. t.hungarumlaut = 333;
  38882. t.ogonek = 333;
  38883. t.caron = 333;
  38884. t.emdash = 1000;
  38885. t.AE = 1000;
  38886. t.ordfeminine = 370;
  38887. t.Lslash = 611;
  38888. t.Oslash = 778;
  38889. t.OE = 1000;
  38890. t.ordmasculine = 365;
  38891. t.ae = 889;
  38892. t.dotlessi = 278;
  38893. t.lslash = 278;
  38894. t.oslash = 611;
  38895. t.oe = 944;
  38896. t.germandbls = 611;
  38897. t.Idieresis = 278;
  38898. t.eacute = 556;
  38899. t.abreve = 556;
  38900. t.uhungarumlaut = 611;
  38901. t.ecaron = 556;
  38902. t.Ydieresis = 667;
  38903. t.divide = 584;
  38904. t.Yacute = 667;
  38905. t.Acircumflex = 722;
  38906. t.aacute = 556;
  38907. t.Ucircumflex = 722;
  38908. t.yacute = 556;
  38909. t.scommaaccent = 556;
  38910. t.ecircumflex = 556;
  38911. t.Uring = 722;
  38912. t.Udieresis = 722;
  38913. t.aogonek = 556;
  38914. t.Uacute = 722;
  38915. t.uogonek = 611;
  38916. t.Edieresis = 667;
  38917. t.Dcroat = 722;
  38918. t.commaaccent = 250;
  38919. t.copyright = 737;
  38920. t.Emacron = 667;
  38921. t.ccaron = 556;
  38922. t.aring = 556;
  38923. t.Ncommaaccent = 722;
  38924. t.lacute = 278;
  38925. t.agrave = 556;
  38926. t.Tcommaaccent = 611;
  38927. t.Cacute = 722;
  38928. t.atilde = 556;
  38929. t.Edotaccent = 667;
  38930. t.scaron = 556;
  38931. t.scedilla = 556;
  38932. t.iacute = 278;
  38933. t.lozenge = 494;
  38934. t.Rcaron = 722;
  38935. t.Gcommaaccent = 778;
  38936. t.ucircumflex = 611;
  38937. t.acircumflex = 556;
  38938. t.Amacron = 722;
  38939. t.rcaron = 389;
  38940. t.ccedilla = 556;
  38941. t.Zdotaccent = 611;
  38942. t.Thorn = 667;
  38943. t.Omacron = 778;
  38944. t.Racute = 722;
  38945. t.Sacute = 667;
  38946. t.dcaron = 743;
  38947. t.Umacron = 722;
  38948. t.uring = 611;
  38949. t.threesuperior = 333;
  38950. t.Ograve = 778;
  38951. t.Agrave = 722;
  38952. t.Abreve = 722;
  38953. t.multiply = 584;
  38954. t.uacute = 611;
  38955. t.Tcaron = 611;
  38956. t.partialdiff = 494;
  38957. t.ydieresis = 556;
  38958. t.Nacute = 722;
  38959. t.icircumflex = 278;
  38960. t.Ecircumflex = 667;
  38961. t.adieresis = 556;
  38962. t.edieresis = 556;
  38963. t.cacute = 556;
  38964. t.nacute = 611;
  38965. t.umacron = 611;
  38966. t.Ncaron = 722;
  38967. t.Iacute = 278;
  38968. t.plusminus = 584;
  38969. t.brokenbar = 280;
  38970. t.registered = 737;
  38971. t.Gbreve = 778;
  38972. t.Idotaccent = 278;
  38973. t.summation = 600;
  38974. t.Egrave = 667;
  38975. t.racute = 389;
  38976. t.omacron = 611;
  38977. t.Zacute = 611;
  38978. t.Zcaron = 611;
  38979. t.greaterequal = 549;
  38980. t.Eth = 722;
  38981. t.Ccedilla = 722;
  38982. t.lcommaaccent = 278;
  38983. t.tcaron = 389;
  38984. t.eogonek = 556;
  38985. t.Uogonek = 722;
  38986. t.Aacute = 722;
  38987. t.Adieresis = 722;
  38988. t.egrave = 556;
  38989. t.zacute = 500;
  38990. t.iogonek = 278;
  38991. t.Oacute = 778;
  38992. t.oacute = 611;
  38993. t.amacron = 556;
  38994. t.sacute = 556;
  38995. t.idieresis = 278;
  38996. t.Ocircumflex = 778;
  38997. t.Ugrave = 722;
  38998. t.Delta = 612;
  38999. t.thorn = 611;
  39000. t.twosuperior = 333;
  39001. t.Odieresis = 778;
  39002. t.mu = 611;
  39003. t.igrave = 278;
  39004. t.ohungarumlaut = 611;
  39005. t.Eogonek = 667;
  39006. t.dcroat = 611;
  39007. t.threequarters = 834;
  39008. t.Scedilla = 667;
  39009. t.lcaron = 400;
  39010. t.Kcommaaccent = 722;
  39011. t.Lacute = 611;
  39012. t.trademark = 1000;
  39013. t.edotaccent = 556;
  39014. t.Igrave = 278;
  39015. t.Imacron = 278;
  39016. t.Lcaron = 611;
  39017. t.onehalf = 834;
  39018. t.lessequal = 549;
  39019. t.ocircumflex = 611;
  39020. t.ntilde = 611;
  39021. t.Uhungarumlaut = 722;
  39022. t.Eacute = 667;
  39023. t.emacron = 556;
  39024. t.gbreve = 611;
  39025. t.onequarter = 834;
  39026. t.Scaron = 667;
  39027. t.Scommaaccent = 667;
  39028. t.Ohungarumlaut = 778;
  39029. t.degree = 400;
  39030. t.ograve = 611;
  39031. t.Ccaron = 722;
  39032. t.ugrave = 611;
  39033. t.radical = 549;
  39034. t.Dcaron = 722;
  39035. t.rcommaaccent = 389;
  39036. t.Ntilde = 722;
  39037. t.otilde = 611;
  39038. t.Rcommaaccent = 722;
  39039. t.Lcommaaccent = 611;
  39040. t.Atilde = 722;
  39041. t.Aogonek = 722;
  39042. t.Aring = 722;
  39043. t.Otilde = 778;
  39044. t.zdotaccent = 500;
  39045. t.Ecaron = 667;
  39046. t.Iogonek = 278;
  39047. t.kcommaaccent = 556;
  39048. t.minus = 584;
  39049. t.Icircumflex = 278;
  39050. t.ncaron = 611;
  39051. t.tcommaaccent = 333;
  39052. t.logicalnot = 584;
  39053. t.odieresis = 611;
  39054. t.udieresis = 611;
  39055. t.notequal = 549;
  39056. t.gcommaaccent = 611;
  39057. t.eth = 611;
  39058. t.zcaron = 500;
  39059. t.ncommaaccent = 611;
  39060. t.onesuperior = 333;
  39061. t.imacron = 278;
  39062. t.Euro = 556;
  39063. });
  39064. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39065. t.space = 278;
  39066. t.exclam = 278;
  39067. t.quotedbl = 355;
  39068. t.numbersign = 556;
  39069. t.dollar = 556;
  39070. t.percent = 889;
  39071. t.ampersand = 667;
  39072. t.quoteright = 222;
  39073. t.parenleft = 333;
  39074. t.parenright = 333;
  39075. t.asterisk = 389;
  39076. t.plus = 584;
  39077. t.comma = 278;
  39078. t.hyphen = 333;
  39079. t.period = 278;
  39080. t.slash = 278;
  39081. t.zero = 556;
  39082. t.one = 556;
  39083. t.two = 556;
  39084. t.three = 556;
  39085. t.four = 556;
  39086. t.five = 556;
  39087. t.six = 556;
  39088. t.seven = 556;
  39089. t.eight = 556;
  39090. t.nine = 556;
  39091. t.colon = 278;
  39092. t.semicolon = 278;
  39093. t.less = 584;
  39094. t.equal = 584;
  39095. t.greater = 584;
  39096. t.question = 556;
  39097. t.at = 1015;
  39098. t.A = 667;
  39099. t.B = 667;
  39100. t.C = 722;
  39101. t.D = 722;
  39102. t.E = 667;
  39103. t.F = 611;
  39104. t.G = 778;
  39105. t.H = 722;
  39106. t.I = 278;
  39107. t.J = 500;
  39108. t.K = 667;
  39109. t.L = 556;
  39110. t.M = 833;
  39111. t.N = 722;
  39112. t.O = 778;
  39113. t.P = 667;
  39114. t.Q = 778;
  39115. t.R = 722;
  39116. t.S = 667;
  39117. t.T = 611;
  39118. t.U = 722;
  39119. t.V = 667;
  39120. t.W = 944;
  39121. t.X = 667;
  39122. t.Y = 667;
  39123. t.Z = 611;
  39124. t.bracketleft = 278;
  39125. t.backslash = 278;
  39126. t.bracketright = 278;
  39127. t.asciicircum = 469;
  39128. t.underscore = 556;
  39129. t.quoteleft = 222;
  39130. t.a = 556;
  39131. t.b = 556;
  39132. t.c = 500;
  39133. t.d = 556;
  39134. t.e = 556;
  39135. t.f = 278;
  39136. t.g = 556;
  39137. t.h = 556;
  39138. t.i = 222;
  39139. t.j = 222;
  39140. t.k = 500;
  39141. t.l = 222;
  39142. t.m = 833;
  39143. t.n = 556;
  39144. t.o = 556;
  39145. t.p = 556;
  39146. t.q = 556;
  39147. t.r = 333;
  39148. t.s = 500;
  39149. t.t = 278;
  39150. t.u = 556;
  39151. t.v = 500;
  39152. t.w = 722;
  39153. t.x = 500;
  39154. t.y = 500;
  39155. t.z = 500;
  39156. t.braceleft = 334;
  39157. t.bar = 260;
  39158. t.braceright = 334;
  39159. t.asciitilde = 584;
  39160. t.exclamdown = 333;
  39161. t.cent = 556;
  39162. t.sterling = 556;
  39163. t.fraction = 167;
  39164. t.yen = 556;
  39165. t.florin = 556;
  39166. t.section = 556;
  39167. t.currency = 556;
  39168. t.quotesingle = 191;
  39169. t.quotedblleft = 333;
  39170. t.guillemotleft = 556;
  39171. t.guilsinglleft = 333;
  39172. t.guilsinglright = 333;
  39173. t.fi = 500;
  39174. t.fl = 500;
  39175. t.endash = 556;
  39176. t.dagger = 556;
  39177. t.daggerdbl = 556;
  39178. t.periodcentered = 278;
  39179. t.paragraph = 537;
  39180. t.bullet = 350;
  39181. t.quotesinglbase = 222;
  39182. t.quotedblbase = 333;
  39183. t.quotedblright = 333;
  39184. t.guillemotright = 556;
  39185. t.ellipsis = 1000;
  39186. t.perthousand = 1000;
  39187. t.questiondown = 611;
  39188. t.grave = 333;
  39189. t.acute = 333;
  39190. t.circumflex = 333;
  39191. t.tilde = 333;
  39192. t.macron = 333;
  39193. t.breve = 333;
  39194. t.dotaccent = 333;
  39195. t.dieresis = 333;
  39196. t.ring = 333;
  39197. t.cedilla = 333;
  39198. t.hungarumlaut = 333;
  39199. t.ogonek = 333;
  39200. t.caron = 333;
  39201. t.emdash = 1000;
  39202. t.AE = 1000;
  39203. t.ordfeminine = 370;
  39204. t.Lslash = 556;
  39205. t.Oslash = 778;
  39206. t.OE = 1000;
  39207. t.ordmasculine = 365;
  39208. t.ae = 889;
  39209. t.dotlessi = 278;
  39210. t.lslash = 222;
  39211. t.oslash = 611;
  39212. t.oe = 944;
  39213. t.germandbls = 611;
  39214. t.Idieresis = 278;
  39215. t.eacute = 556;
  39216. t.abreve = 556;
  39217. t.uhungarumlaut = 556;
  39218. t.ecaron = 556;
  39219. t.Ydieresis = 667;
  39220. t.divide = 584;
  39221. t.Yacute = 667;
  39222. t.Acircumflex = 667;
  39223. t.aacute = 556;
  39224. t.Ucircumflex = 722;
  39225. t.yacute = 500;
  39226. t.scommaaccent = 500;
  39227. t.ecircumflex = 556;
  39228. t.Uring = 722;
  39229. t.Udieresis = 722;
  39230. t.aogonek = 556;
  39231. t.Uacute = 722;
  39232. t.uogonek = 556;
  39233. t.Edieresis = 667;
  39234. t.Dcroat = 722;
  39235. t.commaaccent = 250;
  39236. t.copyright = 737;
  39237. t.Emacron = 667;
  39238. t.ccaron = 500;
  39239. t.aring = 556;
  39240. t.Ncommaaccent = 722;
  39241. t.lacute = 222;
  39242. t.agrave = 556;
  39243. t.Tcommaaccent = 611;
  39244. t.Cacute = 722;
  39245. t.atilde = 556;
  39246. t.Edotaccent = 667;
  39247. t.scaron = 500;
  39248. t.scedilla = 500;
  39249. t.iacute = 278;
  39250. t.lozenge = 471;
  39251. t.Rcaron = 722;
  39252. t.Gcommaaccent = 778;
  39253. t.ucircumflex = 556;
  39254. t.acircumflex = 556;
  39255. t.Amacron = 667;
  39256. t.rcaron = 333;
  39257. t.ccedilla = 500;
  39258. t.Zdotaccent = 611;
  39259. t.Thorn = 667;
  39260. t.Omacron = 778;
  39261. t.Racute = 722;
  39262. t.Sacute = 667;
  39263. t.dcaron = 643;
  39264. t.Umacron = 722;
  39265. t.uring = 556;
  39266. t.threesuperior = 333;
  39267. t.Ograve = 778;
  39268. t.Agrave = 667;
  39269. t.Abreve = 667;
  39270. t.multiply = 584;
  39271. t.uacute = 556;
  39272. t.Tcaron = 611;
  39273. t.partialdiff = 476;
  39274. t.ydieresis = 500;
  39275. t.Nacute = 722;
  39276. t.icircumflex = 278;
  39277. t.Ecircumflex = 667;
  39278. t.adieresis = 556;
  39279. t.edieresis = 556;
  39280. t.cacute = 500;
  39281. t.nacute = 556;
  39282. t.umacron = 556;
  39283. t.Ncaron = 722;
  39284. t.Iacute = 278;
  39285. t.plusminus = 584;
  39286. t.brokenbar = 260;
  39287. t.registered = 737;
  39288. t.Gbreve = 778;
  39289. t.Idotaccent = 278;
  39290. t.summation = 600;
  39291. t.Egrave = 667;
  39292. t.racute = 333;
  39293. t.omacron = 556;
  39294. t.Zacute = 611;
  39295. t.Zcaron = 611;
  39296. t.greaterequal = 549;
  39297. t.Eth = 722;
  39298. t.Ccedilla = 722;
  39299. t.lcommaaccent = 222;
  39300. t.tcaron = 317;
  39301. t.eogonek = 556;
  39302. t.Uogonek = 722;
  39303. t.Aacute = 667;
  39304. t.Adieresis = 667;
  39305. t.egrave = 556;
  39306. t.zacute = 500;
  39307. t.iogonek = 222;
  39308. t.Oacute = 778;
  39309. t.oacute = 556;
  39310. t.amacron = 556;
  39311. t.sacute = 500;
  39312. t.idieresis = 278;
  39313. t.Ocircumflex = 778;
  39314. t.Ugrave = 722;
  39315. t.Delta = 612;
  39316. t.thorn = 556;
  39317. t.twosuperior = 333;
  39318. t.Odieresis = 778;
  39319. t.mu = 556;
  39320. t.igrave = 278;
  39321. t.ohungarumlaut = 556;
  39322. t.Eogonek = 667;
  39323. t.dcroat = 556;
  39324. t.threequarters = 834;
  39325. t.Scedilla = 667;
  39326. t.lcaron = 299;
  39327. t.Kcommaaccent = 667;
  39328. t.Lacute = 556;
  39329. t.trademark = 1000;
  39330. t.edotaccent = 556;
  39331. t.Igrave = 278;
  39332. t.Imacron = 278;
  39333. t.Lcaron = 556;
  39334. t.onehalf = 834;
  39335. t.lessequal = 549;
  39336. t.ocircumflex = 556;
  39337. t.ntilde = 556;
  39338. t.Uhungarumlaut = 722;
  39339. t.Eacute = 667;
  39340. t.emacron = 556;
  39341. t.gbreve = 556;
  39342. t.onequarter = 834;
  39343. t.Scaron = 667;
  39344. t.Scommaaccent = 667;
  39345. t.Ohungarumlaut = 778;
  39346. t.degree = 400;
  39347. t.ograve = 556;
  39348. t.Ccaron = 722;
  39349. t.ugrave = 556;
  39350. t.radical = 453;
  39351. t.Dcaron = 722;
  39352. t.rcommaaccent = 333;
  39353. t.Ntilde = 722;
  39354. t.otilde = 556;
  39355. t.Rcommaaccent = 722;
  39356. t.Lcommaaccent = 556;
  39357. t.Atilde = 667;
  39358. t.Aogonek = 667;
  39359. t.Aring = 667;
  39360. t.Otilde = 778;
  39361. t.zdotaccent = 500;
  39362. t.Ecaron = 667;
  39363. t.Iogonek = 278;
  39364. t.kcommaaccent = 500;
  39365. t.minus = 584;
  39366. t.Icircumflex = 278;
  39367. t.ncaron = 556;
  39368. t.tcommaaccent = 278;
  39369. t.logicalnot = 584;
  39370. t.odieresis = 556;
  39371. t.udieresis = 556;
  39372. t.notequal = 549;
  39373. t.gcommaaccent = 556;
  39374. t.eth = 556;
  39375. t.zcaron = 500;
  39376. t.ncommaaccent = 556;
  39377. t.onesuperior = 333;
  39378. t.imacron = 278;
  39379. t.Euro = 556;
  39380. });
  39381. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  39382. t.space = 250;
  39383. t.exclam = 333;
  39384. t.universal = 713;
  39385. t.numbersign = 500;
  39386. t.existential = 549;
  39387. t.percent = 833;
  39388. t.ampersand = 778;
  39389. t.suchthat = 439;
  39390. t.parenleft = 333;
  39391. t.parenright = 333;
  39392. t.asteriskmath = 500;
  39393. t.plus = 549;
  39394. t.comma = 250;
  39395. t.minus = 549;
  39396. t.period = 250;
  39397. t.slash = 278;
  39398. t.zero = 500;
  39399. t.one = 500;
  39400. t.two = 500;
  39401. t.three = 500;
  39402. t.four = 500;
  39403. t.five = 500;
  39404. t.six = 500;
  39405. t.seven = 500;
  39406. t.eight = 500;
  39407. t.nine = 500;
  39408. t.colon = 278;
  39409. t.semicolon = 278;
  39410. t.less = 549;
  39411. t.equal = 549;
  39412. t.greater = 549;
  39413. t.question = 444;
  39414. t.congruent = 549;
  39415. t.Alpha = 722;
  39416. t.Beta = 667;
  39417. t.Chi = 722;
  39418. t.Delta = 612;
  39419. t.Epsilon = 611;
  39420. t.Phi = 763;
  39421. t.Gamma = 603;
  39422. t.Eta = 722;
  39423. t.Iota = 333;
  39424. t.theta1 = 631;
  39425. t.Kappa = 722;
  39426. t.Lambda = 686;
  39427. t.Mu = 889;
  39428. t.Nu = 722;
  39429. t.Omicron = 722;
  39430. t.Pi = 768;
  39431. t.Theta = 741;
  39432. t.Rho = 556;
  39433. t.Sigma = 592;
  39434. t.Tau = 611;
  39435. t.Upsilon = 690;
  39436. t.sigma1 = 439;
  39437. t.Omega = 768;
  39438. t.Xi = 645;
  39439. t.Psi = 795;
  39440. t.Zeta = 611;
  39441. t.bracketleft = 333;
  39442. t.therefore = 863;
  39443. t.bracketright = 333;
  39444. t.perpendicular = 658;
  39445. t.underscore = 500;
  39446. t.radicalex = 500;
  39447. t.alpha = 631;
  39448. t.beta = 549;
  39449. t.chi = 549;
  39450. t.delta = 494;
  39451. t.epsilon = 439;
  39452. t.phi = 521;
  39453. t.gamma = 411;
  39454. t.eta = 603;
  39455. t.iota = 329;
  39456. t.phi1 = 603;
  39457. t.kappa = 549;
  39458. t.lambda = 549;
  39459. t.mu = 576;
  39460. t.nu = 521;
  39461. t.omicron = 549;
  39462. t.pi = 549;
  39463. t.theta = 521;
  39464. t.rho = 549;
  39465. t.sigma = 603;
  39466. t.tau = 439;
  39467. t.upsilon = 576;
  39468. t.omega1 = 713;
  39469. t.omega = 686;
  39470. t.xi = 493;
  39471. t.psi = 686;
  39472. t.zeta = 494;
  39473. t.braceleft = 480;
  39474. t.bar = 200;
  39475. t.braceright = 480;
  39476. t.similar = 549;
  39477. t.Euro = 750;
  39478. t.Upsilon1 = 620;
  39479. t.minute = 247;
  39480. t.lessequal = 549;
  39481. t.fraction = 167;
  39482. t.infinity = 713;
  39483. t.florin = 500;
  39484. t.club = 753;
  39485. t.diamond = 753;
  39486. t.heart = 753;
  39487. t.spade = 753;
  39488. t.arrowboth = 1042;
  39489. t.arrowleft = 987;
  39490. t.arrowup = 603;
  39491. t.arrowright = 987;
  39492. t.arrowdown = 603;
  39493. t.degree = 400;
  39494. t.plusminus = 549;
  39495. t.second = 411;
  39496. t.greaterequal = 549;
  39497. t.multiply = 549;
  39498. t.proportional = 713;
  39499. t.partialdiff = 494;
  39500. t.bullet = 460;
  39501. t.divide = 549;
  39502. t.notequal = 549;
  39503. t.equivalence = 549;
  39504. t.approxequal = 549;
  39505. t.ellipsis = 1000;
  39506. t.arrowvertex = 603;
  39507. t.arrowhorizex = 1000;
  39508. t.carriagereturn = 658;
  39509. t.aleph = 823;
  39510. t.Ifraktur = 686;
  39511. t.Rfraktur = 795;
  39512. t.weierstrass = 987;
  39513. t.circlemultiply = 768;
  39514. t.circleplus = 768;
  39515. t.emptyset = 823;
  39516. t.intersection = 768;
  39517. t.union = 768;
  39518. t.propersuperset = 713;
  39519. t.reflexsuperset = 713;
  39520. t.notsubset = 713;
  39521. t.propersubset = 713;
  39522. t.reflexsubset = 713;
  39523. t.element = 713;
  39524. t.notelement = 713;
  39525. t.angle = 768;
  39526. t.gradient = 713;
  39527. t.registerserif = 790;
  39528. t.copyrightserif = 790;
  39529. t.trademarkserif = 890;
  39530. t.product = 823;
  39531. t.radical = 549;
  39532. t.dotmath = 250;
  39533. t.logicalnot = 713;
  39534. t.logicaland = 603;
  39535. t.logicalor = 603;
  39536. t.arrowdblboth = 1042;
  39537. t.arrowdblleft = 987;
  39538. t.arrowdblup = 603;
  39539. t.arrowdblright = 987;
  39540. t.arrowdbldown = 603;
  39541. t.lozenge = 494;
  39542. t.angleleft = 329;
  39543. t.registersans = 790;
  39544. t.copyrightsans = 790;
  39545. t.trademarksans = 786;
  39546. t.summation = 713;
  39547. t.parenlefttp = 384;
  39548. t.parenleftex = 384;
  39549. t.parenleftbt = 384;
  39550. t.bracketlefttp = 384;
  39551. t.bracketleftex = 384;
  39552. t.bracketleftbt = 384;
  39553. t.bracelefttp = 494;
  39554. t.braceleftmid = 494;
  39555. t.braceleftbt = 494;
  39556. t.braceex = 494;
  39557. t.angleright = 329;
  39558. t.integral = 274;
  39559. t.integraltp = 686;
  39560. t.integralex = 686;
  39561. t.integralbt = 686;
  39562. t.parenrighttp = 384;
  39563. t.parenrightex = 384;
  39564. t.parenrightbt = 384;
  39565. t.bracketrighttp = 384;
  39566. t.bracketrightex = 384;
  39567. t.bracketrightbt = 384;
  39568. t.bracerighttp = 494;
  39569. t.bracerightmid = 494;
  39570. t.bracerightbt = 494;
  39571. t.apple = 790;
  39572. });
  39573. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39574. t.space = 250;
  39575. t.exclam = 333;
  39576. t.quotedbl = 408;
  39577. t.numbersign = 500;
  39578. t.dollar = 500;
  39579. t.percent = 833;
  39580. t.ampersand = 778;
  39581. t.quoteright = 333;
  39582. t.parenleft = 333;
  39583. t.parenright = 333;
  39584. t.asterisk = 500;
  39585. t.plus = 564;
  39586. t.comma = 250;
  39587. t.hyphen = 333;
  39588. t.period = 250;
  39589. t.slash = 278;
  39590. t.zero = 500;
  39591. t.one = 500;
  39592. t.two = 500;
  39593. t.three = 500;
  39594. t.four = 500;
  39595. t.five = 500;
  39596. t.six = 500;
  39597. t.seven = 500;
  39598. t.eight = 500;
  39599. t.nine = 500;
  39600. t.colon = 278;
  39601. t.semicolon = 278;
  39602. t.less = 564;
  39603. t.equal = 564;
  39604. t.greater = 564;
  39605. t.question = 444;
  39606. t.at = 921;
  39607. t.A = 722;
  39608. t.B = 667;
  39609. t.C = 667;
  39610. t.D = 722;
  39611. t.E = 611;
  39612. t.F = 556;
  39613. t.G = 722;
  39614. t.H = 722;
  39615. t.I = 333;
  39616. t.J = 389;
  39617. t.K = 722;
  39618. t.L = 611;
  39619. t.M = 889;
  39620. t.N = 722;
  39621. t.O = 722;
  39622. t.P = 556;
  39623. t.Q = 722;
  39624. t.R = 667;
  39625. t.S = 556;
  39626. t.T = 611;
  39627. t.U = 722;
  39628. t.V = 722;
  39629. t.W = 944;
  39630. t.X = 722;
  39631. t.Y = 722;
  39632. t.Z = 611;
  39633. t.bracketleft = 333;
  39634. t.backslash = 278;
  39635. t.bracketright = 333;
  39636. t.asciicircum = 469;
  39637. t.underscore = 500;
  39638. t.quoteleft = 333;
  39639. t.a = 444;
  39640. t.b = 500;
  39641. t.c = 444;
  39642. t.d = 500;
  39643. t.e = 444;
  39644. t.f = 333;
  39645. t.g = 500;
  39646. t.h = 500;
  39647. t.i = 278;
  39648. t.j = 278;
  39649. t.k = 500;
  39650. t.l = 278;
  39651. t.m = 778;
  39652. t.n = 500;
  39653. t.o = 500;
  39654. t.p = 500;
  39655. t.q = 500;
  39656. t.r = 333;
  39657. t.s = 389;
  39658. t.t = 278;
  39659. t.u = 500;
  39660. t.v = 500;
  39661. t.w = 722;
  39662. t.x = 500;
  39663. t.y = 500;
  39664. t.z = 444;
  39665. t.braceleft = 480;
  39666. t.bar = 200;
  39667. t.braceright = 480;
  39668. t.asciitilde = 541;
  39669. t.exclamdown = 333;
  39670. t.cent = 500;
  39671. t.sterling = 500;
  39672. t.fraction = 167;
  39673. t.yen = 500;
  39674. t.florin = 500;
  39675. t.section = 500;
  39676. t.currency = 500;
  39677. t.quotesingle = 180;
  39678. t.quotedblleft = 444;
  39679. t.guillemotleft = 500;
  39680. t.guilsinglleft = 333;
  39681. t.guilsinglright = 333;
  39682. t.fi = 556;
  39683. t.fl = 556;
  39684. t.endash = 500;
  39685. t.dagger = 500;
  39686. t.daggerdbl = 500;
  39687. t.periodcentered = 250;
  39688. t.paragraph = 453;
  39689. t.bullet = 350;
  39690. t.quotesinglbase = 333;
  39691. t.quotedblbase = 444;
  39692. t.quotedblright = 444;
  39693. t.guillemotright = 500;
  39694. t.ellipsis = 1000;
  39695. t.perthousand = 1000;
  39696. t.questiondown = 444;
  39697. t.grave = 333;
  39698. t.acute = 333;
  39699. t.circumflex = 333;
  39700. t.tilde = 333;
  39701. t.macron = 333;
  39702. t.breve = 333;
  39703. t.dotaccent = 333;
  39704. t.dieresis = 333;
  39705. t.ring = 333;
  39706. t.cedilla = 333;
  39707. t.hungarumlaut = 333;
  39708. t.ogonek = 333;
  39709. t.caron = 333;
  39710. t.emdash = 1000;
  39711. t.AE = 889;
  39712. t.ordfeminine = 276;
  39713. t.Lslash = 611;
  39714. t.Oslash = 722;
  39715. t.OE = 889;
  39716. t.ordmasculine = 310;
  39717. t.ae = 667;
  39718. t.dotlessi = 278;
  39719. t.lslash = 278;
  39720. t.oslash = 500;
  39721. t.oe = 722;
  39722. t.germandbls = 500;
  39723. t.Idieresis = 333;
  39724. t.eacute = 444;
  39725. t.abreve = 444;
  39726. t.uhungarumlaut = 500;
  39727. t.ecaron = 444;
  39728. t.Ydieresis = 722;
  39729. t.divide = 564;
  39730. t.Yacute = 722;
  39731. t.Acircumflex = 722;
  39732. t.aacute = 444;
  39733. t.Ucircumflex = 722;
  39734. t.yacute = 500;
  39735. t.scommaaccent = 389;
  39736. t.ecircumflex = 444;
  39737. t.Uring = 722;
  39738. t.Udieresis = 722;
  39739. t.aogonek = 444;
  39740. t.Uacute = 722;
  39741. t.uogonek = 500;
  39742. t.Edieresis = 611;
  39743. t.Dcroat = 722;
  39744. t.commaaccent = 250;
  39745. t.copyright = 760;
  39746. t.Emacron = 611;
  39747. t.ccaron = 444;
  39748. t.aring = 444;
  39749. t.Ncommaaccent = 722;
  39750. t.lacute = 278;
  39751. t.agrave = 444;
  39752. t.Tcommaaccent = 611;
  39753. t.Cacute = 667;
  39754. t.atilde = 444;
  39755. t.Edotaccent = 611;
  39756. t.scaron = 389;
  39757. t.scedilla = 389;
  39758. t.iacute = 278;
  39759. t.lozenge = 471;
  39760. t.Rcaron = 667;
  39761. t.Gcommaaccent = 722;
  39762. t.ucircumflex = 500;
  39763. t.acircumflex = 444;
  39764. t.Amacron = 722;
  39765. t.rcaron = 333;
  39766. t.ccedilla = 444;
  39767. t.Zdotaccent = 611;
  39768. t.Thorn = 556;
  39769. t.Omacron = 722;
  39770. t.Racute = 667;
  39771. t.Sacute = 556;
  39772. t.dcaron = 588;
  39773. t.Umacron = 722;
  39774. t.uring = 500;
  39775. t.threesuperior = 300;
  39776. t.Ograve = 722;
  39777. t.Agrave = 722;
  39778. t.Abreve = 722;
  39779. t.multiply = 564;
  39780. t.uacute = 500;
  39781. t.Tcaron = 611;
  39782. t.partialdiff = 476;
  39783. t.ydieresis = 500;
  39784. t.Nacute = 722;
  39785. t.icircumflex = 278;
  39786. t.Ecircumflex = 611;
  39787. t.adieresis = 444;
  39788. t.edieresis = 444;
  39789. t.cacute = 444;
  39790. t.nacute = 500;
  39791. t.umacron = 500;
  39792. t.Ncaron = 722;
  39793. t.Iacute = 333;
  39794. t.plusminus = 564;
  39795. t.brokenbar = 200;
  39796. t.registered = 760;
  39797. t.Gbreve = 722;
  39798. t.Idotaccent = 333;
  39799. t.summation = 600;
  39800. t.Egrave = 611;
  39801. t.racute = 333;
  39802. t.omacron = 500;
  39803. t.Zacute = 611;
  39804. t.Zcaron = 611;
  39805. t.greaterequal = 549;
  39806. t.Eth = 722;
  39807. t.Ccedilla = 667;
  39808. t.lcommaaccent = 278;
  39809. t.tcaron = 326;
  39810. t.eogonek = 444;
  39811. t.Uogonek = 722;
  39812. t.Aacute = 722;
  39813. t.Adieresis = 722;
  39814. t.egrave = 444;
  39815. t.zacute = 444;
  39816. t.iogonek = 278;
  39817. t.Oacute = 722;
  39818. t.oacute = 500;
  39819. t.amacron = 444;
  39820. t.sacute = 389;
  39821. t.idieresis = 278;
  39822. t.Ocircumflex = 722;
  39823. t.Ugrave = 722;
  39824. t.Delta = 612;
  39825. t.thorn = 500;
  39826. t.twosuperior = 300;
  39827. t.Odieresis = 722;
  39828. t.mu = 500;
  39829. t.igrave = 278;
  39830. t.ohungarumlaut = 500;
  39831. t.Eogonek = 611;
  39832. t.dcroat = 500;
  39833. t.threequarters = 750;
  39834. t.Scedilla = 556;
  39835. t.lcaron = 344;
  39836. t.Kcommaaccent = 722;
  39837. t.Lacute = 611;
  39838. t.trademark = 980;
  39839. t.edotaccent = 444;
  39840. t.Igrave = 333;
  39841. t.Imacron = 333;
  39842. t.Lcaron = 611;
  39843. t.onehalf = 750;
  39844. t.lessequal = 549;
  39845. t.ocircumflex = 500;
  39846. t.ntilde = 500;
  39847. t.Uhungarumlaut = 722;
  39848. t.Eacute = 611;
  39849. t.emacron = 444;
  39850. t.gbreve = 500;
  39851. t.onequarter = 750;
  39852. t.Scaron = 556;
  39853. t.Scommaaccent = 556;
  39854. t.Ohungarumlaut = 722;
  39855. t.degree = 400;
  39856. t.ograve = 500;
  39857. t.Ccaron = 667;
  39858. t.ugrave = 500;
  39859. t.radical = 453;
  39860. t.Dcaron = 722;
  39861. t.rcommaaccent = 333;
  39862. t.Ntilde = 722;
  39863. t.otilde = 500;
  39864. t.Rcommaaccent = 667;
  39865. t.Lcommaaccent = 611;
  39866. t.Atilde = 722;
  39867. t.Aogonek = 722;
  39868. t.Aring = 722;
  39869. t.Otilde = 722;
  39870. t.zdotaccent = 444;
  39871. t.Ecaron = 611;
  39872. t.Iogonek = 333;
  39873. t.kcommaaccent = 500;
  39874. t.minus = 564;
  39875. t.Icircumflex = 333;
  39876. t.ncaron = 500;
  39877. t.tcommaaccent = 278;
  39878. t.logicalnot = 564;
  39879. t.odieresis = 500;
  39880. t.udieresis = 500;
  39881. t.notequal = 549;
  39882. t.gcommaaccent = 500;
  39883. t.eth = 500;
  39884. t.zcaron = 444;
  39885. t.ncommaaccent = 500;
  39886. t.onesuperior = 300;
  39887. t.imacron = 278;
  39888. t.Euro = 500;
  39889. });
  39890. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39891. t.space = 250;
  39892. t.exclam = 333;
  39893. t.quotedbl = 555;
  39894. t.numbersign = 500;
  39895. t.dollar = 500;
  39896. t.percent = 1000;
  39897. t.ampersand = 833;
  39898. t.quoteright = 333;
  39899. t.parenleft = 333;
  39900. t.parenright = 333;
  39901. t.asterisk = 500;
  39902. t.plus = 570;
  39903. t.comma = 250;
  39904. t.hyphen = 333;
  39905. t.period = 250;
  39906. t.slash = 278;
  39907. t.zero = 500;
  39908. t.one = 500;
  39909. t.two = 500;
  39910. t.three = 500;
  39911. t.four = 500;
  39912. t.five = 500;
  39913. t.six = 500;
  39914. t.seven = 500;
  39915. t.eight = 500;
  39916. t.nine = 500;
  39917. t.colon = 333;
  39918. t.semicolon = 333;
  39919. t.less = 570;
  39920. t.equal = 570;
  39921. t.greater = 570;
  39922. t.question = 500;
  39923. t.at = 930;
  39924. t.A = 722;
  39925. t.B = 667;
  39926. t.C = 722;
  39927. t.D = 722;
  39928. t.E = 667;
  39929. t.F = 611;
  39930. t.G = 778;
  39931. t.H = 778;
  39932. t.I = 389;
  39933. t.J = 500;
  39934. t.K = 778;
  39935. t.L = 667;
  39936. t.M = 944;
  39937. t.N = 722;
  39938. t.O = 778;
  39939. t.P = 611;
  39940. t.Q = 778;
  39941. t.R = 722;
  39942. t.S = 556;
  39943. t.T = 667;
  39944. t.U = 722;
  39945. t.V = 722;
  39946. t.W = 1000;
  39947. t.X = 722;
  39948. t.Y = 722;
  39949. t.Z = 667;
  39950. t.bracketleft = 333;
  39951. t.backslash = 278;
  39952. t.bracketright = 333;
  39953. t.asciicircum = 581;
  39954. t.underscore = 500;
  39955. t.quoteleft = 333;
  39956. t.a = 500;
  39957. t.b = 556;
  39958. t.c = 444;
  39959. t.d = 556;
  39960. t.e = 444;
  39961. t.f = 333;
  39962. t.g = 500;
  39963. t.h = 556;
  39964. t.i = 278;
  39965. t.j = 333;
  39966. t.k = 556;
  39967. t.l = 278;
  39968. t.m = 833;
  39969. t.n = 556;
  39970. t.o = 500;
  39971. t.p = 556;
  39972. t.q = 556;
  39973. t.r = 444;
  39974. t.s = 389;
  39975. t.t = 333;
  39976. t.u = 556;
  39977. t.v = 500;
  39978. t.w = 722;
  39979. t.x = 500;
  39980. t.y = 500;
  39981. t.z = 444;
  39982. t.braceleft = 394;
  39983. t.bar = 220;
  39984. t.braceright = 394;
  39985. t.asciitilde = 520;
  39986. t.exclamdown = 333;
  39987. t.cent = 500;
  39988. t.sterling = 500;
  39989. t.fraction = 167;
  39990. t.yen = 500;
  39991. t.florin = 500;
  39992. t.section = 500;
  39993. t.currency = 500;
  39994. t.quotesingle = 278;
  39995. t.quotedblleft = 500;
  39996. t.guillemotleft = 500;
  39997. t.guilsinglleft = 333;
  39998. t.guilsinglright = 333;
  39999. t.fi = 556;
  40000. t.fl = 556;
  40001. t.endash = 500;
  40002. t.dagger = 500;
  40003. t.daggerdbl = 500;
  40004. t.periodcentered = 250;
  40005. t.paragraph = 540;
  40006. t.bullet = 350;
  40007. t.quotesinglbase = 333;
  40008. t.quotedblbase = 500;
  40009. t.quotedblright = 500;
  40010. t.guillemotright = 500;
  40011. t.ellipsis = 1000;
  40012. t.perthousand = 1000;
  40013. t.questiondown = 500;
  40014. t.grave = 333;
  40015. t.acute = 333;
  40016. t.circumflex = 333;
  40017. t.tilde = 333;
  40018. t.macron = 333;
  40019. t.breve = 333;
  40020. t.dotaccent = 333;
  40021. t.dieresis = 333;
  40022. t.ring = 333;
  40023. t.cedilla = 333;
  40024. t.hungarumlaut = 333;
  40025. t.ogonek = 333;
  40026. t.caron = 333;
  40027. t.emdash = 1000;
  40028. t.AE = 1000;
  40029. t.ordfeminine = 300;
  40030. t.Lslash = 667;
  40031. t.Oslash = 778;
  40032. t.OE = 1000;
  40033. t.ordmasculine = 330;
  40034. t.ae = 722;
  40035. t.dotlessi = 278;
  40036. t.lslash = 278;
  40037. t.oslash = 500;
  40038. t.oe = 722;
  40039. t.germandbls = 556;
  40040. t.Idieresis = 389;
  40041. t.eacute = 444;
  40042. t.abreve = 500;
  40043. t.uhungarumlaut = 556;
  40044. t.ecaron = 444;
  40045. t.Ydieresis = 722;
  40046. t.divide = 570;
  40047. t.Yacute = 722;
  40048. t.Acircumflex = 722;
  40049. t.aacute = 500;
  40050. t.Ucircumflex = 722;
  40051. t.yacute = 500;
  40052. t.scommaaccent = 389;
  40053. t.ecircumflex = 444;
  40054. t.Uring = 722;
  40055. t.Udieresis = 722;
  40056. t.aogonek = 500;
  40057. t.Uacute = 722;
  40058. t.uogonek = 556;
  40059. t.Edieresis = 667;
  40060. t.Dcroat = 722;
  40061. t.commaaccent = 250;
  40062. t.copyright = 747;
  40063. t.Emacron = 667;
  40064. t.ccaron = 444;
  40065. t.aring = 500;
  40066. t.Ncommaaccent = 722;
  40067. t.lacute = 278;
  40068. t.agrave = 500;
  40069. t.Tcommaaccent = 667;
  40070. t.Cacute = 722;
  40071. t.atilde = 500;
  40072. t.Edotaccent = 667;
  40073. t.scaron = 389;
  40074. t.scedilla = 389;
  40075. t.iacute = 278;
  40076. t.lozenge = 494;
  40077. t.Rcaron = 722;
  40078. t.Gcommaaccent = 778;
  40079. t.ucircumflex = 556;
  40080. t.acircumflex = 500;
  40081. t.Amacron = 722;
  40082. t.rcaron = 444;
  40083. t.ccedilla = 444;
  40084. t.Zdotaccent = 667;
  40085. t.Thorn = 611;
  40086. t.Omacron = 778;
  40087. t.Racute = 722;
  40088. t.Sacute = 556;
  40089. t.dcaron = 672;
  40090. t.Umacron = 722;
  40091. t.uring = 556;
  40092. t.threesuperior = 300;
  40093. t.Ograve = 778;
  40094. t.Agrave = 722;
  40095. t.Abreve = 722;
  40096. t.multiply = 570;
  40097. t.uacute = 556;
  40098. t.Tcaron = 667;
  40099. t.partialdiff = 494;
  40100. t.ydieresis = 500;
  40101. t.Nacute = 722;
  40102. t.icircumflex = 278;
  40103. t.Ecircumflex = 667;
  40104. t.adieresis = 500;
  40105. t.edieresis = 444;
  40106. t.cacute = 444;
  40107. t.nacute = 556;
  40108. t.umacron = 556;
  40109. t.Ncaron = 722;
  40110. t.Iacute = 389;
  40111. t.plusminus = 570;
  40112. t.brokenbar = 220;
  40113. t.registered = 747;
  40114. t.Gbreve = 778;
  40115. t.Idotaccent = 389;
  40116. t.summation = 600;
  40117. t.Egrave = 667;
  40118. t.racute = 444;
  40119. t.omacron = 500;
  40120. t.Zacute = 667;
  40121. t.Zcaron = 667;
  40122. t.greaterequal = 549;
  40123. t.Eth = 722;
  40124. t.Ccedilla = 722;
  40125. t.lcommaaccent = 278;
  40126. t.tcaron = 416;
  40127. t.eogonek = 444;
  40128. t.Uogonek = 722;
  40129. t.Aacute = 722;
  40130. t.Adieresis = 722;
  40131. t.egrave = 444;
  40132. t.zacute = 444;
  40133. t.iogonek = 278;
  40134. t.Oacute = 778;
  40135. t.oacute = 500;
  40136. t.amacron = 500;
  40137. t.sacute = 389;
  40138. t.idieresis = 278;
  40139. t.Ocircumflex = 778;
  40140. t.Ugrave = 722;
  40141. t.Delta = 612;
  40142. t.thorn = 556;
  40143. t.twosuperior = 300;
  40144. t.Odieresis = 778;
  40145. t.mu = 556;
  40146. t.igrave = 278;
  40147. t.ohungarumlaut = 500;
  40148. t.Eogonek = 667;
  40149. t.dcroat = 556;
  40150. t.threequarters = 750;
  40151. t.Scedilla = 556;
  40152. t.lcaron = 394;
  40153. t.Kcommaaccent = 778;
  40154. t.Lacute = 667;
  40155. t.trademark = 1000;
  40156. t.edotaccent = 444;
  40157. t.Igrave = 389;
  40158. t.Imacron = 389;
  40159. t.Lcaron = 667;
  40160. t.onehalf = 750;
  40161. t.lessequal = 549;
  40162. t.ocircumflex = 500;
  40163. t.ntilde = 556;
  40164. t.Uhungarumlaut = 722;
  40165. t.Eacute = 667;
  40166. t.emacron = 444;
  40167. t.gbreve = 500;
  40168. t.onequarter = 750;
  40169. t.Scaron = 556;
  40170. t.Scommaaccent = 556;
  40171. t.Ohungarumlaut = 778;
  40172. t.degree = 400;
  40173. t.ograve = 500;
  40174. t.Ccaron = 722;
  40175. t.ugrave = 556;
  40176. t.radical = 549;
  40177. t.Dcaron = 722;
  40178. t.rcommaaccent = 444;
  40179. t.Ntilde = 722;
  40180. t.otilde = 500;
  40181. t.Rcommaaccent = 722;
  40182. t.Lcommaaccent = 667;
  40183. t.Atilde = 722;
  40184. t.Aogonek = 722;
  40185. t.Aring = 722;
  40186. t.Otilde = 778;
  40187. t.zdotaccent = 444;
  40188. t.Ecaron = 667;
  40189. t.Iogonek = 389;
  40190. t.kcommaaccent = 556;
  40191. t.minus = 570;
  40192. t.Icircumflex = 389;
  40193. t.ncaron = 556;
  40194. t.tcommaaccent = 333;
  40195. t.logicalnot = 570;
  40196. t.odieresis = 500;
  40197. t.udieresis = 556;
  40198. t.notequal = 549;
  40199. t.gcommaaccent = 500;
  40200. t.eth = 500;
  40201. t.zcaron = 444;
  40202. t.ncommaaccent = 556;
  40203. t.onesuperior = 300;
  40204. t.imacron = 278;
  40205. t.Euro = 500;
  40206. });
  40207. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40208. t.space = 250;
  40209. t.exclam = 389;
  40210. t.quotedbl = 555;
  40211. t.numbersign = 500;
  40212. t.dollar = 500;
  40213. t.percent = 833;
  40214. t.ampersand = 778;
  40215. t.quoteright = 333;
  40216. t.parenleft = 333;
  40217. t.parenright = 333;
  40218. t.asterisk = 500;
  40219. t.plus = 570;
  40220. t.comma = 250;
  40221. t.hyphen = 333;
  40222. t.period = 250;
  40223. t.slash = 278;
  40224. t.zero = 500;
  40225. t.one = 500;
  40226. t.two = 500;
  40227. t.three = 500;
  40228. t.four = 500;
  40229. t.five = 500;
  40230. t.six = 500;
  40231. t.seven = 500;
  40232. t.eight = 500;
  40233. t.nine = 500;
  40234. t.colon = 333;
  40235. t.semicolon = 333;
  40236. t.less = 570;
  40237. t.equal = 570;
  40238. t.greater = 570;
  40239. t.question = 500;
  40240. t.at = 832;
  40241. t.A = 667;
  40242. t.B = 667;
  40243. t.C = 667;
  40244. t.D = 722;
  40245. t.E = 667;
  40246. t.F = 667;
  40247. t.G = 722;
  40248. t.H = 778;
  40249. t.I = 389;
  40250. t.J = 500;
  40251. t.K = 667;
  40252. t.L = 611;
  40253. t.M = 889;
  40254. t.N = 722;
  40255. t.O = 722;
  40256. t.P = 611;
  40257. t.Q = 722;
  40258. t.R = 667;
  40259. t.S = 556;
  40260. t.T = 611;
  40261. t.U = 722;
  40262. t.V = 667;
  40263. t.W = 889;
  40264. t.X = 667;
  40265. t.Y = 611;
  40266. t.Z = 611;
  40267. t.bracketleft = 333;
  40268. t.backslash = 278;
  40269. t.bracketright = 333;
  40270. t.asciicircum = 570;
  40271. t.underscore = 500;
  40272. t.quoteleft = 333;
  40273. t.a = 500;
  40274. t.b = 500;
  40275. t.c = 444;
  40276. t.d = 500;
  40277. t.e = 444;
  40278. t.f = 333;
  40279. t.g = 500;
  40280. t.h = 556;
  40281. t.i = 278;
  40282. t.j = 278;
  40283. t.k = 500;
  40284. t.l = 278;
  40285. t.m = 778;
  40286. t.n = 556;
  40287. t.o = 500;
  40288. t.p = 500;
  40289. t.q = 500;
  40290. t.r = 389;
  40291. t.s = 389;
  40292. t.t = 278;
  40293. t.u = 556;
  40294. t.v = 444;
  40295. t.w = 667;
  40296. t.x = 500;
  40297. t.y = 444;
  40298. t.z = 389;
  40299. t.braceleft = 348;
  40300. t.bar = 220;
  40301. t.braceright = 348;
  40302. t.asciitilde = 570;
  40303. t.exclamdown = 389;
  40304. t.cent = 500;
  40305. t.sterling = 500;
  40306. t.fraction = 167;
  40307. t.yen = 500;
  40308. t.florin = 500;
  40309. t.section = 500;
  40310. t.currency = 500;
  40311. t.quotesingle = 278;
  40312. t.quotedblleft = 500;
  40313. t.guillemotleft = 500;
  40314. t.guilsinglleft = 333;
  40315. t.guilsinglright = 333;
  40316. t.fi = 556;
  40317. t.fl = 556;
  40318. t.endash = 500;
  40319. t.dagger = 500;
  40320. t.daggerdbl = 500;
  40321. t.periodcentered = 250;
  40322. t.paragraph = 500;
  40323. t.bullet = 350;
  40324. t.quotesinglbase = 333;
  40325. t.quotedblbase = 500;
  40326. t.quotedblright = 500;
  40327. t.guillemotright = 500;
  40328. t.ellipsis = 1000;
  40329. t.perthousand = 1000;
  40330. t.questiondown = 500;
  40331. t.grave = 333;
  40332. t.acute = 333;
  40333. t.circumflex = 333;
  40334. t.tilde = 333;
  40335. t.macron = 333;
  40336. t.breve = 333;
  40337. t.dotaccent = 333;
  40338. t.dieresis = 333;
  40339. t.ring = 333;
  40340. t.cedilla = 333;
  40341. t.hungarumlaut = 333;
  40342. t.ogonek = 333;
  40343. t.caron = 333;
  40344. t.emdash = 1000;
  40345. t.AE = 944;
  40346. t.ordfeminine = 266;
  40347. t.Lslash = 611;
  40348. t.Oslash = 722;
  40349. t.OE = 944;
  40350. t.ordmasculine = 300;
  40351. t.ae = 722;
  40352. t.dotlessi = 278;
  40353. t.lslash = 278;
  40354. t.oslash = 500;
  40355. t.oe = 722;
  40356. t.germandbls = 500;
  40357. t.Idieresis = 389;
  40358. t.eacute = 444;
  40359. t.abreve = 500;
  40360. t.uhungarumlaut = 556;
  40361. t.ecaron = 444;
  40362. t.Ydieresis = 611;
  40363. t.divide = 570;
  40364. t.Yacute = 611;
  40365. t.Acircumflex = 667;
  40366. t.aacute = 500;
  40367. t.Ucircumflex = 722;
  40368. t.yacute = 444;
  40369. t.scommaaccent = 389;
  40370. t.ecircumflex = 444;
  40371. t.Uring = 722;
  40372. t.Udieresis = 722;
  40373. t.aogonek = 500;
  40374. t.Uacute = 722;
  40375. t.uogonek = 556;
  40376. t.Edieresis = 667;
  40377. t.Dcroat = 722;
  40378. t.commaaccent = 250;
  40379. t.copyright = 747;
  40380. t.Emacron = 667;
  40381. t.ccaron = 444;
  40382. t.aring = 500;
  40383. t.Ncommaaccent = 722;
  40384. t.lacute = 278;
  40385. t.agrave = 500;
  40386. t.Tcommaaccent = 611;
  40387. t.Cacute = 667;
  40388. t.atilde = 500;
  40389. t.Edotaccent = 667;
  40390. t.scaron = 389;
  40391. t.scedilla = 389;
  40392. t.iacute = 278;
  40393. t.lozenge = 494;
  40394. t.Rcaron = 667;
  40395. t.Gcommaaccent = 722;
  40396. t.ucircumflex = 556;
  40397. t.acircumflex = 500;
  40398. t.Amacron = 667;
  40399. t.rcaron = 389;
  40400. t.ccedilla = 444;
  40401. t.Zdotaccent = 611;
  40402. t.Thorn = 611;
  40403. t.Omacron = 722;
  40404. t.Racute = 667;
  40405. t.Sacute = 556;
  40406. t.dcaron = 608;
  40407. t.Umacron = 722;
  40408. t.uring = 556;
  40409. t.threesuperior = 300;
  40410. t.Ograve = 722;
  40411. t.Agrave = 667;
  40412. t.Abreve = 667;
  40413. t.multiply = 570;
  40414. t.uacute = 556;
  40415. t.Tcaron = 611;
  40416. t.partialdiff = 494;
  40417. t.ydieresis = 444;
  40418. t.Nacute = 722;
  40419. t.icircumflex = 278;
  40420. t.Ecircumflex = 667;
  40421. t.adieresis = 500;
  40422. t.edieresis = 444;
  40423. t.cacute = 444;
  40424. t.nacute = 556;
  40425. t.umacron = 556;
  40426. t.Ncaron = 722;
  40427. t.Iacute = 389;
  40428. t.plusminus = 570;
  40429. t.brokenbar = 220;
  40430. t.registered = 747;
  40431. t.Gbreve = 722;
  40432. t.Idotaccent = 389;
  40433. t.summation = 600;
  40434. t.Egrave = 667;
  40435. t.racute = 389;
  40436. t.omacron = 500;
  40437. t.Zacute = 611;
  40438. t.Zcaron = 611;
  40439. t.greaterequal = 549;
  40440. t.Eth = 722;
  40441. t.Ccedilla = 667;
  40442. t.lcommaaccent = 278;
  40443. t.tcaron = 366;
  40444. t.eogonek = 444;
  40445. t.Uogonek = 722;
  40446. t.Aacute = 667;
  40447. t.Adieresis = 667;
  40448. t.egrave = 444;
  40449. t.zacute = 389;
  40450. t.iogonek = 278;
  40451. t.Oacute = 722;
  40452. t.oacute = 500;
  40453. t.amacron = 500;
  40454. t.sacute = 389;
  40455. t.idieresis = 278;
  40456. t.Ocircumflex = 722;
  40457. t.Ugrave = 722;
  40458. t.Delta = 612;
  40459. t.thorn = 500;
  40460. t.twosuperior = 300;
  40461. t.Odieresis = 722;
  40462. t.mu = 576;
  40463. t.igrave = 278;
  40464. t.ohungarumlaut = 500;
  40465. t.Eogonek = 667;
  40466. t.dcroat = 500;
  40467. t.threequarters = 750;
  40468. t.Scedilla = 556;
  40469. t.lcaron = 382;
  40470. t.Kcommaaccent = 667;
  40471. t.Lacute = 611;
  40472. t.trademark = 1000;
  40473. t.edotaccent = 444;
  40474. t.Igrave = 389;
  40475. t.Imacron = 389;
  40476. t.Lcaron = 611;
  40477. t.onehalf = 750;
  40478. t.lessequal = 549;
  40479. t.ocircumflex = 500;
  40480. t.ntilde = 556;
  40481. t.Uhungarumlaut = 722;
  40482. t.Eacute = 667;
  40483. t.emacron = 444;
  40484. t.gbreve = 500;
  40485. t.onequarter = 750;
  40486. t.Scaron = 556;
  40487. t.Scommaaccent = 556;
  40488. t.Ohungarumlaut = 722;
  40489. t.degree = 400;
  40490. t.ograve = 500;
  40491. t.Ccaron = 667;
  40492. t.ugrave = 556;
  40493. t.radical = 549;
  40494. t.Dcaron = 722;
  40495. t.rcommaaccent = 389;
  40496. t.Ntilde = 722;
  40497. t.otilde = 500;
  40498. t.Rcommaaccent = 667;
  40499. t.Lcommaaccent = 611;
  40500. t.Atilde = 667;
  40501. t.Aogonek = 667;
  40502. t.Aring = 667;
  40503. t.Otilde = 722;
  40504. t.zdotaccent = 389;
  40505. t.Ecaron = 667;
  40506. t.Iogonek = 389;
  40507. t.kcommaaccent = 500;
  40508. t.minus = 606;
  40509. t.Icircumflex = 389;
  40510. t.ncaron = 556;
  40511. t.tcommaaccent = 278;
  40512. t.logicalnot = 606;
  40513. t.odieresis = 500;
  40514. t.udieresis = 556;
  40515. t.notequal = 549;
  40516. t.gcommaaccent = 500;
  40517. t.eth = 500;
  40518. t.zcaron = 389;
  40519. t.ncommaaccent = 556;
  40520. t.onesuperior = 300;
  40521. t.imacron = 278;
  40522. t.Euro = 500;
  40523. });
  40524. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40525. t.space = 250;
  40526. t.exclam = 333;
  40527. t.quotedbl = 420;
  40528. t.numbersign = 500;
  40529. t.dollar = 500;
  40530. t.percent = 833;
  40531. t.ampersand = 778;
  40532. t.quoteright = 333;
  40533. t.parenleft = 333;
  40534. t.parenright = 333;
  40535. t.asterisk = 500;
  40536. t.plus = 675;
  40537. t.comma = 250;
  40538. t.hyphen = 333;
  40539. t.period = 250;
  40540. t.slash = 278;
  40541. t.zero = 500;
  40542. t.one = 500;
  40543. t.two = 500;
  40544. t.three = 500;
  40545. t.four = 500;
  40546. t.five = 500;
  40547. t.six = 500;
  40548. t.seven = 500;
  40549. t.eight = 500;
  40550. t.nine = 500;
  40551. t.colon = 333;
  40552. t.semicolon = 333;
  40553. t.less = 675;
  40554. t.equal = 675;
  40555. t.greater = 675;
  40556. t.question = 500;
  40557. t.at = 920;
  40558. t.A = 611;
  40559. t.B = 611;
  40560. t.C = 667;
  40561. t.D = 722;
  40562. t.E = 611;
  40563. t.F = 611;
  40564. t.G = 722;
  40565. t.H = 722;
  40566. t.I = 333;
  40567. t.J = 444;
  40568. t.K = 667;
  40569. t.L = 556;
  40570. t.M = 833;
  40571. t.N = 667;
  40572. t.O = 722;
  40573. t.P = 611;
  40574. t.Q = 722;
  40575. t.R = 611;
  40576. t.S = 500;
  40577. t.T = 556;
  40578. t.U = 722;
  40579. t.V = 611;
  40580. t.W = 833;
  40581. t.X = 611;
  40582. t.Y = 556;
  40583. t.Z = 556;
  40584. t.bracketleft = 389;
  40585. t.backslash = 278;
  40586. t.bracketright = 389;
  40587. t.asciicircum = 422;
  40588. t.underscore = 500;
  40589. t.quoteleft = 333;
  40590. t.a = 500;
  40591. t.b = 500;
  40592. t.c = 444;
  40593. t.d = 500;
  40594. t.e = 444;
  40595. t.f = 278;
  40596. t.g = 500;
  40597. t.h = 500;
  40598. t.i = 278;
  40599. t.j = 278;
  40600. t.k = 444;
  40601. t.l = 278;
  40602. t.m = 722;
  40603. t.n = 500;
  40604. t.o = 500;
  40605. t.p = 500;
  40606. t.q = 500;
  40607. t.r = 389;
  40608. t.s = 389;
  40609. t.t = 278;
  40610. t.u = 500;
  40611. t.v = 444;
  40612. t.w = 667;
  40613. t.x = 444;
  40614. t.y = 444;
  40615. t.z = 389;
  40616. t.braceleft = 400;
  40617. t.bar = 275;
  40618. t.braceright = 400;
  40619. t.asciitilde = 541;
  40620. t.exclamdown = 389;
  40621. t.cent = 500;
  40622. t.sterling = 500;
  40623. t.fraction = 167;
  40624. t.yen = 500;
  40625. t.florin = 500;
  40626. t.section = 500;
  40627. t.currency = 500;
  40628. t.quotesingle = 214;
  40629. t.quotedblleft = 556;
  40630. t.guillemotleft = 500;
  40631. t.guilsinglleft = 333;
  40632. t.guilsinglright = 333;
  40633. t.fi = 500;
  40634. t.fl = 500;
  40635. t.endash = 500;
  40636. t.dagger = 500;
  40637. t.daggerdbl = 500;
  40638. t.periodcentered = 250;
  40639. t.paragraph = 523;
  40640. t.bullet = 350;
  40641. t.quotesinglbase = 333;
  40642. t.quotedblbase = 556;
  40643. t.quotedblright = 556;
  40644. t.guillemotright = 500;
  40645. t.ellipsis = 889;
  40646. t.perthousand = 1000;
  40647. t.questiondown = 500;
  40648. t.grave = 333;
  40649. t.acute = 333;
  40650. t.circumflex = 333;
  40651. t.tilde = 333;
  40652. t.macron = 333;
  40653. t.breve = 333;
  40654. t.dotaccent = 333;
  40655. t.dieresis = 333;
  40656. t.ring = 333;
  40657. t.cedilla = 333;
  40658. t.hungarumlaut = 333;
  40659. t.ogonek = 333;
  40660. t.caron = 333;
  40661. t.emdash = 889;
  40662. t.AE = 889;
  40663. t.ordfeminine = 276;
  40664. t.Lslash = 556;
  40665. t.Oslash = 722;
  40666. t.OE = 944;
  40667. t.ordmasculine = 310;
  40668. t.ae = 667;
  40669. t.dotlessi = 278;
  40670. t.lslash = 278;
  40671. t.oslash = 500;
  40672. t.oe = 667;
  40673. t.germandbls = 500;
  40674. t.Idieresis = 333;
  40675. t.eacute = 444;
  40676. t.abreve = 500;
  40677. t.uhungarumlaut = 500;
  40678. t.ecaron = 444;
  40679. t.Ydieresis = 556;
  40680. t.divide = 675;
  40681. t.Yacute = 556;
  40682. t.Acircumflex = 611;
  40683. t.aacute = 500;
  40684. t.Ucircumflex = 722;
  40685. t.yacute = 444;
  40686. t.scommaaccent = 389;
  40687. t.ecircumflex = 444;
  40688. t.Uring = 722;
  40689. t.Udieresis = 722;
  40690. t.aogonek = 500;
  40691. t.Uacute = 722;
  40692. t.uogonek = 500;
  40693. t.Edieresis = 611;
  40694. t.Dcroat = 722;
  40695. t.commaaccent = 250;
  40696. t.copyright = 760;
  40697. t.Emacron = 611;
  40698. t.ccaron = 444;
  40699. t.aring = 500;
  40700. t.Ncommaaccent = 667;
  40701. t.lacute = 278;
  40702. t.agrave = 500;
  40703. t.Tcommaaccent = 556;
  40704. t.Cacute = 667;
  40705. t.atilde = 500;
  40706. t.Edotaccent = 611;
  40707. t.scaron = 389;
  40708. t.scedilla = 389;
  40709. t.iacute = 278;
  40710. t.lozenge = 471;
  40711. t.Rcaron = 611;
  40712. t.Gcommaaccent = 722;
  40713. t.ucircumflex = 500;
  40714. t.acircumflex = 500;
  40715. t.Amacron = 611;
  40716. t.rcaron = 389;
  40717. t.ccedilla = 444;
  40718. t.Zdotaccent = 556;
  40719. t.Thorn = 611;
  40720. t.Omacron = 722;
  40721. t.Racute = 611;
  40722. t.Sacute = 500;
  40723. t.dcaron = 544;
  40724. t.Umacron = 722;
  40725. t.uring = 500;
  40726. t.threesuperior = 300;
  40727. t.Ograve = 722;
  40728. t.Agrave = 611;
  40729. t.Abreve = 611;
  40730. t.multiply = 675;
  40731. t.uacute = 500;
  40732. t.Tcaron = 556;
  40733. t.partialdiff = 476;
  40734. t.ydieresis = 444;
  40735. t.Nacute = 667;
  40736. t.icircumflex = 278;
  40737. t.Ecircumflex = 611;
  40738. t.adieresis = 500;
  40739. t.edieresis = 444;
  40740. t.cacute = 444;
  40741. t.nacute = 500;
  40742. t.umacron = 500;
  40743. t.Ncaron = 667;
  40744. t.Iacute = 333;
  40745. t.plusminus = 675;
  40746. t.brokenbar = 275;
  40747. t.registered = 760;
  40748. t.Gbreve = 722;
  40749. t.Idotaccent = 333;
  40750. t.summation = 600;
  40751. t.Egrave = 611;
  40752. t.racute = 389;
  40753. t.omacron = 500;
  40754. t.Zacute = 556;
  40755. t.Zcaron = 556;
  40756. t.greaterequal = 549;
  40757. t.Eth = 722;
  40758. t.Ccedilla = 667;
  40759. t.lcommaaccent = 278;
  40760. t.tcaron = 300;
  40761. t.eogonek = 444;
  40762. t.Uogonek = 722;
  40763. t.Aacute = 611;
  40764. t.Adieresis = 611;
  40765. t.egrave = 444;
  40766. t.zacute = 389;
  40767. t.iogonek = 278;
  40768. t.Oacute = 722;
  40769. t.oacute = 500;
  40770. t.amacron = 500;
  40771. t.sacute = 389;
  40772. t.idieresis = 278;
  40773. t.Ocircumflex = 722;
  40774. t.Ugrave = 722;
  40775. t.Delta = 612;
  40776. t.thorn = 500;
  40777. t.twosuperior = 300;
  40778. t.Odieresis = 722;
  40779. t.mu = 500;
  40780. t.igrave = 278;
  40781. t.ohungarumlaut = 500;
  40782. t.Eogonek = 611;
  40783. t.dcroat = 500;
  40784. t.threequarters = 750;
  40785. t.Scedilla = 500;
  40786. t.lcaron = 300;
  40787. t.Kcommaaccent = 667;
  40788. t.Lacute = 556;
  40789. t.trademark = 980;
  40790. t.edotaccent = 444;
  40791. t.Igrave = 333;
  40792. t.Imacron = 333;
  40793. t.Lcaron = 611;
  40794. t.onehalf = 750;
  40795. t.lessequal = 549;
  40796. t.ocircumflex = 500;
  40797. t.ntilde = 500;
  40798. t.Uhungarumlaut = 722;
  40799. t.Eacute = 611;
  40800. t.emacron = 444;
  40801. t.gbreve = 500;
  40802. t.onequarter = 750;
  40803. t.Scaron = 500;
  40804. t.Scommaaccent = 500;
  40805. t.Ohungarumlaut = 722;
  40806. t.degree = 400;
  40807. t.ograve = 500;
  40808. t.Ccaron = 667;
  40809. t.ugrave = 500;
  40810. t.radical = 453;
  40811. t.Dcaron = 722;
  40812. t.rcommaaccent = 389;
  40813. t.Ntilde = 667;
  40814. t.otilde = 500;
  40815. t.Rcommaaccent = 611;
  40816. t.Lcommaaccent = 556;
  40817. t.Atilde = 611;
  40818. t.Aogonek = 611;
  40819. t.Aring = 611;
  40820. t.Otilde = 722;
  40821. t.zdotaccent = 389;
  40822. t.Ecaron = 611;
  40823. t.Iogonek = 333;
  40824. t.kcommaaccent = 444;
  40825. t.minus = 675;
  40826. t.Icircumflex = 333;
  40827. t.ncaron = 500;
  40828. t.tcommaaccent = 278;
  40829. t.logicalnot = 675;
  40830. t.odieresis = 500;
  40831. t.udieresis = 500;
  40832. t.notequal = 549;
  40833. t.gcommaaccent = 500;
  40834. t.eth = 500;
  40835. t.zcaron = 389;
  40836. t.ncommaaccent = 500;
  40837. t.onesuperior = 300;
  40838. t.imacron = 278;
  40839. t.Euro = 500;
  40840. });
  40841. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  40842. t.space = 278;
  40843. t.a1 = 974;
  40844. t.a2 = 961;
  40845. t.a202 = 974;
  40846. t.a3 = 980;
  40847. t.a4 = 719;
  40848. t.a5 = 789;
  40849. t.a119 = 790;
  40850. t.a118 = 791;
  40851. t.a117 = 690;
  40852. t.a11 = 960;
  40853. t.a12 = 939;
  40854. t.a13 = 549;
  40855. t.a14 = 855;
  40856. t.a15 = 911;
  40857. t.a16 = 933;
  40858. t.a105 = 911;
  40859. t.a17 = 945;
  40860. t.a18 = 974;
  40861. t.a19 = 755;
  40862. t.a20 = 846;
  40863. t.a21 = 762;
  40864. t.a22 = 761;
  40865. t.a23 = 571;
  40866. t.a24 = 677;
  40867. t.a25 = 763;
  40868. t.a26 = 760;
  40869. t.a27 = 759;
  40870. t.a28 = 754;
  40871. t.a6 = 494;
  40872. t.a7 = 552;
  40873. t.a8 = 537;
  40874. t.a9 = 577;
  40875. t.a10 = 692;
  40876. t.a29 = 786;
  40877. t.a30 = 788;
  40878. t.a31 = 788;
  40879. t.a32 = 790;
  40880. t.a33 = 793;
  40881. t.a34 = 794;
  40882. t.a35 = 816;
  40883. t.a36 = 823;
  40884. t.a37 = 789;
  40885. t.a38 = 841;
  40886. t.a39 = 823;
  40887. t.a40 = 833;
  40888. t.a41 = 816;
  40889. t.a42 = 831;
  40890. t.a43 = 923;
  40891. t.a44 = 744;
  40892. t.a45 = 723;
  40893. t.a46 = 749;
  40894. t.a47 = 790;
  40895. t.a48 = 792;
  40896. t.a49 = 695;
  40897. t.a50 = 776;
  40898. t.a51 = 768;
  40899. t.a52 = 792;
  40900. t.a53 = 759;
  40901. t.a54 = 707;
  40902. t.a55 = 708;
  40903. t.a56 = 682;
  40904. t.a57 = 701;
  40905. t.a58 = 826;
  40906. t.a59 = 815;
  40907. t.a60 = 789;
  40908. t.a61 = 789;
  40909. t.a62 = 707;
  40910. t.a63 = 687;
  40911. t.a64 = 696;
  40912. t.a65 = 689;
  40913. t.a66 = 786;
  40914. t.a67 = 787;
  40915. t.a68 = 713;
  40916. t.a69 = 791;
  40917. t.a70 = 785;
  40918. t.a71 = 791;
  40919. t.a72 = 873;
  40920. t.a73 = 761;
  40921. t.a74 = 762;
  40922. t.a203 = 762;
  40923. t.a75 = 759;
  40924. t.a204 = 759;
  40925. t.a76 = 892;
  40926. t.a77 = 892;
  40927. t.a78 = 788;
  40928. t.a79 = 784;
  40929. t.a81 = 438;
  40930. t.a82 = 138;
  40931. t.a83 = 277;
  40932. t.a84 = 415;
  40933. t.a97 = 392;
  40934. t.a98 = 392;
  40935. t.a99 = 668;
  40936. t.a100 = 668;
  40937. t.a89 = 390;
  40938. t.a90 = 390;
  40939. t.a93 = 317;
  40940. t.a94 = 317;
  40941. t.a91 = 276;
  40942. t.a92 = 276;
  40943. t.a205 = 509;
  40944. t.a85 = 509;
  40945. t.a206 = 410;
  40946. t.a86 = 410;
  40947. t.a87 = 234;
  40948. t.a88 = 234;
  40949. t.a95 = 334;
  40950. t.a96 = 334;
  40951. t.a101 = 732;
  40952. t.a102 = 544;
  40953. t.a103 = 544;
  40954. t.a104 = 910;
  40955. t.a106 = 667;
  40956. t.a107 = 760;
  40957. t.a108 = 760;
  40958. t.a112 = 776;
  40959. t.a111 = 595;
  40960. t.a110 = 694;
  40961. t.a109 = 626;
  40962. t.a120 = 788;
  40963. t.a121 = 788;
  40964. t.a122 = 788;
  40965. t.a123 = 788;
  40966. t.a124 = 788;
  40967. t.a125 = 788;
  40968. t.a126 = 788;
  40969. t.a127 = 788;
  40970. t.a128 = 788;
  40971. t.a129 = 788;
  40972. t.a130 = 788;
  40973. t.a131 = 788;
  40974. t.a132 = 788;
  40975. t.a133 = 788;
  40976. t.a134 = 788;
  40977. t.a135 = 788;
  40978. t.a136 = 788;
  40979. t.a137 = 788;
  40980. t.a138 = 788;
  40981. t.a139 = 788;
  40982. t.a140 = 788;
  40983. t.a141 = 788;
  40984. t.a142 = 788;
  40985. t.a143 = 788;
  40986. t.a144 = 788;
  40987. t.a145 = 788;
  40988. t.a146 = 788;
  40989. t.a147 = 788;
  40990. t.a148 = 788;
  40991. t.a149 = 788;
  40992. t.a150 = 788;
  40993. t.a151 = 788;
  40994. t.a152 = 788;
  40995. t.a153 = 788;
  40996. t.a154 = 788;
  40997. t.a155 = 788;
  40998. t.a156 = 788;
  40999. t.a157 = 788;
  41000. t.a158 = 788;
  41001. t.a159 = 788;
  41002. t.a160 = 894;
  41003. t.a161 = 838;
  41004. t.a163 = 1016;
  41005. t.a164 = 458;
  41006. t.a196 = 748;
  41007. t.a165 = 924;
  41008. t.a192 = 748;
  41009. t.a166 = 918;
  41010. t.a167 = 927;
  41011. t.a168 = 928;
  41012. t.a169 = 928;
  41013. t.a170 = 834;
  41014. t.a171 = 873;
  41015. t.a172 = 828;
  41016. t.a173 = 924;
  41017. t.a162 = 924;
  41018. t.a174 = 917;
  41019. t.a175 = 930;
  41020. t.a176 = 931;
  41021. t.a177 = 463;
  41022. t.a178 = 883;
  41023. t.a179 = 836;
  41024. t.a193 = 836;
  41025. t.a180 = 867;
  41026. t.a199 = 867;
  41027. t.a181 = 696;
  41028. t.a200 = 696;
  41029. t.a182 = 874;
  41030. t.a201 = 874;
  41031. t.a183 = 760;
  41032. t.a184 = 946;
  41033. t.a197 = 771;
  41034. t.a185 = 865;
  41035. t.a194 = 771;
  41036. t.a198 = 888;
  41037. t.a186 = 967;
  41038. t.a195 = 888;
  41039. t.a187 = 831;
  41040. t.a188 = 873;
  41041. t.a189 = 927;
  41042. t.a190 = 970;
  41043. t.a191 = 918;
  41044. });
  41045. });
  41046. exports.getMetrics = getMetrics;
  41047. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41048. t.Courier = {
  41049. ascent: 629,
  41050. descent: -157,
  41051. capHeight: 562,
  41052. xHeight: -426
  41053. };
  41054. t["Courier-Bold"] = {
  41055. ascent: 629,
  41056. descent: -157,
  41057. capHeight: 562,
  41058. xHeight: 439
  41059. };
  41060. t["Courier-Oblique"] = {
  41061. ascent: 629,
  41062. descent: -157,
  41063. capHeight: 562,
  41064. xHeight: 426
  41065. };
  41066. t["Courier-BoldOblique"] = {
  41067. ascent: 629,
  41068. descent: -157,
  41069. capHeight: 562,
  41070. xHeight: 426
  41071. };
  41072. t.Helvetica = {
  41073. ascent: 718,
  41074. descent: -207,
  41075. capHeight: 718,
  41076. xHeight: 523
  41077. };
  41078. t["Helvetica-Bold"] = {
  41079. ascent: 718,
  41080. descent: -207,
  41081. capHeight: 718,
  41082. xHeight: 532
  41083. };
  41084. t["Helvetica-Oblique"] = {
  41085. ascent: 718,
  41086. descent: -207,
  41087. capHeight: 718,
  41088. xHeight: 523
  41089. };
  41090. t["Helvetica-BoldOblique"] = {
  41091. ascent: 718,
  41092. descent: -207,
  41093. capHeight: 718,
  41094. xHeight: 532
  41095. };
  41096. t["Times-Roman"] = {
  41097. ascent: 683,
  41098. descent: -217,
  41099. capHeight: 662,
  41100. xHeight: 450
  41101. };
  41102. t["Times-Bold"] = {
  41103. ascent: 683,
  41104. descent: -217,
  41105. capHeight: 676,
  41106. xHeight: 461
  41107. };
  41108. t["Times-Italic"] = {
  41109. ascent: 683,
  41110. descent: -217,
  41111. capHeight: 653,
  41112. xHeight: 441
  41113. };
  41114. t["Times-BoldItalic"] = {
  41115. ascent: 683,
  41116. descent: -217,
  41117. capHeight: 669,
  41118. xHeight: 462
  41119. };
  41120. t.Symbol = {
  41121. ascent: Math.NaN,
  41122. descent: Math.NaN,
  41123. capHeight: Math.NaN,
  41124. xHeight: Math.NaN
  41125. };
  41126. t.ZapfDingbats = {
  41127. ascent: Math.NaN,
  41128. descent: Math.NaN,
  41129. capHeight: Math.NaN,
  41130. xHeight: Math.NaN
  41131. };
  41132. });
  41133. exports.getFontBasicMetrics = getFontBasicMetrics;
  41134. /***/ }),
  41135. /* 52 */
  41136. /***/ ((__unused_webpack_module, exports) => {
  41137. Object.defineProperty(exports, "__esModule", ({
  41138. value: true
  41139. }));
  41140. exports.GlyfTable = void 0;
  41141. const ON_CURVE_POINT = 1 << 0;
  41142. const X_SHORT_VECTOR = 1 << 1;
  41143. const Y_SHORT_VECTOR = 1 << 2;
  41144. const REPEAT_FLAG = 1 << 3;
  41145. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41146. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41147. const OVERLAP_SIMPLE = 1 << 6;
  41148. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41149. const ARGS_ARE_XY_VALUES = 1 << 1;
  41150. const WE_HAVE_A_SCALE = 1 << 3;
  41151. const MORE_COMPONENTS = 1 << 5;
  41152. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41153. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41154. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41155. class GlyfTable {
  41156. constructor({
  41157. glyfTable,
  41158. isGlyphLocationsLong,
  41159. locaTable,
  41160. numGlyphs
  41161. }) {
  41162. this.glyphs = [];
  41163. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41164. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41165. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41166. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41167. let pos = 0;
  41168. for (let i = 0; i < numGlyphs; i++) {
  41169. pos += offsetSize;
  41170. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41171. if (next === prev) {
  41172. this.glyphs.push(new Glyph({}));
  41173. continue;
  41174. }
  41175. const glyph = Glyph.parse(prev, glyf);
  41176. this.glyphs.push(glyph);
  41177. prev = next;
  41178. }
  41179. }
  41180. getSize() {
  41181. return this.glyphs.reduce((a, g) => {
  41182. const size = g.getSize();
  41183. return a + (size + 3 & ~3);
  41184. }, 0);
  41185. }
  41186. write() {
  41187. const totalSize = this.getSize();
  41188. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41189. const isLocationLong = totalSize > 0x1fffe;
  41190. const offsetSize = isLocationLong ? 4 : 2;
  41191. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41192. if (isLocationLong) {
  41193. locaTable.setUint32(0, 0);
  41194. } else {
  41195. locaTable.setUint16(0, 0);
  41196. }
  41197. let pos = 0;
  41198. let locaIndex = 0;
  41199. for (const glyph of this.glyphs) {
  41200. pos += glyph.write(pos, glyfTable);
  41201. pos = pos + 3 & ~3;
  41202. locaIndex += offsetSize;
  41203. if (isLocationLong) {
  41204. locaTable.setUint32(locaIndex, pos);
  41205. } else {
  41206. locaTable.setUint16(locaIndex, pos >> 1);
  41207. }
  41208. }
  41209. return {
  41210. isLocationLong,
  41211. loca: new Uint8Array(locaTable.buffer),
  41212. glyf: new Uint8Array(glyfTable.buffer)
  41213. };
  41214. }
  41215. scale(factors) {
  41216. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41217. this.glyphs[i].scale(factors[i]);
  41218. }
  41219. }
  41220. }
  41221. exports.GlyfTable = GlyfTable;
  41222. class Glyph {
  41223. constructor({
  41224. header = null,
  41225. simple = null,
  41226. composites = null
  41227. }) {
  41228. this.header = header;
  41229. this.simple = simple;
  41230. this.composites = composites;
  41231. }
  41232. static parse(pos, glyf) {
  41233. const [read, header] = GlyphHeader.parse(pos, glyf);
  41234. pos += read;
  41235. if (header.numberOfContours < 0) {
  41236. const composites = [];
  41237. while (true) {
  41238. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41239. pos += n;
  41240. composites.push(composite);
  41241. if (!(composite.flags & MORE_COMPONENTS)) {
  41242. break;
  41243. }
  41244. }
  41245. return new Glyph({
  41246. header,
  41247. composites
  41248. });
  41249. }
  41250. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  41251. return new Glyph({
  41252. header,
  41253. simple
  41254. });
  41255. }
  41256. getSize() {
  41257. if (!this.header) {
  41258. return 0;
  41259. }
  41260. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  41261. return this.header.getSize() + size;
  41262. }
  41263. write(pos, buf) {
  41264. if (!this.header) {
  41265. return 0;
  41266. }
  41267. const spos = pos;
  41268. pos += this.header.write(pos, buf);
  41269. if (this.simple) {
  41270. pos += this.simple.write(pos, buf);
  41271. } else {
  41272. for (const composite of this.composites) {
  41273. pos += composite.write(pos, buf);
  41274. }
  41275. }
  41276. return pos - spos;
  41277. }
  41278. scale(factor) {
  41279. if (!this.header) {
  41280. return;
  41281. }
  41282. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  41283. this.header.scale(xMiddle, factor);
  41284. if (this.simple) {
  41285. this.simple.scale(xMiddle, factor);
  41286. } else {
  41287. for (const composite of this.composites) {
  41288. composite.scale(xMiddle, factor);
  41289. }
  41290. }
  41291. }
  41292. }
  41293. class GlyphHeader {
  41294. constructor({
  41295. numberOfContours,
  41296. xMin,
  41297. yMin,
  41298. xMax,
  41299. yMax
  41300. }) {
  41301. this.numberOfContours = numberOfContours;
  41302. this.xMin = xMin;
  41303. this.yMin = yMin;
  41304. this.xMax = xMax;
  41305. this.yMax = yMax;
  41306. }
  41307. static parse(pos, glyf) {
  41308. return [10, new GlyphHeader({
  41309. numberOfContours: glyf.getInt16(pos),
  41310. xMin: glyf.getInt16(pos + 2),
  41311. yMin: glyf.getInt16(pos + 4),
  41312. xMax: glyf.getInt16(pos + 6),
  41313. yMax: glyf.getInt16(pos + 8)
  41314. })];
  41315. }
  41316. getSize() {
  41317. return 10;
  41318. }
  41319. write(pos, buf) {
  41320. buf.setInt16(pos, this.numberOfContours);
  41321. buf.setInt16(pos + 2, this.xMin);
  41322. buf.setInt16(pos + 4, this.yMin);
  41323. buf.setInt16(pos + 6, this.xMax);
  41324. buf.setInt16(pos + 8, this.yMax);
  41325. return 10;
  41326. }
  41327. scale(x, factor) {
  41328. this.xMin = Math.round(x + (this.xMin - x) * factor);
  41329. this.xMax = Math.round(x + (this.xMax - x) * factor);
  41330. }
  41331. }
  41332. class Contour {
  41333. constructor({
  41334. flags,
  41335. xCoordinates,
  41336. yCoordinates
  41337. }) {
  41338. this.xCoordinates = xCoordinates;
  41339. this.yCoordinates = yCoordinates;
  41340. this.flags = flags;
  41341. }
  41342. }
  41343. class SimpleGlyph {
  41344. constructor({
  41345. contours,
  41346. instructions
  41347. }) {
  41348. this.contours = contours;
  41349. this.instructions = instructions;
  41350. }
  41351. static parse(pos, glyf, numberOfContours) {
  41352. const endPtsOfContours = [];
  41353. for (let i = 0; i < numberOfContours; i++) {
  41354. const endPt = glyf.getUint16(pos);
  41355. pos += 2;
  41356. endPtsOfContours.push(endPt);
  41357. }
  41358. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  41359. const instructionLength = glyf.getUint16(pos);
  41360. pos += 2;
  41361. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41362. pos += instructionLength;
  41363. const flags = [];
  41364. for (let i = 0; i < numberOfPt; pos++, i++) {
  41365. let flag = glyf.getUint8(pos);
  41366. flags.push(flag);
  41367. if (flag & REPEAT_FLAG) {
  41368. const count = glyf.getUint8(++pos);
  41369. flag ^= REPEAT_FLAG;
  41370. for (let m = 0; m < count; m++) {
  41371. flags.push(flag);
  41372. }
  41373. i += count;
  41374. }
  41375. }
  41376. const allXCoordinates = [];
  41377. let xCoordinates = [];
  41378. let yCoordinates = [];
  41379. let pointFlags = [];
  41380. const contours = [];
  41381. let endPtsOfContoursIndex = 0;
  41382. let lastCoordinate = 0;
  41383. for (let i = 0; i < numberOfPt; i++) {
  41384. const flag = flags[i];
  41385. if (flag & X_SHORT_VECTOR) {
  41386. const x = glyf.getUint8(pos++);
  41387. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  41388. xCoordinates.push(lastCoordinate);
  41389. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  41390. xCoordinates.push(lastCoordinate);
  41391. } else {
  41392. lastCoordinate += glyf.getInt16(pos);
  41393. pos += 2;
  41394. xCoordinates.push(lastCoordinate);
  41395. }
  41396. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41397. endPtsOfContoursIndex++;
  41398. allXCoordinates.push(xCoordinates);
  41399. xCoordinates = [];
  41400. }
  41401. }
  41402. lastCoordinate = 0;
  41403. endPtsOfContoursIndex = 0;
  41404. for (let i = 0; i < numberOfPt; i++) {
  41405. const flag = flags[i];
  41406. if (flag & Y_SHORT_VECTOR) {
  41407. const y = glyf.getUint8(pos++);
  41408. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  41409. yCoordinates.push(lastCoordinate);
  41410. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  41411. yCoordinates.push(lastCoordinate);
  41412. } else {
  41413. lastCoordinate += glyf.getInt16(pos);
  41414. pos += 2;
  41415. yCoordinates.push(lastCoordinate);
  41416. }
  41417. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  41418. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41419. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  41420. endPtsOfContoursIndex++;
  41421. contours.push(new Contour({
  41422. flags: pointFlags,
  41423. xCoordinates,
  41424. yCoordinates
  41425. }));
  41426. yCoordinates = [];
  41427. pointFlags = [];
  41428. }
  41429. }
  41430. return new SimpleGlyph({
  41431. contours,
  41432. instructions
  41433. });
  41434. }
  41435. getSize() {
  41436. let size = this.contours.length * 2 + 2 + this.instructions.length;
  41437. let lastX = 0;
  41438. let lastY = 0;
  41439. for (const contour of this.contours) {
  41440. size += contour.flags.length;
  41441. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41442. const x = contour.xCoordinates[i];
  41443. const y = contour.yCoordinates[i];
  41444. let abs = Math.abs(x - lastX);
  41445. if (abs > 255) {
  41446. size += 2;
  41447. } else if (abs > 0) {
  41448. size += 1;
  41449. }
  41450. lastX = x;
  41451. abs = Math.abs(y - lastY);
  41452. if (abs > 255) {
  41453. size += 2;
  41454. } else if (abs > 0) {
  41455. size += 1;
  41456. }
  41457. lastY = y;
  41458. }
  41459. }
  41460. return size;
  41461. }
  41462. write(pos, buf) {
  41463. const spos = pos;
  41464. const xCoordinates = [];
  41465. const yCoordinates = [];
  41466. const flags = [];
  41467. let lastX = 0;
  41468. let lastY = 0;
  41469. for (const contour of this.contours) {
  41470. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41471. let flag = contour.flags[i];
  41472. const x = contour.xCoordinates[i];
  41473. let delta = x - lastX;
  41474. if (delta === 0) {
  41475. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  41476. xCoordinates.push(0);
  41477. } else {
  41478. const abs = Math.abs(delta);
  41479. if (abs <= 255) {
  41480. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  41481. xCoordinates.push(abs);
  41482. } else {
  41483. xCoordinates.push(delta);
  41484. }
  41485. }
  41486. lastX = x;
  41487. const y = contour.yCoordinates[i];
  41488. delta = y - lastY;
  41489. if (delta === 0) {
  41490. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  41491. yCoordinates.push(0);
  41492. } else {
  41493. const abs = Math.abs(delta);
  41494. if (abs <= 255) {
  41495. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  41496. yCoordinates.push(abs);
  41497. } else {
  41498. yCoordinates.push(delta);
  41499. }
  41500. }
  41501. lastY = y;
  41502. flags.push(flag);
  41503. }
  41504. buf.setUint16(pos, xCoordinates.length - 1);
  41505. pos += 2;
  41506. }
  41507. buf.setUint16(pos, this.instructions.length);
  41508. pos += 2;
  41509. if (this.instructions.length) {
  41510. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41511. pos += this.instructions.length;
  41512. }
  41513. for (const flag of flags) {
  41514. buf.setUint8(pos++, flag);
  41515. }
  41516. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  41517. const x = xCoordinates[i];
  41518. const flag = flags[i];
  41519. if (flag & X_SHORT_VECTOR) {
  41520. buf.setUint8(pos++, x);
  41521. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  41522. buf.setInt16(pos, x);
  41523. pos += 2;
  41524. }
  41525. }
  41526. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  41527. const y = yCoordinates[i];
  41528. const flag = flags[i];
  41529. if (flag & Y_SHORT_VECTOR) {
  41530. buf.setUint8(pos++, y);
  41531. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  41532. buf.setInt16(pos, y);
  41533. pos += 2;
  41534. }
  41535. }
  41536. return pos - spos;
  41537. }
  41538. scale(x, factor) {
  41539. for (const contour of this.contours) {
  41540. if (contour.xCoordinates.length === 0) {
  41541. continue;
  41542. }
  41543. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41544. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  41545. }
  41546. }
  41547. }
  41548. }
  41549. class CompositeGlyph {
  41550. constructor({
  41551. flags,
  41552. glyphIndex,
  41553. argument1,
  41554. argument2,
  41555. transf,
  41556. instructions
  41557. }) {
  41558. this.flags = flags;
  41559. this.glyphIndex = glyphIndex;
  41560. this.argument1 = argument1;
  41561. this.argument2 = argument2;
  41562. this.transf = transf;
  41563. this.instructions = instructions;
  41564. }
  41565. static parse(pos, glyf) {
  41566. const spos = pos;
  41567. const transf = [];
  41568. let flags = glyf.getUint16(pos);
  41569. const glyphIndex = glyf.getUint16(pos + 2);
  41570. pos += 4;
  41571. let argument1, argument2;
  41572. if (flags & ARG_1_AND_2_ARE_WORDS) {
  41573. if (flags & ARGS_ARE_XY_VALUES) {
  41574. argument1 = glyf.getInt16(pos);
  41575. argument2 = glyf.getInt16(pos + 2);
  41576. } else {
  41577. argument1 = glyf.getUint16(pos);
  41578. argument2 = glyf.getUint16(pos + 2);
  41579. }
  41580. pos += 4;
  41581. flags ^= ARG_1_AND_2_ARE_WORDS;
  41582. } else {
  41583. if (flags & ARGS_ARE_XY_VALUES) {
  41584. argument1 = glyf.getInt8(pos);
  41585. argument2 = glyf.getInt8(pos + 1);
  41586. } else {
  41587. argument1 = glyf.getUint8(pos);
  41588. argument2 = glyf.getUint8(pos + 1);
  41589. }
  41590. pos += 2;
  41591. }
  41592. if (flags & WE_HAVE_A_SCALE) {
  41593. transf.push(glyf.getUint16(pos));
  41594. pos += 2;
  41595. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  41596. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  41597. pos += 4;
  41598. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  41599. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  41600. pos += 8;
  41601. }
  41602. let instructions = null;
  41603. if (flags & WE_HAVE_INSTRUCTIONS) {
  41604. const instructionLength = glyf.getUint16(pos);
  41605. pos += 2;
  41606. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41607. pos += instructionLength;
  41608. }
  41609. return [pos - spos, new CompositeGlyph({
  41610. flags,
  41611. glyphIndex,
  41612. argument1,
  41613. argument2,
  41614. transf,
  41615. instructions
  41616. })];
  41617. }
  41618. getSize() {
  41619. let size = 2 + 2 + this.transf.length * 2;
  41620. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41621. size += 2 + this.instructions.length;
  41622. }
  41623. size += 2;
  41624. if (this.flags & 2) {
  41625. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41626. size += 2;
  41627. }
  41628. } else {
  41629. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  41630. size += 2;
  41631. }
  41632. }
  41633. return size;
  41634. }
  41635. write(pos, buf) {
  41636. const spos = pos;
  41637. if (this.flags & ARGS_ARE_XY_VALUES) {
  41638. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41639. this.flags |= ARG_1_AND_2_ARE_WORDS;
  41640. }
  41641. } else {
  41642. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  41643. this.flags |= ARG_1_AND_2_ARE_WORDS;
  41644. }
  41645. }
  41646. buf.setUint16(pos, this.flags);
  41647. buf.setUint16(pos + 2, this.glyphIndex);
  41648. pos += 4;
  41649. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  41650. if (this.flags & ARGS_ARE_XY_VALUES) {
  41651. buf.setInt16(pos, this.argument1);
  41652. buf.setInt16(pos + 2, this.argument2);
  41653. } else {
  41654. buf.setUint16(pos, this.argument1);
  41655. buf.setUint16(pos + 2, this.argument2);
  41656. }
  41657. pos += 4;
  41658. } else {
  41659. buf.setUint8(pos, this.argument1);
  41660. buf.setUint8(pos + 1, this.argument2);
  41661. pos += 2;
  41662. }
  41663. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41664. buf.setUint16(pos, this.instructions.length);
  41665. pos += 2;
  41666. if (this.instructions.length) {
  41667. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41668. pos += this.instructions.length;
  41669. }
  41670. }
  41671. return pos - spos;
  41672. }
  41673. scale(x, factor) {}
  41674. }
  41675. /***/ }),
  41676. /* 53 */
  41677. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41678. Object.defineProperty(exports, "__esModule", ({
  41679. value: true
  41680. }));
  41681. exports.OpenTypeFileBuilder = void 0;
  41682. var _core_utils = __w_pdfjs_require__(8);
  41683. var _util = __w_pdfjs_require__(2);
  41684. function writeInt16(dest, offset, num) {
  41685. dest[offset] = num >> 8 & 0xff;
  41686. dest[offset + 1] = num & 0xff;
  41687. }
  41688. function writeInt32(dest, offset, num) {
  41689. dest[offset] = num >> 24 & 0xff;
  41690. dest[offset + 1] = num >> 16 & 0xff;
  41691. dest[offset + 2] = num >> 8 & 0xff;
  41692. dest[offset + 3] = num & 0xff;
  41693. }
  41694. function writeData(dest, offset, data) {
  41695. if (data instanceof Uint8Array) {
  41696. dest.set(data, offset);
  41697. } else if (typeof data === "string") {
  41698. for (let i = 0, ii = data.length; i < ii; i++) {
  41699. dest[offset++] = data.charCodeAt(i) & 0xff;
  41700. }
  41701. } else {
  41702. for (let i = 0, ii = data.length; i < ii; i++) {
  41703. dest[offset++] = data[i] & 0xff;
  41704. }
  41705. }
  41706. }
  41707. const OTF_HEADER_SIZE = 12;
  41708. const OTF_TABLE_ENTRY_SIZE = 16;
  41709. class OpenTypeFileBuilder {
  41710. constructor(sfnt) {
  41711. this.sfnt = sfnt;
  41712. this.tables = Object.create(null);
  41713. }
  41714. static getSearchParams(entriesCount, entrySize) {
  41715. let maxPower2 = 1,
  41716. log2 = 0;
  41717. while ((maxPower2 ^ entriesCount) > maxPower2) {
  41718. maxPower2 <<= 1;
  41719. log2++;
  41720. }
  41721. const searchRange = maxPower2 * entrySize;
  41722. return {
  41723. range: searchRange,
  41724. entry: log2,
  41725. rangeShift: entrySize * entriesCount - searchRange
  41726. };
  41727. }
  41728. toArray() {
  41729. let sfnt = this.sfnt;
  41730. const tables = this.tables;
  41731. const tablesNames = Object.keys(tables);
  41732. tablesNames.sort();
  41733. const numTables = tablesNames.length;
  41734. let i, j, jj, table, tableName;
  41735. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  41736. const tableOffsets = [offset];
  41737. for (i = 0; i < numTables; i++) {
  41738. table = tables[tablesNames[i]];
  41739. const paddedLength = (table.length + 3 & ~3) >>> 0;
  41740. offset += paddedLength;
  41741. tableOffsets.push(offset);
  41742. }
  41743. const file = new Uint8Array(offset);
  41744. for (i = 0; i < numTables; i++) {
  41745. table = tables[tablesNames[i]];
  41746. writeData(file, tableOffsets[i], table);
  41747. }
  41748. if (sfnt === "true") {
  41749. sfnt = (0, _util.string32)(0x00010000);
  41750. }
  41751. file[0] = sfnt.charCodeAt(0) & 0xff;
  41752. file[1] = sfnt.charCodeAt(1) & 0xff;
  41753. file[2] = sfnt.charCodeAt(2) & 0xff;
  41754. file[3] = sfnt.charCodeAt(3) & 0xff;
  41755. writeInt16(file, 4, numTables);
  41756. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  41757. writeInt16(file, 6, searchParams.range);
  41758. writeInt16(file, 8, searchParams.entry);
  41759. writeInt16(file, 10, searchParams.rangeShift);
  41760. offset = OTF_HEADER_SIZE;
  41761. for (i = 0; i < numTables; i++) {
  41762. tableName = tablesNames[i];
  41763. file[offset] = tableName.charCodeAt(0) & 0xff;
  41764. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  41765. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  41766. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  41767. let checksum = 0;
  41768. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  41769. const quad = (0, _core_utils.readUint32)(file, j);
  41770. checksum = checksum + quad >>> 0;
  41771. }
  41772. writeInt32(file, offset + 4, checksum);
  41773. writeInt32(file, offset + 8, tableOffsets[i]);
  41774. writeInt32(file, offset + 12, tables[tableName].length);
  41775. offset += OTF_TABLE_ENTRY_SIZE;
  41776. }
  41777. return file;
  41778. }
  41779. addTable(tag, data) {
  41780. if (tag in this.tables) {
  41781. throw new Error("Table " + tag + " already exists");
  41782. }
  41783. this.tables[tag] = data;
  41784. }
  41785. }
  41786. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  41787. /***/ }),
  41788. /* 54 */
  41789. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41790. Object.defineProperty(exports, "__esModule", ({
  41791. value: true
  41792. }));
  41793. exports.Type1Font = void 0;
  41794. var _cff_parser = __w_pdfjs_require__(45);
  41795. var _fonts_utils = __w_pdfjs_require__(18);
  41796. var _core_utils = __w_pdfjs_require__(8);
  41797. var _stream = __w_pdfjs_require__(10);
  41798. var _type1_parser = __w_pdfjs_require__(55);
  41799. var _util = __w_pdfjs_require__(2);
  41800. function findBlock(streamBytes, signature, startIndex) {
  41801. const streamBytesLength = streamBytes.length;
  41802. const signatureLength = signature.length;
  41803. const scanLength = streamBytesLength - signatureLength;
  41804. let i = startIndex,
  41805. found = false;
  41806. while (i < scanLength) {
  41807. let j = 0;
  41808. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41809. j++;
  41810. }
  41811. if (j >= signatureLength) {
  41812. i += j;
  41813. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  41814. i++;
  41815. }
  41816. found = true;
  41817. break;
  41818. }
  41819. i++;
  41820. }
  41821. return {
  41822. found,
  41823. length: i
  41824. };
  41825. }
  41826. function getHeaderBlock(stream, suggestedLength) {
  41827. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  41828. const streamStartPos = stream.pos;
  41829. let headerBytes, headerBytesLength, block;
  41830. try {
  41831. headerBytes = stream.getBytes(suggestedLength);
  41832. headerBytesLength = headerBytes.length;
  41833. } catch (ex) {}
  41834. if (headerBytesLength === suggestedLength) {
  41835. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41836. if (block.found && block.length === suggestedLength) {
  41837. return {
  41838. stream: new _stream.Stream(headerBytes),
  41839. length: suggestedLength
  41840. };
  41841. }
  41842. }
  41843. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  41844. stream.pos = streamStartPos;
  41845. const SCAN_BLOCK_LENGTH = 2048;
  41846. let actualLength;
  41847. while (true) {
  41848. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41849. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41850. if (block.length === 0) {
  41851. break;
  41852. }
  41853. stream.pos += block.length;
  41854. if (block.found) {
  41855. actualLength = stream.pos - streamStartPos;
  41856. break;
  41857. }
  41858. }
  41859. stream.pos = streamStartPos;
  41860. if (actualLength) {
  41861. return {
  41862. stream: new _stream.Stream(stream.getBytes(actualLength)),
  41863. length: actualLength
  41864. };
  41865. }
  41866. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  41867. return {
  41868. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  41869. length: suggestedLength
  41870. };
  41871. }
  41872. function getEexecBlock(stream, suggestedLength) {
  41873. const eexecBytes = stream.getBytes();
  41874. return {
  41875. stream: new _stream.Stream(eexecBytes),
  41876. length: eexecBytes.length
  41877. };
  41878. }
  41879. class Type1Font {
  41880. constructor(name, file, properties) {
  41881. const PFB_HEADER_SIZE = 6;
  41882. let headerBlockLength = properties.length1;
  41883. let eexecBlockLength = properties.length2;
  41884. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41885. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41886. if (pfbHeaderPresent) {
  41887. file.skip(PFB_HEADER_SIZE);
  41888. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41889. }
  41890. const headerBlock = getHeaderBlock(file, headerBlockLength);
  41891. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41892. headerBlockParser.extractFontHeader(properties);
  41893. if (pfbHeaderPresent) {
  41894. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41895. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41896. }
  41897. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  41898. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41899. const data = eexecBlockParser.extractFontProgram(properties);
  41900. for (const key in data.properties) {
  41901. properties[key] = data.properties[key];
  41902. }
  41903. const charstrings = data.charstrings;
  41904. const type2Charstrings = this.getType2Charstrings(charstrings);
  41905. const subrs = this.getType2Subrs(data.subrs);
  41906. this.charstrings = charstrings;
  41907. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41908. this.seacs = this.getSeacs(data.charstrings);
  41909. }
  41910. get numGlyphs() {
  41911. return this.charstrings.length + 1;
  41912. }
  41913. getCharset() {
  41914. const charset = [".notdef"];
  41915. const charstrings = this.charstrings;
  41916. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41917. charset.push(charstrings[glyphId].glyphName);
  41918. }
  41919. return charset;
  41920. }
  41921. getGlyphMapping(properties) {
  41922. const charstrings = this.charstrings;
  41923. if (properties.composite) {
  41924. const charCodeToGlyphId = Object.create(null);
  41925. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  41926. const charCode = properties.cMap.charCodeOf(glyphId);
  41927. charCodeToGlyphId[charCode] = glyphId + 1;
  41928. }
  41929. return charCodeToGlyphId;
  41930. }
  41931. const glyphNames = [".notdef"];
  41932. let builtInEncoding, glyphId;
  41933. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41934. glyphNames.push(charstrings[glyphId].glyphName);
  41935. }
  41936. const encoding = properties.builtInEncoding;
  41937. if (encoding) {
  41938. builtInEncoding = Object.create(null);
  41939. for (const charCode in encoding) {
  41940. glyphId = glyphNames.indexOf(encoding[charCode]);
  41941. if (glyphId >= 0) {
  41942. builtInEncoding[charCode] = glyphId;
  41943. }
  41944. }
  41945. }
  41946. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  41947. }
  41948. hasGlyphId(id) {
  41949. if (id < 0 || id >= this.numGlyphs) {
  41950. return false;
  41951. }
  41952. if (id === 0) {
  41953. return true;
  41954. }
  41955. const glyph = this.charstrings[id - 1];
  41956. return glyph.charstring.length > 0;
  41957. }
  41958. getSeacs(charstrings) {
  41959. const seacMap = [];
  41960. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  41961. const charstring = charstrings[i];
  41962. if (charstring.seac) {
  41963. seacMap[i + 1] = charstring.seac;
  41964. }
  41965. }
  41966. return seacMap;
  41967. }
  41968. getType2Charstrings(type1Charstrings) {
  41969. const type2Charstrings = [];
  41970. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41971. type2Charstrings.push(type1Charstrings[i].charstring);
  41972. }
  41973. return type2Charstrings;
  41974. }
  41975. getType2Subrs(type1Subrs) {
  41976. let bias = 0;
  41977. const count = type1Subrs.length;
  41978. if (count < 1133) {
  41979. bias = 107;
  41980. } else if (count < 33769) {
  41981. bias = 1131;
  41982. } else {
  41983. bias = 32768;
  41984. }
  41985. const type2Subrs = [];
  41986. let i;
  41987. for (i = 0; i < bias; i++) {
  41988. type2Subrs.push([0x0b]);
  41989. }
  41990. for (i = 0; i < count; i++) {
  41991. type2Subrs.push(type1Subrs[i]);
  41992. }
  41993. return type2Subrs;
  41994. }
  41995. wrap(name, glyphs, charstrings, subrs, properties) {
  41996. const cff = new _cff_parser.CFF();
  41997. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  41998. cff.names = [name];
  41999. const topDict = new _cff_parser.CFFTopDict();
  42000. topDict.setByName("version", 391);
  42001. topDict.setByName("Notice", 392);
  42002. topDict.setByName("FullName", 393);
  42003. topDict.setByName("FamilyName", 394);
  42004. topDict.setByName("Weight", 395);
  42005. topDict.setByName("Encoding", null);
  42006. topDict.setByName("FontMatrix", properties.fontMatrix);
  42007. topDict.setByName("FontBBox", properties.bbox);
  42008. topDict.setByName("charset", null);
  42009. topDict.setByName("CharStrings", null);
  42010. topDict.setByName("Private", null);
  42011. cff.topDict = topDict;
  42012. const strings = new _cff_parser.CFFStrings();
  42013. strings.add("Version 0.11");
  42014. strings.add("See original notice");
  42015. strings.add(name);
  42016. strings.add(name);
  42017. strings.add("Medium");
  42018. cff.strings = strings;
  42019. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42020. const count = glyphs.length;
  42021. const charsetArray = [".notdef"];
  42022. let i, ii;
  42023. for (i = 0; i < count; i++) {
  42024. const glyphName = charstrings[i].glyphName;
  42025. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42026. if (index === -1) {
  42027. strings.add(glyphName);
  42028. }
  42029. charsetArray.push(glyphName);
  42030. }
  42031. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42032. const charStringsIndex = new _cff_parser.CFFIndex();
  42033. charStringsIndex.add([0x8b, 0x0e]);
  42034. for (i = 0; i < count; i++) {
  42035. charStringsIndex.add(glyphs[i]);
  42036. }
  42037. cff.charStrings = charStringsIndex;
  42038. const privateDict = new _cff_parser.CFFPrivateDict();
  42039. privateDict.setByName("Subrs", null);
  42040. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42041. for (i = 0, ii = fields.length; i < ii; i++) {
  42042. const field = fields[i];
  42043. if (!(field in properties.privateData)) {
  42044. continue;
  42045. }
  42046. const value = properties.privateData[field];
  42047. if (Array.isArray(value)) {
  42048. for (let j = value.length - 1; j > 0; j--) {
  42049. value[j] -= value[j - 1];
  42050. }
  42051. }
  42052. privateDict.setByName(field, value);
  42053. }
  42054. cff.topDict.privateDict = privateDict;
  42055. const subrIndex = new _cff_parser.CFFIndex();
  42056. for (i = 0, ii = subrs.length; i < ii; i++) {
  42057. subrIndex.add(subrs[i]);
  42058. }
  42059. privateDict.subrsIndex = subrIndex;
  42060. const compiler = new _cff_parser.CFFCompiler(cff);
  42061. return compiler.compile();
  42062. }
  42063. }
  42064. exports.Type1Font = Type1Font;
  42065. /***/ }),
  42066. /* 55 */
  42067. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42068. Object.defineProperty(exports, "__esModule", ({
  42069. value: true
  42070. }));
  42071. exports.Type1Parser = void 0;
  42072. var _encodings = __w_pdfjs_require__(19);
  42073. var _core_utils = __w_pdfjs_require__(8);
  42074. var _stream = __w_pdfjs_require__(10);
  42075. var _util = __w_pdfjs_require__(2);
  42076. const HINTING_ENABLED = false;
  42077. const Type1CharString = function Type1CharStringClosure() {
  42078. const COMMAND_MAP = {
  42079. hstem: [1],
  42080. vstem: [3],
  42081. vmoveto: [4],
  42082. rlineto: [5],
  42083. hlineto: [6],
  42084. vlineto: [7],
  42085. rrcurveto: [8],
  42086. callsubr: [10],
  42087. flex: [12, 35],
  42088. drop: [12, 18],
  42089. endchar: [14],
  42090. rmoveto: [21],
  42091. hmoveto: [22],
  42092. vhcurveto: [30],
  42093. hvcurveto: [31]
  42094. };
  42095. class Type1CharString {
  42096. constructor() {
  42097. this.width = 0;
  42098. this.lsb = 0;
  42099. this.flexing = false;
  42100. this.output = [];
  42101. this.stack = [];
  42102. }
  42103. convert(encoded, subrs, seacAnalysisEnabled) {
  42104. const count = encoded.length;
  42105. let error = false;
  42106. let wx, sbx, subrNumber;
  42107. for (let i = 0; i < count; i++) {
  42108. let value = encoded[i];
  42109. if (value < 32) {
  42110. if (value === 12) {
  42111. value = (value << 8) + encoded[++i];
  42112. }
  42113. switch (value) {
  42114. case 1:
  42115. if (!HINTING_ENABLED) {
  42116. this.stack = [];
  42117. break;
  42118. }
  42119. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42120. break;
  42121. case 3:
  42122. if (!HINTING_ENABLED) {
  42123. this.stack = [];
  42124. break;
  42125. }
  42126. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42127. break;
  42128. case 4:
  42129. if (this.flexing) {
  42130. if (this.stack.length < 1) {
  42131. error = true;
  42132. break;
  42133. }
  42134. const dy = this.stack.pop();
  42135. this.stack.push(0, dy);
  42136. break;
  42137. }
  42138. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42139. break;
  42140. case 5:
  42141. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42142. break;
  42143. case 6:
  42144. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42145. break;
  42146. case 7:
  42147. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42148. break;
  42149. case 8:
  42150. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42151. break;
  42152. case 9:
  42153. this.stack = [];
  42154. break;
  42155. case 10:
  42156. if (this.stack.length < 1) {
  42157. error = true;
  42158. break;
  42159. }
  42160. subrNumber = this.stack.pop();
  42161. if (!subrs[subrNumber]) {
  42162. error = true;
  42163. break;
  42164. }
  42165. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42166. break;
  42167. case 11:
  42168. return error;
  42169. case 13:
  42170. if (this.stack.length < 2) {
  42171. error = true;
  42172. break;
  42173. }
  42174. wx = this.stack.pop();
  42175. sbx = this.stack.pop();
  42176. this.lsb = sbx;
  42177. this.width = wx;
  42178. this.stack.push(wx, sbx);
  42179. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42180. break;
  42181. case 14:
  42182. this.output.push(COMMAND_MAP.endchar[0]);
  42183. break;
  42184. case 21:
  42185. if (this.flexing) {
  42186. break;
  42187. }
  42188. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42189. break;
  42190. case 22:
  42191. if (this.flexing) {
  42192. this.stack.push(0);
  42193. break;
  42194. }
  42195. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42196. break;
  42197. case 30:
  42198. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42199. break;
  42200. case 31:
  42201. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42202. break;
  42203. case (12 << 8) + 0:
  42204. this.stack = [];
  42205. break;
  42206. case (12 << 8) + 1:
  42207. if (!HINTING_ENABLED) {
  42208. this.stack = [];
  42209. break;
  42210. }
  42211. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42212. break;
  42213. case (12 << 8) + 2:
  42214. if (!HINTING_ENABLED) {
  42215. this.stack = [];
  42216. break;
  42217. }
  42218. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42219. break;
  42220. case (12 << 8) + 6:
  42221. if (seacAnalysisEnabled) {
  42222. const asb = this.stack[this.stack.length - 5];
  42223. this.seac = this.stack.splice(-4, 4);
  42224. this.seac[0] += this.lsb - asb;
  42225. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42226. } else {
  42227. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42228. }
  42229. break;
  42230. case (12 << 8) + 7:
  42231. if (this.stack.length < 4) {
  42232. error = true;
  42233. break;
  42234. }
  42235. this.stack.pop();
  42236. wx = this.stack.pop();
  42237. const sby = this.stack.pop();
  42238. sbx = this.stack.pop();
  42239. this.lsb = sbx;
  42240. this.width = wx;
  42241. this.stack.push(wx, sbx, sby);
  42242. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  42243. break;
  42244. case (12 << 8) + 12:
  42245. if (this.stack.length < 2) {
  42246. error = true;
  42247. break;
  42248. }
  42249. const num2 = this.stack.pop();
  42250. const num1 = this.stack.pop();
  42251. this.stack.push(num1 / num2);
  42252. break;
  42253. case (12 << 8) + 16:
  42254. if (this.stack.length < 2) {
  42255. error = true;
  42256. break;
  42257. }
  42258. subrNumber = this.stack.pop();
  42259. const numArgs = this.stack.pop();
  42260. if (subrNumber === 0 && numArgs === 3) {
  42261. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  42262. 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]);
  42263. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  42264. this.flexing = false;
  42265. this.stack.push(flexArgs[15], flexArgs[16]);
  42266. } else if (subrNumber === 1 && numArgs === 0) {
  42267. this.flexing = true;
  42268. }
  42269. break;
  42270. case (12 << 8) + 17:
  42271. break;
  42272. case (12 << 8) + 33:
  42273. this.stack = [];
  42274. break;
  42275. default:
  42276. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  42277. break;
  42278. }
  42279. if (error) {
  42280. break;
  42281. }
  42282. continue;
  42283. } else if (value <= 246) {
  42284. value -= 139;
  42285. } else if (value <= 250) {
  42286. value = (value - 247) * 256 + encoded[++i] + 108;
  42287. } else if (value <= 254) {
  42288. value = -((value - 251) * 256) - encoded[++i] - 108;
  42289. } else {
  42290. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  42291. }
  42292. this.stack.push(value);
  42293. }
  42294. return error;
  42295. }
  42296. executeCommand(howManyArgs, command, keepStack) {
  42297. const stackLength = this.stack.length;
  42298. if (howManyArgs > stackLength) {
  42299. return true;
  42300. }
  42301. const start = stackLength - howManyArgs;
  42302. for (let i = start; i < stackLength; i++) {
  42303. let value = this.stack[i];
  42304. if (Number.isInteger(value)) {
  42305. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  42306. } else {
  42307. value = 65536 * value | 0;
  42308. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  42309. }
  42310. }
  42311. this.output.push.apply(this.output, command);
  42312. if (keepStack) {
  42313. this.stack.splice(start, howManyArgs);
  42314. } else {
  42315. this.stack.length = 0;
  42316. }
  42317. return false;
  42318. }
  42319. }
  42320. return Type1CharString;
  42321. }();
  42322. const Type1Parser = function Type1ParserClosure() {
  42323. const EEXEC_ENCRYPT_KEY = 55665;
  42324. const CHAR_STRS_ENCRYPT_KEY = 4330;
  42325. function isHexDigit(code) {
  42326. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  42327. }
  42328. function decrypt(data, key, discardNumber) {
  42329. if (discardNumber >= data.length) {
  42330. return new Uint8Array(0);
  42331. }
  42332. const c1 = 52845,
  42333. c2 = 22719;
  42334. let r = key | 0,
  42335. i,
  42336. j;
  42337. for (i = 0; i < discardNumber; i++) {
  42338. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  42339. }
  42340. const count = data.length - discardNumber;
  42341. const decrypted = new Uint8Array(count);
  42342. for (i = discardNumber, j = 0; j < count; i++, j++) {
  42343. const value = data[i];
  42344. decrypted[j] = value ^ r >> 8;
  42345. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42346. }
  42347. return decrypted;
  42348. }
  42349. function decryptAscii(data, key, discardNumber) {
  42350. const c1 = 52845,
  42351. c2 = 22719;
  42352. let r = key | 0;
  42353. const count = data.length,
  42354. maybeLength = count >>> 1;
  42355. const decrypted = new Uint8Array(maybeLength);
  42356. let i, j;
  42357. for (i = 0, j = 0; i < count; i++) {
  42358. const digit1 = data[i];
  42359. if (!isHexDigit(digit1)) {
  42360. continue;
  42361. }
  42362. i++;
  42363. let digit2;
  42364. while (i < count && !isHexDigit(digit2 = data[i])) {
  42365. i++;
  42366. }
  42367. if (i < count) {
  42368. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  42369. decrypted[j++] = value ^ r >> 8;
  42370. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42371. }
  42372. }
  42373. return decrypted.slice(discardNumber, j);
  42374. }
  42375. function isSpecial(c) {
  42376. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  42377. }
  42378. class Type1Parser {
  42379. constructor(stream, encrypted, seacAnalysisEnabled) {
  42380. if (encrypted) {
  42381. const data = stream.getBytes();
  42382. 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]));
  42383. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  42384. }
  42385. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  42386. this.stream = stream;
  42387. this.nextChar();
  42388. }
  42389. readNumberArray() {
  42390. this.getToken();
  42391. const array = [];
  42392. while (true) {
  42393. const token = this.getToken();
  42394. if (token === null || token === "]" || token === "}") {
  42395. break;
  42396. }
  42397. array.push(parseFloat(token || 0));
  42398. }
  42399. return array;
  42400. }
  42401. readNumber() {
  42402. const token = this.getToken();
  42403. return parseFloat(token || 0);
  42404. }
  42405. readInt() {
  42406. const token = this.getToken();
  42407. return parseInt(token || 0, 10) | 0;
  42408. }
  42409. readBoolean() {
  42410. const token = this.getToken();
  42411. return token === "true" ? 1 : 0;
  42412. }
  42413. nextChar() {
  42414. return this.currentChar = this.stream.getByte();
  42415. }
  42416. prevChar() {
  42417. this.stream.skip(-2);
  42418. return this.currentChar = this.stream.getByte();
  42419. }
  42420. getToken() {
  42421. let comment = false;
  42422. let ch = this.currentChar;
  42423. while (true) {
  42424. if (ch === -1) {
  42425. return null;
  42426. }
  42427. if (comment) {
  42428. if (ch === 0x0a || ch === 0x0d) {
  42429. comment = false;
  42430. }
  42431. } else if (ch === 0x25) {
  42432. comment = true;
  42433. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42434. break;
  42435. }
  42436. ch = this.nextChar();
  42437. }
  42438. if (isSpecial(ch)) {
  42439. this.nextChar();
  42440. return String.fromCharCode(ch);
  42441. }
  42442. let token = "";
  42443. do {
  42444. token += String.fromCharCode(ch);
  42445. ch = this.nextChar();
  42446. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  42447. return token;
  42448. }
  42449. readCharStrings(bytes, lenIV) {
  42450. if (lenIV === -1) {
  42451. return bytes;
  42452. }
  42453. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  42454. }
  42455. extractFontProgram(properties) {
  42456. const stream = this.stream;
  42457. const subrs = [],
  42458. charstrings = [];
  42459. const privateData = Object.create(null);
  42460. privateData.lenIV = 4;
  42461. const program = {
  42462. subrs: [],
  42463. charstrings: [],
  42464. properties: {
  42465. privateData
  42466. }
  42467. };
  42468. let token, length, data, lenIV, encoded;
  42469. while ((token = this.getToken()) !== null) {
  42470. if (token !== "/") {
  42471. continue;
  42472. }
  42473. token = this.getToken();
  42474. switch (token) {
  42475. case "CharStrings":
  42476. this.getToken();
  42477. this.getToken();
  42478. this.getToken();
  42479. this.getToken();
  42480. while (true) {
  42481. token = this.getToken();
  42482. if (token === null || token === "end") {
  42483. break;
  42484. }
  42485. if (token !== "/") {
  42486. continue;
  42487. }
  42488. const glyph = this.getToken();
  42489. length = this.readInt();
  42490. this.getToken();
  42491. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42492. lenIV = program.properties.privateData.lenIV;
  42493. encoded = this.readCharStrings(data, lenIV);
  42494. this.nextChar();
  42495. token = this.getToken();
  42496. if (token === "noaccess") {
  42497. this.getToken();
  42498. } else if (token === "/") {
  42499. this.prevChar();
  42500. }
  42501. charstrings.push({
  42502. glyph,
  42503. encoded
  42504. });
  42505. }
  42506. break;
  42507. case "Subrs":
  42508. this.readInt();
  42509. this.getToken();
  42510. while (this.getToken() === "dup") {
  42511. const index = this.readInt();
  42512. length = this.readInt();
  42513. this.getToken();
  42514. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42515. lenIV = program.properties.privateData.lenIV;
  42516. encoded = this.readCharStrings(data, lenIV);
  42517. this.nextChar();
  42518. token = this.getToken();
  42519. if (token === "noaccess") {
  42520. this.getToken();
  42521. }
  42522. subrs[index] = encoded;
  42523. }
  42524. break;
  42525. case "BlueValues":
  42526. case "OtherBlues":
  42527. case "FamilyBlues":
  42528. case "FamilyOtherBlues":
  42529. const blueArray = this.readNumberArray();
  42530. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  42531. program.properties.privateData[token] = blueArray;
  42532. }
  42533. break;
  42534. case "StemSnapH":
  42535. case "StemSnapV":
  42536. program.properties.privateData[token] = this.readNumberArray();
  42537. break;
  42538. case "StdHW":
  42539. case "StdVW":
  42540. program.properties.privateData[token] = this.readNumberArray()[0];
  42541. break;
  42542. case "BlueShift":
  42543. case "lenIV":
  42544. case "BlueFuzz":
  42545. case "BlueScale":
  42546. case "LanguageGroup":
  42547. case "ExpansionFactor":
  42548. program.properties.privateData[token] = this.readNumber();
  42549. break;
  42550. case "ForceBold":
  42551. program.properties.privateData[token] = this.readBoolean();
  42552. break;
  42553. }
  42554. }
  42555. for (let i = 0; i < charstrings.length; i++) {
  42556. const glyph = charstrings[i].glyph;
  42557. encoded = charstrings[i].encoded;
  42558. const charString = new Type1CharString();
  42559. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  42560. let output = charString.output;
  42561. if (error) {
  42562. output = [14];
  42563. }
  42564. const charStringObject = {
  42565. glyphName: glyph,
  42566. charstring: output,
  42567. width: charString.width,
  42568. lsb: charString.lsb,
  42569. seac: charString.seac
  42570. };
  42571. if (glyph === ".notdef") {
  42572. program.charstrings.unshift(charStringObject);
  42573. } else {
  42574. program.charstrings.push(charStringObject);
  42575. }
  42576. if (properties.builtInEncoding) {
  42577. const index = properties.builtInEncoding.indexOf(glyph);
  42578. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  42579. properties.widths[index] = charString.width;
  42580. }
  42581. }
  42582. }
  42583. return program;
  42584. }
  42585. extractFontHeader(properties) {
  42586. let token;
  42587. while ((token = this.getToken()) !== null) {
  42588. if (token !== "/") {
  42589. continue;
  42590. }
  42591. token = this.getToken();
  42592. switch (token) {
  42593. case "FontMatrix":
  42594. const matrix = this.readNumberArray();
  42595. properties.fontMatrix = matrix;
  42596. break;
  42597. case "Encoding":
  42598. const encodingArg = this.getToken();
  42599. let encoding;
  42600. if (!/^\d+$/.test(encodingArg)) {
  42601. encoding = (0, _encodings.getEncoding)(encodingArg);
  42602. } else {
  42603. encoding = [];
  42604. const size = parseInt(encodingArg, 10) | 0;
  42605. this.getToken();
  42606. for (let j = 0; j < size; j++) {
  42607. token = this.getToken();
  42608. while (token !== "dup" && token !== "def") {
  42609. token = this.getToken();
  42610. if (token === null) {
  42611. return;
  42612. }
  42613. }
  42614. if (token === "def") {
  42615. break;
  42616. }
  42617. const index = this.readInt();
  42618. this.getToken();
  42619. const glyph = this.getToken();
  42620. encoding[index] = glyph;
  42621. this.getToken();
  42622. }
  42623. }
  42624. properties.builtInEncoding = encoding;
  42625. break;
  42626. case "FontBBox":
  42627. const fontBBox = this.readNumberArray();
  42628. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  42629. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  42630. properties.ascentScaled = true;
  42631. break;
  42632. }
  42633. }
  42634. }
  42635. }
  42636. return Type1Parser;
  42637. }();
  42638. exports.Type1Parser = Type1Parser;
  42639. /***/ }),
  42640. /* 56 */
  42641. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42642. Object.defineProperty(exports, "__esModule", ({
  42643. value: true
  42644. }));
  42645. exports.Pattern = void 0;
  42646. exports.getTilingPatternIR = getTilingPatternIR;
  42647. var _util = __w_pdfjs_require__(2);
  42648. var _base_stream = __w_pdfjs_require__(9);
  42649. var _colorspace = __w_pdfjs_require__(24);
  42650. var _core_utils = __w_pdfjs_require__(8);
  42651. const ShadingType = {
  42652. FUNCTION_BASED: 1,
  42653. AXIAL: 2,
  42654. RADIAL: 3,
  42655. FREE_FORM_MESH: 4,
  42656. LATTICE_FORM_MESH: 5,
  42657. COONS_PATCH_MESH: 6,
  42658. TENSOR_PATCH_MESH: 7
  42659. };
  42660. class Pattern {
  42661. constructor() {
  42662. (0, _util.unreachable)("Cannot initialize Pattern.");
  42663. }
  42664. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  42665. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  42666. const type = dict.get("ShadingType");
  42667. try {
  42668. switch (type) {
  42669. case ShadingType.AXIAL:
  42670. case ShadingType.RADIAL:
  42671. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  42672. case ShadingType.FREE_FORM_MESH:
  42673. case ShadingType.LATTICE_FORM_MESH:
  42674. case ShadingType.COONS_PATCH_MESH:
  42675. case ShadingType.TENSOR_PATCH_MESH:
  42676. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  42677. default:
  42678. throw new _util.FormatError("Unsupported ShadingType: " + type);
  42679. }
  42680. } catch (ex) {
  42681. if (ex instanceof _core_utils.MissingDataException) {
  42682. throw ex;
  42683. }
  42684. handler.send("UnsupportedFeature", {
  42685. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  42686. });
  42687. (0, _util.warn)(ex);
  42688. return new DummyShading();
  42689. }
  42690. }
  42691. }
  42692. exports.Pattern = Pattern;
  42693. class BaseShading {
  42694. static get SMALL_NUMBER() {
  42695. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  42696. }
  42697. constructor() {
  42698. if (this.constructor === BaseShading) {
  42699. (0, _util.unreachable)("Cannot initialize BaseShading.");
  42700. }
  42701. }
  42702. getIR() {
  42703. (0, _util.unreachable)("Abstract method `getIR` called.");
  42704. }
  42705. }
  42706. class RadialAxialShading extends BaseShading {
  42707. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  42708. super();
  42709. this.coordsArr = dict.getArray("Coords");
  42710. this.shadingType = dict.get("ShadingType");
  42711. const cs = _colorspace.ColorSpace.parse({
  42712. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  42713. xref,
  42714. resources,
  42715. pdfFunctionFactory,
  42716. localColorSpaceCache
  42717. });
  42718. const bbox = dict.getArray("BBox");
  42719. if (Array.isArray(bbox) && bbox.length === 4) {
  42720. this.bbox = _util.Util.normalizeRect(bbox);
  42721. } else {
  42722. this.bbox = null;
  42723. }
  42724. let t0 = 0.0,
  42725. t1 = 1.0;
  42726. if (dict.has("Domain")) {
  42727. const domainArr = dict.getArray("Domain");
  42728. t0 = domainArr[0];
  42729. t1 = domainArr[1];
  42730. }
  42731. let extendStart = false,
  42732. extendEnd = false;
  42733. if (dict.has("Extend")) {
  42734. const extendArr = dict.getArray("Extend");
  42735. extendStart = extendArr[0];
  42736. extendEnd = extendArr[1];
  42737. }
  42738. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  42739. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  42740. const distance = Math.hypot(x1 - x2, y1 - y2);
  42741. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  42742. (0, _util.warn)("Unsupported radial gradient.");
  42743. }
  42744. }
  42745. this.extendStart = extendStart;
  42746. this.extendEnd = extendEnd;
  42747. const fnObj = dict.getRaw("Function");
  42748. const fn = pdfFunctionFactory.createFromArray(fnObj);
  42749. const NUMBER_OF_SAMPLES = 10;
  42750. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  42751. const colorStops = this.colorStops = [];
  42752. if (t0 >= t1 || step <= 0) {
  42753. (0, _util.info)("Bad shading domain.");
  42754. return;
  42755. }
  42756. const color = new Float32Array(cs.numComps),
  42757. ratio = new Float32Array(1);
  42758. let rgbColor;
  42759. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  42760. ratio[0] = t0 + i * step;
  42761. fn(ratio, 0, color, 0);
  42762. rgbColor = cs.getRgb(color, 0);
  42763. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  42764. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  42765. }
  42766. let background = "transparent";
  42767. if (dict.has("Background")) {
  42768. rgbColor = cs.getRgb(dict.get("Background"), 0);
  42769. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  42770. }
  42771. if (!extendStart) {
  42772. colorStops.unshift([0, background]);
  42773. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  42774. }
  42775. if (!extendEnd) {
  42776. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  42777. colorStops.push([1, background]);
  42778. }
  42779. this.colorStops = colorStops;
  42780. }
  42781. getIR() {
  42782. const coordsArr = this.coordsArr;
  42783. const shadingType = this.shadingType;
  42784. let type, p0, p1, r0, r1;
  42785. if (shadingType === ShadingType.AXIAL) {
  42786. p0 = [coordsArr[0], coordsArr[1]];
  42787. p1 = [coordsArr[2], coordsArr[3]];
  42788. r0 = null;
  42789. r1 = null;
  42790. type = "axial";
  42791. } else if (shadingType === ShadingType.RADIAL) {
  42792. p0 = [coordsArr[0], coordsArr[1]];
  42793. p1 = [coordsArr[3], coordsArr[4]];
  42794. r0 = coordsArr[2];
  42795. r1 = coordsArr[5];
  42796. type = "radial";
  42797. } else {
  42798. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  42799. }
  42800. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  42801. }
  42802. }
  42803. class MeshStreamReader {
  42804. constructor(stream, context) {
  42805. this.stream = stream;
  42806. this.context = context;
  42807. this.buffer = 0;
  42808. this.bufferLength = 0;
  42809. const numComps = context.numComps;
  42810. this.tmpCompsBuf = new Float32Array(numComps);
  42811. const csNumComps = context.colorSpace.numComps;
  42812. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  42813. }
  42814. get hasData() {
  42815. if (this.stream.end) {
  42816. return this.stream.pos < this.stream.end;
  42817. }
  42818. if (this.bufferLength > 0) {
  42819. return true;
  42820. }
  42821. const nextByte = this.stream.getByte();
  42822. if (nextByte < 0) {
  42823. return false;
  42824. }
  42825. this.buffer = nextByte;
  42826. this.bufferLength = 8;
  42827. return true;
  42828. }
  42829. readBits(n) {
  42830. let buffer = this.buffer;
  42831. let bufferLength = this.bufferLength;
  42832. if (n === 32) {
  42833. if (bufferLength === 0) {
  42834. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  42835. }
  42836. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  42837. const nextByte = this.stream.getByte();
  42838. this.buffer = nextByte & (1 << bufferLength) - 1;
  42839. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  42840. }
  42841. if (n === 8 && bufferLength === 0) {
  42842. return this.stream.getByte();
  42843. }
  42844. while (bufferLength < n) {
  42845. buffer = buffer << 8 | this.stream.getByte();
  42846. bufferLength += 8;
  42847. }
  42848. bufferLength -= n;
  42849. this.bufferLength = bufferLength;
  42850. this.buffer = buffer & (1 << bufferLength) - 1;
  42851. return buffer >> bufferLength;
  42852. }
  42853. align() {
  42854. this.buffer = 0;
  42855. this.bufferLength = 0;
  42856. }
  42857. readFlag() {
  42858. return this.readBits(this.context.bitsPerFlag);
  42859. }
  42860. readCoordinate() {
  42861. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  42862. const xi = this.readBits(bitsPerCoordinate);
  42863. const yi = this.readBits(bitsPerCoordinate);
  42864. const decode = this.context.decode;
  42865. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  42866. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  42867. }
  42868. readComponents() {
  42869. const numComps = this.context.numComps;
  42870. const bitsPerComponent = this.context.bitsPerComponent;
  42871. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  42872. const decode = this.context.decode;
  42873. const components = this.tmpCompsBuf;
  42874. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  42875. const ci = this.readBits(bitsPerComponent);
  42876. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  42877. }
  42878. const color = this.tmpCsCompsBuf;
  42879. if (this.context.colorFn) {
  42880. this.context.colorFn(components, 0, color, 0);
  42881. }
  42882. return this.context.colorSpace.getRgb(color, 0);
  42883. }
  42884. }
  42885. const getB = function getBClosure() {
  42886. function buildB(count) {
  42887. const lut = [];
  42888. for (let i = 0; i <= count; i++) {
  42889. const t = i / count,
  42890. t_ = 1 - t;
  42891. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  42892. }
  42893. return lut;
  42894. }
  42895. const cache = [];
  42896. return function (count) {
  42897. if (!cache[count]) {
  42898. cache[count] = buildB(count);
  42899. }
  42900. return cache[count];
  42901. };
  42902. }();
  42903. class MeshShading extends BaseShading {
  42904. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  42905. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  42906. }
  42907. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  42908. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  42909. }
  42910. static get TRIANGLE_DENSITY() {
  42911. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  42912. }
  42913. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  42914. super();
  42915. if (!(stream instanceof _base_stream.BaseStream)) {
  42916. throw new _util.FormatError("Mesh data is not a stream");
  42917. }
  42918. const dict = stream.dict;
  42919. this.shadingType = dict.get("ShadingType");
  42920. const bbox = dict.getArray("BBox");
  42921. if (Array.isArray(bbox) && bbox.length === 4) {
  42922. this.bbox = _util.Util.normalizeRect(bbox);
  42923. } else {
  42924. this.bbox = null;
  42925. }
  42926. const cs = _colorspace.ColorSpace.parse({
  42927. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  42928. xref,
  42929. resources,
  42930. pdfFunctionFactory,
  42931. localColorSpaceCache
  42932. });
  42933. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  42934. const fnObj = dict.getRaw("Function");
  42935. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  42936. this.coords = [];
  42937. this.colors = [];
  42938. this.figures = [];
  42939. const decodeContext = {
  42940. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  42941. bitsPerComponent: dict.get("BitsPerComponent"),
  42942. bitsPerFlag: dict.get("BitsPerFlag"),
  42943. decode: dict.getArray("Decode"),
  42944. colorFn: fn,
  42945. colorSpace: cs,
  42946. numComps: fn ? 1 : cs.numComps
  42947. };
  42948. const reader = new MeshStreamReader(stream, decodeContext);
  42949. let patchMesh = false;
  42950. switch (this.shadingType) {
  42951. case ShadingType.FREE_FORM_MESH:
  42952. this._decodeType4Shading(reader);
  42953. break;
  42954. case ShadingType.LATTICE_FORM_MESH:
  42955. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  42956. if (verticesPerRow < 2) {
  42957. throw new _util.FormatError("Invalid VerticesPerRow");
  42958. }
  42959. this._decodeType5Shading(reader, verticesPerRow);
  42960. break;
  42961. case ShadingType.COONS_PATCH_MESH:
  42962. this._decodeType6Shading(reader);
  42963. patchMesh = true;
  42964. break;
  42965. case ShadingType.TENSOR_PATCH_MESH:
  42966. this._decodeType7Shading(reader);
  42967. patchMesh = true;
  42968. break;
  42969. default:
  42970. (0, _util.unreachable)("Unsupported mesh type.");
  42971. break;
  42972. }
  42973. if (patchMesh) {
  42974. this._updateBounds();
  42975. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  42976. this._buildFigureFromPatch(i);
  42977. }
  42978. }
  42979. this._updateBounds();
  42980. this._packData();
  42981. }
  42982. _decodeType4Shading(reader) {
  42983. const coords = this.coords;
  42984. const colors = this.colors;
  42985. const operators = [];
  42986. const ps = [];
  42987. let verticesLeft = 0;
  42988. while (reader.hasData) {
  42989. const f = reader.readFlag();
  42990. const coord = reader.readCoordinate();
  42991. const color = reader.readComponents();
  42992. if (verticesLeft === 0) {
  42993. if (!(0 <= f && f <= 2)) {
  42994. throw new _util.FormatError("Unknown type4 flag");
  42995. }
  42996. switch (f) {
  42997. case 0:
  42998. verticesLeft = 3;
  42999. break;
  43000. case 1:
  43001. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  43002. verticesLeft = 1;
  43003. break;
  43004. case 2:
  43005. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  43006. verticesLeft = 1;
  43007. break;
  43008. }
  43009. operators.push(f);
  43010. }
  43011. ps.push(coords.length);
  43012. coords.push(coord);
  43013. colors.push(color);
  43014. verticesLeft--;
  43015. reader.align();
  43016. }
  43017. this.figures.push({
  43018. type: "triangles",
  43019. coords: new Int32Array(ps),
  43020. colors: new Int32Array(ps)
  43021. });
  43022. }
  43023. _decodeType5Shading(reader, verticesPerRow) {
  43024. const coords = this.coords;
  43025. const colors = this.colors;
  43026. const ps = [];
  43027. while (reader.hasData) {
  43028. const coord = reader.readCoordinate();
  43029. const color = reader.readComponents();
  43030. ps.push(coords.length);
  43031. coords.push(coord);
  43032. colors.push(color);
  43033. }
  43034. this.figures.push({
  43035. type: "lattice",
  43036. coords: new Int32Array(ps),
  43037. colors: new Int32Array(ps),
  43038. verticesPerRow
  43039. });
  43040. }
  43041. _decodeType6Shading(reader) {
  43042. const coords = this.coords;
  43043. const colors = this.colors;
  43044. const ps = new Int32Array(16);
  43045. const cs = new Int32Array(4);
  43046. while (reader.hasData) {
  43047. const f = reader.readFlag();
  43048. if (!(0 <= f && f <= 3)) {
  43049. throw new _util.FormatError("Unknown type6 flag");
  43050. }
  43051. const pi = coords.length;
  43052. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43053. coords.push(reader.readCoordinate());
  43054. }
  43055. const ci = colors.length;
  43056. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43057. colors.push(reader.readComponents());
  43058. }
  43059. let tmp1, tmp2, tmp3, tmp4;
  43060. switch (f) {
  43061. case 0:
  43062. ps[12] = pi + 3;
  43063. ps[13] = pi + 4;
  43064. ps[14] = pi + 5;
  43065. ps[15] = pi + 6;
  43066. ps[8] = pi + 2;
  43067. ps[11] = pi + 7;
  43068. ps[4] = pi + 1;
  43069. ps[7] = pi + 8;
  43070. ps[0] = pi;
  43071. ps[1] = pi + 11;
  43072. ps[2] = pi + 10;
  43073. ps[3] = pi + 9;
  43074. cs[2] = ci + 1;
  43075. cs[3] = ci + 2;
  43076. cs[0] = ci;
  43077. cs[1] = ci + 3;
  43078. break;
  43079. case 1:
  43080. tmp1 = ps[12];
  43081. tmp2 = ps[13];
  43082. tmp3 = ps[14];
  43083. tmp4 = ps[15];
  43084. ps[12] = tmp4;
  43085. ps[13] = pi + 0;
  43086. ps[14] = pi + 1;
  43087. ps[15] = pi + 2;
  43088. ps[8] = tmp3;
  43089. ps[11] = pi + 3;
  43090. ps[4] = tmp2;
  43091. ps[7] = pi + 4;
  43092. ps[0] = tmp1;
  43093. ps[1] = pi + 7;
  43094. ps[2] = pi + 6;
  43095. ps[3] = pi + 5;
  43096. tmp1 = cs[2];
  43097. tmp2 = cs[3];
  43098. cs[2] = tmp2;
  43099. cs[3] = ci;
  43100. cs[0] = tmp1;
  43101. cs[1] = ci + 1;
  43102. break;
  43103. case 2:
  43104. tmp1 = ps[15];
  43105. tmp2 = ps[11];
  43106. ps[12] = ps[3];
  43107. ps[13] = pi + 0;
  43108. ps[14] = pi + 1;
  43109. ps[15] = pi + 2;
  43110. ps[8] = ps[7];
  43111. ps[11] = pi + 3;
  43112. ps[4] = tmp2;
  43113. ps[7] = pi + 4;
  43114. ps[0] = tmp1;
  43115. ps[1] = pi + 7;
  43116. ps[2] = pi + 6;
  43117. ps[3] = pi + 5;
  43118. tmp1 = cs[3];
  43119. cs[2] = cs[1];
  43120. cs[3] = ci;
  43121. cs[0] = tmp1;
  43122. cs[1] = ci + 1;
  43123. break;
  43124. case 3:
  43125. ps[12] = ps[0];
  43126. ps[13] = pi + 0;
  43127. ps[14] = pi + 1;
  43128. ps[15] = pi + 2;
  43129. ps[8] = ps[1];
  43130. ps[11] = pi + 3;
  43131. ps[4] = ps[2];
  43132. ps[7] = pi + 4;
  43133. ps[0] = ps[3];
  43134. ps[1] = pi + 7;
  43135. ps[2] = pi + 6;
  43136. ps[3] = pi + 5;
  43137. cs[2] = cs[0];
  43138. cs[3] = ci;
  43139. cs[0] = cs[1];
  43140. cs[1] = ci + 1;
  43141. break;
  43142. }
  43143. ps[5] = coords.length;
  43144. 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]);
  43145. ps[6] = coords.length;
  43146. 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]);
  43147. ps[9] = coords.length;
  43148. 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]);
  43149. ps[10] = coords.length;
  43150. 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]);
  43151. this.figures.push({
  43152. type: "patch",
  43153. coords: new Int32Array(ps),
  43154. colors: new Int32Array(cs)
  43155. });
  43156. }
  43157. }
  43158. _decodeType7Shading(reader) {
  43159. const coords = this.coords;
  43160. const colors = this.colors;
  43161. const ps = new Int32Array(16);
  43162. const cs = new Int32Array(4);
  43163. while (reader.hasData) {
  43164. const f = reader.readFlag();
  43165. if (!(0 <= f && f <= 3)) {
  43166. throw new _util.FormatError("Unknown type7 flag");
  43167. }
  43168. const pi = coords.length;
  43169. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43170. coords.push(reader.readCoordinate());
  43171. }
  43172. const ci = colors.length;
  43173. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43174. colors.push(reader.readComponents());
  43175. }
  43176. let tmp1, tmp2, tmp3, tmp4;
  43177. switch (f) {
  43178. case 0:
  43179. ps[12] = pi + 3;
  43180. ps[13] = pi + 4;
  43181. ps[14] = pi + 5;
  43182. ps[15] = pi + 6;
  43183. ps[8] = pi + 2;
  43184. ps[9] = pi + 13;
  43185. ps[10] = pi + 14;
  43186. ps[11] = pi + 7;
  43187. ps[4] = pi + 1;
  43188. ps[5] = pi + 12;
  43189. ps[6] = pi + 15;
  43190. ps[7] = pi + 8;
  43191. ps[0] = pi;
  43192. ps[1] = pi + 11;
  43193. ps[2] = pi + 10;
  43194. ps[3] = pi + 9;
  43195. cs[2] = ci + 1;
  43196. cs[3] = ci + 2;
  43197. cs[0] = ci;
  43198. cs[1] = ci + 3;
  43199. break;
  43200. case 1:
  43201. tmp1 = ps[12];
  43202. tmp2 = ps[13];
  43203. tmp3 = ps[14];
  43204. tmp4 = ps[15];
  43205. ps[12] = tmp4;
  43206. ps[13] = pi + 0;
  43207. ps[14] = pi + 1;
  43208. ps[15] = pi + 2;
  43209. ps[8] = tmp3;
  43210. ps[9] = pi + 9;
  43211. ps[10] = pi + 10;
  43212. ps[11] = pi + 3;
  43213. ps[4] = tmp2;
  43214. ps[5] = pi + 8;
  43215. ps[6] = pi + 11;
  43216. ps[7] = pi + 4;
  43217. ps[0] = tmp1;
  43218. ps[1] = pi + 7;
  43219. ps[2] = pi + 6;
  43220. ps[3] = pi + 5;
  43221. tmp1 = cs[2];
  43222. tmp2 = cs[3];
  43223. cs[2] = tmp2;
  43224. cs[3] = ci;
  43225. cs[0] = tmp1;
  43226. cs[1] = ci + 1;
  43227. break;
  43228. case 2:
  43229. tmp1 = ps[15];
  43230. tmp2 = ps[11];
  43231. ps[12] = ps[3];
  43232. ps[13] = pi + 0;
  43233. ps[14] = pi + 1;
  43234. ps[15] = pi + 2;
  43235. ps[8] = ps[7];
  43236. ps[9] = pi + 9;
  43237. ps[10] = pi + 10;
  43238. ps[11] = pi + 3;
  43239. ps[4] = tmp2;
  43240. ps[5] = pi + 8;
  43241. ps[6] = pi + 11;
  43242. ps[7] = pi + 4;
  43243. ps[0] = tmp1;
  43244. ps[1] = pi + 7;
  43245. ps[2] = pi + 6;
  43246. ps[3] = pi + 5;
  43247. tmp1 = cs[3];
  43248. cs[2] = cs[1];
  43249. cs[3] = ci;
  43250. cs[0] = tmp1;
  43251. cs[1] = ci + 1;
  43252. break;
  43253. case 3:
  43254. ps[12] = ps[0];
  43255. ps[13] = pi + 0;
  43256. ps[14] = pi + 1;
  43257. ps[15] = pi + 2;
  43258. ps[8] = ps[1];
  43259. ps[9] = pi + 9;
  43260. ps[10] = pi + 10;
  43261. ps[11] = pi + 3;
  43262. ps[4] = ps[2];
  43263. ps[5] = pi + 8;
  43264. ps[6] = pi + 11;
  43265. ps[7] = pi + 4;
  43266. ps[0] = ps[3];
  43267. ps[1] = pi + 7;
  43268. ps[2] = pi + 6;
  43269. ps[3] = pi + 5;
  43270. cs[2] = cs[0];
  43271. cs[3] = ci;
  43272. cs[0] = cs[1];
  43273. cs[1] = ci + 1;
  43274. break;
  43275. }
  43276. this.figures.push({
  43277. type: "patch",
  43278. coords: new Int32Array(ps),
  43279. colors: new Int32Array(cs)
  43280. });
  43281. }
  43282. }
  43283. _buildFigureFromPatch(index) {
  43284. const figure = this.figures[index];
  43285. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  43286. const coords = this.coords,
  43287. colors = this.colors;
  43288. const pi = figure.coords;
  43289. const ci = figure.colors;
  43290. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43291. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43292. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43293. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43294. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  43295. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  43296. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  43297. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  43298. const verticesPerRow = splitXBy + 1;
  43299. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  43300. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  43301. let k = 0;
  43302. const cl = new Uint8Array(3),
  43303. cr = new Uint8Array(3);
  43304. const c0 = colors[ci[0]],
  43305. c1 = colors[ci[1]],
  43306. c2 = colors[ci[2]],
  43307. c3 = colors[ci[3]];
  43308. const bRow = getB(splitYBy),
  43309. bCol = getB(splitXBy);
  43310. for (let row = 0; row <= splitYBy; row++) {
  43311. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  43312. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  43313. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  43314. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  43315. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  43316. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  43317. for (let col = 0; col <= splitXBy; col++, k++) {
  43318. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  43319. continue;
  43320. }
  43321. let x = 0,
  43322. y = 0;
  43323. let q = 0;
  43324. for (let i = 0; i <= 3; i++) {
  43325. for (let j = 0; j <= 3; j++, q++) {
  43326. const m = bRow[row][i] * bCol[col][j];
  43327. x += coords[pi[q]][0] * m;
  43328. y += coords[pi[q]][1] * m;
  43329. }
  43330. }
  43331. figureCoords[k] = coords.length;
  43332. coords.push([x, y]);
  43333. figureColors[k] = colors.length;
  43334. const newColor = new Uint8Array(3);
  43335. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  43336. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  43337. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  43338. colors.push(newColor);
  43339. }
  43340. }
  43341. figureCoords[0] = pi[0];
  43342. figureColors[0] = ci[0];
  43343. figureCoords[splitXBy] = pi[3];
  43344. figureColors[splitXBy] = ci[1];
  43345. figureCoords[verticesPerRow * splitYBy] = pi[12];
  43346. figureColors[verticesPerRow * splitYBy] = ci[2];
  43347. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  43348. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  43349. this.figures[index] = {
  43350. type: "lattice",
  43351. coords: figureCoords,
  43352. colors: figureColors,
  43353. verticesPerRow
  43354. };
  43355. }
  43356. _updateBounds() {
  43357. let minX = this.coords[0][0],
  43358. minY = this.coords[0][1],
  43359. maxX = minX,
  43360. maxY = minY;
  43361. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  43362. const x = this.coords[i][0],
  43363. y = this.coords[i][1];
  43364. minX = minX > x ? x : minX;
  43365. minY = minY > y ? y : minY;
  43366. maxX = maxX < x ? x : maxX;
  43367. maxY = maxY < y ? y : maxY;
  43368. }
  43369. this.bounds = [minX, minY, maxX, maxY];
  43370. }
  43371. _packData() {
  43372. let i, ii, j, jj;
  43373. const coords = this.coords;
  43374. const coordsPacked = new Float32Array(coords.length * 2);
  43375. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  43376. const xy = coords[i];
  43377. coordsPacked[j++] = xy[0];
  43378. coordsPacked[j++] = xy[1];
  43379. }
  43380. this.coords = coordsPacked;
  43381. const colors = this.colors;
  43382. const colorsPacked = new Uint8Array(colors.length * 3);
  43383. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  43384. const c = colors[i];
  43385. colorsPacked[j++] = c[0];
  43386. colorsPacked[j++] = c[1];
  43387. colorsPacked[j++] = c[2];
  43388. }
  43389. this.colors = colorsPacked;
  43390. const figures = this.figures;
  43391. for (i = 0, ii = figures.length; i < ii; i++) {
  43392. const figure = figures[i],
  43393. ps = figure.coords,
  43394. cs = figure.colors;
  43395. for (j = 0, jj = ps.length; j < jj; j++) {
  43396. ps[j] *= 2;
  43397. cs[j] *= 3;
  43398. }
  43399. }
  43400. }
  43401. getIR() {
  43402. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  43403. }
  43404. }
  43405. class DummyShading extends BaseShading {
  43406. getIR() {
  43407. return ["Dummy"];
  43408. }
  43409. }
  43410. function getTilingPatternIR(operatorList, dict, color) {
  43411. const matrix = dict.getArray("Matrix");
  43412. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  43413. const xstep = dict.get("XStep");
  43414. const ystep = dict.get("YStep");
  43415. const paintType = dict.get("PaintType");
  43416. const tilingType = dict.get("TilingType");
  43417. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  43418. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  43419. }
  43420. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  43421. }
  43422. /***/ }),
  43423. /* 57 */
  43424. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43425. Object.defineProperty(exports, "__esModule", ({
  43426. value: true
  43427. }));
  43428. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  43429. exports.isPDFFunction = isPDFFunction;
  43430. var _primitives = __w_pdfjs_require__(5);
  43431. var _util = __w_pdfjs_require__(2);
  43432. var _ps_parser = __w_pdfjs_require__(58);
  43433. var _base_stream = __w_pdfjs_require__(9);
  43434. var _image_utils = __w_pdfjs_require__(59);
  43435. class PDFFunctionFactory {
  43436. constructor({
  43437. xref,
  43438. isEvalSupported = true
  43439. }) {
  43440. this.xref = xref;
  43441. this.isEvalSupported = isEvalSupported !== false;
  43442. }
  43443. create(fn) {
  43444. const cachedFunction = this.getCached(fn);
  43445. if (cachedFunction) {
  43446. return cachedFunction;
  43447. }
  43448. const parsedFunction = PDFFunction.parse({
  43449. xref: this.xref,
  43450. isEvalSupported: this.isEvalSupported,
  43451. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  43452. });
  43453. this._cache(fn, parsedFunction);
  43454. return parsedFunction;
  43455. }
  43456. createFromArray(fnObj) {
  43457. const cachedFunction = this.getCached(fnObj);
  43458. if (cachedFunction) {
  43459. return cachedFunction;
  43460. }
  43461. const parsedFunction = PDFFunction.parseArray({
  43462. xref: this.xref,
  43463. isEvalSupported: this.isEvalSupported,
  43464. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  43465. });
  43466. this._cache(fnObj, parsedFunction);
  43467. return parsedFunction;
  43468. }
  43469. getCached(cacheKey) {
  43470. let fnRef;
  43471. if (cacheKey instanceof _primitives.Ref) {
  43472. fnRef = cacheKey;
  43473. } else if (cacheKey instanceof _primitives.Dict) {
  43474. fnRef = cacheKey.objId;
  43475. } else if (cacheKey instanceof _base_stream.BaseStream) {
  43476. fnRef = cacheKey.dict && cacheKey.dict.objId;
  43477. }
  43478. if (fnRef) {
  43479. const localFunction = this._localFunctionCache.getByRef(fnRef);
  43480. if (localFunction) {
  43481. return localFunction;
  43482. }
  43483. }
  43484. return null;
  43485. }
  43486. _cache(cacheKey, parsedFunction) {
  43487. if (!parsedFunction) {
  43488. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  43489. }
  43490. let fnRef;
  43491. if (cacheKey instanceof _primitives.Ref) {
  43492. fnRef = cacheKey;
  43493. } else if (cacheKey instanceof _primitives.Dict) {
  43494. fnRef = cacheKey.objId;
  43495. } else if (cacheKey instanceof _base_stream.BaseStream) {
  43496. fnRef = cacheKey.dict && cacheKey.dict.objId;
  43497. }
  43498. if (fnRef) {
  43499. this._localFunctionCache.set(null, fnRef, parsedFunction);
  43500. }
  43501. }
  43502. get _localFunctionCache() {
  43503. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  43504. }
  43505. }
  43506. exports.PDFFunctionFactory = PDFFunctionFactory;
  43507. function toNumberArray(arr) {
  43508. if (!Array.isArray(arr)) {
  43509. return null;
  43510. }
  43511. const length = arr.length;
  43512. for (let i = 0; i < length; i++) {
  43513. if (typeof arr[i] !== "number") {
  43514. const result = new Array(length);
  43515. for (let j = 0; j < length; j++) {
  43516. result[j] = +arr[j];
  43517. }
  43518. return result;
  43519. }
  43520. }
  43521. return arr;
  43522. }
  43523. class PDFFunction {
  43524. static getSampleArray(size, outputSize, bps, stream) {
  43525. let i, ii;
  43526. let length = 1;
  43527. for (i = 0, ii = size.length; i < ii; i++) {
  43528. length *= size[i];
  43529. }
  43530. length *= outputSize;
  43531. const array = new Array(length);
  43532. let codeSize = 0;
  43533. let codeBuf = 0;
  43534. const sampleMul = 1.0 / (2.0 ** bps - 1);
  43535. const strBytes = stream.getBytes((length * bps + 7) / 8);
  43536. let strIdx = 0;
  43537. for (i = 0; i < length; i++) {
  43538. while (codeSize < bps) {
  43539. codeBuf <<= 8;
  43540. codeBuf |= strBytes[strIdx++];
  43541. codeSize += 8;
  43542. }
  43543. codeSize -= bps;
  43544. array[i] = (codeBuf >> codeSize) * sampleMul;
  43545. codeBuf &= (1 << codeSize) - 1;
  43546. }
  43547. return array;
  43548. }
  43549. static parse({
  43550. xref,
  43551. isEvalSupported,
  43552. fn
  43553. }) {
  43554. const dict = fn.dict || fn;
  43555. const typeNum = dict.get("FunctionType");
  43556. switch (typeNum) {
  43557. case 0:
  43558. return this.constructSampled({
  43559. xref,
  43560. isEvalSupported,
  43561. fn,
  43562. dict
  43563. });
  43564. case 1:
  43565. break;
  43566. case 2:
  43567. return this.constructInterpolated({
  43568. xref,
  43569. isEvalSupported,
  43570. dict
  43571. });
  43572. case 3:
  43573. return this.constructStiched({
  43574. xref,
  43575. isEvalSupported,
  43576. dict
  43577. });
  43578. case 4:
  43579. return this.constructPostScript({
  43580. xref,
  43581. isEvalSupported,
  43582. fn,
  43583. dict
  43584. });
  43585. }
  43586. throw new _util.FormatError("Unknown type of function");
  43587. }
  43588. static parseArray({
  43589. xref,
  43590. isEvalSupported,
  43591. fnObj
  43592. }) {
  43593. if (!Array.isArray(fnObj)) {
  43594. return this.parse({
  43595. xref,
  43596. isEvalSupported,
  43597. fn: fnObj
  43598. });
  43599. }
  43600. const fnArray = [];
  43601. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  43602. fnArray.push(this.parse({
  43603. xref,
  43604. isEvalSupported,
  43605. fn: xref.fetchIfRef(fnObj[j])
  43606. }));
  43607. }
  43608. return function (src, srcOffset, dest, destOffset) {
  43609. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  43610. fnArray[i](src, srcOffset, dest, destOffset + i);
  43611. }
  43612. };
  43613. }
  43614. static constructSampled({
  43615. xref,
  43616. isEvalSupported,
  43617. fn,
  43618. dict
  43619. }) {
  43620. function toMultiArray(arr) {
  43621. const inputLength = arr.length;
  43622. const out = [];
  43623. let index = 0;
  43624. for (let i = 0; i < inputLength; i += 2) {
  43625. out[index++] = [arr[i], arr[i + 1]];
  43626. }
  43627. return out;
  43628. }
  43629. function interpolate(x, xmin, xmax, ymin, ymax) {
  43630. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  43631. }
  43632. let domain = toNumberArray(dict.getArray("Domain"));
  43633. let range = toNumberArray(dict.getArray("Range"));
  43634. if (!domain || !range) {
  43635. throw new _util.FormatError("No domain or range");
  43636. }
  43637. const inputSize = domain.length / 2;
  43638. const outputSize = range.length / 2;
  43639. domain = toMultiArray(domain);
  43640. range = toMultiArray(range);
  43641. const size = toNumberArray(dict.getArray("Size"));
  43642. const bps = dict.get("BitsPerSample");
  43643. const order = dict.get("Order") || 1;
  43644. if (order !== 1) {
  43645. (0, _util.info)("No support for cubic spline interpolation: " + order);
  43646. }
  43647. let encode = toNumberArray(dict.getArray("Encode"));
  43648. if (!encode) {
  43649. encode = [];
  43650. for (let i = 0; i < inputSize; ++i) {
  43651. encode.push([0, size[i] - 1]);
  43652. }
  43653. } else {
  43654. encode = toMultiArray(encode);
  43655. }
  43656. let decode = toNumberArray(dict.getArray("Decode"));
  43657. if (!decode) {
  43658. decode = range;
  43659. } else {
  43660. decode = toMultiArray(decode);
  43661. }
  43662. const samples = this.getSampleArray(size, outputSize, bps, fn);
  43663. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  43664. const cubeVertices = 1 << inputSize;
  43665. const cubeN = new Float64Array(cubeVertices);
  43666. const cubeVertex = new Uint32Array(cubeVertices);
  43667. let i, j;
  43668. for (j = 0; j < cubeVertices; j++) {
  43669. cubeN[j] = 1;
  43670. }
  43671. let k = outputSize,
  43672. pos = 1;
  43673. for (i = 0; i < inputSize; ++i) {
  43674. const domain_2i = domain[i][0];
  43675. const domain_2i_1 = domain[i][1];
  43676. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  43677. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  43678. const size_i = size[i];
  43679. e = Math.min(Math.max(e, 0), size_i - 1);
  43680. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  43681. const n0 = e0 + 1 - e;
  43682. const n1 = e - e0;
  43683. const offset0 = e0 * k;
  43684. const offset1 = offset0 + k;
  43685. for (j = 0; j < cubeVertices; j++) {
  43686. if (j & pos) {
  43687. cubeN[j] *= n1;
  43688. cubeVertex[j] += offset1;
  43689. } else {
  43690. cubeN[j] *= n0;
  43691. cubeVertex[j] += offset0;
  43692. }
  43693. }
  43694. k *= size_i;
  43695. pos <<= 1;
  43696. }
  43697. for (j = 0; j < outputSize; ++j) {
  43698. let rj = 0;
  43699. for (i = 0; i < cubeVertices; i++) {
  43700. rj += samples[cubeVertex[i] + j] * cubeN[i];
  43701. }
  43702. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  43703. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  43704. }
  43705. };
  43706. }
  43707. static constructInterpolated({
  43708. xref,
  43709. isEvalSupported,
  43710. dict
  43711. }) {
  43712. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  43713. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  43714. const n = dict.get("N");
  43715. const diff = [];
  43716. for (let i = 0, ii = c0.length; i < ii; ++i) {
  43717. diff.push(c1[i] - c0[i]);
  43718. }
  43719. const length = diff.length;
  43720. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  43721. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  43722. for (let j = 0; j < length; ++j) {
  43723. dest[destOffset + j] = c0[j] + x * diff[j];
  43724. }
  43725. };
  43726. }
  43727. static constructStiched({
  43728. xref,
  43729. isEvalSupported,
  43730. dict
  43731. }) {
  43732. const domain = toNumberArray(dict.getArray("Domain"));
  43733. if (!domain) {
  43734. throw new _util.FormatError("No domain");
  43735. }
  43736. const inputSize = domain.length / 2;
  43737. if (inputSize !== 1) {
  43738. throw new _util.FormatError("Bad domain for stiched function");
  43739. }
  43740. const fnRefs = dict.get("Functions");
  43741. const fns = [];
  43742. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  43743. fns.push(this.parse({
  43744. xref,
  43745. isEvalSupported,
  43746. fn: xref.fetchIfRef(fnRefs[i])
  43747. }));
  43748. }
  43749. const bounds = toNumberArray(dict.getArray("Bounds"));
  43750. const encode = toNumberArray(dict.getArray("Encode"));
  43751. const tmpBuf = new Float32Array(1);
  43752. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  43753. const clip = function constructStichedFromIRClip(v, min, max) {
  43754. if (v > max) {
  43755. v = max;
  43756. } else if (v < min) {
  43757. v = min;
  43758. }
  43759. return v;
  43760. };
  43761. const v = clip(src[srcOffset], domain[0], domain[1]);
  43762. const length = bounds.length;
  43763. let i;
  43764. for (i = 0; i < length; ++i) {
  43765. if (v < bounds[i]) {
  43766. break;
  43767. }
  43768. }
  43769. let dmin = domain[0];
  43770. if (i > 0) {
  43771. dmin = bounds[i - 1];
  43772. }
  43773. let dmax = domain[1];
  43774. if (i < bounds.length) {
  43775. dmax = bounds[i];
  43776. }
  43777. const rmin = encode[2 * i];
  43778. const rmax = encode[2 * i + 1];
  43779. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  43780. fns[i](tmpBuf, 0, dest, destOffset);
  43781. };
  43782. }
  43783. static constructPostScript({
  43784. xref,
  43785. isEvalSupported,
  43786. fn,
  43787. dict
  43788. }) {
  43789. const domain = toNumberArray(dict.getArray("Domain"));
  43790. const range = toNumberArray(dict.getArray("Range"));
  43791. if (!domain) {
  43792. throw new _util.FormatError("No domain.");
  43793. }
  43794. if (!range) {
  43795. throw new _util.FormatError("No range.");
  43796. }
  43797. const lexer = new _ps_parser.PostScriptLexer(fn);
  43798. const parser = new _ps_parser.PostScriptParser(lexer);
  43799. const code = parser.parse();
  43800. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  43801. const compiled = new PostScriptCompiler().compile(code, domain, range);
  43802. if (compiled) {
  43803. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  43804. }
  43805. }
  43806. (0, _util.info)("Unable to compile PS function");
  43807. const numOutputs = range.length >> 1;
  43808. const numInputs = domain.length >> 1;
  43809. const evaluator = new PostScriptEvaluator(code);
  43810. const cache = Object.create(null);
  43811. const MAX_CACHE_SIZE = 2048 * 4;
  43812. let cache_available = MAX_CACHE_SIZE;
  43813. const tmpBuf = new Float32Array(numInputs);
  43814. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  43815. let i, value;
  43816. let key = "";
  43817. const input = tmpBuf;
  43818. for (i = 0; i < numInputs; i++) {
  43819. value = src[srcOffset + i];
  43820. input[i] = value;
  43821. key += value + "_";
  43822. }
  43823. const cachedValue = cache[key];
  43824. if (cachedValue !== undefined) {
  43825. dest.set(cachedValue, destOffset);
  43826. return;
  43827. }
  43828. const output = new Float32Array(numOutputs);
  43829. const stack = evaluator.execute(input);
  43830. const stackIndex = stack.length - numOutputs;
  43831. for (i = 0; i < numOutputs; i++) {
  43832. value = stack[stackIndex + i];
  43833. let bound = range[i * 2];
  43834. if (value < bound) {
  43835. value = bound;
  43836. } else {
  43837. bound = range[i * 2 + 1];
  43838. if (value > bound) {
  43839. value = bound;
  43840. }
  43841. }
  43842. output[i] = value;
  43843. }
  43844. if (cache_available > 0) {
  43845. cache_available--;
  43846. cache[key] = output;
  43847. }
  43848. dest.set(output, destOffset);
  43849. };
  43850. }
  43851. }
  43852. function isPDFFunction(v) {
  43853. let fnDict;
  43854. if (typeof v !== "object") {
  43855. return false;
  43856. } else if (v instanceof _primitives.Dict) {
  43857. fnDict = v;
  43858. } else if (v instanceof _base_stream.BaseStream) {
  43859. fnDict = v.dict;
  43860. } else {
  43861. return false;
  43862. }
  43863. return fnDict.has("FunctionType");
  43864. }
  43865. class PostScriptStack {
  43866. static get MAX_STACK_SIZE() {
  43867. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  43868. }
  43869. constructor(initialStack) {
  43870. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  43871. }
  43872. push(value) {
  43873. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  43874. throw new Error("PostScript function stack overflow.");
  43875. }
  43876. this.stack.push(value);
  43877. }
  43878. pop() {
  43879. if (this.stack.length <= 0) {
  43880. throw new Error("PostScript function stack underflow.");
  43881. }
  43882. return this.stack.pop();
  43883. }
  43884. copy(n) {
  43885. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  43886. throw new Error("PostScript function stack overflow.");
  43887. }
  43888. const stack = this.stack;
  43889. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  43890. stack.push(stack[i]);
  43891. }
  43892. }
  43893. index(n) {
  43894. this.push(this.stack[this.stack.length - n - 1]);
  43895. }
  43896. roll(n, p) {
  43897. const stack = this.stack;
  43898. const l = stack.length - n;
  43899. const r = stack.length - 1;
  43900. const c = l + (p - Math.floor(p / n) * n);
  43901. for (let i = l, j = r; i < j; i++, j--) {
  43902. const t = stack[i];
  43903. stack[i] = stack[j];
  43904. stack[j] = t;
  43905. }
  43906. for (let i = l, j = c - 1; i < j; i++, j--) {
  43907. const t = stack[i];
  43908. stack[i] = stack[j];
  43909. stack[j] = t;
  43910. }
  43911. for (let i = c, j = r; i < j; i++, j--) {
  43912. const t = stack[i];
  43913. stack[i] = stack[j];
  43914. stack[j] = t;
  43915. }
  43916. }
  43917. }
  43918. class PostScriptEvaluator {
  43919. constructor(operators) {
  43920. this.operators = operators;
  43921. }
  43922. execute(initialStack) {
  43923. const stack = new PostScriptStack(initialStack);
  43924. let counter = 0;
  43925. const operators = this.operators;
  43926. const length = operators.length;
  43927. let operator, a, b;
  43928. while (counter < length) {
  43929. operator = operators[counter++];
  43930. if (typeof operator === "number") {
  43931. stack.push(operator);
  43932. continue;
  43933. }
  43934. switch (operator) {
  43935. case "jz":
  43936. b = stack.pop();
  43937. a = stack.pop();
  43938. if (!a) {
  43939. counter = b;
  43940. }
  43941. break;
  43942. case "j":
  43943. a = stack.pop();
  43944. counter = a;
  43945. break;
  43946. case "abs":
  43947. a = stack.pop();
  43948. stack.push(Math.abs(a));
  43949. break;
  43950. case "add":
  43951. b = stack.pop();
  43952. a = stack.pop();
  43953. stack.push(a + b);
  43954. break;
  43955. case "and":
  43956. b = stack.pop();
  43957. a = stack.pop();
  43958. if (typeof a === "boolean" && typeof b === "boolean") {
  43959. stack.push(a && b);
  43960. } else {
  43961. stack.push(a & b);
  43962. }
  43963. break;
  43964. case "atan":
  43965. a = stack.pop();
  43966. stack.push(Math.atan(a));
  43967. break;
  43968. case "bitshift":
  43969. b = stack.pop();
  43970. a = stack.pop();
  43971. if (a > 0) {
  43972. stack.push(a << b);
  43973. } else {
  43974. stack.push(a >> b);
  43975. }
  43976. break;
  43977. case "ceiling":
  43978. a = stack.pop();
  43979. stack.push(Math.ceil(a));
  43980. break;
  43981. case "copy":
  43982. a = stack.pop();
  43983. stack.copy(a);
  43984. break;
  43985. case "cos":
  43986. a = stack.pop();
  43987. stack.push(Math.cos(a));
  43988. break;
  43989. case "cvi":
  43990. a = stack.pop() | 0;
  43991. stack.push(a);
  43992. break;
  43993. case "cvr":
  43994. break;
  43995. case "div":
  43996. b = stack.pop();
  43997. a = stack.pop();
  43998. stack.push(a / b);
  43999. break;
  44000. case "dup":
  44001. stack.copy(1);
  44002. break;
  44003. case "eq":
  44004. b = stack.pop();
  44005. a = stack.pop();
  44006. stack.push(a === b);
  44007. break;
  44008. case "exch":
  44009. stack.roll(2, 1);
  44010. break;
  44011. case "exp":
  44012. b = stack.pop();
  44013. a = stack.pop();
  44014. stack.push(a ** b);
  44015. break;
  44016. case "false":
  44017. stack.push(false);
  44018. break;
  44019. case "floor":
  44020. a = stack.pop();
  44021. stack.push(Math.floor(a));
  44022. break;
  44023. case "ge":
  44024. b = stack.pop();
  44025. a = stack.pop();
  44026. stack.push(a >= b);
  44027. break;
  44028. case "gt":
  44029. b = stack.pop();
  44030. a = stack.pop();
  44031. stack.push(a > b);
  44032. break;
  44033. case "idiv":
  44034. b = stack.pop();
  44035. a = stack.pop();
  44036. stack.push(a / b | 0);
  44037. break;
  44038. case "index":
  44039. a = stack.pop();
  44040. stack.index(a);
  44041. break;
  44042. case "le":
  44043. b = stack.pop();
  44044. a = stack.pop();
  44045. stack.push(a <= b);
  44046. break;
  44047. case "ln":
  44048. a = stack.pop();
  44049. stack.push(Math.log(a));
  44050. break;
  44051. case "log":
  44052. a = stack.pop();
  44053. stack.push(Math.log(a) / Math.LN10);
  44054. break;
  44055. case "lt":
  44056. b = stack.pop();
  44057. a = stack.pop();
  44058. stack.push(a < b);
  44059. break;
  44060. case "mod":
  44061. b = stack.pop();
  44062. a = stack.pop();
  44063. stack.push(a % b);
  44064. break;
  44065. case "mul":
  44066. b = stack.pop();
  44067. a = stack.pop();
  44068. stack.push(a * b);
  44069. break;
  44070. case "ne":
  44071. b = stack.pop();
  44072. a = stack.pop();
  44073. stack.push(a !== b);
  44074. break;
  44075. case "neg":
  44076. a = stack.pop();
  44077. stack.push(-a);
  44078. break;
  44079. case "not":
  44080. a = stack.pop();
  44081. if (typeof a === "boolean") {
  44082. stack.push(!a);
  44083. } else {
  44084. stack.push(~a);
  44085. }
  44086. break;
  44087. case "or":
  44088. b = stack.pop();
  44089. a = stack.pop();
  44090. if (typeof a === "boolean" && typeof b === "boolean") {
  44091. stack.push(a || b);
  44092. } else {
  44093. stack.push(a | b);
  44094. }
  44095. break;
  44096. case "pop":
  44097. stack.pop();
  44098. break;
  44099. case "roll":
  44100. b = stack.pop();
  44101. a = stack.pop();
  44102. stack.roll(a, b);
  44103. break;
  44104. case "round":
  44105. a = stack.pop();
  44106. stack.push(Math.round(a));
  44107. break;
  44108. case "sin":
  44109. a = stack.pop();
  44110. stack.push(Math.sin(a));
  44111. break;
  44112. case "sqrt":
  44113. a = stack.pop();
  44114. stack.push(Math.sqrt(a));
  44115. break;
  44116. case "sub":
  44117. b = stack.pop();
  44118. a = stack.pop();
  44119. stack.push(a - b);
  44120. break;
  44121. case "true":
  44122. stack.push(true);
  44123. break;
  44124. case "truncate":
  44125. a = stack.pop();
  44126. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  44127. stack.push(a);
  44128. break;
  44129. case "xor":
  44130. b = stack.pop();
  44131. a = stack.pop();
  44132. if (typeof a === "boolean" && typeof b === "boolean") {
  44133. stack.push(a !== b);
  44134. } else {
  44135. stack.push(a ^ b);
  44136. }
  44137. break;
  44138. default:
  44139. throw new _util.FormatError(`Unknown operator ${operator}`);
  44140. }
  44141. }
  44142. return stack.stack;
  44143. }
  44144. }
  44145. exports.PostScriptEvaluator = PostScriptEvaluator;
  44146. const PostScriptCompiler = function PostScriptCompilerClosure() {
  44147. class AstNode {
  44148. constructor(type) {
  44149. this.type = type;
  44150. }
  44151. visit(visitor) {
  44152. (0, _util.unreachable)("abstract method");
  44153. }
  44154. }
  44155. class AstArgument extends AstNode {
  44156. constructor(index, min, max) {
  44157. super("args");
  44158. this.index = index;
  44159. this.min = min;
  44160. this.max = max;
  44161. }
  44162. visit(visitor) {
  44163. visitor.visitArgument(this);
  44164. }
  44165. }
  44166. class AstLiteral extends AstNode {
  44167. constructor(number) {
  44168. super("literal");
  44169. this.number = number;
  44170. this.min = number;
  44171. this.max = number;
  44172. }
  44173. visit(visitor) {
  44174. visitor.visitLiteral(this);
  44175. }
  44176. }
  44177. class AstBinaryOperation extends AstNode {
  44178. constructor(op, arg1, arg2, min, max) {
  44179. super("binary");
  44180. this.op = op;
  44181. this.arg1 = arg1;
  44182. this.arg2 = arg2;
  44183. this.min = min;
  44184. this.max = max;
  44185. }
  44186. visit(visitor) {
  44187. visitor.visitBinaryOperation(this);
  44188. }
  44189. }
  44190. class AstMin extends AstNode {
  44191. constructor(arg, max) {
  44192. super("max");
  44193. this.arg = arg;
  44194. this.min = arg.min;
  44195. this.max = max;
  44196. }
  44197. visit(visitor) {
  44198. visitor.visitMin(this);
  44199. }
  44200. }
  44201. class AstVariable extends AstNode {
  44202. constructor(index, min, max) {
  44203. super("var");
  44204. this.index = index;
  44205. this.min = min;
  44206. this.max = max;
  44207. }
  44208. visit(visitor) {
  44209. visitor.visitVariable(this);
  44210. }
  44211. }
  44212. class AstVariableDefinition extends AstNode {
  44213. constructor(variable, arg) {
  44214. super("definition");
  44215. this.variable = variable;
  44216. this.arg = arg;
  44217. }
  44218. visit(visitor) {
  44219. visitor.visitVariableDefinition(this);
  44220. }
  44221. }
  44222. class ExpressionBuilderVisitor {
  44223. constructor() {
  44224. this.parts = [];
  44225. }
  44226. visitArgument(arg) {
  44227. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  44228. }
  44229. visitVariable(variable) {
  44230. this.parts.push("v", variable.index);
  44231. }
  44232. visitLiteral(literal) {
  44233. this.parts.push(literal.number);
  44234. }
  44235. visitBinaryOperation(operation) {
  44236. this.parts.push("(");
  44237. operation.arg1.visit(this);
  44238. this.parts.push(" ", operation.op, " ");
  44239. operation.arg2.visit(this);
  44240. this.parts.push(")");
  44241. }
  44242. visitVariableDefinition(definition) {
  44243. this.parts.push("var ");
  44244. definition.variable.visit(this);
  44245. this.parts.push(" = ");
  44246. definition.arg.visit(this);
  44247. this.parts.push(";");
  44248. }
  44249. visitMin(max) {
  44250. this.parts.push("Math.min(");
  44251. max.arg.visit(this);
  44252. this.parts.push(", ", max.max, ")");
  44253. }
  44254. toString() {
  44255. return this.parts.join("");
  44256. }
  44257. }
  44258. function buildAddOperation(num1, num2) {
  44259. if (num2.type === "literal" && num2.number === 0) {
  44260. return num1;
  44261. }
  44262. if (num1.type === "literal" && num1.number === 0) {
  44263. return num2;
  44264. }
  44265. if (num2.type === "literal" && num1.type === "literal") {
  44266. return new AstLiteral(num1.number + num2.number);
  44267. }
  44268. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  44269. }
  44270. function buildMulOperation(num1, num2) {
  44271. if (num2.type === "literal") {
  44272. if (num2.number === 0) {
  44273. return new AstLiteral(0);
  44274. } else if (num2.number === 1) {
  44275. return num1;
  44276. } else if (num1.type === "literal") {
  44277. return new AstLiteral(num1.number * num2.number);
  44278. }
  44279. }
  44280. if (num1.type === "literal") {
  44281. if (num1.number === 0) {
  44282. return new AstLiteral(0);
  44283. } else if (num1.number === 1) {
  44284. return num2;
  44285. }
  44286. }
  44287. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  44288. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  44289. return new AstBinaryOperation("*", num1, num2, min, max);
  44290. }
  44291. function buildSubOperation(num1, num2) {
  44292. if (num2.type === "literal") {
  44293. if (num2.number === 0) {
  44294. return num1;
  44295. } else if (num1.type === "literal") {
  44296. return new AstLiteral(num1.number - num2.number);
  44297. }
  44298. }
  44299. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  44300. return num2.arg2;
  44301. }
  44302. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  44303. }
  44304. function buildMinOperation(num1, max) {
  44305. if (num1.min >= max) {
  44306. return new AstLiteral(max);
  44307. } else if (num1.max <= max) {
  44308. return num1;
  44309. }
  44310. return new AstMin(num1, max);
  44311. }
  44312. class PostScriptCompiler {
  44313. compile(code, domain, range) {
  44314. const stack = [];
  44315. const instructions = [];
  44316. const inputSize = domain.length >> 1,
  44317. outputSize = range.length >> 1;
  44318. let lastRegister = 0;
  44319. let n, j;
  44320. let num1, num2, ast1, ast2, tmpVar, item;
  44321. for (let i = 0; i < inputSize; i++) {
  44322. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  44323. }
  44324. for (let i = 0, ii = code.length; i < ii; i++) {
  44325. item = code[i];
  44326. if (typeof item === "number") {
  44327. stack.push(new AstLiteral(item));
  44328. continue;
  44329. }
  44330. switch (item) {
  44331. case "add":
  44332. if (stack.length < 2) {
  44333. return null;
  44334. }
  44335. num2 = stack.pop();
  44336. num1 = stack.pop();
  44337. stack.push(buildAddOperation(num1, num2));
  44338. break;
  44339. case "cvr":
  44340. if (stack.length < 1) {
  44341. return null;
  44342. }
  44343. break;
  44344. case "mul":
  44345. if (stack.length < 2) {
  44346. return null;
  44347. }
  44348. num2 = stack.pop();
  44349. num1 = stack.pop();
  44350. stack.push(buildMulOperation(num1, num2));
  44351. break;
  44352. case "sub":
  44353. if (stack.length < 2) {
  44354. return null;
  44355. }
  44356. num2 = stack.pop();
  44357. num1 = stack.pop();
  44358. stack.push(buildSubOperation(num1, num2));
  44359. break;
  44360. case "exch":
  44361. if (stack.length < 2) {
  44362. return null;
  44363. }
  44364. ast1 = stack.pop();
  44365. ast2 = stack.pop();
  44366. stack.push(ast1, ast2);
  44367. break;
  44368. case "pop":
  44369. if (stack.length < 1) {
  44370. return null;
  44371. }
  44372. stack.pop();
  44373. break;
  44374. case "index":
  44375. if (stack.length < 1) {
  44376. return null;
  44377. }
  44378. num1 = stack.pop();
  44379. if (num1.type !== "literal") {
  44380. return null;
  44381. }
  44382. n = num1.number;
  44383. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  44384. return null;
  44385. }
  44386. ast1 = stack[stack.length - n - 1];
  44387. if (ast1.type === "literal" || ast1.type === "var") {
  44388. stack.push(ast1);
  44389. break;
  44390. }
  44391. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  44392. stack[stack.length - n - 1] = tmpVar;
  44393. stack.push(tmpVar);
  44394. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  44395. break;
  44396. case "dup":
  44397. if (stack.length < 1) {
  44398. return null;
  44399. }
  44400. 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]) {
  44401. num1 = stack.pop();
  44402. stack.push(buildMinOperation(num1, code[i + 1]));
  44403. i += 6;
  44404. break;
  44405. }
  44406. ast1 = stack[stack.length - 1];
  44407. if (ast1.type === "literal" || ast1.type === "var") {
  44408. stack.push(ast1);
  44409. break;
  44410. }
  44411. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  44412. stack[stack.length - 1] = tmpVar;
  44413. stack.push(tmpVar);
  44414. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  44415. break;
  44416. case "roll":
  44417. if (stack.length < 2) {
  44418. return null;
  44419. }
  44420. num2 = stack.pop();
  44421. num1 = stack.pop();
  44422. if (num2.type !== "literal" || num1.type !== "literal") {
  44423. return null;
  44424. }
  44425. j = num2.number;
  44426. n = num1.number;
  44427. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  44428. return null;
  44429. }
  44430. j = (j % n + n) % n;
  44431. if (j === 0) {
  44432. break;
  44433. }
  44434. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  44435. break;
  44436. default:
  44437. return null;
  44438. }
  44439. }
  44440. if (stack.length !== outputSize) {
  44441. return null;
  44442. }
  44443. const result = [];
  44444. for (const instruction of instructions) {
  44445. const statementBuilder = new ExpressionBuilderVisitor();
  44446. instruction.visit(statementBuilder);
  44447. result.push(statementBuilder.toString());
  44448. }
  44449. for (let i = 0, ii = stack.length; i < ii; i++) {
  44450. const expr = stack[i],
  44451. statementBuilder = new ExpressionBuilderVisitor();
  44452. expr.visit(statementBuilder);
  44453. const min = range[i * 2],
  44454. max = range[i * 2 + 1];
  44455. const out = [statementBuilder.toString()];
  44456. if (min > expr.min) {
  44457. out.unshift("Math.max(", min, ", ");
  44458. out.push(")");
  44459. }
  44460. if (max < expr.max) {
  44461. out.unshift("Math.min(", max, ", ");
  44462. out.push(")");
  44463. }
  44464. out.unshift("dest[destOffset + ", i, "] = ");
  44465. out.push(";");
  44466. result.push(out.join(""));
  44467. }
  44468. return result.join("\n");
  44469. }
  44470. }
  44471. return PostScriptCompiler;
  44472. }();
  44473. exports.PostScriptCompiler = PostScriptCompiler;
  44474. /***/ }),
  44475. /* 58 */
  44476. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44477. Object.defineProperty(exports, "__esModule", ({
  44478. value: true
  44479. }));
  44480. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  44481. var _util = __w_pdfjs_require__(2);
  44482. var _primitives = __w_pdfjs_require__(5);
  44483. var _core_utils = __w_pdfjs_require__(8);
  44484. class PostScriptParser {
  44485. constructor(lexer) {
  44486. this.lexer = lexer;
  44487. this.operators = [];
  44488. this.token = null;
  44489. this.prev = null;
  44490. }
  44491. nextToken() {
  44492. this.prev = this.token;
  44493. this.token = this.lexer.getToken();
  44494. }
  44495. accept(type) {
  44496. if (this.token.type === type) {
  44497. this.nextToken();
  44498. return true;
  44499. }
  44500. return false;
  44501. }
  44502. expect(type) {
  44503. if (this.accept(type)) {
  44504. return true;
  44505. }
  44506. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  44507. }
  44508. parse() {
  44509. this.nextToken();
  44510. this.expect(PostScriptTokenTypes.LBRACE);
  44511. this.parseBlock();
  44512. this.expect(PostScriptTokenTypes.RBRACE);
  44513. return this.operators;
  44514. }
  44515. parseBlock() {
  44516. while (true) {
  44517. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  44518. this.operators.push(this.prev.value);
  44519. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  44520. this.operators.push(this.prev.value);
  44521. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  44522. this.parseCondition();
  44523. } else {
  44524. return;
  44525. }
  44526. }
  44527. }
  44528. parseCondition() {
  44529. const conditionLocation = this.operators.length;
  44530. this.operators.push(null, null);
  44531. this.parseBlock();
  44532. this.expect(PostScriptTokenTypes.RBRACE);
  44533. if (this.accept(PostScriptTokenTypes.IF)) {
  44534. this.operators[conditionLocation] = this.operators.length;
  44535. this.operators[conditionLocation + 1] = "jz";
  44536. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  44537. const jumpLocation = this.operators.length;
  44538. this.operators.push(null, null);
  44539. const endOfTrue = this.operators.length;
  44540. this.parseBlock();
  44541. this.expect(PostScriptTokenTypes.RBRACE);
  44542. this.expect(PostScriptTokenTypes.IFELSE);
  44543. this.operators[jumpLocation] = this.operators.length;
  44544. this.operators[jumpLocation + 1] = "j";
  44545. this.operators[conditionLocation] = endOfTrue;
  44546. this.operators[conditionLocation + 1] = "jz";
  44547. } else {
  44548. throw new _util.FormatError("PS Function: error parsing conditional.");
  44549. }
  44550. }
  44551. }
  44552. exports.PostScriptParser = PostScriptParser;
  44553. const PostScriptTokenTypes = {
  44554. LBRACE: 0,
  44555. RBRACE: 1,
  44556. NUMBER: 2,
  44557. OPERATOR: 3,
  44558. IF: 4,
  44559. IFELSE: 5
  44560. };
  44561. class PostScriptToken {
  44562. static get opCache() {
  44563. return (0, _util.shadow)(this, "opCache", Object.create(null));
  44564. }
  44565. constructor(type, value) {
  44566. this.type = type;
  44567. this.value = value;
  44568. }
  44569. static getOperator(op) {
  44570. const opValue = PostScriptToken.opCache[op];
  44571. if (opValue) {
  44572. return opValue;
  44573. }
  44574. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  44575. }
  44576. static get LBRACE() {
  44577. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  44578. }
  44579. static get RBRACE() {
  44580. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  44581. }
  44582. static get IF() {
  44583. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  44584. }
  44585. static get IFELSE() {
  44586. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  44587. }
  44588. }
  44589. class PostScriptLexer {
  44590. constructor(stream) {
  44591. this.stream = stream;
  44592. this.nextChar();
  44593. this.strBuf = [];
  44594. }
  44595. nextChar() {
  44596. return this.currentChar = this.stream.getByte();
  44597. }
  44598. getToken() {
  44599. let comment = false;
  44600. let ch = this.currentChar;
  44601. while (true) {
  44602. if (ch < 0) {
  44603. return _primitives.EOF;
  44604. }
  44605. if (comment) {
  44606. if (ch === 0x0a || ch === 0x0d) {
  44607. comment = false;
  44608. }
  44609. } else if (ch === 0x25) {
  44610. comment = true;
  44611. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  44612. break;
  44613. }
  44614. ch = this.nextChar();
  44615. }
  44616. switch (ch | 0) {
  44617. case 0x30:
  44618. case 0x31:
  44619. case 0x32:
  44620. case 0x33:
  44621. case 0x34:
  44622. case 0x35:
  44623. case 0x36:
  44624. case 0x37:
  44625. case 0x38:
  44626. case 0x39:
  44627. case 0x2b:
  44628. case 0x2d:
  44629. case 0x2e:
  44630. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  44631. case 0x7b:
  44632. this.nextChar();
  44633. return PostScriptToken.LBRACE;
  44634. case 0x7d:
  44635. this.nextChar();
  44636. return PostScriptToken.RBRACE;
  44637. }
  44638. const strBuf = this.strBuf;
  44639. strBuf.length = 0;
  44640. strBuf[0] = String.fromCharCode(ch);
  44641. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  44642. strBuf.push(String.fromCharCode(ch));
  44643. }
  44644. const str = strBuf.join("");
  44645. switch (str.toLowerCase()) {
  44646. case "if":
  44647. return PostScriptToken.IF;
  44648. case "ifelse":
  44649. return PostScriptToken.IFELSE;
  44650. default:
  44651. return PostScriptToken.getOperator(str);
  44652. }
  44653. }
  44654. getNumber() {
  44655. let ch = this.currentChar;
  44656. const strBuf = this.strBuf;
  44657. strBuf.length = 0;
  44658. strBuf[0] = String.fromCharCode(ch);
  44659. while ((ch = this.nextChar()) >= 0) {
  44660. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  44661. strBuf.push(String.fromCharCode(ch));
  44662. } else {
  44663. break;
  44664. }
  44665. }
  44666. const value = parseFloat(strBuf.join(""));
  44667. if (isNaN(value)) {
  44668. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  44669. }
  44670. return value;
  44671. }
  44672. }
  44673. exports.PostScriptLexer = PostScriptLexer;
  44674. /***/ }),
  44675. /* 59 */
  44676. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44677. Object.defineProperty(exports, "__esModule", ({
  44678. value: true
  44679. }));
  44680. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  44681. var _util = __w_pdfjs_require__(2);
  44682. var _primitives = __w_pdfjs_require__(5);
  44683. class BaseLocalCache {
  44684. constructor(options) {
  44685. if (this.constructor === BaseLocalCache) {
  44686. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  44687. }
  44688. this._onlyRefs = (options && options.onlyRefs) === true;
  44689. if (!this._onlyRefs) {
  44690. this._nameRefMap = new Map();
  44691. this._imageMap = new Map();
  44692. }
  44693. this._imageCache = new _primitives.RefSetCache();
  44694. }
  44695. getByName(name) {
  44696. if (this._onlyRefs) {
  44697. (0, _util.unreachable)("Should not call `getByName` method.");
  44698. }
  44699. const ref = this._nameRefMap.get(name);
  44700. if (ref) {
  44701. return this.getByRef(ref);
  44702. }
  44703. return this._imageMap.get(name) || null;
  44704. }
  44705. getByRef(ref) {
  44706. return this._imageCache.get(ref) || null;
  44707. }
  44708. set(name, ref, data) {
  44709. (0, _util.unreachable)("Abstract method `set` called.");
  44710. }
  44711. }
  44712. class LocalImageCache extends BaseLocalCache {
  44713. set(name, ref = null, data) {
  44714. if (typeof name !== "string") {
  44715. throw new Error('LocalImageCache.set - expected "name" argument.');
  44716. }
  44717. if (ref) {
  44718. if (this._imageCache.has(ref)) {
  44719. return;
  44720. }
  44721. this._nameRefMap.set(name, ref);
  44722. this._imageCache.put(ref, data);
  44723. return;
  44724. }
  44725. if (this._imageMap.has(name)) {
  44726. return;
  44727. }
  44728. this._imageMap.set(name, data);
  44729. }
  44730. }
  44731. exports.LocalImageCache = LocalImageCache;
  44732. class LocalColorSpaceCache extends BaseLocalCache {
  44733. set(name = null, ref = null, data) {
  44734. if (typeof name !== "string" && !ref) {
  44735. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  44736. }
  44737. if (ref) {
  44738. if (this._imageCache.has(ref)) {
  44739. return;
  44740. }
  44741. if (name !== null) {
  44742. this._nameRefMap.set(name, ref);
  44743. }
  44744. this._imageCache.put(ref, data);
  44745. return;
  44746. }
  44747. if (this._imageMap.has(name)) {
  44748. return;
  44749. }
  44750. this._imageMap.set(name, data);
  44751. }
  44752. }
  44753. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  44754. class LocalFunctionCache extends BaseLocalCache {
  44755. constructor(options) {
  44756. super({
  44757. onlyRefs: true
  44758. });
  44759. }
  44760. set(name = null, ref, data) {
  44761. if (!ref) {
  44762. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  44763. }
  44764. if (this._imageCache.has(ref)) {
  44765. return;
  44766. }
  44767. this._imageCache.put(ref, data);
  44768. }
  44769. }
  44770. exports.LocalFunctionCache = LocalFunctionCache;
  44771. class LocalGStateCache extends BaseLocalCache {
  44772. set(name, ref = null, data) {
  44773. if (typeof name !== "string") {
  44774. throw new Error('LocalGStateCache.set - expected "name" argument.');
  44775. }
  44776. if (ref) {
  44777. if (this._imageCache.has(ref)) {
  44778. return;
  44779. }
  44780. this._nameRefMap.set(name, ref);
  44781. this._imageCache.put(ref, data);
  44782. return;
  44783. }
  44784. if (this._imageMap.has(name)) {
  44785. return;
  44786. }
  44787. this._imageMap.set(name, data);
  44788. }
  44789. }
  44790. exports.LocalGStateCache = LocalGStateCache;
  44791. class LocalTilingPatternCache extends BaseLocalCache {
  44792. constructor(options) {
  44793. super({
  44794. onlyRefs: true
  44795. });
  44796. }
  44797. set(name = null, ref, data) {
  44798. if (!ref) {
  44799. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  44800. }
  44801. if (this._imageCache.has(ref)) {
  44802. return;
  44803. }
  44804. this._imageCache.put(ref, data);
  44805. }
  44806. }
  44807. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  44808. class GlobalImageCache {
  44809. static get NUM_PAGES_THRESHOLD() {
  44810. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  44811. }
  44812. static get MIN_IMAGES_TO_CACHE() {
  44813. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  44814. }
  44815. static get MAX_BYTE_SIZE() {
  44816. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  44817. }
  44818. constructor() {
  44819. this._refCache = new _primitives.RefSetCache();
  44820. this._imageCache = new _primitives.RefSetCache();
  44821. }
  44822. get _byteSize() {
  44823. let byteSize = 0;
  44824. for (const imageData of this._imageCache) {
  44825. byteSize += imageData.byteSize;
  44826. }
  44827. return byteSize;
  44828. }
  44829. get _cacheLimitReached() {
  44830. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  44831. return false;
  44832. }
  44833. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  44834. return false;
  44835. }
  44836. return true;
  44837. }
  44838. shouldCache(ref, pageIndex) {
  44839. const pageIndexSet = this._refCache.get(ref);
  44840. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  44841. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  44842. return false;
  44843. }
  44844. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  44845. return false;
  44846. }
  44847. return true;
  44848. }
  44849. addPageIndex(ref, pageIndex) {
  44850. let pageIndexSet = this._refCache.get(ref);
  44851. if (!pageIndexSet) {
  44852. pageIndexSet = new Set();
  44853. this._refCache.put(ref, pageIndexSet);
  44854. }
  44855. pageIndexSet.add(pageIndex);
  44856. }
  44857. addByteSize(ref, byteSize) {
  44858. const imageData = this._imageCache.get(ref);
  44859. if (!imageData) {
  44860. return;
  44861. }
  44862. if (imageData.byteSize) {
  44863. return;
  44864. }
  44865. imageData.byteSize = byteSize;
  44866. }
  44867. getData(ref, pageIndex) {
  44868. const pageIndexSet = this._refCache.get(ref);
  44869. if (!pageIndexSet) {
  44870. return null;
  44871. }
  44872. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  44873. return null;
  44874. }
  44875. const imageData = this._imageCache.get(ref);
  44876. if (!imageData) {
  44877. return null;
  44878. }
  44879. pageIndexSet.add(pageIndex);
  44880. return imageData;
  44881. }
  44882. setData(ref, data) {
  44883. if (!this._refCache.has(ref)) {
  44884. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  44885. }
  44886. if (this._imageCache.has(ref)) {
  44887. return;
  44888. }
  44889. if (this._cacheLimitReached) {
  44890. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  44891. return;
  44892. }
  44893. this._imageCache.put(ref, data);
  44894. }
  44895. clear(onlyData = false) {
  44896. if (!onlyData) {
  44897. this._refCache.clear();
  44898. }
  44899. this._imageCache.clear();
  44900. }
  44901. }
  44902. exports.GlobalImageCache = GlobalImageCache;
  44903. /***/ }),
  44904. /* 60 */
  44905. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44906. Object.defineProperty(exports, "__esModule", ({
  44907. value: true
  44908. }));
  44909. exports.bidi = bidi;
  44910. var _util = __w_pdfjs_require__(2);
  44911. 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"];
  44912. 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"];
  44913. function isOdd(i) {
  44914. return (i & 1) !== 0;
  44915. }
  44916. function isEven(i) {
  44917. return (i & 1) === 0;
  44918. }
  44919. function findUnequal(arr, start, value) {
  44920. let j, jj;
  44921. for (j = start, jj = arr.length; j < jj; ++j) {
  44922. if (arr[j] !== value) {
  44923. return j;
  44924. }
  44925. }
  44926. return j;
  44927. }
  44928. function setValues(arr, start, end, value) {
  44929. for (let j = start; j < end; ++j) {
  44930. arr[j] = value;
  44931. }
  44932. }
  44933. function reverseValues(arr, start, end) {
  44934. for (let i = start, j = end - 1; i < j; ++i, --j) {
  44935. const temp = arr[i];
  44936. arr[i] = arr[j];
  44937. arr[j] = temp;
  44938. }
  44939. }
  44940. function createBidiText(str, isLTR, vertical = false) {
  44941. let dir = "ltr";
  44942. if (vertical) {
  44943. dir = "ttb";
  44944. } else if (!isLTR) {
  44945. dir = "rtl";
  44946. }
  44947. return {
  44948. str,
  44949. dir
  44950. };
  44951. }
  44952. const chars = [];
  44953. const types = [];
  44954. function bidi(str, startLevel = -1, vertical = false) {
  44955. let isLTR = true;
  44956. const strLength = str.length;
  44957. if (strLength === 0 || vertical) {
  44958. return createBidiText(str, isLTR, vertical);
  44959. }
  44960. chars.length = strLength;
  44961. types.length = strLength;
  44962. let numBidi = 0;
  44963. let i, ii;
  44964. for (i = 0; i < strLength; ++i) {
  44965. chars[i] = str.charAt(i);
  44966. const charCode = str.charCodeAt(i);
  44967. let charType = "L";
  44968. if (charCode <= 0x00ff) {
  44969. charType = baseTypes[charCode];
  44970. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  44971. charType = "R";
  44972. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  44973. charType = arabicTypes[charCode & 0xff];
  44974. if (!charType) {
  44975. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  44976. }
  44977. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  44978. charType = "AL";
  44979. }
  44980. if (charType === "R" || charType === "AL" || charType === "AN") {
  44981. numBidi++;
  44982. }
  44983. types[i] = charType;
  44984. }
  44985. if (numBidi === 0) {
  44986. isLTR = true;
  44987. return createBidiText(str, isLTR);
  44988. }
  44989. if (startLevel === -1) {
  44990. if (numBidi / strLength < 0.3 && strLength > 4) {
  44991. isLTR = true;
  44992. startLevel = 0;
  44993. } else {
  44994. isLTR = false;
  44995. startLevel = 1;
  44996. }
  44997. }
  44998. const levels = [];
  44999. for (i = 0; i < strLength; ++i) {
  45000. levels[i] = startLevel;
  45001. }
  45002. const e = isOdd(startLevel) ? "R" : "L";
  45003. const sor = e;
  45004. const eor = sor;
  45005. let lastType = sor;
  45006. for (i = 0; i < strLength; ++i) {
  45007. if (types[i] === "NSM") {
  45008. types[i] = lastType;
  45009. } else {
  45010. lastType = types[i];
  45011. }
  45012. }
  45013. lastType = sor;
  45014. let t;
  45015. for (i = 0; i < strLength; ++i) {
  45016. t = types[i];
  45017. if (t === "EN") {
  45018. types[i] = lastType === "AL" ? "AN" : "EN";
  45019. } else if (t === "R" || t === "L" || t === "AL") {
  45020. lastType = t;
  45021. }
  45022. }
  45023. for (i = 0; i < strLength; ++i) {
  45024. t = types[i];
  45025. if (t === "AL") {
  45026. types[i] = "R";
  45027. }
  45028. }
  45029. for (i = 1; i < strLength - 1; ++i) {
  45030. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  45031. types[i] = "EN";
  45032. }
  45033. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  45034. types[i] = types[i - 1];
  45035. }
  45036. }
  45037. for (i = 0; i < strLength; ++i) {
  45038. if (types[i] === "EN") {
  45039. for (let j = i - 1; j >= 0; --j) {
  45040. if (types[j] !== "ET") {
  45041. break;
  45042. }
  45043. types[j] = "EN";
  45044. }
  45045. for (let j = i + 1; j < strLength; ++j) {
  45046. if (types[j] !== "ET") {
  45047. break;
  45048. }
  45049. types[j] = "EN";
  45050. }
  45051. }
  45052. }
  45053. for (i = 0; i < strLength; ++i) {
  45054. t = types[i];
  45055. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  45056. types[i] = "ON";
  45057. }
  45058. }
  45059. lastType = sor;
  45060. for (i = 0; i < strLength; ++i) {
  45061. t = types[i];
  45062. if (t === "EN") {
  45063. types[i] = lastType === "L" ? "L" : "EN";
  45064. } else if (t === "R" || t === "L") {
  45065. lastType = t;
  45066. }
  45067. }
  45068. for (i = 0; i < strLength; ++i) {
  45069. if (types[i] === "ON") {
  45070. const end = findUnequal(types, i + 1, "ON");
  45071. let before = sor;
  45072. if (i > 0) {
  45073. before = types[i - 1];
  45074. }
  45075. let after = eor;
  45076. if (end + 1 < strLength) {
  45077. after = types[end + 1];
  45078. }
  45079. if (before !== "L") {
  45080. before = "R";
  45081. }
  45082. if (after !== "L") {
  45083. after = "R";
  45084. }
  45085. if (before === after) {
  45086. setValues(types, i, end, before);
  45087. }
  45088. i = end - 1;
  45089. }
  45090. }
  45091. for (i = 0; i < strLength; ++i) {
  45092. if (types[i] === "ON") {
  45093. types[i] = e;
  45094. }
  45095. }
  45096. for (i = 0; i < strLength; ++i) {
  45097. t = types[i];
  45098. if (isEven(levels[i])) {
  45099. if (t === "R") {
  45100. levels[i] += 1;
  45101. } else if (t === "AN" || t === "EN") {
  45102. levels[i] += 2;
  45103. }
  45104. } else {
  45105. if (t === "L" || t === "AN" || t === "EN") {
  45106. levels[i] += 1;
  45107. }
  45108. }
  45109. }
  45110. let highestLevel = -1;
  45111. let lowestOddLevel = 99;
  45112. let level;
  45113. for (i = 0, ii = levels.length; i < ii; ++i) {
  45114. level = levels[i];
  45115. if (highestLevel < level) {
  45116. highestLevel = level;
  45117. }
  45118. if (lowestOddLevel > level && isOdd(level)) {
  45119. lowestOddLevel = level;
  45120. }
  45121. }
  45122. for (level = highestLevel; level >= lowestOddLevel; --level) {
  45123. let start = -1;
  45124. for (i = 0, ii = levels.length; i < ii; ++i) {
  45125. if (levels[i] < level) {
  45126. if (start >= 0) {
  45127. reverseValues(chars, start, i);
  45128. start = -1;
  45129. }
  45130. } else if (start < 0) {
  45131. start = i;
  45132. }
  45133. }
  45134. if (start >= 0) {
  45135. reverseValues(chars, start, levels.length);
  45136. }
  45137. }
  45138. for (i = 0, ii = chars.length; i < ii; ++i) {
  45139. const ch = chars[i];
  45140. if (ch === "<" || ch === ">") {
  45141. chars[i] = "";
  45142. }
  45143. }
  45144. return createBidiText(chars.join(""), isLTR);
  45145. }
  45146. /***/ }),
  45147. /* 61 */
  45148. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45149. Object.defineProperty(exports, "__esModule", ({
  45150. value: true
  45151. }));
  45152. exports.MurmurHash3_64 = void 0;
  45153. var _util = __w_pdfjs_require__(2);
  45154. const SEED = 0xc3d2e1f0;
  45155. const MASK_HIGH = 0xffff0000;
  45156. const MASK_LOW = 0xffff;
  45157. class MurmurHash3_64 {
  45158. constructor(seed) {
  45159. this.h1 = seed ? seed & 0xffffffff : SEED;
  45160. this.h2 = seed ? seed & 0xffffffff : SEED;
  45161. }
  45162. update(input) {
  45163. let data, length;
  45164. if (typeof input === "string") {
  45165. data = new Uint8Array(input.length * 2);
  45166. length = 0;
  45167. for (let i = 0, ii = input.length; i < ii; i++) {
  45168. const code = input.charCodeAt(i);
  45169. if (code <= 0xff) {
  45170. data[length++] = code;
  45171. } else {
  45172. data[length++] = code >>> 8;
  45173. data[length++] = code & 0xff;
  45174. }
  45175. }
  45176. } else if ((0, _util.isArrayBuffer)(input)) {
  45177. data = input.slice();
  45178. length = data.byteLength;
  45179. } else {
  45180. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  45181. }
  45182. const blockCounts = length >> 2;
  45183. const tailLength = length - blockCounts * 4;
  45184. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  45185. let k1 = 0,
  45186. k2 = 0;
  45187. let h1 = this.h1,
  45188. h2 = this.h2;
  45189. const C1 = 0xcc9e2d51,
  45190. C2 = 0x1b873593;
  45191. const C1_LOW = C1 & MASK_LOW,
  45192. C2_LOW = C2 & MASK_LOW;
  45193. for (let i = 0; i < blockCounts; i++) {
  45194. if (i & 1) {
  45195. k1 = dataUint32[i];
  45196. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45197. k1 = k1 << 15 | k1 >>> 17;
  45198. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45199. h1 ^= k1;
  45200. h1 = h1 << 13 | h1 >>> 19;
  45201. h1 = h1 * 5 + 0xe6546b64;
  45202. } else {
  45203. k2 = dataUint32[i];
  45204. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  45205. k2 = k2 << 15 | k2 >>> 17;
  45206. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  45207. h2 ^= k2;
  45208. h2 = h2 << 13 | h2 >>> 19;
  45209. h2 = h2 * 5 + 0xe6546b64;
  45210. }
  45211. }
  45212. k1 = 0;
  45213. switch (tailLength) {
  45214. case 3:
  45215. k1 ^= data[blockCounts * 4 + 2] << 16;
  45216. case 2:
  45217. k1 ^= data[blockCounts * 4 + 1] << 8;
  45218. case 1:
  45219. k1 ^= data[blockCounts * 4];
  45220. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45221. k1 = k1 << 15 | k1 >>> 17;
  45222. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45223. if (blockCounts & 1) {
  45224. h1 ^= k1;
  45225. } else {
  45226. h2 ^= k1;
  45227. }
  45228. }
  45229. this.h1 = h1;
  45230. this.h2 = h2;
  45231. }
  45232. hexdigest() {
  45233. let h1 = this.h1,
  45234. h2 = this.h2;
  45235. h1 ^= h2 >>> 1;
  45236. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  45237. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  45238. h1 ^= h2 >>> 1;
  45239. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  45240. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  45241. h1 ^= h2 >>> 1;
  45242. const hex1 = (h1 >>> 0).toString(16),
  45243. hex2 = (h2 >>> 0).toString(16);
  45244. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  45245. }
  45246. }
  45247. exports.MurmurHash3_64 = MurmurHash3_64;
  45248. /***/ }),
  45249. /* 62 */
  45250. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45251. Object.defineProperty(exports, "__esModule", ({
  45252. value: true
  45253. }));
  45254. exports.OperatorList = void 0;
  45255. var _util = __w_pdfjs_require__(2);
  45256. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  45257. let state = parentState;
  45258. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  45259. const item = pattern[i];
  45260. state = state[item] || (state[item] = []);
  45261. }
  45262. state[pattern[pattern.length - 1]] = {
  45263. checkFn,
  45264. iterateFn,
  45265. processFn
  45266. };
  45267. }
  45268. const InitialState = [];
  45269. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  45270. const fnArray = context.fnArray;
  45271. const iFirstSave = context.iCurr - 3;
  45272. const pos = (i - iFirstSave) % 4;
  45273. switch (pos) {
  45274. case 0:
  45275. return fnArray[i] === _util.OPS.save;
  45276. case 1:
  45277. return fnArray[i] === _util.OPS.transform;
  45278. case 2:
  45279. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  45280. case 3:
  45281. return fnArray[i] === _util.OPS.restore;
  45282. }
  45283. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  45284. }, function foundInlineImageGroup(context, i) {
  45285. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  45286. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  45287. const MAX_WIDTH = 1000;
  45288. const IMAGE_PADDING = 1;
  45289. const fnArray = context.fnArray,
  45290. argsArray = context.argsArray;
  45291. const curr = context.iCurr;
  45292. const iFirstSave = curr - 3;
  45293. const iFirstTransform = curr - 2;
  45294. const iFirstPIIXO = curr - 1;
  45295. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  45296. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  45297. return i - (i - iFirstSave) % 4;
  45298. }
  45299. let maxX = 0;
  45300. const map = [];
  45301. let maxLineHeight = 0;
  45302. let currentX = IMAGE_PADDING,
  45303. currentY = IMAGE_PADDING;
  45304. for (let q = 0; q < count; q++) {
  45305. const transform = argsArray[iFirstTransform + (q << 2)];
  45306. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  45307. if (currentX + img.width > MAX_WIDTH) {
  45308. maxX = Math.max(maxX, currentX);
  45309. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  45310. currentX = 0;
  45311. maxLineHeight = 0;
  45312. }
  45313. map.push({
  45314. transform,
  45315. x: currentX,
  45316. y: currentY,
  45317. w: img.width,
  45318. h: img.height
  45319. });
  45320. currentX += img.width + 2 * IMAGE_PADDING;
  45321. maxLineHeight = Math.max(maxLineHeight, img.height);
  45322. }
  45323. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  45324. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  45325. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  45326. const imgRowSize = imgWidth << 2;
  45327. for (let q = 0; q < count; q++) {
  45328. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  45329. const rowSize = map[q].w << 2;
  45330. let dataOffset = 0;
  45331. let offset = map[q].x + map[q].y * imgWidth << 2;
  45332. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  45333. for (let k = 0, kk = map[q].h; k < kk; k++) {
  45334. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  45335. dataOffset += rowSize;
  45336. offset += imgRowSize;
  45337. }
  45338. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  45339. while (offset >= 0) {
  45340. data[offset - 4] = data[offset];
  45341. data[offset - 3] = data[offset + 1];
  45342. data[offset - 2] = data[offset + 2];
  45343. data[offset - 1] = data[offset + 3];
  45344. data[offset + rowSize] = data[offset + rowSize - 4];
  45345. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  45346. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  45347. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  45348. offset -= imgRowSize;
  45349. }
  45350. }
  45351. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  45352. argsArray.splice(iFirstSave, count * 4, [{
  45353. width: imgWidth,
  45354. height: imgHeight,
  45355. kind: _util.ImageKind.RGBA_32BPP,
  45356. data: imgData
  45357. }, map]);
  45358. return iFirstSave + 1;
  45359. });
  45360. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  45361. const fnArray = context.fnArray;
  45362. const iFirstSave = context.iCurr - 3;
  45363. const pos = (i - iFirstSave) % 4;
  45364. switch (pos) {
  45365. case 0:
  45366. return fnArray[i] === _util.OPS.save;
  45367. case 1:
  45368. return fnArray[i] === _util.OPS.transform;
  45369. case 2:
  45370. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  45371. case 3:
  45372. return fnArray[i] === _util.OPS.restore;
  45373. }
  45374. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  45375. }, function foundImageMaskGroup(context, i) {
  45376. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  45377. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  45378. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  45379. const fnArray = context.fnArray,
  45380. argsArray = context.argsArray;
  45381. const curr = context.iCurr;
  45382. const iFirstSave = curr - 3;
  45383. const iFirstTransform = curr - 2;
  45384. const iFirstPIMXO = curr - 1;
  45385. let count = Math.floor((i - iFirstSave) / 4);
  45386. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  45387. return i - (i - iFirstSave) % 4;
  45388. }
  45389. let isSameImage = false;
  45390. let iTransform, transformArgs;
  45391. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  45392. const firstTransformArg0 = argsArray[iFirstTransform][0],
  45393. firstTransformArg1 = argsArray[iFirstTransform][1],
  45394. firstTransformArg2 = argsArray[iFirstTransform][2],
  45395. firstTransformArg3 = argsArray[iFirstTransform][3];
  45396. if (firstTransformArg1 === firstTransformArg2) {
  45397. isSameImage = true;
  45398. iTransform = iFirstTransform + 4;
  45399. let iPIMXO = iFirstPIMXO + 4;
  45400. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  45401. transformArgs = argsArray[iTransform];
  45402. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  45403. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  45404. isSameImage = false;
  45405. } else {
  45406. count = q;
  45407. }
  45408. break;
  45409. }
  45410. }
  45411. }
  45412. if (isSameImage) {
  45413. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  45414. const positions = new Float32Array(count * 2);
  45415. iTransform = iFirstTransform;
  45416. for (let q = 0; q < count; q++, iTransform += 4) {
  45417. transformArgs = argsArray[iTransform];
  45418. positions[q << 1] = transformArgs[4];
  45419. positions[(q << 1) + 1] = transformArgs[5];
  45420. }
  45421. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  45422. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  45423. } else {
  45424. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  45425. const images = [];
  45426. for (let q = 0; q < count; q++) {
  45427. transformArgs = argsArray[iFirstTransform + (q << 2)];
  45428. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  45429. images.push({
  45430. data: maskParams.data,
  45431. width: maskParams.width,
  45432. height: maskParams.height,
  45433. interpolate: maskParams.interpolate,
  45434. count: maskParams.count,
  45435. transform: transformArgs
  45436. });
  45437. }
  45438. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  45439. argsArray.splice(iFirstSave, count * 4, [images]);
  45440. }
  45441. return iFirstSave + 1;
  45442. });
  45443. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  45444. const argsArray = context.argsArray;
  45445. const iFirstTransform = context.iCurr - 2;
  45446. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  45447. }, function iterateImageGroup(context, i) {
  45448. const fnArray = context.fnArray,
  45449. argsArray = context.argsArray;
  45450. const iFirstSave = context.iCurr - 3;
  45451. const pos = (i - iFirstSave) % 4;
  45452. switch (pos) {
  45453. case 0:
  45454. return fnArray[i] === _util.OPS.save;
  45455. case 1:
  45456. if (fnArray[i] !== _util.OPS.transform) {
  45457. return false;
  45458. }
  45459. const iFirstTransform = context.iCurr - 2;
  45460. const firstTransformArg0 = argsArray[iFirstTransform][0];
  45461. const firstTransformArg3 = argsArray[iFirstTransform][3];
  45462. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  45463. return false;
  45464. }
  45465. return true;
  45466. case 2:
  45467. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  45468. return false;
  45469. }
  45470. const iFirstPIXO = context.iCurr - 1;
  45471. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45472. if (argsArray[i][0] !== firstPIXOArg0) {
  45473. return false;
  45474. }
  45475. return true;
  45476. case 3:
  45477. return fnArray[i] === _util.OPS.restore;
  45478. }
  45479. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  45480. }, function (context, i) {
  45481. const MIN_IMAGES_IN_BLOCK = 3;
  45482. const MAX_IMAGES_IN_BLOCK = 1000;
  45483. const fnArray = context.fnArray,
  45484. argsArray = context.argsArray;
  45485. const curr = context.iCurr;
  45486. const iFirstSave = curr - 3;
  45487. const iFirstTransform = curr - 2;
  45488. const iFirstPIXO = curr - 1;
  45489. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45490. const firstTransformArg0 = argsArray[iFirstTransform][0];
  45491. const firstTransformArg3 = argsArray[iFirstTransform][3];
  45492. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  45493. if (count < MIN_IMAGES_IN_BLOCK) {
  45494. return i - (i - iFirstSave) % 4;
  45495. }
  45496. const positions = new Float32Array(count * 2);
  45497. let iTransform = iFirstTransform;
  45498. for (let q = 0; q < count; q++, iTransform += 4) {
  45499. const transformArgs = argsArray[iTransform];
  45500. positions[q << 1] = transformArgs[4];
  45501. positions[(q << 1) + 1] = transformArgs[5];
  45502. }
  45503. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  45504. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  45505. argsArray.splice(iFirstSave, count * 4, args);
  45506. return iFirstSave + 1;
  45507. });
  45508. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  45509. const fnArray = context.fnArray,
  45510. argsArray = context.argsArray;
  45511. const iFirstSave = context.iCurr - 4;
  45512. const pos = (i - iFirstSave) % 5;
  45513. switch (pos) {
  45514. case 0:
  45515. return fnArray[i] === _util.OPS.beginText;
  45516. case 1:
  45517. return fnArray[i] === _util.OPS.setFont;
  45518. case 2:
  45519. return fnArray[i] === _util.OPS.setTextMatrix;
  45520. case 3:
  45521. if (fnArray[i] !== _util.OPS.showText) {
  45522. return false;
  45523. }
  45524. const iFirstSetFont = context.iCurr - 3;
  45525. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45526. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45527. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  45528. return false;
  45529. }
  45530. return true;
  45531. case 4:
  45532. return fnArray[i] === _util.OPS.endText;
  45533. }
  45534. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  45535. }, function (context, i) {
  45536. const MIN_CHARS_IN_BLOCK = 3;
  45537. const MAX_CHARS_IN_BLOCK = 1000;
  45538. const fnArray = context.fnArray,
  45539. argsArray = context.argsArray;
  45540. const curr = context.iCurr;
  45541. const iFirstBeginText = curr - 4;
  45542. const iFirstSetFont = curr - 3;
  45543. const iFirstSetTextMatrix = curr - 2;
  45544. const iFirstShowText = curr - 1;
  45545. const iFirstEndText = curr;
  45546. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45547. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45548. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  45549. if (count < MIN_CHARS_IN_BLOCK) {
  45550. return i - (i - iFirstBeginText) % 5;
  45551. }
  45552. let iFirst = iFirstBeginText;
  45553. 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) {
  45554. count++;
  45555. iFirst -= 5;
  45556. }
  45557. let iEndText = iFirst + 4;
  45558. for (let q = 1; q < count; q++) {
  45559. fnArray.splice(iEndText, 3);
  45560. argsArray.splice(iEndText, 3);
  45561. iEndText += 2;
  45562. }
  45563. return iEndText + 1;
  45564. });
  45565. class NullOptimizer {
  45566. constructor(queue) {
  45567. this.queue = queue;
  45568. }
  45569. _optimize() {}
  45570. push(fn, args) {
  45571. this.queue.fnArray.push(fn);
  45572. this.queue.argsArray.push(args);
  45573. this._optimize();
  45574. }
  45575. flush() {}
  45576. reset() {}
  45577. }
  45578. class QueueOptimizer extends NullOptimizer {
  45579. constructor(queue) {
  45580. super(queue);
  45581. this.state = null;
  45582. this.context = {
  45583. iCurr: 0,
  45584. fnArray: queue.fnArray,
  45585. argsArray: queue.argsArray
  45586. };
  45587. this.match = null;
  45588. this.lastProcessed = 0;
  45589. }
  45590. _optimize() {
  45591. const fnArray = this.queue.fnArray;
  45592. let i = this.lastProcessed,
  45593. ii = fnArray.length;
  45594. let state = this.state;
  45595. let match = this.match;
  45596. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  45597. this.lastProcessed = ii;
  45598. return;
  45599. }
  45600. const context = this.context;
  45601. while (i < ii) {
  45602. if (match) {
  45603. const iterate = (0, match.iterateFn)(context, i);
  45604. if (iterate) {
  45605. i++;
  45606. continue;
  45607. }
  45608. i = (0, match.processFn)(context, i + 1);
  45609. ii = fnArray.length;
  45610. match = null;
  45611. state = null;
  45612. if (i >= ii) {
  45613. break;
  45614. }
  45615. }
  45616. state = (state || InitialState)[fnArray[i]];
  45617. if (!state || Array.isArray(state)) {
  45618. i++;
  45619. continue;
  45620. }
  45621. context.iCurr = i;
  45622. i++;
  45623. if (state.checkFn && !(0, state.checkFn)(context)) {
  45624. state = null;
  45625. continue;
  45626. }
  45627. match = state;
  45628. state = null;
  45629. }
  45630. this.state = state;
  45631. this.match = match;
  45632. this.lastProcessed = i;
  45633. }
  45634. flush() {
  45635. while (this.match) {
  45636. const length = this.queue.fnArray.length;
  45637. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  45638. this.match = null;
  45639. this.state = null;
  45640. this._optimize();
  45641. }
  45642. }
  45643. reset() {
  45644. this.state = null;
  45645. this.match = null;
  45646. this.lastProcessed = 0;
  45647. }
  45648. }
  45649. class OperatorList {
  45650. static get CHUNK_SIZE() {
  45651. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  45652. }
  45653. static get CHUNK_SIZE_ABOUT() {
  45654. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  45655. }
  45656. constructor(intent = 0, streamSink) {
  45657. this._streamSink = streamSink;
  45658. this.fnArray = [];
  45659. this.argsArray = [];
  45660. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  45661. this.optimizer = new QueueOptimizer(this);
  45662. } else {
  45663. this.optimizer = new NullOptimizer(this);
  45664. }
  45665. this.dependencies = new Set();
  45666. this._totalLength = 0;
  45667. this.weight = 0;
  45668. this._resolved = streamSink ? null : Promise.resolve();
  45669. }
  45670. get length() {
  45671. return this.argsArray.length;
  45672. }
  45673. get ready() {
  45674. return this._resolved || this._streamSink.ready;
  45675. }
  45676. get totalLength() {
  45677. return this._totalLength + this.length;
  45678. }
  45679. addOp(fn, args) {
  45680. this.optimizer.push(fn, args);
  45681. this.weight++;
  45682. if (this._streamSink) {
  45683. if (this.weight >= OperatorList.CHUNK_SIZE) {
  45684. this.flush();
  45685. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  45686. this.flush();
  45687. }
  45688. }
  45689. }
  45690. addImageOps(fn, args, optionalContent) {
  45691. if (optionalContent !== undefined) {
  45692. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  45693. }
  45694. this.addOp(fn, args);
  45695. if (optionalContent !== undefined) {
  45696. this.addOp(_util.OPS.endMarkedContent, []);
  45697. }
  45698. }
  45699. addDependency(dependency) {
  45700. if (this.dependencies.has(dependency)) {
  45701. return;
  45702. }
  45703. this.dependencies.add(dependency);
  45704. this.addOp(_util.OPS.dependency, [dependency]);
  45705. }
  45706. addDependencies(dependencies) {
  45707. for (const dependency of dependencies) {
  45708. this.addDependency(dependency);
  45709. }
  45710. }
  45711. addOpList(opList) {
  45712. if (!(opList instanceof OperatorList)) {
  45713. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  45714. return;
  45715. }
  45716. for (const dependency of opList.dependencies) {
  45717. this.dependencies.add(dependency);
  45718. }
  45719. for (let i = 0, ii = opList.length; i < ii; i++) {
  45720. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  45721. }
  45722. }
  45723. getIR() {
  45724. return {
  45725. fnArray: this.fnArray,
  45726. argsArray: this.argsArray,
  45727. length: this.length
  45728. };
  45729. }
  45730. get _transfers() {
  45731. const transfers = [];
  45732. const {
  45733. fnArray,
  45734. argsArray,
  45735. length
  45736. } = this;
  45737. for (let i = 0; i < length; i++) {
  45738. switch (fnArray[i]) {
  45739. case _util.OPS.paintInlineImageXObject:
  45740. case _util.OPS.paintInlineImageXObjectGroup:
  45741. case _util.OPS.paintImageMaskXObject:
  45742. const arg = argsArray[i][0];
  45743. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  45744. transfers.push(arg.data.buffer);
  45745. }
  45746. break;
  45747. }
  45748. }
  45749. return transfers;
  45750. }
  45751. flush(lastChunk = false) {
  45752. this.optimizer.flush();
  45753. const length = this.length;
  45754. this._totalLength += length;
  45755. this._streamSink.enqueue({
  45756. fnArray: this.fnArray,
  45757. argsArray: this.argsArray,
  45758. lastChunk,
  45759. length
  45760. }, 1, this._transfers);
  45761. this.dependencies.clear();
  45762. this.fnArray.length = 0;
  45763. this.argsArray.length = 0;
  45764. this.weight = 0;
  45765. this.optimizer.reset();
  45766. }
  45767. }
  45768. exports.OperatorList = OperatorList;
  45769. /***/ }),
  45770. /* 63 */
  45771. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45772. Object.defineProperty(exports, "__esModule", ({
  45773. value: true
  45774. }));
  45775. exports.PDFImage = void 0;
  45776. var _util = __w_pdfjs_require__(2);
  45777. var _image_utils = __w_pdfjs_require__(64);
  45778. var _base_stream = __w_pdfjs_require__(9);
  45779. var _colorspace = __w_pdfjs_require__(24);
  45780. var _decode_stream = __w_pdfjs_require__(29);
  45781. var _jpeg_stream = __w_pdfjs_require__(37);
  45782. var _jpx = __w_pdfjs_require__(40);
  45783. var _primitives = __w_pdfjs_require__(5);
  45784. function decodeAndClamp(value, addend, coefficient, max) {
  45785. value = addend + value * coefficient;
  45786. if (value < 0) {
  45787. value = 0;
  45788. } else if (value > max) {
  45789. value = max;
  45790. }
  45791. return value;
  45792. }
  45793. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  45794. const length = w2 * h2;
  45795. let dest;
  45796. if (bpc <= 8) {
  45797. dest = new Uint8Array(length);
  45798. } else if (bpc <= 16) {
  45799. dest = new Uint16Array(length);
  45800. } else {
  45801. dest = new Uint32Array(length);
  45802. }
  45803. const xRatio = w1 / w2;
  45804. const yRatio = h1 / h2;
  45805. let i,
  45806. j,
  45807. py,
  45808. newIndex = 0,
  45809. oldIndex;
  45810. const xScaled = new Uint16Array(w2);
  45811. const w1Scanline = w1;
  45812. for (i = 0; i < w2; i++) {
  45813. xScaled[i] = Math.floor(i * xRatio);
  45814. }
  45815. for (i = 0; i < h2; i++) {
  45816. py = Math.floor(i * yRatio) * w1Scanline;
  45817. for (j = 0; j < w2; j++) {
  45818. oldIndex = py + xScaled[j];
  45819. dest[newIndex++] = src[oldIndex];
  45820. }
  45821. }
  45822. return dest;
  45823. }
  45824. class PDFImage {
  45825. constructor({
  45826. xref,
  45827. res,
  45828. image,
  45829. isInline = false,
  45830. smask = null,
  45831. mask = null,
  45832. isMask = false,
  45833. pdfFunctionFactory,
  45834. localColorSpaceCache
  45835. }) {
  45836. this.image = image;
  45837. const dict = image.dict;
  45838. const filter = dict.get("F", "Filter");
  45839. if (filter instanceof _primitives.Name) {
  45840. switch (filter.name) {
  45841. case "JPXDecode":
  45842. const jpxImage = new _jpx.JpxImage();
  45843. jpxImage.parseImageProperties(image.stream);
  45844. image.stream.reset();
  45845. image.width = jpxImage.width;
  45846. image.height = jpxImage.height;
  45847. image.bitsPerComponent = jpxImage.bitsPerComponent;
  45848. image.numComps = jpxImage.componentsCount;
  45849. break;
  45850. case "JBIG2Decode":
  45851. image.bitsPerComponent = 1;
  45852. image.numComps = 1;
  45853. break;
  45854. }
  45855. }
  45856. let width = dict.get("W", "Width");
  45857. let height = dict.get("H", "Height");
  45858. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  45859. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  45860. width = image.width;
  45861. height = image.height;
  45862. }
  45863. if (width < 1 || height < 1) {
  45864. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  45865. }
  45866. this.width = width;
  45867. this.height = height;
  45868. this.interpolate = dict.get("I", "Interpolate");
  45869. this.imageMask = dict.get("IM", "ImageMask") || false;
  45870. this.matte = dict.get("Matte") || false;
  45871. let bitsPerComponent = image.bitsPerComponent;
  45872. if (!bitsPerComponent) {
  45873. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  45874. if (!bitsPerComponent) {
  45875. if (this.imageMask) {
  45876. bitsPerComponent = 1;
  45877. } else {
  45878. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  45879. }
  45880. }
  45881. }
  45882. this.bpc = bitsPerComponent;
  45883. if (!this.imageMask) {
  45884. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  45885. if (!colorSpace) {
  45886. (0, _util.info)("JPX images (which do not require color spaces)");
  45887. switch (image.numComps) {
  45888. case 1:
  45889. colorSpace = _primitives.Name.get("DeviceGray");
  45890. break;
  45891. case 3:
  45892. colorSpace = _primitives.Name.get("DeviceRGB");
  45893. break;
  45894. case 4:
  45895. colorSpace = _primitives.Name.get("DeviceCMYK");
  45896. break;
  45897. default:
  45898. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  45899. }
  45900. }
  45901. this.colorSpace = _colorspace.ColorSpace.parse({
  45902. cs: colorSpace,
  45903. xref,
  45904. resources: isInline ? res : null,
  45905. pdfFunctionFactory,
  45906. localColorSpaceCache
  45907. });
  45908. this.numComps = this.colorSpace.numComps;
  45909. }
  45910. this.decode = dict.getArray("D", "Decode");
  45911. this.needsDecode = false;
  45912. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  45913. this.needsDecode = true;
  45914. const max = (1 << bitsPerComponent) - 1;
  45915. this.decodeCoefficients = [];
  45916. this.decodeAddends = [];
  45917. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  45918. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  45919. const dmin = this.decode[i];
  45920. const dmax = this.decode[i + 1];
  45921. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  45922. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  45923. }
  45924. }
  45925. if (smask) {
  45926. this.smask = new PDFImage({
  45927. xref,
  45928. res,
  45929. image: smask,
  45930. isInline,
  45931. pdfFunctionFactory,
  45932. localColorSpaceCache
  45933. });
  45934. } else if (mask) {
  45935. if (mask instanceof _base_stream.BaseStream) {
  45936. const maskDict = mask.dict,
  45937. imageMask = maskDict.get("IM", "ImageMask");
  45938. if (!imageMask) {
  45939. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  45940. } else {
  45941. this.mask = new PDFImage({
  45942. xref,
  45943. res,
  45944. image: mask,
  45945. isInline,
  45946. isMask: true,
  45947. pdfFunctionFactory,
  45948. localColorSpaceCache
  45949. });
  45950. }
  45951. } else {
  45952. this.mask = mask;
  45953. }
  45954. }
  45955. }
  45956. static async buildImage({
  45957. xref,
  45958. res,
  45959. image,
  45960. isInline = false,
  45961. pdfFunctionFactory,
  45962. localColorSpaceCache
  45963. }) {
  45964. const imageData = image;
  45965. let smaskData = null;
  45966. let maskData = null;
  45967. const smask = image.dict.get("SMask");
  45968. const mask = image.dict.get("Mask");
  45969. if (smask) {
  45970. if (smask instanceof _base_stream.BaseStream) {
  45971. smaskData = smask;
  45972. } else {
  45973. (0, _util.warn)("Unsupported /SMask format.");
  45974. }
  45975. } else if (mask) {
  45976. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  45977. maskData = mask;
  45978. } else {
  45979. (0, _util.warn)("Unsupported /Mask format.");
  45980. }
  45981. }
  45982. return new PDFImage({
  45983. xref,
  45984. res,
  45985. image: imageData,
  45986. isInline,
  45987. smask: smaskData,
  45988. mask: maskData,
  45989. pdfFunctionFactory,
  45990. localColorSpaceCache
  45991. });
  45992. }
  45993. static createRawMask({
  45994. imgArray,
  45995. width,
  45996. height,
  45997. imageIsFromDecodeStream,
  45998. inverseDecode,
  45999. interpolate
  46000. }) {
  46001. const computedLength = (width + 7 >> 3) * height;
  46002. const actualLength = imgArray.byteLength;
  46003. const haveFullData = computedLength === actualLength;
  46004. let data, i;
  46005. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  46006. data = imgArray;
  46007. } else if (!inverseDecode) {
  46008. data = new Uint8Array(imgArray);
  46009. } else {
  46010. data = new Uint8Array(computedLength);
  46011. data.set(imgArray);
  46012. data.fill(0xff, actualLength);
  46013. }
  46014. if (inverseDecode) {
  46015. for (i = 0; i < actualLength; i++) {
  46016. data[i] ^= 0xff;
  46017. }
  46018. }
  46019. return {
  46020. data,
  46021. width,
  46022. height,
  46023. interpolate
  46024. };
  46025. }
  46026. static createMask({
  46027. imgArray,
  46028. width,
  46029. height,
  46030. imageIsFromDecodeStream,
  46031. inverseDecode,
  46032. interpolate
  46033. }) {
  46034. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  46035. if (isSingleOpaquePixel) {
  46036. return {
  46037. isSingleOpaquePixel
  46038. };
  46039. }
  46040. if (_util.FeatureTest.isOffscreenCanvasSupported) {
  46041. const canvas = new OffscreenCanvas(width, height);
  46042. const ctx = canvas.getContext("2d");
  46043. const imgData = ctx.createImageData(width, height);
  46044. (0, _image_utils.applyMaskImageData)({
  46045. src: imgArray,
  46046. dest: imgData.data,
  46047. width,
  46048. height,
  46049. inverseDecode
  46050. });
  46051. ctx.putImageData(imgData, 0, 0);
  46052. const bitmap = canvas.transferToImageBitmap();
  46053. return {
  46054. data: null,
  46055. width,
  46056. height,
  46057. interpolate,
  46058. bitmap
  46059. };
  46060. }
  46061. return this.createRawMask({
  46062. imgArray,
  46063. width,
  46064. height,
  46065. inverseDecode,
  46066. imageIsFromDecodeStream,
  46067. interpolate
  46068. });
  46069. }
  46070. get drawWidth() {
  46071. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  46072. }
  46073. get drawHeight() {
  46074. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  46075. }
  46076. decodeBuffer(buffer) {
  46077. const bpc = this.bpc;
  46078. const numComps = this.numComps;
  46079. const decodeAddends = this.decodeAddends;
  46080. const decodeCoefficients = this.decodeCoefficients;
  46081. const max = (1 << bpc) - 1;
  46082. let i, ii;
  46083. if (bpc === 1) {
  46084. for (i = 0, ii = buffer.length; i < ii; i++) {
  46085. buffer[i] = +!buffer[i];
  46086. }
  46087. return;
  46088. }
  46089. let index = 0;
  46090. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  46091. for (let j = 0; j < numComps; j++) {
  46092. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  46093. index++;
  46094. }
  46095. }
  46096. }
  46097. getComponents(buffer) {
  46098. const bpc = this.bpc;
  46099. if (bpc === 8) {
  46100. return buffer;
  46101. }
  46102. const width = this.width;
  46103. const height = this.height;
  46104. const numComps = this.numComps;
  46105. const length = width * height * numComps;
  46106. let bufferPos = 0;
  46107. let output;
  46108. if (bpc <= 8) {
  46109. output = new Uint8Array(length);
  46110. } else if (bpc <= 16) {
  46111. output = new Uint16Array(length);
  46112. } else {
  46113. output = new Uint32Array(length);
  46114. }
  46115. const rowComps = width * numComps;
  46116. const max = (1 << bpc) - 1;
  46117. let i = 0,
  46118. ii,
  46119. buf;
  46120. if (bpc === 1) {
  46121. let mask, loop1End, loop2End;
  46122. for (let j = 0; j < height; j++) {
  46123. loop1End = i + (rowComps & ~7);
  46124. loop2End = i + rowComps;
  46125. while (i < loop1End) {
  46126. buf = buffer[bufferPos++];
  46127. output[i] = buf >> 7 & 1;
  46128. output[i + 1] = buf >> 6 & 1;
  46129. output[i + 2] = buf >> 5 & 1;
  46130. output[i + 3] = buf >> 4 & 1;
  46131. output[i + 4] = buf >> 3 & 1;
  46132. output[i + 5] = buf >> 2 & 1;
  46133. output[i + 6] = buf >> 1 & 1;
  46134. output[i + 7] = buf & 1;
  46135. i += 8;
  46136. }
  46137. if (i < loop2End) {
  46138. buf = buffer[bufferPos++];
  46139. mask = 128;
  46140. while (i < loop2End) {
  46141. output[i++] = +!!(buf & mask);
  46142. mask >>= 1;
  46143. }
  46144. }
  46145. }
  46146. } else {
  46147. let bits = 0;
  46148. buf = 0;
  46149. for (i = 0, ii = length; i < ii; ++i) {
  46150. if (i % rowComps === 0) {
  46151. buf = 0;
  46152. bits = 0;
  46153. }
  46154. while (bits < bpc) {
  46155. buf = buf << 8 | buffer[bufferPos++];
  46156. bits += 8;
  46157. }
  46158. const remainingBits = bits - bpc;
  46159. let value = buf >> remainingBits;
  46160. if (value < 0) {
  46161. value = 0;
  46162. } else if (value > max) {
  46163. value = max;
  46164. }
  46165. output[i] = value;
  46166. buf &= (1 << remainingBits) - 1;
  46167. bits = remainingBits;
  46168. }
  46169. }
  46170. return output;
  46171. }
  46172. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  46173. const smask = this.smask;
  46174. const mask = this.mask;
  46175. let alphaBuf, sw, sh, i, ii, j;
  46176. if (smask) {
  46177. sw = smask.width;
  46178. sh = smask.height;
  46179. alphaBuf = new Uint8ClampedArray(sw * sh);
  46180. smask.fillGrayBuffer(alphaBuf);
  46181. if (sw !== width || sh !== height) {
  46182. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  46183. }
  46184. } else if (mask) {
  46185. if (mask instanceof PDFImage) {
  46186. sw = mask.width;
  46187. sh = mask.height;
  46188. alphaBuf = new Uint8ClampedArray(sw * sh);
  46189. mask.numComps = 1;
  46190. mask.fillGrayBuffer(alphaBuf);
  46191. for (i = 0, ii = sw * sh; i < ii; ++i) {
  46192. alphaBuf[i] = 255 - alphaBuf[i];
  46193. }
  46194. if (sw !== width || sh !== height) {
  46195. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  46196. }
  46197. } else if (Array.isArray(mask)) {
  46198. alphaBuf = new Uint8ClampedArray(width * height);
  46199. const numComps = this.numComps;
  46200. for (i = 0, ii = width * height; i < ii; ++i) {
  46201. let opacity = 0;
  46202. const imageOffset = i * numComps;
  46203. for (j = 0; j < numComps; ++j) {
  46204. const color = image[imageOffset + j];
  46205. const maskOffset = j * 2;
  46206. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  46207. opacity = 255;
  46208. break;
  46209. }
  46210. }
  46211. alphaBuf[i] = opacity;
  46212. }
  46213. } else {
  46214. throw new _util.FormatError("Unknown mask format.");
  46215. }
  46216. }
  46217. if (alphaBuf) {
  46218. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46219. rgbaBuf[j] = alphaBuf[i];
  46220. }
  46221. } else {
  46222. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46223. rgbaBuf[j] = 255;
  46224. }
  46225. }
  46226. }
  46227. undoPreblend(buffer, width, height) {
  46228. const matte = this.smask && this.smask.matte;
  46229. if (!matte) {
  46230. return;
  46231. }
  46232. const matteRgb = this.colorSpace.getRgb(matte, 0);
  46233. const matteR = matteRgb[0];
  46234. const matteG = matteRgb[1];
  46235. const matteB = matteRgb[2];
  46236. const length = width * height * 4;
  46237. for (let i = 0; i < length; i += 4) {
  46238. const alpha = buffer[i + 3];
  46239. if (alpha === 0) {
  46240. buffer[i] = 255;
  46241. buffer[i + 1] = 255;
  46242. buffer[i + 2] = 255;
  46243. continue;
  46244. }
  46245. const k = 255 / alpha;
  46246. buffer[i] = (buffer[i] - matteR) * k + matteR;
  46247. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  46248. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  46249. }
  46250. }
  46251. createImageData(forceRGBA = false) {
  46252. const drawWidth = this.drawWidth;
  46253. const drawHeight = this.drawHeight;
  46254. const imgData = {
  46255. width: drawWidth,
  46256. height: drawHeight,
  46257. interpolate: this.interpolate,
  46258. kind: 0,
  46259. data: null
  46260. };
  46261. const numComps = this.numComps;
  46262. const originalWidth = this.width;
  46263. const originalHeight = this.height;
  46264. const bpc = this.bpc;
  46265. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  46266. if (!forceRGBA) {
  46267. let kind;
  46268. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  46269. kind = _util.ImageKind.GRAYSCALE_1BPP;
  46270. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  46271. kind = _util.ImageKind.RGB_24BPP;
  46272. }
  46273. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  46274. imgData.kind = kind;
  46275. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  46276. if (this.needsDecode) {
  46277. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  46278. const buffer = imgData.data;
  46279. for (let i = 0, ii = buffer.length; i < ii; i++) {
  46280. buffer[i] ^= 0xff;
  46281. }
  46282. }
  46283. return imgData;
  46284. }
  46285. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  46286. let imageLength = originalHeight * rowBytes;
  46287. switch (this.colorSpace.name) {
  46288. case "DeviceGray":
  46289. imageLength *= 3;
  46290. case "DeviceRGB":
  46291. case "DeviceCMYK":
  46292. imgData.kind = _util.ImageKind.RGB_24BPP;
  46293. imgData.data = this.getImageBytes(imageLength, {
  46294. drawWidth,
  46295. drawHeight,
  46296. forceRGB: true
  46297. });
  46298. return imgData;
  46299. }
  46300. }
  46301. }
  46302. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  46303. internal: true
  46304. });
  46305. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  46306. const comps = this.getComponents(imgArray);
  46307. let alpha01, maybeUndoPreblend;
  46308. if (!forceRGBA && !this.smask && !this.mask) {
  46309. imgData.kind = _util.ImageKind.RGB_24BPP;
  46310. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  46311. alpha01 = 0;
  46312. maybeUndoPreblend = false;
  46313. } else {
  46314. imgData.kind = _util.ImageKind.RGBA_32BPP;
  46315. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  46316. alpha01 = 1;
  46317. maybeUndoPreblend = true;
  46318. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  46319. }
  46320. if (this.needsDecode) {
  46321. this.decodeBuffer(comps);
  46322. }
  46323. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  46324. if (maybeUndoPreblend) {
  46325. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  46326. }
  46327. return imgData;
  46328. }
  46329. fillGrayBuffer(buffer) {
  46330. const numComps = this.numComps;
  46331. if (numComps !== 1) {
  46332. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  46333. }
  46334. const width = this.width;
  46335. const height = this.height;
  46336. const bpc = this.bpc;
  46337. const rowBytes = width * numComps * bpc + 7 >> 3;
  46338. const imgArray = this.getImageBytes(height * rowBytes, {
  46339. internal: true
  46340. });
  46341. const comps = this.getComponents(imgArray);
  46342. let i, length;
  46343. if (bpc === 1) {
  46344. length = width * height;
  46345. if (this.needsDecode) {
  46346. for (i = 0; i < length; ++i) {
  46347. buffer[i] = comps[i] - 1 & 255;
  46348. }
  46349. } else {
  46350. for (i = 0; i < length; ++i) {
  46351. buffer[i] = -comps[i] & 255;
  46352. }
  46353. }
  46354. return;
  46355. }
  46356. if (this.needsDecode) {
  46357. this.decodeBuffer(comps);
  46358. }
  46359. length = width * height;
  46360. const scale = 255 / ((1 << bpc) - 1);
  46361. for (i = 0; i < length; ++i) {
  46362. buffer[i] = scale * comps[i];
  46363. }
  46364. }
  46365. getImageBytes(length, {
  46366. drawWidth,
  46367. drawHeight,
  46368. forceRGB = false,
  46369. internal = false
  46370. }) {
  46371. this.image.reset();
  46372. this.image.drawWidth = drawWidth || this.width;
  46373. this.image.drawHeight = drawHeight || this.height;
  46374. this.image.forceRGB = !!forceRGB;
  46375. const imageBytes = this.image.getBytes(length);
  46376. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  46377. return imageBytes;
  46378. }
  46379. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  46380. return new Uint8Array(imageBytes);
  46381. }
  46382. }
  46383. exports.PDFImage = PDFImage;
  46384. /***/ }),
  46385. /* 64 */
  46386. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46387. Object.defineProperty(exports, "__esModule", ({
  46388. value: true
  46389. }));
  46390. exports.applyMaskImageData = applyMaskImageData;
  46391. var _util = __w_pdfjs_require__(2);
  46392. function applyMaskImageData({
  46393. src,
  46394. srcPos = 0,
  46395. dest,
  46396. destPos = 0,
  46397. width,
  46398. height,
  46399. inverseDecode = false
  46400. }) {
  46401. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  46402. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  46403. const widthInSource = width >> 3;
  46404. const widthRemainder = width & 7;
  46405. const srcLength = src.length;
  46406. dest = new Uint32Array(dest.buffer);
  46407. for (let i = 0; i < height; i++) {
  46408. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  46409. const elem = srcPos < srcLength ? src[srcPos] : 255;
  46410. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  46411. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  46412. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  46413. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  46414. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  46415. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  46416. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  46417. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  46418. }
  46419. if (widthRemainder === 0) {
  46420. continue;
  46421. }
  46422. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  46423. for (let j = 0; j < widthRemainder; j++) {
  46424. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  46425. }
  46426. }
  46427. return {
  46428. srcPos,
  46429. destPos
  46430. };
  46431. }
  46432. /***/ }),
  46433. /* 65 */
  46434. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46435. Object.defineProperty(exports, "__esModule", ({
  46436. value: true
  46437. }));
  46438. exports.Catalog = void 0;
  46439. var _core_utils = __w_pdfjs_require__(8);
  46440. var _util = __w_pdfjs_require__(2);
  46441. var _primitives = __w_pdfjs_require__(5);
  46442. var _name_number_tree = __w_pdfjs_require__(66);
  46443. var _base_stream = __w_pdfjs_require__(9);
  46444. var _cleanup_helper = __w_pdfjs_require__(67);
  46445. var _colorspace = __w_pdfjs_require__(24);
  46446. var _file_spec = __w_pdfjs_require__(68);
  46447. var _image_utils = __w_pdfjs_require__(59);
  46448. var _metadata_parser = __w_pdfjs_require__(69);
  46449. var _struct_tree = __w_pdfjs_require__(71);
  46450. function fetchDestination(dest) {
  46451. if (dest instanceof _primitives.Dict) {
  46452. dest = dest.get("D");
  46453. }
  46454. return Array.isArray(dest) ? dest : null;
  46455. }
  46456. class Catalog {
  46457. constructor(pdfManager, xref) {
  46458. this.pdfManager = pdfManager;
  46459. this.xref = xref;
  46460. this._catDict = xref.getCatalogObj();
  46461. if (!(this._catDict instanceof _primitives.Dict)) {
  46462. throw new _util.FormatError("Catalog object is not a dictionary.");
  46463. }
  46464. this.toplevelPagesDict;
  46465. this._actualNumPages = null;
  46466. this.fontCache = new _primitives.RefSetCache();
  46467. this.builtInCMapCache = new Map();
  46468. this.standardFontDataCache = new Map();
  46469. this.globalImageCache = new _image_utils.GlobalImageCache();
  46470. this.pageKidsCountCache = new _primitives.RefSetCache();
  46471. this.pageIndexCache = new _primitives.RefSetCache();
  46472. this.nonBlendModesSet = new _primitives.RefSet();
  46473. }
  46474. get version() {
  46475. const version = this._catDict.get("Version");
  46476. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  46477. }
  46478. get lang() {
  46479. const lang = this._catDict.get("Lang");
  46480. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  46481. }
  46482. get needsRendering() {
  46483. const needsRendering = this._catDict.get("NeedsRendering");
  46484. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  46485. }
  46486. get collection() {
  46487. let collection = null;
  46488. try {
  46489. const obj = this._catDict.get("Collection");
  46490. if (obj instanceof _primitives.Dict && obj.size > 0) {
  46491. collection = obj;
  46492. }
  46493. } catch (ex) {
  46494. if (ex instanceof _core_utils.MissingDataException) {
  46495. throw ex;
  46496. }
  46497. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  46498. }
  46499. return (0, _util.shadow)(this, "collection", collection);
  46500. }
  46501. get acroForm() {
  46502. let acroForm = null;
  46503. try {
  46504. const obj = this._catDict.get("AcroForm");
  46505. if (obj instanceof _primitives.Dict && obj.size > 0) {
  46506. acroForm = obj;
  46507. }
  46508. } catch (ex) {
  46509. if (ex instanceof _core_utils.MissingDataException) {
  46510. throw ex;
  46511. }
  46512. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  46513. }
  46514. return (0, _util.shadow)(this, "acroForm", acroForm);
  46515. }
  46516. get acroFormRef() {
  46517. const value = this._catDict.getRaw("AcroForm");
  46518. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  46519. }
  46520. get metadata() {
  46521. const streamRef = this._catDict.getRaw("Metadata");
  46522. if (!(streamRef instanceof _primitives.Ref)) {
  46523. return (0, _util.shadow)(this, "metadata", null);
  46524. }
  46525. let metadata = null;
  46526. try {
  46527. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  46528. const stream = this.xref.fetch(streamRef, suppressEncryption);
  46529. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  46530. const type = stream.dict.get("Type");
  46531. const subtype = stream.dict.get("Subtype");
  46532. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  46533. const data = (0, _util.stringToUTF8String)(stream.getString());
  46534. if (data) {
  46535. metadata = new _metadata_parser.MetadataParser(data).serializable;
  46536. }
  46537. }
  46538. }
  46539. } catch (ex) {
  46540. if (ex instanceof _core_utils.MissingDataException) {
  46541. throw ex;
  46542. }
  46543. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  46544. }
  46545. return (0, _util.shadow)(this, "metadata", metadata);
  46546. }
  46547. get markInfo() {
  46548. let markInfo = null;
  46549. try {
  46550. markInfo = this._readMarkInfo();
  46551. } catch (ex) {
  46552. if (ex instanceof _core_utils.MissingDataException) {
  46553. throw ex;
  46554. }
  46555. (0, _util.warn)("Unable to read mark info.");
  46556. }
  46557. return (0, _util.shadow)(this, "markInfo", markInfo);
  46558. }
  46559. _readMarkInfo() {
  46560. const obj = this._catDict.get("MarkInfo");
  46561. if (!(obj instanceof _primitives.Dict)) {
  46562. return null;
  46563. }
  46564. const markInfo = {
  46565. Marked: false,
  46566. UserProperties: false,
  46567. Suspects: false
  46568. };
  46569. for (const key in markInfo) {
  46570. const value = obj.get(key);
  46571. if (typeof value === "boolean") {
  46572. markInfo[key] = value;
  46573. }
  46574. }
  46575. return markInfo;
  46576. }
  46577. get structTreeRoot() {
  46578. let structTree = null;
  46579. try {
  46580. structTree = this._readStructTreeRoot();
  46581. } catch (ex) {
  46582. if (ex instanceof _core_utils.MissingDataException) {
  46583. throw ex;
  46584. }
  46585. (0, _util.warn)("Unable read to structTreeRoot info.");
  46586. }
  46587. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  46588. }
  46589. _readStructTreeRoot() {
  46590. const obj = this._catDict.get("StructTreeRoot");
  46591. if (!(obj instanceof _primitives.Dict)) {
  46592. return null;
  46593. }
  46594. const root = new _struct_tree.StructTreeRoot(obj);
  46595. root.init();
  46596. return root;
  46597. }
  46598. get toplevelPagesDict() {
  46599. const pagesObj = this._catDict.get("Pages");
  46600. if (!(pagesObj instanceof _primitives.Dict)) {
  46601. throw new _util.FormatError("Invalid top-level pages dictionary.");
  46602. }
  46603. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  46604. }
  46605. get documentOutline() {
  46606. let obj = null;
  46607. try {
  46608. obj = this._readDocumentOutline();
  46609. } catch (ex) {
  46610. if (ex instanceof _core_utils.MissingDataException) {
  46611. throw ex;
  46612. }
  46613. (0, _util.warn)("Unable to read document outline.");
  46614. }
  46615. return (0, _util.shadow)(this, "documentOutline", obj);
  46616. }
  46617. _readDocumentOutline() {
  46618. let obj = this._catDict.get("Outlines");
  46619. if (!(obj instanceof _primitives.Dict)) {
  46620. return null;
  46621. }
  46622. obj = obj.getRaw("First");
  46623. if (!(obj instanceof _primitives.Ref)) {
  46624. return null;
  46625. }
  46626. const root = {
  46627. items: []
  46628. };
  46629. const queue = [{
  46630. obj,
  46631. parent: root
  46632. }];
  46633. const processed = new _primitives.RefSet();
  46634. processed.put(obj);
  46635. const xref = this.xref,
  46636. blackColor = new Uint8ClampedArray(3);
  46637. while (queue.length > 0) {
  46638. const i = queue.shift();
  46639. const outlineDict = xref.fetchIfRef(i.obj);
  46640. if (outlineDict === null) {
  46641. continue;
  46642. }
  46643. if (!outlineDict.has("Title")) {
  46644. throw new _util.FormatError("Invalid outline item encountered.");
  46645. }
  46646. const data = {
  46647. url: null,
  46648. dest: null
  46649. };
  46650. Catalog.parseDestDictionary({
  46651. destDict: outlineDict,
  46652. resultObj: data,
  46653. docBaseUrl: this.pdfManager.docBaseUrl
  46654. });
  46655. const title = outlineDict.get("Title");
  46656. const flags = outlineDict.get("F") || 0;
  46657. const color = outlineDict.getArray("C");
  46658. const count = outlineDict.get("Count");
  46659. let rgbColor = blackColor;
  46660. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  46661. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  46662. }
  46663. const outlineItem = {
  46664. dest: data.dest,
  46665. url: data.url,
  46666. unsafeUrl: data.unsafeUrl,
  46667. newWindow: data.newWindow,
  46668. title: (0, _util.stringToPDFString)(title),
  46669. color: rgbColor,
  46670. count: Number.isInteger(count) ? count : undefined,
  46671. bold: !!(flags & 2),
  46672. italic: !!(flags & 1),
  46673. items: []
  46674. };
  46675. i.parent.items.push(outlineItem);
  46676. obj = outlineDict.getRaw("First");
  46677. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  46678. queue.push({
  46679. obj,
  46680. parent: outlineItem
  46681. });
  46682. processed.put(obj);
  46683. }
  46684. obj = outlineDict.getRaw("Next");
  46685. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  46686. queue.push({
  46687. obj,
  46688. parent: i.parent
  46689. });
  46690. processed.put(obj);
  46691. }
  46692. }
  46693. return root.items.length > 0 ? root.items : null;
  46694. }
  46695. get permissions() {
  46696. let permissions = null;
  46697. try {
  46698. permissions = this._readPermissions();
  46699. } catch (ex) {
  46700. if (ex instanceof _core_utils.MissingDataException) {
  46701. throw ex;
  46702. }
  46703. (0, _util.warn)("Unable to read permissions.");
  46704. }
  46705. return (0, _util.shadow)(this, "permissions", permissions);
  46706. }
  46707. _readPermissions() {
  46708. const encrypt = this.xref.trailer.get("Encrypt");
  46709. if (!(encrypt instanceof _primitives.Dict)) {
  46710. return null;
  46711. }
  46712. let flags = encrypt.get("P");
  46713. if (typeof flags !== "number") {
  46714. return null;
  46715. }
  46716. flags += 2 ** 32;
  46717. const permissions = [];
  46718. for (const key in _util.PermissionFlag) {
  46719. const value = _util.PermissionFlag[key];
  46720. if (flags & value) {
  46721. permissions.push(value);
  46722. }
  46723. }
  46724. return permissions;
  46725. }
  46726. get optionalContentConfig() {
  46727. let config = null;
  46728. try {
  46729. const properties = this._catDict.get("OCProperties");
  46730. if (!properties) {
  46731. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46732. }
  46733. const defaultConfig = properties.get("D");
  46734. if (!defaultConfig) {
  46735. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46736. }
  46737. const groupsData = properties.get("OCGs");
  46738. if (!Array.isArray(groupsData)) {
  46739. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46740. }
  46741. const groups = [];
  46742. const groupRefs = [];
  46743. for (const groupRef of groupsData) {
  46744. if (!(groupRef instanceof _primitives.Ref)) {
  46745. continue;
  46746. }
  46747. groupRefs.push(groupRef);
  46748. const group = this.xref.fetchIfRef(groupRef);
  46749. groups.push({
  46750. id: groupRef.toString(),
  46751. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  46752. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  46753. });
  46754. }
  46755. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  46756. config.groups = groups;
  46757. } catch (ex) {
  46758. if (ex instanceof _core_utils.MissingDataException) {
  46759. throw ex;
  46760. }
  46761. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  46762. }
  46763. return (0, _util.shadow)(this, "optionalContentConfig", config);
  46764. }
  46765. _readOptionalContentConfig(config, contentGroupRefs) {
  46766. function parseOnOff(refs) {
  46767. const onParsed = [];
  46768. if (Array.isArray(refs)) {
  46769. for (const value of refs) {
  46770. if (!(value instanceof _primitives.Ref)) {
  46771. continue;
  46772. }
  46773. if (contentGroupRefs.includes(value)) {
  46774. onParsed.push(value.toString());
  46775. }
  46776. }
  46777. }
  46778. return onParsed;
  46779. }
  46780. function parseOrder(refs, nestedLevels = 0) {
  46781. if (!Array.isArray(refs)) {
  46782. return null;
  46783. }
  46784. const order = [];
  46785. for (const value of refs) {
  46786. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  46787. parsedOrderRefs.put(value);
  46788. order.push(value.toString());
  46789. continue;
  46790. }
  46791. const nestedOrder = parseNestedOrder(value, nestedLevels);
  46792. if (nestedOrder) {
  46793. order.push(nestedOrder);
  46794. }
  46795. }
  46796. if (nestedLevels > 0) {
  46797. return order;
  46798. }
  46799. const hiddenGroups = [];
  46800. for (const groupRef of contentGroupRefs) {
  46801. if (parsedOrderRefs.has(groupRef)) {
  46802. continue;
  46803. }
  46804. hiddenGroups.push(groupRef.toString());
  46805. }
  46806. if (hiddenGroups.length) {
  46807. order.push({
  46808. name: null,
  46809. order: hiddenGroups
  46810. });
  46811. }
  46812. return order;
  46813. }
  46814. function parseNestedOrder(ref, nestedLevels) {
  46815. if (++nestedLevels > MAX_NESTED_LEVELS) {
  46816. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  46817. return null;
  46818. }
  46819. const value = xref.fetchIfRef(ref);
  46820. if (!Array.isArray(value)) {
  46821. return null;
  46822. }
  46823. const nestedName = xref.fetchIfRef(value[0]);
  46824. if (typeof nestedName !== "string") {
  46825. return null;
  46826. }
  46827. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  46828. if (!nestedOrder || !nestedOrder.length) {
  46829. return null;
  46830. }
  46831. return {
  46832. name: (0, _util.stringToPDFString)(nestedName),
  46833. order: nestedOrder
  46834. };
  46835. }
  46836. const xref = this.xref,
  46837. parsedOrderRefs = new _primitives.RefSet(),
  46838. MAX_NESTED_LEVELS = 10;
  46839. return {
  46840. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  46841. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  46842. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  46843. on: parseOnOff(config.get("ON")),
  46844. off: parseOnOff(config.get("OFF")),
  46845. order: parseOrder(config.get("Order")),
  46846. groups: null
  46847. };
  46848. }
  46849. setActualNumPages(num = null) {
  46850. this._actualNumPages = num;
  46851. }
  46852. get hasActualNumPages() {
  46853. return this._actualNumPages !== null;
  46854. }
  46855. get _pagesCount() {
  46856. const obj = this.toplevelPagesDict.get("Count");
  46857. if (!Number.isInteger(obj)) {
  46858. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  46859. }
  46860. return (0, _util.shadow)(this, "_pagesCount", obj);
  46861. }
  46862. get numPages() {
  46863. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  46864. }
  46865. get destinations() {
  46866. const obj = this._readDests(),
  46867. dests = Object.create(null);
  46868. if (obj instanceof _name_number_tree.NameTree) {
  46869. for (const [key, value] of obj.getAll()) {
  46870. const dest = fetchDestination(value);
  46871. if (dest) {
  46872. dests[(0, _util.stringToPDFString)(key)] = dest;
  46873. }
  46874. }
  46875. } else if (obj instanceof _primitives.Dict) {
  46876. obj.forEach(function (key, value) {
  46877. const dest = fetchDestination(value);
  46878. if (dest) {
  46879. dests[key] = dest;
  46880. }
  46881. });
  46882. }
  46883. return (0, _util.shadow)(this, "destinations", dests);
  46884. }
  46885. getDestination(id) {
  46886. const obj = this._readDests();
  46887. if (obj instanceof _name_number_tree.NameTree) {
  46888. const dest = fetchDestination(obj.get(id));
  46889. if (dest) {
  46890. return dest;
  46891. }
  46892. const allDest = this.destinations[id];
  46893. if (allDest) {
  46894. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  46895. return allDest;
  46896. }
  46897. } else if (obj instanceof _primitives.Dict) {
  46898. const dest = fetchDestination(obj.get(id));
  46899. if (dest) {
  46900. return dest;
  46901. }
  46902. }
  46903. return null;
  46904. }
  46905. _readDests() {
  46906. const obj = this._catDict.get("Names");
  46907. if (obj && obj.has("Dests")) {
  46908. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  46909. } else if (this._catDict.has("Dests")) {
  46910. return this._catDict.get("Dests");
  46911. }
  46912. return undefined;
  46913. }
  46914. get pageLabels() {
  46915. let obj = null;
  46916. try {
  46917. obj = this._readPageLabels();
  46918. } catch (ex) {
  46919. if (ex instanceof _core_utils.MissingDataException) {
  46920. throw ex;
  46921. }
  46922. (0, _util.warn)("Unable to read page labels.");
  46923. }
  46924. return (0, _util.shadow)(this, "pageLabels", obj);
  46925. }
  46926. _readPageLabels() {
  46927. const obj = this._catDict.getRaw("PageLabels");
  46928. if (!obj) {
  46929. return null;
  46930. }
  46931. const pageLabels = new Array(this.numPages);
  46932. let style = null,
  46933. prefix = "";
  46934. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  46935. const nums = numberTree.getAll();
  46936. let currentLabel = "",
  46937. currentIndex = 1;
  46938. for (let i = 0, ii = this.numPages; i < ii; i++) {
  46939. const labelDict = nums.get(i);
  46940. if (labelDict !== undefined) {
  46941. if (!(labelDict instanceof _primitives.Dict)) {
  46942. throw new _util.FormatError("PageLabel is not a dictionary.");
  46943. }
  46944. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  46945. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  46946. }
  46947. if (labelDict.has("S")) {
  46948. const s = labelDict.get("S");
  46949. if (!(s instanceof _primitives.Name)) {
  46950. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  46951. }
  46952. style = s.name;
  46953. } else {
  46954. style = null;
  46955. }
  46956. if (labelDict.has("P")) {
  46957. const p = labelDict.get("P");
  46958. if (typeof p !== "string") {
  46959. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  46960. }
  46961. prefix = (0, _util.stringToPDFString)(p);
  46962. } else {
  46963. prefix = "";
  46964. }
  46965. if (labelDict.has("St")) {
  46966. const st = labelDict.get("St");
  46967. if (!(Number.isInteger(st) && st >= 1)) {
  46968. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  46969. }
  46970. currentIndex = st;
  46971. } else {
  46972. currentIndex = 1;
  46973. }
  46974. }
  46975. switch (style) {
  46976. case "D":
  46977. currentLabel = currentIndex;
  46978. break;
  46979. case "R":
  46980. case "r":
  46981. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  46982. break;
  46983. case "A":
  46984. case "a":
  46985. const LIMIT = 26;
  46986. const A_UPPER_CASE = 0x41,
  46987. A_LOWER_CASE = 0x61;
  46988. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  46989. const letterIndex = currentIndex - 1;
  46990. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  46991. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  46992. break;
  46993. default:
  46994. if (style) {
  46995. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  46996. }
  46997. currentLabel = "";
  46998. }
  46999. pageLabels[i] = prefix + currentLabel;
  47000. currentIndex++;
  47001. }
  47002. return pageLabels;
  47003. }
  47004. get pageLayout() {
  47005. const obj = this._catDict.get("PageLayout");
  47006. let pageLayout = "";
  47007. if (obj instanceof _primitives.Name) {
  47008. switch (obj.name) {
  47009. case "SinglePage":
  47010. case "OneColumn":
  47011. case "TwoColumnLeft":
  47012. case "TwoColumnRight":
  47013. case "TwoPageLeft":
  47014. case "TwoPageRight":
  47015. pageLayout = obj.name;
  47016. }
  47017. }
  47018. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  47019. }
  47020. get pageMode() {
  47021. const obj = this._catDict.get("PageMode");
  47022. let pageMode = "UseNone";
  47023. if (obj instanceof _primitives.Name) {
  47024. switch (obj.name) {
  47025. case "UseNone":
  47026. case "UseOutlines":
  47027. case "UseThumbs":
  47028. case "FullScreen":
  47029. case "UseOC":
  47030. case "UseAttachments":
  47031. pageMode = obj.name;
  47032. }
  47033. }
  47034. return (0, _util.shadow)(this, "pageMode", pageMode);
  47035. }
  47036. get viewerPreferences() {
  47037. const obj = this._catDict.get("ViewerPreferences");
  47038. if (!(obj instanceof _primitives.Dict)) {
  47039. return (0, _util.shadow)(this, "viewerPreferences", null);
  47040. }
  47041. let prefs = null;
  47042. for (const key of obj.getKeys()) {
  47043. const value = obj.get(key);
  47044. let prefValue;
  47045. switch (key) {
  47046. case "HideToolbar":
  47047. case "HideMenubar":
  47048. case "HideWindowUI":
  47049. case "FitWindow":
  47050. case "CenterWindow":
  47051. case "DisplayDocTitle":
  47052. case "PickTrayByPDFSize":
  47053. if (typeof value === "boolean") {
  47054. prefValue = value;
  47055. }
  47056. break;
  47057. case "NonFullScreenPageMode":
  47058. if (value instanceof _primitives.Name) {
  47059. switch (value.name) {
  47060. case "UseNone":
  47061. case "UseOutlines":
  47062. case "UseThumbs":
  47063. case "UseOC":
  47064. prefValue = value.name;
  47065. break;
  47066. default:
  47067. prefValue = "UseNone";
  47068. }
  47069. }
  47070. break;
  47071. case "Direction":
  47072. if (value instanceof _primitives.Name) {
  47073. switch (value.name) {
  47074. case "L2R":
  47075. case "R2L":
  47076. prefValue = value.name;
  47077. break;
  47078. default:
  47079. prefValue = "L2R";
  47080. }
  47081. }
  47082. break;
  47083. case "ViewArea":
  47084. case "ViewClip":
  47085. case "PrintArea":
  47086. case "PrintClip":
  47087. if (value instanceof _primitives.Name) {
  47088. switch (value.name) {
  47089. case "MediaBox":
  47090. case "CropBox":
  47091. case "BleedBox":
  47092. case "TrimBox":
  47093. case "ArtBox":
  47094. prefValue = value.name;
  47095. break;
  47096. default:
  47097. prefValue = "CropBox";
  47098. }
  47099. }
  47100. break;
  47101. case "PrintScaling":
  47102. if (value instanceof _primitives.Name) {
  47103. switch (value.name) {
  47104. case "None":
  47105. case "AppDefault":
  47106. prefValue = value.name;
  47107. break;
  47108. default:
  47109. prefValue = "AppDefault";
  47110. }
  47111. }
  47112. break;
  47113. case "Duplex":
  47114. if (value instanceof _primitives.Name) {
  47115. switch (value.name) {
  47116. case "Simplex":
  47117. case "DuplexFlipShortEdge":
  47118. case "DuplexFlipLongEdge":
  47119. prefValue = value.name;
  47120. break;
  47121. default:
  47122. prefValue = "None";
  47123. }
  47124. }
  47125. break;
  47126. case "PrintPageRange":
  47127. if (Array.isArray(value) && value.length % 2 === 0) {
  47128. const isValid = value.every((page, i, arr) => {
  47129. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  47130. });
  47131. if (isValid) {
  47132. prefValue = value;
  47133. }
  47134. }
  47135. break;
  47136. case "NumCopies":
  47137. if (Number.isInteger(value) && value > 0) {
  47138. prefValue = value;
  47139. }
  47140. break;
  47141. default:
  47142. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  47143. continue;
  47144. }
  47145. if (prefValue === undefined) {
  47146. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  47147. continue;
  47148. }
  47149. if (!prefs) {
  47150. prefs = Object.create(null);
  47151. }
  47152. prefs[key] = prefValue;
  47153. }
  47154. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  47155. }
  47156. get openAction() {
  47157. const obj = this._catDict.get("OpenAction");
  47158. const openAction = Object.create(null);
  47159. if (obj instanceof _primitives.Dict) {
  47160. const destDict = new _primitives.Dict(this.xref);
  47161. destDict.set("A", obj);
  47162. const resultObj = {
  47163. url: null,
  47164. dest: null,
  47165. action: null
  47166. };
  47167. Catalog.parseDestDictionary({
  47168. destDict,
  47169. resultObj
  47170. });
  47171. if (Array.isArray(resultObj.dest)) {
  47172. openAction.dest = resultObj.dest;
  47173. } else if (resultObj.action) {
  47174. openAction.action = resultObj.action;
  47175. }
  47176. } else if (Array.isArray(obj)) {
  47177. openAction.dest = obj;
  47178. }
  47179. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  47180. }
  47181. get attachments() {
  47182. const obj = this._catDict.get("Names");
  47183. let attachments = null;
  47184. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  47185. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  47186. for (const [key, value] of nameTree.getAll()) {
  47187. const fs = new _file_spec.FileSpec(value, this.xref);
  47188. if (!attachments) {
  47189. attachments = Object.create(null);
  47190. }
  47191. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  47192. }
  47193. }
  47194. return (0, _util.shadow)(this, "attachments", attachments);
  47195. }
  47196. get xfaImages() {
  47197. const obj = this._catDict.get("Names");
  47198. let xfaImages = null;
  47199. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  47200. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  47201. for (const [key, value] of nameTree.getAll()) {
  47202. if (!xfaImages) {
  47203. xfaImages = new _primitives.Dict(this.xref);
  47204. }
  47205. xfaImages.set((0, _util.stringToPDFString)(key), value);
  47206. }
  47207. }
  47208. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  47209. }
  47210. _collectJavaScript() {
  47211. const obj = this._catDict.get("Names");
  47212. let javaScript = null;
  47213. function appendIfJavaScriptDict(name, jsDict) {
  47214. if (!(jsDict instanceof _primitives.Dict)) {
  47215. return;
  47216. }
  47217. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  47218. return;
  47219. }
  47220. let js = jsDict.get("JS");
  47221. if (js instanceof _base_stream.BaseStream) {
  47222. js = js.getString();
  47223. } else if (typeof js !== "string") {
  47224. return;
  47225. }
  47226. if (javaScript === null) {
  47227. javaScript = new Map();
  47228. }
  47229. javaScript.set(name, (0, _util.stringToPDFString)(js));
  47230. }
  47231. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  47232. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  47233. for (const [key, value] of nameTree.getAll()) {
  47234. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  47235. }
  47236. }
  47237. const openAction = this._catDict.get("OpenAction");
  47238. if (openAction) {
  47239. appendIfJavaScriptDict("OpenAction", openAction);
  47240. }
  47241. return javaScript;
  47242. }
  47243. get javaScript() {
  47244. const javaScript = this._collectJavaScript();
  47245. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  47246. }
  47247. get jsActions() {
  47248. const javaScript = this._collectJavaScript();
  47249. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  47250. if (javaScript) {
  47251. if (!actions) {
  47252. actions = Object.create(null);
  47253. }
  47254. for (const [key, val] of javaScript) {
  47255. if (key in actions) {
  47256. actions[key].push(val);
  47257. } else {
  47258. actions[key] = [val];
  47259. }
  47260. }
  47261. }
  47262. return (0, _util.shadow)(this, "jsActions", actions);
  47263. }
  47264. async fontFallback(id, handler) {
  47265. const translatedFonts = await Promise.all(this.fontCache);
  47266. for (const translatedFont of translatedFonts) {
  47267. if (translatedFont.loadedName === id) {
  47268. translatedFont.fallback(handler);
  47269. return;
  47270. }
  47271. }
  47272. }
  47273. async cleanup(manuallyTriggered = false) {
  47274. (0, _cleanup_helper.clearGlobalCaches)();
  47275. this.globalImageCache.clear(manuallyTriggered);
  47276. this.pageKidsCountCache.clear();
  47277. this.pageIndexCache.clear();
  47278. this.nonBlendModesSet.clear();
  47279. const translatedFonts = await Promise.all(this.fontCache);
  47280. for (const {
  47281. dict
  47282. } of translatedFonts) {
  47283. delete dict.cacheKey;
  47284. }
  47285. this.fontCache.clear();
  47286. this.builtInCMapCache.clear();
  47287. this.standardFontDataCache.clear();
  47288. }
  47289. async getPageDict(pageIndex) {
  47290. const nodesToVisit = [this.toplevelPagesDict];
  47291. const visitedNodes = new _primitives.RefSet();
  47292. const pagesRef = this._catDict.getRaw("Pages");
  47293. if (pagesRef instanceof _primitives.Ref) {
  47294. visitedNodes.put(pagesRef);
  47295. }
  47296. const xref = this.xref,
  47297. pageKidsCountCache = this.pageKidsCountCache,
  47298. pageIndexCache = this.pageIndexCache;
  47299. let currentPageIndex = 0;
  47300. while (nodesToVisit.length) {
  47301. const currentNode = nodesToVisit.pop();
  47302. if (currentNode instanceof _primitives.Ref) {
  47303. const count = pageKidsCountCache.get(currentNode);
  47304. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  47305. currentPageIndex += count;
  47306. continue;
  47307. }
  47308. if (visitedNodes.has(currentNode)) {
  47309. throw new _util.FormatError("Pages tree contains circular reference.");
  47310. }
  47311. visitedNodes.put(currentNode);
  47312. const obj = await xref.fetchAsync(currentNode);
  47313. if (obj instanceof _primitives.Dict) {
  47314. let type = obj.getRaw("Type");
  47315. if (type instanceof _primitives.Ref) {
  47316. type = await xref.fetchAsync(type);
  47317. }
  47318. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  47319. if (!pageKidsCountCache.has(currentNode)) {
  47320. pageKidsCountCache.put(currentNode, 1);
  47321. }
  47322. if (!pageIndexCache.has(currentNode)) {
  47323. pageIndexCache.put(currentNode, currentPageIndex);
  47324. }
  47325. if (currentPageIndex === pageIndex) {
  47326. return [obj, currentNode];
  47327. }
  47328. currentPageIndex++;
  47329. continue;
  47330. }
  47331. }
  47332. nodesToVisit.push(obj);
  47333. continue;
  47334. }
  47335. if (!(currentNode instanceof _primitives.Dict)) {
  47336. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  47337. }
  47338. const {
  47339. objId
  47340. } = currentNode;
  47341. let count = currentNode.getRaw("Count");
  47342. if (count instanceof _primitives.Ref) {
  47343. count = await xref.fetchAsync(count);
  47344. }
  47345. if (Number.isInteger(count) && count >= 0) {
  47346. if (objId && !pageKidsCountCache.has(objId)) {
  47347. pageKidsCountCache.put(objId, count);
  47348. }
  47349. if (currentPageIndex + count <= pageIndex) {
  47350. currentPageIndex += count;
  47351. continue;
  47352. }
  47353. }
  47354. let kids = currentNode.getRaw("Kids");
  47355. if (kids instanceof _primitives.Ref) {
  47356. kids = await xref.fetchAsync(kids);
  47357. }
  47358. if (!Array.isArray(kids)) {
  47359. let type = currentNode.getRaw("Type");
  47360. if (type instanceof _primitives.Ref) {
  47361. type = await xref.fetchAsync(type);
  47362. }
  47363. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  47364. if (currentPageIndex === pageIndex) {
  47365. return [currentNode, null];
  47366. }
  47367. currentPageIndex++;
  47368. continue;
  47369. }
  47370. throw new _util.FormatError("Page dictionary kids object is not an array.");
  47371. }
  47372. for (let last = kids.length - 1; last >= 0; last--) {
  47373. nodesToVisit.push(kids[last]);
  47374. }
  47375. }
  47376. throw new Error(`Page index ${pageIndex} not found.`);
  47377. }
  47378. async getAllPageDicts(recoveryMode = false) {
  47379. const queue = [{
  47380. currentNode: this.toplevelPagesDict,
  47381. posInKids: 0
  47382. }];
  47383. const visitedNodes = new _primitives.RefSet();
  47384. const pagesRef = this._catDict.getRaw("Pages");
  47385. if (pagesRef instanceof _primitives.Ref) {
  47386. visitedNodes.put(pagesRef);
  47387. }
  47388. const map = new Map(),
  47389. xref = this.xref,
  47390. pageIndexCache = this.pageIndexCache;
  47391. let pageIndex = 0;
  47392. function addPageDict(pageDict, pageRef) {
  47393. if (pageRef && !pageIndexCache.has(pageRef)) {
  47394. pageIndexCache.put(pageRef, pageIndex);
  47395. }
  47396. map.set(pageIndex++, [pageDict, pageRef]);
  47397. }
  47398. function addPageError(error) {
  47399. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  47400. throw error;
  47401. }
  47402. map.set(pageIndex++, [error, null]);
  47403. }
  47404. while (queue.length > 0) {
  47405. const queueItem = queue[queue.length - 1];
  47406. const {
  47407. currentNode,
  47408. posInKids
  47409. } = queueItem;
  47410. let kids = currentNode.getRaw("Kids");
  47411. if (kids instanceof _primitives.Ref) {
  47412. try {
  47413. kids = await xref.fetchAsync(kids);
  47414. } catch (ex) {
  47415. addPageError(ex);
  47416. break;
  47417. }
  47418. }
  47419. if (!Array.isArray(kids)) {
  47420. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  47421. break;
  47422. }
  47423. if (posInKids >= kids.length) {
  47424. queue.pop();
  47425. continue;
  47426. }
  47427. const kidObj = kids[posInKids];
  47428. let obj;
  47429. if (kidObj instanceof _primitives.Ref) {
  47430. if (visitedNodes.has(kidObj)) {
  47431. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  47432. break;
  47433. }
  47434. visitedNodes.put(kidObj);
  47435. try {
  47436. obj = await xref.fetchAsync(kidObj);
  47437. } catch (ex) {
  47438. addPageError(ex);
  47439. break;
  47440. }
  47441. } else {
  47442. obj = kidObj;
  47443. }
  47444. if (!(obj instanceof _primitives.Dict)) {
  47445. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  47446. break;
  47447. }
  47448. let type = obj.getRaw("Type");
  47449. if (type instanceof _primitives.Ref) {
  47450. try {
  47451. type = await xref.fetchAsync(type);
  47452. } catch (ex) {
  47453. addPageError(ex);
  47454. break;
  47455. }
  47456. }
  47457. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  47458. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  47459. } else {
  47460. queue.push({
  47461. currentNode: obj,
  47462. posInKids: 0
  47463. });
  47464. }
  47465. queueItem.posInKids++;
  47466. }
  47467. return map;
  47468. }
  47469. getPageIndex(pageRef) {
  47470. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  47471. if (cachedPageIndex !== undefined) {
  47472. return Promise.resolve(cachedPageIndex);
  47473. }
  47474. const xref = this.xref;
  47475. function pagesBeforeRef(kidRef) {
  47476. let total = 0,
  47477. parentRef;
  47478. return xref.fetchAsync(kidRef).then(function (node) {
  47479. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  47480. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  47481. }
  47482. if (!node) {
  47483. return null;
  47484. }
  47485. if (!(node instanceof _primitives.Dict)) {
  47486. throw new _util.FormatError("Node must be a dictionary.");
  47487. }
  47488. parentRef = node.getRaw("Parent");
  47489. return node.getAsync("Parent");
  47490. }).then(function (parent) {
  47491. if (!parent) {
  47492. return null;
  47493. }
  47494. if (!(parent instanceof _primitives.Dict)) {
  47495. throw new _util.FormatError("Parent must be a dictionary.");
  47496. }
  47497. return parent.getAsync("Kids");
  47498. }).then(function (kids) {
  47499. if (!kids) {
  47500. return null;
  47501. }
  47502. const kidPromises = [];
  47503. let found = false;
  47504. for (let i = 0, ii = kids.length; i < ii; i++) {
  47505. const kid = kids[i];
  47506. if (!(kid instanceof _primitives.Ref)) {
  47507. throw new _util.FormatError("Kid must be a reference.");
  47508. }
  47509. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  47510. found = true;
  47511. break;
  47512. }
  47513. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  47514. if (!(obj instanceof _primitives.Dict)) {
  47515. throw new _util.FormatError("Kid node must be a dictionary.");
  47516. }
  47517. if (obj.has("Count")) {
  47518. total += obj.get("Count");
  47519. } else {
  47520. total++;
  47521. }
  47522. }));
  47523. }
  47524. if (!found) {
  47525. throw new _util.FormatError("Kid reference not found in parent's kids.");
  47526. }
  47527. return Promise.all(kidPromises).then(function () {
  47528. return [total, parentRef];
  47529. });
  47530. });
  47531. }
  47532. let total = 0;
  47533. const next = ref => pagesBeforeRef(ref).then(args => {
  47534. if (!args) {
  47535. this.pageIndexCache.put(pageRef, total);
  47536. return total;
  47537. }
  47538. const [count, parentRef] = args;
  47539. total += count;
  47540. return next(parentRef);
  47541. });
  47542. return next(pageRef);
  47543. }
  47544. get baseUrl() {
  47545. const uri = this._catDict.get("URI");
  47546. if (uri instanceof _primitives.Dict) {
  47547. const base = uri.get("Base");
  47548. if (typeof base === "string") {
  47549. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  47550. tryConvertEncoding: true
  47551. });
  47552. if (absoluteUrl) {
  47553. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  47554. }
  47555. }
  47556. }
  47557. return (0, _util.shadow)(this, "baseUrl", null);
  47558. }
  47559. static parseDestDictionary(params) {
  47560. const destDict = params.destDict;
  47561. if (!(destDict instanceof _primitives.Dict)) {
  47562. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  47563. return;
  47564. }
  47565. const resultObj = params.resultObj;
  47566. if (typeof resultObj !== "object") {
  47567. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  47568. return;
  47569. }
  47570. const docBaseUrl = params.docBaseUrl || null;
  47571. let action = destDict.get("A"),
  47572. url,
  47573. dest;
  47574. if (!(action instanceof _primitives.Dict)) {
  47575. if (destDict.has("Dest")) {
  47576. action = destDict.get("Dest");
  47577. } else {
  47578. action = destDict.get("AA");
  47579. if (action instanceof _primitives.Dict) {
  47580. if (action.has("D")) {
  47581. action = action.get("D");
  47582. } else if (action.has("U")) {
  47583. action = action.get("U");
  47584. }
  47585. }
  47586. }
  47587. }
  47588. if (action instanceof _primitives.Dict) {
  47589. const actionType = action.get("S");
  47590. if (!(actionType instanceof _primitives.Name)) {
  47591. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  47592. return;
  47593. }
  47594. const actionName = actionType.name;
  47595. switch (actionName) {
  47596. case "ResetForm":
  47597. const flags = action.get("Flags");
  47598. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  47599. const fields = [];
  47600. const refs = [];
  47601. for (const obj of action.get("Fields") || []) {
  47602. if (obj instanceof _primitives.Ref) {
  47603. refs.push(obj.toString());
  47604. } else if (typeof obj === "string") {
  47605. fields.push((0, _util.stringToPDFString)(obj));
  47606. }
  47607. }
  47608. resultObj.resetForm = {
  47609. fields,
  47610. refs,
  47611. include
  47612. };
  47613. break;
  47614. case "URI":
  47615. url = action.get("URI");
  47616. if (url instanceof _primitives.Name) {
  47617. url = "/" + url.name;
  47618. }
  47619. break;
  47620. case "GoTo":
  47621. dest = action.get("D");
  47622. break;
  47623. case "Launch":
  47624. case "GoToR":
  47625. const urlDict = action.get("F");
  47626. if (urlDict instanceof _primitives.Dict) {
  47627. url = urlDict.get("F") || null;
  47628. } else if (typeof urlDict === "string") {
  47629. url = urlDict;
  47630. }
  47631. let remoteDest = action.get("D");
  47632. if (remoteDest) {
  47633. if (remoteDest instanceof _primitives.Name) {
  47634. remoteDest = remoteDest.name;
  47635. }
  47636. if (typeof url === "string") {
  47637. const baseUrl = url.split("#")[0];
  47638. if (typeof remoteDest === "string") {
  47639. url = baseUrl + "#" + remoteDest;
  47640. } else if (Array.isArray(remoteDest)) {
  47641. url = baseUrl + "#" + JSON.stringify(remoteDest);
  47642. }
  47643. }
  47644. }
  47645. const newWindow = action.get("NewWindow");
  47646. if (typeof newWindow === "boolean") {
  47647. resultObj.newWindow = newWindow;
  47648. }
  47649. break;
  47650. case "Named":
  47651. const namedAction = action.get("N");
  47652. if (namedAction instanceof _primitives.Name) {
  47653. resultObj.action = namedAction.name;
  47654. }
  47655. break;
  47656. case "JavaScript":
  47657. const jsAction = action.get("JS");
  47658. let js;
  47659. if (jsAction instanceof _base_stream.BaseStream) {
  47660. js = jsAction.getString();
  47661. } else if (typeof jsAction === "string") {
  47662. js = jsAction;
  47663. }
  47664. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  47665. if (jsURL) {
  47666. url = jsURL.url;
  47667. resultObj.newWindow = jsURL.newWindow;
  47668. break;
  47669. }
  47670. default:
  47671. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  47672. break;
  47673. }
  47674. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  47675. break;
  47676. }
  47677. } else if (destDict.has("Dest")) {
  47678. dest = destDict.get("Dest");
  47679. }
  47680. if (typeof url === "string") {
  47681. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  47682. addDefaultProtocol: true,
  47683. tryConvertEncoding: true
  47684. });
  47685. if (absoluteUrl) {
  47686. resultObj.url = absoluteUrl.href;
  47687. }
  47688. resultObj.unsafeUrl = url;
  47689. }
  47690. if (dest) {
  47691. if (dest instanceof _primitives.Name) {
  47692. dest = dest.name;
  47693. }
  47694. if (typeof dest === "string") {
  47695. resultObj.dest = (0, _util.stringToPDFString)(dest);
  47696. } else if (Array.isArray(dest)) {
  47697. resultObj.dest = dest;
  47698. }
  47699. }
  47700. }
  47701. }
  47702. exports.Catalog = Catalog;
  47703. /***/ }),
  47704. /* 66 */
  47705. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47706. Object.defineProperty(exports, "__esModule", ({
  47707. value: true
  47708. }));
  47709. exports.NumberTree = exports.NameTree = void 0;
  47710. var _primitives = __w_pdfjs_require__(5);
  47711. var _util = __w_pdfjs_require__(2);
  47712. class NameOrNumberTree {
  47713. constructor(root, xref, type) {
  47714. if (this.constructor === NameOrNumberTree) {
  47715. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  47716. }
  47717. this.root = root;
  47718. this.xref = xref;
  47719. this._type = type;
  47720. }
  47721. getAll() {
  47722. const map = new Map();
  47723. if (!this.root) {
  47724. return map;
  47725. }
  47726. const xref = this.xref;
  47727. const processed = new _primitives.RefSet();
  47728. processed.put(this.root);
  47729. const queue = [this.root];
  47730. while (queue.length > 0) {
  47731. const obj = xref.fetchIfRef(queue.shift());
  47732. if (!(obj instanceof _primitives.Dict)) {
  47733. continue;
  47734. }
  47735. if (obj.has("Kids")) {
  47736. const kids = obj.get("Kids");
  47737. if (!Array.isArray(kids)) {
  47738. continue;
  47739. }
  47740. for (const kid of kids) {
  47741. if (processed.has(kid)) {
  47742. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  47743. }
  47744. queue.push(kid);
  47745. processed.put(kid);
  47746. }
  47747. continue;
  47748. }
  47749. const entries = obj.get(this._type);
  47750. if (!Array.isArray(entries)) {
  47751. continue;
  47752. }
  47753. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  47754. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  47755. }
  47756. }
  47757. return map;
  47758. }
  47759. get(key) {
  47760. if (!this.root) {
  47761. return null;
  47762. }
  47763. const xref = this.xref;
  47764. let kidsOrEntries = xref.fetchIfRef(this.root);
  47765. let loopCount = 0;
  47766. const MAX_LEVELS = 10;
  47767. while (kidsOrEntries.has("Kids")) {
  47768. if (++loopCount > MAX_LEVELS) {
  47769. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  47770. return null;
  47771. }
  47772. const kids = kidsOrEntries.get("Kids");
  47773. if (!Array.isArray(kids)) {
  47774. return null;
  47775. }
  47776. let l = 0,
  47777. r = kids.length - 1;
  47778. while (l <= r) {
  47779. const m = l + r >> 1;
  47780. const kid = xref.fetchIfRef(kids[m]);
  47781. const limits = kid.get("Limits");
  47782. if (key < xref.fetchIfRef(limits[0])) {
  47783. r = m - 1;
  47784. } else if (key > xref.fetchIfRef(limits[1])) {
  47785. l = m + 1;
  47786. } else {
  47787. kidsOrEntries = kid;
  47788. break;
  47789. }
  47790. }
  47791. if (l > r) {
  47792. return null;
  47793. }
  47794. }
  47795. const entries = kidsOrEntries.get(this._type);
  47796. if (Array.isArray(entries)) {
  47797. let l = 0,
  47798. r = entries.length - 2;
  47799. while (l <= r) {
  47800. const tmp = l + r >> 1,
  47801. m = tmp + (tmp & 1);
  47802. const currentKey = xref.fetchIfRef(entries[m]);
  47803. if (key < currentKey) {
  47804. r = m - 2;
  47805. } else if (key > currentKey) {
  47806. l = m + 2;
  47807. } else {
  47808. return xref.fetchIfRef(entries[m + 1]);
  47809. }
  47810. }
  47811. }
  47812. return null;
  47813. }
  47814. }
  47815. class NameTree extends NameOrNumberTree {
  47816. constructor(root, xref) {
  47817. super(root, xref, "Names");
  47818. }
  47819. }
  47820. exports.NameTree = NameTree;
  47821. class NumberTree extends NameOrNumberTree {
  47822. constructor(root, xref) {
  47823. super(root, xref, "Nums");
  47824. }
  47825. }
  47826. exports.NumberTree = NumberTree;
  47827. /***/ }),
  47828. /* 67 */
  47829. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47830. Object.defineProperty(exports, "__esModule", ({
  47831. value: true
  47832. }));
  47833. exports.clearGlobalCaches = clearGlobalCaches;
  47834. var _primitives = __w_pdfjs_require__(5);
  47835. var _unicode = __w_pdfjs_require__(21);
  47836. function clearGlobalCaches() {
  47837. (0, _primitives.clearPrimitiveCaches)();
  47838. (0, _unicode.clearUnicodeCaches)();
  47839. }
  47840. /***/ }),
  47841. /* 68 */
  47842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47843. Object.defineProperty(exports, "__esModule", ({
  47844. value: true
  47845. }));
  47846. exports.FileSpec = void 0;
  47847. var _util = __w_pdfjs_require__(2);
  47848. var _base_stream = __w_pdfjs_require__(9);
  47849. var _primitives = __w_pdfjs_require__(5);
  47850. function pickPlatformItem(dict) {
  47851. if (dict.has("UF")) {
  47852. return dict.get("UF");
  47853. } else if (dict.has("F")) {
  47854. return dict.get("F");
  47855. } else if (dict.has("Unix")) {
  47856. return dict.get("Unix");
  47857. } else if (dict.has("Mac")) {
  47858. return dict.get("Mac");
  47859. } else if (dict.has("DOS")) {
  47860. return dict.get("DOS");
  47861. }
  47862. return null;
  47863. }
  47864. class FileSpec {
  47865. constructor(root, xref) {
  47866. if (!(root instanceof _primitives.Dict)) {
  47867. return;
  47868. }
  47869. this.xref = xref;
  47870. this.root = root;
  47871. if (root.has("FS")) {
  47872. this.fs = root.get("FS");
  47873. }
  47874. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  47875. if (root.has("RF")) {
  47876. (0, _util.warn)("Related file specifications are not supported");
  47877. }
  47878. this.contentAvailable = true;
  47879. if (!root.has("EF")) {
  47880. this.contentAvailable = false;
  47881. (0, _util.warn)("Non-embedded file specifications are not supported");
  47882. }
  47883. }
  47884. get filename() {
  47885. if (!this._filename && this.root) {
  47886. const filename = pickPlatformItem(this.root) || "unnamed";
  47887. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  47888. }
  47889. return this._filename;
  47890. }
  47891. get content() {
  47892. if (!this.contentAvailable) {
  47893. return null;
  47894. }
  47895. if (!this.contentRef && this.root) {
  47896. this.contentRef = pickPlatformItem(this.root.get("EF"));
  47897. }
  47898. let content = null;
  47899. if (this.contentRef) {
  47900. const fileObj = this.xref.fetchIfRef(this.contentRef);
  47901. if (fileObj instanceof _base_stream.BaseStream) {
  47902. content = fileObj.getBytes();
  47903. } else {
  47904. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  47905. }
  47906. } else {
  47907. (0, _util.warn)("Embedded file specification does not have a content");
  47908. }
  47909. return content;
  47910. }
  47911. get serializable() {
  47912. return {
  47913. filename: this.filename,
  47914. content: this.content
  47915. };
  47916. }
  47917. }
  47918. exports.FileSpec = FileSpec;
  47919. /***/ }),
  47920. /* 69 */
  47921. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47922. Object.defineProperty(exports, "__esModule", ({
  47923. value: true
  47924. }));
  47925. exports.MetadataParser = void 0;
  47926. var _xml_parser = __w_pdfjs_require__(70);
  47927. class MetadataParser {
  47928. constructor(data) {
  47929. data = this._repair(data);
  47930. const parser = new _xml_parser.SimpleXMLParser({
  47931. lowerCaseName: true
  47932. });
  47933. const xmlDocument = parser.parseFromString(data);
  47934. this._metadataMap = new Map();
  47935. this._data = data;
  47936. if (xmlDocument) {
  47937. this._parse(xmlDocument);
  47938. }
  47939. }
  47940. _repair(data) {
  47941. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  47942. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  47943. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  47944. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  47945. switch (name) {
  47946. case "amp":
  47947. return "&";
  47948. case "apos":
  47949. return "'";
  47950. case "gt":
  47951. return ">";
  47952. case "lt":
  47953. return "<";
  47954. case "quot":
  47955. return '"';
  47956. }
  47957. throw new Error(`_repair: ${name} isn't defined.`);
  47958. });
  47959. const charBuf = [];
  47960. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  47961. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  47962. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  47963. charBuf.push(String.fromCharCode(code));
  47964. } else {
  47965. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  47966. }
  47967. }
  47968. return ">" + charBuf.join("");
  47969. });
  47970. }
  47971. _getSequence(entry) {
  47972. const name = entry.nodeName;
  47973. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  47974. return null;
  47975. }
  47976. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  47977. }
  47978. _parseArray(entry) {
  47979. if (!entry.hasChildNodes()) {
  47980. return;
  47981. }
  47982. const [seqNode] = entry.childNodes;
  47983. const sequence = this._getSequence(seqNode) || [];
  47984. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  47985. }
  47986. _parse(xmlDocument) {
  47987. let rdf = xmlDocument.documentElement;
  47988. if (rdf.nodeName !== "rdf:rdf") {
  47989. rdf = rdf.firstChild;
  47990. while (rdf && rdf.nodeName !== "rdf:rdf") {
  47991. rdf = rdf.nextSibling;
  47992. }
  47993. }
  47994. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  47995. return;
  47996. }
  47997. for (const desc of rdf.childNodes) {
  47998. if (desc.nodeName !== "rdf:description") {
  47999. continue;
  48000. }
  48001. for (const entry of desc.childNodes) {
  48002. const name = entry.nodeName;
  48003. switch (name) {
  48004. case "#text":
  48005. continue;
  48006. case "dc:creator":
  48007. case "dc:subject":
  48008. this._parseArray(entry);
  48009. continue;
  48010. }
  48011. this._metadataMap.set(name, entry.textContent.trim());
  48012. }
  48013. }
  48014. }
  48015. get serializable() {
  48016. return {
  48017. parsedData: this._metadataMap,
  48018. rawData: this._data
  48019. };
  48020. }
  48021. }
  48022. exports.MetadataParser = MetadataParser;
  48023. /***/ }),
  48024. /* 70 */
  48025. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48026. Object.defineProperty(exports, "__esModule", ({
  48027. value: true
  48028. }));
  48029. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  48030. var _core_utils = __w_pdfjs_require__(8);
  48031. const XMLParserErrorCode = {
  48032. NoError: 0,
  48033. EndOfDocument: -1,
  48034. UnterminatedCdat: -2,
  48035. UnterminatedXmlDeclaration: -3,
  48036. UnterminatedDoctypeDeclaration: -4,
  48037. UnterminatedComment: -5,
  48038. MalformedElement: -6,
  48039. OutOfMemory: -7,
  48040. UnterminatedAttributeValue: -8,
  48041. UnterminatedElement: -9,
  48042. ElementNeverBegun: -10
  48043. };
  48044. exports.XMLParserErrorCode = XMLParserErrorCode;
  48045. function isWhitespace(s, index) {
  48046. const ch = s[index];
  48047. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  48048. }
  48049. function isWhitespaceString(s) {
  48050. for (let i = 0, ii = s.length; i < ii; i++) {
  48051. if (!isWhitespace(s, i)) {
  48052. return false;
  48053. }
  48054. }
  48055. return true;
  48056. }
  48057. class XMLParserBase {
  48058. _resolveEntities(s) {
  48059. return s.replace(/&([^;]+);/g, (all, entity) => {
  48060. if (entity.substring(0, 2) === "#x") {
  48061. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  48062. } else if (entity.substring(0, 1) === "#") {
  48063. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  48064. }
  48065. switch (entity) {
  48066. case "lt":
  48067. return "<";
  48068. case "gt":
  48069. return ">";
  48070. case "amp":
  48071. return "&";
  48072. case "quot":
  48073. return '"';
  48074. case "apos":
  48075. return "'";
  48076. }
  48077. return this.onResolveEntity(entity);
  48078. });
  48079. }
  48080. _parseContent(s, start) {
  48081. const attributes = [];
  48082. let pos = start;
  48083. function skipWs() {
  48084. while (pos < s.length && isWhitespace(s, pos)) {
  48085. ++pos;
  48086. }
  48087. }
  48088. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  48089. ++pos;
  48090. }
  48091. const name = s.substring(start, pos);
  48092. skipWs();
  48093. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  48094. skipWs();
  48095. let attrName = "",
  48096. attrValue = "";
  48097. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  48098. attrName += s[pos];
  48099. ++pos;
  48100. }
  48101. skipWs();
  48102. if (s[pos] !== "=") {
  48103. return null;
  48104. }
  48105. ++pos;
  48106. skipWs();
  48107. const attrEndChar = s[pos];
  48108. if (attrEndChar !== '"' && attrEndChar !== "'") {
  48109. return null;
  48110. }
  48111. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  48112. if (attrEndIndex < 0) {
  48113. return null;
  48114. }
  48115. attrValue = s.substring(pos, attrEndIndex);
  48116. attributes.push({
  48117. name: attrName,
  48118. value: this._resolveEntities(attrValue)
  48119. });
  48120. pos = attrEndIndex + 1;
  48121. skipWs();
  48122. }
  48123. return {
  48124. name,
  48125. attributes,
  48126. parsed: pos - start
  48127. };
  48128. }
  48129. _parseProcessingInstruction(s, start) {
  48130. let pos = start;
  48131. function skipWs() {
  48132. while (pos < s.length && isWhitespace(s, pos)) {
  48133. ++pos;
  48134. }
  48135. }
  48136. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  48137. ++pos;
  48138. }
  48139. const name = s.substring(start, pos);
  48140. skipWs();
  48141. const attrStart = pos;
  48142. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  48143. ++pos;
  48144. }
  48145. const value = s.substring(attrStart, pos);
  48146. return {
  48147. name,
  48148. value,
  48149. parsed: pos - start
  48150. };
  48151. }
  48152. parseXml(s) {
  48153. let i = 0;
  48154. while (i < s.length) {
  48155. const ch = s[i];
  48156. let j = i;
  48157. if (ch === "<") {
  48158. ++j;
  48159. const ch2 = s[j];
  48160. let q;
  48161. switch (ch2) {
  48162. case "/":
  48163. ++j;
  48164. q = s.indexOf(">", j);
  48165. if (q < 0) {
  48166. this.onError(XMLParserErrorCode.UnterminatedElement);
  48167. return;
  48168. }
  48169. this.onEndElement(s.substring(j, q));
  48170. j = q + 1;
  48171. break;
  48172. case "?":
  48173. ++j;
  48174. const pi = this._parseProcessingInstruction(s, j);
  48175. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  48176. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  48177. return;
  48178. }
  48179. this.onPi(pi.name, pi.value);
  48180. j += pi.parsed + 2;
  48181. break;
  48182. case "!":
  48183. if (s.substring(j + 1, j + 3) === "--") {
  48184. q = s.indexOf("-->", j + 3);
  48185. if (q < 0) {
  48186. this.onError(XMLParserErrorCode.UnterminatedComment);
  48187. return;
  48188. }
  48189. this.onComment(s.substring(j + 3, q));
  48190. j = q + 3;
  48191. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  48192. q = s.indexOf("]]>", j + 8);
  48193. if (q < 0) {
  48194. this.onError(XMLParserErrorCode.UnterminatedCdat);
  48195. return;
  48196. }
  48197. this.onCdata(s.substring(j + 8, q));
  48198. j = q + 3;
  48199. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  48200. const q2 = s.indexOf("[", j + 8);
  48201. let complexDoctype = false;
  48202. q = s.indexOf(">", j + 8);
  48203. if (q < 0) {
  48204. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48205. return;
  48206. }
  48207. if (q2 > 0 && q > q2) {
  48208. q = s.indexOf("]>", j + 8);
  48209. if (q < 0) {
  48210. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48211. return;
  48212. }
  48213. complexDoctype = true;
  48214. }
  48215. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  48216. this.onDoctype(doctypeContent);
  48217. j = q + (complexDoctype ? 2 : 1);
  48218. } else {
  48219. this.onError(XMLParserErrorCode.MalformedElement);
  48220. return;
  48221. }
  48222. break;
  48223. default:
  48224. const content = this._parseContent(s, j);
  48225. if (content === null) {
  48226. this.onError(XMLParserErrorCode.MalformedElement);
  48227. return;
  48228. }
  48229. let isClosed = false;
  48230. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  48231. isClosed = true;
  48232. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  48233. this.onError(XMLParserErrorCode.UnterminatedElement);
  48234. return;
  48235. }
  48236. this.onBeginElement(content.name, content.attributes, isClosed);
  48237. j += content.parsed + (isClosed ? 2 : 1);
  48238. break;
  48239. }
  48240. } else {
  48241. while (j < s.length && s[j] !== "<") {
  48242. j++;
  48243. }
  48244. const text = s.substring(i, j);
  48245. this.onText(this._resolveEntities(text));
  48246. }
  48247. i = j;
  48248. }
  48249. }
  48250. onResolveEntity(name) {
  48251. return `&${name};`;
  48252. }
  48253. onPi(name, value) {}
  48254. onComment(text) {}
  48255. onCdata(text) {}
  48256. onDoctype(doctypeContent) {}
  48257. onText(text) {}
  48258. onBeginElement(name, attributes, isEmpty) {}
  48259. onEndElement(name) {}
  48260. onError(code) {}
  48261. }
  48262. exports.XMLParserBase = XMLParserBase;
  48263. class SimpleDOMNode {
  48264. constructor(nodeName, nodeValue) {
  48265. this.nodeName = nodeName;
  48266. this.nodeValue = nodeValue;
  48267. Object.defineProperty(this, "parentNode", {
  48268. value: null,
  48269. writable: true
  48270. });
  48271. }
  48272. get firstChild() {
  48273. return this.childNodes && this.childNodes[0];
  48274. }
  48275. get nextSibling() {
  48276. const childNodes = this.parentNode.childNodes;
  48277. if (!childNodes) {
  48278. return undefined;
  48279. }
  48280. const index = childNodes.indexOf(this);
  48281. if (index === -1) {
  48282. return undefined;
  48283. }
  48284. return childNodes[index + 1];
  48285. }
  48286. get textContent() {
  48287. if (!this.childNodes) {
  48288. return this.nodeValue || "";
  48289. }
  48290. return this.childNodes.map(function (child) {
  48291. return child.textContent;
  48292. }).join("");
  48293. }
  48294. get children() {
  48295. return this.childNodes || [];
  48296. }
  48297. hasChildNodes() {
  48298. return this.childNodes && this.childNodes.length > 0;
  48299. }
  48300. searchNode(paths, pos) {
  48301. if (pos >= paths.length) {
  48302. return this;
  48303. }
  48304. const component = paths[pos];
  48305. const stack = [];
  48306. let node = this;
  48307. while (true) {
  48308. if (component.name === node.nodeName) {
  48309. if (component.pos === 0) {
  48310. const res = node.searchNode(paths, pos + 1);
  48311. if (res !== null) {
  48312. return res;
  48313. }
  48314. } else if (stack.length === 0) {
  48315. return null;
  48316. } else {
  48317. const [parent] = stack.pop();
  48318. let siblingPos = 0;
  48319. for (const child of parent.childNodes) {
  48320. if (component.name === child.nodeName) {
  48321. if (siblingPos === component.pos) {
  48322. return child.searchNode(paths, pos + 1);
  48323. }
  48324. siblingPos++;
  48325. }
  48326. }
  48327. return node.searchNode(paths, pos + 1);
  48328. }
  48329. }
  48330. if (node.childNodes && node.childNodes.length !== 0) {
  48331. stack.push([node, 0]);
  48332. node = node.childNodes[0];
  48333. } else if (stack.length === 0) {
  48334. return null;
  48335. } else {
  48336. while (stack.length !== 0) {
  48337. const [parent, currentPos] = stack.pop();
  48338. const newPos = currentPos + 1;
  48339. if (newPos < parent.childNodes.length) {
  48340. stack.push([parent, newPos]);
  48341. node = parent.childNodes[newPos];
  48342. break;
  48343. }
  48344. }
  48345. if (stack.length === 0) {
  48346. return null;
  48347. }
  48348. }
  48349. }
  48350. }
  48351. dump(buffer) {
  48352. if (this.nodeName === "#text") {
  48353. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  48354. return;
  48355. }
  48356. buffer.push(`<${this.nodeName}`);
  48357. if (this.attributes) {
  48358. for (const attribute of this.attributes) {
  48359. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  48360. }
  48361. }
  48362. if (this.hasChildNodes()) {
  48363. buffer.push(">");
  48364. for (const child of this.childNodes) {
  48365. child.dump(buffer);
  48366. }
  48367. buffer.push(`</${this.nodeName}>`);
  48368. } else if (this.nodeValue) {
  48369. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  48370. } else {
  48371. buffer.push("/>");
  48372. }
  48373. }
  48374. }
  48375. exports.SimpleDOMNode = SimpleDOMNode;
  48376. class SimpleXMLParser extends XMLParserBase {
  48377. constructor({
  48378. hasAttributes = false,
  48379. lowerCaseName = false
  48380. }) {
  48381. super();
  48382. this._currentFragment = null;
  48383. this._stack = null;
  48384. this._errorCode = XMLParserErrorCode.NoError;
  48385. this._hasAttributes = hasAttributes;
  48386. this._lowerCaseName = lowerCaseName;
  48387. }
  48388. parseFromString(data) {
  48389. this._currentFragment = [];
  48390. this._stack = [];
  48391. this._errorCode = XMLParserErrorCode.NoError;
  48392. this.parseXml(data);
  48393. if (this._errorCode !== XMLParserErrorCode.NoError) {
  48394. return undefined;
  48395. }
  48396. const [documentElement] = this._currentFragment;
  48397. if (!documentElement) {
  48398. return undefined;
  48399. }
  48400. return {
  48401. documentElement
  48402. };
  48403. }
  48404. onText(text) {
  48405. if (isWhitespaceString(text)) {
  48406. return;
  48407. }
  48408. const node = new SimpleDOMNode("#text", text);
  48409. this._currentFragment.push(node);
  48410. }
  48411. onCdata(text) {
  48412. const node = new SimpleDOMNode("#text", text);
  48413. this._currentFragment.push(node);
  48414. }
  48415. onBeginElement(name, attributes, isEmpty) {
  48416. if (this._lowerCaseName) {
  48417. name = name.toLowerCase();
  48418. }
  48419. const node = new SimpleDOMNode(name);
  48420. node.childNodes = [];
  48421. if (this._hasAttributes) {
  48422. node.attributes = attributes;
  48423. }
  48424. this._currentFragment.push(node);
  48425. if (isEmpty) {
  48426. return;
  48427. }
  48428. this._stack.push(this._currentFragment);
  48429. this._currentFragment = node.childNodes;
  48430. }
  48431. onEndElement(name) {
  48432. this._currentFragment = this._stack.pop() || [];
  48433. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  48434. if (!lastElement) {
  48435. return null;
  48436. }
  48437. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  48438. lastElement.childNodes[i].parentNode = lastElement;
  48439. }
  48440. return lastElement;
  48441. }
  48442. onError(code) {
  48443. this._errorCode = code;
  48444. }
  48445. }
  48446. exports.SimpleXMLParser = SimpleXMLParser;
  48447. /***/ }),
  48448. /* 71 */
  48449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48450. Object.defineProperty(exports, "__esModule", ({
  48451. value: true
  48452. }));
  48453. exports.StructTreeRoot = exports.StructTreePage = void 0;
  48454. var _primitives = __w_pdfjs_require__(5);
  48455. var _util = __w_pdfjs_require__(2);
  48456. var _name_number_tree = __w_pdfjs_require__(66);
  48457. const MAX_DEPTH = 40;
  48458. const StructElementType = {
  48459. PAGE_CONTENT: "PAGE_CONTENT",
  48460. STREAM_CONTENT: "STREAM_CONTENT",
  48461. OBJECT: "OBJECT",
  48462. ELEMENT: "ELEMENT"
  48463. };
  48464. class StructTreeRoot {
  48465. constructor(rootDict) {
  48466. this.dict = rootDict;
  48467. this.roleMap = new Map();
  48468. }
  48469. init() {
  48470. this.readRoleMap();
  48471. }
  48472. readRoleMap() {
  48473. const roleMapDict = this.dict.get("RoleMap");
  48474. if (!(roleMapDict instanceof _primitives.Dict)) {
  48475. return;
  48476. }
  48477. roleMapDict.forEach((key, value) => {
  48478. if (!(value instanceof _primitives.Name)) {
  48479. return;
  48480. }
  48481. this.roleMap.set(key, value.name);
  48482. });
  48483. }
  48484. }
  48485. exports.StructTreeRoot = StructTreeRoot;
  48486. class StructElementNode {
  48487. constructor(tree, dict) {
  48488. this.tree = tree;
  48489. this.dict = dict;
  48490. this.kids = [];
  48491. this.parseKids();
  48492. }
  48493. get role() {
  48494. const nameObj = this.dict.get("S");
  48495. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  48496. const {
  48497. root
  48498. } = this.tree;
  48499. if (root.roleMap.has(name)) {
  48500. return root.roleMap.get(name);
  48501. }
  48502. return name;
  48503. }
  48504. parseKids() {
  48505. let pageObjId = null;
  48506. const objRef = this.dict.getRaw("Pg");
  48507. if (objRef instanceof _primitives.Ref) {
  48508. pageObjId = objRef.toString();
  48509. }
  48510. const kids = this.dict.get("K");
  48511. if (Array.isArray(kids)) {
  48512. for (const kid of kids) {
  48513. const element = this.parseKid(pageObjId, kid);
  48514. if (element) {
  48515. this.kids.push(element);
  48516. }
  48517. }
  48518. } else {
  48519. const element = this.parseKid(pageObjId, kids);
  48520. if (element) {
  48521. this.kids.push(element);
  48522. }
  48523. }
  48524. }
  48525. parseKid(pageObjId, kid) {
  48526. if (Number.isInteger(kid)) {
  48527. if (this.tree.pageDict.objId !== pageObjId) {
  48528. return null;
  48529. }
  48530. return new StructElement({
  48531. type: StructElementType.PAGE_CONTENT,
  48532. mcid: kid,
  48533. pageObjId
  48534. });
  48535. }
  48536. let kidDict = null;
  48537. if (kid instanceof _primitives.Ref) {
  48538. kidDict = this.dict.xref.fetch(kid);
  48539. } else if (kid instanceof _primitives.Dict) {
  48540. kidDict = kid;
  48541. }
  48542. if (!kidDict) {
  48543. return null;
  48544. }
  48545. const pageRef = kidDict.getRaw("Pg");
  48546. if (pageRef instanceof _primitives.Ref) {
  48547. pageObjId = pageRef.toString();
  48548. }
  48549. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  48550. if (type === "MCR") {
  48551. if (this.tree.pageDict.objId !== pageObjId) {
  48552. return null;
  48553. }
  48554. return new StructElement({
  48555. type: StructElementType.STREAM_CONTENT,
  48556. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  48557. pageObjId,
  48558. mcid: kidDict.get("MCID")
  48559. });
  48560. }
  48561. if (type === "OBJR") {
  48562. if (this.tree.pageDict.objId !== pageObjId) {
  48563. return null;
  48564. }
  48565. return new StructElement({
  48566. type: StructElementType.OBJECT,
  48567. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  48568. pageObjId
  48569. });
  48570. }
  48571. return new StructElement({
  48572. type: StructElementType.ELEMENT,
  48573. dict: kidDict
  48574. });
  48575. }
  48576. }
  48577. class StructElement {
  48578. constructor({
  48579. type,
  48580. dict = null,
  48581. mcid = null,
  48582. pageObjId = null,
  48583. refObjId = null
  48584. }) {
  48585. this.type = type;
  48586. this.dict = dict;
  48587. this.mcid = mcid;
  48588. this.pageObjId = pageObjId;
  48589. this.refObjId = refObjId;
  48590. this.parentNode = null;
  48591. }
  48592. }
  48593. class StructTreePage {
  48594. constructor(structTreeRoot, pageDict) {
  48595. this.root = structTreeRoot;
  48596. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  48597. this.pageDict = pageDict;
  48598. this.nodes = [];
  48599. }
  48600. parse() {
  48601. if (!this.root || !this.rootDict) {
  48602. return;
  48603. }
  48604. const parentTree = this.rootDict.get("ParentTree");
  48605. if (!parentTree) {
  48606. return;
  48607. }
  48608. const id = this.pageDict.get("StructParents");
  48609. if (!Number.isInteger(id)) {
  48610. return;
  48611. }
  48612. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  48613. const parentArray = numberTree.get(id);
  48614. if (!Array.isArray(parentArray)) {
  48615. return;
  48616. }
  48617. const map = new Map();
  48618. for (const ref of parentArray) {
  48619. if (ref instanceof _primitives.Ref) {
  48620. this.addNode(this.rootDict.xref.fetch(ref), map);
  48621. }
  48622. }
  48623. }
  48624. addNode(dict, map, level = 0) {
  48625. if (level > MAX_DEPTH) {
  48626. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  48627. return null;
  48628. }
  48629. if (map.has(dict)) {
  48630. return map.get(dict);
  48631. }
  48632. const element = new StructElementNode(this, dict);
  48633. map.set(dict, element);
  48634. const parent = dict.get("P");
  48635. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  48636. if (!this.addTopLevelNode(dict, element)) {
  48637. map.delete(dict);
  48638. }
  48639. return element;
  48640. }
  48641. const parentNode = this.addNode(parent, map, level + 1);
  48642. if (!parentNode) {
  48643. return element;
  48644. }
  48645. let save = false;
  48646. for (const kid of parentNode.kids) {
  48647. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  48648. kid.parentNode = element;
  48649. save = true;
  48650. }
  48651. }
  48652. if (!save) {
  48653. map.delete(dict);
  48654. }
  48655. return element;
  48656. }
  48657. addTopLevelNode(dict, element) {
  48658. const obj = this.rootDict.get("K");
  48659. if (!obj) {
  48660. return false;
  48661. }
  48662. if (obj instanceof _primitives.Dict) {
  48663. if (obj.objId !== dict.objId) {
  48664. return false;
  48665. }
  48666. this.nodes[0] = element;
  48667. return true;
  48668. }
  48669. if (!Array.isArray(obj)) {
  48670. return true;
  48671. }
  48672. let save = false;
  48673. for (let i = 0; i < obj.length; i++) {
  48674. const kidRef = obj[i];
  48675. if (kidRef && kidRef.toString() === dict.objId) {
  48676. this.nodes[i] = element;
  48677. save = true;
  48678. }
  48679. }
  48680. return save;
  48681. }
  48682. get serializable() {
  48683. function nodeToSerializable(node, parent, level = 0) {
  48684. if (level > MAX_DEPTH) {
  48685. (0, _util.warn)("StructTree too deep to be fully serialized.");
  48686. return;
  48687. }
  48688. const obj = Object.create(null);
  48689. obj.role = node.role;
  48690. obj.children = [];
  48691. parent.children.push(obj);
  48692. const alt = node.dict.get("Alt");
  48693. if (typeof alt === "string") {
  48694. obj.alt = (0, _util.stringToPDFString)(alt);
  48695. }
  48696. const lang = node.dict.get("Lang");
  48697. if (typeof lang === "string") {
  48698. obj.lang = (0, _util.stringToPDFString)(lang);
  48699. }
  48700. for (const kid of node.kids) {
  48701. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  48702. if (kidElement) {
  48703. nodeToSerializable(kidElement, obj, level + 1);
  48704. continue;
  48705. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  48706. obj.children.push({
  48707. type: "content",
  48708. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  48709. });
  48710. } else if (kid.type === StructElementType.OBJECT) {
  48711. obj.children.push({
  48712. type: "object",
  48713. id: kid.refObjId
  48714. });
  48715. }
  48716. }
  48717. }
  48718. const root = Object.create(null);
  48719. root.children = [];
  48720. root.role = "Root";
  48721. for (const child of this.nodes) {
  48722. if (!child) {
  48723. continue;
  48724. }
  48725. nodeToSerializable(child, root);
  48726. }
  48727. return root;
  48728. }
  48729. }
  48730. exports.StructTreePage = StructTreePage;
  48731. /***/ }),
  48732. /* 72 */
  48733. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48734. Object.defineProperty(exports, "__esModule", ({
  48735. value: true
  48736. }));
  48737. exports.ObjectLoader = void 0;
  48738. var _primitives = __w_pdfjs_require__(5);
  48739. var _base_stream = __w_pdfjs_require__(9);
  48740. var _core_utils = __w_pdfjs_require__(8);
  48741. var _util = __w_pdfjs_require__(2);
  48742. function mayHaveChildren(value) {
  48743. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  48744. }
  48745. function addChildren(node, nodesToVisit) {
  48746. if (node instanceof _primitives.Dict) {
  48747. node = node.getRawValues();
  48748. } else if (node instanceof _base_stream.BaseStream) {
  48749. node = node.dict.getRawValues();
  48750. } else if (!Array.isArray(node)) {
  48751. return;
  48752. }
  48753. for (const rawValue of node) {
  48754. if (mayHaveChildren(rawValue)) {
  48755. nodesToVisit.push(rawValue);
  48756. }
  48757. }
  48758. }
  48759. class ObjectLoader {
  48760. constructor(dict, keys, xref) {
  48761. this.dict = dict;
  48762. this.keys = keys;
  48763. this.xref = xref;
  48764. this.refSet = null;
  48765. }
  48766. async load() {
  48767. if (this.xref.stream.isDataLoaded) {
  48768. return undefined;
  48769. }
  48770. const {
  48771. keys,
  48772. dict
  48773. } = this;
  48774. this.refSet = new _primitives.RefSet();
  48775. const nodesToVisit = [];
  48776. for (let i = 0, ii = keys.length; i < ii; i++) {
  48777. const rawValue = dict.getRaw(keys[i]);
  48778. if (rawValue !== undefined) {
  48779. nodesToVisit.push(rawValue);
  48780. }
  48781. }
  48782. return this._walk(nodesToVisit);
  48783. }
  48784. async _walk(nodesToVisit) {
  48785. const nodesToRevisit = [];
  48786. const pendingRequests = [];
  48787. while (nodesToVisit.length) {
  48788. let currentNode = nodesToVisit.pop();
  48789. if (currentNode instanceof _primitives.Ref) {
  48790. if (this.refSet.has(currentNode)) {
  48791. continue;
  48792. }
  48793. try {
  48794. this.refSet.put(currentNode);
  48795. currentNode = this.xref.fetch(currentNode);
  48796. } catch (ex) {
  48797. if (!(ex instanceof _core_utils.MissingDataException)) {
  48798. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  48799. this.refSet = null;
  48800. const {
  48801. manager
  48802. } = this.xref.stream;
  48803. return manager.requestAllChunks();
  48804. }
  48805. nodesToRevisit.push(currentNode);
  48806. pendingRequests.push({
  48807. begin: ex.begin,
  48808. end: ex.end
  48809. });
  48810. }
  48811. }
  48812. if (currentNode instanceof _base_stream.BaseStream) {
  48813. const baseStreams = currentNode.getBaseStreams();
  48814. if (baseStreams) {
  48815. let foundMissingData = false;
  48816. for (const stream of baseStreams) {
  48817. if (stream.isDataLoaded) {
  48818. continue;
  48819. }
  48820. foundMissingData = true;
  48821. pendingRequests.push({
  48822. begin: stream.start,
  48823. end: stream.end
  48824. });
  48825. }
  48826. if (foundMissingData) {
  48827. nodesToRevisit.push(currentNode);
  48828. }
  48829. }
  48830. }
  48831. addChildren(currentNode, nodesToVisit);
  48832. }
  48833. if (pendingRequests.length) {
  48834. await this.xref.stream.manager.requestRanges(pendingRequests);
  48835. for (const node of nodesToRevisit) {
  48836. if (node instanceof _primitives.Ref) {
  48837. this.refSet.remove(node);
  48838. }
  48839. }
  48840. return this._walk(nodesToRevisit);
  48841. }
  48842. this.refSet = null;
  48843. return undefined;
  48844. }
  48845. }
  48846. exports.ObjectLoader = ObjectLoader;
  48847. /***/ }),
  48848. /* 73 */
  48849. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48850. Object.defineProperty(exports, "__esModule", ({
  48851. value: true
  48852. }));
  48853. exports.incrementalUpdate = incrementalUpdate;
  48854. exports.writeDict = writeDict;
  48855. var _util = __w_pdfjs_require__(2);
  48856. var _primitives = __w_pdfjs_require__(5);
  48857. var _core_utils = __w_pdfjs_require__(8);
  48858. var _xml_parser = __w_pdfjs_require__(70);
  48859. var _base_stream = __w_pdfjs_require__(9);
  48860. var _crypto = __w_pdfjs_require__(74);
  48861. function writeDict(dict, buffer, transform) {
  48862. buffer.push("<<");
  48863. for (const key of dict.getKeys()) {
  48864. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  48865. writeValue(dict.getRaw(key), buffer, transform);
  48866. }
  48867. buffer.push(">>");
  48868. }
  48869. function writeStream(stream, buffer, transform) {
  48870. writeDict(stream.dict, buffer, transform);
  48871. buffer.push(" stream\n");
  48872. let string = stream.getString();
  48873. if (transform !== null) {
  48874. string = transform.encryptString(string);
  48875. }
  48876. buffer.push(string, "\nendstream\n");
  48877. }
  48878. function writeArray(array, buffer, transform) {
  48879. buffer.push("[");
  48880. let first = true;
  48881. for (const val of array) {
  48882. if (!first) {
  48883. buffer.push(" ");
  48884. } else {
  48885. first = false;
  48886. }
  48887. writeValue(val, buffer, transform);
  48888. }
  48889. buffer.push("]");
  48890. }
  48891. function numberToString(value) {
  48892. if (Number.isInteger(value)) {
  48893. return value.toString();
  48894. }
  48895. const roundedValue = Math.round(value * 100);
  48896. if (roundedValue % 100 === 0) {
  48897. return (roundedValue / 100).toString();
  48898. }
  48899. if (roundedValue % 10 === 0) {
  48900. return value.toFixed(1);
  48901. }
  48902. return value.toFixed(2);
  48903. }
  48904. function writeValue(value, buffer, transform) {
  48905. if (value instanceof _primitives.Name) {
  48906. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  48907. } else if (value instanceof _primitives.Ref) {
  48908. buffer.push(`${value.num} ${value.gen} R`);
  48909. } else if (Array.isArray(value)) {
  48910. writeArray(value, buffer, transform);
  48911. } else if (typeof value === "string") {
  48912. if (transform !== null) {
  48913. value = transform.encryptString(value);
  48914. }
  48915. buffer.push(`(${(0, _util.escapeString)(value)})`);
  48916. } else if (typeof value === "number") {
  48917. buffer.push(numberToString(value));
  48918. } else if (typeof value === "boolean") {
  48919. buffer.push(value.toString());
  48920. } else if (value instanceof _primitives.Dict) {
  48921. writeDict(value, buffer, transform);
  48922. } else if (value instanceof _base_stream.BaseStream) {
  48923. writeStream(value, buffer, transform);
  48924. } else if (value === null) {
  48925. buffer.push("null");
  48926. } else {
  48927. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  48928. }
  48929. }
  48930. function writeInt(number, size, offset, buffer) {
  48931. for (let i = size + offset - 1; i > offset - 1; i--) {
  48932. buffer[i] = number & 0xff;
  48933. number >>= 8;
  48934. }
  48935. return offset + size;
  48936. }
  48937. function writeString(string, offset, buffer) {
  48938. for (let i = 0, len = string.length; i < len; i++) {
  48939. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  48940. }
  48941. }
  48942. function computeMD5(filesize, xrefInfo) {
  48943. const time = Math.floor(Date.now() / 1000);
  48944. const filename = xrefInfo.filename || "";
  48945. const md5Buffer = [time.toString(), filename, filesize.toString()];
  48946. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  48947. for (const value of Object.values(xrefInfo.info)) {
  48948. md5Buffer.push(value);
  48949. md5BufferLen += value.length;
  48950. }
  48951. const array = new Uint8Array(md5BufferLen);
  48952. let offset = 0;
  48953. for (const str of md5Buffer) {
  48954. writeString(str, offset, array);
  48955. offset += str.length;
  48956. }
  48957. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  48958. }
  48959. function writeXFADataForAcroform(str, newRefs) {
  48960. const xml = new _xml_parser.SimpleXMLParser({
  48961. hasAttributes: true
  48962. }).parseFromString(str);
  48963. for (const {
  48964. xfa
  48965. } of newRefs) {
  48966. if (!xfa) {
  48967. continue;
  48968. }
  48969. const {
  48970. path,
  48971. value
  48972. } = xfa;
  48973. if (!path) {
  48974. continue;
  48975. }
  48976. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  48977. if (node) {
  48978. if (Array.isArray(value)) {
  48979. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  48980. } else {
  48981. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  48982. }
  48983. } else {
  48984. (0, _util.warn)(`Node not found for path: ${path}`);
  48985. }
  48986. }
  48987. const buffer = [];
  48988. xml.documentElement.dump(buffer);
  48989. return buffer.join("");
  48990. }
  48991. function updateXFA({
  48992. xfaData,
  48993. xfaDatasetsRef,
  48994. hasXfaDatasetsEntry,
  48995. acroFormRef,
  48996. acroForm,
  48997. newRefs,
  48998. xref,
  48999. xrefInfo
  49000. }) {
  49001. if (xref === null) {
  49002. return;
  49003. }
  49004. if (!hasXfaDatasetsEntry) {
  49005. if (!acroFormRef) {
  49006. (0, _util.warn)("XFA - Cannot save it");
  49007. return;
  49008. }
  49009. const oldXfa = acroForm.get("XFA");
  49010. const newXfa = oldXfa.slice();
  49011. newXfa.splice(2, 0, "datasets");
  49012. newXfa.splice(3, 0, xfaDatasetsRef);
  49013. acroForm.set("XFA", newXfa);
  49014. const encrypt = xref.encrypt;
  49015. let transform = null;
  49016. if (encrypt) {
  49017. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  49018. }
  49019. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  49020. writeDict(acroForm, buffer, transform);
  49021. buffer.push("\n");
  49022. acroForm.set("XFA", oldXfa);
  49023. newRefs.push({
  49024. ref: acroFormRef,
  49025. data: buffer.join("")
  49026. });
  49027. }
  49028. if (xfaData === null) {
  49029. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  49030. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  49031. }
  49032. const encrypt = xref.encrypt;
  49033. if (encrypt) {
  49034. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  49035. xfaData = transform.encryptString(xfaData);
  49036. }
  49037. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  49038. newRefs.push({
  49039. ref: xfaDatasetsRef,
  49040. data
  49041. });
  49042. }
  49043. function incrementalUpdate({
  49044. originalData,
  49045. xrefInfo,
  49046. newRefs,
  49047. xref = null,
  49048. hasXfa = false,
  49049. xfaDatasetsRef = null,
  49050. hasXfaDatasetsEntry = false,
  49051. acroFormRef = null,
  49052. acroForm = null,
  49053. xfaData = null
  49054. }) {
  49055. if (hasXfa) {
  49056. updateXFA({
  49057. xfaData,
  49058. xfaDatasetsRef,
  49059. hasXfaDatasetsEntry,
  49060. acroFormRef,
  49061. acroForm,
  49062. newRefs,
  49063. xref,
  49064. xrefInfo
  49065. });
  49066. }
  49067. const newXref = new _primitives.Dict(null);
  49068. const refForXrefTable = xrefInfo.newRef;
  49069. let buffer, baseOffset;
  49070. const lastByte = originalData[originalData.length - 1];
  49071. if (lastByte === 0x0a || lastByte === 0x0d) {
  49072. buffer = [];
  49073. baseOffset = originalData.length;
  49074. } else {
  49075. buffer = ["\n"];
  49076. baseOffset = originalData.length + 1;
  49077. }
  49078. newXref.set("Size", refForXrefTable.num + 1);
  49079. newXref.set("Prev", xrefInfo.startXRef);
  49080. newXref.set("Type", _primitives.Name.get("XRef"));
  49081. if (xrefInfo.rootRef !== null) {
  49082. newXref.set("Root", xrefInfo.rootRef);
  49083. }
  49084. if (xrefInfo.infoRef !== null) {
  49085. newXref.set("Info", xrefInfo.infoRef);
  49086. }
  49087. if (xrefInfo.encryptRef !== null) {
  49088. newXref.set("Encrypt", xrefInfo.encryptRef);
  49089. }
  49090. newRefs.push({
  49091. ref: refForXrefTable,
  49092. data: ""
  49093. });
  49094. newRefs = newRefs.sort((a, b) => {
  49095. return a.ref.num - b.ref.num;
  49096. });
  49097. const xrefTableData = [[0, 1, 0xffff]];
  49098. const indexes = [0, 1];
  49099. let maxOffset = 0;
  49100. for (const {
  49101. ref,
  49102. data
  49103. } of newRefs) {
  49104. maxOffset = Math.max(maxOffset, baseOffset);
  49105. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  49106. baseOffset += data.length;
  49107. indexes.push(ref.num, 1);
  49108. buffer.push(data);
  49109. }
  49110. newXref.set("Index", indexes);
  49111. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  49112. const md5 = computeMD5(baseOffset, xrefInfo);
  49113. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  49114. }
  49115. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  49116. const sizes = [1, offsetSize, 2];
  49117. const structSize = sizes[0] + sizes[1] + sizes[2];
  49118. const tableLength = structSize * xrefTableData.length;
  49119. newXref.set("W", sizes);
  49120. newXref.set("Length", tableLength);
  49121. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  49122. writeDict(newXref, buffer, null);
  49123. buffer.push(" stream\n");
  49124. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  49125. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  49126. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  49127. array.set(originalData);
  49128. let offset = originalData.length;
  49129. for (const str of buffer) {
  49130. writeString(str, offset, array);
  49131. offset += str.length;
  49132. }
  49133. for (const [type, objOffset, gen] of xrefTableData) {
  49134. offset = writeInt(type, sizes[0], offset, array);
  49135. offset = writeInt(objOffset, sizes[1], offset, array);
  49136. offset = writeInt(gen, sizes[2], offset, array);
  49137. }
  49138. writeString(footer, offset, array);
  49139. return array;
  49140. }
  49141. /***/ }),
  49142. /* 74 */
  49143. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49144. Object.defineProperty(exports, "__esModule", ({
  49145. value: true
  49146. }));
  49147. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  49148. exports.calculateSHA384 = calculateSHA384;
  49149. exports.calculateSHA512 = void 0;
  49150. var _util = __w_pdfjs_require__(2);
  49151. var _primitives = __w_pdfjs_require__(5);
  49152. var _decrypt_stream = __w_pdfjs_require__(75);
  49153. class ARCFourCipher {
  49154. constructor(key) {
  49155. this.a = 0;
  49156. this.b = 0;
  49157. const s = new Uint8Array(256);
  49158. const keyLength = key.length;
  49159. for (let i = 0; i < 256; ++i) {
  49160. s[i] = i;
  49161. }
  49162. for (let i = 0, j = 0; i < 256; ++i) {
  49163. const tmp = s[i];
  49164. j = j + tmp + key[i % keyLength] & 0xff;
  49165. s[i] = s[j];
  49166. s[j] = tmp;
  49167. }
  49168. this.s = s;
  49169. }
  49170. encryptBlock(data) {
  49171. let a = this.a,
  49172. b = this.b;
  49173. const s = this.s;
  49174. const n = data.length;
  49175. const output = new Uint8Array(n);
  49176. for (let i = 0; i < n; ++i) {
  49177. a = a + 1 & 0xff;
  49178. const tmp = s[a];
  49179. b = b + tmp & 0xff;
  49180. const tmp2 = s[b];
  49181. s[a] = tmp2;
  49182. s[b] = tmp;
  49183. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  49184. }
  49185. this.a = a;
  49186. this.b = b;
  49187. return output;
  49188. }
  49189. decryptBlock(data) {
  49190. return this.encryptBlock(data);
  49191. }
  49192. encrypt(data) {
  49193. return this.encryptBlock(data);
  49194. }
  49195. }
  49196. exports.ARCFourCipher = ARCFourCipher;
  49197. const calculateMD5 = function calculateMD5Closure() {
  49198. 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]);
  49199. 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]);
  49200. function hash(data, offset, length) {
  49201. let h0 = 1732584193,
  49202. h1 = -271733879,
  49203. h2 = -1732584194,
  49204. h3 = 271733878;
  49205. const paddedLength = length + 72 & ~63;
  49206. const padded = new Uint8Array(paddedLength);
  49207. let i, j;
  49208. for (i = 0; i < length; ++i) {
  49209. padded[i] = data[offset++];
  49210. }
  49211. padded[i++] = 0x80;
  49212. const n = paddedLength - 8;
  49213. while (i < n) {
  49214. padded[i++] = 0;
  49215. }
  49216. padded[i++] = length << 3 & 0xff;
  49217. padded[i++] = length >> 5 & 0xff;
  49218. padded[i++] = length >> 13 & 0xff;
  49219. padded[i++] = length >> 21 & 0xff;
  49220. padded[i++] = length >>> 29 & 0xff;
  49221. padded[i++] = 0;
  49222. padded[i++] = 0;
  49223. padded[i++] = 0;
  49224. const w = new Int32Array(16);
  49225. for (i = 0; i < paddedLength;) {
  49226. for (j = 0; j < 16; ++j, i += 4) {
  49227. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  49228. }
  49229. let a = h0,
  49230. b = h1,
  49231. c = h2,
  49232. d = h3,
  49233. f,
  49234. g;
  49235. for (j = 0; j < 64; ++j) {
  49236. if (j < 16) {
  49237. f = b & c | ~b & d;
  49238. g = j;
  49239. } else if (j < 32) {
  49240. f = d & b | ~d & c;
  49241. g = 5 * j + 1 & 15;
  49242. } else if (j < 48) {
  49243. f = b ^ c ^ d;
  49244. g = 3 * j + 5 & 15;
  49245. } else {
  49246. f = c ^ (b | ~d);
  49247. g = 7 * j & 15;
  49248. }
  49249. const tmp = d,
  49250. rotateArg = a + f + k[j] + w[g] | 0,
  49251. rotate = r[j];
  49252. d = c;
  49253. c = b;
  49254. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  49255. a = tmp;
  49256. }
  49257. h0 = h0 + a | 0;
  49258. h1 = h1 + b | 0;
  49259. h2 = h2 + c | 0;
  49260. h3 = h3 + d | 0;
  49261. }
  49262. 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]);
  49263. }
  49264. return hash;
  49265. }();
  49266. exports.calculateMD5 = calculateMD5;
  49267. class Word64 {
  49268. constructor(highInteger, lowInteger) {
  49269. this.high = highInteger | 0;
  49270. this.low = lowInteger | 0;
  49271. }
  49272. and(word) {
  49273. this.high &= word.high;
  49274. this.low &= word.low;
  49275. }
  49276. xor(word) {
  49277. this.high ^= word.high;
  49278. this.low ^= word.low;
  49279. }
  49280. or(word) {
  49281. this.high |= word.high;
  49282. this.low |= word.low;
  49283. }
  49284. shiftRight(places) {
  49285. if (places >= 32) {
  49286. this.low = this.high >>> places - 32 | 0;
  49287. this.high = 0;
  49288. } else {
  49289. this.low = this.low >>> places | this.high << 32 - places;
  49290. this.high = this.high >>> places | 0;
  49291. }
  49292. }
  49293. shiftLeft(places) {
  49294. if (places >= 32) {
  49295. this.high = this.low << places - 32;
  49296. this.low = 0;
  49297. } else {
  49298. this.high = this.high << places | this.low >>> 32 - places;
  49299. this.low <<= places;
  49300. }
  49301. }
  49302. rotateRight(places) {
  49303. let low, high;
  49304. if (places & 32) {
  49305. high = this.low;
  49306. low = this.high;
  49307. } else {
  49308. low = this.low;
  49309. high = this.high;
  49310. }
  49311. places &= 31;
  49312. this.low = low >>> places | high << 32 - places;
  49313. this.high = high >>> places | low << 32 - places;
  49314. }
  49315. not() {
  49316. this.high = ~this.high;
  49317. this.low = ~this.low;
  49318. }
  49319. add(word) {
  49320. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  49321. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  49322. if (lowAdd > 0xffffffff) {
  49323. highAdd += 1;
  49324. }
  49325. this.low = lowAdd | 0;
  49326. this.high = highAdd | 0;
  49327. }
  49328. copyTo(bytes, offset) {
  49329. bytes[offset] = this.high >>> 24 & 0xff;
  49330. bytes[offset + 1] = this.high >> 16 & 0xff;
  49331. bytes[offset + 2] = this.high >> 8 & 0xff;
  49332. bytes[offset + 3] = this.high & 0xff;
  49333. bytes[offset + 4] = this.low >>> 24 & 0xff;
  49334. bytes[offset + 5] = this.low >> 16 & 0xff;
  49335. bytes[offset + 6] = this.low >> 8 & 0xff;
  49336. bytes[offset + 7] = this.low & 0xff;
  49337. }
  49338. assign(word) {
  49339. this.high = word.high;
  49340. this.low = word.low;
  49341. }
  49342. }
  49343. const calculateSHA256 = function calculateSHA256Closure() {
  49344. function rotr(x, n) {
  49345. return x >>> n | x << 32 - n;
  49346. }
  49347. function ch(x, y, z) {
  49348. return x & y ^ ~x & z;
  49349. }
  49350. function maj(x, y, z) {
  49351. return x & y ^ x & z ^ y & z;
  49352. }
  49353. function sigma(x) {
  49354. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  49355. }
  49356. function sigmaPrime(x) {
  49357. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  49358. }
  49359. function littleSigma(x) {
  49360. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  49361. }
  49362. function littleSigmaPrime(x) {
  49363. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  49364. }
  49365. 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];
  49366. function hash(data, offset, length) {
  49367. let h0 = 0x6a09e667,
  49368. h1 = 0xbb67ae85,
  49369. h2 = 0x3c6ef372,
  49370. h3 = 0xa54ff53a,
  49371. h4 = 0x510e527f,
  49372. h5 = 0x9b05688c,
  49373. h6 = 0x1f83d9ab,
  49374. h7 = 0x5be0cd19;
  49375. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  49376. const padded = new Uint8Array(paddedLength);
  49377. let i, j;
  49378. for (i = 0; i < length; ++i) {
  49379. padded[i] = data[offset++];
  49380. }
  49381. padded[i++] = 0x80;
  49382. const n = paddedLength - 8;
  49383. while (i < n) {
  49384. padded[i++] = 0;
  49385. }
  49386. padded[i++] = 0;
  49387. padded[i++] = 0;
  49388. padded[i++] = 0;
  49389. padded[i++] = length >>> 29 & 0xff;
  49390. padded[i++] = length >> 21 & 0xff;
  49391. padded[i++] = length >> 13 & 0xff;
  49392. padded[i++] = length >> 5 & 0xff;
  49393. padded[i++] = length << 3 & 0xff;
  49394. const w = new Uint32Array(64);
  49395. for (i = 0; i < paddedLength;) {
  49396. for (j = 0; j < 16; ++j) {
  49397. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  49398. i += 4;
  49399. }
  49400. for (j = 16; j < 64; ++j) {
  49401. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  49402. }
  49403. let a = h0,
  49404. b = h1,
  49405. c = h2,
  49406. d = h3,
  49407. e = h4,
  49408. f = h5,
  49409. g = h6,
  49410. h = h7,
  49411. t1,
  49412. t2;
  49413. for (j = 0; j < 64; ++j) {
  49414. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  49415. t2 = sigma(a) + maj(a, b, c);
  49416. h = g;
  49417. g = f;
  49418. f = e;
  49419. e = d + t1 | 0;
  49420. d = c;
  49421. c = b;
  49422. b = a;
  49423. a = t1 + t2 | 0;
  49424. }
  49425. h0 = h0 + a | 0;
  49426. h1 = h1 + b | 0;
  49427. h2 = h2 + c | 0;
  49428. h3 = h3 + d | 0;
  49429. h4 = h4 + e | 0;
  49430. h5 = h5 + f | 0;
  49431. h6 = h6 + g | 0;
  49432. h7 = h7 + h | 0;
  49433. }
  49434. 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]);
  49435. }
  49436. return hash;
  49437. }();
  49438. exports.calculateSHA256 = calculateSHA256;
  49439. const calculateSHA512 = function calculateSHA512Closure() {
  49440. function ch(result, x, y, z, tmp) {
  49441. result.assign(x);
  49442. result.and(y);
  49443. tmp.assign(x);
  49444. tmp.not();
  49445. tmp.and(z);
  49446. result.xor(tmp);
  49447. }
  49448. function maj(result, x, y, z, tmp) {
  49449. result.assign(x);
  49450. result.and(y);
  49451. tmp.assign(x);
  49452. tmp.and(z);
  49453. result.xor(tmp);
  49454. tmp.assign(y);
  49455. tmp.and(z);
  49456. result.xor(tmp);
  49457. }
  49458. function sigma(result, x, tmp) {
  49459. result.assign(x);
  49460. result.rotateRight(28);
  49461. tmp.assign(x);
  49462. tmp.rotateRight(34);
  49463. result.xor(tmp);
  49464. tmp.assign(x);
  49465. tmp.rotateRight(39);
  49466. result.xor(tmp);
  49467. }
  49468. function sigmaPrime(result, x, tmp) {
  49469. result.assign(x);
  49470. result.rotateRight(14);
  49471. tmp.assign(x);
  49472. tmp.rotateRight(18);
  49473. result.xor(tmp);
  49474. tmp.assign(x);
  49475. tmp.rotateRight(41);
  49476. result.xor(tmp);
  49477. }
  49478. function littleSigma(result, x, tmp) {
  49479. result.assign(x);
  49480. result.rotateRight(1);
  49481. tmp.assign(x);
  49482. tmp.rotateRight(8);
  49483. result.xor(tmp);
  49484. tmp.assign(x);
  49485. tmp.shiftRight(7);
  49486. result.xor(tmp);
  49487. }
  49488. function littleSigmaPrime(result, x, tmp) {
  49489. result.assign(x);
  49490. result.rotateRight(19);
  49491. tmp.assign(x);
  49492. tmp.rotateRight(61);
  49493. result.xor(tmp);
  49494. tmp.assign(x);
  49495. tmp.shiftRight(6);
  49496. result.xor(tmp);
  49497. }
  49498. 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)];
  49499. function hash(data, offset, length, mode384 = false) {
  49500. let h0, h1, h2, h3, h4, h5, h6, h7;
  49501. if (!mode384) {
  49502. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  49503. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  49504. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  49505. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  49506. h4 = new Word64(0x510e527f, 0xade682d1);
  49507. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  49508. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  49509. h7 = new Word64(0x5be0cd19, 0x137e2179);
  49510. } else {
  49511. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  49512. h1 = new Word64(0x629a292a, 0x367cd507);
  49513. h2 = new Word64(0x9159015a, 0x3070dd17);
  49514. h3 = new Word64(0x152fecd8, 0xf70e5939);
  49515. h4 = new Word64(0x67332667, 0xffc00b31);
  49516. h5 = new Word64(0x8eb44a87, 0x68581511);
  49517. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  49518. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  49519. }
  49520. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  49521. const padded = new Uint8Array(paddedLength);
  49522. let i, j;
  49523. for (i = 0; i < length; ++i) {
  49524. padded[i] = data[offset++];
  49525. }
  49526. padded[i++] = 0x80;
  49527. const n = paddedLength - 16;
  49528. while (i < n) {
  49529. padded[i++] = 0;
  49530. }
  49531. padded[i++] = 0;
  49532. padded[i++] = 0;
  49533. padded[i++] = 0;
  49534. padded[i++] = 0;
  49535. padded[i++] = 0;
  49536. padded[i++] = 0;
  49537. padded[i++] = 0;
  49538. padded[i++] = 0;
  49539. padded[i++] = 0;
  49540. padded[i++] = 0;
  49541. padded[i++] = 0;
  49542. padded[i++] = length >>> 29 & 0xff;
  49543. padded[i++] = length >> 21 & 0xff;
  49544. padded[i++] = length >> 13 & 0xff;
  49545. padded[i++] = length >> 5 & 0xff;
  49546. padded[i++] = length << 3 & 0xff;
  49547. const w = new Array(80);
  49548. for (i = 0; i < 80; i++) {
  49549. w[i] = new Word64(0, 0);
  49550. }
  49551. let a = new Word64(0, 0),
  49552. b = new Word64(0, 0),
  49553. c = new Word64(0, 0);
  49554. let d = new Word64(0, 0),
  49555. e = new Word64(0, 0),
  49556. f = new Word64(0, 0);
  49557. let g = new Word64(0, 0),
  49558. h = new Word64(0, 0);
  49559. const t1 = new Word64(0, 0),
  49560. t2 = new Word64(0, 0);
  49561. const tmp1 = new Word64(0, 0),
  49562. tmp2 = new Word64(0, 0);
  49563. let tmp3;
  49564. for (i = 0; i < paddedLength;) {
  49565. for (j = 0; j < 16; ++j) {
  49566. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  49567. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  49568. i += 8;
  49569. }
  49570. for (j = 16; j < 80; ++j) {
  49571. tmp3 = w[j];
  49572. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  49573. tmp3.add(w[j - 7]);
  49574. littleSigma(tmp1, w[j - 15], tmp2);
  49575. tmp3.add(tmp1);
  49576. tmp3.add(w[j - 16]);
  49577. }
  49578. a.assign(h0);
  49579. b.assign(h1);
  49580. c.assign(h2);
  49581. d.assign(h3);
  49582. e.assign(h4);
  49583. f.assign(h5);
  49584. g.assign(h6);
  49585. h.assign(h7);
  49586. for (j = 0; j < 80; ++j) {
  49587. t1.assign(h);
  49588. sigmaPrime(tmp1, e, tmp2);
  49589. t1.add(tmp1);
  49590. ch(tmp1, e, f, g, tmp2);
  49591. t1.add(tmp1);
  49592. t1.add(k[j]);
  49593. t1.add(w[j]);
  49594. sigma(t2, a, tmp2);
  49595. maj(tmp1, a, b, c, tmp2);
  49596. t2.add(tmp1);
  49597. tmp3 = h;
  49598. h = g;
  49599. g = f;
  49600. f = e;
  49601. d.add(t1);
  49602. e = d;
  49603. d = c;
  49604. c = b;
  49605. b = a;
  49606. tmp3.assign(t1);
  49607. tmp3.add(t2);
  49608. a = tmp3;
  49609. }
  49610. h0.add(a);
  49611. h1.add(b);
  49612. h2.add(c);
  49613. h3.add(d);
  49614. h4.add(e);
  49615. h5.add(f);
  49616. h6.add(g);
  49617. h7.add(h);
  49618. }
  49619. let result;
  49620. if (!mode384) {
  49621. result = new Uint8Array(64);
  49622. h0.copyTo(result, 0);
  49623. h1.copyTo(result, 8);
  49624. h2.copyTo(result, 16);
  49625. h3.copyTo(result, 24);
  49626. h4.copyTo(result, 32);
  49627. h5.copyTo(result, 40);
  49628. h6.copyTo(result, 48);
  49629. h7.copyTo(result, 56);
  49630. } else {
  49631. result = new Uint8Array(48);
  49632. h0.copyTo(result, 0);
  49633. h1.copyTo(result, 8);
  49634. h2.copyTo(result, 16);
  49635. h3.copyTo(result, 24);
  49636. h4.copyTo(result, 32);
  49637. h5.copyTo(result, 40);
  49638. }
  49639. return result;
  49640. }
  49641. return hash;
  49642. }();
  49643. exports.calculateSHA512 = calculateSHA512;
  49644. function calculateSHA384(data, offset, length) {
  49645. return calculateSHA512(data, offset, length, true);
  49646. }
  49647. class NullCipher {
  49648. decryptBlock(data) {
  49649. return data;
  49650. }
  49651. encrypt(data) {
  49652. return data;
  49653. }
  49654. }
  49655. class AESBaseCipher {
  49656. constructor() {
  49657. if (this.constructor === AESBaseCipher) {
  49658. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  49659. }
  49660. 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]);
  49661. 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]);
  49662. 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]);
  49663. this._mixCol = new Uint8Array(256);
  49664. for (let i = 0; i < 256; i++) {
  49665. if (i < 128) {
  49666. this._mixCol[i] = i << 1;
  49667. } else {
  49668. this._mixCol[i] = i << 1 ^ 0x1b;
  49669. }
  49670. }
  49671. this.buffer = new Uint8Array(16);
  49672. this.bufferPosition = 0;
  49673. }
  49674. _expandKey(cipherKey) {
  49675. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  49676. }
  49677. _decrypt(input, key) {
  49678. let t, u, v;
  49679. const state = new Uint8Array(16);
  49680. state.set(input);
  49681. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49682. state[j] ^= key[k];
  49683. }
  49684. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  49685. t = state[13];
  49686. state[13] = state[9];
  49687. state[9] = state[5];
  49688. state[5] = state[1];
  49689. state[1] = t;
  49690. t = state[14];
  49691. u = state[10];
  49692. state[14] = state[6];
  49693. state[10] = state[2];
  49694. state[6] = t;
  49695. state[2] = u;
  49696. t = state[15];
  49697. u = state[11];
  49698. v = state[7];
  49699. state[15] = state[3];
  49700. state[11] = t;
  49701. state[7] = u;
  49702. state[3] = v;
  49703. for (let j = 0; j < 16; ++j) {
  49704. state[j] = this._inv_s[state[j]];
  49705. }
  49706. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49707. state[j] ^= key[k];
  49708. }
  49709. for (let j = 0; j < 16; j += 4) {
  49710. const s0 = this._mix[state[j]];
  49711. const s1 = this._mix[state[j + 1]];
  49712. const s2 = this._mix[state[j + 2]];
  49713. const s3 = this._mix[state[j + 3]];
  49714. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  49715. state[j] = t >>> 24 & 0xff;
  49716. state[j + 1] = t >> 16 & 0xff;
  49717. state[j + 2] = t >> 8 & 0xff;
  49718. state[j + 3] = t & 0xff;
  49719. }
  49720. }
  49721. t = state[13];
  49722. state[13] = state[9];
  49723. state[9] = state[5];
  49724. state[5] = state[1];
  49725. state[1] = t;
  49726. t = state[14];
  49727. u = state[10];
  49728. state[14] = state[6];
  49729. state[10] = state[2];
  49730. state[6] = t;
  49731. state[2] = u;
  49732. t = state[15];
  49733. u = state[11];
  49734. v = state[7];
  49735. state[15] = state[3];
  49736. state[11] = t;
  49737. state[7] = u;
  49738. state[3] = v;
  49739. for (let j = 0; j < 16; ++j) {
  49740. state[j] = this._inv_s[state[j]];
  49741. state[j] ^= key[j];
  49742. }
  49743. return state;
  49744. }
  49745. _encrypt(input, key) {
  49746. const s = this._s;
  49747. let t, u, v;
  49748. const state = new Uint8Array(16);
  49749. state.set(input);
  49750. for (let j = 0; j < 16; ++j) {
  49751. state[j] ^= key[j];
  49752. }
  49753. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  49754. for (let j = 0; j < 16; ++j) {
  49755. state[j] = s[state[j]];
  49756. }
  49757. v = state[1];
  49758. state[1] = state[5];
  49759. state[5] = state[9];
  49760. state[9] = state[13];
  49761. state[13] = v;
  49762. v = state[2];
  49763. u = state[6];
  49764. state[2] = state[10];
  49765. state[6] = state[14];
  49766. state[10] = v;
  49767. state[14] = u;
  49768. v = state[3];
  49769. u = state[7];
  49770. t = state[11];
  49771. state[3] = state[15];
  49772. state[7] = v;
  49773. state[11] = u;
  49774. state[15] = t;
  49775. for (let j = 0; j < 16; j += 4) {
  49776. const s0 = state[j + 0];
  49777. const s1 = state[j + 1];
  49778. const s2 = state[j + 2];
  49779. const s3 = state[j + 3];
  49780. t = s0 ^ s1 ^ s2 ^ s3;
  49781. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  49782. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  49783. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  49784. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  49785. }
  49786. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49787. state[j] ^= key[k];
  49788. }
  49789. }
  49790. for (let j = 0; j < 16; ++j) {
  49791. state[j] = s[state[j]];
  49792. }
  49793. v = state[1];
  49794. state[1] = state[5];
  49795. state[5] = state[9];
  49796. state[9] = state[13];
  49797. state[13] = v;
  49798. v = state[2];
  49799. u = state[6];
  49800. state[2] = state[10];
  49801. state[6] = state[14];
  49802. state[10] = v;
  49803. state[14] = u;
  49804. v = state[3];
  49805. u = state[7];
  49806. t = state[11];
  49807. state[3] = state[15];
  49808. state[7] = v;
  49809. state[11] = u;
  49810. state[15] = t;
  49811. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49812. state[j] ^= key[k];
  49813. }
  49814. return state;
  49815. }
  49816. _decryptBlock2(data, finalize) {
  49817. const sourceLength = data.length;
  49818. let buffer = this.buffer,
  49819. bufferLength = this.bufferPosition;
  49820. const result = [];
  49821. let iv = this.iv;
  49822. for (let i = 0; i < sourceLength; ++i) {
  49823. buffer[bufferLength] = data[i];
  49824. ++bufferLength;
  49825. if (bufferLength < 16) {
  49826. continue;
  49827. }
  49828. const plain = this._decrypt(buffer, this._key);
  49829. for (let j = 0; j < 16; ++j) {
  49830. plain[j] ^= iv[j];
  49831. }
  49832. iv = buffer;
  49833. result.push(plain);
  49834. buffer = new Uint8Array(16);
  49835. bufferLength = 0;
  49836. }
  49837. this.buffer = buffer;
  49838. this.bufferLength = bufferLength;
  49839. this.iv = iv;
  49840. if (result.length === 0) {
  49841. return new Uint8Array(0);
  49842. }
  49843. let outputLength = 16 * result.length;
  49844. if (finalize) {
  49845. const lastBlock = result[result.length - 1];
  49846. let psLen = lastBlock[15];
  49847. if (psLen <= 16) {
  49848. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49849. if (lastBlock[i] !== psLen) {
  49850. psLen = 0;
  49851. break;
  49852. }
  49853. }
  49854. outputLength -= psLen;
  49855. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49856. }
  49857. }
  49858. const output = new Uint8Array(outputLength);
  49859. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49860. output.set(result[i], j);
  49861. }
  49862. return output;
  49863. }
  49864. decryptBlock(data, finalize, iv = null) {
  49865. const sourceLength = data.length;
  49866. const buffer = this.buffer;
  49867. let bufferLength = this.bufferPosition;
  49868. if (iv) {
  49869. this.iv = iv;
  49870. } else {
  49871. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49872. buffer[bufferLength] = data[i];
  49873. }
  49874. if (bufferLength < 16) {
  49875. this.bufferLength = bufferLength;
  49876. return new Uint8Array(0);
  49877. }
  49878. this.iv = buffer;
  49879. data = data.subarray(16);
  49880. }
  49881. this.buffer = new Uint8Array(16);
  49882. this.bufferLength = 0;
  49883. this.decryptBlock = this._decryptBlock2;
  49884. return this.decryptBlock(data, finalize);
  49885. }
  49886. encrypt(data, iv) {
  49887. const sourceLength = data.length;
  49888. let buffer = this.buffer,
  49889. bufferLength = this.bufferPosition;
  49890. const result = [];
  49891. if (!iv) {
  49892. iv = new Uint8Array(16);
  49893. }
  49894. for (let i = 0; i < sourceLength; ++i) {
  49895. buffer[bufferLength] = data[i];
  49896. ++bufferLength;
  49897. if (bufferLength < 16) {
  49898. continue;
  49899. }
  49900. for (let j = 0; j < 16; ++j) {
  49901. buffer[j] ^= iv[j];
  49902. }
  49903. const cipher = this._encrypt(buffer, this._key);
  49904. iv = cipher;
  49905. result.push(cipher);
  49906. buffer = new Uint8Array(16);
  49907. bufferLength = 0;
  49908. }
  49909. this.buffer = buffer;
  49910. this.bufferLength = bufferLength;
  49911. this.iv = iv;
  49912. if (result.length === 0) {
  49913. return new Uint8Array(0);
  49914. }
  49915. const outputLength = 16 * result.length;
  49916. const output = new Uint8Array(outputLength);
  49917. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49918. output.set(result[i], j);
  49919. }
  49920. return output;
  49921. }
  49922. }
  49923. class AES128Cipher extends AESBaseCipher {
  49924. constructor(key) {
  49925. super();
  49926. this._cyclesOfRepetition = 10;
  49927. this._keySize = 160;
  49928. 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]);
  49929. this._key = this._expandKey(key);
  49930. }
  49931. _expandKey(cipherKey) {
  49932. const b = 176;
  49933. const s = this._s;
  49934. const rcon = this._rcon;
  49935. const result = new Uint8Array(b);
  49936. result.set(cipherKey);
  49937. for (let j = 16, i = 1; j < b; ++i) {
  49938. let t1 = result[j - 3];
  49939. let t2 = result[j - 2];
  49940. let t3 = result[j - 1];
  49941. let t4 = result[j - 4];
  49942. t1 = s[t1];
  49943. t2 = s[t2];
  49944. t3 = s[t3];
  49945. t4 = s[t4];
  49946. t1 ^= rcon[i];
  49947. for (let n = 0; n < 4; ++n) {
  49948. result[j] = t1 ^= result[j - 16];
  49949. j++;
  49950. result[j] = t2 ^= result[j - 16];
  49951. j++;
  49952. result[j] = t3 ^= result[j - 16];
  49953. j++;
  49954. result[j] = t4 ^= result[j - 16];
  49955. j++;
  49956. }
  49957. }
  49958. return result;
  49959. }
  49960. }
  49961. exports.AES128Cipher = AES128Cipher;
  49962. class AES256Cipher extends AESBaseCipher {
  49963. constructor(key) {
  49964. super();
  49965. this._cyclesOfRepetition = 14;
  49966. this._keySize = 224;
  49967. this._key = this._expandKey(key);
  49968. }
  49969. _expandKey(cipherKey) {
  49970. const b = 240;
  49971. const s = this._s;
  49972. const result = new Uint8Array(b);
  49973. result.set(cipherKey);
  49974. let r = 1;
  49975. let t1, t2, t3, t4;
  49976. for (let j = 32, i = 1; j < b; ++i) {
  49977. if (j % 32 === 16) {
  49978. t1 = s[t1];
  49979. t2 = s[t2];
  49980. t3 = s[t3];
  49981. t4 = s[t4];
  49982. } else if (j % 32 === 0) {
  49983. t1 = result[j - 3];
  49984. t2 = result[j - 2];
  49985. t3 = result[j - 1];
  49986. t4 = result[j - 4];
  49987. t1 = s[t1];
  49988. t2 = s[t2];
  49989. t3 = s[t3];
  49990. t4 = s[t4];
  49991. t1 ^= r;
  49992. if ((r <<= 1) >= 256) {
  49993. r = (r ^ 0x1b) & 0xff;
  49994. }
  49995. }
  49996. for (let n = 0; n < 4; ++n) {
  49997. result[j] = t1 ^= result[j - 32];
  49998. j++;
  49999. result[j] = t2 ^= result[j - 32];
  50000. j++;
  50001. result[j] = t3 ^= result[j - 32];
  50002. j++;
  50003. result[j] = t4 ^= result[j - 32];
  50004. j++;
  50005. }
  50006. }
  50007. return result;
  50008. }
  50009. }
  50010. exports.AES256Cipher = AES256Cipher;
  50011. class PDF17 {
  50012. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  50013. const hashData = new Uint8Array(password.length + 56);
  50014. hashData.set(password, 0);
  50015. hashData.set(ownerValidationSalt, password.length);
  50016. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  50017. const result = calculateSHA256(hashData, 0, hashData.length);
  50018. return (0, _util.isArrayEqual)(result, ownerPassword);
  50019. }
  50020. checkUserPassword(password, userValidationSalt, userPassword) {
  50021. const hashData = new Uint8Array(password.length + 8);
  50022. hashData.set(password, 0);
  50023. hashData.set(userValidationSalt, password.length);
  50024. const result = calculateSHA256(hashData, 0, hashData.length);
  50025. return (0, _util.isArrayEqual)(result, userPassword);
  50026. }
  50027. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  50028. const hashData = new Uint8Array(password.length + 56);
  50029. hashData.set(password, 0);
  50030. hashData.set(ownerKeySalt, password.length);
  50031. hashData.set(userBytes, password.length + ownerKeySalt.length);
  50032. const key = calculateSHA256(hashData, 0, hashData.length);
  50033. const cipher = new AES256Cipher(key);
  50034. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  50035. }
  50036. getUserKey(password, userKeySalt, userEncryption) {
  50037. const hashData = new Uint8Array(password.length + 8);
  50038. hashData.set(password, 0);
  50039. hashData.set(userKeySalt, password.length);
  50040. const key = calculateSHA256(hashData, 0, hashData.length);
  50041. const cipher = new AES256Cipher(key);
  50042. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  50043. }
  50044. }
  50045. exports.PDF17 = PDF17;
  50046. const PDF20 = function PDF20Closure() {
  50047. function calculatePDF20Hash(password, input, userBytes) {
  50048. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  50049. let e = [0];
  50050. let i = 0;
  50051. while (i < 64 || e[e.length - 1] > i - 32) {
  50052. const combinedLength = password.length + k.length + userBytes.length,
  50053. combinedArray = new Uint8Array(combinedLength);
  50054. let writeOffset = 0;
  50055. combinedArray.set(password, writeOffset);
  50056. writeOffset += password.length;
  50057. combinedArray.set(k, writeOffset);
  50058. writeOffset += k.length;
  50059. combinedArray.set(userBytes, writeOffset);
  50060. const k1 = new Uint8Array(combinedLength * 64);
  50061. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  50062. k1.set(combinedArray, pos);
  50063. }
  50064. const cipher = new AES128Cipher(k.subarray(0, 16));
  50065. e = cipher.encrypt(k1, k.subarray(16, 32));
  50066. let remainder = 0;
  50067. for (let z = 0; z < 16; z++) {
  50068. remainder *= 256 % 3;
  50069. remainder %= 3;
  50070. remainder += (e[z] >>> 0) % 3;
  50071. remainder %= 3;
  50072. }
  50073. if (remainder === 0) {
  50074. k = calculateSHA256(e, 0, e.length);
  50075. } else if (remainder === 1) {
  50076. k = calculateSHA384(e, 0, e.length);
  50077. } else if (remainder === 2) {
  50078. k = calculateSHA512(e, 0, e.length);
  50079. }
  50080. i++;
  50081. }
  50082. return k.subarray(0, 32);
  50083. }
  50084. class PDF20 {
  50085. hash(password, concatBytes, userBytes) {
  50086. return calculatePDF20Hash(password, concatBytes, userBytes);
  50087. }
  50088. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  50089. const hashData = new Uint8Array(password.length + 56);
  50090. hashData.set(password, 0);
  50091. hashData.set(ownerValidationSalt, password.length);
  50092. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  50093. const result = calculatePDF20Hash(password, hashData, userBytes);
  50094. return (0, _util.isArrayEqual)(result, ownerPassword);
  50095. }
  50096. checkUserPassword(password, userValidationSalt, userPassword) {
  50097. const hashData = new Uint8Array(password.length + 8);
  50098. hashData.set(password, 0);
  50099. hashData.set(userValidationSalt, password.length);
  50100. const result = calculatePDF20Hash(password, hashData, []);
  50101. return (0, _util.isArrayEqual)(result, userPassword);
  50102. }
  50103. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  50104. const hashData = new Uint8Array(password.length + 56);
  50105. hashData.set(password, 0);
  50106. hashData.set(ownerKeySalt, password.length);
  50107. hashData.set(userBytes, password.length + ownerKeySalt.length);
  50108. const key = calculatePDF20Hash(password, hashData, userBytes);
  50109. const cipher = new AES256Cipher(key);
  50110. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  50111. }
  50112. getUserKey(password, userKeySalt, userEncryption) {
  50113. const hashData = new Uint8Array(password.length + 8);
  50114. hashData.set(password, 0);
  50115. hashData.set(userKeySalt, password.length);
  50116. const key = calculatePDF20Hash(password, hashData, []);
  50117. const cipher = new AES256Cipher(key);
  50118. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  50119. }
  50120. }
  50121. return PDF20;
  50122. }();
  50123. exports.PDF20 = PDF20;
  50124. class CipherTransform {
  50125. constructor(stringCipherConstructor, streamCipherConstructor) {
  50126. this.StringCipherConstructor = stringCipherConstructor;
  50127. this.StreamCipherConstructor = streamCipherConstructor;
  50128. }
  50129. createStream(stream, length) {
  50130. const cipher = new this.StreamCipherConstructor();
  50131. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  50132. return cipher.decryptBlock(data, finalize);
  50133. });
  50134. }
  50135. decryptString(s) {
  50136. const cipher = new this.StringCipherConstructor();
  50137. let data = (0, _util.stringToBytes)(s);
  50138. data = cipher.decryptBlock(data, true);
  50139. return (0, _util.bytesToString)(data);
  50140. }
  50141. encryptString(s) {
  50142. const cipher = new this.StringCipherConstructor();
  50143. if (cipher instanceof AESBaseCipher) {
  50144. const strLen = s.length;
  50145. const pad = 16 - strLen % 16;
  50146. s += String.fromCharCode(pad).repeat(pad);
  50147. const iv = new Uint8Array(16);
  50148. if (typeof crypto !== "undefined") {
  50149. crypto.getRandomValues(iv);
  50150. } else {
  50151. for (let i = 0; i < 16; i++) {
  50152. iv[i] = Math.floor(256 * Math.random());
  50153. }
  50154. }
  50155. let data = (0, _util.stringToBytes)(s);
  50156. data = cipher.encrypt(data, iv);
  50157. const buf = new Uint8Array(16 + data.length);
  50158. buf.set(iv);
  50159. buf.set(data, 16);
  50160. return (0, _util.bytesToString)(buf);
  50161. }
  50162. let data = (0, _util.stringToBytes)(s);
  50163. data = cipher.encrypt(data);
  50164. return (0, _util.bytesToString)(data);
  50165. }
  50166. }
  50167. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  50168. 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]);
  50169. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  50170. if (password) {
  50171. const passwordLength = Math.min(127, password.length);
  50172. password = password.subarray(0, passwordLength);
  50173. } else {
  50174. password = [];
  50175. }
  50176. let pdfAlgorithm;
  50177. if (revision === 6) {
  50178. pdfAlgorithm = new PDF20();
  50179. } else {
  50180. pdfAlgorithm = new PDF17();
  50181. }
  50182. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  50183. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  50184. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  50185. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  50186. }
  50187. return null;
  50188. }
  50189. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  50190. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  50191. const hashData = new Uint8Array(hashDataSize);
  50192. let i = 0,
  50193. j,
  50194. n;
  50195. if (password) {
  50196. n = Math.min(32, password.length);
  50197. for (; i < n; ++i) {
  50198. hashData[i] = password[i];
  50199. }
  50200. }
  50201. j = 0;
  50202. while (i < 32) {
  50203. hashData[i++] = defaultPasswordBytes[j++];
  50204. }
  50205. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  50206. hashData[i++] = ownerPassword[j];
  50207. }
  50208. hashData[i++] = flags & 0xff;
  50209. hashData[i++] = flags >> 8 & 0xff;
  50210. hashData[i++] = flags >> 16 & 0xff;
  50211. hashData[i++] = flags >>> 24 & 0xff;
  50212. for (j = 0, n = fileId.length; j < n; ++j) {
  50213. hashData[i++] = fileId[j];
  50214. }
  50215. if (revision >= 4 && !encryptMetadata) {
  50216. hashData[i++] = 0xff;
  50217. hashData[i++] = 0xff;
  50218. hashData[i++] = 0xff;
  50219. hashData[i++] = 0xff;
  50220. }
  50221. let hash = calculateMD5(hashData, 0, i);
  50222. const keyLengthInBytes = keyLength >> 3;
  50223. if (revision >= 3) {
  50224. for (j = 0; j < 50; ++j) {
  50225. hash = calculateMD5(hash, 0, keyLengthInBytes);
  50226. }
  50227. }
  50228. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  50229. let cipher, checkData;
  50230. if (revision >= 3) {
  50231. for (i = 0; i < 32; ++i) {
  50232. hashData[i] = defaultPasswordBytes[i];
  50233. }
  50234. for (j = 0, n = fileId.length; j < n; ++j) {
  50235. hashData[i++] = fileId[j];
  50236. }
  50237. cipher = new ARCFourCipher(encryptionKey);
  50238. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  50239. n = encryptionKey.length;
  50240. const derivedKey = new Uint8Array(n);
  50241. for (j = 1; j <= 19; ++j) {
  50242. for (let k = 0; k < n; ++k) {
  50243. derivedKey[k] = encryptionKey[k] ^ j;
  50244. }
  50245. cipher = new ARCFourCipher(derivedKey);
  50246. checkData = cipher.encryptBlock(checkData);
  50247. }
  50248. for (j = 0, n = checkData.length; j < n; ++j) {
  50249. if (userPassword[j] !== checkData[j]) {
  50250. return null;
  50251. }
  50252. }
  50253. } else {
  50254. cipher = new ARCFourCipher(encryptionKey);
  50255. checkData = cipher.encryptBlock(defaultPasswordBytes);
  50256. for (j = 0, n = checkData.length; j < n; ++j) {
  50257. if (userPassword[j] !== checkData[j]) {
  50258. return null;
  50259. }
  50260. }
  50261. }
  50262. return encryptionKey;
  50263. }
  50264. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  50265. const hashData = new Uint8Array(32);
  50266. let i = 0;
  50267. const n = Math.min(32, password.length);
  50268. for (; i < n; ++i) {
  50269. hashData[i] = password[i];
  50270. }
  50271. let j = 0;
  50272. while (i < 32) {
  50273. hashData[i++] = defaultPasswordBytes[j++];
  50274. }
  50275. let hash = calculateMD5(hashData, 0, i);
  50276. const keyLengthInBytes = keyLength >> 3;
  50277. if (revision >= 3) {
  50278. for (j = 0; j < 50; ++j) {
  50279. hash = calculateMD5(hash, 0, hash.length);
  50280. }
  50281. }
  50282. let cipher, userPassword;
  50283. if (revision >= 3) {
  50284. userPassword = ownerPassword;
  50285. const derivedKey = new Uint8Array(keyLengthInBytes);
  50286. for (j = 19; j >= 0; j--) {
  50287. for (let k = 0; k < keyLengthInBytes; ++k) {
  50288. derivedKey[k] = hash[k] ^ j;
  50289. }
  50290. cipher = new ARCFourCipher(derivedKey);
  50291. userPassword = cipher.encryptBlock(userPassword);
  50292. }
  50293. } else {
  50294. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  50295. userPassword = cipher.encryptBlock(ownerPassword);
  50296. }
  50297. return userPassword;
  50298. }
  50299. const identityName = _primitives.Name.get("Identity");
  50300. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  50301. const key = new Uint8Array(encryptionKey.length + 9);
  50302. const n = encryptionKey.length;
  50303. let i;
  50304. for (i = 0; i < n; ++i) {
  50305. key[i] = encryptionKey[i];
  50306. }
  50307. key[i++] = num & 0xff;
  50308. key[i++] = num >> 8 & 0xff;
  50309. key[i++] = num >> 16 & 0xff;
  50310. key[i++] = gen & 0xff;
  50311. key[i++] = gen >> 8 & 0xff;
  50312. if (isAes) {
  50313. key[i++] = 0x73;
  50314. key[i++] = 0x41;
  50315. key[i++] = 0x6c;
  50316. key[i++] = 0x54;
  50317. }
  50318. const hash = calculateMD5(key, 0, i);
  50319. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  50320. }
  50321. function buildCipherConstructor(cf, name, num, gen, key) {
  50322. if (!(name instanceof _primitives.Name)) {
  50323. throw new _util.FormatError("Invalid crypt filter name.");
  50324. }
  50325. const cryptFilter = cf.get(name.name);
  50326. let cfm;
  50327. if (cryptFilter !== null && cryptFilter !== undefined) {
  50328. cfm = cryptFilter.get("CFM");
  50329. }
  50330. if (!cfm || cfm.name === "None") {
  50331. return function cipherTransformFactoryBuildCipherConstructorNone() {
  50332. return new NullCipher();
  50333. };
  50334. }
  50335. if (cfm.name === "V2") {
  50336. return function cipherTransformFactoryBuildCipherConstructorV2() {
  50337. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  50338. };
  50339. }
  50340. if (cfm.name === "AESV2") {
  50341. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  50342. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  50343. };
  50344. }
  50345. if (cfm.name === "AESV3") {
  50346. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  50347. return new AES256Cipher(key);
  50348. };
  50349. }
  50350. throw new _util.FormatError("Unknown crypto method");
  50351. }
  50352. class CipherTransformFactory {
  50353. constructor(dict, fileId, password) {
  50354. const filter = dict.get("Filter");
  50355. if (!(0, _primitives.isName)(filter, "Standard")) {
  50356. throw new _util.FormatError("unknown encryption method");
  50357. }
  50358. this.filterName = filter.name;
  50359. this.dict = dict;
  50360. const algorithm = dict.get("V");
  50361. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  50362. throw new _util.FormatError("unsupported encryption algorithm");
  50363. }
  50364. this.algorithm = algorithm;
  50365. let keyLength = dict.get("Length");
  50366. if (!keyLength) {
  50367. if (algorithm <= 3) {
  50368. keyLength = 40;
  50369. } else {
  50370. const cfDict = dict.get("CF");
  50371. const streamCryptoName = dict.get("StmF");
  50372. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  50373. cfDict.suppressEncryption = true;
  50374. const handlerDict = cfDict.get(streamCryptoName.name);
  50375. keyLength = handlerDict && handlerDict.get("Length") || 128;
  50376. if (keyLength < 40) {
  50377. keyLength <<= 3;
  50378. }
  50379. }
  50380. }
  50381. }
  50382. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  50383. throw new _util.FormatError("invalid key length");
  50384. }
  50385. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  50386. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  50387. const flags = dict.get("P");
  50388. const revision = dict.get("R");
  50389. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  50390. this.encryptMetadata = encryptMetadata;
  50391. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  50392. let passwordBytes;
  50393. if (password) {
  50394. if (revision === 6) {
  50395. try {
  50396. password = (0, _util.utf8StringToString)(password);
  50397. } catch (ex) {
  50398. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  50399. }
  50400. }
  50401. passwordBytes = (0, _util.stringToBytes)(password);
  50402. }
  50403. let encryptionKey;
  50404. if (algorithm !== 5) {
  50405. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  50406. } else {
  50407. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  50408. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  50409. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  50410. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  50411. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  50412. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  50413. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  50414. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  50415. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  50416. }
  50417. if (!encryptionKey && !password) {
  50418. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  50419. } else if (!encryptionKey && password) {
  50420. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  50421. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  50422. }
  50423. if (!encryptionKey) {
  50424. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  50425. }
  50426. this.encryptionKey = encryptionKey;
  50427. if (algorithm >= 4) {
  50428. const cf = dict.get("CF");
  50429. if (cf instanceof _primitives.Dict) {
  50430. cf.suppressEncryption = true;
  50431. }
  50432. this.cf = cf;
  50433. this.stmf = dict.get("StmF") || identityName;
  50434. this.strf = dict.get("StrF") || identityName;
  50435. this.eff = dict.get("EFF") || this.stmf;
  50436. }
  50437. }
  50438. createCipherTransform(num, gen) {
  50439. if (this.algorithm === 4 || this.algorithm === 5) {
  50440. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  50441. }
  50442. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  50443. const cipherConstructor = function buildCipherCipherConstructor() {
  50444. return new ARCFourCipher(key);
  50445. };
  50446. return new CipherTransform(cipherConstructor, cipherConstructor);
  50447. }
  50448. }
  50449. return CipherTransformFactory;
  50450. }();
  50451. exports.CipherTransformFactory = CipherTransformFactory;
  50452. /***/ }),
  50453. /* 75 */
  50454. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50455. Object.defineProperty(exports, "__esModule", ({
  50456. value: true
  50457. }));
  50458. exports.DecryptStream = void 0;
  50459. var _decode_stream = __w_pdfjs_require__(29);
  50460. const chunkSize = 512;
  50461. class DecryptStream extends _decode_stream.DecodeStream {
  50462. constructor(str, maybeLength, decrypt) {
  50463. super(maybeLength);
  50464. this.str = str;
  50465. this.dict = str.dict;
  50466. this.decrypt = decrypt;
  50467. this.nextChunk = null;
  50468. this.initialized = false;
  50469. }
  50470. readBlock() {
  50471. let chunk;
  50472. if (this.initialized) {
  50473. chunk = this.nextChunk;
  50474. } else {
  50475. chunk = this.str.getBytes(chunkSize);
  50476. this.initialized = true;
  50477. }
  50478. if (!chunk || chunk.length === 0) {
  50479. this.eof = true;
  50480. return;
  50481. }
  50482. this.nextChunk = this.str.getBytes(chunkSize);
  50483. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  50484. const decrypt = this.decrypt;
  50485. chunk = decrypt(chunk, !hasMoreData);
  50486. let bufferLength = this.bufferLength;
  50487. const n = chunk.length,
  50488. buffer = this.ensureBuffer(bufferLength + n);
  50489. for (let i = 0; i < n; i++) {
  50490. buffer[bufferLength++] = chunk[i];
  50491. }
  50492. this.bufferLength = bufferLength;
  50493. }
  50494. }
  50495. exports.DecryptStream = DecryptStream;
  50496. /***/ }),
  50497. /* 76 */
  50498. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50499. Object.defineProperty(exports, "__esModule", ({
  50500. value: true
  50501. }));
  50502. exports.XFAFactory = void 0;
  50503. var _xfa_object = __w_pdfjs_require__(77);
  50504. var _bind = __w_pdfjs_require__(81);
  50505. var _data = __w_pdfjs_require__(87);
  50506. var _fonts = __w_pdfjs_require__(85);
  50507. var _utils = __w_pdfjs_require__(78);
  50508. var _util = __w_pdfjs_require__(2);
  50509. var _parser = __w_pdfjs_require__(88);
  50510. var _xhtml = __w_pdfjs_require__(98);
  50511. class XFAFactory {
  50512. constructor(data) {
  50513. try {
  50514. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  50515. const binder = new _bind.Binder(this.root);
  50516. this.form = binder.bind();
  50517. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  50518. this.form[_xfa_object.$globalData].template = this.form;
  50519. } catch (e) {
  50520. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  50521. }
  50522. }
  50523. isValid() {
  50524. return this.root && this.form;
  50525. }
  50526. _createPagesHelper() {
  50527. const iterator = this.form[_xfa_object.$toPages]();
  50528. return new Promise((resolve, reject) => {
  50529. const nextIteration = () => {
  50530. try {
  50531. const value = iterator.next();
  50532. if (value.done) {
  50533. resolve(value.value);
  50534. } else {
  50535. setTimeout(nextIteration, 0);
  50536. }
  50537. } catch (e) {
  50538. reject(e);
  50539. }
  50540. };
  50541. setTimeout(nextIteration, 0);
  50542. });
  50543. }
  50544. async _createPages() {
  50545. try {
  50546. this.pages = await this._createPagesHelper();
  50547. this.dims = this.pages.children.map(c => {
  50548. const {
  50549. width,
  50550. height
  50551. } = c.attributes.style;
  50552. return [0, 0, parseInt(width), parseInt(height)];
  50553. });
  50554. } catch (e) {
  50555. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  50556. }
  50557. }
  50558. getBoundingBox(pageIndex) {
  50559. return this.dims[pageIndex];
  50560. }
  50561. async getNumPages() {
  50562. if (!this.pages) {
  50563. await this._createPages();
  50564. }
  50565. return this.dims.length;
  50566. }
  50567. setImages(images) {
  50568. this.form[_xfa_object.$globalData].images = images;
  50569. }
  50570. setFonts(fonts) {
  50571. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  50572. const missingFonts = [];
  50573. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  50574. typeface = (0, _utils.stripQuotes)(typeface);
  50575. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  50576. if (!font) {
  50577. missingFonts.push(typeface);
  50578. }
  50579. }
  50580. if (missingFonts.length > 0) {
  50581. return missingFonts;
  50582. }
  50583. return null;
  50584. }
  50585. appendFonts(fonts, reallyMissingFonts) {
  50586. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  50587. }
  50588. async getPages() {
  50589. if (!this.pages) {
  50590. await this._createPages();
  50591. }
  50592. const pages = this.pages;
  50593. this.pages = null;
  50594. return pages;
  50595. }
  50596. serializeData(storage) {
  50597. return this.dataHandler.serialize(storage);
  50598. }
  50599. static _createDocument(data) {
  50600. if (!data["/xdp:xdp"]) {
  50601. return data["xdp:xdp"];
  50602. }
  50603. return Object.values(data).join("");
  50604. }
  50605. static getRichTextAsHtml(rc) {
  50606. if (!rc || typeof rc !== "string") {
  50607. return null;
  50608. }
  50609. try {
  50610. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  50611. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  50612. const newRoot = _xhtml.XhtmlNamespace.body({});
  50613. newRoot[_xfa_object.$appendChild](root);
  50614. root = newRoot;
  50615. }
  50616. const result = root[_xfa_object.$toHTML]();
  50617. if (!result.success) {
  50618. return null;
  50619. }
  50620. const {
  50621. html
  50622. } = result;
  50623. const {
  50624. attributes
  50625. } = html;
  50626. if (attributes) {
  50627. if (attributes.class) {
  50628. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  50629. }
  50630. attributes.dir = "auto";
  50631. }
  50632. return {
  50633. html,
  50634. str: root[_xfa_object.$text]()
  50635. };
  50636. } catch (e) {
  50637. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  50638. }
  50639. return null;
  50640. }
  50641. }
  50642. exports.XFAFactory = XFAFactory;
  50643. /***/ }),
  50644. /* 77 */
  50645. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50646. Object.defineProperty(exports, "__esModule", ({
  50647. value: true
  50648. }));
  50649. 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;
  50650. var _utils = __w_pdfjs_require__(78);
  50651. var _util = __w_pdfjs_require__(2);
  50652. var _core_utils = __w_pdfjs_require__(8);
  50653. var _namespaces = __w_pdfjs_require__(79);
  50654. var _som = __w_pdfjs_require__(80);
  50655. const $acceptWhitespace = Symbol();
  50656. exports.$acceptWhitespace = $acceptWhitespace;
  50657. const $addHTML = Symbol();
  50658. exports.$addHTML = $addHTML;
  50659. const $appendChild = Symbol();
  50660. exports.$appendChild = $appendChild;
  50661. const $childrenToHTML = Symbol();
  50662. exports.$childrenToHTML = $childrenToHTML;
  50663. const $clean = Symbol();
  50664. exports.$clean = $clean;
  50665. const $cleanPage = Symbol();
  50666. exports.$cleanPage = $cleanPage;
  50667. const $cleanup = Symbol();
  50668. exports.$cleanup = $cleanup;
  50669. const $clone = Symbol();
  50670. exports.$clone = $clone;
  50671. const $consumed = Symbol();
  50672. exports.$consumed = $consumed;
  50673. const $content = Symbol("content");
  50674. exports.$content = $content;
  50675. const $data = Symbol("data");
  50676. exports.$data = $data;
  50677. const $dump = Symbol();
  50678. exports.$dump = $dump;
  50679. const $extra = Symbol("extra");
  50680. exports.$extra = $extra;
  50681. const $finalize = Symbol();
  50682. exports.$finalize = $finalize;
  50683. const $flushHTML = Symbol();
  50684. exports.$flushHTML = $flushHTML;
  50685. const $getAttributeIt = Symbol();
  50686. exports.$getAttributeIt = $getAttributeIt;
  50687. const $getAttributes = Symbol();
  50688. exports.$getAttributes = $getAttributes;
  50689. const $getAvailableSpace = Symbol();
  50690. exports.$getAvailableSpace = $getAvailableSpace;
  50691. const $getChildrenByClass = Symbol();
  50692. exports.$getChildrenByClass = $getChildrenByClass;
  50693. const $getChildrenByName = Symbol();
  50694. exports.$getChildrenByName = $getChildrenByName;
  50695. const $getChildrenByNameIt = Symbol();
  50696. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  50697. const $getDataValue = Symbol();
  50698. exports.$getDataValue = $getDataValue;
  50699. const $getExtra = Symbol();
  50700. exports.$getExtra = $getExtra;
  50701. const $getRealChildrenByNameIt = Symbol();
  50702. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  50703. const $getChildren = Symbol();
  50704. exports.$getChildren = $getChildren;
  50705. const $getContainedChildren = Symbol();
  50706. exports.$getContainedChildren = $getContainedChildren;
  50707. const $getNextPage = Symbol();
  50708. exports.$getNextPage = $getNextPage;
  50709. const $getSubformParent = Symbol();
  50710. exports.$getSubformParent = $getSubformParent;
  50711. const $getParent = Symbol();
  50712. exports.$getParent = $getParent;
  50713. const $getTemplateRoot = Symbol();
  50714. exports.$getTemplateRoot = $getTemplateRoot;
  50715. const $globalData = Symbol();
  50716. exports.$globalData = $globalData;
  50717. const $hasSettableValue = Symbol();
  50718. exports.$hasSettableValue = $hasSettableValue;
  50719. const $ids = Symbol();
  50720. exports.$ids = $ids;
  50721. const $indexOf = Symbol();
  50722. exports.$indexOf = $indexOf;
  50723. const $insertAt = Symbol();
  50724. exports.$insertAt = $insertAt;
  50725. const $isCDATAXml = Symbol();
  50726. exports.$isCDATAXml = $isCDATAXml;
  50727. const $isBindable = Symbol();
  50728. exports.$isBindable = $isBindable;
  50729. const $isDataValue = Symbol();
  50730. exports.$isDataValue = $isDataValue;
  50731. const $isDescendent = Symbol();
  50732. exports.$isDescendent = $isDescendent;
  50733. const $isNsAgnostic = Symbol();
  50734. exports.$isNsAgnostic = $isNsAgnostic;
  50735. const $isSplittable = Symbol();
  50736. exports.$isSplittable = $isSplittable;
  50737. const $isThereMoreWidth = Symbol();
  50738. exports.$isThereMoreWidth = $isThereMoreWidth;
  50739. const $isTransparent = Symbol();
  50740. exports.$isTransparent = $isTransparent;
  50741. const $isUsable = Symbol();
  50742. exports.$isUsable = $isUsable;
  50743. const $lastAttribute = Symbol();
  50744. const $namespaceId = Symbol("namespaceId");
  50745. exports.$namespaceId = $namespaceId;
  50746. const $nodeName = Symbol("nodeName");
  50747. exports.$nodeName = $nodeName;
  50748. const $nsAttributes = Symbol();
  50749. exports.$nsAttributes = $nsAttributes;
  50750. const $onChild = Symbol();
  50751. exports.$onChild = $onChild;
  50752. const $onChildCheck = Symbol();
  50753. exports.$onChildCheck = $onChildCheck;
  50754. const $onText = Symbol();
  50755. exports.$onText = $onText;
  50756. const $pushGlyphs = Symbol();
  50757. exports.$pushGlyphs = $pushGlyphs;
  50758. const $popPara = Symbol();
  50759. exports.$popPara = $popPara;
  50760. const $pushPara = Symbol();
  50761. exports.$pushPara = $pushPara;
  50762. const $removeChild = Symbol();
  50763. exports.$removeChild = $removeChild;
  50764. const $root = Symbol("root");
  50765. exports.$root = $root;
  50766. const $resolvePrototypes = Symbol();
  50767. exports.$resolvePrototypes = $resolvePrototypes;
  50768. const $searchNode = Symbol();
  50769. exports.$searchNode = $searchNode;
  50770. const $setId = Symbol();
  50771. exports.$setId = $setId;
  50772. const $setSetAttributes = Symbol();
  50773. exports.$setSetAttributes = $setSetAttributes;
  50774. const $setValue = Symbol();
  50775. exports.$setValue = $setValue;
  50776. const $tabIndex = Symbol();
  50777. exports.$tabIndex = $tabIndex;
  50778. const $text = Symbol();
  50779. exports.$text = $text;
  50780. const $toPages = Symbol();
  50781. exports.$toPages = $toPages;
  50782. const $toHTML = Symbol();
  50783. exports.$toHTML = $toHTML;
  50784. const $toString = Symbol();
  50785. exports.$toString = $toString;
  50786. const $toStyle = Symbol();
  50787. exports.$toStyle = $toStyle;
  50788. const $uid = Symbol("uid");
  50789. exports.$uid = $uid;
  50790. const _applyPrototype = Symbol();
  50791. const _attributes = Symbol();
  50792. const _attributeNames = Symbol();
  50793. const _children = Symbol("_children");
  50794. const _cloneAttribute = Symbol();
  50795. const _dataValue = Symbol();
  50796. const _defaultValue = Symbol();
  50797. const _filteredChildrenGenerator = Symbol();
  50798. const _getPrototype = Symbol();
  50799. const _getUnsetAttributes = Symbol();
  50800. const _hasChildren = Symbol();
  50801. const _max = Symbol();
  50802. const _options = Symbol();
  50803. const _parent = Symbol("parent");
  50804. const _resolvePrototypesHelper = Symbol();
  50805. const _setAttributes = Symbol();
  50806. const _validator = Symbol();
  50807. let uid = 0;
  50808. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  50809. class XFAObject {
  50810. constructor(nsId, name, hasChildren = false) {
  50811. this[$namespaceId] = nsId;
  50812. this[$nodeName] = name;
  50813. this[_hasChildren] = hasChildren;
  50814. this[_parent] = null;
  50815. this[_children] = [];
  50816. this[$uid] = `${name}${uid++}`;
  50817. this[$globalData] = null;
  50818. }
  50819. [$onChild](child) {
  50820. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  50821. return false;
  50822. }
  50823. const name = child[$nodeName];
  50824. const node = this[name];
  50825. if (node instanceof XFAObjectArray) {
  50826. if (node.push(child)) {
  50827. this[$appendChild](child);
  50828. return true;
  50829. }
  50830. } else {
  50831. if (node !== null) {
  50832. this[$removeChild](node);
  50833. }
  50834. this[name] = child;
  50835. this[$appendChild](child);
  50836. return true;
  50837. }
  50838. let id = "";
  50839. if (this.id) {
  50840. id = ` (id: ${this.id})`;
  50841. } else if (this.name) {
  50842. id = ` (name: ${this.name} ${this.h.value})`;
  50843. }
  50844. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  50845. return false;
  50846. }
  50847. [$onChildCheck](child) {
  50848. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  50849. }
  50850. [$isNsAgnostic]() {
  50851. return false;
  50852. }
  50853. [$acceptWhitespace]() {
  50854. return false;
  50855. }
  50856. [$isCDATAXml]() {
  50857. return false;
  50858. }
  50859. [$isBindable]() {
  50860. return false;
  50861. }
  50862. [$popPara]() {
  50863. if (this.para) {
  50864. this[$getTemplateRoot]()[$extra].paraStack.pop();
  50865. }
  50866. }
  50867. [$pushPara]() {
  50868. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  50869. }
  50870. [$setId](ids) {
  50871. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  50872. ids.set(this.id, this);
  50873. }
  50874. }
  50875. [$getTemplateRoot]() {
  50876. return this[$globalData].template;
  50877. }
  50878. [$isSplittable]() {
  50879. return false;
  50880. }
  50881. [$isThereMoreWidth]() {
  50882. return false;
  50883. }
  50884. [$appendChild](child) {
  50885. child[_parent] = this;
  50886. this[_children].push(child);
  50887. if (!child[$globalData] && this[$globalData]) {
  50888. child[$globalData] = this[$globalData];
  50889. }
  50890. }
  50891. [$removeChild](child) {
  50892. const i = this[_children].indexOf(child);
  50893. this[_children].splice(i, 1);
  50894. }
  50895. [$hasSettableValue]() {
  50896. return this.hasOwnProperty("value");
  50897. }
  50898. [$setValue](_) {}
  50899. [$onText](_) {}
  50900. [$finalize]() {}
  50901. [$clean](builder) {
  50902. delete this[_hasChildren];
  50903. if (this[$cleanup]) {
  50904. builder.clean(this[$cleanup]);
  50905. delete this[$cleanup];
  50906. }
  50907. }
  50908. [$indexOf](child) {
  50909. return this[_children].indexOf(child);
  50910. }
  50911. [$insertAt](i, child) {
  50912. child[_parent] = this;
  50913. this[_children].splice(i, 0, child);
  50914. if (!child[$globalData] && this[$globalData]) {
  50915. child[$globalData] = this[$globalData];
  50916. }
  50917. }
  50918. [$isTransparent]() {
  50919. return !this.name;
  50920. }
  50921. [$lastAttribute]() {
  50922. return "";
  50923. }
  50924. [$text]() {
  50925. if (this[_children].length === 0) {
  50926. return this[$content];
  50927. }
  50928. return this[_children].map(c => c[$text]()).join("");
  50929. }
  50930. get [_attributeNames]() {
  50931. const proto = Object.getPrototypeOf(this);
  50932. if (!proto._attributes) {
  50933. const attributes = proto._attributes = new Set();
  50934. for (const name of Object.getOwnPropertyNames(this)) {
  50935. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  50936. break;
  50937. }
  50938. attributes.add(name);
  50939. }
  50940. }
  50941. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  50942. }
  50943. [$isDescendent](parent) {
  50944. let node = this;
  50945. while (node) {
  50946. if (node === parent) {
  50947. return true;
  50948. }
  50949. node = node[$getParent]();
  50950. }
  50951. return false;
  50952. }
  50953. [$getParent]() {
  50954. return this[_parent];
  50955. }
  50956. [$getSubformParent]() {
  50957. return this[$getParent]();
  50958. }
  50959. [$getChildren](name = null) {
  50960. if (!name) {
  50961. return this[_children];
  50962. }
  50963. return this[name];
  50964. }
  50965. [$dump]() {
  50966. const dumped = Object.create(null);
  50967. if (this[$content]) {
  50968. dumped.$content = this[$content];
  50969. }
  50970. for (const name of Object.getOwnPropertyNames(this)) {
  50971. const value = this[name];
  50972. if (value === null) {
  50973. continue;
  50974. }
  50975. if (value instanceof XFAObject) {
  50976. dumped[name] = value[$dump]();
  50977. } else if (value instanceof XFAObjectArray) {
  50978. if (!value.isEmpty()) {
  50979. dumped[name] = value.dump();
  50980. }
  50981. } else {
  50982. dumped[name] = value;
  50983. }
  50984. }
  50985. return dumped;
  50986. }
  50987. [$toStyle]() {
  50988. return null;
  50989. }
  50990. [$toHTML]() {
  50991. return _utils.HTMLResult.EMPTY;
  50992. }
  50993. *[$getContainedChildren]() {
  50994. for (const node of this[$getChildren]()) {
  50995. yield node;
  50996. }
  50997. }
  50998. *[_filteredChildrenGenerator](filter, include) {
  50999. for (const node of this[$getContainedChildren]()) {
  51000. if (!filter || include === filter.has(node[$nodeName])) {
  51001. const availableSpace = this[$getAvailableSpace]();
  51002. const res = node[$toHTML](availableSpace);
  51003. if (!res.success) {
  51004. this[$extra].failingNode = node;
  51005. }
  51006. yield res;
  51007. }
  51008. }
  51009. }
  51010. [$flushHTML]() {
  51011. return null;
  51012. }
  51013. [$addHTML](html, bbox) {
  51014. this[$extra].children.push(html);
  51015. }
  51016. [$getAvailableSpace]() {}
  51017. [$childrenToHTML]({
  51018. filter = null,
  51019. include = true
  51020. }) {
  51021. if (!this[$extra].generator) {
  51022. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  51023. } else {
  51024. const availableSpace = this[$getAvailableSpace]();
  51025. const res = this[$extra].failingNode[$toHTML](availableSpace);
  51026. if (!res.success) {
  51027. return res;
  51028. }
  51029. if (res.html) {
  51030. this[$addHTML](res.html, res.bbox);
  51031. }
  51032. delete this[$extra].failingNode;
  51033. }
  51034. while (true) {
  51035. const gen = this[$extra].generator.next();
  51036. if (gen.done) {
  51037. break;
  51038. }
  51039. const res = gen.value;
  51040. if (!res.success) {
  51041. return res;
  51042. }
  51043. if (res.html) {
  51044. this[$addHTML](res.html, res.bbox);
  51045. }
  51046. }
  51047. this[$extra].generator = null;
  51048. return _utils.HTMLResult.EMPTY;
  51049. }
  51050. [$setSetAttributes](attributes) {
  51051. this[_setAttributes] = new Set(Object.keys(attributes));
  51052. }
  51053. [_getUnsetAttributes](protoAttributes) {
  51054. const allAttr = this[_attributeNames];
  51055. const setAttr = this[_setAttributes];
  51056. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  51057. }
  51058. [$resolvePrototypes](ids, ancestors = new Set()) {
  51059. for (const child of this[_children]) {
  51060. child[_resolvePrototypesHelper](ids, ancestors);
  51061. }
  51062. }
  51063. [_resolvePrototypesHelper](ids, ancestors) {
  51064. const proto = this[_getPrototype](ids, ancestors);
  51065. if (proto) {
  51066. this[_applyPrototype](proto, ids, ancestors);
  51067. } else {
  51068. this[$resolvePrototypes](ids, ancestors);
  51069. }
  51070. }
  51071. [_getPrototype](ids, ancestors) {
  51072. const {
  51073. use,
  51074. usehref
  51075. } = this;
  51076. if (!use && !usehref) {
  51077. return null;
  51078. }
  51079. let proto = null;
  51080. let somExpression = null;
  51081. let id = null;
  51082. let ref = use;
  51083. if (usehref) {
  51084. ref = usehref;
  51085. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  51086. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  51087. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  51088. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  51089. } else if (usehref.startsWith("#")) {
  51090. id = usehref.slice(1);
  51091. } else if (usehref.startsWith(".#")) {
  51092. id = usehref.slice(2);
  51093. }
  51094. } else if (use.startsWith("#")) {
  51095. id = use.slice(1);
  51096. } else {
  51097. somExpression = use;
  51098. }
  51099. this.use = this.usehref = "";
  51100. if (id) {
  51101. proto = ids.get(id);
  51102. } else {
  51103. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  51104. if (proto) {
  51105. proto = proto[0];
  51106. }
  51107. }
  51108. if (!proto) {
  51109. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  51110. return null;
  51111. }
  51112. if (proto[$nodeName] !== this[$nodeName]) {
  51113. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  51114. return null;
  51115. }
  51116. if (ancestors.has(proto)) {
  51117. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51118. return null;
  51119. }
  51120. ancestors.add(proto);
  51121. const protoProto = proto[_getPrototype](ids, ancestors);
  51122. if (protoProto) {
  51123. proto[_applyPrototype](protoProto, ids, ancestors);
  51124. }
  51125. proto[$resolvePrototypes](ids, ancestors);
  51126. ancestors.delete(proto);
  51127. return proto;
  51128. }
  51129. [_applyPrototype](proto, ids, ancestors) {
  51130. if (ancestors.has(proto)) {
  51131. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51132. return;
  51133. }
  51134. if (!this[$content] && proto[$content]) {
  51135. this[$content] = proto[$content];
  51136. }
  51137. const newAncestors = new Set(ancestors);
  51138. newAncestors.add(proto);
  51139. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  51140. this[unsetAttrName] = proto[unsetAttrName];
  51141. if (this[_setAttributes]) {
  51142. this[_setAttributes].add(unsetAttrName);
  51143. }
  51144. }
  51145. for (const name of Object.getOwnPropertyNames(this)) {
  51146. if (this[_attributeNames].has(name)) {
  51147. continue;
  51148. }
  51149. const value = this[name];
  51150. const protoValue = proto[name];
  51151. if (value instanceof XFAObjectArray) {
  51152. for (const child of value[_children]) {
  51153. child[_resolvePrototypesHelper](ids, ancestors);
  51154. }
  51155. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  51156. const child = proto[_children][i][$clone]();
  51157. if (value.push(child)) {
  51158. child[_parent] = this;
  51159. this[_children].push(child);
  51160. child[_resolvePrototypesHelper](ids, ancestors);
  51161. } else {
  51162. break;
  51163. }
  51164. }
  51165. continue;
  51166. }
  51167. if (value !== null) {
  51168. value[$resolvePrototypes](ids, ancestors);
  51169. if (protoValue) {
  51170. value[_applyPrototype](protoValue, ids, ancestors);
  51171. }
  51172. continue;
  51173. }
  51174. if (protoValue !== null) {
  51175. const child = protoValue[$clone]();
  51176. child[_parent] = this;
  51177. this[name] = child;
  51178. this[_children].push(child);
  51179. child[_resolvePrototypesHelper](ids, ancestors);
  51180. }
  51181. }
  51182. }
  51183. static [_cloneAttribute](obj) {
  51184. if (Array.isArray(obj)) {
  51185. return obj.map(x => XFAObject[_cloneAttribute](x));
  51186. }
  51187. if (typeof obj === "object" && obj !== null) {
  51188. return Object.assign({}, obj);
  51189. }
  51190. return obj;
  51191. }
  51192. [$clone]() {
  51193. const clone = Object.create(Object.getPrototypeOf(this));
  51194. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  51195. try {
  51196. clone[$symbol] = this[$symbol];
  51197. } catch (_) {
  51198. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  51199. }
  51200. }
  51201. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  51202. clone[_children] = [];
  51203. for (const name of Object.getOwnPropertyNames(this)) {
  51204. if (this[_attributeNames].has(name)) {
  51205. clone[name] = XFAObject[_cloneAttribute](this[name]);
  51206. continue;
  51207. }
  51208. const value = this[name];
  51209. if (value instanceof XFAObjectArray) {
  51210. clone[name] = new XFAObjectArray(value[_max]);
  51211. } else {
  51212. clone[name] = null;
  51213. }
  51214. }
  51215. for (const child of this[_children]) {
  51216. const name = child[$nodeName];
  51217. const clonedChild = child[$clone]();
  51218. clone[_children].push(clonedChild);
  51219. clonedChild[_parent] = clone;
  51220. if (clone[name] === null) {
  51221. clone[name] = clonedChild;
  51222. } else {
  51223. clone[name][_children].push(clonedChild);
  51224. }
  51225. }
  51226. return clone;
  51227. }
  51228. [$getChildren](name = null) {
  51229. if (!name) {
  51230. return this[_children];
  51231. }
  51232. return this[_children].filter(c => c[$nodeName] === name);
  51233. }
  51234. [$getChildrenByClass](name) {
  51235. return this[name];
  51236. }
  51237. [$getChildrenByName](name, allTransparent, first = true) {
  51238. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  51239. }
  51240. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  51241. if (name === "parent") {
  51242. yield this[_parent];
  51243. return;
  51244. }
  51245. for (const child of this[_children]) {
  51246. if (child[$nodeName] === name) {
  51247. yield child;
  51248. }
  51249. if (child.name === name) {
  51250. yield child;
  51251. }
  51252. if (allTransparent || child[$isTransparent]()) {
  51253. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  51254. }
  51255. }
  51256. if (first && this[_attributeNames].has(name)) {
  51257. yield new XFAAttribute(this, name, this[name]);
  51258. }
  51259. }
  51260. }
  51261. exports.XFAObject = XFAObject;
  51262. class XFAObjectArray {
  51263. constructor(max = Infinity) {
  51264. this[_max] = max;
  51265. this[_children] = [];
  51266. }
  51267. push(child) {
  51268. const len = this[_children].length;
  51269. if (len <= this[_max]) {
  51270. this[_children].push(child);
  51271. return true;
  51272. }
  51273. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  51274. return false;
  51275. }
  51276. isEmpty() {
  51277. return this[_children].length === 0;
  51278. }
  51279. dump() {
  51280. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  51281. }
  51282. [$clone]() {
  51283. const clone = new XFAObjectArray(this[_max]);
  51284. clone[_children] = this[_children].map(c => c[$clone]());
  51285. return clone;
  51286. }
  51287. get children() {
  51288. return this[_children];
  51289. }
  51290. clear() {
  51291. this[_children].length = 0;
  51292. }
  51293. }
  51294. exports.XFAObjectArray = XFAObjectArray;
  51295. class XFAAttribute {
  51296. constructor(node, name, value) {
  51297. this[_parent] = node;
  51298. this[$nodeName] = name;
  51299. this[$content] = value;
  51300. this[$consumed] = false;
  51301. this[$uid] = `attribute${uid++}`;
  51302. }
  51303. [$getParent]() {
  51304. return this[_parent];
  51305. }
  51306. [$isDataValue]() {
  51307. return true;
  51308. }
  51309. [$getDataValue]() {
  51310. return this[$content].trim();
  51311. }
  51312. [$setValue](value) {
  51313. value = value.value || "";
  51314. this[$content] = value.toString();
  51315. }
  51316. [$text]() {
  51317. return this[$content];
  51318. }
  51319. [$isDescendent](parent) {
  51320. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  51321. }
  51322. }
  51323. exports.XFAAttribute = XFAAttribute;
  51324. class XmlObject extends XFAObject {
  51325. constructor(nsId, name, attributes = {}) {
  51326. super(nsId, name);
  51327. this[$content] = "";
  51328. this[_dataValue] = null;
  51329. if (name !== "#text") {
  51330. const map = new Map();
  51331. this[_attributes] = map;
  51332. for (const [attrName, value] of Object.entries(attributes)) {
  51333. map.set(attrName, new XFAAttribute(this, attrName, value));
  51334. }
  51335. if (attributes.hasOwnProperty($nsAttributes)) {
  51336. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  51337. if (dataNode !== undefined) {
  51338. if (dataNode === "dataGroup") {
  51339. this[_dataValue] = false;
  51340. } else if (dataNode === "dataValue") {
  51341. this[_dataValue] = true;
  51342. }
  51343. }
  51344. }
  51345. }
  51346. this[$consumed] = false;
  51347. }
  51348. [$toString](buf) {
  51349. const tagName = this[$nodeName];
  51350. if (tagName === "#text") {
  51351. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  51352. return;
  51353. }
  51354. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  51355. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  51356. buf.push(`<${prefix}${utf8TagName}`);
  51357. for (const [name, value] of this[_attributes].entries()) {
  51358. const utf8Name = (0, _util.utf8StringToString)(name);
  51359. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  51360. }
  51361. if (this[_dataValue] !== null) {
  51362. if (this[_dataValue]) {
  51363. buf.push(` xfa:dataNode="dataValue"`);
  51364. } else {
  51365. buf.push(` xfa:dataNode="dataGroup"`);
  51366. }
  51367. }
  51368. if (!this[$content] && this[_children].length === 0) {
  51369. buf.push("/>");
  51370. return;
  51371. }
  51372. buf.push(">");
  51373. if (this[$content]) {
  51374. if (typeof this[$content] === "string") {
  51375. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  51376. } else {
  51377. this[$content][$toString](buf);
  51378. }
  51379. } else {
  51380. for (const child of this[_children]) {
  51381. child[$toString](buf);
  51382. }
  51383. }
  51384. buf.push(`</${prefix}${utf8TagName}>`);
  51385. }
  51386. [$onChild](child) {
  51387. if (this[$content]) {
  51388. const node = new XmlObject(this[$namespaceId], "#text");
  51389. this[$appendChild](node);
  51390. node[$content] = this[$content];
  51391. this[$content] = "";
  51392. }
  51393. this[$appendChild](child);
  51394. return true;
  51395. }
  51396. [$onText](str) {
  51397. this[$content] += str;
  51398. }
  51399. [$finalize]() {
  51400. if (this[$content] && this[_children].length > 0) {
  51401. const node = new XmlObject(this[$namespaceId], "#text");
  51402. this[$appendChild](node);
  51403. node[$content] = this[$content];
  51404. delete this[$content];
  51405. }
  51406. }
  51407. [$toHTML]() {
  51408. if (this[$nodeName] === "#text") {
  51409. return _utils.HTMLResult.success({
  51410. name: "#text",
  51411. value: this[$content]
  51412. });
  51413. }
  51414. return _utils.HTMLResult.EMPTY;
  51415. }
  51416. [$getChildren](name = null) {
  51417. if (!name) {
  51418. return this[_children];
  51419. }
  51420. return this[_children].filter(c => c[$nodeName] === name);
  51421. }
  51422. [$getAttributes]() {
  51423. return this[_attributes];
  51424. }
  51425. [$getChildrenByClass](name) {
  51426. const value = this[_attributes].get(name);
  51427. if (value !== undefined) {
  51428. return value;
  51429. }
  51430. return this[$getChildren](name);
  51431. }
  51432. *[$getChildrenByNameIt](name, allTransparent) {
  51433. const value = this[_attributes].get(name);
  51434. if (value) {
  51435. yield value;
  51436. }
  51437. for (const child of this[_children]) {
  51438. if (child[$nodeName] === name) {
  51439. yield child;
  51440. }
  51441. if (allTransparent) {
  51442. yield* child[$getChildrenByNameIt](name, allTransparent);
  51443. }
  51444. }
  51445. }
  51446. *[$getAttributeIt](name, skipConsumed) {
  51447. const value = this[_attributes].get(name);
  51448. if (value && (!skipConsumed || !value[$consumed])) {
  51449. yield value;
  51450. }
  51451. for (const child of this[_children]) {
  51452. yield* child[$getAttributeIt](name, skipConsumed);
  51453. }
  51454. }
  51455. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  51456. for (const child of this[_children]) {
  51457. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  51458. yield child;
  51459. }
  51460. if (allTransparent) {
  51461. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  51462. }
  51463. }
  51464. }
  51465. [$isDataValue]() {
  51466. if (this[_dataValue] === null) {
  51467. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  51468. }
  51469. return this[_dataValue];
  51470. }
  51471. [$getDataValue]() {
  51472. if (this[_dataValue] === null) {
  51473. if (this[_children].length === 0) {
  51474. return this[$content].trim();
  51475. }
  51476. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  51477. return this[_children][0][$text]().trim();
  51478. }
  51479. return null;
  51480. }
  51481. return this[$content].trim();
  51482. }
  51483. [$setValue](value) {
  51484. value = value.value || "";
  51485. this[$content] = value.toString();
  51486. }
  51487. [$dump](hasNS = false) {
  51488. const dumped = Object.create(null);
  51489. if (hasNS) {
  51490. dumped.$ns = this[$namespaceId];
  51491. }
  51492. if (this[$content]) {
  51493. dumped.$content = this[$content];
  51494. }
  51495. dumped.$name = this[$nodeName];
  51496. dumped.children = [];
  51497. for (const child of this[_children]) {
  51498. dumped.children.push(child[$dump](hasNS));
  51499. }
  51500. dumped.attributes = Object.create(null);
  51501. for (const [name, value] of this[_attributes]) {
  51502. dumped.attributes[name] = value[$content];
  51503. }
  51504. return dumped;
  51505. }
  51506. }
  51507. exports.XmlObject = XmlObject;
  51508. class ContentObject extends XFAObject {
  51509. constructor(nsId, name) {
  51510. super(nsId, name);
  51511. this[$content] = "";
  51512. }
  51513. [$onText](text) {
  51514. this[$content] += text;
  51515. }
  51516. [$finalize]() {}
  51517. }
  51518. exports.ContentObject = ContentObject;
  51519. class OptionObject extends ContentObject {
  51520. constructor(nsId, name, options) {
  51521. super(nsId, name);
  51522. this[_options] = options;
  51523. }
  51524. [$finalize]() {
  51525. this[$content] = (0, _utils.getKeyword)({
  51526. data: this[$content],
  51527. defaultValue: this[_options][0],
  51528. validate: k => this[_options].includes(k)
  51529. });
  51530. }
  51531. [$clean](builder) {
  51532. super[$clean](builder);
  51533. delete this[_options];
  51534. }
  51535. }
  51536. exports.OptionObject = OptionObject;
  51537. class StringObject extends ContentObject {
  51538. [$finalize]() {
  51539. this[$content] = this[$content].trim();
  51540. }
  51541. }
  51542. exports.StringObject = StringObject;
  51543. class IntegerObject extends ContentObject {
  51544. constructor(nsId, name, defaultValue, validator) {
  51545. super(nsId, name);
  51546. this[_defaultValue] = defaultValue;
  51547. this[_validator] = validator;
  51548. }
  51549. [$finalize]() {
  51550. this[$content] = (0, _utils.getInteger)({
  51551. data: this[$content],
  51552. defaultValue: this[_defaultValue],
  51553. validate: this[_validator]
  51554. });
  51555. }
  51556. [$clean](builder) {
  51557. super[$clean](builder);
  51558. delete this[_defaultValue];
  51559. delete this[_validator];
  51560. }
  51561. }
  51562. exports.IntegerObject = IntegerObject;
  51563. class Option01 extends IntegerObject {
  51564. constructor(nsId, name) {
  51565. super(nsId, name, 0, n => n === 1);
  51566. }
  51567. }
  51568. exports.Option01 = Option01;
  51569. class Option10 extends IntegerObject {
  51570. constructor(nsId, name) {
  51571. super(nsId, name, 1, n => n === 0);
  51572. }
  51573. }
  51574. exports.Option10 = Option10;
  51575. /***/ }),
  51576. /* 78 */
  51577. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51578. Object.defineProperty(exports, "__esModule", ({
  51579. value: true
  51580. }));
  51581. exports.HTMLResult = void 0;
  51582. exports.getBBox = getBBox;
  51583. exports.getColor = getColor;
  51584. exports.getFloat = getFloat;
  51585. exports.getInteger = getInteger;
  51586. exports.getKeyword = getKeyword;
  51587. exports.getMeasurement = getMeasurement;
  51588. exports.getRatio = getRatio;
  51589. exports.getRelevant = getRelevant;
  51590. exports.getStringOption = getStringOption;
  51591. exports.stripQuotes = stripQuotes;
  51592. var _util = __w_pdfjs_require__(2);
  51593. const dimConverters = {
  51594. pt: x => x,
  51595. cm: x => x / 2.54 * 72,
  51596. mm: x => x / (10 * 2.54) * 72,
  51597. in: x => x * 72,
  51598. px: x => x
  51599. };
  51600. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  51601. function stripQuotes(str) {
  51602. if (str.startsWith("'") || str.startsWith('"')) {
  51603. return str.slice(1, str.length - 1);
  51604. }
  51605. return str;
  51606. }
  51607. function getInteger({
  51608. data,
  51609. defaultValue,
  51610. validate
  51611. }) {
  51612. if (!data) {
  51613. return defaultValue;
  51614. }
  51615. data = data.trim();
  51616. const n = parseInt(data, 10);
  51617. if (!isNaN(n) && validate(n)) {
  51618. return n;
  51619. }
  51620. return defaultValue;
  51621. }
  51622. function getFloat({
  51623. data,
  51624. defaultValue,
  51625. validate
  51626. }) {
  51627. if (!data) {
  51628. return defaultValue;
  51629. }
  51630. data = data.trim();
  51631. const n = parseFloat(data);
  51632. if (!isNaN(n) && validate(n)) {
  51633. return n;
  51634. }
  51635. return defaultValue;
  51636. }
  51637. function getKeyword({
  51638. data,
  51639. defaultValue,
  51640. validate
  51641. }) {
  51642. if (!data) {
  51643. return defaultValue;
  51644. }
  51645. data = data.trim();
  51646. if (validate(data)) {
  51647. return data;
  51648. }
  51649. return defaultValue;
  51650. }
  51651. function getStringOption(data, options) {
  51652. return getKeyword({
  51653. data,
  51654. defaultValue: options[0],
  51655. validate: k => options.includes(k)
  51656. });
  51657. }
  51658. function getMeasurement(str, def = "0") {
  51659. def = def || "0";
  51660. if (!str) {
  51661. return getMeasurement(def);
  51662. }
  51663. const match = str.trim().match(measurementPattern);
  51664. if (!match) {
  51665. return getMeasurement(def);
  51666. }
  51667. const [, valueStr, unit] = match;
  51668. const value = parseFloat(valueStr);
  51669. if (isNaN(value)) {
  51670. return getMeasurement(def);
  51671. }
  51672. if (value === 0) {
  51673. return 0;
  51674. }
  51675. const conv = dimConverters[unit];
  51676. if (conv) {
  51677. return conv(value);
  51678. }
  51679. return value;
  51680. }
  51681. function getRatio(data) {
  51682. if (!data) {
  51683. return {
  51684. num: 1,
  51685. den: 1
  51686. };
  51687. }
  51688. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  51689. if (ratio.length === 1) {
  51690. ratio.push(1);
  51691. }
  51692. if (ratio.length === 0) {
  51693. return {
  51694. num: 1,
  51695. den: 1
  51696. };
  51697. }
  51698. const [num, den] = ratio;
  51699. return {
  51700. num,
  51701. den
  51702. };
  51703. }
  51704. function getRelevant(data) {
  51705. if (!data) {
  51706. return [];
  51707. }
  51708. return data.trim().split(/\s+/).map(e => {
  51709. return {
  51710. excluded: e[0] === "-",
  51711. viewname: e.substring(1)
  51712. };
  51713. });
  51714. }
  51715. function getColor(data, def = [0, 0, 0]) {
  51716. let [r, g, b] = def;
  51717. if (!data) {
  51718. return {
  51719. r,
  51720. g,
  51721. b
  51722. };
  51723. }
  51724. 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);
  51725. if (color.length < 3) {
  51726. return {
  51727. r,
  51728. g,
  51729. b
  51730. };
  51731. }
  51732. [r, g, b] = color;
  51733. return {
  51734. r,
  51735. g,
  51736. b
  51737. };
  51738. }
  51739. function getBBox(data) {
  51740. const def = -1;
  51741. if (!data) {
  51742. return {
  51743. x: def,
  51744. y: def,
  51745. width: def,
  51746. height: def
  51747. };
  51748. }
  51749. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  51750. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  51751. return {
  51752. x: def,
  51753. y: def,
  51754. width: def,
  51755. height: def
  51756. };
  51757. }
  51758. const [x, y, width, height] = bbox;
  51759. return {
  51760. x,
  51761. y,
  51762. width,
  51763. height
  51764. };
  51765. }
  51766. class HTMLResult {
  51767. static get FAILURE() {
  51768. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  51769. }
  51770. static get EMPTY() {
  51771. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  51772. }
  51773. constructor(success, html, bbox, breakNode) {
  51774. this.success = success;
  51775. this.html = html;
  51776. this.bbox = bbox;
  51777. this.breakNode = breakNode;
  51778. }
  51779. isBreak() {
  51780. return !!this.breakNode;
  51781. }
  51782. static breakNode(node) {
  51783. return new HTMLResult(false, null, null, node);
  51784. }
  51785. static success(html, bbox = null) {
  51786. return new HTMLResult(true, html, bbox, null);
  51787. }
  51788. }
  51789. exports.HTMLResult = HTMLResult;
  51790. /***/ }),
  51791. /* 79 */
  51792. /***/ ((__unused_webpack_module, exports) => {
  51793. Object.defineProperty(exports, "__esModule", ({
  51794. value: true
  51795. }));
  51796. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  51797. const $buildXFAObject = Symbol();
  51798. exports.$buildXFAObject = $buildXFAObject;
  51799. const NamespaceIds = {
  51800. config: {
  51801. id: 0,
  51802. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  51803. },
  51804. connectionSet: {
  51805. id: 1,
  51806. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  51807. },
  51808. datasets: {
  51809. id: 2,
  51810. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  51811. },
  51812. form: {
  51813. id: 3,
  51814. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  51815. },
  51816. localeSet: {
  51817. id: 4,
  51818. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  51819. },
  51820. pdf: {
  51821. id: 5,
  51822. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  51823. },
  51824. signature: {
  51825. id: 6,
  51826. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  51827. },
  51828. sourceSet: {
  51829. id: 7,
  51830. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  51831. },
  51832. stylesheet: {
  51833. id: 8,
  51834. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  51835. },
  51836. template: {
  51837. id: 9,
  51838. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  51839. },
  51840. xdc: {
  51841. id: 10,
  51842. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  51843. },
  51844. xdp: {
  51845. id: 11,
  51846. check: ns => ns === "http://ns.adobe.com/xdp/"
  51847. },
  51848. xfdf: {
  51849. id: 12,
  51850. check: ns => ns === "http://ns.adobe.com/xfdf/"
  51851. },
  51852. xhtml: {
  51853. id: 13,
  51854. check: ns => ns === "http://www.w3.org/1999/xhtml"
  51855. },
  51856. xmpmeta: {
  51857. id: 14,
  51858. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  51859. }
  51860. };
  51861. exports.NamespaceIds = NamespaceIds;
  51862. /***/ }),
  51863. /* 80 */
  51864. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51865. Object.defineProperty(exports, "__esModule", ({
  51866. value: true
  51867. }));
  51868. exports.createDataNode = createDataNode;
  51869. exports.searchNode = searchNode;
  51870. var _xfa_object = __w_pdfjs_require__(77);
  51871. var _namespaces = __w_pdfjs_require__(79);
  51872. var _util = __w_pdfjs_require__(2);
  51873. const namePattern = /^[^.[]+/;
  51874. const indexPattern = /^[^\]]+/;
  51875. const operators = {
  51876. dot: 0,
  51877. dotDot: 1,
  51878. dotHash: 2,
  51879. dotBracket: 3,
  51880. dotParen: 4
  51881. };
  51882. 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]]);
  51883. const somCache = new WeakMap();
  51884. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51885. function parseIndex(index) {
  51886. index = index.trim();
  51887. if (index === "*") {
  51888. return Infinity;
  51889. }
  51890. return parseInt(index, 10) || 0;
  51891. }
  51892. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  51893. let match = expr.match(namePattern);
  51894. if (!match) {
  51895. return null;
  51896. }
  51897. let [name] = match;
  51898. const parsed = [{
  51899. name,
  51900. cacheName: "." + name,
  51901. index: 0,
  51902. js: null,
  51903. formCalc: null,
  51904. operator: operators.dot
  51905. }];
  51906. let pos = name.length;
  51907. while (pos < expr.length) {
  51908. const spos = pos;
  51909. const char = expr.charAt(pos++);
  51910. if (char === "[") {
  51911. match = expr.slice(pos).match(indexPattern);
  51912. if (!match) {
  51913. (0, _util.warn)("XFA - Invalid index in SOM expression");
  51914. return null;
  51915. }
  51916. parsed[parsed.length - 1].index = parseIndex(match[0]);
  51917. pos += match[0].length + 1;
  51918. continue;
  51919. }
  51920. let operator;
  51921. switch (expr.charAt(pos)) {
  51922. case ".":
  51923. if (!dotDotAllowed) {
  51924. return null;
  51925. }
  51926. pos++;
  51927. operator = operators.dotDot;
  51928. break;
  51929. case "#":
  51930. pos++;
  51931. operator = operators.dotHash;
  51932. break;
  51933. case "[":
  51934. if (noExpr) {
  51935. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  51936. return null;
  51937. }
  51938. operator = operators.dotBracket;
  51939. break;
  51940. case "(":
  51941. if (noExpr) {
  51942. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  51943. return null;
  51944. }
  51945. operator = operators.dotParen;
  51946. break;
  51947. default:
  51948. operator = operators.dot;
  51949. break;
  51950. }
  51951. match = expr.slice(pos).match(namePattern);
  51952. if (!match) {
  51953. break;
  51954. }
  51955. [name] = match;
  51956. pos += name.length;
  51957. parsed.push({
  51958. name,
  51959. cacheName: expr.slice(spos, pos),
  51960. operator,
  51961. index: 0,
  51962. js: null,
  51963. formCalc: null
  51964. });
  51965. }
  51966. return parsed;
  51967. }
  51968. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  51969. const parsed = parseExpression(expr, dotDotAllowed);
  51970. if (!parsed) {
  51971. return null;
  51972. }
  51973. const fn = shortcuts.get(parsed[0].name);
  51974. let i = 0;
  51975. let isQualified;
  51976. if (fn) {
  51977. isQualified = true;
  51978. root = [fn(root, container)];
  51979. i = 1;
  51980. } else {
  51981. isQualified = container === null;
  51982. root = [container || root];
  51983. }
  51984. for (let ii = parsed.length; i < ii; i++) {
  51985. const {
  51986. name,
  51987. cacheName,
  51988. operator,
  51989. index
  51990. } = parsed[i];
  51991. const nodes = [];
  51992. for (const node of root) {
  51993. if (!(node instanceof _xfa_object.XFAObject)) {
  51994. continue;
  51995. }
  51996. let children, cached;
  51997. if (useCache) {
  51998. cached = somCache.get(node);
  51999. if (!cached) {
  52000. cached = new Map();
  52001. somCache.set(node, cached);
  52002. }
  52003. children = cached.get(cacheName);
  52004. }
  52005. if (!children) {
  52006. switch (operator) {
  52007. case operators.dot:
  52008. children = node[_xfa_object.$getChildrenByName](name, false);
  52009. break;
  52010. case operators.dotDot:
  52011. children = node[_xfa_object.$getChildrenByName](name, true);
  52012. break;
  52013. case operators.dotHash:
  52014. children = node[_xfa_object.$getChildrenByClass](name);
  52015. if (children instanceof _xfa_object.XFAObjectArray) {
  52016. children = children.children;
  52017. } else {
  52018. children = [children];
  52019. }
  52020. break;
  52021. default:
  52022. break;
  52023. }
  52024. if (useCache) {
  52025. cached.set(cacheName, children);
  52026. }
  52027. }
  52028. if (children.length > 0) {
  52029. nodes.push(children);
  52030. }
  52031. }
  52032. if (nodes.length === 0 && !isQualified && i === 0) {
  52033. const parent = container[_xfa_object.$getParent]();
  52034. container = parent;
  52035. if (!container) {
  52036. return null;
  52037. }
  52038. i = -1;
  52039. root = [container];
  52040. continue;
  52041. }
  52042. if (isFinite(index)) {
  52043. root = nodes.filter(node => index < node.length).map(node => node[index]);
  52044. } else {
  52045. root = nodes.reduce((acc, node) => acc.concat(node), []);
  52046. }
  52047. }
  52048. if (root.length === 0) {
  52049. return null;
  52050. }
  52051. return root;
  52052. }
  52053. function createNodes(root, path) {
  52054. let node = null;
  52055. for (const {
  52056. name,
  52057. index
  52058. } of path) {
  52059. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  52060. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  52061. node = new _xfa_object.XmlObject(nsId, name);
  52062. root[_xfa_object.$appendChild](node);
  52063. }
  52064. root = node;
  52065. }
  52066. return node;
  52067. }
  52068. function createDataNode(root, container, expr) {
  52069. const parsed = parseExpression(expr);
  52070. if (!parsed) {
  52071. return null;
  52072. }
  52073. if (parsed.some(x => x.operator === operators.dotDot)) {
  52074. return null;
  52075. }
  52076. const fn = shortcuts.get(parsed[0].name);
  52077. let i = 0;
  52078. if (fn) {
  52079. root = fn(root, container);
  52080. i = 1;
  52081. } else {
  52082. root = container || root;
  52083. }
  52084. for (let ii = parsed.length; i < ii; i++) {
  52085. const {
  52086. name,
  52087. operator,
  52088. index
  52089. } = parsed[i];
  52090. if (!isFinite(index)) {
  52091. parsed[i].index = 0;
  52092. return createNodes(root, parsed.slice(i));
  52093. }
  52094. let children;
  52095. switch (operator) {
  52096. case operators.dot:
  52097. children = root[_xfa_object.$getChildrenByName](name, false);
  52098. break;
  52099. case operators.dotDot:
  52100. children = root[_xfa_object.$getChildrenByName](name, true);
  52101. break;
  52102. case operators.dotHash:
  52103. children = root[_xfa_object.$getChildrenByClass](name);
  52104. if (children instanceof _xfa_object.XFAObjectArray) {
  52105. children = children.children;
  52106. } else {
  52107. children = [children];
  52108. }
  52109. break;
  52110. default:
  52111. break;
  52112. }
  52113. if (children.length === 0) {
  52114. return createNodes(root, parsed.slice(i));
  52115. }
  52116. if (index < children.length) {
  52117. const child = children[index];
  52118. if (!(child instanceof _xfa_object.XFAObject)) {
  52119. (0, _util.warn)(`XFA - Cannot create a node.`);
  52120. return null;
  52121. }
  52122. root = child;
  52123. } else {
  52124. parsed[i].index = index - children.length;
  52125. return createNodes(root, parsed.slice(i));
  52126. }
  52127. }
  52128. return null;
  52129. }
  52130. /***/ }),
  52131. /* 81 */
  52132. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52133. Object.defineProperty(exports, "__esModule", ({
  52134. value: true
  52135. }));
  52136. exports.Binder = void 0;
  52137. var _xfa_object = __w_pdfjs_require__(77);
  52138. var _template = __w_pdfjs_require__(82);
  52139. var _som = __w_pdfjs_require__(80);
  52140. var _namespaces = __w_pdfjs_require__(79);
  52141. var _util = __w_pdfjs_require__(2);
  52142. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52143. function createText(content) {
  52144. const node = new _template.Text({});
  52145. node[_xfa_object.$content] = content;
  52146. return node;
  52147. }
  52148. class Binder {
  52149. constructor(root) {
  52150. this.root = root;
  52151. this.datasets = root.datasets;
  52152. if (root.datasets && root.datasets.data) {
  52153. this.data = root.datasets.data;
  52154. } else {
  52155. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  52156. }
  52157. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  52158. this.root.form = this.form = root.template[_xfa_object.$clone]();
  52159. }
  52160. _isConsumeData() {
  52161. return !this.emptyMerge && this._mergeMode;
  52162. }
  52163. _isMatchTemplate() {
  52164. return !this._isConsumeData();
  52165. }
  52166. bind() {
  52167. this._bindElement(this.form, this.data);
  52168. return this.form;
  52169. }
  52170. getData() {
  52171. return this.data;
  52172. }
  52173. _bindValue(formNode, data, picture) {
  52174. formNode[_xfa_object.$data] = data;
  52175. if (formNode[_xfa_object.$hasSettableValue]()) {
  52176. if (data[_xfa_object.$isDataValue]()) {
  52177. const value = data[_xfa_object.$getDataValue]();
  52178. formNode[_xfa_object.$setValue](createText(value));
  52179. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  52180. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  52181. formNode[_xfa_object.$setValue](createText(value));
  52182. } else if (this._isConsumeData()) {
  52183. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52184. }
  52185. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  52186. this._bindElement(formNode, data);
  52187. } else {
  52188. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52189. }
  52190. }
  52191. _findDataByNameToConsume(name, isValue, dataNode, global) {
  52192. if (!name) {
  52193. return null;
  52194. }
  52195. let generator, match;
  52196. for (let i = 0; i < 3; i++) {
  52197. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  52198. while (true) {
  52199. match = generator.next().value;
  52200. if (!match) {
  52201. break;
  52202. }
  52203. if (isValue === match[_xfa_object.$isDataValue]()) {
  52204. return match;
  52205. }
  52206. }
  52207. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  52208. break;
  52209. }
  52210. dataNode = dataNode[_xfa_object.$getParent]();
  52211. }
  52212. if (!global) {
  52213. return null;
  52214. }
  52215. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  52216. match = generator.next().value;
  52217. if (match) {
  52218. return match;
  52219. }
  52220. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  52221. match = generator.next().value;
  52222. if (match && match[_xfa_object.$isDataValue]()) {
  52223. return match;
  52224. }
  52225. return null;
  52226. }
  52227. _setProperties(formNode, dataNode) {
  52228. if (!formNode.hasOwnProperty("setProperty")) {
  52229. return;
  52230. }
  52231. for (const {
  52232. ref,
  52233. target,
  52234. connection
  52235. } of formNode.setProperty.children) {
  52236. if (connection) {
  52237. continue;
  52238. }
  52239. if (!ref) {
  52240. continue;
  52241. }
  52242. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52243. if (!nodes) {
  52244. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52245. continue;
  52246. }
  52247. const [node] = nodes;
  52248. if (!node[_xfa_object.$isDescendent](this.data)) {
  52249. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  52250. continue;
  52251. }
  52252. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  52253. if (!targetNodes) {
  52254. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  52255. continue;
  52256. }
  52257. const [targetNode] = targetNodes;
  52258. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  52259. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  52260. continue;
  52261. }
  52262. const targetParent = targetNode[_xfa_object.$getParent]();
  52263. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  52264. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  52265. continue;
  52266. }
  52267. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  52268. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  52269. continue;
  52270. }
  52271. const content = node[_xfa_object.$text]();
  52272. const name = targetNode[_xfa_object.$nodeName];
  52273. if (targetNode instanceof _xfa_object.XFAAttribute) {
  52274. const attrs = Object.create(null);
  52275. attrs[name] = content;
  52276. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  52277. targetParent[name] = obj[name];
  52278. continue;
  52279. }
  52280. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  52281. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  52282. continue;
  52283. }
  52284. targetNode[_xfa_object.$data] = node;
  52285. targetNode[_xfa_object.$content] = content;
  52286. targetNode[_xfa_object.$finalize]();
  52287. }
  52288. }
  52289. _bindItems(formNode, dataNode) {
  52290. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  52291. return;
  52292. }
  52293. for (const item of formNode.items.children) {
  52294. formNode[_xfa_object.$removeChild](item);
  52295. }
  52296. formNode.items.clear();
  52297. const labels = new _template.Items({});
  52298. const values = new _template.Items({});
  52299. formNode[_xfa_object.$appendChild](labels);
  52300. formNode.items.push(labels);
  52301. formNode[_xfa_object.$appendChild](values);
  52302. formNode.items.push(values);
  52303. for (const {
  52304. ref,
  52305. labelRef,
  52306. valueRef,
  52307. connection
  52308. } of formNode.bindItems.children) {
  52309. if (connection) {
  52310. continue;
  52311. }
  52312. if (!ref) {
  52313. continue;
  52314. }
  52315. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52316. if (!nodes) {
  52317. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52318. continue;
  52319. }
  52320. for (const node of nodes) {
  52321. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  52322. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  52323. continue;
  52324. }
  52325. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  52326. if (!labelNodes) {
  52327. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  52328. continue;
  52329. }
  52330. const [labelNode] = labelNodes;
  52331. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  52332. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  52333. continue;
  52334. }
  52335. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  52336. if (!valueNodes) {
  52337. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  52338. continue;
  52339. }
  52340. const [valueNode] = valueNodes;
  52341. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  52342. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  52343. continue;
  52344. }
  52345. const label = createText(labelNode[_xfa_object.$text]());
  52346. const value = createText(valueNode[_xfa_object.$text]());
  52347. labels[_xfa_object.$appendChild](label);
  52348. labels.text.push(label);
  52349. values[_xfa_object.$appendChild](value);
  52350. values.text.push(value);
  52351. }
  52352. }
  52353. }
  52354. _bindOccurrences(formNode, matches, picture) {
  52355. let baseClone;
  52356. if (matches.length > 1) {
  52357. baseClone = formNode[_xfa_object.$clone]();
  52358. baseClone[_xfa_object.$removeChild](baseClone.occur);
  52359. baseClone.occur = null;
  52360. }
  52361. this._bindValue(formNode, matches[0], picture);
  52362. this._setProperties(formNode, matches[0]);
  52363. this._bindItems(formNode, matches[0]);
  52364. if (matches.length === 1) {
  52365. return;
  52366. }
  52367. const parent = formNode[_xfa_object.$getParent]();
  52368. const name = formNode[_xfa_object.$nodeName];
  52369. const pos = parent[_xfa_object.$indexOf](formNode);
  52370. for (let i = 1, ii = matches.length; i < ii; i++) {
  52371. const match = matches[i];
  52372. const clone = baseClone[_xfa_object.$clone]();
  52373. parent[name].push(clone);
  52374. parent[_xfa_object.$insertAt](pos + i, clone);
  52375. this._bindValue(clone, match, picture);
  52376. this._setProperties(clone, match);
  52377. this._bindItems(clone, match);
  52378. }
  52379. }
  52380. _createOccurrences(formNode) {
  52381. if (!this.emptyMerge) {
  52382. return;
  52383. }
  52384. const {
  52385. occur
  52386. } = formNode;
  52387. if (!occur || occur.initial <= 1) {
  52388. return;
  52389. }
  52390. const parent = formNode[_xfa_object.$getParent]();
  52391. const name = formNode[_xfa_object.$nodeName];
  52392. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  52393. return;
  52394. }
  52395. let currentNumber;
  52396. if (formNode.name) {
  52397. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  52398. } else {
  52399. currentNumber = parent[name].children.length;
  52400. }
  52401. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  52402. const ii = occur.initial - currentNumber;
  52403. if (ii) {
  52404. const nodeClone = formNode[_xfa_object.$clone]();
  52405. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  52406. nodeClone.occur = null;
  52407. parent[name].push(nodeClone);
  52408. parent[_xfa_object.$insertAt](pos, nodeClone);
  52409. for (let i = 1; i < ii; i++) {
  52410. const clone = nodeClone[_xfa_object.$clone]();
  52411. parent[name].push(clone);
  52412. parent[_xfa_object.$insertAt](pos + i, clone);
  52413. }
  52414. }
  52415. }
  52416. _getOccurInfo(formNode) {
  52417. const {
  52418. name,
  52419. occur
  52420. } = formNode;
  52421. if (!occur || !name) {
  52422. return [1, 1];
  52423. }
  52424. const max = occur.max === -1 ? Infinity : occur.max;
  52425. return [occur.min, max];
  52426. }
  52427. _setAndBind(formNode, dataNode) {
  52428. this._setProperties(formNode, dataNode);
  52429. this._bindItems(formNode, dataNode);
  52430. this._bindElement(formNode, dataNode);
  52431. }
  52432. _bindElement(formNode, dataNode) {
  52433. const uselessNodes = [];
  52434. this._createOccurrences(formNode);
  52435. for (const child of formNode[_xfa_object.$getChildren]()) {
  52436. if (child[_xfa_object.$data]) {
  52437. continue;
  52438. }
  52439. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  52440. this._mergeMode = child.mergeMode === "consumeData";
  52441. const dataChildren = dataNode[_xfa_object.$getChildren]();
  52442. if (dataChildren.length > 0) {
  52443. this._bindOccurrences(child, [dataChildren[0]], null);
  52444. } else if (this.emptyMerge) {
  52445. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  52446. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  52447. dataNode[_xfa_object.$appendChild](dataChild);
  52448. this._bindElement(child, dataChild);
  52449. }
  52450. continue;
  52451. }
  52452. if (!child[_xfa_object.$isBindable]()) {
  52453. continue;
  52454. }
  52455. let global = false;
  52456. let picture = null;
  52457. let ref = null;
  52458. let match = null;
  52459. if (child.bind) {
  52460. switch (child.bind.match) {
  52461. case "none":
  52462. this._setAndBind(child, dataNode);
  52463. continue;
  52464. case "global":
  52465. global = true;
  52466. break;
  52467. case "dataRef":
  52468. if (!child.bind.ref) {
  52469. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  52470. this._setAndBind(child, dataNode);
  52471. continue;
  52472. }
  52473. ref = child.bind.ref;
  52474. break;
  52475. default:
  52476. break;
  52477. }
  52478. if (child.bind.picture) {
  52479. picture = child.bind.picture[_xfa_object.$content];
  52480. }
  52481. }
  52482. const [min, max] = this._getOccurInfo(child);
  52483. if (ref) {
  52484. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  52485. if (match === null) {
  52486. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  52487. if (!match) {
  52488. continue;
  52489. }
  52490. if (this._isConsumeData()) {
  52491. match[_xfa_object.$consumed] = true;
  52492. }
  52493. this._setAndBind(child, match);
  52494. continue;
  52495. } else {
  52496. if (this._isConsumeData()) {
  52497. match = match.filter(node => !node[_xfa_object.$consumed]);
  52498. }
  52499. if (match.length > max) {
  52500. match = match.slice(0, max);
  52501. } else if (match.length === 0) {
  52502. match = null;
  52503. }
  52504. if (match && this._isConsumeData()) {
  52505. match.forEach(node => {
  52506. node[_xfa_object.$consumed] = true;
  52507. });
  52508. }
  52509. }
  52510. } else {
  52511. if (!child.name) {
  52512. this._setAndBind(child, dataNode);
  52513. continue;
  52514. }
  52515. if (this._isConsumeData()) {
  52516. const matches = [];
  52517. while (matches.length < max) {
  52518. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  52519. if (!found) {
  52520. break;
  52521. }
  52522. found[_xfa_object.$consumed] = true;
  52523. matches.push(found);
  52524. }
  52525. match = matches.length > 0 ? matches : null;
  52526. } else {
  52527. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  52528. if (!match) {
  52529. if (min === 0) {
  52530. uselessNodes.push(child);
  52531. continue;
  52532. }
  52533. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  52534. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  52535. if (this.emptyMerge) {
  52536. match[_xfa_object.$consumed] = true;
  52537. }
  52538. dataNode[_xfa_object.$appendChild](match);
  52539. this._setAndBind(child, match);
  52540. continue;
  52541. }
  52542. if (this.emptyMerge) {
  52543. match[_xfa_object.$consumed] = true;
  52544. }
  52545. match = [match];
  52546. }
  52547. }
  52548. if (match) {
  52549. this._bindOccurrences(child, match, picture);
  52550. } else if (min > 0) {
  52551. this._setAndBind(child, dataNode);
  52552. } else {
  52553. uselessNodes.push(child);
  52554. }
  52555. }
  52556. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  52557. }
  52558. }
  52559. exports.Binder = Binder;
  52560. /***/ }),
  52561. /* 82 */
  52562. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52563. Object.defineProperty(exports, "__esModule", ({
  52564. value: true
  52565. }));
  52566. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  52567. var _xfa_object = __w_pdfjs_require__(77);
  52568. var _namespaces = __w_pdfjs_require__(79);
  52569. var _layout = __w_pdfjs_require__(83);
  52570. var _html_utils = __w_pdfjs_require__(84);
  52571. var _utils = __w_pdfjs_require__(78);
  52572. var _util = __w_pdfjs_require__(2);
  52573. var _fonts = __w_pdfjs_require__(85);
  52574. var _core_utils = __w_pdfjs_require__(8);
  52575. var _som = __w_pdfjs_require__(80);
  52576. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  52577. const SVG_NS = "http://www.w3.org/2000/svg";
  52578. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  52579. const MAX_EMPTY_PAGES = 3;
  52580. const DEFAULT_TAB_INDEX = 5000;
  52581. const HEADING_PATTERN = /^H(\d+)$/;
  52582. 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"]);
  52583. 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"]];
  52584. function getBorderDims(node) {
  52585. if (!node || !node.border) {
  52586. return {
  52587. w: 0,
  52588. h: 0
  52589. };
  52590. }
  52591. const borderExtra = node.border[_xfa_object.$getExtra]();
  52592. if (!borderExtra) {
  52593. return {
  52594. w: 0,
  52595. h: 0
  52596. };
  52597. }
  52598. return {
  52599. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  52600. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  52601. };
  52602. }
  52603. function hasMargin(node) {
  52604. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  52605. }
  52606. function _setValue(templateNode, value) {
  52607. if (!templateNode.value) {
  52608. const nodeValue = new Value({});
  52609. templateNode[_xfa_object.$appendChild](nodeValue);
  52610. templateNode.value = nodeValue;
  52611. }
  52612. templateNode.value[_xfa_object.$setValue](value);
  52613. }
  52614. function* getContainedChildren(node) {
  52615. for (const child of node[_xfa_object.$getChildren]()) {
  52616. if (child instanceof SubformSet) {
  52617. yield* child[_xfa_object.$getContainedChildren]();
  52618. continue;
  52619. }
  52620. yield child;
  52621. }
  52622. }
  52623. function setTabIndex(node) {
  52624. while (node) {
  52625. if (!node.traversal) {
  52626. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52627. return;
  52628. }
  52629. if (node[_xfa_object.$tabIndex]) {
  52630. return;
  52631. }
  52632. let next = null;
  52633. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  52634. if (child.operation === "next") {
  52635. next = child;
  52636. break;
  52637. }
  52638. }
  52639. if (!next || !next.ref) {
  52640. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52641. return;
  52642. }
  52643. const root = node[_xfa_object.$getTemplateRoot]();
  52644. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  52645. const ref = root[_xfa_object.$searchNode](next.ref, node);
  52646. if (!ref) {
  52647. return;
  52648. }
  52649. node = ref[0];
  52650. }
  52651. }
  52652. function applyAssist(obj, attributes) {
  52653. const assist = obj.assist;
  52654. if (assist) {
  52655. const assistTitle = assist[_xfa_object.$toHTML]();
  52656. if (assistTitle) {
  52657. attributes.title = assistTitle;
  52658. }
  52659. const role = assist.role;
  52660. const match = role.match(HEADING_PATTERN);
  52661. if (match) {
  52662. const ariaRole = "heading";
  52663. const ariaLevel = match[1];
  52664. attributes.role = ariaRole;
  52665. attributes["aria-level"] = ariaLevel;
  52666. }
  52667. }
  52668. if (obj.layout === "table") {
  52669. attributes.role = "table";
  52670. } else if (obj.layout === "row") {
  52671. attributes.role = "row";
  52672. } else {
  52673. const parent = obj[_xfa_object.$getParent]();
  52674. if (parent.layout === "row") {
  52675. if (parent.assist && parent.assist.role === "TH") {
  52676. attributes.role = "columnheader";
  52677. } else {
  52678. attributes.role = "cell";
  52679. }
  52680. }
  52681. }
  52682. }
  52683. function ariaLabel(obj) {
  52684. if (!obj.assist) {
  52685. return null;
  52686. }
  52687. const assist = obj.assist;
  52688. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  52689. return assist.speak[_xfa_object.$content];
  52690. }
  52691. if (assist.toolTip) {
  52692. return assist.toolTip[_xfa_object.$content];
  52693. }
  52694. return null;
  52695. }
  52696. function valueToHtml(value) {
  52697. return _utils.HTMLResult.success({
  52698. name: "div",
  52699. attributes: {
  52700. class: ["xfaRich"],
  52701. style: Object.create(null)
  52702. },
  52703. children: [{
  52704. name: "span",
  52705. attributes: {
  52706. style: Object.create(null)
  52707. },
  52708. value
  52709. }]
  52710. });
  52711. }
  52712. function setFirstUnsplittable(node) {
  52713. const root = node[_xfa_object.$getTemplateRoot]();
  52714. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  52715. root[_xfa_object.$extra].firstUnsplittable = node;
  52716. root[_xfa_object.$extra].noLayoutFailure = true;
  52717. }
  52718. }
  52719. function unsetFirstUnsplittable(node) {
  52720. const root = node[_xfa_object.$getTemplateRoot]();
  52721. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  52722. root[_xfa_object.$extra].noLayoutFailure = false;
  52723. }
  52724. }
  52725. function handleBreak(node) {
  52726. if (node[_xfa_object.$extra]) {
  52727. return false;
  52728. }
  52729. node[_xfa_object.$extra] = Object.create(null);
  52730. if (node.targetType === "auto") {
  52731. return false;
  52732. }
  52733. const root = node[_xfa_object.$getTemplateRoot]();
  52734. let target = null;
  52735. if (node.target) {
  52736. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  52737. if (!target) {
  52738. return false;
  52739. }
  52740. target = target[0];
  52741. }
  52742. const {
  52743. currentPageArea,
  52744. currentContentArea
  52745. } = root[_xfa_object.$extra];
  52746. if (node.targetType === "pageArea") {
  52747. if (!(target instanceof PageArea)) {
  52748. target = null;
  52749. }
  52750. if (node.startNew) {
  52751. node[_xfa_object.$extra].target = target || currentPageArea;
  52752. return true;
  52753. } else if (target && target !== currentPageArea) {
  52754. node[_xfa_object.$extra].target = target;
  52755. return true;
  52756. }
  52757. return false;
  52758. }
  52759. if (!(target instanceof ContentArea)) {
  52760. target = null;
  52761. }
  52762. const pageArea = target && target[_xfa_object.$getParent]();
  52763. let index;
  52764. let nextPageArea = pageArea;
  52765. if (node.startNew) {
  52766. if (target) {
  52767. const contentAreas = pageArea.contentArea.children;
  52768. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  52769. const indexForTarget = contentAreas.indexOf(target);
  52770. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  52771. nextPageArea = null;
  52772. }
  52773. index = indexForTarget - 1;
  52774. } else {
  52775. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  52776. }
  52777. } else if (target && target !== currentContentArea) {
  52778. const contentAreas = pageArea.contentArea.children;
  52779. index = contentAreas.indexOf(target) - 1;
  52780. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  52781. } else {
  52782. return false;
  52783. }
  52784. node[_xfa_object.$extra].target = nextPageArea;
  52785. node[_xfa_object.$extra].index = index;
  52786. return true;
  52787. }
  52788. function handleOverflow(node, extraNode, space) {
  52789. const root = node[_xfa_object.$getTemplateRoot]();
  52790. const saved = root[_xfa_object.$extra].noLayoutFailure;
  52791. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  52792. extraNode[_xfa_object.$getSubformParent] = () => node;
  52793. root[_xfa_object.$extra].noLayoutFailure = true;
  52794. const res = extraNode[_xfa_object.$toHTML](space);
  52795. node[_xfa_object.$addHTML](res.html, res.bbox);
  52796. root[_xfa_object.$extra].noLayoutFailure = saved;
  52797. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  52798. }
  52799. class AppearanceFilter extends _xfa_object.StringObject {
  52800. constructor(attributes) {
  52801. super(TEMPLATE_NS_ID, "appearanceFilter");
  52802. this.id = attributes.id || "";
  52803. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52804. this.use = attributes.use || "";
  52805. this.usehref = attributes.usehref || "";
  52806. }
  52807. }
  52808. class Arc extends _xfa_object.XFAObject {
  52809. constructor(attributes) {
  52810. super(TEMPLATE_NS_ID, "arc", true);
  52811. this.circular = (0, _utils.getInteger)({
  52812. data: attributes.circular,
  52813. defaultValue: 0,
  52814. validate: x => x === 1
  52815. });
  52816. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52817. this.id = attributes.id || "";
  52818. this.startAngle = (0, _utils.getFloat)({
  52819. data: attributes.startAngle,
  52820. defaultValue: 0,
  52821. validate: x => true
  52822. });
  52823. this.sweepAngle = (0, _utils.getFloat)({
  52824. data: attributes.sweepAngle,
  52825. defaultValue: 360,
  52826. validate: x => true
  52827. });
  52828. this.use = attributes.use || "";
  52829. this.usehref = attributes.usehref || "";
  52830. this.edge = null;
  52831. this.fill = null;
  52832. }
  52833. [_xfa_object.$toHTML]() {
  52834. const edge = this.edge ? this.edge : new Edge({});
  52835. const edgeStyle = edge[_xfa_object.$toStyle]();
  52836. const style = Object.create(null);
  52837. if (this.fill && this.fill.presence === "visible") {
  52838. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52839. } else {
  52840. style.fill = "transparent";
  52841. }
  52842. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  52843. style.stroke = edgeStyle.color;
  52844. let arc;
  52845. const attributes = {
  52846. xmlns: SVG_NS,
  52847. style: {
  52848. width: "100%",
  52849. height: "100%",
  52850. overflow: "visible"
  52851. }
  52852. };
  52853. if (this.sweepAngle === 360) {
  52854. arc = {
  52855. name: "ellipse",
  52856. attributes: {
  52857. xmlns: SVG_NS,
  52858. cx: "50%",
  52859. cy: "50%",
  52860. rx: "50%",
  52861. ry: "50%",
  52862. style
  52863. }
  52864. };
  52865. } else {
  52866. const startAngle = this.startAngle * Math.PI / 180;
  52867. const sweepAngle = this.sweepAngle * Math.PI / 180;
  52868. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  52869. 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))];
  52870. arc = {
  52871. name: "path",
  52872. attributes: {
  52873. xmlns: SVG_NS,
  52874. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  52875. vectorEffect: "non-scaling-stroke",
  52876. style
  52877. }
  52878. };
  52879. Object.assign(attributes, {
  52880. viewBox: "0 0 100 100",
  52881. preserveAspectRatio: "none"
  52882. });
  52883. }
  52884. const svg = {
  52885. name: "svg",
  52886. children: [arc],
  52887. attributes
  52888. };
  52889. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52890. if (hasMargin(parent)) {
  52891. return _utils.HTMLResult.success({
  52892. name: "div",
  52893. attributes: {
  52894. style: {
  52895. display: "inline",
  52896. width: "100%",
  52897. height: "100%"
  52898. }
  52899. },
  52900. children: [svg]
  52901. });
  52902. }
  52903. svg.attributes.style.position = "absolute";
  52904. return _utils.HTMLResult.success(svg);
  52905. }
  52906. }
  52907. class Area extends _xfa_object.XFAObject {
  52908. constructor(attributes) {
  52909. super(TEMPLATE_NS_ID, "area", true);
  52910. this.colSpan = (0, _utils.getInteger)({
  52911. data: attributes.colSpan,
  52912. defaultValue: 1,
  52913. validate: n => n >= 1 || n === -1
  52914. });
  52915. this.id = attributes.id || "";
  52916. this.name = attributes.name || "";
  52917. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52918. this.use = attributes.use || "";
  52919. this.usehref = attributes.usehref || "";
  52920. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52921. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52922. this.desc = null;
  52923. this.extras = null;
  52924. this.area = new _xfa_object.XFAObjectArray();
  52925. this.draw = new _xfa_object.XFAObjectArray();
  52926. this.exObject = new _xfa_object.XFAObjectArray();
  52927. this.exclGroup = new _xfa_object.XFAObjectArray();
  52928. this.field = new _xfa_object.XFAObjectArray();
  52929. this.subform = new _xfa_object.XFAObjectArray();
  52930. this.subformSet = new _xfa_object.XFAObjectArray();
  52931. }
  52932. *[_xfa_object.$getContainedChildren]() {
  52933. yield* getContainedChildren(this);
  52934. }
  52935. [_xfa_object.$isTransparent]() {
  52936. return true;
  52937. }
  52938. [_xfa_object.$isBindable]() {
  52939. return true;
  52940. }
  52941. [_xfa_object.$addHTML](html, bbox) {
  52942. const [x, y, w, h] = bbox;
  52943. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  52944. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  52945. this[_xfa_object.$extra].children.push(html);
  52946. }
  52947. [_xfa_object.$getAvailableSpace]() {
  52948. return this[_xfa_object.$extra].availableSpace;
  52949. }
  52950. [_xfa_object.$toHTML](availableSpace) {
  52951. const style = (0, _html_utils.toStyle)(this, "position");
  52952. const attributes = {
  52953. style,
  52954. id: this[_xfa_object.$uid],
  52955. class: ["xfaArea"]
  52956. };
  52957. if ((0, _html_utils.isPrintOnly)(this)) {
  52958. attributes.class.push("xfaPrintOnly");
  52959. }
  52960. if (this.name) {
  52961. attributes.xfaName = this.name;
  52962. }
  52963. const children = [];
  52964. this[_xfa_object.$extra] = {
  52965. children,
  52966. width: 0,
  52967. height: 0,
  52968. availableSpace
  52969. };
  52970. const result = this[_xfa_object.$childrenToHTML]({
  52971. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  52972. include: true
  52973. });
  52974. if (!result.success) {
  52975. if (result.isBreak()) {
  52976. return result;
  52977. }
  52978. delete this[_xfa_object.$extra];
  52979. return _utils.HTMLResult.FAILURE;
  52980. }
  52981. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  52982. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  52983. const html = {
  52984. name: "div",
  52985. attributes,
  52986. children
  52987. };
  52988. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  52989. delete this[_xfa_object.$extra];
  52990. return _utils.HTMLResult.success(html, bbox);
  52991. }
  52992. }
  52993. class Assist extends _xfa_object.XFAObject {
  52994. constructor(attributes) {
  52995. super(TEMPLATE_NS_ID, "assist", true);
  52996. this.id = attributes.id || "";
  52997. this.role = attributes.role || "";
  52998. this.use = attributes.use || "";
  52999. this.usehref = attributes.usehref || "";
  53000. this.speak = null;
  53001. this.toolTip = null;
  53002. }
  53003. [_xfa_object.$toHTML]() {
  53004. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  53005. }
  53006. }
  53007. class Barcode extends _xfa_object.XFAObject {
  53008. constructor(attributes) {
  53009. super(TEMPLATE_NS_ID, "barcode", true);
  53010. this.charEncoding = (0, _utils.getKeyword)({
  53011. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  53012. defaultValue: "",
  53013. 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}/)
  53014. });
  53015. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  53016. this.dataColumnCount = (0, _utils.getInteger)({
  53017. data: attributes.dataColumnCount,
  53018. defaultValue: -1,
  53019. validate: x => x >= 0
  53020. });
  53021. this.dataLength = (0, _utils.getInteger)({
  53022. data: attributes.dataLength,
  53023. defaultValue: -1,
  53024. validate: x => x >= 0
  53025. });
  53026. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  53027. this.dataRowCount = (0, _utils.getInteger)({
  53028. data: attributes.dataRowCount,
  53029. defaultValue: -1,
  53030. validate: x => x >= 0
  53031. });
  53032. this.endChar = attributes.endChar || "";
  53033. this.errorCorrectionLevel = (0, _utils.getInteger)({
  53034. data: attributes.errorCorrectionLevel,
  53035. defaultValue: -1,
  53036. validate: x => x >= 0 && x <= 8
  53037. });
  53038. this.id = attributes.id || "";
  53039. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  53040. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  53041. this.printCheckDigit = (0, _utils.getInteger)({
  53042. data: attributes.printCheckDigit,
  53043. defaultValue: 0,
  53044. validate: x => x === 1
  53045. });
  53046. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  53047. this.startChar = attributes.startChar || "";
  53048. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  53049. this.truncate = (0, _utils.getInteger)({
  53050. data: attributes.truncate,
  53051. defaultValue: 0,
  53052. validate: x => x === 1
  53053. });
  53054. 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"]);
  53055. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  53056. this.use = attributes.use || "";
  53057. this.usehref = attributes.usehref || "";
  53058. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  53059. this.encrypt = null;
  53060. this.extras = null;
  53061. }
  53062. }
  53063. class Bind extends _xfa_object.XFAObject {
  53064. constructor(attributes) {
  53065. super(TEMPLATE_NS_ID, "bind", true);
  53066. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  53067. this.ref = attributes.ref || "";
  53068. this.picture = null;
  53069. }
  53070. }
  53071. class BindItems extends _xfa_object.XFAObject {
  53072. constructor(attributes) {
  53073. super(TEMPLATE_NS_ID, "bindItems");
  53074. this.connection = attributes.connection || "";
  53075. this.labelRef = attributes.labelRef || "";
  53076. this.ref = attributes.ref || "";
  53077. this.valueRef = attributes.valueRef || "";
  53078. }
  53079. }
  53080. exports.BindItems = BindItems;
  53081. class Bookend extends _xfa_object.XFAObject {
  53082. constructor(attributes) {
  53083. super(TEMPLATE_NS_ID, "bookend");
  53084. this.id = attributes.id || "";
  53085. this.leader = attributes.leader || "";
  53086. this.trailer = attributes.trailer || "";
  53087. this.use = attributes.use || "";
  53088. this.usehref = attributes.usehref || "";
  53089. }
  53090. }
  53091. class BooleanElement extends _xfa_object.Option01 {
  53092. constructor(attributes) {
  53093. super(TEMPLATE_NS_ID, "boolean");
  53094. this.id = attributes.id || "";
  53095. this.name = attributes.name || "";
  53096. this.use = attributes.use || "";
  53097. this.usehref = attributes.usehref || "";
  53098. }
  53099. [_xfa_object.$toHTML](availableSpace) {
  53100. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  53101. }
  53102. }
  53103. class Border extends _xfa_object.XFAObject {
  53104. constructor(attributes) {
  53105. super(TEMPLATE_NS_ID, "border", true);
  53106. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  53107. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53108. this.id = attributes.id || "";
  53109. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53110. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53111. this.use = attributes.use || "";
  53112. this.usehref = attributes.usehref || "";
  53113. this.corner = new _xfa_object.XFAObjectArray(4);
  53114. this.edge = new _xfa_object.XFAObjectArray(4);
  53115. this.extras = null;
  53116. this.fill = null;
  53117. this.margin = null;
  53118. }
  53119. [_xfa_object.$getExtra]() {
  53120. if (!this[_xfa_object.$extra]) {
  53121. const edges = this.edge.children.slice();
  53122. if (edges.length < 4) {
  53123. const defaultEdge = edges[edges.length - 1] || new Edge({});
  53124. for (let i = edges.length; i < 4; i++) {
  53125. edges.push(defaultEdge);
  53126. }
  53127. }
  53128. const widths = edges.map(edge => edge.thickness);
  53129. const insets = [0, 0, 0, 0];
  53130. if (this.margin) {
  53131. insets[0] = this.margin.topInset;
  53132. insets[1] = this.margin.rightInset;
  53133. insets[2] = this.margin.bottomInset;
  53134. insets[3] = this.margin.leftInset;
  53135. }
  53136. this[_xfa_object.$extra] = {
  53137. widths,
  53138. insets,
  53139. edges
  53140. };
  53141. }
  53142. return this[_xfa_object.$extra];
  53143. }
  53144. [_xfa_object.$toStyle]() {
  53145. const {
  53146. edges
  53147. } = this[_xfa_object.$getExtra]();
  53148. const edgeStyles = edges.map(node => {
  53149. const style = node[_xfa_object.$toStyle]();
  53150. style.color = style.color || "#000000";
  53151. return style;
  53152. });
  53153. const style = Object.create(null);
  53154. if (this.margin) {
  53155. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  53156. }
  53157. if (this.fill && this.fill.presence === "visible") {
  53158. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53159. }
  53160. if (this.corner.children.some(node => node.radius !== 0)) {
  53161. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  53162. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  53163. const last = cornerStyles[cornerStyles.length - 1];
  53164. for (let i = cornerStyles.length; i < 4; i++) {
  53165. cornerStyles.push(last);
  53166. }
  53167. }
  53168. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  53169. }
  53170. switch (this.presence) {
  53171. case "invisible":
  53172. case "hidden":
  53173. style.borderStyle = "";
  53174. break;
  53175. case "inactive":
  53176. style.borderStyle = "none";
  53177. break;
  53178. default:
  53179. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  53180. break;
  53181. }
  53182. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  53183. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  53184. return style;
  53185. }
  53186. }
  53187. class Break extends _xfa_object.XFAObject {
  53188. constructor(attributes) {
  53189. super(TEMPLATE_NS_ID, "break", true);
  53190. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53191. this.afterTarget = attributes.afterTarget || "";
  53192. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53193. this.beforeTarget = attributes.beforeTarget || "";
  53194. this.bookendLeader = attributes.bookendLeader || "";
  53195. this.bookendTrailer = attributes.bookendTrailer || "";
  53196. this.id = attributes.id || "";
  53197. this.overflowLeader = attributes.overflowLeader || "";
  53198. this.overflowTarget = attributes.overflowTarget || "";
  53199. this.overflowTrailer = attributes.overflowTrailer || "";
  53200. this.startNew = (0, _utils.getInteger)({
  53201. data: attributes.startNew,
  53202. defaultValue: 0,
  53203. validate: x => x === 1
  53204. });
  53205. this.use = attributes.use || "";
  53206. this.usehref = attributes.usehref || "";
  53207. this.extras = null;
  53208. }
  53209. }
  53210. class BreakAfter extends _xfa_object.XFAObject {
  53211. constructor(attributes) {
  53212. super(TEMPLATE_NS_ID, "breakAfter", true);
  53213. this.id = attributes.id || "";
  53214. this.leader = attributes.leader || "";
  53215. this.startNew = (0, _utils.getInteger)({
  53216. data: attributes.startNew,
  53217. defaultValue: 0,
  53218. validate: x => x === 1
  53219. });
  53220. this.target = attributes.target || "";
  53221. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53222. this.trailer = attributes.trailer || "";
  53223. this.use = attributes.use || "";
  53224. this.usehref = attributes.usehref || "";
  53225. this.script = null;
  53226. }
  53227. }
  53228. class BreakBefore extends _xfa_object.XFAObject {
  53229. constructor(attributes) {
  53230. super(TEMPLATE_NS_ID, "breakBefore", true);
  53231. this.id = attributes.id || "";
  53232. this.leader = attributes.leader || "";
  53233. this.startNew = (0, _utils.getInteger)({
  53234. data: attributes.startNew,
  53235. defaultValue: 0,
  53236. validate: x => x === 1
  53237. });
  53238. this.target = attributes.target || "";
  53239. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53240. this.trailer = attributes.trailer || "";
  53241. this.use = attributes.use || "";
  53242. this.usehref = attributes.usehref || "";
  53243. this.script = null;
  53244. }
  53245. [_xfa_object.$toHTML](availableSpace) {
  53246. this[_xfa_object.$extra] = {};
  53247. return _utils.HTMLResult.FAILURE;
  53248. }
  53249. }
  53250. class Button extends _xfa_object.XFAObject {
  53251. constructor(attributes) {
  53252. super(TEMPLATE_NS_ID, "button", true);
  53253. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  53254. this.id = attributes.id || "";
  53255. this.use = attributes.use || "";
  53256. this.usehref = attributes.usehref || "";
  53257. this.extras = null;
  53258. }
  53259. [_xfa_object.$toHTML](availableSpace) {
  53260. const parent = this[_xfa_object.$getParent]();
  53261. const grandpa = parent[_xfa_object.$getParent]();
  53262. const htmlButton = {
  53263. name: "button",
  53264. attributes: {
  53265. id: this[_xfa_object.$uid],
  53266. class: ["xfaButton"],
  53267. style: {}
  53268. },
  53269. children: []
  53270. };
  53271. for (const event of grandpa.event.children) {
  53272. if (event.activity !== "click" || !event.script) {
  53273. continue;
  53274. }
  53275. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  53276. if (!jsURL) {
  53277. continue;
  53278. }
  53279. const href = (0, _html_utils.fixURL)(jsURL.url);
  53280. if (!href) {
  53281. continue;
  53282. }
  53283. htmlButton.children.push({
  53284. name: "a",
  53285. attributes: {
  53286. id: "link" + this[_xfa_object.$uid],
  53287. href,
  53288. newWindow: jsURL.newWindow,
  53289. class: ["xfaLink"],
  53290. style: {}
  53291. },
  53292. children: []
  53293. });
  53294. }
  53295. return _utils.HTMLResult.success(htmlButton);
  53296. }
  53297. }
  53298. class Calculate extends _xfa_object.XFAObject {
  53299. constructor(attributes) {
  53300. super(TEMPLATE_NS_ID, "calculate", true);
  53301. this.id = attributes.id || "";
  53302. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  53303. this.use = attributes.use || "";
  53304. this.usehref = attributes.usehref || "";
  53305. this.extras = null;
  53306. this.message = null;
  53307. this.script = null;
  53308. }
  53309. }
  53310. class Caption extends _xfa_object.XFAObject {
  53311. constructor(attributes) {
  53312. super(TEMPLATE_NS_ID, "caption", true);
  53313. this.id = attributes.id || "";
  53314. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  53315. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53316. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  53317. this.use = attributes.use || "";
  53318. this.usehref = attributes.usehref || "";
  53319. this.extras = null;
  53320. this.font = null;
  53321. this.margin = null;
  53322. this.para = null;
  53323. this.value = null;
  53324. }
  53325. [_xfa_object.$setValue](value) {
  53326. _setValue(this, value);
  53327. }
  53328. [_xfa_object.$getExtra](availableSpace) {
  53329. if (!this[_xfa_object.$extra]) {
  53330. let {
  53331. width,
  53332. height
  53333. } = availableSpace;
  53334. switch (this.placement) {
  53335. case "left":
  53336. case "right":
  53337. case "inline":
  53338. width = this.reserve <= 0 ? width : this.reserve;
  53339. break;
  53340. case "top":
  53341. case "bottom":
  53342. height = this.reserve <= 0 ? height : this.reserve;
  53343. break;
  53344. }
  53345. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  53346. width,
  53347. height
  53348. });
  53349. }
  53350. return this[_xfa_object.$extra];
  53351. }
  53352. [_xfa_object.$toHTML](availableSpace) {
  53353. if (!this.value) {
  53354. return _utils.HTMLResult.EMPTY;
  53355. }
  53356. this[_xfa_object.$pushPara]();
  53357. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  53358. if (!value) {
  53359. this[_xfa_object.$popPara]();
  53360. return _utils.HTMLResult.EMPTY;
  53361. }
  53362. const savedReserve = this.reserve;
  53363. if (this.reserve <= 0) {
  53364. const {
  53365. w,
  53366. h
  53367. } = this[_xfa_object.$getExtra](availableSpace);
  53368. switch (this.placement) {
  53369. case "left":
  53370. case "right":
  53371. case "inline":
  53372. this.reserve = w;
  53373. break;
  53374. case "top":
  53375. case "bottom":
  53376. this.reserve = h;
  53377. break;
  53378. }
  53379. }
  53380. const children = [];
  53381. if (typeof value === "string") {
  53382. children.push({
  53383. name: "#text",
  53384. value
  53385. });
  53386. } else {
  53387. children.push(value);
  53388. }
  53389. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  53390. switch (this.placement) {
  53391. case "left":
  53392. case "right":
  53393. if (this.reserve > 0) {
  53394. style.width = (0, _html_utils.measureToString)(this.reserve);
  53395. }
  53396. break;
  53397. case "top":
  53398. case "bottom":
  53399. if (this.reserve > 0) {
  53400. style.height = (0, _html_utils.measureToString)(this.reserve);
  53401. }
  53402. break;
  53403. }
  53404. (0, _html_utils.setPara)(this, null, value);
  53405. this[_xfa_object.$popPara]();
  53406. this.reserve = savedReserve;
  53407. return _utils.HTMLResult.success({
  53408. name: "div",
  53409. attributes: {
  53410. style,
  53411. class: ["xfaCaption"]
  53412. },
  53413. children
  53414. });
  53415. }
  53416. }
  53417. class Certificate extends _xfa_object.StringObject {
  53418. constructor(attributes) {
  53419. super(TEMPLATE_NS_ID, "certificate");
  53420. this.id = attributes.id || "";
  53421. this.name = attributes.name || "";
  53422. this.use = attributes.use || "";
  53423. this.usehref = attributes.usehref || "";
  53424. }
  53425. }
  53426. class Certificates extends _xfa_object.XFAObject {
  53427. constructor(attributes) {
  53428. super(TEMPLATE_NS_ID, "certificates", true);
  53429. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  53430. this.id = attributes.id || "";
  53431. this.url = attributes.url || "";
  53432. this.urlPolicy = attributes.urlPolicy || "";
  53433. this.use = attributes.use || "";
  53434. this.usehref = attributes.usehref || "";
  53435. this.encryption = null;
  53436. this.issuers = null;
  53437. this.keyUsage = null;
  53438. this.oids = null;
  53439. this.signing = null;
  53440. this.subjectDNs = null;
  53441. }
  53442. }
  53443. class CheckButton extends _xfa_object.XFAObject {
  53444. constructor(attributes) {
  53445. super(TEMPLATE_NS_ID, "checkButton", true);
  53446. this.id = attributes.id || "";
  53447. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  53448. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  53449. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  53450. this.use = attributes.use || "";
  53451. this.usehref = attributes.usehref || "";
  53452. this.border = null;
  53453. this.extras = null;
  53454. this.margin = null;
  53455. }
  53456. [_xfa_object.$toHTML](availableSpace) {
  53457. const style = (0, _html_utils.toStyle)("margin");
  53458. const size = (0, _html_utils.measureToString)(this.size);
  53459. style.width = style.height = size;
  53460. let type;
  53461. let className;
  53462. let groupId;
  53463. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53464. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  53465. const exportedValue = {
  53466. on: (items[0] !== undefined ? items[0] : "on").toString(),
  53467. off: (items[1] !== undefined ? items[1] : "off").toString()
  53468. };
  53469. const value = field.value && field.value[_xfa_object.$text]() || "off";
  53470. const checked = value === exportedValue.on || undefined;
  53471. const container = field[_xfa_object.$getSubformParent]();
  53472. const fieldId = field[_xfa_object.$uid];
  53473. let dataId;
  53474. if (container instanceof ExclGroup) {
  53475. groupId = container[_xfa_object.$uid];
  53476. type = "radio";
  53477. className = "xfaRadio";
  53478. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  53479. } else {
  53480. type = "checkbox";
  53481. className = "xfaCheckbox";
  53482. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  53483. }
  53484. const input = {
  53485. name: "input",
  53486. attributes: {
  53487. class: [className],
  53488. style,
  53489. fieldId,
  53490. dataId,
  53491. type,
  53492. checked,
  53493. xfaOn: exportedValue.on,
  53494. xfaOff: exportedValue.off,
  53495. "aria-label": ariaLabel(field)
  53496. }
  53497. };
  53498. if (groupId) {
  53499. input.attributes.name = groupId;
  53500. }
  53501. return _utils.HTMLResult.success({
  53502. name: "label",
  53503. attributes: {
  53504. class: ["xfaLabel"]
  53505. },
  53506. children: [input]
  53507. });
  53508. }
  53509. }
  53510. class ChoiceList extends _xfa_object.XFAObject {
  53511. constructor(attributes) {
  53512. super(TEMPLATE_NS_ID, "choiceList", true);
  53513. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  53514. this.id = attributes.id || "";
  53515. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  53516. this.textEntry = (0, _utils.getInteger)({
  53517. data: attributes.textEntry,
  53518. defaultValue: 0,
  53519. validate: x => x === 1
  53520. });
  53521. this.use = attributes.use || "";
  53522. this.usehref = attributes.usehref || "";
  53523. this.border = null;
  53524. this.extras = null;
  53525. this.margin = null;
  53526. }
  53527. [_xfa_object.$toHTML](availableSpace) {
  53528. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  53529. const ui = this[_xfa_object.$getParent]();
  53530. const field = ui[_xfa_object.$getParent]();
  53531. const fontSize = field.font && field.font.size || 10;
  53532. const optionStyle = {
  53533. fontSize: `calc(${fontSize}px * var(--zoom-factor))`
  53534. };
  53535. const children = [];
  53536. if (field.items.children.length > 0) {
  53537. const items = field.items;
  53538. let displayedIndex = 0;
  53539. let saveIndex = 0;
  53540. if (items.children.length === 2) {
  53541. displayedIndex = items.children[0].save;
  53542. saveIndex = 1 - displayedIndex;
  53543. }
  53544. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  53545. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  53546. let selected = false;
  53547. const value = field.value && field.value[_xfa_object.$text]() || "";
  53548. for (let i = 0, ii = displayed.length; i < ii; i++) {
  53549. const option = {
  53550. name: "option",
  53551. attributes: {
  53552. value: values[i] || displayed[i],
  53553. style: optionStyle
  53554. },
  53555. value: displayed[i]
  53556. };
  53557. if (values[i] === value) {
  53558. option.attributes.selected = selected = true;
  53559. }
  53560. children.push(option);
  53561. }
  53562. if (!selected) {
  53563. children.splice(0, 0, {
  53564. name: "option",
  53565. attributes: {
  53566. hidden: true,
  53567. selected: true
  53568. },
  53569. value: " "
  53570. });
  53571. }
  53572. }
  53573. const selectAttributes = {
  53574. class: ["xfaSelect"],
  53575. fieldId: field[_xfa_object.$uid],
  53576. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53577. style,
  53578. "aria-label": ariaLabel(field)
  53579. };
  53580. if (this.open === "multiSelect") {
  53581. selectAttributes.multiple = true;
  53582. }
  53583. return _utils.HTMLResult.success({
  53584. name: "label",
  53585. attributes: {
  53586. class: ["xfaLabel"]
  53587. },
  53588. children: [{
  53589. name: "select",
  53590. children,
  53591. attributes: selectAttributes
  53592. }]
  53593. });
  53594. }
  53595. }
  53596. class Color extends _xfa_object.XFAObject {
  53597. constructor(attributes) {
  53598. super(TEMPLATE_NS_ID, "color", true);
  53599. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  53600. this.id = attributes.id || "";
  53601. this.use = attributes.use || "";
  53602. this.usehref = attributes.usehref || "";
  53603. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  53604. this.extras = null;
  53605. }
  53606. [_xfa_object.$hasSettableValue]() {
  53607. return false;
  53608. }
  53609. [_xfa_object.$toStyle]() {
  53610. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  53611. }
  53612. }
  53613. class Comb extends _xfa_object.XFAObject {
  53614. constructor(attributes) {
  53615. super(TEMPLATE_NS_ID, "comb");
  53616. this.id = attributes.id || "";
  53617. this.numberOfCells = (0, _utils.getInteger)({
  53618. data: attributes.numberOfCells,
  53619. defaultValue: 0,
  53620. validate: x => x >= 0
  53621. });
  53622. this.use = attributes.use || "";
  53623. this.usehref = attributes.usehref || "";
  53624. }
  53625. }
  53626. class Connect extends _xfa_object.XFAObject {
  53627. constructor(attributes) {
  53628. super(TEMPLATE_NS_ID, "connect", true);
  53629. this.connection = attributes.connection || "";
  53630. this.id = attributes.id || "";
  53631. this.ref = attributes.ref || "";
  53632. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  53633. this.use = attributes.use || "";
  53634. this.usehref = attributes.usehref || "";
  53635. this.picture = null;
  53636. }
  53637. }
  53638. class ContentArea extends _xfa_object.XFAObject {
  53639. constructor(attributes) {
  53640. super(TEMPLATE_NS_ID, "contentArea", true);
  53641. this.h = (0, _utils.getMeasurement)(attributes.h);
  53642. this.id = attributes.id || "";
  53643. this.name = attributes.name || "";
  53644. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53645. this.use = attributes.use || "";
  53646. this.usehref = attributes.usehref || "";
  53647. this.w = (0, _utils.getMeasurement)(attributes.w);
  53648. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53649. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53650. this.desc = null;
  53651. this.extras = null;
  53652. }
  53653. [_xfa_object.$toHTML](availableSpace) {
  53654. const left = (0, _html_utils.measureToString)(this.x);
  53655. const top = (0, _html_utils.measureToString)(this.y);
  53656. const style = {
  53657. left,
  53658. top,
  53659. width: (0, _html_utils.measureToString)(this.w),
  53660. height: (0, _html_utils.measureToString)(this.h)
  53661. };
  53662. const classNames = ["xfaContentarea"];
  53663. if ((0, _html_utils.isPrintOnly)(this)) {
  53664. classNames.push("xfaPrintOnly");
  53665. }
  53666. return _utils.HTMLResult.success({
  53667. name: "div",
  53668. children: [],
  53669. attributes: {
  53670. style,
  53671. class: classNames,
  53672. id: this[_xfa_object.$uid]
  53673. }
  53674. });
  53675. }
  53676. }
  53677. class Corner extends _xfa_object.XFAObject {
  53678. constructor(attributes) {
  53679. super(TEMPLATE_NS_ID, "corner", true);
  53680. this.id = attributes.id || "";
  53681. this.inverted = (0, _utils.getInteger)({
  53682. data: attributes.inverted,
  53683. defaultValue: 0,
  53684. validate: x => x === 1
  53685. });
  53686. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  53687. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53688. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  53689. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53690. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53691. this.use = attributes.use || "";
  53692. this.usehref = attributes.usehref || "";
  53693. this.color = null;
  53694. this.extras = null;
  53695. }
  53696. [_xfa_object.$toStyle]() {
  53697. const style = (0, _html_utils.toStyle)(this, "visibility");
  53698. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  53699. return style;
  53700. }
  53701. }
  53702. class DateElement extends _xfa_object.ContentObject {
  53703. constructor(attributes) {
  53704. super(TEMPLATE_NS_ID, "date");
  53705. this.id = attributes.id || "";
  53706. this.name = attributes.name || "";
  53707. this.use = attributes.use || "";
  53708. this.usehref = attributes.usehref || "";
  53709. }
  53710. [_xfa_object.$finalize]() {
  53711. const date = this[_xfa_object.$content].trim();
  53712. this[_xfa_object.$content] = date ? new Date(date) : null;
  53713. }
  53714. [_xfa_object.$toHTML](availableSpace) {
  53715. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53716. }
  53717. }
  53718. class DateTime extends _xfa_object.ContentObject {
  53719. constructor(attributes) {
  53720. super(TEMPLATE_NS_ID, "dateTime");
  53721. this.id = attributes.id || "";
  53722. this.name = attributes.name || "";
  53723. this.use = attributes.use || "";
  53724. this.usehref = attributes.usehref || "";
  53725. }
  53726. [_xfa_object.$finalize]() {
  53727. const date = this[_xfa_object.$content].trim();
  53728. this[_xfa_object.$content] = date ? new Date(date) : null;
  53729. }
  53730. [_xfa_object.$toHTML](availableSpace) {
  53731. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53732. }
  53733. }
  53734. class DateTimeEdit extends _xfa_object.XFAObject {
  53735. constructor(attributes) {
  53736. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  53737. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  53738. this.id = attributes.id || "";
  53739. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  53740. this.use = attributes.use || "";
  53741. this.usehref = attributes.usehref || "";
  53742. this.border = null;
  53743. this.comb = null;
  53744. this.extras = null;
  53745. this.margin = null;
  53746. }
  53747. [_xfa_object.$toHTML](availableSpace) {
  53748. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  53749. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53750. const html = {
  53751. name: "input",
  53752. attributes: {
  53753. type: "text",
  53754. fieldId: field[_xfa_object.$uid],
  53755. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53756. class: ["xfaTextfield"],
  53757. style,
  53758. "aria-label": ariaLabel(field)
  53759. }
  53760. };
  53761. return _utils.HTMLResult.success({
  53762. name: "label",
  53763. attributes: {
  53764. class: ["xfaLabel"]
  53765. },
  53766. children: [html]
  53767. });
  53768. }
  53769. }
  53770. class Decimal extends _xfa_object.ContentObject {
  53771. constructor(attributes) {
  53772. super(TEMPLATE_NS_ID, "decimal");
  53773. this.fracDigits = (0, _utils.getInteger)({
  53774. data: attributes.fracDigits,
  53775. defaultValue: 2,
  53776. validate: x => true
  53777. });
  53778. this.id = attributes.id || "";
  53779. this.leadDigits = (0, _utils.getInteger)({
  53780. data: attributes.leadDigits,
  53781. defaultValue: -1,
  53782. validate: x => true
  53783. });
  53784. this.name = attributes.name || "";
  53785. this.use = attributes.use || "";
  53786. this.usehref = attributes.usehref || "";
  53787. }
  53788. [_xfa_object.$finalize]() {
  53789. const number = parseFloat(this[_xfa_object.$content].trim());
  53790. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53791. }
  53792. [_xfa_object.$toHTML](availableSpace) {
  53793. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53794. }
  53795. }
  53796. class DefaultUi extends _xfa_object.XFAObject {
  53797. constructor(attributes) {
  53798. super(TEMPLATE_NS_ID, "defaultUi", true);
  53799. this.id = attributes.id || "";
  53800. this.use = attributes.use || "";
  53801. this.usehref = attributes.usehref || "";
  53802. this.extras = null;
  53803. }
  53804. }
  53805. class Desc extends _xfa_object.XFAObject {
  53806. constructor(attributes) {
  53807. super(TEMPLATE_NS_ID, "desc", true);
  53808. this.id = attributes.id || "";
  53809. this.use = attributes.use || "";
  53810. this.usehref = attributes.usehref || "";
  53811. this.boolean = new _xfa_object.XFAObjectArray();
  53812. this.date = new _xfa_object.XFAObjectArray();
  53813. this.dateTime = new _xfa_object.XFAObjectArray();
  53814. this.decimal = new _xfa_object.XFAObjectArray();
  53815. this.exData = new _xfa_object.XFAObjectArray();
  53816. this.float = new _xfa_object.XFAObjectArray();
  53817. this.image = new _xfa_object.XFAObjectArray();
  53818. this.integer = new _xfa_object.XFAObjectArray();
  53819. this.text = new _xfa_object.XFAObjectArray();
  53820. this.time = new _xfa_object.XFAObjectArray();
  53821. }
  53822. }
  53823. class DigestMethod extends _xfa_object.OptionObject {
  53824. constructor(attributes) {
  53825. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  53826. this.id = attributes.id || "";
  53827. this.use = attributes.use || "";
  53828. this.usehref = attributes.usehref || "";
  53829. }
  53830. }
  53831. class DigestMethods extends _xfa_object.XFAObject {
  53832. constructor(attributes) {
  53833. super(TEMPLATE_NS_ID, "digestMethods", true);
  53834. this.id = attributes.id || "";
  53835. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53836. this.use = attributes.use || "";
  53837. this.usehref = attributes.usehref || "";
  53838. this.digestMethod = new _xfa_object.XFAObjectArray();
  53839. }
  53840. }
  53841. class Draw extends _xfa_object.XFAObject {
  53842. constructor(attributes) {
  53843. super(TEMPLATE_NS_ID, "draw", true);
  53844. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53845. this.colSpan = (0, _utils.getInteger)({
  53846. data: attributes.colSpan,
  53847. defaultValue: 1,
  53848. validate: n => n >= 1 || n === -1
  53849. });
  53850. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53851. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53852. this.id = attributes.id || "";
  53853. this.locale = attributes.locale || "";
  53854. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53855. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53856. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53857. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53858. this.name = attributes.name || "";
  53859. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53860. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53861. this.rotate = (0, _utils.getInteger)({
  53862. data: attributes.rotate,
  53863. defaultValue: 0,
  53864. validate: x => x % 90 === 0
  53865. });
  53866. this.use = attributes.use || "";
  53867. this.usehref = attributes.usehref || "";
  53868. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53869. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53870. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53871. this.assist = null;
  53872. this.border = null;
  53873. this.caption = null;
  53874. this.desc = null;
  53875. this.extras = null;
  53876. this.font = null;
  53877. this.keep = null;
  53878. this.margin = null;
  53879. this.para = null;
  53880. this.traversal = null;
  53881. this.ui = null;
  53882. this.value = null;
  53883. this.setProperty = new _xfa_object.XFAObjectArray();
  53884. }
  53885. [_xfa_object.$setValue](value) {
  53886. _setValue(this, value);
  53887. }
  53888. [_xfa_object.$toHTML](availableSpace) {
  53889. setTabIndex(this);
  53890. if (this.presence === "hidden" || this.presence === "inactive") {
  53891. return _utils.HTMLResult.EMPTY;
  53892. }
  53893. (0, _html_utils.fixDimensions)(this);
  53894. this[_xfa_object.$pushPara]();
  53895. const savedW = this.w;
  53896. const savedH = this.h;
  53897. const {
  53898. w,
  53899. h,
  53900. isBroken
  53901. } = (0, _html_utils.layoutNode)(this, availableSpace);
  53902. if (w && this.w === "") {
  53903. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  53904. this[_xfa_object.$popPara]();
  53905. return _utils.HTMLResult.FAILURE;
  53906. }
  53907. this.w = w;
  53908. }
  53909. if (h && this.h === "") {
  53910. this.h = h;
  53911. }
  53912. setFirstUnsplittable(this);
  53913. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53914. this.w = savedW;
  53915. this.h = savedH;
  53916. this[_xfa_object.$popPara]();
  53917. return _utils.HTMLResult.FAILURE;
  53918. }
  53919. unsetFirstUnsplittable(this);
  53920. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  53921. (0, _html_utils.setMinMaxDimensions)(this, style);
  53922. if (style.margin) {
  53923. style.padding = style.margin;
  53924. delete style.margin;
  53925. }
  53926. const classNames = ["xfaDraw"];
  53927. if (this.font) {
  53928. classNames.push("xfaFont");
  53929. }
  53930. if ((0, _html_utils.isPrintOnly)(this)) {
  53931. classNames.push("xfaPrintOnly");
  53932. }
  53933. const attributes = {
  53934. style,
  53935. id: this[_xfa_object.$uid],
  53936. class: classNames
  53937. };
  53938. if (this.name) {
  53939. attributes.xfaName = this.name;
  53940. }
  53941. const html = {
  53942. name: "div",
  53943. attributes,
  53944. children: []
  53945. };
  53946. applyAssist(this, attributes);
  53947. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  53948. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  53949. if (value === null) {
  53950. this.w = savedW;
  53951. this.h = savedH;
  53952. this[_xfa_object.$popPara]();
  53953. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53954. }
  53955. html.children.push(value);
  53956. (0, _html_utils.setPara)(this, style, value);
  53957. this.w = savedW;
  53958. this.h = savedH;
  53959. this[_xfa_object.$popPara]();
  53960. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53961. }
  53962. }
  53963. class Edge extends _xfa_object.XFAObject {
  53964. constructor(attributes) {
  53965. super(TEMPLATE_NS_ID, "edge", true);
  53966. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  53967. this.id = attributes.id || "";
  53968. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53969. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53970. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53971. this.use = attributes.use || "";
  53972. this.usehref = attributes.usehref || "";
  53973. this.color = null;
  53974. this.extras = null;
  53975. }
  53976. [_xfa_object.$toStyle]() {
  53977. const style = (0, _html_utils.toStyle)(this, "visibility");
  53978. Object.assign(style, {
  53979. linecap: this.cap,
  53980. width: (0, _html_utils.measureToString)(this.thickness),
  53981. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  53982. style: ""
  53983. });
  53984. if (this.presence !== "visible") {
  53985. style.style = "none";
  53986. } else {
  53987. switch (this.stroke) {
  53988. case "solid":
  53989. style.style = "solid";
  53990. break;
  53991. case "dashDot":
  53992. style.style = "dashed";
  53993. break;
  53994. case "dashDotDot":
  53995. style.style = "dashed";
  53996. break;
  53997. case "dashed":
  53998. style.style = "dashed";
  53999. break;
  54000. case "dotted":
  54001. style.style = "dotted";
  54002. break;
  54003. case "embossed":
  54004. style.style = "ridge";
  54005. break;
  54006. case "etched":
  54007. style.style = "groove";
  54008. break;
  54009. case "lowered":
  54010. style.style = "inset";
  54011. break;
  54012. case "raised":
  54013. style.style = "outset";
  54014. break;
  54015. }
  54016. }
  54017. return style;
  54018. }
  54019. }
  54020. class Encoding extends _xfa_object.OptionObject {
  54021. constructor(attributes) {
  54022. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  54023. this.id = attributes.id || "";
  54024. this.use = attributes.use || "";
  54025. this.usehref = attributes.usehref || "";
  54026. }
  54027. }
  54028. class Encodings extends _xfa_object.XFAObject {
  54029. constructor(attributes) {
  54030. super(TEMPLATE_NS_ID, "encodings", true);
  54031. this.id = attributes.id || "";
  54032. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54033. this.use = attributes.use || "";
  54034. this.usehref = attributes.usehref || "";
  54035. this.encoding = new _xfa_object.XFAObjectArray();
  54036. }
  54037. }
  54038. class Encrypt extends _xfa_object.XFAObject {
  54039. constructor(attributes) {
  54040. super(TEMPLATE_NS_ID, "encrypt", true);
  54041. this.id = attributes.id || "";
  54042. this.use = attributes.use || "";
  54043. this.usehref = attributes.usehref || "";
  54044. this.certificate = null;
  54045. }
  54046. }
  54047. class EncryptData extends _xfa_object.XFAObject {
  54048. constructor(attributes) {
  54049. super(TEMPLATE_NS_ID, "encryptData", true);
  54050. this.id = attributes.id || "";
  54051. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  54052. this.target = attributes.target || "";
  54053. this.use = attributes.use || "";
  54054. this.usehref = attributes.usehref || "";
  54055. this.filter = null;
  54056. this.manifest = null;
  54057. }
  54058. }
  54059. class Encryption extends _xfa_object.XFAObject {
  54060. constructor(attributes) {
  54061. super(TEMPLATE_NS_ID, "encryption", true);
  54062. this.id = attributes.id || "";
  54063. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54064. this.use = attributes.use || "";
  54065. this.usehref = attributes.usehref || "";
  54066. this.certificate = new _xfa_object.XFAObjectArray();
  54067. }
  54068. }
  54069. class EncryptionMethod extends _xfa_object.OptionObject {
  54070. constructor(attributes) {
  54071. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  54072. this.id = attributes.id || "";
  54073. this.use = attributes.use || "";
  54074. this.usehref = attributes.usehref || "";
  54075. }
  54076. }
  54077. class EncryptionMethods extends _xfa_object.XFAObject {
  54078. constructor(attributes) {
  54079. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  54080. this.id = attributes.id || "";
  54081. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54082. this.use = attributes.use || "";
  54083. this.usehref = attributes.usehref || "";
  54084. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  54085. }
  54086. }
  54087. class Event extends _xfa_object.XFAObject {
  54088. constructor(attributes) {
  54089. super(TEMPLATE_NS_ID, "event", true);
  54090. 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"]);
  54091. this.id = attributes.id || "";
  54092. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  54093. this.name = attributes.name || "";
  54094. this.ref = attributes.ref || "";
  54095. this.use = attributes.use || "";
  54096. this.usehref = attributes.usehref || "";
  54097. this.extras = null;
  54098. this.encryptData = null;
  54099. this.execute = null;
  54100. this.script = null;
  54101. this.signData = null;
  54102. this.submit = null;
  54103. }
  54104. }
  54105. class ExData extends _xfa_object.ContentObject {
  54106. constructor(attributes) {
  54107. super(TEMPLATE_NS_ID, "exData");
  54108. this.contentType = attributes.contentType || "";
  54109. this.href = attributes.href || "";
  54110. this.id = attributes.id || "";
  54111. this.maxLength = (0, _utils.getInteger)({
  54112. data: attributes.maxLength,
  54113. defaultValue: -1,
  54114. validate: x => x >= -1
  54115. });
  54116. this.name = attributes.name || "";
  54117. this.rid = attributes.rid || "";
  54118. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  54119. this.use = attributes.use || "";
  54120. this.usehref = attributes.usehref || "";
  54121. }
  54122. [_xfa_object.$isCDATAXml]() {
  54123. return this.contentType === "text/html";
  54124. }
  54125. [_xfa_object.$onChild](child) {
  54126. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  54127. this[_xfa_object.$content] = child;
  54128. return true;
  54129. }
  54130. if (this.contentType === "text/xml") {
  54131. this[_xfa_object.$content] = child;
  54132. return true;
  54133. }
  54134. return false;
  54135. }
  54136. [_xfa_object.$toHTML](availableSpace) {
  54137. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  54138. return _utils.HTMLResult.EMPTY;
  54139. }
  54140. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  54141. }
  54142. }
  54143. class ExObject extends _xfa_object.XFAObject {
  54144. constructor(attributes) {
  54145. super(TEMPLATE_NS_ID, "exObject", true);
  54146. this.archive = attributes.archive || "";
  54147. this.classId = attributes.classId || "";
  54148. this.codeBase = attributes.codeBase || "";
  54149. this.codeType = attributes.codeType || "";
  54150. this.id = attributes.id || "";
  54151. this.name = attributes.name || "";
  54152. this.use = attributes.use || "";
  54153. this.usehref = attributes.usehref || "";
  54154. this.extras = null;
  54155. this.boolean = new _xfa_object.XFAObjectArray();
  54156. this.date = new _xfa_object.XFAObjectArray();
  54157. this.dateTime = new _xfa_object.XFAObjectArray();
  54158. this.decimal = new _xfa_object.XFAObjectArray();
  54159. this.exData = new _xfa_object.XFAObjectArray();
  54160. this.exObject = new _xfa_object.XFAObjectArray();
  54161. this.float = new _xfa_object.XFAObjectArray();
  54162. this.image = new _xfa_object.XFAObjectArray();
  54163. this.integer = new _xfa_object.XFAObjectArray();
  54164. this.text = new _xfa_object.XFAObjectArray();
  54165. this.time = new _xfa_object.XFAObjectArray();
  54166. }
  54167. }
  54168. class ExclGroup extends _xfa_object.XFAObject {
  54169. constructor(attributes) {
  54170. super(TEMPLATE_NS_ID, "exclGroup", true);
  54171. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54172. this.accessKey = attributes.accessKey || "";
  54173. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54174. this.colSpan = (0, _utils.getInteger)({
  54175. data: attributes.colSpan,
  54176. defaultValue: 1,
  54177. validate: n => n >= 1 || n === -1
  54178. });
  54179. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54180. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54181. this.id = attributes.id || "";
  54182. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  54183. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54184. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54185. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54186. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54187. this.name = attributes.name || "";
  54188. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54189. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54190. this.use = attributes.use || "";
  54191. this.usehref = attributes.usehref || "";
  54192. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54193. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54194. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54195. this.assist = null;
  54196. this.bind = null;
  54197. this.border = null;
  54198. this.calculate = null;
  54199. this.caption = null;
  54200. this.desc = null;
  54201. this.extras = null;
  54202. this.margin = null;
  54203. this.para = null;
  54204. this.traversal = null;
  54205. this.validate = null;
  54206. this.connect = new _xfa_object.XFAObjectArray();
  54207. this.event = new _xfa_object.XFAObjectArray();
  54208. this.field = new _xfa_object.XFAObjectArray();
  54209. this.setProperty = new _xfa_object.XFAObjectArray();
  54210. }
  54211. [_xfa_object.$isBindable]() {
  54212. return true;
  54213. }
  54214. [_xfa_object.$hasSettableValue]() {
  54215. return true;
  54216. }
  54217. [_xfa_object.$setValue](value) {
  54218. for (const field of this.field.children) {
  54219. if (!field.value) {
  54220. const nodeValue = new Value({});
  54221. field[_xfa_object.$appendChild](nodeValue);
  54222. field.value = nodeValue;
  54223. }
  54224. field.value[_xfa_object.$setValue](value);
  54225. }
  54226. }
  54227. [_xfa_object.$isThereMoreWidth]() {
  54228. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  54229. }
  54230. [_xfa_object.$isSplittable]() {
  54231. const parent = this[_xfa_object.$getSubformParent]();
  54232. if (!parent[_xfa_object.$isSplittable]()) {
  54233. return false;
  54234. }
  54235. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  54236. return this[_xfa_object.$extra]._isSplittable;
  54237. }
  54238. if (this.layout === "position" || this.layout.includes("row")) {
  54239. this[_xfa_object.$extra]._isSplittable = false;
  54240. return false;
  54241. }
  54242. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  54243. return false;
  54244. }
  54245. this[_xfa_object.$extra]._isSplittable = true;
  54246. return true;
  54247. }
  54248. [_xfa_object.$flushHTML]() {
  54249. return (0, _layout.flushHTML)(this);
  54250. }
  54251. [_xfa_object.$addHTML](html, bbox) {
  54252. (0, _layout.addHTML)(this, html, bbox);
  54253. }
  54254. [_xfa_object.$getAvailableSpace]() {
  54255. return (0, _layout.getAvailableSpace)(this);
  54256. }
  54257. [_xfa_object.$toHTML](availableSpace) {
  54258. setTabIndex(this);
  54259. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  54260. return _utils.HTMLResult.EMPTY;
  54261. }
  54262. (0, _html_utils.fixDimensions)(this);
  54263. const children = [];
  54264. const attributes = {
  54265. id: this[_xfa_object.$uid],
  54266. class: []
  54267. };
  54268. (0, _html_utils.setAccess)(this, attributes.class);
  54269. if (!this[_xfa_object.$extra]) {
  54270. this[_xfa_object.$extra] = Object.create(null);
  54271. }
  54272. Object.assign(this[_xfa_object.$extra], {
  54273. children,
  54274. attributes,
  54275. attempt: 0,
  54276. line: null,
  54277. numberInLine: 0,
  54278. availableSpace: {
  54279. width: Math.min(this.w || Infinity, availableSpace.width),
  54280. height: Math.min(this.h || Infinity, availableSpace.height)
  54281. },
  54282. width: 0,
  54283. height: 0,
  54284. prevHeight: 0,
  54285. currentWidth: 0
  54286. });
  54287. const isSplittable = this[_xfa_object.$isSplittable]();
  54288. if (!isSplittable) {
  54289. setFirstUnsplittable(this);
  54290. }
  54291. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54292. return _utils.HTMLResult.FAILURE;
  54293. }
  54294. const filter = new Set(["field"]);
  54295. if (this.layout.includes("row")) {
  54296. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  54297. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  54298. this[_xfa_object.$extra].columnWidths = columnWidths;
  54299. this[_xfa_object.$extra].currentColumn = 0;
  54300. }
  54301. }
  54302. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  54303. const classNames = ["xfaExclgroup"];
  54304. const cl = (0, _html_utils.layoutClass)(this);
  54305. if (cl) {
  54306. classNames.push(cl);
  54307. }
  54308. if ((0, _html_utils.isPrintOnly)(this)) {
  54309. classNames.push("xfaPrintOnly");
  54310. }
  54311. attributes.style = style;
  54312. attributes.class = classNames;
  54313. if (this.name) {
  54314. attributes.xfaName = this.name;
  54315. }
  54316. this[_xfa_object.$pushPara]();
  54317. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  54318. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  54319. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  54320. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  54321. this[_xfa_object.$extra].numberInLine = 0;
  54322. }
  54323. const result = this[_xfa_object.$childrenToHTML]({
  54324. filter,
  54325. include: true
  54326. });
  54327. if (result.success) {
  54328. break;
  54329. }
  54330. if (result.isBreak()) {
  54331. this[_xfa_object.$popPara]();
  54332. return result;
  54333. }
  54334. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  54335. this[_xfa_object.$extra].attempt = maxRun;
  54336. break;
  54337. }
  54338. }
  54339. this[_xfa_object.$popPara]();
  54340. if (!isSplittable) {
  54341. unsetFirstUnsplittable(this);
  54342. }
  54343. if (this[_xfa_object.$extra].attempt === maxRun) {
  54344. if (!isSplittable) {
  54345. delete this[_xfa_object.$extra];
  54346. }
  54347. return _utils.HTMLResult.FAILURE;
  54348. }
  54349. let marginH = 0;
  54350. let marginV = 0;
  54351. if (this.margin) {
  54352. marginH = this.margin.leftInset + this.margin.rightInset;
  54353. marginV = this.margin.topInset + this.margin.bottomInset;
  54354. }
  54355. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  54356. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  54357. const bbox = [this.x, this.y, width, height];
  54358. if (this.w === "") {
  54359. style.width = (0, _html_utils.measureToString)(width);
  54360. }
  54361. if (this.h === "") {
  54362. style.height = (0, _html_utils.measureToString)(height);
  54363. }
  54364. const html = {
  54365. name: "div",
  54366. attributes,
  54367. children
  54368. };
  54369. applyAssist(this, attributes);
  54370. delete this[_xfa_object.$extra];
  54371. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54372. }
  54373. }
  54374. class Execute extends _xfa_object.XFAObject {
  54375. constructor(attributes) {
  54376. super(TEMPLATE_NS_ID, "execute");
  54377. this.connection = attributes.connection || "";
  54378. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  54379. this.id = attributes.id || "";
  54380. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  54381. this.use = attributes.use || "";
  54382. this.usehref = attributes.usehref || "";
  54383. }
  54384. }
  54385. class Extras extends _xfa_object.XFAObject {
  54386. constructor(attributes) {
  54387. super(TEMPLATE_NS_ID, "extras", true);
  54388. this.id = attributes.id || "";
  54389. this.name = attributes.name || "";
  54390. this.use = attributes.use || "";
  54391. this.usehref = attributes.usehref || "";
  54392. this.boolean = new _xfa_object.XFAObjectArray();
  54393. this.date = new _xfa_object.XFAObjectArray();
  54394. this.dateTime = new _xfa_object.XFAObjectArray();
  54395. this.decimal = new _xfa_object.XFAObjectArray();
  54396. this.exData = new _xfa_object.XFAObjectArray();
  54397. this.extras = new _xfa_object.XFAObjectArray();
  54398. this.float = new _xfa_object.XFAObjectArray();
  54399. this.image = new _xfa_object.XFAObjectArray();
  54400. this.integer = new _xfa_object.XFAObjectArray();
  54401. this.text = new _xfa_object.XFAObjectArray();
  54402. this.time = new _xfa_object.XFAObjectArray();
  54403. }
  54404. }
  54405. class Field extends _xfa_object.XFAObject {
  54406. constructor(attributes) {
  54407. super(TEMPLATE_NS_ID, "field", true);
  54408. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54409. this.accessKey = attributes.accessKey || "";
  54410. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54411. this.colSpan = (0, _utils.getInteger)({
  54412. data: attributes.colSpan,
  54413. defaultValue: 1,
  54414. validate: n => n >= 1 || n === -1
  54415. });
  54416. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54417. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54418. this.id = attributes.id || "";
  54419. this.locale = attributes.locale || "";
  54420. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54421. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54422. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54423. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54424. this.name = attributes.name || "";
  54425. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54426. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54427. this.rotate = (0, _utils.getInteger)({
  54428. data: attributes.rotate,
  54429. defaultValue: 0,
  54430. validate: x => x % 90 === 0
  54431. });
  54432. this.use = attributes.use || "";
  54433. this.usehref = attributes.usehref || "";
  54434. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54435. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54436. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54437. this.assist = null;
  54438. this.bind = null;
  54439. this.border = null;
  54440. this.calculate = null;
  54441. this.caption = null;
  54442. this.desc = null;
  54443. this.extras = null;
  54444. this.font = null;
  54445. this.format = null;
  54446. this.items = new _xfa_object.XFAObjectArray(2);
  54447. this.keep = null;
  54448. this.margin = null;
  54449. this.para = null;
  54450. this.traversal = null;
  54451. this.ui = null;
  54452. this.validate = null;
  54453. this.value = null;
  54454. this.bindItems = new _xfa_object.XFAObjectArray();
  54455. this.connect = new _xfa_object.XFAObjectArray();
  54456. this.event = new _xfa_object.XFAObjectArray();
  54457. this.setProperty = new _xfa_object.XFAObjectArray();
  54458. }
  54459. [_xfa_object.$isBindable]() {
  54460. return true;
  54461. }
  54462. [_xfa_object.$setValue](value) {
  54463. _setValue(this, value);
  54464. }
  54465. [_xfa_object.$toHTML](availableSpace) {
  54466. setTabIndex(this);
  54467. if (!this.ui) {
  54468. this.ui = new Ui({});
  54469. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  54470. this[_xfa_object.$appendChild](this.ui);
  54471. let node;
  54472. switch (this.items.children.length) {
  54473. case 0:
  54474. node = new TextEdit({});
  54475. this.ui.textEdit = node;
  54476. break;
  54477. case 1:
  54478. node = new CheckButton({});
  54479. this.ui.checkButton = node;
  54480. break;
  54481. case 2:
  54482. node = new ChoiceList({});
  54483. this.ui.choiceList = node;
  54484. break;
  54485. }
  54486. this.ui[_xfa_object.$appendChild](node);
  54487. }
  54488. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  54489. return _utils.HTMLResult.EMPTY;
  54490. }
  54491. if (this.caption) {
  54492. delete this.caption[_xfa_object.$extra];
  54493. }
  54494. this[_xfa_object.$pushPara]();
  54495. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  54496. const savedW = this.w;
  54497. const savedH = this.h;
  54498. let marginH = 0;
  54499. let marginV = 0;
  54500. if (this.margin) {
  54501. marginH = this.margin.leftInset + this.margin.rightInset;
  54502. marginV = this.margin.topInset + this.margin.bottomInset;
  54503. }
  54504. let borderDims = null;
  54505. if (this.w === "" || this.h === "") {
  54506. let width = null;
  54507. let height = null;
  54508. let uiW = 0;
  54509. let uiH = 0;
  54510. if (this.ui.checkButton) {
  54511. uiW = uiH = this.ui.checkButton.size;
  54512. } else {
  54513. const {
  54514. w,
  54515. h
  54516. } = (0, _html_utils.layoutNode)(this, availableSpace);
  54517. if (w !== null) {
  54518. uiW = w;
  54519. uiH = h;
  54520. } else {
  54521. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  54522. }
  54523. }
  54524. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  54525. uiW += borderDims.w;
  54526. uiH += borderDims.h;
  54527. if (this.caption) {
  54528. const {
  54529. w,
  54530. h,
  54531. isBroken
  54532. } = this.caption[_xfa_object.$getExtra](availableSpace);
  54533. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  54534. this[_xfa_object.$popPara]();
  54535. return _utils.HTMLResult.FAILURE;
  54536. }
  54537. width = w;
  54538. height = h;
  54539. switch (this.caption.placement) {
  54540. case "left":
  54541. case "right":
  54542. case "inline":
  54543. width += uiW;
  54544. break;
  54545. case "top":
  54546. case "bottom":
  54547. height += uiH;
  54548. break;
  54549. }
  54550. } else {
  54551. width = uiW;
  54552. height = uiH;
  54553. }
  54554. if (width && this.w === "") {
  54555. width += marginH;
  54556. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  54557. }
  54558. if (height && this.h === "") {
  54559. height += marginV;
  54560. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  54561. }
  54562. }
  54563. this[_xfa_object.$popPara]();
  54564. (0, _html_utils.fixDimensions)(this);
  54565. setFirstUnsplittable(this);
  54566. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54567. this.w = savedW;
  54568. this.h = savedH;
  54569. this[_xfa_object.$popPara]();
  54570. return _utils.HTMLResult.FAILURE;
  54571. }
  54572. unsetFirstUnsplittable(this);
  54573. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  54574. (0, _html_utils.setMinMaxDimensions)(this, style);
  54575. const classNames = ["xfaField"];
  54576. if (this.font) {
  54577. classNames.push("xfaFont");
  54578. }
  54579. if ((0, _html_utils.isPrintOnly)(this)) {
  54580. classNames.push("xfaPrintOnly");
  54581. }
  54582. const attributes = {
  54583. style,
  54584. id: this[_xfa_object.$uid],
  54585. class: classNames
  54586. };
  54587. if (style.margin) {
  54588. style.padding = style.margin;
  54589. delete style.margin;
  54590. }
  54591. (0, _html_utils.setAccess)(this, classNames);
  54592. if (this.name) {
  54593. attributes.xfaName = this.name;
  54594. }
  54595. const children = [];
  54596. const html = {
  54597. name: "div",
  54598. attributes,
  54599. children
  54600. };
  54601. applyAssist(this, attributes);
  54602. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  54603. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  54604. const ui = this.ui[_xfa_object.$toHTML]().html;
  54605. if (!ui) {
  54606. Object.assign(style, borderStyle);
  54607. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54608. }
  54609. if (this[_xfa_object.$tabIndex]) {
  54610. if (ui.children && ui.children[0]) {
  54611. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  54612. } else {
  54613. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  54614. }
  54615. }
  54616. if (!ui.attributes.style) {
  54617. ui.attributes.style = Object.create(null);
  54618. }
  54619. let aElement = null;
  54620. if (this.ui.button) {
  54621. if (ui.children.length === 1) {
  54622. [aElement] = ui.children.splice(0, 1);
  54623. }
  54624. Object.assign(ui.attributes.style, borderStyle);
  54625. } else {
  54626. Object.assign(style, borderStyle);
  54627. }
  54628. children.push(ui);
  54629. if (this.value) {
  54630. if (this.ui.imageEdit) {
  54631. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  54632. } else if (!this.ui.button) {
  54633. let value = "";
  54634. if (this.value.exData) {
  54635. value = this.value.exData[_xfa_object.$text]();
  54636. } else if (this.value.text) {
  54637. value = this.value.text[_xfa_object.$getExtra]();
  54638. } else {
  54639. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  54640. if (htmlValue !== null) {
  54641. value = htmlValue.children[0].value;
  54642. }
  54643. }
  54644. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  54645. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  54646. }
  54647. if (value) {
  54648. if (this.ui.numericEdit) {
  54649. value = parseFloat(value);
  54650. value = isNaN(value) ? "" : value.toString();
  54651. }
  54652. if (ui.children[0].name === "textarea") {
  54653. ui.children[0].attributes.textContent = value;
  54654. } else {
  54655. ui.children[0].attributes.value = value;
  54656. }
  54657. }
  54658. }
  54659. }
  54660. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  54661. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  54662. let captionHeight = 0;
  54663. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  54664. captionHeight = this.caption.reserve;
  54665. if (captionHeight <= 0) {
  54666. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  54667. }
  54668. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  54669. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  54670. } else {
  54671. ui.children[0].attributes.style.height = "100%";
  54672. }
  54673. }
  54674. if (aElement) {
  54675. ui.children.push(aElement);
  54676. }
  54677. if (!caption) {
  54678. if (ui.attributes.class) {
  54679. ui.attributes.class.push("xfaLeft");
  54680. }
  54681. this.w = savedW;
  54682. this.h = savedH;
  54683. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54684. }
  54685. if (this.ui.button) {
  54686. if (style.padding) {
  54687. delete style.padding;
  54688. }
  54689. if (caption.name === "div") {
  54690. caption.name = "span";
  54691. }
  54692. ui.children.push(caption);
  54693. return _utils.HTMLResult.success(html, bbox);
  54694. } else if (this.ui.checkButton) {
  54695. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  54696. }
  54697. if (!ui.attributes.class) {
  54698. ui.attributes.class = [];
  54699. }
  54700. ui.children.splice(0, 0, caption);
  54701. switch (this.caption.placement) {
  54702. case "left":
  54703. ui.attributes.class.push("xfaLeft");
  54704. break;
  54705. case "right":
  54706. ui.attributes.class.push("xfaRight");
  54707. break;
  54708. case "top":
  54709. ui.attributes.class.push("xfaTop");
  54710. break;
  54711. case "bottom":
  54712. ui.attributes.class.push("xfaBottom");
  54713. break;
  54714. case "inline":
  54715. ui.attributes.class.push("xfaLeft");
  54716. break;
  54717. }
  54718. this.w = savedW;
  54719. this.h = savedH;
  54720. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54721. }
  54722. }
  54723. exports.Field = Field;
  54724. class Fill extends _xfa_object.XFAObject {
  54725. constructor(attributes) {
  54726. super(TEMPLATE_NS_ID, "fill", true);
  54727. this.id = attributes.id || "";
  54728. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54729. this.use = attributes.use || "";
  54730. this.usehref = attributes.usehref || "";
  54731. this.color = null;
  54732. this.extras = null;
  54733. this.linear = null;
  54734. this.pattern = null;
  54735. this.radial = null;
  54736. this.solid = null;
  54737. this.stipple = null;
  54738. }
  54739. [_xfa_object.$toStyle]() {
  54740. const parent = this[_xfa_object.$getParent]();
  54741. const grandpa = parent[_xfa_object.$getParent]();
  54742. const ggrandpa = grandpa[_xfa_object.$getParent]();
  54743. const style = Object.create(null);
  54744. let propName = "color";
  54745. let altPropName = propName;
  54746. if (parent instanceof Border) {
  54747. propName = "background-color";
  54748. altPropName = "background";
  54749. if (ggrandpa instanceof Ui) {
  54750. style.backgroundColor = "white";
  54751. }
  54752. }
  54753. if (parent instanceof Rectangle || parent instanceof Arc) {
  54754. propName = altPropName = "fill";
  54755. style.fill = "white";
  54756. }
  54757. for (const name of Object.getOwnPropertyNames(this)) {
  54758. if (name === "extras" || name === "color") {
  54759. continue;
  54760. }
  54761. const obj = this[name];
  54762. if (!(obj instanceof _xfa_object.XFAObject)) {
  54763. continue;
  54764. }
  54765. const color = obj[_xfa_object.$toStyle](this.color);
  54766. if (color) {
  54767. style[color.startsWith("#") ? propName : altPropName] = color;
  54768. }
  54769. return style;
  54770. }
  54771. if (this.color && this.color.value) {
  54772. const color = this.color[_xfa_object.$toStyle]();
  54773. style[color.startsWith("#") ? propName : altPropName] = color;
  54774. }
  54775. return style;
  54776. }
  54777. }
  54778. class Filter extends _xfa_object.XFAObject {
  54779. constructor(attributes) {
  54780. super(TEMPLATE_NS_ID, "filter", true);
  54781. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  54782. this.id = attributes.id || "";
  54783. this.name = attributes.name || "";
  54784. this.use = attributes.use || "";
  54785. this.usehref = attributes.usehref || "";
  54786. this.version = (0, _utils.getInteger)({
  54787. data: this.version,
  54788. defaultValue: 5,
  54789. validate: x => x >= 1 && x <= 5
  54790. });
  54791. this.appearanceFilter = null;
  54792. this.certificates = null;
  54793. this.digestMethods = null;
  54794. this.encodings = null;
  54795. this.encryptionMethods = null;
  54796. this.handler = null;
  54797. this.lockDocument = null;
  54798. this.mdp = null;
  54799. this.reasons = null;
  54800. this.timeStamp = null;
  54801. }
  54802. }
  54803. class Float extends _xfa_object.ContentObject {
  54804. constructor(attributes) {
  54805. super(TEMPLATE_NS_ID, "float");
  54806. this.id = attributes.id || "";
  54807. this.name = attributes.name || "";
  54808. this.use = attributes.use || "";
  54809. this.usehref = attributes.usehref || "";
  54810. }
  54811. [_xfa_object.$finalize]() {
  54812. const number = parseFloat(this[_xfa_object.$content].trim());
  54813. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54814. }
  54815. [_xfa_object.$toHTML](availableSpace) {
  54816. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54817. }
  54818. }
  54819. class Font extends _xfa_object.XFAObject {
  54820. constructor(attributes) {
  54821. super(TEMPLATE_NS_ID, "font", true);
  54822. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  54823. this.fontHorizontalScale = (0, _utils.getFloat)({
  54824. data: attributes.fontHorizontalScale,
  54825. defaultValue: 100,
  54826. validate: x => x >= 0
  54827. });
  54828. this.fontVerticalScale = (0, _utils.getFloat)({
  54829. data: attributes.fontVerticalScale,
  54830. defaultValue: 100,
  54831. validate: x => x >= 0
  54832. });
  54833. this.id = attributes.id || "";
  54834. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  54835. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  54836. this.lineThrough = (0, _utils.getInteger)({
  54837. data: attributes.lineThrough,
  54838. defaultValue: 0,
  54839. validate: x => x === 1 || x === 2
  54840. });
  54841. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  54842. this.overline = (0, _utils.getInteger)({
  54843. data: attributes.overline,
  54844. defaultValue: 0,
  54845. validate: x => x === 1 || x === 2
  54846. });
  54847. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  54848. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  54849. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54850. this.typeface = attributes.typeface || "Courier";
  54851. this.underline = (0, _utils.getInteger)({
  54852. data: attributes.underline,
  54853. defaultValue: 0,
  54854. validate: x => x === 1 || x === 2
  54855. });
  54856. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  54857. this.use = attributes.use || "";
  54858. this.usehref = attributes.usehref || "";
  54859. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  54860. this.extras = null;
  54861. this.fill = null;
  54862. }
  54863. [_xfa_object.$clean](builder) {
  54864. super[_xfa_object.$clean](builder);
  54865. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  54866. }
  54867. [_xfa_object.$toStyle]() {
  54868. const style = (0, _html_utils.toStyle)(this, "fill");
  54869. const color = style.color;
  54870. if (color) {
  54871. if (color === "#000000") {
  54872. delete style.color;
  54873. } else if (!color.startsWith("#")) {
  54874. style.background = color;
  54875. style.backgroundClip = "text";
  54876. style.color = "transparent";
  54877. }
  54878. }
  54879. if (this.baselineShift) {
  54880. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  54881. }
  54882. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  54883. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  54884. if (this.lineThrough !== 0) {
  54885. style.textDecoration = "line-through";
  54886. if (this.lineThrough === 2) {
  54887. style.textDecorationStyle = "double";
  54888. }
  54889. }
  54890. if (this.overline !== 0) {
  54891. style.textDecoration = "overline";
  54892. if (this.overline === 2) {
  54893. style.textDecorationStyle = "double";
  54894. }
  54895. }
  54896. style.fontStyle = this.posture;
  54897. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  54898. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  54899. if (this.underline !== 0) {
  54900. style.textDecoration = "underline";
  54901. if (this.underline === 2) {
  54902. style.textDecorationStyle = "double";
  54903. }
  54904. }
  54905. style.fontWeight = this.weight;
  54906. return style;
  54907. }
  54908. }
  54909. class Format extends _xfa_object.XFAObject {
  54910. constructor(attributes) {
  54911. super(TEMPLATE_NS_ID, "format", true);
  54912. this.id = attributes.id || "";
  54913. this.use = attributes.use || "";
  54914. this.usehref = attributes.usehref || "";
  54915. this.extras = null;
  54916. this.picture = null;
  54917. }
  54918. }
  54919. class Handler extends _xfa_object.StringObject {
  54920. constructor(attributes) {
  54921. super(TEMPLATE_NS_ID, "handler");
  54922. this.id = attributes.id || "";
  54923. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54924. this.use = attributes.use || "";
  54925. this.usehref = attributes.usehref || "";
  54926. }
  54927. }
  54928. class Hyphenation extends _xfa_object.XFAObject {
  54929. constructor(attributes) {
  54930. super(TEMPLATE_NS_ID, "hyphenation");
  54931. this.excludeAllCaps = (0, _utils.getInteger)({
  54932. data: attributes.excludeAllCaps,
  54933. defaultValue: 0,
  54934. validate: x => x === 1
  54935. });
  54936. this.excludeInitialCap = (0, _utils.getInteger)({
  54937. data: attributes.excludeInitialCap,
  54938. defaultValue: 0,
  54939. validate: x => x === 1
  54940. });
  54941. this.hyphenate = (0, _utils.getInteger)({
  54942. data: attributes.hyphenate,
  54943. defaultValue: 0,
  54944. validate: x => x === 1
  54945. });
  54946. this.id = attributes.id || "";
  54947. this.pushCharacterCount = (0, _utils.getInteger)({
  54948. data: attributes.pushCharacterCount,
  54949. defaultValue: 3,
  54950. validate: x => x >= 0
  54951. });
  54952. this.remainCharacterCount = (0, _utils.getInteger)({
  54953. data: attributes.remainCharacterCount,
  54954. defaultValue: 3,
  54955. validate: x => x >= 0
  54956. });
  54957. this.use = attributes.use || "";
  54958. this.usehref = attributes.usehref || "";
  54959. this.wordCharacterCount = (0, _utils.getInteger)({
  54960. data: attributes.wordCharacterCount,
  54961. defaultValue: 7,
  54962. validate: x => x >= 0
  54963. });
  54964. }
  54965. }
  54966. class Image extends _xfa_object.StringObject {
  54967. constructor(attributes) {
  54968. super(TEMPLATE_NS_ID, "image");
  54969. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  54970. this.contentType = attributes.contentType || "";
  54971. this.href = attributes.href || "";
  54972. this.id = attributes.id || "";
  54973. this.name = attributes.name || "";
  54974. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  54975. this.use = attributes.use || "";
  54976. this.usehref = attributes.usehref || "";
  54977. }
  54978. [_xfa_object.$toHTML]() {
  54979. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  54980. return _utils.HTMLResult.EMPTY;
  54981. }
  54982. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  54983. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  54984. return _utils.HTMLResult.EMPTY;
  54985. }
  54986. if (!buffer && this.transferEncoding === "base64") {
  54987. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  54988. }
  54989. if (!buffer) {
  54990. return _utils.HTMLResult.EMPTY;
  54991. }
  54992. if (!this.contentType) {
  54993. for (const [header, type] of IMAGES_HEADERS) {
  54994. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  54995. this.contentType = type;
  54996. break;
  54997. }
  54998. }
  54999. if (!this.contentType) {
  55000. return _utils.HTMLResult.EMPTY;
  55001. }
  55002. }
  55003. const blob = new Blob([buffer], {
  55004. type: this.contentType
  55005. });
  55006. let style;
  55007. switch (this.aspect) {
  55008. case "fit":
  55009. case "actual":
  55010. break;
  55011. case "height":
  55012. style = {
  55013. height: "100%",
  55014. objectFit: "fill"
  55015. };
  55016. break;
  55017. case "none":
  55018. style = {
  55019. width: "100%",
  55020. height: "100%",
  55021. objectFit: "fill"
  55022. };
  55023. break;
  55024. case "width":
  55025. style = {
  55026. width: "100%",
  55027. objectFit: "fill"
  55028. };
  55029. break;
  55030. }
  55031. const parent = this[_xfa_object.$getParent]();
  55032. return _utils.HTMLResult.success({
  55033. name: "img",
  55034. attributes: {
  55035. class: ["xfaImage"],
  55036. style,
  55037. src: URL.createObjectURL(blob),
  55038. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  55039. }
  55040. });
  55041. }
  55042. }
  55043. class ImageEdit extends _xfa_object.XFAObject {
  55044. constructor(attributes) {
  55045. super(TEMPLATE_NS_ID, "imageEdit", true);
  55046. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  55047. this.id = attributes.id || "";
  55048. this.use = attributes.use || "";
  55049. this.usehref = attributes.usehref || "";
  55050. this.border = null;
  55051. this.extras = null;
  55052. this.margin = null;
  55053. }
  55054. [_xfa_object.$toHTML](availableSpace) {
  55055. if (this.data === "embed") {
  55056. return _utils.HTMLResult.success({
  55057. name: "div",
  55058. children: [],
  55059. attributes: {}
  55060. });
  55061. }
  55062. return _utils.HTMLResult.EMPTY;
  55063. }
  55064. }
  55065. class Integer extends _xfa_object.ContentObject {
  55066. constructor(attributes) {
  55067. super(TEMPLATE_NS_ID, "integer");
  55068. this.id = attributes.id || "";
  55069. this.name = attributes.name || "";
  55070. this.use = attributes.use || "";
  55071. this.usehref = attributes.usehref || "";
  55072. }
  55073. [_xfa_object.$finalize]() {
  55074. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  55075. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55076. }
  55077. [_xfa_object.$toHTML](availableSpace) {
  55078. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55079. }
  55080. }
  55081. class Issuers extends _xfa_object.XFAObject {
  55082. constructor(attributes) {
  55083. super(TEMPLATE_NS_ID, "issuers", true);
  55084. this.id = attributes.id || "";
  55085. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55086. this.use = attributes.use || "";
  55087. this.usehref = attributes.usehref || "";
  55088. this.certificate = new _xfa_object.XFAObjectArray();
  55089. }
  55090. }
  55091. class Items extends _xfa_object.XFAObject {
  55092. constructor(attributes) {
  55093. super(TEMPLATE_NS_ID, "items", true);
  55094. this.id = attributes.id || "";
  55095. this.name = attributes.name || "";
  55096. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55097. this.ref = attributes.ref || "";
  55098. this.save = (0, _utils.getInteger)({
  55099. data: attributes.save,
  55100. defaultValue: 0,
  55101. validate: x => x === 1
  55102. });
  55103. this.use = attributes.use || "";
  55104. this.usehref = attributes.usehref || "";
  55105. this.boolean = new _xfa_object.XFAObjectArray();
  55106. this.date = new _xfa_object.XFAObjectArray();
  55107. this.dateTime = new _xfa_object.XFAObjectArray();
  55108. this.decimal = new _xfa_object.XFAObjectArray();
  55109. this.exData = new _xfa_object.XFAObjectArray();
  55110. this.float = new _xfa_object.XFAObjectArray();
  55111. this.image = new _xfa_object.XFAObjectArray();
  55112. this.integer = new _xfa_object.XFAObjectArray();
  55113. this.text = new _xfa_object.XFAObjectArray();
  55114. this.time = new _xfa_object.XFAObjectArray();
  55115. }
  55116. [_xfa_object.$toHTML]() {
  55117. const output = [];
  55118. for (const child of this[_xfa_object.$getChildren]()) {
  55119. output.push(child[_xfa_object.$text]());
  55120. }
  55121. return _utils.HTMLResult.success(output);
  55122. }
  55123. }
  55124. exports.Items = Items;
  55125. class Keep extends _xfa_object.XFAObject {
  55126. constructor(attributes) {
  55127. super(TEMPLATE_NS_ID, "keep", true);
  55128. this.id = attributes.id || "";
  55129. const options = ["none", "contentArea", "pageArea"];
  55130. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  55131. this.next = (0, _utils.getStringOption)(attributes.next, options);
  55132. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  55133. this.use = attributes.use || "";
  55134. this.usehref = attributes.usehref || "";
  55135. this.extras = null;
  55136. }
  55137. }
  55138. class KeyUsage extends _xfa_object.XFAObject {
  55139. constructor(attributes) {
  55140. super(TEMPLATE_NS_ID, "keyUsage");
  55141. const options = ["", "yes", "no"];
  55142. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  55143. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  55144. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  55145. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  55146. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  55147. this.id = attributes.id || "";
  55148. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  55149. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  55150. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  55151. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  55152. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55153. this.use = attributes.use || "";
  55154. this.usehref = attributes.usehref || "";
  55155. }
  55156. }
  55157. class Line extends _xfa_object.XFAObject {
  55158. constructor(attributes) {
  55159. super(TEMPLATE_NS_ID, "line", true);
  55160. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55161. this.id = attributes.id || "";
  55162. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  55163. this.use = attributes.use || "";
  55164. this.usehref = attributes.usehref || "";
  55165. this.edge = null;
  55166. }
  55167. [_xfa_object.$toHTML]() {
  55168. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55169. const edge = this.edge ? this.edge : new Edge({});
  55170. const edgeStyle = edge[_xfa_object.$toStyle]();
  55171. const style = Object.create(null);
  55172. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  55173. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  55174. style.stroke = edgeStyle.color;
  55175. let x1, y1, x2, y2;
  55176. let width = "100%";
  55177. let height = "100%";
  55178. if (parent.w <= thickness) {
  55179. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  55180. width = style.strokeWidth;
  55181. } else if (parent.h <= thickness) {
  55182. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  55183. height = style.strokeWidth;
  55184. } else {
  55185. if (this.slope === "\\") {
  55186. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  55187. } else {
  55188. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  55189. }
  55190. }
  55191. const line = {
  55192. name: "line",
  55193. attributes: {
  55194. xmlns: SVG_NS,
  55195. x1,
  55196. y1,
  55197. x2,
  55198. y2,
  55199. style
  55200. }
  55201. };
  55202. const svg = {
  55203. name: "svg",
  55204. children: [line],
  55205. attributes: {
  55206. xmlns: SVG_NS,
  55207. width,
  55208. height,
  55209. style: {
  55210. overflow: "visible"
  55211. }
  55212. }
  55213. };
  55214. if (hasMargin(parent)) {
  55215. return _utils.HTMLResult.success({
  55216. name: "div",
  55217. attributes: {
  55218. style: {
  55219. display: "inline",
  55220. width: "100%",
  55221. height: "100%"
  55222. }
  55223. },
  55224. children: [svg]
  55225. });
  55226. }
  55227. svg.attributes.style.position = "absolute";
  55228. return _utils.HTMLResult.success(svg);
  55229. }
  55230. }
  55231. class Linear extends _xfa_object.XFAObject {
  55232. constructor(attributes) {
  55233. super(TEMPLATE_NS_ID, "linear", true);
  55234. this.id = attributes.id || "";
  55235. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  55236. this.use = attributes.use || "";
  55237. this.usehref = attributes.usehref || "";
  55238. this.color = null;
  55239. this.extras = null;
  55240. }
  55241. [_xfa_object.$toStyle](startColor) {
  55242. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55243. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  55244. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55245. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  55246. }
  55247. }
  55248. class LockDocument extends _xfa_object.ContentObject {
  55249. constructor(attributes) {
  55250. super(TEMPLATE_NS_ID, "lockDocument");
  55251. this.id = attributes.id || "";
  55252. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55253. this.use = attributes.use || "";
  55254. this.usehref = attributes.usehref || "";
  55255. }
  55256. [_xfa_object.$finalize]() {
  55257. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  55258. }
  55259. }
  55260. class Manifest extends _xfa_object.XFAObject {
  55261. constructor(attributes) {
  55262. super(TEMPLATE_NS_ID, "manifest", true);
  55263. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  55264. this.id = attributes.id || "";
  55265. this.name = attributes.name || "";
  55266. this.use = attributes.use || "";
  55267. this.usehref = attributes.usehref || "";
  55268. this.extras = null;
  55269. this.ref = new _xfa_object.XFAObjectArray();
  55270. }
  55271. }
  55272. class Margin extends _xfa_object.XFAObject {
  55273. constructor(attributes) {
  55274. super(TEMPLATE_NS_ID, "margin", true);
  55275. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  55276. this.id = attributes.id || "";
  55277. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  55278. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  55279. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  55280. this.use = attributes.use || "";
  55281. this.usehref = attributes.usehref || "";
  55282. this.extras = null;
  55283. }
  55284. [_xfa_object.$toStyle]() {
  55285. return {
  55286. 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)
  55287. };
  55288. }
  55289. }
  55290. class Mdp extends _xfa_object.XFAObject {
  55291. constructor(attributes) {
  55292. super(TEMPLATE_NS_ID, "mdp");
  55293. this.id = attributes.id || "";
  55294. this.permissions = (0, _utils.getInteger)({
  55295. data: attributes.permissions,
  55296. defaultValue: 2,
  55297. validate: x => x === 1 || x === 3
  55298. });
  55299. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  55300. this.use = attributes.use || "";
  55301. this.usehref = attributes.usehref || "";
  55302. }
  55303. }
  55304. class Medium extends _xfa_object.XFAObject {
  55305. constructor(attributes) {
  55306. super(TEMPLATE_NS_ID, "medium");
  55307. this.id = attributes.id || "";
  55308. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  55309. this.long = (0, _utils.getMeasurement)(attributes.long);
  55310. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  55311. this.short = (0, _utils.getMeasurement)(attributes.short);
  55312. this.stock = attributes.stock || "";
  55313. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  55314. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  55315. this.use = attributes.use || "";
  55316. this.usehref = attributes.usehref || "";
  55317. }
  55318. }
  55319. class Message extends _xfa_object.XFAObject {
  55320. constructor(attributes) {
  55321. super(TEMPLATE_NS_ID, "message", true);
  55322. this.id = attributes.id || "";
  55323. this.use = attributes.use || "";
  55324. this.usehref = attributes.usehref || "";
  55325. this.text = new _xfa_object.XFAObjectArray();
  55326. }
  55327. }
  55328. class NumericEdit extends _xfa_object.XFAObject {
  55329. constructor(attributes) {
  55330. super(TEMPLATE_NS_ID, "numericEdit", true);
  55331. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55332. this.id = attributes.id || "";
  55333. this.use = attributes.use || "";
  55334. this.usehref = attributes.usehref || "";
  55335. this.border = null;
  55336. this.comb = null;
  55337. this.extras = null;
  55338. this.margin = null;
  55339. }
  55340. [_xfa_object.$toHTML](availableSpace) {
  55341. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  55342. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55343. const html = {
  55344. name: "input",
  55345. attributes: {
  55346. type: "text",
  55347. fieldId: field[_xfa_object.$uid],
  55348. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  55349. class: ["xfaTextfield"],
  55350. style,
  55351. "aria-label": ariaLabel(field)
  55352. }
  55353. };
  55354. return _utils.HTMLResult.success({
  55355. name: "label",
  55356. attributes: {
  55357. class: ["xfaLabel"]
  55358. },
  55359. children: [html]
  55360. });
  55361. }
  55362. }
  55363. class Occur extends _xfa_object.XFAObject {
  55364. constructor(attributes) {
  55365. super(TEMPLATE_NS_ID, "occur", true);
  55366. this.id = attributes.id || "";
  55367. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  55368. data: attributes.initial,
  55369. defaultValue: "",
  55370. validate: x => true
  55371. }) : "";
  55372. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  55373. data: attributes.max,
  55374. defaultValue: 1,
  55375. validate: x => true
  55376. }) : "";
  55377. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  55378. data: attributes.min,
  55379. defaultValue: 1,
  55380. validate: x => true
  55381. }) : "";
  55382. this.use = attributes.use || "";
  55383. this.usehref = attributes.usehref || "";
  55384. this.extras = null;
  55385. }
  55386. [_xfa_object.$clean]() {
  55387. const parent = this[_xfa_object.$getParent]();
  55388. const originalMin = this.min;
  55389. if (this.min === "") {
  55390. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  55391. }
  55392. if (this.max === "") {
  55393. if (originalMin === "") {
  55394. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  55395. } else {
  55396. this.max = this.min;
  55397. }
  55398. }
  55399. if (this.max !== -1 && this.max < this.min) {
  55400. this.max = this.min;
  55401. }
  55402. if (this.initial === "") {
  55403. this.initial = parent instanceof Template ? 1 : this.min;
  55404. }
  55405. }
  55406. }
  55407. class Oid extends _xfa_object.StringObject {
  55408. constructor(attributes) {
  55409. super(TEMPLATE_NS_ID, "oid");
  55410. this.id = attributes.id || "";
  55411. this.name = attributes.name || "";
  55412. this.use = attributes.use || "";
  55413. this.usehref = attributes.usehref || "";
  55414. }
  55415. }
  55416. class Oids extends _xfa_object.XFAObject {
  55417. constructor(attributes) {
  55418. super(TEMPLATE_NS_ID, "oids", true);
  55419. this.id = attributes.id || "";
  55420. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55421. this.use = attributes.use || "";
  55422. this.usehref = attributes.usehref || "";
  55423. this.oid = new _xfa_object.XFAObjectArray();
  55424. }
  55425. }
  55426. class Overflow extends _xfa_object.XFAObject {
  55427. constructor(attributes) {
  55428. super(TEMPLATE_NS_ID, "overflow");
  55429. this.id = attributes.id || "";
  55430. this.leader = attributes.leader || "";
  55431. this.target = attributes.target || "";
  55432. this.trailer = attributes.trailer || "";
  55433. this.use = attributes.use || "";
  55434. this.usehref = attributes.usehref || "";
  55435. }
  55436. [_xfa_object.$getExtra]() {
  55437. if (!this[_xfa_object.$extra]) {
  55438. const parent = this[_xfa_object.$getParent]();
  55439. const root = this[_xfa_object.$getTemplateRoot]();
  55440. const target = root[_xfa_object.$searchNode](this.target, parent);
  55441. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  55442. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  55443. this[_xfa_object.$extra] = {
  55444. target: target && target[0] || null,
  55445. leader: leader && leader[0] || null,
  55446. trailer: trailer && trailer[0] || null,
  55447. addLeader: false,
  55448. addTrailer: false
  55449. };
  55450. }
  55451. return this[_xfa_object.$extra];
  55452. }
  55453. }
  55454. class PageArea extends _xfa_object.XFAObject {
  55455. constructor(attributes) {
  55456. super(TEMPLATE_NS_ID, "pageArea", true);
  55457. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  55458. this.id = attributes.id || "";
  55459. this.initialNumber = (0, _utils.getInteger)({
  55460. data: attributes.initialNumber,
  55461. defaultValue: 1,
  55462. validate: x => true
  55463. });
  55464. this.name = attributes.name || "";
  55465. this.numbered = (0, _utils.getInteger)({
  55466. data: attributes.numbered,
  55467. defaultValue: 1,
  55468. validate: x => true
  55469. });
  55470. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  55471. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  55472. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55473. this.use = attributes.use || "";
  55474. this.usehref = attributes.usehref || "";
  55475. this.desc = null;
  55476. this.extras = null;
  55477. this.medium = null;
  55478. this.occur = null;
  55479. this.area = new _xfa_object.XFAObjectArray();
  55480. this.contentArea = new _xfa_object.XFAObjectArray();
  55481. this.draw = new _xfa_object.XFAObjectArray();
  55482. this.exclGroup = new _xfa_object.XFAObjectArray();
  55483. this.field = new _xfa_object.XFAObjectArray();
  55484. this.subform = new _xfa_object.XFAObjectArray();
  55485. }
  55486. [_xfa_object.$isUsable]() {
  55487. if (!this[_xfa_object.$extra]) {
  55488. this[_xfa_object.$extra] = {
  55489. numberOfUse: 0
  55490. };
  55491. return true;
  55492. }
  55493. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  55494. }
  55495. [_xfa_object.$cleanPage]() {
  55496. delete this[_xfa_object.$extra];
  55497. }
  55498. [_xfa_object.$getNextPage]() {
  55499. if (!this[_xfa_object.$extra]) {
  55500. this[_xfa_object.$extra] = {
  55501. numberOfUse: 0
  55502. };
  55503. }
  55504. const parent = this[_xfa_object.$getParent]();
  55505. if (parent.relation === "orderedOccurrence") {
  55506. if (this[_xfa_object.$isUsable]()) {
  55507. this[_xfa_object.$extra].numberOfUse += 1;
  55508. return this;
  55509. }
  55510. }
  55511. return parent[_xfa_object.$getNextPage]();
  55512. }
  55513. [_xfa_object.$getAvailableSpace]() {
  55514. return this[_xfa_object.$extra].space || {
  55515. width: 0,
  55516. height: 0
  55517. };
  55518. }
  55519. [_xfa_object.$toHTML]() {
  55520. if (!this[_xfa_object.$extra]) {
  55521. this[_xfa_object.$extra] = {
  55522. numberOfUse: 1
  55523. };
  55524. }
  55525. const children = [];
  55526. this[_xfa_object.$extra].children = children;
  55527. const style = Object.create(null);
  55528. if (this.medium && this.medium.short && this.medium.long) {
  55529. style.width = (0, _html_utils.measureToString)(this.medium.short);
  55530. style.height = (0, _html_utils.measureToString)(this.medium.long);
  55531. this[_xfa_object.$extra].space = {
  55532. width: this.medium.short,
  55533. height: this.medium.long
  55534. };
  55535. if (this.medium.orientation === "landscape") {
  55536. const x = style.width;
  55537. style.width = style.height;
  55538. style.height = x;
  55539. this[_xfa_object.$extra].space = {
  55540. width: this.medium.long,
  55541. height: this.medium.short
  55542. };
  55543. }
  55544. } else {
  55545. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  55546. }
  55547. this[_xfa_object.$childrenToHTML]({
  55548. filter: new Set(["area", "draw", "field", "subform"]),
  55549. include: true
  55550. });
  55551. this[_xfa_object.$childrenToHTML]({
  55552. filter: new Set(["contentArea"]),
  55553. include: true
  55554. });
  55555. return _utils.HTMLResult.success({
  55556. name: "div",
  55557. children,
  55558. attributes: {
  55559. class: ["xfaPage"],
  55560. id: this[_xfa_object.$uid],
  55561. style,
  55562. xfaName: this.name
  55563. }
  55564. });
  55565. }
  55566. }
  55567. class PageSet extends _xfa_object.XFAObject {
  55568. constructor(attributes) {
  55569. super(TEMPLATE_NS_ID, "pageSet", true);
  55570. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  55571. this.id = attributes.id || "";
  55572. this.name = attributes.name || "";
  55573. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  55574. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55575. this.use = attributes.use || "";
  55576. this.usehref = attributes.usehref || "";
  55577. this.extras = null;
  55578. this.occur = null;
  55579. this.pageArea = new _xfa_object.XFAObjectArray();
  55580. this.pageSet = new _xfa_object.XFAObjectArray();
  55581. }
  55582. [_xfa_object.$cleanPage]() {
  55583. for (const page of this.pageArea.children) {
  55584. page[_xfa_object.$cleanPage]();
  55585. }
  55586. for (const page of this.pageSet.children) {
  55587. page[_xfa_object.$cleanPage]();
  55588. }
  55589. }
  55590. [_xfa_object.$isUsable]() {
  55591. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  55592. }
  55593. [_xfa_object.$getNextPage]() {
  55594. if (!this[_xfa_object.$extra]) {
  55595. this[_xfa_object.$extra] = {
  55596. numberOfUse: 1,
  55597. pageIndex: -1,
  55598. pageSetIndex: -1
  55599. };
  55600. }
  55601. if (this.relation === "orderedOccurrence") {
  55602. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  55603. this[_xfa_object.$extra].pageIndex += 1;
  55604. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  55605. return pageArea[_xfa_object.$getNextPage]();
  55606. }
  55607. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  55608. this[_xfa_object.$extra].pageSetIndex += 1;
  55609. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  55610. }
  55611. if (this[_xfa_object.$isUsable]()) {
  55612. this[_xfa_object.$extra].numberOfUse += 1;
  55613. this[_xfa_object.$extra].pageIndex = -1;
  55614. this[_xfa_object.$extra].pageSetIndex = -1;
  55615. return this[_xfa_object.$getNextPage]();
  55616. }
  55617. const parent = this[_xfa_object.$getParent]();
  55618. if (parent instanceof PageSet) {
  55619. return parent[_xfa_object.$getNextPage]();
  55620. }
  55621. this[_xfa_object.$cleanPage]();
  55622. return this[_xfa_object.$getNextPage]();
  55623. }
  55624. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  55625. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  55626. const position = pageNumber === 0 ? "first" : "rest";
  55627. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  55628. if (page) {
  55629. return page;
  55630. }
  55631. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  55632. if (page) {
  55633. return page;
  55634. }
  55635. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  55636. if (page) {
  55637. return page;
  55638. }
  55639. return this.pageArea.children[0];
  55640. }
  55641. }
  55642. class Para extends _xfa_object.XFAObject {
  55643. constructor(attributes) {
  55644. super(TEMPLATE_NS_ID, "para", true);
  55645. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55646. this.id = attributes.id || "";
  55647. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  55648. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  55649. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  55650. this.orphans = (0, _utils.getInteger)({
  55651. data: attributes.orphans,
  55652. defaultValue: 0,
  55653. validate: x => x >= 0
  55654. });
  55655. this.preserve = attributes.preserve || "";
  55656. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  55657. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  55658. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  55659. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  55660. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  55661. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  55662. this.use = attributes.use || "";
  55663. this.usehref = attributes.usehref || "";
  55664. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  55665. this.widows = (0, _utils.getInteger)({
  55666. data: attributes.widows,
  55667. defaultValue: 0,
  55668. validate: x => x >= 0
  55669. });
  55670. this.hyphenation = null;
  55671. }
  55672. [_xfa_object.$toStyle]() {
  55673. const style = (0, _html_utils.toStyle)(this, "hAlign");
  55674. if (this.marginLeft !== "") {
  55675. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  55676. }
  55677. if (this.marginRight !== "") {
  55678. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  55679. }
  55680. if (this.spaceAbove !== "") {
  55681. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  55682. }
  55683. if (this.spaceBelow !== "") {
  55684. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  55685. }
  55686. if (this.textIndent !== "") {
  55687. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  55688. (0, _html_utils.fixTextIndent)(style);
  55689. }
  55690. if (this.lineHeight > 0) {
  55691. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  55692. }
  55693. if (this.tabDefault !== "") {
  55694. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  55695. }
  55696. if (this.tabStops.length > 0) {}
  55697. if (this.hyphenatation) {
  55698. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  55699. }
  55700. return style;
  55701. }
  55702. }
  55703. class PasswordEdit extends _xfa_object.XFAObject {
  55704. constructor(attributes) {
  55705. super(TEMPLATE_NS_ID, "passwordEdit", true);
  55706. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55707. this.id = attributes.id || "";
  55708. this.passwordChar = attributes.passwordChar || "*";
  55709. this.use = attributes.use || "";
  55710. this.usehref = attributes.usehref || "";
  55711. this.border = null;
  55712. this.extras = null;
  55713. this.margin = null;
  55714. }
  55715. }
  55716. class Pattern extends _xfa_object.XFAObject {
  55717. constructor(attributes) {
  55718. super(TEMPLATE_NS_ID, "pattern", true);
  55719. this.id = attributes.id || "";
  55720. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  55721. this.use = attributes.use || "";
  55722. this.usehref = attributes.usehref || "";
  55723. this.color = null;
  55724. this.extras = null;
  55725. }
  55726. [_xfa_object.$toStyle](startColor) {
  55727. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55728. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55729. const width = 5;
  55730. const cmd = "repeating-linear-gradient";
  55731. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  55732. switch (this.type) {
  55733. case "crossHatch":
  55734. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  55735. case "crossDiagonal":
  55736. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  55737. case "diagonalLeft":
  55738. return `${cmd}(45deg,${colors})`;
  55739. case "diagonalRight":
  55740. return `${cmd}(-45deg,${colors})`;
  55741. case "horizontal":
  55742. return `${cmd}(to top,${colors})`;
  55743. case "vertical":
  55744. return `${cmd}(to right,${colors})`;
  55745. }
  55746. return "";
  55747. }
  55748. }
  55749. class Picture extends _xfa_object.StringObject {
  55750. constructor(attributes) {
  55751. super(TEMPLATE_NS_ID, "picture");
  55752. this.id = attributes.id || "";
  55753. this.use = attributes.use || "";
  55754. this.usehref = attributes.usehref || "";
  55755. }
  55756. }
  55757. class Proto extends _xfa_object.XFAObject {
  55758. constructor(attributes) {
  55759. super(TEMPLATE_NS_ID, "proto", true);
  55760. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  55761. this.arc = new _xfa_object.XFAObjectArray();
  55762. this.area = new _xfa_object.XFAObjectArray();
  55763. this.assist = new _xfa_object.XFAObjectArray();
  55764. this.barcode = new _xfa_object.XFAObjectArray();
  55765. this.bindItems = new _xfa_object.XFAObjectArray();
  55766. this.bookend = new _xfa_object.XFAObjectArray();
  55767. this.boolean = new _xfa_object.XFAObjectArray();
  55768. this.border = new _xfa_object.XFAObjectArray();
  55769. this.break = new _xfa_object.XFAObjectArray();
  55770. this.breakAfter = new _xfa_object.XFAObjectArray();
  55771. this.breakBefore = new _xfa_object.XFAObjectArray();
  55772. this.button = new _xfa_object.XFAObjectArray();
  55773. this.calculate = new _xfa_object.XFAObjectArray();
  55774. this.caption = new _xfa_object.XFAObjectArray();
  55775. this.certificate = new _xfa_object.XFAObjectArray();
  55776. this.certificates = new _xfa_object.XFAObjectArray();
  55777. this.checkButton = new _xfa_object.XFAObjectArray();
  55778. this.choiceList = new _xfa_object.XFAObjectArray();
  55779. this.color = new _xfa_object.XFAObjectArray();
  55780. this.comb = new _xfa_object.XFAObjectArray();
  55781. this.connect = new _xfa_object.XFAObjectArray();
  55782. this.contentArea = new _xfa_object.XFAObjectArray();
  55783. this.corner = new _xfa_object.XFAObjectArray();
  55784. this.date = new _xfa_object.XFAObjectArray();
  55785. this.dateTime = new _xfa_object.XFAObjectArray();
  55786. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  55787. this.decimal = new _xfa_object.XFAObjectArray();
  55788. this.defaultUi = new _xfa_object.XFAObjectArray();
  55789. this.desc = new _xfa_object.XFAObjectArray();
  55790. this.digestMethod = new _xfa_object.XFAObjectArray();
  55791. this.digestMethods = new _xfa_object.XFAObjectArray();
  55792. this.draw = new _xfa_object.XFAObjectArray();
  55793. this.edge = new _xfa_object.XFAObjectArray();
  55794. this.encoding = new _xfa_object.XFAObjectArray();
  55795. this.encodings = new _xfa_object.XFAObjectArray();
  55796. this.encrypt = new _xfa_object.XFAObjectArray();
  55797. this.encryptData = new _xfa_object.XFAObjectArray();
  55798. this.encryption = new _xfa_object.XFAObjectArray();
  55799. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55800. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  55801. this.event = new _xfa_object.XFAObjectArray();
  55802. this.exData = new _xfa_object.XFAObjectArray();
  55803. this.exObject = new _xfa_object.XFAObjectArray();
  55804. this.exclGroup = new _xfa_object.XFAObjectArray();
  55805. this.execute = new _xfa_object.XFAObjectArray();
  55806. this.extras = new _xfa_object.XFAObjectArray();
  55807. this.field = new _xfa_object.XFAObjectArray();
  55808. this.fill = new _xfa_object.XFAObjectArray();
  55809. this.filter = new _xfa_object.XFAObjectArray();
  55810. this.float = new _xfa_object.XFAObjectArray();
  55811. this.font = new _xfa_object.XFAObjectArray();
  55812. this.format = new _xfa_object.XFAObjectArray();
  55813. this.handler = new _xfa_object.XFAObjectArray();
  55814. this.hyphenation = new _xfa_object.XFAObjectArray();
  55815. this.image = new _xfa_object.XFAObjectArray();
  55816. this.imageEdit = new _xfa_object.XFAObjectArray();
  55817. this.integer = new _xfa_object.XFAObjectArray();
  55818. this.issuers = new _xfa_object.XFAObjectArray();
  55819. this.items = new _xfa_object.XFAObjectArray();
  55820. this.keep = new _xfa_object.XFAObjectArray();
  55821. this.keyUsage = new _xfa_object.XFAObjectArray();
  55822. this.line = new _xfa_object.XFAObjectArray();
  55823. this.linear = new _xfa_object.XFAObjectArray();
  55824. this.lockDocument = new _xfa_object.XFAObjectArray();
  55825. this.manifest = new _xfa_object.XFAObjectArray();
  55826. this.margin = new _xfa_object.XFAObjectArray();
  55827. this.mdp = new _xfa_object.XFAObjectArray();
  55828. this.medium = new _xfa_object.XFAObjectArray();
  55829. this.message = new _xfa_object.XFAObjectArray();
  55830. this.numericEdit = new _xfa_object.XFAObjectArray();
  55831. this.occur = new _xfa_object.XFAObjectArray();
  55832. this.oid = new _xfa_object.XFAObjectArray();
  55833. this.oids = new _xfa_object.XFAObjectArray();
  55834. this.overflow = new _xfa_object.XFAObjectArray();
  55835. this.pageArea = new _xfa_object.XFAObjectArray();
  55836. this.pageSet = new _xfa_object.XFAObjectArray();
  55837. this.para = new _xfa_object.XFAObjectArray();
  55838. this.passwordEdit = new _xfa_object.XFAObjectArray();
  55839. this.pattern = new _xfa_object.XFAObjectArray();
  55840. this.picture = new _xfa_object.XFAObjectArray();
  55841. this.radial = new _xfa_object.XFAObjectArray();
  55842. this.reason = new _xfa_object.XFAObjectArray();
  55843. this.reasons = new _xfa_object.XFAObjectArray();
  55844. this.rectangle = new _xfa_object.XFAObjectArray();
  55845. this.ref = new _xfa_object.XFAObjectArray();
  55846. this.script = new _xfa_object.XFAObjectArray();
  55847. this.setProperty = new _xfa_object.XFAObjectArray();
  55848. this.signData = new _xfa_object.XFAObjectArray();
  55849. this.signature = new _xfa_object.XFAObjectArray();
  55850. this.signing = new _xfa_object.XFAObjectArray();
  55851. this.solid = new _xfa_object.XFAObjectArray();
  55852. this.speak = new _xfa_object.XFAObjectArray();
  55853. this.stipple = new _xfa_object.XFAObjectArray();
  55854. this.subform = new _xfa_object.XFAObjectArray();
  55855. this.subformSet = new _xfa_object.XFAObjectArray();
  55856. this.subjectDN = new _xfa_object.XFAObjectArray();
  55857. this.subjectDNs = new _xfa_object.XFAObjectArray();
  55858. this.submit = new _xfa_object.XFAObjectArray();
  55859. this.text = new _xfa_object.XFAObjectArray();
  55860. this.textEdit = new _xfa_object.XFAObjectArray();
  55861. this.time = new _xfa_object.XFAObjectArray();
  55862. this.timeStamp = new _xfa_object.XFAObjectArray();
  55863. this.toolTip = new _xfa_object.XFAObjectArray();
  55864. this.traversal = new _xfa_object.XFAObjectArray();
  55865. this.traverse = new _xfa_object.XFAObjectArray();
  55866. this.ui = new _xfa_object.XFAObjectArray();
  55867. this.validate = new _xfa_object.XFAObjectArray();
  55868. this.value = new _xfa_object.XFAObjectArray();
  55869. this.variables = new _xfa_object.XFAObjectArray();
  55870. }
  55871. }
  55872. class Radial extends _xfa_object.XFAObject {
  55873. constructor(attributes) {
  55874. super(TEMPLATE_NS_ID, "radial", true);
  55875. this.id = attributes.id || "";
  55876. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  55877. this.use = attributes.use || "";
  55878. this.usehref = attributes.usehref || "";
  55879. this.color = null;
  55880. this.extras = null;
  55881. }
  55882. [_xfa_object.$toStyle](startColor) {
  55883. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55884. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55885. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  55886. return `radial-gradient(circle at center, ${colors})`;
  55887. }
  55888. }
  55889. class Reason extends _xfa_object.StringObject {
  55890. constructor(attributes) {
  55891. super(TEMPLATE_NS_ID, "reason");
  55892. this.id = attributes.id || "";
  55893. this.name = attributes.name || "";
  55894. this.use = attributes.use || "";
  55895. this.usehref = attributes.usehref || "";
  55896. }
  55897. }
  55898. class Reasons extends _xfa_object.XFAObject {
  55899. constructor(attributes) {
  55900. super(TEMPLATE_NS_ID, "reasons", true);
  55901. this.id = attributes.id || "";
  55902. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55903. this.use = attributes.use || "";
  55904. this.usehref = attributes.usehref || "";
  55905. this.reason = new _xfa_object.XFAObjectArray();
  55906. }
  55907. }
  55908. class Rectangle extends _xfa_object.XFAObject {
  55909. constructor(attributes) {
  55910. super(TEMPLATE_NS_ID, "rectangle", true);
  55911. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55912. this.id = attributes.id || "";
  55913. this.use = attributes.use || "";
  55914. this.usehref = attributes.usehref || "";
  55915. this.corner = new _xfa_object.XFAObjectArray(4);
  55916. this.edge = new _xfa_object.XFAObjectArray(4);
  55917. this.fill = null;
  55918. }
  55919. [_xfa_object.$toHTML]() {
  55920. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  55921. const edgeStyle = edge[_xfa_object.$toStyle]();
  55922. const style = Object.create(null);
  55923. if (this.fill && this.fill.presence === "visible") {
  55924. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  55925. } else {
  55926. style.fill = "transparent";
  55927. }
  55928. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  55929. style.stroke = edgeStyle.color;
  55930. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  55931. const cornerStyle = corner[_xfa_object.$toStyle]();
  55932. const rect = {
  55933. name: "rect",
  55934. attributes: {
  55935. xmlns: SVG_NS,
  55936. width: "100%",
  55937. height: "100%",
  55938. x: 0,
  55939. y: 0,
  55940. rx: cornerStyle.radius,
  55941. ry: cornerStyle.radius,
  55942. style
  55943. }
  55944. };
  55945. const svg = {
  55946. name: "svg",
  55947. children: [rect],
  55948. attributes: {
  55949. xmlns: SVG_NS,
  55950. style: {
  55951. overflow: "visible"
  55952. },
  55953. width: "100%",
  55954. height: "100%"
  55955. }
  55956. };
  55957. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55958. if (hasMargin(parent)) {
  55959. return _utils.HTMLResult.success({
  55960. name: "div",
  55961. attributes: {
  55962. style: {
  55963. display: "inline",
  55964. width: "100%",
  55965. height: "100%"
  55966. }
  55967. },
  55968. children: [svg]
  55969. });
  55970. }
  55971. svg.attributes.style.position = "absolute";
  55972. return _utils.HTMLResult.success(svg);
  55973. }
  55974. }
  55975. class RefElement extends _xfa_object.StringObject {
  55976. constructor(attributes) {
  55977. super(TEMPLATE_NS_ID, "ref");
  55978. this.id = attributes.id || "";
  55979. this.use = attributes.use || "";
  55980. this.usehref = attributes.usehref || "";
  55981. }
  55982. }
  55983. class Script extends _xfa_object.StringObject {
  55984. constructor(attributes) {
  55985. super(TEMPLATE_NS_ID, "script");
  55986. this.binding = attributes.binding || "";
  55987. this.contentType = attributes.contentType || "";
  55988. this.id = attributes.id || "";
  55989. this.name = attributes.name || "";
  55990. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55991. this.use = attributes.use || "";
  55992. this.usehref = attributes.usehref || "";
  55993. }
  55994. }
  55995. class SetProperty extends _xfa_object.XFAObject {
  55996. constructor(attributes) {
  55997. super(TEMPLATE_NS_ID, "setProperty");
  55998. this.connection = attributes.connection || "";
  55999. this.ref = attributes.ref || "";
  56000. this.target = attributes.target || "";
  56001. }
  56002. }
  56003. exports.SetProperty = SetProperty;
  56004. class SignData extends _xfa_object.XFAObject {
  56005. constructor(attributes) {
  56006. super(TEMPLATE_NS_ID, "signData", true);
  56007. this.id = attributes.id || "";
  56008. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  56009. this.ref = attributes.ref || "";
  56010. this.target = attributes.target || "";
  56011. this.use = attributes.use || "";
  56012. this.usehref = attributes.usehref || "";
  56013. this.filter = null;
  56014. this.manifest = null;
  56015. }
  56016. }
  56017. class Signature extends _xfa_object.XFAObject {
  56018. constructor(attributes) {
  56019. super(TEMPLATE_NS_ID, "signature", true);
  56020. this.id = attributes.id || "";
  56021. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  56022. this.use = attributes.use || "";
  56023. this.usehref = attributes.usehref || "";
  56024. this.border = null;
  56025. this.extras = null;
  56026. this.filter = null;
  56027. this.manifest = null;
  56028. this.margin = null;
  56029. }
  56030. }
  56031. class Signing extends _xfa_object.XFAObject {
  56032. constructor(attributes) {
  56033. super(TEMPLATE_NS_ID, "signing", true);
  56034. this.id = attributes.id || "";
  56035. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56036. this.use = attributes.use || "";
  56037. this.usehref = attributes.usehref || "";
  56038. this.certificate = new _xfa_object.XFAObjectArray();
  56039. }
  56040. }
  56041. class Solid extends _xfa_object.XFAObject {
  56042. constructor(attributes) {
  56043. super(TEMPLATE_NS_ID, "solid", true);
  56044. this.id = attributes.id || "";
  56045. this.use = attributes.use || "";
  56046. this.usehref = attributes.usehref || "";
  56047. this.extras = null;
  56048. }
  56049. [_xfa_object.$toStyle](startColor) {
  56050. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56051. }
  56052. }
  56053. class Speak extends _xfa_object.StringObject {
  56054. constructor(attributes) {
  56055. super(TEMPLATE_NS_ID, "speak");
  56056. this.disable = (0, _utils.getInteger)({
  56057. data: attributes.disable,
  56058. defaultValue: 0,
  56059. validate: x => x === 1
  56060. });
  56061. this.id = attributes.id || "";
  56062. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  56063. this.rid = attributes.rid || "";
  56064. this.use = attributes.use || "";
  56065. this.usehref = attributes.usehref || "";
  56066. }
  56067. }
  56068. class Stipple extends _xfa_object.XFAObject {
  56069. constructor(attributes) {
  56070. super(TEMPLATE_NS_ID, "stipple", true);
  56071. this.id = attributes.id || "";
  56072. this.rate = (0, _utils.getInteger)({
  56073. data: attributes.rate,
  56074. defaultValue: 50,
  56075. validate: x => x >= 0 && x <= 100
  56076. });
  56077. this.use = attributes.use || "";
  56078. this.usehref = attributes.usehref || "";
  56079. this.color = null;
  56080. this.extras = null;
  56081. }
  56082. [_xfa_object.$toStyle](bgColor) {
  56083. const alpha = this.rate / 100;
  56084. 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));
  56085. }
  56086. }
  56087. class Subform extends _xfa_object.XFAObject {
  56088. constructor(attributes) {
  56089. super(TEMPLATE_NS_ID, "subform", true);
  56090. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  56091. this.allowMacro = (0, _utils.getInteger)({
  56092. data: attributes.allowMacro,
  56093. defaultValue: 0,
  56094. validate: x => x === 1
  56095. });
  56096. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  56097. this.colSpan = (0, _utils.getInteger)({
  56098. data: attributes.colSpan,
  56099. defaultValue: 1,
  56100. validate: n => n >= 1 || n === -1
  56101. });
  56102. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  56103. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  56104. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56105. this.id = attributes.id || "";
  56106. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  56107. this.locale = attributes.locale || "";
  56108. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  56109. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  56110. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  56111. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  56112. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  56113. this.name = attributes.name || "";
  56114. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56115. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56116. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  56117. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  56118. this.use = attributes.use || "";
  56119. this.usehref = attributes.usehref || "";
  56120. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  56121. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  56122. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  56123. this.assist = null;
  56124. this.bind = null;
  56125. this.bookend = null;
  56126. this.border = null;
  56127. this.break = null;
  56128. this.calculate = null;
  56129. this.desc = null;
  56130. this.extras = null;
  56131. this.keep = null;
  56132. this.margin = null;
  56133. this.occur = null;
  56134. this.overflow = null;
  56135. this.pageSet = null;
  56136. this.para = null;
  56137. this.traversal = null;
  56138. this.validate = null;
  56139. this.variables = null;
  56140. this.area = new _xfa_object.XFAObjectArray();
  56141. this.breakAfter = new _xfa_object.XFAObjectArray();
  56142. this.breakBefore = new _xfa_object.XFAObjectArray();
  56143. this.connect = new _xfa_object.XFAObjectArray();
  56144. this.draw = new _xfa_object.XFAObjectArray();
  56145. this.event = new _xfa_object.XFAObjectArray();
  56146. this.exObject = new _xfa_object.XFAObjectArray();
  56147. this.exclGroup = new _xfa_object.XFAObjectArray();
  56148. this.field = new _xfa_object.XFAObjectArray();
  56149. this.proto = new _xfa_object.XFAObjectArray();
  56150. this.setProperty = new _xfa_object.XFAObjectArray();
  56151. this.subform = new _xfa_object.XFAObjectArray();
  56152. this.subformSet = new _xfa_object.XFAObjectArray();
  56153. }
  56154. [_xfa_object.$getSubformParent]() {
  56155. const parent = this[_xfa_object.$getParent]();
  56156. if (parent instanceof SubformSet) {
  56157. return parent[_xfa_object.$getSubformParent]();
  56158. }
  56159. return parent;
  56160. }
  56161. [_xfa_object.$isBindable]() {
  56162. return true;
  56163. }
  56164. [_xfa_object.$isThereMoreWidth]() {
  56165. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  56166. }
  56167. *[_xfa_object.$getContainedChildren]() {
  56168. yield* getContainedChildren(this);
  56169. }
  56170. [_xfa_object.$flushHTML]() {
  56171. return (0, _layout.flushHTML)(this);
  56172. }
  56173. [_xfa_object.$addHTML](html, bbox) {
  56174. (0, _layout.addHTML)(this, html, bbox);
  56175. }
  56176. [_xfa_object.$getAvailableSpace]() {
  56177. return (0, _layout.getAvailableSpace)(this);
  56178. }
  56179. [_xfa_object.$isSplittable]() {
  56180. const parent = this[_xfa_object.$getSubformParent]();
  56181. if (!parent[_xfa_object.$isSplittable]()) {
  56182. return false;
  56183. }
  56184. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  56185. return this[_xfa_object.$extra]._isSplittable;
  56186. }
  56187. if (this.layout === "position" || this.layout.includes("row")) {
  56188. this[_xfa_object.$extra]._isSplittable = false;
  56189. return false;
  56190. }
  56191. if (this.keep && this.keep.intact !== "none") {
  56192. this[_xfa_object.$extra]._isSplittable = false;
  56193. return false;
  56194. }
  56195. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  56196. return false;
  56197. }
  56198. this[_xfa_object.$extra]._isSplittable = true;
  56199. return true;
  56200. }
  56201. [_xfa_object.$toHTML](availableSpace) {
  56202. setTabIndex(this);
  56203. if (this.break) {
  56204. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  56205. const node = new BreakAfter({
  56206. targetType: this.break.after,
  56207. target: this.break.afterTarget,
  56208. startNew: this.break.startNew.toString()
  56209. });
  56210. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56211. this[_xfa_object.$appendChild](node);
  56212. this.breakAfter.push(node);
  56213. }
  56214. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  56215. const node = new BreakBefore({
  56216. targetType: this.break.before,
  56217. target: this.break.beforeTarget,
  56218. startNew: this.break.startNew.toString()
  56219. });
  56220. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56221. this[_xfa_object.$appendChild](node);
  56222. this.breakBefore.push(node);
  56223. }
  56224. if (this.break.overflowTarget !== "") {
  56225. const node = new Overflow({
  56226. target: this.break.overflowTarget,
  56227. leader: this.break.overflowLeader,
  56228. trailer: this.break.overflowTrailer
  56229. });
  56230. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56231. this[_xfa_object.$appendChild](node);
  56232. this.overflow.push(node);
  56233. }
  56234. this[_xfa_object.$removeChild](this.break);
  56235. this.break = null;
  56236. }
  56237. if (this.presence === "hidden" || this.presence === "inactive") {
  56238. return _utils.HTMLResult.EMPTY;
  56239. }
  56240. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  56241. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  56242. }
  56243. if (this.breakBefore.children.length >= 1) {
  56244. const breakBefore = this.breakBefore.children[0];
  56245. if (handleBreak(breakBefore)) {
  56246. return _utils.HTMLResult.breakNode(breakBefore);
  56247. }
  56248. }
  56249. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  56250. return _utils.HTMLResult.EMPTY;
  56251. }
  56252. (0, _html_utils.fixDimensions)(this);
  56253. const children = [];
  56254. const attributes = {
  56255. id: this[_xfa_object.$uid],
  56256. class: []
  56257. };
  56258. (0, _html_utils.setAccess)(this, attributes.class);
  56259. if (!this[_xfa_object.$extra]) {
  56260. this[_xfa_object.$extra] = Object.create(null);
  56261. }
  56262. Object.assign(this[_xfa_object.$extra], {
  56263. children,
  56264. line: null,
  56265. attributes,
  56266. attempt: 0,
  56267. numberInLine: 0,
  56268. availableSpace: {
  56269. width: Math.min(this.w || Infinity, availableSpace.width),
  56270. height: Math.min(this.h || Infinity, availableSpace.height)
  56271. },
  56272. width: 0,
  56273. height: 0,
  56274. prevHeight: 0,
  56275. currentWidth: 0
  56276. });
  56277. const root = this[_xfa_object.$getTemplateRoot]();
  56278. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  56279. const isSplittable = this[_xfa_object.$isSplittable]();
  56280. if (!isSplittable) {
  56281. setFirstUnsplittable(this);
  56282. }
  56283. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  56284. return _utils.HTMLResult.FAILURE;
  56285. }
  56286. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  56287. if (this.layout.includes("row")) {
  56288. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  56289. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  56290. this[_xfa_object.$extra].columnWidths = columnWidths;
  56291. this[_xfa_object.$extra].currentColumn = 0;
  56292. }
  56293. }
  56294. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  56295. const classNames = ["xfaSubform"];
  56296. const cl = (0, _html_utils.layoutClass)(this);
  56297. if (cl) {
  56298. classNames.push(cl);
  56299. }
  56300. attributes.style = style;
  56301. attributes.class = classNames;
  56302. if (this.name) {
  56303. attributes.xfaName = this.name;
  56304. }
  56305. if (this.overflow) {
  56306. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  56307. if (overflowExtra.addLeader) {
  56308. overflowExtra.addLeader = false;
  56309. handleOverflow(this, overflowExtra.leader, availableSpace);
  56310. }
  56311. }
  56312. this[_xfa_object.$pushPara]();
  56313. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  56314. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  56315. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  56316. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  56317. this[_xfa_object.$extra].numberInLine = 0;
  56318. }
  56319. const result = this[_xfa_object.$childrenToHTML]({
  56320. filter,
  56321. include: true
  56322. });
  56323. if (result.success) {
  56324. break;
  56325. }
  56326. if (result.isBreak()) {
  56327. this[_xfa_object.$popPara]();
  56328. return result;
  56329. }
  56330. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  56331. this[_xfa_object.$extra].attempt = maxRun;
  56332. break;
  56333. }
  56334. }
  56335. this[_xfa_object.$popPara]();
  56336. if (!isSplittable) {
  56337. unsetFirstUnsplittable(this);
  56338. }
  56339. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  56340. if (this[_xfa_object.$extra].attempt === maxRun) {
  56341. if (this.overflow) {
  56342. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  56343. }
  56344. if (!isSplittable) {
  56345. delete this[_xfa_object.$extra];
  56346. }
  56347. return _utils.HTMLResult.FAILURE;
  56348. }
  56349. if (this.overflow) {
  56350. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  56351. if (overflowExtra.addTrailer) {
  56352. overflowExtra.addTrailer = false;
  56353. handleOverflow(this, overflowExtra.trailer, availableSpace);
  56354. }
  56355. }
  56356. let marginH = 0;
  56357. let marginV = 0;
  56358. if (this.margin) {
  56359. marginH = this.margin.leftInset + this.margin.rightInset;
  56360. marginV = this.margin.topInset + this.margin.bottomInset;
  56361. }
  56362. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  56363. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  56364. const bbox = [this.x, this.y, width, height];
  56365. if (this.w === "") {
  56366. style.width = (0, _html_utils.measureToString)(width);
  56367. }
  56368. if (this.h === "") {
  56369. style.height = (0, _html_utils.measureToString)(height);
  56370. }
  56371. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  56372. return _utils.HTMLResult.EMPTY;
  56373. }
  56374. const html = {
  56375. name: "div",
  56376. attributes,
  56377. children
  56378. };
  56379. applyAssist(this, attributes);
  56380. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  56381. if (this.breakAfter.children.length >= 1) {
  56382. const breakAfter = this.breakAfter.children[0];
  56383. if (handleBreak(breakAfter)) {
  56384. this[_xfa_object.$extra].afterBreakAfter = result;
  56385. return _utils.HTMLResult.breakNode(breakAfter);
  56386. }
  56387. }
  56388. delete this[_xfa_object.$extra];
  56389. return result;
  56390. }
  56391. }
  56392. class SubformSet extends _xfa_object.XFAObject {
  56393. constructor(attributes) {
  56394. super(TEMPLATE_NS_ID, "subformSet", true);
  56395. this.id = attributes.id || "";
  56396. this.name = attributes.name || "";
  56397. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  56398. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56399. this.use = attributes.use || "";
  56400. this.usehref = attributes.usehref || "";
  56401. this.bookend = null;
  56402. this.break = null;
  56403. this.desc = null;
  56404. this.extras = null;
  56405. this.occur = null;
  56406. this.overflow = null;
  56407. this.breakAfter = new _xfa_object.XFAObjectArray();
  56408. this.breakBefore = new _xfa_object.XFAObjectArray();
  56409. this.subform = new _xfa_object.XFAObjectArray();
  56410. this.subformSet = new _xfa_object.XFAObjectArray();
  56411. }
  56412. *[_xfa_object.$getContainedChildren]() {
  56413. yield* getContainedChildren(this);
  56414. }
  56415. [_xfa_object.$getSubformParent]() {
  56416. let parent = this[_xfa_object.$getParent]();
  56417. while (!(parent instanceof Subform)) {
  56418. parent = parent[_xfa_object.$getParent]();
  56419. }
  56420. return parent;
  56421. }
  56422. [_xfa_object.$isBindable]() {
  56423. return true;
  56424. }
  56425. }
  56426. class SubjectDN extends _xfa_object.ContentObject {
  56427. constructor(attributes) {
  56428. super(TEMPLATE_NS_ID, "subjectDN");
  56429. this.delimiter = attributes.delimiter || ",";
  56430. this.id = attributes.id || "";
  56431. this.name = attributes.name || "";
  56432. this.use = attributes.use || "";
  56433. this.usehref = attributes.usehref || "";
  56434. }
  56435. [_xfa_object.$finalize]() {
  56436. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  56437. kv = kv.split("=", 2);
  56438. kv[0] = kv[0].trim();
  56439. return kv;
  56440. }));
  56441. }
  56442. }
  56443. class SubjectDNs extends _xfa_object.XFAObject {
  56444. constructor(attributes) {
  56445. super(TEMPLATE_NS_ID, "subjectDNs", true);
  56446. this.id = attributes.id || "";
  56447. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56448. this.use = attributes.use || "";
  56449. this.usehref = attributes.usehref || "";
  56450. this.subjectDN = new _xfa_object.XFAObjectArray();
  56451. }
  56452. }
  56453. class Submit extends _xfa_object.XFAObject {
  56454. constructor(attributes) {
  56455. super(TEMPLATE_NS_ID, "submit", true);
  56456. this.embedPDF = (0, _utils.getInteger)({
  56457. data: attributes.embedPDF,
  56458. defaultValue: 0,
  56459. validate: x => x === 1
  56460. });
  56461. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  56462. this.id = attributes.id || "";
  56463. this.target = attributes.target || "";
  56464. this.textEncoding = (0, _utils.getKeyword)({
  56465. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  56466. defaultValue: "",
  56467. 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}/)
  56468. });
  56469. this.use = attributes.use || "";
  56470. this.usehref = attributes.usehref || "";
  56471. this.xdpContent = attributes.xdpContent || "";
  56472. this.encrypt = null;
  56473. this.encryptData = new _xfa_object.XFAObjectArray();
  56474. this.signData = new _xfa_object.XFAObjectArray();
  56475. }
  56476. }
  56477. class Template extends _xfa_object.XFAObject {
  56478. constructor(attributes) {
  56479. super(TEMPLATE_NS_ID, "template", true);
  56480. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  56481. this.extras = null;
  56482. this.subform = new _xfa_object.XFAObjectArray();
  56483. }
  56484. [_xfa_object.$finalize]() {
  56485. if (this.subform.children.length === 0) {
  56486. (0, _util.warn)("XFA - No subforms in template node.");
  56487. }
  56488. if (this.subform.children.length >= 2) {
  56489. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  56490. }
  56491. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  56492. }
  56493. [_xfa_object.$isSplittable]() {
  56494. return true;
  56495. }
  56496. [_xfa_object.$searchNode](expr, container) {
  56497. if (expr.startsWith("#")) {
  56498. return [this[_xfa_object.$ids].get(expr.slice(1))];
  56499. }
  56500. return (0, _som.searchNode)(this, container, expr, true, true);
  56501. }
  56502. *[_xfa_object.$toPages]() {
  56503. if (!this.subform.children.length) {
  56504. return _utils.HTMLResult.success({
  56505. name: "div",
  56506. children: []
  56507. });
  56508. }
  56509. this[_xfa_object.$extra] = {
  56510. overflowNode: null,
  56511. firstUnsplittable: null,
  56512. currentContentArea: null,
  56513. currentPageArea: null,
  56514. noLayoutFailure: false,
  56515. pageNumber: 1,
  56516. pagePosition: "first",
  56517. oddOrEven: "odd",
  56518. blankOrNotBlank: "nonBlank",
  56519. paraStack: []
  56520. };
  56521. const root = this.subform.children[0];
  56522. root.pageSet[_xfa_object.$cleanPage]();
  56523. const pageAreas = root.pageSet.pageArea.children;
  56524. const mainHtml = {
  56525. name: "div",
  56526. children: []
  56527. };
  56528. let pageArea = null;
  56529. let breakBefore = null;
  56530. let breakBeforeTarget = null;
  56531. if (root.breakBefore.children.length >= 1) {
  56532. breakBefore = root.breakBefore.children[0];
  56533. breakBeforeTarget = breakBefore.target;
  56534. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  56535. breakBefore = root.subform.children[0].breakBefore.children[0];
  56536. breakBeforeTarget = breakBefore.target;
  56537. } else if (root.break && root.break.beforeTarget) {
  56538. breakBefore = root.break;
  56539. breakBeforeTarget = breakBefore.beforeTarget;
  56540. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  56541. breakBefore = root.subform.children[0].break;
  56542. breakBeforeTarget = breakBefore.beforeTarget;
  56543. }
  56544. if (breakBefore) {
  56545. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  56546. if (target instanceof PageArea) {
  56547. pageArea = target;
  56548. breakBefore[_xfa_object.$extra] = {};
  56549. }
  56550. }
  56551. if (!pageArea) {
  56552. pageArea = pageAreas[0];
  56553. }
  56554. pageArea[_xfa_object.$extra] = {
  56555. numberOfUse: 1
  56556. };
  56557. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  56558. pageAreaParent[_xfa_object.$extra] = {
  56559. numberOfUse: 1,
  56560. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  56561. pageSetIndex: 0
  56562. };
  56563. let targetPageArea;
  56564. let leader = null;
  56565. let trailer = null;
  56566. let hasSomething = true;
  56567. let hasSomethingCounter = 0;
  56568. let startIndex = 0;
  56569. while (true) {
  56570. if (!hasSomething) {
  56571. mainHtml.children.pop();
  56572. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  56573. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  56574. return mainHtml;
  56575. }
  56576. } else {
  56577. hasSomethingCounter = 0;
  56578. }
  56579. targetPageArea = null;
  56580. this[_xfa_object.$extra].currentPageArea = pageArea;
  56581. const page = pageArea[_xfa_object.$toHTML]().html;
  56582. mainHtml.children.push(page);
  56583. if (leader) {
  56584. this[_xfa_object.$extra].noLayoutFailure = true;
  56585. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  56586. leader = null;
  56587. }
  56588. if (trailer) {
  56589. this[_xfa_object.$extra].noLayoutFailure = true;
  56590. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  56591. trailer = null;
  56592. }
  56593. const contentAreas = pageArea.contentArea.children;
  56594. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  56595. hasSomething = false;
  56596. this[_xfa_object.$extra].firstUnsplittable = null;
  56597. this[_xfa_object.$extra].noLayoutFailure = false;
  56598. const flush = index => {
  56599. const html = root[_xfa_object.$flushHTML]();
  56600. if (html) {
  56601. hasSomething = hasSomething || html.children && html.children.length !== 0;
  56602. htmlContentAreas[index].children.push(html);
  56603. }
  56604. };
  56605. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  56606. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  56607. const space = {
  56608. width: contentArea.w,
  56609. height: contentArea.h
  56610. };
  56611. startIndex = 0;
  56612. if (leader) {
  56613. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  56614. leader = null;
  56615. }
  56616. if (trailer) {
  56617. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  56618. trailer = null;
  56619. }
  56620. const html = root[_xfa_object.$toHTML](space);
  56621. if (html.success) {
  56622. if (html.html) {
  56623. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  56624. htmlContentAreas[i].children.push(html.html);
  56625. } else if (!hasSomething && mainHtml.children.length > 1) {
  56626. mainHtml.children.pop();
  56627. }
  56628. return mainHtml;
  56629. }
  56630. if (html.isBreak()) {
  56631. const node = html.breakNode;
  56632. flush(i);
  56633. if (node.targetType === "auto") {
  56634. continue;
  56635. }
  56636. if (node.leader) {
  56637. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  56638. leader = leader ? leader[0] : null;
  56639. }
  56640. if (node.trailer) {
  56641. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  56642. trailer = trailer ? trailer[0] : null;
  56643. }
  56644. if (node.targetType === "pageArea") {
  56645. targetPageArea = node[_xfa_object.$extra].target;
  56646. i = Infinity;
  56647. } else if (!node[_xfa_object.$extra].target) {
  56648. i = node[_xfa_object.$extra].index;
  56649. } else {
  56650. targetPageArea = node[_xfa_object.$extra].target;
  56651. startIndex = node[_xfa_object.$extra].index + 1;
  56652. i = Infinity;
  56653. }
  56654. continue;
  56655. }
  56656. if (this[_xfa_object.$extra].overflowNode) {
  56657. const node = this[_xfa_object.$extra].overflowNode;
  56658. this[_xfa_object.$extra].overflowNode = null;
  56659. const overflowExtra = node[_xfa_object.$getExtra]();
  56660. const target = overflowExtra.target;
  56661. overflowExtra.addLeader = overflowExtra.leader !== null;
  56662. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  56663. flush(i);
  56664. const currentIndex = i;
  56665. i = Infinity;
  56666. if (target instanceof PageArea) {
  56667. targetPageArea = target;
  56668. } else if (target instanceof ContentArea) {
  56669. const index = contentAreas.findIndex(e => e === target);
  56670. if (index !== -1) {
  56671. if (index > currentIndex) {
  56672. i = index - 1;
  56673. } else {
  56674. startIndex = index;
  56675. }
  56676. } else {
  56677. targetPageArea = target[_xfa_object.$getParent]();
  56678. startIndex = targetPageArea.contentArea.children.findIndex(e => e === target);
  56679. }
  56680. }
  56681. continue;
  56682. }
  56683. flush(i);
  56684. }
  56685. this[_xfa_object.$extra].pageNumber += 1;
  56686. if (targetPageArea) {
  56687. if (targetPageArea[_xfa_object.$isUsable]()) {
  56688. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  56689. } else {
  56690. targetPageArea = null;
  56691. }
  56692. }
  56693. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  56694. yield null;
  56695. }
  56696. }
  56697. }
  56698. exports.Template = Template;
  56699. class Text extends _xfa_object.ContentObject {
  56700. constructor(attributes) {
  56701. super(TEMPLATE_NS_ID, "text");
  56702. this.id = attributes.id || "";
  56703. this.maxChars = (0, _utils.getInteger)({
  56704. data: attributes.maxChars,
  56705. defaultValue: 0,
  56706. validate: x => x >= 0
  56707. });
  56708. this.name = attributes.name || "";
  56709. this.rid = attributes.rid || "";
  56710. this.use = attributes.use || "";
  56711. this.usehref = attributes.usehref || "";
  56712. }
  56713. [_xfa_object.$acceptWhitespace]() {
  56714. return true;
  56715. }
  56716. [_xfa_object.$onChild](child) {
  56717. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56718. this[_xfa_object.$content] = child;
  56719. return true;
  56720. }
  56721. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  56722. return false;
  56723. }
  56724. [_xfa_object.$onText](str) {
  56725. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  56726. return;
  56727. }
  56728. super[_xfa_object.$onText](str);
  56729. }
  56730. [_xfa_object.$finalize]() {
  56731. if (typeof this[_xfa_object.$content] === "string") {
  56732. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  56733. }
  56734. }
  56735. [_xfa_object.$getExtra]() {
  56736. if (typeof this[_xfa_object.$content] === "string") {
  56737. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  56738. if (line) {
  56739. acc.push(line);
  56740. }
  56741. return acc;
  56742. }, []).join("\n");
  56743. }
  56744. return this[_xfa_object.$content][_xfa_object.$text]();
  56745. }
  56746. [_xfa_object.$toHTML](availableSpace) {
  56747. if (typeof this[_xfa_object.$content] === "string") {
  56748. const html = valueToHtml(this[_xfa_object.$content]).html;
  56749. if (this[_xfa_object.$content].includes("\u2029")) {
  56750. html.name = "div";
  56751. html.children = [];
  56752. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  56753. acc.push({
  56754. name: "span",
  56755. value: line
  56756. }, {
  56757. name: "br"
  56758. });
  56759. return acc;
  56760. }, [])).forEach(lines => {
  56761. html.children.push({
  56762. name: "p",
  56763. children: lines
  56764. });
  56765. });
  56766. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  56767. html.name = "div";
  56768. html.children = [];
  56769. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  56770. html.children.push({
  56771. name: "span",
  56772. value: line
  56773. }, {
  56774. name: "br"
  56775. });
  56776. });
  56777. }
  56778. return _utils.HTMLResult.success(html);
  56779. }
  56780. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  56781. }
  56782. }
  56783. exports.Text = Text;
  56784. class TextEdit extends _xfa_object.XFAObject {
  56785. constructor(attributes) {
  56786. super(TEMPLATE_NS_ID, "textEdit", true);
  56787. this.allowRichText = (0, _utils.getInteger)({
  56788. data: attributes.allowRichText,
  56789. defaultValue: 0,
  56790. validate: x => x === 1
  56791. });
  56792. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56793. this.id = attributes.id || "";
  56794. this.multiLine = (0, _utils.getInteger)({
  56795. data: attributes.multiLine,
  56796. defaultValue: "",
  56797. validate: x => x === 0 || x === 1
  56798. });
  56799. this.use = attributes.use || "";
  56800. this.usehref = attributes.usehref || "";
  56801. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  56802. this.border = null;
  56803. this.comb = null;
  56804. this.extras = null;
  56805. this.margin = null;
  56806. }
  56807. [_xfa_object.$toHTML](availableSpace) {
  56808. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56809. let html;
  56810. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56811. if (this.multiLine === "") {
  56812. this.multiLine = field instanceof Draw ? 1 : 0;
  56813. }
  56814. if (this.multiLine === 1) {
  56815. html = {
  56816. name: "textarea",
  56817. attributes: {
  56818. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56819. fieldId: field[_xfa_object.$uid],
  56820. class: ["xfaTextfield"],
  56821. style,
  56822. "aria-label": ariaLabel(field)
  56823. }
  56824. };
  56825. } else {
  56826. html = {
  56827. name: "input",
  56828. attributes: {
  56829. type: "text",
  56830. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56831. fieldId: field[_xfa_object.$uid],
  56832. class: ["xfaTextfield"],
  56833. style,
  56834. "aria-label": ariaLabel(field)
  56835. }
  56836. };
  56837. }
  56838. return _utils.HTMLResult.success({
  56839. name: "label",
  56840. attributes: {
  56841. class: ["xfaLabel"]
  56842. },
  56843. children: [html]
  56844. });
  56845. }
  56846. }
  56847. class Time extends _xfa_object.StringObject {
  56848. constructor(attributes) {
  56849. super(TEMPLATE_NS_ID, "time");
  56850. this.id = attributes.id || "";
  56851. this.name = attributes.name || "";
  56852. this.use = attributes.use || "";
  56853. this.usehref = attributes.usehref || "";
  56854. }
  56855. [_xfa_object.$finalize]() {
  56856. const date = this[_xfa_object.$content].trim();
  56857. this[_xfa_object.$content] = date ? new Date(date) : null;
  56858. }
  56859. [_xfa_object.$toHTML](availableSpace) {
  56860. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  56861. }
  56862. }
  56863. class TimeStamp extends _xfa_object.XFAObject {
  56864. constructor(attributes) {
  56865. super(TEMPLATE_NS_ID, "timeStamp");
  56866. this.id = attributes.id || "";
  56867. this.server = attributes.server || "";
  56868. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56869. this.use = attributes.use || "";
  56870. this.usehref = attributes.usehref || "";
  56871. }
  56872. }
  56873. class ToolTip extends _xfa_object.StringObject {
  56874. constructor(attributes) {
  56875. super(TEMPLATE_NS_ID, "toolTip");
  56876. this.id = attributes.id || "";
  56877. this.rid = attributes.rid || "";
  56878. this.use = attributes.use || "";
  56879. this.usehref = attributes.usehref || "";
  56880. }
  56881. }
  56882. class Traversal extends _xfa_object.XFAObject {
  56883. constructor(attributes) {
  56884. super(TEMPLATE_NS_ID, "traversal", true);
  56885. this.id = attributes.id || "";
  56886. this.use = attributes.use || "";
  56887. this.usehref = attributes.usehref || "";
  56888. this.extras = null;
  56889. this.traverse = new _xfa_object.XFAObjectArray();
  56890. }
  56891. }
  56892. class Traverse extends _xfa_object.XFAObject {
  56893. constructor(attributes) {
  56894. super(TEMPLATE_NS_ID, "traverse", true);
  56895. this.id = attributes.id || "";
  56896. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  56897. this.ref = attributes.ref || "";
  56898. this.use = attributes.use || "";
  56899. this.usehref = attributes.usehref || "";
  56900. this.extras = null;
  56901. this.script = null;
  56902. }
  56903. get name() {
  56904. return this.operation;
  56905. }
  56906. [_xfa_object.$isTransparent]() {
  56907. return false;
  56908. }
  56909. }
  56910. class Ui extends _xfa_object.XFAObject {
  56911. constructor(attributes) {
  56912. super(TEMPLATE_NS_ID, "ui", true);
  56913. this.id = attributes.id || "";
  56914. this.use = attributes.use || "";
  56915. this.usehref = attributes.usehref || "";
  56916. this.extras = null;
  56917. this.picture = null;
  56918. this.barcode = null;
  56919. this.button = null;
  56920. this.checkButton = null;
  56921. this.choiceList = null;
  56922. this.dateTimeEdit = null;
  56923. this.defaultUi = null;
  56924. this.imageEdit = null;
  56925. this.numericEdit = null;
  56926. this.passwordEdit = null;
  56927. this.signature = null;
  56928. this.textEdit = null;
  56929. }
  56930. [_xfa_object.$getExtra]() {
  56931. if (this[_xfa_object.$extra] === undefined) {
  56932. for (const name of Object.getOwnPropertyNames(this)) {
  56933. if (name === "extras" || name === "picture") {
  56934. continue;
  56935. }
  56936. const obj = this[name];
  56937. if (!(obj instanceof _xfa_object.XFAObject)) {
  56938. continue;
  56939. }
  56940. this[_xfa_object.$extra] = obj;
  56941. return obj;
  56942. }
  56943. this[_xfa_object.$extra] = null;
  56944. }
  56945. return this[_xfa_object.$extra];
  56946. }
  56947. [_xfa_object.$toHTML](availableSpace) {
  56948. const obj = this[_xfa_object.$getExtra]();
  56949. if (obj) {
  56950. return obj[_xfa_object.$toHTML](availableSpace);
  56951. }
  56952. return _utils.HTMLResult.EMPTY;
  56953. }
  56954. }
  56955. class Validate extends _xfa_object.XFAObject {
  56956. constructor(attributes) {
  56957. super(TEMPLATE_NS_ID, "validate", true);
  56958. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  56959. this.id = attributes.id || "";
  56960. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  56961. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  56962. this.use = attributes.use || "";
  56963. this.usehref = attributes.usehref || "";
  56964. this.extras = null;
  56965. this.message = null;
  56966. this.picture = null;
  56967. this.script = null;
  56968. }
  56969. }
  56970. class Value extends _xfa_object.XFAObject {
  56971. constructor(attributes) {
  56972. super(TEMPLATE_NS_ID, "value", true);
  56973. this.id = attributes.id || "";
  56974. this.override = (0, _utils.getInteger)({
  56975. data: attributes.override,
  56976. defaultValue: 0,
  56977. validate: x => x === 1
  56978. });
  56979. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56980. this.use = attributes.use || "";
  56981. this.usehref = attributes.usehref || "";
  56982. this.arc = null;
  56983. this.boolean = null;
  56984. this.date = null;
  56985. this.dateTime = null;
  56986. this.decimal = null;
  56987. this.exData = null;
  56988. this.float = null;
  56989. this.image = null;
  56990. this.integer = null;
  56991. this.line = null;
  56992. this.rectangle = null;
  56993. this.text = null;
  56994. this.time = null;
  56995. }
  56996. [_xfa_object.$setValue](value) {
  56997. const parent = this[_xfa_object.$getParent]();
  56998. if (parent instanceof Field) {
  56999. if (parent.ui && parent.ui.imageEdit) {
  57000. if (!this.image) {
  57001. this.image = new Image({});
  57002. this[_xfa_object.$appendChild](this.image);
  57003. }
  57004. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  57005. return;
  57006. }
  57007. }
  57008. const valueName = value[_xfa_object.$nodeName];
  57009. if (this[valueName] !== null) {
  57010. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  57011. return;
  57012. }
  57013. for (const name of Object.getOwnPropertyNames(this)) {
  57014. const obj = this[name];
  57015. if (obj instanceof _xfa_object.XFAObject) {
  57016. this[name] = null;
  57017. this[_xfa_object.$removeChild](obj);
  57018. }
  57019. }
  57020. this[value[_xfa_object.$nodeName]] = value;
  57021. this[_xfa_object.$appendChild](value);
  57022. }
  57023. [_xfa_object.$text]() {
  57024. if (this.exData) {
  57025. if (typeof this.exData[_xfa_object.$content] === "string") {
  57026. return this.exData[_xfa_object.$content].trim();
  57027. }
  57028. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  57029. }
  57030. for (const name of Object.getOwnPropertyNames(this)) {
  57031. if (name === "image") {
  57032. continue;
  57033. }
  57034. const obj = this[name];
  57035. if (obj instanceof _xfa_object.XFAObject) {
  57036. return (obj[_xfa_object.$content] || "").toString().trim();
  57037. }
  57038. }
  57039. return null;
  57040. }
  57041. [_xfa_object.$toHTML](availableSpace) {
  57042. for (const name of Object.getOwnPropertyNames(this)) {
  57043. const obj = this[name];
  57044. if (!(obj instanceof _xfa_object.XFAObject)) {
  57045. continue;
  57046. }
  57047. return obj[_xfa_object.$toHTML](availableSpace);
  57048. }
  57049. return _utils.HTMLResult.EMPTY;
  57050. }
  57051. }
  57052. exports.Value = Value;
  57053. class Variables extends _xfa_object.XFAObject {
  57054. constructor(attributes) {
  57055. super(TEMPLATE_NS_ID, "variables", true);
  57056. this.id = attributes.id || "";
  57057. this.use = attributes.use || "";
  57058. this.usehref = attributes.usehref || "";
  57059. this.boolean = new _xfa_object.XFAObjectArray();
  57060. this.date = new _xfa_object.XFAObjectArray();
  57061. this.dateTime = new _xfa_object.XFAObjectArray();
  57062. this.decimal = new _xfa_object.XFAObjectArray();
  57063. this.exData = new _xfa_object.XFAObjectArray();
  57064. this.float = new _xfa_object.XFAObjectArray();
  57065. this.image = new _xfa_object.XFAObjectArray();
  57066. this.integer = new _xfa_object.XFAObjectArray();
  57067. this.manifest = new _xfa_object.XFAObjectArray();
  57068. this.script = new _xfa_object.XFAObjectArray();
  57069. this.text = new _xfa_object.XFAObjectArray();
  57070. this.time = new _xfa_object.XFAObjectArray();
  57071. }
  57072. [_xfa_object.$isTransparent]() {
  57073. return true;
  57074. }
  57075. }
  57076. class TemplateNamespace {
  57077. static [_namespaces.$buildXFAObject](name, attributes) {
  57078. if (TemplateNamespace.hasOwnProperty(name)) {
  57079. const node = TemplateNamespace[name](attributes);
  57080. node[_xfa_object.$setSetAttributes](attributes);
  57081. return node;
  57082. }
  57083. return undefined;
  57084. }
  57085. static appearanceFilter(attrs) {
  57086. return new AppearanceFilter(attrs);
  57087. }
  57088. static arc(attrs) {
  57089. return new Arc(attrs);
  57090. }
  57091. static area(attrs) {
  57092. return new Area(attrs);
  57093. }
  57094. static assist(attrs) {
  57095. return new Assist(attrs);
  57096. }
  57097. static barcode(attrs) {
  57098. return new Barcode(attrs);
  57099. }
  57100. static bind(attrs) {
  57101. return new Bind(attrs);
  57102. }
  57103. static bindItems(attrs) {
  57104. return new BindItems(attrs);
  57105. }
  57106. static bookend(attrs) {
  57107. return new Bookend(attrs);
  57108. }
  57109. static boolean(attrs) {
  57110. return new BooleanElement(attrs);
  57111. }
  57112. static border(attrs) {
  57113. return new Border(attrs);
  57114. }
  57115. static break(attrs) {
  57116. return new Break(attrs);
  57117. }
  57118. static breakAfter(attrs) {
  57119. return new BreakAfter(attrs);
  57120. }
  57121. static breakBefore(attrs) {
  57122. return new BreakBefore(attrs);
  57123. }
  57124. static button(attrs) {
  57125. return new Button(attrs);
  57126. }
  57127. static calculate(attrs) {
  57128. return new Calculate(attrs);
  57129. }
  57130. static caption(attrs) {
  57131. return new Caption(attrs);
  57132. }
  57133. static certificate(attrs) {
  57134. return new Certificate(attrs);
  57135. }
  57136. static certificates(attrs) {
  57137. return new Certificates(attrs);
  57138. }
  57139. static checkButton(attrs) {
  57140. return new CheckButton(attrs);
  57141. }
  57142. static choiceList(attrs) {
  57143. return new ChoiceList(attrs);
  57144. }
  57145. static color(attrs) {
  57146. return new Color(attrs);
  57147. }
  57148. static comb(attrs) {
  57149. return new Comb(attrs);
  57150. }
  57151. static connect(attrs) {
  57152. return new Connect(attrs);
  57153. }
  57154. static contentArea(attrs) {
  57155. return new ContentArea(attrs);
  57156. }
  57157. static corner(attrs) {
  57158. return new Corner(attrs);
  57159. }
  57160. static date(attrs) {
  57161. return new DateElement(attrs);
  57162. }
  57163. static dateTime(attrs) {
  57164. return new DateTime(attrs);
  57165. }
  57166. static dateTimeEdit(attrs) {
  57167. return new DateTimeEdit(attrs);
  57168. }
  57169. static decimal(attrs) {
  57170. return new Decimal(attrs);
  57171. }
  57172. static defaultUi(attrs) {
  57173. return new DefaultUi(attrs);
  57174. }
  57175. static desc(attrs) {
  57176. return new Desc(attrs);
  57177. }
  57178. static digestMethod(attrs) {
  57179. return new DigestMethod(attrs);
  57180. }
  57181. static digestMethods(attrs) {
  57182. return new DigestMethods(attrs);
  57183. }
  57184. static draw(attrs) {
  57185. return new Draw(attrs);
  57186. }
  57187. static edge(attrs) {
  57188. return new Edge(attrs);
  57189. }
  57190. static encoding(attrs) {
  57191. return new Encoding(attrs);
  57192. }
  57193. static encodings(attrs) {
  57194. return new Encodings(attrs);
  57195. }
  57196. static encrypt(attrs) {
  57197. return new Encrypt(attrs);
  57198. }
  57199. static encryptData(attrs) {
  57200. return new EncryptData(attrs);
  57201. }
  57202. static encryption(attrs) {
  57203. return new Encryption(attrs);
  57204. }
  57205. static encryptionMethod(attrs) {
  57206. return new EncryptionMethod(attrs);
  57207. }
  57208. static encryptionMethods(attrs) {
  57209. return new EncryptionMethods(attrs);
  57210. }
  57211. static event(attrs) {
  57212. return new Event(attrs);
  57213. }
  57214. static exData(attrs) {
  57215. return new ExData(attrs);
  57216. }
  57217. static exObject(attrs) {
  57218. return new ExObject(attrs);
  57219. }
  57220. static exclGroup(attrs) {
  57221. return new ExclGroup(attrs);
  57222. }
  57223. static execute(attrs) {
  57224. return new Execute(attrs);
  57225. }
  57226. static extras(attrs) {
  57227. return new Extras(attrs);
  57228. }
  57229. static field(attrs) {
  57230. return new Field(attrs);
  57231. }
  57232. static fill(attrs) {
  57233. return new Fill(attrs);
  57234. }
  57235. static filter(attrs) {
  57236. return new Filter(attrs);
  57237. }
  57238. static float(attrs) {
  57239. return new Float(attrs);
  57240. }
  57241. static font(attrs) {
  57242. return new Font(attrs);
  57243. }
  57244. static format(attrs) {
  57245. return new Format(attrs);
  57246. }
  57247. static handler(attrs) {
  57248. return new Handler(attrs);
  57249. }
  57250. static hyphenation(attrs) {
  57251. return new Hyphenation(attrs);
  57252. }
  57253. static image(attrs) {
  57254. return new Image(attrs);
  57255. }
  57256. static imageEdit(attrs) {
  57257. return new ImageEdit(attrs);
  57258. }
  57259. static integer(attrs) {
  57260. return new Integer(attrs);
  57261. }
  57262. static issuers(attrs) {
  57263. return new Issuers(attrs);
  57264. }
  57265. static items(attrs) {
  57266. return new Items(attrs);
  57267. }
  57268. static keep(attrs) {
  57269. return new Keep(attrs);
  57270. }
  57271. static keyUsage(attrs) {
  57272. return new KeyUsage(attrs);
  57273. }
  57274. static line(attrs) {
  57275. return new Line(attrs);
  57276. }
  57277. static linear(attrs) {
  57278. return new Linear(attrs);
  57279. }
  57280. static lockDocument(attrs) {
  57281. return new LockDocument(attrs);
  57282. }
  57283. static manifest(attrs) {
  57284. return new Manifest(attrs);
  57285. }
  57286. static margin(attrs) {
  57287. return new Margin(attrs);
  57288. }
  57289. static mdp(attrs) {
  57290. return new Mdp(attrs);
  57291. }
  57292. static medium(attrs) {
  57293. return new Medium(attrs);
  57294. }
  57295. static message(attrs) {
  57296. return new Message(attrs);
  57297. }
  57298. static numericEdit(attrs) {
  57299. return new NumericEdit(attrs);
  57300. }
  57301. static occur(attrs) {
  57302. return new Occur(attrs);
  57303. }
  57304. static oid(attrs) {
  57305. return new Oid(attrs);
  57306. }
  57307. static oids(attrs) {
  57308. return new Oids(attrs);
  57309. }
  57310. static overflow(attrs) {
  57311. return new Overflow(attrs);
  57312. }
  57313. static pageArea(attrs) {
  57314. return new PageArea(attrs);
  57315. }
  57316. static pageSet(attrs) {
  57317. return new PageSet(attrs);
  57318. }
  57319. static para(attrs) {
  57320. return new Para(attrs);
  57321. }
  57322. static passwordEdit(attrs) {
  57323. return new PasswordEdit(attrs);
  57324. }
  57325. static pattern(attrs) {
  57326. return new Pattern(attrs);
  57327. }
  57328. static picture(attrs) {
  57329. return new Picture(attrs);
  57330. }
  57331. static proto(attrs) {
  57332. return new Proto(attrs);
  57333. }
  57334. static radial(attrs) {
  57335. return new Radial(attrs);
  57336. }
  57337. static reason(attrs) {
  57338. return new Reason(attrs);
  57339. }
  57340. static reasons(attrs) {
  57341. return new Reasons(attrs);
  57342. }
  57343. static rectangle(attrs) {
  57344. return new Rectangle(attrs);
  57345. }
  57346. static ref(attrs) {
  57347. return new RefElement(attrs);
  57348. }
  57349. static script(attrs) {
  57350. return new Script(attrs);
  57351. }
  57352. static setProperty(attrs) {
  57353. return new SetProperty(attrs);
  57354. }
  57355. static signData(attrs) {
  57356. return new SignData(attrs);
  57357. }
  57358. static signature(attrs) {
  57359. return new Signature(attrs);
  57360. }
  57361. static signing(attrs) {
  57362. return new Signing(attrs);
  57363. }
  57364. static solid(attrs) {
  57365. return new Solid(attrs);
  57366. }
  57367. static speak(attrs) {
  57368. return new Speak(attrs);
  57369. }
  57370. static stipple(attrs) {
  57371. return new Stipple(attrs);
  57372. }
  57373. static subform(attrs) {
  57374. return new Subform(attrs);
  57375. }
  57376. static subformSet(attrs) {
  57377. return new SubformSet(attrs);
  57378. }
  57379. static subjectDN(attrs) {
  57380. return new SubjectDN(attrs);
  57381. }
  57382. static subjectDNs(attrs) {
  57383. return new SubjectDNs(attrs);
  57384. }
  57385. static submit(attrs) {
  57386. return new Submit(attrs);
  57387. }
  57388. static template(attrs) {
  57389. return new Template(attrs);
  57390. }
  57391. static text(attrs) {
  57392. return new Text(attrs);
  57393. }
  57394. static textEdit(attrs) {
  57395. return new TextEdit(attrs);
  57396. }
  57397. static time(attrs) {
  57398. return new Time(attrs);
  57399. }
  57400. static timeStamp(attrs) {
  57401. return new TimeStamp(attrs);
  57402. }
  57403. static toolTip(attrs) {
  57404. return new ToolTip(attrs);
  57405. }
  57406. static traversal(attrs) {
  57407. return new Traversal(attrs);
  57408. }
  57409. static traverse(attrs) {
  57410. return new Traverse(attrs);
  57411. }
  57412. static ui(attrs) {
  57413. return new Ui(attrs);
  57414. }
  57415. static validate(attrs) {
  57416. return new Validate(attrs);
  57417. }
  57418. static value(attrs) {
  57419. return new Value(attrs);
  57420. }
  57421. static variables(attrs) {
  57422. return new Variables(attrs);
  57423. }
  57424. }
  57425. exports.TemplateNamespace = TemplateNamespace;
  57426. /***/ }),
  57427. /* 83 */
  57428. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57429. Object.defineProperty(exports, "__esModule", ({
  57430. value: true
  57431. }));
  57432. exports.addHTML = addHTML;
  57433. exports.checkDimensions = checkDimensions;
  57434. exports.flushHTML = flushHTML;
  57435. exports.getAvailableSpace = getAvailableSpace;
  57436. var _xfa_object = __w_pdfjs_require__(77);
  57437. var _html_utils = __w_pdfjs_require__(84);
  57438. function createLine(node, children) {
  57439. return {
  57440. name: "div",
  57441. attributes: {
  57442. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  57443. },
  57444. children
  57445. };
  57446. }
  57447. function flushHTML(node) {
  57448. if (!node[_xfa_object.$extra]) {
  57449. return null;
  57450. }
  57451. const attributes = node[_xfa_object.$extra].attributes;
  57452. const html = {
  57453. name: "div",
  57454. attributes,
  57455. children: node[_xfa_object.$extra].children
  57456. };
  57457. if (node[_xfa_object.$extra].failingNode) {
  57458. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  57459. if (htmlFromFailing) {
  57460. if (node.layout.endsWith("-tb")) {
  57461. html.children.push(createLine(node, [htmlFromFailing]));
  57462. } else {
  57463. html.children.push(htmlFromFailing);
  57464. }
  57465. }
  57466. }
  57467. if (html.children.length === 0) {
  57468. return null;
  57469. }
  57470. return html;
  57471. }
  57472. function addHTML(node, html, bbox) {
  57473. const extra = node[_xfa_object.$extra];
  57474. const availableSpace = extra.availableSpace;
  57475. const [x, y, w, h] = bbox;
  57476. switch (node.layout) {
  57477. case "position":
  57478. {
  57479. extra.width = Math.max(extra.width, x + w);
  57480. extra.height = Math.max(extra.height, y + h);
  57481. extra.children.push(html);
  57482. break;
  57483. }
  57484. case "lr-tb":
  57485. case "rl-tb":
  57486. if (!extra.line || extra.attempt === 1) {
  57487. extra.line = createLine(node, []);
  57488. extra.children.push(extra.line);
  57489. extra.numberInLine = 0;
  57490. }
  57491. extra.numberInLine += 1;
  57492. extra.line.children.push(html);
  57493. if (extra.attempt === 0) {
  57494. extra.currentWidth += w;
  57495. extra.height = Math.max(extra.height, extra.prevHeight + h);
  57496. } else {
  57497. extra.currentWidth = w;
  57498. extra.prevHeight = extra.height;
  57499. extra.height += h;
  57500. extra.attempt = 0;
  57501. }
  57502. extra.width = Math.max(extra.width, extra.currentWidth);
  57503. break;
  57504. case "rl-row":
  57505. case "row":
  57506. {
  57507. extra.children.push(html);
  57508. extra.width += w;
  57509. extra.height = Math.max(extra.height, h);
  57510. const height = (0, _html_utils.measureToString)(extra.height);
  57511. for (const child of extra.children) {
  57512. child.attributes.style.height = height;
  57513. }
  57514. break;
  57515. }
  57516. case "table":
  57517. {
  57518. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  57519. extra.height += h;
  57520. extra.children.push(html);
  57521. break;
  57522. }
  57523. case "tb":
  57524. {
  57525. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  57526. extra.height += h;
  57527. extra.children.push(html);
  57528. break;
  57529. }
  57530. }
  57531. }
  57532. function getAvailableSpace(node) {
  57533. const availableSpace = node[_xfa_object.$extra].availableSpace;
  57534. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  57535. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  57536. switch (node.layout) {
  57537. case "lr-tb":
  57538. case "rl-tb":
  57539. if (node[_xfa_object.$extra].attempt === 0) {
  57540. return {
  57541. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  57542. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  57543. };
  57544. }
  57545. return {
  57546. width: availableSpace.width - marginH,
  57547. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  57548. };
  57549. case "rl-row":
  57550. case "row":
  57551. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  57552. return {
  57553. width,
  57554. height: availableSpace.height - marginH
  57555. };
  57556. case "table":
  57557. case "tb":
  57558. return {
  57559. width: availableSpace.width - marginH,
  57560. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  57561. };
  57562. case "position":
  57563. default:
  57564. return availableSpace;
  57565. }
  57566. }
  57567. function getTransformedBBox(node) {
  57568. let w = node.w === "" ? NaN : node.w;
  57569. let h = node.h === "" ? NaN : node.h;
  57570. let [centerX, centerY] = [0, 0];
  57571. switch (node.anchorType || "") {
  57572. case "bottomCenter":
  57573. [centerX, centerY] = [w / 2, h];
  57574. break;
  57575. case "bottomLeft":
  57576. [centerX, centerY] = [0, h];
  57577. break;
  57578. case "bottomRight":
  57579. [centerX, centerY] = [w, h];
  57580. break;
  57581. case "middleCenter":
  57582. [centerX, centerY] = [w / 2, h / 2];
  57583. break;
  57584. case "middleLeft":
  57585. [centerX, centerY] = [0, h / 2];
  57586. break;
  57587. case "middleRight":
  57588. [centerX, centerY] = [w, h / 2];
  57589. break;
  57590. case "topCenter":
  57591. [centerX, centerY] = [w / 2, 0];
  57592. break;
  57593. case "topRight":
  57594. [centerX, centerY] = [w, 0];
  57595. break;
  57596. }
  57597. let x, y;
  57598. switch (node.rotate || 0) {
  57599. case 0:
  57600. [x, y] = [-centerX, -centerY];
  57601. break;
  57602. case 90:
  57603. [x, y] = [-centerY, centerX];
  57604. [w, h] = [h, -w];
  57605. break;
  57606. case 180:
  57607. [x, y] = [centerX, centerY];
  57608. [w, h] = [-w, -h];
  57609. break;
  57610. case 270:
  57611. [x, y] = [centerY, -centerX];
  57612. [w, h] = [-h, w];
  57613. break;
  57614. }
  57615. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  57616. }
  57617. function checkDimensions(node, space) {
  57618. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  57619. return true;
  57620. }
  57621. if (node.w === 0 || node.h === 0) {
  57622. return true;
  57623. }
  57624. const ERROR = 2;
  57625. const parent = node[_xfa_object.$getSubformParent]();
  57626. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  57627. const [, y, w, h] = getTransformedBBox(node);
  57628. switch (parent.layout) {
  57629. case "lr-tb":
  57630. case "rl-tb":
  57631. if (attempt === 0) {
  57632. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57633. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57634. return false;
  57635. }
  57636. if (node.w !== "") {
  57637. if (Math.round(w - space.width) <= ERROR) {
  57638. return true;
  57639. }
  57640. if (parent[_xfa_object.$extra].numberInLine === 0) {
  57641. return space.height > ERROR;
  57642. }
  57643. return false;
  57644. }
  57645. return space.width > ERROR;
  57646. }
  57647. if (node.w !== "") {
  57648. return Math.round(w - space.width) <= ERROR;
  57649. }
  57650. return space.width > ERROR;
  57651. }
  57652. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57653. return true;
  57654. }
  57655. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57656. return false;
  57657. }
  57658. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57659. return space.height > ERROR;
  57660. }
  57661. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57662. return false;
  57663. }
  57664. return space.height > ERROR;
  57665. case "table":
  57666. case "tb":
  57667. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57668. return true;
  57669. }
  57670. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  57671. return Math.round(h - space.height) <= ERROR;
  57672. }
  57673. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57674. return space.height > ERROR;
  57675. }
  57676. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57677. return false;
  57678. }
  57679. return space.height > ERROR;
  57680. case "position":
  57681. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57682. return true;
  57683. }
  57684. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  57685. return true;
  57686. }
  57687. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  57688. return h + y > area.h;
  57689. case "rl-row":
  57690. case "row":
  57691. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57692. return true;
  57693. }
  57694. if (node.h !== "") {
  57695. return Math.round(h - space.height) <= ERROR;
  57696. }
  57697. return true;
  57698. default:
  57699. return true;
  57700. }
  57701. }
  57702. /***/ }),
  57703. /* 84 */
  57704. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57705. Object.defineProperty(exports, "__esModule", ({
  57706. value: true
  57707. }));
  57708. exports.computeBbox = computeBbox;
  57709. exports.createWrapper = createWrapper;
  57710. exports.fixDimensions = fixDimensions;
  57711. exports.fixTextIndent = fixTextIndent;
  57712. exports.fixURL = fixURL;
  57713. exports.isPrintOnly = isPrintOnly;
  57714. exports.layoutClass = layoutClass;
  57715. exports.layoutNode = layoutNode;
  57716. exports.measureToString = measureToString;
  57717. exports.setAccess = setAccess;
  57718. exports.setFontFamily = setFontFamily;
  57719. exports.setMinMaxDimensions = setMinMaxDimensions;
  57720. exports.setPara = setPara;
  57721. exports.toStyle = toStyle;
  57722. var _xfa_object = __w_pdfjs_require__(77);
  57723. var _util = __w_pdfjs_require__(2);
  57724. var _utils = __w_pdfjs_require__(78);
  57725. var _fonts = __w_pdfjs_require__(85);
  57726. var _text = __w_pdfjs_require__(86);
  57727. function measureToString(m) {
  57728. if (typeof m === "string") {
  57729. return "0px";
  57730. }
  57731. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  57732. }
  57733. const converters = {
  57734. anchorType(node, style) {
  57735. const parent = node[_xfa_object.$getSubformParent]();
  57736. if (!parent || parent.layout && parent.layout !== "position") {
  57737. return;
  57738. }
  57739. if (!("transform" in style)) {
  57740. style.transform = "";
  57741. }
  57742. switch (node.anchorType) {
  57743. case "bottomCenter":
  57744. style.transform += "translate(-50%, -100%)";
  57745. break;
  57746. case "bottomLeft":
  57747. style.transform += "translate(0,-100%)";
  57748. break;
  57749. case "bottomRight":
  57750. style.transform += "translate(-100%,-100%)";
  57751. break;
  57752. case "middleCenter":
  57753. style.transform += "translate(-50%,-50%)";
  57754. break;
  57755. case "middleLeft":
  57756. style.transform += "translate(0,-50%)";
  57757. break;
  57758. case "middleRight":
  57759. style.transform += "translate(-100%,-50%)";
  57760. break;
  57761. case "topCenter":
  57762. style.transform += "translate(-50%,0)";
  57763. break;
  57764. case "topRight":
  57765. style.transform += "translate(-100%,0)";
  57766. break;
  57767. }
  57768. },
  57769. dimensions(node, style) {
  57770. const parent = node[_xfa_object.$getSubformParent]();
  57771. let width = node.w;
  57772. const height = node.h;
  57773. if (parent.layout && parent.layout.includes("row")) {
  57774. const extra = parent[_xfa_object.$extra];
  57775. const colSpan = node.colSpan;
  57776. let w;
  57777. if (colSpan === -1) {
  57778. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  57779. extra.currentColumn = 0;
  57780. } else {
  57781. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  57782. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  57783. }
  57784. if (!isNaN(w)) {
  57785. width = node.w = w;
  57786. }
  57787. }
  57788. if (width !== "") {
  57789. style.width = measureToString(width);
  57790. } else {
  57791. style.width = "auto";
  57792. }
  57793. if (height !== "") {
  57794. style.height = measureToString(height);
  57795. } else {
  57796. style.height = "auto";
  57797. }
  57798. },
  57799. position(node, style) {
  57800. const parent = node[_xfa_object.$getSubformParent]();
  57801. if (parent && parent.layout && parent.layout !== "position") {
  57802. return;
  57803. }
  57804. style.position = "absolute";
  57805. style.left = measureToString(node.x);
  57806. style.top = measureToString(node.y);
  57807. },
  57808. rotate(node, style) {
  57809. if (node.rotate) {
  57810. if (!("transform" in style)) {
  57811. style.transform = "";
  57812. }
  57813. style.transform += `rotate(-${node.rotate}deg)`;
  57814. style.transformOrigin = "top left";
  57815. }
  57816. },
  57817. presence(node, style) {
  57818. switch (node.presence) {
  57819. case "invisible":
  57820. style.visibility = "hidden";
  57821. break;
  57822. case "hidden":
  57823. case "inactive":
  57824. style.display = "none";
  57825. break;
  57826. }
  57827. },
  57828. hAlign(node, style) {
  57829. if (node[_xfa_object.$nodeName] === "para") {
  57830. switch (node.hAlign) {
  57831. case "justifyAll":
  57832. style.textAlign = "justify-all";
  57833. break;
  57834. case "radix":
  57835. style.textAlign = "left";
  57836. break;
  57837. default:
  57838. style.textAlign = node.hAlign;
  57839. }
  57840. } else {
  57841. switch (node.hAlign) {
  57842. case "left":
  57843. style.alignSelf = "start";
  57844. break;
  57845. case "center":
  57846. style.alignSelf = "center";
  57847. break;
  57848. case "right":
  57849. style.alignSelf = "end";
  57850. break;
  57851. }
  57852. }
  57853. },
  57854. margin(node, style) {
  57855. if (node.margin) {
  57856. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  57857. }
  57858. }
  57859. };
  57860. function setMinMaxDimensions(node, style) {
  57861. const parent = node[_xfa_object.$getSubformParent]();
  57862. if (parent.layout === "position") {
  57863. if (node.minW > 0) {
  57864. style.minWidth = measureToString(node.minW);
  57865. }
  57866. if (node.maxW > 0) {
  57867. style.maxWidth = measureToString(node.maxW);
  57868. }
  57869. if (node.minH > 0) {
  57870. style.minHeight = measureToString(node.minH);
  57871. }
  57872. if (node.maxH > 0) {
  57873. style.maxHeight = measureToString(node.maxH);
  57874. }
  57875. }
  57876. }
  57877. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  57878. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  57879. if (typeof text === "string") {
  57880. measure.addString(text);
  57881. } else {
  57882. text[_xfa_object.$pushGlyphs](measure);
  57883. }
  57884. return measure.compute(width);
  57885. }
  57886. function layoutNode(node, availableSpace) {
  57887. let height = null;
  57888. let width = null;
  57889. let isBroken = false;
  57890. if ((!node.w || !node.h) && node.value) {
  57891. let marginH = 0;
  57892. let marginV = 0;
  57893. if (node.margin) {
  57894. marginH = node.margin.leftInset + node.margin.rightInset;
  57895. marginV = node.margin.topInset + node.margin.bottomInset;
  57896. }
  57897. let lineHeight = null;
  57898. let margin = null;
  57899. if (node.para) {
  57900. margin = Object.create(null);
  57901. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  57902. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  57903. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  57904. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  57905. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  57906. }
  57907. let font = node.font;
  57908. if (!font) {
  57909. const root = node[_xfa_object.$getTemplateRoot]();
  57910. let parent = node[_xfa_object.$getParent]();
  57911. while (parent && parent !== root) {
  57912. if (parent.font) {
  57913. font = parent.font;
  57914. break;
  57915. }
  57916. parent = parent[_xfa_object.$getParent]();
  57917. }
  57918. }
  57919. const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH;
  57920. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  57921. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  57922. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  57923. width = res.width;
  57924. height = res.height;
  57925. isBroken = res.isBroken;
  57926. } else {
  57927. const text = node.value[_xfa_object.$text]();
  57928. if (text) {
  57929. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  57930. width = res.width;
  57931. height = res.height;
  57932. isBroken = res.isBroken;
  57933. }
  57934. }
  57935. if (width !== null && !node.w) {
  57936. width += marginH;
  57937. }
  57938. if (height !== null && !node.h) {
  57939. height += marginV;
  57940. }
  57941. }
  57942. return {
  57943. w: width,
  57944. h: height,
  57945. isBroken
  57946. };
  57947. }
  57948. function computeBbox(node, html, availableSpace) {
  57949. let bbox;
  57950. if (node.w !== "" && node.h !== "") {
  57951. bbox = [node.x, node.y, node.w, node.h];
  57952. } else {
  57953. if (!availableSpace) {
  57954. return null;
  57955. }
  57956. let width = node.w;
  57957. if (width === "") {
  57958. if (node.maxW === 0) {
  57959. const parent = node[_xfa_object.$getSubformParent]();
  57960. if (parent.layout === "position" && parent.w !== "") {
  57961. width = 0;
  57962. } else {
  57963. width = node.minW;
  57964. }
  57965. } else {
  57966. width = Math.min(node.maxW, availableSpace.width);
  57967. }
  57968. html.attributes.style.width = measureToString(width);
  57969. }
  57970. let height = node.h;
  57971. if (height === "") {
  57972. if (node.maxH === 0) {
  57973. const parent = node[_xfa_object.$getSubformParent]();
  57974. if (parent.layout === "position" && parent.h !== "") {
  57975. height = 0;
  57976. } else {
  57977. height = node.minH;
  57978. }
  57979. } else {
  57980. height = Math.min(node.maxH, availableSpace.height);
  57981. }
  57982. html.attributes.style.height = measureToString(height);
  57983. }
  57984. bbox = [node.x, node.y, width, height];
  57985. }
  57986. return bbox;
  57987. }
  57988. function fixDimensions(node) {
  57989. const parent = node[_xfa_object.$getSubformParent]();
  57990. if (parent.layout && parent.layout.includes("row")) {
  57991. const extra = parent[_xfa_object.$extra];
  57992. const colSpan = node.colSpan;
  57993. let width;
  57994. if (colSpan === -1) {
  57995. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  57996. } else {
  57997. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  57998. }
  57999. if (!isNaN(width)) {
  58000. node.w = width;
  58001. }
  58002. }
  58003. if (parent.layout && parent.layout !== "position") {
  58004. node.x = node.y = 0;
  58005. }
  58006. if (node.layout === "table") {
  58007. if (node.w === "" && Array.isArray(node.columnWidths)) {
  58008. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  58009. }
  58010. }
  58011. }
  58012. function layoutClass(node) {
  58013. switch (node.layout) {
  58014. case "position":
  58015. return "xfaPosition";
  58016. case "lr-tb":
  58017. return "xfaLrTb";
  58018. case "rl-row":
  58019. return "xfaRlRow";
  58020. case "rl-tb":
  58021. return "xfaRlTb";
  58022. case "row":
  58023. return "xfaRow";
  58024. case "table":
  58025. return "xfaTable";
  58026. case "tb":
  58027. return "xfaTb";
  58028. default:
  58029. return "xfaPosition";
  58030. }
  58031. }
  58032. function toStyle(node, ...names) {
  58033. const style = Object.create(null);
  58034. for (const name of names) {
  58035. const value = node[name];
  58036. if (value === null) {
  58037. continue;
  58038. }
  58039. if (converters.hasOwnProperty(name)) {
  58040. converters[name](node, style);
  58041. continue;
  58042. }
  58043. if (value instanceof _xfa_object.XFAObject) {
  58044. const newStyle = value[_xfa_object.$toStyle]();
  58045. if (newStyle) {
  58046. Object.assign(style, newStyle);
  58047. } else {
  58048. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  58049. }
  58050. }
  58051. }
  58052. return style;
  58053. }
  58054. function createWrapper(node, html) {
  58055. const {
  58056. attributes
  58057. } = html;
  58058. const {
  58059. style
  58060. } = attributes;
  58061. const wrapper = {
  58062. name: "div",
  58063. attributes: {
  58064. class: ["xfaWrapper"],
  58065. style: Object.create(null)
  58066. },
  58067. children: []
  58068. };
  58069. attributes.class.push("xfaWrapped");
  58070. if (node.border) {
  58071. const {
  58072. widths,
  58073. insets
  58074. } = node.border[_xfa_object.$extra];
  58075. let width, height;
  58076. let top = insets[0];
  58077. let left = insets[3];
  58078. const insetsH = insets[0] + insets[2];
  58079. const insetsW = insets[1] + insets[3];
  58080. switch (node.border.hand) {
  58081. case "even":
  58082. top -= widths[0] / 2;
  58083. left -= widths[3] / 2;
  58084. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  58085. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  58086. break;
  58087. case "left":
  58088. top -= widths[0];
  58089. left -= widths[3];
  58090. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  58091. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  58092. break;
  58093. case "right":
  58094. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  58095. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  58096. break;
  58097. }
  58098. const classNames = ["xfaBorder"];
  58099. if (isPrintOnly(node.border)) {
  58100. classNames.push("xfaPrintOnly");
  58101. }
  58102. const border = {
  58103. name: "div",
  58104. attributes: {
  58105. class: classNames,
  58106. style: {
  58107. top: `${top}px`,
  58108. left: `${left}px`,
  58109. width,
  58110. height
  58111. }
  58112. },
  58113. children: []
  58114. };
  58115. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  58116. if (style[key] !== undefined) {
  58117. border.attributes.style[key] = style[key];
  58118. delete style[key];
  58119. }
  58120. }
  58121. wrapper.children.push(border, html);
  58122. } else {
  58123. wrapper.children.push(html);
  58124. }
  58125. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  58126. if (style[key] !== undefined) {
  58127. wrapper.attributes.style[key] = style[key];
  58128. delete style[key];
  58129. }
  58130. }
  58131. if (style.position === "absolute") {
  58132. wrapper.attributes.style.position = "absolute";
  58133. } else {
  58134. wrapper.attributes.style.position = "relative";
  58135. }
  58136. delete style.position;
  58137. if (style.alignSelf) {
  58138. wrapper.attributes.style.alignSelf = style.alignSelf;
  58139. delete style.alignSelf;
  58140. }
  58141. return wrapper;
  58142. }
  58143. function fixTextIndent(styles) {
  58144. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  58145. if (indent >= 0) {
  58146. return;
  58147. }
  58148. const align = styles.textAlign === "right" ? "right" : "left";
  58149. const name = "padding" + (align === "left" ? "Left" : "Right");
  58150. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  58151. styles[name] = `${padding - indent}px`;
  58152. }
  58153. function setAccess(node, classNames) {
  58154. switch (node.access) {
  58155. case "nonInteractive":
  58156. classNames.push("xfaNonInteractive");
  58157. break;
  58158. case "readOnly":
  58159. classNames.push("xfaReadOnly");
  58160. break;
  58161. case "protected":
  58162. classNames.push("xfaDisabled");
  58163. break;
  58164. }
  58165. }
  58166. function isPrintOnly(node) {
  58167. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  58168. }
  58169. function getCurrentPara(node) {
  58170. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  58171. return stack.length ? stack[stack.length - 1] : null;
  58172. }
  58173. function setPara(node, nodeStyle, value) {
  58174. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  58175. if (nodeStyle) {
  58176. if (node.h === "") {
  58177. nodeStyle.height = "auto";
  58178. }
  58179. if (node.w === "") {
  58180. nodeStyle.width = "auto";
  58181. }
  58182. }
  58183. const para = getCurrentPara(node);
  58184. if (para) {
  58185. const valueStyle = value.attributes.style;
  58186. valueStyle.display = "flex";
  58187. valueStyle.flexDirection = "column";
  58188. switch (para.vAlign) {
  58189. case "top":
  58190. valueStyle.justifyContent = "start";
  58191. break;
  58192. case "bottom":
  58193. valueStyle.justifyContent = "end";
  58194. break;
  58195. case "middle":
  58196. valueStyle.justifyContent = "center";
  58197. break;
  58198. }
  58199. const paraStyle = para[_xfa_object.$toStyle]();
  58200. for (const [key, val] of Object.entries(paraStyle)) {
  58201. if (!(key in valueStyle)) {
  58202. valueStyle[key] = val;
  58203. }
  58204. }
  58205. }
  58206. }
  58207. }
  58208. function setFontFamily(xfaFont, node, fontFinder, style) {
  58209. if (!fontFinder) {
  58210. delete style.fontFamily;
  58211. return;
  58212. }
  58213. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  58214. style.fontFamily = `"${name}"`;
  58215. const typeface = fontFinder.find(name);
  58216. if (typeface) {
  58217. const {
  58218. fontFamily
  58219. } = typeface.regular.cssFontInfo;
  58220. if (fontFamily !== name) {
  58221. style.fontFamily = `"${fontFamily}"`;
  58222. }
  58223. const para = getCurrentPara(node);
  58224. if (para && para.lineHeight !== "") {
  58225. return;
  58226. }
  58227. if (style.lineHeight) {
  58228. return;
  58229. }
  58230. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  58231. if (pdfFont) {
  58232. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  58233. }
  58234. }
  58235. }
  58236. function fixURL(str) {
  58237. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  58238. addDefaultProtocol: true,
  58239. tryConvertEncoding: true
  58240. });
  58241. return absoluteUrl ? absoluteUrl.href : null;
  58242. }
  58243. /***/ }),
  58244. /* 85 */
  58245. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58246. Object.defineProperty(exports, "__esModule", ({
  58247. value: true
  58248. }));
  58249. exports.FontFinder = void 0;
  58250. exports.getMetrics = getMetrics;
  58251. exports.selectFont = selectFont;
  58252. var _xfa_object = __w_pdfjs_require__(77);
  58253. var _utils = __w_pdfjs_require__(78);
  58254. var _util = __w_pdfjs_require__(2);
  58255. class FontFinder {
  58256. constructor(pdfFonts) {
  58257. this.fonts = new Map();
  58258. this.cache = new Map();
  58259. this.warned = new Set();
  58260. this.defaultFont = null;
  58261. this.add(pdfFonts);
  58262. }
  58263. add(pdfFonts, reallyMissingFonts = null) {
  58264. for (const pdfFont of pdfFonts) {
  58265. this.addPdfFont(pdfFont);
  58266. }
  58267. for (const pdfFont of this.fonts.values()) {
  58268. if (!pdfFont.regular) {
  58269. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  58270. }
  58271. }
  58272. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  58273. return;
  58274. }
  58275. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  58276. for (const missing of reallyMissingFonts) {
  58277. this.fonts.set(missing, myriad);
  58278. }
  58279. }
  58280. addPdfFont(pdfFont) {
  58281. const cssFontInfo = pdfFont.cssFontInfo;
  58282. const name = cssFontInfo.fontFamily;
  58283. let font = this.fonts.get(name);
  58284. if (!font) {
  58285. font = Object.create(null);
  58286. this.fonts.set(name, font);
  58287. if (!this.defaultFont) {
  58288. this.defaultFont = font;
  58289. }
  58290. }
  58291. let property = "";
  58292. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  58293. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  58294. property = fontWeight >= 700 ? "bolditalic" : "italic";
  58295. } else if (fontWeight >= 700) {
  58296. property = "bold";
  58297. }
  58298. if (!property) {
  58299. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  58300. property = "bold";
  58301. }
  58302. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  58303. property += "italic";
  58304. }
  58305. }
  58306. if (!property) {
  58307. property = "regular";
  58308. }
  58309. font[property] = pdfFont;
  58310. }
  58311. getDefault() {
  58312. return this.defaultFont;
  58313. }
  58314. find(fontName, mustWarn = true) {
  58315. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  58316. if (font) {
  58317. return font;
  58318. }
  58319. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  58320. let name = fontName.replace(pattern, "");
  58321. font = this.fonts.get(name);
  58322. if (font) {
  58323. this.cache.set(fontName, font);
  58324. return font;
  58325. }
  58326. name = name.toLowerCase();
  58327. const maybe = [];
  58328. for (const [family, pdfFont] of this.fonts.entries()) {
  58329. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  58330. maybe.push(pdfFont);
  58331. }
  58332. }
  58333. if (maybe.length === 0) {
  58334. for (const [, pdfFont] of this.fonts.entries()) {
  58335. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  58336. maybe.push(pdfFont);
  58337. }
  58338. }
  58339. }
  58340. if (maybe.length === 0) {
  58341. name = name.replace(/psmt|mt/gi, "");
  58342. for (const [family, pdfFont] of this.fonts.entries()) {
  58343. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  58344. maybe.push(pdfFont);
  58345. }
  58346. }
  58347. }
  58348. if (maybe.length === 0) {
  58349. for (const pdfFont of this.fonts.values()) {
  58350. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  58351. maybe.push(pdfFont);
  58352. }
  58353. }
  58354. }
  58355. if (maybe.length >= 1) {
  58356. if (maybe.length !== 1 && mustWarn) {
  58357. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  58358. }
  58359. this.cache.set(fontName, maybe[0]);
  58360. return maybe[0];
  58361. }
  58362. if (mustWarn && !this.warned.has(fontName)) {
  58363. this.warned.add(fontName);
  58364. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  58365. }
  58366. return null;
  58367. }
  58368. }
  58369. exports.FontFinder = FontFinder;
  58370. function selectFont(xfaFont, typeface) {
  58371. if (xfaFont.posture === "italic") {
  58372. if (xfaFont.weight === "bold") {
  58373. return typeface.bolditalic;
  58374. }
  58375. return typeface.italic;
  58376. } else if (xfaFont.weight === "bold") {
  58377. return typeface.bold;
  58378. }
  58379. return typeface.regular;
  58380. }
  58381. function getMetrics(xfaFont, real = false) {
  58382. let pdfFont = null;
  58383. if (xfaFont) {
  58384. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  58385. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  58386. pdfFont = selectFont(xfaFont, typeface);
  58387. }
  58388. if (!pdfFont) {
  58389. return {
  58390. lineHeight: 12,
  58391. lineGap: 2,
  58392. lineNoGap: 10
  58393. };
  58394. }
  58395. const size = xfaFont.size || 10;
  58396. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  58397. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  58398. return {
  58399. lineHeight: lineHeight * size,
  58400. lineGap: lineGap * size,
  58401. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  58402. };
  58403. }
  58404. /***/ }),
  58405. /* 86 */
  58406. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58407. Object.defineProperty(exports, "__esModule", ({
  58408. value: true
  58409. }));
  58410. exports.TextMeasure = void 0;
  58411. var _fonts = __w_pdfjs_require__(85);
  58412. const WIDTH_FACTOR = 1.02;
  58413. class FontInfo {
  58414. constructor(xfaFont, margin, lineHeight, fontFinder) {
  58415. this.lineHeight = lineHeight;
  58416. this.paraMargin = margin || {
  58417. top: 0,
  58418. bottom: 0,
  58419. left: 0,
  58420. right: 0
  58421. };
  58422. if (!xfaFont) {
  58423. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58424. return;
  58425. }
  58426. this.xfaFont = {
  58427. typeface: xfaFont.typeface,
  58428. posture: xfaFont.posture,
  58429. weight: xfaFont.weight,
  58430. size: xfaFont.size,
  58431. letterSpacing: xfaFont.letterSpacing
  58432. };
  58433. const typeface = fontFinder.find(xfaFont.typeface);
  58434. if (!typeface) {
  58435. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58436. return;
  58437. }
  58438. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  58439. if (!this.pdfFont) {
  58440. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58441. }
  58442. }
  58443. defaultFont(fontFinder) {
  58444. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  58445. if (font && font.regular) {
  58446. const pdfFont = font.regular;
  58447. const info = pdfFont.cssFontInfo;
  58448. const xfaFont = {
  58449. typeface: info.fontFamily,
  58450. posture: "normal",
  58451. weight: "normal",
  58452. size: 10,
  58453. letterSpacing: 0
  58454. };
  58455. return [pdfFont, xfaFont];
  58456. }
  58457. const xfaFont = {
  58458. typeface: "Courier",
  58459. posture: "normal",
  58460. weight: "normal",
  58461. size: 10,
  58462. letterSpacing: 0
  58463. };
  58464. return [null, xfaFont];
  58465. }
  58466. }
  58467. class FontSelector {
  58468. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  58469. this.fontFinder = fontFinder;
  58470. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  58471. }
  58472. pushData(xfaFont, margin, lineHeight) {
  58473. const lastFont = this.stack[this.stack.length - 1];
  58474. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  58475. if (!xfaFont[name]) {
  58476. xfaFont[name] = lastFont.xfaFont[name];
  58477. }
  58478. }
  58479. for (const name of ["top", "bottom", "left", "right"]) {
  58480. if (isNaN(margin[name])) {
  58481. margin[name] = lastFont.paraMargin[name];
  58482. }
  58483. }
  58484. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  58485. if (!fontInfo.pdfFont) {
  58486. fontInfo.pdfFont = lastFont.pdfFont;
  58487. }
  58488. this.stack.push(fontInfo);
  58489. }
  58490. popFont() {
  58491. this.stack.pop();
  58492. }
  58493. topFont() {
  58494. return this.stack[this.stack.length - 1];
  58495. }
  58496. }
  58497. class TextMeasure {
  58498. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  58499. this.glyphs = [];
  58500. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  58501. this.extraHeight = 0;
  58502. }
  58503. pushData(xfaFont, margin, lineHeight) {
  58504. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  58505. }
  58506. popFont(xfaFont) {
  58507. return this.fontSelector.popFont();
  58508. }
  58509. addPara() {
  58510. const lastFont = this.fontSelector.topFont();
  58511. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  58512. }
  58513. addString(str) {
  58514. if (!str) {
  58515. return;
  58516. }
  58517. const lastFont = this.fontSelector.topFont();
  58518. const fontSize = lastFont.xfaFont.size;
  58519. if (lastFont.pdfFont) {
  58520. const letterSpacing = lastFont.xfaFont.letterSpacing;
  58521. const pdfFont = lastFont.pdfFont;
  58522. const fontLineHeight = pdfFont.lineHeight || 1.2;
  58523. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  58524. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  58525. const noGap = fontLineHeight - lineGap;
  58526. const firstLineHeight = Math.max(1, noGap) * fontSize;
  58527. const scale = fontSize / 1000;
  58528. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  58529. for (const line of str.split(/[\u2029\n]/)) {
  58530. const encodedLine = pdfFont.encodeString(line).join("");
  58531. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  58532. for (const glyph of glyphs) {
  58533. const width = glyph.width || fallbackWidth;
  58534. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  58535. }
  58536. this.glyphs.push([0, 0, 0, "\n", true]);
  58537. }
  58538. this.glyphs.pop();
  58539. return;
  58540. }
  58541. for (const line of str.split(/[\u2029\n]/)) {
  58542. for (const char of line.split("")) {
  58543. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  58544. }
  58545. this.glyphs.push([0, 0, 0, "\n", true]);
  58546. }
  58547. this.glyphs.pop();
  58548. }
  58549. compute(maxWidth) {
  58550. let lastSpacePos = -1,
  58551. lastSpaceWidth = 0,
  58552. width = 0,
  58553. height = 0,
  58554. currentLineWidth = 0,
  58555. currentLineHeight = 0;
  58556. let isBroken = false;
  58557. let isFirstLine = true;
  58558. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  58559. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  58560. const isSpace = char === " ";
  58561. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  58562. if (isEOL) {
  58563. width = Math.max(width, currentLineWidth);
  58564. currentLineWidth = 0;
  58565. height += currentLineHeight;
  58566. currentLineHeight = glyphHeight;
  58567. lastSpacePos = -1;
  58568. lastSpaceWidth = 0;
  58569. isFirstLine = false;
  58570. continue;
  58571. }
  58572. if (isSpace) {
  58573. if (currentLineWidth + glyphWidth > maxWidth) {
  58574. width = Math.max(width, currentLineWidth);
  58575. currentLineWidth = 0;
  58576. height += currentLineHeight;
  58577. currentLineHeight = glyphHeight;
  58578. lastSpacePos = -1;
  58579. lastSpaceWidth = 0;
  58580. isBroken = true;
  58581. isFirstLine = false;
  58582. } else {
  58583. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  58584. lastSpaceWidth = currentLineWidth;
  58585. currentLineWidth += glyphWidth;
  58586. lastSpacePos = i;
  58587. }
  58588. continue;
  58589. }
  58590. if (currentLineWidth + glyphWidth > maxWidth) {
  58591. height += currentLineHeight;
  58592. currentLineHeight = glyphHeight;
  58593. if (lastSpacePos !== -1) {
  58594. i = lastSpacePos;
  58595. width = Math.max(width, lastSpaceWidth);
  58596. currentLineWidth = 0;
  58597. lastSpacePos = -1;
  58598. lastSpaceWidth = 0;
  58599. } else {
  58600. width = Math.max(width, currentLineWidth);
  58601. currentLineWidth = glyphWidth;
  58602. }
  58603. isBroken = true;
  58604. isFirstLine = false;
  58605. continue;
  58606. }
  58607. currentLineWidth += glyphWidth;
  58608. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  58609. }
  58610. width = Math.max(width, currentLineWidth);
  58611. height += currentLineHeight + this.extraHeight;
  58612. return {
  58613. width: WIDTH_FACTOR * width,
  58614. height,
  58615. isBroken
  58616. };
  58617. }
  58618. }
  58619. exports.TextMeasure = TextMeasure;
  58620. /***/ }),
  58621. /* 87 */
  58622. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58623. Object.defineProperty(exports, "__esModule", ({
  58624. value: true
  58625. }));
  58626. exports.DataHandler = void 0;
  58627. var _xfa_object = __w_pdfjs_require__(77);
  58628. class DataHandler {
  58629. constructor(root, data) {
  58630. this.data = data;
  58631. this.dataset = root.datasets || null;
  58632. }
  58633. serialize(storage) {
  58634. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  58635. while (stack.length > 0) {
  58636. const last = stack[stack.length - 1];
  58637. const [i, children] = last;
  58638. if (i + 1 === children.length) {
  58639. stack.pop();
  58640. continue;
  58641. }
  58642. const child = children[++last[0]];
  58643. const storageEntry = storage.get(child[_xfa_object.$uid]);
  58644. if (storageEntry) {
  58645. child[_xfa_object.$setValue](storageEntry);
  58646. } else {
  58647. const attributes = child[_xfa_object.$getAttributes]();
  58648. for (const value of attributes.values()) {
  58649. const entry = storage.get(value[_xfa_object.$uid]);
  58650. if (entry) {
  58651. value[_xfa_object.$setValue](entry);
  58652. break;
  58653. }
  58654. }
  58655. }
  58656. const nodes = child[_xfa_object.$getChildren]();
  58657. if (nodes.length > 0) {
  58658. stack.push([-1, nodes]);
  58659. }
  58660. }
  58661. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  58662. if (this.dataset) {
  58663. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  58664. if (child[_xfa_object.$nodeName] !== "data") {
  58665. child[_xfa_object.$toString](buf);
  58666. }
  58667. }
  58668. }
  58669. this.data[_xfa_object.$toString](buf);
  58670. buf.push("</xfa:datasets>");
  58671. return buf.join("");
  58672. }
  58673. }
  58674. exports.DataHandler = DataHandler;
  58675. /***/ }),
  58676. /* 88 */
  58677. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58678. Object.defineProperty(exports, "__esModule", ({
  58679. value: true
  58680. }));
  58681. exports.XFAParser = void 0;
  58682. var _xfa_object = __w_pdfjs_require__(77);
  58683. var _xml_parser = __w_pdfjs_require__(70);
  58684. var _builder = __w_pdfjs_require__(89);
  58685. var _util = __w_pdfjs_require__(2);
  58686. class XFAParser extends _xml_parser.XMLParserBase {
  58687. constructor(rootNameSpace = null, richText = false) {
  58688. super();
  58689. this._builder = new _builder.Builder(rootNameSpace);
  58690. this._stack = [];
  58691. this._globalData = {
  58692. usedTypefaces: new Set()
  58693. };
  58694. this._ids = new Map();
  58695. this._current = this._builder.buildRoot(this._ids);
  58696. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  58697. this._whiteRegex = /^\s+$/;
  58698. this._nbsps = /\xa0+/g;
  58699. this._richText = richText;
  58700. }
  58701. parse(data) {
  58702. this.parseXml(data);
  58703. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  58704. return undefined;
  58705. }
  58706. this._current[_xfa_object.$finalize]();
  58707. return this._current.element;
  58708. }
  58709. onText(text) {
  58710. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  58711. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  58712. this._current[_xfa_object.$onText](text, this._richText);
  58713. return;
  58714. }
  58715. if (this._whiteRegex.test(text)) {
  58716. return;
  58717. }
  58718. this._current[_xfa_object.$onText](text.trim());
  58719. }
  58720. onCdata(text) {
  58721. this._current[_xfa_object.$onText](text);
  58722. }
  58723. _mkAttributes(attributes, tagName) {
  58724. let namespace = null;
  58725. let prefixes = null;
  58726. const attributeObj = Object.create({});
  58727. for (const {
  58728. name,
  58729. value
  58730. } of attributes) {
  58731. if (name === "xmlns") {
  58732. if (!namespace) {
  58733. namespace = value;
  58734. } else {
  58735. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  58736. }
  58737. } else if (name.startsWith("xmlns:")) {
  58738. const prefix = name.substring("xmlns:".length);
  58739. if (!prefixes) {
  58740. prefixes = [];
  58741. }
  58742. prefixes.push({
  58743. prefix,
  58744. value
  58745. });
  58746. } else {
  58747. const i = name.indexOf(":");
  58748. if (i === -1) {
  58749. attributeObj[name] = value;
  58750. } else {
  58751. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  58752. if (!nsAttrs) {
  58753. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  58754. }
  58755. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  58756. let attrs = nsAttrs[ns];
  58757. if (!attrs) {
  58758. attrs = nsAttrs[ns] = Object.create(null);
  58759. }
  58760. attrs[attrName] = value;
  58761. }
  58762. }
  58763. }
  58764. return [namespace, prefixes, attributeObj];
  58765. }
  58766. _getNameAndPrefix(name, nsAgnostic) {
  58767. const i = name.indexOf(":");
  58768. if (i === -1) {
  58769. return [name, null];
  58770. }
  58771. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  58772. }
  58773. onBeginElement(tagName, attributes, isEmpty) {
  58774. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  58775. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  58776. const node = this._builder.build({
  58777. nsPrefix,
  58778. name,
  58779. attributes: attributesObj,
  58780. namespace,
  58781. prefixes
  58782. });
  58783. node[_xfa_object.$globalData] = this._globalData;
  58784. if (isEmpty) {
  58785. node[_xfa_object.$finalize]();
  58786. if (this._current[_xfa_object.$onChild](node)) {
  58787. node[_xfa_object.$setId](this._ids);
  58788. }
  58789. node[_xfa_object.$clean](this._builder);
  58790. return;
  58791. }
  58792. this._stack.push(this._current);
  58793. this._current = node;
  58794. }
  58795. onEndElement(name) {
  58796. const node = this._current;
  58797. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  58798. const parser = new XFAParser();
  58799. parser._globalData = this._globalData;
  58800. const root = parser.parse(node[_xfa_object.$content]);
  58801. node[_xfa_object.$content] = null;
  58802. node[_xfa_object.$onChild](root);
  58803. }
  58804. node[_xfa_object.$finalize]();
  58805. this._current = this._stack.pop();
  58806. if (this._current[_xfa_object.$onChild](node)) {
  58807. node[_xfa_object.$setId](this._ids);
  58808. }
  58809. node[_xfa_object.$clean](this._builder);
  58810. }
  58811. onError(code) {
  58812. this._errorCode = code;
  58813. }
  58814. }
  58815. exports.XFAParser = XFAParser;
  58816. /***/ }),
  58817. /* 89 */
  58818. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58819. Object.defineProperty(exports, "__esModule", ({
  58820. value: true
  58821. }));
  58822. exports.Builder = void 0;
  58823. var _namespaces = __w_pdfjs_require__(79);
  58824. var _xfa_object = __w_pdfjs_require__(77);
  58825. var _setup = __w_pdfjs_require__(90);
  58826. var _template = __w_pdfjs_require__(82);
  58827. var _unknown = __w_pdfjs_require__(99);
  58828. var _util = __w_pdfjs_require__(2);
  58829. class Root extends _xfa_object.XFAObject {
  58830. constructor(ids) {
  58831. super(-1, "root", Object.create(null));
  58832. this.element = null;
  58833. this[_xfa_object.$ids] = ids;
  58834. }
  58835. [_xfa_object.$onChild](child) {
  58836. this.element = child;
  58837. return true;
  58838. }
  58839. [_xfa_object.$finalize]() {
  58840. super[_xfa_object.$finalize]();
  58841. if (this.element.template instanceof _template.Template) {
  58842. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  58843. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  58844. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  58845. }
  58846. }
  58847. }
  58848. class Empty extends _xfa_object.XFAObject {
  58849. constructor() {
  58850. super(-1, "", Object.create(null));
  58851. }
  58852. [_xfa_object.$onChild](_) {
  58853. return false;
  58854. }
  58855. }
  58856. class Builder {
  58857. constructor(rootNameSpace = null) {
  58858. this._namespaceStack = [];
  58859. this._nsAgnosticLevel = 0;
  58860. this._namespacePrefixes = new Map();
  58861. this._namespaces = new Map();
  58862. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  58863. id
  58864. }) => id));
  58865. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  58866. }
  58867. buildRoot(ids) {
  58868. return new Root(ids);
  58869. }
  58870. build({
  58871. nsPrefix,
  58872. name,
  58873. attributes,
  58874. namespace,
  58875. prefixes
  58876. }) {
  58877. const hasNamespaceDef = namespace !== null;
  58878. if (hasNamespaceDef) {
  58879. this._namespaceStack.push(this._currentNamespace);
  58880. this._currentNamespace = this._searchNamespace(namespace);
  58881. }
  58882. if (prefixes) {
  58883. this._addNamespacePrefix(prefixes);
  58884. }
  58885. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  58886. const dataTemplate = _setup.NamespaceSetUp.datasets;
  58887. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  58888. let xfaAttrs = null;
  58889. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  58890. const nsToUse = this._getNamespaceToUse(ns);
  58891. if (nsToUse === dataTemplate) {
  58892. xfaAttrs = {
  58893. xfa: attrs
  58894. };
  58895. break;
  58896. }
  58897. }
  58898. if (xfaAttrs) {
  58899. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  58900. } else {
  58901. delete attributes[_xfa_object.$nsAttributes];
  58902. }
  58903. }
  58904. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  58905. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  58906. if (node[_xfa_object.$isNsAgnostic]()) {
  58907. this._nsAgnosticLevel++;
  58908. }
  58909. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  58910. node[_xfa_object.$cleanup] = {
  58911. hasNamespace: hasNamespaceDef,
  58912. prefixes,
  58913. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  58914. };
  58915. }
  58916. return node;
  58917. }
  58918. isNsAgnostic() {
  58919. return this._nsAgnosticLevel > 0;
  58920. }
  58921. _searchNamespace(nsName) {
  58922. let ns = this._namespaces.get(nsName);
  58923. if (ns) {
  58924. return ns;
  58925. }
  58926. for (const [name, {
  58927. check
  58928. }] of Object.entries(_namespaces.NamespaceIds)) {
  58929. if (check(nsName)) {
  58930. ns = _setup.NamespaceSetUp[name];
  58931. if (ns) {
  58932. this._namespaces.set(nsName, ns);
  58933. return ns;
  58934. }
  58935. break;
  58936. }
  58937. }
  58938. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  58939. this._namespaces.set(nsName, ns);
  58940. return ns;
  58941. }
  58942. _addNamespacePrefix(prefixes) {
  58943. for (const {
  58944. prefix,
  58945. value
  58946. } of prefixes) {
  58947. const namespace = this._searchNamespace(value);
  58948. let prefixStack = this._namespacePrefixes.get(prefix);
  58949. if (!prefixStack) {
  58950. prefixStack = [];
  58951. this._namespacePrefixes.set(prefix, prefixStack);
  58952. }
  58953. prefixStack.push(namespace);
  58954. }
  58955. }
  58956. _getNamespaceToUse(prefix) {
  58957. if (!prefix) {
  58958. return this._currentNamespace;
  58959. }
  58960. const prefixStack = this._namespacePrefixes.get(prefix);
  58961. if (prefixStack && prefixStack.length > 0) {
  58962. return prefixStack[prefixStack.length - 1];
  58963. }
  58964. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  58965. return null;
  58966. }
  58967. clean(data) {
  58968. const {
  58969. hasNamespace,
  58970. prefixes,
  58971. nsAgnostic
  58972. } = data;
  58973. if (hasNamespace) {
  58974. this._currentNamespace = this._namespaceStack.pop();
  58975. }
  58976. if (prefixes) {
  58977. prefixes.forEach(({
  58978. prefix
  58979. }) => {
  58980. this._namespacePrefixes.get(prefix).pop();
  58981. });
  58982. }
  58983. if (nsAgnostic) {
  58984. this._nsAgnosticLevel--;
  58985. }
  58986. }
  58987. }
  58988. exports.Builder = Builder;
  58989. /***/ }),
  58990. /* 90 */
  58991. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58992. Object.defineProperty(exports, "__esModule", ({
  58993. value: true
  58994. }));
  58995. exports.NamespaceSetUp = void 0;
  58996. var _config = __w_pdfjs_require__(91);
  58997. var _connection_set = __w_pdfjs_require__(92);
  58998. var _datasets = __w_pdfjs_require__(93);
  58999. var _locale_set = __w_pdfjs_require__(94);
  59000. var _signature = __w_pdfjs_require__(95);
  59001. var _stylesheet = __w_pdfjs_require__(96);
  59002. var _template = __w_pdfjs_require__(82);
  59003. var _xdp = __w_pdfjs_require__(97);
  59004. var _xhtml = __w_pdfjs_require__(98);
  59005. const NamespaceSetUp = {
  59006. config: _config.ConfigNamespace,
  59007. connection: _connection_set.ConnectionSetNamespace,
  59008. datasets: _datasets.DatasetsNamespace,
  59009. localeSet: _locale_set.LocaleSetNamespace,
  59010. signature: _signature.SignatureNamespace,
  59011. stylesheet: _stylesheet.StylesheetNamespace,
  59012. template: _template.TemplateNamespace,
  59013. xdp: _xdp.XdpNamespace,
  59014. xhtml: _xhtml.XhtmlNamespace
  59015. };
  59016. exports.NamespaceSetUp = NamespaceSetUp;
  59017. /***/ }),
  59018. /* 91 */
  59019. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59020. Object.defineProperty(exports, "__esModule", ({
  59021. value: true
  59022. }));
  59023. exports.ConfigNamespace = void 0;
  59024. var _namespaces = __w_pdfjs_require__(79);
  59025. var _xfa_object = __w_pdfjs_require__(77);
  59026. var _utils = __w_pdfjs_require__(78);
  59027. var _util = __w_pdfjs_require__(2);
  59028. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  59029. class Acrobat extends _xfa_object.XFAObject {
  59030. constructor(attributes) {
  59031. super(CONFIG_NS_ID, "acrobat", true);
  59032. this.acrobat7 = null;
  59033. this.autoSave = null;
  59034. this.common = null;
  59035. this.validate = null;
  59036. this.validateApprovalSignatures = null;
  59037. this.submitUrl = new _xfa_object.XFAObjectArray();
  59038. }
  59039. }
  59040. class Acrobat7 extends _xfa_object.XFAObject {
  59041. constructor(attributes) {
  59042. super(CONFIG_NS_ID, "acrobat7", true);
  59043. this.dynamicRender = null;
  59044. }
  59045. }
  59046. class ADBE_JSConsole extends _xfa_object.OptionObject {
  59047. constructor(attributes) {
  59048. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  59049. }
  59050. }
  59051. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  59052. constructor(attributes) {
  59053. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  59054. }
  59055. }
  59056. class AddSilentPrint extends _xfa_object.Option01 {
  59057. constructor(attributes) {
  59058. super(CONFIG_NS_ID, "addSilentPrint");
  59059. }
  59060. }
  59061. class AddViewerPreferences extends _xfa_object.Option01 {
  59062. constructor(attributes) {
  59063. super(CONFIG_NS_ID, "addViewerPreferences");
  59064. }
  59065. }
  59066. class AdjustData extends _xfa_object.Option10 {
  59067. constructor(attributes) {
  59068. super(CONFIG_NS_ID, "adjustData");
  59069. }
  59070. }
  59071. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  59072. constructor(attributes) {
  59073. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  59074. }
  59075. }
  59076. class Agent extends _xfa_object.XFAObject {
  59077. constructor(attributes) {
  59078. super(CONFIG_NS_ID, "agent", true);
  59079. this.name = attributes.name ? attributes.name.trim() : "";
  59080. this.common = new _xfa_object.XFAObjectArray();
  59081. }
  59082. }
  59083. class AlwaysEmbed extends _xfa_object.ContentObject {
  59084. constructor(attributes) {
  59085. super(CONFIG_NS_ID, "alwaysEmbed");
  59086. }
  59087. }
  59088. class Amd extends _xfa_object.StringObject {
  59089. constructor(attributes) {
  59090. super(CONFIG_NS_ID, "amd");
  59091. }
  59092. }
  59093. class Area extends _xfa_object.XFAObject {
  59094. constructor(attributes) {
  59095. super(CONFIG_NS_ID, "area");
  59096. this.level = (0, _utils.getInteger)({
  59097. data: attributes.level,
  59098. defaultValue: 0,
  59099. validate: n => n >= 1 && n <= 3
  59100. });
  59101. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  59102. }
  59103. }
  59104. class Attributes extends _xfa_object.OptionObject {
  59105. constructor(attributes) {
  59106. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  59107. }
  59108. }
  59109. class AutoSave extends _xfa_object.OptionObject {
  59110. constructor(attributes) {
  59111. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  59112. }
  59113. }
  59114. class Base extends _xfa_object.StringObject {
  59115. constructor(attributes) {
  59116. super(CONFIG_NS_ID, "base");
  59117. }
  59118. }
  59119. class BatchOutput extends _xfa_object.XFAObject {
  59120. constructor(attributes) {
  59121. super(CONFIG_NS_ID, "batchOutput");
  59122. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  59123. }
  59124. }
  59125. class BehaviorOverride extends _xfa_object.ContentObject {
  59126. constructor(attributes) {
  59127. super(CONFIG_NS_ID, "behaviorOverride");
  59128. }
  59129. [_xfa_object.$finalize]() {
  59130. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  59131. }
  59132. }
  59133. class Cache extends _xfa_object.XFAObject {
  59134. constructor(attributes) {
  59135. super(CONFIG_NS_ID, "cache", true);
  59136. this.templateCache = null;
  59137. }
  59138. }
  59139. class Change extends _xfa_object.Option01 {
  59140. constructor(attributes) {
  59141. super(CONFIG_NS_ID, "change");
  59142. }
  59143. }
  59144. class Common extends _xfa_object.XFAObject {
  59145. constructor(attributes) {
  59146. super(CONFIG_NS_ID, "common", true);
  59147. this.data = null;
  59148. this.locale = null;
  59149. this.localeSet = null;
  59150. this.messaging = null;
  59151. this.suppressBanner = null;
  59152. this.template = null;
  59153. this.validationMessaging = null;
  59154. this.versionControl = null;
  59155. this.log = new _xfa_object.XFAObjectArray();
  59156. }
  59157. }
  59158. class Compress extends _xfa_object.XFAObject {
  59159. constructor(attributes) {
  59160. super(CONFIG_NS_ID, "compress");
  59161. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  59162. }
  59163. }
  59164. class CompressLogicalStructure extends _xfa_object.Option01 {
  59165. constructor(attributes) {
  59166. super(CONFIG_NS_ID, "compressLogicalStructure");
  59167. }
  59168. }
  59169. class CompressObjectStream extends _xfa_object.Option10 {
  59170. constructor(attributes) {
  59171. super(CONFIG_NS_ID, "compressObjectStream");
  59172. }
  59173. }
  59174. class Compression extends _xfa_object.XFAObject {
  59175. constructor(attributes) {
  59176. super(CONFIG_NS_ID, "compression", true);
  59177. this.compressLogicalStructure = null;
  59178. this.compressObjectStream = null;
  59179. this.level = null;
  59180. this.type = null;
  59181. }
  59182. }
  59183. class Config extends _xfa_object.XFAObject {
  59184. constructor(attributes) {
  59185. super(CONFIG_NS_ID, "config", true);
  59186. this.acrobat = null;
  59187. this.present = null;
  59188. this.trace = null;
  59189. this.agent = new _xfa_object.XFAObjectArray();
  59190. }
  59191. }
  59192. class Conformance extends _xfa_object.OptionObject {
  59193. constructor(attributes) {
  59194. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  59195. }
  59196. }
  59197. class ContentCopy extends _xfa_object.Option01 {
  59198. constructor(attributes) {
  59199. super(CONFIG_NS_ID, "contentCopy");
  59200. }
  59201. }
  59202. class Copies extends _xfa_object.IntegerObject {
  59203. constructor(attributes) {
  59204. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  59205. }
  59206. }
  59207. class Creator extends _xfa_object.StringObject {
  59208. constructor(attributes) {
  59209. super(CONFIG_NS_ID, "creator");
  59210. }
  59211. }
  59212. class CurrentPage extends _xfa_object.IntegerObject {
  59213. constructor(attributes) {
  59214. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  59215. }
  59216. }
  59217. class Data extends _xfa_object.XFAObject {
  59218. constructor(attributes) {
  59219. super(CONFIG_NS_ID, "data", true);
  59220. this.adjustData = null;
  59221. this.attributes = null;
  59222. this.incrementalLoad = null;
  59223. this.outputXSL = null;
  59224. this.range = null;
  59225. this.record = null;
  59226. this.startNode = null;
  59227. this.uri = null;
  59228. this.window = null;
  59229. this.xsl = null;
  59230. this.excludeNS = new _xfa_object.XFAObjectArray();
  59231. this.transform = new _xfa_object.XFAObjectArray();
  59232. }
  59233. }
  59234. class Debug extends _xfa_object.XFAObject {
  59235. constructor(attributes) {
  59236. super(CONFIG_NS_ID, "debug", true);
  59237. this.uri = null;
  59238. }
  59239. }
  59240. class DefaultTypeface extends _xfa_object.ContentObject {
  59241. constructor(attributes) {
  59242. super(CONFIG_NS_ID, "defaultTypeface");
  59243. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  59244. }
  59245. }
  59246. class Destination extends _xfa_object.OptionObject {
  59247. constructor(attributes) {
  59248. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  59249. }
  59250. }
  59251. class DocumentAssembly extends _xfa_object.Option01 {
  59252. constructor(attributes) {
  59253. super(CONFIG_NS_ID, "documentAssembly");
  59254. }
  59255. }
  59256. class Driver extends _xfa_object.XFAObject {
  59257. constructor(attributes) {
  59258. super(CONFIG_NS_ID, "driver", true);
  59259. this.name = attributes.name ? attributes.name.trim() : "";
  59260. this.fontInfo = null;
  59261. this.xdc = null;
  59262. }
  59263. }
  59264. class DuplexOption extends _xfa_object.OptionObject {
  59265. constructor(attributes) {
  59266. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  59267. }
  59268. }
  59269. class DynamicRender extends _xfa_object.OptionObject {
  59270. constructor(attributes) {
  59271. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  59272. }
  59273. }
  59274. class Embed extends _xfa_object.Option01 {
  59275. constructor(attributes) {
  59276. super(CONFIG_NS_ID, "embed");
  59277. }
  59278. }
  59279. class Encrypt extends _xfa_object.Option01 {
  59280. constructor(attributes) {
  59281. super(CONFIG_NS_ID, "encrypt");
  59282. }
  59283. }
  59284. class Encryption extends _xfa_object.XFAObject {
  59285. constructor(attributes) {
  59286. super(CONFIG_NS_ID, "encryption", true);
  59287. this.encrypt = null;
  59288. this.encryptionLevel = null;
  59289. this.permissions = null;
  59290. }
  59291. }
  59292. class EncryptionLevel extends _xfa_object.OptionObject {
  59293. constructor(attributes) {
  59294. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  59295. }
  59296. }
  59297. class Enforce extends _xfa_object.StringObject {
  59298. constructor(attributes) {
  59299. super(CONFIG_NS_ID, "enforce");
  59300. }
  59301. }
  59302. class Equate extends _xfa_object.XFAObject {
  59303. constructor(attributes) {
  59304. super(CONFIG_NS_ID, "equate");
  59305. this.force = (0, _utils.getInteger)({
  59306. data: attributes.force,
  59307. defaultValue: 1,
  59308. validate: n => n === 0
  59309. });
  59310. this.from = attributes.from || "";
  59311. this.to = attributes.to || "";
  59312. }
  59313. }
  59314. class EquateRange extends _xfa_object.XFAObject {
  59315. constructor(attributes) {
  59316. super(CONFIG_NS_ID, "equateRange");
  59317. this.from = attributes.from || "";
  59318. this.to = attributes.to || "";
  59319. this._unicodeRange = attributes.unicodeRange || "";
  59320. }
  59321. get unicodeRange() {
  59322. const ranges = [];
  59323. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  59324. const unicodeRange = this._unicodeRange;
  59325. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  59326. range = range.split("-", 2).map(x => {
  59327. const found = x.match(unicodeRegex);
  59328. if (!found) {
  59329. return 0;
  59330. }
  59331. return parseInt(found[1], 16);
  59332. });
  59333. if (range.length === 1) {
  59334. range.push(range[0]);
  59335. }
  59336. ranges.push(range);
  59337. }
  59338. return (0, _util.shadow)(this, "unicodeRange", ranges);
  59339. }
  59340. }
  59341. class Exclude extends _xfa_object.ContentObject {
  59342. constructor(attributes) {
  59343. super(CONFIG_NS_ID, "exclude");
  59344. }
  59345. [_xfa_object.$finalize]() {
  59346. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  59347. }
  59348. }
  59349. class ExcludeNS extends _xfa_object.StringObject {
  59350. constructor(attributes) {
  59351. super(CONFIG_NS_ID, "excludeNS");
  59352. }
  59353. }
  59354. class FlipLabel extends _xfa_object.OptionObject {
  59355. constructor(attributes) {
  59356. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  59357. }
  59358. }
  59359. class FontInfo extends _xfa_object.XFAObject {
  59360. constructor(attributes) {
  59361. super(CONFIG_NS_ID, "fontInfo", true);
  59362. this.embed = null;
  59363. this.map = null;
  59364. this.subsetBelow = null;
  59365. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  59366. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  59367. this.neverEmbed = new _xfa_object.XFAObjectArray();
  59368. }
  59369. }
  59370. class FormFieldFilling extends _xfa_object.Option01 {
  59371. constructor(attributes) {
  59372. super(CONFIG_NS_ID, "formFieldFilling");
  59373. }
  59374. }
  59375. class GroupParent extends _xfa_object.StringObject {
  59376. constructor(attributes) {
  59377. super(CONFIG_NS_ID, "groupParent");
  59378. }
  59379. }
  59380. class IfEmpty extends _xfa_object.OptionObject {
  59381. constructor(attributes) {
  59382. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  59383. }
  59384. }
  59385. class IncludeXDPContent extends _xfa_object.StringObject {
  59386. constructor(attributes) {
  59387. super(CONFIG_NS_ID, "includeXDPContent");
  59388. }
  59389. }
  59390. class IncrementalLoad extends _xfa_object.OptionObject {
  59391. constructor(attributes) {
  59392. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  59393. }
  59394. }
  59395. class IncrementalMerge extends _xfa_object.Option01 {
  59396. constructor(attributes) {
  59397. super(CONFIG_NS_ID, "incrementalMerge");
  59398. }
  59399. }
  59400. class Interactive extends _xfa_object.Option01 {
  59401. constructor(attributes) {
  59402. super(CONFIG_NS_ID, "interactive");
  59403. }
  59404. }
  59405. class Jog extends _xfa_object.OptionObject {
  59406. constructor(attributes) {
  59407. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  59408. }
  59409. }
  59410. class LabelPrinter extends _xfa_object.XFAObject {
  59411. constructor(attributes) {
  59412. super(CONFIG_NS_ID, "labelPrinter", true);
  59413. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  59414. this.batchOutput = null;
  59415. this.flipLabel = null;
  59416. this.fontInfo = null;
  59417. this.xdc = null;
  59418. }
  59419. }
  59420. class Layout extends _xfa_object.OptionObject {
  59421. constructor(attributes) {
  59422. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  59423. }
  59424. }
  59425. class Level extends _xfa_object.IntegerObject {
  59426. constructor(attributes) {
  59427. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  59428. }
  59429. }
  59430. class Linearized extends _xfa_object.Option01 {
  59431. constructor(attributes) {
  59432. super(CONFIG_NS_ID, "linearized");
  59433. }
  59434. }
  59435. class Locale extends _xfa_object.StringObject {
  59436. constructor(attributes) {
  59437. super(CONFIG_NS_ID, "locale");
  59438. }
  59439. }
  59440. class LocaleSet extends _xfa_object.StringObject {
  59441. constructor(attributes) {
  59442. super(CONFIG_NS_ID, "localeSet");
  59443. }
  59444. }
  59445. class Log extends _xfa_object.XFAObject {
  59446. constructor(attributes) {
  59447. super(CONFIG_NS_ID, "log", true);
  59448. this.mode = null;
  59449. this.threshold = null;
  59450. this.to = null;
  59451. this.uri = null;
  59452. }
  59453. }
  59454. class MapElement extends _xfa_object.XFAObject {
  59455. constructor(attributes) {
  59456. super(CONFIG_NS_ID, "map", true);
  59457. this.equate = new _xfa_object.XFAObjectArray();
  59458. this.equateRange = new _xfa_object.XFAObjectArray();
  59459. }
  59460. }
  59461. class MediumInfo extends _xfa_object.XFAObject {
  59462. constructor(attributes) {
  59463. super(CONFIG_NS_ID, "mediumInfo", true);
  59464. this.map = null;
  59465. }
  59466. }
  59467. class Message extends _xfa_object.XFAObject {
  59468. constructor(attributes) {
  59469. super(CONFIG_NS_ID, "message", true);
  59470. this.msgId = null;
  59471. this.severity = null;
  59472. }
  59473. }
  59474. class Messaging extends _xfa_object.XFAObject {
  59475. constructor(attributes) {
  59476. super(CONFIG_NS_ID, "messaging", true);
  59477. this.message = new _xfa_object.XFAObjectArray();
  59478. }
  59479. }
  59480. class Mode extends _xfa_object.OptionObject {
  59481. constructor(attributes) {
  59482. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  59483. }
  59484. }
  59485. class ModifyAnnots extends _xfa_object.Option01 {
  59486. constructor(attributes) {
  59487. super(CONFIG_NS_ID, "modifyAnnots");
  59488. }
  59489. }
  59490. class MsgId extends _xfa_object.IntegerObject {
  59491. constructor(attributes) {
  59492. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  59493. }
  59494. }
  59495. class NameAttr extends _xfa_object.StringObject {
  59496. constructor(attributes) {
  59497. super(CONFIG_NS_ID, "nameAttr");
  59498. }
  59499. }
  59500. class NeverEmbed extends _xfa_object.ContentObject {
  59501. constructor(attributes) {
  59502. super(CONFIG_NS_ID, "neverEmbed");
  59503. }
  59504. }
  59505. class NumberOfCopies extends _xfa_object.IntegerObject {
  59506. constructor(attributes) {
  59507. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  59508. }
  59509. }
  59510. class OpenAction extends _xfa_object.XFAObject {
  59511. constructor(attributes) {
  59512. super(CONFIG_NS_ID, "openAction", true);
  59513. this.destination = null;
  59514. }
  59515. }
  59516. class Output extends _xfa_object.XFAObject {
  59517. constructor(attributes) {
  59518. super(CONFIG_NS_ID, "output", true);
  59519. this.to = null;
  59520. this.type = null;
  59521. this.uri = null;
  59522. }
  59523. }
  59524. class OutputBin extends _xfa_object.StringObject {
  59525. constructor(attributes) {
  59526. super(CONFIG_NS_ID, "outputBin");
  59527. }
  59528. }
  59529. class OutputXSL extends _xfa_object.XFAObject {
  59530. constructor(attributes) {
  59531. super(CONFIG_NS_ID, "outputXSL", true);
  59532. this.uri = null;
  59533. }
  59534. }
  59535. class Overprint extends _xfa_object.OptionObject {
  59536. constructor(attributes) {
  59537. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  59538. }
  59539. }
  59540. class Packets extends _xfa_object.StringObject {
  59541. constructor(attributes) {
  59542. super(CONFIG_NS_ID, "packets");
  59543. }
  59544. [_xfa_object.$finalize]() {
  59545. if (this[_xfa_object.$content] === "*") {
  59546. return;
  59547. }
  59548. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  59549. }
  59550. }
  59551. class PageOffset extends _xfa_object.XFAObject {
  59552. constructor(attributes) {
  59553. super(CONFIG_NS_ID, "pageOffset");
  59554. this.x = (0, _utils.getInteger)({
  59555. data: attributes.x,
  59556. defaultValue: "useXDCSetting",
  59557. validate: n => true
  59558. });
  59559. this.y = (0, _utils.getInteger)({
  59560. data: attributes.y,
  59561. defaultValue: "useXDCSetting",
  59562. validate: n => true
  59563. });
  59564. }
  59565. }
  59566. class PageRange extends _xfa_object.StringObject {
  59567. constructor(attributes) {
  59568. super(CONFIG_NS_ID, "pageRange");
  59569. }
  59570. [_xfa_object.$finalize]() {
  59571. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  59572. const ranges = [];
  59573. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  59574. ranges.push(numbers.slice(i, i + 2));
  59575. }
  59576. this[_xfa_object.$content] = ranges;
  59577. }
  59578. }
  59579. class Pagination extends _xfa_object.OptionObject {
  59580. constructor(attributes) {
  59581. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  59582. }
  59583. }
  59584. class PaginationOverride extends _xfa_object.OptionObject {
  59585. constructor(attributes) {
  59586. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  59587. }
  59588. }
  59589. class Part extends _xfa_object.IntegerObject {
  59590. constructor(attributes) {
  59591. super(CONFIG_NS_ID, "part", 1, n => false);
  59592. }
  59593. }
  59594. class Pcl extends _xfa_object.XFAObject {
  59595. constructor(attributes) {
  59596. super(CONFIG_NS_ID, "pcl", true);
  59597. this.name = attributes.name || "";
  59598. this.batchOutput = null;
  59599. this.fontInfo = null;
  59600. this.jog = null;
  59601. this.mediumInfo = null;
  59602. this.outputBin = null;
  59603. this.pageOffset = null;
  59604. this.staple = null;
  59605. this.xdc = null;
  59606. }
  59607. }
  59608. class Pdf extends _xfa_object.XFAObject {
  59609. constructor(attributes) {
  59610. super(CONFIG_NS_ID, "pdf", true);
  59611. this.name = attributes.name || "";
  59612. this.adobeExtensionLevel = null;
  59613. this.batchOutput = null;
  59614. this.compression = null;
  59615. this.creator = null;
  59616. this.encryption = null;
  59617. this.fontInfo = null;
  59618. this.interactive = null;
  59619. this.linearized = null;
  59620. this.openAction = null;
  59621. this.pdfa = null;
  59622. this.producer = null;
  59623. this.renderPolicy = null;
  59624. this.scriptModel = null;
  59625. this.silentPrint = null;
  59626. this.submitFormat = null;
  59627. this.tagged = null;
  59628. this.version = null;
  59629. this.viewerPreferences = null;
  59630. this.xdc = null;
  59631. }
  59632. }
  59633. class Pdfa extends _xfa_object.XFAObject {
  59634. constructor(attributes) {
  59635. super(CONFIG_NS_ID, "pdfa", true);
  59636. this.amd = null;
  59637. this.conformance = null;
  59638. this.includeXDPContent = null;
  59639. this.part = null;
  59640. }
  59641. }
  59642. class Permissions extends _xfa_object.XFAObject {
  59643. constructor(attributes) {
  59644. super(CONFIG_NS_ID, "permissions", true);
  59645. this.accessibleContent = null;
  59646. this.change = null;
  59647. this.contentCopy = null;
  59648. this.documentAssembly = null;
  59649. this.formFieldFilling = null;
  59650. this.modifyAnnots = null;
  59651. this.plaintextMetadata = null;
  59652. this.print = null;
  59653. this.printHighQuality = null;
  59654. }
  59655. }
  59656. class PickTrayByPDFSize extends _xfa_object.Option01 {
  59657. constructor(attributes) {
  59658. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  59659. }
  59660. }
  59661. class Picture extends _xfa_object.StringObject {
  59662. constructor(attributes) {
  59663. super(CONFIG_NS_ID, "picture");
  59664. }
  59665. }
  59666. class PlaintextMetadata extends _xfa_object.Option01 {
  59667. constructor(attributes) {
  59668. super(CONFIG_NS_ID, "plaintextMetadata");
  59669. }
  59670. }
  59671. class Presence extends _xfa_object.OptionObject {
  59672. constructor(attributes) {
  59673. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  59674. }
  59675. }
  59676. class Present extends _xfa_object.XFAObject {
  59677. constructor(attributes) {
  59678. super(CONFIG_NS_ID, "present", true);
  59679. this.behaviorOverride = null;
  59680. this.cache = null;
  59681. this.common = null;
  59682. this.copies = null;
  59683. this.destination = null;
  59684. this.incrementalMerge = null;
  59685. this.layout = null;
  59686. this.output = null;
  59687. this.overprint = null;
  59688. this.pagination = null;
  59689. this.paginationOverride = null;
  59690. this.script = null;
  59691. this.validate = null;
  59692. this.xdp = null;
  59693. this.driver = new _xfa_object.XFAObjectArray();
  59694. this.labelPrinter = new _xfa_object.XFAObjectArray();
  59695. this.pcl = new _xfa_object.XFAObjectArray();
  59696. this.pdf = new _xfa_object.XFAObjectArray();
  59697. this.ps = new _xfa_object.XFAObjectArray();
  59698. this.submitUrl = new _xfa_object.XFAObjectArray();
  59699. this.webClient = new _xfa_object.XFAObjectArray();
  59700. this.zpl = new _xfa_object.XFAObjectArray();
  59701. }
  59702. }
  59703. class Print extends _xfa_object.Option01 {
  59704. constructor(attributes) {
  59705. super(CONFIG_NS_ID, "print");
  59706. }
  59707. }
  59708. class PrintHighQuality extends _xfa_object.Option01 {
  59709. constructor(attributes) {
  59710. super(CONFIG_NS_ID, "printHighQuality");
  59711. }
  59712. }
  59713. class PrintScaling extends _xfa_object.OptionObject {
  59714. constructor(attributes) {
  59715. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  59716. }
  59717. }
  59718. class PrinterName extends _xfa_object.StringObject {
  59719. constructor(attributes) {
  59720. super(CONFIG_NS_ID, "printerName");
  59721. }
  59722. }
  59723. class Producer extends _xfa_object.StringObject {
  59724. constructor(attributes) {
  59725. super(CONFIG_NS_ID, "producer");
  59726. }
  59727. }
  59728. class Ps extends _xfa_object.XFAObject {
  59729. constructor(attributes) {
  59730. super(CONFIG_NS_ID, "ps", true);
  59731. this.name = attributes.name || "";
  59732. this.batchOutput = null;
  59733. this.fontInfo = null;
  59734. this.jog = null;
  59735. this.mediumInfo = null;
  59736. this.outputBin = null;
  59737. this.staple = null;
  59738. this.xdc = null;
  59739. }
  59740. }
  59741. class Range extends _xfa_object.ContentObject {
  59742. constructor(attributes) {
  59743. super(CONFIG_NS_ID, "range");
  59744. }
  59745. [_xfa_object.$finalize]() {
  59746. 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 => {
  59747. if (range.length === 1) {
  59748. range.push(range[0]);
  59749. }
  59750. return range;
  59751. });
  59752. }
  59753. }
  59754. class Record extends _xfa_object.ContentObject {
  59755. constructor(attributes) {
  59756. super(CONFIG_NS_ID, "record");
  59757. }
  59758. [_xfa_object.$finalize]() {
  59759. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59760. const n = parseInt(this[_xfa_object.$content], 10);
  59761. if (!isNaN(n) && n >= 0) {
  59762. this[_xfa_object.$content] = n;
  59763. }
  59764. }
  59765. }
  59766. class Relevant extends _xfa_object.ContentObject {
  59767. constructor(attributes) {
  59768. super(CONFIG_NS_ID, "relevant");
  59769. }
  59770. [_xfa_object.$finalize]() {
  59771. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  59772. }
  59773. }
  59774. class Rename extends _xfa_object.ContentObject {
  59775. constructor(attributes) {
  59776. super(CONFIG_NS_ID, "rename");
  59777. }
  59778. [_xfa_object.$finalize]() {
  59779. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59780. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  59781. (0, _util.warn)("XFA - Rename: invalid XFA name");
  59782. }
  59783. }
  59784. }
  59785. class RenderPolicy extends _xfa_object.OptionObject {
  59786. constructor(attributes) {
  59787. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  59788. }
  59789. }
  59790. class RunScripts extends _xfa_object.OptionObject {
  59791. constructor(attributes) {
  59792. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  59793. }
  59794. }
  59795. class Script extends _xfa_object.XFAObject {
  59796. constructor(attributes) {
  59797. super(CONFIG_NS_ID, "script", true);
  59798. this.currentPage = null;
  59799. this.exclude = null;
  59800. this.runScripts = null;
  59801. }
  59802. }
  59803. class ScriptModel extends _xfa_object.OptionObject {
  59804. constructor(attributes) {
  59805. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  59806. }
  59807. }
  59808. class Severity extends _xfa_object.OptionObject {
  59809. constructor(attributes) {
  59810. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  59811. }
  59812. }
  59813. class SilentPrint extends _xfa_object.XFAObject {
  59814. constructor(attributes) {
  59815. super(CONFIG_NS_ID, "silentPrint", true);
  59816. this.addSilentPrint = null;
  59817. this.printerName = null;
  59818. }
  59819. }
  59820. class Staple extends _xfa_object.XFAObject {
  59821. constructor(attributes) {
  59822. super(CONFIG_NS_ID, "staple");
  59823. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  59824. }
  59825. }
  59826. class StartNode extends _xfa_object.StringObject {
  59827. constructor(attributes) {
  59828. super(CONFIG_NS_ID, "startNode");
  59829. }
  59830. }
  59831. class StartPage extends _xfa_object.IntegerObject {
  59832. constructor(attributes) {
  59833. super(CONFIG_NS_ID, "startPage", 0, n => true);
  59834. }
  59835. }
  59836. class SubmitFormat extends _xfa_object.OptionObject {
  59837. constructor(attributes) {
  59838. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  59839. }
  59840. }
  59841. class SubmitUrl extends _xfa_object.StringObject {
  59842. constructor(attributes) {
  59843. super(CONFIG_NS_ID, "submitUrl");
  59844. }
  59845. }
  59846. class SubsetBelow extends _xfa_object.IntegerObject {
  59847. constructor(attributes) {
  59848. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  59849. }
  59850. }
  59851. class SuppressBanner extends _xfa_object.Option01 {
  59852. constructor(attributes) {
  59853. super(CONFIG_NS_ID, "suppressBanner");
  59854. }
  59855. }
  59856. class Tagged extends _xfa_object.Option01 {
  59857. constructor(attributes) {
  59858. super(CONFIG_NS_ID, "tagged");
  59859. }
  59860. }
  59861. class Template extends _xfa_object.XFAObject {
  59862. constructor(attributes) {
  59863. super(CONFIG_NS_ID, "template", true);
  59864. this.base = null;
  59865. this.relevant = null;
  59866. this.startPage = null;
  59867. this.uri = null;
  59868. this.xsl = null;
  59869. }
  59870. }
  59871. class Threshold extends _xfa_object.OptionObject {
  59872. constructor(attributes) {
  59873. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  59874. }
  59875. }
  59876. class To extends _xfa_object.OptionObject {
  59877. constructor(attributes) {
  59878. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  59879. }
  59880. }
  59881. class TemplateCache extends _xfa_object.XFAObject {
  59882. constructor(attributes) {
  59883. super(CONFIG_NS_ID, "templateCache");
  59884. this.maxEntries = (0, _utils.getInteger)({
  59885. data: attributes.maxEntries,
  59886. defaultValue: 5,
  59887. validate: n => n >= 0
  59888. });
  59889. }
  59890. }
  59891. class Trace extends _xfa_object.XFAObject {
  59892. constructor(attributes) {
  59893. super(CONFIG_NS_ID, "trace", true);
  59894. this.area = new _xfa_object.XFAObjectArray();
  59895. }
  59896. }
  59897. class Transform extends _xfa_object.XFAObject {
  59898. constructor(attributes) {
  59899. super(CONFIG_NS_ID, "transform", true);
  59900. this.groupParent = null;
  59901. this.ifEmpty = null;
  59902. this.nameAttr = null;
  59903. this.picture = null;
  59904. this.presence = null;
  59905. this.rename = null;
  59906. this.whitespace = null;
  59907. }
  59908. }
  59909. class Type extends _xfa_object.OptionObject {
  59910. constructor(attributes) {
  59911. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  59912. }
  59913. }
  59914. class Uri extends _xfa_object.StringObject {
  59915. constructor(attributes) {
  59916. super(CONFIG_NS_ID, "uri");
  59917. }
  59918. }
  59919. class Validate extends _xfa_object.OptionObject {
  59920. constructor(attributes) {
  59921. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  59922. }
  59923. }
  59924. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  59925. constructor(attributes) {
  59926. super(CONFIG_NS_ID, "validateApprovalSignatures");
  59927. }
  59928. [_xfa_object.$finalize]() {
  59929. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  59930. }
  59931. }
  59932. class ValidationMessaging extends _xfa_object.OptionObject {
  59933. constructor(attributes) {
  59934. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  59935. }
  59936. }
  59937. class Version extends _xfa_object.OptionObject {
  59938. constructor(attributes) {
  59939. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  59940. }
  59941. }
  59942. class VersionControl extends _xfa_object.XFAObject {
  59943. constructor(attributes) {
  59944. super(CONFIG_NS_ID, "VersionControl");
  59945. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  59946. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  59947. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  59948. }
  59949. }
  59950. class ViewerPreferences extends _xfa_object.XFAObject {
  59951. constructor(attributes) {
  59952. super(CONFIG_NS_ID, "viewerPreferences", true);
  59953. this.ADBE_JSConsole = null;
  59954. this.ADBE_JSDebugger = null;
  59955. this.addViewerPreferences = null;
  59956. this.duplexOption = null;
  59957. this.enforce = null;
  59958. this.numberOfCopies = null;
  59959. this.pageRange = null;
  59960. this.pickTrayByPDFSize = null;
  59961. this.printScaling = null;
  59962. }
  59963. }
  59964. class WebClient extends _xfa_object.XFAObject {
  59965. constructor(attributes) {
  59966. super(CONFIG_NS_ID, "webClient", true);
  59967. this.name = attributes.name ? attributes.name.trim() : "";
  59968. this.fontInfo = null;
  59969. this.xdc = null;
  59970. }
  59971. }
  59972. class Whitespace extends _xfa_object.OptionObject {
  59973. constructor(attributes) {
  59974. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  59975. }
  59976. }
  59977. class Window extends _xfa_object.ContentObject {
  59978. constructor(attributes) {
  59979. super(CONFIG_NS_ID, "window");
  59980. }
  59981. [_xfa_object.$finalize]() {
  59982. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  59983. if (pair.some(x => isNaN(x))) {
  59984. this[_xfa_object.$content] = [0, 0];
  59985. return;
  59986. }
  59987. if (pair.length === 1) {
  59988. pair.push(pair[0]);
  59989. }
  59990. this[_xfa_object.$content] = pair;
  59991. }
  59992. }
  59993. class Xdc extends _xfa_object.XFAObject {
  59994. constructor(attributes) {
  59995. super(CONFIG_NS_ID, "xdc", true);
  59996. this.uri = new _xfa_object.XFAObjectArray();
  59997. this.xsl = new _xfa_object.XFAObjectArray();
  59998. }
  59999. }
  60000. class Xdp extends _xfa_object.XFAObject {
  60001. constructor(attributes) {
  60002. super(CONFIG_NS_ID, "xdp", true);
  60003. this.packets = null;
  60004. }
  60005. }
  60006. class Xsl extends _xfa_object.XFAObject {
  60007. constructor(attributes) {
  60008. super(CONFIG_NS_ID, "xsl", true);
  60009. this.debug = null;
  60010. this.uri = null;
  60011. }
  60012. }
  60013. class Zpl extends _xfa_object.XFAObject {
  60014. constructor(attributes) {
  60015. super(CONFIG_NS_ID, "zpl", true);
  60016. this.name = attributes.name ? attributes.name.trim() : "";
  60017. this.batchOutput = null;
  60018. this.flipLabel = null;
  60019. this.fontInfo = null;
  60020. this.xdc = null;
  60021. }
  60022. }
  60023. class ConfigNamespace {
  60024. static [_namespaces.$buildXFAObject](name, attributes) {
  60025. if (ConfigNamespace.hasOwnProperty(name)) {
  60026. return ConfigNamespace[name](attributes);
  60027. }
  60028. return undefined;
  60029. }
  60030. static acrobat(attrs) {
  60031. return new Acrobat(attrs);
  60032. }
  60033. static acrobat7(attrs) {
  60034. return new Acrobat7(attrs);
  60035. }
  60036. static ADBE_JSConsole(attrs) {
  60037. return new ADBE_JSConsole(attrs);
  60038. }
  60039. static ADBE_JSDebugger(attrs) {
  60040. return new ADBE_JSDebugger(attrs);
  60041. }
  60042. static addSilentPrint(attrs) {
  60043. return new AddSilentPrint(attrs);
  60044. }
  60045. static addViewerPreferences(attrs) {
  60046. return new AddViewerPreferences(attrs);
  60047. }
  60048. static adjustData(attrs) {
  60049. return new AdjustData(attrs);
  60050. }
  60051. static adobeExtensionLevel(attrs) {
  60052. return new AdobeExtensionLevel(attrs);
  60053. }
  60054. static agent(attrs) {
  60055. return new Agent(attrs);
  60056. }
  60057. static alwaysEmbed(attrs) {
  60058. return new AlwaysEmbed(attrs);
  60059. }
  60060. static amd(attrs) {
  60061. return new Amd(attrs);
  60062. }
  60063. static area(attrs) {
  60064. return new Area(attrs);
  60065. }
  60066. static attributes(attrs) {
  60067. return new Attributes(attrs);
  60068. }
  60069. static autoSave(attrs) {
  60070. return new AutoSave(attrs);
  60071. }
  60072. static base(attrs) {
  60073. return new Base(attrs);
  60074. }
  60075. static batchOutput(attrs) {
  60076. return new BatchOutput(attrs);
  60077. }
  60078. static behaviorOverride(attrs) {
  60079. return new BehaviorOverride(attrs);
  60080. }
  60081. static cache(attrs) {
  60082. return new Cache(attrs);
  60083. }
  60084. static change(attrs) {
  60085. return new Change(attrs);
  60086. }
  60087. static common(attrs) {
  60088. return new Common(attrs);
  60089. }
  60090. static compress(attrs) {
  60091. return new Compress(attrs);
  60092. }
  60093. static compressLogicalStructure(attrs) {
  60094. return new CompressLogicalStructure(attrs);
  60095. }
  60096. static compressObjectStream(attrs) {
  60097. return new CompressObjectStream(attrs);
  60098. }
  60099. static compression(attrs) {
  60100. return new Compression(attrs);
  60101. }
  60102. static config(attrs) {
  60103. return new Config(attrs);
  60104. }
  60105. static conformance(attrs) {
  60106. return new Conformance(attrs);
  60107. }
  60108. static contentCopy(attrs) {
  60109. return new ContentCopy(attrs);
  60110. }
  60111. static copies(attrs) {
  60112. return new Copies(attrs);
  60113. }
  60114. static creator(attrs) {
  60115. return new Creator(attrs);
  60116. }
  60117. static currentPage(attrs) {
  60118. return new CurrentPage(attrs);
  60119. }
  60120. static data(attrs) {
  60121. return new Data(attrs);
  60122. }
  60123. static debug(attrs) {
  60124. return new Debug(attrs);
  60125. }
  60126. static defaultTypeface(attrs) {
  60127. return new DefaultTypeface(attrs);
  60128. }
  60129. static destination(attrs) {
  60130. return new Destination(attrs);
  60131. }
  60132. static documentAssembly(attrs) {
  60133. return new DocumentAssembly(attrs);
  60134. }
  60135. static driver(attrs) {
  60136. return new Driver(attrs);
  60137. }
  60138. static duplexOption(attrs) {
  60139. return new DuplexOption(attrs);
  60140. }
  60141. static dynamicRender(attrs) {
  60142. return new DynamicRender(attrs);
  60143. }
  60144. static embed(attrs) {
  60145. return new Embed(attrs);
  60146. }
  60147. static encrypt(attrs) {
  60148. return new Encrypt(attrs);
  60149. }
  60150. static encryption(attrs) {
  60151. return new Encryption(attrs);
  60152. }
  60153. static encryptionLevel(attrs) {
  60154. return new EncryptionLevel(attrs);
  60155. }
  60156. static enforce(attrs) {
  60157. return new Enforce(attrs);
  60158. }
  60159. static equate(attrs) {
  60160. return new Equate(attrs);
  60161. }
  60162. static equateRange(attrs) {
  60163. return new EquateRange(attrs);
  60164. }
  60165. static exclude(attrs) {
  60166. return new Exclude(attrs);
  60167. }
  60168. static excludeNS(attrs) {
  60169. return new ExcludeNS(attrs);
  60170. }
  60171. static flipLabel(attrs) {
  60172. return new FlipLabel(attrs);
  60173. }
  60174. static fontInfo(attrs) {
  60175. return new FontInfo(attrs);
  60176. }
  60177. static formFieldFilling(attrs) {
  60178. return new FormFieldFilling(attrs);
  60179. }
  60180. static groupParent(attrs) {
  60181. return new GroupParent(attrs);
  60182. }
  60183. static ifEmpty(attrs) {
  60184. return new IfEmpty(attrs);
  60185. }
  60186. static includeXDPContent(attrs) {
  60187. return new IncludeXDPContent(attrs);
  60188. }
  60189. static incrementalLoad(attrs) {
  60190. return new IncrementalLoad(attrs);
  60191. }
  60192. static incrementalMerge(attrs) {
  60193. return new IncrementalMerge(attrs);
  60194. }
  60195. static interactive(attrs) {
  60196. return new Interactive(attrs);
  60197. }
  60198. static jog(attrs) {
  60199. return new Jog(attrs);
  60200. }
  60201. static labelPrinter(attrs) {
  60202. return new LabelPrinter(attrs);
  60203. }
  60204. static layout(attrs) {
  60205. return new Layout(attrs);
  60206. }
  60207. static level(attrs) {
  60208. return new Level(attrs);
  60209. }
  60210. static linearized(attrs) {
  60211. return new Linearized(attrs);
  60212. }
  60213. static locale(attrs) {
  60214. return new Locale(attrs);
  60215. }
  60216. static localeSet(attrs) {
  60217. return new LocaleSet(attrs);
  60218. }
  60219. static log(attrs) {
  60220. return new Log(attrs);
  60221. }
  60222. static map(attrs) {
  60223. return new MapElement(attrs);
  60224. }
  60225. static mediumInfo(attrs) {
  60226. return new MediumInfo(attrs);
  60227. }
  60228. static message(attrs) {
  60229. return new Message(attrs);
  60230. }
  60231. static messaging(attrs) {
  60232. return new Messaging(attrs);
  60233. }
  60234. static mode(attrs) {
  60235. return new Mode(attrs);
  60236. }
  60237. static modifyAnnots(attrs) {
  60238. return new ModifyAnnots(attrs);
  60239. }
  60240. static msgId(attrs) {
  60241. return new MsgId(attrs);
  60242. }
  60243. static nameAttr(attrs) {
  60244. return new NameAttr(attrs);
  60245. }
  60246. static neverEmbed(attrs) {
  60247. return new NeverEmbed(attrs);
  60248. }
  60249. static numberOfCopies(attrs) {
  60250. return new NumberOfCopies(attrs);
  60251. }
  60252. static openAction(attrs) {
  60253. return new OpenAction(attrs);
  60254. }
  60255. static output(attrs) {
  60256. return new Output(attrs);
  60257. }
  60258. static outputBin(attrs) {
  60259. return new OutputBin(attrs);
  60260. }
  60261. static outputXSL(attrs) {
  60262. return new OutputXSL(attrs);
  60263. }
  60264. static overprint(attrs) {
  60265. return new Overprint(attrs);
  60266. }
  60267. static packets(attrs) {
  60268. return new Packets(attrs);
  60269. }
  60270. static pageOffset(attrs) {
  60271. return new PageOffset(attrs);
  60272. }
  60273. static pageRange(attrs) {
  60274. return new PageRange(attrs);
  60275. }
  60276. static pagination(attrs) {
  60277. return new Pagination(attrs);
  60278. }
  60279. static paginationOverride(attrs) {
  60280. return new PaginationOverride(attrs);
  60281. }
  60282. static part(attrs) {
  60283. return new Part(attrs);
  60284. }
  60285. static pcl(attrs) {
  60286. return new Pcl(attrs);
  60287. }
  60288. static pdf(attrs) {
  60289. return new Pdf(attrs);
  60290. }
  60291. static pdfa(attrs) {
  60292. return new Pdfa(attrs);
  60293. }
  60294. static permissions(attrs) {
  60295. return new Permissions(attrs);
  60296. }
  60297. static pickTrayByPDFSize(attrs) {
  60298. return new PickTrayByPDFSize(attrs);
  60299. }
  60300. static picture(attrs) {
  60301. return new Picture(attrs);
  60302. }
  60303. static plaintextMetadata(attrs) {
  60304. return new PlaintextMetadata(attrs);
  60305. }
  60306. static presence(attrs) {
  60307. return new Presence(attrs);
  60308. }
  60309. static present(attrs) {
  60310. return new Present(attrs);
  60311. }
  60312. static print(attrs) {
  60313. return new Print(attrs);
  60314. }
  60315. static printHighQuality(attrs) {
  60316. return new PrintHighQuality(attrs);
  60317. }
  60318. static printScaling(attrs) {
  60319. return new PrintScaling(attrs);
  60320. }
  60321. static printerName(attrs) {
  60322. return new PrinterName(attrs);
  60323. }
  60324. static producer(attrs) {
  60325. return new Producer(attrs);
  60326. }
  60327. static ps(attrs) {
  60328. return new Ps(attrs);
  60329. }
  60330. static range(attrs) {
  60331. return new Range(attrs);
  60332. }
  60333. static record(attrs) {
  60334. return new Record(attrs);
  60335. }
  60336. static relevant(attrs) {
  60337. return new Relevant(attrs);
  60338. }
  60339. static rename(attrs) {
  60340. return new Rename(attrs);
  60341. }
  60342. static renderPolicy(attrs) {
  60343. return new RenderPolicy(attrs);
  60344. }
  60345. static runScripts(attrs) {
  60346. return new RunScripts(attrs);
  60347. }
  60348. static script(attrs) {
  60349. return new Script(attrs);
  60350. }
  60351. static scriptModel(attrs) {
  60352. return new ScriptModel(attrs);
  60353. }
  60354. static severity(attrs) {
  60355. return new Severity(attrs);
  60356. }
  60357. static silentPrint(attrs) {
  60358. return new SilentPrint(attrs);
  60359. }
  60360. static staple(attrs) {
  60361. return new Staple(attrs);
  60362. }
  60363. static startNode(attrs) {
  60364. return new StartNode(attrs);
  60365. }
  60366. static startPage(attrs) {
  60367. return new StartPage(attrs);
  60368. }
  60369. static submitFormat(attrs) {
  60370. return new SubmitFormat(attrs);
  60371. }
  60372. static submitUrl(attrs) {
  60373. return new SubmitUrl(attrs);
  60374. }
  60375. static subsetBelow(attrs) {
  60376. return new SubsetBelow(attrs);
  60377. }
  60378. static suppressBanner(attrs) {
  60379. return new SuppressBanner(attrs);
  60380. }
  60381. static tagged(attrs) {
  60382. return new Tagged(attrs);
  60383. }
  60384. static template(attrs) {
  60385. return new Template(attrs);
  60386. }
  60387. static templateCache(attrs) {
  60388. return new TemplateCache(attrs);
  60389. }
  60390. static threshold(attrs) {
  60391. return new Threshold(attrs);
  60392. }
  60393. static to(attrs) {
  60394. return new To(attrs);
  60395. }
  60396. static trace(attrs) {
  60397. return new Trace(attrs);
  60398. }
  60399. static transform(attrs) {
  60400. return new Transform(attrs);
  60401. }
  60402. static type(attrs) {
  60403. return new Type(attrs);
  60404. }
  60405. static uri(attrs) {
  60406. return new Uri(attrs);
  60407. }
  60408. static validate(attrs) {
  60409. return new Validate(attrs);
  60410. }
  60411. static validateApprovalSignatures(attrs) {
  60412. return new ValidateApprovalSignatures(attrs);
  60413. }
  60414. static validationMessaging(attrs) {
  60415. return new ValidationMessaging(attrs);
  60416. }
  60417. static version(attrs) {
  60418. return new Version(attrs);
  60419. }
  60420. static versionControl(attrs) {
  60421. return new VersionControl(attrs);
  60422. }
  60423. static viewerPreferences(attrs) {
  60424. return new ViewerPreferences(attrs);
  60425. }
  60426. static webClient(attrs) {
  60427. return new WebClient(attrs);
  60428. }
  60429. static whitespace(attrs) {
  60430. return new Whitespace(attrs);
  60431. }
  60432. static window(attrs) {
  60433. return new Window(attrs);
  60434. }
  60435. static xdc(attrs) {
  60436. return new Xdc(attrs);
  60437. }
  60438. static xdp(attrs) {
  60439. return new Xdp(attrs);
  60440. }
  60441. static xsl(attrs) {
  60442. return new Xsl(attrs);
  60443. }
  60444. static zpl(attrs) {
  60445. return new Zpl(attrs);
  60446. }
  60447. }
  60448. exports.ConfigNamespace = ConfigNamespace;
  60449. /***/ }),
  60450. /* 92 */
  60451. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60452. Object.defineProperty(exports, "__esModule", ({
  60453. value: true
  60454. }));
  60455. exports.ConnectionSetNamespace = void 0;
  60456. var _namespaces = __w_pdfjs_require__(79);
  60457. var _xfa_object = __w_pdfjs_require__(77);
  60458. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  60459. class ConnectionSet extends _xfa_object.XFAObject {
  60460. constructor(attributes) {
  60461. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  60462. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  60463. this.xmlConnection = new _xfa_object.XFAObjectArray();
  60464. this.xsdConnection = new _xfa_object.XFAObjectArray();
  60465. }
  60466. }
  60467. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  60468. constructor(attributes) {
  60469. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  60470. this.id = attributes.id || "";
  60471. this.name = attributes.name || "";
  60472. this.use = attributes.use || "";
  60473. this.usehref = attributes.usehref || "";
  60474. }
  60475. }
  60476. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  60477. constructor(attributes) {
  60478. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  60479. this.id = attributes.id || "";
  60480. this.name = attributes.name || "";
  60481. this.use = attributes.use || "";
  60482. this.usehref = attributes.usehref || "";
  60483. }
  60484. }
  60485. class Operation extends _xfa_object.StringObject {
  60486. constructor(attributes) {
  60487. super(CONNECTION_SET_NS_ID, "operation");
  60488. this.id = attributes.id || "";
  60489. this.input = attributes.input || "";
  60490. this.name = attributes.name || "";
  60491. this.output = attributes.output || "";
  60492. this.use = attributes.use || "";
  60493. this.usehref = attributes.usehref || "";
  60494. }
  60495. }
  60496. class RootElement extends _xfa_object.StringObject {
  60497. constructor(attributes) {
  60498. super(CONNECTION_SET_NS_ID, "rootElement");
  60499. this.id = attributes.id || "";
  60500. this.name = attributes.name || "";
  60501. this.use = attributes.use || "";
  60502. this.usehref = attributes.usehref || "";
  60503. }
  60504. }
  60505. class SoapAction extends _xfa_object.StringObject {
  60506. constructor(attributes) {
  60507. super(CONNECTION_SET_NS_ID, "soapAction");
  60508. this.id = attributes.id || "";
  60509. this.name = attributes.name || "";
  60510. this.use = attributes.use || "";
  60511. this.usehref = attributes.usehref || "";
  60512. }
  60513. }
  60514. class SoapAddress extends _xfa_object.StringObject {
  60515. constructor(attributes) {
  60516. super(CONNECTION_SET_NS_ID, "soapAddress");
  60517. this.id = attributes.id || "";
  60518. this.name = attributes.name || "";
  60519. this.use = attributes.use || "";
  60520. this.usehref = attributes.usehref || "";
  60521. }
  60522. }
  60523. class Uri extends _xfa_object.StringObject {
  60524. constructor(attributes) {
  60525. super(CONNECTION_SET_NS_ID, "uri");
  60526. this.id = attributes.id || "";
  60527. this.name = attributes.name || "";
  60528. this.use = attributes.use || "";
  60529. this.usehref = attributes.usehref || "";
  60530. }
  60531. }
  60532. class WsdlAddress extends _xfa_object.StringObject {
  60533. constructor(attributes) {
  60534. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  60535. this.id = attributes.id || "";
  60536. this.name = attributes.name || "";
  60537. this.use = attributes.use || "";
  60538. this.usehref = attributes.usehref || "";
  60539. }
  60540. }
  60541. class WsdlConnection extends _xfa_object.XFAObject {
  60542. constructor(attributes) {
  60543. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  60544. this.dataDescription = attributes.dataDescription || "";
  60545. this.name = attributes.name || "";
  60546. this.effectiveInputPolicy = null;
  60547. this.effectiveOutputPolicy = null;
  60548. this.operation = null;
  60549. this.soapAction = null;
  60550. this.soapAddress = null;
  60551. this.wsdlAddress = null;
  60552. }
  60553. }
  60554. class XmlConnection extends _xfa_object.XFAObject {
  60555. constructor(attributes) {
  60556. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  60557. this.dataDescription = attributes.dataDescription || "";
  60558. this.name = attributes.name || "";
  60559. this.uri = null;
  60560. }
  60561. }
  60562. class XsdConnection extends _xfa_object.XFAObject {
  60563. constructor(attributes) {
  60564. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  60565. this.dataDescription = attributes.dataDescription || "";
  60566. this.name = attributes.name || "";
  60567. this.rootElement = null;
  60568. this.uri = null;
  60569. }
  60570. }
  60571. class ConnectionSetNamespace {
  60572. static [_namespaces.$buildXFAObject](name, attributes) {
  60573. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  60574. return ConnectionSetNamespace[name](attributes);
  60575. }
  60576. return undefined;
  60577. }
  60578. static connectionSet(attrs) {
  60579. return new ConnectionSet(attrs);
  60580. }
  60581. static effectiveInputPolicy(attrs) {
  60582. return new EffectiveInputPolicy(attrs);
  60583. }
  60584. static effectiveOutputPolicy(attrs) {
  60585. return new EffectiveOutputPolicy(attrs);
  60586. }
  60587. static operation(attrs) {
  60588. return new Operation(attrs);
  60589. }
  60590. static rootElement(attrs) {
  60591. return new RootElement(attrs);
  60592. }
  60593. static soapAction(attrs) {
  60594. return new SoapAction(attrs);
  60595. }
  60596. static soapAddress(attrs) {
  60597. return new SoapAddress(attrs);
  60598. }
  60599. static uri(attrs) {
  60600. return new Uri(attrs);
  60601. }
  60602. static wsdlAddress(attrs) {
  60603. return new WsdlAddress(attrs);
  60604. }
  60605. static wsdlConnection(attrs) {
  60606. return new WsdlConnection(attrs);
  60607. }
  60608. static xmlConnection(attrs) {
  60609. return new XmlConnection(attrs);
  60610. }
  60611. static xsdConnection(attrs) {
  60612. return new XsdConnection(attrs);
  60613. }
  60614. }
  60615. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  60616. /***/ }),
  60617. /* 93 */
  60618. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60619. Object.defineProperty(exports, "__esModule", ({
  60620. value: true
  60621. }));
  60622. exports.DatasetsNamespace = void 0;
  60623. var _xfa_object = __w_pdfjs_require__(77);
  60624. var _namespaces = __w_pdfjs_require__(79);
  60625. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  60626. class Data extends _xfa_object.XmlObject {
  60627. constructor(attributes) {
  60628. super(DATASETS_NS_ID, "data", attributes);
  60629. }
  60630. [_xfa_object.$isNsAgnostic]() {
  60631. return true;
  60632. }
  60633. }
  60634. class Datasets extends _xfa_object.XFAObject {
  60635. constructor(attributes) {
  60636. super(DATASETS_NS_ID, "datasets", true);
  60637. this.data = null;
  60638. this.Signature = null;
  60639. }
  60640. [_xfa_object.$onChild](child) {
  60641. const name = child[_xfa_object.$nodeName];
  60642. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  60643. this[name] = child;
  60644. }
  60645. this[_xfa_object.$appendChild](child);
  60646. }
  60647. }
  60648. class DatasetsNamespace {
  60649. static [_namespaces.$buildXFAObject](name, attributes) {
  60650. if (DatasetsNamespace.hasOwnProperty(name)) {
  60651. return DatasetsNamespace[name](attributes);
  60652. }
  60653. return undefined;
  60654. }
  60655. static datasets(attributes) {
  60656. return new Datasets(attributes);
  60657. }
  60658. static data(attributes) {
  60659. return new Data(attributes);
  60660. }
  60661. }
  60662. exports.DatasetsNamespace = DatasetsNamespace;
  60663. /***/ }),
  60664. /* 94 */
  60665. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60666. Object.defineProperty(exports, "__esModule", ({
  60667. value: true
  60668. }));
  60669. exports.LocaleSetNamespace = void 0;
  60670. var _namespaces = __w_pdfjs_require__(79);
  60671. var _xfa_object = __w_pdfjs_require__(77);
  60672. var _utils = __w_pdfjs_require__(78);
  60673. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  60674. class CalendarSymbols extends _xfa_object.XFAObject {
  60675. constructor(attributes) {
  60676. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  60677. this.name = "gregorian";
  60678. this.dayNames = new _xfa_object.XFAObjectArray(2);
  60679. this.eraNames = null;
  60680. this.meridiemNames = null;
  60681. this.monthNames = new _xfa_object.XFAObjectArray(2);
  60682. }
  60683. }
  60684. class CurrencySymbol extends _xfa_object.StringObject {
  60685. constructor(attributes) {
  60686. super(LOCALE_SET_NS_ID, "currencySymbol");
  60687. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  60688. }
  60689. }
  60690. class CurrencySymbols extends _xfa_object.XFAObject {
  60691. constructor(attributes) {
  60692. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  60693. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  60694. }
  60695. }
  60696. class DatePattern extends _xfa_object.StringObject {
  60697. constructor(attributes) {
  60698. super(LOCALE_SET_NS_ID, "datePattern");
  60699. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60700. }
  60701. }
  60702. class DatePatterns extends _xfa_object.XFAObject {
  60703. constructor(attributes) {
  60704. super(LOCALE_SET_NS_ID, "datePatterns", true);
  60705. this.datePattern = new _xfa_object.XFAObjectArray(4);
  60706. }
  60707. }
  60708. class DateTimeSymbols extends _xfa_object.ContentObject {
  60709. constructor(attributes) {
  60710. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  60711. }
  60712. }
  60713. class Day extends _xfa_object.StringObject {
  60714. constructor(attributes) {
  60715. super(LOCALE_SET_NS_ID, "day");
  60716. }
  60717. }
  60718. class DayNames extends _xfa_object.XFAObject {
  60719. constructor(attributes) {
  60720. super(LOCALE_SET_NS_ID, "dayNames", true);
  60721. this.abbr = (0, _utils.getInteger)({
  60722. data: attributes.abbr,
  60723. defaultValue: 0,
  60724. validate: x => x === 1
  60725. });
  60726. this.day = new _xfa_object.XFAObjectArray(7);
  60727. }
  60728. }
  60729. class Era extends _xfa_object.StringObject {
  60730. constructor(attributes) {
  60731. super(LOCALE_SET_NS_ID, "era");
  60732. }
  60733. }
  60734. class EraNames extends _xfa_object.XFAObject {
  60735. constructor(attributes) {
  60736. super(LOCALE_SET_NS_ID, "eraNames", true);
  60737. this.era = new _xfa_object.XFAObjectArray(2);
  60738. }
  60739. }
  60740. class Locale extends _xfa_object.XFAObject {
  60741. constructor(attributes) {
  60742. super(LOCALE_SET_NS_ID, "locale", true);
  60743. this.desc = attributes.desc || "";
  60744. this.name = "isoname";
  60745. this.calendarSymbols = null;
  60746. this.currencySymbols = null;
  60747. this.datePatterns = null;
  60748. this.dateTimeSymbols = null;
  60749. this.numberPatterns = null;
  60750. this.numberSymbols = null;
  60751. this.timePatterns = null;
  60752. this.typeFaces = null;
  60753. }
  60754. }
  60755. class LocaleSet extends _xfa_object.XFAObject {
  60756. constructor(attributes) {
  60757. super(LOCALE_SET_NS_ID, "localeSet", true);
  60758. this.locale = new _xfa_object.XFAObjectArray();
  60759. }
  60760. }
  60761. class Meridiem extends _xfa_object.StringObject {
  60762. constructor(attributes) {
  60763. super(LOCALE_SET_NS_ID, "meridiem");
  60764. }
  60765. }
  60766. class MeridiemNames extends _xfa_object.XFAObject {
  60767. constructor(attributes) {
  60768. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  60769. this.meridiem = new _xfa_object.XFAObjectArray(2);
  60770. }
  60771. }
  60772. class Month extends _xfa_object.StringObject {
  60773. constructor(attributes) {
  60774. super(LOCALE_SET_NS_ID, "month");
  60775. }
  60776. }
  60777. class MonthNames extends _xfa_object.XFAObject {
  60778. constructor(attributes) {
  60779. super(LOCALE_SET_NS_ID, "monthNames", true);
  60780. this.abbr = (0, _utils.getInteger)({
  60781. data: attributes.abbr,
  60782. defaultValue: 0,
  60783. validate: x => x === 1
  60784. });
  60785. this.month = new _xfa_object.XFAObjectArray(12);
  60786. }
  60787. }
  60788. class NumberPattern extends _xfa_object.StringObject {
  60789. constructor(attributes) {
  60790. super(LOCALE_SET_NS_ID, "numberPattern");
  60791. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60792. }
  60793. }
  60794. class NumberPatterns extends _xfa_object.XFAObject {
  60795. constructor(attributes) {
  60796. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  60797. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  60798. }
  60799. }
  60800. class NumberSymbol extends _xfa_object.StringObject {
  60801. constructor(attributes) {
  60802. super(LOCALE_SET_NS_ID, "numberSymbol");
  60803. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  60804. }
  60805. }
  60806. class NumberSymbols extends _xfa_object.XFAObject {
  60807. constructor(attributes) {
  60808. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  60809. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  60810. }
  60811. }
  60812. class TimePattern extends _xfa_object.StringObject {
  60813. constructor(attributes) {
  60814. super(LOCALE_SET_NS_ID, "timePattern");
  60815. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60816. }
  60817. }
  60818. class TimePatterns extends _xfa_object.XFAObject {
  60819. constructor(attributes) {
  60820. super(LOCALE_SET_NS_ID, "timePatterns", true);
  60821. this.timePattern = new _xfa_object.XFAObjectArray(4);
  60822. }
  60823. }
  60824. class TypeFace extends _xfa_object.XFAObject {
  60825. constructor(attributes) {
  60826. super(LOCALE_SET_NS_ID, "typeFace", true);
  60827. this.name = attributes.name | "";
  60828. }
  60829. }
  60830. class TypeFaces extends _xfa_object.XFAObject {
  60831. constructor(attributes) {
  60832. super(LOCALE_SET_NS_ID, "typeFaces", true);
  60833. this.typeFace = new _xfa_object.XFAObjectArray();
  60834. }
  60835. }
  60836. class LocaleSetNamespace {
  60837. static [_namespaces.$buildXFAObject](name, attributes) {
  60838. if (LocaleSetNamespace.hasOwnProperty(name)) {
  60839. return LocaleSetNamespace[name](attributes);
  60840. }
  60841. return undefined;
  60842. }
  60843. static calendarSymbols(attrs) {
  60844. return new CalendarSymbols(attrs);
  60845. }
  60846. static currencySymbol(attrs) {
  60847. return new CurrencySymbol(attrs);
  60848. }
  60849. static currencySymbols(attrs) {
  60850. return new CurrencySymbols(attrs);
  60851. }
  60852. static datePattern(attrs) {
  60853. return new DatePattern(attrs);
  60854. }
  60855. static datePatterns(attrs) {
  60856. return new DatePatterns(attrs);
  60857. }
  60858. static dateTimeSymbols(attrs) {
  60859. return new DateTimeSymbols(attrs);
  60860. }
  60861. static day(attrs) {
  60862. return new Day(attrs);
  60863. }
  60864. static dayNames(attrs) {
  60865. return new DayNames(attrs);
  60866. }
  60867. static era(attrs) {
  60868. return new Era(attrs);
  60869. }
  60870. static eraNames(attrs) {
  60871. return new EraNames(attrs);
  60872. }
  60873. static locale(attrs) {
  60874. return new Locale(attrs);
  60875. }
  60876. static localeSet(attrs) {
  60877. return new LocaleSet(attrs);
  60878. }
  60879. static meridiem(attrs) {
  60880. return new Meridiem(attrs);
  60881. }
  60882. static meridiemNames(attrs) {
  60883. return new MeridiemNames(attrs);
  60884. }
  60885. static month(attrs) {
  60886. return new Month(attrs);
  60887. }
  60888. static monthNames(attrs) {
  60889. return new MonthNames(attrs);
  60890. }
  60891. static numberPattern(attrs) {
  60892. return new NumberPattern(attrs);
  60893. }
  60894. static numberPatterns(attrs) {
  60895. return new NumberPatterns(attrs);
  60896. }
  60897. static numberSymbol(attrs) {
  60898. return new NumberSymbol(attrs);
  60899. }
  60900. static numberSymbols(attrs) {
  60901. return new NumberSymbols(attrs);
  60902. }
  60903. static timePattern(attrs) {
  60904. return new TimePattern(attrs);
  60905. }
  60906. static timePatterns(attrs) {
  60907. return new TimePatterns(attrs);
  60908. }
  60909. static typeFace(attrs) {
  60910. return new TypeFace(attrs);
  60911. }
  60912. static typeFaces(attrs) {
  60913. return new TypeFaces(attrs);
  60914. }
  60915. }
  60916. exports.LocaleSetNamespace = LocaleSetNamespace;
  60917. /***/ }),
  60918. /* 95 */
  60919. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60920. Object.defineProperty(exports, "__esModule", ({
  60921. value: true
  60922. }));
  60923. exports.SignatureNamespace = void 0;
  60924. var _namespaces = __w_pdfjs_require__(79);
  60925. var _xfa_object = __w_pdfjs_require__(77);
  60926. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  60927. class Signature extends _xfa_object.XFAObject {
  60928. constructor(attributes) {
  60929. super(SIGNATURE_NS_ID, "signature", true);
  60930. }
  60931. }
  60932. class SignatureNamespace {
  60933. static [_namespaces.$buildXFAObject](name, attributes) {
  60934. if (SignatureNamespace.hasOwnProperty(name)) {
  60935. return SignatureNamespace[name](attributes);
  60936. }
  60937. return undefined;
  60938. }
  60939. static signature(attributes) {
  60940. return new Signature(attributes);
  60941. }
  60942. }
  60943. exports.SignatureNamespace = SignatureNamespace;
  60944. /***/ }),
  60945. /* 96 */
  60946. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60947. Object.defineProperty(exports, "__esModule", ({
  60948. value: true
  60949. }));
  60950. exports.StylesheetNamespace = void 0;
  60951. var _namespaces = __w_pdfjs_require__(79);
  60952. var _xfa_object = __w_pdfjs_require__(77);
  60953. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  60954. class Stylesheet extends _xfa_object.XFAObject {
  60955. constructor(attributes) {
  60956. super(STYLESHEET_NS_ID, "stylesheet", true);
  60957. }
  60958. }
  60959. class StylesheetNamespace {
  60960. static [_namespaces.$buildXFAObject](name, attributes) {
  60961. if (StylesheetNamespace.hasOwnProperty(name)) {
  60962. return StylesheetNamespace[name](attributes);
  60963. }
  60964. return undefined;
  60965. }
  60966. static stylesheet(attributes) {
  60967. return new Stylesheet(attributes);
  60968. }
  60969. }
  60970. exports.StylesheetNamespace = StylesheetNamespace;
  60971. /***/ }),
  60972. /* 97 */
  60973. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60974. Object.defineProperty(exports, "__esModule", ({
  60975. value: true
  60976. }));
  60977. exports.XdpNamespace = void 0;
  60978. var _namespaces = __w_pdfjs_require__(79);
  60979. var _xfa_object = __w_pdfjs_require__(77);
  60980. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  60981. class Xdp extends _xfa_object.XFAObject {
  60982. constructor(attributes) {
  60983. super(XDP_NS_ID, "xdp", true);
  60984. this.uuid = attributes.uuid || "";
  60985. this.timeStamp = attributes.timeStamp || "";
  60986. this.config = null;
  60987. this.connectionSet = null;
  60988. this.datasets = null;
  60989. this.localeSet = null;
  60990. this.stylesheet = new _xfa_object.XFAObjectArray();
  60991. this.template = null;
  60992. }
  60993. [_xfa_object.$onChildCheck](child) {
  60994. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  60995. return ns && child[_xfa_object.$namespaceId] === ns.id;
  60996. }
  60997. }
  60998. class XdpNamespace {
  60999. static [_namespaces.$buildXFAObject](name, attributes) {
  61000. if (XdpNamespace.hasOwnProperty(name)) {
  61001. return XdpNamespace[name](attributes);
  61002. }
  61003. return undefined;
  61004. }
  61005. static xdp(attributes) {
  61006. return new Xdp(attributes);
  61007. }
  61008. }
  61009. exports.XdpNamespace = XdpNamespace;
  61010. /***/ }),
  61011. /* 98 */
  61012. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61013. Object.defineProperty(exports, "__esModule", ({
  61014. value: true
  61015. }));
  61016. exports.XhtmlNamespace = void 0;
  61017. var _xfa_object = __w_pdfjs_require__(77);
  61018. var _namespaces = __w_pdfjs_require__(79);
  61019. var _html_utils = __w_pdfjs_require__(84);
  61020. var _utils = __w_pdfjs_require__(78);
  61021. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  61022. const $richText = Symbol();
  61023. 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"]);
  61024. 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) => {
  61025. value = original.fontSize = (0, _utils.getMeasurement)(value);
  61026. return (0, _html_utils.measureToString)(0.99 * value);
  61027. }], ["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))]]);
  61028. const spacesRegExp = /\s+/g;
  61029. const crlfRegExp = /[\r\n]+/g;
  61030. const crlfForRichTextRegExp = /\r\n?/g;
  61031. function mapStyle(styleStr, node, richText) {
  61032. const style = Object.create(null);
  61033. if (!styleStr) {
  61034. return style;
  61035. }
  61036. const original = Object.create(null);
  61037. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  61038. const mapping = StyleMapping.get(key);
  61039. if (mapping === "") {
  61040. continue;
  61041. }
  61042. let newValue = value;
  61043. if (mapping) {
  61044. if (typeof mapping === "string") {
  61045. newValue = mapping;
  61046. } else {
  61047. newValue = mapping(value, original);
  61048. }
  61049. }
  61050. if (key.endsWith("scale")) {
  61051. if (style.transform) {
  61052. style.transform = `${style[key]} ${newValue}`;
  61053. } else {
  61054. style.transform = newValue;
  61055. }
  61056. } else {
  61057. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  61058. }
  61059. }
  61060. if (style.fontFamily) {
  61061. (0, _html_utils.setFontFamily)({
  61062. typeface: style.fontFamily,
  61063. weight: style.fontWeight || "normal",
  61064. posture: style.fontStyle || "normal",
  61065. size: original.fontSize || 0
  61066. }, node, node[_xfa_object.$globalData].fontFinder, style);
  61067. }
  61068. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  61069. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  61070. const VERTICAL_FACTOR = 0.333;
  61071. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  61072. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  61073. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  61074. }
  61075. (0, _html_utils.fixTextIndent)(style);
  61076. return style;
  61077. }
  61078. function checkStyle(node) {
  61079. if (!node.style) {
  61080. return "";
  61081. }
  61082. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  61083. if (key === "font-family") {
  61084. node[_xfa_object.$globalData].usedTypefaces.add(value);
  61085. }
  61086. return VALID_STYLES.has(key);
  61087. }).map(kv => kv.join(":")).join(";");
  61088. }
  61089. const NoWhites = new Set(["body", "html"]);
  61090. class XhtmlObject extends _xfa_object.XmlObject {
  61091. constructor(attributes, name) {
  61092. super(XHTML_NS_ID, name);
  61093. this[$richText] = false;
  61094. this.style = attributes.style || "";
  61095. }
  61096. [_xfa_object.$clean](builder) {
  61097. super[_xfa_object.$clean](builder);
  61098. this.style = checkStyle(this);
  61099. }
  61100. [_xfa_object.$acceptWhitespace]() {
  61101. return !NoWhites.has(this[_xfa_object.$nodeName]);
  61102. }
  61103. [_xfa_object.$onText](str, richText = false) {
  61104. if (!richText) {
  61105. str = str.replace(crlfRegExp, "");
  61106. if (!this.style.includes("xfa-spacerun:yes")) {
  61107. str = str.replace(spacesRegExp, " ");
  61108. }
  61109. } else {
  61110. this[$richText] = true;
  61111. }
  61112. if (str) {
  61113. this[_xfa_object.$content] += str;
  61114. }
  61115. }
  61116. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  61117. const xfaFont = Object.create(null);
  61118. const margin = {
  61119. top: NaN,
  61120. bottom: NaN,
  61121. left: NaN,
  61122. right: NaN
  61123. };
  61124. let lineHeight = null;
  61125. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  61126. switch (key) {
  61127. case "font-family":
  61128. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  61129. break;
  61130. case "font-size":
  61131. xfaFont.size = (0, _utils.getMeasurement)(value);
  61132. break;
  61133. case "font-weight":
  61134. xfaFont.weight = value;
  61135. break;
  61136. case "font-style":
  61137. xfaFont.posture = value;
  61138. break;
  61139. case "letter-spacing":
  61140. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  61141. break;
  61142. case "margin":
  61143. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  61144. switch (values.length) {
  61145. case 1:
  61146. margin.top = margin.bottom = margin.left = margin.right = values[0];
  61147. break;
  61148. case 2:
  61149. margin.top = margin.bottom = values[0];
  61150. margin.left = margin.right = values[1];
  61151. break;
  61152. case 3:
  61153. margin.top = values[0];
  61154. margin.bottom = values[2];
  61155. margin.left = margin.right = values[1];
  61156. break;
  61157. case 4:
  61158. margin.top = values[0];
  61159. margin.left = values[1];
  61160. margin.bottom = values[2];
  61161. margin.right = values[3];
  61162. break;
  61163. }
  61164. break;
  61165. case "margin-top":
  61166. margin.top = (0, _utils.getMeasurement)(value);
  61167. break;
  61168. case "margin-bottom":
  61169. margin.bottom = (0, _utils.getMeasurement)(value);
  61170. break;
  61171. case "margin-left":
  61172. margin.left = (0, _utils.getMeasurement)(value);
  61173. break;
  61174. case "margin-right":
  61175. margin.right = (0, _utils.getMeasurement)(value);
  61176. break;
  61177. case "line-height":
  61178. lineHeight = (0, _utils.getMeasurement)(value);
  61179. break;
  61180. }
  61181. }
  61182. measure.pushData(xfaFont, margin, lineHeight);
  61183. if (this[_xfa_object.$content]) {
  61184. measure.addString(this[_xfa_object.$content]);
  61185. } else {
  61186. for (const child of this[_xfa_object.$getChildren]()) {
  61187. if (child[_xfa_object.$nodeName] === "#text") {
  61188. measure.addString(child[_xfa_object.$content]);
  61189. continue;
  61190. }
  61191. child[_xfa_object.$pushGlyphs](measure);
  61192. }
  61193. }
  61194. if (mustPop) {
  61195. measure.popFont();
  61196. }
  61197. }
  61198. [_xfa_object.$toHTML](availableSpace) {
  61199. const children = [];
  61200. this[_xfa_object.$extra] = {
  61201. children
  61202. };
  61203. this[_xfa_object.$childrenToHTML]({});
  61204. if (children.length === 0 && !this[_xfa_object.$content]) {
  61205. return _utils.HTMLResult.EMPTY;
  61206. }
  61207. let value;
  61208. if (this[$richText]) {
  61209. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  61210. } else {
  61211. value = this[_xfa_object.$content] || undefined;
  61212. }
  61213. return _utils.HTMLResult.success({
  61214. name: this[_xfa_object.$nodeName],
  61215. attributes: {
  61216. href: this.href,
  61217. style: mapStyle(this.style, this, this[$richText])
  61218. },
  61219. children,
  61220. value
  61221. });
  61222. }
  61223. }
  61224. class A extends XhtmlObject {
  61225. constructor(attributes) {
  61226. super(attributes, "a");
  61227. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  61228. }
  61229. }
  61230. class B extends XhtmlObject {
  61231. constructor(attributes) {
  61232. super(attributes, "b");
  61233. }
  61234. [_xfa_object.$pushGlyphs](measure) {
  61235. measure.pushFont({
  61236. weight: "bold"
  61237. });
  61238. super[_xfa_object.$pushGlyphs](measure);
  61239. measure.popFont();
  61240. }
  61241. }
  61242. class Body extends XhtmlObject {
  61243. constructor(attributes) {
  61244. super(attributes, "body");
  61245. }
  61246. [_xfa_object.$toHTML](availableSpace) {
  61247. const res = super[_xfa_object.$toHTML](availableSpace);
  61248. const {
  61249. html
  61250. } = res;
  61251. if (!html) {
  61252. return _utils.HTMLResult.EMPTY;
  61253. }
  61254. html.name = "div";
  61255. html.attributes.class = ["xfaRich"];
  61256. return res;
  61257. }
  61258. }
  61259. class Br extends XhtmlObject {
  61260. constructor(attributes) {
  61261. super(attributes, "br");
  61262. }
  61263. [_xfa_object.$text]() {
  61264. return "\n";
  61265. }
  61266. [_xfa_object.$pushGlyphs](measure) {
  61267. measure.addString("\n");
  61268. }
  61269. [_xfa_object.$toHTML](availableSpace) {
  61270. return _utils.HTMLResult.success({
  61271. name: "br"
  61272. });
  61273. }
  61274. }
  61275. class Html extends XhtmlObject {
  61276. constructor(attributes) {
  61277. super(attributes, "html");
  61278. }
  61279. [_xfa_object.$toHTML](availableSpace) {
  61280. const children = [];
  61281. this[_xfa_object.$extra] = {
  61282. children
  61283. };
  61284. this[_xfa_object.$childrenToHTML]({});
  61285. if (children.length === 0) {
  61286. return _utils.HTMLResult.success({
  61287. name: "div",
  61288. attributes: {
  61289. class: ["xfaRich"],
  61290. style: {}
  61291. },
  61292. value: this[_xfa_object.$content] || ""
  61293. });
  61294. }
  61295. if (children.length === 1) {
  61296. const child = children[0];
  61297. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  61298. return _utils.HTMLResult.success(child);
  61299. }
  61300. }
  61301. return _utils.HTMLResult.success({
  61302. name: "div",
  61303. attributes: {
  61304. class: ["xfaRich"],
  61305. style: {}
  61306. },
  61307. children
  61308. });
  61309. }
  61310. }
  61311. class I extends XhtmlObject {
  61312. constructor(attributes) {
  61313. super(attributes, "i");
  61314. }
  61315. [_xfa_object.$pushGlyphs](measure) {
  61316. measure.pushFont({
  61317. posture: "italic"
  61318. });
  61319. super[_xfa_object.$pushGlyphs](measure);
  61320. measure.popFont();
  61321. }
  61322. }
  61323. class Li extends XhtmlObject {
  61324. constructor(attributes) {
  61325. super(attributes, "li");
  61326. }
  61327. }
  61328. class Ol extends XhtmlObject {
  61329. constructor(attributes) {
  61330. super(attributes, "ol");
  61331. }
  61332. }
  61333. class P extends XhtmlObject {
  61334. constructor(attributes) {
  61335. super(attributes, "p");
  61336. }
  61337. [_xfa_object.$pushGlyphs](measure) {
  61338. super[_xfa_object.$pushGlyphs](measure, false);
  61339. measure.addString("\n");
  61340. measure.addPara();
  61341. measure.popFont();
  61342. }
  61343. [_xfa_object.$text]() {
  61344. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  61345. if (siblings[siblings.length - 1] === this) {
  61346. return super[_xfa_object.$text]();
  61347. }
  61348. return super[_xfa_object.$text]() + "\n";
  61349. }
  61350. }
  61351. class Span extends XhtmlObject {
  61352. constructor(attributes) {
  61353. super(attributes, "span");
  61354. }
  61355. }
  61356. class Sub extends XhtmlObject {
  61357. constructor(attributes) {
  61358. super(attributes, "sub");
  61359. }
  61360. }
  61361. class Sup extends XhtmlObject {
  61362. constructor(attributes) {
  61363. super(attributes, "sup");
  61364. }
  61365. }
  61366. class Ul extends XhtmlObject {
  61367. constructor(attributes) {
  61368. super(attributes, "ul");
  61369. }
  61370. }
  61371. class XhtmlNamespace {
  61372. static [_namespaces.$buildXFAObject](name, attributes) {
  61373. if (XhtmlNamespace.hasOwnProperty(name)) {
  61374. return XhtmlNamespace[name](attributes);
  61375. }
  61376. return undefined;
  61377. }
  61378. static a(attributes) {
  61379. return new A(attributes);
  61380. }
  61381. static b(attributes) {
  61382. return new B(attributes);
  61383. }
  61384. static body(attributes) {
  61385. return new Body(attributes);
  61386. }
  61387. static br(attributes) {
  61388. return new Br(attributes);
  61389. }
  61390. static html(attributes) {
  61391. return new Html(attributes);
  61392. }
  61393. static i(attributes) {
  61394. return new I(attributes);
  61395. }
  61396. static li(attributes) {
  61397. return new Li(attributes);
  61398. }
  61399. static ol(attributes) {
  61400. return new Ol(attributes);
  61401. }
  61402. static p(attributes) {
  61403. return new P(attributes);
  61404. }
  61405. static span(attributes) {
  61406. return new Span(attributes);
  61407. }
  61408. static sub(attributes) {
  61409. return new Sub(attributes);
  61410. }
  61411. static sup(attributes) {
  61412. return new Sup(attributes);
  61413. }
  61414. static ul(attributes) {
  61415. return new Ul(attributes);
  61416. }
  61417. }
  61418. exports.XhtmlNamespace = XhtmlNamespace;
  61419. /***/ }),
  61420. /* 99 */
  61421. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61422. Object.defineProperty(exports, "__esModule", ({
  61423. value: true
  61424. }));
  61425. exports.UnknownNamespace = void 0;
  61426. var _namespaces = __w_pdfjs_require__(79);
  61427. var _xfa_object = __w_pdfjs_require__(77);
  61428. class UnknownNamespace {
  61429. constructor(nsId) {
  61430. this.namespaceId = nsId;
  61431. }
  61432. [_namespaces.$buildXFAObject](name, attributes) {
  61433. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  61434. }
  61435. }
  61436. exports.UnknownNamespace = UnknownNamespace;
  61437. /***/ }),
  61438. /* 100 */
  61439. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61440. Object.defineProperty(exports, "__esModule", ({
  61441. value: true
  61442. }));
  61443. exports.DatasetReader = void 0;
  61444. var _util = __w_pdfjs_require__(2);
  61445. var _core_utils = __w_pdfjs_require__(8);
  61446. var _xml_parser = __w_pdfjs_require__(70);
  61447. function decodeString(str) {
  61448. try {
  61449. return (0, _util.stringToUTF8String)(str);
  61450. } catch (ex) {
  61451. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  61452. return str;
  61453. }
  61454. }
  61455. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  61456. constructor(options) {
  61457. super(options);
  61458. this.node = null;
  61459. }
  61460. onEndElement(name) {
  61461. const node = super.onEndElement(name);
  61462. if (node && name === "xfa:datasets") {
  61463. this.node = node;
  61464. throw new Error("Aborting DatasetXMLParser.");
  61465. }
  61466. }
  61467. }
  61468. class DatasetReader {
  61469. constructor(data) {
  61470. if (data.datasets) {
  61471. this.node = new _xml_parser.SimpleXMLParser({
  61472. hasAttributes: true
  61473. }).parseFromString(data.datasets).documentElement;
  61474. } else {
  61475. const parser = new DatasetXMLParser({
  61476. hasAttributes: true
  61477. });
  61478. try {
  61479. parser.parseFromString(data["xdp:xdp"]);
  61480. } catch (_) {}
  61481. this.node = parser.node;
  61482. }
  61483. }
  61484. getValue(path) {
  61485. if (!this.node || !path) {
  61486. return "";
  61487. }
  61488. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  61489. if (!node) {
  61490. return "";
  61491. }
  61492. const first = node.firstChild;
  61493. if (first && first.nodeName === "value") {
  61494. return node.children.map(child => decodeString(child.textContent));
  61495. }
  61496. return decodeString(node.textContent);
  61497. }
  61498. }
  61499. exports.DatasetReader = DatasetReader;
  61500. /***/ }),
  61501. /* 101 */
  61502. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61503. Object.defineProperty(exports, "__esModule", ({
  61504. value: true
  61505. }));
  61506. exports.XRef = void 0;
  61507. var _util = __w_pdfjs_require__(2);
  61508. var _primitives = __w_pdfjs_require__(5);
  61509. var _core_utils = __w_pdfjs_require__(8);
  61510. var _parser = __w_pdfjs_require__(27);
  61511. var _base_stream = __w_pdfjs_require__(9);
  61512. var _crypto = __w_pdfjs_require__(74);
  61513. class XRef {
  61514. constructor(stream, pdfManager) {
  61515. this.stream = stream;
  61516. this.pdfManager = pdfManager;
  61517. this.entries = [];
  61518. this.xrefstms = Object.create(null);
  61519. this._cacheMap = new Map();
  61520. this._pendingRefs = new _primitives.RefSet();
  61521. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  61522. this._newRefNum = null;
  61523. }
  61524. getNewRef() {
  61525. if (this._newRefNum === null) {
  61526. this._newRefNum = this.entries.length;
  61527. }
  61528. return _primitives.Ref.get(this._newRefNum++, 0);
  61529. }
  61530. resetNewRef() {
  61531. this._newRefNum = null;
  61532. }
  61533. setStartXRef(startXRef) {
  61534. this.startXRefQueue = [startXRef];
  61535. }
  61536. parse(recoveryMode = false) {
  61537. let trailerDict;
  61538. if (!recoveryMode) {
  61539. trailerDict = this.readXRef();
  61540. } else {
  61541. (0, _util.warn)("Indexing all PDF objects");
  61542. trailerDict = this.indexObjects();
  61543. }
  61544. trailerDict.assignXref(this);
  61545. this.trailer = trailerDict;
  61546. let encrypt;
  61547. try {
  61548. encrypt = trailerDict.get("Encrypt");
  61549. } catch (ex) {
  61550. if (ex instanceof _core_utils.MissingDataException) {
  61551. throw ex;
  61552. }
  61553. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  61554. }
  61555. if (encrypt instanceof _primitives.Dict) {
  61556. const ids = trailerDict.get("ID");
  61557. const fileId = ids && ids.length ? ids[0] : "";
  61558. encrypt.suppressEncryption = true;
  61559. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  61560. }
  61561. let root;
  61562. try {
  61563. root = trailerDict.get("Root");
  61564. } catch (ex) {
  61565. if (ex instanceof _core_utils.MissingDataException) {
  61566. throw ex;
  61567. }
  61568. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  61569. }
  61570. if (root instanceof _primitives.Dict) {
  61571. try {
  61572. const pages = root.get("Pages");
  61573. if (pages instanceof _primitives.Dict) {
  61574. this.root = root;
  61575. return;
  61576. }
  61577. } catch (ex) {
  61578. if (ex instanceof _core_utils.MissingDataException) {
  61579. throw ex;
  61580. }
  61581. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  61582. }
  61583. }
  61584. if (!recoveryMode) {
  61585. throw new _core_utils.XRefParseException();
  61586. }
  61587. throw new _util.InvalidPDFException("Invalid Root reference.");
  61588. }
  61589. processXRefTable(parser) {
  61590. if (!("tableState" in this)) {
  61591. this.tableState = {
  61592. entryNum: 0,
  61593. streamPos: parser.lexer.stream.pos,
  61594. parserBuf1: parser.buf1,
  61595. parserBuf2: parser.buf2
  61596. };
  61597. }
  61598. const obj = this.readXRefTable(parser);
  61599. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61600. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  61601. }
  61602. let dict = parser.getObj();
  61603. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  61604. dict = dict.dict;
  61605. }
  61606. if (!(dict instanceof _primitives.Dict)) {
  61607. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  61608. }
  61609. delete this.tableState;
  61610. return dict;
  61611. }
  61612. readXRefTable(parser) {
  61613. const stream = parser.lexer.stream;
  61614. const tableState = this.tableState;
  61615. stream.pos = tableState.streamPos;
  61616. parser.buf1 = tableState.parserBuf1;
  61617. parser.buf2 = tableState.parserBuf2;
  61618. let obj;
  61619. while (true) {
  61620. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  61621. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  61622. break;
  61623. }
  61624. tableState.firstEntryNum = obj;
  61625. tableState.entryCount = parser.getObj();
  61626. }
  61627. let first = tableState.firstEntryNum;
  61628. const count = tableState.entryCount;
  61629. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  61630. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  61631. }
  61632. for (let i = tableState.entryNum; i < count; i++) {
  61633. tableState.streamPos = stream.pos;
  61634. tableState.entryNum = i;
  61635. tableState.parserBuf1 = parser.buf1;
  61636. tableState.parserBuf2 = parser.buf2;
  61637. const entry = {};
  61638. entry.offset = parser.getObj();
  61639. entry.gen = parser.getObj();
  61640. const type = parser.getObj();
  61641. if (type instanceof _primitives.Cmd) {
  61642. switch (type.cmd) {
  61643. case "f":
  61644. entry.free = true;
  61645. break;
  61646. case "n":
  61647. entry.uncompressed = true;
  61648. break;
  61649. }
  61650. }
  61651. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  61652. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  61653. }
  61654. if (i === 0 && entry.free && first === 1) {
  61655. first = 0;
  61656. }
  61657. if (!this.entries[i + first]) {
  61658. this.entries[i + first] = entry;
  61659. }
  61660. }
  61661. tableState.entryNum = 0;
  61662. tableState.streamPos = stream.pos;
  61663. tableState.parserBuf1 = parser.buf1;
  61664. tableState.parserBuf2 = parser.buf2;
  61665. delete tableState.firstEntryNum;
  61666. delete tableState.entryCount;
  61667. }
  61668. if (this.entries[0] && !this.entries[0].free) {
  61669. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  61670. }
  61671. return obj;
  61672. }
  61673. processXRefStream(stream) {
  61674. if (!("streamState" in this)) {
  61675. const streamParameters = stream.dict;
  61676. const byteWidths = streamParameters.get("W");
  61677. let range = streamParameters.get("Index");
  61678. if (!range) {
  61679. range = [0, streamParameters.get("Size")];
  61680. }
  61681. this.streamState = {
  61682. entryRanges: range,
  61683. byteWidths,
  61684. entryNum: 0,
  61685. streamPos: stream.pos
  61686. };
  61687. }
  61688. this.readXRefStream(stream);
  61689. delete this.streamState;
  61690. return stream.dict;
  61691. }
  61692. readXRefStream(stream) {
  61693. const streamState = this.streamState;
  61694. stream.pos = streamState.streamPos;
  61695. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  61696. const entryRanges = streamState.entryRanges;
  61697. while (entryRanges.length > 0) {
  61698. const [first, n] = entryRanges;
  61699. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  61700. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  61701. }
  61702. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  61703. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  61704. }
  61705. for (let i = streamState.entryNum; i < n; ++i) {
  61706. streamState.entryNum = i;
  61707. streamState.streamPos = stream.pos;
  61708. let type = 0,
  61709. offset = 0,
  61710. generation = 0;
  61711. for (let j = 0; j < typeFieldWidth; ++j) {
  61712. const typeByte = stream.getByte();
  61713. if (typeByte === -1) {
  61714. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  61715. }
  61716. type = type << 8 | typeByte;
  61717. }
  61718. if (typeFieldWidth === 0) {
  61719. type = 1;
  61720. }
  61721. for (let j = 0; j < offsetFieldWidth; ++j) {
  61722. const offsetByte = stream.getByte();
  61723. if (offsetByte === -1) {
  61724. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  61725. }
  61726. offset = offset << 8 | offsetByte;
  61727. }
  61728. for (let j = 0; j < generationFieldWidth; ++j) {
  61729. const generationByte = stream.getByte();
  61730. if (generationByte === -1) {
  61731. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  61732. }
  61733. generation = generation << 8 | generationByte;
  61734. }
  61735. const entry = {};
  61736. entry.offset = offset;
  61737. entry.gen = generation;
  61738. switch (type) {
  61739. case 0:
  61740. entry.free = true;
  61741. break;
  61742. case 1:
  61743. entry.uncompressed = true;
  61744. break;
  61745. case 2:
  61746. break;
  61747. default:
  61748. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  61749. }
  61750. if (!this.entries[first + i]) {
  61751. this.entries[first + i] = entry;
  61752. }
  61753. }
  61754. streamState.entryNum = 0;
  61755. streamState.streamPos = stream.pos;
  61756. entryRanges.splice(0, 2);
  61757. }
  61758. }
  61759. indexObjects() {
  61760. const TAB = 0x9,
  61761. LF = 0xa,
  61762. CR = 0xd,
  61763. SPACE = 0x20;
  61764. const PERCENT = 0x25,
  61765. LT = 0x3c;
  61766. function readToken(data, offset) {
  61767. let token = "",
  61768. ch = data[offset];
  61769. while (ch !== LF && ch !== CR && ch !== LT) {
  61770. if (++offset >= data.length) {
  61771. break;
  61772. }
  61773. token += String.fromCharCode(ch);
  61774. ch = data[offset];
  61775. }
  61776. return token;
  61777. }
  61778. function skipUntil(data, offset, what) {
  61779. const length = what.length,
  61780. dataLength = data.length;
  61781. let skipped = 0;
  61782. while (offset < dataLength) {
  61783. let i = 0;
  61784. while (i < length && data[offset + i] === what[i]) {
  61785. ++i;
  61786. }
  61787. if (i >= length) {
  61788. break;
  61789. }
  61790. offset++;
  61791. skipped++;
  61792. }
  61793. return skipped;
  61794. }
  61795. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  61796. const endobjRegExp = /\bendobj[\b\s]$/;
  61797. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  61798. const CHECK_CONTENT_LENGTH = 25;
  61799. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  61800. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  61801. const objBytes = new Uint8Array([111, 98, 106]);
  61802. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  61803. this.entries.length = 0;
  61804. this._cacheMap.clear();
  61805. const stream = this.stream;
  61806. stream.pos = 0;
  61807. const buffer = stream.getBytes(),
  61808. length = buffer.length;
  61809. let position = stream.start;
  61810. const trailers = [],
  61811. xrefStms = [];
  61812. while (position < length) {
  61813. let ch = buffer[position];
  61814. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  61815. ++position;
  61816. continue;
  61817. }
  61818. if (ch === PERCENT) {
  61819. do {
  61820. ++position;
  61821. if (position >= length) {
  61822. break;
  61823. }
  61824. ch = buffer[position];
  61825. } while (ch !== LF && ch !== CR);
  61826. continue;
  61827. }
  61828. const token = readToken(buffer, position);
  61829. let m;
  61830. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  61831. position += skipUntil(buffer, position, trailerBytes);
  61832. trailers.push(position);
  61833. position += skipUntil(buffer, position, startxrefBytes);
  61834. } else if (m = objRegExp.exec(token)) {
  61835. const num = m[1] | 0,
  61836. gen = m[2] | 0;
  61837. let contentLength,
  61838. startPos = position + token.length,
  61839. updateEntries = false;
  61840. if (!this.entries[num]) {
  61841. updateEntries = true;
  61842. } else if (this.entries[num].gen === gen) {
  61843. try {
  61844. const parser = new _parser.Parser({
  61845. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  61846. });
  61847. parser.getObj();
  61848. updateEntries = true;
  61849. } catch (ex) {
  61850. if (ex instanceof _core_utils.ParserEOFException) {
  61851. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  61852. } else {
  61853. updateEntries = true;
  61854. }
  61855. }
  61856. }
  61857. if (updateEntries) {
  61858. this.entries[num] = {
  61859. offset: position - stream.start,
  61860. gen,
  61861. uncompressed: true
  61862. };
  61863. }
  61864. while (startPos < buffer.length) {
  61865. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  61866. contentLength = endPos - position;
  61867. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  61868. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  61869. if (endobjRegExp.test(tokenStr)) {
  61870. break;
  61871. } else {
  61872. const objToken = nestedObjRegExp.exec(tokenStr);
  61873. if (objToken && objToken[1]) {
  61874. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  61875. contentLength -= objToken[1].length;
  61876. break;
  61877. }
  61878. }
  61879. startPos = endPos;
  61880. }
  61881. const content = buffer.subarray(position, position + contentLength);
  61882. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  61883. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  61884. xrefStms.push(position - stream.start);
  61885. this.xrefstms[position - stream.start] = 1;
  61886. }
  61887. position += contentLength;
  61888. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  61889. trailers.push(position);
  61890. position += skipUntil(buffer, position, startxrefBytes);
  61891. } else {
  61892. position += token.length + 1;
  61893. }
  61894. }
  61895. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  61896. this.startXRefQueue.push(xrefStms[i]);
  61897. this.readXRef(true);
  61898. }
  61899. let trailerDict;
  61900. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  61901. stream.pos = trailers[i];
  61902. const parser = new _parser.Parser({
  61903. lexer: new _parser.Lexer(stream),
  61904. xref: this,
  61905. allowStreams: true,
  61906. recoveryMode: true
  61907. });
  61908. const obj = parser.getObj();
  61909. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61910. continue;
  61911. }
  61912. const dict = parser.getObj();
  61913. if (!(dict instanceof _primitives.Dict)) {
  61914. continue;
  61915. }
  61916. try {
  61917. const rootDict = dict.get("Root");
  61918. if (!(rootDict instanceof _primitives.Dict)) {
  61919. continue;
  61920. }
  61921. const pagesDict = rootDict.get("Pages");
  61922. if (!(pagesDict instanceof _primitives.Dict)) {
  61923. continue;
  61924. }
  61925. const pagesCount = pagesDict.get("Count");
  61926. if (!Number.isInteger(pagesCount)) {
  61927. continue;
  61928. }
  61929. } catch (ex) {
  61930. continue;
  61931. }
  61932. if (dict.has("ID")) {
  61933. return dict;
  61934. }
  61935. trailerDict = dict;
  61936. }
  61937. if (trailerDict) {
  61938. return trailerDict;
  61939. }
  61940. if (this.topDict) {
  61941. return this.topDict;
  61942. }
  61943. throw new _util.InvalidPDFException("Invalid PDF structure.");
  61944. }
  61945. readXRef(recoveryMode = false) {
  61946. const stream = this.stream;
  61947. const startXRefParsedCache = new Set();
  61948. try {
  61949. while (this.startXRefQueue.length) {
  61950. const startXRef = this.startXRefQueue[0];
  61951. if (startXRefParsedCache.has(startXRef)) {
  61952. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  61953. this.startXRefQueue.shift();
  61954. continue;
  61955. }
  61956. startXRefParsedCache.add(startXRef);
  61957. stream.pos = startXRef + stream.start;
  61958. const parser = new _parser.Parser({
  61959. lexer: new _parser.Lexer(stream),
  61960. xref: this,
  61961. allowStreams: true
  61962. });
  61963. let obj = parser.getObj();
  61964. let dict;
  61965. if ((0, _primitives.isCmd)(obj, "xref")) {
  61966. dict = this.processXRefTable(parser);
  61967. if (!this.topDict) {
  61968. this.topDict = dict;
  61969. }
  61970. obj = dict.get("XRefStm");
  61971. if (Number.isInteger(obj)) {
  61972. const pos = obj;
  61973. if (!(pos in this.xrefstms)) {
  61974. this.xrefstms[pos] = 1;
  61975. this.startXRefQueue.push(pos);
  61976. }
  61977. }
  61978. } else if (Number.isInteger(obj)) {
  61979. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  61980. throw new _util.FormatError("Invalid XRef stream");
  61981. }
  61982. dict = this.processXRefStream(obj);
  61983. if (!this.topDict) {
  61984. this.topDict = dict;
  61985. }
  61986. if (!dict) {
  61987. throw new _util.FormatError("Failed to read XRef stream");
  61988. }
  61989. } else {
  61990. throw new _util.FormatError("Invalid XRef stream header");
  61991. }
  61992. obj = dict.get("Prev");
  61993. if (Number.isInteger(obj)) {
  61994. this.startXRefQueue.push(obj);
  61995. } else if (obj instanceof _primitives.Ref) {
  61996. this.startXRefQueue.push(obj.num);
  61997. }
  61998. this.startXRefQueue.shift();
  61999. }
  62000. return this.topDict;
  62001. } catch (e) {
  62002. if (e instanceof _core_utils.MissingDataException) {
  62003. throw e;
  62004. }
  62005. (0, _util.info)("(while reading XRef): " + e);
  62006. this.startXRefQueue.shift();
  62007. }
  62008. if (recoveryMode) {
  62009. return undefined;
  62010. }
  62011. throw new _core_utils.XRefParseException();
  62012. }
  62013. getEntry(i) {
  62014. const xrefEntry = this.entries[i];
  62015. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  62016. return xrefEntry;
  62017. }
  62018. return null;
  62019. }
  62020. fetchIfRef(obj, suppressEncryption = false) {
  62021. if (obj instanceof _primitives.Ref) {
  62022. return this.fetch(obj, suppressEncryption);
  62023. }
  62024. return obj;
  62025. }
  62026. fetch(ref, suppressEncryption = false) {
  62027. if (!(ref instanceof _primitives.Ref)) {
  62028. throw new Error("ref object is not a reference");
  62029. }
  62030. const num = ref.num;
  62031. const cacheEntry = this._cacheMap.get(num);
  62032. if (cacheEntry !== undefined) {
  62033. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  62034. cacheEntry.objId = ref.toString();
  62035. }
  62036. return cacheEntry;
  62037. }
  62038. let xrefEntry = this.getEntry(num);
  62039. if (xrefEntry === null) {
  62040. this._cacheMap.set(num, xrefEntry);
  62041. return xrefEntry;
  62042. }
  62043. if (this._pendingRefs.has(ref)) {
  62044. this._pendingRefs.remove(ref);
  62045. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  62046. return _primitives.CIRCULAR_REF;
  62047. }
  62048. this._pendingRefs.put(ref);
  62049. try {
  62050. if (xrefEntry.uncompressed) {
  62051. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  62052. } else {
  62053. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  62054. }
  62055. this._pendingRefs.remove(ref);
  62056. } catch (ex) {
  62057. this._pendingRefs.remove(ref);
  62058. throw ex;
  62059. }
  62060. if (xrefEntry instanceof _primitives.Dict) {
  62061. xrefEntry.objId = ref.toString();
  62062. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  62063. xrefEntry.dict.objId = ref.toString();
  62064. }
  62065. return xrefEntry;
  62066. }
  62067. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  62068. const gen = ref.gen;
  62069. let num = ref.num;
  62070. if (xrefEntry.gen !== gen) {
  62071. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  62072. }
  62073. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  62074. const parser = new _parser.Parser({
  62075. lexer: new _parser.Lexer(stream),
  62076. xref: this,
  62077. allowStreams: true
  62078. });
  62079. const obj1 = parser.getObj();
  62080. const obj2 = parser.getObj();
  62081. const obj3 = parser.getObj();
  62082. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  62083. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62084. }
  62085. if (obj3.cmd !== "obj") {
  62086. if (obj3.cmd.startsWith("obj")) {
  62087. num = parseInt(obj3.cmd.substring(3), 10);
  62088. if (!Number.isNaN(num)) {
  62089. return num;
  62090. }
  62091. }
  62092. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62093. }
  62094. if (this.encrypt && !suppressEncryption) {
  62095. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  62096. } else {
  62097. xrefEntry = parser.getObj();
  62098. }
  62099. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  62100. this._cacheMap.set(num, xrefEntry);
  62101. }
  62102. return xrefEntry;
  62103. }
  62104. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  62105. const tableOffset = xrefEntry.offset;
  62106. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  62107. if (!(stream instanceof _base_stream.BaseStream)) {
  62108. throw new _util.FormatError("bad ObjStm stream");
  62109. }
  62110. const first = stream.dict.get("First");
  62111. const n = stream.dict.get("N");
  62112. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62113. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  62114. }
  62115. let parser = new _parser.Parser({
  62116. lexer: new _parser.Lexer(stream),
  62117. xref: this,
  62118. allowStreams: true
  62119. });
  62120. const nums = new Array(n);
  62121. const offsets = new Array(n);
  62122. for (let i = 0; i < n; ++i) {
  62123. const num = parser.getObj();
  62124. if (!Number.isInteger(num)) {
  62125. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  62126. }
  62127. const offset = parser.getObj();
  62128. if (!Number.isInteger(offset)) {
  62129. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  62130. }
  62131. nums[i] = num;
  62132. offsets[i] = offset;
  62133. }
  62134. const start = (stream.start || 0) + first;
  62135. const entries = new Array(n);
  62136. for (let i = 0; i < n; ++i) {
  62137. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  62138. if (length < 0) {
  62139. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  62140. }
  62141. parser = new _parser.Parser({
  62142. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  62143. xref: this,
  62144. allowStreams: true
  62145. });
  62146. const obj = parser.getObj();
  62147. entries[i] = obj;
  62148. if (obj instanceof _base_stream.BaseStream) {
  62149. continue;
  62150. }
  62151. const num = nums[i],
  62152. entry = this.entries[num];
  62153. if (entry && entry.offset === tableOffset && entry.gen === i) {
  62154. this._cacheMap.set(num, obj);
  62155. }
  62156. }
  62157. xrefEntry = entries[xrefEntry.gen];
  62158. if (xrefEntry === undefined) {
  62159. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  62160. }
  62161. return xrefEntry;
  62162. }
  62163. async fetchIfRefAsync(obj, suppressEncryption) {
  62164. if (obj instanceof _primitives.Ref) {
  62165. return this.fetchAsync(obj, suppressEncryption);
  62166. }
  62167. return obj;
  62168. }
  62169. async fetchAsync(ref, suppressEncryption) {
  62170. try {
  62171. return this.fetch(ref, suppressEncryption);
  62172. } catch (ex) {
  62173. if (!(ex instanceof _core_utils.MissingDataException)) {
  62174. throw ex;
  62175. }
  62176. await this.pdfManager.requestRange(ex.begin, ex.end);
  62177. return this.fetchAsync(ref, suppressEncryption);
  62178. }
  62179. }
  62180. getCatalogObj() {
  62181. return this.root;
  62182. }
  62183. }
  62184. exports.XRef = XRef;
  62185. /***/ }),
  62186. /* 102 */
  62187. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62188. Object.defineProperty(exports, "__esModule", ({
  62189. value: true
  62190. }));
  62191. exports.MessageHandler = void 0;
  62192. var _util = __w_pdfjs_require__(2);
  62193. const CallbackKind = {
  62194. UNKNOWN: 0,
  62195. DATA: 1,
  62196. ERROR: 2
  62197. };
  62198. const StreamKind = {
  62199. UNKNOWN: 0,
  62200. CANCEL: 1,
  62201. CANCEL_COMPLETE: 2,
  62202. CLOSE: 3,
  62203. ENQUEUE: 4,
  62204. ERROR: 5,
  62205. PULL: 6,
  62206. PULL_COMPLETE: 7,
  62207. START_COMPLETE: 8
  62208. };
  62209. function wrapReason(reason) {
  62210. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  62211. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  62212. }
  62213. switch (reason.name) {
  62214. case "AbortException":
  62215. return new _util.AbortException(reason.message);
  62216. case "MissingPDFException":
  62217. return new _util.MissingPDFException(reason.message);
  62218. case "PasswordException":
  62219. return new _util.PasswordException(reason.message, reason.code);
  62220. case "UnexpectedResponseException":
  62221. return new _util.UnexpectedResponseException(reason.message, reason.status);
  62222. case "UnknownErrorException":
  62223. return new _util.UnknownErrorException(reason.message, reason.details);
  62224. default:
  62225. return new _util.UnknownErrorException(reason.message, reason.toString());
  62226. }
  62227. }
  62228. class MessageHandler {
  62229. constructor(sourceName, targetName, comObj) {
  62230. this.sourceName = sourceName;
  62231. this.targetName = targetName;
  62232. this.comObj = comObj;
  62233. this.callbackId = 1;
  62234. this.streamId = 1;
  62235. this.streamSinks = Object.create(null);
  62236. this.streamControllers = Object.create(null);
  62237. this.callbackCapabilities = Object.create(null);
  62238. this.actionHandler = Object.create(null);
  62239. this._onComObjOnMessage = event => {
  62240. const data = event.data;
  62241. if (data.targetName !== this.sourceName) {
  62242. return;
  62243. }
  62244. if (data.stream) {
  62245. this._processStreamMessage(data);
  62246. return;
  62247. }
  62248. if (data.callback) {
  62249. const callbackId = data.callbackId;
  62250. const capability = this.callbackCapabilities[callbackId];
  62251. if (!capability) {
  62252. throw new Error(`Cannot resolve callback ${callbackId}`);
  62253. }
  62254. delete this.callbackCapabilities[callbackId];
  62255. if (data.callback === CallbackKind.DATA) {
  62256. capability.resolve(data.data);
  62257. } else if (data.callback === CallbackKind.ERROR) {
  62258. capability.reject(wrapReason(data.reason));
  62259. } else {
  62260. throw new Error("Unexpected callback case");
  62261. }
  62262. return;
  62263. }
  62264. const action = this.actionHandler[data.action];
  62265. if (!action) {
  62266. throw new Error(`Unknown action from worker: ${data.action}`);
  62267. }
  62268. if (data.callbackId) {
  62269. const cbSourceName = this.sourceName;
  62270. const cbTargetName = data.sourceName;
  62271. new Promise(function (resolve) {
  62272. resolve(action(data.data));
  62273. }).then(function (result) {
  62274. comObj.postMessage({
  62275. sourceName: cbSourceName,
  62276. targetName: cbTargetName,
  62277. callback: CallbackKind.DATA,
  62278. callbackId: data.callbackId,
  62279. data: result
  62280. });
  62281. }, function (reason) {
  62282. comObj.postMessage({
  62283. sourceName: cbSourceName,
  62284. targetName: cbTargetName,
  62285. callback: CallbackKind.ERROR,
  62286. callbackId: data.callbackId,
  62287. reason: wrapReason(reason)
  62288. });
  62289. });
  62290. return;
  62291. }
  62292. if (data.streamId) {
  62293. this._createStreamSink(data);
  62294. return;
  62295. }
  62296. action(data.data);
  62297. };
  62298. comObj.addEventListener("message", this._onComObjOnMessage);
  62299. }
  62300. on(actionName, handler) {
  62301. const ah = this.actionHandler;
  62302. if (ah[actionName]) {
  62303. throw new Error(`There is already an actionName called "${actionName}"`);
  62304. }
  62305. ah[actionName] = handler;
  62306. }
  62307. send(actionName, data, transfers) {
  62308. this.comObj.postMessage({
  62309. sourceName: this.sourceName,
  62310. targetName: this.targetName,
  62311. action: actionName,
  62312. data
  62313. }, transfers);
  62314. }
  62315. sendWithPromise(actionName, data, transfers) {
  62316. const callbackId = this.callbackId++;
  62317. const capability = (0, _util.createPromiseCapability)();
  62318. this.callbackCapabilities[callbackId] = capability;
  62319. try {
  62320. this.comObj.postMessage({
  62321. sourceName: this.sourceName,
  62322. targetName: this.targetName,
  62323. action: actionName,
  62324. callbackId,
  62325. data
  62326. }, transfers);
  62327. } catch (ex) {
  62328. capability.reject(ex);
  62329. }
  62330. return capability.promise;
  62331. }
  62332. sendWithStream(actionName, data, queueingStrategy, transfers) {
  62333. const streamId = this.streamId++,
  62334. sourceName = this.sourceName,
  62335. targetName = this.targetName,
  62336. comObj = this.comObj;
  62337. return new ReadableStream({
  62338. start: controller => {
  62339. const startCapability = (0, _util.createPromiseCapability)();
  62340. this.streamControllers[streamId] = {
  62341. controller,
  62342. startCall: startCapability,
  62343. pullCall: null,
  62344. cancelCall: null,
  62345. isClosed: false
  62346. };
  62347. comObj.postMessage({
  62348. sourceName,
  62349. targetName,
  62350. action: actionName,
  62351. streamId,
  62352. data,
  62353. desiredSize: controller.desiredSize
  62354. }, transfers);
  62355. return startCapability.promise;
  62356. },
  62357. pull: controller => {
  62358. const pullCapability = (0, _util.createPromiseCapability)();
  62359. this.streamControllers[streamId].pullCall = pullCapability;
  62360. comObj.postMessage({
  62361. sourceName,
  62362. targetName,
  62363. stream: StreamKind.PULL,
  62364. streamId,
  62365. desiredSize: controller.desiredSize
  62366. });
  62367. return pullCapability.promise;
  62368. },
  62369. cancel: reason => {
  62370. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  62371. const cancelCapability = (0, _util.createPromiseCapability)();
  62372. this.streamControllers[streamId].cancelCall = cancelCapability;
  62373. this.streamControllers[streamId].isClosed = true;
  62374. comObj.postMessage({
  62375. sourceName,
  62376. targetName,
  62377. stream: StreamKind.CANCEL,
  62378. streamId,
  62379. reason: wrapReason(reason)
  62380. });
  62381. return cancelCapability.promise;
  62382. }
  62383. }, queueingStrategy);
  62384. }
  62385. _createStreamSink(data) {
  62386. const streamId = data.streamId,
  62387. sourceName = this.sourceName,
  62388. targetName = data.sourceName,
  62389. comObj = this.comObj;
  62390. const self = this,
  62391. action = this.actionHandler[data.action];
  62392. const streamSink = {
  62393. enqueue(chunk, size = 1, transfers) {
  62394. if (this.isCancelled) {
  62395. return;
  62396. }
  62397. const lastDesiredSize = this.desiredSize;
  62398. this.desiredSize -= size;
  62399. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  62400. this.sinkCapability = (0, _util.createPromiseCapability)();
  62401. this.ready = this.sinkCapability.promise;
  62402. }
  62403. comObj.postMessage({
  62404. sourceName,
  62405. targetName,
  62406. stream: StreamKind.ENQUEUE,
  62407. streamId,
  62408. chunk
  62409. }, transfers);
  62410. },
  62411. close() {
  62412. if (this.isCancelled) {
  62413. return;
  62414. }
  62415. this.isCancelled = true;
  62416. comObj.postMessage({
  62417. sourceName,
  62418. targetName,
  62419. stream: StreamKind.CLOSE,
  62420. streamId
  62421. });
  62422. delete self.streamSinks[streamId];
  62423. },
  62424. error(reason) {
  62425. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  62426. if (this.isCancelled) {
  62427. return;
  62428. }
  62429. this.isCancelled = true;
  62430. comObj.postMessage({
  62431. sourceName,
  62432. targetName,
  62433. stream: StreamKind.ERROR,
  62434. streamId,
  62435. reason: wrapReason(reason)
  62436. });
  62437. },
  62438. sinkCapability: (0, _util.createPromiseCapability)(),
  62439. onPull: null,
  62440. onCancel: null,
  62441. isCancelled: false,
  62442. desiredSize: data.desiredSize,
  62443. ready: null
  62444. };
  62445. streamSink.sinkCapability.resolve();
  62446. streamSink.ready = streamSink.sinkCapability.promise;
  62447. this.streamSinks[streamId] = streamSink;
  62448. new Promise(function (resolve) {
  62449. resolve(action(data.data, streamSink));
  62450. }).then(function () {
  62451. comObj.postMessage({
  62452. sourceName,
  62453. targetName,
  62454. stream: StreamKind.START_COMPLETE,
  62455. streamId,
  62456. success: true
  62457. });
  62458. }, function (reason) {
  62459. comObj.postMessage({
  62460. sourceName,
  62461. targetName,
  62462. stream: StreamKind.START_COMPLETE,
  62463. streamId,
  62464. reason: wrapReason(reason)
  62465. });
  62466. });
  62467. }
  62468. _processStreamMessage(data) {
  62469. const streamId = data.streamId,
  62470. sourceName = this.sourceName,
  62471. targetName = data.sourceName,
  62472. comObj = this.comObj;
  62473. const streamController = this.streamControllers[streamId],
  62474. streamSink = this.streamSinks[streamId];
  62475. switch (data.stream) {
  62476. case StreamKind.START_COMPLETE:
  62477. if (data.success) {
  62478. streamController.startCall.resolve();
  62479. } else {
  62480. streamController.startCall.reject(wrapReason(data.reason));
  62481. }
  62482. break;
  62483. case StreamKind.PULL_COMPLETE:
  62484. if (data.success) {
  62485. streamController.pullCall.resolve();
  62486. } else {
  62487. streamController.pullCall.reject(wrapReason(data.reason));
  62488. }
  62489. break;
  62490. case StreamKind.PULL:
  62491. if (!streamSink) {
  62492. comObj.postMessage({
  62493. sourceName,
  62494. targetName,
  62495. stream: StreamKind.PULL_COMPLETE,
  62496. streamId,
  62497. success: true
  62498. });
  62499. break;
  62500. }
  62501. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  62502. streamSink.sinkCapability.resolve();
  62503. }
  62504. streamSink.desiredSize = data.desiredSize;
  62505. new Promise(function (resolve) {
  62506. resolve(streamSink.onPull && streamSink.onPull());
  62507. }).then(function () {
  62508. comObj.postMessage({
  62509. sourceName,
  62510. targetName,
  62511. stream: StreamKind.PULL_COMPLETE,
  62512. streamId,
  62513. success: true
  62514. });
  62515. }, function (reason) {
  62516. comObj.postMessage({
  62517. sourceName,
  62518. targetName,
  62519. stream: StreamKind.PULL_COMPLETE,
  62520. streamId,
  62521. reason: wrapReason(reason)
  62522. });
  62523. });
  62524. break;
  62525. case StreamKind.ENQUEUE:
  62526. (0, _util.assert)(streamController, "enqueue should have stream controller");
  62527. if (streamController.isClosed) {
  62528. break;
  62529. }
  62530. streamController.controller.enqueue(data.chunk);
  62531. break;
  62532. case StreamKind.CLOSE:
  62533. (0, _util.assert)(streamController, "close should have stream controller");
  62534. if (streamController.isClosed) {
  62535. break;
  62536. }
  62537. streamController.isClosed = true;
  62538. streamController.controller.close();
  62539. this._deleteStreamController(streamController, streamId);
  62540. break;
  62541. case StreamKind.ERROR:
  62542. (0, _util.assert)(streamController, "error should have stream controller");
  62543. streamController.controller.error(wrapReason(data.reason));
  62544. this._deleteStreamController(streamController, streamId);
  62545. break;
  62546. case StreamKind.CANCEL_COMPLETE:
  62547. if (data.success) {
  62548. streamController.cancelCall.resolve();
  62549. } else {
  62550. streamController.cancelCall.reject(wrapReason(data.reason));
  62551. }
  62552. this._deleteStreamController(streamController, streamId);
  62553. break;
  62554. case StreamKind.CANCEL:
  62555. if (!streamSink) {
  62556. break;
  62557. }
  62558. new Promise(function (resolve) {
  62559. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  62560. }).then(function () {
  62561. comObj.postMessage({
  62562. sourceName,
  62563. targetName,
  62564. stream: StreamKind.CANCEL_COMPLETE,
  62565. streamId,
  62566. success: true
  62567. });
  62568. }, function (reason) {
  62569. comObj.postMessage({
  62570. sourceName,
  62571. targetName,
  62572. stream: StreamKind.CANCEL_COMPLETE,
  62573. streamId,
  62574. reason: wrapReason(reason)
  62575. });
  62576. });
  62577. streamSink.sinkCapability.reject(wrapReason(data.reason));
  62578. streamSink.isCancelled = true;
  62579. delete this.streamSinks[streamId];
  62580. break;
  62581. default:
  62582. throw new Error("Unexpected stream case");
  62583. }
  62584. }
  62585. async _deleteStreamController(streamController, streamId) {
  62586. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  62587. delete this.streamControllers[streamId];
  62588. }
  62589. destroy() {
  62590. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  62591. }
  62592. }
  62593. exports.MessageHandler = MessageHandler;
  62594. /***/ }),
  62595. /* 103 */
  62596. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62597. Object.defineProperty(exports, "__esModule", ({
  62598. value: true
  62599. }));
  62600. exports.PDFWorkerStream = void 0;
  62601. var _util = __w_pdfjs_require__(2);
  62602. class PDFWorkerStream {
  62603. constructor(msgHandler) {
  62604. this._msgHandler = msgHandler;
  62605. this._contentLength = null;
  62606. this._fullRequestReader = null;
  62607. this._rangeRequestReaders = [];
  62608. }
  62609. getFullReader() {
  62610. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  62611. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  62612. return this._fullRequestReader;
  62613. }
  62614. getRangeReader(begin, end) {
  62615. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  62616. this._rangeRequestReaders.push(reader);
  62617. return reader;
  62618. }
  62619. cancelAllRequests(reason) {
  62620. if (this._fullRequestReader) {
  62621. this._fullRequestReader.cancel(reason);
  62622. }
  62623. for (const reader of this._rangeRequestReaders.slice(0)) {
  62624. reader.cancel(reason);
  62625. }
  62626. }
  62627. }
  62628. exports.PDFWorkerStream = PDFWorkerStream;
  62629. class PDFWorkerStreamReader {
  62630. constructor(msgHandler) {
  62631. this._msgHandler = msgHandler;
  62632. this.onProgress = null;
  62633. this._contentLength = null;
  62634. this._isRangeSupported = false;
  62635. this._isStreamingSupported = false;
  62636. const readableStream = this._msgHandler.sendWithStream("GetReader");
  62637. this._reader = readableStream.getReader();
  62638. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  62639. this._isStreamingSupported = data.isStreamingSupported;
  62640. this._isRangeSupported = data.isRangeSupported;
  62641. this._contentLength = data.contentLength;
  62642. });
  62643. }
  62644. get headersReady() {
  62645. return this._headersReady;
  62646. }
  62647. get contentLength() {
  62648. return this._contentLength;
  62649. }
  62650. get isStreamingSupported() {
  62651. return this._isStreamingSupported;
  62652. }
  62653. get isRangeSupported() {
  62654. return this._isRangeSupported;
  62655. }
  62656. async read() {
  62657. const {
  62658. value,
  62659. done
  62660. } = await this._reader.read();
  62661. if (done) {
  62662. return {
  62663. value: undefined,
  62664. done: true
  62665. };
  62666. }
  62667. return {
  62668. value: value.buffer,
  62669. done: false
  62670. };
  62671. }
  62672. cancel(reason) {
  62673. this._reader.cancel(reason);
  62674. }
  62675. }
  62676. class PDFWorkerStreamRangeReader {
  62677. constructor(begin, end, msgHandler) {
  62678. this._msgHandler = msgHandler;
  62679. this.onProgress = null;
  62680. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  62681. begin,
  62682. end
  62683. });
  62684. this._reader = readableStream.getReader();
  62685. }
  62686. get isStreamingSupported() {
  62687. return false;
  62688. }
  62689. async read() {
  62690. const {
  62691. value,
  62692. done
  62693. } = await this._reader.read();
  62694. if (done) {
  62695. return {
  62696. value: undefined,
  62697. done: true
  62698. };
  62699. }
  62700. return {
  62701. value: value.buffer,
  62702. done: false
  62703. };
  62704. }
  62705. cancel(reason) {
  62706. this._reader.cancel(reason);
  62707. }
  62708. }
  62709. /***/ })
  62710. /******/ ]);
  62711. /************************************************************************/
  62712. /******/ // The module cache
  62713. /******/ var __webpack_module_cache__ = {};
  62714. /******/
  62715. /******/ // The require function
  62716. /******/ function __w_pdfjs_require__(moduleId) {
  62717. /******/ // Check if module is in cache
  62718. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  62719. /******/ if (cachedModule !== undefined) {
  62720. /******/ return cachedModule.exports;
  62721. /******/ }
  62722. /******/ // Create a new module (and put it into the cache)
  62723. /******/ var module = __webpack_module_cache__[moduleId] = {
  62724. /******/ // no module.id needed
  62725. /******/ // no module.loaded needed
  62726. /******/ exports: {}
  62727. /******/ };
  62728. /******/
  62729. /******/ // Execute the module function
  62730. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  62731. /******/
  62732. /******/ // Return the exports of the module
  62733. /******/ return module.exports;
  62734. /******/ }
  62735. /******/
  62736. /************************************************************************/
  62737. /******/ /* webpack/runtime/define property getters */
  62738. /******/ (() => {
  62739. /******/ // define getter functions for harmony exports
  62740. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  62741. /******/ for(var key in definition) {
  62742. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  62743. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  62744. /******/ }
  62745. /******/ }
  62746. /******/ };
  62747. /******/ })();
  62748. /******/
  62749. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  62750. /******/ (() => {
  62751. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  62752. /******/ })();
  62753. /******/
  62754. /******/ /* webpack/runtime/make namespace object */
  62755. /******/ (() => {
  62756. /******/ // define __esModule on exports
  62757. /******/ __w_pdfjs_require__.r = (exports) => {
  62758. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  62759. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  62760. /******/ }
  62761. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  62762. /******/ };
  62763. /******/ })();
  62764. /******/
  62765. /************************************************************************/
  62766. var __webpack_exports__ = {};
  62767. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  62768. (() => {
  62769. var exports = __webpack_exports__;
  62770. Object.defineProperty(exports, "__esModule", ({
  62771. value: true
  62772. }));
  62773. Object.defineProperty(exports, "WorkerMessageHandler", ({
  62774. enumerable: true,
  62775. get: function () {
  62776. return _worker.WorkerMessageHandler;
  62777. }
  62778. }));
  62779. var _worker = __w_pdfjs_require__(1);
  62780. const pdfjsVersion = '2.14.305';
  62781. const pdfjsBuild = 'eaaa8b4ad';
  62782. })();
  62783. /******/ return __webpack_exports__;
  62784. /******/ })()
  62785. ;
  62786. });
  62787. //# sourceMappingURL=pdf.worker.js.map