pdf.worker.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2021 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * Javascript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(this, function() {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  42. var _util = __w_pdfjs_require__(2);
  43. var _primitives = __w_pdfjs_require__(5);
  44. var _pdf_manager = __w_pdfjs_require__(7);
  45. var _writer = __w_pdfjs_require__(71);
  46. var _is_node = __w_pdfjs_require__(4);
  47. var _message_handler = __w_pdfjs_require__(99);
  48. var _worker_stream = __w_pdfjs_require__(100);
  49. var _core_utils = __w_pdfjs_require__(9);
  50. class WorkerTask {
  51. constructor(name) {
  52. this.name = name;
  53. this.terminated = false;
  54. this._capability = (0, _util.createPromiseCapability)();
  55. }
  56. get finished() {
  57. return this._capability.promise;
  58. }
  59. finish() {
  60. this._capability.resolve();
  61. }
  62. terminate() {
  63. this.terminated = true;
  64. }
  65. ensureNotTerminated() {
  66. if (this.terminated) {
  67. throw new Error("Worker task was terminated");
  68. }
  69. }
  70. }
  71. exports.WorkerTask = WorkerTask;
  72. class WorkerMessageHandler {
  73. static setup(handler, port) {
  74. let testMessageProcessed = false;
  75. handler.on("test", function wphSetupTest(data) {
  76. if (testMessageProcessed) {
  77. return;
  78. }
  79. testMessageProcessed = true;
  80. if (!(data instanceof Uint8Array)) {
  81. handler.send("test", null);
  82. return;
  83. }
  84. const supportTransfers = data[0] === 255;
  85. handler.postMessageTransfers = supportTransfers;
  86. handler.send("test", {
  87. supportTransfers
  88. });
  89. });
  90. handler.on("configure", function wphConfigure(data) {
  91. (0, _util.setVerbosityLevel)(data.verbosity);
  92. });
  93. handler.on("GetDocRequest", function wphSetupDoc(data) {
  94. return WorkerMessageHandler.createDocumentHandler(data, port);
  95. });
  96. }
  97. static createDocumentHandler(docParams, port) {
  98. let pdfManager;
  99. let terminated = false;
  100. let cancelXHRs = null;
  101. const WorkerTasks = [];
  102. const verbosity = (0, _util.getVerbosityLevel)();
  103. const apiVersion = docParams.apiVersion;
  104. const workerVersion = '2.10.377';
  105. if (apiVersion !== workerVersion) {
  106. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  107. }
  108. const enumerableProperties = [];
  109. for (const property in []) {
  110. enumerableProperties.push(property);
  111. }
  112. if (enumerableProperties.length) {
  113. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  114. }
  115. if (typeof ReadableStream === "undefined") {
  116. throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); " + "please use a `legacy`-build instead.");
  117. }
  118. const docId = docParams.docId;
  119. const docBaseUrl = docParams.docBaseUrl;
  120. const workerHandlerName = docParams.docId + "_worker";
  121. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  122. handler.postMessageTransfers = docParams.postMessageTransfers;
  123. function ensureNotTerminated() {
  124. if (terminated) {
  125. throw new Error("Worker was terminated");
  126. }
  127. }
  128. function startWorkerTask(task) {
  129. WorkerTasks.push(task);
  130. }
  131. function finishWorkerTask(task) {
  132. task.finish();
  133. const i = WorkerTasks.indexOf(task);
  134. WorkerTasks.splice(i, 1);
  135. }
  136. async function loadDocument(recoveryMode) {
  137. await pdfManager.ensureDoc("checkHeader");
  138. await pdfManager.ensureDoc("parseStartXRef");
  139. await pdfManager.ensureDoc("parse", [recoveryMode]);
  140. if (!recoveryMode) {
  141. await pdfManager.ensureDoc("checkFirstPage");
  142. }
  143. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  144. if (isPureXfa) {
  145. const task = new WorkerTask("loadXfaFonts");
  146. startWorkerTask(task);
  147. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  148. }
  149. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  150. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  151. return {
  152. numPages,
  153. fingerprints,
  154. htmlForXfa
  155. };
  156. }
  157. function getPdfManager(data, evaluatorOptions, enableXfa) {
  158. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  159. let newPdfManager;
  160. const source = data.source;
  161. if (source.data) {
  162. try {
  163. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  164. pdfManagerCapability.resolve(newPdfManager);
  165. } catch (ex) {
  166. pdfManagerCapability.reject(ex);
  167. }
  168. return pdfManagerCapability.promise;
  169. }
  170. let pdfStream,
  171. cachedChunks = [];
  172. try {
  173. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  174. } catch (ex) {
  175. pdfManagerCapability.reject(ex);
  176. return pdfManagerCapability.promise;
  177. }
  178. const fullRequest = pdfStream.getFullReader();
  179. fullRequest.headersReady.then(function () {
  180. if (!fullRequest.isRangeSupported) {
  181. return;
  182. }
  183. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  184. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  185. msgHandler: handler,
  186. password: source.password,
  187. length: fullRequest.contentLength,
  188. disableAutoFetch,
  189. rangeChunkSize: source.rangeChunkSize
  190. }, evaluatorOptions, enableXfa, docBaseUrl);
  191. for (let i = 0; i < cachedChunks.length; i++) {
  192. newPdfManager.sendProgressiveData(cachedChunks[i]);
  193. }
  194. cachedChunks = [];
  195. pdfManagerCapability.resolve(newPdfManager);
  196. cancelXHRs = null;
  197. }).catch(function (reason) {
  198. pdfManagerCapability.reject(reason);
  199. cancelXHRs = null;
  200. });
  201. let loaded = 0;
  202. const flushChunks = function () {
  203. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  204. if (source.length && pdfFile.length !== source.length) {
  205. (0, _util.warn)("reported HTTP length is different from actual");
  206. }
  207. try {
  208. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  209. pdfManagerCapability.resolve(newPdfManager);
  210. } catch (ex) {
  211. pdfManagerCapability.reject(ex);
  212. }
  213. cachedChunks = [];
  214. };
  215. const readPromise = new Promise(function (resolve, reject) {
  216. const readChunk = function ({
  217. value,
  218. done
  219. }) {
  220. try {
  221. ensureNotTerminated();
  222. if (done) {
  223. if (!newPdfManager) {
  224. flushChunks();
  225. }
  226. cancelXHRs = null;
  227. return;
  228. }
  229. loaded += (0, _util.arrayByteLength)(value);
  230. if (!fullRequest.isStreamingSupported) {
  231. handler.send("DocProgress", {
  232. loaded,
  233. total: Math.max(loaded, fullRequest.contentLength || 0)
  234. });
  235. }
  236. if (newPdfManager) {
  237. newPdfManager.sendProgressiveData(value);
  238. } else {
  239. cachedChunks.push(value);
  240. }
  241. fullRequest.read().then(readChunk, reject);
  242. } catch (e) {
  243. reject(e);
  244. }
  245. };
  246. fullRequest.read().then(readChunk, reject);
  247. });
  248. readPromise.catch(function (e) {
  249. pdfManagerCapability.reject(e);
  250. cancelXHRs = null;
  251. });
  252. cancelXHRs = function (reason) {
  253. pdfStream.cancelAllRequests(reason);
  254. };
  255. return pdfManagerCapability.promise;
  256. }
  257. function setupDoc(data) {
  258. function onSuccess(doc) {
  259. ensureNotTerminated();
  260. handler.send("GetDoc", {
  261. pdfInfo: doc
  262. });
  263. }
  264. function onFailure(ex) {
  265. ensureNotTerminated();
  266. if (ex instanceof _util.PasswordException) {
  267. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  268. startWorkerTask(task);
  269. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  270. password
  271. }) {
  272. finishWorkerTask(task);
  273. pdfManager.updatePassword(password);
  274. pdfManagerReady();
  275. }).catch(function () {
  276. finishWorkerTask(task);
  277. handler.send("DocException", ex);
  278. });
  279. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  280. handler.send("DocException", ex);
  281. } else {
  282. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  283. }
  284. }
  285. function pdfManagerReady() {
  286. ensureNotTerminated();
  287. loadDocument(false).then(onSuccess, function (reason) {
  288. ensureNotTerminated();
  289. if (!(reason instanceof _core_utils.XRefParseException)) {
  290. onFailure(reason);
  291. return;
  292. }
  293. pdfManager.requestLoadedStream();
  294. pdfManager.onLoadedStream().then(function () {
  295. ensureNotTerminated();
  296. loadDocument(true).then(onSuccess, onFailure);
  297. });
  298. });
  299. }
  300. ensureNotTerminated();
  301. const evaluatorOptions = {
  302. maxImageSize: data.maxImageSize,
  303. disableFontFace: data.disableFontFace,
  304. ignoreErrors: data.ignoreErrors,
  305. isEvalSupported: data.isEvalSupported,
  306. fontExtraProperties: data.fontExtraProperties,
  307. useSystemFonts: data.useSystemFonts,
  308. cMapUrl: data.cMapUrl,
  309. standardFontDataUrl: data.standardFontDataUrl
  310. };
  311. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  312. if (terminated) {
  313. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  314. throw new Error("Worker was terminated");
  315. }
  316. pdfManager = newPdfManager;
  317. pdfManager.onLoadedStream().then(function (stream) {
  318. handler.send("DataLoaded", {
  319. length: stream.bytes.byteLength
  320. });
  321. });
  322. }).then(pdfManagerReady, onFailure);
  323. }
  324. handler.on("GetPage", function wphSetupGetPage(data) {
  325. return pdfManager.getPage(data.pageIndex).then(function (page) {
  326. 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]) {
  327. return {
  328. rotate,
  329. ref,
  330. userUnit,
  331. view
  332. };
  333. });
  334. });
  335. });
  336. handler.on("GetPageIndex", function wphSetupGetPageIndex({
  337. ref
  338. }) {
  339. const pageRef = _primitives.Ref.get(ref.num, ref.gen);
  340. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  341. });
  342. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  343. return pdfManager.ensureCatalog("destinations");
  344. });
  345. handler.on("GetDestination", function wphSetupGetDestination(data) {
  346. return pdfManager.ensureCatalog("getDestination", [data.id]);
  347. });
  348. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  349. return pdfManager.ensureCatalog("pageLabels");
  350. });
  351. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  352. return pdfManager.ensureCatalog("pageLayout");
  353. });
  354. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  355. return pdfManager.ensureCatalog("pageMode");
  356. });
  357. handler.on("GetViewerPreferences", function (data) {
  358. return pdfManager.ensureCatalog("viewerPreferences");
  359. });
  360. handler.on("GetOpenAction", function (data) {
  361. return pdfManager.ensureCatalog("openAction");
  362. });
  363. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  364. return pdfManager.ensureCatalog("attachments");
  365. });
  366. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  367. return pdfManager.ensureCatalog("javaScript");
  368. });
  369. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  370. return pdfManager.ensureCatalog("jsActions");
  371. });
  372. handler.on("GetPageJSActions", function ({
  373. pageIndex
  374. }) {
  375. return pdfManager.getPage(pageIndex).then(function (page) {
  376. return pdfManager.ensure(page, "jsActions");
  377. });
  378. });
  379. handler.on("GetOutline", function wphSetupGetOutline(data) {
  380. return pdfManager.ensureCatalog("documentOutline");
  381. });
  382. handler.on("GetOptionalContentConfig", function (data) {
  383. return pdfManager.ensureCatalog("optionalContentConfig");
  384. });
  385. handler.on("GetPermissions", function (data) {
  386. return pdfManager.ensureCatalog("permissions");
  387. });
  388. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  389. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  390. });
  391. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  392. return pdfManager.ensureCatalog("markInfo");
  393. });
  394. handler.on("GetData", function wphSetupGetData(data) {
  395. pdfManager.requestLoadedStream();
  396. return pdfManager.onLoadedStream().then(function (stream) {
  397. return stream.bytes;
  398. });
  399. });
  400. handler.on("GetStats", function wphSetupGetStats(data) {
  401. return pdfManager.ensureXRef("stats");
  402. });
  403. handler.on("GetAnnotations", function ({
  404. pageIndex,
  405. intent
  406. }) {
  407. return pdfManager.getPage(pageIndex).then(function (page) {
  408. return page.getAnnotationsData(intent);
  409. });
  410. });
  411. handler.on("GetFieldObjects", function (data) {
  412. return pdfManager.ensureDoc("fieldObjects");
  413. });
  414. handler.on("HasJSActions", function (data) {
  415. return pdfManager.ensureDoc("hasJSActions");
  416. });
  417. handler.on("GetCalculationOrderIds", function (data) {
  418. return pdfManager.ensureDoc("calculationOrderIds");
  419. });
  420. handler.on("SaveDocument", function ({
  421. isPureXfa,
  422. numPages,
  423. annotationStorage,
  424. filename
  425. }) {
  426. pdfManager.requestLoadedStream();
  427. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  428. if (isPureXfa) {
  429. promises.push(pdfManager.serializeXfaData(annotationStorage));
  430. } else {
  431. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  432. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  433. const task = new WorkerTask(`Save: page ${pageIndex}`);
  434. return page.save(handler, task, annotationStorage).finally(function () {
  435. finishWorkerTask(task);
  436. });
  437. }));
  438. }
  439. }
  440. return Promise.all(promises).then(function ([stream, acroForm, xref, startXRef, ...refs]) {
  441. let newRefs = [];
  442. let xfaData = null;
  443. if (isPureXfa) {
  444. xfaData = refs[0];
  445. if (!xfaData) {
  446. return stream.bytes;
  447. }
  448. } else {
  449. for (const ref of refs) {
  450. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  451. }
  452. if (newRefs.length === 0) {
  453. return stream.bytes;
  454. }
  455. }
  456. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || [];
  457. let xfaDatasets = null;
  458. if (Array.isArray(xfa)) {
  459. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  460. if (xfa[i] === "datasets") {
  461. xfaDatasets = xfa[i + 1];
  462. }
  463. }
  464. } else {
  465. (0, _util.warn)("Unsupported XFA type.");
  466. }
  467. let newXrefInfo = Object.create(null);
  468. if (xref.trailer) {
  469. const infoObj = Object.create(null);
  470. const xrefInfo = xref.trailer.get("Info") || null;
  471. if (xrefInfo instanceof _primitives.Dict) {
  472. xrefInfo.forEach((key, value) => {
  473. if ((0, _util.isString)(key) && (0, _util.isString)(value)) {
  474. infoObj[key] = (0, _util.stringToPDFString)(value);
  475. }
  476. });
  477. }
  478. newXrefInfo = {
  479. rootRef: xref.trailer.getRaw("Root") || null,
  480. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  481. newRef: xref.getNewRef(),
  482. infoRef: xref.trailer.getRaw("Info") || null,
  483. info: infoObj,
  484. fileIds: xref.trailer.get("ID") || null,
  485. startXRef,
  486. filename
  487. };
  488. }
  489. xref.resetNewRef();
  490. return (0, _writer.incrementalUpdate)({
  491. originalData: stream.bytes,
  492. xrefInfo: newXrefInfo,
  493. newRefs,
  494. xref,
  495. datasetsRef: xfaDatasets,
  496. xfaData
  497. });
  498. });
  499. });
  500. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  501. const pageIndex = data.pageIndex;
  502. pdfManager.getPage(pageIndex).then(function (page) {
  503. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  504. startWorkerTask(task);
  505. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  506. page.getOperatorList({
  507. handler,
  508. sink,
  509. task,
  510. intent: data.intent,
  511. renderInteractiveForms: data.renderInteractiveForms,
  512. annotationStorage: data.annotationStorage
  513. }).then(function (operatorListInfo) {
  514. finishWorkerTask(task);
  515. if (start) {
  516. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  517. }
  518. sink.close();
  519. }, function (reason) {
  520. finishWorkerTask(task);
  521. if (task.terminated) {
  522. return;
  523. }
  524. handler.send("UnsupportedFeature", {
  525. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  526. });
  527. sink.error(reason);
  528. });
  529. });
  530. });
  531. handler.on("GetTextContent", function wphExtractText(data, sink) {
  532. const pageIndex = data.pageIndex;
  533. sink.onPull = function (desiredSize) {};
  534. sink.onCancel = function (reason) {};
  535. pdfManager.getPage(pageIndex).then(function (page) {
  536. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  537. startWorkerTask(task);
  538. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  539. page.extractTextContent({
  540. handler,
  541. task,
  542. sink,
  543. normalizeWhitespace: data.normalizeWhitespace,
  544. includeMarkedContent: data.includeMarkedContent,
  545. combineTextItems: data.combineTextItems
  546. }).then(function () {
  547. finishWorkerTask(task);
  548. if (start) {
  549. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  550. }
  551. sink.close();
  552. }, function (reason) {
  553. finishWorkerTask(task);
  554. if (task.terminated) {
  555. return;
  556. }
  557. sink.error(reason);
  558. });
  559. });
  560. });
  561. handler.on("GetStructTree", function wphGetStructTree(data) {
  562. return pdfManager.getPage(data.pageIndex).then(function (page) {
  563. return pdfManager.ensure(page, "getStructTree");
  564. });
  565. });
  566. handler.on("FontFallback", function (data) {
  567. return pdfManager.fontFallback(data.id, handler);
  568. });
  569. handler.on("Cleanup", function wphCleanup(data) {
  570. return pdfManager.cleanup(true);
  571. });
  572. handler.on("Terminate", function wphTerminate(data) {
  573. terminated = true;
  574. const waitOn = [];
  575. if (pdfManager) {
  576. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  577. const cleanupPromise = pdfManager.cleanup();
  578. waitOn.push(cleanupPromise);
  579. pdfManager = null;
  580. } else {
  581. (0, _primitives.clearPrimitiveCaches)();
  582. }
  583. if (cancelXHRs) {
  584. cancelXHRs(new _util.AbortException("Worker was terminated."));
  585. }
  586. for (const task of WorkerTasks) {
  587. waitOn.push(task.finished);
  588. task.terminate();
  589. }
  590. return Promise.all(waitOn).then(function () {
  591. handler.destroy();
  592. handler = null;
  593. });
  594. });
  595. handler.on("Ready", function wphReady(data) {
  596. setupDoc(docParams);
  597. docParams = null;
  598. });
  599. return workerHandlerName;
  600. }
  601. static initializeFromPort(port) {
  602. const handler = new _message_handler.MessageHandler("worker", "main", port);
  603. WorkerMessageHandler.setup(handler, port);
  604. handler.send("ready", null);
  605. }
  606. }
  607. exports.WorkerMessageHandler = WorkerMessageHandler;
  608. function isMessagePort(maybePort) {
  609. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  610. }
  611. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  612. WorkerMessageHandler.initializeFromPort(self);
  613. }
  614. /***/ }),
  615. /* 2 */
  616. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  617. Object.defineProperty(exports, "__esModule", ({
  618. value: true
  619. }));
  620. exports.arrayByteLength = arrayByteLength;
  621. exports.arraysToBytes = arraysToBytes;
  622. exports.assert = assert;
  623. exports.bytesToString = bytesToString;
  624. exports.createObjectURL = createObjectURL;
  625. exports.createPromiseCapability = createPromiseCapability;
  626. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  627. exports.escapeString = escapeString;
  628. exports.getModificationDate = getModificationDate;
  629. exports.getVerbosityLevel = getVerbosityLevel;
  630. exports.info = info;
  631. exports.isArrayBuffer = isArrayBuffer;
  632. exports.isArrayEqual = isArrayEqual;
  633. exports.isAscii = isAscii;
  634. exports.isBool = isBool;
  635. exports.isNum = isNum;
  636. exports.isSameOrigin = isSameOrigin;
  637. exports.isString = isString;
  638. exports.objectFromMap = objectFromMap;
  639. exports.objectSize = objectSize;
  640. exports.removeNullCharacters = removeNullCharacters;
  641. exports.setVerbosityLevel = setVerbosityLevel;
  642. exports.shadow = shadow;
  643. exports.string32 = string32;
  644. exports.stringToBytes = stringToBytes;
  645. exports.stringToPDFString = stringToPDFString;
  646. exports.stringToUTF16BEString = stringToUTF16BEString;
  647. exports.stringToUTF8String = stringToUTF8String;
  648. exports.unreachable = unreachable;
  649. exports.utf8StringToString = utf8StringToString;
  650. exports.warn = warn;
  651. exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  652. __w_pdfjs_require__(3);
  653. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  654. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  655. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  656. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  657. const PermissionFlag = {
  658. PRINT: 0x04,
  659. MODIFY_CONTENTS: 0x08,
  660. COPY: 0x10,
  661. MODIFY_ANNOTATIONS: 0x20,
  662. FILL_INTERACTIVE_FORMS: 0x100,
  663. COPY_FOR_ACCESSIBILITY: 0x200,
  664. ASSEMBLE: 0x400,
  665. PRINT_HIGH_QUALITY: 0x800
  666. };
  667. exports.PermissionFlag = PermissionFlag;
  668. const TextRenderingMode = {
  669. FILL: 0,
  670. STROKE: 1,
  671. FILL_STROKE: 2,
  672. INVISIBLE: 3,
  673. FILL_ADD_TO_PATH: 4,
  674. STROKE_ADD_TO_PATH: 5,
  675. FILL_STROKE_ADD_TO_PATH: 6,
  676. ADD_TO_PATH: 7,
  677. FILL_STROKE_MASK: 3,
  678. ADD_TO_PATH_FLAG: 4
  679. };
  680. exports.TextRenderingMode = TextRenderingMode;
  681. const ImageKind = {
  682. GRAYSCALE_1BPP: 1,
  683. RGB_24BPP: 2,
  684. RGBA_32BPP: 3
  685. };
  686. exports.ImageKind = ImageKind;
  687. const AnnotationType = {
  688. TEXT: 1,
  689. LINK: 2,
  690. FREETEXT: 3,
  691. LINE: 4,
  692. SQUARE: 5,
  693. CIRCLE: 6,
  694. POLYGON: 7,
  695. POLYLINE: 8,
  696. HIGHLIGHT: 9,
  697. UNDERLINE: 10,
  698. SQUIGGLY: 11,
  699. STRIKEOUT: 12,
  700. STAMP: 13,
  701. CARET: 14,
  702. INK: 15,
  703. POPUP: 16,
  704. FILEATTACHMENT: 17,
  705. SOUND: 18,
  706. MOVIE: 19,
  707. WIDGET: 20,
  708. SCREEN: 21,
  709. PRINTERMARK: 22,
  710. TRAPNET: 23,
  711. WATERMARK: 24,
  712. THREED: 25,
  713. REDACT: 26
  714. };
  715. exports.AnnotationType = AnnotationType;
  716. const AnnotationStateModelType = {
  717. MARKED: "Marked",
  718. REVIEW: "Review"
  719. };
  720. exports.AnnotationStateModelType = AnnotationStateModelType;
  721. const AnnotationMarkedState = {
  722. MARKED: "Marked",
  723. UNMARKED: "Unmarked"
  724. };
  725. exports.AnnotationMarkedState = AnnotationMarkedState;
  726. const AnnotationReviewState = {
  727. ACCEPTED: "Accepted",
  728. REJECTED: "Rejected",
  729. CANCELLED: "Cancelled",
  730. COMPLETED: "Completed",
  731. NONE: "None"
  732. };
  733. exports.AnnotationReviewState = AnnotationReviewState;
  734. const AnnotationReplyType = {
  735. GROUP: "Group",
  736. REPLY: "R"
  737. };
  738. exports.AnnotationReplyType = AnnotationReplyType;
  739. const AnnotationFlag = {
  740. INVISIBLE: 0x01,
  741. HIDDEN: 0x02,
  742. PRINT: 0x04,
  743. NOZOOM: 0x08,
  744. NOROTATE: 0x10,
  745. NOVIEW: 0x20,
  746. READONLY: 0x40,
  747. LOCKED: 0x80,
  748. TOGGLENOVIEW: 0x100,
  749. LOCKEDCONTENTS: 0x200
  750. };
  751. exports.AnnotationFlag = AnnotationFlag;
  752. const AnnotationFieldFlag = {
  753. READONLY: 0x0000001,
  754. REQUIRED: 0x0000002,
  755. NOEXPORT: 0x0000004,
  756. MULTILINE: 0x0001000,
  757. PASSWORD: 0x0002000,
  758. NOTOGGLETOOFF: 0x0004000,
  759. RADIO: 0x0008000,
  760. PUSHBUTTON: 0x0010000,
  761. COMBO: 0x0020000,
  762. EDIT: 0x0040000,
  763. SORT: 0x0080000,
  764. FILESELECT: 0x0100000,
  765. MULTISELECT: 0x0200000,
  766. DONOTSPELLCHECK: 0x0400000,
  767. DONOTSCROLL: 0x0800000,
  768. COMB: 0x1000000,
  769. RICHTEXT: 0x2000000,
  770. RADIOSINUNISON: 0x2000000,
  771. COMMITONSELCHANGE: 0x4000000
  772. };
  773. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  774. const AnnotationBorderStyleType = {
  775. SOLID: 1,
  776. DASHED: 2,
  777. BEVELED: 3,
  778. INSET: 4,
  779. UNDERLINE: 5
  780. };
  781. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  782. const AnnotationActionEventType = {
  783. E: "Mouse Enter",
  784. X: "Mouse Exit",
  785. D: "Mouse Down",
  786. U: "Mouse Up",
  787. Fo: "Focus",
  788. Bl: "Blur",
  789. PO: "PageOpen",
  790. PC: "PageClose",
  791. PV: "PageVisible",
  792. PI: "PageInvisible",
  793. K: "Keystroke",
  794. F: "Format",
  795. V: "Validate",
  796. C: "Calculate"
  797. };
  798. exports.AnnotationActionEventType = AnnotationActionEventType;
  799. const DocumentActionEventType = {
  800. WC: "WillClose",
  801. WS: "WillSave",
  802. DS: "DidSave",
  803. WP: "WillPrint",
  804. DP: "DidPrint"
  805. };
  806. exports.DocumentActionEventType = DocumentActionEventType;
  807. const PageActionEventType = {
  808. O: "PageOpen",
  809. C: "PageClose"
  810. };
  811. exports.PageActionEventType = PageActionEventType;
  812. const StreamType = {
  813. UNKNOWN: "UNKNOWN",
  814. FLATE: "FLATE",
  815. LZW: "LZW",
  816. DCT: "DCT",
  817. JPX: "JPX",
  818. JBIG: "JBIG",
  819. A85: "A85",
  820. AHX: "AHX",
  821. CCF: "CCF",
  822. RLX: "RLX"
  823. };
  824. exports.StreamType = StreamType;
  825. const FontType = {
  826. UNKNOWN: "UNKNOWN",
  827. TYPE1: "TYPE1",
  828. TYPE1STANDARD: "TYPE1STANDARD",
  829. TYPE1C: "TYPE1C",
  830. CIDFONTTYPE0: "CIDFONTTYPE0",
  831. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  832. TRUETYPE: "TRUETYPE",
  833. CIDFONTTYPE2: "CIDFONTTYPE2",
  834. TYPE3: "TYPE3",
  835. OPENTYPE: "OPENTYPE",
  836. TYPE0: "TYPE0",
  837. MMTYPE1: "MMTYPE1"
  838. };
  839. exports.FontType = FontType;
  840. const VerbosityLevel = {
  841. ERRORS: 0,
  842. WARNINGS: 1,
  843. INFOS: 5
  844. };
  845. exports.VerbosityLevel = VerbosityLevel;
  846. const CMapCompressionType = {
  847. NONE: 0,
  848. BINARY: 1,
  849. STREAM: 2
  850. };
  851. exports.CMapCompressionType = CMapCompressionType;
  852. const OPS = {
  853. dependency: 1,
  854. setLineWidth: 2,
  855. setLineCap: 3,
  856. setLineJoin: 4,
  857. setMiterLimit: 5,
  858. setDash: 6,
  859. setRenderingIntent: 7,
  860. setFlatness: 8,
  861. setGState: 9,
  862. save: 10,
  863. restore: 11,
  864. transform: 12,
  865. moveTo: 13,
  866. lineTo: 14,
  867. curveTo: 15,
  868. curveTo2: 16,
  869. curveTo3: 17,
  870. closePath: 18,
  871. rectangle: 19,
  872. stroke: 20,
  873. closeStroke: 21,
  874. fill: 22,
  875. eoFill: 23,
  876. fillStroke: 24,
  877. eoFillStroke: 25,
  878. closeFillStroke: 26,
  879. closeEOFillStroke: 27,
  880. endPath: 28,
  881. clip: 29,
  882. eoClip: 30,
  883. beginText: 31,
  884. endText: 32,
  885. setCharSpacing: 33,
  886. setWordSpacing: 34,
  887. setHScale: 35,
  888. setLeading: 36,
  889. setFont: 37,
  890. setTextRenderingMode: 38,
  891. setTextRise: 39,
  892. moveText: 40,
  893. setLeadingMoveText: 41,
  894. setTextMatrix: 42,
  895. nextLine: 43,
  896. showText: 44,
  897. showSpacedText: 45,
  898. nextLineShowText: 46,
  899. nextLineSetSpacingShowText: 47,
  900. setCharWidth: 48,
  901. setCharWidthAndBounds: 49,
  902. setStrokeColorSpace: 50,
  903. setFillColorSpace: 51,
  904. setStrokeColor: 52,
  905. setStrokeColorN: 53,
  906. setFillColor: 54,
  907. setFillColorN: 55,
  908. setStrokeGray: 56,
  909. setFillGray: 57,
  910. setStrokeRGBColor: 58,
  911. setFillRGBColor: 59,
  912. setStrokeCMYKColor: 60,
  913. setFillCMYKColor: 61,
  914. shadingFill: 62,
  915. beginInlineImage: 63,
  916. beginImageData: 64,
  917. endInlineImage: 65,
  918. paintXObject: 66,
  919. markPoint: 67,
  920. markPointProps: 68,
  921. beginMarkedContent: 69,
  922. beginMarkedContentProps: 70,
  923. endMarkedContent: 71,
  924. beginCompat: 72,
  925. endCompat: 73,
  926. paintFormXObjectBegin: 74,
  927. paintFormXObjectEnd: 75,
  928. beginGroup: 76,
  929. endGroup: 77,
  930. beginAnnotations: 78,
  931. endAnnotations: 79,
  932. beginAnnotation: 80,
  933. endAnnotation: 81,
  934. paintJpegXObject: 82,
  935. paintImageMaskXObject: 83,
  936. paintImageMaskXObjectGroup: 84,
  937. paintImageXObject: 85,
  938. paintInlineImageXObject: 86,
  939. paintInlineImageXObjectGroup: 87,
  940. paintImageXObjectRepeat: 88,
  941. paintImageMaskXObjectRepeat: 89,
  942. paintSolidColorImageMask: 90,
  943. constructPath: 91
  944. };
  945. exports.OPS = OPS;
  946. const UNSUPPORTED_FEATURES = {
  947. unknown: "unknown",
  948. forms: "forms",
  949. javaScript: "javaScript",
  950. signatures: "signatures",
  951. smask: "smask",
  952. shadingPattern: "shadingPattern",
  953. font: "font",
  954. errorTilingPattern: "errorTilingPattern",
  955. errorExtGState: "errorExtGState",
  956. errorXObject: "errorXObject",
  957. errorFontLoadType3: "errorFontLoadType3",
  958. errorFontState: "errorFontState",
  959. errorFontMissing: "errorFontMissing",
  960. errorFontTranslate: "errorFontTranslate",
  961. errorColorSpace: "errorColorSpace",
  962. errorOperatorList: "errorOperatorList",
  963. errorFontToUnicode: "errorFontToUnicode",
  964. errorFontLoadNative: "errorFontLoadNative",
  965. errorFontBuildPath: "errorFontBuildPath",
  966. errorFontGetPath: "errorFontGetPath",
  967. errorMarkedContent: "errorMarkedContent"
  968. };
  969. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  970. const PasswordResponses = {
  971. NEED_PASSWORD: 1,
  972. INCORRECT_PASSWORD: 2
  973. };
  974. exports.PasswordResponses = PasswordResponses;
  975. let verbosity = VerbosityLevel.WARNINGS;
  976. function setVerbosityLevel(level) {
  977. if (Number.isInteger(level)) {
  978. verbosity = level;
  979. }
  980. }
  981. function getVerbosityLevel() {
  982. return verbosity;
  983. }
  984. function info(msg) {
  985. if (verbosity >= VerbosityLevel.INFOS) {
  986. console.log(`Info: ${msg}`);
  987. }
  988. }
  989. function warn(msg) {
  990. if (verbosity >= VerbosityLevel.WARNINGS) {
  991. console.log(`Warning: ${msg}`);
  992. }
  993. }
  994. function unreachable(msg) {
  995. throw new Error(msg);
  996. }
  997. function assert(cond, msg) {
  998. if (!cond) {
  999. unreachable(msg);
  1000. }
  1001. }
  1002. function isSameOrigin(baseUrl, otherUrl) {
  1003. let base;
  1004. try {
  1005. base = new URL(baseUrl);
  1006. if (!base.origin || base.origin === "null") {
  1007. return false;
  1008. }
  1009. } catch (e) {
  1010. return false;
  1011. }
  1012. const other = new URL(otherUrl, base);
  1013. return base.origin === other.origin;
  1014. }
  1015. function _isValidProtocol(url) {
  1016. if (!url) {
  1017. return false;
  1018. }
  1019. switch (url.protocol) {
  1020. case "http:":
  1021. case "https:":
  1022. case "ftp:":
  1023. case "mailto:":
  1024. case "tel:":
  1025. return true;
  1026. default:
  1027. return false;
  1028. }
  1029. }
  1030. function createValidAbsoluteUrl(url, baseUrl) {
  1031. if (!url) {
  1032. return null;
  1033. }
  1034. try {
  1035. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1036. if (_isValidProtocol(absoluteUrl)) {
  1037. return absoluteUrl;
  1038. }
  1039. } catch (ex) {}
  1040. return null;
  1041. }
  1042. function shadow(obj, prop, value) {
  1043. Object.defineProperty(obj, prop, {
  1044. value,
  1045. enumerable: true,
  1046. configurable: true,
  1047. writable: false
  1048. });
  1049. return value;
  1050. }
  1051. const BaseException = function BaseExceptionClosure() {
  1052. function BaseException(message) {
  1053. if (this.constructor === BaseException) {
  1054. unreachable("Cannot initialize BaseException.");
  1055. }
  1056. this.message = message;
  1057. this.name = this.constructor.name;
  1058. }
  1059. BaseException.prototype = new Error();
  1060. BaseException.constructor = BaseException;
  1061. return BaseException;
  1062. }();
  1063. exports.BaseException = BaseException;
  1064. class PasswordException extends BaseException {
  1065. constructor(msg, code) {
  1066. super(msg);
  1067. this.code = code;
  1068. }
  1069. }
  1070. exports.PasswordException = PasswordException;
  1071. class UnknownErrorException extends BaseException {
  1072. constructor(msg, details) {
  1073. super(msg);
  1074. this.details = details;
  1075. }
  1076. }
  1077. exports.UnknownErrorException = UnknownErrorException;
  1078. class InvalidPDFException extends BaseException {}
  1079. exports.InvalidPDFException = InvalidPDFException;
  1080. class MissingPDFException extends BaseException {}
  1081. exports.MissingPDFException = MissingPDFException;
  1082. class UnexpectedResponseException extends BaseException {
  1083. constructor(msg, status) {
  1084. super(msg);
  1085. this.status = status;
  1086. }
  1087. }
  1088. exports.UnexpectedResponseException = UnexpectedResponseException;
  1089. class FormatError extends BaseException {}
  1090. exports.FormatError = FormatError;
  1091. class AbortException extends BaseException {}
  1092. exports.AbortException = AbortException;
  1093. const NullCharactersRegExp = /\x00/g;
  1094. function removeNullCharacters(str) {
  1095. if (typeof str !== "string") {
  1096. warn("The argument for removeNullCharacters must be a string.");
  1097. return str;
  1098. }
  1099. return str.replace(NullCharactersRegExp, "");
  1100. }
  1101. function bytesToString(bytes) {
  1102. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1103. const length = bytes.length;
  1104. const MAX_ARGUMENT_COUNT = 8192;
  1105. if (length < MAX_ARGUMENT_COUNT) {
  1106. return String.fromCharCode.apply(null, bytes);
  1107. }
  1108. const strBuf = [];
  1109. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1110. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1111. const chunk = bytes.subarray(i, chunkEnd);
  1112. strBuf.push(String.fromCharCode.apply(null, chunk));
  1113. }
  1114. return strBuf.join("");
  1115. }
  1116. function stringToBytes(str) {
  1117. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1118. const length = str.length;
  1119. const bytes = new Uint8Array(length);
  1120. for (let i = 0; i < length; ++i) {
  1121. bytes[i] = str.charCodeAt(i) & 0xff;
  1122. }
  1123. return bytes;
  1124. }
  1125. function arrayByteLength(arr) {
  1126. if (arr.length !== undefined) {
  1127. return arr.length;
  1128. }
  1129. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1130. return arr.byteLength;
  1131. }
  1132. function arraysToBytes(arr) {
  1133. const length = arr.length;
  1134. if (length === 1 && arr[0] instanceof Uint8Array) {
  1135. return arr[0];
  1136. }
  1137. let resultLength = 0;
  1138. for (let i = 0; i < length; i++) {
  1139. resultLength += arrayByteLength(arr[i]);
  1140. }
  1141. let pos = 0;
  1142. const data = new Uint8Array(resultLength);
  1143. for (let i = 0; i < length; i++) {
  1144. let item = arr[i];
  1145. if (!(item instanceof Uint8Array)) {
  1146. if (typeof item === "string") {
  1147. item = stringToBytes(item);
  1148. } else {
  1149. item = new Uint8Array(item);
  1150. }
  1151. }
  1152. const itemLength = item.byteLength;
  1153. data.set(item, pos);
  1154. pos += itemLength;
  1155. }
  1156. return data;
  1157. }
  1158. function string32(value) {
  1159. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1160. }
  1161. function objectSize(obj) {
  1162. return Object.keys(obj).length;
  1163. }
  1164. function objectFromMap(map) {
  1165. const obj = Object.create(null);
  1166. for (const [key, value] of map) {
  1167. obj[key] = value;
  1168. }
  1169. return obj;
  1170. }
  1171. function isLittleEndian() {
  1172. const buffer8 = new Uint8Array(4);
  1173. buffer8[0] = 1;
  1174. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1175. return view32[0] === 1;
  1176. }
  1177. const IsLittleEndianCached = {
  1178. get value() {
  1179. return shadow(this, "value", isLittleEndian());
  1180. }
  1181. };
  1182. exports.IsLittleEndianCached = IsLittleEndianCached;
  1183. function isEvalSupported() {
  1184. try {
  1185. new Function("");
  1186. return true;
  1187. } catch (e) {
  1188. return false;
  1189. }
  1190. }
  1191. const IsEvalSupportedCached = {
  1192. get value() {
  1193. return shadow(this, "value", isEvalSupported());
  1194. }
  1195. };
  1196. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1197. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1198. class Util {
  1199. static makeHexColor(r, g, b) {
  1200. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1201. }
  1202. static transform(m1, m2) {
  1203. 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]];
  1204. }
  1205. static applyTransform(p, m) {
  1206. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1207. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1208. return [xt, yt];
  1209. }
  1210. static applyInverseTransform(p, m) {
  1211. const d = m[0] * m[3] - m[1] * m[2];
  1212. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1213. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1214. return [xt, yt];
  1215. }
  1216. static getAxialAlignedBoundingBox(r, m) {
  1217. const p1 = Util.applyTransform(r, m);
  1218. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1219. const p3 = Util.applyTransform([r[0], r[3]], m);
  1220. const p4 = Util.applyTransform([r[2], r[1]], m);
  1221. 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])];
  1222. }
  1223. static inverseTransform(m) {
  1224. const d = m[0] * m[3] - m[1] * m[2];
  1225. 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];
  1226. }
  1227. static apply3dTransform(m, v) {
  1228. 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]];
  1229. }
  1230. static singularValueDecompose2dScale(m) {
  1231. const transpose = [m[0], m[2], m[1], m[3]];
  1232. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1233. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1234. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1235. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1236. const first = (a + d) / 2;
  1237. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1238. const sx = first + second || 1;
  1239. const sy = first - second || 1;
  1240. return [Math.sqrt(sx), Math.sqrt(sy)];
  1241. }
  1242. static normalizeRect(rect) {
  1243. const r = rect.slice(0);
  1244. if (rect[0] > rect[2]) {
  1245. r[0] = rect[2];
  1246. r[2] = rect[0];
  1247. }
  1248. if (rect[1] > rect[3]) {
  1249. r[1] = rect[3];
  1250. r[3] = rect[1];
  1251. }
  1252. return r;
  1253. }
  1254. static intersect(rect1, rect2) {
  1255. function compare(a, b) {
  1256. return a - b;
  1257. }
  1258. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1259. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1260. const result = [];
  1261. rect1 = Util.normalizeRect(rect1);
  1262. rect2 = Util.normalizeRect(rect2);
  1263. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1264. result[0] = orderedX[1];
  1265. result[2] = orderedX[2];
  1266. } else {
  1267. return null;
  1268. }
  1269. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1270. result[1] = orderedY[1];
  1271. result[3] = orderedY[2];
  1272. } else {
  1273. return null;
  1274. }
  1275. return result;
  1276. }
  1277. }
  1278. exports.Util = Util;
  1279. 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];
  1280. function stringToPDFString(str) {
  1281. const length = str.length,
  1282. strBuf = [];
  1283. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1284. for (let i = 2; i < length; i += 2) {
  1285. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1286. }
  1287. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1288. for (let i = 2; i < length; i += 2) {
  1289. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1290. }
  1291. } else {
  1292. for (let i = 0; i < length; ++i) {
  1293. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1294. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1295. }
  1296. }
  1297. return strBuf.join("");
  1298. }
  1299. function escapeString(str) {
  1300. return str.replace(/([()\\\n\r])/g, match => {
  1301. if (match === "\n") {
  1302. return "\\n";
  1303. } else if (match === "\r") {
  1304. return "\\r";
  1305. }
  1306. return `\\${match}`;
  1307. });
  1308. }
  1309. function isAscii(str) {
  1310. return /^[\x00-\x7F]*$/.test(str);
  1311. }
  1312. function stringToUTF16BEString(str) {
  1313. const buf = ["\xFE\xFF"];
  1314. for (let i = 0, ii = str.length; i < ii; i++) {
  1315. const char = str.charCodeAt(i);
  1316. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1317. }
  1318. return buf.join("");
  1319. }
  1320. function stringToUTF8String(str) {
  1321. return decodeURIComponent(escape(str));
  1322. }
  1323. function utf8StringToString(str) {
  1324. return unescape(encodeURIComponent(str));
  1325. }
  1326. function isBool(v) {
  1327. return typeof v === "boolean";
  1328. }
  1329. function isNum(v) {
  1330. return typeof v === "number";
  1331. }
  1332. function isString(v) {
  1333. return typeof v === "string";
  1334. }
  1335. function isArrayBuffer(v) {
  1336. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1337. }
  1338. function isArrayEqual(arr1, arr2) {
  1339. if (arr1.length !== arr2.length) {
  1340. return false;
  1341. }
  1342. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1343. if (arr1[i] !== arr2[i]) {
  1344. return false;
  1345. }
  1346. }
  1347. return true;
  1348. }
  1349. function getModificationDate(date = new Date()) {
  1350. 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")];
  1351. return buffer.join("");
  1352. }
  1353. function createPromiseCapability() {
  1354. const capability = Object.create(null);
  1355. let isSettled = false;
  1356. Object.defineProperty(capability, "settled", {
  1357. get() {
  1358. return isSettled;
  1359. }
  1360. });
  1361. capability.promise = new Promise(function (resolve, reject) {
  1362. capability.resolve = function (data) {
  1363. isSettled = true;
  1364. resolve(data);
  1365. };
  1366. capability.reject = function (reason) {
  1367. isSettled = true;
  1368. reject(reason);
  1369. };
  1370. });
  1371. return capability;
  1372. }
  1373. function createObjectURL(data, contentType = "", forceDataSchema = false) {
  1374. if (URL.createObjectURL && !forceDataSchema) {
  1375. return URL.createObjectURL(new Blob([data], {
  1376. type: contentType
  1377. }));
  1378. }
  1379. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1380. let buffer = `data:${contentType};base64,`;
  1381. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1382. const b1 = data[i] & 0xff;
  1383. const b2 = data[i + 1] & 0xff;
  1384. const b3 = data[i + 2] & 0xff;
  1385. const d1 = b1 >> 2,
  1386. d2 = (b1 & 3) << 4 | b2 >> 4;
  1387. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1388. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1389. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1390. }
  1391. return buffer;
  1392. }
  1393. /***/ }),
  1394. /* 3 */
  1395. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1396. var _is_node = __w_pdfjs_require__(4);
  1397. ;
  1398. /***/ }),
  1399. /* 4 */
  1400. /***/ ((__unused_webpack_module, exports) => {
  1401. Object.defineProperty(exports, "__esModule", ({
  1402. value: true
  1403. }));
  1404. exports.isNodeJS = void 0;
  1405. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1406. exports.isNodeJS = isNodeJS;
  1407. /***/ }),
  1408. /* 5 */
  1409. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1410. Object.defineProperty(exports, "__esModule", ({
  1411. value: true
  1412. }));
  1413. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1414. exports.isCmd = isCmd;
  1415. exports.isDict = isDict;
  1416. exports.isEOF = isEOF;
  1417. exports.isName = isName;
  1418. exports.isRef = isRef;
  1419. exports.isRefsEqual = isRefsEqual;
  1420. exports.isStream = isStream;
  1421. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = void 0;
  1422. var _util = __w_pdfjs_require__(2);
  1423. var _base_stream = __w_pdfjs_require__(6);
  1424. const EOF = {};
  1425. exports.EOF = EOF;
  1426. const Name = function NameClosure() {
  1427. let nameCache = Object.create(null);
  1428. class Name {
  1429. constructor(name) {
  1430. this.name = name;
  1431. }
  1432. static get(name) {
  1433. const nameValue = nameCache[name];
  1434. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1435. }
  1436. static _clearCache() {
  1437. nameCache = Object.create(null);
  1438. }
  1439. }
  1440. return Name;
  1441. }();
  1442. exports.Name = Name;
  1443. const Cmd = function CmdClosure() {
  1444. let cmdCache = Object.create(null);
  1445. class Cmd {
  1446. constructor(cmd) {
  1447. this.cmd = cmd;
  1448. }
  1449. static get(cmd) {
  1450. const cmdValue = cmdCache[cmd];
  1451. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1452. }
  1453. static _clearCache() {
  1454. cmdCache = Object.create(null);
  1455. }
  1456. }
  1457. return Cmd;
  1458. }();
  1459. exports.Cmd = Cmd;
  1460. const nonSerializable = function nonSerializableClosure() {
  1461. return nonSerializable;
  1462. };
  1463. class Dict {
  1464. constructor(xref = null) {
  1465. this._map = Object.create(null);
  1466. this.xref = xref;
  1467. this.objId = null;
  1468. this.suppressEncryption = false;
  1469. this.__nonSerializable__ = nonSerializable;
  1470. }
  1471. assignXref(newXref) {
  1472. this.xref = newXref;
  1473. }
  1474. get size() {
  1475. return Object.keys(this._map).length;
  1476. }
  1477. get(key1, key2, key3) {
  1478. let value = this._map[key1];
  1479. if (value === undefined && key2 !== undefined) {
  1480. value = this._map[key2];
  1481. if (value === undefined && key3 !== undefined) {
  1482. value = this._map[key3];
  1483. }
  1484. }
  1485. if (value instanceof Ref && this.xref) {
  1486. return this.xref.fetch(value, this.suppressEncryption);
  1487. }
  1488. return value;
  1489. }
  1490. async getAsync(key1, key2, key3) {
  1491. let value = this._map[key1];
  1492. if (value === undefined && key2 !== undefined) {
  1493. value = this._map[key2];
  1494. if (value === undefined && key3 !== undefined) {
  1495. value = this._map[key3];
  1496. }
  1497. }
  1498. if (value instanceof Ref && this.xref) {
  1499. return this.xref.fetchAsync(value, this.suppressEncryption);
  1500. }
  1501. return value;
  1502. }
  1503. getArray(key1, key2, key3) {
  1504. let value = this._map[key1];
  1505. if (value === undefined && key2 !== undefined) {
  1506. value = this._map[key2];
  1507. if (value === undefined && key3 !== undefined) {
  1508. value = this._map[key3];
  1509. }
  1510. }
  1511. if (value instanceof Ref && this.xref) {
  1512. value = this.xref.fetch(value, this.suppressEncryption);
  1513. }
  1514. if (Array.isArray(value)) {
  1515. value = value.slice();
  1516. for (let i = 0, ii = value.length; i < ii; i++) {
  1517. if (value[i] instanceof Ref && this.xref) {
  1518. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1519. }
  1520. }
  1521. }
  1522. return value;
  1523. }
  1524. getRaw(key) {
  1525. return this._map[key];
  1526. }
  1527. getKeys() {
  1528. return Object.keys(this._map);
  1529. }
  1530. getRawValues() {
  1531. return Object.values(this._map);
  1532. }
  1533. set(key, value) {
  1534. this._map[key] = value;
  1535. }
  1536. has(key) {
  1537. return this._map[key] !== undefined;
  1538. }
  1539. forEach(callback) {
  1540. for (const key in this._map) {
  1541. callback(key, this.get(key));
  1542. }
  1543. }
  1544. static get empty() {
  1545. const emptyDict = new Dict(null);
  1546. emptyDict.set = (key, value) => {
  1547. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1548. };
  1549. return (0, _util.shadow)(this, "empty", emptyDict);
  1550. }
  1551. static merge({
  1552. xref,
  1553. dictArray,
  1554. mergeSubDicts = false
  1555. }) {
  1556. const mergedDict = new Dict(xref),
  1557. properties = new Map();
  1558. for (const dict of dictArray) {
  1559. if (!(dict instanceof Dict)) {
  1560. continue;
  1561. }
  1562. for (const [key, value] of Object.entries(dict._map)) {
  1563. let property = properties.get(key);
  1564. if (property === undefined) {
  1565. property = [];
  1566. properties.set(key, property);
  1567. } else if (!mergeSubDicts) {
  1568. continue;
  1569. }
  1570. property.push(value);
  1571. }
  1572. }
  1573. for (const [name, values] of properties) {
  1574. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1575. mergedDict._map[name] = values[0];
  1576. continue;
  1577. }
  1578. const subDict = new Dict(xref);
  1579. for (const dict of values) {
  1580. if (!(dict instanceof Dict)) {
  1581. continue;
  1582. }
  1583. for (const [key, value] of Object.entries(dict._map)) {
  1584. if (subDict._map[key] === undefined) {
  1585. subDict._map[key] = value;
  1586. }
  1587. }
  1588. }
  1589. if (subDict.size > 0) {
  1590. mergedDict._map[name] = subDict;
  1591. }
  1592. }
  1593. properties.clear();
  1594. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1595. }
  1596. }
  1597. exports.Dict = Dict;
  1598. const Ref = function RefClosure() {
  1599. let refCache = Object.create(null);
  1600. class Ref {
  1601. constructor(num, gen) {
  1602. this.num = num;
  1603. this.gen = gen;
  1604. }
  1605. toString() {
  1606. if (this.gen === 0) {
  1607. return `${this.num}R`;
  1608. }
  1609. return `${this.num}R${this.gen}`;
  1610. }
  1611. static get(num, gen) {
  1612. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1613. const refValue = refCache[key];
  1614. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1615. }
  1616. static _clearCache() {
  1617. refCache = Object.create(null);
  1618. }
  1619. }
  1620. return Ref;
  1621. }();
  1622. exports.Ref = Ref;
  1623. class RefSet {
  1624. constructor(parent = null) {
  1625. this._set = new Set(parent && parent._set);
  1626. }
  1627. has(ref) {
  1628. return this._set.has(ref.toString());
  1629. }
  1630. put(ref) {
  1631. this._set.add(ref.toString());
  1632. }
  1633. remove(ref) {
  1634. this._set.delete(ref.toString());
  1635. }
  1636. forEach(callback) {
  1637. for (const ref of this._set.values()) {
  1638. callback(ref);
  1639. }
  1640. }
  1641. clear() {
  1642. this._set.clear();
  1643. }
  1644. }
  1645. exports.RefSet = RefSet;
  1646. class RefSetCache {
  1647. constructor() {
  1648. this._map = new Map();
  1649. }
  1650. get size() {
  1651. return this._map.size;
  1652. }
  1653. get(ref) {
  1654. return this._map.get(ref.toString());
  1655. }
  1656. has(ref) {
  1657. return this._map.has(ref.toString());
  1658. }
  1659. put(ref, obj) {
  1660. this._map.set(ref.toString(), obj);
  1661. }
  1662. putAlias(ref, aliasRef) {
  1663. this._map.set(ref.toString(), this.get(aliasRef));
  1664. }
  1665. forEach(callback) {
  1666. for (const value of this._map.values()) {
  1667. callback(value);
  1668. }
  1669. }
  1670. clear() {
  1671. this._map.clear();
  1672. }
  1673. }
  1674. exports.RefSetCache = RefSetCache;
  1675. function isEOF(v) {
  1676. return v === EOF;
  1677. }
  1678. function isName(v, name) {
  1679. return v instanceof Name && (name === undefined || v.name === name);
  1680. }
  1681. function isCmd(v, cmd) {
  1682. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1683. }
  1684. function isDict(v, type) {
  1685. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1686. }
  1687. function isRef(v) {
  1688. return v instanceof Ref;
  1689. }
  1690. function isRefsEqual(v1, v2) {
  1691. return v1.num === v2.num && v1.gen === v2.gen;
  1692. }
  1693. function isStream(v) {
  1694. return v instanceof _base_stream.BaseStream;
  1695. }
  1696. function clearPrimitiveCaches() {
  1697. Cmd._clearCache();
  1698. Name._clearCache();
  1699. Ref._clearCache();
  1700. }
  1701. /***/ }),
  1702. /* 6 */
  1703. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1704. Object.defineProperty(exports, "__esModule", ({
  1705. value: true
  1706. }));
  1707. exports.BaseStream = void 0;
  1708. var _util = __w_pdfjs_require__(2);
  1709. class BaseStream {
  1710. constructor() {
  1711. if (this.constructor === BaseStream) {
  1712. (0, _util.unreachable)("Cannot initialize BaseStream.");
  1713. }
  1714. }
  1715. get length() {
  1716. (0, _util.unreachable)("Abstract getter `length` accessed");
  1717. }
  1718. get isEmpty() {
  1719. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  1720. }
  1721. get isDataLoaded() {
  1722. return (0, _util.shadow)(this, "isDataLoaded", true);
  1723. }
  1724. getByte() {
  1725. (0, _util.unreachable)("Abstract method `getByte` called");
  1726. }
  1727. getBytes(length, forceClamped = false) {
  1728. (0, _util.unreachable)("Abstract method `getBytes` called");
  1729. }
  1730. peekByte() {
  1731. const peekedByte = this.getByte();
  1732. if (peekedByte !== -1) {
  1733. this.pos--;
  1734. }
  1735. return peekedByte;
  1736. }
  1737. peekBytes(length, forceClamped = false) {
  1738. const bytes = this.getBytes(length, forceClamped);
  1739. this.pos -= bytes.length;
  1740. return bytes;
  1741. }
  1742. getUint16() {
  1743. const b0 = this.getByte();
  1744. const b1 = this.getByte();
  1745. if (b0 === -1 || b1 === -1) {
  1746. return -1;
  1747. }
  1748. return (b0 << 8) + b1;
  1749. }
  1750. getInt32() {
  1751. const b0 = this.getByte();
  1752. const b1 = this.getByte();
  1753. const b2 = this.getByte();
  1754. const b3 = this.getByte();
  1755. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1756. }
  1757. getByteRange(begin, end) {
  1758. (0, _util.unreachable)("Abstract method `getByteRange` called");
  1759. }
  1760. getString(length) {
  1761. return (0, _util.bytesToString)(this.getBytes(length, false));
  1762. }
  1763. skip(n) {
  1764. this.pos += n || 1;
  1765. }
  1766. reset() {
  1767. (0, _util.unreachable)("Abstract method `reset` called");
  1768. }
  1769. moveStart() {
  1770. (0, _util.unreachable)("Abstract method `moveStart` called");
  1771. }
  1772. makeSubStream(start, length, dict = null) {
  1773. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  1774. }
  1775. getBaseStreams() {
  1776. return null;
  1777. }
  1778. }
  1779. exports.BaseStream = BaseStream;
  1780. /***/ }),
  1781. /* 7 */
  1782. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1783. Object.defineProperty(exports, "__esModule", ({
  1784. value: true
  1785. }));
  1786. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1787. var _util = __w_pdfjs_require__(2);
  1788. var _chunked_stream = __w_pdfjs_require__(8);
  1789. var _core_utils = __w_pdfjs_require__(9);
  1790. var _document = __w_pdfjs_require__(11);
  1791. var _stream = __w_pdfjs_require__(10);
  1792. function parseDocBaseUrl(url) {
  1793. if (url) {
  1794. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1795. if (absoluteUrl) {
  1796. return absoluteUrl.href;
  1797. }
  1798. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1799. }
  1800. return null;
  1801. }
  1802. class BasePdfManager {
  1803. constructor() {
  1804. if (this.constructor === BasePdfManager) {
  1805. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1806. }
  1807. }
  1808. get docId() {
  1809. return this._docId;
  1810. }
  1811. get password() {
  1812. return this._password;
  1813. }
  1814. get docBaseUrl() {
  1815. return this._docBaseUrl;
  1816. }
  1817. onLoadedStream() {
  1818. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1819. }
  1820. ensureDoc(prop, args) {
  1821. return this.ensure(this.pdfDocument, prop, args);
  1822. }
  1823. ensureXRef(prop, args) {
  1824. return this.ensure(this.pdfDocument.xref, prop, args);
  1825. }
  1826. ensureCatalog(prop, args) {
  1827. return this.ensure(this.pdfDocument.catalog, prop, args);
  1828. }
  1829. getPage(pageIndex) {
  1830. return this.pdfDocument.getPage(pageIndex);
  1831. }
  1832. fontFallback(id, handler) {
  1833. return this.pdfDocument.fontFallback(id, handler);
  1834. }
  1835. loadXfaFonts(handler, task) {
  1836. return this.pdfDocument.loadXfaFonts(handler, task);
  1837. }
  1838. loadXfaImages() {
  1839. return this.pdfDocument.loadXfaImages();
  1840. }
  1841. serializeXfaData(annotationStorage) {
  1842. return this.pdfDocument.serializeXfaData(annotationStorage);
  1843. }
  1844. cleanup(manuallyTriggered = false) {
  1845. return this.pdfDocument.cleanup(manuallyTriggered);
  1846. }
  1847. async ensure(obj, prop, args) {
  1848. (0, _util.unreachable)("Abstract method `ensure` called");
  1849. }
  1850. requestRange(begin, end) {
  1851. (0, _util.unreachable)("Abstract method `requestRange` called");
  1852. }
  1853. requestLoadedStream() {
  1854. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1855. }
  1856. sendProgressiveData(chunk) {
  1857. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1858. }
  1859. updatePassword(password) {
  1860. this._password = password;
  1861. }
  1862. terminate(reason) {
  1863. (0, _util.unreachable)("Abstract method `terminate` called");
  1864. }
  1865. }
  1866. class LocalPdfManager extends BasePdfManager {
  1867. constructor(docId, data, password, evaluatorOptions, enableXfa, docBaseUrl) {
  1868. super();
  1869. this._docId = docId;
  1870. this._password = password;
  1871. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1872. this.evaluatorOptions = evaluatorOptions;
  1873. this.enableXfa = enableXfa;
  1874. const stream = new _stream.Stream(data);
  1875. this.pdfDocument = new _document.PDFDocument(this, stream);
  1876. this._loadedStreamPromise = Promise.resolve(stream);
  1877. }
  1878. async ensure(obj, prop, args) {
  1879. const value = obj[prop];
  1880. if (typeof value === "function") {
  1881. return value.apply(obj, args);
  1882. }
  1883. return value;
  1884. }
  1885. requestRange(begin, end) {
  1886. return Promise.resolve();
  1887. }
  1888. requestLoadedStream() {}
  1889. onLoadedStream() {
  1890. return this._loadedStreamPromise;
  1891. }
  1892. terminate(reason) {}
  1893. }
  1894. exports.LocalPdfManager = LocalPdfManager;
  1895. class NetworkPdfManager extends BasePdfManager {
  1896. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1897. super();
  1898. this._docId = docId;
  1899. this._password = args.password;
  1900. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1901. this.msgHandler = args.msgHandler;
  1902. this.evaluatorOptions = evaluatorOptions;
  1903. this.enableXfa = enableXfa;
  1904. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1905. msgHandler: args.msgHandler,
  1906. length: args.length,
  1907. disableAutoFetch: args.disableAutoFetch,
  1908. rangeChunkSize: args.rangeChunkSize
  1909. });
  1910. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1911. }
  1912. async ensure(obj, prop, args) {
  1913. try {
  1914. const value = obj[prop];
  1915. if (typeof value === "function") {
  1916. return value.apply(obj, args);
  1917. }
  1918. return value;
  1919. } catch (ex) {
  1920. if (!(ex instanceof _core_utils.MissingDataException)) {
  1921. throw ex;
  1922. }
  1923. await this.requestRange(ex.begin, ex.end);
  1924. return this.ensure(obj, prop, args);
  1925. }
  1926. }
  1927. requestRange(begin, end) {
  1928. return this.streamManager.requestRange(begin, end);
  1929. }
  1930. requestLoadedStream() {
  1931. this.streamManager.requestAllChunks();
  1932. }
  1933. sendProgressiveData(chunk) {
  1934. this.streamManager.onReceiveData({
  1935. chunk
  1936. });
  1937. }
  1938. onLoadedStream() {
  1939. return this.streamManager.onLoadedStream();
  1940. }
  1941. terminate(reason) {
  1942. this.streamManager.abort(reason);
  1943. }
  1944. }
  1945. exports.NetworkPdfManager = NetworkPdfManager;
  1946. /***/ }),
  1947. /* 8 */
  1948. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1949. Object.defineProperty(exports, "__esModule", ({
  1950. value: true
  1951. }));
  1952. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1953. var _util = __w_pdfjs_require__(2);
  1954. var _core_utils = __w_pdfjs_require__(9);
  1955. var _stream = __w_pdfjs_require__(10);
  1956. class ChunkedStream extends _stream.Stream {
  1957. constructor(length, chunkSize, manager) {
  1958. super(new Uint8Array(length), 0, length, null);
  1959. this.chunkSize = chunkSize;
  1960. this._loadedChunks = new Set();
  1961. this.numChunks = Math.ceil(length / chunkSize);
  1962. this.manager = manager;
  1963. this.progressiveDataLength = 0;
  1964. this.lastSuccessfulEnsureByteChunk = -1;
  1965. }
  1966. getMissingChunks() {
  1967. const chunks = [];
  1968. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1969. if (!this._loadedChunks.has(chunk)) {
  1970. chunks.push(chunk);
  1971. }
  1972. }
  1973. return chunks;
  1974. }
  1975. get numChunksLoaded() {
  1976. return this._loadedChunks.size;
  1977. }
  1978. get isDataLoaded() {
  1979. return this.numChunksLoaded === this.numChunks;
  1980. }
  1981. onReceiveData(begin, chunk) {
  1982. const chunkSize = this.chunkSize;
  1983. if (begin % chunkSize !== 0) {
  1984. throw new Error(`Bad begin offset: ${begin}`);
  1985. }
  1986. const end = begin + chunk.byteLength;
  1987. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1988. throw new Error(`Bad end offset: ${end}`);
  1989. }
  1990. this.bytes.set(new Uint8Array(chunk), begin);
  1991. const beginChunk = Math.floor(begin / chunkSize);
  1992. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1993. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1994. this._loadedChunks.add(curChunk);
  1995. }
  1996. }
  1997. onReceiveProgressiveData(data) {
  1998. let position = this.progressiveDataLength;
  1999. const beginChunk = Math.floor(position / this.chunkSize);
  2000. this.bytes.set(new Uint8Array(data), position);
  2001. position += data.byteLength;
  2002. this.progressiveDataLength = position;
  2003. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2004. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2005. this._loadedChunks.add(curChunk);
  2006. }
  2007. }
  2008. ensureByte(pos) {
  2009. if (pos < this.progressiveDataLength) {
  2010. return;
  2011. }
  2012. const chunk = Math.floor(pos / this.chunkSize);
  2013. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2014. return;
  2015. }
  2016. if (!this._loadedChunks.has(chunk)) {
  2017. throw new _core_utils.MissingDataException(pos, pos + 1);
  2018. }
  2019. this.lastSuccessfulEnsureByteChunk = chunk;
  2020. }
  2021. ensureRange(begin, end) {
  2022. if (begin >= end) {
  2023. return;
  2024. }
  2025. if (end <= this.progressiveDataLength) {
  2026. return;
  2027. }
  2028. const chunkSize = this.chunkSize;
  2029. const beginChunk = Math.floor(begin / chunkSize);
  2030. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2031. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2032. if (!this._loadedChunks.has(chunk)) {
  2033. throw new _core_utils.MissingDataException(begin, end);
  2034. }
  2035. }
  2036. }
  2037. nextEmptyChunk(beginChunk) {
  2038. const numChunks = this.numChunks;
  2039. for (let i = 0; i < numChunks; ++i) {
  2040. const chunk = (beginChunk + i) % numChunks;
  2041. if (!this._loadedChunks.has(chunk)) {
  2042. return chunk;
  2043. }
  2044. }
  2045. return null;
  2046. }
  2047. hasChunk(chunk) {
  2048. return this._loadedChunks.has(chunk);
  2049. }
  2050. getByte() {
  2051. const pos = this.pos;
  2052. if (pos >= this.end) {
  2053. return -1;
  2054. }
  2055. if (pos >= this.progressiveDataLength) {
  2056. this.ensureByte(pos);
  2057. }
  2058. return this.bytes[this.pos++];
  2059. }
  2060. getBytes(length, forceClamped = false) {
  2061. const bytes = this.bytes;
  2062. const pos = this.pos;
  2063. const strEnd = this.end;
  2064. if (!length) {
  2065. if (strEnd > this.progressiveDataLength) {
  2066. this.ensureRange(pos, strEnd);
  2067. }
  2068. const subarray = bytes.subarray(pos, strEnd);
  2069. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2070. }
  2071. let end = pos + length;
  2072. if (end > strEnd) {
  2073. end = strEnd;
  2074. }
  2075. if (end > this.progressiveDataLength) {
  2076. this.ensureRange(pos, end);
  2077. }
  2078. this.pos = end;
  2079. const subarray = bytes.subarray(pos, end);
  2080. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2081. }
  2082. getByteRange(begin, end) {
  2083. if (begin < 0) {
  2084. begin = 0;
  2085. }
  2086. if (end > this.end) {
  2087. end = this.end;
  2088. }
  2089. if (end > this.progressiveDataLength) {
  2090. this.ensureRange(begin, end);
  2091. }
  2092. return this.bytes.subarray(begin, end);
  2093. }
  2094. makeSubStream(start, length, dict = null) {
  2095. if (length) {
  2096. if (start + length > this.progressiveDataLength) {
  2097. this.ensureRange(start, start + length);
  2098. }
  2099. } else {
  2100. if (start >= this.progressiveDataLength) {
  2101. this.ensureByte(start);
  2102. }
  2103. }
  2104. function ChunkedStreamSubstream() {}
  2105. ChunkedStreamSubstream.prototype = Object.create(this);
  2106. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2107. const chunkSize = this.chunkSize;
  2108. const beginChunk = Math.floor(this.start / chunkSize);
  2109. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2110. const missingChunks = [];
  2111. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2112. if (!this._loadedChunks.has(chunk)) {
  2113. missingChunks.push(chunk);
  2114. }
  2115. }
  2116. return missingChunks;
  2117. };
  2118. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2119. get() {
  2120. if (this.numChunksLoaded === this.numChunks) {
  2121. return true;
  2122. }
  2123. return this.getMissingChunks().length === 0;
  2124. },
  2125. configurable: true
  2126. });
  2127. const subStream = new ChunkedStreamSubstream();
  2128. subStream.pos = subStream.start = start;
  2129. subStream.end = start + length || this.end;
  2130. subStream.dict = dict;
  2131. return subStream;
  2132. }
  2133. getBaseStreams() {
  2134. return [this];
  2135. }
  2136. }
  2137. exports.ChunkedStream = ChunkedStream;
  2138. class ChunkedStreamManager {
  2139. constructor(pdfNetworkStream, args) {
  2140. this.length = args.length;
  2141. this.chunkSize = args.rangeChunkSize;
  2142. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2143. this.pdfNetworkStream = pdfNetworkStream;
  2144. this.disableAutoFetch = args.disableAutoFetch;
  2145. this.msgHandler = args.msgHandler;
  2146. this.currRequestId = 0;
  2147. this._chunksNeededByRequest = new Map();
  2148. this._requestsByChunk = new Map();
  2149. this._promisesByRequest = new Map();
  2150. this.progressiveDataLength = 0;
  2151. this.aborted = false;
  2152. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2153. }
  2154. onLoadedStream() {
  2155. return this._loadedStreamCapability.promise;
  2156. }
  2157. sendRequest(begin, end) {
  2158. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2159. if (!rangeReader.isStreamingSupported) {
  2160. rangeReader.onProgress = this.onProgress.bind(this);
  2161. }
  2162. let chunks = [],
  2163. loaded = 0;
  2164. const promise = new Promise((resolve, reject) => {
  2165. const readChunk = chunk => {
  2166. try {
  2167. if (!chunk.done) {
  2168. const data = chunk.value;
  2169. chunks.push(data);
  2170. loaded += (0, _util.arrayByteLength)(data);
  2171. if (rangeReader.isStreamingSupported) {
  2172. this.onProgress({
  2173. loaded
  2174. });
  2175. }
  2176. rangeReader.read().then(readChunk, reject);
  2177. return;
  2178. }
  2179. const chunkData = (0, _util.arraysToBytes)(chunks);
  2180. chunks = null;
  2181. resolve(chunkData);
  2182. } catch (e) {
  2183. reject(e);
  2184. }
  2185. };
  2186. rangeReader.read().then(readChunk, reject);
  2187. });
  2188. promise.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);
  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. /* 9 */
  2383. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2384. Object.defineProperty(exports, "__esModule", ({
  2385. value: true
  2386. }));
  2387. exports.collectActions = collectActions;
  2388. exports.encodeToXmlString = encodeToXmlString;
  2389. exports.escapePDFName = escapePDFName;
  2390. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2391. exports.getInheritableProperty = getInheritableProperty;
  2392. exports.getLookupTableFactory = getLookupTableFactory;
  2393. exports.isWhiteSpace = isWhiteSpace;
  2394. exports.log2 = log2;
  2395. exports.parseXFAPath = parseXFAPath;
  2396. exports.readInt8 = readInt8;
  2397. exports.readUint16 = readUint16;
  2398. exports.readUint32 = readUint32;
  2399. exports.toRomanNumerals = toRomanNumerals;
  2400. exports.validateCSSFont = validateCSSFont;
  2401. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = void 0;
  2402. var _util = __w_pdfjs_require__(2);
  2403. var _primitives = __w_pdfjs_require__(5);
  2404. function getLookupTableFactory(initializer) {
  2405. let lookup;
  2406. return function () {
  2407. if (initializer) {
  2408. lookup = Object.create(null);
  2409. initializer(lookup);
  2410. initializer = null;
  2411. }
  2412. return lookup;
  2413. };
  2414. }
  2415. function getArrayLookupTableFactory(initializer) {
  2416. let lookup;
  2417. return function () {
  2418. if (initializer) {
  2419. let arr = initializer();
  2420. initializer = null;
  2421. lookup = Object.create(null);
  2422. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2423. lookup[arr[i]] = arr[i + 1];
  2424. }
  2425. arr = null;
  2426. }
  2427. return lookup;
  2428. };
  2429. }
  2430. class MissingDataException extends _util.BaseException {
  2431. constructor(begin, end) {
  2432. super(`Missing data [${begin}, ${end})`);
  2433. this.begin = begin;
  2434. this.end = end;
  2435. }
  2436. }
  2437. exports.MissingDataException = MissingDataException;
  2438. class ParserEOFException extends _util.BaseException {}
  2439. exports.ParserEOFException = ParserEOFException;
  2440. class XRefEntryException extends _util.BaseException {}
  2441. exports.XRefEntryException = XRefEntryException;
  2442. class XRefParseException extends _util.BaseException {}
  2443. exports.XRefParseException = XRefParseException;
  2444. function getInheritableProperty({
  2445. dict,
  2446. key,
  2447. getArray = false,
  2448. stopWhenFound = true
  2449. }) {
  2450. let values;
  2451. const visited = new _primitives.RefSet();
  2452. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2453. if (dict.objId) {
  2454. visited.put(dict.objId);
  2455. }
  2456. const value = getArray ? dict.getArray(key) : dict.get(key);
  2457. if (value !== undefined) {
  2458. if (stopWhenFound) {
  2459. return value;
  2460. }
  2461. if (!values) {
  2462. values = [];
  2463. }
  2464. values.push(value);
  2465. }
  2466. dict = dict.get("Parent");
  2467. }
  2468. return values;
  2469. }
  2470. 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"];
  2471. function toRomanNumerals(number, lowerCase = false) {
  2472. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2473. const romanBuf = [];
  2474. let pos;
  2475. while (number >= 1000) {
  2476. number -= 1000;
  2477. romanBuf.push("M");
  2478. }
  2479. pos = number / 100 | 0;
  2480. number %= 100;
  2481. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2482. pos = number / 10 | 0;
  2483. number %= 10;
  2484. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2485. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2486. const romanStr = romanBuf.join("");
  2487. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2488. }
  2489. function log2(x) {
  2490. if (x <= 0) {
  2491. return 0;
  2492. }
  2493. return Math.ceil(Math.log2(x));
  2494. }
  2495. function readInt8(data, offset) {
  2496. return data[offset] << 24 >> 24;
  2497. }
  2498. function readUint16(data, offset) {
  2499. return data[offset] << 8 | data[offset + 1];
  2500. }
  2501. function readUint32(data, offset) {
  2502. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2503. }
  2504. function isWhiteSpace(ch) {
  2505. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2506. }
  2507. function parseXFAPath(path) {
  2508. const positionPattern = /(.+)\[([0-9]+)\]$/;
  2509. return path.split(".").map(component => {
  2510. const m = component.match(positionPattern);
  2511. if (m) {
  2512. return {
  2513. name: m[1],
  2514. pos: parseInt(m[2], 10)
  2515. };
  2516. }
  2517. return {
  2518. name: component,
  2519. pos: 0
  2520. };
  2521. });
  2522. }
  2523. function escapePDFName(str) {
  2524. const buffer = [];
  2525. let start = 0;
  2526. for (let i = 0, ii = str.length; i < ii; i++) {
  2527. const char = str.charCodeAt(i);
  2528. 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) {
  2529. if (start < i) {
  2530. buffer.push(str.substring(start, i));
  2531. }
  2532. buffer.push(`#${char.toString(16)}`);
  2533. start = i + 1;
  2534. }
  2535. }
  2536. if (buffer.length === 0) {
  2537. return str;
  2538. }
  2539. if (start < str.length) {
  2540. buffer.push(str.substring(start, str.length));
  2541. }
  2542. return buffer.join("");
  2543. }
  2544. function _collectJS(entry, xref, list, parents) {
  2545. if (!entry) {
  2546. return;
  2547. }
  2548. let parent = null;
  2549. if ((0, _primitives.isRef)(entry)) {
  2550. if (parents.has(entry)) {
  2551. return;
  2552. }
  2553. parent = entry;
  2554. parents.put(parent);
  2555. entry = xref.fetch(entry);
  2556. }
  2557. if (Array.isArray(entry)) {
  2558. for (const element of entry) {
  2559. _collectJS(element, xref, list, parents);
  2560. }
  2561. } else if (entry instanceof _primitives.Dict) {
  2562. if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) {
  2563. const js = entry.get("JS");
  2564. let code;
  2565. if ((0, _primitives.isStream)(js)) {
  2566. code = js.getString();
  2567. } else {
  2568. code = js;
  2569. }
  2570. code = (0, _util.stringToPDFString)(code);
  2571. if (code) {
  2572. list.push(code);
  2573. }
  2574. }
  2575. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2576. }
  2577. if (parent) {
  2578. parents.remove(parent);
  2579. }
  2580. }
  2581. function collectActions(xref, dict, eventType) {
  2582. const actions = Object.create(null);
  2583. const additionalActionsDicts = getInheritableProperty({
  2584. dict,
  2585. key: "AA",
  2586. stopWhenFound: false
  2587. });
  2588. if (additionalActionsDicts) {
  2589. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2590. const additionalActions = additionalActionsDicts[i];
  2591. if (!(additionalActions instanceof _primitives.Dict)) {
  2592. continue;
  2593. }
  2594. for (const key of additionalActions.getKeys()) {
  2595. const action = eventType[key];
  2596. if (!action) {
  2597. continue;
  2598. }
  2599. const actionDict = additionalActions.getRaw(key);
  2600. const parents = new _primitives.RefSet();
  2601. const list = [];
  2602. _collectJS(actionDict, xref, list, parents);
  2603. if (list.length > 0) {
  2604. actions[action] = list;
  2605. }
  2606. }
  2607. }
  2608. }
  2609. if (dict.has("A")) {
  2610. const actionDict = dict.get("A");
  2611. const parents = new _primitives.RefSet();
  2612. const list = [];
  2613. _collectJS(actionDict, xref, list, parents);
  2614. if (list.length > 0) {
  2615. actions.Action = list;
  2616. }
  2617. }
  2618. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2619. }
  2620. const XMLEntities = {
  2621. 0x3c: "&lt;",
  2622. 0x3e: "&gt;",
  2623. 0x26: "&amp;",
  2624. 0x22: "&quot;",
  2625. 0x27: "&apos;"
  2626. };
  2627. function encodeToXmlString(str) {
  2628. const buffer = [];
  2629. let start = 0;
  2630. for (let i = 0, ii = str.length; i < ii; i++) {
  2631. const char = str.codePointAt(i);
  2632. if (0x20 <= char && char <= 0x7e) {
  2633. const entity = XMLEntities[char];
  2634. if (entity) {
  2635. if (start < i) {
  2636. buffer.push(str.substring(start, i));
  2637. }
  2638. buffer.push(entity);
  2639. start = i + 1;
  2640. }
  2641. } else {
  2642. if (start < i) {
  2643. buffer.push(str.substring(start, i));
  2644. }
  2645. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2646. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2647. i++;
  2648. }
  2649. start = i + 1;
  2650. }
  2651. }
  2652. if (buffer.length === 0) {
  2653. return str;
  2654. }
  2655. if (start < str.length) {
  2656. buffer.push(str.substring(start, str.length));
  2657. }
  2658. return buffer.join("");
  2659. }
  2660. function validateCSSFont(cssFontInfo) {
  2661. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2662. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2663. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2664. const {
  2665. fontFamily,
  2666. fontWeight,
  2667. italicAngle
  2668. } = cssFontInfo;
  2669. if (/^".*"$/.test(fontFamily)) {
  2670. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2671. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2672. return false;
  2673. }
  2674. } else if (/^'.*'$/.test(fontFamily)) {
  2675. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2676. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2677. return false;
  2678. }
  2679. } else {
  2680. for (const ident of fontFamily.split(/[ \t]+/)) {
  2681. if (/^([0-9]|(-([0-9]|-)))/.test(ident) || !/^[a-zA-Z0-9\-_\\]+$/.test(ident)) {
  2682. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2683. return false;
  2684. }
  2685. }
  2686. }
  2687. const weight = fontWeight ? fontWeight.toString() : "";
  2688. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2689. const angle = parseFloat(italicAngle);
  2690. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2691. return true;
  2692. }
  2693. /***/ }),
  2694. /* 10 */
  2695. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2696. Object.defineProperty(exports, "__esModule", ({
  2697. value: true
  2698. }));
  2699. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2700. var _base_stream = __w_pdfjs_require__(6);
  2701. var _util = __w_pdfjs_require__(2);
  2702. class Stream extends _base_stream.BaseStream {
  2703. constructor(arrayBuffer, start, length, dict) {
  2704. super();
  2705. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2706. this.start = start || 0;
  2707. this.pos = this.start;
  2708. this.end = start + length || this.bytes.length;
  2709. this.dict = dict;
  2710. }
  2711. get length() {
  2712. return this.end - this.start;
  2713. }
  2714. get isEmpty() {
  2715. return this.length === 0;
  2716. }
  2717. getByte() {
  2718. if (this.pos >= this.end) {
  2719. return -1;
  2720. }
  2721. return this.bytes[this.pos++];
  2722. }
  2723. getBytes(length, forceClamped = false) {
  2724. const bytes = this.bytes;
  2725. const pos = this.pos;
  2726. const strEnd = this.end;
  2727. if (!length) {
  2728. const subarray = bytes.subarray(pos, strEnd);
  2729. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2730. }
  2731. let end = pos + length;
  2732. if (end > strEnd) {
  2733. end = strEnd;
  2734. }
  2735. this.pos = end;
  2736. const subarray = bytes.subarray(pos, end);
  2737. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2738. }
  2739. getByteRange(begin, end) {
  2740. if (begin < 0) {
  2741. begin = 0;
  2742. }
  2743. if (end > this.end) {
  2744. end = this.end;
  2745. }
  2746. return this.bytes.subarray(begin, end);
  2747. }
  2748. reset() {
  2749. this.pos = this.start;
  2750. }
  2751. moveStart() {
  2752. this.start = this.pos;
  2753. }
  2754. makeSubStream(start, length, dict = null) {
  2755. return new Stream(this.bytes.buffer, start, length, dict);
  2756. }
  2757. }
  2758. exports.Stream = Stream;
  2759. class StringStream extends Stream {
  2760. constructor(str) {
  2761. super((0, _util.stringToBytes)(str));
  2762. }
  2763. }
  2764. exports.StringStream = StringStream;
  2765. class NullStream extends Stream {
  2766. constructor() {
  2767. super(new Uint8Array(0));
  2768. }
  2769. }
  2770. exports.NullStream = NullStream;
  2771. /***/ }),
  2772. /* 11 */
  2773. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2774. Object.defineProperty(exports, "__esModule", ({
  2775. value: true
  2776. }));
  2777. exports.PDFDocument = exports.Page = void 0;
  2778. var _util = __w_pdfjs_require__(2);
  2779. var _primitives = __w_pdfjs_require__(5);
  2780. var _core_utils = __w_pdfjs_require__(9);
  2781. var _stream = __w_pdfjs_require__(10);
  2782. var _annotation = __w_pdfjs_require__(12);
  2783. var _base_stream = __w_pdfjs_require__(6);
  2784. var _crypto = __w_pdfjs_require__(72);
  2785. var _catalog = __w_pdfjs_require__(64);
  2786. var _xfa_fonts = __w_pdfjs_require__(55);
  2787. var _parser = __w_pdfjs_require__(17);
  2788. var _object_loader = __w_pdfjs_require__(70);
  2789. var _operator_list = __w_pdfjs_require__(62);
  2790. var _evaluator = __w_pdfjs_require__(15);
  2791. var _decode_stream = __w_pdfjs_require__(19);
  2792. var _struct_tree = __w_pdfjs_require__(69);
  2793. var _factory = __w_pdfjs_require__(74);
  2794. var _xref = __w_pdfjs_require__(98);
  2795. const DEFAULT_USER_UNIT = 1.0;
  2796. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2797. class Page {
  2798. constructor({
  2799. pdfManager,
  2800. xref,
  2801. pageIndex,
  2802. pageDict,
  2803. ref,
  2804. globalIdFactory,
  2805. fontCache,
  2806. builtInCMapCache,
  2807. standardFontDataCache,
  2808. globalImageCache,
  2809. nonBlendModesSet,
  2810. xfaFactory
  2811. }) {
  2812. this.pdfManager = pdfManager;
  2813. this.pageIndex = pageIndex;
  2814. this.pageDict = pageDict;
  2815. this.xref = xref;
  2816. this.ref = ref;
  2817. this.fontCache = fontCache;
  2818. this.builtInCMapCache = builtInCMapCache;
  2819. this.standardFontDataCache = standardFontDataCache;
  2820. this.globalImageCache = globalImageCache;
  2821. this.nonBlendModesSet = nonBlendModesSet;
  2822. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2823. this.resourcesPromise = null;
  2824. this.xfaFactory = xfaFactory;
  2825. const idCounters = {
  2826. obj: 0
  2827. };
  2828. this._localIdFactory = class extends globalIdFactory {
  2829. static createObjId() {
  2830. return `p${pageIndex}_${++idCounters.obj}`;
  2831. }
  2832. static getPageObjId() {
  2833. return `page${ref.toString()}`;
  2834. }
  2835. };
  2836. }
  2837. _getInheritableProperty(key, getArray = false) {
  2838. const value = (0, _core_utils.getInheritableProperty)({
  2839. dict: this.pageDict,
  2840. key,
  2841. getArray,
  2842. stopWhenFound: false
  2843. });
  2844. if (!Array.isArray(value)) {
  2845. return value;
  2846. }
  2847. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2848. return value[0];
  2849. }
  2850. return _primitives.Dict.merge({
  2851. xref: this.xref,
  2852. dictArray: value
  2853. });
  2854. }
  2855. get content() {
  2856. return this.pageDict.getArray("Contents");
  2857. }
  2858. get resources() {
  2859. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2860. }
  2861. _getBoundingBox(name) {
  2862. if (this.xfaData) {
  2863. return this.xfaData.bbox;
  2864. }
  2865. const box = this._getInheritableProperty(name, true);
  2866. if (Array.isArray(box) && box.length === 4) {
  2867. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2868. return box;
  2869. }
  2870. (0, _util.warn)(`Empty /${name} entry.`);
  2871. }
  2872. return null;
  2873. }
  2874. get mediaBox() {
  2875. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2876. }
  2877. get cropBox() {
  2878. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2879. }
  2880. get userUnit() {
  2881. let obj = this.pageDict.get("UserUnit");
  2882. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2883. obj = DEFAULT_USER_UNIT;
  2884. }
  2885. return (0, _util.shadow)(this, "userUnit", obj);
  2886. }
  2887. get view() {
  2888. const {
  2889. cropBox,
  2890. mediaBox
  2891. } = this;
  2892. let view;
  2893. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2894. view = mediaBox;
  2895. } else {
  2896. const box = _util.Util.intersect(cropBox, mediaBox);
  2897. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2898. view = box;
  2899. } else {
  2900. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2901. }
  2902. }
  2903. return (0, _util.shadow)(this, "view", view || mediaBox);
  2904. }
  2905. get rotate() {
  2906. let rotate = this._getInheritableProperty("Rotate") || 0;
  2907. if (rotate % 90 !== 0) {
  2908. rotate = 0;
  2909. } else if (rotate >= 360) {
  2910. rotate %= 360;
  2911. } else if (rotate < 0) {
  2912. rotate = (rotate % 360 + 360) % 360;
  2913. }
  2914. return (0, _util.shadow)(this, "rotate", rotate);
  2915. }
  2916. getContentStream() {
  2917. return this.pdfManager.ensure(this, "content").then(content => {
  2918. if (content instanceof _base_stream.BaseStream) {
  2919. return content;
  2920. }
  2921. if (Array.isArray(content)) {
  2922. return new _decode_stream.StreamsSequenceStream(content);
  2923. }
  2924. return new _stream.NullStream();
  2925. });
  2926. }
  2927. get xfaData() {
  2928. if (this.xfaFactory) {
  2929. return (0, _util.shadow)(this, "xfaData", {
  2930. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  2931. });
  2932. }
  2933. return (0, _util.shadow)(this, "xfaData", null);
  2934. }
  2935. save(handler, task, annotationStorage) {
  2936. const partialEvaluator = new _evaluator.PartialEvaluator({
  2937. xref: this.xref,
  2938. handler,
  2939. pageIndex: this.pageIndex,
  2940. idFactory: this._localIdFactory,
  2941. fontCache: this.fontCache,
  2942. builtInCMapCache: this.builtInCMapCache,
  2943. standardFontDataCache: this.standardFontDataCache,
  2944. globalImageCache: this.globalImageCache,
  2945. options: this.evaluatorOptions
  2946. });
  2947. return this._parsedAnnotations.then(function (annotations) {
  2948. const newRefsPromises = [];
  2949. for (const annotation of annotations) {
  2950. if (!annotation.mustBePrinted(annotationStorage)) {
  2951. continue;
  2952. }
  2953. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  2954. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2955. return null;
  2956. }));
  2957. }
  2958. return Promise.all(newRefsPromises);
  2959. });
  2960. }
  2961. loadResources(keys) {
  2962. if (!this.resourcesPromise) {
  2963. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  2964. }
  2965. return this.resourcesPromise.then(() => {
  2966. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  2967. return objectLoader.load();
  2968. });
  2969. }
  2970. getOperatorList({
  2971. handler,
  2972. sink,
  2973. task,
  2974. intent,
  2975. renderInteractiveForms,
  2976. annotationStorage
  2977. }) {
  2978. const contentStreamPromise = this.getContentStream();
  2979. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  2980. const partialEvaluator = new _evaluator.PartialEvaluator({
  2981. xref: this.xref,
  2982. handler,
  2983. pageIndex: this.pageIndex,
  2984. idFactory: this._localIdFactory,
  2985. fontCache: this.fontCache,
  2986. builtInCMapCache: this.builtInCMapCache,
  2987. standardFontDataCache: this.standardFontDataCache,
  2988. globalImageCache: this.globalImageCache,
  2989. options: this.evaluatorOptions
  2990. });
  2991. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2992. const pageListPromise = dataPromises.then(([contentStream]) => {
  2993. const opList = new _operator_list.OperatorList(intent, sink);
  2994. handler.send("StartRenderPage", {
  2995. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  2996. pageIndex: this.pageIndex,
  2997. intent
  2998. });
  2999. return partialEvaluator.getOperatorList({
  3000. stream: contentStream,
  3001. task,
  3002. resources: this.resources,
  3003. operatorList: opList
  3004. }).then(function () {
  3005. return opList;
  3006. });
  3007. });
  3008. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  3009. if (annotations.length === 0) {
  3010. pageOpList.flush(true);
  3011. return {
  3012. length: pageOpList.totalLength
  3013. };
  3014. }
  3015. const annotationIntent = intent.startsWith("oplist-") ? intent.split("-")[1] : intent;
  3016. const opListPromises = [];
  3017. for (const annotation of annotations) {
  3018. if (annotationIntent === "display" && annotation.mustBeViewed(annotationStorage) || annotationIntent === "print" && annotation.mustBePrinted(annotationStorage)) {
  3019. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) {
  3020. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3021. return null;
  3022. }));
  3023. }
  3024. }
  3025. return Promise.all(opListPromises).then(function (opLists) {
  3026. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3027. for (const opList of opLists) {
  3028. pageOpList.addOpList(opList);
  3029. }
  3030. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3031. pageOpList.flush(true);
  3032. return {
  3033. length: pageOpList.totalLength
  3034. };
  3035. });
  3036. });
  3037. }
  3038. extractTextContent({
  3039. handler,
  3040. task,
  3041. normalizeWhitespace,
  3042. includeMarkedContent,
  3043. sink,
  3044. combineTextItems
  3045. }) {
  3046. const contentStreamPromise = this.getContentStream();
  3047. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3048. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3049. return dataPromises.then(([contentStream]) => {
  3050. const partialEvaluator = new _evaluator.PartialEvaluator({
  3051. xref: this.xref,
  3052. handler,
  3053. pageIndex: this.pageIndex,
  3054. idFactory: this._localIdFactory,
  3055. fontCache: this.fontCache,
  3056. builtInCMapCache: this.builtInCMapCache,
  3057. standardFontDataCache: this.standardFontDataCache,
  3058. globalImageCache: this.globalImageCache,
  3059. options: this.evaluatorOptions
  3060. });
  3061. return partialEvaluator.getTextContent({
  3062. stream: contentStream,
  3063. task,
  3064. resources: this.resources,
  3065. normalizeWhitespace,
  3066. includeMarkedContent,
  3067. combineTextItems,
  3068. sink
  3069. });
  3070. });
  3071. }
  3072. async getStructTree() {
  3073. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3074. if (!structTreeRoot) {
  3075. return null;
  3076. }
  3077. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3078. return structTree.serializable;
  3079. }
  3080. _parseStructTree(structTreeRoot) {
  3081. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3082. tree.parse();
  3083. return tree;
  3084. }
  3085. getAnnotationsData(intent) {
  3086. return this._parsedAnnotations.then(function (annotations) {
  3087. const annotationsData = [];
  3088. for (let i = 0, ii = annotations.length; i < ii; i++) {
  3089. if (!intent || intent === "display" && annotations[i].viewable || intent === "print" && annotations[i].printable) {
  3090. annotationsData.push(annotations[i].data);
  3091. }
  3092. }
  3093. return annotationsData;
  3094. });
  3095. }
  3096. get annotations() {
  3097. const annots = this._getInheritableProperty("Annots");
  3098. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3099. }
  3100. get _parsedAnnotations() {
  3101. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3102. const annotationPromises = [];
  3103. for (const annotationRef of this.annotations) {
  3104. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3105. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3106. return null;
  3107. }));
  3108. }
  3109. return Promise.all(annotationPromises).then(function (annotations) {
  3110. return annotations.filter(annotation => !!annotation);
  3111. });
  3112. });
  3113. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3114. }
  3115. get jsActions() {
  3116. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3117. return (0, _util.shadow)(this, "jsActions", actions);
  3118. }
  3119. }
  3120. exports.Page = Page;
  3121. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3122. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3123. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3124. const FINGERPRINT_FIRST_BYTES = 1024;
  3125. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3126. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
  3127. function find(stream, signature, limit = 1024, backwards = false) {
  3128. const signatureLength = signature.length;
  3129. const scanBytes = stream.peekBytes(limit);
  3130. const scanLength = scanBytes.length - signatureLength;
  3131. if (scanLength <= 0) {
  3132. return false;
  3133. }
  3134. if (backwards) {
  3135. const signatureEnd = signatureLength - 1;
  3136. let pos = scanBytes.length - 1;
  3137. while (pos >= signatureEnd) {
  3138. let j = 0;
  3139. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3140. j++;
  3141. }
  3142. if (j >= signatureLength) {
  3143. stream.pos += pos - signatureEnd;
  3144. return true;
  3145. }
  3146. pos--;
  3147. }
  3148. } else {
  3149. let pos = 0;
  3150. while (pos <= scanLength) {
  3151. let j = 0;
  3152. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3153. j++;
  3154. }
  3155. if (j >= signatureLength) {
  3156. stream.pos += pos;
  3157. return true;
  3158. }
  3159. pos++;
  3160. }
  3161. }
  3162. return false;
  3163. }
  3164. class PDFDocument {
  3165. constructor(pdfManager, arg) {
  3166. let stream;
  3167. if ((0, _primitives.isStream)(arg)) {
  3168. stream = arg;
  3169. } else if ((0, _util.isArrayBuffer)(arg)) {
  3170. stream = new _stream.Stream(arg);
  3171. } else {
  3172. throw new Error("PDFDocument: Unknown argument type");
  3173. }
  3174. if (stream.length <= 0) {
  3175. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3176. }
  3177. this.pdfManager = pdfManager;
  3178. this.stream = stream;
  3179. this.xref = new _xref.XRef(stream, pdfManager);
  3180. this._pagePromises = [];
  3181. this._version = null;
  3182. const idCounters = {
  3183. font: 0
  3184. };
  3185. this._globalIdFactory = class {
  3186. static getDocId() {
  3187. return `g_${pdfManager.docId}`;
  3188. }
  3189. static createFontId() {
  3190. return `f${++idCounters.font}`;
  3191. }
  3192. static createObjId() {
  3193. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3194. }
  3195. static getPageObjId() {
  3196. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3197. }
  3198. };
  3199. }
  3200. parse(recoveryMode) {
  3201. this.xref.parse(recoveryMode);
  3202. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3203. if (this.catalog.version) {
  3204. this._version = this.catalog.version;
  3205. }
  3206. }
  3207. get linearization() {
  3208. let linearization = null;
  3209. try {
  3210. linearization = _parser.Linearization.create(this.stream);
  3211. } catch (err) {
  3212. if (err instanceof _core_utils.MissingDataException) {
  3213. throw err;
  3214. }
  3215. (0, _util.info)(err);
  3216. }
  3217. return (0, _util.shadow)(this, "linearization", linearization);
  3218. }
  3219. get startXRef() {
  3220. const stream = this.stream;
  3221. let startXRef = 0;
  3222. if (this.linearization) {
  3223. stream.reset();
  3224. if (find(stream, ENDOBJ_SIGNATURE)) {
  3225. startXRef = stream.pos + 6 - stream.start;
  3226. }
  3227. } else {
  3228. const step = 1024;
  3229. const startXRefLength = STARTXREF_SIGNATURE.length;
  3230. let found = false,
  3231. pos = stream.end;
  3232. while (!found && pos > 0) {
  3233. pos -= step - startXRefLength;
  3234. if (pos < 0) {
  3235. pos = 0;
  3236. }
  3237. stream.pos = pos;
  3238. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3239. }
  3240. if (found) {
  3241. stream.skip(9);
  3242. let ch;
  3243. do {
  3244. ch = stream.getByte();
  3245. } while ((0, _core_utils.isWhiteSpace)(ch));
  3246. let str = "";
  3247. while (ch >= 0x20 && ch <= 0x39) {
  3248. str += String.fromCharCode(ch);
  3249. ch = stream.getByte();
  3250. }
  3251. startXRef = parseInt(str, 10);
  3252. if (isNaN(startXRef)) {
  3253. startXRef = 0;
  3254. }
  3255. }
  3256. }
  3257. return (0, _util.shadow)(this, "startXRef", startXRef);
  3258. }
  3259. checkHeader() {
  3260. const stream = this.stream;
  3261. stream.reset();
  3262. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3263. return;
  3264. }
  3265. stream.moveStart();
  3266. const MAX_PDF_VERSION_LENGTH = 12;
  3267. let version = "",
  3268. ch;
  3269. while ((ch = stream.getByte()) > 0x20) {
  3270. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3271. break;
  3272. }
  3273. version += String.fromCharCode(ch);
  3274. }
  3275. if (!this._version) {
  3276. this._version = version.substring(5);
  3277. }
  3278. }
  3279. parseStartXRef() {
  3280. this.xref.setStartXRef(this.startXRef);
  3281. }
  3282. get numPages() {
  3283. if (this.xfaFactory) {
  3284. return (0, _util.shadow)(this, "numPages", this.xfaFactory.numberPages);
  3285. }
  3286. const linearization = this.linearization;
  3287. const num = linearization ? linearization.numPages : this.catalog.numPages;
  3288. return (0, _util.shadow)(this, "numPages", num);
  3289. }
  3290. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3291. const RECURSION_LIMIT = 10;
  3292. if (!Array.isArray(fields)) {
  3293. return false;
  3294. }
  3295. return fields.every(field => {
  3296. field = this.xref.fetchIfRef(field);
  3297. if (!(field instanceof _primitives.Dict)) {
  3298. return false;
  3299. }
  3300. if (field.has("Kids")) {
  3301. if (++recursionDepth > RECURSION_LIMIT) {
  3302. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3303. return false;
  3304. }
  3305. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3306. }
  3307. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3308. const rectangle = field.get("Rect");
  3309. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3310. return isSignature && isInvisible;
  3311. });
  3312. }
  3313. get xfaData() {
  3314. const acroForm = this.catalog.acroForm;
  3315. if (!acroForm) {
  3316. return null;
  3317. }
  3318. const xfa = acroForm.get("XFA");
  3319. const entries = {
  3320. "xdp:xdp": "",
  3321. template: "",
  3322. datasets: "",
  3323. config: "",
  3324. connectionSet: "",
  3325. localeSet: "",
  3326. stylesheet: "",
  3327. "/xdp:xdp": ""
  3328. };
  3329. if ((0, _primitives.isStream)(xfa) && !xfa.isEmpty) {
  3330. try {
  3331. entries["xdp:xdp"] = (0, _util.stringToUTF8String)(xfa.getString());
  3332. return entries;
  3333. } catch (_) {
  3334. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3335. return null;
  3336. }
  3337. }
  3338. if (!Array.isArray(xfa) || xfa.length === 0) {
  3339. return null;
  3340. }
  3341. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3342. let name;
  3343. if (i === 0) {
  3344. name = "xdp:xdp";
  3345. } else if (i === ii - 2) {
  3346. name = "/xdp:xdp";
  3347. } else {
  3348. name = xfa[i];
  3349. }
  3350. if (!entries.hasOwnProperty(name)) {
  3351. continue;
  3352. }
  3353. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3354. if (!(0, _primitives.isStream)(data) || data.isEmpty) {
  3355. continue;
  3356. }
  3357. try {
  3358. entries[name] = (0, _util.stringToUTF8String)(data.getString());
  3359. } catch (_) {
  3360. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3361. return null;
  3362. }
  3363. }
  3364. return entries;
  3365. }
  3366. get xfaFactory() {
  3367. if (this.pdfManager.enableXfa && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3368. const data = this.xfaData;
  3369. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3370. }
  3371. return (0, _util.shadow)(this, "xfaFaxtory", null);
  3372. }
  3373. get isPureXfa() {
  3374. return this.xfaFactory && this.xfaFactory.isValid();
  3375. }
  3376. get htmlForXfa() {
  3377. if (this.xfaFactory) {
  3378. return this.xfaFactory.getPages();
  3379. }
  3380. return null;
  3381. }
  3382. async loadXfaImages() {
  3383. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3384. if (!xfaImagesDict) {
  3385. return;
  3386. }
  3387. const keys = xfaImagesDict.getKeys();
  3388. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3389. await objectLoader.load();
  3390. const xfaImages = new Map();
  3391. for (const key of keys) {
  3392. const stream = xfaImagesDict.get(key);
  3393. if (!(0, _primitives.isStream)(stream)) {
  3394. continue;
  3395. }
  3396. xfaImages.set(key, stream.getBytes());
  3397. }
  3398. this.xfaFactory.setImages(xfaImages);
  3399. }
  3400. async loadXfaFonts(handler, task) {
  3401. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3402. if (!acroForm) {
  3403. return;
  3404. }
  3405. const resources = await acroForm.getAsync("DR");
  3406. if (!(resources instanceof _primitives.Dict)) {
  3407. return;
  3408. }
  3409. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3410. await objectLoader.load();
  3411. const fontRes = resources.get("Font");
  3412. if (!(fontRes instanceof _primitives.Dict)) {
  3413. return;
  3414. }
  3415. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3416. options.useSystemFonts = false;
  3417. const partialEvaluator = new _evaluator.PartialEvaluator({
  3418. xref: this.xref,
  3419. handler,
  3420. pageIndex: -1,
  3421. idFactory: this._globalIdFactory,
  3422. fontCache: this.catalog.fontCache,
  3423. builtInCMapCache: this.catalog.builtInCMapCache,
  3424. standardFontDataCache: this.catalog.standardFontDataCache,
  3425. options
  3426. });
  3427. const operatorList = new _operator_list.OperatorList();
  3428. const pdfFonts = [];
  3429. const initialState = {
  3430. get font() {
  3431. return pdfFonts[pdfFonts.length - 1];
  3432. },
  3433. set font(font) {
  3434. pdfFonts.push(font);
  3435. },
  3436. clone() {
  3437. return this;
  3438. }
  3439. };
  3440. const fonts = new Map();
  3441. fontRes.forEach((fontName, font) => {
  3442. fonts.set(fontName, font);
  3443. });
  3444. const promises = [];
  3445. for (const [fontName, font] of fonts) {
  3446. const descriptor = font.get("FontDescriptor");
  3447. if (!(descriptor instanceof _primitives.Dict)) {
  3448. continue;
  3449. }
  3450. let fontFamily = descriptor.get("FontFamily");
  3451. fontFamily = fontFamily.replace(/[ ]+([0-9])/g, "$1");
  3452. const fontWeight = descriptor.get("FontWeight");
  3453. const italicAngle = -descriptor.get("ItalicAngle");
  3454. const cssFontInfo = {
  3455. fontFamily,
  3456. fontWeight,
  3457. italicAngle
  3458. };
  3459. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3460. continue;
  3461. }
  3462. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3463. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3464. return null;
  3465. }));
  3466. }
  3467. await Promise.all(promises);
  3468. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3469. if (!missingFonts) {
  3470. return;
  3471. }
  3472. options.ignoreErrors = true;
  3473. promises.length = 0;
  3474. pdfFonts.length = 0;
  3475. const reallyMissingFonts = new Set();
  3476. for (const missing of missingFonts) {
  3477. if (!(0, _xfa_fonts.getXfaFontWidths)(`${missing}-Regular`)) {
  3478. reallyMissingFonts.add(missing);
  3479. }
  3480. }
  3481. if (reallyMissingFonts.size) {
  3482. missingFonts.push("PdfJS-Fallback");
  3483. }
  3484. for (const missing of missingFonts) {
  3485. if (reallyMissingFonts.has(missing)) {
  3486. continue;
  3487. }
  3488. for (const fontInfo of [{
  3489. name: "Regular",
  3490. fontWeight: 400,
  3491. italicAngle: 0
  3492. }, {
  3493. name: "Bold",
  3494. fontWeight: 700,
  3495. italicAngle: 0
  3496. }, {
  3497. name: "Italic",
  3498. fontWeight: 400,
  3499. italicAngle: 12
  3500. }, {
  3501. name: "BoldItalic",
  3502. fontWeight: 700,
  3503. italicAngle: 12
  3504. }]) {
  3505. const name = `${missing}-${fontInfo.name}`;
  3506. const widths = (0, _xfa_fonts.getXfaFontWidths)(name);
  3507. const dict = new _primitives.Dict(null);
  3508. dict.set("BaseFont", _primitives.Name.get(name));
  3509. dict.set("Type", _primitives.Name.get("Font"));
  3510. dict.set("Subtype", _primitives.Name.get("TrueType"));
  3511. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  3512. const descriptor = new _primitives.Dict(null);
  3513. descriptor.set("Widths", widths);
  3514. dict.set("FontDescriptor", descriptor);
  3515. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3516. fontFamily: missing,
  3517. fontWeight: fontInfo.fontWeight,
  3518. italicAngle: fontInfo.italicAngle
  3519. }).catch(function (reason) {
  3520. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3521. return null;
  3522. }));
  3523. }
  3524. }
  3525. await Promise.all(promises);
  3526. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3527. }
  3528. async serializeXfaData(annotationStorage) {
  3529. if (this.xfaFactory) {
  3530. return this.xfaFactory.serializeData(annotationStorage);
  3531. }
  3532. return null;
  3533. }
  3534. get formInfo() {
  3535. const formInfo = {
  3536. hasFields: false,
  3537. hasAcroForm: false,
  3538. hasXfa: false,
  3539. hasSignatures: false
  3540. };
  3541. const acroForm = this.catalog.acroForm;
  3542. if (!acroForm) {
  3543. return (0, _util.shadow)(this, "formInfo", formInfo);
  3544. }
  3545. try {
  3546. const fields = acroForm.get("Fields");
  3547. const hasFields = Array.isArray(fields) && fields.length > 0;
  3548. formInfo.hasFields = hasFields;
  3549. const xfa = acroForm.get("XFA");
  3550. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
  3551. const sigFlags = acroForm.get("SigFlags");
  3552. const hasSignatures = !!(sigFlags & 0x1);
  3553. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3554. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3555. formInfo.hasSignatures = hasSignatures;
  3556. } catch (ex) {
  3557. if (ex instanceof _core_utils.MissingDataException) {
  3558. throw ex;
  3559. }
  3560. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3561. }
  3562. return (0, _util.shadow)(this, "formInfo", formInfo);
  3563. }
  3564. get documentInfo() {
  3565. const DocumentInfoValidators = {
  3566. Title: _util.isString,
  3567. Author: _util.isString,
  3568. Subject: _util.isString,
  3569. Keywords: _util.isString,
  3570. Creator: _util.isString,
  3571. Producer: _util.isString,
  3572. CreationDate: _util.isString,
  3573. ModDate: _util.isString,
  3574. Trapped: _primitives.isName
  3575. };
  3576. let version = this._version;
  3577. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3578. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3579. version = null;
  3580. }
  3581. const docInfo = {
  3582. PDFFormatVersion: version,
  3583. IsLinearized: !!this.linearization,
  3584. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3585. IsXFAPresent: this.formInfo.hasXfa,
  3586. IsCollectionPresent: !!this.catalog.collection,
  3587. IsSignaturesPresent: this.formInfo.hasSignatures
  3588. };
  3589. let infoDict;
  3590. try {
  3591. infoDict = this.xref.trailer.get("Info");
  3592. } catch (err) {
  3593. if (err instanceof _core_utils.MissingDataException) {
  3594. throw err;
  3595. }
  3596. (0, _util.info)("The document information dictionary is invalid.");
  3597. }
  3598. if ((0, _primitives.isDict)(infoDict)) {
  3599. for (const key of infoDict.getKeys()) {
  3600. const value = infoDict.get(key);
  3601. if (DocumentInfoValidators[key]) {
  3602. if (DocumentInfoValidators[key](value)) {
  3603. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  3604. } else {
  3605. (0, _util.info)(`Bad value in document info for "${key}".`);
  3606. }
  3607. } else if (typeof key === "string") {
  3608. let customValue;
  3609. if ((0, _util.isString)(value)) {
  3610. customValue = (0, _util.stringToPDFString)(value);
  3611. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  3612. customValue = value;
  3613. } else {
  3614. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  3615. continue;
  3616. }
  3617. if (!docInfo.Custom) {
  3618. docInfo.Custom = Object.create(null);
  3619. }
  3620. docInfo.Custom[key] = customValue;
  3621. }
  3622. }
  3623. }
  3624. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3625. }
  3626. get fingerprints() {
  3627. function validate(data) {
  3628. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3629. }
  3630. function hexString(hash) {
  3631. const buf = [];
  3632. for (let i = 0, ii = hash.length; i < ii; i++) {
  3633. const hex = hash[i].toString(16);
  3634. buf.push(hex.padStart(2, "0"));
  3635. }
  3636. return buf.join("");
  3637. }
  3638. const idArray = this.xref.trailer.get("ID");
  3639. let hashOriginal, hashModified;
  3640. if (Array.isArray(idArray) && validate(idArray[0])) {
  3641. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3642. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3643. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3644. }
  3645. } else {
  3646. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3647. }
  3648. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3649. }
  3650. _getLinearizationPage(pageIndex) {
  3651. const {
  3652. catalog,
  3653. linearization
  3654. } = this;
  3655. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3656. return this.xref.fetchAsync(ref).then(obj => {
  3657. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  3658. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  3659. catalog.pageKidsCountCache.put(ref, 1);
  3660. }
  3661. return [obj, ref];
  3662. }
  3663. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  3664. }).catch(reason => {
  3665. (0, _util.info)(reason);
  3666. return catalog.getPageDict(pageIndex);
  3667. });
  3668. }
  3669. getPage(pageIndex) {
  3670. if (this._pagePromises[pageIndex] !== undefined) {
  3671. return this._pagePromises[pageIndex];
  3672. }
  3673. const {
  3674. catalog,
  3675. linearization
  3676. } = this;
  3677. if (this.xfaFactory) {
  3678. return Promise.resolve(new Page({
  3679. pdfManager: this.pdfManager,
  3680. xref: this.xref,
  3681. pageIndex,
  3682. pageDict: _primitives.Dict.empty,
  3683. ref: null,
  3684. globalIdFactory: this._globalIdFactory,
  3685. fontCache: catalog.fontCache,
  3686. builtInCMapCache: catalog.builtInCMapCache,
  3687. standardFontDataCache: catalog.standardFontDataCache,
  3688. globalImageCache: catalog.globalImageCache,
  3689. nonBlendModesSet: catalog.nonBlendModesSet,
  3690. xfaFactory: this.xfaFactory
  3691. }));
  3692. }
  3693. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  3694. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  3695. return new Page({
  3696. pdfManager: this.pdfManager,
  3697. xref: this.xref,
  3698. pageIndex,
  3699. pageDict,
  3700. ref,
  3701. globalIdFactory: this._globalIdFactory,
  3702. fontCache: catalog.fontCache,
  3703. builtInCMapCache: catalog.builtInCMapCache,
  3704. standardFontDataCache: catalog.standardFontDataCache,
  3705. globalImageCache: catalog.globalImageCache,
  3706. nonBlendModesSet: catalog.nonBlendModesSet,
  3707. xfaFactory: null
  3708. });
  3709. });
  3710. }
  3711. checkFirstPage() {
  3712. return this.getPage(0).catch(async reason => {
  3713. if (reason instanceof _core_utils.XRefEntryException) {
  3714. this._pagePromises.length = 0;
  3715. await this.cleanup();
  3716. throw new _core_utils.XRefParseException();
  3717. }
  3718. });
  3719. }
  3720. fontFallback(id, handler) {
  3721. return this.catalog.fontFallback(id, handler);
  3722. }
  3723. async cleanup(manuallyTriggered = false) {
  3724. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  3725. }
  3726. _collectFieldObjects(name, fieldRef, promises) {
  3727. const field = this.xref.fetchIfRef(fieldRef);
  3728. if (field.has("T")) {
  3729. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3730. if (name === "") {
  3731. name = partName;
  3732. } else {
  3733. name = `${name}.${partName}`;
  3734. }
  3735. }
  3736. if (!promises.has(name)) {
  3737. promises.set(name, []);
  3738. }
  3739. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3740. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3741. return null;
  3742. }));
  3743. if (field.has("Kids")) {
  3744. const kids = field.get("Kids");
  3745. for (const kid of kids) {
  3746. this._collectFieldObjects(name, kid, promises);
  3747. }
  3748. }
  3749. }
  3750. get fieldObjects() {
  3751. if (!this.formInfo.hasFields) {
  3752. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3753. }
  3754. const allFields = Object.create(null);
  3755. const fieldPromises = new Map();
  3756. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3757. this._collectFieldObjects("", fieldRef, fieldPromises);
  3758. }
  3759. const allPromises = [];
  3760. for (const [name, promises] of fieldPromises) {
  3761. allPromises.push(Promise.all(promises).then(fields => {
  3762. fields = fields.filter(field => !!field);
  3763. if (fields.length > 0) {
  3764. allFields[name] = fields;
  3765. }
  3766. }));
  3767. }
  3768. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  3769. }
  3770. get hasJSActions() {
  3771. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  3772. return (0, _util.shadow)(this, "hasJSActions", promise);
  3773. }
  3774. async _parseHasJSActions() {
  3775. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  3776. if (catalogJsActions) {
  3777. return true;
  3778. }
  3779. if (fieldObjects) {
  3780. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  3781. }
  3782. return false;
  3783. }
  3784. get calculationOrderIds() {
  3785. const acroForm = this.catalog.acroForm;
  3786. if (!acroForm || !acroForm.has("CO")) {
  3787. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3788. }
  3789. const calculationOrder = acroForm.get("CO");
  3790. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  3791. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3792. }
  3793. const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString());
  3794. if (ids.length === 0) {
  3795. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3796. }
  3797. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  3798. }
  3799. }
  3800. exports.PDFDocument = PDFDocument;
  3801. /***/ }),
  3802. /* 12 */
  3803. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3804. Object.defineProperty(exports, "__esModule", ({
  3805. value: true
  3806. }));
  3807. exports.getQuadPoints = getQuadPoints;
  3808. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  3809. var _util = __w_pdfjs_require__(2);
  3810. var _core_utils = __w_pdfjs_require__(9);
  3811. var _default_appearance = __w_pdfjs_require__(13);
  3812. var _primitives = __w_pdfjs_require__(5);
  3813. var _catalog = __w_pdfjs_require__(64);
  3814. var _colorspace = __w_pdfjs_require__(14);
  3815. var _file_spec = __w_pdfjs_require__(66);
  3816. var _object_loader = __w_pdfjs_require__(70);
  3817. var _operator_list = __w_pdfjs_require__(62);
  3818. var _stream = __w_pdfjs_require__(10);
  3819. var _writer = __w_pdfjs_require__(71);
  3820. class AnnotationFactory {
  3821. static create(xref, ref, pdfManager, idFactory, collectFields) {
  3822. return Promise.all([pdfManager.ensureCatalog("acroForm"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex]));
  3823. }
  3824. static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex = -1) {
  3825. const dict = xref.fetchIfRef(ref);
  3826. if (!(0, _primitives.isDict)(dict)) {
  3827. return undefined;
  3828. }
  3829. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  3830. let subtype = dict.get("Subtype");
  3831. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  3832. const parameters = {
  3833. xref,
  3834. ref,
  3835. dict,
  3836. subtype,
  3837. id,
  3838. pdfManager,
  3839. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  3840. collectFields,
  3841. pageIndex
  3842. };
  3843. switch (subtype) {
  3844. case "Link":
  3845. return new LinkAnnotation(parameters);
  3846. case "Text":
  3847. return new TextAnnotation(parameters);
  3848. case "Widget":
  3849. let fieldType = (0, _core_utils.getInheritableProperty)({
  3850. dict,
  3851. key: "FT"
  3852. });
  3853. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  3854. switch (fieldType) {
  3855. case "Tx":
  3856. return new TextWidgetAnnotation(parameters);
  3857. case "Btn":
  3858. return new ButtonWidgetAnnotation(parameters);
  3859. case "Ch":
  3860. return new ChoiceWidgetAnnotation(parameters);
  3861. case "Sig":
  3862. return new SignatureWidgetAnnotation(parameters);
  3863. }
  3864. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  3865. return new WidgetAnnotation(parameters);
  3866. case "Popup":
  3867. return new PopupAnnotation(parameters);
  3868. case "FreeText":
  3869. return new FreeTextAnnotation(parameters);
  3870. case "Line":
  3871. return new LineAnnotation(parameters);
  3872. case "Square":
  3873. return new SquareAnnotation(parameters);
  3874. case "Circle":
  3875. return new CircleAnnotation(parameters);
  3876. case "PolyLine":
  3877. return new PolylineAnnotation(parameters);
  3878. case "Polygon":
  3879. return new PolygonAnnotation(parameters);
  3880. case "Caret":
  3881. return new CaretAnnotation(parameters);
  3882. case "Ink":
  3883. return new InkAnnotation(parameters);
  3884. case "Highlight":
  3885. return new HighlightAnnotation(parameters);
  3886. case "Underline":
  3887. return new UnderlineAnnotation(parameters);
  3888. case "Squiggly":
  3889. return new SquigglyAnnotation(parameters);
  3890. case "StrikeOut":
  3891. return new StrikeOutAnnotation(parameters);
  3892. case "Stamp":
  3893. return new StampAnnotation(parameters);
  3894. case "FileAttachment":
  3895. return new FileAttachmentAnnotation(parameters);
  3896. default:
  3897. if (!collectFields) {
  3898. if (!subtype) {
  3899. (0, _util.warn)("Annotation is missing the required /Subtype.");
  3900. } else {
  3901. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  3902. }
  3903. }
  3904. return new Annotation(parameters);
  3905. }
  3906. }
  3907. static async _getPageIndex(xref, ref, pdfManager) {
  3908. try {
  3909. const annotDict = await xref.fetchIfRefAsync(ref);
  3910. if (!(0, _primitives.isDict)(annotDict)) {
  3911. return -1;
  3912. }
  3913. const pageRef = annotDict.getRaw("P");
  3914. if (!(0, _primitives.isRef)(pageRef)) {
  3915. return -1;
  3916. }
  3917. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  3918. return pageIndex;
  3919. } catch (ex) {
  3920. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  3921. return -1;
  3922. }
  3923. }
  3924. }
  3925. exports.AnnotationFactory = AnnotationFactory;
  3926. function getRgbColor(color) {
  3927. const rgbColor = new Uint8ClampedArray(3);
  3928. if (!Array.isArray(color)) {
  3929. return rgbColor;
  3930. }
  3931. switch (color.length) {
  3932. case 0:
  3933. return null;
  3934. case 1:
  3935. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  3936. return rgbColor;
  3937. case 3:
  3938. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  3939. return rgbColor;
  3940. case 4:
  3941. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  3942. return rgbColor;
  3943. default:
  3944. return rgbColor;
  3945. }
  3946. }
  3947. function getQuadPoints(dict, rect) {
  3948. if (!dict.has("QuadPoints")) {
  3949. return null;
  3950. }
  3951. const quadPoints = dict.getArray("QuadPoints");
  3952. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  3953. return null;
  3954. }
  3955. const quadPointsLists = [];
  3956. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  3957. quadPointsLists.push([]);
  3958. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  3959. const x = quadPoints[j];
  3960. const y = quadPoints[j + 1];
  3961. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  3962. return null;
  3963. }
  3964. quadPointsLists[i].push({
  3965. x,
  3966. y
  3967. });
  3968. }
  3969. }
  3970. return quadPointsLists.map(quadPointsList => {
  3971. 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]);
  3972. return [{
  3973. x: minX,
  3974. y: maxY
  3975. }, {
  3976. x: maxX,
  3977. y: maxY
  3978. }, {
  3979. x: minX,
  3980. y: minY
  3981. }, {
  3982. x: maxX,
  3983. y: minY
  3984. }];
  3985. });
  3986. }
  3987. function getTransformMatrix(rect, bbox, matrix) {
  3988. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  3989. if (minX === maxX || minY === maxY) {
  3990. return [1, 0, 0, 1, rect[0], rect[1]];
  3991. }
  3992. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  3993. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  3994. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  3995. }
  3996. class Annotation {
  3997. constructor(params) {
  3998. const dict = params.dict;
  3999. this.setContents(dict.get("Contents"));
  4000. this.setModificationDate(dict.get("M"));
  4001. this.setFlags(dict.get("F"));
  4002. this.setRectangle(dict.getArray("Rect"));
  4003. this.setColor(dict.getArray("C"));
  4004. this.setBorderStyle(dict);
  4005. this.setAppearance(dict);
  4006. this._streams = [];
  4007. if (this.appearance) {
  4008. this._streams.push(this.appearance);
  4009. }
  4010. this.data = {
  4011. annotationFlags: this.flags,
  4012. borderStyle: this.borderStyle,
  4013. color: this.color,
  4014. contents: this.contents,
  4015. hasAppearance: !!this.appearance,
  4016. id: params.id,
  4017. modificationDate: this.modificationDate,
  4018. rect: this.rectangle,
  4019. subtype: params.subtype
  4020. };
  4021. if (params.collectFields) {
  4022. const kids = dict.get("Kids");
  4023. if (Array.isArray(kids)) {
  4024. const kidIds = [];
  4025. for (const kid of kids) {
  4026. if ((0, _primitives.isRef)(kid)) {
  4027. kidIds.push(kid.toString());
  4028. }
  4029. }
  4030. if (kidIds.length !== 0) {
  4031. this.data.kidIds = kidIds;
  4032. }
  4033. }
  4034. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  4035. this.data.fieldName = this._constructFieldName(dict);
  4036. this.data.pageIndex = params.pageIndex;
  4037. }
  4038. this._fallbackFontDict = null;
  4039. }
  4040. _hasFlag(flags, flag) {
  4041. return !!(flags & flag);
  4042. }
  4043. _isViewable(flags) {
  4044. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  4045. }
  4046. _isPrintable(flags) {
  4047. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  4048. }
  4049. mustBeViewed(annotationStorage) {
  4050. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4051. if (storageEntry && storageEntry.hidden !== undefined) {
  4052. return !storageEntry.hidden;
  4053. }
  4054. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  4055. }
  4056. mustBePrinted(annotationStorage) {
  4057. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4058. if (storageEntry && storageEntry.print !== undefined) {
  4059. return storageEntry.print;
  4060. }
  4061. return this.printable;
  4062. }
  4063. get viewable() {
  4064. if (this.data.quadPoints === null) {
  4065. return false;
  4066. }
  4067. if (this.flags === 0) {
  4068. return true;
  4069. }
  4070. return this._isViewable(this.flags);
  4071. }
  4072. get printable() {
  4073. if (this.data.quadPoints === null) {
  4074. return false;
  4075. }
  4076. if (this.flags === 0) {
  4077. return false;
  4078. }
  4079. return this._isPrintable(this.flags);
  4080. }
  4081. setContents(contents) {
  4082. this.contents = (0, _util.stringToPDFString)(contents || "");
  4083. }
  4084. setModificationDate(modificationDate) {
  4085. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  4086. }
  4087. setFlags(flags) {
  4088. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  4089. }
  4090. hasFlag(flag) {
  4091. return this._hasFlag(this.flags, flag);
  4092. }
  4093. setRectangle(rectangle) {
  4094. if (Array.isArray(rectangle) && rectangle.length === 4) {
  4095. this.rectangle = _util.Util.normalizeRect(rectangle);
  4096. } else {
  4097. this.rectangle = [0, 0, 0, 0];
  4098. }
  4099. }
  4100. setColor(color) {
  4101. this.color = getRgbColor(color);
  4102. }
  4103. setBorderStyle(borderStyle) {
  4104. this.borderStyle = new AnnotationBorderStyle();
  4105. if (!(0, _primitives.isDict)(borderStyle)) {
  4106. return;
  4107. }
  4108. if (borderStyle.has("BS")) {
  4109. const dict = borderStyle.get("BS");
  4110. const dictType = dict.get("Type");
  4111. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  4112. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  4113. this.borderStyle.setStyle(dict.get("S"));
  4114. this.borderStyle.setDashArray(dict.getArray("D"));
  4115. }
  4116. } else if (borderStyle.has("Border")) {
  4117. const array = borderStyle.getArray("Border");
  4118. if (Array.isArray(array) && array.length >= 3) {
  4119. this.borderStyle.setHorizontalCornerRadius(array[0]);
  4120. this.borderStyle.setVerticalCornerRadius(array[1]);
  4121. this.borderStyle.setWidth(array[2], this.rectangle);
  4122. if (array.length === 4) {
  4123. this.borderStyle.setDashArray(array[3]);
  4124. }
  4125. }
  4126. } else {
  4127. this.borderStyle.setWidth(0);
  4128. }
  4129. }
  4130. setAppearance(dict) {
  4131. this.appearance = null;
  4132. const appearanceStates = dict.get("AP");
  4133. if (!(0, _primitives.isDict)(appearanceStates)) {
  4134. return;
  4135. }
  4136. const normalAppearanceState = appearanceStates.get("N");
  4137. if ((0, _primitives.isStream)(normalAppearanceState)) {
  4138. this.appearance = normalAppearanceState;
  4139. return;
  4140. }
  4141. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  4142. return;
  4143. }
  4144. const as = dict.get("AS");
  4145. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  4146. return;
  4147. }
  4148. this.appearance = normalAppearanceState.get(as.name);
  4149. }
  4150. loadResources(keys) {
  4151. return this.appearance.dict.getAsync("Resources").then(resources => {
  4152. if (!resources) {
  4153. return undefined;
  4154. }
  4155. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4156. return objectLoader.load().then(function () {
  4157. return resources;
  4158. });
  4159. });
  4160. }
  4161. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  4162. if (!this.appearance) {
  4163. return Promise.resolve(new _operator_list.OperatorList());
  4164. }
  4165. const appearance = this.appearance;
  4166. const data = this.data;
  4167. const appearanceDict = appearance.dict;
  4168. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  4169. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4170. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4171. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4172. return resourcesPromise.then(resources => {
  4173. const opList = new _operator_list.OperatorList();
  4174. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix]);
  4175. return evaluator.getOperatorList({
  4176. stream: appearance,
  4177. task,
  4178. resources,
  4179. operatorList: opList,
  4180. fallbackFontDict: this._fallbackFontDict
  4181. }).then(() => {
  4182. opList.addOp(_util.OPS.endAnnotation, []);
  4183. this.reset();
  4184. return opList;
  4185. });
  4186. });
  4187. }
  4188. async save(evaluator, task, annotationStorage) {
  4189. return null;
  4190. }
  4191. getFieldObject() {
  4192. if (this.data.kidIds) {
  4193. return {
  4194. id: this.data.id,
  4195. actions: this.data.actions,
  4196. name: this.data.fieldName,
  4197. type: "",
  4198. kidIds: this.data.kidIds,
  4199. page: this.data.pageIndex
  4200. };
  4201. }
  4202. return null;
  4203. }
  4204. reset() {
  4205. for (const stream of this._streams) {
  4206. stream.reset();
  4207. }
  4208. }
  4209. _constructFieldName(dict) {
  4210. if (!dict.has("T") && !dict.has("Parent")) {
  4211. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4212. return "";
  4213. }
  4214. if (!dict.has("Parent")) {
  4215. return (0, _util.stringToPDFString)(dict.get("T"));
  4216. }
  4217. const fieldName = [];
  4218. if (dict.has("T")) {
  4219. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4220. }
  4221. let loopDict = dict;
  4222. const visited = new _primitives.RefSet();
  4223. if (dict.objId) {
  4224. visited.put(dict.objId);
  4225. }
  4226. while (loopDict.has("Parent")) {
  4227. loopDict = loopDict.get("Parent");
  4228. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4229. break;
  4230. }
  4231. if (loopDict.objId) {
  4232. visited.put(loopDict.objId);
  4233. }
  4234. if (loopDict.has("T")) {
  4235. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4236. }
  4237. }
  4238. return fieldName.join(".");
  4239. }
  4240. }
  4241. exports.Annotation = Annotation;
  4242. class AnnotationBorderStyle {
  4243. constructor() {
  4244. this.width = 1;
  4245. this.style = _util.AnnotationBorderStyleType.SOLID;
  4246. this.dashArray = [3];
  4247. this.horizontalCornerRadius = 0;
  4248. this.verticalCornerRadius = 0;
  4249. }
  4250. setWidth(width, rect = [0, 0, 0, 0]) {
  4251. if ((0, _primitives.isName)(width)) {
  4252. this.width = 0;
  4253. return;
  4254. }
  4255. if (Number.isInteger(width)) {
  4256. if (width > 0) {
  4257. const maxWidth = (rect[2] - rect[0]) / 2;
  4258. const maxHeight = (rect[3] - rect[1]) / 2;
  4259. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4260. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4261. width = 1;
  4262. }
  4263. }
  4264. this.width = width;
  4265. }
  4266. }
  4267. setStyle(style) {
  4268. if (!(0, _primitives.isName)(style)) {
  4269. return;
  4270. }
  4271. switch (style.name) {
  4272. case "S":
  4273. this.style = _util.AnnotationBorderStyleType.SOLID;
  4274. break;
  4275. case "D":
  4276. this.style = _util.AnnotationBorderStyleType.DASHED;
  4277. break;
  4278. case "B":
  4279. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4280. break;
  4281. case "I":
  4282. this.style = _util.AnnotationBorderStyleType.INSET;
  4283. break;
  4284. case "U":
  4285. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4286. break;
  4287. default:
  4288. break;
  4289. }
  4290. }
  4291. setDashArray(dashArray) {
  4292. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4293. let isValid = true;
  4294. let allZeros = true;
  4295. for (const element of dashArray) {
  4296. const validNumber = +element >= 0;
  4297. if (!validNumber) {
  4298. isValid = false;
  4299. break;
  4300. } else if (element > 0) {
  4301. allZeros = false;
  4302. }
  4303. }
  4304. if (isValid && !allZeros) {
  4305. this.dashArray = dashArray;
  4306. } else {
  4307. this.width = 0;
  4308. }
  4309. } else if (dashArray) {
  4310. this.width = 0;
  4311. }
  4312. }
  4313. setHorizontalCornerRadius(radius) {
  4314. if (Number.isInteger(radius)) {
  4315. this.horizontalCornerRadius = radius;
  4316. }
  4317. }
  4318. setVerticalCornerRadius(radius) {
  4319. if (Number.isInteger(radius)) {
  4320. this.verticalCornerRadius = radius;
  4321. }
  4322. }
  4323. }
  4324. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  4325. class MarkupAnnotation extends Annotation {
  4326. constructor(parameters) {
  4327. super(parameters);
  4328. const dict = parameters.dict;
  4329. if (dict.has("IRT")) {
  4330. const rawIRT = dict.getRaw("IRT");
  4331. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  4332. const rt = dict.get("RT");
  4333. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  4334. }
  4335. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  4336. const parent = dict.get("IRT");
  4337. this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
  4338. this.setContents(parent.get("Contents"));
  4339. this.data.contents = this.contents;
  4340. if (!parent.has("CreationDate")) {
  4341. this.data.creationDate = null;
  4342. } else {
  4343. this.setCreationDate(parent.get("CreationDate"));
  4344. this.data.creationDate = this.creationDate;
  4345. }
  4346. if (!parent.has("M")) {
  4347. this.data.modificationDate = null;
  4348. } else {
  4349. this.setModificationDate(parent.get("M"));
  4350. this.data.modificationDate = this.modificationDate;
  4351. }
  4352. this.data.hasPopup = parent.has("Popup");
  4353. if (!parent.has("C")) {
  4354. this.data.color = null;
  4355. } else {
  4356. this.setColor(parent.getArray("C"));
  4357. this.data.color = this.color;
  4358. }
  4359. } else {
  4360. this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
  4361. this.setCreationDate(dict.get("CreationDate"));
  4362. this.data.creationDate = this.creationDate;
  4363. this.data.hasPopup = dict.has("Popup");
  4364. if (!dict.has("C")) {
  4365. this.data.color = null;
  4366. }
  4367. }
  4368. }
  4369. setCreationDate(creationDate) {
  4370. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  4371. }
  4372. _setDefaultAppearance({
  4373. xref,
  4374. extra,
  4375. strokeColor,
  4376. fillColor,
  4377. blendMode,
  4378. strokeAlpha,
  4379. fillAlpha,
  4380. pointsCallback
  4381. }) {
  4382. let minX = Number.MAX_VALUE;
  4383. let minY = Number.MAX_VALUE;
  4384. let maxX = Number.MIN_VALUE;
  4385. let maxY = Number.MIN_VALUE;
  4386. const buffer = ["q"];
  4387. if (extra) {
  4388. buffer.push(extra);
  4389. }
  4390. if (strokeColor) {
  4391. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  4392. }
  4393. if (fillColor) {
  4394. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  4395. }
  4396. let pointsArray = this.data.quadPoints;
  4397. if (!pointsArray) {
  4398. pointsArray = [[{
  4399. x: this.rectangle[0],
  4400. y: this.rectangle[3]
  4401. }, {
  4402. x: this.rectangle[2],
  4403. y: this.rectangle[3]
  4404. }, {
  4405. x: this.rectangle[0],
  4406. y: this.rectangle[1]
  4407. }, {
  4408. x: this.rectangle[2],
  4409. y: this.rectangle[1]
  4410. }]];
  4411. }
  4412. for (const points of pointsArray) {
  4413. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  4414. minX = Math.min(minX, mX);
  4415. maxX = Math.max(maxX, MX);
  4416. minY = Math.min(minY, mY);
  4417. maxY = Math.max(maxY, MY);
  4418. }
  4419. buffer.push("Q");
  4420. const formDict = new _primitives.Dict(xref);
  4421. const appearanceStreamDict = new _primitives.Dict(xref);
  4422. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  4423. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  4424. appearanceStream.dict = appearanceStreamDict;
  4425. formDict.set("Fm0", appearanceStream);
  4426. const gsDict = new _primitives.Dict(xref);
  4427. if (blendMode) {
  4428. gsDict.set("BM", _primitives.Name.get(blendMode));
  4429. }
  4430. if (typeof strokeAlpha === "number") {
  4431. gsDict.set("CA", strokeAlpha);
  4432. }
  4433. if (typeof fillAlpha === "number") {
  4434. gsDict.set("ca", fillAlpha);
  4435. }
  4436. const stateDict = new _primitives.Dict(xref);
  4437. stateDict.set("GS0", gsDict);
  4438. const resources = new _primitives.Dict(xref);
  4439. resources.set("ExtGState", stateDict);
  4440. resources.set("XObject", formDict);
  4441. const appearanceDict = new _primitives.Dict(xref);
  4442. appearanceDict.set("Resources", resources);
  4443. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  4444. appearanceDict.set("BBox", bbox);
  4445. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  4446. this.appearance.dict = appearanceDict;
  4447. this._streams.push(this.appearance, appearanceStream);
  4448. }
  4449. }
  4450. exports.MarkupAnnotation = MarkupAnnotation;
  4451. class WidgetAnnotation extends Annotation {
  4452. constructor(params) {
  4453. super(params);
  4454. const dict = params.dict;
  4455. const data = this.data;
  4456. this.ref = params.ref;
  4457. data.annotationType = _util.AnnotationType.WIDGET;
  4458. if (data.fieldName === undefined) {
  4459. data.fieldName = this._constructFieldName(dict);
  4460. }
  4461. if (data.actions === undefined) {
  4462. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  4463. }
  4464. const fieldValue = (0, _core_utils.getInheritableProperty)({
  4465. dict,
  4466. key: "V",
  4467. getArray: true
  4468. });
  4469. data.fieldValue = this._decodeFormValue(fieldValue);
  4470. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  4471. dict,
  4472. key: "DV",
  4473. getArray: true
  4474. });
  4475. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  4476. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  4477. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  4478. dict,
  4479. key: "DA"
  4480. }) || params.acroForm.get("DA");
  4481. this._defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : "";
  4482. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  4483. const fieldType = (0, _core_utils.getInheritableProperty)({
  4484. dict,
  4485. key: "FT"
  4486. });
  4487. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  4488. const localResources = (0, _core_utils.getInheritableProperty)({
  4489. dict,
  4490. key: "DR"
  4491. });
  4492. const acroFormResources = params.acroForm.get("DR");
  4493. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  4494. this._fieldResources = {
  4495. localResources,
  4496. acroFormResources,
  4497. appearanceResources,
  4498. mergedResources: _primitives.Dict.merge({
  4499. xref: params.xref,
  4500. dictArray: [localResources, appearanceResources, acroFormResources],
  4501. mergeSubDicts: true
  4502. })
  4503. };
  4504. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  4505. dict,
  4506. key: "Ff"
  4507. });
  4508. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  4509. data.fieldFlags = 0;
  4510. }
  4511. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  4512. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  4513. }
  4514. _decodeFormValue(formValue) {
  4515. if (Array.isArray(formValue)) {
  4516. return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item));
  4517. } else if ((0, _primitives.isName)(formValue)) {
  4518. return (0, _util.stringToPDFString)(formValue.name);
  4519. } else if ((0, _util.isString)(formValue)) {
  4520. return (0, _util.stringToPDFString)(formValue);
  4521. }
  4522. return null;
  4523. }
  4524. hasFieldFlag(flag) {
  4525. return !!(this.data.fieldFlags & flag);
  4526. }
  4527. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  4528. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  4529. return Promise.resolve(new _operator_list.OperatorList());
  4530. }
  4531. if (!this._hasText) {
  4532. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4533. }
  4534. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  4535. if (this.appearance && content === null) {
  4536. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4537. }
  4538. const operatorList = new _operator_list.OperatorList();
  4539. if (!this._defaultAppearance || content === null) {
  4540. return operatorList;
  4541. }
  4542. const matrix = [1, 0, 0, 1, 0, 0];
  4543. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  4544. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  4545. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]);
  4546. const stream = new _stream.StringStream(content);
  4547. return evaluator.getOperatorList({
  4548. stream,
  4549. task,
  4550. resources: this._fieldResources.mergedResources,
  4551. operatorList
  4552. }).then(function () {
  4553. operatorList.addOp(_util.OPS.endAnnotation, []);
  4554. return operatorList;
  4555. });
  4556. });
  4557. }
  4558. async save(evaluator, task, annotationStorage) {
  4559. if (!annotationStorage) {
  4560. return null;
  4561. }
  4562. const storageEntry = annotationStorage.get(this.data.id);
  4563. const value = storageEntry && storageEntry.value;
  4564. if (value === this.data.fieldValue || value === undefined) {
  4565. return null;
  4566. }
  4567. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  4568. if (appearance === null) {
  4569. return null;
  4570. }
  4571. const {
  4572. xref
  4573. } = evaluator;
  4574. const dict = xref.fetchIfRef(this.ref);
  4575. if (!(0, _primitives.isDict)(dict)) {
  4576. return null;
  4577. }
  4578. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  4579. const xfa = {
  4580. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  4581. value
  4582. };
  4583. const newRef = xref.getNewRef();
  4584. const AP = new _primitives.Dict(xref);
  4585. AP.set("N", newRef);
  4586. const encrypt = xref.encrypt;
  4587. let originalTransform = null;
  4588. let newTransform = null;
  4589. if (encrypt) {
  4590. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  4591. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  4592. appearance = newTransform.encryptString(appearance);
  4593. }
  4594. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  4595. dict.set("AP", AP);
  4596. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  4597. const appearanceDict = new _primitives.Dict(xref);
  4598. appearanceDict.set("Length", appearance.length);
  4599. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  4600. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  4601. appearanceDict.set("BBox", bbox);
  4602. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  4603. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  4604. bufferOriginal.push("\nendobj\n");
  4605. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  4606. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  4607. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  4608. return [{
  4609. ref: this.ref,
  4610. data: bufferOriginal.join(""),
  4611. xfa
  4612. }, {
  4613. ref: newRef,
  4614. data: bufferNew.join(""),
  4615. xfa: null
  4616. }];
  4617. }
  4618. async _getAppearance(evaluator, task, annotationStorage) {
  4619. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  4620. if (!annotationStorage || isPassword) {
  4621. return null;
  4622. }
  4623. const storageEntry = annotationStorage.get(this.data.id);
  4624. let value = storageEntry && storageEntry.value;
  4625. if (value === undefined) {
  4626. return null;
  4627. }
  4628. value = value.trim();
  4629. if (value === "") {
  4630. return "";
  4631. }
  4632. let lineCount = -1;
  4633. if (this.data.multiLine) {
  4634. lineCount = value.split(/\r\n|\r|\n/).length;
  4635. }
  4636. const defaultPadding = 2;
  4637. const hPadding = defaultPadding;
  4638. const totalHeight = this.data.rect[3] - this.data.rect[1];
  4639. const totalWidth = this.data.rect[2] - this.data.rect[0];
  4640. if (!this._defaultAppearance) {
  4641. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  4642. }
  4643. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight, lineCount);
  4644. const font = await this._getFontData(evaluator, task);
  4645. let descent = font.descent;
  4646. if (isNaN(descent)) {
  4647. descent = 0;
  4648. }
  4649. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  4650. const alignment = this.data.textAlignment;
  4651. if (this.data.multiLine) {
  4652. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  4653. }
  4654. const encodedString = font.encodeString(value).join("");
  4655. if (this.data.comb) {
  4656. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  4657. }
  4658. if (alignment === 0 || alignment > 2) {
  4659. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  4660. }
  4661. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  4662. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  4663. }
  4664. async _getFontData(evaluator, task) {
  4665. const operatorList = new _operator_list.OperatorList();
  4666. const initialState = {
  4667. font: null,
  4668. clone() {
  4669. return this;
  4670. }
  4671. };
  4672. const {
  4673. fontName,
  4674. fontSize
  4675. } = this.data.defaultAppearanceData;
  4676. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  4677. return initialState.font;
  4678. }
  4679. _computeFontSize(height, lineCount) {
  4680. let {
  4681. fontSize
  4682. } = this.data.defaultAppearanceData;
  4683. if (!fontSize) {
  4684. const roundWithOneDigit = x => Math.round(x * 10) / 10;
  4685. const FONT_FACTOR = 0.8;
  4686. if (lineCount === -1) {
  4687. fontSize = roundWithOneDigit(FONT_FACTOR * height);
  4688. } else {
  4689. fontSize = 10;
  4690. let lineHeight = fontSize / FONT_FACTOR;
  4691. let numberOfLines = Math.round(height / lineHeight);
  4692. numberOfLines = Math.max(numberOfLines, lineCount);
  4693. lineHeight = height / numberOfLines;
  4694. fontSize = roundWithOneDigit(FONT_FACTOR * lineHeight);
  4695. }
  4696. const {
  4697. fontName,
  4698. fontColor
  4699. } = this.data.defaultAppearanceData;
  4700. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  4701. fontSize,
  4702. fontName,
  4703. fontColor
  4704. });
  4705. }
  4706. return [this._defaultAppearance, fontSize];
  4707. }
  4708. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  4709. const glyphs = font.charsToGlyphs(text);
  4710. const scale = fontSize / 1000;
  4711. let width = 0;
  4712. for (const glyph of glyphs) {
  4713. width += glyph.width * scale;
  4714. }
  4715. let shift;
  4716. if (alignment === 1) {
  4717. shift = (totalWidth - width) / 2;
  4718. } else if (alignment === 2) {
  4719. shift = totalWidth - width - hPadding;
  4720. } else {
  4721. shift = hPadding;
  4722. }
  4723. shift = shift.toFixed(2);
  4724. vPadding = vPadding.toFixed(2);
  4725. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  4726. }
  4727. _getSaveFieldResources(xref) {
  4728. const {
  4729. localResources,
  4730. appearanceResources,
  4731. acroFormResources
  4732. } = this._fieldResources;
  4733. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  4734. if (!fontName) {
  4735. return localResources || _primitives.Dict.empty;
  4736. }
  4737. for (const resources of [localResources, appearanceResources]) {
  4738. if (resources instanceof _primitives.Dict) {
  4739. const localFont = resources.get("Font");
  4740. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  4741. return resources;
  4742. }
  4743. }
  4744. }
  4745. if (acroFormResources instanceof _primitives.Dict) {
  4746. const acroFormFont = acroFormResources.get("Font");
  4747. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  4748. const subFontDict = new _primitives.Dict(xref);
  4749. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  4750. const subResourcesDict = new _primitives.Dict(xref);
  4751. subResourcesDict.set("Font", subFontDict);
  4752. return _primitives.Dict.merge({
  4753. xref,
  4754. dictArray: [subResourcesDict, localResources],
  4755. mergeSubDicts: true
  4756. });
  4757. }
  4758. }
  4759. return localResources || _primitives.Dict.empty;
  4760. }
  4761. getFieldObject() {
  4762. return null;
  4763. }
  4764. }
  4765. class TextWidgetAnnotation extends WidgetAnnotation {
  4766. constructor(params) {
  4767. super(params);
  4768. this._hasText = true;
  4769. const dict = params.dict;
  4770. if (!(0, _util.isString)(this.data.fieldValue)) {
  4771. this.data.fieldValue = "";
  4772. }
  4773. let alignment = (0, _core_utils.getInheritableProperty)({
  4774. dict,
  4775. key: "Q"
  4776. });
  4777. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  4778. alignment = null;
  4779. }
  4780. this.data.textAlignment = alignment;
  4781. let maximumLength = (0, _core_utils.getInheritableProperty)({
  4782. dict,
  4783. key: "MaxLen"
  4784. });
  4785. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  4786. maximumLength = null;
  4787. }
  4788. this.data.maxLen = maximumLength;
  4789. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  4790. 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;
  4791. }
  4792. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  4793. const combWidth = (width / this.data.maxLen).toFixed(2);
  4794. const buf = [];
  4795. const positions = font.getCharPositions(text);
  4796. for (const [start, end] of positions) {
  4797. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  4798. }
  4799. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  4800. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  4801. }
  4802. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  4803. const lines = text.split(/\r\n|\r|\n/);
  4804. const buf = [];
  4805. const totalWidth = width - 2 * hPadding;
  4806. for (const line of lines) {
  4807. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  4808. for (const chunk of chunks) {
  4809. const padding = buf.length === 0 ? hPadding : 0;
  4810. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  4811. }
  4812. }
  4813. const renderedText = buf.join("\n");
  4814. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  4815. }
  4816. _splitLine(line, font, fontSize, width) {
  4817. line = font.encodeString(line).join("");
  4818. const glyphs = font.charsToGlyphs(line);
  4819. if (glyphs.length <= 1) {
  4820. return [line];
  4821. }
  4822. const positions = font.getCharPositions(line);
  4823. const scale = fontSize / 1000;
  4824. const chunks = [];
  4825. let lastSpacePosInStringStart = -1,
  4826. lastSpacePosInStringEnd = -1,
  4827. lastSpacePos = -1,
  4828. startChunk = 0,
  4829. currentWidth = 0;
  4830. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  4831. const [start, end] = positions[i];
  4832. const glyph = glyphs[i];
  4833. const glyphWidth = glyph.width * scale;
  4834. if (glyph.unicode === " ") {
  4835. if (currentWidth + glyphWidth > width) {
  4836. chunks.push(line.substring(startChunk, start));
  4837. startChunk = start;
  4838. currentWidth = glyphWidth;
  4839. lastSpacePosInStringStart = -1;
  4840. lastSpacePos = -1;
  4841. } else {
  4842. currentWidth += glyphWidth;
  4843. lastSpacePosInStringStart = start;
  4844. lastSpacePosInStringEnd = end;
  4845. lastSpacePos = i;
  4846. }
  4847. } else {
  4848. if (currentWidth + glyphWidth > width) {
  4849. if (lastSpacePosInStringStart !== -1) {
  4850. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  4851. startChunk = lastSpacePosInStringEnd;
  4852. i = lastSpacePos + 1;
  4853. lastSpacePosInStringStart = -1;
  4854. currentWidth = 0;
  4855. } else {
  4856. chunks.push(line.substring(startChunk, start));
  4857. startChunk = start;
  4858. currentWidth = glyphWidth;
  4859. }
  4860. } else {
  4861. currentWidth += glyphWidth;
  4862. }
  4863. }
  4864. }
  4865. if (startChunk < line.length) {
  4866. chunks.push(line.substring(startChunk, line.length));
  4867. }
  4868. return chunks;
  4869. }
  4870. getFieldObject() {
  4871. return {
  4872. id: this.data.id,
  4873. value: this.data.fieldValue,
  4874. defaultValue: this.data.defaultFieldValue,
  4875. multiline: this.data.multiLine,
  4876. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  4877. charLimit: this.data.maxLen,
  4878. comb: this.data.comb,
  4879. editable: !this.data.readOnly,
  4880. hidden: this.data.hidden,
  4881. name: this.data.fieldName,
  4882. rect: this.data.rect,
  4883. actions: this.data.actions,
  4884. page: this.data.pageIndex,
  4885. type: "text"
  4886. };
  4887. }
  4888. }
  4889. class ButtonWidgetAnnotation extends WidgetAnnotation {
  4890. constructor(params) {
  4891. super(params);
  4892. this.checkedAppearance = null;
  4893. this.uncheckedAppearance = null;
  4894. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  4895. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  4896. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  4897. this.data.isTooltipOnly = false;
  4898. if (this.data.checkBox) {
  4899. this._processCheckBox(params);
  4900. } else if (this.data.radioButton) {
  4901. this._processRadioButton(params);
  4902. } else if (this.data.pushButton) {
  4903. this._processPushButton(params);
  4904. } else {
  4905. (0, _util.warn)("Invalid field flags for button widget annotation");
  4906. }
  4907. }
  4908. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  4909. if (this.data.pushButton) {
  4910. return super.getOperatorList(evaluator, task, false, annotationStorage);
  4911. }
  4912. if (annotationStorage) {
  4913. const storageEntry = annotationStorage.get(this.data.id);
  4914. const value = storageEntry && storageEntry.value;
  4915. if (value === undefined) {
  4916. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4917. }
  4918. let appearance;
  4919. if (value) {
  4920. appearance = this.checkedAppearance;
  4921. } else {
  4922. appearance = this.uncheckedAppearance;
  4923. }
  4924. if (appearance) {
  4925. const savedAppearance = this.appearance;
  4926. this.appearance = appearance;
  4927. const operatorList = super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4928. this.appearance = savedAppearance;
  4929. return operatorList;
  4930. }
  4931. return Promise.resolve(new _operator_list.OperatorList());
  4932. }
  4933. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4934. }
  4935. async save(evaluator, task, annotationStorage) {
  4936. if (this.data.checkBox) {
  4937. return this._saveCheckbox(evaluator, task, annotationStorage);
  4938. }
  4939. if (this.data.radioButton) {
  4940. return this._saveRadioButton(evaluator, task, annotationStorage);
  4941. }
  4942. return null;
  4943. }
  4944. async _saveCheckbox(evaluator, task, annotationStorage) {
  4945. if (!annotationStorage) {
  4946. return null;
  4947. }
  4948. const storageEntry = annotationStorage.get(this.data.id);
  4949. const value = storageEntry && storageEntry.value;
  4950. if (value === undefined) {
  4951. return null;
  4952. }
  4953. const defaultValue = this.data.fieldValue && this.data.fieldValue !== "Off";
  4954. if (defaultValue === value) {
  4955. return null;
  4956. }
  4957. const dict = evaluator.xref.fetchIfRef(this.ref);
  4958. if (!(0, _primitives.isDict)(dict)) {
  4959. return null;
  4960. }
  4961. const xfa = {
  4962. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  4963. value: value ? this.data.exportValue : ""
  4964. };
  4965. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  4966. dict.set("V", name);
  4967. dict.set("AS", name);
  4968. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  4969. const encrypt = evaluator.xref.encrypt;
  4970. let originalTransform = null;
  4971. if (encrypt) {
  4972. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  4973. }
  4974. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  4975. (0, _writer.writeDict)(dict, buffer, originalTransform);
  4976. buffer.push("\nendobj\n");
  4977. return [{
  4978. ref: this.ref,
  4979. data: buffer.join(""),
  4980. xfa
  4981. }];
  4982. }
  4983. async _saveRadioButton(evaluator, task, annotationStorage) {
  4984. if (!annotationStorage) {
  4985. return null;
  4986. }
  4987. const storageEntry = annotationStorage.get(this.data.id);
  4988. const value = storageEntry && storageEntry.value;
  4989. if (value === undefined) {
  4990. return null;
  4991. }
  4992. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  4993. if (defaultValue === value) {
  4994. return null;
  4995. }
  4996. const dict = evaluator.xref.fetchIfRef(this.ref);
  4997. if (!(0, _primitives.isDict)(dict)) {
  4998. return null;
  4999. }
  5000. const xfa = {
  5001. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5002. value: value ? this.data.buttonValue : ""
  5003. };
  5004. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  5005. let parentBuffer = null;
  5006. const encrypt = evaluator.xref.encrypt;
  5007. if (value) {
  5008. if ((0, _primitives.isRef)(this.parent)) {
  5009. const parent = evaluator.xref.fetch(this.parent);
  5010. let parentTransform = null;
  5011. if (encrypt) {
  5012. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  5013. }
  5014. parent.set("V", name);
  5015. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  5016. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  5017. parentBuffer.push("\nendobj\n");
  5018. } else if ((0, _primitives.isDict)(this.parent)) {
  5019. this.parent.set("V", name);
  5020. }
  5021. }
  5022. dict.set("AS", name);
  5023. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5024. let originalTransform = null;
  5025. if (encrypt) {
  5026. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5027. }
  5028. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5029. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5030. buffer.push("\nendobj\n");
  5031. const newRefs = [{
  5032. ref: this.ref,
  5033. data: buffer.join(""),
  5034. xfa
  5035. }];
  5036. if (parentBuffer !== null) {
  5037. newRefs.push({
  5038. ref: this.parent,
  5039. data: parentBuffer.join(""),
  5040. xfa: null
  5041. });
  5042. }
  5043. return newRefs;
  5044. }
  5045. _processCheckBox(params) {
  5046. const customAppearance = params.dict.get("AP");
  5047. if (!(0, _primitives.isDict)(customAppearance)) {
  5048. return;
  5049. }
  5050. const normalAppearance = customAppearance.get("N");
  5051. if (!(0, _primitives.isDict)(normalAppearance)) {
  5052. return;
  5053. }
  5054. const exportValues = normalAppearance.getKeys();
  5055. if (!exportValues.includes("Off")) {
  5056. exportValues.push("Off");
  5057. }
  5058. if (!exportValues.includes(this.data.fieldValue)) {
  5059. this.data.fieldValue = null;
  5060. }
  5061. if (exportValues.length !== 2) {
  5062. return;
  5063. }
  5064. this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
  5065. this.checkedAppearance = normalAppearance.get(this.data.exportValue);
  5066. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  5067. this._streams.push(this.checkedAppearance);
  5068. if (this.uncheckedAppearance) {
  5069. this._streams.push(this.uncheckedAppearance);
  5070. }
  5071. this._fallbackFontDict = this.fallbackFontDict;
  5072. }
  5073. _processRadioButton(params) {
  5074. this.data.fieldValue = this.data.buttonValue = null;
  5075. const fieldParent = params.dict.get("Parent");
  5076. if ((0, _primitives.isDict)(fieldParent)) {
  5077. this.parent = params.dict.getRaw("Parent");
  5078. const fieldParentValue = fieldParent.get("V");
  5079. if ((0, _primitives.isName)(fieldParentValue)) {
  5080. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  5081. }
  5082. }
  5083. const appearanceStates = params.dict.get("AP");
  5084. if (!(0, _primitives.isDict)(appearanceStates)) {
  5085. return;
  5086. }
  5087. const normalAppearance = appearanceStates.get("N");
  5088. if (!(0, _primitives.isDict)(normalAppearance)) {
  5089. return;
  5090. }
  5091. for (const key of normalAppearance.getKeys()) {
  5092. if (key !== "Off") {
  5093. this.data.buttonValue = this._decodeFormValue(key);
  5094. break;
  5095. }
  5096. }
  5097. this.checkedAppearance = normalAppearance.get(this.data.buttonValue);
  5098. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  5099. this._streams.push(this.checkedAppearance);
  5100. if (this.uncheckedAppearance) {
  5101. this._streams.push(this.uncheckedAppearance);
  5102. }
  5103. this._fallbackFontDict = this.fallbackFontDict;
  5104. }
  5105. _processPushButton(params) {
  5106. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  5107. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  5108. return;
  5109. }
  5110. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  5111. _catalog.Catalog.parseDestDictionary({
  5112. destDict: params.dict,
  5113. resultObj: this.data,
  5114. docBaseUrl: params.pdfManager.docBaseUrl
  5115. });
  5116. }
  5117. getFieldObject() {
  5118. let type = "button";
  5119. let exportValues;
  5120. if (this.data.checkBox) {
  5121. type = "checkbox";
  5122. exportValues = this.data.exportValue;
  5123. } else if (this.data.radioButton) {
  5124. type = "radiobutton";
  5125. exportValues = this.data.buttonValue;
  5126. }
  5127. return {
  5128. id: this.data.id,
  5129. value: this.data.fieldValue || "Off",
  5130. defaultValue: this.data.defaultFieldValue,
  5131. exportValues,
  5132. editable: !this.data.readOnly,
  5133. name: this.data.fieldName,
  5134. rect: this.data.rect,
  5135. hidden: this.data.hidden,
  5136. actions: this.data.actions,
  5137. page: this.data.pageIndex,
  5138. type
  5139. };
  5140. }
  5141. get fallbackFontDict() {
  5142. const dict = new _primitives.Dict();
  5143. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  5144. dict.set("Type", _primitives.Name.get("FallbackType"));
  5145. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  5146. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  5147. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  5148. }
  5149. }
  5150. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  5151. constructor(params) {
  5152. super(params);
  5153. this.data.options = [];
  5154. const options = (0, _core_utils.getInheritableProperty)({
  5155. dict: params.dict,
  5156. key: "Opt"
  5157. });
  5158. if (Array.isArray(options)) {
  5159. const xref = params.xref;
  5160. for (let i = 0, ii = options.length; i < ii; i++) {
  5161. const option = xref.fetchIfRef(options[i]);
  5162. const isOptionArray = Array.isArray(option);
  5163. this.data.options[i] = {
  5164. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  5165. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  5166. };
  5167. }
  5168. }
  5169. if ((0, _util.isString)(this.data.fieldValue)) {
  5170. this.data.fieldValue = [this.data.fieldValue];
  5171. } else if (!this.data.fieldValue) {
  5172. this.data.fieldValue = [];
  5173. }
  5174. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  5175. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  5176. this._hasText = true;
  5177. }
  5178. getFieldObject() {
  5179. const type = this.data.combo ? "combobox" : "listbox";
  5180. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  5181. return {
  5182. id: this.data.id,
  5183. value,
  5184. defaultValue: this.data.defaultFieldValue,
  5185. editable: !this.data.readOnly,
  5186. name: this.data.fieldName,
  5187. rect: this.data.rect,
  5188. numItems: this.data.fieldValue.length,
  5189. multipleSelection: this.data.multiSelect,
  5190. hidden: this.data.hidden,
  5191. actions: this.data.actions,
  5192. items: this.data.options,
  5193. page: this.data.pageIndex,
  5194. type
  5195. };
  5196. }
  5197. }
  5198. class SignatureWidgetAnnotation extends WidgetAnnotation {
  5199. constructor(params) {
  5200. super(params);
  5201. this.data.fieldValue = null;
  5202. }
  5203. getFieldObject() {
  5204. return {
  5205. id: this.data.id,
  5206. value: null,
  5207. page: this.data.pageIndex,
  5208. type: "signature"
  5209. };
  5210. }
  5211. }
  5212. class TextAnnotation extends MarkupAnnotation {
  5213. constructor(parameters) {
  5214. const DEFAULT_ICON_SIZE = 22;
  5215. super(parameters);
  5216. const dict = parameters.dict;
  5217. this.data.annotationType = _util.AnnotationType.TEXT;
  5218. if (this.data.hasAppearance) {
  5219. this.data.name = "NoIcon";
  5220. } else {
  5221. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  5222. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  5223. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  5224. }
  5225. if (dict.has("State")) {
  5226. this.data.state = dict.get("State") || null;
  5227. this.data.stateModel = dict.get("StateModel") || null;
  5228. } else {
  5229. this.data.state = null;
  5230. this.data.stateModel = null;
  5231. }
  5232. }
  5233. }
  5234. class LinkAnnotation extends Annotation {
  5235. constructor(params) {
  5236. super(params);
  5237. this.data.annotationType = _util.AnnotationType.LINK;
  5238. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  5239. if (quadPoints) {
  5240. this.data.quadPoints = quadPoints;
  5241. }
  5242. _catalog.Catalog.parseDestDictionary({
  5243. destDict: params.dict,
  5244. resultObj: this.data,
  5245. docBaseUrl: params.pdfManager.docBaseUrl
  5246. });
  5247. }
  5248. }
  5249. class PopupAnnotation extends Annotation {
  5250. constructor(parameters) {
  5251. super(parameters);
  5252. this.data.annotationType = _util.AnnotationType.POPUP;
  5253. let parentItem = parameters.dict.get("Parent");
  5254. if (!parentItem) {
  5255. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  5256. return;
  5257. }
  5258. const parentSubtype = parentItem.get("Subtype");
  5259. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  5260. const rawParent = parameters.dict.getRaw("Parent");
  5261. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  5262. const parentRect = parentItem.getArray("Rect");
  5263. if (Array.isArray(parentRect) && parentRect.length === 4) {
  5264. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  5265. } else {
  5266. this.data.parentRect = [0, 0, 0, 0];
  5267. }
  5268. const rt = parentItem.get("RT");
  5269. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  5270. parentItem = parentItem.get("IRT");
  5271. }
  5272. if (!parentItem.has("M")) {
  5273. this.data.modificationDate = null;
  5274. } else {
  5275. this.setModificationDate(parentItem.get("M"));
  5276. this.data.modificationDate = this.modificationDate;
  5277. }
  5278. if (!parentItem.has("C")) {
  5279. this.data.color = null;
  5280. } else {
  5281. this.setColor(parentItem.getArray("C"));
  5282. this.data.color = this.color;
  5283. }
  5284. if (!this.viewable) {
  5285. const parentFlags = parentItem.get("F");
  5286. if (this._isViewable(parentFlags)) {
  5287. this.setFlags(parentFlags);
  5288. }
  5289. }
  5290. this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
  5291. this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
  5292. }
  5293. }
  5294. class FreeTextAnnotation extends MarkupAnnotation {
  5295. constructor(parameters) {
  5296. super(parameters);
  5297. this.data.annotationType = _util.AnnotationType.FREETEXT;
  5298. }
  5299. }
  5300. class LineAnnotation extends MarkupAnnotation {
  5301. constructor(parameters) {
  5302. super(parameters);
  5303. this.data.annotationType = _util.AnnotationType.LINE;
  5304. const lineCoordinates = parameters.dict.getArray("L");
  5305. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  5306. if (!this.appearance) {
  5307. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5308. const strokeAlpha = parameters.dict.get("CA");
  5309. let fillColor = null,
  5310. interiorColor = parameters.dict.getArray("IC");
  5311. if (interiorColor) {
  5312. interiorColor = getRgbColor(interiorColor);
  5313. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  5314. }
  5315. const fillAlpha = fillColor ? strokeAlpha : null;
  5316. const borderWidth = this.borderStyle.width || 1,
  5317. borderAdjust = 2 * borderWidth;
  5318. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  5319. if (!_util.Util.intersect(this.rectangle, bbox)) {
  5320. this.rectangle = bbox;
  5321. }
  5322. this._setDefaultAppearance({
  5323. xref: parameters.xref,
  5324. extra: `${borderWidth} w`,
  5325. strokeColor,
  5326. fillColor,
  5327. strokeAlpha,
  5328. fillAlpha,
  5329. pointsCallback: (buffer, points) => {
  5330. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  5331. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  5332. }
  5333. });
  5334. }
  5335. }
  5336. }
  5337. class SquareAnnotation extends MarkupAnnotation {
  5338. constructor(parameters) {
  5339. super(parameters);
  5340. this.data.annotationType = _util.AnnotationType.SQUARE;
  5341. if (!this.appearance) {
  5342. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5343. const strokeAlpha = parameters.dict.get("CA");
  5344. let fillColor = null,
  5345. interiorColor = parameters.dict.getArray("IC");
  5346. if (interiorColor) {
  5347. interiorColor = getRgbColor(interiorColor);
  5348. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  5349. }
  5350. const fillAlpha = fillColor ? strokeAlpha : null;
  5351. this._setDefaultAppearance({
  5352. xref: parameters.xref,
  5353. extra: `${this.borderStyle.width} w`,
  5354. strokeColor,
  5355. fillColor,
  5356. strokeAlpha,
  5357. fillAlpha,
  5358. pointsCallback: (buffer, points) => {
  5359. const x = points[2].x + this.borderStyle.width / 2;
  5360. const y = points[2].y + this.borderStyle.width / 2;
  5361. const width = points[3].x - points[2].x - this.borderStyle.width;
  5362. const height = points[1].y - points[3].y - this.borderStyle.width;
  5363. buffer.push(`${x} ${y} ${width} ${height} re`);
  5364. if (fillColor) {
  5365. buffer.push("B");
  5366. } else {
  5367. buffer.push("S");
  5368. }
  5369. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5370. }
  5371. });
  5372. }
  5373. }
  5374. }
  5375. class CircleAnnotation extends MarkupAnnotation {
  5376. constructor(parameters) {
  5377. super(parameters);
  5378. this.data.annotationType = _util.AnnotationType.CIRCLE;
  5379. if (!this.appearance) {
  5380. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5381. const strokeAlpha = parameters.dict.get("CA");
  5382. let fillColor = null;
  5383. let interiorColor = parameters.dict.getArray("IC");
  5384. if (interiorColor) {
  5385. interiorColor = getRgbColor(interiorColor);
  5386. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  5387. }
  5388. const fillAlpha = fillColor ? strokeAlpha : null;
  5389. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  5390. this._setDefaultAppearance({
  5391. xref: parameters.xref,
  5392. extra: `${this.borderStyle.width} w`,
  5393. strokeColor,
  5394. fillColor,
  5395. strokeAlpha,
  5396. fillAlpha,
  5397. pointsCallback: (buffer, points) => {
  5398. const x0 = points[0].x + this.borderStyle.width / 2;
  5399. const y0 = points[0].y - this.borderStyle.width / 2;
  5400. const x1 = points[3].x - this.borderStyle.width / 2;
  5401. const y1 = points[3].y + this.borderStyle.width / 2;
  5402. const xMid = x0 + (x1 - x0) / 2;
  5403. const yMid = y0 + (y1 - y0) / 2;
  5404. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  5405. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  5406. 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");
  5407. if (fillColor) {
  5408. buffer.push("B");
  5409. } else {
  5410. buffer.push("S");
  5411. }
  5412. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5413. }
  5414. });
  5415. }
  5416. }
  5417. }
  5418. class PolylineAnnotation extends MarkupAnnotation {
  5419. constructor(parameters) {
  5420. super(parameters);
  5421. this.data.annotationType = _util.AnnotationType.POLYLINE;
  5422. this.data.vertices = [];
  5423. const rawVertices = parameters.dict.getArray("Vertices");
  5424. if (!Array.isArray(rawVertices)) {
  5425. return;
  5426. }
  5427. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  5428. this.data.vertices.push({
  5429. x: rawVertices[i],
  5430. y: rawVertices[i + 1]
  5431. });
  5432. }
  5433. if (!this.appearance) {
  5434. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5435. const strokeAlpha = parameters.dict.get("CA");
  5436. const borderWidth = this.borderStyle.width || 1,
  5437. borderAdjust = 2 * borderWidth;
  5438. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  5439. for (const vertex of this.data.vertices) {
  5440. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  5441. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  5442. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  5443. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  5444. }
  5445. if (!_util.Util.intersect(this.rectangle, bbox)) {
  5446. this.rectangle = bbox;
  5447. }
  5448. this._setDefaultAppearance({
  5449. xref: parameters.xref,
  5450. extra: `${borderWidth} w`,
  5451. strokeColor,
  5452. strokeAlpha,
  5453. pointsCallback: (buffer, points) => {
  5454. const vertices = this.data.vertices;
  5455. for (let i = 0, ii = vertices.length; i < ii; i++) {
  5456. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  5457. }
  5458. buffer.push("S");
  5459. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5460. }
  5461. });
  5462. }
  5463. }
  5464. }
  5465. class PolygonAnnotation extends PolylineAnnotation {
  5466. constructor(parameters) {
  5467. super(parameters);
  5468. this.data.annotationType = _util.AnnotationType.POLYGON;
  5469. }
  5470. }
  5471. class CaretAnnotation extends MarkupAnnotation {
  5472. constructor(parameters) {
  5473. super(parameters);
  5474. this.data.annotationType = _util.AnnotationType.CARET;
  5475. }
  5476. }
  5477. class InkAnnotation extends MarkupAnnotation {
  5478. constructor(parameters) {
  5479. super(parameters);
  5480. this.data.annotationType = _util.AnnotationType.INK;
  5481. this.data.inkLists = [];
  5482. const rawInkLists = parameters.dict.getArray("InkList");
  5483. if (!Array.isArray(rawInkLists)) {
  5484. return;
  5485. }
  5486. const xref = parameters.xref;
  5487. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  5488. this.data.inkLists.push([]);
  5489. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  5490. this.data.inkLists[i].push({
  5491. x: xref.fetchIfRef(rawInkLists[i][j]),
  5492. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  5493. });
  5494. }
  5495. }
  5496. if (!this.appearance) {
  5497. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5498. const strokeAlpha = parameters.dict.get("CA");
  5499. const borderWidth = this.borderStyle.width || 1,
  5500. borderAdjust = 2 * borderWidth;
  5501. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  5502. for (const inkLists of this.data.inkLists) {
  5503. for (const vertex of inkLists) {
  5504. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  5505. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  5506. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  5507. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  5508. }
  5509. }
  5510. if (!_util.Util.intersect(this.rectangle, bbox)) {
  5511. this.rectangle = bbox;
  5512. }
  5513. this._setDefaultAppearance({
  5514. xref: parameters.xref,
  5515. extra: `${borderWidth} w`,
  5516. strokeColor,
  5517. strokeAlpha,
  5518. pointsCallback: (buffer, points) => {
  5519. for (const inkList of this.data.inkLists) {
  5520. for (let i = 0, ii = inkList.length; i < ii; i++) {
  5521. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  5522. }
  5523. buffer.push("S");
  5524. }
  5525. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5526. }
  5527. });
  5528. }
  5529. }
  5530. }
  5531. class HighlightAnnotation extends MarkupAnnotation {
  5532. constructor(parameters) {
  5533. super(parameters);
  5534. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  5535. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5536. if (quadPoints) {
  5537. const resources = this.appearance && this.appearance.dict.get("Resources");
  5538. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  5539. if (this.appearance) {
  5540. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  5541. }
  5542. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  5543. const fillAlpha = parameters.dict.get("CA");
  5544. this._setDefaultAppearance({
  5545. xref: parameters.xref,
  5546. fillColor,
  5547. blendMode: "Multiply",
  5548. fillAlpha,
  5549. pointsCallback: (buffer, points) => {
  5550. 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");
  5551. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5552. }
  5553. });
  5554. }
  5555. } else {
  5556. this.data.hasPopup = false;
  5557. }
  5558. }
  5559. }
  5560. class UnderlineAnnotation extends MarkupAnnotation {
  5561. constructor(parameters) {
  5562. super(parameters);
  5563. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  5564. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5565. if (quadPoints) {
  5566. if (!this.appearance) {
  5567. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5568. const strokeAlpha = parameters.dict.get("CA");
  5569. this._setDefaultAppearance({
  5570. xref: parameters.xref,
  5571. extra: "[] 0 d 1 w",
  5572. strokeColor,
  5573. strokeAlpha,
  5574. pointsCallback: (buffer, points) => {
  5575. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  5576. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5577. }
  5578. });
  5579. }
  5580. } else {
  5581. this.data.hasPopup = false;
  5582. }
  5583. }
  5584. }
  5585. class SquigglyAnnotation extends MarkupAnnotation {
  5586. constructor(parameters) {
  5587. super(parameters);
  5588. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  5589. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5590. if (quadPoints) {
  5591. if (!this.appearance) {
  5592. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5593. const strokeAlpha = parameters.dict.get("CA");
  5594. this._setDefaultAppearance({
  5595. xref: parameters.xref,
  5596. extra: "[] 0 d 1 w",
  5597. strokeColor,
  5598. strokeAlpha,
  5599. pointsCallback: (buffer, points) => {
  5600. const dy = (points[0].y - points[2].y) / 6;
  5601. let shift = dy;
  5602. let x = points[2].x;
  5603. const y = points[2].y;
  5604. const xEnd = points[3].x;
  5605. buffer.push(`${x} ${y + shift} m`);
  5606. do {
  5607. x += 2;
  5608. shift = shift === 0 ? dy : 0;
  5609. buffer.push(`${x} ${y + shift} l`);
  5610. } while (x < xEnd);
  5611. buffer.push("S");
  5612. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  5613. }
  5614. });
  5615. }
  5616. } else {
  5617. this.data.hasPopup = false;
  5618. }
  5619. }
  5620. }
  5621. class StrikeOutAnnotation extends MarkupAnnotation {
  5622. constructor(parameters) {
  5623. super(parameters);
  5624. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  5625. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5626. if (quadPoints) {
  5627. if (!this.appearance) {
  5628. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5629. const strokeAlpha = parameters.dict.get("CA");
  5630. this._setDefaultAppearance({
  5631. xref: parameters.xref,
  5632. extra: "[] 0 d 1 w",
  5633. strokeColor,
  5634. strokeAlpha,
  5635. pointsCallback: (buffer, points) => {
  5636. 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");
  5637. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5638. }
  5639. });
  5640. }
  5641. } else {
  5642. this.data.hasPopup = false;
  5643. }
  5644. }
  5645. }
  5646. class StampAnnotation extends MarkupAnnotation {
  5647. constructor(parameters) {
  5648. super(parameters);
  5649. this.data.annotationType = _util.AnnotationType.STAMP;
  5650. }
  5651. }
  5652. class FileAttachmentAnnotation extends MarkupAnnotation {
  5653. constructor(parameters) {
  5654. super(parameters);
  5655. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  5656. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  5657. this.data.file = file.serializable;
  5658. }
  5659. }
  5660. /***/ }),
  5661. /* 13 */
  5662. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5663. Object.defineProperty(exports, "__esModule", ({
  5664. value: true
  5665. }));
  5666. exports.createDefaultAppearance = createDefaultAppearance;
  5667. exports.parseDefaultAppearance = parseDefaultAppearance;
  5668. var _util = __w_pdfjs_require__(2);
  5669. var _colorspace = __w_pdfjs_require__(14);
  5670. var _core_utils = __w_pdfjs_require__(9);
  5671. var _evaluator = __w_pdfjs_require__(15);
  5672. var _primitives = __w_pdfjs_require__(5);
  5673. var _stream = __w_pdfjs_require__(10);
  5674. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  5675. constructor(str) {
  5676. super(new _stream.StringStream(str));
  5677. }
  5678. parse() {
  5679. const operation = {
  5680. fn: 0,
  5681. args: []
  5682. };
  5683. const result = {
  5684. fontSize: 0,
  5685. fontName: "",
  5686. fontColor: new Uint8ClampedArray(3)
  5687. };
  5688. try {
  5689. while (true) {
  5690. operation.args.length = 0;
  5691. if (!this.read(operation)) {
  5692. break;
  5693. }
  5694. if (this.savedStatesDepth !== 0) {
  5695. continue;
  5696. }
  5697. const {
  5698. fn,
  5699. args
  5700. } = operation;
  5701. switch (fn | 0) {
  5702. case _util.OPS.setFont:
  5703. const [fontName, fontSize] = args;
  5704. if (fontName instanceof _primitives.Name) {
  5705. result.fontName = fontName.name;
  5706. }
  5707. if (typeof fontSize === "number" && fontSize > 0) {
  5708. result.fontSize = fontSize;
  5709. }
  5710. break;
  5711. case _util.OPS.setFillRGBColor:
  5712. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  5713. break;
  5714. case _util.OPS.setFillGray:
  5715. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  5716. break;
  5717. case _util.OPS.setFillColorSpace:
  5718. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  5719. break;
  5720. }
  5721. }
  5722. } catch (reason) {
  5723. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  5724. }
  5725. return result;
  5726. }
  5727. }
  5728. function parseDefaultAppearance(str) {
  5729. return new DefaultAppearanceEvaluator(str).parse();
  5730. }
  5731. function createDefaultAppearance({
  5732. fontSize,
  5733. fontName,
  5734. fontColor
  5735. }) {
  5736. let colorCmd;
  5737. if (fontColor.every(c => c === 0)) {
  5738. colorCmd = "0 g";
  5739. } else {
  5740. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  5741. }
  5742. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  5743. }
  5744. /***/ }),
  5745. /* 14 */
  5746. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5747. Object.defineProperty(exports, "__esModule", ({
  5748. value: true
  5749. }));
  5750. exports.ColorSpace = void 0;
  5751. var _util = __w_pdfjs_require__(2);
  5752. var _primitives = __w_pdfjs_require__(5);
  5753. var _core_utils = __w_pdfjs_require__(9);
  5754. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  5755. const COMPONENTS = 3;
  5756. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  5757. const xRatio = w1 / w2;
  5758. const yRatio = h1 / h2;
  5759. let newIndex = 0,
  5760. oldIndex;
  5761. const xScaled = new Uint16Array(w2);
  5762. const w1Scanline = w1 * COMPONENTS;
  5763. for (let i = 0; i < w2; i++) {
  5764. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  5765. }
  5766. for (let i = 0; i < h2; i++) {
  5767. const py = Math.floor(i * yRatio) * w1Scanline;
  5768. for (let j = 0; j < w2; j++) {
  5769. oldIndex = py + xScaled[j];
  5770. dest[newIndex++] = src[oldIndex++];
  5771. dest[newIndex++] = src[oldIndex++];
  5772. dest[newIndex++] = src[oldIndex++];
  5773. newIndex += alpha01;
  5774. }
  5775. }
  5776. }
  5777. class ColorSpace {
  5778. constructor(name, numComps) {
  5779. if (this.constructor === ColorSpace) {
  5780. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  5781. }
  5782. this.name = name;
  5783. this.numComps = numComps;
  5784. }
  5785. getRgb(src, srcOffset) {
  5786. const rgb = new Uint8ClampedArray(3);
  5787. this.getRgbItem(src, srcOffset, rgb, 0);
  5788. return rgb;
  5789. }
  5790. getRgbItem(src, srcOffset, dest, destOffset) {
  5791. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  5792. }
  5793. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  5794. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  5795. }
  5796. getOutputLength(inputLength, alpha01) {
  5797. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  5798. }
  5799. isPassthrough(bits) {
  5800. return false;
  5801. }
  5802. isDefaultDecode(decodeMap, bpc) {
  5803. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  5804. }
  5805. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  5806. const count = originalWidth * originalHeight;
  5807. let rgbBuf = null;
  5808. const numComponentColors = 1 << bpc;
  5809. const needsResizing = originalHeight !== height || originalWidth !== width;
  5810. if (this.isPassthrough(bpc)) {
  5811. rgbBuf = comps;
  5812. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  5813. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  5814. for (let i = 0; i < numComponentColors; i++) {
  5815. allColors[i] = i;
  5816. }
  5817. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  5818. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  5819. if (!needsResizing) {
  5820. let destPos = 0;
  5821. for (let i = 0; i < count; ++i) {
  5822. const key = comps[i] * 3;
  5823. dest[destPos++] = colorMap[key];
  5824. dest[destPos++] = colorMap[key + 1];
  5825. dest[destPos++] = colorMap[key + 2];
  5826. destPos += alpha01;
  5827. }
  5828. } else {
  5829. rgbBuf = new Uint8Array(count * 3);
  5830. let rgbPos = 0;
  5831. for (let i = 0; i < count; ++i) {
  5832. const key = comps[i] * 3;
  5833. rgbBuf[rgbPos++] = colorMap[key];
  5834. rgbBuf[rgbPos++] = colorMap[key + 1];
  5835. rgbBuf[rgbPos++] = colorMap[key + 2];
  5836. }
  5837. }
  5838. } else {
  5839. if (!needsResizing) {
  5840. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  5841. } else {
  5842. rgbBuf = new Uint8ClampedArray(count * 3);
  5843. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  5844. }
  5845. }
  5846. if (rgbBuf) {
  5847. if (needsResizing) {
  5848. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  5849. } else {
  5850. let destPos = 0,
  5851. rgbPos = 0;
  5852. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  5853. dest[destPos++] = rgbBuf[rgbPos++];
  5854. dest[destPos++] = rgbBuf[rgbPos++];
  5855. dest[destPos++] = rgbBuf[rgbPos++];
  5856. destPos += alpha01;
  5857. }
  5858. }
  5859. }
  5860. }
  5861. get usesZeroToOneRange() {
  5862. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  5863. }
  5864. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  5865. if (!localColorSpaceCache) {
  5866. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  5867. }
  5868. if (!parsedColorSpace) {
  5869. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  5870. }
  5871. let csName, csRef;
  5872. if (cacheKey instanceof _primitives.Ref) {
  5873. csRef = cacheKey;
  5874. cacheKey = xref.fetch(cacheKey);
  5875. }
  5876. if (cacheKey instanceof _primitives.Name) {
  5877. csName = cacheKey.name;
  5878. }
  5879. if (csName || csRef) {
  5880. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  5881. }
  5882. }
  5883. static getCached(cacheKey, xref, localColorSpaceCache) {
  5884. if (!localColorSpaceCache) {
  5885. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  5886. }
  5887. if (cacheKey instanceof _primitives.Ref) {
  5888. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  5889. if (localColorSpace) {
  5890. return localColorSpace;
  5891. }
  5892. try {
  5893. cacheKey = xref.fetch(cacheKey);
  5894. } catch (ex) {
  5895. if (ex instanceof _core_utils.MissingDataException) {
  5896. throw ex;
  5897. }
  5898. }
  5899. }
  5900. if (cacheKey instanceof _primitives.Name) {
  5901. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  5902. if (localColorSpace) {
  5903. return localColorSpace;
  5904. }
  5905. }
  5906. return null;
  5907. }
  5908. static async parseAsync({
  5909. cs,
  5910. xref,
  5911. resources = null,
  5912. pdfFunctionFactory,
  5913. localColorSpaceCache
  5914. }) {
  5915. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  5916. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  5917. return parsedColorSpace;
  5918. }
  5919. static parse({
  5920. cs,
  5921. xref,
  5922. resources = null,
  5923. pdfFunctionFactory,
  5924. localColorSpaceCache
  5925. }) {
  5926. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  5927. if (cachedColorSpace) {
  5928. return cachedColorSpace;
  5929. }
  5930. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  5931. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  5932. return parsedColorSpace;
  5933. }
  5934. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  5935. cs = xref.fetchIfRef(cs);
  5936. if ((0, _primitives.isName)(cs)) {
  5937. switch (cs.name) {
  5938. case "DeviceGray":
  5939. case "G":
  5940. return this.singletons.gray;
  5941. case "DeviceRGB":
  5942. case "RGB":
  5943. return this.singletons.rgb;
  5944. case "DeviceCMYK":
  5945. case "CMYK":
  5946. return this.singletons.cmyk;
  5947. case "Pattern":
  5948. return new PatternCS(null);
  5949. default:
  5950. if ((0, _primitives.isDict)(resources)) {
  5951. const colorSpaces = resources.get("ColorSpace");
  5952. if ((0, _primitives.isDict)(colorSpaces)) {
  5953. const resourcesCS = colorSpaces.get(cs.name);
  5954. if (resourcesCS) {
  5955. if ((0, _primitives.isName)(resourcesCS)) {
  5956. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  5957. }
  5958. cs = resourcesCS;
  5959. break;
  5960. }
  5961. }
  5962. }
  5963. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  5964. }
  5965. }
  5966. if (Array.isArray(cs)) {
  5967. const mode = xref.fetchIfRef(cs[0]).name;
  5968. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  5969. switch (mode) {
  5970. case "DeviceGray":
  5971. case "G":
  5972. return this.singletons.gray;
  5973. case "DeviceRGB":
  5974. case "RGB":
  5975. return this.singletons.rgb;
  5976. case "DeviceCMYK":
  5977. case "CMYK":
  5978. return this.singletons.cmyk;
  5979. case "CalGray":
  5980. params = xref.fetchIfRef(cs[1]);
  5981. whitePoint = params.getArray("WhitePoint");
  5982. blackPoint = params.getArray("BlackPoint");
  5983. gamma = params.get("Gamma");
  5984. return new CalGrayCS(whitePoint, blackPoint, gamma);
  5985. case "CalRGB":
  5986. params = xref.fetchIfRef(cs[1]);
  5987. whitePoint = params.getArray("WhitePoint");
  5988. blackPoint = params.getArray("BlackPoint");
  5989. gamma = params.getArray("Gamma");
  5990. const matrix = params.getArray("Matrix");
  5991. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  5992. case "ICCBased":
  5993. const stream = xref.fetchIfRef(cs[1]);
  5994. const dict = stream.dict;
  5995. numComps = dict.get("N");
  5996. const alt = dict.get("Alternate");
  5997. if (alt) {
  5998. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  5999. if (altCS.numComps === numComps) {
  6000. return altCS;
  6001. }
  6002. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  6003. }
  6004. if (numComps === 1) {
  6005. return this.singletons.gray;
  6006. } else if (numComps === 3) {
  6007. return this.singletons.rgb;
  6008. } else if (numComps === 4) {
  6009. return this.singletons.cmyk;
  6010. }
  6011. break;
  6012. case "Pattern":
  6013. baseCS = cs[1] || null;
  6014. if (baseCS) {
  6015. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  6016. }
  6017. return new PatternCS(baseCS);
  6018. case "Indexed":
  6019. case "I":
  6020. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  6021. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  6022. const lookup = xref.fetchIfRef(cs[3]);
  6023. return new IndexedCS(baseCS, hiVal, lookup);
  6024. case "Separation":
  6025. case "DeviceN":
  6026. const name = xref.fetchIfRef(cs[1]);
  6027. numComps = Array.isArray(name) ? name.length : 1;
  6028. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  6029. const tintFn = pdfFunctionFactory.create(cs[3]);
  6030. return new AlternateCS(numComps, baseCS, tintFn);
  6031. case "Lab":
  6032. params = xref.fetchIfRef(cs[1]);
  6033. whitePoint = params.getArray("WhitePoint");
  6034. blackPoint = params.getArray("BlackPoint");
  6035. const range = params.getArray("Range");
  6036. return new LabCS(whitePoint, blackPoint, range);
  6037. default:
  6038. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  6039. }
  6040. }
  6041. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  6042. }
  6043. static isDefaultDecode(decode, numComps) {
  6044. if (!Array.isArray(decode)) {
  6045. return true;
  6046. }
  6047. if (numComps * 2 !== decode.length) {
  6048. (0, _util.warn)("The decode map is not the correct length");
  6049. return true;
  6050. }
  6051. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  6052. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  6053. return false;
  6054. }
  6055. }
  6056. return true;
  6057. }
  6058. static get singletons() {
  6059. return (0, _util.shadow)(this, "singletons", {
  6060. get gray() {
  6061. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  6062. },
  6063. get rgb() {
  6064. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  6065. },
  6066. get cmyk() {
  6067. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  6068. }
  6069. });
  6070. }
  6071. }
  6072. exports.ColorSpace = ColorSpace;
  6073. class AlternateCS extends ColorSpace {
  6074. constructor(numComps, base, tintFn) {
  6075. super("Alternate", numComps);
  6076. this.base = base;
  6077. this.tintFn = tintFn;
  6078. this.tmpBuf = new Float32Array(base.numComps);
  6079. }
  6080. getRgbItem(src, srcOffset, dest, destOffset) {
  6081. const tmpBuf = this.tmpBuf;
  6082. this.tintFn(src, srcOffset, tmpBuf, 0);
  6083. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  6084. }
  6085. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6086. const tintFn = this.tintFn;
  6087. const base = this.base;
  6088. const scale = 1 / ((1 << bits) - 1);
  6089. const baseNumComps = base.numComps;
  6090. const usesZeroToOneRange = base.usesZeroToOneRange;
  6091. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  6092. let pos = isPassthrough ? destOffset : 0;
  6093. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  6094. const numComps = this.numComps;
  6095. const scaled = new Float32Array(numComps);
  6096. const tinted = new Float32Array(baseNumComps);
  6097. let i, j;
  6098. for (i = 0; i < count; i++) {
  6099. for (j = 0; j < numComps; j++) {
  6100. scaled[j] = src[srcOffset++] * scale;
  6101. }
  6102. tintFn(scaled, 0, tinted, 0);
  6103. if (usesZeroToOneRange) {
  6104. for (j = 0; j < baseNumComps; j++) {
  6105. baseBuf[pos++] = tinted[j] * 255;
  6106. }
  6107. } else {
  6108. base.getRgbItem(tinted, 0, baseBuf, pos);
  6109. pos += baseNumComps;
  6110. }
  6111. }
  6112. if (!isPassthrough) {
  6113. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  6114. }
  6115. }
  6116. getOutputLength(inputLength, alpha01) {
  6117. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  6118. }
  6119. }
  6120. class PatternCS extends ColorSpace {
  6121. constructor(baseCS) {
  6122. super("Pattern", null);
  6123. this.base = baseCS;
  6124. }
  6125. isDefaultDecode(decodeMap, bpc) {
  6126. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  6127. }
  6128. }
  6129. class IndexedCS extends ColorSpace {
  6130. constructor(base, highVal, lookup) {
  6131. super("Indexed", 1);
  6132. this.base = base;
  6133. this.highVal = highVal;
  6134. const length = base.numComps * highVal;
  6135. this.lookup = new Uint8Array(length);
  6136. if ((0, _primitives.isStream)(lookup)) {
  6137. const bytes = lookup.getBytes(length);
  6138. this.lookup.set(bytes);
  6139. } else if (typeof lookup === "string") {
  6140. for (let i = 0; i < length; ++i) {
  6141. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  6142. }
  6143. } else {
  6144. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  6145. }
  6146. }
  6147. getRgbItem(src, srcOffset, dest, destOffset) {
  6148. const numComps = this.base.numComps;
  6149. const start = src[srcOffset] * numComps;
  6150. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  6151. }
  6152. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6153. const base = this.base;
  6154. const numComps = base.numComps;
  6155. const outputDelta = base.getOutputLength(numComps, alpha01);
  6156. const lookup = this.lookup;
  6157. for (let i = 0; i < count; ++i) {
  6158. const lookupPos = src[srcOffset++] * numComps;
  6159. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  6160. destOffset += outputDelta;
  6161. }
  6162. }
  6163. getOutputLength(inputLength, alpha01) {
  6164. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  6165. }
  6166. isDefaultDecode(decodeMap, bpc) {
  6167. if (!Array.isArray(decodeMap)) {
  6168. return true;
  6169. }
  6170. if (decodeMap.length !== 2) {
  6171. (0, _util.warn)("Decode map length is not correct");
  6172. return true;
  6173. }
  6174. if (!Number.isInteger(bpc) || bpc < 1) {
  6175. (0, _util.warn)("Bits per component is not correct");
  6176. return true;
  6177. }
  6178. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  6179. }
  6180. }
  6181. class DeviceGrayCS extends ColorSpace {
  6182. constructor() {
  6183. super("DeviceGray", 1);
  6184. }
  6185. getRgbItem(src, srcOffset, dest, destOffset) {
  6186. const c = src[srcOffset] * 255;
  6187. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  6188. }
  6189. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6190. const scale = 255 / ((1 << bits) - 1);
  6191. let j = srcOffset,
  6192. q = destOffset;
  6193. for (let i = 0; i < count; ++i) {
  6194. const c = scale * src[j++];
  6195. dest[q++] = c;
  6196. dest[q++] = c;
  6197. dest[q++] = c;
  6198. q += alpha01;
  6199. }
  6200. }
  6201. getOutputLength(inputLength, alpha01) {
  6202. return inputLength * (3 + alpha01);
  6203. }
  6204. }
  6205. class DeviceRgbCS extends ColorSpace {
  6206. constructor() {
  6207. super("DeviceRGB", 3);
  6208. }
  6209. getRgbItem(src, srcOffset, dest, destOffset) {
  6210. dest[destOffset] = src[srcOffset] * 255;
  6211. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  6212. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  6213. }
  6214. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6215. if (bits === 8 && alpha01 === 0) {
  6216. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  6217. return;
  6218. }
  6219. const scale = 255 / ((1 << bits) - 1);
  6220. let j = srcOffset,
  6221. q = destOffset;
  6222. for (let i = 0; i < count; ++i) {
  6223. dest[q++] = scale * src[j++];
  6224. dest[q++] = scale * src[j++];
  6225. dest[q++] = scale * src[j++];
  6226. q += alpha01;
  6227. }
  6228. }
  6229. getOutputLength(inputLength, alpha01) {
  6230. return inputLength * (3 + alpha01) / 3 | 0;
  6231. }
  6232. isPassthrough(bits) {
  6233. return bits === 8;
  6234. }
  6235. }
  6236. const DeviceCmykCS = function DeviceCmykCSClosure() {
  6237. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  6238. const c = src[srcOffset] * srcScale;
  6239. const m = src[srcOffset + 1] * srcScale;
  6240. const y = src[srcOffset + 2] * srcScale;
  6241. const k = src[srcOffset + 3] * srcScale;
  6242. 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);
  6243. 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);
  6244. 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);
  6245. }
  6246. class DeviceCmykCS extends ColorSpace {
  6247. constructor() {
  6248. super("DeviceCMYK", 4);
  6249. }
  6250. getRgbItem(src, srcOffset, dest, destOffset) {
  6251. convertToRgb(src, srcOffset, 1, dest, destOffset);
  6252. }
  6253. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6254. const scale = 1 / ((1 << bits) - 1);
  6255. for (let i = 0; i < count; i++) {
  6256. convertToRgb(src, srcOffset, scale, dest, destOffset);
  6257. srcOffset += 4;
  6258. destOffset += 3 + alpha01;
  6259. }
  6260. }
  6261. getOutputLength(inputLength, alpha01) {
  6262. return inputLength / 4 * (3 + alpha01) | 0;
  6263. }
  6264. }
  6265. return DeviceCmykCS;
  6266. }();
  6267. const CalGrayCS = function CalGrayCSClosure() {
  6268. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  6269. const A = src[srcOffset] * scale;
  6270. const AG = A ** cs.G;
  6271. const L = cs.YW * AG;
  6272. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  6273. dest[destOffset] = val;
  6274. dest[destOffset + 1] = val;
  6275. dest[destOffset + 2] = val;
  6276. }
  6277. class CalGrayCS extends ColorSpace {
  6278. constructor(whitePoint, blackPoint, gamma) {
  6279. super("CalGray", 1);
  6280. if (!whitePoint) {
  6281. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  6282. }
  6283. blackPoint = blackPoint || [0, 0, 0];
  6284. gamma = gamma || 1;
  6285. this.XW = whitePoint[0];
  6286. this.YW = whitePoint[1];
  6287. this.ZW = whitePoint[2];
  6288. this.XB = blackPoint[0];
  6289. this.YB = blackPoint[1];
  6290. this.ZB = blackPoint[2];
  6291. this.G = gamma;
  6292. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  6293. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  6294. }
  6295. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  6296. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  6297. this.XB = this.YB = this.ZB = 0;
  6298. }
  6299. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  6300. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  6301. }
  6302. if (this.G < 1) {
  6303. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  6304. this.G = 1;
  6305. }
  6306. }
  6307. getRgbItem(src, srcOffset, dest, destOffset) {
  6308. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  6309. }
  6310. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6311. const scale = 1 / ((1 << bits) - 1);
  6312. for (let i = 0; i < count; ++i) {
  6313. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  6314. srcOffset += 1;
  6315. destOffset += 3 + alpha01;
  6316. }
  6317. }
  6318. getOutputLength(inputLength, alpha01) {
  6319. return inputLength * (3 + alpha01);
  6320. }
  6321. }
  6322. return CalGrayCS;
  6323. }();
  6324. const CalRGBCS = function CalRGBCSClosure() {
  6325. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  6326. 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]);
  6327. 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]);
  6328. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  6329. const tempNormalizeMatrix = new Float32Array(3);
  6330. const tempConvertMatrix1 = new Float32Array(3);
  6331. const tempConvertMatrix2 = new Float32Array(3);
  6332. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  6333. function matrixProduct(a, b, result) {
  6334. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  6335. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  6336. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  6337. }
  6338. function convertToFlat(sourceWhitePoint, LMS, result) {
  6339. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  6340. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  6341. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  6342. }
  6343. function convertToD65(sourceWhitePoint, LMS, result) {
  6344. const D65X = 0.95047;
  6345. const D65Y = 1;
  6346. const D65Z = 1.08883;
  6347. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  6348. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  6349. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  6350. }
  6351. function sRGBTransferFunction(color) {
  6352. if (color <= 0.0031308) {
  6353. return adjustToRange(0, 1, 12.92 * color);
  6354. }
  6355. if (color >= 0.99554525) {
  6356. return 1;
  6357. }
  6358. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  6359. }
  6360. function adjustToRange(min, max, value) {
  6361. return Math.max(min, Math.min(max, value));
  6362. }
  6363. function decodeL(L) {
  6364. if (L < 0) {
  6365. return -decodeL(-L);
  6366. }
  6367. if (L > 8.0) {
  6368. return ((L + 16) / 116) ** 3;
  6369. }
  6370. return L * DECODE_L_CONSTANT;
  6371. }
  6372. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  6373. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  6374. result[0] = XYZ_Flat[0];
  6375. result[1] = XYZ_Flat[1];
  6376. result[2] = XYZ_Flat[2];
  6377. return;
  6378. }
  6379. const zeroDecodeL = decodeL(0);
  6380. const X_DST = zeroDecodeL;
  6381. const X_SRC = decodeL(sourceBlackPoint[0]);
  6382. const Y_DST = zeroDecodeL;
  6383. const Y_SRC = decodeL(sourceBlackPoint[1]);
  6384. const Z_DST = zeroDecodeL;
  6385. const Z_SRC = decodeL(sourceBlackPoint[2]);
  6386. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  6387. const X_Offset = 1 - X_Scale;
  6388. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  6389. const Y_Offset = 1 - Y_Scale;
  6390. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  6391. const Z_Offset = 1 - Z_Scale;
  6392. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  6393. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  6394. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  6395. }
  6396. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  6397. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  6398. result[0] = XYZ_In[0];
  6399. result[1] = XYZ_In[1];
  6400. result[2] = XYZ_In[2];
  6401. return;
  6402. }
  6403. const LMS = result;
  6404. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  6405. const LMS_Flat = tempNormalizeMatrix;
  6406. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  6407. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  6408. }
  6409. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  6410. const LMS = result;
  6411. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  6412. const LMS_D65 = tempNormalizeMatrix;
  6413. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  6414. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  6415. }
  6416. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  6417. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  6418. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  6419. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  6420. const AGR = A === 1 ? 1 : A ** cs.GR;
  6421. const BGG = B === 1 ? 1 : B ** cs.GG;
  6422. const CGB = C === 1 ? 1 : C ** cs.GB;
  6423. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  6424. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  6425. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  6426. const XYZ = tempConvertMatrix1;
  6427. XYZ[0] = X;
  6428. XYZ[1] = Y;
  6429. XYZ[2] = Z;
  6430. const XYZ_Flat = tempConvertMatrix2;
  6431. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  6432. const XYZ_Black = tempConvertMatrix1;
  6433. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  6434. const XYZ_D65 = tempConvertMatrix2;
  6435. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  6436. const SRGB = tempConvertMatrix1;
  6437. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  6438. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  6439. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  6440. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  6441. }
  6442. class CalRGBCS extends ColorSpace {
  6443. constructor(whitePoint, blackPoint, gamma, matrix) {
  6444. super("CalRGB", 3);
  6445. if (!whitePoint) {
  6446. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  6447. }
  6448. blackPoint = blackPoint || new Float32Array(3);
  6449. gamma = gamma || new Float32Array([1, 1, 1]);
  6450. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  6451. const XW = whitePoint[0];
  6452. const YW = whitePoint[1];
  6453. const ZW = whitePoint[2];
  6454. this.whitePoint = whitePoint;
  6455. const XB = blackPoint[0];
  6456. const YB = blackPoint[1];
  6457. const ZB = blackPoint[2];
  6458. this.blackPoint = blackPoint;
  6459. this.GR = gamma[0];
  6460. this.GG = gamma[1];
  6461. this.GB = gamma[2];
  6462. this.MXA = matrix[0];
  6463. this.MYA = matrix[1];
  6464. this.MZA = matrix[2];
  6465. this.MXB = matrix[3];
  6466. this.MYB = matrix[4];
  6467. this.MZB = matrix[5];
  6468. this.MXC = matrix[6];
  6469. this.MYC = matrix[7];
  6470. this.MZC = matrix[8];
  6471. if (XW < 0 || ZW < 0 || YW !== 1) {
  6472. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  6473. }
  6474. if (XB < 0 || YB < 0 || ZB < 0) {
  6475. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  6476. this.blackPoint = new Float32Array(3);
  6477. }
  6478. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  6479. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  6480. this.GR = this.GG = this.GB = 1;
  6481. }
  6482. }
  6483. getRgbItem(src, srcOffset, dest, destOffset) {
  6484. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  6485. }
  6486. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6487. const scale = 1 / ((1 << bits) - 1);
  6488. for (let i = 0; i < count; ++i) {
  6489. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  6490. srcOffset += 3;
  6491. destOffset += 3 + alpha01;
  6492. }
  6493. }
  6494. getOutputLength(inputLength, alpha01) {
  6495. return inputLength * (3 + alpha01) / 3 | 0;
  6496. }
  6497. }
  6498. return CalRGBCS;
  6499. }();
  6500. const LabCS = function LabCSClosure() {
  6501. function fn_g(x) {
  6502. let result;
  6503. if (x >= 6 / 29) {
  6504. result = x ** 3;
  6505. } else {
  6506. result = 108 / 841 * (x - 4 / 29);
  6507. }
  6508. return result;
  6509. }
  6510. function decode(value, high1, low2, high2) {
  6511. return low2 + value * (high2 - low2) / high1;
  6512. }
  6513. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  6514. let Ls = src[srcOffset];
  6515. let as = src[srcOffset + 1];
  6516. let bs = src[srcOffset + 2];
  6517. if (maxVal !== false) {
  6518. Ls = decode(Ls, maxVal, 0, 100);
  6519. as = decode(as, maxVal, cs.amin, cs.amax);
  6520. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  6521. }
  6522. if (as > cs.amax) {
  6523. as = cs.amax;
  6524. } else if (as < cs.amin) {
  6525. as = cs.amin;
  6526. }
  6527. if (bs > cs.bmax) {
  6528. bs = cs.bmax;
  6529. } else if (bs < cs.bmin) {
  6530. bs = cs.bmin;
  6531. }
  6532. const M = (Ls + 16) / 116;
  6533. const L = M + as / 500;
  6534. const N = M - bs / 200;
  6535. const X = cs.XW * fn_g(L);
  6536. const Y = cs.YW * fn_g(M);
  6537. const Z = cs.ZW * fn_g(N);
  6538. let r, g, b;
  6539. if (cs.ZW < 1) {
  6540. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  6541. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  6542. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  6543. } else {
  6544. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  6545. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  6546. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  6547. }
  6548. dest[destOffset] = Math.sqrt(r) * 255;
  6549. dest[destOffset + 1] = Math.sqrt(g) * 255;
  6550. dest[destOffset + 2] = Math.sqrt(b) * 255;
  6551. }
  6552. class LabCS extends ColorSpace {
  6553. constructor(whitePoint, blackPoint, range) {
  6554. super("Lab", 3);
  6555. if (!whitePoint) {
  6556. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  6557. }
  6558. blackPoint = blackPoint || [0, 0, 0];
  6559. range = range || [-100, 100, -100, 100];
  6560. this.XW = whitePoint[0];
  6561. this.YW = whitePoint[1];
  6562. this.ZW = whitePoint[2];
  6563. this.amin = range[0];
  6564. this.amax = range[1];
  6565. this.bmin = range[2];
  6566. this.bmax = range[3];
  6567. this.XB = blackPoint[0];
  6568. this.YB = blackPoint[1];
  6569. this.ZB = blackPoint[2];
  6570. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  6571. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  6572. }
  6573. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  6574. (0, _util.info)("Invalid BlackPoint, falling back to default");
  6575. this.XB = this.YB = this.ZB = 0;
  6576. }
  6577. if (this.amin > this.amax || this.bmin > this.bmax) {
  6578. (0, _util.info)("Invalid Range, falling back to defaults");
  6579. this.amin = -100;
  6580. this.amax = 100;
  6581. this.bmin = -100;
  6582. this.bmax = 100;
  6583. }
  6584. }
  6585. getRgbItem(src, srcOffset, dest, destOffset) {
  6586. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  6587. }
  6588. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6589. const maxVal = (1 << bits) - 1;
  6590. for (let i = 0; i < count; i++) {
  6591. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  6592. srcOffset += 3;
  6593. destOffset += 3 + alpha01;
  6594. }
  6595. }
  6596. getOutputLength(inputLength, alpha01) {
  6597. return inputLength * (3 + alpha01) / 3 | 0;
  6598. }
  6599. isDefaultDecode(decodeMap, bpc) {
  6600. return true;
  6601. }
  6602. get usesZeroToOneRange() {
  6603. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  6604. }
  6605. }
  6606. return LabCS;
  6607. }();
  6608. /***/ }),
  6609. /* 15 */
  6610. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6611. Object.defineProperty(exports, "__esModule", ({
  6612. value: true
  6613. }));
  6614. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  6615. var _util = __w_pdfjs_require__(2);
  6616. var _cmap = __w_pdfjs_require__(16);
  6617. var _primitives = __w_pdfjs_require__(5);
  6618. var _fonts = __w_pdfjs_require__(34);
  6619. var _fonts_utils = __w_pdfjs_require__(38);
  6620. var _encodings = __w_pdfjs_require__(37);
  6621. var _standard_fonts = __w_pdfjs_require__(41);
  6622. var _unicode = __w_pdfjs_require__(40);
  6623. var _pattern = __w_pdfjs_require__(49);
  6624. var _to_unicode_map = __w_pdfjs_require__(42);
  6625. var _function = __w_pdfjs_require__(50);
  6626. var _parser = __w_pdfjs_require__(17);
  6627. var _image_utils = __w_pdfjs_require__(52);
  6628. var _stream = __w_pdfjs_require__(10);
  6629. var _bidi = __w_pdfjs_require__(53);
  6630. var _colorspace = __w_pdfjs_require__(14);
  6631. var _decode_stream = __w_pdfjs_require__(19);
  6632. var _glyphlist = __w_pdfjs_require__(39);
  6633. var _core_utils = __w_pdfjs_require__(9);
  6634. var _metrics = __w_pdfjs_require__(54);
  6635. var _xfa_fonts = __w_pdfjs_require__(55);
  6636. var _murmurhash = __w_pdfjs_require__(61);
  6637. var _operator_list = __w_pdfjs_require__(62);
  6638. var _image = __w_pdfjs_require__(63);
  6639. const DefaultPartialEvaluatorOptions = Object.freeze({
  6640. maxImageSize: -1,
  6641. disableFontFace: false,
  6642. ignoreErrors: false,
  6643. isEvalSupported: true,
  6644. fontExtraProperties: false,
  6645. useSystemFonts: true,
  6646. cMapUrl: null,
  6647. standardFontDataUrl: null
  6648. });
  6649. const PatternType = {
  6650. TILING: 1,
  6651. SHADING: 2
  6652. };
  6653. const deferred = Promise.resolve();
  6654. function normalizeBlendMode(value, parsingArray = false) {
  6655. if (Array.isArray(value)) {
  6656. for (let i = 0, ii = value.length; i < ii; i++) {
  6657. const maybeBM = normalizeBlendMode(value[i], true);
  6658. if (maybeBM) {
  6659. return maybeBM;
  6660. }
  6661. }
  6662. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  6663. return "source-over";
  6664. }
  6665. if (!(0, _primitives.isName)(value)) {
  6666. if (parsingArray) {
  6667. return null;
  6668. }
  6669. return "source-over";
  6670. }
  6671. switch (value.name) {
  6672. case "Normal":
  6673. case "Compatible":
  6674. return "source-over";
  6675. case "Multiply":
  6676. return "multiply";
  6677. case "Screen":
  6678. return "screen";
  6679. case "Overlay":
  6680. return "overlay";
  6681. case "Darken":
  6682. return "darken";
  6683. case "Lighten":
  6684. return "lighten";
  6685. case "ColorDodge":
  6686. return "color-dodge";
  6687. case "ColorBurn":
  6688. return "color-burn";
  6689. case "HardLight":
  6690. return "hard-light";
  6691. case "SoftLight":
  6692. return "soft-light";
  6693. case "Difference":
  6694. return "difference";
  6695. case "Exclusion":
  6696. return "exclusion";
  6697. case "Hue":
  6698. return "hue";
  6699. case "Saturation":
  6700. return "saturation";
  6701. case "Color":
  6702. return "color";
  6703. case "Luminosity":
  6704. return "luminosity";
  6705. }
  6706. if (parsingArray) {
  6707. return null;
  6708. }
  6709. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  6710. return "source-over";
  6711. }
  6712. class TimeSlotManager {
  6713. static get TIME_SLOT_DURATION_MS() {
  6714. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  6715. }
  6716. static get CHECK_TIME_EVERY() {
  6717. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  6718. }
  6719. constructor() {
  6720. this.reset();
  6721. }
  6722. check() {
  6723. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  6724. return false;
  6725. }
  6726. this.checked = 0;
  6727. return this.endTime <= Date.now();
  6728. }
  6729. reset() {
  6730. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  6731. this.checked = 0;
  6732. }
  6733. }
  6734. class PartialEvaluator {
  6735. constructor({
  6736. xref,
  6737. handler,
  6738. pageIndex,
  6739. idFactory,
  6740. fontCache,
  6741. builtInCMapCache,
  6742. standardFontDataCache,
  6743. globalImageCache,
  6744. options = null
  6745. }) {
  6746. this.xref = xref;
  6747. this.handler = handler;
  6748. this.pageIndex = pageIndex;
  6749. this.idFactory = idFactory;
  6750. this.fontCache = fontCache;
  6751. this.builtInCMapCache = builtInCMapCache;
  6752. this.standardFontDataCache = standardFontDataCache;
  6753. this.globalImageCache = globalImageCache;
  6754. this.options = options || DefaultPartialEvaluatorOptions;
  6755. this.parsingType3Font = false;
  6756. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  6757. }
  6758. get _pdfFunctionFactory() {
  6759. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  6760. xref: this.xref,
  6761. isEvalSupported: this.options.isEvalSupported
  6762. });
  6763. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  6764. }
  6765. clone(newOptions = null) {
  6766. const newEvaluator = Object.create(this);
  6767. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  6768. return newEvaluator;
  6769. }
  6770. hasBlendModes(resources, nonBlendModesSet) {
  6771. if (!(resources instanceof _primitives.Dict)) {
  6772. return false;
  6773. }
  6774. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  6775. return false;
  6776. }
  6777. const processed = new _primitives.RefSet(nonBlendModesSet);
  6778. if (resources.objId) {
  6779. processed.put(resources.objId);
  6780. }
  6781. const nodes = [resources],
  6782. xref = this.xref;
  6783. while (nodes.length) {
  6784. const node = nodes.shift();
  6785. const graphicStates = node.get("ExtGState");
  6786. if (graphicStates instanceof _primitives.Dict) {
  6787. for (let graphicState of graphicStates.getRawValues()) {
  6788. if (graphicState instanceof _primitives.Ref) {
  6789. if (processed.has(graphicState)) {
  6790. continue;
  6791. }
  6792. try {
  6793. graphicState = xref.fetch(graphicState);
  6794. } catch (ex) {
  6795. processed.put(graphicState);
  6796. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  6797. continue;
  6798. }
  6799. }
  6800. if (!(graphicState instanceof _primitives.Dict)) {
  6801. continue;
  6802. }
  6803. if (graphicState.objId) {
  6804. processed.put(graphicState.objId);
  6805. }
  6806. const bm = graphicState.get("BM");
  6807. if (bm instanceof _primitives.Name) {
  6808. if (bm.name !== "Normal") {
  6809. return true;
  6810. }
  6811. continue;
  6812. }
  6813. if (bm !== undefined && Array.isArray(bm)) {
  6814. for (const element of bm) {
  6815. if (element instanceof _primitives.Name && element.name !== "Normal") {
  6816. return true;
  6817. }
  6818. }
  6819. }
  6820. }
  6821. }
  6822. const xObjects = node.get("XObject");
  6823. if (!(xObjects instanceof _primitives.Dict)) {
  6824. continue;
  6825. }
  6826. for (let xObject of xObjects.getRawValues()) {
  6827. if (xObject instanceof _primitives.Ref) {
  6828. if (processed.has(xObject)) {
  6829. continue;
  6830. }
  6831. try {
  6832. xObject = xref.fetch(xObject);
  6833. } catch (ex) {
  6834. processed.put(xObject);
  6835. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  6836. continue;
  6837. }
  6838. }
  6839. if (!(0, _primitives.isStream)(xObject)) {
  6840. continue;
  6841. }
  6842. if (xObject.dict.objId) {
  6843. processed.put(xObject.dict.objId);
  6844. }
  6845. const xResources = xObject.dict.get("Resources");
  6846. if (!(xResources instanceof _primitives.Dict)) {
  6847. continue;
  6848. }
  6849. if (xResources.objId && processed.has(xResources.objId)) {
  6850. continue;
  6851. }
  6852. nodes.push(xResources);
  6853. if (xResources.objId) {
  6854. processed.put(xResources.objId);
  6855. }
  6856. }
  6857. }
  6858. processed.forEach(ref => {
  6859. nonBlendModesSet.put(ref);
  6860. });
  6861. return false;
  6862. }
  6863. async fetchBuiltInCMap(name) {
  6864. const cachedData = this.builtInCMapCache.get(name);
  6865. if (cachedData) {
  6866. return cachedData;
  6867. }
  6868. let data;
  6869. if (this.options.cMapUrl !== null) {
  6870. const url = `${this.options.cMapUrl}${name}.bcmap`;
  6871. const response = await fetch(url);
  6872. if (!response.ok) {
  6873. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  6874. }
  6875. data = {
  6876. cMapData: new Uint8Array(await response.arrayBuffer()),
  6877. compressionType: _util.CMapCompressionType.BINARY
  6878. };
  6879. } else {
  6880. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  6881. name
  6882. });
  6883. }
  6884. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  6885. this.builtInCMapCache.set(name, data);
  6886. }
  6887. return data;
  6888. }
  6889. async fetchStandardFontData(name) {
  6890. const cachedData = this.standardFontDataCache.get(name);
  6891. if (cachedData) {
  6892. return new _stream.Stream(cachedData);
  6893. }
  6894. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  6895. return null;
  6896. }
  6897. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  6898. filename = standardFontNameToFileName[name];
  6899. let data;
  6900. if (this.options.standardFontDataUrl !== null) {
  6901. const url = `${this.options.standardFontDataUrl}${filename}`;
  6902. const response = await fetch(url);
  6903. if (!response.ok) {
  6904. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  6905. } else {
  6906. data = await response.arrayBuffer();
  6907. }
  6908. } else {
  6909. try {
  6910. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  6911. filename
  6912. });
  6913. } catch (e) {
  6914. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  6915. }
  6916. }
  6917. if (!data) {
  6918. return null;
  6919. }
  6920. this.standardFontDataCache.set(name, data);
  6921. return new _stream.Stream(data);
  6922. }
  6923. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  6924. const dict = xobj.dict;
  6925. const matrix = dict.getArray("Matrix");
  6926. let bbox = dict.getArray("BBox");
  6927. if (Array.isArray(bbox) && bbox.length === 4) {
  6928. bbox = _util.Util.normalizeRect(bbox);
  6929. } else {
  6930. bbox = null;
  6931. }
  6932. let optionalContent = null,
  6933. groupOptions;
  6934. if (dict.has("OC")) {
  6935. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  6936. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  6937. }
  6938. const group = dict.get("Group");
  6939. if (group) {
  6940. groupOptions = {
  6941. matrix,
  6942. bbox,
  6943. smask,
  6944. isolated: false,
  6945. knockout: false
  6946. };
  6947. const groupSubtype = group.get("S");
  6948. let colorSpace = null;
  6949. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  6950. groupOptions.isolated = group.get("I") || false;
  6951. groupOptions.knockout = group.get("K") || false;
  6952. if (group.has("CS")) {
  6953. const cs = group.getRaw("CS");
  6954. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  6955. if (cachedColorSpace) {
  6956. colorSpace = cachedColorSpace;
  6957. } else {
  6958. colorSpace = await this.parseColorSpace({
  6959. cs,
  6960. resources,
  6961. localColorSpaceCache
  6962. });
  6963. }
  6964. }
  6965. }
  6966. if (smask && smask.backdrop) {
  6967. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  6968. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  6969. }
  6970. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  6971. }
  6972. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  6973. return this.getOperatorList({
  6974. stream: xobj,
  6975. task,
  6976. resources: dict.get("Resources") || resources,
  6977. operatorList,
  6978. initialState
  6979. }).then(function () {
  6980. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  6981. if (group) {
  6982. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  6983. }
  6984. if (optionalContent) {
  6985. operatorList.addOp(_util.OPS.endMarkedContent, []);
  6986. }
  6987. });
  6988. }
  6989. _sendImgData(objId, imgData, cacheGlobally = false) {
  6990. const transfers = imgData ? [imgData.data.buffer] : null;
  6991. if (this.parsingType3Font || cacheGlobally) {
  6992. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  6993. }
  6994. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  6995. }
  6996. async buildPaintImageXObject({
  6997. resources,
  6998. image,
  6999. isInline = false,
  7000. operatorList,
  7001. cacheKey,
  7002. localImageCache,
  7003. localColorSpaceCache
  7004. }) {
  7005. const dict = image.dict;
  7006. const imageRef = dict.objId;
  7007. const w = dict.get("Width", "W");
  7008. const h = dict.get("Height", "H");
  7009. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  7010. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  7011. return undefined;
  7012. }
  7013. const maxImageSize = this.options.maxImageSize;
  7014. if (maxImageSize !== -1 && w * h > maxImageSize) {
  7015. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  7016. return undefined;
  7017. }
  7018. const imageMask = dict.get("ImageMask", "IM") || false;
  7019. let imgData, args;
  7020. if (imageMask) {
  7021. const width = dict.get("Width", "W");
  7022. const height = dict.get("Height", "H");
  7023. const bitStrideLength = width + 7 >> 3;
  7024. const imgArray = image.getBytes(bitStrideLength * height, true);
  7025. const decode = dict.getArray("Decode", "D");
  7026. imgData = _image.PDFImage.createMask({
  7027. imgArray,
  7028. width,
  7029. height,
  7030. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  7031. inverseDecode: !!decode && decode[0] > 0
  7032. });
  7033. imgData.cached = !!cacheKey;
  7034. args = [imgData];
  7035. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  7036. if (cacheKey) {
  7037. localImageCache.set(cacheKey, imageRef, {
  7038. fn: _util.OPS.paintImageMaskXObject,
  7039. args
  7040. });
  7041. }
  7042. return undefined;
  7043. }
  7044. const softMask = dict.get("SMask", "SM") || false;
  7045. const mask = dict.get("Mask") || false;
  7046. const SMALL_IMAGE_DIMENSIONS = 200;
  7047. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  7048. const imageObj = new _image.PDFImage({
  7049. xref: this.xref,
  7050. res: resources,
  7051. image,
  7052. isInline,
  7053. pdfFunctionFactory: this._pdfFunctionFactory,
  7054. localColorSpaceCache
  7055. });
  7056. imgData = imageObj.createImageData(true);
  7057. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  7058. return undefined;
  7059. }
  7060. let objId = `img_${this.idFactory.createObjId()}`,
  7061. cacheGlobally = false;
  7062. if (this.parsingType3Font) {
  7063. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  7064. } else if (imageRef) {
  7065. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  7066. if (cacheGlobally) {
  7067. objId = `${this.idFactory.getDocId()}_${objId}`;
  7068. }
  7069. }
  7070. operatorList.addDependency(objId);
  7071. args = [objId, w, h];
  7072. _image.PDFImage.buildImage({
  7073. xref: this.xref,
  7074. res: resources,
  7075. image,
  7076. isInline,
  7077. pdfFunctionFactory: this._pdfFunctionFactory,
  7078. localColorSpaceCache
  7079. }).then(imageObj => {
  7080. imgData = imageObj.createImageData(false);
  7081. if (cacheKey && imageRef && cacheGlobally) {
  7082. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  7083. }
  7084. return this._sendImgData(objId, imgData, cacheGlobally);
  7085. }).catch(reason => {
  7086. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  7087. return this._sendImgData(objId, null, cacheGlobally);
  7088. });
  7089. operatorList.addOp(_util.OPS.paintImageXObject, args);
  7090. if (cacheKey) {
  7091. localImageCache.set(cacheKey, imageRef, {
  7092. fn: _util.OPS.paintImageXObject,
  7093. args
  7094. });
  7095. if (imageRef) {
  7096. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  7097. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  7098. if (cacheGlobally) {
  7099. this.globalImageCache.setData(imageRef, {
  7100. objId,
  7101. fn: _util.OPS.paintImageXObject,
  7102. args,
  7103. byteSize: 0
  7104. });
  7105. }
  7106. }
  7107. }
  7108. return undefined;
  7109. }
  7110. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  7111. const smaskContent = smask.get("G");
  7112. const smaskOptions = {
  7113. subtype: smask.get("S").name,
  7114. backdrop: smask.get("BC")
  7115. };
  7116. const transferObj = smask.get("TR");
  7117. if ((0, _function.isPDFFunction)(transferObj)) {
  7118. const transferFn = this._pdfFunctionFactory.create(transferObj);
  7119. const transferMap = new Uint8Array(256);
  7120. const tmp = new Float32Array(1);
  7121. for (let i = 0; i < 256; i++) {
  7122. tmp[0] = i / 255;
  7123. transferFn(tmp, 0, tmp, 0);
  7124. transferMap[i] = tmp[0] * 255 | 0;
  7125. }
  7126. smaskOptions.transferMap = transferMap;
  7127. }
  7128. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  7129. }
  7130. handleTransferFunction(tr) {
  7131. let transferArray;
  7132. if (Array.isArray(tr)) {
  7133. transferArray = tr;
  7134. } else if ((0, _function.isPDFFunction)(tr)) {
  7135. transferArray = [tr];
  7136. } else {
  7137. return null;
  7138. }
  7139. const transferMaps = [];
  7140. let numFns = 0,
  7141. numEffectfulFns = 0;
  7142. for (const entry of transferArray) {
  7143. const transferObj = this.xref.fetchIfRef(entry);
  7144. numFns++;
  7145. if ((0, _primitives.isName)(transferObj, "Identity")) {
  7146. transferMaps.push(null);
  7147. continue;
  7148. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  7149. return null;
  7150. }
  7151. const transferFn = this._pdfFunctionFactory.create(transferObj);
  7152. const transferMap = new Uint8Array(256),
  7153. tmp = new Float32Array(1);
  7154. for (let j = 0; j < 256; j++) {
  7155. tmp[0] = j / 255;
  7156. transferFn(tmp, 0, tmp, 0);
  7157. transferMap[j] = tmp[0] * 255 | 0;
  7158. }
  7159. transferMaps.push(transferMap);
  7160. numEffectfulFns++;
  7161. }
  7162. if (!(numFns === 1 || numFns === 4)) {
  7163. return null;
  7164. }
  7165. if (numEffectfulFns === 0) {
  7166. return null;
  7167. }
  7168. return transferMaps;
  7169. }
  7170. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, cacheKey, localTilingPatternCache) {
  7171. const tilingOpList = new _operator_list.OperatorList();
  7172. const patternResources = _primitives.Dict.merge({
  7173. xref: this.xref,
  7174. dictArray: [patternDict.get("Resources"), resources]
  7175. });
  7176. return this.getOperatorList({
  7177. stream: pattern,
  7178. task,
  7179. resources: patternResources,
  7180. operatorList: tilingOpList
  7181. }).then(function () {
  7182. const operatorListIR = tilingOpList.getIR();
  7183. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  7184. operatorList.addDependencies(tilingOpList.dependencies);
  7185. operatorList.addOp(fn, tilingPatternIR);
  7186. if (cacheKey) {
  7187. localTilingPatternCache.set(cacheKey, patternDict.objId, {
  7188. operatorListIR,
  7189. dict: patternDict
  7190. });
  7191. }
  7192. }).catch(reason => {
  7193. if (reason instanceof _util.AbortException) {
  7194. return;
  7195. }
  7196. if (this.options.ignoreErrors) {
  7197. this.handler.send("UnsupportedFeature", {
  7198. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  7199. });
  7200. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  7201. return;
  7202. }
  7203. throw reason;
  7204. });
  7205. }
  7206. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  7207. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  7208. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  7209. if (!translated.font.isType3Font) {
  7210. return translated;
  7211. }
  7212. return translated.loadType3Data(this, resources, task).then(function () {
  7213. operatorList.addDependencies(translated.type3Dependencies);
  7214. return translated;
  7215. }).catch(reason => {
  7216. this.handler.send("UnsupportedFeature", {
  7217. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  7218. });
  7219. return new TranslatedFont({
  7220. loadedName: "g_font_error",
  7221. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  7222. dict: translated.font,
  7223. evaluatorOptions: this.options
  7224. });
  7225. });
  7226. }).then(translated => {
  7227. state.font = translated.font;
  7228. translated.send(this.handler);
  7229. return translated.loadedName;
  7230. });
  7231. }
  7232. handleText(chars, state) {
  7233. const font = state.font;
  7234. const glyphs = font.charsToGlyphs(chars);
  7235. if (font.data) {
  7236. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  7237. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  7238. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  7239. }
  7240. }
  7241. return glyphs;
  7242. }
  7243. ensureStateFont(state) {
  7244. if (state.font) {
  7245. return;
  7246. }
  7247. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  7248. if (this.options.ignoreErrors) {
  7249. this.handler.send("UnsupportedFeature", {
  7250. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  7251. });
  7252. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  7253. return;
  7254. }
  7255. throw reason;
  7256. }
  7257. async setGState({
  7258. resources,
  7259. gState,
  7260. operatorList,
  7261. cacheKey,
  7262. task,
  7263. stateManager,
  7264. localGStateCache,
  7265. localColorSpaceCache
  7266. }) {
  7267. const gStateRef = gState.objId;
  7268. let isSimpleGState = true;
  7269. const gStateObj = [];
  7270. const gStateKeys = gState.getKeys();
  7271. let promise = Promise.resolve();
  7272. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  7273. const key = gStateKeys[i];
  7274. const value = gState.get(key);
  7275. switch (key) {
  7276. case "Type":
  7277. break;
  7278. case "LW":
  7279. case "LC":
  7280. case "LJ":
  7281. case "ML":
  7282. case "D":
  7283. case "RI":
  7284. case "FL":
  7285. case "CA":
  7286. case "ca":
  7287. gStateObj.push([key, value]);
  7288. break;
  7289. case "Font":
  7290. isSimpleGState = false;
  7291. promise = promise.then(() => {
  7292. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  7293. operatorList.addDependency(loadedName);
  7294. gStateObj.push([key, [loadedName, value[1]]]);
  7295. });
  7296. });
  7297. break;
  7298. case "BM":
  7299. gStateObj.push([key, normalizeBlendMode(value)]);
  7300. break;
  7301. case "SMask":
  7302. if ((0, _primitives.isName)(value, "None")) {
  7303. gStateObj.push([key, false]);
  7304. break;
  7305. }
  7306. if ((0, _primitives.isDict)(value)) {
  7307. isSimpleGState = false;
  7308. promise = promise.then(() => {
  7309. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  7310. });
  7311. gStateObj.push([key, true]);
  7312. } else {
  7313. (0, _util.warn)("Unsupported SMask type");
  7314. }
  7315. break;
  7316. case "TR":
  7317. const transferMaps = this.handleTransferFunction(value);
  7318. gStateObj.push([key, transferMaps]);
  7319. break;
  7320. case "OP":
  7321. case "op":
  7322. case "OPM":
  7323. case "BG":
  7324. case "BG2":
  7325. case "UCR":
  7326. case "UCR2":
  7327. case "TR2":
  7328. case "HT":
  7329. case "SM":
  7330. case "SA":
  7331. case "AIS":
  7332. case "TK":
  7333. (0, _util.info)("graphic state operator " + key);
  7334. break;
  7335. default:
  7336. (0, _util.info)("Unknown graphic state operator " + key);
  7337. break;
  7338. }
  7339. }
  7340. return promise.then(function () {
  7341. if (gStateObj.length > 0) {
  7342. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  7343. }
  7344. if (isSimpleGState) {
  7345. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  7346. }
  7347. });
  7348. }
  7349. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  7350. const errorFont = async () => {
  7351. return new TranslatedFont({
  7352. loadedName: "g_font_error",
  7353. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  7354. dict: font,
  7355. evaluatorOptions: this.options
  7356. });
  7357. };
  7358. const xref = this.xref;
  7359. let fontRef;
  7360. if (font) {
  7361. if (!(0, _primitives.isRef)(font)) {
  7362. throw new _util.FormatError('The "font" object should be a reference.');
  7363. }
  7364. fontRef = font;
  7365. } else {
  7366. const fontRes = resources.get("Font");
  7367. if (fontRes) {
  7368. fontRef = fontRes.getRaw(fontName);
  7369. }
  7370. }
  7371. if (!fontRef) {
  7372. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  7373. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  7374. (0, _util.warn)(`${partialMsg}.`);
  7375. return errorFont();
  7376. }
  7377. this.handler.send("UnsupportedFeature", {
  7378. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  7379. });
  7380. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  7381. if (fallbackFontDict) {
  7382. fontRef = fallbackFontDict;
  7383. } else {
  7384. fontRef = PartialEvaluator.fallbackFontDict;
  7385. }
  7386. }
  7387. if (this.fontCache.has(fontRef)) {
  7388. return this.fontCache.get(fontRef);
  7389. }
  7390. font = xref.fetchIfRef(fontRef);
  7391. if (!(0, _primitives.isDict)(font)) {
  7392. return errorFont();
  7393. }
  7394. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  7395. return this.fontCache.get(font.cacheKey);
  7396. }
  7397. const fontCapability = (0, _util.createPromiseCapability)();
  7398. let preEvaluatedFont;
  7399. try {
  7400. preEvaluatedFont = this.preEvaluateFont(font);
  7401. preEvaluatedFont.cssFontInfo = cssFontInfo;
  7402. } catch (reason) {
  7403. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  7404. return errorFont();
  7405. }
  7406. const {
  7407. descriptor,
  7408. hash
  7409. } = preEvaluatedFont;
  7410. const fontRefIsRef = (0, _primitives.isRef)(fontRef);
  7411. let fontID;
  7412. if (fontRefIsRef) {
  7413. fontID = `f${fontRef.toString()}`;
  7414. }
  7415. if (hash && (0, _primitives.isDict)(descriptor)) {
  7416. if (!descriptor.fontAliases) {
  7417. descriptor.fontAliases = Object.create(null);
  7418. }
  7419. const fontAliases = descriptor.fontAliases;
  7420. if (fontAliases[hash]) {
  7421. const aliasFontRef = fontAliases[hash].aliasRef;
  7422. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  7423. this.fontCache.putAlias(fontRef, aliasFontRef);
  7424. return this.fontCache.get(fontRef);
  7425. }
  7426. } else {
  7427. fontAliases[hash] = {
  7428. fontID: this.idFactory.createFontId()
  7429. };
  7430. }
  7431. if (fontRefIsRef) {
  7432. fontAliases[hash].aliasRef = fontRef;
  7433. }
  7434. fontID = fontAliases[hash].fontID;
  7435. }
  7436. if (fontRefIsRef) {
  7437. this.fontCache.put(fontRef, fontCapability.promise);
  7438. } else {
  7439. if (!fontID) {
  7440. fontID = this.idFactory.createFontId();
  7441. }
  7442. font.cacheKey = `cacheKey_${fontID}`;
  7443. this.fontCache.put(font.cacheKey, fontCapability.promise);
  7444. }
  7445. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  7446. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  7447. this.translateFont(preEvaluatedFont).then(translatedFont => {
  7448. if (translatedFont.fontType !== undefined) {
  7449. const xrefFontStats = xref.stats.fontTypes;
  7450. xrefFontStats[translatedFont.fontType] = true;
  7451. }
  7452. fontCapability.resolve(new TranslatedFont({
  7453. loadedName: font.loadedName,
  7454. font: translatedFont,
  7455. dict: font,
  7456. evaluatorOptions: this.options
  7457. }));
  7458. }).catch(reason => {
  7459. this.handler.send("UnsupportedFeature", {
  7460. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  7461. });
  7462. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  7463. try {
  7464. const fontFile3 = descriptor && descriptor.get("FontFile3");
  7465. const subtype = fontFile3 && fontFile3.get("Subtype");
  7466. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  7467. const xrefFontStats = xref.stats.fontTypes;
  7468. xrefFontStats[fontType] = true;
  7469. } catch (ex) {}
  7470. fontCapability.resolve(new TranslatedFont({
  7471. loadedName: font.loadedName,
  7472. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  7473. dict: font,
  7474. evaluatorOptions: this.options
  7475. }));
  7476. });
  7477. return fontCapability.promise;
  7478. }
  7479. buildPath(operatorList, fn, args, parsingText = false) {
  7480. const lastIndex = operatorList.length - 1;
  7481. if (!args) {
  7482. args = [];
  7483. }
  7484. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  7485. if (parsingText) {
  7486. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  7487. operatorList.addOp(_util.OPS.save, null);
  7488. }
  7489. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  7490. if (parsingText) {
  7491. operatorList.addOp(_util.OPS.restore, null);
  7492. }
  7493. } else {
  7494. const opArgs = operatorList.argsArray[lastIndex];
  7495. opArgs[0].push(fn);
  7496. Array.prototype.push.apply(opArgs[1], args);
  7497. }
  7498. }
  7499. parseColorSpace({
  7500. cs,
  7501. resources,
  7502. localColorSpaceCache
  7503. }) {
  7504. return _colorspace.ColorSpace.parseAsync({
  7505. cs,
  7506. xref: this.xref,
  7507. resources,
  7508. pdfFunctionFactory: this._pdfFunctionFactory,
  7509. localColorSpaceCache
  7510. }).catch(reason => {
  7511. if (reason instanceof _util.AbortException) {
  7512. return null;
  7513. }
  7514. if (this.options.ignoreErrors) {
  7515. this.handler.send("UnsupportedFeature", {
  7516. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  7517. });
  7518. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  7519. return null;
  7520. }
  7521. throw reason;
  7522. });
  7523. }
  7524. parseShading({
  7525. keyObj,
  7526. shading,
  7527. resources,
  7528. localColorSpaceCache,
  7529. localShadingPatternCache,
  7530. matrix = null
  7531. }) {
  7532. let id = localShadingPatternCache.get(keyObj);
  7533. if (!id) {
  7534. var shadingFill = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  7535. const patternIR = shadingFill.getIR();
  7536. id = `pattern_${this.idFactory.createObjId()}`;
  7537. localShadingPatternCache.set(keyObj, id);
  7538. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  7539. }
  7540. return id;
  7541. }
  7542. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  7543. const patternName = args.pop();
  7544. if (patternName instanceof _primitives.Name) {
  7545. const name = patternName.name;
  7546. const localTilingPattern = localTilingPatternCache.getByName(name);
  7547. if (localTilingPattern) {
  7548. try {
  7549. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  7550. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  7551. operatorList.addOp(fn, tilingPatternIR);
  7552. return undefined;
  7553. } catch (ex) {}
  7554. }
  7555. const pattern = patterns.get(name);
  7556. if (pattern) {
  7557. const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  7558. const typeNum = dict.get("PatternType");
  7559. if (typeNum === PatternType.TILING) {
  7560. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  7561. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, name, localTilingPatternCache);
  7562. } else if (typeNum === PatternType.SHADING) {
  7563. const shading = dict.get("Shading");
  7564. const matrix = dict.getArray("Matrix");
  7565. const objId = this.parseShading({
  7566. keyObj: pattern,
  7567. shading,
  7568. matrix,
  7569. resources,
  7570. localColorSpaceCache,
  7571. localShadingPatternCache
  7572. });
  7573. operatorList.addOp(fn, ["Shading", objId]);
  7574. return undefined;
  7575. }
  7576. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  7577. }
  7578. }
  7579. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  7580. }
  7581. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  7582. const MAX_NESTING = 10;
  7583. if (++nestingCounter > MAX_NESTING) {
  7584. (0, _util.warn)("Visibility expression is too deeply nested");
  7585. return;
  7586. }
  7587. const length = array.length;
  7588. const operator = this.xref.fetchIfRef(array[0]);
  7589. if (length < 2 || !(0, _primitives.isName)(operator)) {
  7590. (0, _util.warn)("Invalid visibility expression");
  7591. return;
  7592. }
  7593. switch (operator.name) {
  7594. case "And":
  7595. case "Or":
  7596. case "Not":
  7597. currentResult.push(operator.name);
  7598. break;
  7599. default:
  7600. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  7601. return;
  7602. }
  7603. for (let i = 1; i < length; i++) {
  7604. const raw = array[i];
  7605. const object = this.xref.fetchIfRef(raw);
  7606. if (Array.isArray(object)) {
  7607. const nestedResult = [];
  7608. currentResult.push(nestedResult);
  7609. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  7610. } else if ((0, _primitives.isRef)(raw)) {
  7611. currentResult.push(raw.toString());
  7612. }
  7613. }
  7614. }
  7615. async parseMarkedContentProps(contentProperties, resources) {
  7616. let optionalContent;
  7617. if ((0, _primitives.isName)(contentProperties)) {
  7618. const properties = resources.get("Properties");
  7619. optionalContent = properties.get(contentProperties.name);
  7620. } else if ((0, _primitives.isDict)(contentProperties)) {
  7621. optionalContent = contentProperties;
  7622. } else {
  7623. throw new _util.FormatError("Optional content properties malformed.");
  7624. }
  7625. const optionalContentType = optionalContent.get("Type").name;
  7626. if (optionalContentType === "OCG") {
  7627. return {
  7628. type: optionalContentType,
  7629. id: optionalContent.objId
  7630. };
  7631. } else if (optionalContentType === "OCMD") {
  7632. const expression = optionalContent.get("VE");
  7633. if (Array.isArray(expression)) {
  7634. const result = [];
  7635. this._parseVisibilityExpression(expression, 0, result);
  7636. if (result.length > 0) {
  7637. return {
  7638. type: "OCMD",
  7639. expression: result
  7640. };
  7641. }
  7642. }
  7643. const optionalContentGroups = optionalContent.get("OCGs");
  7644. if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) {
  7645. const groupIds = [];
  7646. if (Array.isArray(optionalContentGroups)) {
  7647. for (const ocg of optionalContentGroups) {
  7648. groupIds.push(ocg.toString());
  7649. }
  7650. } else {
  7651. groupIds.push(optionalContentGroups.objId);
  7652. }
  7653. return {
  7654. type: optionalContentType,
  7655. ids: groupIds,
  7656. policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null,
  7657. expression: null
  7658. };
  7659. } else if ((0, _primitives.isRef)(optionalContentGroups)) {
  7660. return {
  7661. type: optionalContentType,
  7662. id: optionalContentGroups.toString()
  7663. };
  7664. }
  7665. }
  7666. return null;
  7667. }
  7668. getOperatorList({
  7669. stream,
  7670. task,
  7671. resources,
  7672. operatorList,
  7673. initialState = null,
  7674. fallbackFontDict = null
  7675. }) {
  7676. resources = resources || _primitives.Dict.empty;
  7677. initialState = initialState || new EvalState();
  7678. if (!operatorList) {
  7679. throw new Error('getOperatorList: missing "operatorList" parameter');
  7680. }
  7681. const self = this;
  7682. const xref = this.xref;
  7683. let parsingText = false;
  7684. const localImageCache = new _image_utils.LocalImageCache();
  7685. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  7686. const localGStateCache = new _image_utils.LocalGStateCache();
  7687. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  7688. const localShadingPatternCache = new Map();
  7689. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  7690. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  7691. const stateManager = new StateManager(initialState);
  7692. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  7693. const timeSlotManager = new TimeSlotManager();
  7694. function closePendingRestoreOPS(argument) {
  7695. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  7696. operatorList.addOp(_util.OPS.restore, []);
  7697. }
  7698. }
  7699. return new Promise(function promiseBody(resolve, reject) {
  7700. const next = function (promise) {
  7701. Promise.all([promise, operatorList.ready]).then(function () {
  7702. try {
  7703. promiseBody(resolve, reject);
  7704. } catch (ex) {
  7705. reject(ex);
  7706. }
  7707. }, reject);
  7708. };
  7709. task.ensureNotTerminated();
  7710. timeSlotManager.reset();
  7711. const operation = {};
  7712. let stop, i, ii, cs, name, isValidName;
  7713. while (!(stop = timeSlotManager.check())) {
  7714. operation.args = null;
  7715. if (!preprocessor.read(operation)) {
  7716. break;
  7717. }
  7718. let args = operation.args;
  7719. let fn = operation.fn;
  7720. switch (fn | 0) {
  7721. case _util.OPS.paintXObject:
  7722. isValidName = args[0] instanceof _primitives.Name;
  7723. name = args[0].name;
  7724. if (isValidName) {
  7725. const localImage = localImageCache.getByName(name);
  7726. if (localImage) {
  7727. operatorList.addOp(localImage.fn, localImage.args);
  7728. args = null;
  7729. continue;
  7730. }
  7731. }
  7732. next(new Promise(function (resolveXObject, rejectXObject) {
  7733. if (!isValidName) {
  7734. throw new _util.FormatError("XObject must be referred to by name.");
  7735. }
  7736. let xobj = xobjs.getRaw(name);
  7737. if (xobj instanceof _primitives.Ref) {
  7738. const localImage = localImageCache.getByRef(xobj);
  7739. if (localImage) {
  7740. operatorList.addOp(localImage.fn, localImage.args);
  7741. resolveXObject();
  7742. return;
  7743. }
  7744. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  7745. if (globalImage) {
  7746. operatorList.addDependency(globalImage.objId);
  7747. operatorList.addOp(globalImage.fn, globalImage.args);
  7748. resolveXObject();
  7749. return;
  7750. }
  7751. xobj = xref.fetch(xobj);
  7752. }
  7753. if (!(0, _primitives.isStream)(xobj)) {
  7754. throw new _util.FormatError("XObject should be a stream");
  7755. }
  7756. const type = xobj.dict.get("Subtype");
  7757. if (!(0, _primitives.isName)(type)) {
  7758. throw new _util.FormatError("XObject should have a Name subtype");
  7759. }
  7760. if (type.name === "Form") {
  7761. stateManager.save();
  7762. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  7763. stateManager.restore();
  7764. resolveXObject();
  7765. }, rejectXObject);
  7766. return;
  7767. } else if (type.name === "Image") {
  7768. self.buildPaintImageXObject({
  7769. resources,
  7770. image: xobj,
  7771. operatorList,
  7772. cacheKey: name,
  7773. localImageCache,
  7774. localColorSpaceCache
  7775. }).then(resolveXObject, rejectXObject);
  7776. return;
  7777. } else if (type.name === "PS") {
  7778. (0, _util.info)("Ignored XObject subtype PS");
  7779. } else {
  7780. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  7781. }
  7782. resolveXObject();
  7783. }).catch(function (reason) {
  7784. if (reason instanceof _util.AbortException) {
  7785. return;
  7786. }
  7787. if (self.options.ignoreErrors) {
  7788. self.handler.send("UnsupportedFeature", {
  7789. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  7790. });
  7791. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  7792. return;
  7793. }
  7794. throw reason;
  7795. }));
  7796. return;
  7797. case _util.OPS.setFont:
  7798. var fontSize = args[1];
  7799. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  7800. operatorList.addDependency(loadedName);
  7801. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  7802. }));
  7803. return;
  7804. case _util.OPS.beginText:
  7805. parsingText = true;
  7806. break;
  7807. case _util.OPS.endText:
  7808. parsingText = false;
  7809. break;
  7810. case _util.OPS.endInlineImage:
  7811. var cacheKey = args[0].cacheKey;
  7812. if (cacheKey) {
  7813. const localImage = localImageCache.getByName(cacheKey);
  7814. if (localImage) {
  7815. operatorList.addOp(localImage.fn, localImage.args);
  7816. args = null;
  7817. continue;
  7818. }
  7819. }
  7820. next(self.buildPaintImageXObject({
  7821. resources,
  7822. image: args[0],
  7823. isInline: true,
  7824. operatorList,
  7825. cacheKey,
  7826. localImageCache,
  7827. localColorSpaceCache
  7828. }));
  7829. return;
  7830. case _util.OPS.showText:
  7831. if (!stateManager.state.font) {
  7832. self.ensureStateFont(stateManager.state);
  7833. continue;
  7834. }
  7835. args[0] = self.handleText(args[0], stateManager.state);
  7836. break;
  7837. case _util.OPS.showSpacedText:
  7838. if (!stateManager.state.font) {
  7839. self.ensureStateFont(stateManager.state);
  7840. continue;
  7841. }
  7842. var arr = args[0];
  7843. var combinedGlyphs = [];
  7844. var arrLength = arr.length;
  7845. var state = stateManager.state;
  7846. for (i = 0; i < arrLength; ++i) {
  7847. const arrItem = arr[i];
  7848. if ((0, _util.isString)(arrItem)) {
  7849. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  7850. } else if ((0, _util.isNum)(arrItem)) {
  7851. combinedGlyphs.push(arrItem);
  7852. }
  7853. }
  7854. args[0] = combinedGlyphs;
  7855. fn = _util.OPS.showText;
  7856. break;
  7857. case _util.OPS.nextLineShowText:
  7858. if (!stateManager.state.font) {
  7859. self.ensureStateFont(stateManager.state);
  7860. continue;
  7861. }
  7862. operatorList.addOp(_util.OPS.nextLine);
  7863. args[0] = self.handleText(args[0], stateManager.state);
  7864. fn = _util.OPS.showText;
  7865. break;
  7866. case _util.OPS.nextLineSetSpacingShowText:
  7867. if (!stateManager.state.font) {
  7868. self.ensureStateFont(stateManager.state);
  7869. continue;
  7870. }
  7871. operatorList.addOp(_util.OPS.nextLine);
  7872. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  7873. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  7874. args[0] = self.handleText(args[0], stateManager.state);
  7875. fn = _util.OPS.showText;
  7876. break;
  7877. case _util.OPS.setTextRenderingMode:
  7878. stateManager.state.textRenderingMode = args[0];
  7879. break;
  7880. case _util.OPS.setFillColorSpace:
  7881. {
  7882. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  7883. if (cachedColorSpace) {
  7884. stateManager.state.fillColorSpace = cachedColorSpace;
  7885. continue;
  7886. }
  7887. next(self.parseColorSpace({
  7888. cs: args[0],
  7889. resources,
  7890. localColorSpaceCache
  7891. }).then(function (colorSpace) {
  7892. if (colorSpace) {
  7893. stateManager.state.fillColorSpace = colorSpace;
  7894. }
  7895. }));
  7896. return;
  7897. }
  7898. case _util.OPS.setStrokeColorSpace:
  7899. {
  7900. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  7901. if (cachedColorSpace) {
  7902. stateManager.state.strokeColorSpace = cachedColorSpace;
  7903. continue;
  7904. }
  7905. next(self.parseColorSpace({
  7906. cs: args[0],
  7907. resources,
  7908. localColorSpaceCache
  7909. }).then(function (colorSpace) {
  7910. if (colorSpace) {
  7911. stateManager.state.strokeColorSpace = colorSpace;
  7912. }
  7913. }));
  7914. return;
  7915. }
  7916. case _util.OPS.setFillColor:
  7917. cs = stateManager.state.fillColorSpace;
  7918. args = cs.getRgb(args, 0);
  7919. fn = _util.OPS.setFillRGBColor;
  7920. break;
  7921. case _util.OPS.setStrokeColor:
  7922. cs = stateManager.state.strokeColorSpace;
  7923. args = cs.getRgb(args, 0);
  7924. fn = _util.OPS.setStrokeRGBColor;
  7925. break;
  7926. case _util.OPS.setFillGray:
  7927. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  7928. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  7929. fn = _util.OPS.setFillRGBColor;
  7930. break;
  7931. case _util.OPS.setStrokeGray:
  7932. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  7933. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  7934. fn = _util.OPS.setStrokeRGBColor;
  7935. break;
  7936. case _util.OPS.setFillCMYKColor:
  7937. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  7938. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  7939. fn = _util.OPS.setFillRGBColor;
  7940. break;
  7941. case _util.OPS.setStrokeCMYKColor:
  7942. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  7943. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  7944. fn = _util.OPS.setStrokeRGBColor;
  7945. break;
  7946. case _util.OPS.setFillRGBColor:
  7947. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  7948. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  7949. break;
  7950. case _util.OPS.setStrokeRGBColor:
  7951. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  7952. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  7953. break;
  7954. case _util.OPS.setFillColorN:
  7955. cs = stateManager.state.fillColorSpace;
  7956. if (cs.name === "Pattern") {
  7957. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  7958. return;
  7959. }
  7960. args = cs.getRgb(args, 0);
  7961. fn = _util.OPS.setFillRGBColor;
  7962. break;
  7963. case _util.OPS.setStrokeColorN:
  7964. cs = stateManager.state.strokeColorSpace;
  7965. if (cs.name === "Pattern") {
  7966. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  7967. return;
  7968. }
  7969. args = cs.getRgb(args, 0);
  7970. fn = _util.OPS.setStrokeRGBColor;
  7971. break;
  7972. case _util.OPS.shadingFill:
  7973. var shadingRes = resources.get("Shading");
  7974. if (!shadingRes) {
  7975. throw new _util.FormatError("No shading resource found");
  7976. }
  7977. var shading = shadingRes.get(args[0].name);
  7978. if (!shading) {
  7979. throw new _util.FormatError("No shading object found");
  7980. }
  7981. const patternId = self.parseShading({
  7982. keyObj: shading,
  7983. shading,
  7984. resources,
  7985. localColorSpaceCache,
  7986. localShadingPatternCache
  7987. });
  7988. args = [patternId];
  7989. fn = _util.OPS.shadingFill;
  7990. break;
  7991. case _util.OPS.setGState:
  7992. isValidName = args[0] instanceof _primitives.Name;
  7993. name = args[0].name;
  7994. if (isValidName) {
  7995. const localGStateObj = localGStateCache.getByName(name);
  7996. if (localGStateObj) {
  7997. if (localGStateObj.length > 0) {
  7998. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  7999. }
  8000. args = null;
  8001. continue;
  8002. }
  8003. }
  8004. next(new Promise(function (resolveGState, rejectGState) {
  8005. if (!isValidName) {
  8006. throw new _util.FormatError("GState must be referred to by name.");
  8007. }
  8008. const extGState = resources.get("ExtGState");
  8009. if (!(extGState instanceof _primitives.Dict)) {
  8010. throw new _util.FormatError("ExtGState should be a dictionary.");
  8011. }
  8012. const gState = extGState.get(name);
  8013. if (!(gState instanceof _primitives.Dict)) {
  8014. throw new _util.FormatError("GState should be a dictionary.");
  8015. }
  8016. self.setGState({
  8017. resources,
  8018. gState,
  8019. operatorList,
  8020. cacheKey: name,
  8021. task,
  8022. stateManager,
  8023. localGStateCache,
  8024. localColorSpaceCache
  8025. }).then(resolveGState, rejectGState);
  8026. }).catch(function (reason) {
  8027. if (reason instanceof _util.AbortException) {
  8028. return;
  8029. }
  8030. if (self.options.ignoreErrors) {
  8031. self.handler.send("UnsupportedFeature", {
  8032. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  8033. });
  8034. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  8035. return;
  8036. }
  8037. throw reason;
  8038. }));
  8039. return;
  8040. case _util.OPS.moveTo:
  8041. case _util.OPS.lineTo:
  8042. case _util.OPS.curveTo:
  8043. case _util.OPS.curveTo2:
  8044. case _util.OPS.curveTo3:
  8045. case _util.OPS.closePath:
  8046. case _util.OPS.rectangle:
  8047. self.buildPath(operatorList, fn, args, parsingText);
  8048. continue;
  8049. case _util.OPS.markPoint:
  8050. case _util.OPS.markPointProps:
  8051. case _util.OPS.beginCompat:
  8052. case _util.OPS.endCompat:
  8053. continue;
  8054. case _util.OPS.beginMarkedContentProps:
  8055. if (!(0, _primitives.isName)(args[0])) {
  8056. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  8057. continue;
  8058. }
  8059. if (args[0].name === "OC") {
  8060. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  8061. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  8062. }).catch(reason => {
  8063. if (reason instanceof _util.AbortException) {
  8064. return;
  8065. }
  8066. if (self.options.ignoreErrors) {
  8067. self.handler.send("UnsupportedFeature", {
  8068. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  8069. });
  8070. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  8071. return;
  8072. }
  8073. throw reason;
  8074. }));
  8075. return;
  8076. }
  8077. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  8078. break;
  8079. case _util.OPS.beginMarkedContent:
  8080. case _util.OPS.endMarkedContent:
  8081. default:
  8082. if (args !== null) {
  8083. for (i = 0, ii = args.length; i < ii; i++) {
  8084. if (args[i] instanceof _primitives.Dict) {
  8085. break;
  8086. }
  8087. }
  8088. if (i < ii) {
  8089. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  8090. continue;
  8091. }
  8092. }
  8093. }
  8094. operatorList.addOp(fn, args);
  8095. }
  8096. if (stop) {
  8097. next(deferred);
  8098. return;
  8099. }
  8100. closePendingRestoreOPS();
  8101. resolve();
  8102. }).catch(reason => {
  8103. if (reason instanceof _util.AbortException) {
  8104. return;
  8105. }
  8106. if (this.options.ignoreErrors) {
  8107. this.handler.send("UnsupportedFeature", {
  8108. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  8109. });
  8110. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  8111. closePendingRestoreOPS();
  8112. return;
  8113. }
  8114. throw reason;
  8115. });
  8116. }
  8117. getTextContent({
  8118. stream,
  8119. task,
  8120. resources,
  8121. stateManager = null,
  8122. normalizeWhitespace = false,
  8123. combineTextItems = false,
  8124. includeMarkedContent = false,
  8125. sink,
  8126. seenStyles = new Set()
  8127. }) {
  8128. resources = resources || _primitives.Dict.empty;
  8129. stateManager = stateManager || new StateManager(new TextState());
  8130. const WhitespaceRegexp = /\s/g;
  8131. const textContent = {
  8132. items: [],
  8133. styles: Object.create(null)
  8134. };
  8135. const textContentItem = {
  8136. initialized: false,
  8137. str: [],
  8138. totalWidth: 0,
  8139. totalHeight: 0,
  8140. width: 0,
  8141. height: 0,
  8142. vertical: false,
  8143. lastCharSize: 0,
  8144. prevTransform: null,
  8145. textAdvanceScale: 0,
  8146. spaceWidth: 0,
  8147. spaceInFlowMin: 0,
  8148. spaceInFlowMax: 0,
  8149. trackingSpaceMin: Infinity,
  8150. transform: null,
  8151. fontName: null,
  8152. hasEOL: false,
  8153. isLastCharWhiteSpace: false
  8154. };
  8155. const TRACKING_SPACE_FACTOR = 0.3;
  8156. const SPACE_IN_FLOW_MIN_FACTOR = 0.3;
  8157. const SPACE_IN_FLOW_MAX_FACTOR = 1.3;
  8158. const self = this;
  8159. const xref = this.xref;
  8160. const showSpacedTextBuffer = [];
  8161. let xobjs = null;
  8162. const emptyXObjectCache = new _image_utils.LocalImageCache();
  8163. const emptyGStateCache = new _image_utils.LocalGStateCache();
  8164. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  8165. let textState;
  8166. function getCurrentTextTransform() {
  8167. const font = textState.font;
  8168. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  8169. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  8170. const glyphHeight = font.bbox[3] - font.bbox[1];
  8171. if (glyphHeight > 0) {
  8172. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  8173. }
  8174. }
  8175. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  8176. }
  8177. function ensureTextContentItem() {
  8178. if (textContentItem.initialized) {
  8179. return textContentItem;
  8180. }
  8181. const font = textState.font,
  8182. loadedName = font.loadedName;
  8183. if (!seenStyles.has(loadedName)) {
  8184. seenStyles.add(loadedName);
  8185. textContent.styles[loadedName] = {
  8186. fontFamily: font.fallbackName,
  8187. ascent: font.ascent,
  8188. descent: font.descent,
  8189. vertical: font.vertical
  8190. };
  8191. }
  8192. textContentItem.fontName = loadedName;
  8193. const trm = textContentItem.transform = getCurrentTextTransform();
  8194. if (!font.vertical) {
  8195. textContentItem.width = textContentItem.totalWidth = 0;
  8196. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  8197. textContentItem.vertical = false;
  8198. } else {
  8199. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  8200. textContentItem.height = textContentItem.totalHeight = 0;
  8201. textContentItem.vertical = true;
  8202. }
  8203. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  8204. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  8205. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  8206. textContentItem.lastCharSize = textContentItem.lastCharSize || 0;
  8207. const spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  8208. if (spaceWidth) {
  8209. textContentItem.spaceWidth = spaceWidth;
  8210. textContentItem.trackingSpaceMin = spaceWidth * TRACKING_SPACE_FACTOR;
  8211. textContentItem.spaceInFlowMin = spaceWidth * SPACE_IN_FLOW_MIN_FACTOR;
  8212. textContentItem.spaceInFlowMax = spaceWidth * SPACE_IN_FLOW_MAX_FACTOR;
  8213. } else {
  8214. textContentItem.spaceWidth = 0;
  8215. textContentItem.trackingSpaceMin = Infinity;
  8216. }
  8217. textContentItem.hasEOL = false;
  8218. textContentItem.initialized = true;
  8219. return textContentItem;
  8220. }
  8221. function updateAdvanceScale() {
  8222. if (!textContentItem.initialized) {
  8223. return;
  8224. }
  8225. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  8226. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  8227. const scaleFactor = scaleCtmX * scaleLineX;
  8228. if (scaleFactor === textContentItem.textAdvanceScale) {
  8229. return;
  8230. }
  8231. if (!textContentItem.vertical) {
  8232. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  8233. textContentItem.width = 0;
  8234. } else {
  8235. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  8236. textContentItem.height = 0;
  8237. }
  8238. textContentItem.textAdvanceScale = scaleFactor;
  8239. }
  8240. function replaceWhitespace(str) {
  8241. const ii = str.length;
  8242. let i = 0,
  8243. code;
  8244. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  8245. i++;
  8246. }
  8247. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  8248. }
  8249. function runBidiTransform(textChunk) {
  8250. const text = textChunk.str.join("");
  8251. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  8252. const str = normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str;
  8253. return {
  8254. str,
  8255. dir: bidiResult.dir,
  8256. width: textChunk.totalWidth,
  8257. height: textChunk.totalHeight,
  8258. transform: textChunk.transform,
  8259. fontName: textChunk.fontName,
  8260. hasEOL: textChunk.hasEOL
  8261. };
  8262. }
  8263. function handleSetFont(fontName, fontRef) {
  8264. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  8265. if (!translated.font.isType3Font) {
  8266. return translated;
  8267. }
  8268. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  8269. return translated;
  8270. });
  8271. }).then(function (translated) {
  8272. textState.font = translated.font;
  8273. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  8274. });
  8275. }
  8276. function compareWithLastPosition(fontSize) {
  8277. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  8278. return;
  8279. }
  8280. const currentTransform = getCurrentTextTransform();
  8281. const posX = currentTransform[4];
  8282. const posY = currentTransform[5];
  8283. const lastPosX = textContentItem.prevTransform[4];
  8284. const lastPosY = textContentItem.prevTransform[5];
  8285. if (lastPosX === posX && lastPosY === posY) {
  8286. return;
  8287. }
  8288. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  8289. const advanceY = (posY - lastPosY) / textContentItem.textAdvanceScale;
  8290. const HALF_LAST_CHAR = -0.5 * textContentItem.lastCharSize;
  8291. if (textState.font.vertical) {
  8292. if (Math.abs(advanceX) > textContentItem.width / textContentItem.textAdvanceScale) {
  8293. appendEOL();
  8294. return;
  8295. }
  8296. if (HALF_LAST_CHAR > advanceY) {
  8297. return;
  8298. }
  8299. if (advanceY > textContentItem.trackingSpaceMin) {
  8300. textContentItem.height += advanceY;
  8301. } else if (!addFakeSpaces(advanceY, 0, textContentItem.prevTransform)) {
  8302. if (textContentItem.str.length === 0) {
  8303. textContent.items.push({
  8304. str: " ",
  8305. dir: "ltr",
  8306. width: 0,
  8307. height: advanceY,
  8308. transform: textContentItem.prevTransform,
  8309. fontName: textContentItem.fontName,
  8310. hasEOL: false
  8311. });
  8312. textContentItem.isLastCharWhiteSpace = true;
  8313. } else {
  8314. textContentItem.height += advanceY;
  8315. }
  8316. }
  8317. return;
  8318. }
  8319. if (Math.abs(advanceY) > textContentItem.height / textContentItem.textAdvanceScale) {
  8320. appendEOL();
  8321. return;
  8322. }
  8323. if (HALF_LAST_CHAR > advanceX) {
  8324. return;
  8325. }
  8326. if (advanceX <= textContentItem.trackingSpaceMin) {
  8327. textContentItem.width += advanceX;
  8328. } else if (!addFakeSpaces(advanceX, 0, textContentItem.prevTransform)) {
  8329. if (textContentItem.str.length === 0) {
  8330. textContent.items.push({
  8331. str: " ",
  8332. dir: "ltr",
  8333. width: advanceX,
  8334. height: 0,
  8335. transform: textContentItem.prevTransform,
  8336. fontName: textContentItem.fontName,
  8337. hasEOL: false
  8338. });
  8339. textContentItem.isLastCharWhiteSpace = true;
  8340. } else {
  8341. textContentItem.width += advanceX;
  8342. }
  8343. }
  8344. }
  8345. function buildTextContentItem({
  8346. chars,
  8347. extraSpacing,
  8348. isFirstChunk
  8349. }) {
  8350. const font = textState.font;
  8351. if (!chars) {
  8352. const charSpacing = textState.charSpacing + extraSpacing;
  8353. if (charSpacing) {
  8354. if (!font.vertical) {
  8355. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  8356. } else {
  8357. textState.translateTextMatrix(0, charSpacing);
  8358. }
  8359. }
  8360. return;
  8361. }
  8362. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  8363. const glyphs = font.charsToGlyphs(chars);
  8364. const scale = textState.fontMatrix[0] * textState.fontSize;
  8365. if (isFirstChunk) {
  8366. compareWithLastPosition(scale);
  8367. }
  8368. let textChunk = ensureTextContentItem();
  8369. let size = 0;
  8370. let lastCharSize = 0;
  8371. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8372. const glyph = glyphs[i];
  8373. let charSpacing = textState.charSpacing + (i === ii - 1 ? extraSpacing : 0);
  8374. let glyphUnicode = glyph.unicode;
  8375. if (glyph.isSpace) {
  8376. charSpacing += textState.wordSpacing;
  8377. textChunk.isLastCharWhiteSpace = true;
  8378. } else {
  8379. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  8380. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  8381. textChunk.isLastCharWhiteSpace = false;
  8382. }
  8383. textChunk.str.push(glyphUnicode);
  8384. const glyphWidth = font.vertical && glyph.vmetric ? glyph.vmetric[0] : glyph.width;
  8385. let scaledDim = glyphWidth * scale;
  8386. if (!font.vertical) {
  8387. scaledDim *= textState.textHScale;
  8388. textState.translateTextMatrix(scaledDim, 0);
  8389. } else {
  8390. textState.translateTextMatrix(0, scaledDim);
  8391. scaledDim = Math.abs(scaledDim);
  8392. }
  8393. size += scaledDim;
  8394. if (charSpacing) {
  8395. if (!font.vertical) {
  8396. charSpacing *= textState.textHScale;
  8397. }
  8398. scaledDim += charSpacing;
  8399. const wasSplit = charSpacing > textContentItem.trackingSpaceMin && addFakeSpaces(charSpacing, size);
  8400. if (!font.vertical) {
  8401. textState.translateTextMatrix(charSpacing, 0);
  8402. } else {
  8403. textState.translateTextMatrix(0, charSpacing);
  8404. }
  8405. if (wasSplit) {
  8406. textChunk = ensureTextContentItem();
  8407. size = 0;
  8408. } else {
  8409. size += charSpacing;
  8410. }
  8411. }
  8412. lastCharSize = scaledDim;
  8413. }
  8414. textChunk.lastCharSize = lastCharSize;
  8415. if (!font.vertical) {
  8416. textChunk.width += size;
  8417. } else {
  8418. textChunk.height += size;
  8419. }
  8420. textChunk.prevTransform = getCurrentTextTransform();
  8421. }
  8422. function appendEOL() {
  8423. if (textContentItem.initialized) {
  8424. textContentItem.hasEOL = true;
  8425. flushTextContentItem();
  8426. } else if (textContent.items.length > 0) {
  8427. textContent.items[textContent.items.length - 1].hasEOL = true;
  8428. } else {
  8429. textContent.items.push({
  8430. str: "",
  8431. dir: "ltr",
  8432. width: 0,
  8433. height: 0,
  8434. transform: getCurrentTextTransform(),
  8435. fontName: textState.font.loadedName,
  8436. hasEOL: true
  8437. });
  8438. }
  8439. textContentItem.isLastCharWhiteSpace = false;
  8440. textContentItem.lastCharSize = 0;
  8441. }
  8442. function addFakeSpaces(width, size, transf = null) {
  8443. if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) {
  8444. if (textContentItem.initialized) {
  8445. textContentItem.str.push(" ");
  8446. textContentItem.isLastCharWhiteSpace = true;
  8447. }
  8448. return false;
  8449. }
  8450. const fontName = textContentItem.fontName;
  8451. let height = 0;
  8452. width *= textContentItem.textAdvanceScale;
  8453. if (!textContentItem.vertical) {
  8454. textContentItem.width += size;
  8455. } else {
  8456. textContentItem.height += size;
  8457. height = width;
  8458. width = 0;
  8459. }
  8460. flushTextContentItem();
  8461. if (textContentItem.isLastCharWhiteSpace) {
  8462. return true;
  8463. }
  8464. textContentItem.isLastCharWhiteSpace = true;
  8465. textContent.items.push({
  8466. str: " ",
  8467. dir: "ltr",
  8468. width,
  8469. height,
  8470. transform: transf ? transf : getCurrentTextTransform(),
  8471. fontName,
  8472. hasEOL: false
  8473. });
  8474. return true;
  8475. }
  8476. function flushTextContentItem() {
  8477. if (!textContentItem.initialized || !textContentItem.str) {
  8478. return;
  8479. }
  8480. if (!textContentItem.vertical) {
  8481. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  8482. } else {
  8483. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  8484. }
  8485. textContent.items.push(runBidiTransform(textContentItem));
  8486. textContentItem.initialized = false;
  8487. textContentItem.str.length = 0;
  8488. }
  8489. function enqueueChunk() {
  8490. const length = textContent.items.length;
  8491. if (length > 0) {
  8492. sink.enqueue(textContent, length);
  8493. textContent.items = [];
  8494. textContent.styles = Object.create(null);
  8495. }
  8496. }
  8497. const timeSlotManager = new TimeSlotManager();
  8498. return new Promise(function promiseBody(resolve, reject) {
  8499. const next = function (promise) {
  8500. enqueueChunk();
  8501. Promise.all([promise, sink.ready]).then(function () {
  8502. try {
  8503. promiseBody(resolve, reject);
  8504. } catch (ex) {
  8505. reject(ex);
  8506. }
  8507. }, reject);
  8508. };
  8509. task.ensureNotTerminated();
  8510. timeSlotManager.reset();
  8511. const operation = {};
  8512. let stop,
  8513. args = [];
  8514. while (!(stop = timeSlotManager.check())) {
  8515. args.length = 0;
  8516. operation.args = args;
  8517. if (!preprocessor.read(operation)) {
  8518. break;
  8519. }
  8520. textState = stateManager.state;
  8521. const fn = operation.fn;
  8522. args = operation.args;
  8523. switch (fn | 0) {
  8524. case _util.OPS.setFont:
  8525. var fontNameArg = args[0].name,
  8526. fontSizeArg = args[1];
  8527. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  8528. break;
  8529. }
  8530. flushTextContentItem();
  8531. textState.fontName = fontNameArg;
  8532. textState.fontSize = fontSizeArg;
  8533. next(handleSetFont(fontNameArg, null));
  8534. return;
  8535. case _util.OPS.setTextRise:
  8536. flushTextContentItem();
  8537. textState.textRise = args[0];
  8538. break;
  8539. case _util.OPS.setHScale:
  8540. flushTextContentItem();
  8541. textState.textHScale = args[0] / 100;
  8542. break;
  8543. case _util.OPS.setLeading:
  8544. flushTextContentItem();
  8545. textState.leading = args[0];
  8546. break;
  8547. case _util.OPS.moveText:
  8548. textState.translateTextLineMatrix(args[0], args[1]);
  8549. textState.textMatrix = textState.textLineMatrix.slice();
  8550. break;
  8551. case _util.OPS.setLeadingMoveText:
  8552. flushTextContentItem();
  8553. textState.leading = -args[1];
  8554. textState.translateTextLineMatrix(args[0], args[1]);
  8555. textState.textMatrix = textState.textLineMatrix.slice();
  8556. break;
  8557. case _util.OPS.nextLine:
  8558. appendEOL();
  8559. textState.carriageReturn();
  8560. break;
  8561. case _util.OPS.setTextMatrix:
  8562. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  8563. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  8564. updateAdvanceScale();
  8565. break;
  8566. case _util.OPS.setCharSpacing:
  8567. textState.charSpacing = args[0];
  8568. break;
  8569. case _util.OPS.setWordSpacing:
  8570. textState.wordSpacing = args[0];
  8571. break;
  8572. case _util.OPS.beginText:
  8573. flushTextContentItem();
  8574. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  8575. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  8576. break;
  8577. case _util.OPS.showSpacedText:
  8578. if (!stateManager.state.font) {
  8579. self.ensureStateFont(stateManager.state);
  8580. continue;
  8581. }
  8582. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  8583. const elements = args[0];
  8584. let isFirstChunk = true;
  8585. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  8586. const item = elements[i];
  8587. if (typeof item === "string") {
  8588. showSpacedTextBuffer.push(item);
  8589. } else if (typeof item === "number" && item !== 0) {
  8590. const str = showSpacedTextBuffer.join("");
  8591. showSpacedTextBuffer.length = 0;
  8592. buildTextContentItem({
  8593. chars: str,
  8594. extraSpacing: item * spaceFactor,
  8595. isFirstChunk
  8596. });
  8597. if (str && isFirstChunk) {
  8598. isFirstChunk = false;
  8599. }
  8600. }
  8601. }
  8602. const item = elements[elements.length - 1];
  8603. if (typeof item === "string") {
  8604. showSpacedTextBuffer.push(item);
  8605. }
  8606. if (showSpacedTextBuffer.length > 0) {
  8607. const str = showSpacedTextBuffer.join("");
  8608. showSpacedTextBuffer.length = 0;
  8609. buildTextContentItem({
  8610. chars: str,
  8611. extraSpacing: 0,
  8612. isFirstChunk
  8613. });
  8614. }
  8615. break;
  8616. case _util.OPS.showText:
  8617. if (!stateManager.state.font) {
  8618. self.ensureStateFont(stateManager.state);
  8619. continue;
  8620. }
  8621. buildTextContentItem({
  8622. chars: args[0],
  8623. extraSpacing: 0,
  8624. isFirstChunk: true
  8625. });
  8626. break;
  8627. case _util.OPS.nextLineShowText:
  8628. if (!stateManager.state.font) {
  8629. self.ensureStateFont(stateManager.state);
  8630. continue;
  8631. }
  8632. textContentItem.hasEOL = true;
  8633. flushTextContentItem();
  8634. textState.carriageReturn();
  8635. buildTextContentItem({
  8636. chars: args[0],
  8637. extraSpacing: 0,
  8638. isFirstChunk: true
  8639. });
  8640. break;
  8641. case _util.OPS.nextLineSetSpacingShowText:
  8642. if (!stateManager.state.font) {
  8643. self.ensureStateFont(stateManager.state);
  8644. continue;
  8645. }
  8646. textContentItem.hasEOL = true;
  8647. flushTextContentItem();
  8648. textState.wordSpacing = args[0];
  8649. textState.charSpacing = args[1];
  8650. textState.carriageReturn();
  8651. buildTextContentItem({
  8652. chars: args[2],
  8653. extraSpacing: 0,
  8654. isFirstChunk: true
  8655. });
  8656. break;
  8657. case _util.OPS.paintXObject:
  8658. flushTextContentItem();
  8659. if (!xobjs) {
  8660. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  8661. }
  8662. var isValidName = args[0] instanceof _primitives.Name;
  8663. var name = args[0].name;
  8664. if (isValidName && emptyXObjectCache.getByName(name)) {
  8665. break;
  8666. }
  8667. next(new Promise(function (resolveXObject, rejectXObject) {
  8668. if (!isValidName) {
  8669. throw new _util.FormatError("XObject must be referred to by name.");
  8670. }
  8671. let xobj = xobjs.getRaw(name);
  8672. if (xobj instanceof _primitives.Ref) {
  8673. if (emptyXObjectCache.getByRef(xobj)) {
  8674. resolveXObject();
  8675. return;
  8676. }
  8677. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  8678. if (globalImage) {
  8679. resolveXObject();
  8680. return;
  8681. }
  8682. xobj = xref.fetch(xobj);
  8683. }
  8684. if (!(0, _primitives.isStream)(xobj)) {
  8685. throw new _util.FormatError("XObject should be a stream");
  8686. }
  8687. const type = xobj.dict.get("Subtype");
  8688. if (!(0, _primitives.isName)(type)) {
  8689. throw new _util.FormatError("XObject should have a Name subtype");
  8690. }
  8691. if (type.name !== "Form") {
  8692. emptyXObjectCache.set(name, xobj.dict.objId, true);
  8693. resolveXObject();
  8694. return;
  8695. }
  8696. const currentState = stateManager.state.clone();
  8697. const xObjStateManager = new StateManager(currentState);
  8698. const matrix = xobj.dict.getArray("Matrix");
  8699. if (Array.isArray(matrix) && matrix.length === 6) {
  8700. xObjStateManager.transform(matrix);
  8701. }
  8702. enqueueChunk();
  8703. const sinkWrapper = {
  8704. enqueueInvoked: false,
  8705. enqueue(chunk, size) {
  8706. this.enqueueInvoked = true;
  8707. sink.enqueue(chunk, size);
  8708. },
  8709. get desiredSize() {
  8710. return sink.desiredSize;
  8711. },
  8712. get ready() {
  8713. return sink.ready;
  8714. }
  8715. };
  8716. self.getTextContent({
  8717. stream: xobj,
  8718. task,
  8719. resources: xobj.dict.get("Resources") || resources,
  8720. stateManager: xObjStateManager,
  8721. normalizeWhitespace,
  8722. combineTextItems,
  8723. includeMarkedContent,
  8724. sink: sinkWrapper,
  8725. seenStyles
  8726. }).then(function () {
  8727. if (!sinkWrapper.enqueueInvoked) {
  8728. emptyXObjectCache.set(name, xobj.dict.objId, true);
  8729. }
  8730. resolveXObject();
  8731. }, rejectXObject);
  8732. }).catch(function (reason) {
  8733. if (reason instanceof _util.AbortException) {
  8734. return;
  8735. }
  8736. if (self.options.ignoreErrors) {
  8737. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  8738. return;
  8739. }
  8740. throw reason;
  8741. }));
  8742. return;
  8743. case _util.OPS.setGState:
  8744. isValidName = args[0] instanceof _primitives.Name;
  8745. name = args[0].name;
  8746. if (isValidName && emptyGStateCache.getByName(name)) {
  8747. break;
  8748. }
  8749. next(new Promise(function (resolveGState, rejectGState) {
  8750. if (!isValidName) {
  8751. throw new _util.FormatError("GState must be referred to by name.");
  8752. }
  8753. const extGState = resources.get("ExtGState");
  8754. if (!(extGState instanceof _primitives.Dict)) {
  8755. throw new _util.FormatError("ExtGState should be a dictionary.");
  8756. }
  8757. const gState = extGState.get(name);
  8758. if (!(gState instanceof _primitives.Dict)) {
  8759. throw new _util.FormatError("GState should be a dictionary.");
  8760. }
  8761. const gStateFont = gState.get("Font");
  8762. if (!gStateFont) {
  8763. emptyGStateCache.set(name, gState.objId, true);
  8764. resolveGState();
  8765. return;
  8766. }
  8767. flushTextContentItem();
  8768. textState.fontName = null;
  8769. textState.fontSize = gStateFont[1];
  8770. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  8771. }).catch(function (reason) {
  8772. if (reason instanceof _util.AbortException) {
  8773. return;
  8774. }
  8775. if (self.options.ignoreErrors) {
  8776. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  8777. return;
  8778. }
  8779. throw reason;
  8780. }));
  8781. return;
  8782. case _util.OPS.beginMarkedContent:
  8783. if (includeMarkedContent) {
  8784. textContent.items.push({
  8785. type: "beginMarkedContent",
  8786. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  8787. });
  8788. }
  8789. break;
  8790. case _util.OPS.beginMarkedContentProps:
  8791. if (includeMarkedContent) {
  8792. flushTextContentItem();
  8793. let mcid = null;
  8794. if ((0, _primitives.isDict)(args[1])) {
  8795. mcid = args[1].get("MCID");
  8796. }
  8797. textContent.items.push({
  8798. type: "beginMarkedContentProps",
  8799. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  8800. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  8801. });
  8802. }
  8803. break;
  8804. case _util.OPS.endMarkedContent:
  8805. if (includeMarkedContent) {
  8806. flushTextContentItem();
  8807. textContent.items.push({
  8808. type: "endMarkedContent"
  8809. });
  8810. }
  8811. break;
  8812. }
  8813. if (textContent.items.length >= sink.desiredSize) {
  8814. stop = true;
  8815. break;
  8816. }
  8817. }
  8818. if (stop) {
  8819. next(deferred);
  8820. return;
  8821. }
  8822. flushTextContentItem();
  8823. enqueueChunk();
  8824. resolve();
  8825. }).catch(reason => {
  8826. if (reason instanceof _util.AbortException) {
  8827. return;
  8828. }
  8829. if (this.options.ignoreErrors) {
  8830. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  8831. flushTextContentItem();
  8832. enqueueChunk();
  8833. return;
  8834. }
  8835. throw reason;
  8836. });
  8837. }
  8838. extractDataStructures(dict, baseDict, properties) {
  8839. const xref = this.xref;
  8840. let cidToGidBytes;
  8841. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  8842. if (properties.composite) {
  8843. const cidSystemInfo = dict.get("CIDSystemInfo");
  8844. if ((0, _primitives.isDict)(cidSystemInfo)) {
  8845. properties.cidSystemInfo = {
  8846. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  8847. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  8848. supplement: cidSystemInfo.get("Supplement")
  8849. };
  8850. }
  8851. const cidToGidMap = dict.get("CIDToGIDMap");
  8852. if ((0, _primitives.isStream)(cidToGidMap)) {
  8853. cidToGidBytes = cidToGidMap.getBytes();
  8854. }
  8855. }
  8856. const differences = [];
  8857. let baseEncodingName = null;
  8858. let encoding;
  8859. if (dict.has("Encoding")) {
  8860. encoding = dict.get("Encoding");
  8861. if ((0, _primitives.isDict)(encoding)) {
  8862. baseEncodingName = encoding.get("BaseEncoding");
  8863. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  8864. if (encoding.has("Differences")) {
  8865. const diffEncoding = encoding.get("Differences");
  8866. let index = 0;
  8867. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  8868. const data = xref.fetchIfRef(diffEncoding[j]);
  8869. if ((0, _util.isNum)(data)) {
  8870. index = data;
  8871. } else if ((0, _primitives.isName)(data)) {
  8872. differences[index++] = data.name;
  8873. } else {
  8874. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  8875. }
  8876. }
  8877. }
  8878. } else if ((0, _primitives.isName)(encoding)) {
  8879. baseEncodingName = encoding.name;
  8880. } else {
  8881. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  8882. }
  8883. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  8884. baseEncodingName = null;
  8885. }
  8886. }
  8887. if (baseEncodingName) {
  8888. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  8889. } else {
  8890. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  8891. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  8892. encoding = _encodings.StandardEncoding;
  8893. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  8894. encoding = _encodings.WinAnsiEncoding;
  8895. }
  8896. if (isSymbolicFont) {
  8897. encoding = _encodings.MacRomanEncoding;
  8898. if (!properties.file || properties.isInternalFont) {
  8899. if (/Symbol/i.test(properties.name)) {
  8900. encoding = _encodings.SymbolSetEncoding;
  8901. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  8902. encoding = _encodings.ZapfDingbatsEncoding;
  8903. }
  8904. }
  8905. }
  8906. properties.defaultEncoding = encoding;
  8907. }
  8908. properties.differences = differences;
  8909. properties.baseEncodingName = baseEncodingName;
  8910. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  8911. properties.dict = dict;
  8912. return toUnicodePromise.then(readToUnicode => {
  8913. properties.toUnicode = readToUnicode;
  8914. return this.buildToUnicode(properties);
  8915. }).then(builtToUnicode => {
  8916. properties.toUnicode = builtToUnicode;
  8917. if (cidToGidBytes) {
  8918. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  8919. }
  8920. return properties;
  8921. });
  8922. }
  8923. _simpleFontToUnicode(properties, forceGlyphs = false) {
  8924. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  8925. const toUnicode = [];
  8926. const encoding = properties.defaultEncoding.slice();
  8927. const baseEncodingName = properties.baseEncodingName;
  8928. const differences = properties.differences;
  8929. for (const charcode in differences) {
  8930. const glyphName = differences[charcode];
  8931. if (glyphName === ".notdef") {
  8932. continue;
  8933. }
  8934. encoding[charcode] = glyphName;
  8935. }
  8936. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  8937. for (const charcode in encoding) {
  8938. let glyphName = encoding[charcode];
  8939. if (glyphName === "") {
  8940. continue;
  8941. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  8942. let code = 0;
  8943. switch (glyphName[0]) {
  8944. case "G":
  8945. if (glyphName.length === 3) {
  8946. code = parseInt(glyphName.substring(1), 16);
  8947. }
  8948. break;
  8949. case "g":
  8950. if (glyphName.length === 5) {
  8951. code = parseInt(glyphName.substring(1), 16);
  8952. }
  8953. break;
  8954. case "C":
  8955. case "c":
  8956. if (glyphName.length >= 3 && glyphName.length <= 4) {
  8957. const codeStr = glyphName.substring(1);
  8958. if (forceGlyphs) {
  8959. code = parseInt(codeStr, 16);
  8960. break;
  8961. }
  8962. code = +codeStr;
  8963. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  8964. return this._simpleFontToUnicode(properties, true);
  8965. }
  8966. }
  8967. break;
  8968. default:
  8969. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  8970. if (unicode !== -1) {
  8971. code = unicode;
  8972. }
  8973. }
  8974. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  8975. if (baseEncodingName && code === +charcode) {
  8976. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  8977. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  8978. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  8979. continue;
  8980. }
  8981. }
  8982. toUnicode[charcode] = String.fromCodePoint(code);
  8983. }
  8984. continue;
  8985. }
  8986. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  8987. }
  8988. return toUnicode;
  8989. }
  8990. async buildToUnicode(properties) {
  8991. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  8992. if (properties.hasIncludedToUnicodeMap) {
  8993. if (!properties.composite && properties.hasEncoding) {
  8994. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  8995. }
  8996. return properties.toUnicode;
  8997. }
  8998. if (!properties.composite) {
  8999. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  9000. }
  9001. 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"))) {
  9002. const {
  9003. registry,
  9004. ordering
  9005. } = properties.cidSystemInfo;
  9006. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  9007. const ucs2CMap = await _cmap.CMapFactory.create({
  9008. encoding: ucs2CMapName,
  9009. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  9010. useCMap: null
  9011. });
  9012. const toUnicode = [];
  9013. properties.cMap.forEach(function (charcode, cid) {
  9014. if (cid > 0xffff) {
  9015. throw new _util.FormatError("Max size of CID is 65,535");
  9016. }
  9017. const ucs2 = ucs2CMap.lookup(cid);
  9018. if (ucs2) {
  9019. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  9020. }
  9021. });
  9022. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  9023. }
  9024. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  9025. }
  9026. readToUnicode(cmapObj) {
  9027. if (!cmapObj) {
  9028. return Promise.resolve(null);
  9029. }
  9030. if ((0, _primitives.isName)(cmapObj)) {
  9031. return _cmap.CMapFactory.create({
  9032. encoding: cmapObj,
  9033. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  9034. useCMap: null
  9035. }).then(function (cmap) {
  9036. if (cmap instanceof _cmap.IdentityCMap) {
  9037. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  9038. }
  9039. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  9040. });
  9041. } else if ((0, _primitives.isStream)(cmapObj)) {
  9042. return _cmap.CMapFactory.create({
  9043. encoding: cmapObj,
  9044. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  9045. useCMap: null
  9046. }).then(function (cmap) {
  9047. if (cmap instanceof _cmap.IdentityCMap) {
  9048. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  9049. }
  9050. const map = new Array(cmap.length);
  9051. cmap.forEach(function (charCode, token) {
  9052. const str = [];
  9053. for (let k = 0; k < token.length; k += 2) {
  9054. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  9055. if ((w1 & 0xf800) !== 0xd800) {
  9056. str.push(w1);
  9057. continue;
  9058. }
  9059. k += 2;
  9060. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  9061. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  9062. }
  9063. map[charCode] = String.fromCodePoint.apply(String, str);
  9064. });
  9065. return new _to_unicode_map.ToUnicodeMap(map);
  9066. }, reason => {
  9067. if (reason instanceof _util.AbortException) {
  9068. return null;
  9069. }
  9070. if (this.options.ignoreErrors) {
  9071. this.handler.send("UnsupportedFeature", {
  9072. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  9073. });
  9074. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  9075. return null;
  9076. }
  9077. throw reason;
  9078. });
  9079. }
  9080. return Promise.resolve(null);
  9081. }
  9082. readCidToGidMap(glyphsData, toUnicode) {
  9083. const result = [];
  9084. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  9085. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  9086. const code = j >> 1;
  9087. if (glyphID === 0 && !toUnicode.has(code)) {
  9088. continue;
  9089. }
  9090. result[code] = glyphID;
  9091. }
  9092. return result;
  9093. }
  9094. extractWidths(dict, descriptor, properties) {
  9095. const xref = this.xref;
  9096. let glyphsWidths = [];
  9097. let defaultWidth = 0;
  9098. const glyphsVMetrics = [];
  9099. let defaultVMetrics;
  9100. let i, ii, j, jj, start, code, widths;
  9101. if (properties.composite) {
  9102. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  9103. widths = dict.get("W");
  9104. if (widths) {
  9105. for (i = 0, ii = widths.length; i < ii; i++) {
  9106. start = xref.fetchIfRef(widths[i++]);
  9107. code = xref.fetchIfRef(widths[i]);
  9108. if (Array.isArray(code)) {
  9109. for (j = 0, jj = code.length; j < jj; j++) {
  9110. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  9111. }
  9112. } else {
  9113. const width = xref.fetchIfRef(widths[++i]);
  9114. for (j = start; j <= code; j++) {
  9115. glyphsWidths[j] = width;
  9116. }
  9117. }
  9118. }
  9119. }
  9120. if (properties.vertical) {
  9121. let vmetrics = dict.getArray("DW2") || [880, -1000];
  9122. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  9123. vmetrics = dict.get("W2");
  9124. if (vmetrics) {
  9125. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  9126. start = xref.fetchIfRef(vmetrics[i++]);
  9127. code = xref.fetchIfRef(vmetrics[i]);
  9128. if (Array.isArray(code)) {
  9129. for (j = 0, jj = code.length; j < jj; j++) {
  9130. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  9131. }
  9132. } else {
  9133. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  9134. for (j = start; j <= code; j++) {
  9135. glyphsVMetrics[j] = vmetric;
  9136. }
  9137. }
  9138. }
  9139. }
  9140. }
  9141. } else {
  9142. const firstChar = properties.firstChar;
  9143. widths = dict.get("Widths");
  9144. if (widths) {
  9145. j = firstChar;
  9146. for (i = 0, ii = widths.length; i < ii; i++) {
  9147. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  9148. }
  9149. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  9150. } else {
  9151. const baseFontName = dict.get("BaseFont");
  9152. if ((0, _primitives.isName)(baseFontName)) {
  9153. const metrics = this.getBaseFontMetrics(baseFontName.name);
  9154. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  9155. defaultWidth = metrics.defaultWidth;
  9156. }
  9157. }
  9158. }
  9159. let isMonospace = true;
  9160. let firstWidth = defaultWidth;
  9161. for (const glyph in glyphsWidths) {
  9162. const glyphWidth = glyphsWidths[glyph];
  9163. if (!glyphWidth) {
  9164. continue;
  9165. }
  9166. if (!firstWidth) {
  9167. firstWidth = glyphWidth;
  9168. continue;
  9169. }
  9170. if (firstWidth !== glyphWidth) {
  9171. isMonospace = false;
  9172. break;
  9173. }
  9174. }
  9175. if (isMonospace) {
  9176. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  9177. }
  9178. properties.defaultWidth = defaultWidth;
  9179. properties.widths = glyphsWidths;
  9180. properties.defaultVMetrics = defaultVMetrics;
  9181. properties.vmetrics = glyphsVMetrics;
  9182. }
  9183. isSerifFont(baseFontName) {
  9184. const fontNameWoStyle = baseFontName.split("-")[0];
  9185. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  9186. }
  9187. getBaseFontMetrics(name) {
  9188. let defaultWidth = 0;
  9189. let widths = Object.create(null);
  9190. let monospace = false;
  9191. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  9192. let lookupName = stdFontMap[name] || name;
  9193. const Metrics = (0, _metrics.getMetrics)();
  9194. if (!(lookupName in Metrics)) {
  9195. if (this.isSerifFont(name)) {
  9196. lookupName = "Times-Roman";
  9197. } else {
  9198. lookupName = "Helvetica";
  9199. }
  9200. }
  9201. const glyphWidths = Metrics[lookupName];
  9202. if ((0, _util.isNum)(glyphWidths)) {
  9203. defaultWidth = glyphWidths;
  9204. monospace = true;
  9205. } else {
  9206. widths = glyphWidths();
  9207. }
  9208. return {
  9209. defaultWidth,
  9210. monospace,
  9211. widths
  9212. };
  9213. }
  9214. buildCharCodeToWidth(widthsByGlyphName, properties) {
  9215. const widths = Object.create(null);
  9216. const differences = properties.differences;
  9217. const encoding = properties.defaultEncoding;
  9218. for (let charCode = 0; charCode < 256; charCode++) {
  9219. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  9220. widths[charCode] = widthsByGlyphName[differences[charCode]];
  9221. continue;
  9222. }
  9223. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  9224. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  9225. continue;
  9226. }
  9227. }
  9228. return widths;
  9229. }
  9230. preEvaluateFont(dict) {
  9231. const baseDict = dict;
  9232. let type = dict.get("Subtype");
  9233. if (!(0, _primitives.isName)(type)) {
  9234. throw new _util.FormatError("invalid font Subtype");
  9235. }
  9236. let composite = false;
  9237. let hash, toUnicode;
  9238. if (type.name === "Type0") {
  9239. const df = dict.get("DescendantFonts");
  9240. if (!df) {
  9241. throw new _util.FormatError("Descendant fonts are not specified");
  9242. }
  9243. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  9244. if (!(dict instanceof _primitives.Dict)) {
  9245. throw new _util.FormatError("Descendant font is not a dictionary.");
  9246. }
  9247. type = dict.get("Subtype");
  9248. if (!(0, _primitives.isName)(type)) {
  9249. throw new _util.FormatError("invalid font Subtype");
  9250. }
  9251. composite = true;
  9252. }
  9253. const firstChar = dict.get("FirstChar") || 0,
  9254. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  9255. const descriptor = dict.get("FontDescriptor");
  9256. if (descriptor) {
  9257. hash = new _murmurhash.MurmurHash3_64();
  9258. const encoding = baseDict.getRaw("Encoding");
  9259. if ((0, _primitives.isName)(encoding)) {
  9260. hash.update(encoding.name);
  9261. } else if ((0, _primitives.isRef)(encoding)) {
  9262. hash.update(encoding.toString());
  9263. } else if ((0, _primitives.isDict)(encoding)) {
  9264. for (const entry of encoding.getRawValues()) {
  9265. if ((0, _primitives.isName)(entry)) {
  9266. hash.update(entry.name);
  9267. } else if ((0, _primitives.isRef)(entry)) {
  9268. hash.update(entry.toString());
  9269. } else if (Array.isArray(entry)) {
  9270. const diffLength = entry.length,
  9271. diffBuf = new Array(diffLength);
  9272. for (let j = 0; j < diffLength; j++) {
  9273. const diffEntry = entry[j];
  9274. if ((0, _primitives.isName)(diffEntry)) {
  9275. diffBuf[j] = diffEntry.name;
  9276. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  9277. diffBuf[j] = diffEntry.toString();
  9278. }
  9279. }
  9280. hash.update(diffBuf.join());
  9281. }
  9282. }
  9283. }
  9284. hash.update(`${firstChar}-${lastChar}`);
  9285. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  9286. if ((0, _primitives.isStream)(toUnicode)) {
  9287. const stream = toUnicode.str || toUnicode;
  9288. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  9289. hash.update(uint8array);
  9290. } else if ((0, _primitives.isName)(toUnicode)) {
  9291. hash.update(toUnicode.name);
  9292. }
  9293. const widths = dict.get("Widths") || baseDict.get("Widths");
  9294. if (Array.isArray(widths)) {
  9295. const widthsBuf = [];
  9296. for (const entry of widths) {
  9297. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  9298. widthsBuf.push(entry.toString());
  9299. }
  9300. }
  9301. hash.update(widthsBuf.join());
  9302. }
  9303. if (composite) {
  9304. hash.update("compositeFont");
  9305. const compositeWidths = dict.get("W") || baseDict.get("W");
  9306. if (Array.isArray(compositeWidths)) {
  9307. const widthsBuf = [];
  9308. for (const entry of compositeWidths) {
  9309. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  9310. widthsBuf.push(entry.toString());
  9311. } else if (Array.isArray(entry)) {
  9312. const subWidthsBuf = [];
  9313. for (const element of entry) {
  9314. if ((0, _util.isNum)(element) || (0, _primitives.isRef)(element)) {
  9315. subWidthsBuf.push(element.toString());
  9316. }
  9317. }
  9318. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  9319. }
  9320. }
  9321. hash.update(widthsBuf.join());
  9322. }
  9323. }
  9324. }
  9325. return {
  9326. descriptor,
  9327. dict,
  9328. baseDict,
  9329. composite,
  9330. type: type.name,
  9331. firstChar,
  9332. lastChar,
  9333. toUnicode,
  9334. hash: hash ? hash.hexdigest() : ""
  9335. };
  9336. }
  9337. async translateFont({
  9338. descriptor,
  9339. dict,
  9340. baseDict,
  9341. composite,
  9342. type,
  9343. firstChar,
  9344. lastChar,
  9345. toUnicode,
  9346. cssFontInfo
  9347. }) {
  9348. const isType3Font = type === "Type3";
  9349. let properties;
  9350. if (!descriptor) {
  9351. if (isType3Font) {
  9352. descriptor = new _primitives.Dict(null);
  9353. descriptor.set("FontName", _primitives.Name.get(type));
  9354. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  9355. } else {
  9356. let baseFontName = dict.get("BaseFont");
  9357. if (!(0, _primitives.isName)(baseFontName)) {
  9358. throw new _util.FormatError("Base font is not specified");
  9359. }
  9360. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  9361. const metrics = this.getBaseFontMetrics(baseFontName);
  9362. const fontNameWoStyle = baseFontName.split("-")[0];
  9363. 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);
  9364. properties = {
  9365. type,
  9366. name: baseFontName,
  9367. loadedName: baseDict.loadedName,
  9368. widths: metrics.widths,
  9369. defaultWidth: metrics.defaultWidth,
  9370. flags,
  9371. firstChar,
  9372. lastChar,
  9373. toUnicode,
  9374. xHeight: 0,
  9375. capHeight: 0,
  9376. italicAngle: 0,
  9377. isType3Font
  9378. };
  9379. const widths = dict.get("Widths");
  9380. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  9381. let file = null;
  9382. if (standardFontName) {
  9383. properties.isStandardFont = true;
  9384. file = await this.fetchStandardFontData(standardFontName);
  9385. properties.isInternalFont = !!file;
  9386. }
  9387. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  9388. if (widths) {
  9389. const glyphWidths = [];
  9390. let j = firstChar;
  9391. for (let i = 0, ii = widths.length; i < ii; i++) {
  9392. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  9393. }
  9394. newProperties.widths = glyphWidths;
  9395. } else {
  9396. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  9397. }
  9398. return new _fonts.Font(baseFontName, file, newProperties);
  9399. });
  9400. }
  9401. }
  9402. let fontName = descriptor.get("FontName");
  9403. let baseFont = dict.get("BaseFont");
  9404. if ((0, _util.isString)(fontName)) {
  9405. fontName = _primitives.Name.get(fontName);
  9406. }
  9407. if ((0, _util.isString)(baseFont)) {
  9408. baseFont = _primitives.Name.get(baseFont);
  9409. }
  9410. if (!isType3Font) {
  9411. const fontNameStr = fontName && fontName.name;
  9412. const baseFontStr = baseFont && baseFont.name;
  9413. if (fontNameStr !== baseFontStr) {
  9414. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  9415. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  9416. fontName = baseFont;
  9417. }
  9418. }
  9419. }
  9420. fontName = fontName || baseFont;
  9421. if (!(0, _primitives.isName)(fontName)) {
  9422. throw new _util.FormatError("invalid font name");
  9423. }
  9424. let fontFile, subtype, length1, length2, length3;
  9425. try {
  9426. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  9427. } catch (ex) {
  9428. if (!this.options.ignoreErrors) {
  9429. throw ex;
  9430. }
  9431. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  9432. fontFile = new _stream.NullStream();
  9433. }
  9434. let isStandardFont = false;
  9435. let isInternalFont = false;
  9436. let glyphScaleFactors = null;
  9437. if (fontFile) {
  9438. if (fontFile.dict) {
  9439. const subtypeEntry = fontFile.dict.get("Subtype");
  9440. if (subtypeEntry instanceof _primitives.Name) {
  9441. subtype = subtypeEntry.name;
  9442. }
  9443. length1 = fontFile.dict.get("Length1");
  9444. length2 = fontFile.dict.get("Length2");
  9445. length3 = fontFile.dict.get("Length3");
  9446. }
  9447. } else if (cssFontInfo) {
  9448. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  9449. if (standardFontName) {
  9450. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  9451. cssFontInfo.lineHeight = standardFontName.lineHeight || null;
  9452. glyphScaleFactors = standardFontName.factors || null;
  9453. fontFile = await this.fetchStandardFontData(standardFontName.name);
  9454. isInternalFont = !!fontFile;
  9455. type = "TrueType";
  9456. }
  9457. } else if (!isType3Font) {
  9458. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  9459. if (standardFontName) {
  9460. isStandardFont = true;
  9461. fontFile = await this.fetchStandardFontData(standardFontName);
  9462. isInternalFont = !!fontFile;
  9463. }
  9464. }
  9465. properties = {
  9466. type,
  9467. name: fontName.name,
  9468. subtype,
  9469. file: fontFile,
  9470. length1,
  9471. length2,
  9472. length3,
  9473. isStandardFont,
  9474. isInternalFont,
  9475. loadedName: baseDict.loadedName,
  9476. composite,
  9477. fixedPitch: false,
  9478. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  9479. firstChar,
  9480. lastChar,
  9481. toUnicode,
  9482. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  9483. ascent: descriptor.get("Ascent"),
  9484. descent: descriptor.get("Descent"),
  9485. xHeight: descriptor.get("XHeight") || 0,
  9486. capHeight: descriptor.get("CapHeight") || 0,
  9487. flags: descriptor.get("Flags"),
  9488. italicAngle: descriptor.get("ItalicAngle") || 0,
  9489. isType3Font,
  9490. cssFontInfo,
  9491. scaleFactors: glyphScaleFactors
  9492. };
  9493. if (composite) {
  9494. const cidEncoding = baseDict.get("Encoding");
  9495. if ((0, _primitives.isName)(cidEncoding)) {
  9496. properties.cidEncoding = cidEncoding.name;
  9497. }
  9498. const cMap = await _cmap.CMapFactory.create({
  9499. encoding: cidEncoding,
  9500. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  9501. useCMap: null
  9502. });
  9503. properties.cMap = cMap;
  9504. properties.vertical = properties.cMap.vertical;
  9505. }
  9506. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  9507. this.extractWidths(dict, descriptor, newProperties);
  9508. return new _fonts.Font(fontName.name, fontFile, newProperties);
  9509. });
  9510. }
  9511. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  9512. function buildPath(fontChar) {
  9513. const glyphName = `${font.loadedName}_path_${fontChar}`;
  9514. try {
  9515. if (font.renderer.hasBuiltPath(fontChar)) {
  9516. return;
  9517. }
  9518. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  9519. } catch (reason) {
  9520. if (evaluatorOptions.ignoreErrors) {
  9521. handler.send("UnsupportedFeature", {
  9522. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  9523. });
  9524. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  9525. return;
  9526. }
  9527. throw reason;
  9528. }
  9529. }
  9530. for (const glyph of glyphs) {
  9531. buildPath(glyph.fontChar);
  9532. const accent = glyph.accent;
  9533. if (accent && accent.fontChar) {
  9534. buildPath(accent.fontChar);
  9535. }
  9536. }
  9537. }
  9538. static get fallbackFontDict() {
  9539. const dict = new _primitives.Dict();
  9540. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  9541. dict.set("Type", _primitives.Name.get("FallbackType"));
  9542. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9543. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9544. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9545. }
  9546. }
  9547. exports.PartialEvaluator = PartialEvaluator;
  9548. class TranslatedFont {
  9549. constructor({
  9550. loadedName,
  9551. font,
  9552. dict,
  9553. evaluatorOptions
  9554. }) {
  9555. this.loadedName = loadedName;
  9556. this.font = font;
  9557. this.dict = dict;
  9558. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  9559. this.type3Loaded = null;
  9560. this.type3Dependencies = font.isType3Font ? new Set() : null;
  9561. this.sent = false;
  9562. }
  9563. send(handler) {
  9564. if (this.sent) {
  9565. return;
  9566. }
  9567. this.sent = true;
  9568. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  9569. }
  9570. fallback(handler) {
  9571. if (!this.font.data) {
  9572. return;
  9573. }
  9574. this.font.disableFontFace = true;
  9575. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  9576. }
  9577. loadType3Data(evaluator, resources, task) {
  9578. if (this.type3Loaded) {
  9579. return this.type3Loaded;
  9580. }
  9581. if (!this.font.isType3Font) {
  9582. throw new Error("Must be a Type3 font.");
  9583. }
  9584. const type3Evaluator = evaluator.clone({
  9585. ignoreErrors: false
  9586. });
  9587. type3Evaluator.parsingType3Font = true;
  9588. const translatedFont = this.font,
  9589. type3Dependencies = this.type3Dependencies;
  9590. let loadCharProcsPromise = Promise.resolve();
  9591. const charProcs = this.dict.get("CharProcs");
  9592. const fontResources = this.dict.get("Resources") || resources;
  9593. const charProcOperatorList = Object.create(null);
  9594. const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]);
  9595. for (const key of charProcs.getKeys()) {
  9596. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  9597. const glyphStream = charProcs.get(key);
  9598. const operatorList = new _operator_list.OperatorList();
  9599. return type3Evaluator.getOperatorList({
  9600. stream: glyphStream,
  9601. task,
  9602. resources: fontResources,
  9603. operatorList
  9604. }).then(() => {
  9605. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  9606. this._removeType3ColorOperators(operatorList, isEmptyBBox);
  9607. }
  9608. charProcOperatorList[key] = operatorList.getIR();
  9609. for (const dependency of operatorList.dependencies) {
  9610. type3Dependencies.add(dependency);
  9611. }
  9612. }).catch(function (reason) {
  9613. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  9614. const dummyOperatorList = new _operator_list.OperatorList();
  9615. charProcOperatorList[key] = dummyOperatorList.getIR();
  9616. });
  9617. });
  9618. }
  9619. this.type3Loaded = loadCharProcsPromise.then(() => {
  9620. translatedFont.charProcOperatorList = charProcOperatorList;
  9621. if (this._bbox) {
  9622. translatedFont.isCharBBox = true;
  9623. translatedFont.bbox = this._bbox;
  9624. }
  9625. });
  9626. return this.type3Loaded;
  9627. }
  9628. _removeType3ColorOperators(operatorList, isEmptyBBox = false) {
  9629. if (isEmptyBBox) {
  9630. if (!this._bbox) {
  9631. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9632. }
  9633. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2));
  9634. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  9635. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  9636. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  9637. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  9638. }
  9639. let i = 1,
  9640. ii = operatorList.length;
  9641. while (i < ii) {
  9642. switch (operatorList.fnArray[i]) {
  9643. case _util.OPS.setStrokeColorSpace:
  9644. case _util.OPS.setFillColorSpace:
  9645. case _util.OPS.setStrokeColor:
  9646. case _util.OPS.setStrokeColorN:
  9647. case _util.OPS.setFillColor:
  9648. case _util.OPS.setFillColorN:
  9649. case _util.OPS.setStrokeGray:
  9650. case _util.OPS.setFillGray:
  9651. case _util.OPS.setStrokeRGBColor:
  9652. case _util.OPS.setFillRGBColor:
  9653. case _util.OPS.setStrokeCMYKColor:
  9654. case _util.OPS.setFillCMYKColor:
  9655. case _util.OPS.shadingFill:
  9656. case _util.OPS.setRenderingIntent:
  9657. operatorList.fnArray.splice(i, 1);
  9658. operatorList.argsArray.splice(i, 1);
  9659. ii--;
  9660. continue;
  9661. case _util.OPS.setGState:
  9662. const [gStateObj] = operatorList.argsArray[i];
  9663. let j = 0,
  9664. jj = gStateObj.length;
  9665. while (j < jj) {
  9666. const [gStateKey] = gStateObj[j];
  9667. switch (gStateKey) {
  9668. case "TR":
  9669. case "TR2":
  9670. case "HT":
  9671. case "BG":
  9672. case "BG2":
  9673. case "UCR":
  9674. case "UCR2":
  9675. gStateObj.splice(j, 1);
  9676. jj--;
  9677. continue;
  9678. }
  9679. j++;
  9680. }
  9681. break;
  9682. }
  9683. i++;
  9684. }
  9685. }
  9686. }
  9687. class StateManager {
  9688. constructor(initialState = new EvalState()) {
  9689. this.state = initialState;
  9690. this.stateStack = [];
  9691. }
  9692. save() {
  9693. const old = this.state;
  9694. this.stateStack.push(this.state);
  9695. this.state = old.clone();
  9696. }
  9697. restore() {
  9698. const prev = this.stateStack.pop();
  9699. if (prev) {
  9700. this.state = prev;
  9701. }
  9702. }
  9703. transform(args) {
  9704. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  9705. }
  9706. }
  9707. class TextState {
  9708. constructor() {
  9709. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  9710. this.fontName = null;
  9711. this.fontSize = 0;
  9712. this.font = null;
  9713. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  9714. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  9715. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  9716. this.charSpacing = 0;
  9717. this.wordSpacing = 0;
  9718. this.leading = 0;
  9719. this.textHScale = 1;
  9720. this.textRise = 0;
  9721. }
  9722. setTextMatrix(a, b, c, d, e, f) {
  9723. const m = this.textMatrix;
  9724. m[0] = a;
  9725. m[1] = b;
  9726. m[2] = c;
  9727. m[3] = d;
  9728. m[4] = e;
  9729. m[5] = f;
  9730. }
  9731. setTextLineMatrix(a, b, c, d, e, f) {
  9732. const m = this.textLineMatrix;
  9733. m[0] = a;
  9734. m[1] = b;
  9735. m[2] = c;
  9736. m[3] = d;
  9737. m[4] = e;
  9738. m[5] = f;
  9739. }
  9740. translateTextMatrix(x, y) {
  9741. const m = this.textMatrix;
  9742. m[4] = m[0] * x + m[2] * y + m[4];
  9743. m[5] = m[1] * x + m[3] * y + m[5];
  9744. }
  9745. translateTextLineMatrix(x, y) {
  9746. const m = this.textLineMatrix;
  9747. m[4] = m[0] * x + m[2] * y + m[4];
  9748. m[5] = m[1] * x + m[3] * y + m[5];
  9749. }
  9750. carriageReturn() {
  9751. this.translateTextLineMatrix(0, -this.leading);
  9752. this.textMatrix = this.textLineMatrix.slice();
  9753. }
  9754. clone() {
  9755. const clone = Object.create(this);
  9756. clone.textMatrix = this.textMatrix.slice();
  9757. clone.textLineMatrix = this.textLineMatrix.slice();
  9758. clone.fontMatrix = this.fontMatrix.slice();
  9759. return clone;
  9760. }
  9761. }
  9762. class EvalState {
  9763. constructor() {
  9764. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  9765. this.font = null;
  9766. this.textRenderingMode = _util.TextRenderingMode.FILL;
  9767. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9768. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9769. }
  9770. clone() {
  9771. return Object.create(this);
  9772. }
  9773. }
  9774. class EvaluatorPreprocessor {
  9775. static get opMap() {
  9776. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  9777. t.w = {
  9778. id: _util.OPS.setLineWidth,
  9779. numArgs: 1,
  9780. variableArgs: false
  9781. };
  9782. t.J = {
  9783. id: _util.OPS.setLineCap,
  9784. numArgs: 1,
  9785. variableArgs: false
  9786. };
  9787. t.j = {
  9788. id: _util.OPS.setLineJoin,
  9789. numArgs: 1,
  9790. variableArgs: false
  9791. };
  9792. t.M = {
  9793. id: _util.OPS.setMiterLimit,
  9794. numArgs: 1,
  9795. variableArgs: false
  9796. };
  9797. t.d = {
  9798. id: _util.OPS.setDash,
  9799. numArgs: 2,
  9800. variableArgs: false
  9801. };
  9802. t.ri = {
  9803. id: _util.OPS.setRenderingIntent,
  9804. numArgs: 1,
  9805. variableArgs: false
  9806. };
  9807. t.i = {
  9808. id: _util.OPS.setFlatness,
  9809. numArgs: 1,
  9810. variableArgs: false
  9811. };
  9812. t.gs = {
  9813. id: _util.OPS.setGState,
  9814. numArgs: 1,
  9815. variableArgs: false
  9816. };
  9817. t.q = {
  9818. id: _util.OPS.save,
  9819. numArgs: 0,
  9820. variableArgs: false
  9821. };
  9822. t.Q = {
  9823. id: _util.OPS.restore,
  9824. numArgs: 0,
  9825. variableArgs: false
  9826. };
  9827. t.cm = {
  9828. id: _util.OPS.transform,
  9829. numArgs: 6,
  9830. variableArgs: false
  9831. };
  9832. t.m = {
  9833. id: _util.OPS.moveTo,
  9834. numArgs: 2,
  9835. variableArgs: false
  9836. };
  9837. t.l = {
  9838. id: _util.OPS.lineTo,
  9839. numArgs: 2,
  9840. variableArgs: false
  9841. };
  9842. t.c = {
  9843. id: _util.OPS.curveTo,
  9844. numArgs: 6,
  9845. variableArgs: false
  9846. };
  9847. t.v = {
  9848. id: _util.OPS.curveTo2,
  9849. numArgs: 4,
  9850. variableArgs: false
  9851. };
  9852. t.y = {
  9853. id: _util.OPS.curveTo3,
  9854. numArgs: 4,
  9855. variableArgs: false
  9856. };
  9857. t.h = {
  9858. id: _util.OPS.closePath,
  9859. numArgs: 0,
  9860. variableArgs: false
  9861. };
  9862. t.re = {
  9863. id: _util.OPS.rectangle,
  9864. numArgs: 4,
  9865. variableArgs: false
  9866. };
  9867. t.S = {
  9868. id: _util.OPS.stroke,
  9869. numArgs: 0,
  9870. variableArgs: false
  9871. };
  9872. t.s = {
  9873. id: _util.OPS.closeStroke,
  9874. numArgs: 0,
  9875. variableArgs: false
  9876. };
  9877. t.f = {
  9878. id: _util.OPS.fill,
  9879. numArgs: 0,
  9880. variableArgs: false
  9881. };
  9882. t.F = {
  9883. id: _util.OPS.fill,
  9884. numArgs: 0,
  9885. variableArgs: false
  9886. };
  9887. t["f*"] = {
  9888. id: _util.OPS.eoFill,
  9889. numArgs: 0,
  9890. variableArgs: false
  9891. };
  9892. t.B = {
  9893. id: _util.OPS.fillStroke,
  9894. numArgs: 0,
  9895. variableArgs: false
  9896. };
  9897. t["B*"] = {
  9898. id: _util.OPS.eoFillStroke,
  9899. numArgs: 0,
  9900. variableArgs: false
  9901. };
  9902. t.b = {
  9903. id: _util.OPS.closeFillStroke,
  9904. numArgs: 0,
  9905. variableArgs: false
  9906. };
  9907. t["b*"] = {
  9908. id: _util.OPS.closeEOFillStroke,
  9909. numArgs: 0,
  9910. variableArgs: false
  9911. };
  9912. t.n = {
  9913. id: _util.OPS.endPath,
  9914. numArgs: 0,
  9915. variableArgs: false
  9916. };
  9917. t.W = {
  9918. id: _util.OPS.clip,
  9919. numArgs: 0,
  9920. variableArgs: false
  9921. };
  9922. t["W*"] = {
  9923. id: _util.OPS.eoClip,
  9924. numArgs: 0,
  9925. variableArgs: false
  9926. };
  9927. t.BT = {
  9928. id: _util.OPS.beginText,
  9929. numArgs: 0,
  9930. variableArgs: false
  9931. };
  9932. t.ET = {
  9933. id: _util.OPS.endText,
  9934. numArgs: 0,
  9935. variableArgs: false
  9936. };
  9937. t.Tc = {
  9938. id: _util.OPS.setCharSpacing,
  9939. numArgs: 1,
  9940. variableArgs: false
  9941. };
  9942. t.Tw = {
  9943. id: _util.OPS.setWordSpacing,
  9944. numArgs: 1,
  9945. variableArgs: false
  9946. };
  9947. t.Tz = {
  9948. id: _util.OPS.setHScale,
  9949. numArgs: 1,
  9950. variableArgs: false
  9951. };
  9952. t.TL = {
  9953. id: _util.OPS.setLeading,
  9954. numArgs: 1,
  9955. variableArgs: false
  9956. };
  9957. t.Tf = {
  9958. id: _util.OPS.setFont,
  9959. numArgs: 2,
  9960. variableArgs: false
  9961. };
  9962. t.Tr = {
  9963. id: _util.OPS.setTextRenderingMode,
  9964. numArgs: 1,
  9965. variableArgs: false
  9966. };
  9967. t.Ts = {
  9968. id: _util.OPS.setTextRise,
  9969. numArgs: 1,
  9970. variableArgs: false
  9971. };
  9972. t.Td = {
  9973. id: _util.OPS.moveText,
  9974. numArgs: 2,
  9975. variableArgs: false
  9976. };
  9977. t.TD = {
  9978. id: _util.OPS.setLeadingMoveText,
  9979. numArgs: 2,
  9980. variableArgs: false
  9981. };
  9982. t.Tm = {
  9983. id: _util.OPS.setTextMatrix,
  9984. numArgs: 6,
  9985. variableArgs: false
  9986. };
  9987. t["T*"] = {
  9988. id: _util.OPS.nextLine,
  9989. numArgs: 0,
  9990. variableArgs: false
  9991. };
  9992. t.Tj = {
  9993. id: _util.OPS.showText,
  9994. numArgs: 1,
  9995. variableArgs: false
  9996. };
  9997. t.TJ = {
  9998. id: _util.OPS.showSpacedText,
  9999. numArgs: 1,
  10000. variableArgs: false
  10001. };
  10002. t["'"] = {
  10003. id: _util.OPS.nextLineShowText,
  10004. numArgs: 1,
  10005. variableArgs: false
  10006. };
  10007. t['"'] = {
  10008. id: _util.OPS.nextLineSetSpacingShowText,
  10009. numArgs: 3,
  10010. variableArgs: false
  10011. };
  10012. t.d0 = {
  10013. id: _util.OPS.setCharWidth,
  10014. numArgs: 2,
  10015. variableArgs: false
  10016. };
  10017. t.d1 = {
  10018. id: _util.OPS.setCharWidthAndBounds,
  10019. numArgs: 6,
  10020. variableArgs: false
  10021. };
  10022. t.CS = {
  10023. id: _util.OPS.setStrokeColorSpace,
  10024. numArgs: 1,
  10025. variableArgs: false
  10026. };
  10027. t.cs = {
  10028. id: _util.OPS.setFillColorSpace,
  10029. numArgs: 1,
  10030. variableArgs: false
  10031. };
  10032. t.SC = {
  10033. id: _util.OPS.setStrokeColor,
  10034. numArgs: 4,
  10035. variableArgs: true
  10036. };
  10037. t.SCN = {
  10038. id: _util.OPS.setStrokeColorN,
  10039. numArgs: 33,
  10040. variableArgs: true
  10041. };
  10042. t.sc = {
  10043. id: _util.OPS.setFillColor,
  10044. numArgs: 4,
  10045. variableArgs: true
  10046. };
  10047. t.scn = {
  10048. id: _util.OPS.setFillColorN,
  10049. numArgs: 33,
  10050. variableArgs: true
  10051. };
  10052. t.G = {
  10053. id: _util.OPS.setStrokeGray,
  10054. numArgs: 1,
  10055. variableArgs: false
  10056. };
  10057. t.g = {
  10058. id: _util.OPS.setFillGray,
  10059. numArgs: 1,
  10060. variableArgs: false
  10061. };
  10062. t.RG = {
  10063. id: _util.OPS.setStrokeRGBColor,
  10064. numArgs: 3,
  10065. variableArgs: false
  10066. };
  10067. t.rg = {
  10068. id: _util.OPS.setFillRGBColor,
  10069. numArgs: 3,
  10070. variableArgs: false
  10071. };
  10072. t.K = {
  10073. id: _util.OPS.setStrokeCMYKColor,
  10074. numArgs: 4,
  10075. variableArgs: false
  10076. };
  10077. t.k = {
  10078. id: _util.OPS.setFillCMYKColor,
  10079. numArgs: 4,
  10080. variableArgs: false
  10081. };
  10082. t.sh = {
  10083. id: _util.OPS.shadingFill,
  10084. numArgs: 1,
  10085. variableArgs: false
  10086. };
  10087. t.BI = {
  10088. id: _util.OPS.beginInlineImage,
  10089. numArgs: 0,
  10090. variableArgs: false
  10091. };
  10092. t.ID = {
  10093. id: _util.OPS.beginImageData,
  10094. numArgs: 0,
  10095. variableArgs: false
  10096. };
  10097. t.EI = {
  10098. id: _util.OPS.endInlineImage,
  10099. numArgs: 1,
  10100. variableArgs: false
  10101. };
  10102. t.Do = {
  10103. id: _util.OPS.paintXObject,
  10104. numArgs: 1,
  10105. variableArgs: false
  10106. };
  10107. t.MP = {
  10108. id: _util.OPS.markPoint,
  10109. numArgs: 1,
  10110. variableArgs: false
  10111. };
  10112. t.DP = {
  10113. id: _util.OPS.markPointProps,
  10114. numArgs: 2,
  10115. variableArgs: false
  10116. };
  10117. t.BMC = {
  10118. id: _util.OPS.beginMarkedContent,
  10119. numArgs: 1,
  10120. variableArgs: false
  10121. };
  10122. t.BDC = {
  10123. id: _util.OPS.beginMarkedContentProps,
  10124. numArgs: 2,
  10125. variableArgs: false
  10126. };
  10127. t.EMC = {
  10128. id: _util.OPS.endMarkedContent,
  10129. numArgs: 0,
  10130. variableArgs: false
  10131. };
  10132. t.BX = {
  10133. id: _util.OPS.beginCompat,
  10134. numArgs: 0,
  10135. variableArgs: false
  10136. };
  10137. t.EX = {
  10138. id: _util.OPS.endCompat,
  10139. numArgs: 0,
  10140. variableArgs: false
  10141. };
  10142. t.BM = null;
  10143. t.BD = null;
  10144. t.true = null;
  10145. t.fa = null;
  10146. t.fal = null;
  10147. t.fals = null;
  10148. t.false = null;
  10149. t.nu = null;
  10150. t.nul = null;
  10151. t.null = null;
  10152. });
  10153. return (0, _util.shadow)(this, "opMap", getOPMap());
  10154. }
  10155. static get MAX_INVALID_PATH_OPS() {
  10156. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20);
  10157. }
  10158. constructor(stream, xref, stateManager = new StateManager()) {
  10159. this.parser = new _parser.Parser({
  10160. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  10161. xref
  10162. });
  10163. this.stateManager = stateManager;
  10164. this.nonProcessedArgs = [];
  10165. this._numInvalidPathOPS = 0;
  10166. }
  10167. get savedStatesDepth() {
  10168. return this.stateManager.stateStack.length;
  10169. }
  10170. read(operation) {
  10171. let args = operation.args;
  10172. while (true) {
  10173. const obj = this.parser.getObj();
  10174. if (obj instanceof _primitives.Cmd) {
  10175. const cmd = obj.cmd;
  10176. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  10177. if (!opSpec) {
  10178. (0, _util.warn)(`Unknown command "${cmd}".`);
  10179. continue;
  10180. }
  10181. const fn = opSpec.id;
  10182. const numArgs = opSpec.numArgs;
  10183. let argsLength = args !== null ? args.length : 0;
  10184. if (!opSpec.variableArgs) {
  10185. if (argsLength !== numArgs) {
  10186. const nonProcessedArgs = this.nonProcessedArgs;
  10187. while (argsLength > numArgs) {
  10188. nonProcessedArgs.push(args.shift());
  10189. argsLength--;
  10190. }
  10191. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  10192. if (args === null) {
  10193. args = [];
  10194. }
  10195. args.unshift(nonProcessedArgs.pop());
  10196. argsLength++;
  10197. }
  10198. }
  10199. if (argsLength < numArgs) {
  10200. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  10201. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  10202. throw new _util.FormatError(`Invalid ${partialMsg}`);
  10203. }
  10204. (0, _util.warn)(`Skipping ${partialMsg}`);
  10205. if (args !== null) {
  10206. args.length = 0;
  10207. }
  10208. continue;
  10209. }
  10210. } else if (argsLength > numArgs) {
  10211. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  10212. }
  10213. this.preprocessCommand(fn, args);
  10214. operation.fn = fn;
  10215. operation.args = args;
  10216. return true;
  10217. }
  10218. if (obj === _primitives.EOF) {
  10219. return false;
  10220. }
  10221. if (obj !== null) {
  10222. if (args === null) {
  10223. args = [];
  10224. }
  10225. args.push(obj);
  10226. if (args.length > 33) {
  10227. throw new _util.FormatError("Too many arguments");
  10228. }
  10229. }
  10230. }
  10231. }
  10232. preprocessCommand(fn, args) {
  10233. switch (fn | 0) {
  10234. case _util.OPS.save:
  10235. this.stateManager.save();
  10236. break;
  10237. case _util.OPS.restore:
  10238. this.stateManager.restore();
  10239. break;
  10240. case _util.OPS.transform:
  10241. this.stateManager.transform(args);
  10242. break;
  10243. }
  10244. }
  10245. }
  10246. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  10247. /***/ }),
  10248. /* 16 */
  10249. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10250. Object.defineProperty(exports, "__esModule", ({
  10251. value: true
  10252. }));
  10253. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  10254. var _util = __w_pdfjs_require__(2);
  10255. var _primitives = __w_pdfjs_require__(5);
  10256. var _parser = __w_pdfjs_require__(17);
  10257. var _core_utils = __w_pdfjs_require__(9);
  10258. var _stream = __w_pdfjs_require__(10);
  10259. 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"];
  10260. const MAX_MAP_RANGE = 2 ** 24 - 1;
  10261. class CMap {
  10262. constructor(builtInCMap = false) {
  10263. this.codespaceRanges = [[], [], [], []];
  10264. this.numCodespaceRanges = 0;
  10265. this._map = [];
  10266. this.name = "";
  10267. this.vertical = false;
  10268. this.useCMap = null;
  10269. this.builtInCMap = builtInCMap;
  10270. }
  10271. addCodespaceRange(n, low, high) {
  10272. this.codespaceRanges[n - 1].push(low, high);
  10273. this.numCodespaceRanges++;
  10274. }
  10275. mapCidRange(low, high, dstLow) {
  10276. if (high - low > MAX_MAP_RANGE) {
  10277. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  10278. }
  10279. while (low <= high) {
  10280. this._map[low++] = dstLow++;
  10281. }
  10282. }
  10283. mapBfRange(low, high, dstLow) {
  10284. if (high - low > MAX_MAP_RANGE) {
  10285. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  10286. }
  10287. const lastByte = dstLow.length - 1;
  10288. while (low <= high) {
  10289. this._map[low++] = dstLow;
  10290. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  10291. }
  10292. }
  10293. mapBfRangeToArray(low, high, array) {
  10294. if (high - low > MAX_MAP_RANGE) {
  10295. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  10296. }
  10297. const ii = array.length;
  10298. let i = 0;
  10299. while (low <= high && i < ii) {
  10300. this._map[low] = array[i++];
  10301. ++low;
  10302. }
  10303. }
  10304. mapOne(src, dst) {
  10305. this._map[src] = dst;
  10306. }
  10307. lookup(code) {
  10308. return this._map[code];
  10309. }
  10310. contains(code) {
  10311. return this._map[code] !== undefined;
  10312. }
  10313. forEach(callback) {
  10314. const map = this._map;
  10315. const length = map.length;
  10316. if (length <= 0x10000) {
  10317. for (let i = 0; i < length; i++) {
  10318. if (map[i] !== undefined) {
  10319. callback(i, map[i]);
  10320. }
  10321. }
  10322. } else {
  10323. for (const i in map) {
  10324. callback(i, map[i]);
  10325. }
  10326. }
  10327. }
  10328. charCodeOf(value) {
  10329. const map = this._map;
  10330. if (map.length <= 0x10000) {
  10331. return map.indexOf(value);
  10332. }
  10333. for (const charCode in map) {
  10334. if (map[charCode] === value) {
  10335. return charCode | 0;
  10336. }
  10337. }
  10338. return -1;
  10339. }
  10340. getMap() {
  10341. return this._map;
  10342. }
  10343. readCharCode(str, offset, out) {
  10344. let c = 0;
  10345. const codespaceRanges = this.codespaceRanges;
  10346. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  10347. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  10348. const codespaceRange = codespaceRanges[n];
  10349. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  10350. const low = codespaceRange[k++];
  10351. const high = codespaceRange[k++];
  10352. if (c >= low && c <= high) {
  10353. out.charcode = c;
  10354. out.length = n + 1;
  10355. return;
  10356. }
  10357. }
  10358. }
  10359. out.charcode = 0;
  10360. out.length = 1;
  10361. }
  10362. getCharCodeLength(charCode) {
  10363. const codespaceRanges = this.codespaceRanges;
  10364. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  10365. const codespaceRange = codespaceRanges[n];
  10366. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  10367. const low = codespaceRange[k++];
  10368. const high = codespaceRange[k++];
  10369. if (charCode >= low && charCode <= high) {
  10370. return n + 1;
  10371. }
  10372. }
  10373. }
  10374. return 1;
  10375. }
  10376. get length() {
  10377. return this._map.length;
  10378. }
  10379. get isIdentityCMap() {
  10380. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  10381. return false;
  10382. }
  10383. if (this._map.length !== 0x10000) {
  10384. return false;
  10385. }
  10386. for (let i = 0; i < 0x10000; i++) {
  10387. if (this._map[i] !== i) {
  10388. return false;
  10389. }
  10390. }
  10391. return true;
  10392. }
  10393. }
  10394. exports.CMap = CMap;
  10395. class IdentityCMap extends CMap {
  10396. constructor(vertical, n) {
  10397. super();
  10398. this.vertical = vertical;
  10399. this.addCodespaceRange(n, 0, 0xffff);
  10400. }
  10401. mapCidRange(low, high, dstLow) {
  10402. (0, _util.unreachable)("should not call mapCidRange");
  10403. }
  10404. mapBfRange(low, high, dstLow) {
  10405. (0, _util.unreachable)("should not call mapBfRange");
  10406. }
  10407. mapBfRangeToArray(low, high, array) {
  10408. (0, _util.unreachable)("should not call mapBfRangeToArray");
  10409. }
  10410. mapOne(src, dst) {
  10411. (0, _util.unreachable)("should not call mapCidOne");
  10412. }
  10413. lookup(code) {
  10414. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  10415. }
  10416. contains(code) {
  10417. return Number.isInteger(code) && code <= 0xffff;
  10418. }
  10419. forEach(callback) {
  10420. for (let i = 0; i <= 0xffff; i++) {
  10421. callback(i, i);
  10422. }
  10423. }
  10424. charCodeOf(value) {
  10425. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  10426. }
  10427. getMap() {
  10428. const map = new Array(0x10000);
  10429. for (let i = 0; i <= 0xffff; i++) {
  10430. map[i] = i;
  10431. }
  10432. return map;
  10433. }
  10434. get length() {
  10435. return 0x10000;
  10436. }
  10437. get isIdentityCMap() {
  10438. (0, _util.unreachable)("should not access .isIdentityCMap");
  10439. }
  10440. }
  10441. exports.IdentityCMap = IdentityCMap;
  10442. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  10443. function hexToInt(a, size) {
  10444. let n = 0;
  10445. for (let i = 0; i <= size; i++) {
  10446. n = n << 8 | a[i];
  10447. }
  10448. return n >>> 0;
  10449. }
  10450. function hexToStr(a, size) {
  10451. if (size === 1) {
  10452. return String.fromCharCode(a[0], a[1]);
  10453. }
  10454. if (size === 3) {
  10455. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  10456. }
  10457. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  10458. }
  10459. function addHex(a, b, size) {
  10460. let c = 0;
  10461. for (let i = size; i >= 0; i--) {
  10462. c += a[i] + b[i];
  10463. a[i] = c & 255;
  10464. c >>= 8;
  10465. }
  10466. }
  10467. function incHex(a, size) {
  10468. let c = 1;
  10469. for (let i = size; i >= 0 && c > 0; i--) {
  10470. c += a[i];
  10471. a[i] = c & 255;
  10472. c >>= 8;
  10473. }
  10474. }
  10475. const MAX_NUM_SIZE = 16;
  10476. const MAX_ENCODED_NUM_SIZE = 19;
  10477. class BinaryCMapStream {
  10478. constructor(data) {
  10479. this.buffer = data;
  10480. this.pos = 0;
  10481. this.end = data.length;
  10482. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  10483. }
  10484. readByte() {
  10485. if (this.pos >= this.end) {
  10486. return -1;
  10487. }
  10488. return this.buffer[this.pos++];
  10489. }
  10490. readNumber() {
  10491. let n = 0;
  10492. let last;
  10493. do {
  10494. const b = this.readByte();
  10495. if (b < 0) {
  10496. throw new _util.FormatError("unexpected EOF in bcmap");
  10497. }
  10498. last = !(b & 0x80);
  10499. n = n << 7 | b & 0x7f;
  10500. } while (!last);
  10501. return n;
  10502. }
  10503. readSigned() {
  10504. const n = this.readNumber();
  10505. return n & 1 ? ~(n >>> 1) : n >>> 1;
  10506. }
  10507. readHex(num, size) {
  10508. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  10509. this.pos += size + 1;
  10510. }
  10511. readHexNumber(num, size) {
  10512. let last;
  10513. const stack = this.tmpBuf;
  10514. let sp = 0;
  10515. do {
  10516. const b = this.readByte();
  10517. if (b < 0) {
  10518. throw new _util.FormatError("unexpected EOF in bcmap");
  10519. }
  10520. last = !(b & 0x80);
  10521. stack[sp++] = b & 0x7f;
  10522. } while (!last);
  10523. let i = size,
  10524. buffer = 0,
  10525. bufferSize = 0;
  10526. while (i >= 0) {
  10527. while (bufferSize < 8 && stack.length > 0) {
  10528. buffer |= stack[--sp] << bufferSize;
  10529. bufferSize += 7;
  10530. }
  10531. num[i] = buffer & 255;
  10532. i--;
  10533. buffer >>= 8;
  10534. bufferSize -= 8;
  10535. }
  10536. }
  10537. readHexSigned(num, size) {
  10538. this.readHexNumber(num, size);
  10539. const sign = num[size] & 1 ? 255 : 0;
  10540. let c = 0;
  10541. for (let i = 0; i <= size; i++) {
  10542. c = (c & 1) << 8 | num[i];
  10543. num[i] = c >> 1 ^ sign;
  10544. }
  10545. }
  10546. readString() {
  10547. const len = this.readNumber();
  10548. let s = "";
  10549. for (let i = 0; i < len; i++) {
  10550. s += String.fromCharCode(this.readNumber());
  10551. }
  10552. return s;
  10553. }
  10554. }
  10555. class BinaryCMapReader {
  10556. async process(data, cMap, extend) {
  10557. const stream = new BinaryCMapStream(data);
  10558. const header = stream.readByte();
  10559. cMap.vertical = !!(header & 1);
  10560. let useCMap = null;
  10561. const start = new Uint8Array(MAX_NUM_SIZE);
  10562. const end = new Uint8Array(MAX_NUM_SIZE);
  10563. const char = new Uint8Array(MAX_NUM_SIZE);
  10564. const charCode = new Uint8Array(MAX_NUM_SIZE);
  10565. const tmp = new Uint8Array(MAX_NUM_SIZE);
  10566. let code;
  10567. let b;
  10568. while ((b = stream.readByte()) >= 0) {
  10569. const type = b >> 5;
  10570. if (type === 7) {
  10571. switch (b & 0x1f) {
  10572. case 0:
  10573. stream.readString();
  10574. break;
  10575. case 1:
  10576. useCMap = stream.readString();
  10577. break;
  10578. }
  10579. continue;
  10580. }
  10581. const sequence = !!(b & 0x10);
  10582. const dataSize = b & 15;
  10583. if (dataSize + 1 > MAX_NUM_SIZE) {
  10584. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  10585. }
  10586. const ucs2DataSize = 1;
  10587. const subitemsCount = stream.readNumber();
  10588. switch (type) {
  10589. case 0:
  10590. stream.readHex(start, dataSize);
  10591. stream.readHexNumber(end, dataSize);
  10592. addHex(end, start, dataSize);
  10593. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  10594. for (let i = 1; i < subitemsCount; i++) {
  10595. incHex(end, dataSize);
  10596. stream.readHexNumber(start, dataSize);
  10597. addHex(start, end, dataSize);
  10598. stream.readHexNumber(end, dataSize);
  10599. addHex(end, start, dataSize);
  10600. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  10601. }
  10602. break;
  10603. case 1:
  10604. stream.readHex(start, dataSize);
  10605. stream.readHexNumber(end, dataSize);
  10606. addHex(end, start, dataSize);
  10607. stream.readNumber();
  10608. for (let i = 1; i < subitemsCount; i++) {
  10609. incHex(end, dataSize);
  10610. stream.readHexNumber(start, dataSize);
  10611. addHex(start, end, dataSize);
  10612. stream.readHexNumber(end, dataSize);
  10613. addHex(end, start, dataSize);
  10614. stream.readNumber();
  10615. }
  10616. break;
  10617. case 2:
  10618. stream.readHex(char, dataSize);
  10619. code = stream.readNumber();
  10620. cMap.mapOne(hexToInt(char, dataSize), code);
  10621. for (let i = 1; i < subitemsCount; i++) {
  10622. incHex(char, dataSize);
  10623. if (!sequence) {
  10624. stream.readHexNumber(tmp, dataSize);
  10625. addHex(char, tmp, dataSize);
  10626. }
  10627. code = stream.readSigned() + (code + 1);
  10628. cMap.mapOne(hexToInt(char, dataSize), code);
  10629. }
  10630. break;
  10631. case 3:
  10632. stream.readHex(start, dataSize);
  10633. stream.readHexNumber(end, dataSize);
  10634. addHex(end, start, dataSize);
  10635. code = stream.readNumber();
  10636. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  10637. for (let i = 1; i < subitemsCount; i++) {
  10638. incHex(end, dataSize);
  10639. if (!sequence) {
  10640. stream.readHexNumber(start, dataSize);
  10641. addHex(start, end, dataSize);
  10642. } else {
  10643. start.set(end);
  10644. }
  10645. stream.readHexNumber(end, dataSize);
  10646. addHex(end, start, dataSize);
  10647. code = stream.readNumber();
  10648. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  10649. }
  10650. break;
  10651. case 4:
  10652. stream.readHex(char, ucs2DataSize);
  10653. stream.readHex(charCode, dataSize);
  10654. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  10655. for (let i = 1; i < subitemsCount; i++) {
  10656. incHex(char, ucs2DataSize);
  10657. if (!sequence) {
  10658. stream.readHexNumber(tmp, ucs2DataSize);
  10659. addHex(char, tmp, ucs2DataSize);
  10660. }
  10661. incHex(charCode, dataSize);
  10662. stream.readHexSigned(tmp, dataSize);
  10663. addHex(charCode, tmp, dataSize);
  10664. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  10665. }
  10666. break;
  10667. case 5:
  10668. stream.readHex(start, ucs2DataSize);
  10669. stream.readHexNumber(end, ucs2DataSize);
  10670. addHex(end, start, ucs2DataSize);
  10671. stream.readHex(charCode, dataSize);
  10672. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  10673. for (let i = 1; i < subitemsCount; i++) {
  10674. incHex(end, ucs2DataSize);
  10675. if (!sequence) {
  10676. stream.readHexNumber(start, ucs2DataSize);
  10677. addHex(start, end, ucs2DataSize);
  10678. } else {
  10679. start.set(end);
  10680. }
  10681. stream.readHexNumber(end, ucs2DataSize);
  10682. addHex(end, start, ucs2DataSize);
  10683. stream.readHex(charCode, dataSize);
  10684. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  10685. }
  10686. break;
  10687. default:
  10688. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  10689. }
  10690. }
  10691. if (useCMap) {
  10692. return extend(useCMap);
  10693. }
  10694. return cMap;
  10695. }
  10696. }
  10697. return BinaryCMapReader;
  10698. }();
  10699. const CMapFactory = function CMapFactoryClosure() {
  10700. function strToInt(str) {
  10701. let a = 0;
  10702. for (let i = 0; i < str.length; i++) {
  10703. a = a << 8 | str.charCodeAt(i);
  10704. }
  10705. return a >>> 0;
  10706. }
  10707. function expectString(obj) {
  10708. if (!(0, _util.isString)(obj)) {
  10709. throw new _util.FormatError("Malformed CMap: expected string.");
  10710. }
  10711. }
  10712. function expectInt(obj) {
  10713. if (!Number.isInteger(obj)) {
  10714. throw new _util.FormatError("Malformed CMap: expected int.");
  10715. }
  10716. }
  10717. function parseBfChar(cMap, lexer) {
  10718. while (true) {
  10719. let obj = lexer.getObj();
  10720. if ((0, _primitives.isEOF)(obj)) {
  10721. break;
  10722. }
  10723. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  10724. return;
  10725. }
  10726. expectString(obj);
  10727. const src = strToInt(obj);
  10728. obj = lexer.getObj();
  10729. expectString(obj);
  10730. const dst = obj;
  10731. cMap.mapOne(src, dst);
  10732. }
  10733. }
  10734. function parseBfRange(cMap, lexer) {
  10735. while (true) {
  10736. let obj = lexer.getObj();
  10737. if ((0, _primitives.isEOF)(obj)) {
  10738. break;
  10739. }
  10740. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  10741. return;
  10742. }
  10743. expectString(obj);
  10744. const low = strToInt(obj);
  10745. obj = lexer.getObj();
  10746. expectString(obj);
  10747. const high = strToInt(obj);
  10748. obj = lexer.getObj();
  10749. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  10750. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  10751. cMap.mapBfRange(low, high, dstLow);
  10752. } else if ((0, _primitives.isCmd)(obj, "[")) {
  10753. obj = lexer.getObj();
  10754. const array = [];
  10755. while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
  10756. array.push(obj);
  10757. obj = lexer.getObj();
  10758. }
  10759. cMap.mapBfRangeToArray(low, high, array);
  10760. } else {
  10761. break;
  10762. }
  10763. }
  10764. throw new _util.FormatError("Invalid bf range.");
  10765. }
  10766. function parseCidChar(cMap, lexer) {
  10767. while (true) {
  10768. let obj = lexer.getObj();
  10769. if ((0, _primitives.isEOF)(obj)) {
  10770. break;
  10771. }
  10772. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  10773. return;
  10774. }
  10775. expectString(obj);
  10776. const src = strToInt(obj);
  10777. obj = lexer.getObj();
  10778. expectInt(obj);
  10779. const dst = obj;
  10780. cMap.mapOne(src, dst);
  10781. }
  10782. }
  10783. function parseCidRange(cMap, lexer) {
  10784. while (true) {
  10785. let obj = lexer.getObj();
  10786. if ((0, _primitives.isEOF)(obj)) {
  10787. break;
  10788. }
  10789. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  10790. return;
  10791. }
  10792. expectString(obj);
  10793. const low = strToInt(obj);
  10794. obj = lexer.getObj();
  10795. expectString(obj);
  10796. const high = strToInt(obj);
  10797. obj = lexer.getObj();
  10798. expectInt(obj);
  10799. const dstLow = obj;
  10800. cMap.mapCidRange(low, high, dstLow);
  10801. }
  10802. }
  10803. function parseCodespaceRange(cMap, lexer) {
  10804. while (true) {
  10805. let obj = lexer.getObj();
  10806. if ((0, _primitives.isEOF)(obj)) {
  10807. break;
  10808. }
  10809. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  10810. return;
  10811. }
  10812. if (!(0, _util.isString)(obj)) {
  10813. break;
  10814. }
  10815. const low = strToInt(obj);
  10816. obj = lexer.getObj();
  10817. if (!(0, _util.isString)(obj)) {
  10818. break;
  10819. }
  10820. const high = strToInt(obj);
  10821. cMap.addCodespaceRange(obj.length, low, high);
  10822. }
  10823. throw new _util.FormatError("Invalid codespace range.");
  10824. }
  10825. function parseWMode(cMap, lexer) {
  10826. const obj = lexer.getObj();
  10827. if (Number.isInteger(obj)) {
  10828. cMap.vertical = !!obj;
  10829. }
  10830. }
  10831. function parseCMapName(cMap, lexer) {
  10832. const obj = lexer.getObj();
  10833. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  10834. cMap.name = obj.name;
  10835. }
  10836. }
  10837. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  10838. let previous, embeddedUseCMap;
  10839. objLoop: while (true) {
  10840. try {
  10841. const obj = lexer.getObj();
  10842. if ((0, _primitives.isEOF)(obj)) {
  10843. break;
  10844. } else if ((0, _primitives.isName)(obj)) {
  10845. if (obj.name === "WMode") {
  10846. parseWMode(cMap, lexer);
  10847. } else if (obj.name === "CMapName") {
  10848. parseCMapName(cMap, lexer);
  10849. }
  10850. previous = obj;
  10851. } else if ((0, _primitives.isCmd)(obj)) {
  10852. switch (obj.cmd) {
  10853. case "endcmap":
  10854. break objLoop;
  10855. case "usecmap":
  10856. if ((0, _primitives.isName)(previous)) {
  10857. embeddedUseCMap = previous.name;
  10858. }
  10859. break;
  10860. case "begincodespacerange":
  10861. parseCodespaceRange(cMap, lexer);
  10862. break;
  10863. case "beginbfchar":
  10864. parseBfChar(cMap, lexer);
  10865. break;
  10866. case "begincidchar":
  10867. parseCidChar(cMap, lexer);
  10868. break;
  10869. case "beginbfrange":
  10870. parseBfRange(cMap, lexer);
  10871. break;
  10872. case "begincidrange":
  10873. parseCidRange(cMap, lexer);
  10874. break;
  10875. }
  10876. }
  10877. } catch (ex) {
  10878. if (ex instanceof _core_utils.MissingDataException) {
  10879. throw ex;
  10880. }
  10881. (0, _util.warn)("Invalid cMap data: " + ex);
  10882. continue;
  10883. }
  10884. }
  10885. if (!useCMap && embeddedUseCMap) {
  10886. useCMap = embeddedUseCMap;
  10887. }
  10888. if (useCMap) {
  10889. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  10890. }
  10891. return cMap;
  10892. }
  10893. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  10894. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  10895. if (cMap.numCodespaceRanges === 0) {
  10896. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  10897. for (let i = 0; i < useCodespaceRanges.length; i++) {
  10898. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  10899. }
  10900. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  10901. }
  10902. cMap.useCMap.forEach(function (key, value) {
  10903. if (!cMap.contains(key)) {
  10904. cMap.mapOne(key, cMap.useCMap.lookup(key));
  10905. }
  10906. });
  10907. return cMap;
  10908. }
  10909. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  10910. if (name === "Identity-H") {
  10911. return new IdentityCMap(false, 2);
  10912. } else if (name === "Identity-V") {
  10913. return new IdentityCMap(true, 2);
  10914. }
  10915. if (!BUILT_IN_CMAPS.includes(name)) {
  10916. throw new Error("Unknown CMap name: " + name);
  10917. }
  10918. if (!fetchBuiltInCMap) {
  10919. throw new Error("Built-in CMap parameters are not provided.");
  10920. }
  10921. const {
  10922. cMapData,
  10923. compressionType
  10924. } = await fetchBuiltInCMap(name);
  10925. const cMap = new CMap(true);
  10926. if (compressionType === _util.CMapCompressionType.BINARY) {
  10927. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  10928. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  10929. });
  10930. }
  10931. if (compressionType === _util.CMapCompressionType.NONE) {
  10932. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  10933. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  10934. }
  10935. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  10936. }
  10937. return {
  10938. async create(params) {
  10939. const encoding = params.encoding;
  10940. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  10941. const useCMap = params.useCMap;
  10942. if ((0, _primitives.isName)(encoding)) {
  10943. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  10944. } else if ((0, _primitives.isStream)(encoding)) {
  10945. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  10946. if (parsedCMap.isIdentityCMap) {
  10947. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  10948. }
  10949. return parsedCMap;
  10950. }
  10951. throw new Error("Encoding required.");
  10952. }
  10953. };
  10954. }();
  10955. exports.CMapFactory = CMapFactory;
  10956. /***/ }),
  10957. /* 17 */
  10958. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10959. Object.defineProperty(exports, "__esModule", ({
  10960. value: true
  10961. }));
  10962. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  10963. var _util = __w_pdfjs_require__(2);
  10964. var _primitives = __w_pdfjs_require__(5);
  10965. var _core_utils = __w_pdfjs_require__(9);
  10966. var _ascii_85_stream = __w_pdfjs_require__(18);
  10967. var _ascii_hex_stream = __w_pdfjs_require__(20);
  10968. var _ccitt_stream = __w_pdfjs_require__(21);
  10969. var _flate_stream = __w_pdfjs_require__(23);
  10970. var _jbig2_stream = __w_pdfjs_require__(24);
  10971. var _jpeg_stream = __w_pdfjs_require__(27);
  10972. var _jpx_stream = __w_pdfjs_require__(29);
  10973. var _lzw_stream = __w_pdfjs_require__(31);
  10974. var _stream = __w_pdfjs_require__(10);
  10975. var _predictor_stream = __w_pdfjs_require__(32);
  10976. var _run_length_stream = __w_pdfjs_require__(33);
  10977. const MAX_LENGTH_TO_CACHE = 1000;
  10978. const MAX_ADLER32_LENGTH = 5552;
  10979. function computeAdler32(bytes) {
  10980. const bytesLength = bytes.length;
  10981. let a = 1,
  10982. b = 0;
  10983. for (let i = 0; i < bytesLength; ++i) {
  10984. a += bytes[i] & 0xff;
  10985. b += a;
  10986. }
  10987. return b % 65521 << 16 | a % 65521;
  10988. }
  10989. class Parser {
  10990. constructor({
  10991. lexer,
  10992. xref,
  10993. allowStreams = false,
  10994. recoveryMode = false
  10995. }) {
  10996. this.lexer = lexer;
  10997. this.xref = xref;
  10998. this.allowStreams = allowStreams;
  10999. this.recoveryMode = recoveryMode;
  11000. this.imageCache = Object.create(null);
  11001. this.refill();
  11002. }
  11003. refill() {
  11004. this.buf1 = this.lexer.getObj();
  11005. this.buf2 = this.lexer.getObj();
  11006. }
  11007. shift() {
  11008. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  11009. this.buf1 = this.buf2;
  11010. this.buf2 = null;
  11011. } else {
  11012. this.buf1 = this.buf2;
  11013. this.buf2 = this.lexer.getObj();
  11014. }
  11015. }
  11016. tryShift() {
  11017. try {
  11018. this.shift();
  11019. return true;
  11020. } catch (e) {
  11021. if (e instanceof _core_utils.MissingDataException) {
  11022. throw e;
  11023. }
  11024. return false;
  11025. }
  11026. }
  11027. getObj(cipherTransform = null) {
  11028. const buf1 = this.buf1;
  11029. this.shift();
  11030. if (buf1 instanceof _primitives.Cmd) {
  11031. switch (buf1.cmd) {
  11032. case "BI":
  11033. return this.makeInlineImage(cipherTransform);
  11034. case "[":
  11035. const array = [];
  11036. while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
  11037. array.push(this.getObj(cipherTransform));
  11038. }
  11039. if ((0, _primitives.isEOF)(this.buf1)) {
  11040. if (this.recoveryMode) {
  11041. return array;
  11042. }
  11043. throw new _core_utils.ParserEOFException("End of file inside array.");
  11044. }
  11045. this.shift();
  11046. return array;
  11047. case "<<":
  11048. const dict = new _primitives.Dict(this.xref);
  11049. while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
  11050. if (!(0, _primitives.isName)(this.buf1)) {
  11051. (0, _util.info)("Malformed dictionary: key must be a name object");
  11052. this.shift();
  11053. continue;
  11054. }
  11055. const key = this.buf1.name;
  11056. this.shift();
  11057. if ((0, _primitives.isEOF)(this.buf1)) {
  11058. break;
  11059. }
  11060. dict.set(key, this.getObj(cipherTransform));
  11061. }
  11062. if ((0, _primitives.isEOF)(this.buf1)) {
  11063. if (this.recoveryMode) {
  11064. return dict;
  11065. }
  11066. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  11067. }
  11068. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  11069. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  11070. }
  11071. this.shift();
  11072. return dict;
  11073. default:
  11074. return buf1;
  11075. }
  11076. }
  11077. if (Number.isInteger(buf1)) {
  11078. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  11079. const ref = _primitives.Ref.get(buf1, this.buf1);
  11080. this.shift();
  11081. this.shift();
  11082. return ref;
  11083. }
  11084. return buf1;
  11085. }
  11086. if (typeof buf1 === "string") {
  11087. if (cipherTransform) {
  11088. return cipherTransform.decryptString(buf1);
  11089. }
  11090. return buf1;
  11091. }
  11092. return buf1;
  11093. }
  11094. findDefaultInlineStreamEnd(stream) {
  11095. const E = 0x45,
  11096. I = 0x49,
  11097. SPACE = 0x20,
  11098. LF = 0xa,
  11099. CR = 0xd,
  11100. NUL = 0x0;
  11101. const lexer = this.lexer,
  11102. startPos = stream.pos,
  11103. n = 10;
  11104. let state = 0,
  11105. ch,
  11106. maybeEIPos;
  11107. while ((ch = stream.getByte()) !== -1) {
  11108. if (state === 0) {
  11109. state = ch === E ? 1 : 0;
  11110. } else if (state === 1) {
  11111. state = ch === I ? 2 : 0;
  11112. } else {
  11113. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  11114. if (ch === SPACE || ch === LF || ch === CR) {
  11115. maybeEIPos = stream.pos;
  11116. const followingBytes = stream.peekBytes(n);
  11117. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  11118. ch = followingBytes[i];
  11119. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  11120. continue;
  11121. }
  11122. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  11123. state = 0;
  11124. break;
  11125. }
  11126. }
  11127. if (state !== 2) {
  11128. continue;
  11129. }
  11130. if (lexer.knownCommands) {
  11131. const nextObj = lexer.peekObj();
  11132. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  11133. state = 0;
  11134. }
  11135. } else {
  11136. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  11137. }
  11138. if (state === 2) {
  11139. break;
  11140. }
  11141. } else {
  11142. state = 0;
  11143. }
  11144. }
  11145. }
  11146. if (ch === -1) {
  11147. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  11148. if (maybeEIPos) {
  11149. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  11150. stream.skip(-(stream.pos - maybeEIPos));
  11151. }
  11152. }
  11153. let endOffset = 4;
  11154. stream.skip(-endOffset);
  11155. ch = stream.peekByte();
  11156. stream.skip(endOffset);
  11157. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  11158. endOffset--;
  11159. }
  11160. return stream.pos - endOffset - startPos;
  11161. }
  11162. findDCTDecodeInlineStreamEnd(stream) {
  11163. const startPos = stream.pos;
  11164. let foundEOI = false,
  11165. b,
  11166. markerLength;
  11167. while ((b = stream.getByte()) !== -1) {
  11168. if (b !== 0xff) {
  11169. continue;
  11170. }
  11171. switch (stream.getByte()) {
  11172. case 0x00:
  11173. break;
  11174. case 0xff:
  11175. stream.skip(-1);
  11176. break;
  11177. case 0xd9:
  11178. foundEOI = true;
  11179. break;
  11180. case 0xc0:
  11181. case 0xc1:
  11182. case 0xc2:
  11183. case 0xc3:
  11184. case 0xc5:
  11185. case 0xc6:
  11186. case 0xc7:
  11187. case 0xc9:
  11188. case 0xca:
  11189. case 0xcb:
  11190. case 0xcd:
  11191. case 0xce:
  11192. case 0xcf:
  11193. case 0xc4:
  11194. case 0xcc:
  11195. case 0xda:
  11196. case 0xdb:
  11197. case 0xdc:
  11198. case 0xdd:
  11199. case 0xde:
  11200. case 0xdf:
  11201. case 0xe0:
  11202. case 0xe1:
  11203. case 0xe2:
  11204. case 0xe3:
  11205. case 0xe4:
  11206. case 0xe5:
  11207. case 0xe6:
  11208. case 0xe7:
  11209. case 0xe8:
  11210. case 0xe9:
  11211. case 0xea:
  11212. case 0xeb:
  11213. case 0xec:
  11214. case 0xed:
  11215. case 0xee:
  11216. case 0xef:
  11217. case 0xfe:
  11218. markerLength = stream.getUint16();
  11219. if (markerLength > 2) {
  11220. stream.skip(markerLength - 2);
  11221. } else {
  11222. stream.skip(-2);
  11223. }
  11224. break;
  11225. }
  11226. if (foundEOI) {
  11227. break;
  11228. }
  11229. }
  11230. const length = stream.pos - startPos;
  11231. if (b === -1) {
  11232. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  11233. stream.skip(-length);
  11234. return this.findDefaultInlineStreamEnd(stream);
  11235. }
  11236. this.inlineStreamSkipEI(stream);
  11237. return length;
  11238. }
  11239. findASCII85DecodeInlineStreamEnd(stream) {
  11240. const TILDE = 0x7e,
  11241. GT = 0x3e;
  11242. const startPos = stream.pos;
  11243. let ch;
  11244. while ((ch = stream.getByte()) !== -1) {
  11245. if (ch === TILDE) {
  11246. const tildePos = stream.pos;
  11247. ch = stream.peekByte();
  11248. while ((0, _core_utils.isWhiteSpace)(ch)) {
  11249. stream.skip();
  11250. ch = stream.peekByte();
  11251. }
  11252. if (ch === GT) {
  11253. stream.skip();
  11254. break;
  11255. }
  11256. if (stream.pos > tildePos) {
  11257. const maybeEI = stream.peekBytes(2);
  11258. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  11259. break;
  11260. }
  11261. }
  11262. }
  11263. }
  11264. const length = stream.pos - startPos;
  11265. if (ch === -1) {
  11266. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  11267. stream.skip(-length);
  11268. return this.findDefaultInlineStreamEnd(stream);
  11269. }
  11270. this.inlineStreamSkipEI(stream);
  11271. return length;
  11272. }
  11273. findASCIIHexDecodeInlineStreamEnd(stream) {
  11274. const GT = 0x3e;
  11275. const startPos = stream.pos;
  11276. let ch;
  11277. while ((ch = stream.getByte()) !== -1) {
  11278. if (ch === GT) {
  11279. break;
  11280. }
  11281. }
  11282. const length = stream.pos - startPos;
  11283. if (ch === -1) {
  11284. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  11285. stream.skip(-length);
  11286. return this.findDefaultInlineStreamEnd(stream);
  11287. }
  11288. this.inlineStreamSkipEI(stream);
  11289. return length;
  11290. }
  11291. inlineStreamSkipEI(stream) {
  11292. const E = 0x45,
  11293. I = 0x49;
  11294. let state = 0,
  11295. ch;
  11296. while ((ch = stream.getByte()) !== -1) {
  11297. if (state === 0) {
  11298. state = ch === E ? 1 : 0;
  11299. } else if (state === 1) {
  11300. state = ch === I ? 2 : 0;
  11301. } else if (state === 2) {
  11302. break;
  11303. }
  11304. }
  11305. }
  11306. makeInlineImage(cipherTransform) {
  11307. const lexer = this.lexer;
  11308. const stream = lexer.stream;
  11309. const dict = new _primitives.Dict(this.xref);
  11310. let dictLength;
  11311. while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
  11312. if (!(0, _primitives.isName)(this.buf1)) {
  11313. throw new _util.FormatError("Dictionary key must be a name object");
  11314. }
  11315. const key = this.buf1.name;
  11316. this.shift();
  11317. if ((0, _primitives.isEOF)(this.buf1)) {
  11318. break;
  11319. }
  11320. dict.set(key, this.getObj(cipherTransform));
  11321. }
  11322. if (lexer.beginInlineImagePos !== -1) {
  11323. dictLength = stream.pos - lexer.beginInlineImagePos;
  11324. }
  11325. const filter = dict.get("Filter", "F");
  11326. let filterName;
  11327. if ((0, _primitives.isName)(filter)) {
  11328. filterName = filter.name;
  11329. } else if (Array.isArray(filter)) {
  11330. const filterZero = this.xref.fetchIfRef(filter[0]);
  11331. if ((0, _primitives.isName)(filterZero)) {
  11332. filterName = filterZero.name;
  11333. }
  11334. }
  11335. const startPos = stream.pos;
  11336. let length;
  11337. if (filterName === "DCTDecode" || filterName === "DCT") {
  11338. length = this.findDCTDecodeInlineStreamEnd(stream);
  11339. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  11340. length = this.findASCII85DecodeInlineStreamEnd(stream);
  11341. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  11342. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  11343. } else {
  11344. length = this.findDefaultInlineStreamEnd(stream);
  11345. }
  11346. let imageStream = stream.makeSubStream(startPos, length, dict);
  11347. let cacheKey;
  11348. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  11349. const imageBytes = imageStream.getBytes();
  11350. imageStream.reset();
  11351. const initialStreamPos = stream.pos;
  11352. stream.pos = lexer.beginInlineImagePos;
  11353. const dictBytes = stream.getBytes(dictLength);
  11354. stream.pos = initialStreamPos;
  11355. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  11356. const cacheEntry = this.imageCache[cacheKey];
  11357. if (cacheEntry !== undefined) {
  11358. this.buf2 = _primitives.Cmd.get("EI");
  11359. this.shift();
  11360. cacheEntry.reset();
  11361. return cacheEntry;
  11362. }
  11363. }
  11364. if (cipherTransform) {
  11365. imageStream = cipherTransform.createStream(imageStream, length);
  11366. }
  11367. imageStream = this.filter(imageStream, dict, length);
  11368. imageStream.dict = dict;
  11369. if (cacheKey !== undefined) {
  11370. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  11371. this.imageCache[cacheKey] = imageStream;
  11372. }
  11373. this.buf2 = _primitives.Cmd.get("EI");
  11374. this.shift();
  11375. return imageStream;
  11376. }
  11377. _findStreamLength(startPos, signature) {
  11378. const {
  11379. stream
  11380. } = this.lexer;
  11381. stream.pos = startPos;
  11382. const SCAN_BLOCK_LENGTH = 2048;
  11383. const signatureLength = signature.length;
  11384. while (stream.pos < stream.end) {
  11385. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  11386. const scanLength = scanBytes.length - signatureLength;
  11387. if (scanLength <= 0) {
  11388. break;
  11389. }
  11390. let pos = 0;
  11391. while (pos < scanLength) {
  11392. let j = 0;
  11393. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  11394. j++;
  11395. }
  11396. if (j >= signatureLength) {
  11397. stream.pos += pos;
  11398. return stream.pos - startPos;
  11399. }
  11400. pos++;
  11401. }
  11402. stream.pos += scanLength;
  11403. }
  11404. return -1;
  11405. }
  11406. makeStream(dict, cipherTransform) {
  11407. const lexer = this.lexer;
  11408. let stream = lexer.stream;
  11409. lexer.skipToNextLine();
  11410. const startPos = stream.pos - 1;
  11411. let length = dict.get("Length");
  11412. if (!Number.isInteger(length)) {
  11413. (0, _util.info)(`Bad length "${length}" in stream`);
  11414. length = 0;
  11415. }
  11416. stream.pos = startPos + length;
  11417. lexer.nextChar();
  11418. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  11419. this.shift();
  11420. } else {
  11421. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  11422. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  11423. if (actualLength < 0) {
  11424. const MAX_TRUNCATION = 1;
  11425. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  11426. const end = ENDSTREAM_SIGNATURE.length - i;
  11427. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  11428. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  11429. if (maybeLength >= 0) {
  11430. const lastByte = stream.peekBytes(end + 1)[end];
  11431. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  11432. break;
  11433. }
  11434. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  11435. actualLength = maybeLength;
  11436. break;
  11437. }
  11438. }
  11439. if (actualLength < 0) {
  11440. throw new _util.FormatError("Missing endstream command.");
  11441. }
  11442. }
  11443. length = actualLength;
  11444. lexer.nextChar();
  11445. this.shift();
  11446. this.shift();
  11447. }
  11448. this.shift();
  11449. stream = stream.makeSubStream(startPos, length, dict);
  11450. if (cipherTransform) {
  11451. stream = cipherTransform.createStream(stream, length);
  11452. }
  11453. stream = this.filter(stream, dict, length);
  11454. stream.dict = dict;
  11455. return stream;
  11456. }
  11457. filter(stream, dict, length) {
  11458. let filter = dict.get("Filter", "F");
  11459. let params = dict.get("DecodeParms", "DP");
  11460. if ((0, _primitives.isName)(filter)) {
  11461. if (Array.isArray(params)) {
  11462. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  11463. }
  11464. return this.makeFilter(stream, filter.name, length, params);
  11465. }
  11466. let maybeLength = length;
  11467. if (Array.isArray(filter)) {
  11468. const filterArray = filter;
  11469. const paramsArray = params;
  11470. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  11471. filter = this.xref.fetchIfRef(filterArray[i]);
  11472. if (!(0, _primitives.isName)(filter)) {
  11473. throw new _util.FormatError(`Bad filter name "${filter}"`);
  11474. }
  11475. params = null;
  11476. if (Array.isArray(paramsArray) && i in paramsArray) {
  11477. params = this.xref.fetchIfRef(paramsArray[i]);
  11478. }
  11479. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  11480. maybeLength = null;
  11481. }
  11482. }
  11483. return stream;
  11484. }
  11485. makeFilter(stream, name, maybeLength, params) {
  11486. if (maybeLength === 0) {
  11487. (0, _util.warn)(`Empty "${name}" stream.`);
  11488. return new _stream.NullStream();
  11489. }
  11490. try {
  11491. const xrefStreamStats = this.xref.stats.streamTypes;
  11492. if (name === "FlateDecode" || name === "Fl") {
  11493. xrefStreamStats[_util.StreamType.FLATE] = true;
  11494. if (params) {
  11495. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  11496. }
  11497. return new _flate_stream.FlateStream(stream, maybeLength);
  11498. }
  11499. if (name === "LZWDecode" || name === "LZW") {
  11500. xrefStreamStats[_util.StreamType.LZW] = true;
  11501. let earlyChange = 1;
  11502. if (params) {
  11503. if (params.has("EarlyChange")) {
  11504. earlyChange = params.get("EarlyChange");
  11505. }
  11506. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  11507. }
  11508. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  11509. }
  11510. if (name === "DCTDecode" || name === "DCT") {
  11511. xrefStreamStats[_util.StreamType.DCT] = true;
  11512. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  11513. }
  11514. if (name === "JPXDecode" || name === "JPX") {
  11515. xrefStreamStats[_util.StreamType.JPX] = true;
  11516. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  11517. }
  11518. if (name === "ASCII85Decode" || name === "A85") {
  11519. xrefStreamStats[_util.StreamType.A85] = true;
  11520. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  11521. }
  11522. if (name === "ASCIIHexDecode" || name === "AHx") {
  11523. xrefStreamStats[_util.StreamType.AHX] = true;
  11524. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  11525. }
  11526. if (name === "CCITTFaxDecode" || name === "CCF") {
  11527. xrefStreamStats[_util.StreamType.CCF] = true;
  11528. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  11529. }
  11530. if (name === "RunLengthDecode" || name === "RL") {
  11531. xrefStreamStats[_util.StreamType.RLX] = true;
  11532. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  11533. }
  11534. if (name === "JBIG2Decode") {
  11535. xrefStreamStats[_util.StreamType.JBIG] = true;
  11536. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  11537. }
  11538. (0, _util.warn)(`Filter "${name}" is not supported.`);
  11539. return stream;
  11540. } catch (ex) {
  11541. if (ex instanceof _core_utils.MissingDataException) {
  11542. throw ex;
  11543. }
  11544. (0, _util.warn)(`Invalid stream: "${ex}"`);
  11545. return new _stream.NullStream();
  11546. }
  11547. }
  11548. }
  11549. exports.Parser = Parser;
  11550. 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];
  11551. function toHexDigit(ch) {
  11552. if (ch >= 0x30 && ch <= 0x39) {
  11553. return ch & 0x0f;
  11554. }
  11555. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  11556. return (ch & 0x0f) + 9;
  11557. }
  11558. return -1;
  11559. }
  11560. class Lexer {
  11561. constructor(stream, knownCommands = null) {
  11562. this.stream = stream;
  11563. this.nextChar();
  11564. this.strBuf = [];
  11565. this.knownCommands = knownCommands;
  11566. this._hexStringNumWarn = 0;
  11567. this.beginInlineImagePos = -1;
  11568. }
  11569. nextChar() {
  11570. return this.currentChar = this.stream.getByte();
  11571. }
  11572. peekChar() {
  11573. return this.stream.peekByte();
  11574. }
  11575. getNumber() {
  11576. let ch = this.currentChar;
  11577. let eNotation = false;
  11578. let divideBy = 0;
  11579. let sign = 0;
  11580. if (ch === 0x2d) {
  11581. sign = -1;
  11582. ch = this.nextChar();
  11583. if (ch === 0x2d) {
  11584. ch = this.nextChar();
  11585. }
  11586. } else if (ch === 0x2b) {
  11587. sign = 1;
  11588. ch = this.nextChar();
  11589. }
  11590. if (ch === 0x0a || ch === 0x0d) {
  11591. do {
  11592. ch = this.nextChar();
  11593. } while (ch === 0x0a || ch === 0x0d);
  11594. }
  11595. if (ch === 0x2e) {
  11596. divideBy = 10;
  11597. ch = this.nextChar();
  11598. }
  11599. if (ch < 0x30 || ch > 0x39) {
  11600. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  11601. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  11602. return 0;
  11603. }
  11604. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  11605. }
  11606. sign = sign || 1;
  11607. let baseValue = ch - 0x30;
  11608. let powerValue = 0;
  11609. let powerValueSign = 1;
  11610. while ((ch = this.nextChar()) >= 0) {
  11611. if (ch >= 0x30 && ch <= 0x39) {
  11612. const currentDigit = ch - 0x30;
  11613. if (eNotation) {
  11614. powerValue = powerValue * 10 + currentDigit;
  11615. } else {
  11616. if (divideBy !== 0) {
  11617. divideBy *= 10;
  11618. }
  11619. baseValue = baseValue * 10 + currentDigit;
  11620. }
  11621. } else if (ch === 0x2e) {
  11622. if (divideBy === 0) {
  11623. divideBy = 1;
  11624. } else {
  11625. break;
  11626. }
  11627. } else if (ch === 0x2d) {
  11628. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  11629. } else if (ch === 0x45 || ch === 0x65) {
  11630. ch = this.peekChar();
  11631. if (ch === 0x2b || ch === 0x2d) {
  11632. powerValueSign = ch === 0x2d ? -1 : 1;
  11633. this.nextChar();
  11634. } else if (ch < 0x30 || ch > 0x39) {
  11635. break;
  11636. }
  11637. eNotation = true;
  11638. } else {
  11639. break;
  11640. }
  11641. }
  11642. if (divideBy !== 0) {
  11643. baseValue /= divideBy;
  11644. }
  11645. if (eNotation) {
  11646. baseValue *= 10 ** (powerValueSign * powerValue);
  11647. }
  11648. return sign * baseValue;
  11649. }
  11650. getString() {
  11651. let numParen = 1;
  11652. let done = false;
  11653. const strBuf = this.strBuf;
  11654. strBuf.length = 0;
  11655. let ch = this.nextChar();
  11656. while (true) {
  11657. let charBuffered = false;
  11658. switch (ch | 0) {
  11659. case -1:
  11660. (0, _util.warn)("Unterminated string");
  11661. done = true;
  11662. break;
  11663. case 0x28:
  11664. ++numParen;
  11665. strBuf.push("(");
  11666. break;
  11667. case 0x29:
  11668. if (--numParen === 0) {
  11669. this.nextChar();
  11670. done = true;
  11671. } else {
  11672. strBuf.push(")");
  11673. }
  11674. break;
  11675. case 0x5c:
  11676. ch = this.nextChar();
  11677. switch (ch) {
  11678. case -1:
  11679. (0, _util.warn)("Unterminated string");
  11680. done = true;
  11681. break;
  11682. case 0x6e:
  11683. strBuf.push("\n");
  11684. break;
  11685. case 0x72:
  11686. strBuf.push("\r");
  11687. break;
  11688. case 0x74:
  11689. strBuf.push("\t");
  11690. break;
  11691. case 0x62:
  11692. strBuf.push("\b");
  11693. break;
  11694. case 0x66:
  11695. strBuf.push("\f");
  11696. break;
  11697. case 0x5c:
  11698. case 0x28:
  11699. case 0x29:
  11700. strBuf.push(String.fromCharCode(ch));
  11701. break;
  11702. case 0x30:
  11703. case 0x31:
  11704. case 0x32:
  11705. case 0x33:
  11706. case 0x34:
  11707. case 0x35:
  11708. case 0x36:
  11709. case 0x37:
  11710. let x = ch & 0x0f;
  11711. ch = this.nextChar();
  11712. charBuffered = true;
  11713. if (ch >= 0x30 && ch <= 0x37) {
  11714. x = (x << 3) + (ch & 0x0f);
  11715. ch = this.nextChar();
  11716. if (ch >= 0x30 && ch <= 0x37) {
  11717. charBuffered = false;
  11718. x = (x << 3) + (ch & 0x0f);
  11719. }
  11720. }
  11721. strBuf.push(String.fromCharCode(x));
  11722. break;
  11723. case 0x0d:
  11724. if (this.peekChar() === 0x0a) {
  11725. this.nextChar();
  11726. }
  11727. break;
  11728. case 0x0a:
  11729. break;
  11730. default:
  11731. strBuf.push(String.fromCharCode(ch));
  11732. break;
  11733. }
  11734. break;
  11735. default:
  11736. strBuf.push(String.fromCharCode(ch));
  11737. break;
  11738. }
  11739. if (done) {
  11740. break;
  11741. }
  11742. if (!charBuffered) {
  11743. ch = this.nextChar();
  11744. }
  11745. }
  11746. return strBuf.join("");
  11747. }
  11748. getName() {
  11749. let ch, previousCh;
  11750. const strBuf = this.strBuf;
  11751. strBuf.length = 0;
  11752. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  11753. if (ch === 0x23) {
  11754. ch = this.nextChar();
  11755. if (specialChars[ch]) {
  11756. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  11757. strBuf.push("#");
  11758. break;
  11759. }
  11760. const x = toHexDigit(ch);
  11761. if (x !== -1) {
  11762. previousCh = ch;
  11763. ch = this.nextChar();
  11764. const x2 = toHexDigit(ch);
  11765. if (x2 === -1) {
  11766. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  11767. strBuf.push("#", String.fromCharCode(previousCh));
  11768. if (specialChars[ch]) {
  11769. break;
  11770. }
  11771. strBuf.push(String.fromCharCode(ch));
  11772. continue;
  11773. }
  11774. strBuf.push(String.fromCharCode(x << 4 | x2));
  11775. } else {
  11776. strBuf.push("#", String.fromCharCode(ch));
  11777. }
  11778. } else {
  11779. strBuf.push(String.fromCharCode(ch));
  11780. }
  11781. }
  11782. if (strBuf.length > 127) {
  11783. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  11784. } else if (strBuf.length === 0) {
  11785. (0, _util.warn)("Name token is empty.");
  11786. }
  11787. return _primitives.Name.get(strBuf.join(""));
  11788. }
  11789. _hexStringWarn(ch) {
  11790. const MAX_HEX_STRING_NUM_WARN = 5;
  11791. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  11792. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  11793. return;
  11794. }
  11795. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  11796. return;
  11797. }
  11798. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  11799. }
  11800. getHexString() {
  11801. const strBuf = this.strBuf;
  11802. strBuf.length = 0;
  11803. let ch = this.currentChar;
  11804. let isFirstHex = true;
  11805. let firstDigit, secondDigit;
  11806. this._hexStringNumWarn = 0;
  11807. while (true) {
  11808. if (ch < 0) {
  11809. (0, _util.warn)("Unterminated hex string");
  11810. break;
  11811. } else if (ch === 0x3e) {
  11812. this.nextChar();
  11813. break;
  11814. } else if (specialChars[ch] === 1) {
  11815. ch = this.nextChar();
  11816. continue;
  11817. } else {
  11818. if (isFirstHex) {
  11819. firstDigit = toHexDigit(ch);
  11820. if (firstDigit === -1) {
  11821. this._hexStringWarn(ch);
  11822. ch = this.nextChar();
  11823. continue;
  11824. }
  11825. } else {
  11826. secondDigit = toHexDigit(ch);
  11827. if (secondDigit === -1) {
  11828. this._hexStringWarn(ch);
  11829. ch = this.nextChar();
  11830. continue;
  11831. }
  11832. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  11833. }
  11834. isFirstHex = !isFirstHex;
  11835. ch = this.nextChar();
  11836. }
  11837. }
  11838. return strBuf.join("");
  11839. }
  11840. getObj() {
  11841. let comment = false;
  11842. let ch = this.currentChar;
  11843. while (true) {
  11844. if (ch < 0) {
  11845. return _primitives.EOF;
  11846. }
  11847. if (comment) {
  11848. if (ch === 0x0a || ch === 0x0d) {
  11849. comment = false;
  11850. }
  11851. } else if (ch === 0x25) {
  11852. comment = true;
  11853. } else if (specialChars[ch] !== 1) {
  11854. break;
  11855. }
  11856. ch = this.nextChar();
  11857. }
  11858. switch (ch | 0) {
  11859. case 0x30:
  11860. case 0x31:
  11861. case 0x32:
  11862. case 0x33:
  11863. case 0x34:
  11864. case 0x35:
  11865. case 0x36:
  11866. case 0x37:
  11867. case 0x38:
  11868. case 0x39:
  11869. case 0x2b:
  11870. case 0x2d:
  11871. case 0x2e:
  11872. return this.getNumber();
  11873. case 0x28:
  11874. return this.getString();
  11875. case 0x2f:
  11876. return this.getName();
  11877. case 0x5b:
  11878. this.nextChar();
  11879. return _primitives.Cmd.get("[");
  11880. case 0x5d:
  11881. this.nextChar();
  11882. return _primitives.Cmd.get("]");
  11883. case 0x3c:
  11884. ch = this.nextChar();
  11885. if (ch === 0x3c) {
  11886. this.nextChar();
  11887. return _primitives.Cmd.get("<<");
  11888. }
  11889. return this.getHexString();
  11890. case 0x3e:
  11891. ch = this.nextChar();
  11892. if (ch === 0x3e) {
  11893. this.nextChar();
  11894. return _primitives.Cmd.get(">>");
  11895. }
  11896. return _primitives.Cmd.get(">");
  11897. case 0x7b:
  11898. this.nextChar();
  11899. return _primitives.Cmd.get("{");
  11900. case 0x7d:
  11901. this.nextChar();
  11902. return _primitives.Cmd.get("}");
  11903. case 0x29:
  11904. this.nextChar();
  11905. throw new _util.FormatError(`Illegal character: ${ch}`);
  11906. }
  11907. let str = String.fromCharCode(ch);
  11908. const knownCommands = this.knownCommands;
  11909. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  11910. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  11911. const possibleCommand = str + String.fromCharCode(ch);
  11912. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  11913. break;
  11914. }
  11915. if (str.length === 128) {
  11916. throw new _util.FormatError(`Command token too long: ${str.length}`);
  11917. }
  11918. str = possibleCommand;
  11919. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  11920. }
  11921. if (str === "true") {
  11922. return true;
  11923. }
  11924. if (str === "false") {
  11925. return false;
  11926. }
  11927. if (str === "null") {
  11928. return null;
  11929. }
  11930. if (str === "BI") {
  11931. this.beginInlineImagePos = this.stream.pos;
  11932. }
  11933. return _primitives.Cmd.get(str);
  11934. }
  11935. peekObj() {
  11936. const streamPos = this.stream.pos,
  11937. currentChar = this.currentChar,
  11938. beginInlineImagePos = this.beginInlineImagePos;
  11939. let nextObj;
  11940. try {
  11941. nextObj = this.getObj();
  11942. } catch (ex) {
  11943. if (ex instanceof _core_utils.MissingDataException) {
  11944. throw ex;
  11945. }
  11946. (0, _util.warn)(`peekObj: ${ex}`);
  11947. }
  11948. this.stream.pos = streamPos;
  11949. this.currentChar = currentChar;
  11950. this.beginInlineImagePos = beginInlineImagePos;
  11951. return nextObj;
  11952. }
  11953. skipToNextLine() {
  11954. let ch = this.currentChar;
  11955. while (ch >= 0) {
  11956. if (ch === 0x0d) {
  11957. ch = this.nextChar();
  11958. if (ch === 0x0a) {
  11959. this.nextChar();
  11960. }
  11961. break;
  11962. } else if (ch === 0x0a) {
  11963. this.nextChar();
  11964. break;
  11965. }
  11966. ch = this.nextChar();
  11967. }
  11968. }
  11969. }
  11970. exports.Lexer = Lexer;
  11971. class Linearization {
  11972. static create(stream) {
  11973. function getInt(linDict, name, allowZeroValue = false) {
  11974. const obj = linDict.get(name);
  11975. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  11976. return obj;
  11977. }
  11978. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  11979. }
  11980. function getHints(linDict) {
  11981. const hints = linDict.get("H");
  11982. let hintsLength;
  11983. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  11984. for (let index = 0; index < hintsLength; index++) {
  11985. const hint = hints[index];
  11986. if (!(Number.isInteger(hint) && hint > 0)) {
  11987. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  11988. }
  11989. }
  11990. return hints;
  11991. }
  11992. throw new Error("Hint array in the linearization dictionary is invalid.");
  11993. }
  11994. const parser = new Parser({
  11995. lexer: new Lexer(stream),
  11996. xref: null
  11997. });
  11998. const obj1 = parser.getObj();
  11999. const obj2 = parser.getObj();
  12000. const obj3 = parser.getObj();
  12001. const linDict = parser.getObj();
  12002. let obj, length;
  12003. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) {
  12004. return null;
  12005. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  12006. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  12007. }
  12008. return {
  12009. length,
  12010. hints: getHints(linDict),
  12011. objectNumberFirst: getInt(linDict, "O"),
  12012. endFirst: getInt(linDict, "E"),
  12013. numPages: getInt(linDict, "N"),
  12014. mainXRefEntriesOffset: getInt(linDict, "T"),
  12015. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  12016. };
  12017. }
  12018. }
  12019. exports.Linearization = Linearization;
  12020. /***/ }),
  12021. /* 18 */
  12022. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12023. Object.defineProperty(exports, "__esModule", ({
  12024. value: true
  12025. }));
  12026. exports.Ascii85Stream = void 0;
  12027. var _decode_stream = __w_pdfjs_require__(19);
  12028. var _core_utils = __w_pdfjs_require__(9);
  12029. class Ascii85Stream extends _decode_stream.DecodeStream {
  12030. constructor(str, maybeLength) {
  12031. if (maybeLength) {
  12032. maybeLength *= 0.8;
  12033. }
  12034. super(maybeLength);
  12035. this.str = str;
  12036. this.dict = str.dict;
  12037. this.input = new Uint8Array(5);
  12038. }
  12039. readBlock() {
  12040. const TILDA_CHAR = 0x7e;
  12041. const Z_LOWER_CHAR = 0x7a;
  12042. const EOF = -1;
  12043. const str = this.str;
  12044. let c = str.getByte();
  12045. while ((0, _core_utils.isWhiteSpace)(c)) {
  12046. c = str.getByte();
  12047. }
  12048. if (c === EOF || c === TILDA_CHAR) {
  12049. this.eof = true;
  12050. return;
  12051. }
  12052. const bufferLength = this.bufferLength;
  12053. let buffer, i;
  12054. if (c === Z_LOWER_CHAR) {
  12055. buffer = this.ensureBuffer(bufferLength + 4);
  12056. for (i = 0; i < 4; ++i) {
  12057. buffer[bufferLength + i] = 0;
  12058. }
  12059. this.bufferLength += 4;
  12060. } else {
  12061. const input = this.input;
  12062. input[0] = c;
  12063. for (i = 1; i < 5; ++i) {
  12064. c = str.getByte();
  12065. while ((0, _core_utils.isWhiteSpace)(c)) {
  12066. c = str.getByte();
  12067. }
  12068. input[i] = c;
  12069. if (c === EOF || c === TILDA_CHAR) {
  12070. break;
  12071. }
  12072. }
  12073. buffer = this.ensureBuffer(bufferLength + i - 1);
  12074. this.bufferLength += i - 1;
  12075. if (i < 5) {
  12076. for (; i < 5; ++i) {
  12077. input[i] = 0x21 + 84;
  12078. }
  12079. this.eof = true;
  12080. }
  12081. let t = 0;
  12082. for (i = 0; i < 5; ++i) {
  12083. t = t * 85 + (input[i] - 0x21);
  12084. }
  12085. for (i = 3; i >= 0; --i) {
  12086. buffer[bufferLength + i] = t & 0xff;
  12087. t >>= 8;
  12088. }
  12089. }
  12090. }
  12091. }
  12092. exports.Ascii85Stream = Ascii85Stream;
  12093. /***/ }),
  12094. /* 19 */
  12095. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12096. Object.defineProperty(exports, "__esModule", ({
  12097. value: true
  12098. }));
  12099. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  12100. var _base_stream = __w_pdfjs_require__(6);
  12101. var _stream = __w_pdfjs_require__(10);
  12102. const emptyBuffer = new Uint8Array(0);
  12103. class DecodeStream extends _base_stream.BaseStream {
  12104. constructor(maybeMinBufferLength) {
  12105. super();
  12106. this._rawMinBufferLength = maybeMinBufferLength || 0;
  12107. this.pos = 0;
  12108. this.bufferLength = 0;
  12109. this.eof = false;
  12110. this.buffer = emptyBuffer;
  12111. this.minBufferLength = 512;
  12112. if (maybeMinBufferLength) {
  12113. while (this.minBufferLength < maybeMinBufferLength) {
  12114. this.minBufferLength *= 2;
  12115. }
  12116. }
  12117. }
  12118. get isEmpty() {
  12119. while (!this.eof && this.bufferLength === 0) {
  12120. this.readBlock();
  12121. }
  12122. return this.bufferLength === 0;
  12123. }
  12124. ensureBuffer(requested) {
  12125. const buffer = this.buffer;
  12126. if (requested <= buffer.byteLength) {
  12127. return buffer;
  12128. }
  12129. let size = this.minBufferLength;
  12130. while (size < requested) {
  12131. size *= 2;
  12132. }
  12133. const buffer2 = new Uint8Array(size);
  12134. buffer2.set(buffer);
  12135. return this.buffer = buffer2;
  12136. }
  12137. getByte() {
  12138. const pos = this.pos;
  12139. while (this.bufferLength <= pos) {
  12140. if (this.eof) {
  12141. return -1;
  12142. }
  12143. this.readBlock();
  12144. }
  12145. return this.buffer[this.pos++];
  12146. }
  12147. getBytes(length, forceClamped = false) {
  12148. const pos = this.pos;
  12149. let end;
  12150. if (length) {
  12151. this.ensureBuffer(pos + length);
  12152. end = pos + length;
  12153. while (!this.eof && this.bufferLength < end) {
  12154. this.readBlock();
  12155. }
  12156. const bufEnd = this.bufferLength;
  12157. if (end > bufEnd) {
  12158. end = bufEnd;
  12159. }
  12160. } else {
  12161. while (!this.eof) {
  12162. this.readBlock();
  12163. }
  12164. end = this.bufferLength;
  12165. }
  12166. this.pos = end;
  12167. const subarray = this.buffer.subarray(pos, end);
  12168. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  12169. }
  12170. reset() {
  12171. this.pos = 0;
  12172. }
  12173. makeSubStream(start, length, dict = null) {
  12174. if (length === undefined) {
  12175. while (!this.eof) {
  12176. this.readBlock();
  12177. }
  12178. } else {
  12179. const end = start + length;
  12180. while (this.bufferLength <= end && !this.eof) {
  12181. this.readBlock();
  12182. }
  12183. }
  12184. return new _stream.Stream(this.buffer, start, length, dict);
  12185. }
  12186. getBaseStreams() {
  12187. return this.str ? this.str.getBaseStreams() : null;
  12188. }
  12189. }
  12190. exports.DecodeStream = DecodeStream;
  12191. class StreamsSequenceStream extends DecodeStream {
  12192. constructor(streams) {
  12193. let maybeLength = 0;
  12194. for (const stream of streams) {
  12195. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  12196. }
  12197. super(maybeLength);
  12198. this.streams = streams;
  12199. }
  12200. readBlock() {
  12201. const streams = this.streams;
  12202. if (streams.length === 0) {
  12203. this.eof = true;
  12204. return;
  12205. }
  12206. const stream = streams.shift();
  12207. const chunk = stream.getBytes();
  12208. const bufferLength = this.bufferLength;
  12209. const newLength = bufferLength + chunk.length;
  12210. const buffer = this.ensureBuffer(newLength);
  12211. buffer.set(chunk, bufferLength);
  12212. this.bufferLength = newLength;
  12213. }
  12214. getBaseStreams() {
  12215. const baseStreamsBuf = [];
  12216. for (const stream of this.streams) {
  12217. const baseStreams = stream.getBaseStreams();
  12218. if (baseStreams) {
  12219. baseStreamsBuf.push(...baseStreams);
  12220. }
  12221. }
  12222. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  12223. }
  12224. }
  12225. exports.StreamsSequenceStream = StreamsSequenceStream;
  12226. /***/ }),
  12227. /* 20 */
  12228. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12229. Object.defineProperty(exports, "__esModule", ({
  12230. value: true
  12231. }));
  12232. exports.AsciiHexStream = void 0;
  12233. var _decode_stream = __w_pdfjs_require__(19);
  12234. class AsciiHexStream extends _decode_stream.DecodeStream {
  12235. constructor(str, maybeLength) {
  12236. if (maybeLength) {
  12237. maybeLength *= 0.5;
  12238. }
  12239. super(maybeLength);
  12240. this.str = str;
  12241. this.dict = str.dict;
  12242. this.firstDigit = -1;
  12243. }
  12244. readBlock() {
  12245. const UPSTREAM_BLOCK_SIZE = 8000;
  12246. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  12247. if (!bytes.length) {
  12248. this.eof = true;
  12249. return;
  12250. }
  12251. const maxDecodeLength = bytes.length + 1 >> 1;
  12252. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  12253. let bufferLength = this.bufferLength;
  12254. let firstDigit = this.firstDigit;
  12255. for (const ch of bytes) {
  12256. let digit;
  12257. if (ch >= 0x30 && ch <= 0x39) {
  12258. digit = ch & 0x0f;
  12259. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  12260. digit = (ch & 0x0f) + 9;
  12261. } else if (ch === 0x3e) {
  12262. this.eof = true;
  12263. break;
  12264. } else {
  12265. continue;
  12266. }
  12267. if (firstDigit < 0) {
  12268. firstDigit = digit;
  12269. } else {
  12270. buffer[bufferLength++] = firstDigit << 4 | digit;
  12271. firstDigit = -1;
  12272. }
  12273. }
  12274. if (firstDigit >= 0 && this.eof) {
  12275. buffer[bufferLength++] = firstDigit << 4;
  12276. firstDigit = -1;
  12277. }
  12278. this.firstDigit = firstDigit;
  12279. this.bufferLength = bufferLength;
  12280. }
  12281. }
  12282. exports.AsciiHexStream = AsciiHexStream;
  12283. /***/ }),
  12284. /* 21 */
  12285. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12286. Object.defineProperty(exports, "__esModule", ({
  12287. value: true
  12288. }));
  12289. exports.CCITTFaxStream = void 0;
  12290. var _primitives = __w_pdfjs_require__(5);
  12291. var _ccitt = __w_pdfjs_require__(22);
  12292. var _decode_stream = __w_pdfjs_require__(19);
  12293. class CCITTFaxStream extends _decode_stream.DecodeStream {
  12294. constructor(str, maybeLength, params) {
  12295. super(maybeLength);
  12296. this.str = str;
  12297. this.dict = str.dict;
  12298. if (!(0, _primitives.isDict)(params)) {
  12299. params = _primitives.Dict.empty;
  12300. }
  12301. const source = {
  12302. next() {
  12303. return str.getByte();
  12304. }
  12305. };
  12306. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  12307. K: params.get("K"),
  12308. EndOfLine: params.get("EndOfLine"),
  12309. EncodedByteAlign: params.get("EncodedByteAlign"),
  12310. Columns: params.get("Columns"),
  12311. Rows: params.get("Rows"),
  12312. EndOfBlock: params.get("EndOfBlock"),
  12313. BlackIs1: params.get("BlackIs1")
  12314. });
  12315. }
  12316. readBlock() {
  12317. while (!this.eof) {
  12318. const c = this.ccittFaxDecoder.readNextChar();
  12319. if (c === -1) {
  12320. this.eof = true;
  12321. return;
  12322. }
  12323. this.ensureBuffer(this.bufferLength + 1);
  12324. this.buffer[this.bufferLength++] = c;
  12325. }
  12326. }
  12327. }
  12328. exports.CCITTFaxStream = CCITTFaxStream;
  12329. /***/ }),
  12330. /* 22 */
  12331. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12332. Object.defineProperty(exports, "__esModule", ({
  12333. value: true
  12334. }));
  12335. exports.CCITTFaxDecoder = void 0;
  12336. var _util = __w_pdfjs_require__(2);
  12337. const ccittEOL = -2;
  12338. const ccittEOF = -1;
  12339. const twoDimPass = 0;
  12340. const twoDimHoriz = 1;
  12341. const twoDimVert0 = 2;
  12342. const twoDimVertR1 = 3;
  12343. const twoDimVertL1 = 4;
  12344. const twoDimVertR2 = 5;
  12345. const twoDimVertL2 = 6;
  12346. const twoDimVertR3 = 7;
  12347. const twoDimVertL3 = 8;
  12348. 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]];
  12349. 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]];
  12350. 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]];
  12351. 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]];
  12352. 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]];
  12353. 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]];
  12354. class CCITTFaxDecoder {
  12355. constructor(source, options = {}) {
  12356. if (!source || typeof source.next !== "function") {
  12357. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  12358. }
  12359. this.source = source;
  12360. this.eof = false;
  12361. this.encoding = options.K || 0;
  12362. this.eoline = options.EndOfLine || false;
  12363. this.byteAlign = options.EncodedByteAlign || false;
  12364. this.columns = options.Columns || 1728;
  12365. this.rows = options.Rows || 0;
  12366. let eoblock = options.EndOfBlock;
  12367. if (eoblock === null || eoblock === undefined) {
  12368. eoblock = true;
  12369. }
  12370. this.eoblock = eoblock;
  12371. this.black = options.BlackIs1 || false;
  12372. this.codingLine = new Uint32Array(this.columns + 1);
  12373. this.refLine = new Uint32Array(this.columns + 2);
  12374. this.codingLine[0] = this.columns;
  12375. this.codingPos = 0;
  12376. this.row = 0;
  12377. this.nextLine2D = this.encoding < 0;
  12378. this.inputBits = 0;
  12379. this.inputBuf = 0;
  12380. this.outputBits = 0;
  12381. this.rowsDone = false;
  12382. let code1;
  12383. while ((code1 = this._lookBits(12)) === 0) {
  12384. this._eatBits(1);
  12385. }
  12386. if (code1 === 1) {
  12387. this._eatBits(12);
  12388. }
  12389. if (this.encoding > 0) {
  12390. this.nextLine2D = !this._lookBits(1);
  12391. this._eatBits(1);
  12392. }
  12393. }
  12394. readNextChar() {
  12395. if (this.eof) {
  12396. return -1;
  12397. }
  12398. const refLine = this.refLine;
  12399. const codingLine = this.codingLine;
  12400. const columns = this.columns;
  12401. let refPos, blackPixels, bits, i;
  12402. if (this.outputBits === 0) {
  12403. if (this.rowsDone) {
  12404. this.eof = true;
  12405. }
  12406. if (this.eof) {
  12407. return -1;
  12408. }
  12409. this.err = false;
  12410. let code1, code2, code3;
  12411. if (this.nextLine2D) {
  12412. for (i = 0; codingLine[i] < columns; ++i) {
  12413. refLine[i] = codingLine[i];
  12414. }
  12415. refLine[i++] = columns;
  12416. refLine[i] = columns;
  12417. codingLine[0] = 0;
  12418. this.codingPos = 0;
  12419. refPos = 0;
  12420. blackPixels = 0;
  12421. while (codingLine[this.codingPos] < columns) {
  12422. code1 = this._getTwoDimCode();
  12423. switch (code1) {
  12424. case twoDimPass:
  12425. this._addPixels(refLine[refPos + 1], blackPixels);
  12426. if (refLine[refPos + 1] < columns) {
  12427. refPos += 2;
  12428. }
  12429. break;
  12430. case twoDimHoriz:
  12431. code1 = code2 = 0;
  12432. if (blackPixels) {
  12433. do {
  12434. code1 += code3 = this._getBlackCode();
  12435. } while (code3 >= 64);
  12436. do {
  12437. code2 += code3 = this._getWhiteCode();
  12438. } while (code3 >= 64);
  12439. } else {
  12440. do {
  12441. code1 += code3 = this._getWhiteCode();
  12442. } while (code3 >= 64);
  12443. do {
  12444. code2 += code3 = this._getBlackCode();
  12445. } while (code3 >= 64);
  12446. }
  12447. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  12448. if (codingLine[this.codingPos] < columns) {
  12449. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  12450. }
  12451. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12452. refPos += 2;
  12453. }
  12454. break;
  12455. case twoDimVertR3:
  12456. this._addPixels(refLine[refPos] + 3, blackPixels);
  12457. blackPixels ^= 1;
  12458. if (codingLine[this.codingPos] < columns) {
  12459. ++refPos;
  12460. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12461. refPos += 2;
  12462. }
  12463. }
  12464. break;
  12465. case twoDimVertR2:
  12466. this._addPixels(refLine[refPos] + 2, blackPixels);
  12467. blackPixels ^= 1;
  12468. if (codingLine[this.codingPos] < columns) {
  12469. ++refPos;
  12470. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12471. refPos += 2;
  12472. }
  12473. }
  12474. break;
  12475. case twoDimVertR1:
  12476. this._addPixels(refLine[refPos] + 1, blackPixels);
  12477. blackPixels ^= 1;
  12478. if (codingLine[this.codingPos] < columns) {
  12479. ++refPos;
  12480. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12481. refPos += 2;
  12482. }
  12483. }
  12484. break;
  12485. case twoDimVert0:
  12486. this._addPixels(refLine[refPos], blackPixels);
  12487. blackPixels ^= 1;
  12488. if (codingLine[this.codingPos] < columns) {
  12489. ++refPos;
  12490. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12491. refPos += 2;
  12492. }
  12493. }
  12494. break;
  12495. case twoDimVertL3:
  12496. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  12497. blackPixels ^= 1;
  12498. if (codingLine[this.codingPos] < columns) {
  12499. if (refPos > 0) {
  12500. --refPos;
  12501. } else {
  12502. ++refPos;
  12503. }
  12504. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12505. refPos += 2;
  12506. }
  12507. }
  12508. break;
  12509. case twoDimVertL2:
  12510. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  12511. blackPixels ^= 1;
  12512. if (codingLine[this.codingPos] < columns) {
  12513. if (refPos > 0) {
  12514. --refPos;
  12515. } else {
  12516. ++refPos;
  12517. }
  12518. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12519. refPos += 2;
  12520. }
  12521. }
  12522. break;
  12523. case twoDimVertL1:
  12524. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  12525. blackPixels ^= 1;
  12526. if (codingLine[this.codingPos] < columns) {
  12527. if (refPos > 0) {
  12528. --refPos;
  12529. } else {
  12530. ++refPos;
  12531. }
  12532. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12533. refPos += 2;
  12534. }
  12535. }
  12536. break;
  12537. case ccittEOF:
  12538. this._addPixels(columns, 0);
  12539. this.eof = true;
  12540. break;
  12541. default:
  12542. (0, _util.info)("bad 2d code");
  12543. this._addPixels(columns, 0);
  12544. this.err = true;
  12545. }
  12546. }
  12547. } else {
  12548. codingLine[0] = 0;
  12549. this.codingPos = 0;
  12550. blackPixels = 0;
  12551. while (codingLine[this.codingPos] < columns) {
  12552. code1 = 0;
  12553. if (blackPixels) {
  12554. do {
  12555. code1 += code3 = this._getBlackCode();
  12556. } while (code3 >= 64);
  12557. } else {
  12558. do {
  12559. code1 += code3 = this._getWhiteCode();
  12560. } while (code3 >= 64);
  12561. }
  12562. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  12563. blackPixels ^= 1;
  12564. }
  12565. }
  12566. let gotEOL = false;
  12567. if (this.byteAlign) {
  12568. this.inputBits &= ~7;
  12569. }
  12570. if (!this.eoblock && this.row === this.rows - 1) {
  12571. this.rowsDone = true;
  12572. } else {
  12573. code1 = this._lookBits(12);
  12574. if (this.eoline) {
  12575. while (code1 !== ccittEOF && code1 !== 1) {
  12576. this._eatBits(1);
  12577. code1 = this._lookBits(12);
  12578. }
  12579. } else {
  12580. while (code1 === 0) {
  12581. this._eatBits(1);
  12582. code1 = this._lookBits(12);
  12583. }
  12584. }
  12585. if (code1 === 1) {
  12586. this._eatBits(12);
  12587. gotEOL = true;
  12588. } else if (code1 === ccittEOF) {
  12589. this.eof = true;
  12590. }
  12591. }
  12592. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  12593. this.nextLine2D = !this._lookBits(1);
  12594. this._eatBits(1);
  12595. }
  12596. if (this.eoblock && gotEOL && this.byteAlign) {
  12597. code1 = this._lookBits(12);
  12598. if (code1 === 1) {
  12599. this._eatBits(12);
  12600. if (this.encoding > 0) {
  12601. this._lookBits(1);
  12602. this._eatBits(1);
  12603. }
  12604. if (this.encoding >= 0) {
  12605. for (i = 0; i < 4; ++i) {
  12606. code1 = this._lookBits(12);
  12607. if (code1 !== 1) {
  12608. (0, _util.info)("bad rtc code: " + code1);
  12609. }
  12610. this._eatBits(12);
  12611. if (this.encoding > 0) {
  12612. this._lookBits(1);
  12613. this._eatBits(1);
  12614. }
  12615. }
  12616. }
  12617. this.eof = true;
  12618. }
  12619. } else if (this.err && this.eoline) {
  12620. while (true) {
  12621. code1 = this._lookBits(13);
  12622. if (code1 === ccittEOF) {
  12623. this.eof = true;
  12624. return -1;
  12625. }
  12626. if (code1 >> 1 === 1) {
  12627. break;
  12628. }
  12629. this._eatBits(1);
  12630. }
  12631. this._eatBits(12);
  12632. if (this.encoding > 0) {
  12633. this._eatBits(1);
  12634. this.nextLine2D = !(code1 & 1);
  12635. }
  12636. }
  12637. if (codingLine[0] > 0) {
  12638. this.outputBits = codingLine[this.codingPos = 0];
  12639. } else {
  12640. this.outputBits = codingLine[this.codingPos = 1];
  12641. }
  12642. this.row++;
  12643. }
  12644. let c;
  12645. if (this.outputBits >= 8) {
  12646. c = this.codingPos & 1 ? 0 : 0xff;
  12647. this.outputBits -= 8;
  12648. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  12649. this.codingPos++;
  12650. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  12651. }
  12652. } else {
  12653. bits = 8;
  12654. c = 0;
  12655. do {
  12656. if (this.outputBits > bits) {
  12657. c <<= bits;
  12658. if (!(this.codingPos & 1)) {
  12659. c |= 0xff >> 8 - bits;
  12660. }
  12661. this.outputBits -= bits;
  12662. bits = 0;
  12663. } else {
  12664. c <<= this.outputBits;
  12665. if (!(this.codingPos & 1)) {
  12666. c |= 0xff >> 8 - this.outputBits;
  12667. }
  12668. bits -= this.outputBits;
  12669. this.outputBits = 0;
  12670. if (codingLine[this.codingPos] < columns) {
  12671. this.codingPos++;
  12672. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  12673. } else if (bits > 0) {
  12674. c <<= bits;
  12675. bits = 0;
  12676. }
  12677. }
  12678. } while (bits);
  12679. }
  12680. if (this.black) {
  12681. c ^= 0xff;
  12682. }
  12683. return c;
  12684. }
  12685. _addPixels(a1, blackPixels) {
  12686. const codingLine = this.codingLine;
  12687. let codingPos = this.codingPos;
  12688. if (a1 > codingLine[codingPos]) {
  12689. if (a1 > this.columns) {
  12690. (0, _util.info)("row is wrong length");
  12691. this.err = true;
  12692. a1 = this.columns;
  12693. }
  12694. if (codingPos & 1 ^ blackPixels) {
  12695. ++codingPos;
  12696. }
  12697. codingLine[codingPos] = a1;
  12698. }
  12699. this.codingPos = codingPos;
  12700. }
  12701. _addPixelsNeg(a1, blackPixels) {
  12702. const codingLine = this.codingLine;
  12703. let codingPos = this.codingPos;
  12704. if (a1 > codingLine[codingPos]) {
  12705. if (a1 > this.columns) {
  12706. (0, _util.info)("row is wrong length");
  12707. this.err = true;
  12708. a1 = this.columns;
  12709. }
  12710. if (codingPos & 1 ^ blackPixels) {
  12711. ++codingPos;
  12712. }
  12713. codingLine[codingPos] = a1;
  12714. } else if (a1 < codingLine[codingPos]) {
  12715. if (a1 < 0) {
  12716. (0, _util.info)("invalid code");
  12717. this.err = true;
  12718. a1 = 0;
  12719. }
  12720. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  12721. --codingPos;
  12722. }
  12723. codingLine[codingPos] = a1;
  12724. }
  12725. this.codingPos = codingPos;
  12726. }
  12727. _findTableCode(start, end, table, limit) {
  12728. const limitValue = limit || 0;
  12729. for (let i = start; i <= end; ++i) {
  12730. let code = this._lookBits(i);
  12731. if (code === ccittEOF) {
  12732. return [true, 1, false];
  12733. }
  12734. if (i < end) {
  12735. code <<= end - i;
  12736. }
  12737. if (!limitValue || code >= limitValue) {
  12738. const p = table[code - limitValue];
  12739. if (p[0] === i) {
  12740. this._eatBits(i);
  12741. return [true, p[1], true];
  12742. }
  12743. }
  12744. }
  12745. return [false, 0, false];
  12746. }
  12747. _getTwoDimCode() {
  12748. let code = 0;
  12749. let p;
  12750. if (this.eoblock) {
  12751. code = this._lookBits(7);
  12752. p = twoDimTable[code];
  12753. if (p && p[0] > 0) {
  12754. this._eatBits(p[0]);
  12755. return p[1];
  12756. }
  12757. } else {
  12758. const result = this._findTableCode(1, 7, twoDimTable);
  12759. if (result[0] && result[2]) {
  12760. return result[1];
  12761. }
  12762. }
  12763. (0, _util.info)("Bad two dim code");
  12764. return ccittEOF;
  12765. }
  12766. _getWhiteCode() {
  12767. let code = 0;
  12768. let p;
  12769. if (this.eoblock) {
  12770. code = this._lookBits(12);
  12771. if (code === ccittEOF) {
  12772. return 1;
  12773. }
  12774. if (code >> 5 === 0) {
  12775. p = whiteTable1[code];
  12776. } else {
  12777. p = whiteTable2[code >> 3];
  12778. }
  12779. if (p[0] > 0) {
  12780. this._eatBits(p[0]);
  12781. return p[1];
  12782. }
  12783. } else {
  12784. let result = this._findTableCode(1, 9, whiteTable2);
  12785. if (result[0]) {
  12786. return result[1];
  12787. }
  12788. result = this._findTableCode(11, 12, whiteTable1);
  12789. if (result[0]) {
  12790. return result[1];
  12791. }
  12792. }
  12793. (0, _util.info)("bad white code");
  12794. this._eatBits(1);
  12795. return 1;
  12796. }
  12797. _getBlackCode() {
  12798. let code, p;
  12799. if (this.eoblock) {
  12800. code = this._lookBits(13);
  12801. if (code === ccittEOF) {
  12802. return 1;
  12803. }
  12804. if (code >> 7 === 0) {
  12805. p = blackTable1[code];
  12806. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  12807. p = blackTable2[(code >> 1) - 64];
  12808. } else {
  12809. p = blackTable3[code >> 7];
  12810. }
  12811. if (p[0] > 0) {
  12812. this._eatBits(p[0]);
  12813. return p[1];
  12814. }
  12815. } else {
  12816. let result = this._findTableCode(2, 6, blackTable3);
  12817. if (result[0]) {
  12818. return result[1];
  12819. }
  12820. result = this._findTableCode(7, 12, blackTable2, 64);
  12821. if (result[0]) {
  12822. return result[1];
  12823. }
  12824. result = this._findTableCode(10, 13, blackTable1);
  12825. if (result[0]) {
  12826. return result[1];
  12827. }
  12828. }
  12829. (0, _util.info)("bad black code");
  12830. this._eatBits(1);
  12831. return 1;
  12832. }
  12833. _lookBits(n) {
  12834. let c;
  12835. while (this.inputBits < n) {
  12836. if ((c = this.source.next()) === -1) {
  12837. if (this.inputBits === 0) {
  12838. return ccittEOF;
  12839. }
  12840. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  12841. }
  12842. this.inputBuf = this.inputBuf << 8 | c;
  12843. this.inputBits += 8;
  12844. }
  12845. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  12846. }
  12847. _eatBits(n) {
  12848. if ((this.inputBits -= n) < 0) {
  12849. this.inputBits = 0;
  12850. }
  12851. }
  12852. }
  12853. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  12854. /***/ }),
  12855. /* 23 */
  12856. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12857. Object.defineProperty(exports, "__esModule", ({
  12858. value: true
  12859. }));
  12860. exports.FlateStream = void 0;
  12861. var _decode_stream = __w_pdfjs_require__(19);
  12862. var _util = __w_pdfjs_require__(2);
  12863. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  12864. 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]);
  12865. 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]);
  12866. 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];
  12867. 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];
  12868. class FlateStream extends _decode_stream.DecodeStream {
  12869. constructor(str, maybeLength) {
  12870. super(maybeLength);
  12871. this.str = str;
  12872. this.dict = str.dict;
  12873. const cmf = str.getByte();
  12874. const flg = str.getByte();
  12875. if (cmf === -1 || flg === -1) {
  12876. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  12877. }
  12878. if ((cmf & 0x0f) !== 0x08) {
  12879. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  12880. }
  12881. if (((cmf << 8) + flg) % 31 !== 0) {
  12882. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  12883. }
  12884. if (flg & 0x20) {
  12885. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  12886. }
  12887. this.codeSize = 0;
  12888. this.codeBuf = 0;
  12889. }
  12890. getBits(bits) {
  12891. const str = this.str;
  12892. let codeSize = this.codeSize;
  12893. let codeBuf = this.codeBuf;
  12894. let b;
  12895. while (codeSize < bits) {
  12896. if ((b = str.getByte()) === -1) {
  12897. throw new _util.FormatError("Bad encoding in flate stream");
  12898. }
  12899. codeBuf |= b << codeSize;
  12900. codeSize += 8;
  12901. }
  12902. b = codeBuf & (1 << bits) - 1;
  12903. this.codeBuf = codeBuf >> bits;
  12904. this.codeSize = codeSize -= bits;
  12905. return b;
  12906. }
  12907. getCode(table) {
  12908. const str = this.str;
  12909. const codes = table[0];
  12910. const maxLen = table[1];
  12911. let codeSize = this.codeSize;
  12912. let codeBuf = this.codeBuf;
  12913. let b;
  12914. while (codeSize < maxLen) {
  12915. if ((b = str.getByte()) === -1) {
  12916. break;
  12917. }
  12918. codeBuf |= b << codeSize;
  12919. codeSize += 8;
  12920. }
  12921. const code = codes[codeBuf & (1 << maxLen) - 1];
  12922. const codeLen = code >> 16;
  12923. const codeVal = code & 0xffff;
  12924. if (codeLen < 1 || codeSize < codeLen) {
  12925. throw new _util.FormatError("Bad encoding in flate stream");
  12926. }
  12927. this.codeBuf = codeBuf >> codeLen;
  12928. this.codeSize = codeSize - codeLen;
  12929. return codeVal;
  12930. }
  12931. generateHuffmanTable(lengths) {
  12932. const n = lengths.length;
  12933. let maxLen = 0;
  12934. let i;
  12935. for (i = 0; i < n; ++i) {
  12936. if (lengths[i] > maxLen) {
  12937. maxLen = lengths[i];
  12938. }
  12939. }
  12940. const size = 1 << maxLen;
  12941. const codes = new Int32Array(size);
  12942. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  12943. for (let val = 0; val < n; ++val) {
  12944. if (lengths[val] === len) {
  12945. let code2 = 0;
  12946. let t = code;
  12947. for (i = 0; i < len; ++i) {
  12948. code2 = code2 << 1 | t & 1;
  12949. t >>= 1;
  12950. }
  12951. for (i = code2; i < size; i += skip) {
  12952. codes[i] = len << 16 | val;
  12953. }
  12954. ++code;
  12955. }
  12956. }
  12957. }
  12958. return [codes, maxLen];
  12959. }
  12960. readBlock() {
  12961. let buffer, len;
  12962. const str = this.str;
  12963. let hdr = this.getBits(3);
  12964. if (hdr & 1) {
  12965. this.eof = true;
  12966. }
  12967. hdr >>= 1;
  12968. if (hdr === 0) {
  12969. let b;
  12970. if ((b = str.getByte()) === -1) {
  12971. throw new _util.FormatError("Bad block header in flate stream");
  12972. }
  12973. let blockLen = b;
  12974. if ((b = str.getByte()) === -1) {
  12975. throw new _util.FormatError("Bad block header in flate stream");
  12976. }
  12977. blockLen |= b << 8;
  12978. if ((b = str.getByte()) === -1) {
  12979. throw new _util.FormatError("Bad block header in flate stream");
  12980. }
  12981. let check = b;
  12982. if ((b = str.getByte()) === -1) {
  12983. throw new _util.FormatError("Bad block header in flate stream");
  12984. }
  12985. check |= b << 8;
  12986. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  12987. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  12988. }
  12989. this.codeBuf = 0;
  12990. this.codeSize = 0;
  12991. const bufferLength = this.bufferLength,
  12992. end = bufferLength + blockLen;
  12993. buffer = this.ensureBuffer(end);
  12994. this.bufferLength = end;
  12995. if (blockLen === 0) {
  12996. if (str.peekByte() === -1) {
  12997. this.eof = true;
  12998. }
  12999. } else {
  13000. const block = str.getBytes(blockLen);
  13001. buffer.set(block, bufferLength);
  13002. if (block.length < blockLen) {
  13003. this.eof = true;
  13004. }
  13005. }
  13006. return;
  13007. }
  13008. let litCodeTable;
  13009. let distCodeTable;
  13010. if (hdr === 1) {
  13011. litCodeTable = fixedLitCodeTab;
  13012. distCodeTable = fixedDistCodeTab;
  13013. } else if (hdr === 2) {
  13014. const numLitCodes = this.getBits(5) + 257;
  13015. const numDistCodes = this.getBits(5) + 1;
  13016. const numCodeLenCodes = this.getBits(4) + 4;
  13017. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  13018. let i;
  13019. for (i = 0; i < numCodeLenCodes; ++i) {
  13020. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  13021. }
  13022. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  13023. len = 0;
  13024. i = 0;
  13025. const codes = numLitCodes + numDistCodes;
  13026. const codeLengths = new Uint8Array(codes);
  13027. let bitsLength, bitsOffset, what;
  13028. while (i < codes) {
  13029. const code = this.getCode(codeLenCodeTab);
  13030. if (code === 16) {
  13031. bitsLength = 2;
  13032. bitsOffset = 3;
  13033. what = len;
  13034. } else if (code === 17) {
  13035. bitsLength = 3;
  13036. bitsOffset = 3;
  13037. what = len = 0;
  13038. } else if (code === 18) {
  13039. bitsLength = 7;
  13040. bitsOffset = 11;
  13041. what = len = 0;
  13042. } else {
  13043. codeLengths[i++] = len = code;
  13044. continue;
  13045. }
  13046. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  13047. while (repeatLength-- > 0) {
  13048. codeLengths[i++] = what;
  13049. }
  13050. }
  13051. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  13052. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  13053. } else {
  13054. throw new _util.FormatError("Unknown block type in flate stream");
  13055. }
  13056. buffer = this.buffer;
  13057. let limit = buffer ? buffer.length : 0;
  13058. let pos = this.bufferLength;
  13059. while (true) {
  13060. let code1 = this.getCode(litCodeTable);
  13061. if (code1 < 256) {
  13062. if (pos + 1 >= limit) {
  13063. buffer = this.ensureBuffer(pos + 1);
  13064. limit = buffer.length;
  13065. }
  13066. buffer[pos++] = code1;
  13067. continue;
  13068. }
  13069. if (code1 === 256) {
  13070. this.bufferLength = pos;
  13071. return;
  13072. }
  13073. code1 -= 257;
  13074. code1 = lengthDecode[code1];
  13075. let code2 = code1 >> 16;
  13076. if (code2 > 0) {
  13077. code2 = this.getBits(code2);
  13078. }
  13079. len = (code1 & 0xffff) + code2;
  13080. code1 = this.getCode(distCodeTable);
  13081. code1 = distDecode[code1];
  13082. code2 = code1 >> 16;
  13083. if (code2 > 0) {
  13084. code2 = this.getBits(code2);
  13085. }
  13086. const dist = (code1 & 0xffff) + code2;
  13087. if (pos + len >= limit) {
  13088. buffer = this.ensureBuffer(pos + len);
  13089. limit = buffer.length;
  13090. }
  13091. for (let k = 0; k < len; ++k, ++pos) {
  13092. buffer[pos] = buffer[pos - dist];
  13093. }
  13094. }
  13095. }
  13096. }
  13097. exports.FlateStream = FlateStream;
  13098. /***/ }),
  13099. /* 24 */
  13100. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13101. Object.defineProperty(exports, "__esModule", ({
  13102. value: true
  13103. }));
  13104. exports.Jbig2Stream = void 0;
  13105. var _primitives = __w_pdfjs_require__(5);
  13106. var _decode_stream = __w_pdfjs_require__(19);
  13107. var _jbig = __w_pdfjs_require__(25);
  13108. var _util = __w_pdfjs_require__(2);
  13109. class Jbig2Stream extends _decode_stream.DecodeStream {
  13110. constructor(stream, maybeLength, params) {
  13111. super(maybeLength);
  13112. this.stream = stream;
  13113. this.dict = stream.dict;
  13114. this.maybeLength = maybeLength;
  13115. this.params = params;
  13116. }
  13117. get bytes() {
  13118. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  13119. }
  13120. ensureBuffer(requested) {}
  13121. readBlock() {
  13122. if (this.eof) {
  13123. return;
  13124. }
  13125. const jbig2Image = new _jbig.Jbig2Image();
  13126. const chunks = [];
  13127. if ((0, _primitives.isDict)(this.params)) {
  13128. const globalsStream = this.params.get("JBIG2Globals");
  13129. if ((0, _primitives.isStream)(globalsStream)) {
  13130. const globals = globalsStream.getBytes();
  13131. chunks.push({
  13132. data: globals,
  13133. start: 0,
  13134. end: globals.length
  13135. });
  13136. }
  13137. }
  13138. chunks.push({
  13139. data: this.bytes,
  13140. start: 0,
  13141. end: this.bytes.length
  13142. });
  13143. const data = jbig2Image.parseChunks(chunks);
  13144. const dataLength = data.length;
  13145. for (let i = 0; i < dataLength; i++) {
  13146. data[i] ^= 0xff;
  13147. }
  13148. this.buffer = data;
  13149. this.bufferLength = dataLength;
  13150. this.eof = true;
  13151. }
  13152. }
  13153. exports.Jbig2Stream = Jbig2Stream;
  13154. /***/ }),
  13155. /* 25 */
  13156. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13157. Object.defineProperty(exports, "__esModule", ({
  13158. value: true
  13159. }));
  13160. exports.Jbig2Image = void 0;
  13161. var _util = __w_pdfjs_require__(2);
  13162. var _core_utils = __w_pdfjs_require__(9);
  13163. var _arithmetic_decoder = __w_pdfjs_require__(26);
  13164. var _ccitt = __w_pdfjs_require__(22);
  13165. class Jbig2Error extends _util.BaseException {
  13166. constructor(msg) {
  13167. super(`JBIG2 error: ${msg}`);
  13168. }
  13169. }
  13170. class ContextCache {
  13171. getContexts(id) {
  13172. if (id in this) {
  13173. return this[id];
  13174. }
  13175. return this[id] = new Int8Array(1 << 16);
  13176. }
  13177. }
  13178. class DecodingContext {
  13179. constructor(data, start, end) {
  13180. this.data = data;
  13181. this.start = start;
  13182. this.end = end;
  13183. }
  13184. get decoder() {
  13185. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  13186. return (0, _util.shadow)(this, "decoder", decoder);
  13187. }
  13188. get contextCache() {
  13189. const cache = new ContextCache();
  13190. return (0, _util.shadow)(this, "contextCache", cache);
  13191. }
  13192. }
  13193. function decodeInteger(contextCache, procedure, decoder) {
  13194. const contexts = contextCache.getContexts(procedure);
  13195. let prev = 1;
  13196. function readBits(length) {
  13197. let v = 0;
  13198. for (let i = 0; i < length; i++) {
  13199. const bit = decoder.readBit(contexts, prev);
  13200. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  13201. v = v << 1 | bit;
  13202. }
  13203. return v >>> 0;
  13204. }
  13205. const sign = readBits(1);
  13206. 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);
  13207. if (sign === 0) {
  13208. return value;
  13209. } else if (value > 0) {
  13210. return -value;
  13211. }
  13212. return null;
  13213. }
  13214. function decodeIAID(contextCache, decoder, codeLength) {
  13215. const contexts = contextCache.getContexts("IAID");
  13216. let prev = 1;
  13217. for (let i = 0; i < codeLength; i++) {
  13218. const bit = decoder.readBit(contexts, prev);
  13219. prev = prev << 1 | bit;
  13220. }
  13221. if (codeLength < 31) {
  13222. return prev & (1 << codeLength) - 1;
  13223. }
  13224. return prev & 0x7fffffff;
  13225. }
  13226. 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"];
  13227. const CodingTemplates = [[{
  13228. x: -1,
  13229. y: -2
  13230. }, {
  13231. x: 0,
  13232. y: -2
  13233. }, {
  13234. x: 1,
  13235. y: -2
  13236. }, {
  13237. x: -2,
  13238. y: -1
  13239. }, {
  13240. x: -1,
  13241. y: -1
  13242. }, {
  13243. x: 0,
  13244. y: -1
  13245. }, {
  13246. x: 1,
  13247. y: -1
  13248. }, {
  13249. x: 2,
  13250. y: -1
  13251. }, {
  13252. x: -4,
  13253. y: 0
  13254. }, {
  13255. x: -3,
  13256. y: 0
  13257. }, {
  13258. x: -2,
  13259. y: 0
  13260. }, {
  13261. x: -1,
  13262. y: 0
  13263. }], [{
  13264. x: -1,
  13265. y: -2
  13266. }, {
  13267. x: 0,
  13268. y: -2
  13269. }, {
  13270. x: 1,
  13271. y: -2
  13272. }, {
  13273. x: 2,
  13274. y: -2
  13275. }, {
  13276. x: -2,
  13277. y: -1
  13278. }, {
  13279. x: -1,
  13280. y: -1
  13281. }, {
  13282. x: 0,
  13283. y: -1
  13284. }, {
  13285. x: 1,
  13286. y: -1
  13287. }, {
  13288. x: 2,
  13289. y: -1
  13290. }, {
  13291. x: -3,
  13292. y: 0
  13293. }, {
  13294. x: -2,
  13295. y: 0
  13296. }, {
  13297. x: -1,
  13298. y: 0
  13299. }], [{
  13300. x: -1,
  13301. y: -2
  13302. }, {
  13303. x: 0,
  13304. y: -2
  13305. }, {
  13306. x: 1,
  13307. y: -2
  13308. }, {
  13309. x: -2,
  13310. y: -1
  13311. }, {
  13312. x: -1,
  13313. y: -1
  13314. }, {
  13315. x: 0,
  13316. y: -1
  13317. }, {
  13318. x: 1,
  13319. y: -1
  13320. }, {
  13321. x: -2,
  13322. y: 0
  13323. }, {
  13324. x: -1,
  13325. y: 0
  13326. }], [{
  13327. x: -3,
  13328. y: -1
  13329. }, {
  13330. x: -2,
  13331. y: -1
  13332. }, {
  13333. x: -1,
  13334. y: -1
  13335. }, {
  13336. x: 0,
  13337. y: -1
  13338. }, {
  13339. x: 1,
  13340. y: -1
  13341. }, {
  13342. x: -4,
  13343. y: 0
  13344. }, {
  13345. x: -3,
  13346. y: 0
  13347. }, {
  13348. x: -2,
  13349. y: 0
  13350. }, {
  13351. x: -1,
  13352. y: 0
  13353. }]];
  13354. const RefinementTemplates = [{
  13355. coding: [{
  13356. x: 0,
  13357. y: -1
  13358. }, {
  13359. x: 1,
  13360. y: -1
  13361. }, {
  13362. x: -1,
  13363. y: 0
  13364. }],
  13365. reference: [{
  13366. x: 0,
  13367. y: -1
  13368. }, {
  13369. x: 1,
  13370. y: -1
  13371. }, {
  13372. x: -1,
  13373. y: 0
  13374. }, {
  13375. x: 0,
  13376. y: 0
  13377. }, {
  13378. x: 1,
  13379. y: 0
  13380. }, {
  13381. x: -1,
  13382. y: 1
  13383. }, {
  13384. x: 0,
  13385. y: 1
  13386. }, {
  13387. x: 1,
  13388. y: 1
  13389. }]
  13390. }, {
  13391. coding: [{
  13392. x: -1,
  13393. y: -1
  13394. }, {
  13395. x: 0,
  13396. y: -1
  13397. }, {
  13398. x: 1,
  13399. y: -1
  13400. }, {
  13401. x: -1,
  13402. y: 0
  13403. }],
  13404. reference: [{
  13405. x: 0,
  13406. y: -1
  13407. }, {
  13408. x: -1,
  13409. y: 0
  13410. }, {
  13411. x: 0,
  13412. y: 0
  13413. }, {
  13414. x: 1,
  13415. y: 0
  13416. }, {
  13417. x: 0,
  13418. y: 1
  13419. }, {
  13420. x: 1,
  13421. y: 1
  13422. }]
  13423. }];
  13424. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  13425. const RefinementReusedContexts = [0x0020, 0x0008];
  13426. function decodeBitmapTemplate0(width, height, decodingContext) {
  13427. const decoder = decodingContext.decoder;
  13428. const contexts = decodingContext.contextCache.getContexts("GB");
  13429. const bitmap = [];
  13430. let contextLabel, i, j, pixel, row, row1, row2;
  13431. const OLD_PIXEL_MASK = 0x7bf7;
  13432. for (i = 0; i < height; i++) {
  13433. row = bitmap[i] = new Uint8Array(width);
  13434. row1 = i < 1 ? row : bitmap[i - 1];
  13435. row2 = i < 2 ? row : bitmap[i - 2];
  13436. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  13437. for (j = 0; j < width; j++) {
  13438. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  13439. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  13440. }
  13441. }
  13442. return bitmap;
  13443. }
  13444. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  13445. if (mmr) {
  13446. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  13447. return decodeMMRBitmap(input, width, height, false);
  13448. }
  13449. 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) {
  13450. return decodeBitmapTemplate0(width, height, decodingContext);
  13451. }
  13452. const useskip = !!skip;
  13453. const template = CodingTemplates[templateIndex].concat(at);
  13454. template.sort(function (a, b) {
  13455. return a.y - b.y || a.x - b.x;
  13456. });
  13457. const templateLength = template.length;
  13458. const templateX = new Int8Array(templateLength);
  13459. const templateY = new Int8Array(templateLength);
  13460. const changingTemplateEntries = [];
  13461. let reuseMask = 0,
  13462. minX = 0,
  13463. maxX = 0,
  13464. minY = 0;
  13465. let c, k;
  13466. for (k = 0; k < templateLength; k++) {
  13467. templateX[k] = template[k].x;
  13468. templateY[k] = template[k].y;
  13469. minX = Math.min(minX, template[k].x);
  13470. maxX = Math.max(maxX, template[k].x);
  13471. minY = Math.min(minY, template[k].y);
  13472. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  13473. reuseMask |= 1 << templateLength - 1 - k;
  13474. } else {
  13475. changingTemplateEntries.push(k);
  13476. }
  13477. }
  13478. const changingEntriesLength = changingTemplateEntries.length;
  13479. const changingTemplateX = new Int8Array(changingEntriesLength);
  13480. const changingTemplateY = new Int8Array(changingEntriesLength);
  13481. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  13482. for (c = 0; c < changingEntriesLength; c++) {
  13483. k = changingTemplateEntries[c];
  13484. changingTemplateX[c] = template[k].x;
  13485. changingTemplateY[c] = template[k].y;
  13486. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  13487. }
  13488. const sbb_left = -minX;
  13489. const sbb_top = -minY;
  13490. const sbb_right = width - maxX;
  13491. const pseudoPixelContext = ReusedContexts[templateIndex];
  13492. let row = new Uint8Array(width);
  13493. const bitmap = [];
  13494. const decoder = decodingContext.decoder;
  13495. const contexts = decodingContext.contextCache.getContexts("GB");
  13496. let ltp = 0,
  13497. j,
  13498. i0,
  13499. j0,
  13500. contextLabel = 0,
  13501. bit,
  13502. shift;
  13503. for (let i = 0; i < height; i++) {
  13504. if (prediction) {
  13505. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  13506. ltp ^= sltp;
  13507. if (ltp) {
  13508. bitmap.push(row);
  13509. continue;
  13510. }
  13511. }
  13512. row = new Uint8Array(row);
  13513. bitmap.push(row);
  13514. for (j = 0; j < width; j++) {
  13515. if (useskip && skip[i][j]) {
  13516. row[j] = 0;
  13517. continue;
  13518. }
  13519. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  13520. contextLabel = contextLabel << 1 & reuseMask;
  13521. for (k = 0; k < changingEntriesLength; k++) {
  13522. i0 = i + changingTemplateY[k];
  13523. j0 = j + changingTemplateX[k];
  13524. bit = bitmap[i0][j0];
  13525. if (bit) {
  13526. bit = changingTemplateBit[k];
  13527. contextLabel |= bit;
  13528. }
  13529. }
  13530. } else {
  13531. contextLabel = 0;
  13532. shift = templateLength - 1;
  13533. for (k = 0; k < templateLength; k++, shift--) {
  13534. j0 = j + templateX[k];
  13535. if (j0 >= 0 && j0 < width) {
  13536. i0 = i + templateY[k];
  13537. if (i0 >= 0) {
  13538. bit = bitmap[i0][j0];
  13539. if (bit) {
  13540. contextLabel |= bit << shift;
  13541. }
  13542. }
  13543. }
  13544. }
  13545. }
  13546. const pixel = decoder.readBit(contexts, contextLabel);
  13547. row[j] = pixel;
  13548. }
  13549. }
  13550. return bitmap;
  13551. }
  13552. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  13553. let codingTemplate = RefinementTemplates[templateIndex].coding;
  13554. if (templateIndex === 0) {
  13555. codingTemplate = codingTemplate.concat([at[0]]);
  13556. }
  13557. const codingTemplateLength = codingTemplate.length;
  13558. const codingTemplateX = new Int32Array(codingTemplateLength);
  13559. const codingTemplateY = new Int32Array(codingTemplateLength);
  13560. let k;
  13561. for (k = 0; k < codingTemplateLength; k++) {
  13562. codingTemplateX[k] = codingTemplate[k].x;
  13563. codingTemplateY[k] = codingTemplate[k].y;
  13564. }
  13565. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  13566. if (templateIndex === 0) {
  13567. referenceTemplate = referenceTemplate.concat([at[1]]);
  13568. }
  13569. const referenceTemplateLength = referenceTemplate.length;
  13570. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  13571. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  13572. for (k = 0; k < referenceTemplateLength; k++) {
  13573. referenceTemplateX[k] = referenceTemplate[k].x;
  13574. referenceTemplateY[k] = referenceTemplate[k].y;
  13575. }
  13576. const referenceWidth = referenceBitmap[0].length;
  13577. const referenceHeight = referenceBitmap.length;
  13578. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  13579. const bitmap = [];
  13580. const decoder = decodingContext.decoder;
  13581. const contexts = decodingContext.contextCache.getContexts("GR");
  13582. let ltp = 0;
  13583. for (let i = 0; i < height; i++) {
  13584. if (prediction) {
  13585. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  13586. ltp ^= sltp;
  13587. if (ltp) {
  13588. throw new Jbig2Error("prediction is not supported");
  13589. }
  13590. }
  13591. const row = new Uint8Array(width);
  13592. bitmap.push(row);
  13593. for (let j = 0; j < width; j++) {
  13594. let i0, j0;
  13595. let contextLabel = 0;
  13596. for (k = 0; k < codingTemplateLength; k++) {
  13597. i0 = i + codingTemplateY[k];
  13598. j0 = j + codingTemplateX[k];
  13599. if (i0 < 0 || j0 < 0 || j0 >= width) {
  13600. contextLabel <<= 1;
  13601. } else {
  13602. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  13603. }
  13604. }
  13605. for (k = 0; k < referenceTemplateLength; k++) {
  13606. i0 = i + referenceTemplateY[k] - offsetY;
  13607. j0 = j + referenceTemplateX[k] - offsetX;
  13608. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  13609. contextLabel <<= 1;
  13610. } else {
  13611. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  13612. }
  13613. }
  13614. const pixel = decoder.readBit(contexts, contextLabel);
  13615. row[j] = pixel;
  13616. }
  13617. }
  13618. return bitmap;
  13619. }
  13620. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  13621. if (huffman && refinement) {
  13622. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  13623. }
  13624. const newSymbols = [];
  13625. let currentHeight = 0;
  13626. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  13627. const decoder = decodingContext.decoder;
  13628. const contextCache = decodingContext.contextCache;
  13629. let tableB1, symbolWidths;
  13630. if (huffman) {
  13631. tableB1 = getStandardTable(1);
  13632. symbolWidths = [];
  13633. symbolCodeLength = Math.max(symbolCodeLength, 1);
  13634. }
  13635. while (newSymbols.length < numberOfNewSymbols) {
  13636. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  13637. currentHeight += deltaHeight;
  13638. let currentWidth = 0,
  13639. totalWidth = 0;
  13640. const firstSymbol = huffman ? symbolWidths.length : 0;
  13641. while (true) {
  13642. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  13643. if (deltaWidth === null) {
  13644. break;
  13645. }
  13646. currentWidth += deltaWidth;
  13647. totalWidth += currentWidth;
  13648. let bitmap;
  13649. if (refinement) {
  13650. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  13651. if (numberOfInstances > 1) {
  13652. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  13653. } else {
  13654. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  13655. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  13656. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  13657. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  13658. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  13659. }
  13660. newSymbols.push(bitmap);
  13661. } else if (huffman) {
  13662. symbolWidths.push(currentWidth);
  13663. } else {
  13664. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  13665. newSymbols.push(bitmap);
  13666. }
  13667. }
  13668. if (huffman && !refinement) {
  13669. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  13670. huffmanInput.byteAlign();
  13671. let collectiveBitmap;
  13672. if (bitmapSize === 0) {
  13673. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  13674. } else {
  13675. const originalEnd = huffmanInput.end;
  13676. const bitmapEnd = huffmanInput.position + bitmapSize;
  13677. huffmanInput.end = bitmapEnd;
  13678. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  13679. huffmanInput.end = originalEnd;
  13680. huffmanInput.position = bitmapEnd;
  13681. }
  13682. const numberOfSymbolsDecoded = symbolWidths.length;
  13683. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  13684. newSymbols.push(collectiveBitmap);
  13685. } else {
  13686. let i,
  13687. y,
  13688. xMin = 0,
  13689. xMax,
  13690. bitmapWidth,
  13691. symbolBitmap;
  13692. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  13693. bitmapWidth = symbolWidths[i];
  13694. xMax = xMin + bitmapWidth;
  13695. symbolBitmap = [];
  13696. for (y = 0; y < currentHeight; y++) {
  13697. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  13698. }
  13699. newSymbols.push(symbolBitmap);
  13700. xMin = xMax;
  13701. }
  13702. }
  13703. }
  13704. }
  13705. const exportedSymbols = [],
  13706. flags = [];
  13707. let currentFlag = false,
  13708. i,
  13709. ii;
  13710. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  13711. while (flags.length < totalSymbolsLength) {
  13712. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  13713. while (runLength--) {
  13714. flags.push(currentFlag);
  13715. }
  13716. currentFlag = !currentFlag;
  13717. }
  13718. for (i = 0, ii = symbols.length; i < ii; i++) {
  13719. if (flags[i]) {
  13720. exportedSymbols.push(symbols[i]);
  13721. }
  13722. }
  13723. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  13724. if (flags[i]) {
  13725. exportedSymbols.push(newSymbols[j]);
  13726. }
  13727. }
  13728. return exportedSymbols;
  13729. }
  13730. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  13731. if (huffman && refinement) {
  13732. throw new Jbig2Error("refinement with Huffman is not supported");
  13733. }
  13734. const bitmap = [];
  13735. let i, row;
  13736. for (i = 0; i < height; i++) {
  13737. row = new Uint8Array(width);
  13738. if (defaultPixelValue) {
  13739. for (let j = 0; j < width; j++) {
  13740. row[j] = defaultPixelValue;
  13741. }
  13742. }
  13743. bitmap.push(row);
  13744. }
  13745. const decoder = decodingContext.decoder;
  13746. const contextCache = decodingContext.contextCache;
  13747. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  13748. let firstS = 0;
  13749. i = 0;
  13750. while (i < numberOfSymbolInstances) {
  13751. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  13752. stripT += deltaT;
  13753. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  13754. firstS += deltaFirstS;
  13755. let currentS = firstS;
  13756. do {
  13757. let currentT = 0;
  13758. if (stripSize > 1) {
  13759. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  13760. }
  13761. const t = stripSize * stripT + currentT;
  13762. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  13763. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  13764. let symbolBitmap = inputSymbols[symbolId];
  13765. let symbolWidth = symbolBitmap[0].length;
  13766. let symbolHeight = symbolBitmap.length;
  13767. if (applyRefinement) {
  13768. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  13769. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  13770. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  13771. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  13772. symbolWidth += rdw;
  13773. symbolHeight += rdh;
  13774. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  13775. }
  13776. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  13777. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  13778. let s2, t2, symbolRow;
  13779. if (transposed) {
  13780. for (s2 = 0; s2 < symbolHeight; s2++) {
  13781. row = bitmap[offsetS + s2];
  13782. if (!row) {
  13783. continue;
  13784. }
  13785. symbolRow = symbolBitmap[s2];
  13786. const maxWidth = Math.min(width - offsetT, symbolWidth);
  13787. switch (combinationOperator) {
  13788. case 0:
  13789. for (t2 = 0; t2 < maxWidth; t2++) {
  13790. row[offsetT + t2] |= symbolRow[t2];
  13791. }
  13792. break;
  13793. case 2:
  13794. for (t2 = 0; t2 < maxWidth; t2++) {
  13795. row[offsetT + t2] ^= symbolRow[t2];
  13796. }
  13797. break;
  13798. default:
  13799. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  13800. }
  13801. }
  13802. currentS += symbolHeight - 1;
  13803. } else {
  13804. for (t2 = 0; t2 < symbolHeight; t2++) {
  13805. row = bitmap[offsetT + t2];
  13806. if (!row) {
  13807. continue;
  13808. }
  13809. symbolRow = symbolBitmap[t2];
  13810. switch (combinationOperator) {
  13811. case 0:
  13812. for (s2 = 0; s2 < symbolWidth; s2++) {
  13813. row[offsetS + s2] |= symbolRow[s2];
  13814. }
  13815. break;
  13816. case 2:
  13817. for (s2 = 0; s2 < symbolWidth; s2++) {
  13818. row[offsetS + s2] ^= symbolRow[s2];
  13819. }
  13820. break;
  13821. default:
  13822. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  13823. }
  13824. }
  13825. currentS += symbolWidth - 1;
  13826. }
  13827. i++;
  13828. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  13829. if (deltaS === null) {
  13830. break;
  13831. }
  13832. currentS += deltaS + dsOffset;
  13833. } while (true);
  13834. }
  13835. return bitmap;
  13836. }
  13837. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  13838. const at = [];
  13839. if (!mmr) {
  13840. at.push({
  13841. x: -patternWidth,
  13842. y: 0
  13843. });
  13844. if (template === 0) {
  13845. at.push({
  13846. x: -3,
  13847. y: -1
  13848. }, {
  13849. x: 2,
  13850. y: -2
  13851. }, {
  13852. x: -2,
  13853. y: -2
  13854. });
  13855. }
  13856. }
  13857. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  13858. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  13859. const patterns = [];
  13860. for (let i = 0; i <= maxPatternIndex; i++) {
  13861. const patternBitmap = [];
  13862. const xMin = patternWidth * i;
  13863. const xMax = xMin + patternWidth;
  13864. for (let y = 0; y < patternHeight; y++) {
  13865. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  13866. }
  13867. patterns.push(patternBitmap);
  13868. }
  13869. return patterns;
  13870. }
  13871. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  13872. const skip = null;
  13873. if (enableSkip) {
  13874. throw new Jbig2Error("skip is not supported");
  13875. }
  13876. if (combinationOperator !== 0) {
  13877. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  13878. }
  13879. const regionBitmap = [];
  13880. let i, j, row;
  13881. for (i = 0; i < regionHeight; i++) {
  13882. row = new Uint8Array(regionWidth);
  13883. if (defaultPixelValue) {
  13884. for (j = 0; j < regionWidth; j++) {
  13885. row[j] = defaultPixelValue;
  13886. }
  13887. }
  13888. regionBitmap.push(row);
  13889. }
  13890. const numberOfPatterns = patterns.length;
  13891. const pattern0 = patterns[0];
  13892. const patternWidth = pattern0[0].length,
  13893. patternHeight = pattern0.length;
  13894. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  13895. const at = [];
  13896. if (!mmr) {
  13897. at.push({
  13898. x: template <= 1 ? 3 : 2,
  13899. y: -1
  13900. });
  13901. if (template === 0) {
  13902. at.push({
  13903. x: -3,
  13904. y: -1
  13905. }, {
  13906. x: 2,
  13907. y: -2
  13908. }, {
  13909. x: -2,
  13910. y: -2
  13911. });
  13912. }
  13913. }
  13914. const grayScaleBitPlanes = [];
  13915. let mmrInput, bitmap;
  13916. if (mmr) {
  13917. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  13918. }
  13919. for (i = bitsPerValue - 1; i >= 0; i--) {
  13920. if (mmr) {
  13921. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  13922. } else {
  13923. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  13924. }
  13925. grayScaleBitPlanes[i] = bitmap;
  13926. }
  13927. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  13928. for (mg = 0; mg < gridHeight; mg++) {
  13929. for (ng = 0; ng < gridWidth; ng++) {
  13930. bit = 0;
  13931. patternIndex = 0;
  13932. for (j = bitsPerValue - 1; j >= 0; j--) {
  13933. bit ^= grayScaleBitPlanes[j][mg][ng];
  13934. patternIndex |= bit << j;
  13935. }
  13936. patternBitmap = patterns[patternIndex];
  13937. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  13938. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  13939. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  13940. for (i = 0; i < patternHeight; i++) {
  13941. regionRow = regionBitmap[y + i];
  13942. patternRow = patternBitmap[i];
  13943. for (j = 0; j < patternWidth; j++) {
  13944. regionRow[x + j] |= patternRow[j];
  13945. }
  13946. }
  13947. } else {
  13948. let regionX, regionY;
  13949. for (i = 0; i < patternHeight; i++) {
  13950. regionY = y + i;
  13951. if (regionY < 0 || regionY >= regionHeight) {
  13952. continue;
  13953. }
  13954. regionRow = regionBitmap[regionY];
  13955. patternRow = patternBitmap[i];
  13956. for (j = 0; j < patternWidth; j++) {
  13957. regionX = x + j;
  13958. if (regionX >= 0 && regionX < regionWidth) {
  13959. regionRow[regionX] |= patternRow[j];
  13960. }
  13961. }
  13962. }
  13963. }
  13964. }
  13965. }
  13966. return regionBitmap;
  13967. }
  13968. function readSegmentHeader(data, start) {
  13969. const segmentHeader = {};
  13970. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  13971. const flags = data[start + 4];
  13972. const segmentType = flags & 0x3f;
  13973. if (!SegmentTypes[segmentType]) {
  13974. throw new Jbig2Error("invalid segment type: " + segmentType);
  13975. }
  13976. segmentHeader.type = segmentType;
  13977. segmentHeader.typeName = SegmentTypes[segmentType];
  13978. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  13979. const pageAssociationFieldSize = !!(flags & 0x40);
  13980. const referredFlags = data[start + 5];
  13981. let referredToCount = referredFlags >> 5 & 7;
  13982. const retainBits = [referredFlags & 31];
  13983. let position = start + 6;
  13984. if (referredFlags === 7) {
  13985. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  13986. position += 3;
  13987. let bytes = referredToCount + 7 >> 3;
  13988. retainBits[0] = data[position++];
  13989. while (--bytes > 0) {
  13990. retainBits.push(data[position++]);
  13991. }
  13992. } else if (referredFlags === 5 || referredFlags === 6) {
  13993. throw new Jbig2Error("invalid referred-to flags");
  13994. }
  13995. segmentHeader.retainBits = retainBits;
  13996. let referredToSegmentNumberSize = 4;
  13997. if (segmentHeader.number <= 256) {
  13998. referredToSegmentNumberSize = 1;
  13999. } else if (segmentHeader.number <= 65536) {
  14000. referredToSegmentNumberSize = 2;
  14001. }
  14002. const referredTo = [];
  14003. let i, ii;
  14004. for (i = 0; i < referredToCount; i++) {
  14005. let number;
  14006. if (referredToSegmentNumberSize === 1) {
  14007. number = data[position];
  14008. } else if (referredToSegmentNumberSize === 2) {
  14009. number = (0, _core_utils.readUint16)(data, position);
  14010. } else {
  14011. number = (0, _core_utils.readUint32)(data, position);
  14012. }
  14013. referredTo.push(number);
  14014. position += referredToSegmentNumberSize;
  14015. }
  14016. segmentHeader.referredTo = referredTo;
  14017. if (!pageAssociationFieldSize) {
  14018. segmentHeader.pageAssociation = data[position++];
  14019. } else {
  14020. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  14021. position += 4;
  14022. }
  14023. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  14024. position += 4;
  14025. if (segmentHeader.length === 0xffffffff) {
  14026. if (segmentType === 38) {
  14027. const genericRegionInfo = readRegionSegmentInformation(data, position);
  14028. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  14029. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  14030. const searchPatternLength = 6;
  14031. const searchPattern = new Uint8Array(searchPatternLength);
  14032. if (!genericRegionMmr) {
  14033. searchPattern[0] = 0xff;
  14034. searchPattern[1] = 0xac;
  14035. }
  14036. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  14037. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  14038. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  14039. searchPattern[5] = genericRegionInfo.height & 0xff;
  14040. for (i = position, ii = data.length; i < ii; i++) {
  14041. let j = 0;
  14042. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  14043. j++;
  14044. }
  14045. if (j === searchPatternLength) {
  14046. segmentHeader.length = i + searchPatternLength;
  14047. break;
  14048. }
  14049. }
  14050. if (segmentHeader.length === 0xffffffff) {
  14051. throw new Jbig2Error("segment end was not found");
  14052. }
  14053. } else {
  14054. throw new Jbig2Error("invalid unknown segment length");
  14055. }
  14056. }
  14057. segmentHeader.headerEnd = position;
  14058. return segmentHeader;
  14059. }
  14060. function readSegments(header, data, start, end) {
  14061. const segments = [];
  14062. let position = start;
  14063. while (position < end) {
  14064. const segmentHeader = readSegmentHeader(data, position);
  14065. position = segmentHeader.headerEnd;
  14066. const segment = {
  14067. header: segmentHeader,
  14068. data
  14069. };
  14070. if (!header.randomAccess) {
  14071. segment.start = position;
  14072. position += segmentHeader.length;
  14073. segment.end = position;
  14074. }
  14075. segments.push(segment);
  14076. if (segmentHeader.type === 51) {
  14077. break;
  14078. }
  14079. }
  14080. if (header.randomAccess) {
  14081. for (let i = 0, ii = segments.length; i < ii; i++) {
  14082. segments[i].start = position;
  14083. position += segments[i].header.length;
  14084. segments[i].end = position;
  14085. }
  14086. }
  14087. return segments;
  14088. }
  14089. function readRegionSegmentInformation(data, start) {
  14090. return {
  14091. width: (0, _core_utils.readUint32)(data, start),
  14092. height: (0, _core_utils.readUint32)(data, start + 4),
  14093. x: (0, _core_utils.readUint32)(data, start + 8),
  14094. y: (0, _core_utils.readUint32)(data, start + 12),
  14095. combinationOperator: data[start + 16] & 7
  14096. };
  14097. }
  14098. const RegionSegmentInformationFieldLength = 17;
  14099. function processSegment(segment, visitor) {
  14100. const header = segment.header;
  14101. const data = segment.data,
  14102. end = segment.end;
  14103. let position = segment.start;
  14104. let args, at, i, atLength;
  14105. switch (header.type) {
  14106. case 0:
  14107. const dictionary = {};
  14108. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  14109. dictionary.huffman = !!(dictionaryFlags & 1);
  14110. dictionary.refinement = !!(dictionaryFlags & 2);
  14111. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  14112. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  14113. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  14114. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  14115. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  14116. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  14117. dictionary.template = dictionaryFlags >> 10 & 3;
  14118. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  14119. position += 2;
  14120. if (!dictionary.huffman) {
  14121. atLength = dictionary.template === 0 ? 4 : 1;
  14122. at = [];
  14123. for (i = 0; i < atLength; i++) {
  14124. at.push({
  14125. x: (0, _core_utils.readInt8)(data, position),
  14126. y: (0, _core_utils.readInt8)(data, position + 1)
  14127. });
  14128. position += 2;
  14129. }
  14130. dictionary.at = at;
  14131. }
  14132. if (dictionary.refinement && !dictionary.refinementTemplate) {
  14133. at = [];
  14134. for (i = 0; i < 2; i++) {
  14135. at.push({
  14136. x: (0, _core_utils.readInt8)(data, position),
  14137. y: (0, _core_utils.readInt8)(data, position + 1)
  14138. });
  14139. position += 2;
  14140. }
  14141. dictionary.refinementAt = at;
  14142. }
  14143. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  14144. position += 4;
  14145. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  14146. position += 4;
  14147. args = [dictionary, header.number, header.referredTo, data, position, end];
  14148. break;
  14149. case 6:
  14150. case 7:
  14151. const textRegion = {};
  14152. textRegion.info = readRegionSegmentInformation(data, position);
  14153. position += RegionSegmentInformationFieldLength;
  14154. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  14155. position += 2;
  14156. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  14157. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  14158. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  14159. textRegion.stripSize = 1 << textRegion.logStripSize;
  14160. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  14161. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  14162. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  14163. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  14164. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  14165. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  14166. if (textRegion.huffman) {
  14167. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  14168. position += 2;
  14169. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  14170. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  14171. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  14172. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  14173. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  14174. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  14175. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  14176. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  14177. }
  14178. if (textRegion.refinement && !textRegion.refinementTemplate) {
  14179. at = [];
  14180. for (i = 0; i < 2; i++) {
  14181. at.push({
  14182. x: (0, _core_utils.readInt8)(data, position),
  14183. y: (0, _core_utils.readInt8)(data, position + 1)
  14184. });
  14185. position += 2;
  14186. }
  14187. textRegion.refinementAt = at;
  14188. }
  14189. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  14190. position += 4;
  14191. args = [textRegion, header.referredTo, data, position, end];
  14192. break;
  14193. case 16:
  14194. const patternDictionary = {};
  14195. const patternDictionaryFlags = data[position++];
  14196. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  14197. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  14198. patternDictionary.patternWidth = data[position++];
  14199. patternDictionary.patternHeight = data[position++];
  14200. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  14201. position += 4;
  14202. args = [patternDictionary, header.number, data, position, end];
  14203. break;
  14204. case 22:
  14205. case 23:
  14206. const halftoneRegion = {};
  14207. halftoneRegion.info = readRegionSegmentInformation(data, position);
  14208. position += RegionSegmentInformationFieldLength;
  14209. const halftoneRegionFlags = data[position++];
  14210. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  14211. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  14212. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  14213. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  14214. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  14215. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  14216. position += 4;
  14217. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  14218. position += 4;
  14219. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  14220. position += 4;
  14221. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  14222. position += 4;
  14223. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  14224. position += 2;
  14225. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  14226. position += 2;
  14227. args = [halftoneRegion, header.referredTo, data, position, end];
  14228. break;
  14229. case 38:
  14230. case 39:
  14231. const genericRegion = {};
  14232. genericRegion.info = readRegionSegmentInformation(data, position);
  14233. position += RegionSegmentInformationFieldLength;
  14234. const genericRegionSegmentFlags = data[position++];
  14235. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  14236. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  14237. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  14238. if (!genericRegion.mmr) {
  14239. atLength = genericRegion.template === 0 ? 4 : 1;
  14240. at = [];
  14241. for (i = 0; i < atLength; i++) {
  14242. at.push({
  14243. x: (0, _core_utils.readInt8)(data, position),
  14244. y: (0, _core_utils.readInt8)(data, position + 1)
  14245. });
  14246. position += 2;
  14247. }
  14248. genericRegion.at = at;
  14249. }
  14250. args = [genericRegion, data, position, end];
  14251. break;
  14252. case 48:
  14253. const pageInfo = {
  14254. width: (0, _core_utils.readUint32)(data, position),
  14255. height: (0, _core_utils.readUint32)(data, position + 4),
  14256. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  14257. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  14258. };
  14259. if (pageInfo.height === 0xffffffff) {
  14260. delete pageInfo.height;
  14261. }
  14262. const pageSegmentFlags = data[position + 16];
  14263. (0, _core_utils.readUint16)(data, position + 17);
  14264. pageInfo.lossless = !!(pageSegmentFlags & 1);
  14265. pageInfo.refinement = !!(pageSegmentFlags & 2);
  14266. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  14267. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  14268. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  14269. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  14270. args = [pageInfo];
  14271. break;
  14272. case 49:
  14273. break;
  14274. case 50:
  14275. break;
  14276. case 51:
  14277. break;
  14278. case 53:
  14279. args = [header.number, data, position, end];
  14280. break;
  14281. case 62:
  14282. break;
  14283. default:
  14284. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  14285. }
  14286. const callbackName = "on" + header.typeName;
  14287. if (callbackName in visitor) {
  14288. visitor[callbackName].apply(visitor, args);
  14289. }
  14290. }
  14291. function processSegments(segments, visitor) {
  14292. for (let i = 0, ii = segments.length; i < ii; i++) {
  14293. processSegment(segments[i], visitor);
  14294. }
  14295. }
  14296. function parseJbig2Chunks(chunks) {
  14297. const visitor = new SimpleSegmentVisitor();
  14298. for (let i = 0, ii = chunks.length; i < ii; i++) {
  14299. const chunk = chunks[i];
  14300. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  14301. processSegments(segments, visitor);
  14302. }
  14303. return visitor.buffer;
  14304. }
  14305. function parseJbig2(data) {
  14306. const end = data.length;
  14307. let position = 0;
  14308. 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) {
  14309. throw new Jbig2Error("parseJbig2 - invalid header.");
  14310. }
  14311. const header = Object.create(null);
  14312. position += 8;
  14313. const flags = data[position++];
  14314. header.randomAccess = !(flags & 1);
  14315. if (!(flags & 2)) {
  14316. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  14317. position += 4;
  14318. }
  14319. const segments = readSegments(header, data, position, end);
  14320. const visitor = new SimpleSegmentVisitor();
  14321. processSegments(segments, visitor);
  14322. const {
  14323. width,
  14324. height
  14325. } = visitor.currentPageInfo;
  14326. const bitPacked = visitor.buffer;
  14327. const imgData = new Uint8ClampedArray(width * height);
  14328. let q = 0,
  14329. k = 0;
  14330. for (let i = 0; i < height; i++) {
  14331. let mask = 0,
  14332. buffer;
  14333. for (let j = 0; j < width; j++) {
  14334. if (!mask) {
  14335. mask = 128;
  14336. buffer = bitPacked[k++];
  14337. }
  14338. imgData[q++] = buffer & mask ? 0 : 255;
  14339. mask >>= 1;
  14340. }
  14341. }
  14342. return {
  14343. imgData,
  14344. width,
  14345. height
  14346. };
  14347. }
  14348. class SimpleSegmentVisitor {
  14349. onPageInformation(info) {
  14350. this.currentPageInfo = info;
  14351. const rowSize = info.width + 7 >> 3;
  14352. const buffer = new Uint8ClampedArray(rowSize * info.height);
  14353. if (info.defaultPixelValue) {
  14354. for (let i = 0, ii = buffer.length; i < ii; i++) {
  14355. buffer[i] = 0xff;
  14356. }
  14357. }
  14358. this.buffer = buffer;
  14359. }
  14360. drawBitmap(regionInfo, bitmap) {
  14361. const pageInfo = this.currentPageInfo;
  14362. const width = regionInfo.width,
  14363. height = regionInfo.height;
  14364. const rowSize = pageInfo.width + 7 >> 3;
  14365. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  14366. const buffer = this.buffer;
  14367. const mask0 = 128 >> (regionInfo.x & 7);
  14368. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  14369. let i, j, mask, offset;
  14370. switch (combinationOperator) {
  14371. case 0:
  14372. for (i = 0; i < height; i++) {
  14373. mask = mask0;
  14374. offset = offset0;
  14375. for (j = 0; j < width; j++) {
  14376. if (bitmap[i][j]) {
  14377. buffer[offset] |= mask;
  14378. }
  14379. mask >>= 1;
  14380. if (!mask) {
  14381. mask = 128;
  14382. offset++;
  14383. }
  14384. }
  14385. offset0 += rowSize;
  14386. }
  14387. break;
  14388. case 2:
  14389. for (i = 0; i < height; i++) {
  14390. mask = mask0;
  14391. offset = offset0;
  14392. for (j = 0; j < width; j++) {
  14393. if (bitmap[i][j]) {
  14394. buffer[offset] ^= mask;
  14395. }
  14396. mask >>= 1;
  14397. if (!mask) {
  14398. mask = 128;
  14399. offset++;
  14400. }
  14401. }
  14402. offset0 += rowSize;
  14403. }
  14404. break;
  14405. default:
  14406. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  14407. }
  14408. }
  14409. onImmediateGenericRegion(region, data, start, end) {
  14410. const regionInfo = region.info;
  14411. const decodingContext = new DecodingContext(data, start, end);
  14412. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  14413. this.drawBitmap(regionInfo, bitmap);
  14414. }
  14415. onImmediateLosslessGenericRegion() {
  14416. this.onImmediateGenericRegion.apply(this, arguments);
  14417. }
  14418. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  14419. let huffmanTables, huffmanInput;
  14420. if (dictionary.huffman) {
  14421. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  14422. huffmanInput = new Reader(data, start, end);
  14423. }
  14424. let symbols = this.symbols;
  14425. if (!symbols) {
  14426. this.symbols = symbols = {};
  14427. }
  14428. let inputSymbols = [];
  14429. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  14430. const referredSymbols = symbols[referredSegments[i]];
  14431. if (referredSymbols) {
  14432. inputSymbols = inputSymbols.concat(referredSymbols);
  14433. }
  14434. }
  14435. const decodingContext = new DecodingContext(data, start, end);
  14436. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  14437. }
  14438. onImmediateTextRegion(region, referredSegments, data, start, end) {
  14439. const regionInfo = region.info;
  14440. let huffmanTables, huffmanInput;
  14441. const symbols = this.symbols;
  14442. let inputSymbols = [];
  14443. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  14444. const referredSymbols = symbols[referredSegments[i]];
  14445. if (referredSymbols) {
  14446. inputSymbols = inputSymbols.concat(referredSymbols);
  14447. }
  14448. }
  14449. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  14450. if (region.huffman) {
  14451. huffmanInput = new Reader(data, start, end);
  14452. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  14453. }
  14454. const decodingContext = new DecodingContext(data, start, end);
  14455. 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);
  14456. this.drawBitmap(regionInfo, bitmap);
  14457. }
  14458. onImmediateLosslessTextRegion() {
  14459. this.onImmediateTextRegion.apply(this, arguments);
  14460. }
  14461. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  14462. let patterns = this.patterns;
  14463. if (!patterns) {
  14464. this.patterns = patterns = {};
  14465. }
  14466. const decodingContext = new DecodingContext(data, start, end);
  14467. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  14468. }
  14469. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  14470. const patterns = this.patterns[referredSegments[0]];
  14471. const regionInfo = region.info;
  14472. const decodingContext = new DecodingContext(data, start, end);
  14473. 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);
  14474. this.drawBitmap(regionInfo, bitmap);
  14475. }
  14476. onImmediateLosslessHalftoneRegion() {
  14477. this.onImmediateHalftoneRegion.apply(this, arguments);
  14478. }
  14479. onTables(currentSegment, data, start, end) {
  14480. let customTables = this.customTables;
  14481. if (!customTables) {
  14482. this.customTables = customTables = {};
  14483. }
  14484. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  14485. }
  14486. }
  14487. class HuffmanLine {
  14488. constructor(lineData) {
  14489. if (lineData.length === 2) {
  14490. this.isOOB = true;
  14491. this.rangeLow = 0;
  14492. this.prefixLength = lineData[0];
  14493. this.rangeLength = 0;
  14494. this.prefixCode = lineData[1];
  14495. this.isLowerRange = false;
  14496. } else {
  14497. this.isOOB = false;
  14498. this.rangeLow = lineData[0];
  14499. this.prefixLength = lineData[1];
  14500. this.rangeLength = lineData[2];
  14501. this.prefixCode = lineData[3];
  14502. this.isLowerRange = lineData[4] === "lower";
  14503. }
  14504. }
  14505. }
  14506. class HuffmanTreeNode {
  14507. constructor(line) {
  14508. this.children = [];
  14509. if (line) {
  14510. this.isLeaf = true;
  14511. this.rangeLength = line.rangeLength;
  14512. this.rangeLow = line.rangeLow;
  14513. this.isLowerRange = line.isLowerRange;
  14514. this.isOOB = line.isOOB;
  14515. } else {
  14516. this.isLeaf = false;
  14517. }
  14518. }
  14519. buildTree(line, shift) {
  14520. const bit = line.prefixCode >> shift & 1;
  14521. if (shift <= 0) {
  14522. this.children[bit] = new HuffmanTreeNode(line);
  14523. } else {
  14524. let node = this.children[bit];
  14525. if (!node) {
  14526. this.children[bit] = node = new HuffmanTreeNode(null);
  14527. }
  14528. node.buildTree(line, shift - 1);
  14529. }
  14530. }
  14531. decodeNode(reader) {
  14532. if (this.isLeaf) {
  14533. if (this.isOOB) {
  14534. return null;
  14535. }
  14536. const htOffset = reader.readBits(this.rangeLength);
  14537. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  14538. }
  14539. const node = this.children[reader.readBit()];
  14540. if (!node) {
  14541. throw new Jbig2Error("invalid Huffman data");
  14542. }
  14543. return node.decodeNode(reader);
  14544. }
  14545. }
  14546. class HuffmanTable {
  14547. constructor(lines, prefixCodesDone) {
  14548. if (!prefixCodesDone) {
  14549. this.assignPrefixCodes(lines);
  14550. }
  14551. this.rootNode = new HuffmanTreeNode(null);
  14552. for (let i = 0, ii = lines.length; i < ii; i++) {
  14553. const line = lines[i];
  14554. if (line.prefixLength > 0) {
  14555. this.rootNode.buildTree(line, line.prefixLength - 1);
  14556. }
  14557. }
  14558. }
  14559. decode(reader) {
  14560. return this.rootNode.decodeNode(reader);
  14561. }
  14562. assignPrefixCodes(lines) {
  14563. const linesLength = lines.length;
  14564. let prefixLengthMax = 0;
  14565. for (let i = 0; i < linesLength; i++) {
  14566. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  14567. }
  14568. const histogram = new Uint32Array(prefixLengthMax + 1);
  14569. for (let i = 0; i < linesLength; i++) {
  14570. histogram[lines[i].prefixLength]++;
  14571. }
  14572. let currentLength = 1,
  14573. firstCode = 0,
  14574. currentCode,
  14575. currentTemp,
  14576. line;
  14577. histogram[0] = 0;
  14578. while (currentLength <= prefixLengthMax) {
  14579. firstCode = firstCode + histogram[currentLength - 1] << 1;
  14580. currentCode = firstCode;
  14581. currentTemp = 0;
  14582. while (currentTemp < linesLength) {
  14583. line = lines[currentTemp];
  14584. if (line.prefixLength === currentLength) {
  14585. line.prefixCode = currentCode;
  14586. currentCode++;
  14587. }
  14588. currentTemp++;
  14589. }
  14590. currentLength++;
  14591. }
  14592. }
  14593. }
  14594. function decodeTablesSegment(data, start, end) {
  14595. const flags = data[start];
  14596. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  14597. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  14598. const reader = new Reader(data, start + 9, end);
  14599. const prefixSizeBits = (flags >> 1 & 7) + 1;
  14600. const rangeSizeBits = (flags >> 4 & 7) + 1;
  14601. const lines = [];
  14602. let prefixLength,
  14603. rangeLength,
  14604. currentRangeLow = lowestValue;
  14605. do {
  14606. prefixLength = reader.readBits(prefixSizeBits);
  14607. rangeLength = reader.readBits(rangeSizeBits);
  14608. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  14609. currentRangeLow += 1 << rangeLength;
  14610. } while (currentRangeLow < highestValue);
  14611. prefixLength = reader.readBits(prefixSizeBits);
  14612. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  14613. prefixLength = reader.readBits(prefixSizeBits);
  14614. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  14615. if (flags & 1) {
  14616. prefixLength = reader.readBits(prefixSizeBits);
  14617. lines.push(new HuffmanLine([prefixLength, 0]));
  14618. }
  14619. return new HuffmanTable(lines, false);
  14620. }
  14621. const standardTablesCache = {};
  14622. function getStandardTable(number) {
  14623. let table = standardTablesCache[number];
  14624. if (table) {
  14625. return table;
  14626. }
  14627. let lines;
  14628. switch (number) {
  14629. case 1:
  14630. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  14631. break;
  14632. case 2:
  14633. 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]];
  14634. break;
  14635. case 3:
  14636. 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]];
  14637. break;
  14638. case 4:
  14639. 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]];
  14640. break;
  14641. case 5:
  14642. 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]];
  14643. break;
  14644. case 6:
  14645. 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]];
  14646. break;
  14647. case 7:
  14648. 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]];
  14649. break;
  14650. case 8:
  14651. 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]];
  14652. break;
  14653. case 9:
  14654. 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]];
  14655. break;
  14656. case 10:
  14657. 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]];
  14658. break;
  14659. case 11:
  14660. 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]];
  14661. break;
  14662. case 12:
  14663. 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]];
  14664. break;
  14665. case 13:
  14666. 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]];
  14667. break;
  14668. case 14:
  14669. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  14670. break;
  14671. case 15:
  14672. 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]];
  14673. break;
  14674. default:
  14675. throw new Jbig2Error(`standard table B.${number} does not exist`);
  14676. }
  14677. for (let i = 0, ii = lines.length; i < ii; i++) {
  14678. lines[i] = new HuffmanLine(lines[i]);
  14679. }
  14680. table = new HuffmanTable(lines, true);
  14681. standardTablesCache[number] = table;
  14682. return table;
  14683. }
  14684. class Reader {
  14685. constructor(data, start, end) {
  14686. this.data = data;
  14687. this.start = start;
  14688. this.end = end;
  14689. this.position = start;
  14690. this.shift = -1;
  14691. this.currentByte = 0;
  14692. }
  14693. readBit() {
  14694. if (this.shift < 0) {
  14695. if (this.position >= this.end) {
  14696. throw new Jbig2Error("end of data while reading bit");
  14697. }
  14698. this.currentByte = this.data[this.position++];
  14699. this.shift = 7;
  14700. }
  14701. const bit = this.currentByte >> this.shift & 1;
  14702. this.shift--;
  14703. return bit;
  14704. }
  14705. readBits(numBits) {
  14706. let result = 0,
  14707. i;
  14708. for (i = numBits - 1; i >= 0; i--) {
  14709. result |= this.readBit() << i;
  14710. }
  14711. return result;
  14712. }
  14713. byteAlign() {
  14714. this.shift = -1;
  14715. }
  14716. next() {
  14717. if (this.position >= this.end) {
  14718. return -1;
  14719. }
  14720. return this.data[this.position++];
  14721. }
  14722. }
  14723. function getCustomHuffmanTable(index, referredTo, customTables) {
  14724. let currentIndex = 0;
  14725. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  14726. const table = customTables[referredTo[i]];
  14727. if (table) {
  14728. if (index === currentIndex) {
  14729. return table;
  14730. }
  14731. currentIndex++;
  14732. }
  14733. }
  14734. throw new Jbig2Error("can't find custom Huffman table");
  14735. }
  14736. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  14737. const codes = [];
  14738. for (let i = 0; i <= 34; i++) {
  14739. const codeLength = reader.readBits(4);
  14740. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  14741. }
  14742. const runCodesTable = new HuffmanTable(codes, false);
  14743. codes.length = 0;
  14744. for (let i = 0; i < numberOfSymbols;) {
  14745. const codeLength = runCodesTable.decode(reader);
  14746. if (codeLength >= 32) {
  14747. let repeatedLength, numberOfRepeats, j;
  14748. switch (codeLength) {
  14749. case 32:
  14750. if (i === 0) {
  14751. throw new Jbig2Error("no previous value in symbol ID table");
  14752. }
  14753. numberOfRepeats = reader.readBits(2) + 3;
  14754. repeatedLength = codes[i - 1].prefixLength;
  14755. break;
  14756. case 33:
  14757. numberOfRepeats = reader.readBits(3) + 3;
  14758. repeatedLength = 0;
  14759. break;
  14760. case 34:
  14761. numberOfRepeats = reader.readBits(7) + 11;
  14762. repeatedLength = 0;
  14763. break;
  14764. default:
  14765. throw new Jbig2Error("invalid code length in symbol ID table");
  14766. }
  14767. for (j = 0; j < numberOfRepeats; j++) {
  14768. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  14769. i++;
  14770. }
  14771. } else {
  14772. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  14773. i++;
  14774. }
  14775. }
  14776. reader.byteAlign();
  14777. const symbolIDTable = new HuffmanTable(codes, false);
  14778. let customIndex = 0,
  14779. tableFirstS,
  14780. tableDeltaS,
  14781. tableDeltaT;
  14782. switch (textRegion.huffmanFS) {
  14783. case 0:
  14784. case 1:
  14785. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  14786. break;
  14787. case 3:
  14788. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14789. customIndex++;
  14790. break;
  14791. default:
  14792. throw new Jbig2Error("invalid Huffman FS selector");
  14793. }
  14794. switch (textRegion.huffmanDS) {
  14795. case 0:
  14796. case 1:
  14797. case 2:
  14798. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  14799. break;
  14800. case 3:
  14801. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14802. customIndex++;
  14803. break;
  14804. default:
  14805. throw new Jbig2Error("invalid Huffman DS selector");
  14806. }
  14807. switch (textRegion.huffmanDT) {
  14808. case 0:
  14809. case 1:
  14810. case 2:
  14811. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  14812. break;
  14813. case 3:
  14814. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14815. customIndex++;
  14816. break;
  14817. default:
  14818. throw new Jbig2Error("invalid Huffman DT selector");
  14819. }
  14820. if (textRegion.refinement) {
  14821. throw new Jbig2Error("refinement with Huffman is not supported");
  14822. }
  14823. return {
  14824. symbolIDTable,
  14825. tableFirstS,
  14826. tableDeltaS,
  14827. tableDeltaT
  14828. };
  14829. }
  14830. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  14831. let customIndex = 0,
  14832. tableDeltaHeight,
  14833. tableDeltaWidth;
  14834. switch (dictionary.huffmanDHSelector) {
  14835. case 0:
  14836. case 1:
  14837. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  14838. break;
  14839. case 3:
  14840. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14841. customIndex++;
  14842. break;
  14843. default:
  14844. throw new Jbig2Error("invalid Huffman DH selector");
  14845. }
  14846. switch (dictionary.huffmanDWSelector) {
  14847. case 0:
  14848. case 1:
  14849. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  14850. break;
  14851. case 3:
  14852. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14853. customIndex++;
  14854. break;
  14855. default:
  14856. throw new Jbig2Error("invalid Huffman DW selector");
  14857. }
  14858. let tableBitmapSize, tableAggregateInstances;
  14859. if (dictionary.bitmapSizeSelector) {
  14860. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14861. customIndex++;
  14862. } else {
  14863. tableBitmapSize = getStandardTable(1);
  14864. }
  14865. if (dictionary.aggregationInstancesSelector) {
  14866. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14867. } else {
  14868. tableAggregateInstances = getStandardTable(1);
  14869. }
  14870. return {
  14871. tableDeltaHeight,
  14872. tableDeltaWidth,
  14873. tableBitmapSize,
  14874. tableAggregateInstances
  14875. };
  14876. }
  14877. function readUncompressedBitmap(reader, width, height) {
  14878. const bitmap = [];
  14879. for (let y = 0; y < height; y++) {
  14880. const row = new Uint8Array(width);
  14881. bitmap.push(row);
  14882. for (let x = 0; x < width; x++) {
  14883. row[x] = reader.readBit();
  14884. }
  14885. reader.byteAlign();
  14886. }
  14887. return bitmap;
  14888. }
  14889. function decodeMMRBitmap(input, width, height, endOfBlock) {
  14890. const params = {
  14891. K: -1,
  14892. Columns: width,
  14893. Rows: height,
  14894. BlackIs1: true,
  14895. EndOfBlock: endOfBlock
  14896. };
  14897. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  14898. const bitmap = [];
  14899. let currentByte,
  14900. eof = false;
  14901. for (let y = 0; y < height; y++) {
  14902. const row = new Uint8Array(width);
  14903. bitmap.push(row);
  14904. let shift = -1;
  14905. for (let x = 0; x < width; x++) {
  14906. if (shift < 0) {
  14907. currentByte = decoder.readNextChar();
  14908. if (currentByte === -1) {
  14909. currentByte = 0;
  14910. eof = true;
  14911. }
  14912. shift = 7;
  14913. }
  14914. row[x] = currentByte >> shift & 1;
  14915. shift--;
  14916. }
  14917. }
  14918. if (endOfBlock && !eof) {
  14919. const lookForEOFLimit = 5;
  14920. for (let i = 0; i < lookForEOFLimit; i++) {
  14921. if (decoder.readNextChar() === -1) {
  14922. break;
  14923. }
  14924. }
  14925. }
  14926. return bitmap;
  14927. }
  14928. class Jbig2Image {
  14929. parseChunks(chunks) {
  14930. return parseJbig2Chunks(chunks);
  14931. }
  14932. parse(data) {
  14933. const {
  14934. imgData,
  14935. width,
  14936. height
  14937. } = parseJbig2(data);
  14938. this.width = width;
  14939. this.height = height;
  14940. return imgData;
  14941. }
  14942. }
  14943. exports.Jbig2Image = Jbig2Image;
  14944. /***/ }),
  14945. /* 26 */
  14946. /***/ ((__unused_webpack_module, exports) => {
  14947. Object.defineProperty(exports, "__esModule", ({
  14948. value: true
  14949. }));
  14950. exports.ArithmeticDecoder = void 0;
  14951. const QeTable = [{
  14952. qe: 0x5601,
  14953. nmps: 1,
  14954. nlps: 1,
  14955. switchFlag: 1
  14956. }, {
  14957. qe: 0x3401,
  14958. nmps: 2,
  14959. nlps: 6,
  14960. switchFlag: 0
  14961. }, {
  14962. qe: 0x1801,
  14963. nmps: 3,
  14964. nlps: 9,
  14965. switchFlag: 0
  14966. }, {
  14967. qe: 0x0ac1,
  14968. nmps: 4,
  14969. nlps: 12,
  14970. switchFlag: 0
  14971. }, {
  14972. qe: 0x0521,
  14973. nmps: 5,
  14974. nlps: 29,
  14975. switchFlag: 0
  14976. }, {
  14977. qe: 0x0221,
  14978. nmps: 38,
  14979. nlps: 33,
  14980. switchFlag: 0
  14981. }, {
  14982. qe: 0x5601,
  14983. nmps: 7,
  14984. nlps: 6,
  14985. switchFlag: 1
  14986. }, {
  14987. qe: 0x5401,
  14988. nmps: 8,
  14989. nlps: 14,
  14990. switchFlag: 0
  14991. }, {
  14992. qe: 0x4801,
  14993. nmps: 9,
  14994. nlps: 14,
  14995. switchFlag: 0
  14996. }, {
  14997. qe: 0x3801,
  14998. nmps: 10,
  14999. nlps: 14,
  15000. switchFlag: 0
  15001. }, {
  15002. qe: 0x3001,
  15003. nmps: 11,
  15004. nlps: 17,
  15005. switchFlag: 0
  15006. }, {
  15007. qe: 0x2401,
  15008. nmps: 12,
  15009. nlps: 18,
  15010. switchFlag: 0
  15011. }, {
  15012. qe: 0x1c01,
  15013. nmps: 13,
  15014. nlps: 20,
  15015. switchFlag: 0
  15016. }, {
  15017. qe: 0x1601,
  15018. nmps: 29,
  15019. nlps: 21,
  15020. switchFlag: 0
  15021. }, {
  15022. qe: 0x5601,
  15023. nmps: 15,
  15024. nlps: 14,
  15025. switchFlag: 1
  15026. }, {
  15027. qe: 0x5401,
  15028. nmps: 16,
  15029. nlps: 14,
  15030. switchFlag: 0
  15031. }, {
  15032. qe: 0x5101,
  15033. nmps: 17,
  15034. nlps: 15,
  15035. switchFlag: 0
  15036. }, {
  15037. qe: 0x4801,
  15038. nmps: 18,
  15039. nlps: 16,
  15040. switchFlag: 0
  15041. }, {
  15042. qe: 0x3801,
  15043. nmps: 19,
  15044. nlps: 17,
  15045. switchFlag: 0
  15046. }, {
  15047. qe: 0x3401,
  15048. nmps: 20,
  15049. nlps: 18,
  15050. switchFlag: 0
  15051. }, {
  15052. qe: 0x3001,
  15053. nmps: 21,
  15054. nlps: 19,
  15055. switchFlag: 0
  15056. }, {
  15057. qe: 0x2801,
  15058. nmps: 22,
  15059. nlps: 19,
  15060. switchFlag: 0
  15061. }, {
  15062. qe: 0x2401,
  15063. nmps: 23,
  15064. nlps: 20,
  15065. switchFlag: 0
  15066. }, {
  15067. qe: 0x2201,
  15068. nmps: 24,
  15069. nlps: 21,
  15070. switchFlag: 0
  15071. }, {
  15072. qe: 0x1c01,
  15073. nmps: 25,
  15074. nlps: 22,
  15075. switchFlag: 0
  15076. }, {
  15077. qe: 0x1801,
  15078. nmps: 26,
  15079. nlps: 23,
  15080. switchFlag: 0
  15081. }, {
  15082. qe: 0x1601,
  15083. nmps: 27,
  15084. nlps: 24,
  15085. switchFlag: 0
  15086. }, {
  15087. qe: 0x1401,
  15088. nmps: 28,
  15089. nlps: 25,
  15090. switchFlag: 0
  15091. }, {
  15092. qe: 0x1201,
  15093. nmps: 29,
  15094. nlps: 26,
  15095. switchFlag: 0
  15096. }, {
  15097. qe: 0x1101,
  15098. nmps: 30,
  15099. nlps: 27,
  15100. switchFlag: 0
  15101. }, {
  15102. qe: 0x0ac1,
  15103. nmps: 31,
  15104. nlps: 28,
  15105. switchFlag: 0
  15106. }, {
  15107. qe: 0x09c1,
  15108. nmps: 32,
  15109. nlps: 29,
  15110. switchFlag: 0
  15111. }, {
  15112. qe: 0x08a1,
  15113. nmps: 33,
  15114. nlps: 30,
  15115. switchFlag: 0
  15116. }, {
  15117. qe: 0x0521,
  15118. nmps: 34,
  15119. nlps: 31,
  15120. switchFlag: 0
  15121. }, {
  15122. qe: 0x0441,
  15123. nmps: 35,
  15124. nlps: 32,
  15125. switchFlag: 0
  15126. }, {
  15127. qe: 0x02a1,
  15128. nmps: 36,
  15129. nlps: 33,
  15130. switchFlag: 0
  15131. }, {
  15132. qe: 0x0221,
  15133. nmps: 37,
  15134. nlps: 34,
  15135. switchFlag: 0
  15136. }, {
  15137. qe: 0x0141,
  15138. nmps: 38,
  15139. nlps: 35,
  15140. switchFlag: 0
  15141. }, {
  15142. qe: 0x0111,
  15143. nmps: 39,
  15144. nlps: 36,
  15145. switchFlag: 0
  15146. }, {
  15147. qe: 0x0085,
  15148. nmps: 40,
  15149. nlps: 37,
  15150. switchFlag: 0
  15151. }, {
  15152. qe: 0x0049,
  15153. nmps: 41,
  15154. nlps: 38,
  15155. switchFlag: 0
  15156. }, {
  15157. qe: 0x0025,
  15158. nmps: 42,
  15159. nlps: 39,
  15160. switchFlag: 0
  15161. }, {
  15162. qe: 0x0015,
  15163. nmps: 43,
  15164. nlps: 40,
  15165. switchFlag: 0
  15166. }, {
  15167. qe: 0x0009,
  15168. nmps: 44,
  15169. nlps: 41,
  15170. switchFlag: 0
  15171. }, {
  15172. qe: 0x0005,
  15173. nmps: 45,
  15174. nlps: 42,
  15175. switchFlag: 0
  15176. }, {
  15177. qe: 0x0001,
  15178. nmps: 45,
  15179. nlps: 43,
  15180. switchFlag: 0
  15181. }, {
  15182. qe: 0x5601,
  15183. nmps: 46,
  15184. nlps: 46,
  15185. switchFlag: 0
  15186. }];
  15187. class ArithmeticDecoder {
  15188. constructor(data, start, end) {
  15189. this.data = data;
  15190. this.bp = start;
  15191. this.dataEnd = end;
  15192. this.chigh = data[start];
  15193. this.clow = 0;
  15194. this.byteIn();
  15195. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  15196. this.clow = this.clow << 7 & 0xffff;
  15197. this.ct -= 7;
  15198. this.a = 0x8000;
  15199. }
  15200. byteIn() {
  15201. const data = this.data;
  15202. let bp = this.bp;
  15203. if (data[bp] === 0xff) {
  15204. if (data[bp + 1] > 0x8f) {
  15205. this.clow += 0xff00;
  15206. this.ct = 8;
  15207. } else {
  15208. bp++;
  15209. this.clow += data[bp] << 9;
  15210. this.ct = 7;
  15211. this.bp = bp;
  15212. }
  15213. } else {
  15214. bp++;
  15215. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  15216. this.ct = 8;
  15217. this.bp = bp;
  15218. }
  15219. if (this.clow > 0xffff) {
  15220. this.chigh += this.clow >> 16;
  15221. this.clow &= 0xffff;
  15222. }
  15223. }
  15224. readBit(contexts, pos) {
  15225. let cx_index = contexts[pos] >> 1,
  15226. cx_mps = contexts[pos] & 1;
  15227. const qeTableIcx = QeTable[cx_index];
  15228. const qeIcx = qeTableIcx.qe;
  15229. let d;
  15230. let a = this.a - qeIcx;
  15231. if (this.chigh < qeIcx) {
  15232. if (a < qeIcx) {
  15233. a = qeIcx;
  15234. d = cx_mps;
  15235. cx_index = qeTableIcx.nmps;
  15236. } else {
  15237. a = qeIcx;
  15238. d = 1 ^ cx_mps;
  15239. if (qeTableIcx.switchFlag === 1) {
  15240. cx_mps = d;
  15241. }
  15242. cx_index = qeTableIcx.nlps;
  15243. }
  15244. } else {
  15245. this.chigh -= qeIcx;
  15246. if ((a & 0x8000) !== 0) {
  15247. this.a = a;
  15248. return cx_mps;
  15249. }
  15250. if (a < qeIcx) {
  15251. d = 1 ^ cx_mps;
  15252. if (qeTableIcx.switchFlag === 1) {
  15253. cx_mps = d;
  15254. }
  15255. cx_index = qeTableIcx.nlps;
  15256. } else {
  15257. d = cx_mps;
  15258. cx_index = qeTableIcx.nmps;
  15259. }
  15260. }
  15261. do {
  15262. if (this.ct === 0) {
  15263. this.byteIn();
  15264. }
  15265. a <<= 1;
  15266. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  15267. this.clow = this.clow << 1 & 0xffff;
  15268. this.ct--;
  15269. } while ((a & 0x8000) === 0);
  15270. this.a = a;
  15271. contexts[pos] = cx_index << 1 | cx_mps;
  15272. return d;
  15273. }
  15274. }
  15275. exports.ArithmeticDecoder = ArithmeticDecoder;
  15276. /***/ }),
  15277. /* 27 */
  15278. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15279. Object.defineProperty(exports, "__esModule", ({
  15280. value: true
  15281. }));
  15282. exports.JpegStream = void 0;
  15283. var _decode_stream = __w_pdfjs_require__(19);
  15284. var _primitives = __w_pdfjs_require__(5);
  15285. var _jpg = __w_pdfjs_require__(28);
  15286. var _util = __w_pdfjs_require__(2);
  15287. class JpegStream extends _decode_stream.DecodeStream {
  15288. constructor(stream, maybeLength, params) {
  15289. let ch;
  15290. while ((ch = stream.getByte()) !== -1) {
  15291. if (ch === 0xff) {
  15292. stream.skip(-1);
  15293. break;
  15294. }
  15295. }
  15296. super(maybeLength);
  15297. this.stream = stream;
  15298. this.dict = stream.dict;
  15299. this.maybeLength = maybeLength;
  15300. this.params = params;
  15301. }
  15302. get bytes() {
  15303. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  15304. }
  15305. ensureBuffer(requested) {}
  15306. readBlock() {
  15307. if (this.eof) {
  15308. return;
  15309. }
  15310. const jpegOptions = {
  15311. decodeTransform: undefined,
  15312. colorTransform: undefined
  15313. };
  15314. const decodeArr = this.dict.getArray("Decode", "D");
  15315. if (this.forceRGB && Array.isArray(decodeArr)) {
  15316. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  15317. const decodeArrLength = decodeArr.length;
  15318. const transform = new Int32Array(decodeArrLength);
  15319. let transformNeeded = false;
  15320. const maxValue = (1 << bitsPerComponent) - 1;
  15321. for (let i = 0; i < decodeArrLength; i += 2) {
  15322. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  15323. transform[i + 1] = decodeArr[i] * maxValue | 0;
  15324. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  15325. transformNeeded = true;
  15326. }
  15327. }
  15328. if (transformNeeded) {
  15329. jpegOptions.decodeTransform = transform;
  15330. }
  15331. }
  15332. if ((0, _primitives.isDict)(this.params)) {
  15333. const colorTransform = this.params.get("ColorTransform");
  15334. if (Number.isInteger(colorTransform)) {
  15335. jpegOptions.colorTransform = colorTransform;
  15336. }
  15337. }
  15338. const jpegImage = new _jpg.JpegImage(jpegOptions);
  15339. jpegImage.parse(this.bytes);
  15340. const data = jpegImage.getData({
  15341. width: this.drawWidth,
  15342. height: this.drawHeight,
  15343. forceRGB: this.forceRGB,
  15344. isSourcePDF: true
  15345. });
  15346. this.buffer = data;
  15347. this.bufferLength = data.length;
  15348. this.eof = true;
  15349. }
  15350. }
  15351. exports.JpegStream = JpegStream;
  15352. /***/ }),
  15353. /* 28 */
  15354. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15355. Object.defineProperty(exports, "__esModule", ({
  15356. value: true
  15357. }));
  15358. exports.JpegImage = void 0;
  15359. var _util = __w_pdfjs_require__(2);
  15360. var _core_utils = __w_pdfjs_require__(9);
  15361. class JpegError extends _util.BaseException {
  15362. constructor(msg) {
  15363. super(`JPEG error: ${msg}`);
  15364. }
  15365. }
  15366. class DNLMarkerError extends _util.BaseException {
  15367. constructor(message, scanLines) {
  15368. super(message);
  15369. this.scanLines = scanLines;
  15370. }
  15371. }
  15372. class EOIMarkerError extends _util.BaseException {}
  15373. 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]);
  15374. const dctCos1 = 4017;
  15375. const dctSin1 = 799;
  15376. const dctCos3 = 3406;
  15377. const dctSin3 = 2276;
  15378. const dctCos6 = 1567;
  15379. const dctSin6 = 3784;
  15380. const dctSqrt2 = 5793;
  15381. const dctSqrt1d2 = 2896;
  15382. function buildHuffmanTable(codeLengths, values) {
  15383. let k = 0,
  15384. i,
  15385. j,
  15386. length = 16;
  15387. while (length > 0 && !codeLengths[length - 1]) {
  15388. length--;
  15389. }
  15390. const code = [{
  15391. children: [],
  15392. index: 0
  15393. }];
  15394. let p = code[0],
  15395. q;
  15396. for (i = 0; i < length; i++) {
  15397. for (j = 0; j < codeLengths[i]; j++) {
  15398. p = code.pop();
  15399. p.children[p.index] = values[k];
  15400. while (p.index > 0) {
  15401. p = code.pop();
  15402. }
  15403. p.index++;
  15404. code.push(p);
  15405. while (code.length <= i) {
  15406. code.push(q = {
  15407. children: [],
  15408. index: 0
  15409. });
  15410. p.children[p.index] = q.children;
  15411. p = q;
  15412. }
  15413. k++;
  15414. }
  15415. if (i + 1 < length) {
  15416. code.push(q = {
  15417. children: [],
  15418. index: 0
  15419. });
  15420. p.children[p.index] = q.children;
  15421. p = q;
  15422. }
  15423. }
  15424. return code[0].children;
  15425. }
  15426. function getBlockBufferOffset(component, row, col) {
  15427. return 64 * ((component.blocksPerLine + 1) * row + col);
  15428. }
  15429. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  15430. const mcusPerLine = frame.mcusPerLine;
  15431. const progressive = frame.progressive;
  15432. const startOffset = offset;
  15433. let bitsData = 0,
  15434. bitsCount = 0;
  15435. function readBit() {
  15436. if (bitsCount > 0) {
  15437. bitsCount--;
  15438. return bitsData >> bitsCount & 1;
  15439. }
  15440. bitsData = data[offset++];
  15441. if (bitsData === 0xff) {
  15442. const nextByte = data[offset++];
  15443. if (nextByte) {
  15444. if (nextByte === 0xdc && parseDNLMarker) {
  15445. offset += 2;
  15446. const scanLines = (0, _core_utils.readUint16)(data, offset);
  15447. offset += 2;
  15448. if (scanLines > 0 && scanLines !== frame.scanLines) {
  15449. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  15450. }
  15451. } else if (nextByte === 0xd9) {
  15452. if (parseDNLMarker) {
  15453. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  15454. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  15455. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  15456. }
  15457. }
  15458. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  15459. }
  15460. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  15461. }
  15462. }
  15463. bitsCount = 7;
  15464. return bitsData >>> 7;
  15465. }
  15466. function decodeHuffman(tree) {
  15467. let node = tree;
  15468. while (true) {
  15469. node = node[readBit()];
  15470. switch (typeof node) {
  15471. case "number":
  15472. return node;
  15473. case "object":
  15474. continue;
  15475. }
  15476. throw new JpegError("invalid huffman sequence");
  15477. }
  15478. }
  15479. function receive(length) {
  15480. let n = 0;
  15481. while (length > 0) {
  15482. n = n << 1 | readBit();
  15483. length--;
  15484. }
  15485. return n;
  15486. }
  15487. function receiveAndExtend(length) {
  15488. if (length === 1) {
  15489. return readBit() === 1 ? 1 : -1;
  15490. }
  15491. const n = receive(length);
  15492. if (n >= 1 << length - 1) {
  15493. return n;
  15494. }
  15495. return n + (-1 << length) + 1;
  15496. }
  15497. function decodeBaseline(component, blockOffset) {
  15498. const t = decodeHuffman(component.huffmanTableDC);
  15499. const diff = t === 0 ? 0 : receiveAndExtend(t);
  15500. component.blockData[blockOffset] = component.pred += diff;
  15501. let k = 1;
  15502. while (k < 64) {
  15503. const rs = decodeHuffman(component.huffmanTableAC);
  15504. const s = rs & 15,
  15505. r = rs >> 4;
  15506. if (s === 0) {
  15507. if (r < 15) {
  15508. break;
  15509. }
  15510. k += 16;
  15511. continue;
  15512. }
  15513. k += r;
  15514. const z = dctZigZag[k];
  15515. component.blockData[blockOffset + z] = receiveAndExtend(s);
  15516. k++;
  15517. }
  15518. }
  15519. function decodeDCFirst(component, blockOffset) {
  15520. const t = decodeHuffman(component.huffmanTableDC);
  15521. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  15522. component.blockData[blockOffset] = component.pred += diff;
  15523. }
  15524. function decodeDCSuccessive(component, blockOffset) {
  15525. component.blockData[blockOffset] |= readBit() << successive;
  15526. }
  15527. let eobrun = 0;
  15528. function decodeACFirst(component, blockOffset) {
  15529. if (eobrun > 0) {
  15530. eobrun--;
  15531. return;
  15532. }
  15533. let k = spectralStart;
  15534. const e = spectralEnd;
  15535. while (k <= e) {
  15536. const rs = decodeHuffman(component.huffmanTableAC);
  15537. const s = rs & 15,
  15538. r = rs >> 4;
  15539. if (s === 0) {
  15540. if (r < 15) {
  15541. eobrun = receive(r) + (1 << r) - 1;
  15542. break;
  15543. }
  15544. k += 16;
  15545. continue;
  15546. }
  15547. k += r;
  15548. const z = dctZigZag[k];
  15549. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  15550. k++;
  15551. }
  15552. }
  15553. let successiveACState = 0,
  15554. successiveACNextValue;
  15555. function decodeACSuccessive(component, blockOffset) {
  15556. let k = spectralStart;
  15557. const e = spectralEnd;
  15558. let r = 0;
  15559. let s;
  15560. let rs;
  15561. while (k <= e) {
  15562. const offsetZ = blockOffset + dctZigZag[k];
  15563. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  15564. switch (successiveACState) {
  15565. case 0:
  15566. rs = decodeHuffman(component.huffmanTableAC);
  15567. s = rs & 15;
  15568. r = rs >> 4;
  15569. if (s === 0) {
  15570. if (r < 15) {
  15571. eobrun = receive(r) + (1 << r);
  15572. successiveACState = 4;
  15573. } else {
  15574. r = 16;
  15575. successiveACState = 1;
  15576. }
  15577. } else {
  15578. if (s !== 1) {
  15579. throw new JpegError("invalid ACn encoding");
  15580. }
  15581. successiveACNextValue = receiveAndExtend(s);
  15582. successiveACState = r ? 2 : 3;
  15583. }
  15584. continue;
  15585. case 1:
  15586. case 2:
  15587. if (component.blockData[offsetZ]) {
  15588. component.blockData[offsetZ] += sign * (readBit() << successive);
  15589. } else {
  15590. r--;
  15591. if (r === 0) {
  15592. successiveACState = successiveACState === 2 ? 3 : 0;
  15593. }
  15594. }
  15595. break;
  15596. case 3:
  15597. if (component.blockData[offsetZ]) {
  15598. component.blockData[offsetZ] += sign * (readBit() << successive);
  15599. } else {
  15600. component.blockData[offsetZ] = successiveACNextValue << successive;
  15601. successiveACState = 0;
  15602. }
  15603. break;
  15604. case 4:
  15605. if (component.blockData[offsetZ]) {
  15606. component.blockData[offsetZ] += sign * (readBit() << successive);
  15607. }
  15608. break;
  15609. }
  15610. k++;
  15611. }
  15612. if (successiveACState === 4) {
  15613. eobrun--;
  15614. if (eobrun === 0) {
  15615. successiveACState = 0;
  15616. }
  15617. }
  15618. }
  15619. let blockRow = 0;
  15620. function decodeMcu(component, decode, mcu, row, col) {
  15621. const mcuRow = mcu / mcusPerLine | 0;
  15622. const mcuCol = mcu % mcusPerLine;
  15623. blockRow = mcuRow * component.v + row;
  15624. const blockCol = mcuCol * component.h + col;
  15625. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  15626. decode(component, blockOffset);
  15627. }
  15628. function decodeBlock(component, decode, mcu) {
  15629. blockRow = mcu / component.blocksPerLine | 0;
  15630. const blockCol = mcu % component.blocksPerLine;
  15631. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  15632. decode(component, blockOffset);
  15633. }
  15634. const componentsLength = components.length;
  15635. let component, i, j, k, n;
  15636. let decodeFn;
  15637. if (progressive) {
  15638. if (spectralStart === 0) {
  15639. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  15640. } else {
  15641. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  15642. }
  15643. } else {
  15644. decodeFn = decodeBaseline;
  15645. }
  15646. let mcu = 0,
  15647. fileMarker;
  15648. let mcuExpected;
  15649. if (componentsLength === 1) {
  15650. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  15651. } else {
  15652. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  15653. }
  15654. let h, v;
  15655. while (mcu <= mcuExpected) {
  15656. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  15657. if (mcuToRead > 0) {
  15658. for (i = 0; i < componentsLength; i++) {
  15659. components[i].pred = 0;
  15660. }
  15661. eobrun = 0;
  15662. if (componentsLength === 1) {
  15663. component = components[0];
  15664. for (n = 0; n < mcuToRead; n++) {
  15665. decodeBlock(component, decodeFn, mcu);
  15666. mcu++;
  15667. }
  15668. } else {
  15669. for (n = 0; n < mcuToRead; n++) {
  15670. for (i = 0; i < componentsLength; i++) {
  15671. component = components[i];
  15672. h = component.h;
  15673. v = component.v;
  15674. for (j = 0; j < v; j++) {
  15675. for (k = 0; k < h; k++) {
  15676. decodeMcu(component, decodeFn, mcu, j, k);
  15677. }
  15678. }
  15679. }
  15680. mcu++;
  15681. }
  15682. }
  15683. }
  15684. bitsCount = 0;
  15685. fileMarker = findNextFileMarker(data, offset);
  15686. if (!fileMarker) {
  15687. break;
  15688. }
  15689. if (fileMarker.invalid) {
  15690. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  15691. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  15692. offset = fileMarker.offset;
  15693. }
  15694. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  15695. offset += 2;
  15696. } else {
  15697. break;
  15698. }
  15699. }
  15700. return offset - startOffset;
  15701. }
  15702. function quantizeAndInverse(component, blockBufferOffset, p) {
  15703. const qt = component.quantizationTable,
  15704. blockData = component.blockData;
  15705. let v0, v1, v2, v3, v4, v5, v6, v7;
  15706. let p0, p1, p2, p3, p4, p5, p6, p7;
  15707. let t;
  15708. if (!qt) {
  15709. throw new JpegError("missing required Quantization Table.");
  15710. }
  15711. for (let row = 0; row < 64; row += 8) {
  15712. p0 = blockData[blockBufferOffset + row];
  15713. p1 = blockData[blockBufferOffset + row + 1];
  15714. p2 = blockData[blockBufferOffset + row + 2];
  15715. p3 = blockData[blockBufferOffset + row + 3];
  15716. p4 = blockData[blockBufferOffset + row + 4];
  15717. p5 = blockData[blockBufferOffset + row + 5];
  15718. p6 = blockData[blockBufferOffset + row + 6];
  15719. p7 = blockData[blockBufferOffset + row + 7];
  15720. p0 *= qt[row];
  15721. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  15722. t = dctSqrt2 * p0 + 512 >> 10;
  15723. p[row] = t;
  15724. p[row + 1] = t;
  15725. p[row + 2] = t;
  15726. p[row + 3] = t;
  15727. p[row + 4] = t;
  15728. p[row + 5] = t;
  15729. p[row + 6] = t;
  15730. p[row + 7] = t;
  15731. continue;
  15732. }
  15733. p1 *= qt[row + 1];
  15734. p2 *= qt[row + 2];
  15735. p3 *= qt[row + 3];
  15736. p4 *= qt[row + 4];
  15737. p5 *= qt[row + 5];
  15738. p6 *= qt[row + 6];
  15739. p7 *= qt[row + 7];
  15740. v0 = dctSqrt2 * p0 + 128 >> 8;
  15741. v1 = dctSqrt2 * p4 + 128 >> 8;
  15742. v2 = p2;
  15743. v3 = p6;
  15744. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  15745. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  15746. v5 = p3 << 4;
  15747. v6 = p5 << 4;
  15748. v0 = v0 + v1 + 1 >> 1;
  15749. v1 = v0 - v1;
  15750. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  15751. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  15752. v3 = t;
  15753. v4 = v4 + v6 + 1 >> 1;
  15754. v6 = v4 - v6;
  15755. v7 = v7 + v5 + 1 >> 1;
  15756. v5 = v7 - v5;
  15757. v0 = v0 + v3 + 1 >> 1;
  15758. v3 = v0 - v3;
  15759. v1 = v1 + v2 + 1 >> 1;
  15760. v2 = v1 - v2;
  15761. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  15762. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  15763. v7 = t;
  15764. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  15765. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  15766. v6 = t;
  15767. p[row] = v0 + v7;
  15768. p[row + 7] = v0 - v7;
  15769. p[row + 1] = v1 + v6;
  15770. p[row + 6] = v1 - v6;
  15771. p[row + 2] = v2 + v5;
  15772. p[row + 5] = v2 - v5;
  15773. p[row + 3] = v3 + v4;
  15774. p[row + 4] = v3 - v4;
  15775. }
  15776. for (let col = 0; col < 8; ++col) {
  15777. p0 = p[col];
  15778. p1 = p[col + 8];
  15779. p2 = p[col + 16];
  15780. p3 = p[col + 24];
  15781. p4 = p[col + 32];
  15782. p5 = p[col + 40];
  15783. p6 = p[col + 48];
  15784. p7 = p[col + 56];
  15785. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  15786. t = dctSqrt2 * p0 + 8192 >> 14;
  15787. if (t < -2040) {
  15788. t = 0;
  15789. } else if (t >= 2024) {
  15790. t = 255;
  15791. } else {
  15792. t = t + 2056 >> 4;
  15793. }
  15794. blockData[blockBufferOffset + col] = t;
  15795. blockData[blockBufferOffset + col + 8] = t;
  15796. blockData[blockBufferOffset + col + 16] = t;
  15797. blockData[blockBufferOffset + col + 24] = t;
  15798. blockData[blockBufferOffset + col + 32] = t;
  15799. blockData[blockBufferOffset + col + 40] = t;
  15800. blockData[blockBufferOffset + col + 48] = t;
  15801. blockData[blockBufferOffset + col + 56] = t;
  15802. continue;
  15803. }
  15804. v0 = dctSqrt2 * p0 + 2048 >> 12;
  15805. v1 = dctSqrt2 * p4 + 2048 >> 12;
  15806. v2 = p2;
  15807. v3 = p6;
  15808. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  15809. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  15810. v5 = p3;
  15811. v6 = p5;
  15812. v0 = (v0 + v1 + 1 >> 1) + 4112;
  15813. v1 = v0 - v1;
  15814. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  15815. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  15816. v3 = t;
  15817. v4 = v4 + v6 + 1 >> 1;
  15818. v6 = v4 - v6;
  15819. v7 = v7 + v5 + 1 >> 1;
  15820. v5 = v7 - v5;
  15821. v0 = v0 + v3 + 1 >> 1;
  15822. v3 = v0 - v3;
  15823. v1 = v1 + v2 + 1 >> 1;
  15824. v2 = v1 - v2;
  15825. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  15826. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  15827. v7 = t;
  15828. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  15829. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  15830. v6 = t;
  15831. p0 = v0 + v7;
  15832. p7 = v0 - v7;
  15833. p1 = v1 + v6;
  15834. p6 = v1 - v6;
  15835. p2 = v2 + v5;
  15836. p5 = v2 - v5;
  15837. p3 = v3 + v4;
  15838. p4 = v3 - v4;
  15839. if (p0 < 16) {
  15840. p0 = 0;
  15841. } else if (p0 >= 4080) {
  15842. p0 = 255;
  15843. } else {
  15844. p0 >>= 4;
  15845. }
  15846. if (p1 < 16) {
  15847. p1 = 0;
  15848. } else if (p1 >= 4080) {
  15849. p1 = 255;
  15850. } else {
  15851. p1 >>= 4;
  15852. }
  15853. if (p2 < 16) {
  15854. p2 = 0;
  15855. } else if (p2 >= 4080) {
  15856. p2 = 255;
  15857. } else {
  15858. p2 >>= 4;
  15859. }
  15860. if (p3 < 16) {
  15861. p3 = 0;
  15862. } else if (p3 >= 4080) {
  15863. p3 = 255;
  15864. } else {
  15865. p3 >>= 4;
  15866. }
  15867. if (p4 < 16) {
  15868. p4 = 0;
  15869. } else if (p4 >= 4080) {
  15870. p4 = 255;
  15871. } else {
  15872. p4 >>= 4;
  15873. }
  15874. if (p5 < 16) {
  15875. p5 = 0;
  15876. } else if (p5 >= 4080) {
  15877. p5 = 255;
  15878. } else {
  15879. p5 >>= 4;
  15880. }
  15881. if (p6 < 16) {
  15882. p6 = 0;
  15883. } else if (p6 >= 4080) {
  15884. p6 = 255;
  15885. } else {
  15886. p6 >>= 4;
  15887. }
  15888. if (p7 < 16) {
  15889. p7 = 0;
  15890. } else if (p7 >= 4080) {
  15891. p7 = 255;
  15892. } else {
  15893. p7 >>= 4;
  15894. }
  15895. blockData[blockBufferOffset + col] = p0;
  15896. blockData[blockBufferOffset + col + 8] = p1;
  15897. blockData[blockBufferOffset + col + 16] = p2;
  15898. blockData[blockBufferOffset + col + 24] = p3;
  15899. blockData[blockBufferOffset + col + 32] = p4;
  15900. blockData[blockBufferOffset + col + 40] = p5;
  15901. blockData[blockBufferOffset + col + 48] = p6;
  15902. blockData[blockBufferOffset + col + 56] = p7;
  15903. }
  15904. }
  15905. function buildComponentData(frame, component) {
  15906. const blocksPerLine = component.blocksPerLine;
  15907. const blocksPerColumn = component.blocksPerColumn;
  15908. const computationBuffer = new Int16Array(64);
  15909. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  15910. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  15911. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  15912. quantizeAndInverse(component, offset, computationBuffer);
  15913. }
  15914. }
  15915. return component.blockData;
  15916. }
  15917. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  15918. const maxPos = data.length - 1;
  15919. let newPos = startPos < currentPos ? startPos : currentPos;
  15920. if (currentPos >= maxPos) {
  15921. return null;
  15922. }
  15923. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  15924. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  15925. return {
  15926. invalid: null,
  15927. marker: currentMarker,
  15928. offset: currentPos
  15929. };
  15930. }
  15931. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  15932. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  15933. if (++newPos >= maxPos) {
  15934. return null;
  15935. }
  15936. newMarker = (0, _core_utils.readUint16)(data, newPos);
  15937. }
  15938. return {
  15939. invalid: currentMarker.toString(16),
  15940. marker: newMarker,
  15941. offset: newPos
  15942. };
  15943. }
  15944. class JpegImage {
  15945. constructor({
  15946. decodeTransform = null,
  15947. colorTransform = -1
  15948. } = {}) {
  15949. this._decodeTransform = decodeTransform;
  15950. this._colorTransform = colorTransform;
  15951. }
  15952. parse(data, {
  15953. dnlScanLines = null
  15954. } = {}) {
  15955. function readDataBlock() {
  15956. const length = (0, _core_utils.readUint16)(data, offset);
  15957. offset += 2;
  15958. let endOffset = offset + length - 2;
  15959. const fileMarker = findNextFileMarker(data, endOffset, offset);
  15960. if (fileMarker && fileMarker.invalid) {
  15961. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  15962. endOffset = fileMarker.offset;
  15963. }
  15964. const array = data.subarray(offset, endOffset);
  15965. offset += array.length;
  15966. return array;
  15967. }
  15968. function prepareComponents(frame) {
  15969. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  15970. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  15971. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  15972. const component = frame.components[i];
  15973. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  15974. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  15975. const blocksPerLineForMcu = mcusPerLine * component.h;
  15976. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  15977. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  15978. component.blockData = new Int16Array(blocksBufferSize);
  15979. component.blocksPerLine = blocksPerLine;
  15980. component.blocksPerColumn = blocksPerColumn;
  15981. }
  15982. frame.mcusPerLine = mcusPerLine;
  15983. frame.mcusPerColumn = mcusPerColumn;
  15984. }
  15985. let offset = 0;
  15986. let jfif = null;
  15987. let adobe = null;
  15988. let frame, resetInterval;
  15989. let numSOSMarkers = 0;
  15990. const quantizationTables = [];
  15991. const huffmanTablesAC = [],
  15992. huffmanTablesDC = [];
  15993. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  15994. offset += 2;
  15995. if (fileMarker !== 0xffd8) {
  15996. throw new JpegError("SOI not found");
  15997. }
  15998. fileMarker = (0, _core_utils.readUint16)(data, offset);
  15999. offset += 2;
  16000. markerLoop: while (fileMarker !== 0xffd9) {
  16001. let i, j, l;
  16002. switch (fileMarker) {
  16003. case 0xffe0:
  16004. case 0xffe1:
  16005. case 0xffe2:
  16006. case 0xffe3:
  16007. case 0xffe4:
  16008. case 0xffe5:
  16009. case 0xffe6:
  16010. case 0xffe7:
  16011. case 0xffe8:
  16012. case 0xffe9:
  16013. case 0xffea:
  16014. case 0xffeb:
  16015. case 0xffec:
  16016. case 0xffed:
  16017. case 0xffee:
  16018. case 0xffef:
  16019. case 0xfffe:
  16020. const appData = readDataBlock();
  16021. if (fileMarker === 0xffe0) {
  16022. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  16023. jfif = {
  16024. version: {
  16025. major: appData[5],
  16026. minor: appData[6]
  16027. },
  16028. densityUnits: appData[7],
  16029. xDensity: appData[8] << 8 | appData[9],
  16030. yDensity: appData[10] << 8 | appData[11],
  16031. thumbWidth: appData[12],
  16032. thumbHeight: appData[13],
  16033. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  16034. };
  16035. }
  16036. }
  16037. if (fileMarker === 0xffee) {
  16038. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  16039. adobe = {
  16040. version: appData[5] << 8 | appData[6],
  16041. flags0: appData[7] << 8 | appData[8],
  16042. flags1: appData[9] << 8 | appData[10],
  16043. transformCode: appData[11]
  16044. };
  16045. }
  16046. }
  16047. break;
  16048. case 0xffdb:
  16049. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  16050. offset += 2;
  16051. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  16052. let z;
  16053. while (offset < quantizationTablesEnd) {
  16054. const quantizationTableSpec = data[offset++];
  16055. const tableData = new Uint16Array(64);
  16056. if (quantizationTableSpec >> 4 === 0) {
  16057. for (j = 0; j < 64; j++) {
  16058. z = dctZigZag[j];
  16059. tableData[z] = data[offset++];
  16060. }
  16061. } else if (quantizationTableSpec >> 4 === 1) {
  16062. for (j = 0; j < 64; j++) {
  16063. z = dctZigZag[j];
  16064. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  16065. offset += 2;
  16066. }
  16067. } else {
  16068. throw new JpegError("DQT - invalid table spec");
  16069. }
  16070. quantizationTables[quantizationTableSpec & 15] = tableData;
  16071. }
  16072. break;
  16073. case 0xffc0:
  16074. case 0xffc1:
  16075. case 0xffc2:
  16076. if (frame) {
  16077. throw new JpegError("Only single frame JPEGs supported");
  16078. }
  16079. offset += 2;
  16080. frame = {};
  16081. frame.extended = fileMarker === 0xffc1;
  16082. frame.progressive = fileMarker === 0xffc2;
  16083. frame.precision = data[offset++];
  16084. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  16085. offset += 2;
  16086. frame.scanLines = dnlScanLines || sofScanLines;
  16087. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  16088. offset += 2;
  16089. frame.components = [];
  16090. frame.componentIds = {};
  16091. const componentsCount = data[offset++];
  16092. let maxH = 0,
  16093. maxV = 0;
  16094. for (i = 0; i < componentsCount; i++) {
  16095. const componentId = data[offset];
  16096. const h = data[offset + 1] >> 4;
  16097. const v = data[offset + 1] & 15;
  16098. if (maxH < h) {
  16099. maxH = h;
  16100. }
  16101. if (maxV < v) {
  16102. maxV = v;
  16103. }
  16104. const qId = data[offset + 2];
  16105. l = frame.components.push({
  16106. h,
  16107. v,
  16108. quantizationId: qId,
  16109. quantizationTable: null
  16110. });
  16111. frame.componentIds[componentId] = l - 1;
  16112. offset += 3;
  16113. }
  16114. frame.maxH = maxH;
  16115. frame.maxV = maxV;
  16116. prepareComponents(frame);
  16117. break;
  16118. case 0xffc4:
  16119. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  16120. offset += 2;
  16121. for (i = 2; i < huffmanLength;) {
  16122. const huffmanTableSpec = data[offset++];
  16123. const codeLengths = new Uint8Array(16);
  16124. let codeLengthSum = 0;
  16125. for (j = 0; j < 16; j++, offset++) {
  16126. codeLengthSum += codeLengths[j] = data[offset];
  16127. }
  16128. const huffmanValues = new Uint8Array(codeLengthSum);
  16129. for (j = 0; j < codeLengthSum; j++, offset++) {
  16130. huffmanValues[j] = data[offset];
  16131. }
  16132. i += 17 + codeLengthSum;
  16133. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  16134. }
  16135. break;
  16136. case 0xffdd:
  16137. offset += 2;
  16138. resetInterval = (0, _core_utils.readUint16)(data, offset);
  16139. offset += 2;
  16140. break;
  16141. case 0xffda:
  16142. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  16143. offset += 2;
  16144. const selectorsCount = data[offset++],
  16145. components = [];
  16146. for (i = 0; i < selectorsCount; i++) {
  16147. const index = data[offset++];
  16148. const componentIndex = frame.componentIds[index];
  16149. const component = frame.components[componentIndex];
  16150. component.index = index;
  16151. const tableSpec = data[offset++];
  16152. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  16153. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  16154. components.push(component);
  16155. }
  16156. const spectralStart = data[offset++],
  16157. spectralEnd = data[offset++],
  16158. successiveApproximation = data[offset++];
  16159. try {
  16160. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  16161. offset += processed;
  16162. } catch (ex) {
  16163. if (ex instanceof DNLMarkerError) {
  16164. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  16165. return this.parse(data, {
  16166. dnlScanLines: ex.scanLines
  16167. });
  16168. } else if (ex instanceof EOIMarkerError) {
  16169. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  16170. break markerLoop;
  16171. }
  16172. throw ex;
  16173. }
  16174. break;
  16175. case 0xffdc:
  16176. offset += 4;
  16177. break;
  16178. case 0xffff:
  16179. if (data[offset] !== 0xff) {
  16180. offset--;
  16181. }
  16182. break;
  16183. default:
  16184. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  16185. if (nextFileMarker && nextFileMarker.invalid) {
  16186. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  16187. offset = nextFileMarker.offset;
  16188. break;
  16189. }
  16190. if (!nextFileMarker || offset >= data.length - 1) {
  16191. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  16192. break markerLoop;
  16193. }
  16194. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  16195. }
  16196. fileMarker = (0, _core_utils.readUint16)(data, offset);
  16197. offset += 2;
  16198. }
  16199. this.width = frame.samplesPerLine;
  16200. this.height = frame.scanLines;
  16201. this.jfif = jfif;
  16202. this.adobe = adobe;
  16203. this.components = [];
  16204. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  16205. const component = frame.components[i];
  16206. const quantizationTable = quantizationTables[component.quantizationId];
  16207. if (quantizationTable) {
  16208. component.quantizationTable = quantizationTable;
  16209. }
  16210. this.components.push({
  16211. index: component.index,
  16212. output: buildComponentData(frame, component),
  16213. scaleX: component.h / frame.maxH,
  16214. scaleY: component.v / frame.maxV,
  16215. blocksPerLine: component.blocksPerLine,
  16216. blocksPerColumn: component.blocksPerColumn
  16217. });
  16218. }
  16219. this.numComponents = this.components.length;
  16220. return undefined;
  16221. }
  16222. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  16223. const scaleX = this.width / width,
  16224. scaleY = this.height / height;
  16225. let component, componentScaleX, componentScaleY, blocksPerScanline;
  16226. let x, y, i, j, k;
  16227. let index;
  16228. let offset = 0;
  16229. let output;
  16230. const numComponents = this.components.length;
  16231. const dataLength = width * height * numComponents;
  16232. const data = new Uint8ClampedArray(dataLength);
  16233. const xScaleBlockOffset = new Uint32Array(width);
  16234. const mask3LSB = 0xfffffff8;
  16235. let lastComponentScaleX;
  16236. for (i = 0; i < numComponents; i++) {
  16237. component = this.components[i];
  16238. componentScaleX = component.scaleX * scaleX;
  16239. componentScaleY = component.scaleY * scaleY;
  16240. offset = i;
  16241. output = component.output;
  16242. blocksPerScanline = component.blocksPerLine + 1 << 3;
  16243. if (componentScaleX !== lastComponentScaleX) {
  16244. for (x = 0; x < width; x++) {
  16245. j = 0 | x * componentScaleX;
  16246. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  16247. }
  16248. lastComponentScaleX = componentScaleX;
  16249. }
  16250. for (y = 0; y < height; y++) {
  16251. j = 0 | y * componentScaleY;
  16252. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  16253. for (x = 0; x < width; x++) {
  16254. data[offset] = output[index + xScaleBlockOffset[x]];
  16255. offset += numComponents;
  16256. }
  16257. }
  16258. }
  16259. let transform = this._decodeTransform;
  16260. if (!isSourcePDF && numComponents === 4 && !transform) {
  16261. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  16262. }
  16263. if (transform) {
  16264. for (i = 0; i < dataLength;) {
  16265. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  16266. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  16267. }
  16268. }
  16269. }
  16270. return data;
  16271. }
  16272. get _isColorConversionNeeded() {
  16273. if (this.adobe) {
  16274. return !!this.adobe.transformCode;
  16275. }
  16276. if (this.numComponents === 3) {
  16277. if (this._colorTransform === 0) {
  16278. return false;
  16279. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  16280. return false;
  16281. }
  16282. return true;
  16283. }
  16284. if (this._colorTransform === 1) {
  16285. return true;
  16286. }
  16287. return false;
  16288. }
  16289. _convertYccToRgb(data) {
  16290. let Y, Cb, Cr;
  16291. for (let i = 0, length = data.length; i < length; i += 3) {
  16292. Y = data[i];
  16293. Cb = data[i + 1];
  16294. Cr = data[i + 2];
  16295. data[i] = Y - 179.456 + 1.402 * Cr;
  16296. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  16297. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  16298. }
  16299. return data;
  16300. }
  16301. _convertYcckToRgb(data) {
  16302. let Y, Cb, Cr, k;
  16303. let offset = 0;
  16304. for (let i = 0, length = data.length; i < length; i += 4) {
  16305. Y = data[i];
  16306. Cb = data[i + 1];
  16307. Cr = data[i + 2];
  16308. k = data[i + 3];
  16309. 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);
  16310. 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);
  16311. 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);
  16312. }
  16313. return data.subarray(0, offset);
  16314. }
  16315. _convertYcckToCmyk(data) {
  16316. let Y, Cb, Cr;
  16317. for (let i = 0, length = data.length; i < length; i += 4) {
  16318. Y = data[i];
  16319. Cb = data[i + 1];
  16320. Cr = data[i + 2];
  16321. data[i] = 434.456 - Y - 1.402 * Cr;
  16322. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  16323. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  16324. }
  16325. return data;
  16326. }
  16327. _convertCmykToRgb(data) {
  16328. let c, m, y, k;
  16329. let offset = 0;
  16330. for (let i = 0, length = data.length; i < length; i += 4) {
  16331. c = data[i];
  16332. m = data[i + 1];
  16333. y = data[i + 2];
  16334. k = data[i + 3];
  16335. 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);
  16336. 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.00031891311758832814 * k + 0.7364883807733168);
  16337. 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);
  16338. }
  16339. return data.subarray(0, offset);
  16340. }
  16341. getData({
  16342. width,
  16343. height,
  16344. forceRGB = false,
  16345. isSourcePDF = false
  16346. }) {
  16347. if (this.numComponents > 4) {
  16348. throw new JpegError("Unsupported color mode");
  16349. }
  16350. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  16351. if (this.numComponents === 1 && forceRGB) {
  16352. const dataLength = data.length;
  16353. const rgbData = new Uint8ClampedArray(dataLength * 3);
  16354. let offset = 0;
  16355. for (let i = 0; i < dataLength; i++) {
  16356. const grayColor = data[i];
  16357. rgbData[offset++] = grayColor;
  16358. rgbData[offset++] = grayColor;
  16359. rgbData[offset++] = grayColor;
  16360. }
  16361. return rgbData;
  16362. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  16363. return this._convertYccToRgb(data);
  16364. } else if (this.numComponents === 4) {
  16365. if (this._isColorConversionNeeded) {
  16366. if (forceRGB) {
  16367. return this._convertYcckToRgb(data);
  16368. }
  16369. return this._convertYcckToCmyk(data);
  16370. } else if (forceRGB) {
  16371. return this._convertCmykToRgb(data);
  16372. }
  16373. }
  16374. return data;
  16375. }
  16376. }
  16377. exports.JpegImage = JpegImage;
  16378. /***/ }),
  16379. /* 29 */
  16380. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16381. Object.defineProperty(exports, "__esModule", ({
  16382. value: true
  16383. }));
  16384. exports.JpxStream = void 0;
  16385. var _decode_stream = __w_pdfjs_require__(19);
  16386. var _jpx = __w_pdfjs_require__(30);
  16387. var _util = __w_pdfjs_require__(2);
  16388. class JpxStream extends _decode_stream.DecodeStream {
  16389. constructor(stream, maybeLength, params) {
  16390. super(maybeLength);
  16391. this.stream = stream;
  16392. this.dict = stream.dict;
  16393. this.maybeLength = maybeLength;
  16394. this.params = params;
  16395. }
  16396. get bytes() {
  16397. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  16398. }
  16399. ensureBuffer(requested) {}
  16400. readBlock() {
  16401. if (this.eof) {
  16402. return;
  16403. }
  16404. const jpxImage = new _jpx.JpxImage();
  16405. jpxImage.parse(this.bytes);
  16406. const width = jpxImage.width;
  16407. const height = jpxImage.height;
  16408. const componentsCount = jpxImage.componentsCount;
  16409. const tileCount = jpxImage.tiles.length;
  16410. if (tileCount === 1) {
  16411. this.buffer = jpxImage.tiles[0].items;
  16412. } else {
  16413. const data = new Uint8ClampedArray(width * height * componentsCount);
  16414. for (let k = 0; k < tileCount; k++) {
  16415. const tileComponents = jpxImage.tiles[k];
  16416. const tileWidth = tileComponents.width;
  16417. const tileHeight = tileComponents.height;
  16418. const tileLeft = tileComponents.left;
  16419. const tileTop = tileComponents.top;
  16420. const src = tileComponents.items;
  16421. let srcPosition = 0;
  16422. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  16423. const imgRowSize = width * componentsCount;
  16424. const tileRowSize = tileWidth * componentsCount;
  16425. for (let j = 0; j < tileHeight; j++) {
  16426. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  16427. data.set(rowBytes, dataPosition);
  16428. srcPosition += tileRowSize;
  16429. dataPosition += imgRowSize;
  16430. }
  16431. }
  16432. this.buffer = data;
  16433. }
  16434. this.bufferLength = this.buffer.length;
  16435. this.eof = true;
  16436. }
  16437. }
  16438. exports.JpxStream = JpxStream;
  16439. /***/ }),
  16440. /* 30 */
  16441. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16442. Object.defineProperty(exports, "__esModule", ({
  16443. value: true
  16444. }));
  16445. exports.JpxImage = void 0;
  16446. var _util = __w_pdfjs_require__(2);
  16447. var _core_utils = __w_pdfjs_require__(9);
  16448. var _arithmetic_decoder = __w_pdfjs_require__(26);
  16449. class JpxError extends _util.BaseException {
  16450. constructor(msg) {
  16451. super(`JPX error: ${msg}`);
  16452. }
  16453. }
  16454. const SubbandsGainLog2 = {
  16455. LL: 0,
  16456. LH: 1,
  16457. HL: 1,
  16458. HH: 2
  16459. };
  16460. class JpxImage {
  16461. constructor() {
  16462. this.failOnCorruptedImage = false;
  16463. }
  16464. parse(data) {
  16465. const head = (0, _core_utils.readUint16)(data, 0);
  16466. if (head === 0xff4f) {
  16467. this.parseCodestream(data, 0, data.length);
  16468. return;
  16469. }
  16470. const length = data.length;
  16471. let position = 0;
  16472. while (position < length) {
  16473. let headerSize = 8;
  16474. let lbox = (0, _core_utils.readUint32)(data, position);
  16475. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  16476. position += headerSize;
  16477. if (lbox === 1) {
  16478. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  16479. position += 8;
  16480. headerSize += 8;
  16481. }
  16482. if (lbox === 0) {
  16483. lbox = length - position + headerSize;
  16484. }
  16485. if (lbox < headerSize) {
  16486. throw new JpxError("Invalid box field size");
  16487. }
  16488. const dataLength = lbox - headerSize;
  16489. let jumpDataLength = true;
  16490. switch (tbox) {
  16491. case 0x6a703268:
  16492. jumpDataLength = false;
  16493. break;
  16494. case 0x636f6c72:
  16495. const method = data[position];
  16496. if (method === 1) {
  16497. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  16498. switch (colorspace) {
  16499. case 16:
  16500. case 17:
  16501. case 18:
  16502. break;
  16503. default:
  16504. (0, _util.warn)("Unknown colorspace " + colorspace);
  16505. break;
  16506. }
  16507. } else if (method === 2) {
  16508. (0, _util.info)("ICC profile not supported");
  16509. }
  16510. break;
  16511. case 0x6a703263:
  16512. this.parseCodestream(data, position, position + dataLength);
  16513. break;
  16514. case 0x6a502020:
  16515. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  16516. (0, _util.warn)("Invalid JP2 signature");
  16517. }
  16518. break;
  16519. case 0x6a501a1a:
  16520. case 0x66747970:
  16521. case 0x72726571:
  16522. case 0x72657320:
  16523. case 0x69686472:
  16524. break;
  16525. default:
  16526. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  16527. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  16528. break;
  16529. }
  16530. if (jumpDataLength) {
  16531. position += dataLength;
  16532. }
  16533. }
  16534. }
  16535. parseImageProperties(stream) {
  16536. let newByte = stream.getByte();
  16537. while (newByte >= 0) {
  16538. const oldByte = newByte;
  16539. newByte = stream.getByte();
  16540. const code = oldByte << 8 | newByte;
  16541. if (code === 0xff51) {
  16542. stream.skip(4);
  16543. const Xsiz = stream.getInt32() >>> 0;
  16544. const Ysiz = stream.getInt32() >>> 0;
  16545. const XOsiz = stream.getInt32() >>> 0;
  16546. const YOsiz = stream.getInt32() >>> 0;
  16547. stream.skip(16);
  16548. const Csiz = stream.getUint16();
  16549. this.width = Xsiz - XOsiz;
  16550. this.height = Ysiz - YOsiz;
  16551. this.componentsCount = Csiz;
  16552. this.bitsPerComponent = 8;
  16553. return;
  16554. }
  16555. }
  16556. throw new JpxError("No size marker found in JPX stream");
  16557. }
  16558. parseCodestream(data, start, end) {
  16559. const context = {};
  16560. let doNotRecover = false;
  16561. try {
  16562. let position = start;
  16563. while (position + 1 < end) {
  16564. const code = (0, _core_utils.readUint16)(data, position);
  16565. position += 2;
  16566. let length = 0,
  16567. j,
  16568. sqcd,
  16569. spqcds,
  16570. spqcdSize,
  16571. scalarExpounded,
  16572. tile;
  16573. switch (code) {
  16574. case 0xff4f:
  16575. context.mainHeader = true;
  16576. break;
  16577. case 0xffd9:
  16578. break;
  16579. case 0xff51:
  16580. length = (0, _core_utils.readUint16)(data, position);
  16581. const siz = {};
  16582. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  16583. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  16584. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  16585. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  16586. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  16587. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  16588. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  16589. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  16590. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  16591. siz.Csiz = componentsCount;
  16592. const components = [];
  16593. j = position + 38;
  16594. for (let i = 0; i < componentsCount; i++) {
  16595. const component = {
  16596. precision: (data[j] & 0x7f) + 1,
  16597. isSigned: !!(data[j] & 0x80),
  16598. XRsiz: data[j + 1],
  16599. YRsiz: data[j + 2]
  16600. };
  16601. j += 3;
  16602. calculateComponentDimensions(component, siz);
  16603. components.push(component);
  16604. }
  16605. context.SIZ = siz;
  16606. context.components = components;
  16607. calculateTileGrids(context, components);
  16608. context.QCC = [];
  16609. context.COC = [];
  16610. break;
  16611. case 0xff5c:
  16612. length = (0, _core_utils.readUint16)(data, position);
  16613. const qcd = {};
  16614. j = position + 2;
  16615. sqcd = data[j++];
  16616. switch (sqcd & 0x1f) {
  16617. case 0:
  16618. spqcdSize = 8;
  16619. scalarExpounded = true;
  16620. break;
  16621. case 1:
  16622. spqcdSize = 16;
  16623. scalarExpounded = false;
  16624. break;
  16625. case 2:
  16626. spqcdSize = 16;
  16627. scalarExpounded = true;
  16628. break;
  16629. default:
  16630. throw new Error("Invalid SQcd value " + sqcd);
  16631. }
  16632. qcd.noQuantization = spqcdSize === 8;
  16633. qcd.scalarExpounded = scalarExpounded;
  16634. qcd.guardBits = sqcd >> 5;
  16635. spqcds = [];
  16636. while (j < length + position) {
  16637. const spqcd = {};
  16638. if (spqcdSize === 8) {
  16639. spqcd.epsilon = data[j++] >> 3;
  16640. spqcd.mu = 0;
  16641. } else {
  16642. spqcd.epsilon = data[j] >> 3;
  16643. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  16644. j += 2;
  16645. }
  16646. spqcds.push(spqcd);
  16647. }
  16648. qcd.SPqcds = spqcds;
  16649. if (context.mainHeader) {
  16650. context.QCD = qcd;
  16651. } else {
  16652. context.currentTile.QCD = qcd;
  16653. context.currentTile.QCC = [];
  16654. }
  16655. break;
  16656. case 0xff5d:
  16657. length = (0, _core_utils.readUint16)(data, position);
  16658. const qcc = {};
  16659. j = position + 2;
  16660. let cqcc;
  16661. if (context.SIZ.Csiz < 257) {
  16662. cqcc = data[j++];
  16663. } else {
  16664. cqcc = (0, _core_utils.readUint16)(data, j);
  16665. j += 2;
  16666. }
  16667. sqcd = data[j++];
  16668. switch (sqcd & 0x1f) {
  16669. case 0:
  16670. spqcdSize = 8;
  16671. scalarExpounded = true;
  16672. break;
  16673. case 1:
  16674. spqcdSize = 16;
  16675. scalarExpounded = false;
  16676. break;
  16677. case 2:
  16678. spqcdSize = 16;
  16679. scalarExpounded = true;
  16680. break;
  16681. default:
  16682. throw new Error("Invalid SQcd value " + sqcd);
  16683. }
  16684. qcc.noQuantization = spqcdSize === 8;
  16685. qcc.scalarExpounded = scalarExpounded;
  16686. qcc.guardBits = sqcd >> 5;
  16687. spqcds = [];
  16688. while (j < length + position) {
  16689. const spqcd = {};
  16690. if (spqcdSize === 8) {
  16691. spqcd.epsilon = data[j++] >> 3;
  16692. spqcd.mu = 0;
  16693. } else {
  16694. spqcd.epsilon = data[j] >> 3;
  16695. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  16696. j += 2;
  16697. }
  16698. spqcds.push(spqcd);
  16699. }
  16700. qcc.SPqcds = spqcds;
  16701. if (context.mainHeader) {
  16702. context.QCC[cqcc] = qcc;
  16703. } else {
  16704. context.currentTile.QCC[cqcc] = qcc;
  16705. }
  16706. break;
  16707. case 0xff52:
  16708. length = (0, _core_utils.readUint16)(data, position);
  16709. const cod = {};
  16710. j = position + 2;
  16711. const scod = data[j++];
  16712. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  16713. cod.sopMarkerUsed = !!(scod & 2);
  16714. cod.ephMarkerUsed = !!(scod & 4);
  16715. cod.progressionOrder = data[j++];
  16716. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  16717. j += 2;
  16718. cod.multipleComponentTransform = data[j++];
  16719. cod.decompositionLevelsCount = data[j++];
  16720. cod.xcb = (data[j++] & 0xf) + 2;
  16721. cod.ycb = (data[j++] & 0xf) + 2;
  16722. const blockStyle = data[j++];
  16723. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  16724. cod.resetContextProbabilities = !!(blockStyle & 2);
  16725. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  16726. cod.verticallyStripe = !!(blockStyle & 8);
  16727. cod.predictableTermination = !!(blockStyle & 16);
  16728. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  16729. cod.reversibleTransformation = data[j++];
  16730. if (cod.entropyCoderWithCustomPrecincts) {
  16731. const precinctsSizes = [];
  16732. while (j < length + position) {
  16733. const precinctsSize = data[j++];
  16734. precinctsSizes.push({
  16735. PPx: precinctsSize & 0xf,
  16736. PPy: precinctsSize >> 4
  16737. });
  16738. }
  16739. cod.precinctsSizes = precinctsSizes;
  16740. }
  16741. const unsupported = [];
  16742. if (cod.selectiveArithmeticCodingBypass) {
  16743. unsupported.push("selectiveArithmeticCodingBypass");
  16744. }
  16745. if (cod.resetContextProbabilities) {
  16746. unsupported.push("resetContextProbabilities");
  16747. }
  16748. if (cod.terminationOnEachCodingPass) {
  16749. unsupported.push("terminationOnEachCodingPass");
  16750. }
  16751. if (cod.verticallyStripe) {
  16752. unsupported.push("verticallyStripe");
  16753. }
  16754. if (cod.predictableTermination) {
  16755. unsupported.push("predictableTermination");
  16756. }
  16757. if (unsupported.length > 0) {
  16758. doNotRecover = true;
  16759. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  16760. }
  16761. if (context.mainHeader) {
  16762. context.COD = cod;
  16763. } else {
  16764. context.currentTile.COD = cod;
  16765. context.currentTile.COC = [];
  16766. }
  16767. break;
  16768. case 0xff90:
  16769. length = (0, _core_utils.readUint16)(data, position);
  16770. tile = {};
  16771. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  16772. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  16773. tile.dataEnd = tile.length + position - 2;
  16774. tile.partIndex = data[position + 8];
  16775. tile.partsCount = data[position + 9];
  16776. context.mainHeader = false;
  16777. if (tile.partIndex === 0) {
  16778. tile.COD = context.COD;
  16779. tile.COC = context.COC.slice(0);
  16780. tile.QCD = context.QCD;
  16781. tile.QCC = context.QCC.slice(0);
  16782. }
  16783. context.currentTile = tile;
  16784. break;
  16785. case 0xff93:
  16786. tile = context.currentTile;
  16787. if (tile.partIndex === 0) {
  16788. initializeTile(context, tile.index);
  16789. buildPackets(context);
  16790. }
  16791. length = tile.dataEnd - position;
  16792. parseTilePackets(context, data, position, length);
  16793. break;
  16794. case 0xff53:
  16795. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  16796. case 0xff55:
  16797. case 0xff57:
  16798. case 0xff58:
  16799. case 0xff64:
  16800. length = (0, _core_utils.readUint16)(data, position);
  16801. break;
  16802. default:
  16803. throw new Error("Unknown codestream code: " + code.toString(16));
  16804. }
  16805. position += length;
  16806. }
  16807. } catch (e) {
  16808. if (doNotRecover || this.failOnCorruptedImage) {
  16809. throw new JpxError(e.message);
  16810. } else {
  16811. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  16812. }
  16813. }
  16814. this.tiles = transformComponents(context);
  16815. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  16816. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  16817. this.componentsCount = context.SIZ.Csiz;
  16818. }
  16819. }
  16820. exports.JpxImage = JpxImage;
  16821. function calculateComponentDimensions(component, siz) {
  16822. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  16823. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  16824. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  16825. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  16826. component.width = component.x1 - component.x0;
  16827. component.height = component.y1 - component.y0;
  16828. }
  16829. function calculateTileGrids(context, components) {
  16830. const siz = context.SIZ;
  16831. const tiles = [];
  16832. let tile;
  16833. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  16834. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  16835. for (let q = 0; q < numYtiles; q++) {
  16836. for (let p = 0; p < numXtiles; p++) {
  16837. tile = {};
  16838. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  16839. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  16840. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  16841. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  16842. tile.width = tile.tx1 - tile.tx0;
  16843. tile.height = tile.ty1 - tile.ty0;
  16844. tile.components = [];
  16845. tiles.push(tile);
  16846. }
  16847. }
  16848. context.tiles = tiles;
  16849. const componentsCount = siz.Csiz;
  16850. for (let i = 0, ii = componentsCount; i < ii; i++) {
  16851. const component = components[i];
  16852. for (let j = 0, jj = tiles.length; j < jj; j++) {
  16853. const tileComponent = {};
  16854. tile = tiles[j];
  16855. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  16856. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  16857. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  16858. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  16859. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  16860. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  16861. tile.components[i] = tileComponent;
  16862. }
  16863. }
  16864. }
  16865. function getBlocksDimensions(context, component, r) {
  16866. const codOrCoc = component.codingStyleParameters;
  16867. const result = {};
  16868. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  16869. result.PPx = 15;
  16870. result.PPy = 15;
  16871. } else {
  16872. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  16873. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  16874. }
  16875. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  16876. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  16877. return result;
  16878. }
  16879. function buildPrecincts(context, resolution, dimensions) {
  16880. const precinctWidth = 1 << dimensions.PPx;
  16881. const precinctHeight = 1 << dimensions.PPy;
  16882. const isZeroRes = resolution.resLevel === 0;
  16883. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  16884. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  16885. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  16886. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  16887. const numprecincts = numprecinctswide * numprecinctshigh;
  16888. resolution.precinctParameters = {
  16889. precinctWidth,
  16890. precinctHeight,
  16891. numprecinctswide,
  16892. numprecinctshigh,
  16893. numprecincts,
  16894. precinctWidthInSubband,
  16895. precinctHeightInSubband
  16896. };
  16897. }
  16898. function buildCodeblocks(context, subband, dimensions) {
  16899. const xcb_ = dimensions.xcb_;
  16900. const ycb_ = dimensions.ycb_;
  16901. const codeblockWidth = 1 << xcb_;
  16902. const codeblockHeight = 1 << ycb_;
  16903. const cbx0 = subband.tbx0 >> xcb_;
  16904. const cby0 = subband.tby0 >> ycb_;
  16905. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  16906. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  16907. const precinctParameters = subband.resolution.precinctParameters;
  16908. const codeblocks = [];
  16909. const precincts = [];
  16910. let i, j, codeblock, precinctNumber;
  16911. for (j = cby0; j < cby1; j++) {
  16912. for (i = cbx0; i < cbx1; i++) {
  16913. codeblock = {
  16914. cbx: i,
  16915. cby: j,
  16916. tbx0: codeblockWidth * i,
  16917. tby0: codeblockHeight * j,
  16918. tbx1: codeblockWidth * (i + 1),
  16919. tby1: codeblockHeight * (j + 1)
  16920. };
  16921. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  16922. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  16923. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  16924. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  16925. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  16926. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  16927. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  16928. codeblock.precinctNumber = precinctNumber;
  16929. codeblock.subbandType = subband.type;
  16930. codeblock.Lblock = 3;
  16931. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  16932. continue;
  16933. }
  16934. codeblocks.push(codeblock);
  16935. let precinct = precincts[precinctNumber];
  16936. if (precinct !== undefined) {
  16937. if (i < precinct.cbxMin) {
  16938. precinct.cbxMin = i;
  16939. } else if (i > precinct.cbxMax) {
  16940. precinct.cbxMax = i;
  16941. }
  16942. if (j < precinct.cbyMin) {
  16943. precinct.cbxMin = j;
  16944. } else if (j > precinct.cbyMax) {
  16945. precinct.cbyMax = j;
  16946. }
  16947. } else {
  16948. precincts[precinctNumber] = precinct = {
  16949. cbxMin: i,
  16950. cbyMin: j,
  16951. cbxMax: i,
  16952. cbyMax: j
  16953. };
  16954. }
  16955. codeblock.precinct = precinct;
  16956. }
  16957. }
  16958. subband.codeblockParameters = {
  16959. codeblockWidth: xcb_,
  16960. codeblockHeight: ycb_,
  16961. numcodeblockwide: cbx1 - cbx0 + 1,
  16962. numcodeblockhigh: cby1 - cby0 + 1
  16963. };
  16964. subband.codeblocks = codeblocks;
  16965. subband.precincts = precincts;
  16966. }
  16967. function createPacket(resolution, precinctNumber, layerNumber) {
  16968. const precinctCodeblocks = [];
  16969. const subbands = resolution.subbands;
  16970. for (let i = 0, ii = subbands.length; i < ii; i++) {
  16971. const subband = subbands[i];
  16972. const codeblocks = subband.codeblocks;
  16973. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  16974. const codeblock = codeblocks[j];
  16975. if (codeblock.precinctNumber !== precinctNumber) {
  16976. continue;
  16977. }
  16978. precinctCodeblocks.push(codeblock);
  16979. }
  16980. }
  16981. return {
  16982. layerNumber,
  16983. codeblocks: precinctCodeblocks
  16984. };
  16985. }
  16986. function LayerResolutionComponentPositionIterator(context) {
  16987. const siz = context.SIZ;
  16988. const tileIndex = context.currentTile.index;
  16989. const tile = context.tiles[tileIndex];
  16990. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  16991. const componentsCount = siz.Csiz;
  16992. let maxDecompositionLevelsCount = 0;
  16993. for (let q = 0; q < componentsCount; q++) {
  16994. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  16995. }
  16996. let l = 0,
  16997. r = 0,
  16998. i = 0,
  16999. k = 0;
  17000. this.nextPacket = function JpxImage_nextPacket() {
  17001. for (; l < layersCount; l++) {
  17002. for (; r <= maxDecompositionLevelsCount; r++) {
  17003. for (; i < componentsCount; i++) {
  17004. const component = tile.components[i];
  17005. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  17006. continue;
  17007. }
  17008. const resolution = component.resolutions[r];
  17009. const numprecincts = resolution.precinctParameters.numprecincts;
  17010. for (; k < numprecincts;) {
  17011. const packet = createPacket(resolution, k, l);
  17012. k++;
  17013. return packet;
  17014. }
  17015. k = 0;
  17016. }
  17017. i = 0;
  17018. }
  17019. r = 0;
  17020. }
  17021. throw new JpxError("Out of packets");
  17022. };
  17023. }
  17024. function ResolutionLayerComponentPositionIterator(context) {
  17025. const siz = context.SIZ;
  17026. const tileIndex = context.currentTile.index;
  17027. const tile = context.tiles[tileIndex];
  17028. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  17029. const componentsCount = siz.Csiz;
  17030. let maxDecompositionLevelsCount = 0;
  17031. for (let q = 0; q < componentsCount; q++) {
  17032. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  17033. }
  17034. let r = 0,
  17035. l = 0,
  17036. i = 0,
  17037. k = 0;
  17038. this.nextPacket = function JpxImage_nextPacket() {
  17039. for (; r <= maxDecompositionLevelsCount; r++) {
  17040. for (; l < layersCount; l++) {
  17041. for (; i < componentsCount; i++) {
  17042. const component = tile.components[i];
  17043. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  17044. continue;
  17045. }
  17046. const resolution = component.resolutions[r];
  17047. const numprecincts = resolution.precinctParameters.numprecincts;
  17048. for (; k < numprecincts;) {
  17049. const packet = createPacket(resolution, k, l);
  17050. k++;
  17051. return packet;
  17052. }
  17053. k = 0;
  17054. }
  17055. i = 0;
  17056. }
  17057. l = 0;
  17058. }
  17059. throw new JpxError("Out of packets");
  17060. };
  17061. }
  17062. function ResolutionPositionComponentLayerIterator(context) {
  17063. const siz = context.SIZ;
  17064. const tileIndex = context.currentTile.index;
  17065. const tile = context.tiles[tileIndex];
  17066. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  17067. const componentsCount = siz.Csiz;
  17068. let l, r, c, p;
  17069. let maxDecompositionLevelsCount = 0;
  17070. for (c = 0; c < componentsCount; c++) {
  17071. const component = tile.components[c];
  17072. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  17073. }
  17074. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  17075. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  17076. let maxNumPrecincts = 0;
  17077. for (c = 0; c < componentsCount; ++c) {
  17078. const resolutions = tile.components[c].resolutions;
  17079. if (r < resolutions.length) {
  17080. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  17081. }
  17082. }
  17083. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  17084. }
  17085. l = 0;
  17086. r = 0;
  17087. c = 0;
  17088. p = 0;
  17089. this.nextPacket = function JpxImage_nextPacket() {
  17090. for (; r <= maxDecompositionLevelsCount; r++) {
  17091. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  17092. for (; c < componentsCount; c++) {
  17093. const component = tile.components[c];
  17094. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  17095. continue;
  17096. }
  17097. const resolution = component.resolutions[r];
  17098. const numprecincts = resolution.precinctParameters.numprecincts;
  17099. if (p >= numprecincts) {
  17100. continue;
  17101. }
  17102. for (; l < layersCount;) {
  17103. const packet = createPacket(resolution, p, l);
  17104. l++;
  17105. return packet;
  17106. }
  17107. l = 0;
  17108. }
  17109. c = 0;
  17110. }
  17111. p = 0;
  17112. }
  17113. throw new JpxError("Out of packets");
  17114. };
  17115. }
  17116. function PositionComponentResolutionLayerIterator(context) {
  17117. const siz = context.SIZ;
  17118. const tileIndex = context.currentTile.index;
  17119. const tile = context.tiles[tileIndex];
  17120. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  17121. const componentsCount = siz.Csiz;
  17122. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  17123. const precinctsIterationSizes = precinctsSizes;
  17124. let l = 0,
  17125. r = 0,
  17126. c = 0,
  17127. px = 0,
  17128. py = 0;
  17129. this.nextPacket = function JpxImage_nextPacket() {
  17130. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  17131. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  17132. for (; c < componentsCount; c++) {
  17133. const component = tile.components[c];
  17134. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  17135. for (; r <= decompositionLevelsCount; r++) {
  17136. const resolution = component.resolutions[r];
  17137. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  17138. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  17139. if (k === null) {
  17140. continue;
  17141. }
  17142. for (; l < layersCount;) {
  17143. const packet = createPacket(resolution, k, l);
  17144. l++;
  17145. return packet;
  17146. }
  17147. l = 0;
  17148. }
  17149. r = 0;
  17150. }
  17151. c = 0;
  17152. }
  17153. px = 0;
  17154. }
  17155. throw new JpxError("Out of packets");
  17156. };
  17157. }
  17158. function ComponentPositionResolutionLayerIterator(context) {
  17159. const siz = context.SIZ;
  17160. const tileIndex = context.currentTile.index;
  17161. const tile = context.tiles[tileIndex];
  17162. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  17163. const componentsCount = siz.Csiz;
  17164. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  17165. let l = 0,
  17166. r = 0,
  17167. c = 0,
  17168. px = 0,
  17169. py = 0;
  17170. this.nextPacket = function JpxImage_nextPacket() {
  17171. for (; c < componentsCount; ++c) {
  17172. const component = tile.components[c];
  17173. const precinctsIterationSizes = precinctsSizes.components[c];
  17174. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  17175. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  17176. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  17177. for (; r <= decompositionLevelsCount; r++) {
  17178. const resolution = component.resolutions[r];
  17179. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  17180. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  17181. if (k === null) {
  17182. continue;
  17183. }
  17184. for (; l < layersCount;) {
  17185. const packet = createPacket(resolution, k, l);
  17186. l++;
  17187. return packet;
  17188. }
  17189. l = 0;
  17190. }
  17191. r = 0;
  17192. }
  17193. px = 0;
  17194. }
  17195. py = 0;
  17196. }
  17197. throw new JpxError("Out of packets");
  17198. };
  17199. }
  17200. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  17201. const posX = pxIndex * precinctIterationSizes.minWidth;
  17202. const posY = pyIndex * precinctIterationSizes.minHeight;
  17203. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  17204. return null;
  17205. }
  17206. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  17207. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  17208. }
  17209. function getPrecinctSizesInImageScale(tile) {
  17210. const componentsCount = tile.components.length;
  17211. let minWidth = Number.MAX_VALUE;
  17212. let minHeight = Number.MAX_VALUE;
  17213. let maxNumWide = 0;
  17214. let maxNumHigh = 0;
  17215. const sizePerComponent = new Array(componentsCount);
  17216. for (let c = 0; c < componentsCount; c++) {
  17217. const component = tile.components[c];
  17218. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  17219. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  17220. let minWidthCurrentComponent = Number.MAX_VALUE;
  17221. let minHeightCurrentComponent = Number.MAX_VALUE;
  17222. let maxNumWideCurrentComponent = 0;
  17223. let maxNumHighCurrentComponent = 0;
  17224. let scale = 1;
  17225. for (let r = decompositionLevelsCount; r >= 0; --r) {
  17226. const resolution = component.resolutions[r];
  17227. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  17228. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  17229. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  17230. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  17231. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  17232. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  17233. sizePerResolution[r] = {
  17234. width: widthCurrentResolution,
  17235. height: heightCurrentResolution
  17236. };
  17237. scale <<= 1;
  17238. }
  17239. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  17240. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  17241. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  17242. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  17243. sizePerComponent[c] = {
  17244. resolutions: sizePerResolution,
  17245. minWidth: minWidthCurrentComponent,
  17246. minHeight: minHeightCurrentComponent,
  17247. maxNumWide: maxNumWideCurrentComponent,
  17248. maxNumHigh: maxNumHighCurrentComponent
  17249. };
  17250. }
  17251. return {
  17252. components: sizePerComponent,
  17253. minWidth,
  17254. minHeight,
  17255. maxNumWide,
  17256. maxNumHigh
  17257. };
  17258. }
  17259. function buildPackets(context) {
  17260. const siz = context.SIZ;
  17261. const tileIndex = context.currentTile.index;
  17262. const tile = context.tiles[tileIndex];
  17263. const componentsCount = siz.Csiz;
  17264. for (let c = 0; c < componentsCount; c++) {
  17265. const component = tile.components[c];
  17266. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  17267. const resolutions = [];
  17268. const subbands = [];
  17269. for (let r = 0; r <= decompositionLevelsCount; r++) {
  17270. const blocksDimensions = getBlocksDimensions(context, component, r);
  17271. const resolution = {};
  17272. const scale = 1 << decompositionLevelsCount - r;
  17273. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  17274. resolution.try0 = Math.ceil(component.tcy0 / scale);
  17275. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  17276. resolution.try1 = Math.ceil(component.tcy1 / scale);
  17277. resolution.resLevel = r;
  17278. buildPrecincts(context, resolution, blocksDimensions);
  17279. resolutions.push(resolution);
  17280. let subband;
  17281. if (r === 0) {
  17282. subband = {};
  17283. subband.type = "LL";
  17284. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  17285. subband.tby0 = Math.ceil(component.tcy0 / scale);
  17286. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  17287. subband.tby1 = Math.ceil(component.tcy1 / scale);
  17288. subband.resolution = resolution;
  17289. buildCodeblocks(context, subband, blocksDimensions);
  17290. subbands.push(subband);
  17291. resolution.subbands = [subband];
  17292. } else {
  17293. const bscale = 1 << decompositionLevelsCount - r + 1;
  17294. const resolutionSubbands = [];
  17295. subband = {};
  17296. subband.type = "HL";
  17297. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  17298. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  17299. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  17300. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  17301. subband.resolution = resolution;
  17302. buildCodeblocks(context, subband, blocksDimensions);
  17303. subbands.push(subband);
  17304. resolutionSubbands.push(subband);
  17305. subband = {};
  17306. subband.type = "LH";
  17307. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  17308. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  17309. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  17310. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  17311. subband.resolution = resolution;
  17312. buildCodeblocks(context, subband, blocksDimensions);
  17313. subbands.push(subband);
  17314. resolutionSubbands.push(subband);
  17315. subband = {};
  17316. subband.type = "HH";
  17317. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  17318. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  17319. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  17320. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  17321. subband.resolution = resolution;
  17322. buildCodeblocks(context, subband, blocksDimensions);
  17323. subbands.push(subband);
  17324. resolutionSubbands.push(subband);
  17325. resolution.subbands = resolutionSubbands;
  17326. }
  17327. }
  17328. component.resolutions = resolutions;
  17329. component.subbands = subbands;
  17330. }
  17331. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  17332. switch (progressionOrder) {
  17333. case 0:
  17334. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  17335. break;
  17336. case 1:
  17337. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  17338. break;
  17339. case 2:
  17340. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  17341. break;
  17342. case 3:
  17343. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  17344. break;
  17345. case 4:
  17346. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  17347. break;
  17348. default:
  17349. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  17350. }
  17351. }
  17352. function parseTilePackets(context, data, offset, dataLength) {
  17353. let position = 0;
  17354. let buffer,
  17355. bufferSize = 0,
  17356. skipNextBit = false;
  17357. function readBits(count) {
  17358. while (bufferSize < count) {
  17359. const b = data[offset + position];
  17360. position++;
  17361. if (skipNextBit) {
  17362. buffer = buffer << 7 | b;
  17363. bufferSize += 7;
  17364. skipNextBit = false;
  17365. } else {
  17366. buffer = buffer << 8 | b;
  17367. bufferSize += 8;
  17368. }
  17369. if (b === 0xff) {
  17370. skipNextBit = true;
  17371. }
  17372. }
  17373. bufferSize -= count;
  17374. return buffer >>> bufferSize & (1 << count) - 1;
  17375. }
  17376. function skipMarkerIfEqual(value) {
  17377. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  17378. skipBytes(1);
  17379. return true;
  17380. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  17381. skipBytes(2);
  17382. return true;
  17383. }
  17384. return false;
  17385. }
  17386. function skipBytes(count) {
  17387. position += count;
  17388. }
  17389. function alignToByte() {
  17390. bufferSize = 0;
  17391. if (skipNextBit) {
  17392. position++;
  17393. skipNextBit = false;
  17394. }
  17395. }
  17396. function readCodingpasses() {
  17397. if (readBits(1) === 0) {
  17398. return 1;
  17399. }
  17400. if (readBits(1) === 0) {
  17401. return 2;
  17402. }
  17403. let value = readBits(2);
  17404. if (value < 3) {
  17405. return value + 3;
  17406. }
  17407. value = readBits(5);
  17408. if (value < 31) {
  17409. return value + 6;
  17410. }
  17411. value = readBits(7);
  17412. return value + 37;
  17413. }
  17414. const tileIndex = context.currentTile.index;
  17415. const tile = context.tiles[tileIndex];
  17416. const sopMarkerUsed = context.COD.sopMarkerUsed;
  17417. const ephMarkerUsed = context.COD.ephMarkerUsed;
  17418. const packetsIterator = tile.packetsIterator;
  17419. while (position < dataLength) {
  17420. alignToByte();
  17421. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  17422. skipBytes(4);
  17423. }
  17424. const packet = packetsIterator.nextPacket();
  17425. if (!readBits(1)) {
  17426. continue;
  17427. }
  17428. const layerNumber = packet.layerNumber,
  17429. queue = [];
  17430. let codeblock;
  17431. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  17432. codeblock = packet.codeblocks[i];
  17433. let precinct = codeblock.precinct;
  17434. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  17435. const codeblockRow = codeblock.cby - precinct.cbyMin;
  17436. let codeblockIncluded = false;
  17437. let firstTimeInclusion = false;
  17438. let valueReady, zeroBitPlanesTree;
  17439. if (codeblock.included !== undefined) {
  17440. codeblockIncluded = !!readBits(1);
  17441. } else {
  17442. precinct = codeblock.precinct;
  17443. let inclusionTree;
  17444. if (precinct.inclusionTree !== undefined) {
  17445. inclusionTree = precinct.inclusionTree;
  17446. } else {
  17447. const width = precinct.cbxMax - precinct.cbxMin + 1;
  17448. const height = precinct.cbyMax - precinct.cbyMin + 1;
  17449. inclusionTree = new InclusionTree(width, height, layerNumber);
  17450. zeroBitPlanesTree = new TagTree(width, height);
  17451. precinct.inclusionTree = inclusionTree;
  17452. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  17453. }
  17454. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  17455. while (true) {
  17456. if (readBits(1)) {
  17457. valueReady = !inclusionTree.nextLevel();
  17458. if (valueReady) {
  17459. codeblock.included = true;
  17460. codeblockIncluded = firstTimeInclusion = true;
  17461. break;
  17462. }
  17463. } else {
  17464. inclusionTree.incrementValue(layerNumber);
  17465. break;
  17466. }
  17467. }
  17468. }
  17469. }
  17470. if (!codeblockIncluded) {
  17471. continue;
  17472. }
  17473. if (firstTimeInclusion) {
  17474. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  17475. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  17476. while (true) {
  17477. if (readBits(1)) {
  17478. valueReady = !zeroBitPlanesTree.nextLevel();
  17479. if (valueReady) {
  17480. break;
  17481. }
  17482. } else {
  17483. zeroBitPlanesTree.incrementValue();
  17484. }
  17485. }
  17486. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  17487. }
  17488. const codingpasses = readCodingpasses();
  17489. while (readBits(1)) {
  17490. codeblock.Lblock++;
  17491. }
  17492. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  17493. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  17494. const codedDataLength = readBits(bits);
  17495. queue.push({
  17496. codeblock,
  17497. codingpasses,
  17498. dataLength: codedDataLength
  17499. });
  17500. }
  17501. alignToByte();
  17502. if (ephMarkerUsed) {
  17503. skipMarkerIfEqual(0x92);
  17504. }
  17505. while (queue.length > 0) {
  17506. const packetItem = queue.shift();
  17507. codeblock = packetItem.codeblock;
  17508. if (codeblock.data === undefined) {
  17509. codeblock.data = [];
  17510. }
  17511. codeblock.data.push({
  17512. data,
  17513. start: offset + position,
  17514. end: offset + position + packetItem.dataLength,
  17515. codingpasses: packetItem.codingpasses
  17516. });
  17517. position += packetItem.dataLength;
  17518. }
  17519. }
  17520. return position;
  17521. }
  17522. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  17523. const x0 = subband.tbx0;
  17524. const y0 = subband.tby0;
  17525. const width = subband.tbx1 - subband.tbx0;
  17526. const codeblocks = subband.codeblocks;
  17527. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  17528. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  17529. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  17530. const codeblock = codeblocks[i];
  17531. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  17532. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  17533. if (blockWidth === 0 || blockHeight === 0) {
  17534. continue;
  17535. }
  17536. if (codeblock.data === undefined) {
  17537. continue;
  17538. }
  17539. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  17540. let currentCodingpassType = 2;
  17541. const data = codeblock.data;
  17542. let totalLength = 0,
  17543. codingpasses = 0;
  17544. let j, jj, dataItem;
  17545. for (j = 0, jj = data.length; j < jj; j++) {
  17546. dataItem = data[j];
  17547. totalLength += dataItem.end - dataItem.start;
  17548. codingpasses += dataItem.codingpasses;
  17549. }
  17550. const encodedData = new Uint8Array(totalLength);
  17551. let position = 0;
  17552. for (j = 0, jj = data.length; j < jj; j++) {
  17553. dataItem = data[j];
  17554. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  17555. encodedData.set(chunk, position);
  17556. position += chunk.length;
  17557. }
  17558. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  17559. bitModel.setDecoder(decoder);
  17560. for (j = 0; j < codingpasses; j++) {
  17561. switch (currentCodingpassType) {
  17562. case 0:
  17563. bitModel.runSignificancePropagationPass();
  17564. break;
  17565. case 1:
  17566. bitModel.runMagnitudeRefinementPass();
  17567. break;
  17568. case 2:
  17569. bitModel.runCleanupPass();
  17570. if (segmentationSymbolUsed) {
  17571. bitModel.checkSegmentationSymbol();
  17572. }
  17573. break;
  17574. }
  17575. currentCodingpassType = (currentCodingpassType + 1) % 3;
  17576. }
  17577. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  17578. const sign = bitModel.coefficentsSign;
  17579. const magnitude = bitModel.coefficentsMagnitude;
  17580. const bitsDecoded = bitModel.bitsDecoded;
  17581. const magnitudeCorrection = reversible ? 0 : 0.5;
  17582. let k, n, nb;
  17583. position = 0;
  17584. const interleave = subband.type !== "LL";
  17585. for (j = 0; j < blockHeight; j++) {
  17586. const row = offset / width | 0;
  17587. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  17588. for (k = 0; k < blockWidth; k++) {
  17589. n = magnitude[position];
  17590. if (n !== 0) {
  17591. n = (n + magnitudeCorrection) * delta;
  17592. if (sign[position] !== 0) {
  17593. n = -n;
  17594. }
  17595. nb = bitsDecoded[position];
  17596. const pos = interleave ? levelOffset + (offset << 1) : offset;
  17597. if (reversible && nb >= mb) {
  17598. coefficients[pos] = n;
  17599. } else {
  17600. coefficients[pos] = n * (1 << mb - nb);
  17601. }
  17602. }
  17603. offset++;
  17604. position++;
  17605. }
  17606. offset += width - blockWidth;
  17607. }
  17608. }
  17609. }
  17610. function transformTile(context, tile, c) {
  17611. const component = tile.components[c];
  17612. const codingStyleParameters = component.codingStyleParameters;
  17613. const quantizationParameters = component.quantizationParameters;
  17614. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  17615. const spqcds = quantizationParameters.SPqcds;
  17616. const scalarExpounded = quantizationParameters.scalarExpounded;
  17617. const guardBits = quantizationParameters.guardBits;
  17618. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  17619. const precision = context.components[c].precision;
  17620. const reversible = codingStyleParameters.reversibleTransformation;
  17621. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  17622. const subbandCoefficients = [];
  17623. let b = 0;
  17624. for (let i = 0; i <= decompositionLevelsCount; i++) {
  17625. const resolution = component.resolutions[i];
  17626. const width = resolution.trx1 - resolution.trx0;
  17627. const height = resolution.try1 - resolution.try0;
  17628. const coefficients = new Float32Array(width * height);
  17629. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  17630. let mu, epsilon;
  17631. if (!scalarExpounded) {
  17632. mu = spqcds[0].mu;
  17633. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  17634. } else {
  17635. mu = spqcds[b].mu;
  17636. epsilon = spqcds[b].epsilon;
  17637. b++;
  17638. }
  17639. const subband = resolution.subbands[j];
  17640. const gainLog2 = SubbandsGainLog2[subband.type];
  17641. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  17642. const mb = guardBits + epsilon - 1;
  17643. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  17644. }
  17645. subbandCoefficients.push({
  17646. width,
  17647. height,
  17648. items: coefficients
  17649. });
  17650. }
  17651. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  17652. return {
  17653. left: component.tcx0,
  17654. top: component.tcy0,
  17655. width: result.width,
  17656. height: result.height,
  17657. items: result.items
  17658. };
  17659. }
  17660. function transformComponents(context) {
  17661. const siz = context.SIZ;
  17662. const components = context.components;
  17663. const componentsCount = siz.Csiz;
  17664. const resultImages = [];
  17665. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  17666. const tile = context.tiles[i];
  17667. const transformedTiles = [];
  17668. for (let c = 0; c < componentsCount; c++) {
  17669. transformedTiles[c] = transformTile(context, tile, c);
  17670. }
  17671. const tile0 = transformedTiles[0];
  17672. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  17673. const result = {
  17674. left: tile0.left,
  17675. top: tile0.top,
  17676. width: tile0.width,
  17677. height: tile0.height,
  17678. items: out
  17679. };
  17680. let shift, offset;
  17681. let pos = 0,
  17682. j,
  17683. jj,
  17684. y0,
  17685. y1,
  17686. y2;
  17687. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  17688. const fourComponents = componentsCount === 4;
  17689. const y0items = transformedTiles[0].items;
  17690. const y1items = transformedTiles[1].items;
  17691. const y2items = transformedTiles[2].items;
  17692. const y3items = fourComponents ? transformedTiles[3].items : null;
  17693. shift = components[0].precision - 8;
  17694. offset = (128 << shift) + 0.5;
  17695. const component0 = tile.components[0];
  17696. const alpha01 = componentsCount - 3;
  17697. jj = y0items.length;
  17698. if (!component0.codingStyleParameters.reversibleTransformation) {
  17699. for (j = 0; j < jj; j++, pos += alpha01) {
  17700. y0 = y0items[j] + offset;
  17701. y1 = y1items[j];
  17702. y2 = y2items[j];
  17703. out[pos++] = y0 + 1.402 * y2 >> shift;
  17704. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  17705. out[pos++] = y0 + 1.772 * y1 >> shift;
  17706. }
  17707. } else {
  17708. for (j = 0; j < jj; j++, pos += alpha01) {
  17709. y0 = y0items[j] + offset;
  17710. y1 = y1items[j];
  17711. y2 = y2items[j];
  17712. const g = y0 - (y2 + y1 >> 2);
  17713. out[pos++] = g + y2 >> shift;
  17714. out[pos++] = g >> shift;
  17715. out[pos++] = g + y1 >> shift;
  17716. }
  17717. }
  17718. if (fourComponents) {
  17719. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  17720. out[pos] = y3items[j] + offset >> shift;
  17721. }
  17722. }
  17723. } else {
  17724. for (let c = 0; c < componentsCount; c++) {
  17725. const items = transformedTiles[c].items;
  17726. shift = components[c].precision - 8;
  17727. offset = (128 << shift) + 0.5;
  17728. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  17729. out[pos] = items[j] + offset >> shift;
  17730. pos += componentsCount;
  17731. }
  17732. }
  17733. }
  17734. resultImages.push(result);
  17735. }
  17736. return resultImages;
  17737. }
  17738. function initializeTile(context, tileIndex) {
  17739. const siz = context.SIZ;
  17740. const componentsCount = siz.Csiz;
  17741. const tile = context.tiles[tileIndex];
  17742. for (let c = 0; c < componentsCount; c++) {
  17743. const component = tile.components[c];
  17744. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  17745. component.quantizationParameters = qcdOrQcc;
  17746. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  17747. component.codingStyleParameters = codOrCoc;
  17748. }
  17749. tile.codingStyleDefaultParameters = context.currentTile.COD;
  17750. }
  17751. class TagTree {
  17752. constructor(width, height) {
  17753. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  17754. this.levels = [];
  17755. for (let i = 0; i < levelsLength; i++) {
  17756. const level = {
  17757. width,
  17758. height,
  17759. items: []
  17760. };
  17761. this.levels.push(level);
  17762. width = Math.ceil(width / 2);
  17763. height = Math.ceil(height / 2);
  17764. }
  17765. }
  17766. reset(i, j) {
  17767. let currentLevel = 0,
  17768. value = 0,
  17769. level;
  17770. while (currentLevel < this.levels.length) {
  17771. level = this.levels[currentLevel];
  17772. const index = i + j * level.width;
  17773. if (level.items[index] !== undefined) {
  17774. value = level.items[index];
  17775. break;
  17776. }
  17777. level.index = index;
  17778. i >>= 1;
  17779. j >>= 1;
  17780. currentLevel++;
  17781. }
  17782. currentLevel--;
  17783. level = this.levels[currentLevel];
  17784. level.items[level.index] = value;
  17785. this.currentLevel = currentLevel;
  17786. delete this.value;
  17787. }
  17788. incrementValue() {
  17789. const level = this.levels[this.currentLevel];
  17790. level.items[level.index]++;
  17791. }
  17792. nextLevel() {
  17793. let currentLevel = this.currentLevel;
  17794. let level = this.levels[currentLevel];
  17795. const value = level.items[level.index];
  17796. currentLevel--;
  17797. if (currentLevel < 0) {
  17798. this.value = value;
  17799. return false;
  17800. }
  17801. this.currentLevel = currentLevel;
  17802. level = this.levels[currentLevel];
  17803. level.items[level.index] = value;
  17804. return true;
  17805. }
  17806. }
  17807. class InclusionTree {
  17808. constructor(width, height, defaultValue) {
  17809. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  17810. this.levels = [];
  17811. for (let i = 0; i < levelsLength; i++) {
  17812. const items = new Uint8Array(width * height);
  17813. for (let j = 0, jj = items.length; j < jj; j++) {
  17814. items[j] = defaultValue;
  17815. }
  17816. const level = {
  17817. width,
  17818. height,
  17819. items
  17820. };
  17821. this.levels.push(level);
  17822. width = Math.ceil(width / 2);
  17823. height = Math.ceil(height / 2);
  17824. }
  17825. }
  17826. reset(i, j, stopValue) {
  17827. let currentLevel = 0;
  17828. while (currentLevel < this.levels.length) {
  17829. const level = this.levels[currentLevel];
  17830. const index = i + j * level.width;
  17831. level.index = index;
  17832. const value = level.items[index];
  17833. if (value === 0xff) {
  17834. break;
  17835. }
  17836. if (value > stopValue) {
  17837. this.currentLevel = currentLevel;
  17838. this.propagateValues();
  17839. return false;
  17840. }
  17841. i >>= 1;
  17842. j >>= 1;
  17843. currentLevel++;
  17844. }
  17845. this.currentLevel = currentLevel - 1;
  17846. return true;
  17847. }
  17848. incrementValue(stopValue) {
  17849. const level = this.levels[this.currentLevel];
  17850. level.items[level.index] = stopValue + 1;
  17851. this.propagateValues();
  17852. }
  17853. propagateValues() {
  17854. let levelIndex = this.currentLevel;
  17855. let level = this.levels[levelIndex];
  17856. const currentValue = level.items[level.index];
  17857. while (--levelIndex >= 0) {
  17858. level = this.levels[levelIndex];
  17859. level.items[level.index] = currentValue;
  17860. }
  17861. }
  17862. nextLevel() {
  17863. let currentLevel = this.currentLevel;
  17864. let level = this.levels[currentLevel];
  17865. const value = level.items[level.index];
  17866. level.items[level.index] = 0xff;
  17867. currentLevel--;
  17868. if (currentLevel < 0) {
  17869. return false;
  17870. }
  17871. this.currentLevel = currentLevel;
  17872. level = this.levels[currentLevel];
  17873. level.items[level.index] = value;
  17874. return true;
  17875. }
  17876. }
  17877. const BitModel = function BitModelClosure() {
  17878. const UNIFORM_CONTEXT = 17;
  17879. const RUNLENGTH_CONTEXT = 18;
  17880. 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]);
  17881. 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]);
  17882. 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]);
  17883. class BitModel {
  17884. constructor(width, height, subband, zeroBitPlanes, mb) {
  17885. this.width = width;
  17886. this.height = height;
  17887. let contextLabelTable;
  17888. if (subband === "HH") {
  17889. contextLabelTable = HHContextLabel;
  17890. } else if (subband === "HL") {
  17891. contextLabelTable = HLContextLabel;
  17892. } else {
  17893. contextLabelTable = LLAndLHContextsLabel;
  17894. }
  17895. this.contextLabelTable = contextLabelTable;
  17896. const coefficientCount = width * height;
  17897. this.neighborsSignificance = new Uint8Array(coefficientCount);
  17898. this.coefficentsSign = new Uint8Array(coefficientCount);
  17899. let coefficentsMagnitude;
  17900. if (mb > 14) {
  17901. coefficentsMagnitude = new Uint32Array(coefficientCount);
  17902. } else if (mb > 6) {
  17903. coefficentsMagnitude = new Uint16Array(coefficientCount);
  17904. } else {
  17905. coefficentsMagnitude = new Uint8Array(coefficientCount);
  17906. }
  17907. this.coefficentsMagnitude = coefficentsMagnitude;
  17908. this.processingFlags = new Uint8Array(coefficientCount);
  17909. const bitsDecoded = new Uint8Array(coefficientCount);
  17910. if (zeroBitPlanes !== 0) {
  17911. for (let i = 0; i < coefficientCount; i++) {
  17912. bitsDecoded[i] = zeroBitPlanes;
  17913. }
  17914. }
  17915. this.bitsDecoded = bitsDecoded;
  17916. this.reset();
  17917. }
  17918. setDecoder(decoder) {
  17919. this.decoder = decoder;
  17920. }
  17921. reset() {
  17922. this.contexts = new Int8Array(19);
  17923. this.contexts[0] = 4 << 1 | 0;
  17924. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  17925. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  17926. }
  17927. setNeighborsSignificance(row, column, index) {
  17928. const neighborsSignificance = this.neighborsSignificance;
  17929. const width = this.width,
  17930. height = this.height;
  17931. const left = column > 0;
  17932. const right = column + 1 < width;
  17933. let i;
  17934. if (row > 0) {
  17935. i = index - width;
  17936. if (left) {
  17937. neighborsSignificance[i - 1] += 0x10;
  17938. }
  17939. if (right) {
  17940. neighborsSignificance[i + 1] += 0x10;
  17941. }
  17942. neighborsSignificance[i] += 0x04;
  17943. }
  17944. if (row + 1 < height) {
  17945. i = index + width;
  17946. if (left) {
  17947. neighborsSignificance[i - 1] += 0x10;
  17948. }
  17949. if (right) {
  17950. neighborsSignificance[i + 1] += 0x10;
  17951. }
  17952. neighborsSignificance[i] += 0x04;
  17953. }
  17954. if (left) {
  17955. neighborsSignificance[index - 1] += 0x01;
  17956. }
  17957. if (right) {
  17958. neighborsSignificance[index + 1] += 0x01;
  17959. }
  17960. neighborsSignificance[index] |= 0x80;
  17961. }
  17962. runSignificancePropagationPass() {
  17963. const decoder = this.decoder;
  17964. const width = this.width,
  17965. height = this.height;
  17966. const coefficentsMagnitude = this.coefficentsMagnitude;
  17967. const coefficentsSign = this.coefficentsSign;
  17968. const neighborsSignificance = this.neighborsSignificance;
  17969. const processingFlags = this.processingFlags;
  17970. const contexts = this.contexts;
  17971. const labels = this.contextLabelTable;
  17972. const bitsDecoded = this.bitsDecoded;
  17973. const processedInverseMask = ~1;
  17974. const processedMask = 1;
  17975. const firstMagnitudeBitMask = 2;
  17976. for (let i0 = 0; i0 < height; i0 += 4) {
  17977. for (let j = 0; j < width; j++) {
  17978. let index = i0 * width + j;
  17979. for (let i1 = 0; i1 < 4; i1++, index += width) {
  17980. const i = i0 + i1;
  17981. if (i >= height) {
  17982. break;
  17983. }
  17984. processingFlags[index] &= processedInverseMask;
  17985. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  17986. continue;
  17987. }
  17988. const contextLabel = labels[neighborsSignificance[index]];
  17989. const decision = decoder.readBit(contexts, contextLabel);
  17990. if (decision) {
  17991. const sign = this.decodeSignBit(i, j, index);
  17992. coefficentsSign[index] = sign;
  17993. coefficentsMagnitude[index] = 1;
  17994. this.setNeighborsSignificance(i, j, index);
  17995. processingFlags[index] |= firstMagnitudeBitMask;
  17996. }
  17997. bitsDecoded[index]++;
  17998. processingFlags[index] |= processedMask;
  17999. }
  18000. }
  18001. }
  18002. }
  18003. decodeSignBit(row, column, index) {
  18004. const width = this.width,
  18005. height = this.height;
  18006. const coefficentsMagnitude = this.coefficentsMagnitude;
  18007. const coefficentsSign = this.coefficentsSign;
  18008. let contribution, sign0, sign1, significance1;
  18009. let contextLabel, decoded;
  18010. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  18011. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  18012. sign1 = coefficentsSign[index + 1];
  18013. if (significance1) {
  18014. sign0 = coefficentsSign[index - 1];
  18015. contribution = 1 - sign1 - sign0;
  18016. } else {
  18017. contribution = 1 - sign1 - sign1;
  18018. }
  18019. } else if (significance1) {
  18020. sign0 = coefficentsSign[index - 1];
  18021. contribution = 1 - sign0 - sign0;
  18022. } else {
  18023. contribution = 0;
  18024. }
  18025. const horizontalContribution = 3 * contribution;
  18026. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  18027. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  18028. sign1 = coefficentsSign[index + width];
  18029. if (significance1) {
  18030. sign0 = coefficentsSign[index - width];
  18031. contribution = 1 - sign1 - sign0 + horizontalContribution;
  18032. } else {
  18033. contribution = 1 - sign1 - sign1 + horizontalContribution;
  18034. }
  18035. } else if (significance1) {
  18036. sign0 = coefficentsSign[index - width];
  18037. contribution = 1 - sign0 - sign0 + horizontalContribution;
  18038. } else {
  18039. contribution = horizontalContribution;
  18040. }
  18041. if (contribution >= 0) {
  18042. contextLabel = 9 + contribution;
  18043. decoded = this.decoder.readBit(this.contexts, contextLabel);
  18044. } else {
  18045. contextLabel = 9 - contribution;
  18046. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  18047. }
  18048. return decoded;
  18049. }
  18050. runMagnitudeRefinementPass() {
  18051. const decoder = this.decoder;
  18052. const width = this.width,
  18053. height = this.height;
  18054. const coefficentsMagnitude = this.coefficentsMagnitude;
  18055. const neighborsSignificance = this.neighborsSignificance;
  18056. const contexts = this.contexts;
  18057. const bitsDecoded = this.bitsDecoded;
  18058. const processingFlags = this.processingFlags;
  18059. const processedMask = 1;
  18060. const firstMagnitudeBitMask = 2;
  18061. const length = width * height;
  18062. const width4 = width * 4;
  18063. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  18064. indexNext = Math.min(length, index0 + width4);
  18065. for (let j = 0; j < width; j++) {
  18066. for (let index = index0 + j; index < indexNext; index += width) {
  18067. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  18068. continue;
  18069. }
  18070. let contextLabel = 16;
  18071. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  18072. processingFlags[index] ^= firstMagnitudeBitMask;
  18073. const significance = neighborsSignificance[index] & 127;
  18074. contextLabel = significance === 0 ? 15 : 14;
  18075. }
  18076. const bit = decoder.readBit(contexts, contextLabel);
  18077. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  18078. bitsDecoded[index]++;
  18079. processingFlags[index] |= processedMask;
  18080. }
  18081. }
  18082. }
  18083. }
  18084. runCleanupPass() {
  18085. const decoder = this.decoder;
  18086. const width = this.width,
  18087. height = this.height;
  18088. const neighborsSignificance = this.neighborsSignificance;
  18089. const coefficentsMagnitude = this.coefficentsMagnitude;
  18090. const coefficentsSign = this.coefficentsSign;
  18091. const contexts = this.contexts;
  18092. const labels = this.contextLabelTable;
  18093. const bitsDecoded = this.bitsDecoded;
  18094. const processingFlags = this.processingFlags;
  18095. const processedMask = 1;
  18096. const firstMagnitudeBitMask = 2;
  18097. const oneRowDown = width;
  18098. const twoRowsDown = width * 2;
  18099. const threeRowsDown = width * 3;
  18100. let iNext;
  18101. for (let i0 = 0; i0 < height; i0 = iNext) {
  18102. iNext = Math.min(i0 + 4, height);
  18103. const indexBase = i0 * width;
  18104. const checkAllEmpty = i0 + 3 < height;
  18105. for (let j = 0; j < width; j++) {
  18106. const index0 = indexBase + j;
  18107. 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;
  18108. let i1 = 0,
  18109. index = index0;
  18110. let i = i0,
  18111. sign;
  18112. if (allEmpty) {
  18113. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  18114. if (!hasSignificantCoefficent) {
  18115. bitsDecoded[index0]++;
  18116. bitsDecoded[index0 + oneRowDown]++;
  18117. bitsDecoded[index0 + twoRowsDown]++;
  18118. bitsDecoded[index0 + threeRowsDown]++;
  18119. continue;
  18120. }
  18121. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  18122. if (i1 !== 0) {
  18123. i = i0 + i1;
  18124. index += i1 * width;
  18125. }
  18126. sign = this.decodeSignBit(i, j, index);
  18127. coefficentsSign[index] = sign;
  18128. coefficentsMagnitude[index] = 1;
  18129. this.setNeighborsSignificance(i, j, index);
  18130. processingFlags[index] |= firstMagnitudeBitMask;
  18131. index = index0;
  18132. for (let i2 = i0; i2 <= i; i2++, index += width) {
  18133. bitsDecoded[index]++;
  18134. }
  18135. i1++;
  18136. }
  18137. for (i = i0 + i1; i < iNext; i++, index += width) {
  18138. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  18139. continue;
  18140. }
  18141. const contextLabel = labels[neighborsSignificance[index]];
  18142. const decision = decoder.readBit(contexts, contextLabel);
  18143. if (decision === 1) {
  18144. sign = this.decodeSignBit(i, j, index);
  18145. coefficentsSign[index] = sign;
  18146. coefficentsMagnitude[index] = 1;
  18147. this.setNeighborsSignificance(i, j, index);
  18148. processingFlags[index] |= firstMagnitudeBitMask;
  18149. }
  18150. bitsDecoded[index]++;
  18151. }
  18152. }
  18153. }
  18154. }
  18155. checkSegmentationSymbol() {
  18156. const decoder = this.decoder;
  18157. const contexts = this.contexts;
  18158. 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);
  18159. if (symbol !== 0xa) {
  18160. throw new JpxError("Invalid segmentation symbol");
  18161. }
  18162. }
  18163. }
  18164. return BitModel;
  18165. }();
  18166. class Transform {
  18167. constructor() {
  18168. if (this.constructor === Transform) {
  18169. (0, _util.unreachable)("Cannot initialize Transform.");
  18170. }
  18171. }
  18172. calculate(subbands, u0, v0) {
  18173. let ll = subbands[0];
  18174. for (let i = 1, ii = subbands.length; i < ii; i++) {
  18175. ll = this.iterate(ll, subbands[i], u0, v0);
  18176. }
  18177. return ll;
  18178. }
  18179. extend(buffer, offset, size) {
  18180. let i1 = offset - 1,
  18181. j1 = offset + 1;
  18182. let i2 = offset + size - 2,
  18183. j2 = offset + size;
  18184. buffer[i1--] = buffer[j1++];
  18185. buffer[j2++] = buffer[i2--];
  18186. buffer[i1--] = buffer[j1++];
  18187. buffer[j2++] = buffer[i2--];
  18188. buffer[i1--] = buffer[j1++];
  18189. buffer[j2++] = buffer[i2--];
  18190. buffer[i1] = buffer[j1];
  18191. buffer[j2] = buffer[i2];
  18192. }
  18193. filter(x, offset, length) {
  18194. (0, _util.unreachable)("Abstract method `filter` called");
  18195. }
  18196. iterate(ll, hl_lh_hh, u0, v0) {
  18197. const llWidth = ll.width,
  18198. llHeight = ll.height;
  18199. let llItems = ll.items;
  18200. const width = hl_lh_hh.width;
  18201. const height = hl_lh_hh.height;
  18202. const items = hl_lh_hh.items;
  18203. let i, j, k, l, u, v;
  18204. for (k = 0, i = 0; i < llHeight; i++) {
  18205. l = i * 2 * width;
  18206. for (j = 0; j < llWidth; j++, k++, l += 2) {
  18207. items[l] = llItems[k];
  18208. }
  18209. }
  18210. llItems = ll.items = null;
  18211. const bufferPadding = 4;
  18212. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  18213. if (width === 1) {
  18214. if ((u0 & 1) !== 0) {
  18215. for (v = 0, k = 0; v < height; v++, k += width) {
  18216. items[k] *= 0.5;
  18217. }
  18218. }
  18219. } else {
  18220. for (v = 0, k = 0; v < height; v++, k += width) {
  18221. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  18222. this.extend(rowBuffer, bufferPadding, width);
  18223. this.filter(rowBuffer, bufferPadding, width);
  18224. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  18225. }
  18226. }
  18227. let numBuffers = 16;
  18228. const colBuffers = [];
  18229. for (i = 0; i < numBuffers; i++) {
  18230. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  18231. }
  18232. let b,
  18233. currentBuffer = 0;
  18234. ll = bufferPadding + height;
  18235. if (height === 1) {
  18236. if ((v0 & 1) !== 0) {
  18237. for (u = 0; u < width; u++) {
  18238. items[u] *= 0.5;
  18239. }
  18240. }
  18241. } else {
  18242. for (u = 0; u < width; u++) {
  18243. if (currentBuffer === 0) {
  18244. numBuffers = Math.min(width - u, numBuffers);
  18245. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  18246. for (b = 0; b < numBuffers; b++) {
  18247. colBuffers[b][l] = items[k + b];
  18248. }
  18249. }
  18250. currentBuffer = numBuffers;
  18251. }
  18252. currentBuffer--;
  18253. const buffer = colBuffers[currentBuffer];
  18254. this.extend(buffer, bufferPadding, height);
  18255. this.filter(buffer, bufferPadding, height);
  18256. if (currentBuffer === 0) {
  18257. k = u - numBuffers + 1;
  18258. for (l = bufferPadding; l < ll; k += width, l++) {
  18259. for (b = 0; b < numBuffers; b++) {
  18260. items[k + b] = colBuffers[b][l];
  18261. }
  18262. }
  18263. }
  18264. }
  18265. }
  18266. return {
  18267. width,
  18268. height,
  18269. items
  18270. };
  18271. }
  18272. }
  18273. class IrreversibleTransform extends Transform {
  18274. filter(x, offset, length) {
  18275. const len = length >> 1;
  18276. offset |= 0;
  18277. let j, n, current, next;
  18278. const alpha = -1.586134342059924;
  18279. const beta = -0.052980118572961;
  18280. const gamma = 0.882911075530934;
  18281. const delta = 0.443506852043971;
  18282. const K = 1.230174104914001;
  18283. const K_ = 1 / K;
  18284. j = offset - 3;
  18285. for (n = len + 4; n--; j += 2) {
  18286. x[j] *= K_;
  18287. }
  18288. j = offset - 2;
  18289. current = delta * x[j - 1];
  18290. for (n = len + 3; n--; j += 2) {
  18291. next = delta * x[j + 1];
  18292. x[j] = K * x[j] - current - next;
  18293. if (n--) {
  18294. j += 2;
  18295. current = delta * x[j + 1];
  18296. x[j] = K * x[j] - current - next;
  18297. } else {
  18298. break;
  18299. }
  18300. }
  18301. j = offset - 1;
  18302. current = gamma * x[j - 1];
  18303. for (n = len + 2; n--; j += 2) {
  18304. next = gamma * x[j + 1];
  18305. x[j] -= current + next;
  18306. if (n--) {
  18307. j += 2;
  18308. current = gamma * x[j + 1];
  18309. x[j] -= current + next;
  18310. } else {
  18311. break;
  18312. }
  18313. }
  18314. j = offset;
  18315. current = beta * x[j - 1];
  18316. for (n = len + 1; n--; j += 2) {
  18317. next = beta * x[j + 1];
  18318. x[j] -= current + next;
  18319. if (n--) {
  18320. j += 2;
  18321. current = beta * x[j + 1];
  18322. x[j] -= current + next;
  18323. } else {
  18324. break;
  18325. }
  18326. }
  18327. if (len !== 0) {
  18328. j = offset + 1;
  18329. current = alpha * x[j - 1];
  18330. for (n = len; n--; j += 2) {
  18331. next = alpha * x[j + 1];
  18332. x[j] -= current + next;
  18333. if (n--) {
  18334. j += 2;
  18335. current = alpha * x[j + 1];
  18336. x[j] -= current + next;
  18337. } else {
  18338. break;
  18339. }
  18340. }
  18341. }
  18342. }
  18343. }
  18344. class ReversibleTransform extends Transform {
  18345. filter(x, offset, length) {
  18346. const len = length >> 1;
  18347. offset |= 0;
  18348. let j, n;
  18349. for (j = offset, n = len + 1; n--; j += 2) {
  18350. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  18351. }
  18352. for (j = offset + 1, n = len; n--; j += 2) {
  18353. x[j] += x[j - 1] + x[j + 1] >> 1;
  18354. }
  18355. }
  18356. }
  18357. /***/ }),
  18358. /* 31 */
  18359. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18360. Object.defineProperty(exports, "__esModule", ({
  18361. value: true
  18362. }));
  18363. exports.LZWStream = void 0;
  18364. var _decode_stream = __w_pdfjs_require__(19);
  18365. class LZWStream extends _decode_stream.DecodeStream {
  18366. constructor(str, maybeLength, earlyChange) {
  18367. super(maybeLength);
  18368. this.str = str;
  18369. this.dict = str.dict;
  18370. this.cachedData = 0;
  18371. this.bitsCached = 0;
  18372. const maxLzwDictionarySize = 4096;
  18373. const lzwState = {
  18374. earlyChange,
  18375. codeLength: 9,
  18376. nextCode: 258,
  18377. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  18378. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  18379. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  18380. currentSequence: new Uint8Array(maxLzwDictionarySize),
  18381. currentSequenceLength: 0
  18382. };
  18383. for (let i = 0; i < 256; ++i) {
  18384. lzwState.dictionaryValues[i] = i;
  18385. lzwState.dictionaryLengths[i] = 1;
  18386. }
  18387. this.lzwState = lzwState;
  18388. }
  18389. readBits(n) {
  18390. let bitsCached = this.bitsCached;
  18391. let cachedData = this.cachedData;
  18392. while (bitsCached < n) {
  18393. const c = this.str.getByte();
  18394. if (c === -1) {
  18395. this.eof = true;
  18396. return null;
  18397. }
  18398. cachedData = cachedData << 8 | c;
  18399. bitsCached += 8;
  18400. }
  18401. this.bitsCached = bitsCached -= n;
  18402. this.cachedData = cachedData;
  18403. this.lastCode = null;
  18404. return cachedData >>> bitsCached & (1 << n) - 1;
  18405. }
  18406. readBlock() {
  18407. const blockSize = 512,
  18408. decodedSizeDelta = blockSize;
  18409. let estimatedDecodedSize = blockSize * 2;
  18410. let i, j, q;
  18411. const lzwState = this.lzwState;
  18412. if (!lzwState) {
  18413. return;
  18414. }
  18415. const earlyChange = lzwState.earlyChange;
  18416. let nextCode = lzwState.nextCode;
  18417. const dictionaryValues = lzwState.dictionaryValues;
  18418. const dictionaryLengths = lzwState.dictionaryLengths;
  18419. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  18420. let codeLength = lzwState.codeLength;
  18421. let prevCode = lzwState.prevCode;
  18422. const currentSequence = lzwState.currentSequence;
  18423. let currentSequenceLength = lzwState.currentSequenceLength;
  18424. let decodedLength = 0;
  18425. let currentBufferLength = this.bufferLength;
  18426. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  18427. for (i = 0; i < blockSize; i++) {
  18428. const code = this.readBits(codeLength);
  18429. const hasPrev = currentSequenceLength > 0;
  18430. if (code < 256) {
  18431. currentSequence[0] = code;
  18432. currentSequenceLength = 1;
  18433. } else if (code >= 258) {
  18434. if (code < nextCode) {
  18435. currentSequenceLength = dictionaryLengths[code];
  18436. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  18437. currentSequence[j] = dictionaryValues[q];
  18438. q = dictionaryPrevCodes[q];
  18439. }
  18440. } else {
  18441. currentSequence[currentSequenceLength++] = currentSequence[0];
  18442. }
  18443. } else if (code === 256) {
  18444. codeLength = 9;
  18445. nextCode = 258;
  18446. currentSequenceLength = 0;
  18447. continue;
  18448. } else {
  18449. this.eof = true;
  18450. delete this.lzwState;
  18451. break;
  18452. }
  18453. if (hasPrev) {
  18454. dictionaryPrevCodes[nextCode] = prevCode;
  18455. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  18456. dictionaryValues[nextCode] = currentSequence[0];
  18457. nextCode++;
  18458. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  18459. }
  18460. prevCode = code;
  18461. decodedLength += currentSequenceLength;
  18462. if (estimatedDecodedSize < decodedLength) {
  18463. do {
  18464. estimatedDecodedSize += decodedSizeDelta;
  18465. } while (estimatedDecodedSize < decodedLength);
  18466. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  18467. }
  18468. for (j = 0; j < currentSequenceLength; j++) {
  18469. buffer[currentBufferLength++] = currentSequence[j];
  18470. }
  18471. }
  18472. lzwState.nextCode = nextCode;
  18473. lzwState.codeLength = codeLength;
  18474. lzwState.prevCode = prevCode;
  18475. lzwState.currentSequenceLength = currentSequenceLength;
  18476. this.bufferLength = currentBufferLength;
  18477. }
  18478. }
  18479. exports.LZWStream = LZWStream;
  18480. /***/ }),
  18481. /* 32 */
  18482. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18483. Object.defineProperty(exports, "__esModule", ({
  18484. value: true
  18485. }));
  18486. exports.PredictorStream = void 0;
  18487. var _decode_stream = __w_pdfjs_require__(19);
  18488. var _util = __w_pdfjs_require__(2);
  18489. var _primitives = __w_pdfjs_require__(5);
  18490. class PredictorStream extends _decode_stream.DecodeStream {
  18491. constructor(str, maybeLength, params) {
  18492. super(maybeLength);
  18493. if (!(0, _primitives.isDict)(params)) {
  18494. return str;
  18495. }
  18496. const predictor = this.predictor = params.get("Predictor") || 1;
  18497. if (predictor <= 1) {
  18498. return str;
  18499. }
  18500. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  18501. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  18502. }
  18503. if (predictor === 2) {
  18504. this.readBlock = this.readBlockTiff;
  18505. } else {
  18506. this.readBlock = this.readBlockPng;
  18507. }
  18508. this.str = str;
  18509. this.dict = str.dict;
  18510. const colors = this.colors = params.get("Colors") || 1;
  18511. const bits = this.bits = params.get("BitsPerComponent") || 8;
  18512. const columns = this.columns = params.get("Columns") || 1;
  18513. this.pixBytes = colors * bits + 7 >> 3;
  18514. this.rowBytes = columns * colors * bits + 7 >> 3;
  18515. return this;
  18516. }
  18517. readBlockTiff() {
  18518. const rowBytes = this.rowBytes;
  18519. const bufferLength = this.bufferLength;
  18520. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  18521. const bits = this.bits;
  18522. const colors = this.colors;
  18523. const rawBytes = this.str.getBytes(rowBytes);
  18524. this.eof = !rawBytes.length;
  18525. if (this.eof) {
  18526. return;
  18527. }
  18528. let inbuf = 0,
  18529. outbuf = 0;
  18530. let inbits = 0,
  18531. outbits = 0;
  18532. let pos = bufferLength;
  18533. let i;
  18534. if (bits === 1 && colors === 1) {
  18535. for (i = 0; i < rowBytes; ++i) {
  18536. let c = rawBytes[i] ^ inbuf;
  18537. c ^= c >> 1;
  18538. c ^= c >> 2;
  18539. c ^= c >> 4;
  18540. inbuf = (c & 1) << 7;
  18541. buffer[pos++] = c;
  18542. }
  18543. } else if (bits === 8) {
  18544. for (i = 0; i < colors; ++i) {
  18545. buffer[pos++] = rawBytes[i];
  18546. }
  18547. for (; i < rowBytes; ++i) {
  18548. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  18549. pos++;
  18550. }
  18551. } else if (bits === 16) {
  18552. const bytesPerPixel = colors * 2;
  18553. for (i = 0; i < bytesPerPixel; ++i) {
  18554. buffer[pos++] = rawBytes[i];
  18555. }
  18556. for (; i < rowBytes; i += 2) {
  18557. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  18558. buffer[pos++] = sum >> 8 & 0xff;
  18559. buffer[pos++] = sum & 0xff;
  18560. }
  18561. } else {
  18562. const compArray = new Uint8Array(colors + 1);
  18563. const bitMask = (1 << bits) - 1;
  18564. let j = 0,
  18565. k = bufferLength;
  18566. const columns = this.columns;
  18567. for (i = 0; i < columns; ++i) {
  18568. for (let kk = 0; kk < colors; ++kk) {
  18569. if (inbits < bits) {
  18570. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  18571. inbits += 8;
  18572. }
  18573. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  18574. inbits -= bits;
  18575. outbuf = outbuf << bits | compArray[kk];
  18576. outbits += bits;
  18577. if (outbits >= 8) {
  18578. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  18579. outbits -= 8;
  18580. }
  18581. }
  18582. }
  18583. if (outbits > 0) {
  18584. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  18585. }
  18586. }
  18587. this.bufferLength += rowBytes;
  18588. }
  18589. readBlockPng() {
  18590. const rowBytes = this.rowBytes;
  18591. const pixBytes = this.pixBytes;
  18592. const predictor = this.str.getByte();
  18593. const rawBytes = this.str.getBytes(rowBytes);
  18594. this.eof = !rawBytes.length;
  18595. if (this.eof) {
  18596. return;
  18597. }
  18598. const bufferLength = this.bufferLength;
  18599. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  18600. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  18601. if (prevRow.length === 0) {
  18602. prevRow = new Uint8Array(rowBytes);
  18603. }
  18604. let i,
  18605. j = bufferLength,
  18606. up,
  18607. c;
  18608. switch (predictor) {
  18609. case 0:
  18610. for (i = 0; i < rowBytes; ++i) {
  18611. buffer[j++] = rawBytes[i];
  18612. }
  18613. break;
  18614. case 1:
  18615. for (i = 0; i < pixBytes; ++i) {
  18616. buffer[j++] = rawBytes[i];
  18617. }
  18618. for (; i < rowBytes; ++i) {
  18619. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  18620. j++;
  18621. }
  18622. break;
  18623. case 2:
  18624. for (i = 0; i < rowBytes; ++i) {
  18625. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  18626. }
  18627. break;
  18628. case 3:
  18629. for (i = 0; i < pixBytes; ++i) {
  18630. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  18631. }
  18632. for (; i < rowBytes; ++i) {
  18633. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  18634. j++;
  18635. }
  18636. break;
  18637. case 4:
  18638. for (i = 0; i < pixBytes; ++i) {
  18639. up = prevRow[i];
  18640. c = rawBytes[i];
  18641. buffer[j++] = up + c;
  18642. }
  18643. for (; i < rowBytes; ++i) {
  18644. up = prevRow[i];
  18645. const upLeft = prevRow[i - pixBytes];
  18646. const left = buffer[j - pixBytes];
  18647. const p = left + up - upLeft;
  18648. let pa = p - left;
  18649. if (pa < 0) {
  18650. pa = -pa;
  18651. }
  18652. let pb = p - up;
  18653. if (pb < 0) {
  18654. pb = -pb;
  18655. }
  18656. let pc = p - upLeft;
  18657. if (pc < 0) {
  18658. pc = -pc;
  18659. }
  18660. c = rawBytes[i];
  18661. if (pa <= pb && pa <= pc) {
  18662. buffer[j++] = left + c;
  18663. } else if (pb <= pc) {
  18664. buffer[j++] = up + c;
  18665. } else {
  18666. buffer[j++] = upLeft + c;
  18667. }
  18668. }
  18669. break;
  18670. default:
  18671. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  18672. }
  18673. this.bufferLength += rowBytes;
  18674. }
  18675. }
  18676. exports.PredictorStream = PredictorStream;
  18677. /***/ }),
  18678. /* 33 */
  18679. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18680. Object.defineProperty(exports, "__esModule", ({
  18681. value: true
  18682. }));
  18683. exports.RunLengthStream = void 0;
  18684. var _decode_stream = __w_pdfjs_require__(19);
  18685. class RunLengthStream extends _decode_stream.DecodeStream {
  18686. constructor(str, maybeLength) {
  18687. super(maybeLength);
  18688. this.str = str;
  18689. this.dict = str.dict;
  18690. }
  18691. readBlock() {
  18692. const repeatHeader = this.str.getBytes(2);
  18693. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  18694. this.eof = true;
  18695. return;
  18696. }
  18697. let buffer;
  18698. let bufferLength = this.bufferLength;
  18699. let n = repeatHeader[0];
  18700. if (n < 128) {
  18701. buffer = this.ensureBuffer(bufferLength + n + 1);
  18702. buffer[bufferLength++] = repeatHeader[1];
  18703. if (n > 0) {
  18704. const source = this.str.getBytes(n);
  18705. buffer.set(source, bufferLength);
  18706. bufferLength += n;
  18707. }
  18708. } else {
  18709. n = 257 - n;
  18710. const b = repeatHeader[1];
  18711. buffer = this.ensureBuffer(bufferLength + n + 1);
  18712. for (let i = 0; i < n; i++) {
  18713. buffer[bufferLength++] = b;
  18714. }
  18715. }
  18716. this.bufferLength = bufferLength;
  18717. }
  18718. }
  18719. exports.RunLengthStream = RunLengthStream;
  18720. /***/ }),
  18721. /* 34 */
  18722. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18723. Object.defineProperty(exports, "__esModule", ({
  18724. value: true
  18725. }));
  18726. exports.Font = exports.ErrorFont = void 0;
  18727. var _util = __w_pdfjs_require__(2);
  18728. var _cff_parser = __w_pdfjs_require__(35);
  18729. var _fonts_utils = __w_pdfjs_require__(38);
  18730. var _glyphlist = __w_pdfjs_require__(39);
  18731. var _encodings = __w_pdfjs_require__(37);
  18732. var _standard_fonts = __w_pdfjs_require__(41);
  18733. var _unicode = __w_pdfjs_require__(40);
  18734. var _to_unicode_map = __w_pdfjs_require__(42);
  18735. var _cff_font = __w_pdfjs_require__(43);
  18736. var _font_renderer = __w_pdfjs_require__(44);
  18737. var _glyf = __w_pdfjs_require__(45);
  18738. var _cmap = __w_pdfjs_require__(16);
  18739. var _opentype_file_builder = __w_pdfjs_require__(46);
  18740. var _core_utils = __w_pdfjs_require__(9);
  18741. var _stream = __w_pdfjs_require__(10);
  18742. var _type1_font = __w_pdfjs_require__(47);
  18743. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  18744. const PDF_GLYPH_SPACE_UNITS = 1000;
  18745. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isMonospace", "isSerifFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  18746. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  18747. function adjustWidths(properties) {
  18748. if (!properties.fontMatrix) {
  18749. return;
  18750. }
  18751. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  18752. return;
  18753. }
  18754. const scale = 0.001 / properties.fontMatrix[0];
  18755. const glyphsWidths = properties.widths;
  18756. for (const glyph in glyphsWidths) {
  18757. glyphsWidths[glyph] *= scale;
  18758. }
  18759. properties.defaultWidth *= scale;
  18760. }
  18761. function adjustToUnicode(properties, builtInEncoding) {
  18762. if (properties.isInternalFont) {
  18763. return;
  18764. }
  18765. if (builtInEncoding === properties.defaultEncoding) {
  18766. return;
  18767. }
  18768. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  18769. return;
  18770. }
  18771. const toUnicode = [],
  18772. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  18773. for (const charCode in builtInEncoding) {
  18774. if (properties.hasIncludedToUnicodeMap) {
  18775. if (properties.toUnicode.has(charCode)) {
  18776. continue;
  18777. }
  18778. } else {
  18779. if (properties.hasEncoding && properties.differences[charCode] !== undefined) {
  18780. continue;
  18781. }
  18782. }
  18783. const glyphName = builtInEncoding[charCode];
  18784. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  18785. if (unicode !== -1) {
  18786. toUnicode[charCode] = String.fromCharCode(unicode);
  18787. }
  18788. }
  18789. if (toUnicode.length > 0) {
  18790. properties.toUnicode.amend(toUnicode);
  18791. }
  18792. }
  18793. function amendFallbackToUnicode(properties) {
  18794. if (!properties.fallbackToUnicode) {
  18795. return;
  18796. }
  18797. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  18798. return;
  18799. }
  18800. const toUnicode = [];
  18801. for (const charCode in properties.fallbackToUnicode) {
  18802. if (properties.toUnicode.has(charCode)) {
  18803. continue;
  18804. }
  18805. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  18806. }
  18807. if (toUnicode.length > 0) {
  18808. properties.toUnicode.amend(toUnicode);
  18809. }
  18810. }
  18811. class Glyph {
  18812. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  18813. this.originalCharCode = originalCharCode;
  18814. this.fontChar = fontChar;
  18815. this.unicode = unicode;
  18816. this.accent = accent;
  18817. this.width = width;
  18818. this.vmetric = vmetric;
  18819. this.operatorListId = operatorListId;
  18820. this.isSpace = isSpace;
  18821. this.isInFont = isInFont;
  18822. }
  18823. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  18824. 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;
  18825. }
  18826. }
  18827. function int16(b0, b1) {
  18828. return (b0 << 8) + b1;
  18829. }
  18830. function writeSignedInt16(bytes, index, value) {
  18831. bytes[index + 1] = value;
  18832. bytes[index] = value >>> 8;
  18833. }
  18834. function signedInt16(b0, b1) {
  18835. const value = (b0 << 8) + b1;
  18836. return value & 1 << 15 ? value - 0x10000 : value;
  18837. }
  18838. function int32(b0, b1, b2, b3) {
  18839. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  18840. }
  18841. function string16(value) {
  18842. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  18843. }
  18844. function safeString16(value) {
  18845. if (value > 0x7fff) {
  18846. value = 0x7fff;
  18847. } else if (value < -0x8000) {
  18848. value = -0x8000;
  18849. }
  18850. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  18851. }
  18852. function isTrueTypeFile(file) {
  18853. const header = file.peekBytes(4);
  18854. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  18855. }
  18856. function isTrueTypeCollectionFile(file) {
  18857. const header = file.peekBytes(4);
  18858. return (0, _util.bytesToString)(header) === "ttcf";
  18859. }
  18860. function isOpenTypeFile(file) {
  18861. const header = file.peekBytes(4);
  18862. return (0, _util.bytesToString)(header) === "OTTO";
  18863. }
  18864. function isType1File(file) {
  18865. const header = file.peekBytes(2);
  18866. if (header[0] === 0x25 && header[1] === 0x21) {
  18867. return true;
  18868. }
  18869. if (header[0] === 0x80 && header[1] === 0x01) {
  18870. return true;
  18871. }
  18872. return false;
  18873. }
  18874. function isCFFFile(file) {
  18875. const header = file.peekBytes(4);
  18876. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  18877. return true;
  18878. }
  18879. return false;
  18880. }
  18881. function getFontFileType(file, {
  18882. type,
  18883. subtype,
  18884. composite
  18885. }) {
  18886. let fileType, fileSubtype;
  18887. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  18888. if (composite) {
  18889. fileType = "CIDFontType2";
  18890. } else {
  18891. fileType = "TrueType";
  18892. }
  18893. } else if (isOpenTypeFile(file)) {
  18894. if (composite) {
  18895. fileType = "CIDFontType2";
  18896. } else {
  18897. fileType = "OpenType";
  18898. }
  18899. } else if (isType1File(file)) {
  18900. if (composite) {
  18901. fileType = "CIDFontType0";
  18902. } else {
  18903. fileType = type === "MMType1" ? "MMType1" : "Type1";
  18904. }
  18905. } else if (isCFFFile(file)) {
  18906. if (composite) {
  18907. fileType = "CIDFontType0";
  18908. fileSubtype = "CIDFontType0C";
  18909. } else {
  18910. fileType = type === "MMType1" ? "MMType1" : "Type1";
  18911. fileSubtype = "Type1C";
  18912. }
  18913. } else {
  18914. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  18915. fileType = type;
  18916. fileSubtype = subtype;
  18917. }
  18918. return [fileType, fileSubtype];
  18919. }
  18920. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  18921. const toFontChar = [];
  18922. let unicode;
  18923. for (let i = 0, ii = encoding.length; i < ii; i++) {
  18924. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  18925. if (unicode !== -1) {
  18926. toFontChar[i] = unicode;
  18927. }
  18928. }
  18929. for (const charCode in differences) {
  18930. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  18931. if (unicode !== -1) {
  18932. toFontChar[+charCode] = unicode;
  18933. }
  18934. }
  18935. return toFontChar;
  18936. }
  18937. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  18938. const newMap = Object.create(null);
  18939. const toFontChar = [];
  18940. let privateUseAreaIndex = 0;
  18941. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  18942. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  18943. for (let originalCharCode in charCodeToGlyphId) {
  18944. originalCharCode |= 0;
  18945. let glyphId = charCodeToGlyphId[originalCharCode];
  18946. if (!hasGlyph(glyphId)) {
  18947. continue;
  18948. }
  18949. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  18950. privateUseAreaIndex++;
  18951. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  18952. (0, _util.warn)("Ran out of space in font private use area.");
  18953. break;
  18954. }
  18955. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  18956. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  18957. }
  18958. const fontCharCode = nextAvailableFontCharCode++;
  18959. if (glyphId === 0) {
  18960. glyphId = newGlyphZeroId;
  18961. }
  18962. newMap[fontCharCode] = glyphId;
  18963. toFontChar[originalCharCode] = fontCharCode;
  18964. }
  18965. return {
  18966. toFontChar,
  18967. charCodeToGlyphId: newMap,
  18968. nextAvailableFontCharCode
  18969. };
  18970. }
  18971. function getRanges(glyphs, numGlyphs) {
  18972. const codes = [];
  18973. for (const charCode in glyphs) {
  18974. if (glyphs[charCode] >= numGlyphs) {
  18975. continue;
  18976. }
  18977. codes.push({
  18978. fontCharCode: charCode | 0,
  18979. glyphId: glyphs[charCode]
  18980. });
  18981. }
  18982. if (codes.length === 0) {
  18983. codes.push({
  18984. fontCharCode: 0,
  18985. glyphId: 0
  18986. });
  18987. }
  18988. codes.sort(function fontGetRangesSort(a, b) {
  18989. return a.fontCharCode - b.fontCharCode;
  18990. });
  18991. const ranges = [];
  18992. const length = codes.length;
  18993. for (let n = 0; n < length;) {
  18994. const start = codes[n].fontCharCode;
  18995. const codeIndices = [codes[n].glyphId];
  18996. ++n;
  18997. let end = start;
  18998. while (n < length && end + 1 === codes[n].fontCharCode) {
  18999. codeIndices.push(codes[n].glyphId);
  19000. ++end;
  19001. ++n;
  19002. if (end === 0xffff) {
  19003. break;
  19004. }
  19005. }
  19006. ranges.push([start, end, codeIndices]);
  19007. }
  19008. return ranges;
  19009. }
  19010. function createCmapTable(glyphs, numGlyphs) {
  19011. const ranges = getRanges(glyphs, numGlyphs);
  19012. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  19013. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  19014. let i, ii, j, jj;
  19015. for (i = ranges.length - 1; i >= 0; --i) {
  19016. if (ranges[i][0] <= 0xffff) {
  19017. break;
  19018. }
  19019. }
  19020. const bmpLength = i + 1;
  19021. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  19022. ranges[i][1] = 0xfffe;
  19023. }
  19024. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  19025. const segCount = bmpLength + trailingRangesCount;
  19026. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  19027. let startCount = "";
  19028. let endCount = "";
  19029. let idDeltas = "";
  19030. let idRangeOffsets = "";
  19031. let glyphsIds = "";
  19032. let bias = 0;
  19033. let range, start, end, codes;
  19034. for (i = 0, ii = bmpLength; i < ii; i++) {
  19035. range = ranges[i];
  19036. start = range[0];
  19037. end = range[1];
  19038. startCount += string16(start);
  19039. endCount += string16(end);
  19040. codes = range[2];
  19041. let contiguous = true;
  19042. for (j = 1, jj = codes.length; j < jj; ++j) {
  19043. if (codes[j] !== codes[j - 1] + 1) {
  19044. contiguous = false;
  19045. break;
  19046. }
  19047. }
  19048. if (!contiguous) {
  19049. const offset = (segCount - i) * 2 + bias * 2;
  19050. bias += end - start + 1;
  19051. idDeltas += string16(0);
  19052. idRangeOffsets += string16(offset);
  19053. for (j = 0, jj = codes.length; j < jj; ++j) {
  19054. glyphsIds += string16(codes[j]);
  19055. }
  19056. } else {
  19057. const startCode = codes[0];
  19058. idDeltas += string16(startCode - start & 0xffff);
  19059. idRangeOffsets += string16(0);
  19060. }
  19061. }
  19062. if (trailingRangesCount > 0) {
  19063. endCount += "\xFF\xFF";
  19064. startCount += "\xFF\xFF";
  19065. idDeltas += "\x00\x01";
  19066. idRangeOffsets += "\x00\x00";
  19067. }
  19068. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  19069. let format31012 = "";
  19070. let header31012 = "";
  19071. if (numTables > 1) {
  19072. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  19073. format31012 = "";
  19074. for (i = 0, ii = ranges.length; i < ii; i++) {
  19075. range = ranges[i];
  19076. start = range[0];
  19077. codes = range[2];
  19078. let code = codes[0];
  19079. for (j = 1, jj = codes.length; j < jj; ++j) {
  19080. if (codes[j] !== codes[j - 1] + 1) {
  19081. end = range[0] + j - 1;
  19082. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  19083. start = end + 1;
  19084. code = codes[j];
  19085. }
  19086. }
  19087. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  19088. }
  19089. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  19090. }
  19091. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  19092. }
  19093. function validateOS2Table(os2, file) {
  19094. file.pos = (file.start || 0) + os2.offset;
  19095. const version = file.getUint16();
  19096. file.skip(60);
  19097. const selection = file.getUint16();
  19098. if (version < 4 && selection & 0x0300) {
  19099. return false;
  19100. }
  19101. const firstChar = file.getUint16();
  19102. const lastChar = file.getUint16();
  19103. if (firstChar > lastChar) {
  19104. return false;
  19105. }
  19106. file.skip(6);
  19107. const usWinAscent = file.getUint16();
  19108. if (usWinAscent === 0) {
  19109. return false;
  19110. }
  19111. os2.data[8] = os2.data[9] = 0;
  19112. return true;
  19113. }
  19114. function createOS2Table(properties, charstrings, override) {
  19115. override = override || {
  19116. unitsPerEm: 0,
  19117. yMax: 0,
  19118. yMin: 0,
  19119. ascent: 0,
  19120. descent: 0
  19121. };
  19122. let ulUnicodeRange1 = 0;
  19123. let ulUnicodeRange2 = 0;
  19124. let ulUnicodeRange3 = 0;
  19125. let ulUnicodeRange4 = 0;
  19126. let firstCharIndex = null;
  19127. let lastCharIndex = 0;
  19128. if (charstrings) {
  19129. for (let code in charstrings) {
  19130. code |= 0;
  19131. if (firstCharIndex > code || !firstCharIndex) {
  19132. firstCharIndex = code;
  19133. }
  19134. if (lastCharIndex < code) {
  19135. lastCharIndex = code;
  19136. }
  19137. const position = (0, _unicode.getUnicodeRangeFor)(code);
  19138. if (position < 32) {
  19139. ulUnicodeRange1 |= 1 << position;
  19140. } else if (position < 64) {
  19141. ulUnicodeRange2 |= 1 << position - 32;
  19142. } else if (position < 96) {
  19143. ulUnicodeRange3 |= 1 << position - 64;
  19144. } else if (position < 123) {
  19145. ulUnicodeRange4 |= 1 << position - 96;
  19146. } else {
  19147. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  19148. }
  19149. }
  19150. if (lastCharIndex > 0xffff) {
  19151. lastCharIndex = 0xffff;
  19152. }
  19153. } else {
  19154. firstCharIndex = 0;
  19155. lastCharIndex = 255;
  19156. }
  19157. const bbox = properties.bbox || [0, 0, 0, 0];
  19158. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  19159. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  19160. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  19161. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  19162. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  19163. typoDescent = -typoDescent;
  19164. }
  19165. const winAscent = override.yMax || typoAscent;
  19166. const winDescent = -override.yMin || -typoDescent;
  19167. 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";
  19168. }
  19169. function createPostTable(properties) {
  19170. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  19171. 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";
  19172. }
  19173. function createPostscriptName(name) {
  19174. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  19175. }
  19176. function createNameTable(name, proto) {
  19177. if (!proto) {
  19178. proto = [[], []];
  19179. }
  19180. 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"];
  19181. const stringsUnicode = [];
  19182. let i, ii, j, jj, str;
  19183. for (i = 0, ii = strings.length; i < ii; i++) {
  19184. str = proto[1][i] || strings[i];
  19185. const strBufUnicode = [];
  19186. for (j = 0, jj = str.length; j < jj; j++) {
  19187. strBufUnicode.push(string16(str.charCodeAt(j)));
  19188. }
  19189. stringsUnicode.push(strBufUnicode.join(""));
  19190. }
  19191. const names = [strings, stringsUnicode];
  19192. const platforms = ["\x00\x01", "\x00\x03"];
  19193. const encodings = ["\x00\x00", "\x00\x01"];
  19194. const languages = ["\x00\x00", "\x04\x09"];
  19195. const namesRecordCount = strings.length * platforms.length;
  19196. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  19197. let strOffset = 0;
  19198. for (i = 0, ii = platforms.length; i < ii; i++) {
  19199. const strs = names[i];
  19200. for (j = 0, jj = strs.length; j < jj; j++) {
  19201. str = strs[j];
  19202. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  19203. nameTable += nameRecord;
  19204. strOffset += str.length;
  19205. }
  19206. }
  19207. nameTable += strings.join("") + stringsUnicode.join("");
  19208. return nameTable;
  19209. }
  19210. class Font {
  19211. constructor(name, file, properties) {
  19212. this.name = name;
  19213. this.psName = null;
  19214. this.mimetype = null;
  19215. this.disableFontFace = false;
  19216. this.loadedName = properties.loadedName;
  19217. this.isType3Font = properties.isType3Font;
  19218. this.missingFile = false;
  19219. this.cssFontInfo = properties.cssFontInfo;
  19220. this._charsCache = Object.create(null);
  19221. this._glyphCache = Object.create(null);
  19222. this.isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  19223. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  19224. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  19225. let type = properties.type;
  19226. let subtype = properties.subtype;
  19227. this.type = type;
  19228. this.subtype = subtype;
  19229. let fallbackName = "sans-serif";
  19230. if (this.isMonospace) {
  19231. fallbackName = "monospace";
  19232. } else if (this.isSerifFont) {
  19233. fallbackName = "serif";
  19234. }
  19235. this.fallbackName = fallbackName;
  19236. this.differences = properties.differences;
  19237. this.widths = properties.widths;
  19238. this.defaultWidth = properties.defaultWidth;
  19239. this.composite = properties.composite;
  19240. this.cMap = properties.cMap;
  19241. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  19242. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  19243. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  19244. this.lineHeight = this.ascent - this.descent;
  19245. this.fontMatrix = properties.fontMatrix;
  19246. this.bbox = properties.bbox;
  19247. this.defaultEncoding = properties.defaultEncoding;
  19248. this.toUnicode = properties.toUnicode;
  19249. this.toFontChar = [];
  19250. if (properties.type === "Type3") {
  19251. for (let charCode = 0; charCode < 256; charCode++) {
  19252. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  19253. }
  19254. this.fontType = _util.FontType.TYPE3;
  19255. return;
  19256. }
  19257. this.cidEncoding = properties.cidEncoding;
  19258. this.vertical = !!properties.vertical;
  19259. if (this.vertical) {
  19260. this.vmetrics = properties.vmetrics;
  19261. this.defaultVMetrics = properties.defaultVMetrics;
  19262. }
  19263. if (!file || file.isEmpty) {
  19264. if (file) {
  19265. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  19266. }
  19267. this.fallbackToSystemFont(properties);
  19268. return;
  19269. }
  19270. [type, subtype] = getFontFileType(file, properties);
  19271. if (type !== this.type || subtype !== this.subtype) {
  19272. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  19273. }
  19274. let data;
  19275. try {
  19276. switch (type) {
  19277. case "MMType1":
  19278. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  19279. case "Type1":
  19280. case "CIDFontType0":
  19281. this.mimetype = "font/opentype";
  19282. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  19283. adjustWidths(properties);
  19284. data = this.convert(name, cff, properties);
  19285. break;
  19286. case "OpenType":
  19287. case "TrueType":
  19288. case "CIDFontType2":
  19289. this.mimetype = "font/opentype";
  19290. data = this.checkAndRepair(name, file, properties);
  19291. if (this.isOpenType) {
  19292. adjustWidths(properties);
  19293. type = "OpenType";
  19294. }
  19295. break;
  19296. default:
  19297. throw new _util.FormatError(`Font ${type} is not supported`);
  19298. }
  19299. } catch (e) {
  19300. (0, _util.warn)(e);
  19301. this.fallbackToSystemFont(properties);
  19302. return;
  19303. }
  19304. amendFallbackToUnicode(properties);
  19305. this.data = data;
  19306. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  19307. this.fontMatrix = properties.fontMatrix;
  19308. this.widths = properties.widths;
  19309. this.defaultWidth = properties.defaultWidth;
  19310. this.toUnicode = properties.toUnicode;
  19311. this.seacMap = properties.seacMap;
  19312. }
  19313. get renderer() {
  19314. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  19315. return (0, _util.shadow)(this, "renderer", renderer);
  19316. }
  19317. exportData(extraProperties = false) {
  19318. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  19319. const data = Object.create(null);
  19320. let property, value;
  19321. for (property of exportDataProperties) {
  19322. value = this[property];
  19323. if (value !== undefined) {
  19324. data[property] = value;
  19325. }
  19326. }
  19327. return data;
  19328. }
  19329. fallbackToSystemFont(properties) {
  19330. this.missingFile = true;
  19331. const name = this.name;
  19332. const type = this.type;
  19333. const subtype = this.subtype;
  19334. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  19335. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  19336. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  19337. const isStandardFont = !!stdFontMap[fontName];
  19338. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  19339. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  19340. this.bold = fontName.search(/bold/gi) !== -1;
  19341. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  19342. this.black = name.search(/Black/g) !== -1;
  19343. const isNarrow = name.search(/Narrow/g) !== -1;
  19344. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  19345. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  19346. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(),
  19347. cidToGidMap = properties.cidToGidMap;
  19348. const map = [];
  19349. for (const charCode in GlyphMapForStandardFonts) {
  19350. map[+charCode] = GlyphMapForStandardFonts[charCode];
  19351. }
  19352. if (/Arial-?Black/i.test(name)) {
  19353. const SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  19354. for (const charCode in SupplementalGlyphMapForArialBlack) {
  19355. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  19356. }
  19357. } else if (/Calibri/i.test(name)) {
  19358. const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
  19359. for (const charCode in SupplementalGlyphMapForCalibri) {
  19360. map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
  19361. }
  19362. }
  19363. if (cidToGidMap) {
  19364. for (const charCode in map) {
  19365. const cid = map[charCode];
  19366. if (cidToGidMap[cid] !== undefined) {
  19367. map[+charCode] = cidToGidMap[cid];
  19368. }
  19369. }
  19370. }
  19371. const isIdentityUnicode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap;
  19372. if (!isIdentityUnicode) {
  19373. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  19374. map[+charCode] = unicodeCharCode;
  19375. });
  19376. }
  19377. this.toFontChar = map;
  19378. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  19379. } else if (/Symbol/i.test(fontName)) {
  19380. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  19381. } else if (/Dingbats/i.test(fontName)) {
  19382. if (/Wingdings/i.test(name)) {
  19383. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  19384. }
  19385. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  19386. } else if (isStandardFont) {
  19387. this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  19388. } else {
  19389. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  19390. const map = [];
  19391. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  19392. if (!this.composite) {
  19393. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  19394. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  19395. if (unicode !== -1) {
  19396. unicodeCharCode = unicode;
  19397. }
  19398. }
  19399. map[+charCode] = unicodeCharCode;
  19400. });
  19401. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  19402. if (/Verdana/i.test(name)) {
  19403. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  19404. for (const charCode in GlyphMapForStandardFonts) {
  19405. map[+charCode] = GlyphMapForStandardFonts[charCode];
  19406. }
  19407. }
  19408. }
  19409. this.toFontChar = map;
  19410. }
  19411. amendFallbackToUnicode(properties);
  19412. this.loadedName = fontName.split("-")[0];
  19413. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  19414. }
  19415. checkAndRepair(name, font, properties) {
  19416. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  19417. function readTables(file, numTables) {
  19418. const tables = Object.create(null);
  19419. tables["OS/2"] = null;
  19420. tables.cmap = null;
  19421. tables.head = null;
  19422. tables.hhea = null;
  19423. tables.hmtx = null;
  19424. tables.maxp = null;
  19425. tables.name = null;
  19426. tables.post = null;
  19427. for (let i = 0; i < numTables; i++) {
  19428. const table = readTableEntry(file);
  19429. if (!VALID_TABLES.includes(table.tag)) {
  19430. continue;
  19431. }
  19432. if (table.length === 0) {
  19433. continue;
  19434. }
  19435. tables[table.tag] = table;
  19436. }
  19437. return tables;
  19438. }
  19439. function readTableEntry(file) {
  19440. const tag = file.getString(4);
  19441. const checksum = file.getInt32() >>> 0;
  19442. const offset = file.getInt32() >>> 0;
  19443. const length = file.getInt32() >>> 0;
  19444. const previousPosition = file.pos;
  19445. file.pos = file.start ? file.start : 0;
  19446. file.skip(offset);
  19447. const data = file.getBytes(length);
  19448. file.pos = previousPosition;
  19449. if (tag === "head") {
  19450. data[8] = data[9] = data[10] = data[11] = 0;
  19451. data[17] |= 0x20;
  19452. }
  19453. return {
  19454. tag,
  19455. checksum,
  19456. length,
  19457. offset,
  19458. data
  19459. };
  19460. }
  19461. function readOpenTypeHeader(ttf) {
  19462. return {
  19463. version: ttf.getString(4),
  19464. numTables: ttf.getUint16(),
  19465. searchRange: ttf.getUint16(),
  19466. entrySelector: ttf.getUint16(),
  19467. rangeShift: ttf.getUint16()
  19468. };
  19469. }
  19470. function readTrueTypeCollectionHeader(ttc) {
  19471. const ttcTag = ttc.getString(4);
  19472. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  19473. const majorVersion = ttc.getUint16();
  19474. const minorVersion = ttc.getUint16();
  19475. const numFonts = ttc.getInt32() >>> 0;
  19476. const offsetTable = [];
  19477. for (let i = 0; i < numFonts; i++) {
  19478. offsetTable.push(ttc.getInt32() >>> 0);
  19479. }
  19480. const header = {
  19481. ttcTag,
  19482. majorVersion,
  19483. minorVersion,
  19484. numFonts,
  19485. offsetTable
  19486. };
  19487. switch (majorVersion) {
  19488. case 1:
  19489. return header;
  19490. case 2:
  19491. header.dsigTag = ttc.getInt32() >>> 0;
  19492. header.dsigLength = ttc.getInt32() >>> 0;
  19493. header.dsigOffset = ttc.getInt32() >>> 0;
  19494. return header;
  19495. }
  19496. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  19497. }
  19498. function readTrueTypeCollectionData(ttc, fontName) {
  19499. const {
  19500. numFonts,
  19501. offsetTable
  19502. } = readTrueTypeCollectionHeader(ttc);
  19503. const fontNameParts = fontName.split("+");
  19504. let fallbackData;
  19505. for (let i = 0; i < numFonts; i++) {
  19506. ttc.pos = (ttc.start || 0) + offsetTable[i];
  19507. const potentialHeader = readOpenTypeHeader(ttc);
  19508. const potentialTables = readTables(ttc, potentialHeader.numTables);
  19509. if (!potentialTables.name) {
  19510. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  19511. }
  19512. const nameTable = readNameTable(potentialTables.name);
  19513. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  19514. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  19515. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  19516. if (!nameEntry) {
  19517. continue;
  19518. }
  19519. if (nameEntry === fontName) {
  19520. return {
  19521. header: potentialHeader,
  19522. tables: potentialTables
  19523. };
  19524. }
  19525. if (fontNameParts.length < 2) {
  19526. continue;
  19527. }
  19528. for (const part of fontNameParts) {
  19529. if (nameEntry === part) {
  19530. fallbackData = {
  19531. name: part,
  19532. header: potentialHeader,
  19533. tables: potentialTables
  19534. };
  19535. }
  19536. }
  19537. }
  19538. }
  19539. }
  19540. if (fallbackData) {
  19541. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  19542. return {
  19543. header: fallbackData.header,
  19544. tables: fallbackData.tables
  19545. };
  19546. }
  19547. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  19548. }
  19549. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  19550. if (!cmap) {
  19551. (0, _util.warn)("No cmap table available.");
  19552. return {
  19553. platformId: -1,
  19554. encodingId: -1,
  19555. mappings: [],
  19556. hasShortCmap: false
  19557. };
  19558. }
  19559. let segment;
  19560. let start = (file.start ? file.start : 0) + cmap.offset;
  19561. file.pos = start;
  19562. file.skip(2);
  19563. const numTables = file.getUint16();
  19564. let potentialTable;
  19565. let canBreak = false;
  19566. for (let i = 0; i < numTables; i++) {
  19567. const platformId = file.getUint16();
  19568. const encodingId = file.getUint16();
  19569. const offset = file.getInt32() >>> 0;
  19570. let useTable = false;
  19571. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  19572. continue;
  19573. }
  19574. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  19575. useTable = true;
  19576. } else if (platformId === 1 && encodingId === 0) {
  19577. useTable = true;
  19578. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  19579. useTable = true;
  19580. if (!isSymbolicFont) {
  19581. canBreak = true;
  19582. }
  19583. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  19584. useTable = true;
  19585. let correctlySorted = true;
  19586. if (i < numTables - 1) {
  19587. const nextBytes = file.peekBytes(2),
  19588. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  19589. if (nextPlatformId < platformId) {
  19590. correctlySorted = false;
  19591. }
  19592. }
  19593. if (correctlySorted) {
  19594. canBreak = true;
  19595. }
  19596. }
  19597. if (useTable) {
  19598. potentialTable = {
  19599. platformId,
  19600. encodingId,
  19601. offset
  19602. };
  19603. }
  19604. if (canBreak) {
  19605. break;
  19606. }
  19607. }
  19608. if (potentialTable) {
  19609. file.pos = start + potentialTable.offset;
  19610. }
  19611. if (!potentialTable || file.peekByte() === -1) {
  19612. (0, _util.warn)("Could not find a preferred cmap table.");
  19613. return {
  19614. platformId: -1,
  19615. encodingId: -1,
  19616. mappings: [],
  19617. hasShortCmap: false
  19618. };
  19619. }
  19620. const format = file.getUint16();
  19621. file.skip(2 + 2);
  19622. let hasShortCmap = false;
  19623. const mappings = [];
  19624. let j, glyphId;
  19625. if (format === 0) {
  19626. for (j = 0; j < 256; j++) {
  19627. const index = file.getByte();
  19628. if (!index) {
  19629. continue;
  19630. }
  19631. mappings.push({
  19632. charCode: j,
  19633. glyphId: index
  19634. });
  19635. }
  19636. hasShortCmap = true;
  19637. } else if (format === 4) {
  19638. const segCount = file.getUint16() >> 1;
  19639. file.skip(6);
  19640. const segments = [];
  19641. let segIndex;
  19642. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19643. segments.push({
  19644. end: file.getUint16()
  19645. });
  19646. }
  19647. file.skip(2);
  19648. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19649. segments[segIndex].start = file.getUint16();
  19650. }
  19651. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19652. segments[segIndex].delta = file.getUint16();
  19653. }
  19654. let offsetsCount = 0,
  19655. offsetIndex;
  19656. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19657. segment = segments[segIndex];
  19658. const rangeOffset = file.getUint16();
  19659. if (!rangeOffset) {
  19660. segment.offsetIndex = -1;
  19661. continue;
  19662. }
  19663. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  19664. segment.offsetIndex = offsetIndex;
  19665. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  19666. }
  19667. const offsets = [];
  19668. for (j = 0; j < offsetsCount; j++) {
  19669. offsets.push(file.getUint16());
  19670. }
  19671. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19672. segment = segments[segIndex];
  19673. start = segment.start;
  19674. const end = segment.end;
  19675. const delta = segment.delta;
  19676. offsetIndex = segment.offsetIndex;
  19677. for (j = start; j <= end; j++) {
  19678. if (j === 0xffff) {
  19679. continue;
  19680. }
  19681. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  19682. glyphId = glyphId + delta & 0xffff;
  19683. mappings.push({
  19684. charCode: j,
  19685. glyphId
  19686. });
  19687. }
  19688. }
  19689. } else if (format === 6) {
  19690. const firstCode = file.getUint16();
  19691. const entryCount = file.getUint16();
  19692. for (j = 0; j < entryCount; j++) {
  19693. glyphId = file.getUint16();
  19694. const charCode = firstCode + j;
  19695. mappings.push({
  19696. charCode,
  19697. glyphId
  19698. });
  19699. }
  19700. } else {
  19701. (0, _util.warn)("cmap table has unsupported format: " + format);
  19702. return {
  19703. platformId: -1,
  19704. encodingId: -1,
  19705. mappings: [],
  19706. hasShortCmap: false
  19707. };
  19708. }
  19709. mappings.sort(function (a, b) {
  19710. return a.charCode - b.charCode;
  19711. });
  19712. for (let i = 1; i < mappings.length; i++) {
  19713. if (mappings[i - 1].charCode === mappings[i].charCode) {
  19714. mappings.splice(i, 1);
  19715. i--;
  19716. }
  19717. }
  19718. return {
  19719. platformId: potentialTable.platformId,
  19720. encodingId: potentialTable.encodingId,
  19721. mappings,
  19722. hasShortCmap
  19723. };
  19724. }
  19725. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  19726. if (!header) {
  19727. if (metrics) {
  19728. metrics.data = null;
  19729. }
  19730. return;
  19731. }
  19732. file.pos = (file.start ? file.start : 0) + header.offset;
  19733. file.pos += 4;
  19734. file.pos += 2;
  19735. file.pos += 2;
  19736. file.pos += 2;
  19737. file.pos += 2;
  19738. file.pos += 2;
  19739. file.pos += 2;
  19740. file.pos += 2;
  19741. file.pos += 2;
  19742. file.pos += 2;
  19743. const caretOffset = file.getUint16();
  19744. file.pos += 8;
  19745. file.pos += 2;
  19746. let numOfMetrics = file.getUint16();
  19747. if (caretOffset !== 0) {
  19748. const macStyle = int16(headTable.data[44], headTable.data[45]);
  19749. if (!(macStyle & 2)) {
  19750. header.data[22] = 0;
  19751. header.data[23] = 0;
  19752. }
  19753. }
  19754. if (numOfMetrics > numGlyphs) {
  19755. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  19756. numOfMetrics = numGlyphs;
  19757. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  19758. header.data[35] = numOfMetrics & 0x00ff;
  19759. }
  19760. const numOfSidebearings = numGlyphs - numOfMetrics;
  19761. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  19762. if (numMissing > 0) {
  19763. const entries = new Uint8Array(metrics.length + numMissing * 2);
  19764. entries.set(metrics.data);
  19765. if (dupFirstEntry) {
  19766. entries[metrics.length] = metrics.data[2];
  19767. entries[metrics.length + 1] = metrics.data[3];
  19768. }
  19769. metrics.data = entries;
  19770. }
  19771. }
  19772. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  19773. const glyphProfile = {
  19774. length: 0,
  19775. sizeOfInstructions: 0
  19776. };
  19777. if (sourceEnd - sourceStart <= 12) {
  19778. return glyphProfile;
  19779. }
  19780. const glyf = source.subarray(sourceStart, sourceEnd);
  19781. let contoursCount = signedInt16(glyf[0], glyf[1]);
  19782. if (contoursCount < 0) {
  19783. contoursCount = -1;
  19784. writeSignedInt16(glyf, 0, contoursCount);
  19785. dest.set(glyf, destStart);
  19786. glyphProfile.length = glyf.length;
  19787. return glyphProfile;
  19788. }
  19789. let i,
  19790. j = 10,
  19791. flagsCount = 0;
  19792. for (i = 0; i < contoursCount; i++) {
  19793. const endPoint = glyf[j] << 8 | glyf[j + 1];
  19794. flagsCount = endPoint + 1;
  19795. j += 2;
  19796. }
  19797. const instructionsStart = j;
  19798. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  19799. glyphProfile.sizeOfInstructions = instructionsLength;
  19800. j += 2 + instructionsLength;
  19801. const instructionsEnd = j;
  19802. let coordinatesLength = 0;
  19803. for (i = 0; i < flagsCount; i++) {
  19804. const flag = glyf[j++];
  19805. if (flag & 0xc0) {
  19806. glyf[j - 1] = flag & 0x3f;
  19807. }
  19808. let xLength = 2;
  19809. if (flag & 2) {
  19810. xLength = 1;
  19811. } else if (flag & 16) {
  19812. xLength = 0;
  19813. }
  19814. let yLength = 2;
  19815. if (flag & 4) {
  19816. yLength = 1;
  19817. } else if (flag & 32) {
  19818. yLength = 0;
  19819. }
  19820. const xyLength = xLength + yLength;
  19821. coordinatesLength += xyLength;
  19822. if (flag & 8) {
  19823. const repeat = glyf[j++];
  19824. i += repeat;
  19825. coordinatesLength += repeat * xyLength;
  19826. }
  19827. }
  19828. if (coordinatesLength === 0) {
  19829. return glyphProfile;
  19830. }
  19831. let glyphDataLength = j + coordinatesLength;
  19832. if (glyphDataLength > glyf.length) {
  19833. return glyphProfile;
  19834. }
  19835. if (!hintsValid && instructionsLength > 0) {
  19836. dest.set(glyf.subarray(0, instructionsStart), destStart);
  19837. dest.set([0, 0], destStart + instructionsStart);
  19838. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  19839. glyphDataLength -= instructionsLength;
  19840. if (glyf.length - glyphDataLength > 3) {
  19841. glyphDataLength = glyphDataLength + 3 & ~3;
  19842. }
  19843. glyphProfile.length = glyphDataLength;
  19844. return glyphProfile;
  19845. }
  19846. if (glyf.length - glyphDataLength > 3) {
  19847. glyphDataLength = glyphDataLength + 3 & ~3;
  19848. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  19849. glyphProfile.length = glyphDataLength;
  19850. return glyphProfile;
  19851. }
  19852. dest.set(glyf, destStart);
  19853. glyphProfile.length = glyf.length;
  19854. return glyphProfile;
  19855. }
  19856. function sanitizeHead(head, numGlyphs, locaLength) {
  19857. const data = head.data;
  19858. const version = int32(data[0], data[1], data[2], data[3]);
  19859. if (version >> 16 !== 1) {
  19860. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  19861. data[0] = 0;
  19862. data[1] = 1;
  19863. data[2] = 0;
  19864. data[3] = 0;
  19865. }
  19866. const indexToLocFormat = int16(data[50], data[51]);
  19867. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  19868. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  19869. const numGlyphsPlusOne = numGlyphs + 1;
  19870. if (locaLength === numGlyphsPlusOne << 1) {
  19871. data[50] = 0;
  19872. data[51] = 0;
  19873. } else if (locaLength === numGlyphsPlusOne << 2) {
  19874. data[50] = 0;
  19875. data[51] = 1;
  19876. } else {
  19877. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  19878. }
  19879. }
  19880. }
  19881. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  19882. let itemSize, itemDecode, itemEncode;
  19883. if (isGlyphLocationsLong) {
  19884. itemSize = 4;
  19885. itemDecode = function fontItemDecodeLong(data, offset) {
  19886. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  19887. };
  19888. itemEncode = function fontItemEncodeLong(data, offset, value) {
  19889. data[offset] = value >>> 24 & 0xff;
  19890. data[offset + 1] = value >> 16 & 0xff;
  19891. data[offset + 2] = value >> 8 & 0xff;
  19892. data[offset + 3] = value & 0xff;
  19893. };
  19894. } else {
  19895. itemSize = 2;
  19896. itemDecode = function fontItemDecode(data, offset) {
  19897. return data[offset] << 9 | data[offset + 1] << 1;
  19898. };
  19899. itemEncode = function fontItemEncode(data, offset, value) {
  19900. data[offset] = value >> 9 & 0xff;
  19901. data[offset + 1] = value >> 1 & 0xff;
  19902. };
  19903. }
  19904. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  19905. const locaDataSize = itemSize * (1 + numGlyphsOut);
  19906. const locaData = new Uint8Array(locaDataSize);
  19907. locaData.set(loca.data.subarray(0, locaDataSize));
  19908. loca.data = locaData;
  19909. const oldGlyfData = glyf.data;
  19910. const oldGlyfDataLength = oldGlyfData.length;
  19911. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  19912. let i, j;
  19913. const locaEntries = [];
  19914. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  19915. let offset = itemDecode(locaData, j);
  19916. if (offset > oldGlyfDataLength) {
  19917. offset = oldGlyfDataLength;
  19918. }
  19919. locaEntries.push({
  19920. index: i,
  19921. offset,
  19922. endOffset: 0
  19923. });
  19924. }
  19925. locaEntries.sort((a, b) => {
  19926. return a.offset - b.offset;
  19927. });
  19928. for (i = 0; i < numGlyphs; i++) {
  19929. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  19930. }
  19931. locaEntries.sort((a, b) => {
  19932. return a.index - b.index;
  19933. });
  19934. const missingGlyphs = Object.create(null);
  19935. let writeOffset = 0;
  19936. itemEncode(locaData, 0, writeOffset);
  19937. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  19938. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  19939. const newLength = glyphProfile.length;
  19940. if (newLength === 0) {
  19941. missingGlyphs[i] = true;
  19942. }
  19943. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  19944. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  19945. }
  19946. writeOffset += newLength;
  19947. itemEncode(locaData, j, writeOffset);
  19948. }
  19949. if (writeOffset === 0) {
  19950. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  19951. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  19952. itemEncode(locaData, j, simpleGlyph.length);
  19953. }
  19954. glyf.data = simpleGlyph;
  19955. } else if (dupFirstEntry) {
  19956. const firstEntryLength = itemDecode(locaData, itemSize);
  19957. if (newGlyfData.length > firstEntryLength + writeOffset) {
  19958. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  19959. } else {
  19960. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  19961. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  19962. }
  19963. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  19964. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  19965. } else {
  19966. glyf.data = newGlyfData.subarray(0, writeOffset);
  19967. }
  19968. return {
  19969. missingGlyphs,
  19970. maxSizeOfInstructions
  19971. };
  19972. }
  19973. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  19974. const start = (font.start ? font.start : 0) + post.offset;
  19975. font.pos = start;
  19976. const length = post.length,
  19977. end = start + length;
  19978. const version = font.getInt32();
  19979. font.skip(28);
  19980. let glyphNames;
  19981. let valid = true;
  19982. let i;
  19983. switch (version) {
  19984. case 0x00010000:
  19985. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  19986. break;
  19987. case 0x00020000:
  19988. const numGlyphs = font.getUint16();
  19989. if (numGlyphs !== maxpNumGlyphs) {
  19990. valid = false;
  19991. break;
  19992. }
  19993. const glyphNameIndexes = [];
  19994. for (i = 0; i < numGlyphs; ++i) {
  19995. const index = font.getUint16();
  19996. if (index >= 32768) {
  19997. valid = false;
  19998. break;
  19999. }
  20000. glyphNameIndexes.push(index);
  20001. }
  20002. if (!valid) {
  20003. break;
  20004. }
  20005. const customNames = [],
  20006. strBuf = [];
  20007. while (font.pos < end) {
  20008. const stringLength = font.getByte();
  20009. strBuf.length = stringLength;
  20010. for (i = 0; i < stringLength; ++i) {
  20011. strBuf[i] = String.fromCharCode(font.getByte());
  20012. }
  20013. customNames.push(strBuf.join(""));
  20014. }
  20015. glyphNames = [];
  20016. for (i = 0; i < numGlyphs; ++i) {
  20017. const j = glyphNameIndexes[i];
  20018. if (j < 258) {
  20019. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  20020. continue;
  20021. }
  20022. glyphNames.push(customNames[j - 258]);
  20023. }
  20024. break;
  20025. case 0x00030000:
  20026. break;
  20027. default:
  20028. (0, _util.warn)("Unknown/unsupported post table version " + version);
  20029. valid = false;
  20030. if (propertiesObj.defaultEncoding) {
  20031. glyphNames = propertiesObj.defaultEncoding;
  20032. }
  20033. break;
  20034. }
  20035. propertiesObj.glyphNames = glyphNames;
  20036. return valid;
  20037. }
  20038. function readNameTable(nameTable) {
  20039. const start = (font.start ? font.start : 0) + nameTable.offset;
  20040. font.pos = start;
  20041. const names = [[], []];
  20042. const length = nameTable.length,
  20043. end = start + length;
  20044. const format = font.getUint16();
  20045. const FORMAT_0_HEADER_LENGTH = 6;
  20046. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  20047. return names;
  20048. }
  20049. const numRecords = font.getUint16();
  20050. const stringsStart = font.getUint16();
  20051. const records = [];
  20052. const NAME_RECORD_LENGTH = 12;
  20053. let i, ii;
  20054. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  20055. const r = {
  20056. platform: font.getUint16(),
  20057. encoding: font.getUint16(),
  20058. language: font.getUint16(),
  20059. name: font.getUint16(),
  20060. length: font.getUint16(),
  20061. offset: font.getUint16()
  20062. };
  20063. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  20064. records.push(r);
  20065. }
  20066. }
  20067. for (i = 0, ii = records.length; i < ii; i++) {
  20068. const record = records[i];
  20069. if (record.length <= 0) {
  20070. continue;
  20071. }
  20072. const pos = start + stringsStart + record.offset;
  20073. if (pos + record.length > end) {
  20074. continue;
  20075. }
  20076. font.pos = pos;
  20077. const nameIndex = record.name;
  20078. if (record.encoding) {
  20079. let str = "";
  20080. for (let j = 0, jj = record.length; j < jj; j += 2) {
  20081. str += String.fromCharCode(font.getUint16());
  20082. }
  20083. names[1][nameIndex] = str;
  20084. } else {
  20085. names[0][nameIndex] = font.getString(record.length);
  20086. }
  20087. }
  20088. return names;
  20089. }
  20090. 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];
  20091. function sanitizeTTProgram(table, ttContext) {
  20092. let data = table.data;
  20093. let i = 0,
  20094. j,
  20095. n,
  20096. b,
  20097. funcId,
  20098. pc,
  20099. lastEndf = 0,
  20100. lastDeff = 0;
  20101. const stack = [];
  20102. const callstack = [];
  20103. const functionsCalled = [];
  20104. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  20105. let inFDEF = false,
  20106. ifLevel = 0,
  20107. inELSE = 0;
  20108. for (let ii = data.length; i < ii;) {
  20109. const op = data[i++];
  20110. if (op === 0x40) {
  20111. n = data[i++];
  20112. if (inFDEF || inELSE) {
  20113. i += n;
  20114. } else {
  20115. for (j = 0; j < n; j++) {
  20116. stack.push(data[i++]);
  20117. }
  20118. }
  20119. } else if (op === 0x41) {
  20120. n = data[i++];
  20121. if (inFDEF || inELSE) {
  20122. i += n * 2;
  20123. } else {
  20124. for (j = 0; j < n; j++) {
  20125. b = data[i++];
  20126. stack.push(b << 8 | data[i++]);
  20127. }
  20128. }
  20129. } else if ((op & 0xf8) === 0xb0) {
  20130. n = op - 0xb0 + 1;
  20131. if (inFDEF || inELSE) {
  20132. i += n;
  20133. } else {
  20134. for (j = 0; j < n; j++) {
  20135. stack.push(data[i++]);
  20136. }
  20137. }
  20138. } else if ((op & 0xf8) === 0xb8) {
  20139. n = op - 0xb8 + 1;
  20140. if (inFDEF || inELSE) {
  20141. i += n * 2;
  20142. } else {
  20143. for (j = 0; j < n; j++) {
  20144. b = data[i++];
  20145. stack.push(b << 8 | data[i++]);
  20146. }
  20147. }
  20148. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  20149. if (!inFDEF && !inELSE) {
  20150. funcId = stack[stack.length - 1];
  20151. if (isNaN(funcId)) {
  20152. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  20153. } else {
  20154. ttContext.functionsUsed[funcId] = true;
  20155. if (funcId in ttContext.functionsStackDeltas) {
  20156. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  20157. if (newStackLength < 0) {
  20158. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  20159. ttContext.hintsValid = false;
  20160. return;
  20161. }
  20162. stack.length = newStackLength;
  20163. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  20164. callstack.push({
  20165. data,
  20166. i,
  20167. stackTop: stack.length - 1
  20168. });
  20169. functionsCalled.push(funcId);
  20170. pc = ttContext.functionsDefined[funcId];
  20171. if (!pc) {
  20172. (0, _util.warn)("TT: CALL non-existent function");
  20173. ttContext.hintsValid = false;
  20174. return;
  20175. }
  20176. data = pc.data;
  20177. i = pc.i;
  20178. }
  20179. }
  20180. }
  20181. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  20182. if (inFDEF || inELSE) {
  20183. (0, _util.warn)("TT: nested FDEFs not allowed");
  20184. tooComplexToFollowFunctions = true;
  20185. }
  20186. inFDEF = true;
  20187. lastDeff = i;
  20188. funcId = stack.pop();
  20189. ttContext.functionsDefined[funcId] = {
  20190. data,
  20191. i
  20192. };
  20193. } else if (op === 0x2d) {
  20194. if (inFDEF) {
  20195. inFDEF = false;
  20196. lastEndf = i;
  20197. } else {
  20198. pc = callstack.pop();
  20199. if (!pc) {
  20200. (0, _util.warn)("TT: ENDF bad stack");
  20201. ttContext.hintsValid = false;
  20202. return;
  20203. }
  20204. funcId = functionsCalled.pop();
  20205. data = pc.data;
  20206. i = pc.i;
  20207. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  20208. }
  20209. } else if (op === 0x89) {
  20210. if (inFDEF || inELSE) {
  20211. (0, _util.warn)("TT: nested IDEFs not allowed");
  20212. tooComplexToFollowFunctions = true;
  20213. }
  20214. inFDEF = true;
  20215. lastDeff = i;
  20216. } else if (op === 0x58) {
  20217. ++ifLevel;
  20218. } else if (op === 0x1b) {
  20219. inELSE = ifLevel;
  20220. } else if (op === 0x59) {
  20221. if (inELSE === ifLevel) {
  20222. inELSE = 0;
  20223. }
  20224. --ifLevel;
  20225. } else if (op === 0x1c) {
  20226. if (!inFDEF && !inELSE) {
  20227. const offset = stack[stack.length - 1];
  20228. if (offset > 0) {
  20229. i += offset - 1;
  20230. }
  20231. }
  20232. }
  20233. if (!inFDEF && !inELSE) {
  20234. let stackDelta = 0;
  20235. if (op <= 0x8e) {
  20236. stackDelta = TTOpsStackDeltas[op];
  20237. } else if (op >= 0xc0 && op <= 0xdf) {
  20238. stackDelta = -1;
  20239. } else if (op >= 0xe0) {
  20240. stackDelta = -2;
  20241. }
  20242. if (op >= 0x71 && op <= 0x75) {
  20243. n = stack.pop();
  20244. if (!isNaN(n)) {
  20245. stackDelta = -n * 2;
  20246. }
  20247. }
  20248. while (stackDelta < 0 && stack.length > 0) {
  20249. stack.pop();
  20250. stackDelta++;
  20251. }
  20252. while (stackDelta > 0) {
  20253. stack.push(NaN);
  20254. stackDelta--;
  20255. }
  20256. }
  20257. }
  20258. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  20259. const content = [data];
  20260. if (i > data.length) {
  20261. content.push(new Uint8Array(i - data.length));
  20262. }
  20263. if (lastDeff > lastEndf) {
  20264. (0, _util.warn)("TT: complementing a missing function tail");
  20265. content.push(new Uint8Array([0x22, 0x2d]));
  20266. }
  20267. foldTTTable(table, content);
  20268. }
  20269. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  20270. if (ttContext.tooComplexToFollowFunctions) {
  20271. return;
  20272. }
  20273. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  20274. (0, _util.warn)("TT: more functions defined than expected");
  20275. ttContext.hintsValid = false;
  20276. return;
  20277. }
  20278. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  20279. if (j > maxFunctionDefs) {
  20280. (0, _util.warn)("TT: invalid function id: " + j);
  20281. ttContext.hintsValid = false;
  20282. return;
  20283. }
  20284. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  20285. (0, _util.warn)("TT: undefined function: " + j);
  20286. ttContext.hintsValid = false;
  20287. return;
  20288. }
  20289. }
  20290. }
  20291. function foldTTTable(table, content) {
  20292. if (content.length > 1) {
  20293. let newLength = 0;
  20294. let j, jj;
  20295. for (j = 0, jj = content.length; j < jj; j++) {
  20296. newLength += content[j].length;
  20297. }
  20298. newLength = newLength + 3 & ~3;
  20299. const result = new Uint8Array(newLength);
  20300. let pos = 0;
  20301. for (j = 0, jj = content.length; j < jj; j++) {
  20302. result.set(content[j], pos);
  20303. pos += content[j].length;
  20304. }
  20305. table.data = result;
  20306. table.length = newLength;
  20307. }
  20308. }
  20309. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  20310. const ttContext = {
  20311. functionsDefined: [],
  20312. functionsUsed: [],
  20313. functionsStackDeltas: [],
  20314. tooComplexToFollowFunctions: false,
  20315. hintsValid: true
  20316. };
  20317. if (fpgm) {
  20318. sanitizeTTProgram(fpgm, ttContext);
  20319. }
  20320. if (prep) {
  20321. sanitizeTTProgram(prep, ttContext);
  20322. }
  20323. if (fpgm) {
  20324. checkInvalidFunctions(ttContext, maxFunctionDefs);
  20325. }
  20326. if (cvt && cvt.length & 1) {
  20327. const cvtData = new Uint8Array(cvt.length + 1);
  20328. cvtData.set(cvt.data);
  20329. cvt.data = cvtData;
  20330. }
  20331. return ttContext.hintsValid;
  20332. }
  20333. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  20334. let header, tables;
  20335. if (isTrueTypeCollectionFile(font)) {
  20336. const ttcData = readTrueTypeCollectionData(font, this.name);
  20337. header = ttcData.header;
  20338. tables = ttcData.tables;
  20339. } else {
  20340. header = readOpenTypeHeader(font);
  20341. tables = readTables(font, header.numTables);
  20342. }
  20343. let cff, cffFile;
  20344. const isTrueType = !tables["CFF "];
  20345. if (!isTrueType) {
  20346. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  20347. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  20348. cffFile = new _stream.Stream(tables["CFF "].data);
  20349. cff = new _cff_font.CFFFont(cffFile, properties);
  20350. adjustWidths(properties);
  20351. return this.convert(name, cff, properties);
  20352. }
  20353. delete tables.glyf;
  20354. delete tables.loca;
  20355. delete tables.fpgm;
  20356. delete tables.prep;
  20357. delete tables["cvt "];
  20358. this.isOpenType = true;
  20359. } else {
  20360. if (!tables.loca) {
  20361. throw new _util.FormatError('Required "loca" table is not found');
  20362. }
  20363. if (!tables.glyf) {
  20364. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  20365. tables.glyf = {
  20366. tag: "glyf",
  20367. data: new Uint8Array(0)
  20368. };
  20369. }
  20370. this.isOpenType = false;
  20371. }
  20372. if (!tables.maxp) {
  20373. throw new _util.FormatError('Required "maxp" table is not found');
  20374. }
  20375. font.pos = (font.start || 0) + tables.maxp.offset;
  20376. const version = font.getInt32();
  20377. const numGlyphs = font.getUint16();
  20378. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  20379. const {
  20380. scaleFactors
  20381. } = properties;
  20382. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  20383. const glyphs = new _glyf.GlyfTable({
  20384. glyfTable: tables.glyf.data,
  20385. isGlyphLocationsLong,
  20386. locaTable: tables.loca.data,
  20387. numGlyphs
  20388. });
  20389. glyphs.scale(scaleFactors);
  20390. const {
  20391. glyf,
  20392. loca,
  20393. isLocationLong
  20394. } = glyphs.write();
  20395. tables.glyf.data = glyf;
  20396. tables.loca.data = loca;
  20397. if (isLocationLong !== !!isGlyphLocationsLong) {
  20398. tables.head.data[50] = 0;
  20399. tables.head.data[51] = isLocationLong ? 1 : 0;
  20400. }
  20401. const metrics = tables.hmtx.data;
  20402. for (let i = 0; i < numGlyphs; i++) {
  20403. const j = 4 * i;
  20404. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  20405. metrics[j] = advanceWidth >> 8 & 0xff;
  20406. metrics[j + 1] = advanceWidth & 0xff;
  20407. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  20408. writeSignedInt16(metrics, j + 2, lsb);
  20409. }
  20410. }
  20411. let numGlyphsOut = numGlyphs + 1;
  20412. let dupFirstEntry = true;
  20413. if (numGlyphsOut > 0xffff) {
  20414. dupFirstEntry = false;
  20415. numGlyphsOut = numGlyphs;
  20416. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  20417. }
  20418. let maxFunctionDefs = 0;
  20419. let maxSizeOfInstructions = 0;
  20420. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  20421. font.pos += 8;
  20422. const maxZones = font.getUint16();
  20423. if (maxZones > 2) {
  20424. tables.maxp.data[14] = 0;
  20425. tables.maxp.data[15] = 2;
  20426. }
  20427. font.pos += 4;
  20428. maxFunctionDefs = font.getUint16();
  20429. font.pos += 4;
  20430. maxSizeOfInstructions = font.getUint16();
  20431. }
  20432. tables.maxp.data[4] = numGlyphsOut >> 8;
  20433. tables.maxp.data[5] = numGlyphsOut & 255;
  20434. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  20435. if (!hintsValid) {
  20436. delete tables.fpgm;
  20437. delete tables.prep;
  20438. delete tables["cvt "];
  20439. }
  20440. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  20441. if (!tables.head) {
  20442. throw new _util.FormatError('Required "head" table is not found');
  20443. }
  20444. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  20445. let missingGlyphs = Object.create(null);
  20446. if (isTrueType) {
  20447. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  20448. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  20449. missingGlyphs = glyphsInfo.missingGlyphs;
  20450. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  20451. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  20452. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  20453. }
  20454. }
  20455. if (!tables.hhea) {
  20456. throw new _util.FormatError('Required "hhea" table is not found');
  20457. }
  20458. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  20459. tables.hhea.data[10] = 0xff;
  20460. tables.hhea.data[11] = 0xff;
  20461. }
  20462. const metricsOverride = {
  20463. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  20464. yMax: int16(tables.head.data[42], tables.head.data[43]),
  20465. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  20466. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  20467. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  20468. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  20469. };
  20470. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  20471. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  20472. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  20473. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  20474. this.lineHeight = this.cssFontInfo.lineHeight;
  20475. } else {
  20476. this.lineHeight = this.ascent - this.descent + this.lineGap;
  20477. }
  20478. if (tables.post) {
  20479. readPostScriptTable(tables.post, properties, numGlyphs);
  20480. }
  20481. tables.post = {
  20482. tag: "post",
  20483. data: createPostTable(properties)
  20484. };
  20485. const charCodeToGlyphId = [];
  20486. function hasGlyph(glyphId) {
  20487. return !missingGlyphs[glyphId];
  20488. }
  20489. if (properties.composite) {
  20490. const cidToGidMap = properties.cidToGidMap || [];
  20491. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  20492. properties.cMap.forEach(function (charCode, cid) {
  20493. if (cid > 0xffff) {
  20494. throw new _util.FormatError("Max size of CID is 65,535");
  20495. }
  20496. let glyphId = -1;
  20497. if (isCidToGidMapEmpty) {
  20498. glyphId = cid;
  20499. } else if (cidToGidMap[cid] !== undefined) {
  20500. glyphId = cidToGidMap[cid];
  20501. }
  20502. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  20503. charCodeToGlyphId[charCode] = glyphId;
  20504. }
  20505. });
  20506. } else {
  20507. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  20508. const cmapPlatformId = cmapTable.platformId;
  20509. const cmapEncodingId = cmapTable.encodingId;
  20510. const cmapMappings = cmapTable.mappings;
  20511. const cmapMappingsLength = cmapMappings.length;
  20512. let baseEncoding = [];
  20513. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  20514. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  20515. }
  20516. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  20517. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20518. for (let charCode = 0; charCode < 256; charCode++) {
  20519. let glyphName;
  20520. if (this.differences[charCode] !== undefined) {
  20521. glyphName = this.differences[charCode];
  20522. } else if (baseEncoding[charCode] !== "") {
  20523. glyphName = baseEncoding[charCode];
  20524. } else {
  20525. glyphName = _encodings.StandardEncoding[charCode];
  20526. }
  20527. if (!glyphName) {
  20528. continue;
  20529. }
  20530. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  20531. let unicodeOrCharCode;
  20532. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  20533. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  20534. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  20535. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  20536. }
  20537. for (let i = 0; i < cmapMappingsLength; ++i) {
  20538. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  20539. continue;
  20540. }
  20541. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  20542. break;
  20543. }
  20544. }
  20545. } else if (cmapPlatformId === 0) {
  20546. for (let i = 0; i < cmapMappingsLength; ++i) {
  20547. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  20548. }
  20549. } else {
  20550. for (let i = 0; i < cmapMappingsLength; ++i) {
  20551. let charCode = cmapMappings[i].charCode;
  20552. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  20553. charCode &= 0xff;
  20554. }
  20555. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  20556. }
  20557. }
  20558. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  20559. for (let i = 0; i < 256; ++i) {
  20560. if (charCodeToGlyphId[i] !== undefined) {
  20561. continue;
  20562. }
  20563. const glyphName = this.differences[i] || baseEncoding[i];
  20564. if (!glyphName) {
  20565. continue;
  20566. }
  20567. const glyphId = properties.glyphNames.indexOf(glyphName);
  20568. if (glyphId > 0 && hasGlyph(glyphId)) {
  20569. charCodeToGlyphId[i] = glyphId;
  20570. }
  20571. }
  20572. }
  20573. }
  20574. if (charCodeToGlyphId.length === 0) {
  20575. charCodeToGlyphId[0] = 0;
  20576. }
  20577. let glyphZeroId = numGlyphsOut - 1;
  20578. if (!dupFirstEntry) {
  20579. glyphZeroId = 0;
  20580. }
  20581. if (!properties.cssFontInfo) {
  20582. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  20583. this.toFontChar = newMapping.toFontChar;
  20584. tables.cmap = {
  20585. tag: "cmap",
  20586. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  20587. };
  20588. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  20589. tables["OS/2"] = {
  20590. tag: "OS/2",
  20591. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  20592. };
  20593. }
  20594. }
  20595. if (!isTrueType) {
  20596. try {
  20597. cffFile = new _stream.Stream(tables["CFF "].data);
  20598. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  20599. cff = parser.parse();
  20600. cff.duplicateFirstGlyph();
  20601. const compiler = new _cff_parser.CFFCompiler(cff);
  20602. tables["CFF "].data = compiler.compile();
  20603. } catch (e) {
  20604. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  20605. }
  20606. }
  20607. if (!tables.name) {
  20608. tables.name = {
  20609. tag: "name",
  20610. data: createNameTable(this.name)
  20611. };
  20612. } else {
  20613. const namePrototype = readNameTable(tables.name);
  20614. tables.name.data = createNameTable(name, namePrototype);
  20615. this.psName = namePrototype[0][6] || null;
  20616. }
  20617. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  20618. for (const tableTag in tables) {
  20619. builder.addTable(tableTag, tables[tableTag].data);
  20620. }
  20621. return builder.toArray();
  20622. }
  20623. convert(fontName, font, properties) {
  20624. properties.fixedPitch = false;
  20625. if (properties.builtInEncoding) {
  20626. adjustToUnicode(properties, properties.builtInEncoding);
  20627. }
  20628. let glyphZeroId = 1;
  20629. if (font instanceof _cff_font.CFFFont) {
  20630. glyphZeroId = font.numGlyphs - 1;
  20631. }
  20632. const mapping = font.getGlyphMapping(properties);
  20633. let newMapping = null;
  20634. let newCharCodeToGlyphId = mapping;
  20635. if (!properties.cssFontInfo) {
  20636. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  20637. this.toFontChar = newMapping.toFontChar;
  20638. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  20639. }
  20640. const numGlyphs = font.numGlyphs;
  20641. function getCharCodes(charCodeToGlyphId, glyphId) {
  20642. let charCodes = null;
  20643. for (const charCode in charCodeToGlyphId) {
  20644. if (glyphId === charCodeToGlyphId[charCode]) {
  20645. if (!charCodes) {
  20646. charCodes = [];
  20647. }
  20648. charCodes.push(charCode | 0);
  20649. }
  20650. }
  20651. return charCodes;
  20652. }
  20653. function createCharCode(charCodeToGlyphId, glyphId) {
  20654. for (const charCode in charCodeToGlyphId) {
  20655. if (glyphId === charCodeToGlyphId[charCode]) {
  20656. return charCode | 0;
  20657. }
  20658. }
  20659. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  20660. return newMapping.nextAvailableFontCharCode++;
  20661. }
  20662. const seacs = font.seacs;
  20663. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  20664. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  20665. const charset = font.getCharset();
  20666. const seacMap = Object.create(null);
  20667. for (let glyphId in seacs) {
  20668. glyphId |= 0;
  20669. const seac = seacs[glyphId];
  20670. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  20671. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  20672. const baseGlyphId = charset.indexOf(baseGlyphName);
  20673. const accentGlyphId = charset.indexOf(accentGlyphName);
  20674. if (baseGlyphId < 0 || accentGlyphId < 0) {
  20675. continue;
  20676. }
  20677. const accentOffset = {
  20678. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  20679. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  20680. };
  20681. const charCodes = getCharCodes(mapping, glyphId);
  20682. if (!charCodes) {
  20683. continue;
  20684. }
  20685. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  20686. const charCode = charCodes[i];
  20687. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  20688. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  20689. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  20690. seacMap[charCode] = {
  20691. baseFontCharCode,
  20692. accentFontCharCode,
  20693. accentOffset
  20694. };
  20695. }
  20696. }
  20697. properties.seacMap = seacMap;
  20698. }
  20699. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  20700. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  20701. builder.addTable("CFF ", font.data);
  20702. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  20703. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  20704. 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");
  20705. 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));
  20706. builder.addTable("hmtx", function fontFieldsHmtx() {
  20707. const charstrings = font.charstrings;
  20708. const cffWidths = font.cff ? font.cff.widths : null;
  20709. let hmtx = "\x00\x00\x00\x00";
  20710. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  20711. let width = 0;
  20712. if (charstrings) {
  20713. const charstring = charstrings[i - 1];
  20714. width = "width" in charstring ? charstring.width : 0;
  20715. } else if (cffWidths) {
  20716. width = Math.ceil(cffWidths[i] || 0);
  20717. }
  20718. hmtx += string16(width) + string16(0);
  20719. }
  20720. return hmtx;
  20721. }());
  20722. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  20723. builder.addTable("name", createNameTable(fontName));
  20724. builder.addTable("post", createPostTable(properties));
  20725. return builder.toArray();
  20726. }
  20727. get spaceWidth() {
  20728. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  20729. let width;
  20730. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  20731. const glyphName = possibleSpaceReplacements[i];
  20732. if (glyphName in this.widths) {
  20733. width = this.widths[glyphName];
  20734. break;
  20735. }
  20736. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20737. const glyphUnicode = glyphsUnicodeMap[glyphName];
  20738. let charcode = 0;
  20739. if (this.composite && this.cMap.contains(glyphUnicode)) {
  20740. charcode = this.cMap.lookup(glyphUnicode);
  20741. }
  20742. if (!charcode && this.toUnicode) {
  20743. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  20744. }
  20745. if (charcode <= 0) {
  20746. charcode = glyphUnicode;
  20747. }
  20748. width = this.widths[charcode];
  20749. if (width) {
  20750. break;
  20751. }
  20752. }
  20753. width = width || this.defaultWidth;
  20754. return (0, _util.shadow)(this, "spaceWidth", width);
  20755. }
  20756. _charToGlyph(charcode, isSpace = false) {
  20757. let fontCharCode, width, operatorListId;
  20758. let widthCode = charcode;
  20759. if (this.cMap && this.cMap.contains(charcode)) {
  20760. widthCode = this.cMap.lookup(charcode);
  20761. }
  20762. width = this.widths[widthCode];
  20763. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  20764. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  20765. let unicode = this.toUnicode.get(charcode) || charcode;
  20766. if (typeof unicode === "number") {
  20767. unicode = String.fromCharCode(unicode);
  20768. }
  20769. let isInFont = this.toFontChar[charcode] !== undefined;
  20770. fontCharCode = this.toFontChar[charcode] || charcode;
  20771. if (this.missingFile) {
  20772. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  20773. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  20774. fontCharCode = 0x20;
  20775. }
  20776. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  20777. }
  20778. if (this.isType3Font) {
  20779. operatorListId = fontCharCode;
  20780. }
  20781. let accent = null;
  20782. if (this.seacMap && this.seacMap[charcode]) {
  20783. isInFont = true;
  20784. const seac = this.seacMap[charcode];
  20785. fontCharCode = seac.baseFontCharCode;
  20786. accent = {
  20787. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  20788. offset: seac.accentOffset
  20789. };
  20790. }
  20791. let fontChar = "";
  20792. if (typeof fontCharCode === "number") {
  20793. if (fontCharCode <= 0x10ffff) {
  20794. fontChar = String.fromCodePoint(fontCharCode);
  20795. } else {
  20796. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  20797. }
  20798. }
  20799. let glyph = this._glyphCache[charcode];
  20800. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  20801. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  20802. this._glyphCache[charcode] = glyph;
  20803. }
  20804. return glyph;
  20805. }
  20806. charsToGlyphs(chars) {
  20807. let glyphs = this._charsCache[chars];
  20808. if (glyphs) {
  20809. return glyphs;
  20810. }
  20811. glyphs = [];
  20812. if (this.cMap) {
  20813. const c = Object.create(null),
  20814. ii = chars.length;
  20815. let i = 0;
  20816. while (i < ii) {
  20817. this.cMap.readCharCode(chars, i, c);
  20818. const {
  20819. charcode,
  20820. length
  20821. } = c;
  20822. i += length;
  20823. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  20824. glyphs.push(glyph);
  20825. }
  20826. } else {
  20827. for (let i = 0, ii = chars.length; i < ii; ++i) {
  20828. const charcode = chars.charCodeAt(i);
  20829. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  20830. glyphs.push(glyph);
  20831. }
  20832. }
  20833. return this._charsCache[chars] = glyphs;
  20834. }
  20835. getCharPositions(chars) {
  20836. const positions = [];
  20837. if (this.cMap) {
  20838. const c = Object.create(null);
  20839. let i = 0;
  20840. while (i < chars.length) {
  20841. this.cMap.readCharCode(chars, i, c);
  20842. const length = c.length;
  20843. positions.push([i, i + length]);
  20844. i += length;
  20845. }
  20846. } else {
  20847. for (let i = 0, ii = chars.length; i < ii; ++i) {
  20848. positions.push([i, i + 1]);
  20849. }
  20850. }
  20851. return positions;
  20852. }
  20853. get glyphCacheValues() {
  20854. return Object.values(this._glyphCache);
  20855. }
  20856. encodeString(str) {
  20857. const buffers = [];
  20858. const currentBuf = [];
  20859. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  20860. for (let i = 0, ii = str.length; i < ii; i++) {
  20861. const unicode = str.codePointAt(i);
  20862. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  20863. i++;
  20864. }
  20865. if (this.toUnicode) {
  20866. const char = String.fromCodePoint(unicode);
  20867. const charCode = this.toUnicode.charCodeOf(char);
  20868. if (charCode !== -1) {
  20869. if (hasCurrentBufErrors()) {
  20870. buffers.push(currentBuf.join(""));
  20871. currentBuf.length = 0;
  20872. }
  20873. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  20874. for (let j = charCodeLength - 1; j >= 0; j--) {
  20875. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  20876. }
  20877. continue;
  20878. }
  20879. }
  20880. if (!hasCurrentBufErrors()) {
  20881. buffers.push(currentBuf.join(""));
  20882. currentBuf.length = 0;
  20883. }
  20884. currentBuf.push(String.fromCodePoint(unicode));
  20885. }
  20886. buffers.push(currentBuf.join(""));
  20887. return buffers;
  20888. }
  20889. }
  20890. exports.Font = Font;
  20891. class ErrorFont {
  20892. constructor(error) {
  20893. this.error = error;
  20894. this.loadedName = "g_font_error";
  20895. this.missingFile = true;
  20896. }
  20897. charsToGlyphs() {
  20898. return [];
  20899. }
  20900. encodeString(chars) {
  20901. return [chars];
  20902. }
  20903. exportData(extraProperties = false) {
  20904. return {
  20905. error: this.error
  20906. };
  20907. }
  20908. }
  20909. exports.ErrorFont = ErrorFont;
  20910. /***/ }),
  20911. /* 35 */
  20912. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20913. Object.defineProperty(exports, "__esModule", ({
  20914. value: true
  20915. }));
  20916. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  20917. var _util = __w_pdfjs_require__(2);
  20918. var _charsets = __w_pdfjs_require__(36);
  20919. var _encodings = __w_pdfjs_require__(37);
  20920. const MAX_SUBR_NESTING = 10;
  20921. 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"];
  20922. exports.CFFStandardStrings = CFFStandardStrings;
  20923. const NUM_STANDARD_CFF_STRINGS = 391;
  20924. const CFFParser = function CFFParserClosure() {
  20925. const CharstringValidationData = [null, {
  20926. id: "hstem",
  20927. min: 2,
  20928. stackClearing: true,
  20929. stem: true
  20930. }, null, {
  20931. id: "vstem",
  20932. min: 2,
  20933. stackClearing: true,
  20934. stem: true
  20935. }, {
  20936. id: "vmoveto",
  20937. min: 1,
  20938. stackClearing: true
  20939. }, {
  20940. id: "rlineto",
  20941. min: 2,
  20942. resetStack: true
  20943. }, {
  20944. id: "hlineto",
  20945. min: 1,
  20946. resetStack: true
  20947. }, {
  20948. id: "vlineto",
  20949. min: 1,
  20950. resetStack: true
  20951. }, {
  20952. id: "rrcurveto",
  20953. min: 6,
  20954. resetStack: true
  20955. }, null, {
  20956. id: "callsubr",
  20957. min: 1,
  20958. undefStack: true
  20959. }, {
  20960. id: "return",
  20961. min: 0,
  20962. undefStack: true
  20963. }, null, null, {
  20964. id: "endchar",
  20965. min: 0,
  20966. stackClearing: true
  20967. }, null, null, null, {
  20968. id: "hstemhm",
  20969. min: 2,
  20970. stackClearing: true,
  20971. stem: true
  20972. }, {
  20973. id: "hintmask",
  20974. min: 0,
  20975. stackClearing: true
  20976. }, {
  20977. id: "cntrmask",
  20978. min: 0,
  20979. stackClearing: true
  20980. }, {
  20981. id: "rmoveto",
  20982. min: 2,
  20983. stackClearing: true
  20984. }, {
  20985. id: "hmoveto",
  20986. min: 1,
  20987. stackClearing: true
  20988. }, {
  20989. id: "vstemhm",
  20990. min: 2,
  20991. stackClearing: true,
  20992. stem: true
  20993. }, {
  20994. id: "rcurveline",
  20995. min: 8,
  20996. resetStack: true
  20997. }, {
  20998. id: "rlinecurve",
  20999. min: 8,
  21000. resetStack: true
  21001. }, {
  21002. id: "vvcurveto",
  21003. min: 4,
  21004. resetStack: true
  21005. }, {
  21006. id: "hhcurveto",
  21007. min: 4,
  21008. resetStack: true
  21009. }, null, {
  21010. id: "callgsubr",
  21011. min: 1,
  21012. undefStack: true
  21013. }, {
  21014. id: "vhcurveto",
  21015. min: 4,
  21016. resetStack: true
  21017. }, {
  21018. id: "hvcurveto",
  21019. min: 4,
  21020. resetStack: true
  21021. }];
  21022. const CharstringValidationData12 = [null, null, null, {
  21023. id: "and",
  21024. min: 2,
  21025. stackDelta: -1
  21026. }, {
  21027. id: "or",
  21028. min: 2,
  21029. stackDelta: -1
  21030. }, {
  21031. id: "not",
  21032. min: 1,
  21033. stackDelta: 0
  21034. }, null, null, null, {
  21035. id: "abs",
  21036. min: 1,
  21037. stackDelta: 0
  21038. }, {
  21039. id: "add",
  21040. min: 2,
  21041. stackDelta: -1,
  21042. stackFn: function stack_div(stack, index) {
  21043. stack[index - 2] = stack[index - 2] + stack[index - 1];
  21044. }
  21045. }, {
  21046. id: "sub",
  21047. min: 2,
  21048. stackDelta: -1,
  21049. stackFn: function stack_div(stack, index) {
  21050. stack[index - 2] = stack[index - 2] - stack[index - 1];
  21051. }
  21052. }, {
  21053. id: "div",
  21054. min: 2,
  21055. stackDelta: -1,
  21056. stackFn: function stack_div(stack, index) {
  21057. stack[index - 2] = stack[index - 2] / stack[index - 1];
  21058. }
  21059. }, null, {
  21060. id: "neg",
  21061. min: 1,
  21062. stackDelta: 0,
  21063. stackFn: function stack_div(stack, index) {
  21064. stack[index - 1] = -stack[index - 1];
  21065. }
  21066. }, {
  21067. id: "eq",
  21068. min: 2,
  21069. stackDelta: -1
  21070. }, null, null, {
  21071. id: "drop",
  21072. min: 1,
  21073. stackDelta: -1
  21074. }, null, {
  21075. id: "put",
  21076. min: 2,
  21077. stackDelta: -2
  21078. }, {
  21079. id: "get",
  21080. min: 1,
  21081. stackDelta: 0
  21082. }, {
  21083. id: "ifelse",
  21084. min: 4,
  21085. stackDelta: -3
  21086. }, {
  21087. id: "random",
  21088. min: 0,
  21089. stackDelta: 1
  21090. }, {
  21091. id: "mul",
  21092. min: 2,
  21093. stackDelta: -1,
  21094. stackFn: function stack_div(stack, index) {
  21095. stack[index - 2] = stack[index - 2] * stack[index - 1];
  21096. }
  21097. }, null, {
  21098. id: "sqrt",
  21099. min: 1,
  21100. stackDelta: 0
  21101. }, {
  21102. id: "dup",
  21103. min: 1,
  21104. stackDelta: 1
  21105. }, {
  21106. id: "exch",
  21107. min: 2,
  21108. stackDelta: 0
  21109. }, {
  21110. id: "index",
  21111. min: 2,
  21112. stackDelta: 0
  21113. }, {
  21114. id: "roll",
  21115. min: 3,
  21116. stackDelta: -2
  21117. }, null, null, null, {
  21118. id: "hflex",
  21119. min: 7,
  21120. resetStack: true
  21121. }, {
  21122. id: "flex",
  21123. min: 13,
  21124. resetStack: true
  21125. }, {
  21126. id: "hflex1",
  21127. min: 9,
  21128. resetStack: true
  21129. }, {
  21130. id: "flex1",
  21131. min: 11,
  21132. resetStack: true
  21133. }];
  21134. class CFFParser {
  21135. constructor(file, properties, seacAnalysisEnabled) {
  21136. this.bytes = file.getBytes();
  21137. this.properties = properties;
  21138. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  21139. }
  21140. parse() {
  21141. const properties = this.properties;
  21142. const cff = new CFF();
  21143. this.cff = cff;
  21144. const header = this.parseHeader();
  21145. const nameIndex = this.parseIndex(header.endPos);
  21146. const topDictIndex = this.parseIndex(nameIndex.endPos);
  21147. const stringIndex = this.parseIndex(topDictIndex.endPos);
  21148. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  21149. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  21150. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  21151. cff.header = header.obj;
  21152. cff.names = this.parseNameIndex(nameIndex.obj);
  21153. cff.strings = this.parseStringIndex(stringIndex.obj);
  21154. cff.topDict = topDict;
  21155. cff.globalSubrIndex = globalSubrIndex.obj;
  21156. this.parsePrivateDict(cff.topDict);
  21157. cff.isCIDFont = topDict.hasName("ROS");
  21158. const charStringOffset = topDict.getByName("CharStrings");
  21159. const charStringIndex = this.parseIndex(charStringOffset).obj;
  21160. const fontMatrix = topDict.getByName("FontMatrix");
  21161. if (fontMatrix) {
  21162. properties.fontMatrix = fontMatrix;
  21163. }
  21164. const fontBBox = topDict.getByName("FontBBox");
  21165. if (fontBBox) {
  21166. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  21167. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  21168. properties.ascentScaled = true;
  21169. }
  21170. let charset, encoding;
  21171. if (cff.isCIDFont) {
  21172. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  21173. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  21174. const dictRaw = fdArrayIndex.get(i);
  21175. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  21176. this.parsePrivateDict(fontDict);
  21177. cff.fdArray.push(fontDict);
  21178. }
  21179. encoding = null;
  21180. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  21181. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  21182. } else {
  21183. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  21184. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  21185. }
  21186. cff.charset = charset;
  21187. cff.encoding = encoding;
  21188. const charStringsAndSeacs = this.parseCharStrings({
  21189. charStrings: charStringIndex,
  21190. localSubrIndex: topDict.privateDict.subrsIndex,
  21191. globalSubrIndex: globalSubrIndex.obj,
  21192. fdSelect: cff.fdSelect,
  21193. fdArray: cff.fdArray,
  21194. privateDict: topDict.privateDict
  21195. });
  21196. cff.charStrings = charStringsAndSeacs.charStrings;
  21197. cff.seacs = charStringsAndSeacs.seacs;
  21198. cff.widths = charStringsAndSeacs.widths;
  21199. return cff;
  21200. }
  21201. parseHeader() {
  21202. let bytes = this.bytes;
  21203. const bytesLength = bytes.length;
  21204. let offset = 0;
  21205. while (offset < bytesLength && bytes[offset] !== 1) {
  21206. ++offset;
  21207. }
  21208. if (offset >= bytesLength) {
  21209. throw new _util.FormatError("Invalid CFF header");
  21210. }
  21211. if (offset !== 0) {
  21212. (0, _util.info)("cff data is shifted");
  21213. bytes = bytes.subarray(offset);
  21214. this.bytes = bytes;
  21215. }
  21216. const major = bytes[0];
  21217. const minor = bytes[1];
  21218. const hdrSize = bytes[2];
  21219. const offSize = bytes[3];
  21220. const header = new CFFHeader(major, minor, hdrSize, offSize);
  21221. return {
  21222. obj: header,
  21223. endPos: hdrSize
  21224. };
  21225. }
  21226. parseDict(dict) {
  21227. let pos = 0;
  21228. function parseOperand() {
  21229. let value = dict[pos++];
  21230. if (value === 30) {
  21231. return parseFloatOperand();
  21232. } else if (value === 28) {
  21233. value = dict[pos++];
  21234. value = (value << 24 | dict[pos++] << 16) >> 16;
  21235. return value;
  21236. } else if (value === 29) {
  21237. value = dict[pos++];
  21238. value = value << 8 | dict[pos++];
  21239. value = value << 8 | dict[pos++];
  21240. value = value << 8 | dict[pos++];
  21241. return value;
  21242. } else if (value >= 32 && value <= 246) {
  21243. return value - 139;
  21244. } else if (value >= 247 && value <= 250) {
  21245. return (value - 247) * 256 + dict[pos++] + 108;
  21246. } else if (value >= 251 && value <= 254) {
  21247. return -((value - 251) * 256) - dict[pos++] - 108;
  21248. }
  21249. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  21250. return NaN;
  21251. }
  21252. function parseFloatOperand() {
  21253. let str = "";
  21254. const eof = 15;
  21255. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  21256. const length = dict.length;
  21257. while (pos < length) {
  21258. const b = dict[pos++];
  21259. const b1 = b >> 4;
  21260. const b2 = b & 15;
  21261. if (b1 === eof) {
  21262. break;
  21263. }
  21264. str += lookup[b1];
  21265. if (b2 === eof) {
  21266. break;
  21267. }
  21268. str += lookup[b2];
  21269. }
  21270. return parseFloat(str);
  21271. }
  21272. let operands = [];
  21273. const entries = [];
  21274. pos = 0;
  21275. const end = dict.length;
  21276. while (pos < end) {
  21277. let b = dict[pos];
  21278. if (b <= 21) {
  21279. if (b === 12) {
  21280. b = b << 8 | dict[++pos];
  21281. }
  21282. entries.push([b, operands]);
  21283. operands = [];
  21284. ++pos;
  21285. } else {
  21286. operands.push(parseOperand());
  21287. }
  21288. }
  21289. return entries;
  21290. }
  21291. parseIndex(pos) {
  21292. const cffIndex = new CFFIndex();
  21293. const bytes = this.bytes;
  21294. const count = bytes[pos++] << 8 | bytes[pos++];
  21295. const offsets = [];
  21296. let end = pos;
  21297. let i, ii;
  21298. if (count !== 0) {
  21299. const offsetSize = bytes[pos++];
  21300. const startPos = pos + (count + 1) * offsetSize - 1;
  21301. for (i = 0, ii = count + 1; i < ii; ++i) {
  21302. let offset = 0;
  21303. for (let j = 0; j < offsetSize; ++j) {
  21304. offset <<= 8;
  21305. offset += bytes[pos++];
  21306. }
  21307. offsets.push(startPos + offset);
  21308. }
  21309. end = offsets[count];
  21310. }
  21311. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  21312. const offsetStart = offsets[i];
  21313. const offsetEnd = offsets[i + 1];
  21314. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  21315. }
  21316. return {
  21317. obj: cffIndex,
  21318. endPos: end
  21319. };
  21320. }
  21321. parseNameIndex(index) {
  21322. const names = [];
  21323. for (let i = 0, ii = index.count; i < ii; ++i) {
  21324. const name = index.get(i);
  21325. names.push((0, _util.bytesToString)(name));
  21326. }
  21327. return names;
  21328. }
  21329. parseStringIndex(index) {
  21330. const strings = new CFFStrings();
  21331. for (let i = 0, ii = index.count; i < ii; ++i) {
  21332. const data = index.get(i);
  21333. strings.add((0, _util.bytesToString)(data));
  21334. }
  21335. return strings;
  21336. }
  21337. createDict(Type, dict, strings) {
  21338. const cffDict = new Type(strings);
  21339. for (let i = 0, ii = dict.length; i < ii; ++i) {
  21340. const pair = dict[i];
  21341. const key = pair[0];
  21342. const value = pair[1];
  21343. cffDict.setByKey(key, value);
  21344. }
  21345. return cffDict;
  21346. }
  21347. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  21348. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  21349. return false;
  21350. }
  21351. let stackSize = state.stackSize;
  21352. const stack = state.stack;
  21353. const length = data.length;
  21354. for (let j = 0; j < length;) {
  21355. const value = data[j++];
  21356. let validationCommand = null;
  21357. if (value === 12) {
  21358. const q = data[j++];
  21359. if (q === 0) {
  21360. data[j - 2] = 139;
  21361. data[j - 1] = 22;
  21362. stackSize = 0;
  21363. } else {
  21364. validationCommand = CharstringValidationData12[q];
  21365. }
  21366. } else if (value === 28) {
  21367. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  21368. j += 2;
  21369. stackSize++;
  21370. } else if (value === 14) {
  21371. if (stackSize >= 4) {
  21372. stackSize -= 4;
  21373. if (this.seacAnalysisEnabled) {
  21374. state.seac = stack.slice(stackSize, stackSize + 4);
  21375. return false;
  21376. }
  21377. }
  21378. validationCommand = CharstringValidationData[value];
  21379. } else if (value >= 32 && value <= 246) {
  21380. stack[stackSize] = value - 139;
  21381. stackSize++;
  21382. } else if (value >= 247 && value <= 254) {
  21383. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  21384. j++;
  21385. stackSize++;
  21386. } else if (value === 255) {
  21387. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  21388. j += 4;
  21389. stackSize++;
  21390. } else if (value === 19 || value === 20) {
  21391. state.hints += stackSize >> 1;
  21392. j += state.hints + 7 >> 3;
  21393. stackSize %= 2;
  21394. validationCommand = CharstringValidationData[value];
  21395. } else if (value === 10 || value === 29) {
  21396. let subrsIndex;
  21397. if (value === 10) {
  21398. subrsIndex = localSubrIndex;
  21399. } else {
  21400. subrsIndex = globalSubrIndex;
  21401. }
  21402. if (!subrsIndex) {
  21403. validationCommand = CharstringValidationData[value];
  21404. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  21405. return false;
  21406. }
  21407. let bias = 32768;
  21408. if (subrsIndex.count < 1240) {
  21409. bias = 107;
  21410. } else if (subrsIndex.count < 33900) {
  21411. bias = 1131;
  21412. }
  21413. const subrNumber = stack[--stackSize] + bias;
  21414. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  21415. validationCommand = CharstringValidationData[value];
  21416. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  21417. return false;
  21418. }
  21419. state.stackSize = stackSize;
  21420. state.callDepth++;
  21421. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  21422. if (!valid) {
  21423. return false;
  21424. }
  21425. state.callDepth--;
  21426. stackSize = state.stackSize;
  21427. continue;
  21428. } else if (value === 11) {
  21429. state.stackSize = stackSize;
  21430. return true;
  21431. } else if (value === 0 && j === data.length) {
  21432. data[j - 1] = 14;
  21433. validationCommand = CharstringValidationData[14];
  21434. } else {
  21435. validationCommand = CharstringValidationData[value];
  21436. }
  21437. if (validationCommand) {
  21438. if (validationCommand.stem) {
  21439. state.hints += stackSize >> 1;
  21440. if (value === 3 || value === 23) {
  21441. state.hasVStems = true;
  21442. } else if (state.hasVStems && (value === 1 || value === 18)) {
  21443. (0, _util.warn)("CFF stem hints are in wrong order");
  21444. data[j - 1] = value === 1 ? 3 : 23;
  21445. }
  21446. }
  21447. if ("min" in validationCommand) {
  21448. if (!state.undefStack && stackSize < validationCommand.min) {
  21449. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  21450. if (stackSize === 0) {
  21451. data[j - 1] = 14;
  21452. return true;
  21453. }
  21454. return false;
  21455. }
  21456. }
  21457. if (state.firstStackClearing && validationCommand.stackClearing) {
  21458. state.firstStackClearing = false;
  21459. stackSize -= validationCommand.min;
  21460. if (stackSize >= 2 && validationCommand.stem) {
  21461. stackSize %= 2;
  21462. } else if (stackSize > 1) {
  21463. (0, _util.warn)("Found too many parameters for stack-clearing command");
  21464. }
  21465. if (stackSize > 0) {
  21466. state.width = stack[stackSize - 1];
  21467. }
  21468. }
  21469. if ("stackDelta" in validationCommand) {
  21470. if ("stackFn" in validationCommand) {
  21471. validationCommand.stackFn(stack, stackSize);
  21472. }
  21473. stackSize += validationCommand.stackDelta;
  21474. } else if (validationCommand.stackClearing) {
  21475. stackSize = 0;
  21476. } else if (validationCommand.resetStack) {
  21477. stackSize = 0;
  21478. state.undefStack = false;
  21479. } else if (validationCommand.undefStack) {
  21480. stackSize = 0;
  21481. state.undefStack = true;
  21482. state.firstStackClearing = false;
  21483. }
  21484. }
  21485. }
  21486. state.stackSize = stackSize;
  21487. return true;
  21488. }
  21489. parseCharStrings({
  21490. charStrings,
  21491. localSubrIndex,
  21492. globalSubrIndex,
  21493. fdSelect,
  21494. fdArray,
  21495. privateDict
  21496. }) {
  21497. const seacs = [];
  21498. const widths = [];
  21499. const count = charStrings.count;
  21500. for (let i = 0; i < count; i++) {
  21501. const charstring = charStrings.get(i);
  21502. const state = {
  21503. callDepth: 0,
  21504. stackSize: 0,
  21505. stack: [],
  21506. undefStack: true,
  21507. hints: 0,
  21508. firstStackClearing: true,
  21509. seac: null,
  21510. width: null,
  21511. hasVStems: false
  21512. };
  21513. let valid = true;
  21514. let localSubrToUse = null;
  21515. let privateDictToUse = privateDict;
  21516. if (fdSelect && fdArray.length) {
  21517. const fdIndex = fdSelect.getFDIndex(i);
  21518. if (fdIndex === -1) {
  21519. (0, _util.warn)("Glyph index is not in fd select.");
  21520. valid = false;
  21521. }
  21522. if (fdIndex >= fdArray.length) {
  21523. (0, _util.warn)("Invalid fd index for glyph index.");
  21524. valid = false;
  21525. }
  21526. if (valid) {
  21527. privateDictToUse = fdArray[fdIndex].privateDict;
  21528. localSubrToUse = privateDictToUse.subrsIndex;
  21529. }
  21530. } else if (localSubrIndex) {
  21531. localSubrToUse = localSubrIndex;
  21532. }
  21533. if (valid) {
  21534. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  21535. }
  21536. if (state.width !== null) {
  21537. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  21538. widths[i] = nominalWidth + state.width;
  21539. } else {
  21540. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  21541. widths[i] = defaultWidth;
  21542. }
  21543. if (state.seac !== null) {
  21544. seacs[i] = state.seac;
  21545. }
  21546. if (!valid) {
  21547. charStrings.set(i, new Uint8Array([14]));
  21548. }
  21549. }
  21550. return {
  21551. charStrings,
  21552. seacs,
  21553. widths
  21554. };
  21555. }
  21556. emptyPrivateDictionary(parentDict) {
  21557. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  21558. parentDict.setByKey(18, [0, 0]);
  21559. parentDict.privateDict = privateDict;
  21560. }
  21561. parsePrivateDict(parentDict) {
  21562. if (!parentDict.hasName("Private")) {
  21563. this.emptyPrivateDictionary(parentDict);
  21564. return;
  21565. }
  21566. const privateOffset = parentDict.getByName("Private");
  21567. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  21568. parentDict.removeByName("Private");
  21569. return;
  21570. }
  21571. const size = privateOffset[0];
  21572. const offset = privateOffset[1];
  21573. if (size === 0 || offset >= this.bytes.length) {
  21574. this.emptyPrivateDictionary(parentDict);
  21575. return;
  21576. }
  21577. const privateDictEnd = offset + size;
  21578. const dictData = this.bytes.subarray(offset, privateDictEnd);
  21579. const dict = this.parseDict(dictData);
  21580. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  21581. parentDict.privateDict = privateDict;
  21582. if (!privateDict.getByName("Subrs")) {
  21583. return;
  21584. }
  21585. const subrsOffset = privateDict.getByName("Subrs");
  21586. const relativeOffset = offset + subrsOffset;
  21587. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  21588. this.emptyPrivateDictionary(parentDict);
  21589. return;
  21590. }
  21591. const subrsIndex = this.parseIndex(relativeOffset);
  21592. privateDict.subrsIndex = subrsIndex.obj;
  21593. }
  21594. parseCharsets(pos, length, strings, cid) {
  21595. if (pos === 0) {
  21596. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  21597. } else if (pos === 1) {
  21598. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  21599. } else if (pos === 2) {
  21600. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  21601. }
  21602. const bytes = this.bytes;
  21603. const start = pos;
  21604. const format = bytes[pos++];
  21605. const charset = [cid ? 0 : ".notdef"];
  21606. let id, count, i;
  21607. length -= 1;
  21608. switch (format) {
  21609. case 0:
  21610. for (i = 0; i < length; i++) {
  21611. id = bytes[pos++] << 8 | bytes[pos++];
  21612. charset.push(cid ? id : strings.get(id));
  21613. }
  21614. break;
  21615. case 1:
  21616. while (charset.length <= length) {
  21617. id = bytes[pos++] << 8 | bytes[pos++];
  21618. count = bytes[pos++];
  21619. for (i = 0; i <= count; i++) {
  21620. charset.push(cid ? id++ : strings.get(id++));
  21621. }
  21622. }
  21623. break;
  21624. case 2:
  21625. while (charset.length <= length) {
  21626. id = bytes[pos++] << 8 | bytes[pos++];
  21627. count = bytes[pos++] << 8 | bytes[pos++];
  21628. for (i = 0; i <= count; i++) {
  21629. charset.push(cid ? id++ : strings.get(id++));
  21630. }
  21631. }
  21632. break;
  21633. default:
  21634. throw new _util.FormatError("Unknown charset format");
  21635. }
  21636. const end = pos;
  21637. const raw = bytes.subarray(start, end);
  21638. return new CFFCharset(false, format, charset, raw);
  21639. }
  21640. parseEncoding(pos, properties, strings, charset) {
  21641. const encoding = Object.create(null);
  21642. const bytes = this.bytes;
  21643. let predefined = false;
  21644. let format, i, ii;
  21645. let raw = null;
  21646. function readSupplement() {
  21647. const supplementsCount = bytes[pos++];
  21648. for (i = 0; i < supplementsCount; i++) {
  21649. const code = bytes[pos++];
  21650. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  21651. encoding[code] = charset.indexOf(strings.get(sid));
  21652. }
  21653. }
  21654. if (pos === 0 || pos === 1) {
  21655. predefined = true;
  21656. format = pos;
  21657. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  21658. for (i = 0, ii = charset.length; i < ii; i++) {
  21659. const index = baseEncoding.indexOf(charset[i]);
  21660. if (index !== -1) {
  21661. encoding[index] = i;
  21662. }
  21663. }
  21664. } else {
  21665. const dataStart = pos;
  21666. format = bytes[pos++];
  21667. switch (format & 0x7f) {
  21668. case 0:
  21669. const glyphsCount = bytes[pos++];
  21670. for (i = 1; i <= glyphsCount; i++) {
  21671. encoding[bytes[pos++]] = i;
  21672. }
  21673. break;
  21674. case 1:
  21675. const rangesCount = bytes[pos++];
  21676. let gid = 1;
  21677. for (i = 0; i < rangesCount; i++) {
  21678. const start = bytes[pos++];
  21679. const left = bytes[pos++];
  21680. for (let j = start; j <= start + left; j++) {
  21681. encoding[j] = gid++;
  21682. }
  21683. }
  21684. break;
  21685. default:
  21686. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  21687. }
  21688. const dataEnd = pos;
  21689. if (format & 0x80) {
  21690. bytes[dataStart] &= 0x7f;
  21691. readSupplement();
  21692. }
  21693. raw = bytes.subarray(dataStart, dataEnd);
  21694. }
  21695. format &= 0x7f;
  21696. return new CFFEncoding(predefined, format, encoding, raw);
  21697. }
  21698. parseFDSelect(pos, length) {
  21699. const bytes = this.bytes;
  21700. const format = bytes[pos++];
  21701. const fdSelect = [];
  21702. let i;
  21703. switch (format) {
  21704. case 0:
  21705. for (i = 0; i < length; ++i) {
  21706. const id = bytes[pos++];
  21707. fdSelect.push(id);
  21708. }
  21709. break;
  21710. case 3:
  21711. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21712. for (i = 0; i < rangesCount; ++i) {
  21713. let first = bytes[pos++] << 8 | bytes[pos++];
  21714. if (i === 0 && first !== 0) {
  21715. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  21716. first = 0;
  21717. }
  21718. const fdIndex = bytes[pos++];
  21719. const next = bytes[pos] << 8 | bytes[pos + 1];
  21720. for (let j = first; j < next; ++j) {
  21721. fdSelect.push(fdIndex);
  21722. }
  21723. }
  21724. pos += 2;
  21725. break;
  21726. default:
  21727. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  21728. }
  21729. if (fdSelect.length !== length) {
  21730. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  21731. }
  21732. return new CFFFDSelect(format, fdSelect);
  21733. }
  21734. }
  21735. return CFFParser;
  21736. }();
  21737. exports.CFFParser = CFFParser;
  21738. class CFF {
  21739. constructor() {
  21740. this.header = null;
  21741. this.names = [];
  21742. this.topDict = null;
  21743. this.strings = new CFFStrings();
  21744. this.globalSubrIndex = null;
  21745. this.encoding = null;
  21746. this.charset = null;
  21747. this.charStrings = null;
  21748. this.fdArray = [];
  21749. this.fdSelect = null;
  21750. this.isCIDFont = false;
  21751. }
  21752. duplicateFirstGlyph() {
  21753. if (this.charStrings.count >= 65535) {
  21754. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  21755. return;
  21756. }
  21757. const glyphZero = this.charStrings.get(0);
  21758. this.charStrings.add(glyphZero);
  21759. if (this.isCIDFont) {
  21760. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  21761. }
  21762. }
  21763. hasGlyphId(id) {
  21764. if (id < 0 || id >= this.charStrings.count) {
  21765. return false;
  21766. }
  21767. const glyph = this.charStrings.get(id);
  21768. return glyph.length > 0;
  21769. }
  21770. }
  21771. exports.CFF = CFF;
  21772. class CFFHeader {
  21773. constructor(major, minor, hdrSize, offSize) {
  21774. this.major = major;
  21775. this.minor = minor;
  21776. this.hdrSize = hdrSize;
  21777. this.offSize = offSize;
  21778. }
  21779. }
  21780. exports.CFFHeader = CFFHeader;
  21781. class CFFStrings {
  21782. constructor() {
  21783. this.strings = [];
  21784. }
  21785. get(index) {
  21786. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  21787. return CFFStandardStrings[index];
  21788. }
  21789. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  21790. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  21791. }
  21792. return CFFStandardStrings[0];
  21793. }
  21794. getSID(str) {
  21795. let index = CFFStandardStrings.indexOf(str);
  21796. if (index !== -1) {
  21797. return index;
  21798. }
  21799. index = this.strings.indexOf(str);
  21800. if (index !== -1) {
  21801. return index + NUM_STANDARD_CFF_STRINGS;
  21802. }
  21803. return -1;
  21804. }
  21805. add(value) {
  21806. this.strings.push(value);
  21807. }
  21808. get count() {
  21809. return this.strings.length;
  21810. }
  21811. }
  21812. exports.CFFStrings = CFFStrings;
  21813. class CFFIndex {
  21814. constructor() {
  21815. this.objects = [];
  21816. this.length = 0;
  21817. }
  21818. add(data) {
  21819. this.length += data.length;
  21820. this.objects.push(data);
  21821. }
  21822. set(index, data) {
  21823. this.length += data.length - this.objects[index].length;
  21824. this.objects[index] = data;
  21825. }
  21826. get(index) {
  21827. return this.objects[index];
  21828. }
  21829. get count() {
  21830. return this.objects.length;
  21831. }
  21832. }
  21833. exports.CFFIndex = CFFIndex;
  21834. class CFFDict {
  21835. constructor(tables, strings) {
  21836. this.keyToNameMap = tables.keyToNameMap;
  21837. this.nameToKeyMap = tables.nameToKeyMap;
  21838. this.defaults = tables.defaults;
  21839. this.types = tables.types;
  21840. this.opcodes = tables.opcodes;
  21841. this.order = tables.order;
  21842. this.strings = strings;
  21843. this.values = Object.create(null);
  21844. }
  21845. setByKey(key, value) {
  21846. if (!(key in this.keyToNameMap)) {
  21847. return false;
  21848. }
  21849. const valueLength = value.length;
  21850. if (valueLength === 0) {
  21851. return true;
  21852. }
  21853. for (let i = 0; i < valueLength; i++) {
  21854. if (isNaN(value[i])) {
  21855. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21856. return true;
  21857. }
  21858. }
  21859. const type = this.types[key];
  21860. if (type === "num" || type === "sid" || type === "offset") {
  21861. value = value[0];
  21862. }
  21863. this.values[key] = value;
  21864. return true;
  21865. }
  21866. setByName(name, value) {
  21867. if (!(name in this.nameToKeyMap)) {
  21868. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  21869. }
  21870. this.values[this.nameToKeyMap[name]] = value;
  21871. }
  21872. hasName(name) {
  21873. return this.nameToKeyMap[name] in this.values;
  21874. }
  21875. getByName(name) {
  21876. if (!(name in this.nameToKeyMap)) {
  21877. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  21878. }
  21879. const key = this.nameToKeyMap[name];
  21880. if (!(key in this.values)) {
  21881. return this.defaults[key];
  21882. }
  21883. return this.values[key];
  21884. }
  21885. removeByName(name) {
  21886. delete this.values[this.nameToKeyMap[name]];
  21887. }
  21888. static createTables(layout) {
  21889. const tables = {
  21890. keyToNameMap: {},
  21891. nameToKeyMap: {},
  21892. defaults: {},
  21893. types: {},
  21894. opcodes: {},
  21895. order: []
  21896. };
  21897. for (let i = 0, ii = layout.length; i < ii; ++i) {
  21898. const entry = layout[i];
  21899. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21900. tables.keyToNameMap[key] = entry[1];
  21901. tables.nameToKeyMap[entry[1]] = key;
  21902. tables.types[key] = entry[2];
  21903. tables.defaults[key] = entry[3];
  21904. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  21905. tables.order.push(key);
  21906. }
  21907. return tables;
  21908. }
  21909. }
  21910. const CFFTopDict = function CFFTopDictClosure() {
  21911. 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]];
  21912. let tables = null;
  21913. class CFFTopDict extends CFFDict {
  21914. constructor(strings) {
  21915. if (tables === null) {
  21916. tables = CFFDict.createTables(layout);
  21917. }
  21918. super(tables, strings);
  21919. this.privateDict = null;
  21920. }
  21921. }
  21922. return CFFTopDict;
  21923. }();
  21924. exports.CFFTopDict = CFFTopDict;
  21925. const CFFPrivateDict = function CFFPrivateDictClosure() {
  21926. 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]];
  21927. let tables = null;
  21928. class CFFPrivateDict extends CFFDict {
  21929. constructor(strings) {
  21930. if (tables === null) {
  21931. tables = CFFDict.createTables(layout);
  21932. }
  21933. super(tables, strings);
  21934. this.subrsIndex = null;
  21935. }
  21936. }
  21937. return CFFPrivateDict;
  21938. }();
  21939. exports.CFFPrivateDict = CFFPrivateDict;
  21940. const CFFCharsetPredefinedTypes = {
  21941. ISO_ADOBE: 0,
  21942. EXPERT: 1,
  21943. EXPERT_SUBSET: 2
  21944. };
  21945. class CFFCharset {
  21946. constructor(predefined, format, charset, raw) {
  21947. this.predefined = predefined;
  21948. this.format = format;
  21949. this.charset = charset;
  21950. this.raw = raw;
  21951. }
  21952. }
  21953. exports.CFFCharset = CFFCharset;
  21954. class CFFEncoding {
  21955. constructor(predefined, format, encoding, raw) {
  21956. this.predefined = predefined;
  21957. this.format = format;
  21958. this.encoding = encoding;
  21959. this.raw = raw;
  21960. }
  21961. }
  21962. class CFFFDSelect {
  21963. constructor(format, fdSelect) {
  21964. this.format = format;
  21965. this.fdSelect = fdSelect;
  21966. }
  21967. getFDIndex(glyphIndex) {
  21968. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21969. return -1;
  21970. }
  21971. return this.fdSelect[glyphIndex];
  21972. }
  21973. }
  21974. exports.CFFFDSelect = CFFFDSelect;
  21975. class CFFOffsetTracker {
  21976. constructor() {
  21977. this.offsets = Object.create(null);
  21978. }
  21979. isTracking(key) {
  21980. return key in this.offsets;
  21981. }
  21982. track(key, location) {
  21983. if (key in this.offsets) {
  21984. throw new _util.FormatError(`Already tracking location of ${key}`);
  21985. }
  21986. this.offsets[key] = location;
  21987. }
  21988. offset(value) {
  21989. for (const key in this.offsets) {
  21990. this.offsets[key] += value;
  21991. }
  21992. }
  21993. setEntryLocation(key, values, output) {
  21994. if (!(key in this.offsets)) {
  21995. throw new _util.FormatError(`Not tracking location of ${key}`);
  21996. }
  21997. const data = output.data;
  21998. const dataOffset = this.offsets[key];
  21999. const size = 5;
  22000. for (let i = 0, ii = values.length; i < ii; ++i) {
  22001. const offset0 = i * size + dataOffset;
  22002. const offset1 = offset0 + 1;
  22003. const offset2 = offset0 + 2;
  22004. const offset3 = offset0 + 3;
  22005. const offset4 = offset0 + 4;
  22006. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  22007. throw new _util.FormatError("writing to an offset that is not empty");
  22008. }
  22009. const value = values[i];
  22010. data[offset0] = 0x1d;
  22011. data[offset1] = value >> 24 & 0xff;
  22012. data[offset2] = value >> 16 & 0xff;
  22013. data[offset3] = value >> 8 & 0xff;
  22014. data[offset4] = value & 0xff;
  22015. }
  22016. }
  22017. }
  22018. class CFFCompiler {
  22019. constructor(cff) {
  22020. this.cff = cff;
  22021. }
  22022. compile() {
  22023. const cff = this.cff;
  22024. const output = {
  22025. data: [],
  22026. length: 0,
  22027. add: function CFFCompiler_add(data) {
  22028. this.data = this.data.concat(data);
  22029. this.length = this.data.length;
  22030. }
  22031. };
  22032. const header = this.compileHeader(cff.header);
  22033. output.add(header);
  22034. const nameIndex = this.compileNameIndex(cff.names);
  22035. output.add(nameIndex);
  22036. if (cff.isCIDFont) {
  22037. if (cff.topDict.hasName("FontMatrix")) {
  22038. const base = cff.topDict.getByName("FontMatrix");
  22039. cff.topDict.removeByName("FontMatrix");
  22040. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  22041. const subDict = cff.fdArray[i];
  22042. let matrix = base.slice(0);
  22043. if (subDict.hasName("FontMatrix")) {
  22044. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  22045. }
  22046. subDict.setByName("FontMatrix", matrix);
  22047. }
  22048. }
  22049. }
  22050. const xuid = cff.topDict.getByName("XUID");
  22051. if (xuid && xuid.length > 16) {
  22052. cff.topDict.removeByName("XUID");
  22053. }
  22054. cff.topDict.setByName("charset", 0);
  22055. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  22056. output.add(compiled.output);
  22057. const topDictTracker = compiled.trackers[0];
  22058. const stringIndex = this.compileStringIndex(cff.strings.strings);
  22059. output.add(stringIndex);
  22060. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  22061. output.add(globalSubrIndex);
  22062. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  22063. if (cff.encoding.predefined) {
  22064. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  22065. } else {
  22066. const encoding = this.compileEncoding(cff.encoding);
  22067. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  22068. output.add(encoding);
  22069. }
  22070. }
  22071. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  22072. topDictTracker.setEntryLocation("charset", [output.length], output);
  22073. output.add(charset);
  22074. const charStrings = this.compileCharStrings(cff.charStrings);
  22075. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  22076. output.add(charStrings);
  22077. if (cff.isCIDFont) {
  22078. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  22079. const fdSelect = this.compileFDSelect(cff.fdSelect);
  22080. output.add(fdSelect);
  22081. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  22082. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  22083. output.add(compiled.output);
  22084. const fontDictTrackers = compiled.trackers;
  22085. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  22086. }
  22087. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  22088. output.add([0]);
  22089. return output.data;
  22090. }
  22091. encodeNumber(value) {
  22092. if (Number.isInteger(value)) {
  22093. return this.encodeInteger(value);
  22094. }
  22095. return this.encodeFloat(value);
  22096. }
  22097. static get EncodeFloatRegExp() {
  22098. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  22099. }
  22100. encodeFloat(num) {
  22101. let value = num.toString();
  22102. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  22103. if (m) {
  22104. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  22105. value = (Math.round(num * epsilon) / epsilon).toString();
  22106. }
  22107. let nibbles = "";
  22108. let i, ii;
  22109. for (i = 0, ii = value.length; i < ii; ++i) {
  22110. const a = value[i];
  22111. if (a === "e") {
  22112. nibbles += value[++i] === "-" ? "c" : "b";
  22113. } else if (a === ".") {
  22114. nibbles += "a";
  22115. } else if (a === "-") {
  22116. nibbles += "e";
  22117. } else {
  22118. nibbles += a;
  22119. }
  22120. }
  22121. nibbles += nibbles.length & 1 ? "f" : "ff";
  22122. const out = [30];
  22123. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  22124. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  22125. }
  22126. return out;
  22127. }
  22128. encodeInteger(value) {
  22129. let code;
  22130. if (value >= -107 && value <= 107) {
  22131. code = [value + 139];
  22132. } else if (value >= 108 && value <= 1131) {
  22133. value -= 108;
  22134. code = [(value >> 8) + 247, value & 0xff];
  22135. } else if (value >= -1131 && value <= -108) {
  22136. value = -value - 108;
  22137. code = [(value >> 8) + 251, value & 0xff];
  22138. } else if (value >= -32768 && value <= 32767) {
  22139. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  22140. } else {
  22141. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  22142. }
  22143. return code;
  22144. }
  22145. compileHeader(header) {
  22146. return [header.major, header.minor, 4, header.offSize];
  22147. }
  22148. compileNameIndex(names) {
  22149. const nameIndex = new CFFIndex();
  22150. for (let i = 0, ii = names.length; i < ii; ++i) {
  22151. const name = names[i];
  22152. const length = Math.min(name.length, 127);
  22153. let sanitizedName = new Array(length);
  22154. for (let j = 0; j < length; j++) {
  22155. let char = name[j];
  22156. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  22157. char = "_";
  22158. }
  22159. sanitizedName[j] = char;
  22160. }
  22161. sanitizedName = sanitizedName.join("");
  22162. if (sanitizedName === "") {
  22163. sanitizedName = "Bad_Font_Name";
  22164. }
  22165. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  22166. }
  22167. return this.compileIndex(nameIndex);
  22168. }
  22169. compileTopDicts(dicts, length, removeCidKeys) {
  22170. const fontDictTrackers = [];
  22171. let fdArrayIndex = new CFFIndex();
  22172. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  22173. const fontDict = dicts[i];
  22174. if (removeCidKeys) {
  22175. fontDict.removeByName("CIDFontVersion");
  22176. fontDict.removeByName("CIDFontRevision");
  22177. fontDict.removeByName("CIDFontType");
  22178. fontDict.removeByName("CIDCount");
  22179. fontDict.removeByName("UIDBase");
  22180. }
  22181. const fontDictTracker = new CFFOffsetTracker();
  22182. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  22183. fontDictTrackers.push(fontDictTracker);
  22184. fdArrayIndex.add(fontDictData);
  22185. fontDictTracker.offset(length);
  22186. }
  22187. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  22188. return {
  22189. trackers: fontDictTrackers,
  22190. output: fdArrayIndex
  22191. };
  22192. }
  22193. compilePrivateDicts(dicts, trackers, output) {
  22194. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  22195. const fontDict = dicts[i];
  22196. const privateDict = fontDict.privateDict;
  22197. if (!privateDict || !fontDict.hasName("Private")) {
  22198. throw new _util.FormatError("There must be a private dictionary.");
  22199. }
  22200. const privateDictTracker = new CFFOffsetTracker();
  22201. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  22202. let outputLength = output.length;
  22203. privateDictTracker.offset(outputLength);
  22204. if (!privateDictData.length) {
  22205. outputLength = 0;
  22206. }
  22207. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  22208. output.add(privateDictData);
  22209. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  22210. const subrs = this.compileIndex(privateDict.subrsIndex);
  22211. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  22212. output.add(subrs);
  22213. }
  22214. }
  22215. }
  22216. compileDict(dict, offsetTracker) {
  22217. let out = [];
  22218. const order = dict.order;
  22219. for (let i = 0; i < order.length; ++i) {
  22220. const key = order[i];
  22221. if (!(key in dict.values)) {
  22222. continue;
  22223. }
  22224. let values = dict.values[key];
  22225. let types = dict.types[key];
  22226. if (!Array.isArray(types)) {
  22227. types = [types];
  22228. }
  22229. if (!Array.isArray(values)) {
  22230. values = [values];
  22231. }
  22232. if (values.length === 0) {
  22233. continue;
  22234. }
  22235. for (let j = 0, jj = types.length; j < jj; ++j) {
  22236. const type = types[j];
  22237. const value = values[j];
  22238. switch (type) {
  22239. case "num":
  22240. case "sid":
  22241. out = out.concat(this.encodeNumber(value));
  22242. break;
  22243. case "offset":
  22244. const name = dict.keyToNameMap[key];
  22245. if (!offsetTracker.isTracking(name)) {
  22246. offsetTracker.track(name, out.length);
  22247. }
  22248. out = out.concat([0x1d, 0, 0, 0, 0]);
  22249. break;
  22250. case "array":
  22251. case "delta":
  22252. out = out.concat(this.encodeNumber(value));
  22253. for (let k = 1, kk = values.length; k < kk; ++k) {
  22254. out = out.concat(this.encodeNumber(values[k]));
  22255. }
  22256. break;
  22257. default:
  22258. throw new _util.FormatError(`Unknown data type of ${type}`);
  22259. }
  22260. }
  22261. out = out.concat(dict.opcodes[key]);
  22262. }
  22263. return out;
  22264. }
  22265. compileStringIndex(strings) {
  22266. const stringIndex = new CFFIndex();
  22267. for (let i = 0, ii = strings.length; i < ii; ++i) {
  22268. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  22269. }
  22270. return this.compileIndex(stringIndex);
  22271. }
  22272. compileGlobalSubrIndex() {
  22273. const globalSubrIndex = this.cff.globalSubrIndex;
  22274. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  22275. }
  22276. compileCharStrings(charStrings) {
  22277. const charStringsIndex = new CFFIndex();
  22278. for (let i = 0; i < charStrings.count; i++) {
  22279. const glyph = charStrings.get(i);
  22280. if (glyph.length === 0) {
  22281. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  22282. continue;
  22283. }
  22284. charStringsIndex.add(glyph);
  22285. }
  22286. return this.compileIndex(charStringsIndex);
  22287. }
  22288. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  22289. let out;
  22290. const numGlyphsLessNotDef = numGlyphs - 1;
  22291. if (isCIDFont) {
  22292. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  22293. } else {
  22294. const length = 1 + numGlyphsLessNotDef * 2;
  22295. out = new Uint8Array(length);
  22296. out[0] = 0;
  22297. let charsetIndex = 0;
  22298. const numCharsets = charset.charset.length;
  22299. let warned = false;
  22300. for (let i = 1; i < out.length; i += 2) {
  22301. let sid = 0;
  22302. if (charsetIndex < numCharsets) {
  22303. const name = charset.charset[charsetIndex++];
  22304. sid = strings.getSID(name);
  22305. if (sid === -1) {
  22306. sid = 0;
  22307. if (!warned) {
  22308. warned = true;
  22309. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  22310. }
  22311. }
  22312. }
  22313. out[i] = sid >> 8 & 0xff;
  22314. out[i + 1] = sid & 0xff;
  22315. }
  22316. }
  22317. return this.compileTypedArray(out);
  22318. }
  22319. compileEncoding(encoding) {
  22320. return this.compileTypedArray(encoding.raw);
  22321. }
  22322. compileFDSelect(fdSelect) {
  22323. const format = fdSelect.format;
  22324. let out, i;
  22325. switch (format) {
  22326. case 0:
  22327. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  22328. out[0] = format;
  22329. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  22330. out[i + 1] = fdSelect.fdSelect[i];
  22331. }
  22332. break;
  22333. case 3:
  22334. const start = 0;
  22335. let lastFD = fdSelect.fdSelect[0];
  22336. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  22337. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  22338. const currentFD = fdSelect.fdSelect[i];
  22339. if (currentFD !== lastFD) {
  22340. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  22341. lastFD = currentFD;
  22342. }
  22343. }
  22344. const numRanges = (ranges.length - 3) / 3;
  22345. ranges[1] = numRanges >> 8 & 0xff;
  22346. ranges[2] = numRanges & 0xff;
  22347. ranges.push(i >> 8 & 0xff, i & 0xff);
  22348. out = new Uint8Array(ranges);
  22349. break;
  22350. }
  22351. return this.compileTypedArray(out);
  22352. }
  22353. compileTypedArray(data) {
  22354. const out = [];
  22355. for (let i = 0, ii = data.length; i < ii; ++i) {
  22356. out[i] = data[i];
  22357. }
  22358. return out;
  22359. }
  22360. compileIndex(index, trackers = []) {
  22361. const objects = index.objects;
  22362. const count = objects.length;
  22363. if (count === 0) {
  22364. return [0, 0, 0];
  22365. }
  22366. const data = [count >> 8 & 0xff, count & 0xff];
  22367. let lastOffset = 1,
  22368. i;
  22369. for (i = 0; i < count; ++i) {
  22370. lastOffset += objects[i].length;
  22371. }
  22372. let offsetSize;
  22373. if (lastOffset < 0x100) {
  22374. offsetSize = 1;
  22375. } else if (lastOffset < 0x10000) {
  22376. offsetSize = 2;
  22377. } else if (lastOffset < 0x1000000) {
  22378. offsetSize = 3;
  22379. } else {
  22380. offsetSize = 4;
  22381. }
  22382. data.push(offsetSize);
  22383. let relativeOffset = 1;
  22384. for (i = 0; i < count + 1; i++) {
  22385. if (offsetSize === 1) {
  22386. data.push(relativeOffset & 0xff);
  22387. } else if (offsetSize === 2) {
  22388. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  22389. } else if (offsetSize === 3) {
  22390. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  22391. } else {
  22392. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  22393. }
  22394. if (objects[i]) {
  22395. relativeOffset += objects[i].length;
  22396. }
  22397. }
  22398. for (i = 0; i < count; i++) {
  22399. if (trackers[i]) {
  22400. trackers[i].offset(data.length);
  22401. }
  22402. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  22403. data.push(objects[i][j]);
  22404. }
  22405. }
  22406. return data;
  22407. }
  22408. }
  22409. exports.CFFCompiler = CFFCompiler;
  22410. /***/ }),
  22411. /* 36 */
  22412. /***/ ((__unused_webpack_module, exports) => {
  22413. Object.defineProperty(exports, "__esModule", ({
  22414. value: true
  22415. }));
  22416. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  22417. 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"];
  22418. exports.ISOAdobeCharset = ISOAdobeCharset;
  22419. 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"];
  22420. exports.ExpertCharset = ExpertCharset;
  22421. 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"];
  22422. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  22423. /***/ }),
  22424. /* 37 */
  22425. /***/ ((__unused_webpack_module, exports) => {
  22426. Object.defineProperty(exports, "__esModule", ({
  22427. value: true
  22428. }));
  22429. exports.getEncoding = getEncoding;
  22430. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  22431. 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"];
  22432. exports.ExpertEncoding = ExpertEncoding;
  22433. 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", "", "", "", ""];
  22434. 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"];
  22435. exports.MacRomanEncoding = MacRomanEncoding;
  22436. 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", "", "", "", ""];
  22437. exports.StandardEncoding = StandardEncoding;
  22438. 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"];
  22439. exports.WinAnsiEncoding = WinAnsiEncoding;
  22440. 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", ""];
  22441. exports.SymbolSetEncoding = SymbolSetEncoding;
  22442. 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", ""];
  22443. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  22444. function getEncoding(encodingName) {
  22445. switch (encodingName) {
  22446. case "WinAnsiEncoding":
  22447. return WinAnsiEncoding;
  22448. case "StandardEncoding":
  22449. return StandardEncoding;
  22450. case "MacRomanEncoding":
  22451. return MacRomanEncoding;
  22452. case "SymbolSetEncoding":
  22453. return SymbolSetEncoding;
  22454. case "ZapfDingbatsEncoding":
  22455. return ZapfDingbatsEncoding;
  22456. case "ExpertEncoding":
  22457. return ExpertEncoding;
  22458. case "MacExpertEncoding":
  22459. return MacExpertEncoding;
  22460. default:
  22461. return null;
  22462. }
  22463. }
  22464. /***/ }),
  22465. /* 38 */
  22466. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22467. Object.defineProperty(exports, "__esModule", ({
  22468. value: true
  22469. }));
  22470. exports.getFontType = getFontType;
  22471. exports.normalizeFontName = normalizeFontName;
  22472. exports.recoverGlyphName = recoverGlyphName;
  22473. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  22474. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  22475. var _util = __w_pdfjs_require__(2);
  22476. var _encodings = __w_pdfjs_require__(37);
  22477. var _glyphlist = __w_pdfjs_require__(39);
  22478. var _unicode = __w_pdfjs_require__(40);
  22479. const SEAC_ANALYSIS_ENABLED = true;
  22480. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  22481. const FontFlags = {
  22482. FixedPitch: 1,
  22483. Serif: 2,
  22484. Symbolic: 4,
  22485. Script: 8,
  22486. Nonsymbolic: 32,
  22487. Italic: 64,
  22488. AllCap: 65536,
  22489. SmallCap: 131072,
  22490. ForceBold: 262144
  22491. };
  22492. exports.FontFlags = FontFlags;
  22493. 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"];
  22494. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  22495. function getFontType(type, subtype, isStandardFont = false) {
  22496. switch (type) {
  22497. case "Type1":
  22498. if (isStandardFont) {
  22499. return _util.FontType.TYPE1STANDARD;
  22500. }
  22501. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  22502. case "CIDFontType0":
  22503. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  22504. case "OpenType":
  22505. return _util.FontType.OPENTYPE;
  22506. case "TrueType":
  22507. return _util.FontType.TRUETYPE;
  22508. case "CIDFontType2":
  22509. return _util.FontType.CIDFONTTYPE2;
  22510. case "MMType1":
  22511. return _util.FontType.MMTYPE1;
  22512. case "Type0":
  22513. return _util.FontType.TYPE0;
  22514. default:
  22515. return _util.FontType.UNKNOWN;
  22516. }
  22517. }
  22518. function recoverGlyphName(name, glyphsUnicodeMap) {
  22519. if (glyphsUnicodeMap[name] !== undefined) {
  22520. return name;
  22521. }
  22522. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  22523. if (unicode !== -1) {
  22524. for (const key in glyphsUnicodeMap) {
  22525. if (glyphsUnicodeMap[key] === unicode) {
  22526. return key;
  22527. }
  22528. }
  22529. }
  22530. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  22531. return name;
  22532. }
  22533. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  22534. const charCodeToGlyphId = Object.create(null);
  22535. let glyphId, charCode, baseEncoding;
  22536. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  22537. if (properties.isInternalFont) {
  22538. baseEncoding = builtInEncoding;
  22539. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22540. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22541. if (glyphId >= 0) {
  22542. charCodeToGlyphId[charCode] = glyphId;
  22543. } else {
  22544. charCodeToGlyphId[charCode] = 0;
  22545. }
  22546. }
  22547. } else if (properties.baseEncodingName) {
  22548. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22549. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22550. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22551. if (glyphId >= 0) {
  22552. charCodeToGlyphId[charCode] = glyphId;
  22553. } else {
  22554. charCodeToGlyphId[charCode] = 0;
  22555. }
  22556. }
  22557. } else if (isSymbolicFont) {
  22558. for (charCode in builtInEncoding) {
  22559. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  22560. }
  22561. } else {
  22562. baseEncoding = _encodings.StandardEncoding;
  22563. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22564. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22565. if (glyphId >= 0) {
  22566. charCodeToGlyphId[charCode] = glyphId;
  22567. } else {
  22568. charCodeToGlyphId[charCode] = 0;
  22569. }
  22570. }
  22571. }
  22572. const differences = properties.differences;
  22573. let glyphsUnicodeMap;
  22574. if (differences) {
  22575. for (charCode in differences) {
  22576. const glyphName = differences[charCode];
  22577. glyphId = glyphNames.indexOf(glyphName);
  22578. if (glyphId === -1) {
  22579. if (!glyphsUnicodeMap) {
  22580. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22581. }
  22582. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  22583. if (standardGlyphName !== glyphName) {
  22584. glyphId = glyphNames.indexOf(standardGlyphName);
  22585. }
  22586. }
  22587. if (glyphId >= 0) {
  22588. charCodeToGlyphId[charCode] = glyphId;
  22589. } else {
  22590. charCodeToGlyphId[charCode] = 0;
  22591. }
  22592. }
  22593. }
  22594. return charCodeToGlyphId;
  22595. }
  22596. function normalizeFontName(name) {
  22597. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  22598. }
  22599. /***/ }),
  22600. /* 39 */
  22601. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  22602. __w_pdfjs_require__.r(__webpack_exports__);
  22603. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  22604. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  22605. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  22606. /* harmony export */ });
  22607. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  22608. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  22609. return [
  22610. "A",
  22611. 0x0041,
  22612. "AE",
  22613. 0x00c6,
  22614. "AEacute",
  22615. 0x01fc,
  22616. "AEmacron",
  22617. 0x01e2,
  22618. "AEsmall",
  22619. 0xf7e6,
  22620. "Aacute",
  22621. 0x00c1,
  22622. "Aacutesmall",
  22623. 0xf7e1,
  22624. "Abreve",
  22625. 0x0102,
  22626. "Abreveacute",
  22627. 0x1eae,
  22628. "Abrevecyrillic",
  22629. 0x04d0,
  22630. "Abrevedotbelow",
  22631. 0x1eb6,
  22632. "Abrevegrave",
  22633. 0x1eb0,
  22634. "Abrevehookabove",
  22635. 0x1eb2,
  22636. "Abrevetilde",
  22637. 0x1eb4,
  22638. "Acaron",
  22639. 0x01cd,
  22640. "Acircle",
  22641. 0x24b6,
  22642. "Acircumflex",
  22643. 0x00c2,
  22644. "Acircumflexacute",
  22645. 0x1ea4,
  22646. "Acircumflexdotbelow",
  22647. 0x1eac,
  22648. "Acircumflexgrave",
  22649. 0x1ea6,
  22650. "Acircumflexhookabove",
  22651. 0x1ea8,
  22652. "Acircumflexsmall",
  22653. 0xf7e2,
  22654. "Acircumflextilde",
  22655. 0x1eaa,
  22656. "Acute",
  22657. 0xf6c9,
  22658. "Acutesmall",
  22659. 0xf7b4,
  22660. "Acyrillic",
  22661. 0x0410,
  22662. "Adblgrave",
  22663. 0x0200,
  22664. "Adieresis",
  22665. 0x00c4,
  22666. "Adieresiscyrillic",
  22667. 0x04d2,
  22668. "Adieresismacron",
  22669. 0x01de,
  22670. "Adieresissmall",
  22671. 0xf7e4,
  22672. "Adotbelow",
  22673. 0x1ea0,
  22674. "Adotmacron",
  22675. 0x01e0,
  22676. "Agrave",
  22677. 0x00c0,
  22678. "Agravesmall",
  22679. 0xf7e0,
  22680. "Ahookabove",
  22681. 0x1ea2,
  22682. "Aiecyrillic",
  22683. 0x04d4,
  22684. "Ainvertedbreve",
  22685. 0x0202,
  22686. "Alpha",
  22687. 0x0391,
  22688. "Alphatonos",
  22689. 0x0386,
  22690. "Amacron",
  22691. 0x0100,
  22692. "Amonospace",
  22693. 0xff21,
  22694. "Aogonek",
  22695. 0x0104,
  22696. "Aring",
  22697. 0x00c5,
  22698. "Aringacute",
  22699. 0x01fa,
  22700. "Aringbelow",
  22701. 0x1e00,
  22702. "Aringsmall",
  22703. 0xf7e5,
  22704. "Asmall",
  22705. 0xf761,
  22706. "Atilde",
  22707. 0x00c3,
  22708. "Atildesmall",
  22709. 0xf7e3,
  22710. "Aybarmenian",
  22711. 0x0531,
  22712. "B",
  22713. 0x0042,
  22714. "Bcircle",
  22715. 0x24b7,
  22716. "Bdotaccent",
  22717. 0x1e02,
  22718. "Bdotbelow",
  22719. 0x1e04,
  22720. "Becyrillic",
  22721. 0x0411,
  22722. "Benarmenian",
  22723. 0x0532,
  22724. "Beta",
  22725. 0x0392,
  22726. "Bhook",
  22727. 0x0181,
  22728. "Blinebelow",
  22729. 0x1e06,
  22730. "Bmonospace",
  22731. 0xff22,
  22732. "Brevesmall",
  22733. 0xf6f4,
  22734. "Bsmall",
  22735. 0xf762,
  22736. "Btopbar",
  22737. 0x0182,
  22738. "C",
  22739. 0x0043,
  22740. "Caarmenian",
  22741. 0x053e,
  22742. "Cacute",
  22743. 0x0106,
  22744. "Caron",
  22745. 0xf6ca,
  22746. "Caronsmall",
  22747. 0xf6f5,
  22748. "Ccaron",
  22749. 0x010c,
  22750. "Ccedilla",
  22751. 0x00c7,
  22752. "Ccedillaacute",
  22753. 0x1e08,
  22754. "Ccedillasmall",
  22755. 0xf7e7,
  22756. "Ccircle",
  22757. 0x24b8,
  22758. "Ccircumflex",
  22759. 0x0108,
  22760. "Cdot",
  22761. 0x010a,
  22762. "Cdotaccent",
  22763. 0x010a,
  22764. "Cedillasmall",
  22765. 0xf7b8,
  22766. "Chaarmenian",
  22767. 0x0549,
  22768. "Cheabkhasiancyrillic",
  22769. 0x04bc,
  22770. "Checyrillic",
  22771. 0x0427,
  22772. "Chedescenderabkhasiancyrillic",
  22773. 0x04be,
  22774. "Chedescendercyrillic",
  22775. 0x04b6,
  22776. "Chedieresiscyrillic",
  22777. 0x04f4,
  22778. "Cheharmenian",
  22779. 0x0543,
  22780. "Chekhakassiancyrillic",
  22781. 0x04cb,
  22782. "Cheverticalstrokecyrillic",
  22783. 0x04b8,
  22784. "Chi",
  22785. 0x03a7,
  22786. "Chook",
  22787. 0x0187,
  22788. "Circumflexsmall",
  22789. 0xf6f6,
  22790. "Cmonospace",
  22791. 0xff23,
  22792. "Coarmenian",
  22793. 0x0551,
  22794. "Csmall",
  22795. 0xf763,
  22796. "D",
  22797. 0x0044,
  22798. "DZ",
  22799. 0x01f1,
  22800. "DZcaron",
  22801. 0x01c4,
  22802. "Daarmenian",
  22803. 0x0534,
  22804. "Dafrican",
  22805. 0x0189,
  22806. "Dcaron",
  22807. 0x010e,
  22808. "Dcedilla",
  22809. 0x1e10,
  22810. "Dcircle",
  22811. 0x24b9,
  22812. "Dcircumflexbelow",
  22813. 0x1e12,
  22814. "Dcroat",
  22815. 0x0110,
  22816. "Ddotaccent",
  22817. 0x1e0a,
  22818. "Ddotbelow",
  22819. 0x1e0c,
  22820. "Decyrillic",
  22821. 0x0414,
  22822. "Deicoptic",
  22823. 0x03ee,
  22824. "Delta",
  22825. 0x2206,
  22826. "Deltagreek",
  22827. 0x0394,
  22828. "Dhook",
  22829. 0x018a,
  22830. "Dieresis",
  22831. 0xf6cb,
  22832. "DieresisAcute",
  22833. 0xf6cc,
  22834. "DieresisGrave",
  22835. 0xf6cd,
  22836. "Dieresissmall",
  22837. 0xf7a8,
  22838. "Digammagreek",
  22839. 0x03dc,
  22840. "Djecyrillic",
  22841. 0x0402,
  22842. "Dlinebelow",
  22843. 0x1e0e,
  22844. "Dmonospace",
  22845. 0xff24,
  22846. "Dotaccentsmall",
  22847. 0xf6f7,
  22848. "Dslash",
  22849. 0x0110,
  22850. "Dsmall",
  22851. 0xf764,
  22852. "Dtopbar",
  22853. 0x018b,
  22854. "Dz",
  22855. 0x01f2,
  22856. "Dzcaron",
  22857. 0x01c5,
  22858. "Dzeabkhasiancyrillic",
  22859. 0x04e0,
  22860. "Dzecyrillic",
  22861. 0x0405,
  22862. "Dzhecyrillic",
  22863. 0x040f,
  22864. "E",
  22865. 0x0045,
  22866. "Eacute",
  22867. 0x00c9,
  22868. "Eacutesmall",
  22869. 0xf7e9,
  22870. "Ebreve",
  22871. 0x0114,
  22872. "Ecaron",
  22873. 0x011a,
  22874. "Ecedillabreve",
  22875. 0x1e1c,
  22876. "Echarmenian",
  22877. 0x0535,
  22878. "Ecircle",
  22879. 0x24ba,
  22880. "Ecircumflex",
  22881. 0x00ca,
  22882. "Ecircumflexacute",
  22883. 0x1ebe,
  22884. "Ecircumflexbelow",
  22885. 0x1e18,
  22886. "Ecircumflexdotbelow",
  22887. 0x1ec6,
  22888. "Ecircumflexgrave",
  22889. 0x1ec0,
  22890. "Ecircumflexhookabove",
  22891. 0x1ec2,
  22892. "Ecircumflexsmall",
  22893. 0xf7ea,
  22894. "Ecircumflextilde",
  22895. 0x1ec4,
  22896. "Ecyrillic",
  22897. 0x0404,
  22898. "Edblgrave",
  22899. 0x0204,
  22900. "Edieresis",
  22901. 0x00cb,
  22902. "Edieresissmall",
  22903. 0xf7eb,
  22904. "Edot",
  22905. 0x0116,
  22906. "Edotaccent",
  22907. 0x0116,
  22908. "Edotbelow",
  22909. 0x1eb8,
  22910. "Efcyrillic",
  22911. 0x0424,
  22912. "Egrave",
  22913. 0x00c8,
  22914. "Egravesmall",
  22915. 0xf7e8,
  22916. "Eharmenian",
  22917. 0x0537,
  22918. "Ehookabove",
  22919. 0x1eba,
  22920. "Eightroman",
  22921. 0x2167,
  22922. "Einvertedbreve",
  22923. 0x0206,
  22924. "Eiotifiedcyrillic",
  22925. 0x0464,
  22926. "Elcyrillic",
  22927. 0x041b,
  22928. "Elevenroman",
  22929. 0x216a,
  22930. "Emacron",
  22931. 0x0112,
  22932. "Emacronacute",
  22933. 0x1e16,
  22934. "Emacrongrave",
  22935. 0x1e14,
  22936. "Emcyrillic",
  22937. 0x041c,
  22938. "Emonospace",
  22939. 0xff25,
  22940. "Encyrillic",
  22941. 0x041d,
  22942. "Endescendercyrillic",
  22943. 0x04a2,
  22944. "Eng",
  22945. 0x014a,
  22946. "Enghecyrillic",
  22947. 0x04a4,
  22948. "Enhookcyrillic",
  22949. 0x04c7,
  22950. "Eogonek",
  22951. 0x0118,
  22952. "Eopen",
  22953. 0x0190,
  22954. "Epsilon",
  22955. 0x0395,
  22956. "Epsilontonos",
  22957. 0x0388,
  22958. "Ercyrillic",
  22959. 0x0420,
  22960. "Ereversed",
  22961. 0x018e,
  22962. "Ereversedcyrillic",
  22963. 0x042d,
  22964. "Escyrillic",
  22965. 0x0421,
  22966. "Esdescendercyrillic",
  22967. 0x04aa,
  22968. "Esh",
  22969. 0x01a9,
  22970. "Esmall",
  22971. 0xf765,
  22972. "Eta",
  22973. 0x0397,
  22974. "Etarmenian",
  22975. 0x0538,
  22976. "Etatonos",
  22977. 0x0389,
  22978. "Eth",
  22979. 0x00d0,
  22980. "Ethsmall",
  22981. 0xf7f0,
  22982. "Etilde",
  22983. 0x1ebc,
  22984. "Etildebelow",
  22985. 0x1e1a,
  22986. "Euro",
  22987. 0x20ac,
  22988. "Ezh",
  22989. 0x01b7,
  22990. "Ezhcaron",
  22991. 0x01ee,
  22992. "Ezhreversed",
  22993. 0x01b8,
  22994. "F",
  22995. 0x0046,
  22996. "Fcircle",
  22997. 0x24bb,
  22998. "Fdotaccent",
  22999. 0x1e1e,
  23000. "Feharmenian",
  23001. 0x0556,
  23002. "Feicoptic",
  23003. 0x03e4,
  23004. "Fhook",
  23005. 0x0191,
  23006. "Fitacyrillic",
  23007. 0x0472,
  23008. "Fiveroman",
  23009. 0x2164,
  23010. "Fmonospace",
  23011. 0xff26,
  23012. "Fourroman",
  23013. 0x2163,
  23014. "Fsmall",
  23015. 0xf766,
  23016. "G",
  23017. 0x0047,
  23018. "GBsquare",
  23019. 0x3387,
  23020. "Gacute",
  23021. 0x01f4,
  23022. "Gamma",
  23023. 0x0393,
  23024. "Gammaafrican",
  23025. 0x0194,
  23026. "Gangiacoptic",
  23027. 0x03ea,
  23028. "Gbreve",
  23029. 0x011e,
  23030. "Gcaron",
  23031. 0x01e6,
  23032. "Gcedilla",
  23033. 0x0122,
  23034. "Gcircle",
  23035. 0x24bc,
  23036. "Gcircumflex",
  23037. 0x011c,
  23038. "Gcommaaccent",
  23039. 0x0122,
  23040. "Gdot",
  23041. 0x0120,
  23042. "Gdotaccent",
  23043. 0x0120,
  23044. "Gecyrillic",
  23045. 0x0413,
  23046. "Ghadarmenian",
  23047. 0x0542,
  23048. "Ghemiddlehookcyrillic",
  23049. 0x0494,
  23050. "Ghestrokecyrillic",
  23051. 0x0492,
  23052. "Gheupturncyrillic",
  23053. 0x0490,
  23054. "Ghook",
  23055. 0x0193,
  23056. "Gimarmenian",
  23057. 0x0533,
  23058. "Gjecyrillic",
  23059. 0x0403,
  23060. "Gmacron",
  23061. 0x1e20,
  23062. "Gmonospace",
  23063. 0xff27,
  23064. "Grave",
  23065. 0xf6ce,
  23066. "Gravesmall",
  23067. 0xf760,
  23068. "Gsmall",
  23069. 0xf767,
  23070. "Gsmallhook",
  23071. 0x029b,
  23072. "Gstroke",
  23073. 0x01e4,
  23074. "H",
  23075. 0x0048,
  23076. "H18533",
  23077. 0x25cf,
  23078. "H18543",
  23079. 0x25aa,
  23080. "H18551",
  23081. 0x25ab,
  23082. "H22073",
  23083. 0x25a1,
  23084. "HPsquare",
  23085. 0x33cb,
  23086. "Haabkhasiancyrillic",
  23087. 0x04a8,
  23088. "Hadescendercyrillic",
  23089. 0x04b2,
  23090. "Hardsigncyrillic",
  23091. 0x042a,
  23092. "Hbar",
  23093. 0x0126,
  23094. "Hbrevebelow",
  23095. 0x1e2a,
  23096. "Hcedilla",
  23097. 0x1e28,
  23098. "Hcircle",
  23099. 0x24bd,
  23100. "Hcircumflex",
  23101. 0x0124,
  23102. "Hdieresis",
  23103. 0x1e26,
  23104. "Hdotaccent",
  23105. 0x1e22,
  23106. "Hdotbelow",
  23107. 0x1e24,
  23108. "Hmonospace",
  23109. 0xff28,
  23110. "Hoarmenian",
  23111. 0x0540,
  23112. "Horicoptic",
  23113. 0x03e8,
  23114. "Hsmall",
  23115. 0xf768,
  23116. "Hungarumlaut",
  23117. 0xf6cf,
  23118. "Hungarumlautsmall",
  23119. 0xf6f8,
  23120. "Hzsquare",
  23121. 0x3390,
  23122. "I",
  23123. 0x0049,
  23124. "IAcyrillic",
  23125. 0x042f,
  23126. "IJ",
  23127. 0x0132,
  23128. "IUcyrillic",
  23129. 0x042e,
  23130. "Iacute",
  23131. 0x00cd,
  23132. "Iacutesmall",
  23133. 0xf7ed,
  23134. "Ibreve",
  23135. 0x012c,
  23136. "Icaron",
  23137. 0x01cf,
  23138. "Icircle",
  23139. 0x24be,
  23140. "Icircumflex",
  23141. 0x00ce,
  23142. "Icircumflexsmall",
  23143. 0xf7ee,
  23144. "Icyrillic",
  23145. 0x0406,
  23146. "Idblgrave",
  23147. 0x0208,
  23148. "Idieresis",
  23149. 0x00cf,
  23150. "Idieresisacute",
  23151. 0x1e2e,
  23152. "Idieresiscyrillic",
  23153. 0x04e4,
  23154. "Idieresissmall",
  23155. 0xf7ef,
  23156. "Idot",
  23157. 0x0130,
  23158. "Idotaccent",
  23159. 0x0130,
  23160. "Idotbelow",
  23161. 0x1eca,
  23162. "Iebrevecyrillic",
  23163. 0x04d6,
  23164. "Iecyrillic",
  23165. 0x0415,
  23166. "Ifraktur",
  23167. 0x2111,
  23168. "Igrave",
  23169. 0x00cc,
  23170. "Igravesmall",
  23171. 0xf7ec,
  23172. "Ihookabove",
  23173. 0x1ec8,
  23174. "Iicyrillic",
  23175. 0x0418,
  23176. "Iinvertedbreve",
  23177. 0x020a,
  23178. "Iishortcyrillic",
  23179. 0x0419,
  23180. "Imacron",
  23181. 0x012a,
  23182. "Imacroncyrillic",
  23183. 0x04e2,
  23184. "Imonospace",
  23185. 0xff29,
  23186. "Iniarmenian",
  23187. 0x053b,
  23188. "Iocyrillic",
  23189. 0x0401,
  23190. "Iogonek",
  23191. 0x012e,
  23192. "Iota",
  23193. 0x0399,
  23194. "Iotaafrican",
  23195. 0x0196,
  23196. "Iotadieresis",
  23197. 0x03aa,
  23198. "Iotatonos",
  23199. 0x038a,
  23200. "Ismall",
  23201. 0xf769,
  23202. "Istroke",
  23203. 0x0197,
  23204. "Itilde",
  23205. 0x0128,
  23206. "Itildebelow",
  23207. 0x1e2c,
  23208. "Izhitsacyrillic",
  23209. 0x0474,
  23210. "Izhitsadblgravecyrillic",
  23211. 0x0476,
  23212. "J",
  23213. 0x004a,
  23214. "Jaarmenian",
  23215. 0x0541,
  23216. "Jcircle",
  23217. 0x24bf,
  23218. "Jcircumflex",
  23219. 0x0134,
  23220. "Jecyrillic",
  23221. 0x0408,
  23222. "Jheharmenian",
  23223. 0x054b,
  23224. "Jmonospace",
  23225. 0xff2a,
  23226. "Jsmall",
  23227. 0xf76a,
  23228. "K",
  23229. 0x004b,
  23230. "KBsquare",
  23231. 0x3385,
  23232. "KKsquare",
  23233. 0x33cd,
  23234. "Kabashkircyrillic",
  23235. 0x04a0,
  23236. "Kacute",
  23237. 0x1e30,
  23238. "Kacyrillic",
  23239. 0x041a,
  23240. "Kadescendercyrillic",
  23241. 0x049a,
  23242. "Kahookcyrillic",
  23243. 0x04c3,
  23244. "Kappa",
  23245. 0x039a,
  23246. "Kastrokecyrillic",
  23247. 0x049e,
  23248. "Kaverticalstrokecyrillic",
  23249. 0x049c,
  23250. "Kcaron",
  23251. 0x01e8,
  23252. "Kcedilla",
  23253. 0x0136,
  23254. "Kcircle",
  23255. 0x24c0,
  23256. "Kcommaaccent",
  23257. 0x0136,
  23258. "Kdotbelow",
  23259. 0x1e32,
  23260. "Keharmenian",
  23261. 0x0554,
  23262. "Kenarmenian",
  23263. 0x053f,
  23264. "Khacyrillic",
  23265. 0x0425,
  23266. "Kheicoptic",
  23267. 0x03e6,
  23268. "Khook",
  23269. 0x0198,
  23270. "Kjecyrillic",
  23271. 0x040c,
  23272. "Klinebelow",
  23273. 0x1e34,
  23274. "Kmonospace",
  23275. 0xff2b,
  23276. "Koppacyrillic",
  23277. 0x0480,
  23278. "Koppagreek",
  23279. 0x03de,
  23280. "Ksicyrillic",
  23281. 0x046e,
  23282. "Ksmall",
  23283. 0xf76b,
  23284. "L",
  23285. 0x004c,
  23286. "LJ",
  23287. 0x01c7,
  23288. "LL",
  23289. 0xf6bf,
  23290. "Lacute",
  23291. 0x0139,
  23292. "Lambda",
  23293. 0x039b,
  23294. "Lcaron",
  23295. 0x013d,
  23296. "Lcedilla",
  23297. 0x013b,
  23298. "Lcircle",
  23299. 0x24c1,
  23300. "Lcircumflexbelow",
  23301. 0x1e3c,
  23302. "Lcommaaccent",
  23303. 0x013b,
  23304. "Ldot",
  23305. 0x013f,
  23306. "Ldotaccent",
  23307. 0x013f,
  23308. "Ldotbelow",
  23309. 0x1e36,
  23310. "Ldotbelowmacron",
  23311. 0x1e38,
  23312. "Liwnarmenian",
  23313. 0x053c,
  23314. "Lj",
  23315. 0x01c8,
  23316. "Ljecyrillic",
  23317. 0x0409,
  23318. "Llinebelow",
  23319. 0x1e3a,
  23320. "Lmonospace",
  23321. 0xff2c,
  23322. "Lslash",
  23323. 0x0141,
  23324. "Lslashsmall",
  23325. 0xf6f9,
  23326. "Lsmall",
  23327. 0xf76c,
  23328. "M",
  23329. 0x004d,
  23330. "MBsquare",
  23331. 0x3386,
  23332. "Macron",
  23333. 0xf6d0,
  23334. "Macronsmall",
  23335. 0xf7af,
  23336. "Macute",
  23337. 0x1e3e,
  23338. "Mcircle",
  23339. 0x24c2,
  23340. "Mdotaccent",
  23341. 0x1e40,
  23342. "Mdotbelow",
  23343. 0x1e42,
  23344. "Menarmenian",
  23345. 0x0544,
  23346. "Mmonospace",
  23347. 0xff2d,
  23348. "Msmall",
  23349. 0xf76d,
  23350. "Mturned",
  23351. 0x019c,
  23352. "Mu",
  23353. 0x039c,
  23354. "N",
  23355. 0x004e,
  23356. "NJ",
  23357. 0x01ca,
  23358. "Nacute",
  23359. 0x0143,
  23360. "Ncaron",
  23361. 0x0147,
  23362. "Ncedilla",
  23363. 0x0145,
  23364. "Ncircle",
  23365. 0x24c3,
  23366. "Ncircumflexbelow",
  23367. 0x1e4a,
  23368. "Ncommaaccent",
  23369. 0x0145,
  23370. "Ndotaccent",
  23371. 0x1e44,
  23372. "Ndotbelow",
  23373. 0x1e46,
  23374. "Nhookleft",
  23375. 0x019d,
  23376. "Nineroman",
  23377. 0x2168,
  23378. "Nj",
  23379. 0x01cb,
  23380. "Njecyrillic",
  23381. 0x040a,
  23382. "Nlinebelow",
  23383. 0x1e48,
  23384. "Nmonospace",
  23385. 0xff2e,
  23386. "Nowarmenian",
  23387. 0x0546,
  23388. "Nsmall",
  23389. 0xf76e,
  23390. "Ntilde",
  23391. 0x00d1,
  23392. "Ntildesmall",
  23393. 0xf7f1,
  23394. "Nu",
  23395. 0x039d,
  23396. "O",
  23397. 0x004f,
  23398. "OE",
  23399. 0x0152,
  23400. "OEsmall",
  23401. 0xf6fa,
  23402. "Oacute",
  23403. 0x00d3,
  23404. "Oacutesmall",
  23405. 0xf7f3,
  23406. "Obarredcyrillic",
  23407. 0x04e8,
  23408. "Obarreddieresiscyrillic",
  23409. 0x04ea,
  23410. "Obreve",
  23411. 0x014e,
  23412. "Ocaron",
  23413. 0x01d1,
  23414. "Ocenteredtilde",
  23415. 0x019f,
  23416. "Ocircle",
  23417. 0x24c4,
  23418. "Ocircumflex",
  23419. 0x00d4,
  23420. "Ocircumflexacute",
  23421. 0x1ed0,
  23422. "Ocircumflexdotbelow",
  23423. 0x1ed8,
  23424. "Ocircumflexgrave",
  23425. 0x1ed2,
  23426. "Ocircumflexhookabove",
  23427. 0x1ed4,
  23428. "Ocircumflexsmall",
  23429. 0xf7f4,
  23430. "Ocircumflextilde",
  23431. 0x1ed6,
  23432. "Ocyrillic",
  23433. 0x041e,
  23434. "Odblacute",
  23435. 0x0150,
  23436. "Odblgrave",
  23437. 0x020c,
  23438. "Odieresis",
  23439. 0x00d6,
  23440. "Odieresiscyrillic",
  23441. 0x04e6,
  23442. "Odieresissmall",
  23443. 0xf7f6,
  23444. "Odotbelow",
  23445. 0x1ecc,
  23446. "Ogoneksmall",
  23447. 0xf6fb,
  23448. "Ograve",
  23449. 0x00d2,
  23450. "Ogravesmall",
  23451. 0xf7f2,
  23452. "Oharmenian",
  23453. 0x0555,
  23454. "Ohm",
  23455. 0x2126,
  23456. "Ohookabove",
  23457. 0x1ece,
  23458. "Ohorn",
  23459. 0x01a0,
  23460. "Ohornacute",
  23461. 0x1eda,
  23462. "Ohorndotbelow",
  23463. 0x1ee2,
  23464. "Ohorngrave",
  23465. 0x1edc,
  23466. "Ohornhookabove",
  23467. 0x1ede,
  23468. "Ohorntilde",
  23469. 0x1ee0,
  23470. "Ohungarumlaut",
  23471. 0x0150,
  23472. "Oi",
  23473. 0x01a2,
  23474. "Oinvertedbreve",
  23475. 0x020e,
  23476. "Omacron",
  23477. 0x014c,
  23478. "Omacronacute",
  23479. 0x1e52,
  23480. "Omacrongrave",
  23481. 0x1e50,
  23482. "Omega",
  23483. 0x2126,
  23484. "Omegacyrillic",
  23485. 0x0460,
  23486. "Omegagreek",
  23487. 0x03a9,
  23488. "Omegaroundcyrillic",
  23489. 0x047a,
  23490. "Omegatitlocyrillic",
  23491. 0x047c,
  23492. "Omegatonos",
  23493. 0x038f,
  23494. "Omicron",
  23495. 0x039f,
  23496. "Omicrontonos",
  23497. 0x038c,
  23498. "Omonospace",
  23499. 0xff2f,
  23500. "Oneroman",
  23501. 0x2160,
  23502. "Oogonek",
  23503. 0x01ea,
  23504. "Oogonekmacron",
  23505. 0x01ec,
  23506. "Oopen",
  23507. 0x0186,
  23508. "Oslash",
  23509. 0x00d8,
  23510. "Oslashacute",
  23511. 0x01fe,
  23512. "Oslashsmall",
  23513. 0xf7f8,
  23514. "Osmall",
  23515. 0xf76f,
  23516. "Ostrokeacute",
  23517. 0x01fe,
  23518. "Otcyrillic",
  23519. 0x047e,
  23520. "Otilde",
  23521. 0x00d5,
  23522. "Otildeacute",
  23523. 0x1e4c,
  23524. "Otildedieresis",
  23525. 0x1e4e,
  23526. "Otildesmall",
  23527. 0xf7f5,
  23528. "P",
  23529. 0x0050,
  23530. "Pacute",
  23531. 0x1e54,
  23532. "Pcircle",
  23533. 0x24c5,
  23534. "Pdotaccent",
  23535. 0x1e56,
  23536. "Pecyrillic",
  23537. 0x041f,
  23538. "Peharmenian",
  23539. 0x054a,
  23540. "Pemiddlehookcyrillic",
  23541. 0x04a6,
  23542. "Phi",
  23543. 0x03a6,
  23544. "Phook",
  23545. 0x01a4,
  23546. "Pi",
  23547. 0x03a0,
  23548. "Piwrarmenian",
  23549. 0x0553,
  23550. "Pmonospace",
  23551. 0xff30,
  23552. "Psi",
  23553. 0x03a8,
  23554. "Psicyrillic",
  23555. 0x0470,
  23556. "Psmall",
  23557. 0xf770,
  23558. "Q",
  23559. 0x0051,
  23560. "Qcircle",
  23561. 0x24c6,
  23562. "Qmonospace",
  23563. 0xff31,
  23564. "Qsmall",
  23565. 0xf771,
  23566. "R",
  23567. 0x0052,
  23568. "Raarmenian",
  23569. 0x054c,
  23570. "Racute",
  23571. 0x0154,
  23572. "Rcaron",
  23573. 0x0158,
  23574. "Rcedilla",
  23575. 0x0156,
  23576. "Rcircle",
  23577. 0x24c7,
  23578. "Rcommaaccent",
  23579. 0x0156,
  23580. "Rdblgrave",
  23581. 0x0210,
  23582. "Rdotaccent",
  23583. 0x1e58,
  23584. "Rdotbelow",
  23585. 0x1e5a,
  23586. "Rdotbelowmacron",
  23587. 0x1e5c,
  23588. "Reharmenian",
  23589. 0x0550,
  23590. "Rfraktur",
  23591. 0x211c,
  23592. "Rho",
  23593. 0x03a1,
  23594. "Ringsmall",
  23595. 0xf6fc,
  23596. "Rinvertedbreve",
  23597. 0x0212,
  23598. "Rlinebelow",
  23599. 0x1e5e,
  23600. "Rmonospace",
  23601. 0xff32,
  23602. "Rsmall",
  23603. 0xf772,
  23604. "Rsmallinverted",
  23605. 0x0281,
  23606. "Rsmallinvertedsuperior",
  23607. 0x02b6,
  23608. "S",
  23609. 0x0053,
  23610. "SF010000",
  23611. 0x250c,
  23612. "SF020000",
  23613. 0x2514,
  23614. "SF030000",
  23615. 0x2510,
  23616. "SF040000",
  23617. 0x2518,
  23618. "SF050000",
  23619. 0x253c,
  23620. "SF060000",
  23621. 0x252c,
  23622. "SF070000",
  23623. 0x2534,
  23624. "SF080000",
  23625. 0x251c,
  23626. "SF090000",
  23627. 0x2524,
  23628. "SF100000",
  23629. 0x2500,
  23630. "SF110000",
  23631. 0x2502,
  23632. "SF190000",
  23633. 0x2561,
  23634. "SF200000",
  23635. 0x2562,
  23636. "SF210000",
  23637. 0x2556,
  23638. "SF220000",
  23639. 0x2555,
  23640. "SF230000",
  23641. 0x2563,
  23642. "SF240000",
  23643. 0x2551,
  23644. "SF250000",
  23645. 0x2557,
  23646. "SF260000",
  23647. 0x255d,
  23648. "SF270000",
  23649. 0x255c,
  23650. "SF280000",
  23651. 0x255b,
  23652. "SF360000",
  23653. 0x255e,
  23654. "SF370000",
  23655. 0x255f,
  23656. "SF380000",
  23657. 0x255a,
  23658. "SF390000",
  23659. 0x2554,
  23660. "SF400000",
  23661. 0x2569,
  23662. "SF410000",
  23663. 0x2566,
  23664. "SF420000",
  23665. 0x2560,
  23666. "SF430000",
  23667. 0x2550,
  23668. "SF440000",
  23669. 0x256c,
  23670. "SF450000",
  23671. 0x2567,
  23672. "SF460000",
  23673. 0x2568,
  23674. "SF470000",
  23675. 0x2564,
  23676. "SF480000",
  23677. 0x2565,
  23678. "SF490000",
  23679. 0x2559,
  23680. "SF500000",
  23681. 0x2558,
  23682. "SF510000",
  23683. 0x2552,
  23684. "SF520000",
  23685. 0x2553,
  23686. "SF530000",
  23687. 0x256b,
  23688. "SF540000",
  23689. 0x256a,
  23690. "Sacute",
  23691. 0x015a,
  23692. "Sacutedotaccent",
  23693. 0x1e64,
  23694. "Sampigreek",
  23695. 0x03e0,
  23696. "Scaron",
  23697. 0x0160,
  23698. "Scarondotaccent",
  23699. 0x1e66,
  23700. "Scaronsmall",
  23701. 0xf6fd,
  23702. "Scedilla",
  23703. 0x015e,
  23704. "Schwa",
  23705. 0x018f,
  23706. "Schwacyrillic",
  23707. 0x04d8,
  23708. "Schwadieresiscyrillic",
  23709. 0x04da,
  23710. "Scircle",
  23711. 0x24c8,
  23712. "Scircumflex",
  23713. 0x015c,
  23714. "Scommaaccent",
  23715. 0x0218,
  23716. "Sdotaccent",
  23717. 0x1e60,
  23718. "Sdotbelow",
  23719. 0x1e62,
  23720. "Sdotbelowdotaccent",
  23721. 0x1e68,
  23722. "Seharmenian",
  23723. 0x054d,
  23724. "Sevenroman",
  23725. 0x2166,
  23726. "Shaarmenian",
  23727. 0x0547,
  23728. "Shacyrillic",
  23729. 0x0428,
  23730. "Shchacyrillic",
  23731. 0x0429,
  23732. "Sheicoptic",
  23733. 0x03e2,
  23734. "Shhacyrillic",
  23735. 0x04ba,
  23736. "Shimacoptic",
  23737. 0x03ec,
  23738. "Sigma",
  23739. 0x03a3,
  23740. "Sixroman",
  23741. 0x2165,
  23742. "Smonospace",
  23743. 0xff33,
  23744. "Softsigncyrillic",
  23745. 0x042c,
  23746. "Ssmall",
  23747. 0xf773,
  23748. "Stigmagreek",
  23749. 0x03da,
  23750. "T",
  23751. 0x0054,
  23752. "Tau",
  23753. 0x03a4,
  23754. "Tbar",
  23755. 0x0166,
  23756. "Tcaron",
  23757. 0x0164,
  23758. "Tcedilla",
  23759. 0x0162,
  23760. "Tcircle",
  23761. 0x24c9,
  23762. "Tcircumflexbelow",
  23763. 0x1e70,
  23764. "Tcommaaccent",
  23765. 0x0162,
  23766. "Tdotaccent",
  23767. 0x1e6a,
  23768. "Tdotbelow",
  23769. 0x1e6c,
  23770. "Tecyrillic",
  23771. 0x0422,
  23772. "Tedescendercyrillic",
  23773. 0x04ac,
  23774. "Tenroman",
  23775. 0x2169,
  23776. "Tetsecyrillic",
  23777. 0x04b4,
  23778. "Theta",
  23779. 0x0398,
  23780. "Thook",
  23781. 0x01ac,
  23782. "Thorn",
  23783. 0x00de,
  23784. "Thornsmall",
  23785. 0xf7fe,
  23786. "Threeroman",
  23787. 0x2162,
  23788. "Tildesmall",
  23789. 0xf6fe,
  23790. "Tiwnarmenian",
  23791. 0x054f,
  23792. "Tlinebelow",
  23793. 0x1e6e,
  23794. "Tmonospace",
  23795. 0xff34,
  23796. "Toarmenian",
  23797. 0x0539,
  23798. "Tonefive",
  23799. 0x01bc,
  23800. "Tonesix",
  23801. 0x0184,
  23802. "Tonetwo",
  23803. 0x01a7,
  23804. "Tretroflexhook",
  23805. 0x01ae,
  23806. "Tsecyrillic",
  23807. 0x0426,
  23808. "Tshecyrillic",
  23809. 0x040b,
  23810. "Tsmall",
  23811. 0xf774,
  23812. "Twelveroman",
  23813. 0x216b,
  23814. "Tworoman",
  23815. 0x2161,
  23816. "U",
  23817. 0x0055,
  23818. "Uacute",
  23819. 0x00da,
  23820. "Uacutesmall",
  23821. 0xf7fa,
  23822. "Ubreve",
  23823. 0x016c,
  23824. "Ucaron",
  23825. 0x01d3,
  23826. "Ucircle",
  23827. 0x24ca,
  23828. "Ucircumflex",
  23829. 0x00db,
  23830. "Ucircumflexbelow",
  23831. 0x1e76,
  23832. "Ucircumflexsmall",
  23833. 0xf7fb,
  23834. "Ucyrillic",
  23835. 0x0423,
  23836. "Udblacute",
  23837. 0x0170,
  23838. "Udblgrave",
  23839. 0x0214,
  23840. "Udieresis",
  23841. 0x00dc,
  23842. "Udieresisacute",
  23843. 0x01d7,
  23844. "Udieresisbelow",
  23845. 0x1e72,
  23846. "Udieresiscaron",
  23847. 0x01d9,
  23848. "Udieresiscyrillic",
  23849. 0x04f0,
  23850. "Udieresisgrave",
  23851. 0x01db,
  23852. "Udieresismacron",
  23853. 0x01d5,
  23854. "Udieresissmall",
  23855. 0xf7fc,
  23856. "Udotbelow",
  23857. 0x1ee4,
  23858. "Ugrave",
  23859. 0x00d9,
  23860. "Ugravesmall",
  23861. 0xf7f9,
  23862. "Uhookabove",
  23863. 0x1ee6,
  23864. "Uhorn",
  23865. 0x01af,
  23866. "Uhornacute",
  23867. 0x1ee8,
  23868. "Uhorndotbelow",
  23869. 0x1ef0,
  23870. "Uhorngrave",
  23871. 0x1eea,
  23872. "Uhornhookabove",
  23873. 0x1eec,
  23874. "Uhorntilde",
  23875. 0x1eee,
  23876. "Uhungarumlaut",
  23877. 0x0170,
  23878. "Uhungarumlautcyrillic",
  23879. 0x04f2,
  23880. "Uinvertedbreve",
  23881. 0x0216,
  23882. "Ukcyrillic",
  23883. 0x0478,
  23884. "Umacron",
  23885. 0x016a,
  23886. "Umacroncyrillic",
  23887. 0x04ee,
  23888. "Umacrondieresis",
  23889. 0x1e7a,
  23890. "Umonospace",
  23891. 0xff35,
  23892. "Uogonek",
  23893. 0x0172,
  23894. "Upsilon",
  23895. 0x03a5,
  23896. "Upsilon1",
  23897. 0x03d2,
  23898. "Upsilonacutehooksymbolgreek",
  23899. 0x03d3,
  23900. "Upsilonafrican",
  23901. 0x01b1,
  23902. "Upsilondieresis",
  23903. 0x03ab,
  23904. "Upsilondieresishooksymbolgreek",
  23905. 0x03d4,
  23906. "Upsilonhooksymbol",
  23907. 0x03d2,
  23908. "Upsilontonos",
  23909. 0x038e,
  23910. "Uring",
  23911. 0x016e,
  23912. "Ushortcyrillic",
  23913. 0x040e,
  23914. "Usmall",
  23915. 0xf775,
  23916. "Ustraightcyrillic",
  23917. 0x04ae,
  23918. "Ustraightstrokecyrillic",
  23919. 0x04b0,
  23920. "Utilde",
  23921. 0x0168,
  23922. "Utildeacute",
  23923. 0x1e78,
  23924. "Utildebelow",
  23925. 0x1e74,
  23926. "V",
  23927. 0x0056,
  23928. "Vcircle",
  23929. 0x24cb,
  23930. "Vdotbelow",
  23931. 0x1e7e,
  23932. "Vecyrillic",
  23933. 0x0412,
  23934. "Vewarmenian",
  23935. 0x054e,
  23936. "Vhook",
  23937. 0x01b2,
  23938. "Vmonospace",
  23939. 0xff36,
  23940. "Voarmenian",
  23941. 0x0548,
  23942. "Vsmall",
  23943. 0xf776,
  23944. "Vtilde",
  23945. 0x1e7c,
  23946. "W",
  23947. 0x0057,
  23948. "Wacute",
  23949. 0x1e82,
  23950. "Wcircle",
  23951. 0x24cc,
  23952. "Wcircumflex",
  23953. 0x0174,
  23954. "Wdieresis",
  23955. 0x1e84,
  23956. "Wdotaccent",
  23957. 0x1e86,
  23958. "Wdotbelow",
  23959. 0x1e88,
  23960. "Wgrave",
  23961. 0x1e80,
  23962. "Wmonospace",
  23963. 0xff37,
  23964. "Wsmall",
  23965. 0xf777,
  23966. "X",
  23967. 0x0058,
  23968. "Xcircle",
  23969. 0x24cd,
  23970. "Xdieresis",
  23971. 0x1e8c,
  23972. "Xdotaccent",
  23973. 0x1e8a,
  23974. "Xeharmenian",
  23975. 0x053d,
  23976. "Xi",
  23977. 0x039e,
  23978. "Xmonospace",
  23979. 0xff38,
  23980. "Xsmall",
  23981. 0xf778,
  23982. "Y",
  23983. 0x0059,
  23984. "Yacute",
  23985. 0x00dd,
  23986. "Yacutesmall",
  23987. 0xf7fd,
  23988. "Yatcyrillic",
  23989. 0x0462,
  23990. "Ycircle",
  23991. 0x24ce,
  23992. "Ycircumflex",
  23993. 0x0176,
  23994. "Ydieresis",
  23995. 0x0178,
  23996. "Ydieresissmall",
  23997. 0xf7ff,
  23998. "Ydotaccent",
  23999. 0x1e8e,
  24000. "Ydotbelow",
  24001. 0x1ef4,
  24002. "Yericyrillic",
  24003. 0x042b,
  24004. "Yerudieresiscyrillic",
  24005. 0x04f8,
  24006. "Ygrave",
  24007. 0x1ef2,
  24008. "Yhook",
  24009. 0x01b3,
  24010. "Yhookabove",
  24011. 0x1ef6,
  24012. "Yiarmenian",
  24013. 0x0545,
  24014. "Yicyrillic",
  24015. 0x0407,
  24016. "Yiwnarmenian",
  24017. 0x0552,
  24018. "Ymonospace",
  24019. 0xff39,
  24020. "Ysmall",
  24021. 0xf779,
  24022. "Ytilde",
  24023. 0x1ef8,
  24024. "Yusbigcyrillic",
  24025. 0x046a,
  24026. "Yusbigiotifiedcyrillic",
  24027. 0x046c,
  24028. "Yuslittlecyrillic",
  24029. 0x0466,
  24030. "Yuslittleiotifiedcyrillic",
  24031. 0x0468,
  24032. "Z",
  24033. 0x005a,
  24034. "Zaarmenian",
  24035. 0x0536,
  24036. "Zacute",
  24037. 0x0179,
  24038. "Zcaron",
  24039. 0x017d,
  24040. "Zcaronsmall",
  24041. 0xf6ff,
  24042. "Zcircle",
  24043. 0x24cf,
  24044. "Zcircumflex",
  24045. 0x1e90,
  24046. "Zdot",
  24047. 0x017b,
  24048. "Zdotaccent",
  24049. 0x017b,
  24050. "Zdotbelow",
  24051. 0x1e92,
  24052. "Zecyrillic",
  24053. 0x0417,
  24054. "Zedescendercyrillic",
  24055. 0x0498,
  24056. "Zedieresiscyrillic",
  24057. 0x04de,
  24058. "Zeta",
  24059. 0x0396,
  24060. "Zhearmenian",
  24061. 0x053a,
  24062. "Zhebrevecyrillic",
  24063. 0x04c1,
  24064. "Zhecyrillic",
  24065. 0x0416,
  24066. "Zhedescendercyrillic",
  24067. 0x0496,
  24068. "Zhedieresiscyrillic",
  24069. 0x04dc,
  24070. "Zlinebelow",
  24071. 0x1e94,
  24072. "Zmonospace",
  24073. 0xff3a,
  24074. "Zsmall",
  24075. 0xf77a,
  24076. "Zstroke",
  24077. 0x01b5,
  24078. "a",
  24079. 0x0061,
  24080. "aabengali",
  24081. 0x0986,
  24082. "aacute",
  24083. 0x00e1,
  24084. "aadeva",
  24085. 0x0906,
  24086. "aagujarati",
  24087. 0x0a86,
  24088. "aagurmukhi",
  24089. 0x0a06,
  24090. "aamatragurmukhi",
  24091. 0x0a3e,
  24092. "aarusquare",
  24093. 0x3303,
  24094. "aavowelsignbengali",
  24095. 0x09be,
  24096. "aavowelsigndeva",
  24097. 0x093e,
  24098. "aavowelsigngujarati",
  24099. 0x0abe,
  24100. "abbreviationmarkarmenian",
  24101. 0x055f,
  24102. "abbreviationsigndeva",
  24103. 0x0970,
  24104. "abengali",
  24105. 0x0985,
  24106. "abopomofo",
  24107. 0x311a,
  24108. "abreve",
  24109. 0x0103,
  24110. "abreveacute",
  24111. 0x1eaf,
  24112. "abrevecyrillic",
  24113. 0x04d1,
  24114. "abrevedotbelow",
  24115. 0x1eb7,
  24116. "abrevegrave",
  24117. 0x1eb1,
  24118. "abrevehookabove",
  24119. 0x1eb3,
  24120. "abrevetilde",
  24121. 0x1eb5,
  24122. "acaron",
  24123. 0x01ce,
  24124. "acircle",
  24125. 0x24d0,
  24126. "acircumflex",
  24127. 0x00e2,
  24128. "acircumflexacute",
  24129. 0x1ea5,
  24130. "acircumflexdotbelow",
  24131. 0x1ead,
  24132. "acircumflexgrave",
  24133. 0x1ea7,
  24134. "acircumflexhookabove",
  24135. 0x1ea9,
  24136. "acircumflextilde",
  24137. 0x1eab,
  24138. "acute",
  24139. 0x00b4,
  24140. "acutebelowcmb",
  24141. 0x0317,
  24142. "acutecmb",
  24143. 0x0301,
  24144. "acutecomb",
  24145. 0x0301,
  24146. "acutedeva",
  24147. 0x0954,
  24148. "acutelowmod",
  24149. 0x02cf,
  24150. "acutetonecmb",
  24151. 0x0341,
  24152. "acyrillic",
  24153. 0x0430,
  24154. "adblgrave",
  24155. 0x0201,
  24156. "addakgurmukhi",
  24157. 0x0a71,
  24158. "adeva",
  24159. 0x0905,
  24160. "adieresis",
  24161. 0x00e4,
  24162. "adieresiscyrillic",
  24163. 0x04d3,
  24164. "adieresismacron",
  24165. 0x01df,
  24166. "adotbelow",
  24167. 0x1ea1,
  24168. "adotmacron",
  24169. 0x01e1,
  24170. "ae",
  24171. 0x00e6,
  24172. "aeacute",
  24173. 0x01fd,
  24174. "aekorean",
  24175. 0x3150,
  24176. "aemacron",
  24177. 0x01e3,
  24178. "afii00208",
  24179. 0x2015,
  24180. "afii08941",
  24181. 0x20a4,
  24182. "afii10017",
  24183. 0x0410,
  24184. "afii10018",
  24185. 0x0411,
  24186. "afii10019",
  24187. 0x0412,
  24188. "afii10020",
  24189. 0x0413,
  24190. "afii10021",
  24191. 0x0414,
  24192. "afii10022",
  24193. 0x0415,
  24194. "afii10023",
  24195. 0x0401,
  24196. "afii10024",
  24197. 0x0416,
  24198. "afii10025",
  24199. 0x0417,
  24200. "afii10026",
  24201. 0x0418,
  24202. "afii10027",
  24203. 0x0419,
  24204. "afii10028",
  24205. 0x041a,
  24206. "afii10029",
  24207. 0x041b,
  24208. "afii10030",
  24209. 0x041c,
  24210. "afii10031",
  24211. 0x041d,
  24212. "afii10032",
  24213. 0x041e,
  24214. "afii10033",
  24215. 0x041f,
  24216. "afii10034",
  24217. 0x0420,
  24218. "afii10035",
  24219. 0x0421,
  24220. "afii10036",
  24221. 0x0422,
  24222. "afii10037",
  24223. 0x0423,
  24224. "afii10038",
  24225. 0x0424,
  24226. "afii10039",
  24227. 0x0425,
  24228. "afii10040",
  24229. 0x0426,
  24230. "afii10041",
  24231. 0x0427,
  24232. "afii10042",
  24233. 0x0428,
  24234. "afii10043",
  24235. 0x0429,
  24236. "afii10044",
  24237. 0x042a,
  24238. "afii10045",
  24239. 0x042b,
  24240. "afii10046",
  24241. 0x042c,
  24242. "afii10047",
  24243. 0x042d,
  24244. "afii10048",
  24245. 0x042e,
  24246. "afii10049",
  24247. 0x042f,
  24248. "afii10050",
  24249. 0x0490,
  24250. "afii10051",
  24251. 0x0402,
  24252. "afii10052",
  24253. 0x0403,
  24254. "afii10053",
  24255. 0x0404,
  24256. "afii10054",
  24257. 0x0405,
  24258. "afii10055",
  24259. 0x0406,
  24260. "afii10056",
  24261. 0x0407,
  24262. "afii10057",
  24263. 0x0408,
  24264. "afii10058",
  24265. 0x0409,
  24266. "afii10059",
  24267. 0x040a,
  24268. "afii10060",
  24269. 0x040b,
  24270. "afii10061",
  24271. 0x040c,
  24272. "afii10062",
  24273. 0x040e,
  24274. "afii10063",
  24275. 0xf6c4,
  24276. "afii10064",
  24277. 0xf6c5,
  24278. "afii10065",
  24279. 0x0430,
  24280. "afii10066",
  24281. 0x0431,
  24282. "afii10067",
  24283. 0x0432,
  24284. "afii10068",
  24285. 0x0433,
  24286. "afii10069",
  24287. 0x0434,
  24288. "afii10070",
  24289. 0x0435,
  24290. "afii10071",
  24291. 0x0451,
  24292. "afii10072",
  24293. 0x0436,
  24294. "afii10073",
  24295. 0x0437,
  24296. "afii10074",
  24297. 0x0438,
  24298. "afii10075",
  24299. 0x0439,
  24300. "afii10076",
  24301. 0x043a,
  24302. "afii10077",
  24303. 0x043b,
  24304. "afii10078",
  24305. 0x043c,
  24306. "afii10079",
  24307. 0x043d,
  24308. "afii10080",
  24309. 0x043e,
  24310. "afii10081",
  24311. 0x043f,
  24312. "afii10082",
  24313. 0x0440,
  24314. "afii10083",
  24315. 0x0441,
  24316. "afii10084",
  24317. 0x0442,
  24318. "afii10085",
  24319. 0x0443,
  24320. "afii10086",
  24321. 0x0444,
  24322. "afii10087",
  24323. 0x0445,
  24324. "afii10088",
  24325. 0x0446,
  24326. "afii10089",
  24327. 0x0447,
  24328. "afii10090",
  24329. 0x0448,
  24330. "afii10091",
  24331. 0x0449,
  24332. "afii10092",
  24333. 0x044a,
  24334. "afii10093",
  24335. 0x044b,
  24336. "afii10094",
  24337. 0x044c,
  24338. "afii10095",
  24339. 0x044d,
  24340. "afii10096",
  24341. 0x044e,
  24342. "afii10097",
  24343. 0x044f,
  24344. "afii10098",
  24345. 0x0491,
  24346. "afii10099",
  24347. 0x0452,
  24348. "afii10100",
  24349. 0x0453,
  24350. "afii10101",
  24351. 0x0454,
  24352. "afii10102",
  24353. 0x0455,
  24354. "afii10103",
  24355. 0x0456,
  24356. "afii10104",
  24357. 0x0457,
  24358. "afii10105",
  24359. 0x0458,
  24360. "afii10106",
  24361. 0x0459,
  24362. "afii10107",
  24363. 0x045a,
  24364. "afii10108",
  24365. 0x045b,
  24366. "afii10109",
  24367. 0x045c,
  24368. "afii10110",
  24369. 0x045e,
  24370. "afii10145",
  24371. 0x040f,
  24372. "afii10146",
  24373. 0x0462,
  24374. "afii10147",
  24375. 0x0472,
  24376. "afii10148",
  24377. 0x0474,
  24378. "afii10192",
  24379. 0xf6c6,
  24380. "afii10193",
  24381. 0x045f,
  24382. "afii10194",
  24383. 0x0463,
  24384. "afii10195",
  24385. 0x0473,
  24386. "afii10196",
  24387. 0x0475,
  24388. "afii10831",
  24389. 0xf6c7,
  24390. "afii10832",
  24391. 0xf6c8,
  24392. "afii10846",
  24393. 0x04d9,
  24394. "afii299",
  24395. 0x200e,
  24396. "afii300",
  24397. 0x200f,
  24398. "afii301",
  24399. 0x200d,
  24400. "afii57381",
  24401. 0x066a,
  24402. "afii57388",
  24403. 0x060c,
  24404. "afii57392",
  24405. 0x0660,
  24406. "afii57393",
  24407. 0x0661,
  24408. "afii57394",
  24409. 0x0662,
  24410. "afii57395",
  24411. 0x0663,
  24412. "afii57396",
  24413. 0x0664,
  24414. "afii57397",
  24415. 0x0665,
  24416. "afii57398",
  24417. 0x0666,
  24418. "afii57399",
  24419. 0x0667,
  24420. "afii57400",
  24421. 0x0668,
  24422. "afii57401",
  24423. 0x0669,
  24424. "afii57403",
  24425. 0x061b,
  24426. "afii57407",
  24427. 0x061f,
  24428. "afii57409",
  24429. 0x0621,
  24430. "afii57410",
  24431. 0x0622,
  24432. "afii57411",
  24433. 0x0623,
  24434. "afii57412",
  24435. 0x0624,
  24436. "afii57413",
  24437. 0x0625,
  24438. "afii57414",
  24439. 0x0626,
  24440. "afii57415",
  24441. 0x0627,
  24442. "afii57416",
  24443. 0x0628,
  24444. "afii57417",
  24445. 0x0629,
  24446. "afii57418",
  24447. 0x062a,
  24448. "afii57419",
  24449. 0x062b,
  24450. "afii57420",
  24451. 0x062c,
  24452. "afii57421",
  24453. 0x062d,
  24454. "afii57422",
  24455. 0x062e,
  24456. "afii57423",
  24457. 0x062f,
  24458. "afii57424",
  24459. 0x0630,
  24460. "afii57425",
  24461. 0x0631,
  24462. "afii57426",
  24463. 0x0632,
  24464. "afii57427",
  24465. 0x0633,
  24466. "afii57428",
  24467. 0x0634,
  24468. "afii57429",
  24469. 0x0635,
  24470. "afii57430",
  24471. 0x0636,
  24472. "afii57431",
  24473. 0x0637,
  24474. "afii57432",
  24475. 0x0638,
  24476. "afii57433",
  24477. 0x0639,
  24478. "afii57434",
  24479. 0x063a,
  24480. "afii57440",
  24481. 0x0640,
  24482. "afii57441",
  24483. 0x0641,
  24484. "afii57442",
  24485. 0x0642,
  24486. "afii57443",
  24487. 0x0643,
  24488. "afii57444",
  24489. 0x0644,
  24490. "afii57445",
  24491. 0x0645,
  24492. "afii57446",
  24493. 0x0646,
  24494. "afii57448",
  24495. 0x0648,
  24496. "afii57449",
  24497. 0x0649,
  24498. "afii57450",
  24499. 0x064a,
  24500. "afii57451",
  24501. 0x064b,
  24502. "afii57452",
  24503. 0x064c,
  24504. "afii57453",
  24505. 0x064d,
  24506. "afii57454",
  24507. 0x064e,
  24508. "afii57455",
  24509. 0x064f,
  24510. "afii57456",
  24511. 0x0650,
  24512. "afii57457",
  24513. 0x0651,
  24514. "afii57458",
  24515. 0x0652,
  24516. "afii57470",
  24517. 0x0647,
  24518. "afii57505",
  24519. 0x06a4,
  24520. "afii57506",
  24521. 0x067e,
  24522. "afii57507",
  24523. 0x0686,
  24524. "afii57508",
  24525. 0x0698,
  24526. "afii57509",
  24527. 0x06af,
  24528. "afii57511",
  24529. 0x0679,
  24530. "afii57512",
  24531. 0x0688,
  24532. "afii57513",
  24533. 0x0691,
  24534. "afii57514",
  24535. 0x06ba,
  24536. "afii57519",
  24537. 0x06d2,
  24538. "afii57534",
  24539. 0x06d5,
  24540. "afii57636",
  24541. 0x20aa,
  24542. "afii57645",
  24543. 0x05be,
  24544. "afii57658",
  24545. 0x05c3,
  24546. "afii57664",
  24547. 0x05d0,
  24548. "afii57665",
  24549. 0x05d1,
  24550. "afii57666",
  24551. 0x05d2,
  24552. "afii57667",
  24553. 0x05d3,
  24554. "afii57668",
  24555. 0x05d4,
  24556. "afii57669",
  24557. 0x05d5,
  24558. "afii57670",
  24559. 0x05d6,
  24560. "afii57671",
  24561. 0x05d7,
  24562. "afii57672",
  24563. 0x05d8,
  24564. "afii57673",
  24565. 0x05d9,
  24566. "afii57674",
  24567. 0x05da,
  24568. "afii57675",
  24569. 0x05db,
  24570. "afii57676",
  24571. 0x05dc,
  24572. "afii57677",
  24573. 0x05dd,
  24574. "afii57678",
  24575. 0x05de,
  24576. "afii57679",
  24577. 0x05df,
  24578. "afii57680",
  24579. 0x05e0,
  24580. "afii57681",
  24581. 0x05e1,
  24582. "afii57682",
  24583. 0x05e2,
  24584. "afii57683",
  24585. 0x05e3,
  24586. "afii57684",
  24587. 0x05e4,
  24588. "afii57685",
  24589. 0x05e5,
  24590. "afii57686",
  24591. 0x05e6,
  24592. "afii57687",
  24593. 0x05e7,
  24594. "afii57688",
  24595. 0x05e8,
  24596. "afii57689",
  24597. 0x05e9,
  24598. "afii57690",
  24599. 0x05ea,
  24600. "afii57694",
  24601. 0xfb2a,
  24602. "afii57695",
  24603. 0xfb2b,
  24604. "afii57700",
  24605. 0xfb4b,
  24606. "afii57705",
  24607. 0xfb1f,
  24608. "afii57716",
  24609. 0x05f0,
  24610. "afii57717",
  24611. 0x05f1,
  24612. "afii57718",
  24613. 0x05f2,
  24614. "afii57723",
  24615. 0xfb35,
  24616. "afii57793",
  24617. 0x05b4,
  24618. "afii57794",
  24619. 0x05b5,
  24620. "afii57795",
  24621. 0x05b6,
  24622. "afii57796",
  24623. 0x05bb,
  24624. "afii57797",
  24625. 0x05b8,
  24626. "afii57798",
  24627. 0x05b7,
  24628. "afii57799",
  24629. 0x05b0,
  24630. "afii57800",
  24631. 0x05b2,
  24632. "afii57801",
  24633. 0x05b1,
  24634. "afii57802",
  24635. 0x05b3,
  24636. "afii57803",
  24637. 0x05c2,
  24638. "afii57804",
  24639. 0x05c1,
  24640. "afii57806",
  24641. 0x05b9,
  24642. "afii57807",
  24643. 0x05bc,
  24644. "afii57839",
  24645. 0x05bd,
  24646. "afii57841",
  24647. 0x05bf,
  24648. "afii57842",
  24649. 0x05c0,
  24650. "afii57929",
  24651. 0x02bc,
  24652. "afii61248",
  24653. 0x2105,
  24654. "afii61289",
  24655. 0x2113,
  24656. "afii61352",
  24657. 0x2116,
  24658. "afii61573",
  24659. 0x202c,
  24660. "afii61574",
  24661. 0x202d,
  24662. "afii61575",
  24663. 0x202e,
  24664. "afii61664",
  24665. 0x200c,
  24666. "afii63167",
  24667. 0x066d,
  24668. "afii64937",
  24669. 0x02bd,
  24670. "agrave",
  24671. 0x00e0,
  24672. "agujarati",
  24673. 0x0a85,
  24674. "agurmukhi",
  24675. 0x0a05,
  24676. "ahiragana",
  24677. 0x3042,
  24678. "ahookabove",
  24679. 0x1ea3,
  24680. "aibengali",
  24681. 0x0990,
  24682. "aibopomofo",
  24683. 0x311e,
  24684. "aideva",
  24685. 0x0910,
  24686. "aiecyrillic",
  24687. 0x04d5,
  24688. "aigujarati",
  24689. 0x0a90,
  24690. "aigurmukhi",
  24691. 0x0a10,
  24692. "aimatragurmukhi",
  24693. 0x0a48,
  24694. "ainarabic",
  24695. 0x0639,
  24696. "ainfinalarabic",
  24697. 0xfeca,
  24698. "aininitialarabic",
  24699. 0xfecb,
  24700. "ainmedialarabic",
  24701. 0xfecc,
  24702. "ainvertedbreve",
  24703. 0x0203,
  24704. "aivowelsignbengali",
  24705. 0x09c8,
  24706. "aivowelsigndeva",
  24707. 0x0948,
  24708. "aivowelsigngujarati",
  24709. 0x0ac8,
  24710. "akatakana",
  24711. 0x30a2,
  24712. "akatakanahalfwidth",
  24713. 0xff71,
  24714. "akorean",
  24715. 0x314f,
  24716. "alef",
  24717. 0x05d0,
  24718. "alefarabic",
  24719. 0x0627,
  24720. "alefdageshhebrew",
  24721. 0xfb30,
  24722. "aleffinalarabic",
  24723. 0xfe8e,
  24724. "alefhamzaabovearabic",
  24725. 0x0623,
  24726. "alefhamzaabovefinalarabic",
  24727. 0xfe84,
  24728. "alefhamzabelowarabic",
  24729. 0x0625,
  24730. "alefhamzabelowfinalarabic",
  24731. 0xfe88,
  24732. "alefhebrew",
  24733. 0x05d0,
  24734. "aleflamedhebrew",
  24735. 0xfb4f,
  24736. "alefmaddaabovearabic",
  24737. 0x0622,
  24738. "alefmaddaabovefinalarabic",
  24739. 0xfe82,
  24740. "alefmaksuraarabic",
  24741. 0x0649,
  24742. "alefmaksurafinalarabic",
  24743. 0xfef0,
  24744. "alefmaksurainitialarabic",
  24745. 0xfef3,
  24746. "alefmaksuramedialarabic",
  24747. 0xfef4,
  24748. "alefpatahhebrew",
  24749. 0xfb2e,
  24750. "alefqamatshebrew",
  24751. 0xfb2f,
  24752. "aleph",
  24753. 0x2135,
  24754. "allequal",
  24755. 0x224c,
  24756. "alpha",
  24757. 0x03b1,
  24758. "alphatonos",
  24759. 0x03ac,
  24760. "amacron",
  24761. 0x0101,
  24762. "amonospace",
  24763. 0xff41,
  24764. "ampersand",
  24765. 0x0026,
  24766. "ampersandmonospace",
  24767. 0xff06,
  24768. "ampersandsmall",
  24769. 0xf726,
  24770. "amsquare",
  24771. 0x33c2,
  24772. "anbopomofo",
  24773. 0x3122,
  24774. "angbopomofo",
  24775. 0x3124,
  24776. "angbracketleft",
  24777. 0x3008,
  24778. "angbracketright",
  24779. 0x3009,
  24780. "angkhankhuthai",
  24781. 0x0e5a,
  24782. "angle",
  24783. 0x2220,
  24784. "anglebracketleft",
  24785. 0x3008,
  24786. "anglebracketleftvertical",
  24787. 0xfe3f,
  24788. "anglebracketright",
  24789. 0x3009,
  24790. "anglebracketrightvertical",
  24791. 0xfe40,
  24792. "angleleft",
  24793. 0x2329,
  24794. "angleright",
  24795. 0x232a,
  24796. "angstrom",
  24797. 0x212b,
  24798. "anoteleia",
  24799. 0x0387,
  24800. "anudattadeva",
  24801. 0x0952,
  24802. "anusvarabengali",
  24803. 0x0982,
  24804. "anusvaradeva",
  24805. 0x0902,
  24806. "anusvaragujarati",
  24807. 0x0a82,
  24808. "aogonek",
  24809. 0x0105,
  24810. "apaatosquare",
  24811. 0x3300,
  24812. "aparen",
  24813. 0x249c,
  24814. "apostrophearmenian",
  24815. 0x055a,
  24816. "apostrophemod",
  24817. 0x02bc,
  24818. "apple",
  24819. 0xf8ff,
  24820. "approaches",
  24821. 0x2250,
  24822. "approxequal",
  24823. 0x2248,
  24824. "approxequalorimage",
  24825. 0x2252,
  24826. "approximatelyequal",
  24827. 0x2245,
  24828. "araeaekorean",
  24829. 0x318e,
  24830. "araeakorean",
  24831. 0x318d,
  24832. "arc",
  24833. 0x2312,
  24834. "arighthalfring",
  24835. 0x1e9a,
  24836. "aring",
  24837. 0x00e5,
  24838. "aringacute",
  24839. 0x01fb,
  24840. "aringbelow",
  24841. 0x1e01,
  24842. "arrowboth",
  24843. 0x2194,
  24844. "arrowdashdown",
  24845. 0x21e3,
  24846. "arrowdashleft",
  24847. 0x21e0,
  24848. "arrowdashright",
  24849. 0x21e2,
  24850. "arrowdashup",
  24851. 0x21e1,
  24852. "arrowdblboth",
  24853. 0x21d4,
  24854. "arrowdbldown",
  24855. 0x21d3,
  24856. "arrowdblleft",
  24857. 0x21d0,
  24858. "arrowdblright",
  24859. 0x21d2,
  24860. "arrowdblup",
  24861. 0x21d1,
  24862. "arrowdown",
  24863. 0x2193,
  24864. "arrowdownleft",
  24865. 0x2199,
  24866. "arrowdownright",
  24867. 0x2198,
  24868. "arrowdownwhite",
  24869. 0x21e9,
  24870. "arrowheaddownmod",
  24871. 0x02c5,
  24872. "arrowheadleftmod",
  24873. 0x02c2,
  24874. "arrowheadrightmod",
  24875. 0x02c3,
  24876. "arrowheadupmod",
  24877. 0x02c4,
  24878. "arrowhorizex",
  24879. 0xf8e7,
  24880. "arrowleft",
  24881. 0x2190,
  24882. "arrowleftdbl",
  24883. 0x21d0,
  24884. "arrowleftdblstroke",
  24885. 0x21cd,
  24886. "arrowleftoverright",
  24887. 0x21c6,
  24888. "arrowleftwhite",
  24889. 0x21e6,
  24890. "arrowright",
  24891. 0x2192,
  24892. "arrowrightdblstroke",
  24893. 0x21cf,
  24894. "arrowrightheavy",
  24895. 0x279e,
  24896. "arrowrightoverleft",
  24897. 0x21c4,
  24898. "arrowrightwhite",
  24899. 0x21e8,
  24900. "arrowtableft",
  24901. 0x21e4,
  24902. "arrowtabright",
  24903. 0x21e5,
  24904. "arrowup",
  24905. 0x2191,
  24906. "arrowupdn",
  24907. 0x2195,
  24908. "arrowupdnbse",
  24909. 0x21a8,
  24910. "arrowupdownbase",
  24911. 0x21a8,
  24912. "arrowupleft",
  24913. 0x2196,
  24914. "arrowupleftofdown",
  24915. 0x21c5,
  24916. "arrowupright",
  24917. 0x2197,
  24918. "arrowupwhite",
  24919. 0x21e7,
  24920. "arrowvertex",
  24921. 0xf8e6,
  24922. "asciicircum",
  24923. 0x005e,
  24924. "asciicircummonospace",
  24925. 0xff3e,
  24926. "asciitilde",
  24927. 0x007e,
  24928. "asciitildemonospace",
  24929. 0xff5e,
  24930. "ascript",
  24931. 0x0251,
  24932. "ascriptturned",
  24933. 0x0252,
  24934. "asmallhiragana",
  24935. 0x3041,
  24936. "asmallkatakana",
  24937. 0x30a1,
  24938. "asmallkatakanahalfwidth",
  24939. 0xff67,
  24940. "asterisk",
  24941. 0x002a,
  24942. "asteriskaltonearabic",
  24943. 0x066d,
  24944. "asteriskarabic",
  24945. 0x066d,
  24946. "asteriskmath",
  24947. 0x2217,
  24948. "asteriskmonospace",
  24949. 0xff0a,
  24950. "asterisksmall",
  24951. 0xfe61,
  24952. "asterism",
  24953. 0x2042,
  24954. "asuperior",
  24955. 0xf6e9,
  24956. "asymptoticallyequal",
  24957. 0x2243,
  24958. "at",
  24959. 0x0040,
  24960. "atilde",
  24961. 0x00e3,
  24962. "atmonospace",
  24963. 0xff20,
  24964. "atsmall",
  24965. 0xfe6b,
  24966. "aturned",
  24967. 0x0250,
  24968. "aubengali",
  24969. 0x0994,
  24970. "aubopomofo",
  24971. 0x3120,
  24972. "audeva",
  24973. 0x0914,
  24974. "augujarati",
  24975. 0x0a94,
  24976. "augurmukhi",
  24977. 0x0a14,
  24978. "aulengthmarkbengali",
  24979. 0x09d7,
  24980. "aumatragurmukhi",
  24981. 0x0a4c,
  24982. "auvowelsignbengali",
  24983. 0x09cc,
  24984. "auvowelsigndeva",
  24985. 0x094c,
  24986. "auvowelsigngujarati",
  24987. 0x0acc,
  24988. "avagrahadeva",
  24989. 0x093d,
  24990. "aybarmenian",
  24991. 0x0561,
  24992. "ayin",
  24993. 0x05e2,
  24994. "ayinaltonehebrew",
  24995. 0xfb20,
  24996. "ayinhebrew",
  24997. 0x05e2,
  24998. "b",
  24999. 0x0062,
  25000. "babengali",
  25001. 0x09ac,
  25002. "backslash",
  25003. 0x005c,
  25004. "backslashmonospace",
  25005. 0xff3c,
  25006. "badeva",
  25007. 0x092c,
  25008. "bagujarati",
  25009. 0x0aac,
  25010. "bagurmukhi",
  25011. 0x0a2c,
  25012. "bahiragana",
  25013. 0x3070,
  25014. "bahtthai",
  25015. 0x0e3f,
  25016. "bakatakana",
  25017. 0x30d0,
  25018. "bar",
  25019. 0x007c,
  25020. "barmonospace",
  25021. 0xff5c,
  25022. "bbopomofo",
  25023. 0x3105,
  25024. "bcircle",
  25025. 0x24d1,
  25026. "bdotaccent",
  25027. 0x1e03,
  25028. "bdotbelow",
  25029. 0x1e05,
  25030. "beamedsixteenthnotes",
  25031. 0x266c,
  25032. "because",
  25033. 0x2235,
  25034. "becyrillic",
  25035. 0x0431,
  25036. "beharabic",
  25037. 0x0628,
  25038. "behfinalarabic",
  25039. 0xfe90,
  25040. "behinitialarabic",
  25041. 0xfe91,
  25042. "behiragana",
  25043. 0x3079,
  25044. "behmedialarabic",
  25045. 0xfe92,
  25046. "behmeeminitialarabic",
  25047. 0xfc9f,
  25048. "behmeemisolatedarabic",
  25049. 0xfc08,
  25050. "behnoonfinalarabic",
  25051. 0xfc6d,
  25052. "bekatakana",
  25053. 0x30d9,
  25054. "benarmenian",
  25055. 0x0562,
  25056. "bet",
  25057. 0x05d1,
  25058. "beta",
  25059. 0x03b2,
  25060. "betasymbolgreek",
  25061. 0x03d0,
  25062. "betdagesh",
  25063. 0xfb31,
  25064. "betdageshhebrew",
  25065. 0xfb31,
  25066. "bethebrew",
  25067. 0x05d1,
  25068. "betrafehebrew",
  25069. 0xfb4c,
  25070. "bhabengali",
  25071. 0x09ad,
  25072. "bhadeva",
  25073. 0x092d,
  25074. "bhagujarati",
  25075. 0x0aad,
  25076. "bhagurmukhi",
  25077. 0x0a2d,
  25078. "bhook",
  25079. 0x0253,
  25080. "bihiragana",
  25081. 0x3073,
  25082. "bikatakana",
  25083. 0x30d3,
  25084. "bilabialclick",
  25085. 0x0298,
  25086. "bindigurmukhi",
  25087. 0x0a02,
  25088. "birusquare",
  25089. 0x3331,
  25090. "blackcircle",
  25091. 0x25cf,
  25092. "blackdiamond",
  25093. 0x25c6,
  25094. "blackdownpointingtriangle",
  25095. 0x25bc,
  25096. "blackleftpointingpointer",
  25097. 0x25c4,
  25098. "blackleftpointingtriangle",
  25099. 0x25c0,
  25100. "blacklenticularbracketleft",
  25101. 0x3010,
  25102. "blacklenticularbracketleftvertical",
  25103. 0xfe3b,
  25104. "blacklenticularbracketright",
  25105. 0x3011,
  25106. "blacklenticularbracketrightvertical",
  25107. 0xfe3c,
  25108. "blacklowerlefttriangle",
  25109. 0x25e3,
  25110. "blacklowerrighttriangle",
  25111. 0x25e2,
  25112. "blackrectangle",
  25113. 0x25ac,
  25114. "blackrightpointingpointer",
  25115. 0x25ba,
  25116. "blackrightpointingtriangle",
  25117. 0x25b6,
  25118. "blacksmallsquare",
  25119. 0x25aa,
  25120. "blacksmilingface",
  25121. 0x263b,
  25122. "blacksquare",
  25123. 0x25a0,
  25124. "blackstar",
  25125. 0x2605,
  25126. "blackupperlefttriangle",
  25127. 0x25e4,
  25128. "blackupperrighttriangle",
  25129. 0x25e5,
  25130. "blackuppointingsmalltriangle",
  25131. 0x25b4,
  25132. "blackuppointingtriangle",
  25133. 0x25b2,
  25134. "blank",
  25135. 0x2423,
  25136. "blinebelow",
  25137. 0x1e07,
  25138. "block",
  25139. 0x2588,
  25140. "bmonospace",
  25141. 0xff42,
  25142. "bobaimaithai",
  25143. 0x0e1a,
  25144. "bohiragana",
  25145. 0x307c,
  25146. "bokatakana",
  25147. 0x30dc,
  25148. "bparen",
  25149. 0x249d,
  25150. "bqsquare",
  25151. 0x33c3,
  25152. "braceex",
  25153. 0xf8f4,
  25154. "braceleft",
  25155. 0x007b,
  25156. "braceleftbt",
  25157. 0xf8f3,
  25158. "braceleftmid",
  25159. 0xf8f2,
  25160. "braceleftmonospace",
  25161. 0xff5b,
  25162. "braceleftsmall",
  25163. 0xfe5b,
  25164. "bracelefttp",
  25165. 0xf8f1,
  25166. "braceleftvertical",
  25167. 0xfe37,
  25168. "braceright",
  25169. 0x007d,
  25170. "bracerightbt",
  25171. 0xf8fe,
  25172. "bracerightmid",
  25173. 0xf8fd,
  25174. "bracerightmonospace",
  25175. 0xff5d,
  25176. "bracerightsmall",
  25177. 0xfe5c,
  25178. "bracerighttp",
  25179. 0xf8fc,
  25180. "bracerightvertical",
  25181. 0xfe38,
  25182. "bracketleft",
  25183. 0x005b,
  25184. "bracketleftbt",
  25185. 0xf8f0,
  25186. "bracketleftex",
  25187. 0xf8ef,
  25188. "bracketleftmonospace",
  25189. 0xff3b,
  25190. "bracketlefttp",
  25191. 0xf8ee,
  25192. "bracketright",
  25193. 0x005d,
  25194. "bracketrightbt",
  25195. 0xf8fb,
  25196. "bracketrightex",
  25197. 0xf8fa,
  25198. "bracketrightmonospace",
  25199. 0xff3d,
  25200. "bracketrighttp",
  25201. 0xf8f9,
  25202. "breve",
  25203. 0x02d8,
  25204. "brevebelowcmb",
  25205. 0x032e,
  25206. "brevecmb",
  25207. 0x0306,
  25208. "breveinvertedbelowcmb",
  25209. 0x032f,
  25210. "breveinvertedcmb",
  25211. 0x0311,
  25212. "breveinverteddoublecmb",
  25213. 0x0361,
  25214. "bridgebelowcmb",
  25215. 0x032a,
  25216. "bridgeinvertedbelowcmb",
  25217. 0x033a,
  25218. "brokenbar",
  25219. 0x00a6,
  25220. "bstroke",
  25221. 0x0180,
  25222. "bsuperior",
  25223. 0xf6ea,
  25224. "btopbar",
  25225. 0x0183,
  25226. "buhiragana",
  25227. 0x3076,
  25228. "bukatakana",
  25229. 0x30d6,
  25230. "bullet",
  25231. 0x2022,
  25232. "bulletinverse",
  25233. 0x25d8,
  25234. "bulletoperator",
  25235. 0x2219,
  25236. "bullseye",
  25237. 0x25ce,
  25238. "c",
  25239. 0x0063,
  25240. "caarmenian",
  25241. 0x056e,
  25242. "cabengali",
  25243. 0x099a,
  25244. "cacute",
  25245. 0x0107,
  25246. "cadeva",
  25247. 0x091a,
  25248. "cagujarati",
  25249. 0x0a9a,
  25250. "cagurmukhi",
  25251. 0x0a1a,
  25252. "calsquare",
  25253. 0x3388,
  25254. "candrabindubengali",
  25255. 0x0981,
  25256. "candrabinducmb",
  25257. 0x0310,
  25258. "candrabindudeva",
  25259. 0x0901,
  25260. "candrabindugujarati",
  25261. 0x0a81,
  25262. "capslock",
  25263. 0x21ea,
  25264. "careof",
  25265. 0x2105,
  25266. "caron",
  25267. 0x02c7,
  25268. "caronbelowcmb",
  25269. 0x032c,
  25270. "caroncmb",
  25271. 0x030c,
  25272. "carriagereturn",
  25273. 0x21b5,
  25274. "cbopomofo",
  25275. 0x3118,
  25276. "ccaron",
  25277. 0x010d,
  25278. "ccedilla",
  25279. 0x00e7,
  25280. "ccedillaacute",
  25281. 0x1e09,
  25282. "ccircle",
  25283. 0x24d2,
  25284. "ccircumflex",
  25285. 0x0109,
  25286. "ccurl",
  25287. 0x0255,
  25288. "cdot",
  25289. 0x010b,
  25290. "cdotaccent",
  25291. 0x010b,
  25292. "cdsquare",
  25293. 0x33c5,
  25294. "cedilla",
  25295. 0x00b8,
  25296. "cedillacmb",
  25297. 0x0327,
  25298. "cent",
  25299. 0x00a2,
  25300. "centigrade",
  25301. 0x2103,
  25302. "centinferior",
  25303. 0xf6df,
  25304. "centmonospace",
  25305. 0xffe0,
  25306. "centoldstyle",
  25307. 0xf7a2,
  25308. "centsuperior",
  25309. 0xf6e0,
  25310. "chaarmenian",
  25311. 0x0579,
  25312. "chabengali",
  25313. 0x099b,
  25314. "chadeva",
  25315. 0x091b,
  25316. "chagujarati",
  25317. 0x0a9b,
  25318. "chagurmukhi",
  25319. 0x0a1b,
  25320. "chbopomofo",
  25321. 0x3114,
  25322. "cheabkhasiancyrillic",
  25323. 0x04bd,
  25324. "checkmark",
  25325. 0x2713,
  25326. "checyrillic",
  25327. 0x0447,
  25328. "chedescenderabkhasiancyrillic",
  25329. 0x04bf,
  25330. "chedescendercyrillic",
  25331. 0x04b7,
  25332. "chedieresiscyrillic",
  25333. 0x04f5,
  25334. "cheharmenian",
  25335. 0x0573,
  25336. "chekhakassiancyrillic",
  25337. 0x04cc,
  25338. "cheverticalstrokecyrillic",
  25339. 0x04b9,
  25340. "chi",
  25341. 0x03c7,
  25342. "chieuchacirclekorean",
  25343. 0x3277,
  25344. "chieuchaparenkorean",
  25345. 0x3217,
  25346. "chieuchcirclekorean",
  25347. 0x3269,
  25348. "chieuchkorean",
  25349. 0x314a,
  25350. "chieuchparenkorean",
  25351. 0x3209,
  25352. "chochangthai",
  25353. 0x0e0a,
  25354. "chochanthai",
  25355. 0x0e08,
  25356. "chochingthai",
  25357. 0x0e09,
  25358. "chochoethai",
  25359. 0x0e0c,
  25360. "chook",
  25361. 0x0188,
  25362. "cieucacirclekorean",
  25363. 0x3276,
  25364. "cieucaparenkorean",
  25365. 0x3216,
  25366. "cieuccirclekorean",
  25367. 0x3268,
  25368. "cieuckorean",
  25369. 0x3148,
  25370. "cieucparenkorean",
  25371. 0x3208,
  25372. "cieucuparenkorean",
  25373. 0x321c,
  25374. "circle",
  25375. 0x25cb,
  25376. "circlecopyrt",
  25377. 0x00a9,
  25378. "circlemultiply",
  25379. 0x2297,
  25380. "circleot",
  25381. 0x2299,
  25382. "circleplus",
  25383. 0x2295,
  25384. "circlepostalmark",
  25385. 0x3036,
  25386. "circlewithlefthalfblack",
  25387. 0x25d0,
  25388. "circlewithrighthalfblack",
  25389. 0x25d1,
  25390. "circumflex",
  25391. 0x02c6,
  25392. "circumflexbelowcmb",
  25393. 0x032d,
  25394. "circumflexcmb",
  25395. 0x0302,
  25396. "clear",
  25397. 0x2327,
  25398. "clickalveolar",
  25399. 0x01c2,
  25400. "clickdental",
  25401. 0x01c0,
  25402. "clicklateral",
  25403. 0x01c1,
  25404. "clickretroflex",
  25405. 0x01c3,
  25406. "club",
  25407. 0x2663,
  25408. "clubsuitblack",
  25409. 0x2663,
  25410. "clubsuitwhite",
  25411. 0x2667,
  25412. "cmcubedsquare",
  25413. 0x33a4,
  25414. "cmonospace",
  25415. 0xff43,
  25416. "cmsquaredsquare",
  25417. 0x33a0,
  25418. "coarmenian",
  25419. 0x0581,
  25420. "colon",
  25421. 0x003a,
  25422. "colonmonetary",
  25423. 0x20a1,
  25424. "colonmonospace",
  25425. 0xff1a,
  25426. "colonsign",
  25427. 0x20a1,
  25428. "colonsmall",
  25429. 0xfe55,
  25430. "colontriangularhalfmod",
  25431. 0x02d1,
  25432. "colontriangularmod",
  25433. 0x02d0,
  25434. "comma",
  25435. 0x002c,
  25436. "commaabovecmb",
  25437. 0x0313,
  25438. "commaaboverightcmb",
  25439. 0x0315,
  25440. "commaaccent",
  25441. 0xf6c3,
  25442. "commaarabic",
  25443. 0x060c,
  25444. "commaarmenian",
  25445. 0x055d,
  25446. "commainferior",
  25447. 0xf6e1,
  25448. "commamonospace",
  25449. 0xff0c,
  25450. "commareversedabovecmb",
  25451. 0x0314,
  25452. "commareversedmod",
  25453. 0x02bd,
  25454. "commasmall",
  25455. 0xfe50,
  25456. "commasuperior",
  25457. 0xf6e2,
  25458. "commaturnedabovecmb",
  25459. 0x0312,
  25460. "commaturnedmod",
  25461. 0x02bb,
  25462. "compass",
  25463. 0x263c,
  25464. "congruent",
  25465. 0x2245,
  25466. "contourintegral",
  25467. 0x222e,
  25468. "control",
  25469. 0x2303,
  25470. "controlACK",
  25471. 0x0006,
  25472. "controlBEL",
  25473. 0x0007,
  25474. "controlBS",
  25475. 0x0008,
  25476. "controlCAN",
  25477. 0x0018,
  25478. "controlCR",
  25479. 0x000d,
  25480. "controlDC1",
  25481. 0x0011,
  25482. "controlDC2",
  25483. 0x0012,
  25484. "controlDC3",
  25485. 0x0013,
  25486. "controlDC4",
  25487. 0x0014,
  25488. "controlDEL",
  25489. 0x007f,
  25490. "controlDLE",
  25491. 0x0010,
  25492. "controlEM",
  25493. 0x0019,
  25494. "controlENQ",
  25495. 0x0005,
  25496. "controlEOT",
  25497. 0x0004,
  25498. "controlESC",
  25499. 0x001b,
  25500. "controlETB",
  25501. 0x0017,
  25502. "controlETX",
  25503. 0x0003,
  25504. "controlFF",
  25505. 0x000c,
  25506. "controlFS",
  25507. 0x001c,
  25508. "controlGS",
  25509. 0x001d,
  25510. "controlHT",
  25511. 0x0009,
  25512. "controlLF",
  25513. 0x000a,
  25514. "controlNAK",
  25515. 0x0015,
  25516. "controlNULL",
  25517. 0x0000,
  25518. "controlRS",
  25519. 0x001e,
  25520. "controlSI",
  25521. 0x000f,
  25522. "controlSO",
  25523. 0x000e,
  25524. "controlSOT",
  25525. 0x0002,
  25526. "controlSTX",
  25527. 0x0001,
  25528. "controlSUB",
  25529. 0x001a,
  25530. "controlSYN",
  25531. 0x0016,
  25532. "controlUS",
  25533. 0x001f,
  25534. "controlVT",
  25535. 0x000b,
  25536. "copyright",
  25537. 0x00a9,
  25538. "copyrightsans",
  25539. 0xf8e9,
  25540. "copyrightserif",
  25541. 0xf6d9,
  25542. "cornerbracketleft",
  25543. 0x300c,
  25544. "cornerbracketlefthalfwidth",
  25545. 0xff62,
  25546. "cornerbracketleftvertical",
  25547. 0xfe41,
  25548. "cornerbracketright",
  25549. 0x300d,
  25550. "cornerbracketrighthalfwidth",
  25551. 0xff63,
  25552. "cornerbracketrightvertical",
  25553. 0xfe42,
  25554. "corporationsquare",
  25555. 0x337f,
  25556. "cosquare",
  25557. 0x33c7,
  25558. "coverkgsquare",
  25559. 0x33c6,
  25560. "cparen",
  25561. 0x249e,
  25562. "cruzeiro",
  25563. 0x20a2,
  25564. "cstretched",
  25565. 0x0297,
  25566. "curlyand",
  25567. 0x22cf,
  25568. "curlyor",
  25569. 0x22ce,
  25570. "currency",
  25571. 0x00a4,
  25572. "cyrBreve",
  25573. 0xf6d1,
  25574. "cyrFlex",
  25575. 0xf6d2,
  25576. "cyrbreve",
  25577. 0xf6d4,
  25578. "cyrflex",
  25579. 0xf6d5,
  25580. "d",
  25581. 0x0064,
  25582. "daarmenian",
  25583. 0x0564,
  25584. "dabengali",
  25585. 0x09a6,
  25586. "dadarabic",
  25587. 0x0636,
  25588. "dadeva",
  25589. 0x0926,
  25590. "dadfinalarabic",
  25591. 0xfebe,
  25592. "dadinitialarabic",
  25593. 0xfebf,
  25594. "dadmedialarabic",
  25595. 0xfec0,
  25596. "dagesh",
  25597. 0x05bc,
  25598. "dageshhebrew",
  25599. 0x05bc,
  25600. "dagger",
  25601. 0x2020,
  25602. "daggerdbl",
  25603. 0x2021,
  25604. "dagujarati",
  25605. 0x0aa6,
  25606. "dagurmukhi",
  25607. 0x0a26,
  25608. "dahiragana",
  25609. 0x3060,
  25610. "dakatakana",
  25611. 0x30c0,
  25612. "dalarabic",
  25613. 0x062f,
  25614. "dalet",
  25615. 0x05d3,
  25616. "daletdagesh",
  25617. 0xfb33,
  25618. "daletdageshhebrew",
  25619. 0xfb33,
  25620. "dalethebrew",
  25621. 0x05d3,
  25622. "dalfinalarabic",
  25623. 0xfeaa,
  25624. "dammaarabic",
  25625. 0x064f,
  25626. "dammalowarabic",
  25627. 0x064f,
  25628. "dammatanaltonearabic",
  25629. 0x064c,
  25630. "dammatanarabic",
  25631. 0x064c,
  25632. "danda",
  25633. 0x0964,
  25634. "dargahebrew",
  25635. 0x05a7,
  25636. "dargalefthebrew",
  25637. 0x05a7,
  25638. "dasiapneumatacyrilliccmb",
  25639. 0x0485,
  25640. "dblGrave",
  25641. 0xf6d3,
  25642. "dblanglebracketleft",
  25643. 0x300a,
  25644. "dblanglebracketleftvertical",
  25645. 0xfe3d,
  25646. "dblanglebracketright",
  25647. 0x300b,
  25648. "dblanglebracketrightvertical",
  25649. 0xfe3e,
  25650. "dblarchinvertedbelowcmb",
  25651. 0x032b,
  25652. "dblarrowleft",
  25653. 0x21d4,
  25654. "dblarrowright",
  25655. 0x21d2,
  25656. "dbldanda",
  25657. 0x0965,
  25658. "dblgrave",
  25659. 0xf6d6,
  25660. "dblgravecmb",
  25661. 0x030f,
  25662. "dblintegral",
  25663. 0x222c,
  25664. "dbllowline",
  25665. 0x2017,
  25666. "dbllowlinecmb",
  25667. 0x0333,
  25668. "dbloverlinecmb",
  25669. 0x033f,
  25670. "dblprimemod",
  25671. 0x02ba,
  25672. "dblverticalbar",
  25673. 0x2016,
  25674. "dblverticallineabovecmb",
  25675. 0x030e,
  25676. "dbopomofo",
  25677. 0x3109,
  25678. "dbsquare",
  25679. 0x33c8,
  25680. "dcaron",
  25681. 0x010f,
  25682. "dcedilla",
  25683. 0x1e11,
  25684. "dcircle",
  25685. 0x24d3,
  25686. "dcircumflexbelow",
  25687. 0x1e13,
  25688. "dcroat",
  25689. 0x0111,
  25690. "ddabengali",
  25691. 0x09a1,
  25692. "ddadeva",
  25693. 0x0921,
  25694. "ddagujarati",
  25695. 0x0aa1,
  25696. "ddagurmukhi",
  25697. 0x0a21,
  25698. "ddalarabic",
  25699. 0x0688,
  25700. "ddalfinalarabic",
  25701. 0xfb89,
  25702. "dddhadeva",
  25703. 0x095c,
  25704. "ddhabengali",
  25705. 0x09a2,
  25706. "ddhadeva",
  25707. 0x0922,
  25708. "ddhagujarati",
  25709. 0x0aa2,
  25710. "ddhagurmukhi",
  25711. 0x0a22,
  25712. "ddotaccent",
  25713. 0x1e0b,
  25714. "ddotbelow",
  25715. 0x1e0d,
  25716. "decimalseparatorarabic",
  25717. 0x066b,
  25718. "decimalseparatorpersian",
  25719. 0x066b,
  25720. "decyrillic",
  25721. 0x0434,
  25722. "degree",
  25723. 0x00b0,
  25724. "dehihebrew",
  25725. 0x05ad,
  25726. "dehiragana",
  25727. 0x3067,
  25728. "deicoptic",
  25729. 0x03ef,
  25730. "dekatakana",
  25731. 0x30c7,
  25732. "deleteleft",
  25733. 0x232b,
  25734. "deleteright",
  25735. 0x2326,
  25736. "delta",
  25737. 0x03b4,
  25738. "deltaturned",
  25739. 0x018d,
  25740. "denominatorminusonenumeratorbengali",
  25741. 0x09f8,
  25742. "dezh",
  25743. 0x02a4,
  25744. "dhabengali",
  25745. 0x09a7,
  25746. "dhadeva",
  25747. 0x0927,
  25748. "dhagujarati",
  25749. 0x0aa7,
  25750. "dhagurmukhi",
  25751. 0x0a27,
  25752. "dhook",
  25753. 0x0257,
  25754. "dialytikatonos",
  25755. 0x0385,
  25756. "dialytikatonoscmb",
  25757. 0x0344,
  25758. "diamond",
  25759. 0x2666,
  25760. "diamondsuitwhite",
  25761. 0x2662,
  25762. "dieresis",
  25763. 0x00a8,
  25764. "dieresisacute",
  25765. 0xf6d7,
  25766. "dieresisbelowcmb",
  25767. 0x0324,
  25768. "dieresiscmb",
  25769. 0x0308,
  25770. "dieresisgrave",
  25771. 0xf6d8,
  25772. "dieresistonos",
  25773. 0x0385,
  25774. "dihiragana",
  25775. 0x3062,
  25776. "dikatakana",
  25777. 0x30c2,
  25778. "dittomark",
  25779. 0x3003,
  25780. "divide",
  25781. 0x00f7,
  25782. "divides",
  25783. 0x2223,
  25784. "divisionslash",
  25785. 0x2215,
  25786. "djecyrillic",
  25787. 0x0452,
  25788. "dkshade",
  25789. 0x2593,
  25790. "dlinebelow",
  25791. 0x1e0f,
  25792. "dlsquare",
  25793. 0x3397,
  25794. "dmacron",
  25795. 0x0111,
  25796. "dmonospace",
  25797. 0xff44,
  25798. "dnblock",
  25799. 0x2584,
  25800. "dochadathai",
  25801. 0x0e0e,
  25802. "dodekthai",
  25803. 0x0e14,
  25804. "dohiragana",
  25805. 0x3069,
  25806. "dokatakana",
  25807. 0x30c9,
  25808. "dollar",
  25809. 0x0024,
  25810. "dollarinferior",
  25811. 0xf6e3,
  25812. "dollarmonospace",
  25813. 0xff04,
  25814. "dollaroldstyle",
  25815. 0xf724,
  25816. "dollarsmall",
  25817. 0xfe69,
  25818. "dollarsuperior",
  25819. 0xf6e4,
  25820. "dong",
  25821. 0x20ab,
  25822. "dorusquare",
  25823. 0x3326,
  25824. "dotaccent",
  25825. 0x02d9,
  25826. "dotaccentcmb",
  25827. 0x0307,
  25828. "dotbelowcmb",
  25829. 0x0323,
  25830. "dotbelowcomb",
  25831. 0x0323,
  25832. "dotkatakana",
  25833. 0x30fb,
  25834. "dotlessi",
  25835. 0x0131,
  25836. "dotlessj",
  25837. 0xf6be,
  25838. "dotlessjstrokehook",
  25839. 0x0284,
  25840. "dotmath",
  25841. 0x22c5,
  25842. "dottedcircle",
  25843. 0x25cc,
  25844. "doubleyodpatah",
  25845. 0xfb1f,
  25846. "doubleyodpatahhebrew",
  25847. 0xfb1f,
  25848. "downtackbelowcmb",
  25849. 0x031e,
  25850. "downtackmod",
  25851. 0x02d5,
  25852. "dparen",
  25853. 0x249f,
  25854. "dsuperior",
  25855. 0xf6eb,
  25856. "dtail",
  25857. 0x0256,
  25858. "dtopbar",
  25859. 0x018c,
  25860. "duhiragana",
  25861. 0x3065,
  25862. "dukatakana",
  25863. 0x30c5,
  25864. "dz",
  25865. 0x01f3,
  25866. "dzaltone",
  25867. 0x02a3,
  25868. "dzcaron",
  25869. 0x01c6,
  25870. "dzcurl",
  25871. 0x02a5,
  25872. "dzeabkhasiancyrillic",
  25873. 0x04e1,
  25874. "dzecyrillic",
  25875. 0x0455,
  25876. "dzhecyrillic",
  25877. 0x045f,
  25878. "e",
  25879. 0x0065,
  25880. "eacute",
  25881. 0x00e9,
  25882. "earth",
  25883. 0x2641,
  25884. "ebengali",
  25885. 0x098f,
  25886. "ebopomofo",
  25887. 0x311c,
  25888. "ebreve",
  25889. 0x0115,
  25890. "ecandradeva",
  25891. 0x090d,
  25892. "ecandragujarati",
  25893. 0x0a8d,
  25894. "ecandravowelsigndeva",
  25895. 0x0945,
  25896. "ecandravowelsigngujarati",
  25897. 0x0ac5,
  25898. "ecaron",
  25899. 0x011b,
  25900. "ecedillabreve",
  25901. 0x1e1d,
  25902. "echarmenian",
  25903. 0x0565,
  25904. "echyiwnarmenian",
  25905. 0x0587,
  25906. "ecircle",
  25907. 0x24d4,
  25908. "ecircumflex",
  25909. 0x00ea,
  25910. "ecircumflexacute",
  25911. 0x1ebf,
  25912. "ecircumflexbelow",
  25913. 0x1e19,
  25914. "ecircumflexdotbelow",
  25915. 0x1ec7,
  25916. "ecircumflexgrave",
  25917. 0x1ec1,
  25918. "ecircumflexhookabove",
  25919. 0x1ec3,
  25920. "ecircumflextilde",
  25921. 0x1ec5,
  25922. "ecyrillic",
  25923. 0x0454,
  25924. "edblgrave",
  25925. 0x0205,
  25926. "edeva",
  25927. 0x090f,
  25928. "edieresis",
  25929. 0x00eb,
  25930. "edot",
  25931. 0x0117,
  25932. "edotaccent",
  25933. 0x0117,
  25934. "edotbelow",
  25935. 0x1eb9,
  25936. "eegurmukhi",
  25937. 0x0a0f,
  25938. "eematragurmukhi",
  25939. 0x0a47,
  25940. "efcyrillic",
  25941. 0x0444,
  25942. "egrave",
  25943. 0x00e8,
  25944. "egujarati",
  25945. 0x0a8f,
  25946. "eharmenian",
  25947. 0x0567,
  25948. "ehbopomofo",
  25949. 0x311d,
  25950. "ehiragana",
  25951. 0x3048,
  25952. "ehookabove",
  25953. 0x1ebb,
  25954. "eibopomofo",
  25955. 0x311f,
  25956. "eight",
  25957. 0x0038,
  25958. "eightarabic",
  25959. 0x0668,
  25960. "eightbengali",
  25961. 0x09ee,
  25962. "eightcircle",
  25963. 0x2467,
  25964. "eightcircleinversesansserif",
  25965. 0x2791,
  25966. "eightdeva",
  25967. 0x096e,
  25968. "eighteencircle",
  25969. 0x2471,
  25970. "eighteenparen",
  25971. 0x2485,
  25972. "eighteenperiod",
  25973. 0x2499,
  25974. "eightgujarati",
  25975. 0x0aee,
  25976. "eightgurmukhi",
  25977. 0x0a6e,
  25978. "eighthackarabic",
  25979. 0x0668,
  25980. "eighthangzhou",
  25981. 0x3028,
  25982. "eighthnotebeamed",
  25983. 0x266b,
  25984. "eightideographicparen",
  25985. 0x3227,
  25986. "eightinferior",
  25987. 0x2088,
  25988. "eightmonospace",
  25989. 0xff18,
  25990. "eightoldstyle",
  25991. 0xf738,
  25992. "eightparen",
  25993. 0x247b,
  25994. "eightperiod",
  25995. 0x248f,
  25996. "eightpersian",
  25997. 0x06f8,
  25998. "eightroman",
  25999. 0x2177,
  26000. "eightsuperior",
  26001. 0x2078,
  26002. "eightthai",
  26003. 0x0e58,
  26004. "einvertedbreve",
  26005. 0x0207,
  26006. "eiotifiedcyrillic",
  26007. 0x0465,
  26008. "ekatakana",
  26009. 0x30a8,
  26010. "ekatakanahalfwidth",
  26011. 0xff74,
  26012. "ekonkargurmukhi",
  26013. 0x0a74,
  26014. "ekorean",
  26015. 0x3154,
  26016. "elcyrillic",
  26017. 0x043b,
  26018. "element",
  26019. 0x2208,
  26020. "elevencircle",
  26021. 0x246a,
  26022. "elevenparen",
  26023. 0x247e,
  26024. "elevenperiod",
  26025. 0x2492,
  26026. "elevenroman",
  26027. 0x217a,
  26028. "ellipsis",
  26029. 0x2026,
  26030. "ellipsisvertical",
  26031. 0x22ee,
  26032. "emacron",
  26033. 0x0113,
  26034. "emacronacute",
  26035. 0x1e17,
  26036. "emacrongrave",
  26037. 0x1e15,
  26038. "emcyrillic",
  26039. 0x043c,
  26040. "emdash",
  26041. 0x2014,
  26042. "emdashvertical",
  26043. 0xfe31,
  26044. "emonospace",
  26045. 0xff45,
  26046. "emphasismarkarmenian",
  26047. 0x055b,
  26048. "emptyset",
  26049. 0x2205,
  26050. "enbopomofo",
  26051. 0x3123,
  26052. "encyrillic",
  26053. 0x043d,
  26054. "endash",
  26055. 0x2013,
  26056. "endashvertical",
  26057. 0xfe32,
  26058. "endescendercyrillic",
  26059. 0x04a3,
  26060. "eng",
  26061. 0x014b,
  26062. "engbopomofo",
  26063. 0x3125,
  26064. "enghecyrillic",
  26065. 0x04a5,
  26066. "enhookcyrillic",
  26067. 0x04c8,
  26068. "enspace",
  26069. 0x2002,
  26070. "eogonek",
  26071. 0x0119,
  26072. "eokorean",
  26073. 0x3153,
  26074. "eopen",
  26075. 0x025b,
  26076. "eopenclosed",
  26077. 0x029a,
  26078. "eopenreversed",
  26079. 0x025c,
  26080. "eopenreversedclosed",
  26081. 0x025e,
  26082. "eopenreversedhook",
  26083. 0x025d,
  26084. "eparen",
  26085. 0x24a0,
  26086. "epsilon",
  26087. 0x03b5,
  26088. "epsilontonos",
  26089. 0x03ad,
  26090. "equal",
  26091. 0x003d,
  26092. "equalmonospace",
  26093. 0xff1d,
  26094. "equalsmall",
  26095. 0xfe66,
  26096. "equalsuperior",
  26097. 0x207c,
  26098. "equivalence",
  26099. 0x2261,
  26100. "erbopomofo",
  26101. 0x3126,
  26102. "ercyrillic",
  26103. 0x0440,
  26104. "ereversed",
  26105. 0x0258,
  26106. "ereversedcyrillic",
  26107. 0x044d,
  26108. "escyrillic",
  26109. 0x0441,
  26110. "esdescendercyrillic",
  26111. 0x04ab,
  26112. "esh",
  26113. 0x0283,
  26114. "eshcurl",
  26115. 0x0286,
  26116. "eshortdeva",
  26117. 0x090e,
  26118. "eshortvowelsigndeva",
  26119. 0x0946,
  26120. "eshreversedloop",
  26121. 0x01aa,
  26122. "eshsquatreversed",
  26123. 0x0285,
  26124. "esmallhiragana",
  26125. 0x3047,
  26126. "esmallkatakana",
  26127. 0x30a7,
  26128. "esmallkatakanahalfwidth",
  26129. 0xff6a,
  26130. "estimated",
  26131. 0x212e,
  26132. "esuperior",
  26133. 0xf6ec,
  26134. "eta",
  26135. 0x03b7,
  26136. "etarmenian",
  26137. 0x0568,
  26138. "etatonos",
  26139. 0x03ae,
  26140. "eth",
  26141. 0x00f0,
  26142. "etilde",
  26143. 0x1ebd,
  26144. "etildebelow",
  26145. 0x1e1b,
  26146. "etnahtafoukhhebrew",
  26147. 0x0591,
  26148. "etnahtafoukhlefthebrew",
  26149. 0x0591,
  26150. "etnahtahebrew",
  26151. 0x0591,
  26152. "etnahtalefthebrew",
  26153. 0x0591,
  26154. "eturned",
  26155. 0x01dd,
  26156. "eukorean",
  26157. 0x3161,
  26158. "euro",
  26159. 0x20ac,
  26160. "evowelsignbengali",
  26161. 0x09c7,
  26162. "evowelsigndeva",
  26163. 0x0947,
  26164. "evowelsigngujarati",
  26165. 0x0ac7,
  26166. "exclam",
  26167. 0x0021,
  26168. "exclamarmenian",
  26169. 0x055c,
  26170. "exclamdbl",
  26171. 0x203c,
  26172. "exclamdown",
  26173. 0x00a1,
  26174. "exclamdownsmall",
  26175. 0xf7a1,
  26176. "exclammonospace",
  26177. 0xff01,
  26178. "exclamsmall",
  26179. 0xf721,
  26180. "existential",
  26181. 0x2203,
  26182. "ezh",
  26183. 0x0292,
  26184. "ezhcaron",
  26185. 0x01ef,
  26186. "ezhcurl",
  26187. 0x0293,
  26188. "ezhreversed",
  26189. 0x01b9,
  26190. "ezhtail",
  26191. 0x01ba,
  26192. "f",
  26193. 0x0066,
  26194. "fadeva",
  26195. 0x095e,
  26196. "fagurmukhi",
  26197. 0x0a5e,
  26198. "fahrenheit",
  26199. 0x2109,
  26200. "fathaarabic",
  26201. 0x064e,
  26202. "fathalowarabic",
  26203. 0x064e,
  26204. "fathatanarabic",
  26205. 0x064b,
  26206. "fbopomofo",
  26207. 0x3108,
  26208. "fcircle",
  26209. 0x24d5,
  26210. "fdotaccent",
  26211. 0x1e1f,
  26212. "feharabic",
  26213. 0x0641,
  26214. "feharmenian",
  26215. 0x0586,
  26216. "fehfinalarabic",
  26217. 0xfed2,
  26218. "fehinitialarabic",
  26219. 0xfed3,
  26220. "fehmedialarabic",
  26221. 0xfed4,
  26222. "feicoptic",
  26223. 0x03e5,
  26224. "female",
  26225. 0x2640,
  26226. "ff",
  26227. 0xfb00,
  26228. "f_f",
  26229. 0xfb00,
  26230. "ffi",
  26231. 0xfb03,
  26232. "ffl",
  26233. 0xfb04,
  26234. "fi",
  26235. 0xfb01,
  26236. "fifteencircle",
  26237. 0x246e,
  26238. "fifteenparen",
  26239. 0x2482,
  26240. "fifteenperiod",
  26241. 0x2496,
  26242. "figuredash",
  26243. 0x2012,
  26244. "filledbox",
  26245. 0x25a0,
  26246. "filledrect",
  26247. 0x25ac,
  26248. "finalkaf",
  26249. 0x05da,
  26250. "finalkafdagesh",
  26251. 0xfb3a,
  26252. "finalkafdageshhebrew",
  26253. 0xfb3a,
  26254. "finalkafhebrew",
  26255. 0x05da,
  26256. "finalmem",
  26257. 0x05dd,
  26258. "finalmemhebrew",
  26259. 0x05dd,
  26260. "finalnun",
  26261. 0x05df,
  26262. "finalnunhebrew",
  26263. 0x05df,
  26264. "finalpe",
  26265. 0x05e3,
  26266. "finalpehebrew",
  26267. 0x05e3,
  26268. "finaltsadi",
  26269. 0x05e5,
  26270. "finaltsadihebrew",
  26271. 0x05e5,
  26272. "firsttonechinese",
  26273. 0x02c9,
  26274. "fisheye",
  26275. 0x25c9,
  26276. "fitacyrillic",
  26277. 0x0473,
  26278. "five",
  26279. 0x0035,
  26280. "fivearabic",
  26281. 0x0665,
  26282. "fivebengali",
  26283. 0x09eb,
  26284. "fivecircle",
  26285. 0x2464,
  26286. "fivecircleinversesansserif",
  26287. 0x278e,
  26288. "fivedeva",
  26289. 0x096b,
  26290. "fiveeighths",
  26291. 0x215d,
  26292. "fivegujarati",
  26293. 0x0aeb,
  26294. "fivegurmukhi",
  26295. 0x0a6b,
  26296. "fivehackarabic",
  26297. 0x0665,
  26298. "fivehangzhou",
  26299. 0x3025,
  26300. "fiveideographicparen",
  26301. 0x3224,
  26302. "fiveinferior",
  26303. 0x2085,
  26304. "fivemonospace",
  26305. 0xff15,
  26306. "fiveoldstyle",
  26307. 0xf735,
  26308. "fiveparen",
  26309. 0x2478,
  26310. "fiveperiod",
  26311. 0x248c,
  26312. "fivepersian",
  26313. 0x06f5,
  26314. "fiveroman",
  26315. 0x2174,
  26316. "fivesuperior",
  26317. 0x2075,
  26318. "fivethai",
  26319. 0x0e55,
  26320. "fl",
  26321. 0xfb02,
  26322. "florin",
  26323. 0x0192,
  26324. "fmonospace",
  26325. 0xff46,
  26326. "fmsquare",
  26327. 0x3399,
  26328. "fofanthai",
  26329. 0x0e1f,
  26330. "fofathai",
  26331. 0x0e1d,
  26332. "fongmanthai",
  26333. 0x0e4f,
  26334. "forall",
  26335. 0x2200,
  26336. "four",
  26337. 0x0034,
  26338. "fourarabic",
  26339. 0x0664,
  26340. "fourbengali",
  26341. 0x09ea,
  26342. "fourcircle",
  26343. 0x2463,
  26344. "fourcircleinversesansserif",
  26345. 0x278d,
  26346. "fourdeva",
  26347. 0x096a,
  26348. "fourgujarati",
  26349. 0x0aea,
  26350. "fourgurmukhi",
  26351. 0x0a6a,
  26352. "fourhackarabic",
  26353. 0x0664,
  26354. "fourhangzhou",
  26355. 0x3024,
  26356. "fourideographicparen",
  26357. 0x3223,
  26358. "fourinferior",
  26359. 0x2084,
  26360. "fourmonospace",
  26361. 0xff14,
  26362. "fournumeratorbengali",
  26363. 0x09f7,
  26364. "fouroldstyle",
  26365. 0xf734,
  26366. "fourparen",
  26367. 0x2477,
  26368. "fourperiod",
  26369. 0x248b,
  26370. "fourpersian",
  26371. 0x06f4,
  26372. "fourroman",
  26373. 0x2173,
  26374. "foursuperior",
  26375. 0x2074,
  26376. "fourteencircle",
  26377. 0x246d,
  26378. "fourteenparen",
  26379. 0x2481,
  26380. "fourteenperiod",
  26381. 0x2495,
  26382. "fourthai",
  26383. 0x0e54,
  26384. "fourthtonechinese",
  26385. 0x02cb,
  26386. "fparen",
  26387. 0x24a1,
  26388. "fraction",
  26389. 0x2044,
  26390. "franc",
  26391. 0x20a3,
  26392. "g",
  26393. 0x0067,
  26394. "gabengali",
  26395. 0x0997,
  26396. "gacute",
  26397. 0x01f5,
  26398. "gadeva",
  26399. 0x0917,
  26400. "gafarabic",
  26401. 0x06af,
  26402. "gaffinalarabic",
  26403. 0xfb93,
  26404. "gafinitialarabic",
  26405. 0xfb94,
  26406. "gafmedialarabic",
  26407. 0xfb95,
  26408. "gagujarati",
  26409. 0x0a97,
  26410. "gagurmukhi",
  26411. 0x0a17,
  26412. "gahiragana",
  26413. 0x304c,
  26414. "gakatakana",
  26415. 0x30ac,
  26416. "gamma",
  26417. 0x03b3,
  26418. "gammalatinsmall",
  26419. 0x0263,
  26420. "gammasuperior",
  26421. 0x02e0,
  26422. "gangiacoptic",
  26423. 0x03eb,
  26424. "gbopomofo",
  26425. 0x310d,
  26426. "gbreve",
  26427. 0x011f,
  26428. "gcaron",
  26429. 0x01e7,
  26430. "gcedilla",
  26431. 0x0123,
  26432. "gcircle",
  26433. 0x24d6,
  26434. "gcircumflex",
  26435. 0x011d,
  26436. "gcommaaccent",
  26437. 0x0123,
  26438. "gdot",
  26439. 0x0121,
  26440. "gdotaccent",
  26441. 0x0121,
  26442. "gecyrillic",
  26443. 0x0433,
  26444. "gehiragana",
  26445. 0x3052,
  26446. "gekatakana",
  26447. 0x30b2,
  26448. "geometricallyequal",
  26449. 0x2251,
  26450. "gereshaccenthebrew",
  26451. 0x059c,
  26452. "gereshhebrew",
  26453. 0x05f3,
  26454. "gereshmuqdamhebrew",
  26455. 0x059d,
  26456. "germandbls",
  26457. 0x00df,
  26458. "gershayimaccenthebrew",
  26459. 0x059e,
  26460. "gershayimhebrew",
  26461. 0x05f4,
  26462. "getamark",
  26463. 0x3013,
  26464. "ghabengali",
  26465. 0x0998,
  26466. "ghadarmenian",
  26467. 0x0572,
  26468. "ghadeva",
  26469. 0x0918,
  26470. "ghagujarati",
  26471. 0x0a98,
  26472. "ghagurmukhi",
  26473. 0x0a18,
  26474. "ghainarabic",
  26475. 0x063a,
  26476. "ghainfinalarabic",
  26477. 0xfece,
  26478. "ghaininitialarabic",
  26479. 0xfecf,
  26480. "ghainmedialarabic",
  26481. 0xfed0,
  26482. "ghemiddlehookcyrillic",
  26483. 0x0495,
  26484. "ghestrokecyrillic",
  26485. 0x0493,
  26486. "gheupturncyrillic",
  26487. 0x0491,
  26488. "ghhadeva",
  26489. 0x095a,
  26490. "ghhagurmukhi",
  26491. 0x0a5a,
  26492. "ghook",
  26493. 0x0260,
  26494. "ghzsquare",
  26495. 0x3393,
  26496. "gihiragana",
  26497. 0x304e,
  26498. "gikatakana",
  26499. 0x30ae,
  26500. "gimarmenian",
  26501. 0x0563,
  26502. "gimel",
  26503. 0x05d2,
  26504. "gimeldagesh",
  26505. 0xfb32,
  26506. "gimeldageshhebrew",
  26507. 0xfb32,
  26508. "gimelhebrew",
  26509. 0x05d2,
  26510. "gjecyrillic",
  26511. 0x0453,
  26512. "glottalinvertedstroke",
  26513. 0x01be,
  26514. "glottalstop",
  26515. 0x0294,
  26516. "glottalstopinverted",
  26517. 0x0296,
  26518. "glottalstopmod",
  26519. 0x02c0,
  26520. "glottalstopreversed",
  26521. 0x0295,
  26522. "glottalstopreversedmod",
  26523. 0x02c1,
  26524. "glottalstopreversedsuperior",
  26525. 0x02e4,
  26526. "glottalstopstroke",
  26527. 0x02a1,
  26528. "glottalstopstrokereversed",
  26529. 0x02a2,
  26530. "gmacron",
  26531. 0x1e21,
  26532. "gmonospace",
  26533. 0xff47,
  26534. "gohiragana",
  26535. 0x3054,
  26536. "gokatakana",
  26537. 0x30b4,
  26538. "gparen",
  26539. 0x24a2,
  26540. "gpasquare",
  26541. 0x33ac,
  26542. "gradient",
  26543. 0x2207,
  26544. "grave",
  26545. 0x0060,
  26546. "gravebelowcmb",
  26547. 0x0316,
  26548. "gravecmb",
  26549. 0x0300,
  26550. "gravecomb",
  26551. 0x0300,
  26552. "gravedeva",
  26553. 0x0953,
  26554. "gravelowmod",
  26555. 0x02ce,
  26556. "gravemonospace",
  26557. 0xff40,
  26558. "gravetonecmb",
  26559. 0x0340,
  26560. "greater",
  26561. 0x003e,
  26562. "greaterequal",
  26563. 0x2265,
  26564. "greaterequalorless",
  26565. 0x22db,
  26566. "greatermonospace",
  26567. 0xff1e,
  26568. "greaterorequivalent",
  26569. 0x2273,
  26570. "greaterorless",
  26571. 0x2277,
  26572. "greateroverequal",
  26573. 0x2267,
  26574. "greatersmall",
  26575. 0xfe65,
  26576. "gscript",
  26577. 0x0261,
  26578. "gstroke",
  26579. 0x01e5,
  26580. "guhiragana",
  26581. 0x3050,
  26582. "guillemotleft",
  26583. 0x00ab,
  26584. "guillemotright",
  26585. 0x00bb,
  26586. "guilsinglleft",
  26587. 0x2039,
  26588. "guilsinglright",
  26589. 0x203a,
  26590. "gukatakana",
  26591. 0x30b0,
  26592. "guramusquare",
  26593. 0x3318,
  26594. "gysquare",
  26595. 0x33c9,
  26596. "h",
  26597. 0x0068,
  26598. "haabkhasiancyrillic",
  26599. 0x04a9,
  26600. "haaltonearabic",
  26601. 0x06c1,
  26602. "habengali",
  26603. 0x09b9,
  26604. "hadescendercyrillic",
  26605. 0x04b3,
  26606. "hadeva",
  26607. 0x0939,
  26608. "hagujarati",
  26609. 0x0ab9,
  26610. "hagurmukhi",
  26611. 0x0a39,
  26612. "haharabic",
  26613. 0x062d,
  26614. "hahfinalarabic",
  26615. 0xfea2,
  26616. "hahinitialarabic",
  26617. 0xfea3,
  26618. "hahiragana",
  26619. 0x306f,
  26620. "hahmedialarabic",
  26621. 0xfea4,
  26622. "haitusquare",
  26623. 0x332a,
  26624. "hakatakana",
  26625. 0x30cf,
  26626. "hakatakanahalfwidth",
  26627. 0xff8a,
  26628. "halantgurmukhi",
  26629. 0x0a4d,
  26630. "hamzaarabic",
  26631. 0x0621,
  26632. "hamzalowarabic",
  26633. 0x0621,
  26634. "hangulfiller",
  26635. 0x3164,
  26636. "hardsigncyrillic",
  26637. 0x044a,
  26638. "harpoonleftbarbup",
  26639. 0x21bc,
  26640. "harpoonrightbarbup",
  26641. 0x21c0,
  26642. "hasquare",
  26643. 0x33ca,
  26644. "hatafpatah",
  26645. 0x05b2,
  26646. "hatafpatah16",
  26647. 0x05b2,
  26648. "hatafpatah23",
  26649. 0x05b2,
  26650. "hatafpatah2f",
  26651. 0x05b2,
  26652. "hatafpatahhebrew",
  26653. 0x05b2,
  26654. "hatafpatahnarrowhebrew",
  26655. 0x05b2,
  26656. "hatafpatahquarterhebrew",
  26657. 0x05b2,
  26658. "hatafpatahwidehebrew",
  26659. 0x05b2,
  26660. "hatafqamats",
  26661. 0x05b3,
  26662. "hatafqamats1b",
  26663. 0x05b3,
  26664. "hatafqamats28",
  26665. 0x05b3,
  26666. "hatafqamats34",
  26667. 0x05b3,
  26668. "hatafqamatshebrew",
  26669. 0x05b3,
  26670. "hatafqamatsnarrowhebrew",
  26671. 0x05b3,
  26672. "hatafqamatsquarterhebrew",
  26673. 0x05b3,
  26674. "hatafqamatswidehebrew",
  26675. 0x05b3,
  26676. "hatafsegol",
  26677. 0x05b1,
  26678. "hatafsegol17",
  26679. 0x05b1,
  26680. "hatafsegol24",
  26681. 0x05b1,
  26682. "hatafsegol30",
  26683. 0x05b1,
  26684. "hatafsegolhebrew",
  26685. 0x05b1,
  26686. "hatafsegolnarrowhebrew",
  26687. 0x05b1,
  26688. "hatafsegolquarterhebrew",
  26689. 0x05b1,
  26690. "hatafsegolwidehebrew",
  26691. 0x05b1,
  26692. "hbar",
  26693. 0x0127,
  26694. "hbopomofo",
  26695. 0x310f,
  26696. "hbrevebelow",
  26697. 0x1e2b,
  26698. "hcedilla",
  26699. 0x1e29,
  26700. "hcircle",
  26701. 0x24d7,
  26702. "hcircumflex",
  26703. 0x0125,
  26704. "hdieresis",
  26705. 0x1e27,
  26706. "hdotaccent",
  26707. 0x1e23,
  26708. "hdotbelow",
  26709. 0x1e25,
  26710. "he",
  26711. 0x05d4,
  26712. "heart",
  26713. 0x2665,
  26714. "heartsuitblack",
  26715. 0x2665,
  26716. "heartsuitwhite",
  26717. 0x2661,
  26718. "hedagesh",
  26719. 0xfb34,
  26720. "hedageshhebrew",
  26721. 0xfb34,
  26722. "hehaltonearabic",
  26723. 0x06c1,
  26724. "heharabic",
  26725. 0x0647,
  26726. "hehebrew",
  26727. 0x05d4,
  26728. "hehfinalaltonearabic",
  26729. 0xfba7,
  26730. "hehfinalalttwoarabic",
  26731. 0xfeea,
  26732. "hehfinalarabic",
  26733. 0xfeea,
  26734. "hehhamzaabovefinalarabic",
  26735. 0xfba5,
  26736. "hehhamzaaboveisolatedarabic",
  26737. 0xfba4,
  26738. "hehinitialaltonearabic",
  26739. 0xfba8,
  26740. "hehinitialarabic",
  26741. 0xfeeb,
  26742. "hehiragana",
  26743. 0x3078,
  26744. "hehmedialaltonearabic",
  26745. 0xfba9,
  26746. "hehmedialarabic",
  26747. 0xfeec,
  26748. "heiseierasquare",
  26749. 0x337b,
  26750. "hekatakana",
  26751. 0x30d8,
  26752. "hekatakanahalfwidth",
  26753. 0xff8d,
  26754. "hekutaarusquare",
  26755. 0x3336,
  26756. "henghook",
  26757. 0x0267,
  26758. "herutusquare",
  26759. 0x3339,
  26760. "het",
  26761. 0x05d7,
  26762. "hethebrew",
  26763. 0x05d7,
  26764. "hhook",
  26765. 0x0266,
  26766. "hhooksuperior",
  26767. 0x02b1,
  26768. "hieuhacirclekorean",
  26769. 0x327b,
  26770. "hieuhaparenkorean",
  26771. 0x321b,
  26772. "hieuhcirclekorean",
  26773. 0x326d,
  26774. "hieuhkorean",
  26775. 0x314e,
  26776. "hieuhparenkorean",
  26777. 0x320d,
  26778. "hihiragana",
  26779. 0x3072,
  26780. "hikatakana",
  26781. 0x30d2,
  26782. "hikatakanahalfwidth",
  26783. 0xff8b,
  26784. "hiriq",
  26785. 0x05b4,
  26786. "hiriq14",
  26787. 0x05b4,
  26788. "hiriq21",
  26789. 0x05b4,
  26790. "hiriq2d",
  26791. 0x05b4,
  26792. "hiriqhebrew",
  26793. 0x05b4,
  26794. "hiriqnarrowhebrew",
  26795. 0x05b4,
  26796. "hiriqquarterhebrew",
  26797. 0x05b4,
  26798. "hiriqwidehebrew",
  26799. 0x05b4,
  26800. "hlinebelow",
  26801. 0x1e96,
  26802. "hmonospace",
  26803. 0xff48,
  26804. "hoarmenian",
  26805. 0x0570,
  26806. "hohipthai",
  26807. 0x0e2b,
  26808. "hohiragana",
  26809. 0x307b,
  26810. "hokatakana",
  26811. 0x30db,
  26812. "hokatakanahalfwidth",
  26813. 0xff8e,
  26814. "holam",
  26815. 0x05b9,
  26816. "holam19",
  26817. 0x05b9,
  26818. "holam26",
  26819. 0x05b9,
  26820. "holam32",
  26821. 0x05b9,
  26822. "holamhebrew",
  26823. 0x05b9,
  26824. "holamnarrowhebrew",
  26825. 0x05b9,
  26826. "holamquarterhebrew",
  26827. 0x05b9,
  26828. "holamwidehebrew",
  26829. 0x05b9,
  26830. "honokhukthai",
  26831. 0x0e2e,
  26832. "hookabovecomb",
  26833. 0x0309,
  26834. "hookcmb",
  26835. 0x0309,
  26836. "hookpalatalizedbelowcmb",
  26837. 0x0321,
  26838. "hookretroflexbelowcmb",
  26839. 0x0322,
  26840. "hoonsquare",
  26841. 0x3342,
  26842. "horicoptic",
  26843. 0x03e9,
  26844. "horizontalbar",
  26845. 0x2015,
  26846. "horncmb",
  26847. 0x031b,
  26848. "hotsprings",
  26849. 0x2668,
  26850. "house",
  26851. 0x2302,
  26852. "hparen",
  26853. 0x24a3,
  26854. "hsuperior",
  26855. 0x02b0,
  26856. "hturned",
  26857. 0x0265,
  26858. "huhiragana",
  26859. 0x3075,
  26860. "huiitosquare",
  26861. 0x3333,
  26862. "hukatakana",
  26863. 0x30d5,
  26864. "hukatakanahalfwidth",
  26865. 0xff8c,
  26866. "hungarumlaut",
  26867. 0x02dd,
  26868. "hungarumlautcmb",
  26869. 0x030b,
  26870. "hv",
  26871. 0x0195,
  26872. "hyphen",
  26873. 0x002d,
  26874. "hypheninferior",
  26875. 0xf6e5,
  26876. "hyphenmonospace",
  26877. 0xff0d,
  26878. "hyphensmall",
  26879. 0xfe63,
  26880. "hyphensuperior",
  26881. 0xf6e6,
  26882. "hyphentwo",
  26883. 0x2010,
  26884. "i",
  26885. 0x0069,
  26886. "iacute",
  26887. 0x00ed,
  26888. "iacyrillic",
  26889. 0x044f,
  26890. "ibengali",
  26891. 0x0987,
  26892. "ibopomofo",
  26893. 0x3127,
  26894. "ibreve",
  26895. 0x012d,
  26896. "icaron",
  26897. 0x01d0,
  26898. "icircle",
  26899. 0x24d8,
  26900. "icircumflex",
  26901. 0x00ee,
  26902. "icyrillic",
  26903. 0x0456,
  26904. "idblgrave",
  26905. 0x0209,
  26906. "ideographearthcircle",
  26907. 0x328f,
  26908. "ideographfirecircle",
  26909. 0x328b,
  26910. "ideographicallianceparen",
  26911. 0x323f,
  26912. "ideographiccallparen",
  26913. 0x323a,
  26914. "ideographiccentrecircle",
  26915. 0x32a5,
  26916. "ideographicclose",
  26917. 0x3006,
  26918. "ideographiccomma",
  26919. 0x3001,
  26920. "ideographiccommaleft",
  26921. 0xff64,
  26922. "ideographiccongratulationparen",
  26923. 0x3237,
  26924. "ideographiccorrectcircle",
  26925. 0x32a3,
  26926. "ideographicearthparen",
  26927. 0x322f,
  26928. "ideographicenterpriseparen",
  26929. 0x323d,
  26930. "ideographicexcellentcircle",
  26931. 0x329d,
  26932. "ideographicfestivalparen",
  26933. 0x3240,
  26934. "ideographicfinancialcircle",
  26935. 0x3296,
  26936. "ideographicfinancialparen",
  26937. 0x3236,
  26938. "ideographicfireparen",
  26939. 0x322b,
  26940. "ideographichaveparen",
  26941. 0x3232,
  26942. "ideographichighcircle",
  26943. 0x32a4,
  26944. "ideographiciterationmark",
  26945. 0x3005,
  26946. "ideographiclaborcircle",
  26947. 0x3298,
  26948. "ideographiclaborparen",
  26949. 0x3238,
  26950. "ideographicleftcircle",
  26951. 0x32a7,
  26952. "ideographiclowcircle",
  26953. 0x32a6,
  26954. "ideographicmedicinecircle",
  26955. 0x32a9,
  26956. "ideographicmetalparen",
  26957. 0x322e,
  26958. "ideographicmoonparen",
  26959. 0x322a,
  26960. "ideographicnameparen",
  26961. 0x3234,
  26962. "ideographicperiod",
  26963. 0x3002,
  26964. "ideographicprintcircle",
  26965. 0x329e,
  26966. "ideographicreachparen",
  26967. 0x3243,
  26968. "ideographicrepresentparen",
  26969. 0x3239,
  26970. "ideographicresourceparen",
  26971. 0x323e,
  26972. "ideographicrightcircle",
  26973. 0x32a8,
  26974. "ideographicsecretcircle",
  26975. 0x3299,
  26976. "ideographicselfparen",
  26977. 0x3242,
  26978. "ideographicsocietyparen",
  26979. 0x3233,
  26980. "ideographicspace",
  26981. 0x3000,
  26982. "ideographicspecialparen",
  26983. 0x3235,
  26984. "ideographicstockparen",
  26985. 0x3231,
  26986. "ideographicstudyparen",
  26987. 0x323b,
  26988. "ideographicsunparen",
  26989. 0x3230,
  26990. "ideographicsuperviseparen",
  26991. 0x323c,
  26992. "ideographicwaterparen",
  26993. 0x322c,
  26994. "ideographicwoodparen",
  26995. 0x322d,
  26996. "ideographiczero",
  26997. 0x3007,
  26998. "ideographmetalcircle",
  26999. 0x328e,
  27000. "ideographmooncircle",
  27001. 0x328a,
  27002. "ideographnamecircle",
  27003. 0x3294,
  27004. "ideographsuncircle",
  27005. 0x3290,
  27006. "ideographwatercircle",
  27007. 0x328c,
  27008. "ideographwoodcircle",
  27009. 0x328d,
  27010. "ideva",
  27011. 0x0907,
  27012. "idieresis",
  27013. 0x00ef,
  27014. "idieresisacute",
  27015. 0x1e2f,
  27016. "idieresiscyrillic",
  27017. 0x04e5,
  27018. "idotbelow",
  27019. 0x1ecb,
  27020. "iebrevecyrillic",
  27021. 0x04d7,
  27022. "iecyrillic",
  27023. 0x0435,
  27024. "ieungacirclekorean",
  27025. 0x3275,
  27026. "ieungaparenkorean",
  27027. 0x3215,
  27028. "ieungcirclekorean",
  27029. 0x3267,
  27030. "ieungkorean",
  27031. 0x3147,
  27032. "ieungparenkorean",
  27033. 0x3207,
  27034. "igrave",
  27035. 0x00ec,
  27036. "igujarati",
  27037. 0x0a87,
  27038. "igurmukhi",
  27039. 0x0a07,
  27040. "ihiragana",
  27041. 0x3044,
  27042. "ihookabove",
  27043. 0x1ec9,
  27044. "iibengali",
  27045. 0x0988,
  27046. "iicyrillic",
  27047. 0x0438,
  27048. "iideva",
  27049. 0x0908,
  27050. "iigujarati",
  27051. 0x0a88,
  27052. "iigurmukhi",
  27053. 0x0a08,
  27054. "iimatragurmukhi",
  27055. 0x0a40,
  27056. "iinvertedbreve",
  27057. 0x020b,
  27058. "iishortcyrillic",
  27059. 0x0439,
  27060. "iivowelsignbengali",
  27061. 0x09c0,
  27062. "iivowelsigndeva",
  27063. 0x0940,
  27064. "iivowelsigngujarati",
  27065. 0x0ac0,
  27066. "ij",
  27067. 0x0133,
  27068. "ikatakana",
  27069. 0x30a4,
  27070. "ikatakanahalfwidth",
  27071. 0xff72,
  27072. "ikorean",
  27073. 0x3163,
  27074. "ilde",
  27075. 0x02dc,
  27076. "iluyhebrew",
  27077. 0x05ac,
  27078. "imacron",
  27079. 0x012b,
  27080. "imacroncyrillic",
  27081. 0x04e3,
  27082. "imageorapproximatelyequal",
  27083. 0x2253,
  27084. "imatragurmukhi",
  27085. 0x0a3f,
  27086. "imonospace",
  27087. 0xff49,
  27088. "increment",
  27089. 0x2206,
  27090. "infinity",
  27091. 0x221e,
  27092. "iniarmenian",
  27093. 0x056b,
  27094. "integral",
  27095. 0x222b,
  27096. "integralbottom",
  27097. 0x2321,
  27098. "integralbt",
  27099. 0x2321,
  27100. "integralex",
  27101. 0xf8f5,
  27102. "integraltop",
  27103. 0x2320,
  27104. "integraltp",
  27105. 0x2320,
  27106. "intersection",
  27107. 0x2229,
  27108. "intisquare",
  27109. 0x3305,
  27110. "invbullet",
  27111. 0x25d8,
  27112. "invcircle",
  27113. 0x25d9,
  27114. "invsmileface",
  27115. 0x263b,
  27116. "iocyrillic",
  27117. 0x0451,
  27118. "iogonek",
  27119. 0x012f,
  27120. "iota",
  27121. 0x03b9,
  27122. "iotadieresis",
  27123. 0x03ca,
  27124. "iotadieresistonos",
  27125. 0x0390,
  27126. "iotalatin",
  27127. 0x0269,
  27128. "iotatonos",
  27129. 0x03af,
  27130. "iparen",
  27131. 0x24a4,
  27132. "irigurmukhi",
  27133. 0x0a72,
  27134. "ismallhiragana",
  27135. 0x3043,
  27136. "ismallkatakana",
  27137. 0x30a3,
  27138. "ismallkatakanahalfwidth",
  27139. 0xff68,
  27140. "issharbengali",
  27141. 0x09fa,
  27142. "istroke",
  27143. 0x0268,
  27144. "isuperior",
  27145. 0xf6ed,
  27146. "iterationhiragana",
  27147. 0x309d,
  27148. "iterationkatakana",
  27149. 0x30fd,
  27150. "itilde",
  27151. 0x0129,
  27152. "itildebelow",
  27153. 0x1e2d,
  27154. "iubopomofo",
  27155. 0x3129,
  27156. "iucyrillic",
  27157. 0x044e,
  27158. "ivowelsignbengali",
  27159. 0x09bf,
  27160. "ivowelsigndeva",
  27161. 0x093f,
  27162. "ivowelsigngujarati",
  27163. 0x0abf,
  27164. "izhitsacyrillic",
  27165. 0x0475,
  27166. "izhitsadblgravecyrillic",
  27167. 0x0477,
  27168. "j",
  27169. 0x006a,
  27170. "jaarmenian",
  27171. 0x0571,
  27172. "jabengali",
  27173. 0x099c,
  27174. "jadeva",
  27175. 0x091c,
  27176. "jagujarati",
  27177. 0x0a9c,
  27178. "jagurmukhi",
  27179. 0x0a1c,
  27180. "jbopomofo",
  27181. 0x3110,
  27182. "jcaron",
  27183. 0x01f0,
  27184. "jcircle",
  27185. 0x24d9,
  27186. "jcircumflex",
  27187. 0x0135,
  27188. "jcrossedtail",
  27189. 0x029d,
  27190. "jdotlessstroke",
  27191. 0x025f,
  27192. "jecyrillic",
  27193. 0x0458,
  27194. "jeemarabic",
  27195. 0x062c,
  27196. "jeemfinalarabic",
  27197. 0xfe9e,
  27198. "jeeminitialarabic",
  27199. 0xfe9f,
  27200. "jeemmedialarabic",
  27201. 0xfea0,
  27202. "jeharabic",
  27203. 0x0698,
  27204. "jehfinalarabic",
  27205. 0xfb8b,
  27206. "jhabengali",
  27207. 0x099d,
  27208. "jhadeva",
  27209. 0x091d,
  27210. "jhagujarati",
  27211. 0x0a9d,
  27212. "jhagurmukhi",
  27213. 0x0a1d,
  27214. "jheharmenian",
  27215. 0x057b,
  27216. "jis",
  27217. 0x3004,
  27218. "jmonospace",
  27219. 0xff4a,
  27220. "jparen",
  27221. 0x24a5,
  27222. "jsuperior",
  27223. 0x02b2,
  27224. "k",
  27225. 0x006b,
  27226. "kabashkircyrillic",
  27227. 0x04a1,
  27228. "kabengali",
  27229. 0x0995,
  27230. "kacute",
  27231. 0x1e31,
  27232. "kacyrillic",
  27233. 0x043a,
  27234. "kadescendercyrillic",
  27235. 0x049b,
  27236. "kadeva",
  27237. 0x0915,
  27238. "kaf",
  27239. 0x05db,
  27240. "kafarabic",
  27241. 0x0643,
  27242. "kafdagesh",
  27243. 0xfb3b,
  27244. "kafdageshhebrew",
  27245. 0xfb3b,
  27246. "kaffinalarabic",
  27247. 0xfeda,
  27248. "kafhebrew",
  27249. 0x05db,
  27250. "kafinitialarabic",
  27251. 0xfedb,
  27252. "kafmedialarabic",
  27253. 0xfedc,
  27254. "kafrafehebrew",
  27255. 0xfb4d,
  27256. "kagujarati",
  27257. 0x0a95,
  27258. "kagurmukhi",
  27259. 0x0a15,
  27260. "kahiragana",
  27261. 0x304b,
  27262. "kahookcyrillic",
  27263. 0x04c4,
  27264. "kakatakana",
  27265. 0x30ab,
  27266. "kakatakanahalfwidth",
  27267. 0xff76,
  27268. "kappa",
  27269. 0x03ba,
  27270. "kappasymbolgreek",
  27271. 0x03f0,
  27272. "kapyeounmieumkorean",
  27273. 0x3171,
  27274. "kapyeounphieuphkorean",
  27275. 0x3184,
  27276. "kapyeounpieupkorean",
  27277. 0x3178,
  27278. "kapyeounssangpieupkorean",
  27279. 0x3179,
  27280. "karoriisquare",
  27281. 0x330d,
  27282. "kashidaautoarabic",
  27283. 0x0640,
  27284. "kashidaautonosidebearingarabic",
  27285. 0x0640,
  27286. "kasmallkatakana",
  27287. 0x30f5,
  27288. "kasquare",
  27289. 0x3384,
  27290. "kasraarabic",
  27291. 0x0650,
  27292. "kasratanarabic",
  27293. 0x064d,
  27294. "kastrokecyrillic",
  27295. 0x049f,
  27296. "katahiraprolongmarkhalfwidth",
  27297. 0xff70,
  27298. "kaverticalstrokecyrillic",
  27299. 0x049d,
  27300. "kbopomofo",
  27301. 0x310e,
  27302. "kcalsquare",
  27303. 0x3389,
  27304. "kcaron",
  27305. 0x01e9,
  27306. "kcedilla",
  27307. 0x0137,
  27308. "kcircle",
  27309. 0x24da,
  27310. "kcommaaccent",
  27311. 0x0137,
  27312. "kdotbelow",
  27313. 0x1e33,
  27314. "keharmenian",
  27315. 0x0584,
  27316. "kehiragana",
  27317. 0x3051,
  27318. "kekatakana",
  27319. 0x30b1,
  27320. "kekatakanahalfwidth",
  27321. 0xff79,
  27322. "kenarmenian",
  27323. 0x056f,
  27324. "kesmallkatakana",
  27325. 0x30f6,
  27326. "kgreenlandic",
  27327. 0x0138,
  27328. "khabengali",
  27329. 0x0996,
  27330. "khacyrillic",
  27331. 0x0445,
  27332. "khadeva",
  27333. 0x0916,
  27334. "khagujarati",
  27335. 0x0a96,
  27336. "khagurmukhi",
  27337. 0x0a16,
  27338. "khaharabic",
  27339. 0x062e,
  27340. "khahfinalarabic",
  27341. 0xfea6,
  27342. "khahinitialarabic",
  27343. 0xfea7,
  27344. "khahmedialarabic",
  27345. 0xfea8,
  27346. "kheicoptic",
  27347. 0x03e7,
  27348. "khhadeva",
  27349. 0x0959,
  27350. "khhagurmukhi",
  27351. 0x0a59,
  27352. "khieukhacirclekorean",
  27353. 0x3278,
  27354. "khieukhaparenkorean",
  27355. 0x3218,
  27356. "khieukhcirclekorean",
  27357. 0x326a,
  27358. "khieukhkorean",
  27359. 0x314b,
  27360. "khieukhparenkorean",
  27361. 0x320a,
  27362. "khokhaithai",
  27363. 0x0e02,
  27364. "khokhonthai",
  27365. 0x0e05,
  27366. "khokhuatthai",
  27367. 0x0e03,
  27368. "khokhwaithai",
  27369. 0x0e04,
  27370. "khomutthai",
  27371. 0x0e5b,
  27372. "khook",
  27373. 0x0199,
  27374. "khorakhangthai",
  27375. 0x0e06,
  27376. "khzsquare",
  27377. 0x3391,
  27378. "kihiragana",
  27379. 0x304d,
  27380. "kikatakana",
  27381. 0x30ad,
  27382. "kikatakanahalfwidth",
  27383. 0xff77,
  27384. "kiroguramusquare",
  27385. 0x3315,
  27386. "kiromeetorusquare",
  27387. 0x3316,
  27388. "kirosquare",
  27389. 0x3314,
  27390. "kiyeokacirclekorean",
  27391. 0x326e,
  27392. "kiyeokaparenkorean",
  27393. 0x320e,
  27394. "kiyeokcirclekorean",
  27395. 0x3260,
  27396. "kiyeokkorean",
  27397. 0x3131,
  27398. "kiyeokparenkorean",
  27399. 0x3200,
  27400. "kiyeoksioskorean",
  27401. 0x3133,
  27402. "kjecyrillic",
  27403. 0x045c,
  27404. "klinebelow",
  27405. 0x1e35,
  27406. "klsquare",
  27407. 0x3398,
  27408. "kmcubedsquare",
  27409. 0x33a6,
  27410. "kmonospace",
  27411. 0xff4b,
  27412. "kmsquaredsquare",
  27413. 0x33a2,
  27414. "kohiragana",
  27415. 0x3053,
  27416. "kohmsquare",
  27417. 0x33c0,
  27418. "kokaithai",
  27419. 0x0e01,
  27420. "kokatakana",
  27421. 0x30b3,
  27422. "kokatakanahalfwidth",
  27423. 0xff7a,
  27424. "kooposquare",
  27425. 0x331e,
  27426. "koppacyrillic",
  27427. 0x0481,
  27428. "koreanstandardsymbol",
  27429. 0x327f,
  27430. "koroniscmb",
  27431. 0x0343,
  27432. "kparen",
  27433. 0x24a6,
  27434. "kpasquare",
  27435. 0x33aa,
  27436. "ksicyrillic",
  27437. 0x046f,
  27438. "ktsquare",
  27439. 0x33cf,
  27440. "kturned",
  27441. 0x029e,
  27442. "kuhiragana",
  27443. 0x304f,
  27444. "kukatakana",
  27445. 0x30af,
  27446. "kukatakanahalfwidth",
  27447. 0xff78,
  27448. "kvsquare",
  27449. 0x33b8,
  27450. "kwsquare",
  27451. 0x33be,
  27452. "l",
  27453. 0x006c,
  27454. "labengali",
  27455. 0x09b2,
  27456. "lacute",
  27457. 0x013a,
  27458. "ladeva",
  27459. 0x0932,
  27460. "lagujarati",
  27461. 0x0ab2,
  27462. "lagurmukhi",
  27463. 0x0a32,
  27464. "lakkhangyaothai",
  27465. 0x0e45,
  27466. "lamaleffinalarabic",
  27467. 0xfefc,
  27468. "lamalefhamzaabovefinalarabic",
  27469. 0xfef8,
  27470. "lamalefhamzaaboveisolatedarabic",
  27471. 0xfef7,
  27472. "lamalefhamzabelowfinalarabic",
  27473. 0xfefa,
  27474. "lamalefhamzabelowisolatedarabic",
  27475. 0xfef9,
  27476. "lamalefisolatedarabic",
  27477. 0xfefb,
  27478. "lamalefmaddaabovefinalarabic",
  27479. 0xfef6,
  27480. "lamalefmaddaaboveisolatedarabic",
  27481. 0xfef5,
  27482. "lamarabic",
  27483. 0x0644,
  27484. "lambda",
  27485. 0x03bb,
  27486. "lambdastroke",
  27487. 0x019b,
  27488. "lamed",
  27489. 0x05dc,
  27490. "lameddagesh",
  27491. 0xfb3c,
  27492. "lameddageshhebrew",
  27493. 0xfb3c,
  27494. "lamedhebrew",
  27495. 0x05dc,
  27496. "lamfinalarabic",
  27497. 0xfede,
  27498. "lamhahinitialarabic",
  27499. 0xfcca,
  27500. "laminitialarabic",
  27501. 0xfedf,
  27502. "lamjeeminitialarabic",
  27503. 0xfcc9,
  27504. "lamkhahinitialarabic",
  27505. 0xfccb,
  27506. "lamlamhehisolatedarabic",
  27507. 0xfdf2,
  27508. "lammedialarabic",
  27509. 0xfee0,
  27510. "lammeemhahinitialarabic",
  27511. 0xfd88,
  27512. "lammeeminitialarabic",
  27513. 0xfccc,
  27514. "largecircle",
  27515. 0x25ef,
  27516. "lbar",
  27517. 0x019a,
  27518. "lbelt",
  27519. 0x026c,
  27520. "lbopomofo",
  27521. 0x310c,
  27522. "lcaron",
  27523. 0x013e,
  27524. "lcedilla",
  27525. 0x013c,
  27526. "lcircle",
  27527. 0x24db,
  27528. "lcircumflexbelow",
  27529. 0x1e3d,
  27530. "lcommaaccent",
  27531. 0x013c,
  27532. "ldot",
  27533. 0x0140,
  27534. "ldotaccent",
  27535. 0x0140,
  27536. "ldotbelow",
  27537. 0x1e37,
  27538. "ldotbelowmacron",
  27539. 0x1e39,
  27540. "leftangleabovecmb",
  27541. 0x031a,
  27542. "lefttackbelowcmb",
  27543. 0x0318,
  27544. "less",
  27545. 0x003c,
  27546. "lessequal",
  27547. 0x2264,
  27548. "lessequalorgreater",
  27549. 0x22da,
  27550. "lessmonospace",
  27551. 0xff1c,
  27552. "lessorequivalent",
  27553. 0x2272,
  27554. "lessorgreater",
  27555. 0x2276,
  27556. "lessoverequal",
  27557. 0x2266,
  27558. "lesssmall",
  27559. 0xfe64,
  27560. "lezh",
  27561. 0x026e,
  27562. "lfblock",
  27563. 0x258c,
  27564. "lhookretroflex",
  27565. 0x026d,
  27566. "lira",
  27567. 0x20a4,
  27568. "liwnarmenian",
  27569. 0x056c,
  27570. "lj",
  27571. 0x01c9,
  27572. "ljecyrillic",
  27573. 0x0459,
  27574. "ll",
  27575. 0xf6c0,
  27576. "lladeva",
  27577. 0x0933,
  27578. "llagujarati",
  27579. 0x0ab3,
  27580. "llinebelow",
  27581. 0x1e3b,
  27582. "llladeva",
  27583. 0x0934,
  27584. "llvocalicbengali",
  27585. 0x09e1,
  27586. "llvocalicdeva",
  27587. 0x0961,
  27588. "llvocalicvowelsignbengali",
  27589. 0x09e3,
  27590. "llvocalicvowelsigndeva",
  27591. 0x0963,
  27592. "lmiddletilde",
  27593. 0x026b,
  27594. "lmonospace",
  27595. 0xff4c,
  27596. "lmsquare",
  27597. 0x33d0,
  27598. "lochulathai",
  27599. 0x0e2c,
  27600. "logicaland",
  27601. 0x2227,
  27602. "logicalnot",
  27603. 0x00ac,
  27604. "logicalnotreversed",
  27605. 0x2310,
  27606. "logicalor",
  27607. 0x2228,
  27608. "lolingthai",
  27609. 0x0e25,
  27610. "longs",
  27611. 0x017f,
  27612. "lowlinecenterline",
  27613. 0xfe4e,
  27614. "lowlinecmb",
  27615. 0x0332,
  27616. "lowlinedashed",
  27617. 0xfe4d,
  27618. "lozenge",
  27619. 0x25ca,
  27620. "lparen",
  27621. 0x24a7,
  27622. "lslash",
  27623. 0x0142,
  27624. "lsquare",
  27625. 0x2113,
  27626. "lsuperior",
  27627. 0xf6ee,
  27628. "ltshade",
  27629. 0x2591,
  27630. "luthai",
  27631. 0x0e26,
  27632. "lvocalicbengali",
  27633. 0x098c,
  27634. "lvocalicdeva",
  27635. 0x090c,
  27636. "lvocalicvowelsignbengali",
  27637. 0x09e2,
  27638. "lvocalicvowelsigndeva",
  27639. 0x0962,
  27640. "lxsquare",
  27641. 0x33d3,
  27642. "m",
  27643. 0x006d,
  27644. "mabengali",
  27645. 0x09ae,
  27646. "macron",
  27647. 0x00af,
  27648. "macronbelowcmb",
  27649. 0x0331,
  27650. "macroncmb",
  27651. 0x0304,
  27652. "macronlowmod",
  27653. 0x02cd,
  27654. "macronmonospace",
  27655. 0xffe3,
  27656. "macute",
  27657. 0x1e3f,
  27658. "madeva",
  27659. 0x092e,
  27660. "magujarati",
  27661. 0x0aae,
  27662. "magurmukhi",
  27663. 0x0a2e,
  27664. "mahapakhhebrew",
  27665. 0x05a4,
  27666. "mahapakhlefthebrew",
  27667. 0x05a4,
  27668. "mahiragana",
  27669. 0x307e,
  27670. "maichattawalowleftthai",
  27671. 0xf895,
  27672. "maichattawalowrightthai",
  27673. 0xf894,
  27674. "maichattawathai",
  27675. 0x0e4b,
  27676. "maichattawaupperleftthai",
  27677. 0xf893,
  27678. "maieklowleftthai",
  27679. 0xf88c,
  27680. "maieklowrightthai",
  27681. 0xf88b,
  27682. "maiekthai",
  27683. 0x0e48,
  27684. "maiekupperleftthai",
  27685. 0xf88a,
  27686. "maihanakatleftthai",
  27687. 0xf884,
  27688. "maihanakatthai",
  27689. 0x0e31,
  27690. "maitaikhuleftthai",
  27691. 0xf889,
  27692. "maitaikhuthai",
  27693. 0x0e47,
  27694. "maitholowleftthai",
  27695. 0xf88f,
  27696. "maitholowrightthai",
  27697. 0xf88e,
  27698. "maithothai",
  27699. 0x0e49,
  27700. "maithoupperleftthai",
  27701. 0xf88d,
  27702. "maitrilowleftthai",
  27703. 0xf892,
  27704. "maitrilowrightthai",
  27705. 0xf891,
  27706. "maitrithai",
  27707. 0x0e4a,
  27708. "maitriupperleftthai",
  27709. 0xf890,
  27710. "maiyamokthai",
  27711. 0x0e46,
  27712. "makatakana",
  27713. 0x30de,
  27714. "makatakanahalfwidth",
  27715. 0xff8f,
  27716. "male",
  27717. 0x2642,
  27718. "mansyonsquare",
  27719. 0x3347,
  27720. "maqafhebrew",
  27721. 0x05be,
  27722. "mars",
  27723. 0x2642,
  27724. "masoracirclehebrew",
  27725. 0x05af,
  27726. "masquare",
  27727. 0x3383,
  27728. "mbopomofo",
  27729. 0x3107,
  27730. "mbsquare",
  27731. 0x33d4,
  27732. "mcircle",
  27733. 0x24dc,
  27734. "mcubedsquare",
  27735. 0x33a5,
  27736. "mdotaccent",
  27737. 0x1e41,
  27738. "mdotbelow",
  27739. 0x1e43,
  27740. "meemarabic",
  27741. 0x0645,
  27742. "meemfinalarabic",
  27743. 0xfee2,
  27744. "meeminitialarabic",
  27745. 0xfee3,
  27746. "meemmedialarabic",
  27747. 0xfee4,
  27748. "meemmeeminitialarabic",
  27749. 0xfcd1,
  27750. "meemmeemisolatedarabic",
  27751. 0xfc48,
  27752. "meetorusquare",
  27753. 0x334d,
  27754. "mehiragana",
  27755. 0x3081,
  27756. "meizierasquare",
  27757. 0x337e,
  27758. "mekatakana",
  27759. 0x30e1,
  27760. "mekatakanahalfwidth",
  27761. 0xff92,
  27762. "mem",
  27763. 0x05de,
  27764. "memdagesh",
  27765. 0xfb3e,
  27766. "memdageshhebrew",
  27767. 0xfb3e,
  27768. "memhebrew",
  27769. 0x05de,
  27770. "menarmenian",
  27771. 0x0574,
  27772. "merkhahebrew",
  27773. 0x05a5,
  27774. "merkhakefulahebrew",
  27775. 0x05a6,
  27776. "merkhakefulalefthebrew",
  27777. 0x05a6,
  27778. "merkhalefthebrew",
  27779. 0x05a5,
  27780. "mhook",
  27781. 0x0271,
  27782. "mhzsquare",
  27783. 0x3392,
  27784. "middledotkatakanahalfwidth",
  27785. 0xff65,
  27786. "middot",
  27787. 0x00b7,
  27788. "mieumacirclekorean",
  27789. 0x3272,
  27790. "mieumaparenkorean",
  27791. 0x3212,
  27792. "mieumcirclekorean",
  27793. 0x3264,
  27794. "mieumkorean",
  27795. 0x3141,
  27796. "mieumpansioskorean",
  27797. 0x3170,
  27798. "mieumparenkorean",
  27799. 0x3204,
  27800. "mieumpieupkorean",
  27801. 0x316e,
  27802. "mieumsioskorean",
  27803. 0x316f,
  27804. "mihiragana",
  27805. 0x307f,
  27806. "mikatakana",
  27807. 0x30df,
  27808. "mikatakanahalfwidth",
  27809. 0xff90,
  27810. "minus",
  27811. 0x2212,
  27812. "minusbelowcmb",
  27813. 0x0320,
  27814. "minuscircle",
  27815. 0x2296,
  27816. "minusmod",
  27817. 0x02d7,
  27818. "minusplus",
  27819. 0x2213,
  27820. "minute",
  27821. 0x2032,
  27822. "miribaarusquare",
  27823. 0x334a,
  27824. "mirisquare",
  27825. 0x3349,
  27826. "mlonglegturned",
  27827. 0x0270,
  27828. "mlsquare",
  27829. 0x3396,
  27830. "mmcubedsquare",
  27831. 0x33a3,
  27832. "mmonospace",
  27833. 0xff4d,
  27834. "mmsquaredsquare",
  27835. 0x339f,
  27836. "mohiragana",
  27837. 0x3082,
  27838. "mohmsquare",
  27839. 0x33c1,
  27840. "mokatakana",
  27841. 0x30e2,
  27842. "mokatakanahalfwidth",
  27843. 0xff93,
  27844. "molsquare",
  27845. 0x33d6,
  27846. "momathai",
  27847. 0x0e21,
  27848. "moverssquare",
  27849. 0x33a7,
  27850. "moverssquaredsquare",
  27851. 0x33a8,
  27852. "mparen",
  27853. 0x24a8,
  27854. "mpasquare",
  27855. 0x33ab,
  27856. "mssquare",
  27857. 0x33b3,
  27858. "msuperior",
  27859. 0xf6ef,
  27860. "mturned",
  27861. 0x026f,
  27862. "mu",
  27863. 0x00b5,
  27864. "mu1",
  27865. 0x00b5,
  27866. "muasquare",
  27867. 0x3382,
  27868. "muchgreater",
  27869. 0x226b,
  27870. "muchless",
  27871. 0x226a,
  27872. "mufsquare",
  27873. 0x338c,
  27874. "mugreek",
  27875. 0x03bc,
  27876. "mugsquare",
  27877. 0x338d,
  27878. "muhiragana",
  27879. 0x3080,
  27880. "mukatakana",
  27881. 0x30e0,
  27882. "mukatakanahalfwidth",
  27883. 0xff91,
  27884. "mulsquare",
  27885. 0x3395,
  27886. "multiply",
  27887. 0x00d7,
  27888. "mumsquare",
  27889. 0x339b,
  27890. "munahhebrew",
  27891. 0x05a3,
  27892. "munahlefthebrew",
  27893. 0x05a3,
  27894. "musicalnote",
  27895. 0x266a,
  27896. "musicalnotedbl",
  27897. 0x266b,
  27898. "musicflatsign",
  27899. 0x266d,
  27900. "musicsharpsign",
  27901. 0x266f,
  27902. "mussquare",
  27903. 0x33b2,
  27904. "muvsquare",
  27905. 0x33b6,
  27906. "muwsquare",
  27907. 0x33bc,
  27908. "mvmegasquare",
  27909. 0x33b9,
  27910. "mvsquare",
  27911. 0x33b7,
  27912. "mwmegasquare",
  27913. 0x33bf,
  27914. "mwsquare",
  27915. 0x33bd,
  27916. "n",
  27917. 0x006e,
  27918. "nabengali",
  27919. 0x09a8,
  27920. "nabla",
  27921. 0x2207,
  27922. "nacute",
  27923. 0x0144,
  27924. "nadeva",
  27925. 0x0928,
  27926. "nagujarati",
  27927. 0x0aa8,
  27928. "nagurmukhi",
  27929. 0x0a28,
  27930. "nahiragana",
  27931. 0x306a,
  27932. "nakatakana",
  27933. 0x30ca,
  27934. "nakatakanahalfwidth",
  27935. 0xff85,
  27936. "napostrophe",
  27937. 0x0149,
  27938. "nasquare",
  27939. 0x3381,
  27940. "nbopomofo",
  27941. 0x310b,
  27942. "nbspace",
  27943. 0x00a0,
  27944. "ncaron",
  27945. 0x0148,
  27946. "ncedilla",
  27947. 0x0146,
  27948. "ncircle",
  27949. 0x24dd,
  27950. "ncircumflexbelow",
  27951. 0x1e4b,
  27952. "ncommaaccent",
  27953. 0x0146,
  27954. "ndotaccent",
  27955. 0x1e45,
  27956. "ndotbelow",
  27957. 0x1e47,
  27958. "nehiragana",
  27959. 0x306d,
  27960. "nekatakana",
  27961. 0x30cd,
  27962. "nekatakanahalfwidth",
  27963. 0xff88,
  27964. "newsheqelsign",
  27965. 0x20aa,
  27966. "nfsquare",
  27967. 0x338b,
  27968. "ngabengali",
  27969. 0x0999,
  27970. "ngadeva",
  27971. 0x0919,
  27972. "ngagujarati",
  27973. 0x0a99,
  27974. "ngagurmukhi",
  27975. 0x0a19,
  27976. "ngonguthai",
  27977. 0x0e07,
  27978. "nhiragana",
  27979. 0x3093,
  27980. "nhookleft",
  27981. 0x0272,
  27982. "nhookretroflex",
  27983. 0x0273,
  27984. "nieunacirclekorean",
  27985. 0x326f,
  27986. "nieunaparenkorean",
  27987. 0x320f,
  27988. "nieuncieuckorean",
  27989. 0x3135,
  27990. "nieuncirclekorean",
  27991. 0x3261,
  27992. "nieunhieuhkorean",
  27993. 0x3136,
  27994. "nieunkorean",
  27995. 0x3134,
  27996. "nieunpansioskorean",
  27997. 0x3168,
  27998. "nieunparenkorean",
  27999. 0x3201,
  28000. "nieunsioskorean",
  28001. 0x3167,
  28002. "nieuntikeutkorean",
  28003. 0x3166,
  28004. "nihiragana",
  28005. 0x306b,
  28006. "nikatakana",
  28007. 0x30cb,
  28008. "nikatakanahalfwidth",
  28009. 0xff86,
  28010. "nikhahitleftthai",
  28011. 0xf899,
  28012. "nikhahitthai",
  28013. 0x0e4d,
  28014. "nine",
  28015. 0x0039,
  28016. "ninearabic",
  28017. 0x0669,
  28018. "ninebengali",
  28019. 0x09ef,
  28020. "ninecircle",
  28021. 0x2468,
  28022. "ninecircleinversesansserif",
  28023. 0x2792,
  28024. "ninedeva",
  28025. 0x096f,
  28026. "ninegujarati",
  28027. 0x0aef,
  28028. "ninegurmukhi",
  28029. 0x0a6f,
  28030. "ninehackarabic",
  28031. 0x0669,
  28032. "ninehangzhou",
  28033. 0x3029,
  28034. "nineideographicparen",
  28035. 0x3228,
  28036. "nineinferior",
  28037. 0x2089,
  28038. "ninemonospace",
  28039. 0xff19,
  28040. "nineoldstyle",
  28041. 0xf739,
  28042. "nineparen",
  28043. 0x247c,
  28044. "nineperiod",
  28045. 0x2490,
  28046. "ninepersian",
  28047. 0x06f9,
  28048. "nineroman",
  28049. 0x2178,
  28050. "ninesuperior",
  28051. 0x2079,
  28052. "nineteencircle",
  28053. 0x2472,
  28054. "nineteenparen",
  28055. 0x2486,
  28056. "nineteenperiod",
  28057. 0x249a,
  28058. "ninethai",
  28059. 0x0e59,
  28060. "nj",
  28061. 0x01cc,
  28062. "njecyrillic",
  28063. 0x045a,
  28064. "nkatakana",
  28065. 0x30f3,
  28066. "nkatakanahalfwidth",
  28067. 0xff9d,
  28068. "nlegrightlong",
  28069. 0x019e,
  28070. "nlinebelow",
  28071. 0x1e49,
  28072. "nmonospace",
  28073. 0xff4e,
  28074. "nmsquare",
  28075. 0x339a,
  28076. "nnabengali",
  28077. 0x09a3,
  28078. "nnadeva",
  28079. 0x0923,
  28080. "nnagujarati",
  28081. 0x0aa3,
  28082. "nnagurmukhi",
  28083. 0x0a23,
  28084. "nnnadeva",
  28085. 0x0929,
  28086. "nohiragana",
  28087. 0x306e,
  28088. "nokatakana",
  28089. 0x30ce,
  28090. "nokatakanahalfwidth",
  28091. 0xff89,
  28092. "nonbreakingspace",
  28093. 0x00a0,
  28094. "nonenthai",
  28095. 0x0e13,
  28096. "nonuthai",
  28097. 0x0e19,
  28098. "noonarabic",
  28099. 0x0646,
  28100. "noonfinalarabic",
  28101. 0xfee6,
  28102. "noonghunnaarabic",
  28103. 0x06ba,
  28104. "noonghunnafinalarabic",
  28105. 0xfb9f,
  28106. "nooninitialarabic",
  28107. 0xfee7,
  28108. "noonjeeminitialarabic",
  28109. 0xfcd2,
  28110. "noonjeemisolatedarabic",
  28111. 0xfc4b,
  28112. "noonmedialarabic",
  28113. 0xfee8,
  28114. "noonmeeminitialarabic",
  28115. 0xfcd5,
  28116. "noonmeemisolatedarabic",
  28117. 0xfc4e,
  28118. "noonnoonfinalarabic",
  28119. 0xfc8d,
  28120. "notcontains",
  28121. 0x220c,
  28122. "notelement",
  28123. 0x2209,
  28124. "notelementof",
  28125. 0x2209,
  28126. "notequal",
  28127. 0x2260,
  28128. "notgreater",
  28129. 0x226f,
  28130. "notgreaternorequal",
  28131. 0x2271,
  28132. "notgreaternorless",
  28133. 0x2279,
  28134. "notidentical",
  28135. 0x2262,
  28136. "notless",
  28137. 0x226e,
  28138. "notlessnorequal",
  28139. 0x2270,
  28140. "notparallel",
  28141. 0x2226,
  28142. "notprecedes",
  28143. 0x2280,
  28144. "notsubset",
  28145. 0x2284,
  28146. "notsucceeds",
  28147. 0x2281,
  28148. "notsuperset",
  28149. 0x2285,
  28150. "nowarmenian",
  28151. 0x0576,
  28152. "nparen",
  28153. 0x24a9,
  28154. "nssquare",
  28155. 0x33b1,
  28156. "nsuperior",
  28157. 0x207f,
  28158. "ntilde",
  28159. 0x00f1,
  28160. "nu",
  28161. 0x03bd,
  28162. "nuhiragana",
  28163. 0x306c,
  28164. "nukatakana",
  28165. 0x30cc,
  28166. "nukatakanahalfwidth",
  28167. 0xff87,
  28168. "nuktabengali",
  28169. 0x09bc,
  28170. "nuktadeva",
  28171. 0x093c,
  28172. "nuktagujarati",
  28173. 0x0abc,
  28174. "nuktagurmukhi",
  28175. 0x0a3c,
  28176. "numbersign",
  28177. 0x0023,
  28178. "numbersignmonospace",
  28179. 0xff03,
  28180. "numbersignsmall",
  28181. 0xfe5f,
  28182. "numeralsigngreek",
  28183. 0x0374,
  28184. "numeralsignlowergreek",
  28185. 0x0375,
  28186. "numero",
  28187. 0x2116,
  28188. "nun",
  28189. 0x05e0,
  28190. "nundagesh",
  28191. 0xfb40,
  28192. "nundageshhebrew",
  28193. 0xfb40,
  28194. "nunhebrew",
  28195. 0x05e0,
  28196. "nvsquare",
  28197. 0x33b5,
  28198. "nwsquare",
  28199. 0x33bb,
  28200. "nyabengali",
  28201. 0x099e,
  28202. "nyadeva",
  28203. 0x091e,
  28204. "nyagujarati",
  28205. 0x0a9e,
  28206. "nyagurmukhi",
  28207. 0x0a1e,
  28208. "o",
  28209. 0x006f,
  28210. "oacute",
  28211. 0x00f3,
  28212. "oangthai",
  28213. 0x0e2d,
  28214. "obarred",
  28215. 0x0275,
  28216. "obarredcyrillic",
  28217. 0x04e9,
  28218. "obarreddieresiscyrillic",
  28219. 0x04eb,
  28220. "obengali",
  28221. 0x0993,
  28222. "obopomofo",
  28223. 0x311b,
  28224. "obreve",
  28225. 0x014f,
  28226. "ocandradeva",
  28227. 0x0911,
  28228. "ocandragujarati",
  28229. 0x0a91,
  28230. "ocandravowelsigndeva",
  28231. 0x0949,
  28232. "ocandravowelsigngujarati",
  28233. 0x0ac9,
  28234. "ocaron",
  28235. 0x01d2,
  28236. "ocircle",
  28237. 0x24de,
  28238. "ocircumflex",
  28239. 0x00f4,
  28240. "ocircumflexacute",
  28241. 0x1ed1,
  28242. "ocircumflexdotbelow",
  28243. 0x1ed9,
  28244. "ocircumflexgrave",
  28245. 0x1ed3,
  28246. "ocircumflexhookabove",
  28247. 0x1ed5,
  28248. "ocircumflextilde",
  28249. 0x1ed7,
  28250. "ocyrillic",
  28251. 0x043e,
  28252. "odblacute",
  28253. 0x0151,
  28254. "odblgrave",
  28255. 0x020d,
  28256. "odeva",
  28257. 0x0913,
  28258. "odieresis",
  28259. 0x00f6,
  28260. "odieresiscyrillic",
  28261. 0x04e7,
  28262. "odotbelow",
  28263. 0x1ecd,
  28264. "oe",
  28265. 0x0153,
  28266. "oekorean",
  28267. 0x315a,
  28268. "ogonek",
  28269. 0x02db,
  28270. "ogonekcmb",
  28271. 0x0328,
  28272. "ograve",
  28273. 0x00f2,
  28274. "ogujarati",
  28275. 0x0a93,
  28276. "oharmenian",
  28277. 0x0585,
  28278. "ohiragana",
  28279. 0x304a,
  28280. "ohookabove",
  28281. 0x1ecf,
  28282. "ohorn",
  28283. 0x01a1,
  28284. "ohornacute",
  28285. 0x1edb,
  28286. "ohorndotbelow",
  28287. 0x1ee3,
  28288. "ohorngrave",
  28289. 0x1edd,
  28290. "ohornhookabove",
  28291. 0x1edf,
  28292. "ohorntilde",
  28293. 0x1ee1,
  28294. "ohungarumlaut",
  28295. 0x0151,
  28296. "oi",
  28297. 0x01a3,
  28298. "oinvertedbreve",
  28299. 0x020f,
  28300. "okatakana",
  28301. 0x30aa,
  28302. "okatakanahalfwidth",
  28303. 0xff75,
  28304. "okorean",
  28305. 0x3157,
  28306. "olehebrew",
  28307. 0x05ab,
  28308. "omacron",
  28309. 0x014d,
  28310. "omacronacute",
  28311. 0x1e53,
  28312. "omacrongrave",
  28313. 0x1e51,
  28314. "omdeva",
  28315. 0x0950,
  28316. "omega",
  28317. 0x03c9,
  28318. "omega1",
  28319. 0x03d6,
  28320. "omegacyrillic",
  28321. 0x0461,
  28322. "omegalatinclosed",
  28323. 0x0277,
  28324. "omegaroundcyrillic",
  28325. 0x047b,
  28326. "omegatitlocyrillic",
  28327. 0x047d,
  28328. "omegatonos",
  28329. 0x03ce,
  28330. "omgujarati",
  28331. 0x0ad0,
  28332. "omicron",
  28333. 0x03bf,
  28334. "omicrontonos",
  28335. 0x03cc,
  28336. "omonospace",
  28337. 0xff4f,
  28338. "one",
  28339. 0x0031,
  28340. "onearabic",
  28341. 0x0661,
  28342. "onebengali",
  28343. 0x09e7,
  28344. "onecircle",
  28345. 0x2460,
  28346. "onecircleinversesansserif",
  28347. 0x278a,
  28348. "onedeva",
  28349. 0x0967,
  28350. "onedotenleader",
  28351. 0x2024,
  28352. "oneeighth",
  28353. 0x215b,
  28354. "onefitted",
  28355. 0xf6dc,
  28356. "onegujarati",
  28357. 0x0ae7,
  28358. "onegurmukhi",
  28359. 0x0a67,
  28360. "onehackarabic",
  28361. 0x0661,
  28362. "onehalf",
  28363. 0x00bd,
  28364. "onehangzhou",
  28365. 0x3021,
  28366. "oneideographicparen",
  28367. 0x3220,
  28368. "oneinferior",
  28369. 0x2081,
  28370. "onemonospace",
  28371. 0xff11,
  28372. "onenumeratorbengali",
  28373. 0x09f4,
  28374. "oneoldstyle",
  28375. 0xf731,
  28376. "oneparen",
  28377. 0x2474,
  28378. "oneperiod",
  28379. 0x2488,
  28380. "onepersian",
  28381. 0x06f1,
  28382. "onequarter",
  28383. 0x00bc,
  28384. "oneroman",
  28385. 0x2170,
  28386. "onesuperior",
  28387. 0x00b9,
  28388. "onethai",
  28389. 0x0e51,
  28390. "onethird",
  28391. 0x2153,
  28392. "oogonek",
  28393. 0x01eb,
  28394. "oogonekmacron",
  28395. 0x01ed,
  28396. "oogurmukhi",
  28397. 0x0a13,
  28398. "oomatragurmukhi",
  28399. 0x0a4b,
  28400. "oopen",
  28401. 0x0254,
  28402. "oparen",
  28403. 0x24aa,
  28404. "openbullet",
  28405. 0x25e6,
  28406. "option",
  28407. 0x2325,
  28408. "ordfeminine",
  28409. 0x00aa,
  28410. "ordmasculine",
  28411. 0x00ba,
  28412. "orthogonal",
  28413. 0x221f,
  28414. "oshortdeva",
  28415. 0x0912,
  28416. "oshortvowelsigndeva",
  28417. 0x094a,
  28418. "oslash",
  28419. 0x00f8,
  28420. "oslashacute",
  28421. 0x01ff,
  28422. "osmallhiragana",
  28423. 0x3049,
  28424. "osmallkatakana",
  28425. 0x30a9,
  28426. "osmallkatakanahalfwidth",
  28427. 0xff6b,
  28428. "ostrokeacute",
  28429. 0x01ff,
  28430. "osuperior",
  28431. 0xf6f0,
  28432. "otcyrillic",
  28433. 0x047f,
  28434. "otilde",
  28435. 0x00f5,
  28436. "otildeacute",
  28437. 0x1e4d,
  28438. "otildedieresis",
  28439. 0x1e4f,
  28440. "oubopomofo",
  28441. 0x3121,
  28442. "overline",
  28443. 0x203e,
  28444. "overlinecenterline",
  28445. 0xfe4a,
  28446. "overlinecmb",
  28447. 0x0305,
  28448. "overlinedashed",
  28449. 0xfe49,
  28450. "overlinedblwavy",
  28451. 0xfe4c,
  28452. "overlinewavy",
  28453. 0xfe4b,
  28454. "overscore",
  28455. 0x00af,
  28456. "ovowelsignbengali",
  28457. 0x09cb,
  28458. "ovowelsigndeva",
  28459. 0x094b,
  28460. "ovowelsigngujarati",
  28461. 0x0acb,
  28462. "p",
  28463. 0x0070,
  28464. "paampssquare",
  28465. 0x3380,
  28466. "paasentosquare",
  28467. 0x332b,
  28468. "pabengali",
  28469. 0x09aa,
  28470. "pacute",
  28471. 0x1e55,
  28472. "padeva",
  28473. 0x092a,
  28474. "pagedown",
  28475. 0x21df,
  28476. "pageup",
  28477. 0x21de,
  28478. "pagujarati",
  28479. 0x0aaa,
  28480. "pagurmukhi",
  28481. 0x0a2a,
  28482. "pahiragana",
  28483. 0x3071,
  28484. "paiyannoithai",
  28485. 0x0e2f,
  28486. "pakatakana",
  28487. 0x30d1,
  28488. "palatalizationcyrilliccmb",
  28489. 0x0484,
  28490. "palochkacyrillic",
  28491. 0x04c0,
  28492. "pansioskorean",
  28493. 0x317f,
  28494. "paragraph",
  28495. 0x00b6,
  28496. "parallel",
  28497. 0x2225,
  28498. "parenleft",
  28499. 0x0028,
  28500. "parenleftaltonearabic",
  28501. 0xfd3e,
  28502. "parenleftbt",
  28503. 0xf8ed,
  28504. "parenleftex",
  28505. 0xf8ec,
  28506. "parenleftinferior",
  28507. 0x208d,
  28508. "parenleftmonospace",
  28509. 0xff08,
  28510. "parenleftsmall",
  28511. 0xfe59,
  28512. "parenleftsuperior",
  28513. 0x207d,
  28514. "parenlefttp",
  28515. 0xf8eb,
  28516. "parenleftvertical",
  28517. 0xfe35,
  28518. "parenright",
  28519. 0x0029,
  28520. "parenrightaltonearabic",
  28521. 0xfd3f,
  28522. "parenrightbt",
  28523. 0xf8f8,
  28524. "parenrightex",
  28525. 0xf8f7,
  28526. "parenrightinferior",
  28527. 0x208e,
  28528. "parenrightmonospace",
  28529. 0xff09,
  28530. "parenrightsmall",
  28531. 0xfe5a,
  28532. "parenrightsuperior",
  28533. 0x207e,
  28534. "parenrighttp",
  28535. 0xf8f6,
  28536. "parenrightvertical",
  28537. 0xfe36,
  28538. "partialdiff",
  28539. 0x2202,
  28540. "paseqhebrew",
  28541. 0x05c0,
  28542. "pashtahebrew",
  28543. 0x0599,
  28544. "pasquare",
  28545. 0x33a9,
  28546. "patah",
  28547. 0x05b7,
  28548. "patah11",
  28549. 0x05b7,
  28550. "patah1d",
  28551. 0x05b7,
  28552. "patah2a",
  28553. 0x05b7,
  28554. "patahhebrew",
  28555. 0x05b7,
  28556. "patahnarrowhebrew",
  28557. 0x05b7,
  28558. "patahquarterhebrew",
  28559. 0x05b7,
  28560. "patahwidehebrew",
  28561. 0x05b7,
  28562. "pazerhebrew",
  28563. 0x05a1,
  28564. "pbopomofo",
  28565. 0x3106,
  28566. "pcircle",
  28567. 0x24df,
  28568. "pdotaccent",
  28569. 0x1e57,
  28570. "pe",
  28571. 0x05e4,
  28572. "pecyrillic",
  28573. 0x043f,
  28574. "pedagesh",
  28575. 0xfb44,
  28576. "pedageshhebrew",
  28577. 0xfb44,
  28578. "peezisquare",
  28579. 0x333b,
  28580. "pefinaldageshhebrew",
  28581. 0xfb43,
  28582. "peharabic",
  28583. 0x067e,
  28584. "peharmenian",
  28585. 0x057a,
  28586. "pehebrew",
  28587. 0x05e4,
  28588. "pehfinalarabic",
  28589. 0xfb57,
  28590. "pehinitialarabic",
  28591. 0xfb58,
  28592. "pehiragana",
  28593. 0x307a,
  28594. "pehmedialarabic",
  28595. 0xfb59,
  28596. "pekatakana",
  28597. 0x30da,
  28598. "pemiddlehookcyrillic",
  28599. 0x04a7,
  28600. "perafehebrew",
  28601. 0xfb4e,
  28602. "percent",
  28603. 0x0025,
  28604. "percentarabic",
  28605. 0x066a,
  28606. "percentmonospace",
  28607. 0xff05,
  28608. "percentsmall",
  28609. 0xfe6a,
  28610. "period",
  28611. 0x002e,
  28612. "periodarmenian",
  28613. 0x0589,
  28614. "periodcentered",
  28615. 0x00b7,
  28616. "periodhalfwidth",
  28617. 0xff61,
  28618. "periodinferior",
  28619. 0xf6e7,
  28620. "periodmonospace",
  28621. 0xff0e,
  28622. "periodsmall",
  28623. 0xfe52,
  28624. "periodsuperior",
  28625. 0xf6e8,
  28626. "perispomenigreekcmb",
  28627. 0x0342,
  28628. "perpendicular",
  28629. 0x22a5,
  28630. "perthousand",
  28631. 0x2030,
  28632. "peseta",
  28633. 0x20a7,
  28634. "pfsquare",
  28635. 0x338a,
  28636. "phabengali",
  28637. 0x09ab,
  28638. "phadeva",
  28639. 0x092b,
  28640. "phagujarati",
  28641. 0x0aab,
  28642. "phagurmukhi",
  28643. 0x0a2b,
  28644. "phi",
  28645. 0x03c6,
  28646. "phi1",
  28647. 0x03d5,
  28648. "phieuphacirclekorean",
  28649. 0x327a,
  28650. "phieuphaparenkorean",
  28651. 0x321a,
  28652. "phieuphcirclekorean",
  28653. 0x326c,
  28654. "phieuphkorean",
  28655. 0x314d,
  28656. "phieuphparenkorean",
  28657. 0x320c,
  28658. "philatin",
  28659. 0x0278,
  28660. "phinthuthai",
  28661. 0x0e3a,
  28662. "phisymbolgreek",
  28663. 0x03d5,
  28664. "phook",
  28665. 0x01a5,
  28666. "phophanthai",
  28667. 0x0e1e,
  28668. "phophungthai",
  28669. 0x0e1c,
  28670. "phosamphaothai",
  28671. 0x0e20,
  28672. "pi",
  28673. 0x03c0,
  28674. "pieupacirclekorean",
  28675. 0x3273,
  28676. "pieupaparenkorean",
  28677. 0x3213,
  28678. "pieupcieuckorean",
  28679. 0x3176,
  28680. "pieupcirclekorean",
  28681. 0x3265,
  28682. "pieupkiyeokkorean",
  28683. 0x3172,
  28684. "pieupkorean",
  28685. 0x3142,
  28686. "pieupparenkorean",
  28687. 0x3205,
  28688. "pieupsioskiyeokkorean",
  28689. 0x3174,
  28690. "pieupsioskorean",
  28691. 0x3144,
  28692. "pieupsiostikeutkorean",
  28693. 0x3175,
  28694. "pieupthieuthkorean",
  28695. 0x3177,
  28696. "pieuptikeutkorean",
  28697. 0x3173,
  28698. "pihiragana",
  28699. 0x3074,
  28700. "pikatakana",
  28701. 0x30d4,
  28702. "pisymbolgreek",
  28703. 0x03d6,
  28704. "piwrarmenian",
  28705. 0x0583,
  28706. "plus",
  28707. 0x002b,
  28708. "plusbelowcmb",
  28709. 0x031f,
  28710. "pluscircle",
  28711. 0x2295,
  28712. "plusminus",
  28713. 0x00b1,
  28714. "plusmod",
  28715. 0x02d6,
  28716. "plusmonospace",
  28717. 0xff0b,
  28718. "plussmall",
  28719. 0xfe62,
  28720. "plussuperior",
  28721. 0x207a,
  28722. "pmonospace",
  28723. 0xff50,
  28724. "pmsquare",
  28725. 0x33d8,
  28726. "pohiragana",
  28727. 0x307d,
  28728. "pointingindexdownwhite",
  28729. 0x261f,
  28730. "pointingindexleftwhite",
  28731. 0x261c,
  28732. "pointingindexrightwhite",
  28733. 0x261e,
  28734. "pointingindexupwhite",
  28735. 0x261d,
  28736. "pokatakana",
  28737. 0x30dd,
  28738. "poplathai",
  28739. 0x0e1b,
  28740. "postalmark",
  28741. 0x3012,
  28742. "postalmarkface",
  28743. 0x3020,
  28744. "pparen",
  28745. 0x24ab,
  28746. "precedes",
  28747. 0x227a,
  28748. "prescription",
  28749. 0x211e,
  28750. "primemod",
  28751. 0x02b9,
  28752. "primereversed",
  28753. 0x2035,
  28754. "product",
  28755. 0x220f,
  28756. "projective",
  28757. 0x2305,
  28758. "prolongedkana",
  28759. 0x30fc,
  28760. "propellor",
  28761. 0x2318,
  28762. "propersubset",
  28763. 0x2282,
  28764. "propersuperset",
  28765. 0x2283,
  28766. "proportion",
  28767. 0x2237,
  28768. "proportional",
  28769. 0x221d,
  28770. "psi",
  28771. 0x03c8,
  28772. "psicyrillic",
  28773. 0x0471,
  28774. "psilipneumatacyrilliccmb",
  28775. 0x0486,
  28776. "pssquare",
  28777. 0x33b0,
  28778. "puhiragana",
  28779. 0x3077,
  28780. "pukatakana",
  28781. 0x30d7,
  28782. "pvsquare",
  28783. 0x33b4,
  28784. "pwsquare",
  28785. 0x33ba,
  28786. "q",
  28787. 0x0071,
  28788. "qadeva",
  28789. 0x0958,
  28790. "qadmahebrew",
  28791. 0x05a8,
  28792. "qafarabic",
  28793. 0x0642,
  28794. "qaffinalarabic",
  28795. 0xfed6,
  28796. "qafinitialarabic",
  28797. 0xfed7,
  28798. "qafmedialarabic",
  28799. 0xfed8,
  28800. "qamats",
  28801. 0x05b8,
  28802. "qamats10",
  28803. 0x05b8,
  28804. "qamats1a",
  28805. 0x05b8,
  28806. "qamats1c",
  28807. 0x05b8,
  28808. "qamats27",
  28809. 0x05b8,
  28810. "qamats29",
  28811. 0x05b8,
  28812. "qamats33",
  28813. 0x05b8,
  28814. "qamatsde",
  28815. 0x05b8,
  28816. "qamatshebrew",
  28817. 0x05b8,
  28818. "qamatsnarrowhebrew",
  28819. 0x05b8,
  28820. "qamatsqatanhebrew",
  28821. 0x05b8,
  28822. "qamatsqatannarrowhebrew",
  28823. 0x05b8,
  28824. "qamatsqatanquarterhebrew",
  28825. 0x05b8,
  28826. "qamatsqatanwidehebrew",
  28827. 0x05b8,
  28828. "qamatsquarterhebrew",
  28829. 0x05b8,
  28830. "qamatswidehebrew",
  28831. 0x05b8,
  28832. "qarneyparahebrew",
  28833. 0x059f,
  28834. "qbopomofo",
  28835. 0x3111,
  28836. "qcircle",
  28837. 0x24e0,
  28838. "qhook",
  28839. 0x02a0,
  28840. "qmonospace",
  28841. 0xff51,
  28842. "qof",
  28843. 0x05e7,
  28844. "qofdagesh",
  28845. 0xfb47,
  28846. "qofdageshhebrew",
  28847. 0xfb47,
  28848. "qofhebrew",
  28849. 0x05e7,
  28850. "qparen",
  28851. 0x24ac,
  28852. "quarternote",
  28853. 0x2669,
  28854. "qubuts",
  28855. 0x05bb,
  28856. "qubuts18",
  28857. 0x05bb,
  28858. "qubuts25",
  28859. 0x05bb,
  28860. "qubuts31",
  28861. 0x05bb,
  28862. "qubutshebrew",
  28863. 0x05bb,
  28864. "qubutsnarrowhebrew",
  28865. 0x05bb,
  28866. "qubutsquarterhebrew",
  28867. 0x05bb,
  28868. "qubutswidehebrew",
  28869. 0x05bb,
  28870. "question",
  28871. 0x003f,
  28872. "questionarabic",
  28873. 0x061f,
  28874. "questionarmenian",
  28875. 0x055e,
  28876. "questiondown",
  28877. 0x00bf,
  28878. "questiondownsmall",
  28879. 0xf7bf,
  28880. "questiongreek",
  28881. 0x037e,
  28882. "questionmonospace",
  28883. 0xff1f,
  28884. "questionsmall",
  28885. 0xf73f,
  28886. "quotedbl",
  28887. 0x0022,
  28888. "quotedblbase",
  28889. 0x201e,
  28890. "quotedblleft",
  28891. 0x201c,
  28892. "quotedblmonospace",
  28893. 0xff02,
  28894. "quotedblprime",
  28895. 0x301e,
  28896. "quotedblprimereversed",
  28897. 0x301d,
  28898. "quotedblright",
  28899. 0x201d,
  28900. "quoteleft",
  28901. 0x2018,
  28902. "quoteleftreversed",
  28903. 0x201b,
  28904. "quotereversed",
  28905. 0x201b,
  28906. "quoteright",
  28907. 0x2019,
  28908. "quoterightn",
  28909. 0x0149,
  28910. "quotesinglbase",
  28911. 0x201a,
  28912. "quotesingle",
  28913. 0x0027,
  28914. "quotesinglemonospace",
  28915. 0xff07,
  28916. "r",
  28917. 0x0072,
  28918. "raarmenian",
  28919. 0x057c,
  28920. "rabengali",
  28921. 0x09b0,
  28922. "racute",
  28923. 0x0155,
  28924. "radeva",
  28925. 0x0930,
  28926. "radical",
  28927. 0x221a,
  28928. "radicalex",
  28929. 0xf8e5,
  28930. "radoverssquare",
  28931. 0x33ae,
  28932. "radoverssquaredsquare",
  28933. 0x33af,
  28934. "radsquare",
  28935. 0x33ad,
  28936. "rafe",
  28937. 0x05bf,
  28938. "rafehebrew",
  28939. 0x05bf,
  28940. "ragujarati",
  28941. 0x0ab0,
  28942. "ragurmukhi",
  28943. 0x0a30,
  28944. "rahiragana",
  28945. 0x3089,
  28946. "rakatakana",
  28947. 0x30e9,
  28948. "rakatakanahalfwidth",
  28949. 0xff97,
  28950. "ralowerdiagonalbengali",
  28951. 0x09f1,
  28952. "ramiddlediagonalbengali",
  28953. 0x09f0,
  28954. "ramshorn",
  28955. 0x0264,
  28956. "ratio",
  28957. 0x2236,
  28958. "rbopomofo",
  28959. 0x3116,
  28960. "rcaron",
  28961. 0x0159,
  28962. "rcedilla",
  28963. 0x0157,
  28964. "rcircle",
  28965. 0x24e1,
  28966. "rcommaaccent",
  28967. 0x0157,
  28968. "rdblgrave",
  28969. 0x0211,
  28970. "rdotaccent",
  28971. 0x1e59,
  28972. "rdotbelow",
  28973. 0x1e5b,
  28974. "rdotbelowmacron",
  28975. 0x1e5d,
  28976. "referencemark",
  28977. 0x203b,
  28978. "reflexsubset",
  28979. 0x2286,
  28980. "reflexsuperset",
  28981. 0x2287,
  28982. "registered",
  28983. 0x00ae,
  28984. "registersans",
  28985. 0xf8e8,
  28986. "registerserif",
  28987. 0xf6da,
  28988. "reharabic",
  28989. 0x0631,
  28990. "reharmenian",
  28991. 0x0580,
  28992. "rehfinalarabic",
  28993. 0xfeae,
  28994. "rehiragana",
  28995. 0x308c,
  28996. "rekatakana",
  28997. 0x30ec,
  28998. "rekatakanahalfwidth",
  28999. 0xff9a,
  29000. "resh",
  29001. 0x05e8,
  29002. "reshdageshhebrew",
  29003. 0xfb48,
  29004. "reshhebrew",
  29005. 0x05e8,
  29006. "reversedtilde",
  29007. 0x223d,
  29008. "reviahebrew",
  29009. 0x0597,
  29010. "reviamugrashhebrew",
  29011. 0x0597,
  29012. "revlogicalnot",
  29013. 0x2310,
  29014. "rfishhook",
  29015. 0x027e,
  29016. "rfishhookreversed",
  29017. 0x027f,
  29018. "rhabengali",
  29019. 0x09dd,
  29020. "rhadeva",
  29021. 0x095d,
  29022. "rho",
  29023. 0x03c1,
  29024. "rhook",
  29025. 0x027d,
  29026. "rhookturned",
  29027. 0x027b,
  29028. "rhookturnedsuperior",
  29029. 0x02b5,
  29030. "rhosymbolgreek",
  29031. 0x03f1,
  29032. "rhotichookmod",
  29033. 0x02de,
  29034. "rieulacirclekorean",
  29035. 0x3271,
  29036. "rieulaparenkorean",
  29037. 0x3211,
  29038. "rieulcirclekorean",
  29039. 0x3263,
  29040. "rieulhieuhkorean",
  29041. 0x3140,
  29042. "rieulkiyeokkorean",
  29043. 0x313a,
  29044. "rieulkiyeoksioskorean",
  29045. 0x3169,
  29046. "rieulkorean",
  29047. 0x3139,
  29048. "rieulmieumkorean",
  29049. 0x313b,
  29050. "rieulpansioskorean",
  29051. 0x316c,
  29052. "rieulparenkorean",
  29053. 0x3203,
  29054. "rieulphieuphkorean",
  29055. 0x313f,
  29056. "rieulpieupkorean",
  29057. 0x313c,
  29058. "rieulpieupsioskorean",
  29059. 0x316b,
  29060. "rieulsioskorean",
  29061. 0x313d,
  29062. "rieulthieuthkorean",
  29063. 0x313e,
  29064. "rieultikeutkorean",
  29065. 0x316a,
  29066. "rieulyeorinhieuhkorean",
  29067. 0x316d,
  29068. "rightangle",
  29069. 0x221f,
  29070. "righttackbelowcmb",
  29071. 0x0319,
  29072. "righttriangle",
  29073. 0x22bf,
  29074. "rihiragana",
  29075. 0x308a,
  29076. "rikatakana",
  29077. 0x30ea,
  29078. "rikatakanahalfwidth",
  29079. 0xff98,
  29080. "ring",
  29081. 0x02da,
  29082. "ringbelowcmb",
  29083. 0x0325,
  29084. "ringcmb",
  29085. 0x030a,
  29086. "ringhalfleft",
  29087. 0x02bf,
  29088. "ringhalfleftarmenian",
  29089. 0x0559,
  29090. "ringhalfleftbelowcmb",
  29091. 0x031c,
  29092. "ringhalfleftcentered",
  29093. 0x02d3,
  29094. "ringhalfright",
  29095. 0x02be,
  29096. "ringhalfrightbelowcmb",
  29097. 0x0339,
  29098. "ringhalfrightcentered",
  29099. 0x02d2,
  29100. "rinvertedbreve",
  29101. 0x0213,
  29102. "rittorusquare",
  29103. 0x3351,
  29104. "rlinebelow",
  29105. 0x1e5f,
  29106. "rlongleg",
  29107. 0x027c,
  29108. "rlonglegturned",
  29109. 0x027a,
  29110. "rmonospace",
  29111. 0xff52,
  29112. "rohiragana",
  29113. 0x308d,
  29114. "rokatakana",
  29115. 0x30ed,
  29116. "rokatakanahalfwidth",
  29117. 0xff9b,
  29118. "roruathai",
  29119. 0x0e23,
  29120. "rparen",
  29121. 0x24ad,
  29122. "rrabengali",
  29123. 0x09dc,
  29124. "rradeva",
  29125. 0x0931,
  29126. "rragurmukhi",
  29127. 0x0a5c,
  29128. "rreharabic",
  29129. 0x0691,
  29130. "rrehfinalarabic",
  29131. 0xfb8d,
  29132. "rrvocalicbengali",
  29133. 0x09e0,
  29134. "rrvocalicdeva",
  29135. 0x0960,
  29136. "rrvocalicgujarati",
  29137. 0x0ae0,
  29138. "rrvocalicvowelsignbengali",
  29139. 0x09c4,
  29140. "rrvocalicvowelsigndeva",
  29141. 0x0944,
  29142. "rrvocalicvowelsigngujarati",
  29143. 0x0ac4,
  29144. "rsuperior",
  29145. 0xf6f1,
  29146. "rtblock",
  29147. 0x2590,
  29148. "rturned",
  29149. 0x0279,
  29150. "rturnedsuperior",
  29151. 0x02b4,
  29152. "ruhiragana",
  29153. 0x308b,
  29154. "rukatakana",
  29155. 0x30eb,
  29156. "rukatakanahalfwidth",
  29157. 0xff99,
  29158. "rupeemarkbengali",
  29159. 0x09f2,
  29160. "rupeesignbengali",
  29161. 0x09f3,
  29162. "rupiah",
  29163. 0xf6dd,
  29164. "ruthai",
  29165. 0x0e24,
  29166. "rvocalicbengali",
  29167. 0x098b,
  29168. "rvocalicdeva",
  29169. 0x090b,
  29170. "rvocalicgujarati",
  29171. 0x0a8b,
  29172. "rvocalicvowelsignbengali",
  29173. 0x09c3,
  29174. "rvocalicvowelsigndeva",
  29175. 0x0943,
  29176. "rvocalicvowelsigngujarati",
  29177. 0x0ac3,
  29178. "s",
  29179. 0x0073,
  29180. "sabengali",
  29181. 0x09b8,
  29182. "sacute",
  29183. 0x015b,
  29184. "sacutedotaccent",
  29185. 0x1e65,
  29186. "sadarabic",
  29187. 0x0635,
  29188. "sadeva",
  29189. 0x0938,
  29190. "sadfinalarabic",
  29191. 0xfeba,
  29192. "sadinitialarabic",
  29193. 0xfebb,
  29194. "sadmedialarabic",
  29195. 0xfebc,
  29196. "sagujarati",
  29197. 0x0ab8,
  29198. "sagurmukhi",
  29199. 0x0a38,
  29200. "sahiragana",
  29201. 0x3055,
  29202. "sakatakana",
  29203. 0x30b5,
  29204. "sakatakanahalfwidth",
  29205. 0xff7b,
  29206. "sallallahoualayhewasallamarabic",
  29207. 0xfdfa,
  29208. "samekh",
  29209. 0x05e1,
  29210. "samekhdagesh",
  29211. 0xfb41,
  29212. "samekhdageshhebrew",
  29213. 0xfb41,
  29214. "samekhhebrew",
  29215. 0x05e1,
  29216. "saraaathai",
  29217. 0x0e32,
  29218. "saraaethai",
  29219. 0x0e41,
  29220. "saraaimaimalaithai",
  29221. 0x0e44,
  29222. "saraaimaimuanthai",
  29223. 0x0e43,
  29224. "saraamthai",
  29225. 0x0e33,
  29226. "saraathai",
  29227. 0x0e30,
  29228. "saraethai",
  29229. 0x0e40,
  29230. "saraiileftthai",
  29231. 0xf886,
  29232. "saraiithai",
  29233. 0x0e35,
  29234. "saraileftthai",
  29235. 0xf885,
  29236. "saraithai",
  29237. 0x0e34,
  29238. "saraothai",
  29239. 0x0e42,
  29240. "saraueeleftthai",
  29241. 0xf888,
  29242. "saraueethai",
  29243. 0x0e37,
  29244. "saraueleftthai",
  29245. 0xf887,
  29246. "sarauethai",
  29247. 0x0e36,
  29248. "sarauthai",
  29249. 0x0e38,
  29250. "sarauuthai",
  29251. 0x0e39,
  29252. "sbopomofo",
  29253. 0x3119,
  29254. "scaron",
  29255. 0x0161,
  29256. "scarondotaccent",
  29257. 0x1e67,
  29258. "scedilla",
  29259. 0x015f,
  29260. "schwa",
  29261. 0x0259,
  29262. "schwacyrillic",
  29263. 0x04d9,
  29264. "schwadieresiscyrillic",
  29265. 0x04db,
  29266. "schwahook",
  29267. 0x025a,
  29268. "scircle",
  29269. 0x24e2,
  29270. "scircumflex",
  29271. 0x015d,
  29272. "scommaaccent",
  29273. 0x0219,
  29274. "sdotaccent",
  29275. 0x1e61,
  29276. "sdotbelow",
  29277. 0x1e63,
  29278. "sdotbelowdotaccent",
  29279. 0x1e69,
  29280. "seagullbelowcmb",
  29281. 0x033c,
  29282. "second",
  29283. 0x2033,
  29284. "secondtonechinese",
  29285. 0x02ca,
  29286. "section",
  29287. 0x00a7,
  29288. "seenarabic",
  29289. 0x0633,
  29290. "seenfinalarabic",
  29291. 0xfeb2,
  29292. "seeninitialarabic",
  29293. 0xfeb3,
  29294. "seenmedialarabic",
  29295. 0xfeb4,
  29296. "segol",
  29297. 0x05b6,
  29298. "segol13",
  29299. 0x05b6,
  29300. "segol1f",
  29301. 0x05b6,
  29302. "segol2c",
  29303. 0x05b6,
  29304. "segolhebrew",
  29305. 0x05b6,
  29306. "segolnarrowhebrew",
  29307. 0x05b6,
  29308. "segolquarterhebrew",
  29309. 0x05b6,
  29310. "segoltahebrew",
  29311. 0x0592,
  29312. "segolwidehebrew",
  29313. 0x05b6,
  29314. "seharmenian",
  29315. 0x057d,
  29316. "sehiragana",
  29317. 0x305b,
  29318. "sekatakana",
  29319. 0x30bb,
  29320. "sekatakanahalfwidth",
  29321. 0xff7e,
  29322. "semicolon",
  29323. 0x003b,
  29324. "semicolonarabic",
  29325. 0x061b,
  29326. "semicolonmonospace",
  29327. 0xff1b,
  29328. "semicolonsmall",
  29329. 0xfe54,
  29330. "semivoicedmarkkana",
  29331. 0x309c,
  29332. "semivoicedmarkkanahalfwidth",
  29333. 0xff9f,
  29334. "sentisquare",
  29335. 0x3322,
  29336. "sentosquare",
  29337. 0x3323,
  29338. "seven",
  29339. 0x0037,
  29340. "sevenarabic",
  29341. 0x0667,
  29342. "sevenbengali",
  29343. 0x09ed,
  29344. "sevencircle",
  29345. 0x2466,
  29346. "sevencircleinversesansserif",
  29347. 0x2790,
  29348. "sevendeva",
  29349. 0x096d,
  29350. "seveneighths",
  29351. 0x215e,
  29352. "sevengujarati",
  29353. 0x0aed,
  29354. "sevengurmukhi",
  29355. 0x0a6d,
  29356. "sevenhackarabic",
  29357. 0x0667,
  29358. "sevenhangzhou",
  29359. 0x3027,
  29360. "sevenideographicparen",
  29361. 0x3226,
  29362. "seveninferior",
  29363. 0x2087,
  29364. "sevenmonospace",
  29365. 0xff17,
  29366. "sevenoldstyle",
  29367. 0xf737,
  29368. "sevenparen",
  29369. 0x247a,
  29370. "sevenperiod",
  29371. 0x248e,
  29372. "sevenpersian",
  29373. 0x06f7,
  29374. "sevenroman",
  29375. 0x2176,
  29376. "sevensuperior",
  29377. 0x2077,
  29378. "seventeencircle",
  29379. 0x2470,
  29380. "seventeenparen",
  29381. 0x2484,
  29382. "seventeenperiod",
  29383. 0x2498,
  29384. "seventhai",
  29385. 0x0e57,
  29386. "sfthyphen",
  29387. 0x00ad,
  29388. "shaarmenian",
  29389. 0x0577,
  29390. "shabengali",
  29391. 0x09b6,
  29392. "shacyrillic",
  29393. 0x0448,
  29394. "shaddaarabic",
  29395. 0x0651,
  29396. "shaddadammaarabic",
  29397. 0xfc61,
  29398. "shaddadammatanarabic",
  29399. 0xfc5e,
  29400. "shaddafathaarabic",
  29401. 0xfc60,
  29402. "shaddakasraarabic",
  29403. 0xfc62,
  29404. "shaddakasratanarabic",
  29405. 0xfc5f,
  29406. "shade",
  29407. 0x2592,
  29408. "shadedark",
  29409. 0x2593,
  29410. "shadelight",
  29411. 0x2591,
  29412. "shademedium",
  29413. 0x2592,
  29414. "shadeva",
  29415. 0x0936,
  29416. "shagujarati",
  29417. 0x0ab6,
  29418. "shagurmukhi",
  29419. 0x0a36,
  29420. "shalshelethebrew",
  29421. 0x0593,
  29422. "shbopomofo",
  29423. 0x3115,
  29424. "shchacyrillic",
  29425. 0x0449,
  29426. "sheenarabic",
  29427. 0x0634,
  29428. "sheenfinalarabic",
  29429. 0xfeb6,
  29430. "sheeninitialarabic",
  29431. 0xfeb7,
  29432. "sheenmedialarabic",
  29433. 0xfeb8,
  29434. "sheicoptic",
  29435. 0x03e3,
  29436. "sheqel",
  29437. 0x20aa,
  29438. "sheqelhebrew",
  29439. 0x20aa,
  29440. "sheva",
  29441. 0x05b0,
  29442. "sheva115",
  29443. 0x05b0,
  29444. "sheva15",
  29445. 0x05b0,
  29446. "sheva22",
  29447. 0x05b0,
  29448. "sheva2e",
  29449. 0x05b0,
  29450. "shevahebrew",
  29451. 0x05b0,
  29452. "shevanarrowhebrew",
  29453. 0x05b0,
  29454. "shevaquarterhebrew",
  29455. 0x05b0,
  29456. "shevawidehebrew",
  29457. 0x05b0,
  29458. "shhacyrillic",
  29459. 0x04bb,
  29460. "shimacoptic",
  29461. 0x03ed,
  29462. "shin",
  29463. 0x05e9,
  29464. "shindagesh",
  29465. 0xfb49,
  29466. "shindageshhebrew",
  29467. 0xfb49,
  29468. "shindageshshindot",
  29469. 0xfb2c,
  29470. "shindageshshindothebrew",
  29471. 0xfb2c,
  29472. "shindageshsindot",
  29473. 0xfb2d,
  29474. "shindageshsindothebrew",
  29475. 0xfb2d,
  29476. "shindothebrew",
  29477. 0x05c1,
  29478. "shinhebrew",
  29479. 0x05e9,
  29480. "shinshindot",
  29481. 0xfb2a,
  29482. "shinshindothebrew",
  29483. 0xfb2a,
  29484. "shinsindot",
  29485. 0xfb2b,
  29486. "shinsindothebrew",
  29487. 0xfb2b,
  29488. "shook",
  29489. 0x0282,
  29490. "sigma",
  29491. 0x03c3,
  29492. "sigma1",
  29493. 0x03c2,
  29494. "sigmafinal",
  29495. 0x03c2,
  29496. "sigmalunatesymbolgreek",
  29497. 0x03f2,
  29498. "sihiragana",
  29499. 0x3057,
  29500. "sikatakana",
  29501. 0x30b7,
  29502. "sikatakanahalfwidth",
  29503. 0xff7c,
  29504. "siluqhebrew",
  29505. 0x05bd,
  29506. "siluqlefthebrew",
  29507. 0x05bd,
  29508. "similar",
  29509. 0x223c,
  29510. "sindothebrew",
  29511. 0x05c2,
  29512. "siosacirclekorean",
  29513. 0x3274,
  29514. "siosaparenkorean",
  29515. 0x3214,
  29516. "sioscieuckorean",
  29517. 0x317e,
  29518. "sioscirclekorean",
  29519. 0x3266,
  29520. "sioskiyeokkorean",
  29521. 0x317a,
  29522. "sioskorean",
  29523. 0x3145,
  29524. "siosnieunkorean",
  29525. 0x317b,
  29526. "siosparenkorean",
  29527. 0x3206,
  29528. "siospieupkorean",
  29529. 0x317d,
  29530. "siostikeutkorean",
  29531. 0x317c,
  29532. "six",
  29533. 0x0036,
  29534. "sixarabic",
  29535. 0x0666,
  29536. "sixbengali",
  29537. 0x09ec,
  29538. "sixcircle",
  29539. 0x2465,
  29540. "sixcircleinversesansserif",
  29541. 0x278f,
  29542. "sixdeva",
  29543. 0x096c,
  29544. "sixgujarati",
  29545. 0x0aec,
  29546. "sixgurmukhi",
  29547. 0x0a6c,
  29548. "sixhackarabic",
  29549. 0x0666,
  29550. "sixhangzhou",
  29551. 0x3026,
  29552. "sixideographicparen",
  29553. 0x3225,
  29554. "sixinferior",
  29555. 0x2086,
  29556. "sixmonospace",
  29557. 0xff16,
  29558. "sixoldstyle",
  29559. 0xf736,
  29560. "sixparen",
  29561. 0x2479,
  29562. "sixperiod",
  29563. 0x248d,
  29564. "sixpersian",
  29565. 0x06f6,
  29566. "sixroman",
  29567. 0x2175,
  29568. "sixsuperior",
  29569. 0x2076,
  29570. "sixteencircle",
  29571. 0x246f,
  29572. "sixteencurrencydenominatorbengali",
  29573. 0x09f9,
  29574. "sixteenparen",
  29575. 0x2483,
  29576. "sixteenperiod",
  29577. 0x2497,
  29578. "sixthai",
  29579. 0x0e56,
  29580. "slash",
  29581. 0x002f,
  29582. "slashmonospace",
  29583. 0xff0f,
  29584. "slong",
  29585. 0x017f,
  29586. "slongdotaccent",
  29587. 0x1e9b,
  29588. "smileface",
  29589. 0x263a,
  29590. "smonospace",
  29591. 0xff53,
  29592. "sofpasuqhebrew",
  29593. 0x05c3,
  29594. "softhyphen",
  29595. 0x00ad,
  29596. "softsigncyrillic",
  29597. 0x044c,
  29598. "sohiragana",
  29599. 0x305d,
  29600. "sokatakana",
  29601. 0x30bd,
  29602. "sokatakanahalfwidth",
  29603. 0xff7f,
  29604. "soliduslongoverlaycmb",
  29605. 0x0338,
  29606. "solidusshortoverlaycmb",
  29607. 0x0337,
  29608. "sorusithai",
  29609. 0x0e29,
  29610. "sosalathai",
  29611. 0x0e28,
  29612. "sosothai",
  29613. 0x0e0b,
  29614. "sosuathai",
  29615. 0x0e2a,
  29616. "space",
  29617. 0x0020,
  29618. "spacehackarabic",
  29619. 0x0020,
  29620. "spade",
  29621. 0x2660,
  29622. "spadesuitblack",
  29623. 0x2660,
  29624. "spadesuitwhite",
  29625. 0x2664,
  29626. "sparen",
  29627. 0x24ae,
  29628. "squarebelowcmb",
  29629. 0x033b,
  29630. "squarecc",
  29631. 0x33c4,
  29632. "squarecm",
  29633. 0x339d,
  29634. "squarediagonalcrosshatchfill",
  29635. 0x25a9,
  29636. "squarehorizontalfill",
  29637. 0x25a4,
  29638. "squarekg",
  29639. 0x338f,
  29640. "squarekm",
  29641. 0x339e,
  29642. "squarekmcapital",
  29643. 0x33ce,
  29644. "squareln",
  29645. 0x33d1,
  29646. "squarelog",
  29647. 0x33d2,
  29648. "squaremg",
  29649. 0x338e,
  29650. "squaremil",
  29651. 0x33d5,
  29652. "squaremm",
  29653. 0x339c,
  29654. "squaremsquared",
  29655. 0x33a1,
  29656. "squareorthogonalcrosshatchfill",
  29657. 0x25a6,
  29658. "squareupperlefttolowerrightfill",
  29659. 0x25a7,
  29660. "squareupperrighttolowerleftfill",
  29661. 0x25a8,
  29662. "squareverticalfill",
  29663. 0x25a5,
  29664. "squarewhitewithsmallblack",
  29665. 0x25a3,
  29666. "srsquare",
  29667. 0x33db,
  29668. "ssabengali",
  29669. 0x09b7,
  29670. "ssadeva",
  29671. 0x0937,
  29672. "ssagujarati",
  29673. 0x0ab7,
  29674. "ssangcieuckorean",
  29675. 0x3149,
  29676. "ssanghieuhkorean",
  29677. 0x3185,
  29678. "ssangieungkorean",
  29679. 0x3180,
  29680. "ssangkiyeokkorean",
  29681. 0x3132,
  29682. "ssangnieunkorean",
  29683. 0x3165,
  29684. "ssangpieupkorean",
  29685. 0x3143,
  29686. "ssangsioskorean",
  29687. 0x3146,
  29688. "ssangtikeutkorean",
  29689. 0x3138,
  29690. "ssuperior",
  29691. 0xf6f2,
  29692. "sterling",
  29693. 0x00a3,
  29694. "sterlingmonospace",
  29695. 0xffe1,
  29696. "strokelongoverlaycmb",
  29697. 0x0336,
  29698. "strokeshortoverlaycmb",
  29699. 0x0335,
  29700. "subset",
  29701. 0x2282,
  29702. "subsetnotequal",
  29703. 0x228a,
  29704. "subsetorequal",
  29705. 0x2286,
  29706. "succeeds",
  29707. 0x227b,
  29708. "suchthat",
  29709. 0x220b,
  29710. "suhiragana",
  29711. 0x3059,
  29712. "sukatakana",
  29713. 0x30b9,
  29714. "sukatakanahalfwidth",
  29715. 0xff7d,
  29716. "sukunarabic",
  29717. 0x0652,
  29718. "summation",
  29719. 0x2211,
  29720. "sun",
  29721. 0x263c,
  29722. "superset",
  29723. 0x2283,
  29724. "supersetnotequal",
  29725. 0x228b,
  29726. "supersetorequal",
  29727. 0x2287,
  29728. "svsquare",
  29729. 0x33dc,
  29730. "syouwaerasquare",
  29731. 0x337c,
  29732. "t",
  29733. 0x0074,
  29734. "tabengali",
  29735. 0x09a4,
  29736. "tackdown",
  29737. 0x22a4,
  29738. "tackleft",
  29739. 0x22a3,
  29740. "tadeva",
  29741. 0x0924,
  29742. "tagujarati",
  29743. 0x0aa4,
  29744. "tagurmukhi",
  29745. 0x0a24,
  29746. "taharabic",
  29747. 0x0637,
  29748. "tahfinalarabic",
  29749. 0xfec2,
  29750. "tahinitialarabic",
  29751. 0xfec3,
  29752. "tahiragana",
  29753. 0x305f,
  29754. "tahmedialarabic",
  29755. 0xfec4,
  29756. "taisyouerasquare",
  29757. 0x337d,
  29758. "takatakana",
  29759. 0x30bf,
  29760. "takatakanahalfwidth",
  29761. 0xff80,
  29762. "tatweelarabic",
  29763. 0x0640,
  29764. "tau",
  29765. 0x03c4,
  29766. "tav",
  29767. 0x05ea,
  29768. "tavdages",
  29769. 0xfb4a,
  29770. "tavdagesh",
  29771. 0xfb4a,
  29772. "tavdageshhebrew",
  29773. 0xfb4a,
  29774. "tavhebrew",
  29775. 0x05ea,
  29776. "tbar",
  29777. 0x0167,
  29778. "tbopomofo",
  29779. 0x310a,
  29780. "tcaron",
  29781. 0x0165,
  29782. "tccurl",
  29783. 0x02a8,
  29784. "tcedilla",
  29785. 0x0163,
  29786. "tcheharabic",
  29787. 0x0686,
  29788. "tchehfinalarabic",
  29789. 0xfb7b,
  29790. "tchehinitialarabic",
  29791. 0xfb7c,
  29792. "tchehmedialarabic",
  29793. 0xfb7d,
  29794. "tcircle",
  29795. 0x24e3,
  29796. "tcircumflexbelow",
  29797. 0x1e71,
  29798. "tcommaaccent",
  29799. 0x0163,
  29800. "tdieresis",
  29801. 0x1e97,
  29802. "tdotaccent",
  29803. 0x1e6b,
  29804. "tdotbelow",
  29805. 0x1e6d,
  29806. "tecyrillic",
  29807. 0x0442,
  29808. "tedescendercyrillic",
  29809. 0x04ad,
  29810. "teharabic",
  29811. 0x062a,
  29812. "tehfinalarabic",
  29813. 0xfe96,
  29814. "tehhahinitialarabic",
  29815. 0xfca2,
  29816. "tehhahisolatedarabic",
  29817. 0xfc0c,
  29818. "tehinitialarabic",
  29819. 0xfe97,
  29820. "tehiragana",
  29821. 0x3066,
  29822. "tehjeeminitialarabic",
  29823. 0xfca1,
  29824. "tehjeemisolatedarabic",
  29825. 0xfc0b,
  29826. "tehmarbutaarabic",
  29827. 0x0629,
  29828. "tehmarbutafinalarabic",
  29829. 0xfe94,
  29830. "tehmedialarabic",
  29831. 0xfe98,
  29832. "tehmeeminitialarabic",
  29833. 0xfca4,
  29834. "tehmeemisolatedarabic",
  29835. 0xfc0e,
  29836. "tehnoonfinalarabic",
  29837. 0xfc73,
  29838. "tekatakana",
  29839. 0x30c6,
  29840. "tekatakanahalfwidth",
  29841. 0xff83,
  29842. "telephone",
  29843. 0x2121,
  29844. "telephoneblack",
  29845. 0x260e,
  29846. "telishagedolahebrew",
  29847. 0x05a0,
  29848. "telishaqetanahebrew",
  29849. 0x05a9,
  29850. "tencircle",
  29851. 0x2469,
  29852. "tenideographicparen",
  29853. 0x3229,
  29854. "tenparen",
  29855. 0x247d,
  29856. "tenperiod",
  29857. 0x2491,
  29858. "tenroman",
  29859. 0x2179,
  29860. "tesh",
  29861. 0x02a7,
  29862. "tet",
  29863. 0x05d8,
  29864. "tetdagesh",
  29865. 0xfb38,
  29866. "tetdageshhebrew",
  29867. 0xfb38,
  29868. "tethebrew",
  29869. 0x05d8,
  29870. "tetsecyrillic",
  29871. 0x04b5,
  29872. "tevirhebrew",
  29873. 0x059b,
  29874. "tevirlefthebrew",
  29875. 0x059b,
  29876. "thabengali",
  29877. 0x09a5,
  29878. "thadeva",
  29879. 0x0925,
  29880. "thagujarati",
  29881. 0x0aa5,
  29882. "thagurmukhi",
  29883. 0x0a25,
  29884. "thalarabic",
  29885. 0x0630,
  29886. "thalfinalarabic",
  29887. 0xfeac,
  29888. "thanthakhatlowleftthai",
  29889. 0xf898,
  29890. "thanthakhatlowrightthai",
  29891. 0xf897,
  29892. "thanthakhatthai",
  29893. 0x0e4c,
  29894. "thanthakhatupperleftthai",
  29895. 0xf896,
  29896. "theharabic",
  29897. 0x062b,
  29898. "thehfinalarabic",
  29899. 0xfe9a,
  29900. "thehinitialarabic",
  29901. 0xfe9b,
  29902. "thehmedialarabic",
  29903. 0xfe9c,
  29904. "thereexists",
  29905. 0x2203,
  29906. "therefore",
  29907. 0x2234,
  29908. "theta",
  29909. 0x03b8,
  29910. "theta1",
  29911. 0x03d1,
  29912. "thetasymbolgreek",
  29913. 0x03d1,
  29914. "thieuthacirclekorean",
  29915. 0x3279,
  29916. "thieuthaparenkorean",
  29917. 0x3219,
  29918. "thieuthcirclekorean",
  29919. 0x326b,
  29920. "thieuthkorean",
  29921. 0x314c,
  29922. "thieuthparenkorean",
  29923. 0x320b,
  29924. "thirteencircle",
  29925. 0x246c,
  29926. "thirteenparen",
  29927. 0x2480,
  29928. "thirteenperiod",
  29929. 0x2494,
  29930. "thonangmonthothai",
  29931. 0x0e11,
  29932. "thook",
  29933. 0x01ad,
  29934. "thophuthaothai",
  29935. 0x0e12,
  29936. "thorn",
  29937. 0x00fe,
  29938. "thothahanthai",
  29939. 0x0e17,
  29940. "thothanthai",
  29941. 0x0e10,
  29942. "thothongthai",
  29943. 0x0e18,
  29944. "thothungthai",
  29945. 0x0e16,
  29946. "thousandcyrillic",
  29947. 0x0482,
  29948. "thousandsseparatorarabic",
  29949. 0x066c,
  29950. "thousandsseparatorpersian",
  29951. 0x066c,
  29952. "three",
  29953. 0x0033,
  29954. "threearabic",
  29955. 0x0663,
  29956. "threebengali",
  29957. 0x09e9,
  29958. "threecircle",
  29959. 0x2462,
  29960. "threecircleinversesansserif",
  29961. 0x278c,
  29962. "threedeva",
  29963. 0x0969,
  29964. "threeeighths",
  29965. 0x215c,
  29966. "threegujarati",
  29967. 0x0ae9,
  29968. "threegurmukhi",
  29969. 0x0a69,
  29970. "threehackarabic",
  29971. 0x0663,
  29972. "threehangzhou",
  29973. 0x3023,
  29974. "threeideographicparen",
  29975. 0x3222,
  29976. "threeinferior",
  29977. 0x2083,
  29978. "threemonospace",
  29979. 0xff13,
  29980. "threenumeratorbengali",
  29981. 0x09f6,
  29982. "threeoldstyle",
  29983. 0xf733,
  29984. "threeparen",
  29985. 0x2476,
  29986. "threeperiod",
  29987. 0x248a,
  29988. "threepersian",
  29989. 0x06f3,
  29990. "threequarters",
  29991. 0x00be,
  29992. "threequartersemdash",
  29993. 0xf6de,
  29994. "threeroman",
  29995. 0x2172,
  29996. "threesuperior",
  29997. 0x00b3,
  29998. "threethai",
  29999. 0x0e53,
  30000. "thzsquare",
  30001. 0x3394,
  30002. "tihiragana",
  30003. 0x3061,
  30004. "tikatakana",
  30005. 0x30c1,
  30006. "tikatakanahalfwidth",
  30007. 0xff81,
  30008. "tikeutacirclekorean",
  30009. 0x3270,
  30010. "tikeutaparenkorean",
  30011. 0x3210,
  30012. "tikeutcirclekorean",
  30013. 0x3262,
  30014. "tikeutkorean",
  30015. 0x3137,
  30016. "tikeutparenkorean",
  30017. 0x3202,
  30018. "tilde",
  30019. 0x02dc,
  30020. "tildebelowcmb",
  30021. 0x0330,
  30022. "tildecmb",
  30023. 0x0303,
  30024. "tildecomb",
  30025. 0x0303,
  30026. "tildedoublecmb",
  30027. 0x0360,
  30028. "tildeoperator",
  30029. 0x223c,
  30030. "tildeoverlaycmb",
  30031. 0x0334,
  30032. "tildeverticalcmb",
  30033. 0x033e,
  30034. "timescircle",
  30035. 0x2297,
  30036. "tipehahebrew",
  30037. 0x0596,
  30038. "tipehalefthebrew",
  30039. 0x0596,
  30040. "tippigurmukhi",
  30041. 0x0a70,
  30042. "titlocyrilliccmb",
  30043. 0x0483,
  30044. "tiwnarmenian",
  30045. 0x057f,
  30046. "tlinebelow",
  30047. 0x1e6f,
  30048. "tmonospace",
  30049. 0xff54,
  30050. "toarmenian",
  30051. 0x0569,
  30052. "tohiragana",
  30053. 0x3068,
  30054. "tokatakana",
  30055. 0x30c8,
  30056. "tokatakanahalfwidth",
  30057. 0xff84,
  30058. "tonebarextrahighmod",
  30059. 0x02e5,
  30060. "tonebarextralowmod",
  30061. 0x02e9,
  30062. "tonebarhighmod",
  30063. 0x02e6,
  30064. "tonebarlowmod",
  30065. 0x02e8,
  30066. "tonebarmidmod",
  30067. 0x02e7,
  30068. "tonefive",
  30069. 0x01bd,
  30070. "tonesix",
  30071. 0x0185,
  30072. "tonetwo",
  30073. 0x01a8,
  30074. "tonos",
  30075. 0x0384,
  30076. "tonsquare",
  30077. 0x3327,
  30078. "topatakthai",
  30079. 0x0e0f,
  30080. "tortoiseshellbracketleft",
  30081. 0x3014,
  30082. "tortoiseshellbracketleftsmall",
  30083. 0xfe5d,
  30084. "tortoiseshellbracketleftvertical",
  30085. 0xfe39,
  30086. "tortoiseshellbracketright",
  30087. 0x3015,
  30088. "tortoiseshellbracketrightsmall",
  30089. 0xfe5e,
  30090. "tortoiseshellbracketrightvertical",
  30091. 0xfe3a,
  30092. "totaothai",
  30093. 0x0e15,
  30094. "tpalatalhook",
  30095. 0x01ab,
  30096. "tparen",
  30097. 0x24af,
  30098. "trademark",
  30099. 0x2122,
  30100. "trademarksans",
  30101. 0xf8ea,
  30102. "trademarkserif",
  30103. 0xf6db,
  30104. "tretroflexhook",
  30105. 0x0288,
  30106. "triagdn",
  30107. 0x25bc,
  30108. "triaglf",
  30109. 0x25c4,
  30110. "triagrt",
  30111. 0x25ba,
  30112. "triagup",
  30113. 0x25b2,
  30114. "ts",
  30115. 0x02a6,
  30116. "tsadi",
  30117. 0x05e6,
  30118. "tsadidagesh",
  30119. 0xfb46,
  30120. "tsadidageshhebrew",
  30121. 0xfb46,
  30122. "tsadihebrew",
  30123. 0x05e6,
  30124. "tsecyrillic",
  30125. 0x0446,
  30126. "tsere",
  30127. 0x05b5,
  30128. "tsere12",
  30129. 0x05b5,
  30130. "tsere1e",
  30131. 0x05b5,
  30132. "tsere2b",
  30133. 0x05b5,
  30134. "tserehebrew",
  30135. 0x05b5,
  30136. "tserenarrowhebrew",
  30137. 0x05b5,
  30138. "tserequarterhebrew",
  30139. 0x05b5,
  30140. "tserewidehebrew",
  30141. 0x05b5,
  30142. "tshecyrillic",
  30143. 0x045b,
  30144. "tsuperior",
  30145. 0xf6f3,
  30146. "ttabengali",
  30147. 0x099f,
  30148. "ttadeva",
  30149. 0x091f,
  30150. "ttagujarati",
  30151. 0x0a9f,
  30152. "ttagurmukhi",
  30153. 0x0a1f,
  30154. "tteharabic",
  30155. 0x0679,
  30156. "ttehfinalarabic",
  30157. 0xfb67,
  30158. "ttehinitialarabic",
  30159. 0xfb68,
  30160. "ttehmedialarabic",
  30161. 0xfb69,
  30162. "tthabengali",
  30163. 0x09a0,
  30164. "tthadeva",
  30165. 0x0920,
  30166. "tthagujarati",
  30167. 0x0aa0,
  30168. "tthagurmukhi",
  30169. 0x0a20,
  30170. "tturned",
  30171. 0x0287,
  30172. "tuhiragana",
  30173. 0x3064,
  30174. "tukatakana",
  30175. 0x30c4,
  30176. "tukatakanahalfwidth",
  30177. 0xff82,
  30178. "tusmallhiragana",
  30179. 0x3063,
  30180. "tusmallkatakana",
  30181. 0x30c3,
  30182. "tusmallkatakanahalfwidth",
  30183. 0xff6f,
  30184. "twelvecircle",
  30185. 0x246b,
  30186. "twelveparen",
  30187. 0x247f,
  30188. "twelveperiod",
  30189. 0x2493,
  30190. "twelveroman",
  30191. 0x217b,
  30192. "twentycircle",
  30193. 0x2473,
  30194. "twentyhangzhou",
  30195. 0x5344,
  30196. "twentyparen",
  30197. 0x2487,
  30198. "twentyperiod",
  30199. 0x249b,
  30200. "two",
  30201. 0x0032,
  30202. "twoarabic",
  30203. 0x0662,
  30204. "twobengali",
  30205. 0x09e8,
  30206. "twocircle",
  30207. 0x2461,
  30208. "twocircleinversesansserif",
  30209. 0x278b,
  30210. "twodeva",
  30211. 0x0968,
  30212. "twodotenleader",
  30213. 0x2025,
  30214. "twodotleader",
  30215. 0x2025,
  30216. "twodotleadervertical",
  30217. 0xfe30,
  30218. "twogujarati",
  30219. 0x0ae8,
  30220. "twogurmukhi",
  30221. 0x0a68,
  30222. "twohackarabic",
  30223. 0x0662,
  30224. "twohangzhou",
  30225. 0x3022,
  30226. "twoideographicparen",
  30227. 0x3221,
  30228. "twoinferior",
  30229. 0x2082,
  30230. "twomonospace",
  30231. 0xff12,
  30232. "twonumeratorbengali",
  30233. 0x09f5,
  30234. "twooldstyle",
  30235. 0xf732,
  30236. "twoparen",
  30237. 0x2475,
  30238. "twoperiod",
  30239. 0x2489,
  30240. "twopersian",
  30241. 0x06f2,
  30242. "tworoman",
  30243. 0x2171,
  30244. "twostroke",
  30245. 0x01bb,
  30246. "twosuperior",
  30247. 0x00b2,
  30248. "twothai",
  30249. 0x0e52,
  30250. "twothirds",
  30251. 0x2154,
  30252. "u",
  30253. 0x0075,
  30254. "uacute",
  30255. 0x00fa,
  30256. "ubar",
  30257. 0x0289,
  30258. "ubengali",
  30259. 0x0989,
  30260. "ubopomofo",
  30261. 0x3128,
  30262. "ubreve",
  30263. 0x016d,
  30264. "ucaron",
  30265. 0x01d4,
  30266. "ucircle",
  30267. 0x24e4,
  30268. "ucircumflex",
  30269. 0x00fb,
  30270. "ucircumflexbelow",
  30271. 0x1e77,
  30272. "ucyrillic",
  30273. 0x0443,
  30274. "udattadeva",
  30275. 0x0951,
  30276. "udblacute",
  30277. 0x0171,
  30278. "udblgrave",
  30279. 0x0215,
  30280. "udeva",
  30281. 0x0909,
  30282. "udieresis",
  30283. 0x00fc,
  30284. "udieresisacute",
  30285. 0x01d8,
  30286. "udieresisbelow",
  30287. 0x1e73,
  30288. "udieresiscaron",
  30289. 0x01da,
  30290. "udieresiscyrillic",
  30291. 0x04f1,
  30292. "udieresisgrave",
  30293. 0x01dc,
  30294. "udieresismacron",
  30295. 0x01d6,
  30296. "udotbelow",
  30297. 0x1ee5,
  30298. "ugrave",
  30299. 0x00f9,
  30300. "ugujarati",
  30301. 0x0a89,
  30302. "ugurmukhi",
  30303. 0x0a09,
  30304. "uhiragana",
  30305. 0x3046,
  30306. "uhookabove",
  30307. 0x1ee7,
  30308. "uhorn",
  30309. 0x01b0,
  30310. "uhornacute",
  30311. 0x1ee9,
  30312. "uhorndotbelow",
  30313. 0x1ef1,
  30314. "uhorngrave",
  30315. 0x1eeb,
  30316. "uhornhookabove",
  30317. 0x1eed,
  30318. "uhorntilde",
  30319. 0x1eef,
  30320. "uhungarumlaut",
  30321. 0x0171,
  30322. "uhungarumlautcyrillic",
  30323. 0x04f3,
  30324. "uinvertedbreve",
  30325. 0x0217,
  30326. "ukatakana",
  30327. 0x30a6,
  30328. "ukatakanahalfwidth",
  30329. 0xff73,
  30330. "ukcyrillic",
  30331. 0x0479,
  30332. "ukorean",
  30333. 0x315c,
  30334. "umacron",
  30335. 0x016b,
  30336. "umacroncyrillic",
  30337. 0x04ef,
  30338. "umacrondieresis",
  30339. 0x1e7b,
  30340. "umatragurmukhi",
  30341. 0x0a41,
  30342. "umonospace",
  30343. 0xff55,
  30344. "underscore",
  30345. 0x005f,
  30346. "underscoredbl",
  30347. 0x2017,
  30348. "underscoremonospace",
  30349. 0xff3f,
  30350. "underscorevertical",
  30351. 0xfe33,
  30352. "underscorewavy",
  30353. 0xfe4f,
  30354. "union",
  30355. 0x222a,
  30356. "universal",
  30357. 0x2200,
  30358. "uogonek",
  30359. 0x0173,
  30360. "uparen",
  30361. 0x24b0,
  30362. "upblock",
  30363. 0x2580,
  30364. "upperdothebrew",
  30365. 0x05c4,
  30366. "upsilon",
  30367. 0x03c5,
  30368. "upsilondieresis",
  30369. 0x03cb,
  30370. "upsilondieresistonos",
  30371. 0x03b0,
  30372. "upsilonlatin",
  30373. 0x028a,
  30374. "upsilontonos",
  30375. 0x03cd,
  30376. "uptackbelowcmb",
  30377. 0x031d,
  30378. "uptackmod",
  30379. 0x02d4,
  30380. "uragurmukhi",
  30381. 0x0a73,
  30382. "uring",
  30383. 0x016f,
  30384. "ushortcyrillic",
  30385. 0x045e,
  30386. "usmallhiragana",
  30387. 0x3045,
  30388. "usmallkatakana",
  30389. 0x30a5,
  30390. "usmallkatakanahalfwidth",
  30391. 0xff69,
  30392. "ustraightcyrillic",
  30393. 0x04af,
  30394. "ustraightstrokecyrillic",
  30395. 0x04b1,
  30396. "utilde",
  30397. 0x0169,
  30398. "utildeacute",
  30399. 0x1e79,
  30400. "utildebelow",
  30401. 0x1e75,
  30402. "uubengali",
  30403. 0x098a,
  30404. "uudeva",
  30405. 0x090a,
  30406. "uugujarati",
  30407. 0x0a8a,
  30408. "uugurmukhi",
  30409. 0x0a0a,
  30410. "uumatragurmukhi",
  30411. 0x0a42,
  30412. "uuvowelsignbengali",
  30413. 0x09c2,
  30414. "uuvowelsigndeva",
  30415. 0x0942,
  30416. "uuvowelsigngujarati",
  30417. 0x0ac2,
  30418. "uvowelsignbengali",
  30419. 0x09c1,
  30420. "uvowelsigndeva",
  30421. 0x0941,
  30422. "uvowelsigngujarati",
  30423. 0x0ac1,
  30424. "v",
  30425. 0x0076,
  30426. "vadeva",
  30427. 0x0935,
  30428. "vagujarati",
  30429. 0x0ab5,
  30430. "vagurmukhi",
  30431. 0x0a35,
  30432. "vakatakana",
  30433. 0x30f7,
  30434. "vav",
  30435. 0x05d5,
  30436. "vavdagesh",
  30437. 0xfb35,
  30438. "vavdagesh65",
  30439. 0xfb35,
  30440. "vavdageshhebrew",
  30441. 0xfb35,
  30442. "vavhebrew",
  30443. 0x05d5,
  30444. "vavholam",
  30445. 0xfb4b,
  30446. "vavholamhebrew",
  30447. 0xfb4b,
  30448. "vavvavhebrew",
  30449. 0x05f0,
  30450. "vavyodhebrew",
  30451. 0x05f1,
  30452. "vcircle",
  30453. 0x24e5,
  30454. "vdotbelow",
  30455. 0x1e7f,
  30456. "vecyrillic",
  30457. 0x0432,
  30458. "veharabic",
  30459. 0x06a4,
  30460. "vehfinalarabic",
  30461. 0xfb6b,
  30462. "vehinitialarabic",
  30463. 0xfb6c,
  30464. "vehmedialarabic",
  30465. 0xfb6d,
  30466. "vekatakana",
  30467. 0x30f9,
  30468. "venus",
  30469. 0x2640,
  30470. "verticalbar",
  30471. 0x007c,
  30472. "verticallineabovecmb",
  30473. 0x030d,
  30474. "verticallinebelowcmb",
  30475. 0x0329,
  30476. "verticallinelowmod",
  30477. 0x02cc,
  30478. "verticallinemod",
  30479. 0x02c8,
  30480. "vewarmenian",
  30481. 0x057e,
  30482. "vhook",
  30483. 0x028b,
  30484. "vikatakana",
  30485. 0x30f8,
  30486. "viramabengali",
  30487. 0x09cd,
  30488. "viramadeva",
  30489. 0x094d,
  30490. "viramagujarati",
  30491. 0x0acd,
  30492. "visargabengali",
  30493. 0x0983,
  30494. "visargadeva",
  30495. 0x0903,
  30496. "visargagujarati",
  30497. 0x0a83,
  30498. "vmonospace",
  30499. 0xff56,
  30500. "voarmenian",
  30501. 0x0578,
  30502. "voicediterationhiragana",
  30503. 0x309e,
  30504. "voicediterationkatakana",
  30505. 0x30fe,
  30506. "voicedmarkkana",
  30507. 0x309b,
  30508. "voicedmarkkanahalfwidth",
  30509. 0xff9e,
  30510. "vokatakana",
  30511. 0x30fa,
  30512. "vparen",
  30513. 0x24b1,
  30514. "vtilde",
  30515. 0x1e7d,
  30516. "vturned",
  30517. 0x028c,
  30518. "vuhiragana",
  30519. 0x3094,
  30520. "vukatakana",
  30521. 0x30f4,
  30522. "w",
  30523. 0x0077,
  30524. "wacute",
  30525. 0x1e83,
  30526. "waekorean",
  30527. 0x3159,
  30528. "wahiragana",
  30529. 0x308f,
  30530. "wakatakana",
  30531. 0x30ef,
  30532. "wakatakanahalfwidth",
  30533. 0xff9c,
  30534. "wakorean",
  30535. 0x3158,
  30536. "wasmallhiragana",
  30537. 0x308e,
  30538. "wasmallkatakana",
  30539. 0x30ee,
  30540. "wattosquare",
  30541. 0x3357,
  30542. "wavedash",
  30543. 0x301c,
  30544. "wavyunderscorevertical",
  30545. 0xfe34,
  30546. "wawarabic",
  30547. 0x0648,
  30548. "wawfinalarabic",
  30549. 0xfeee,
  30550. "wawhamzaabovearabic",
  30551. 0x0624,
  30552. "wawhamzaabovefinalarabic",
  30553. 0xfe86,
  30554. "wbsquare",
  30555. 0x33dd,
  30556. "wcircle",
  30557. 0x24e6,
  30558. "wcircumflex",
  30559. 0x0175,
  30560. "wdieresis",
  30561. 0x1e85,
  30562. "wdotaccent",
  30563. 0x1e87,
  30564. "wdotbelow",
  30565. 0x1e89,
  30566. "wehiragana",
  30567. 0x3091,
  30568. "weierstrass",
  30569. 0x2118,
  30570. "wekatakana",
  30571. 0x30f1,
  30572. "wekorean",
  30573. 0x315e,
  30574. "weokorean",
  30575. 0x315d,
  30576. "wgrave",
  30577. 0x1e81,
  30578. "whitebullet",
  30579. 0x25e6,
  30580. "whitecircle",
  30581. 0x25cb,
  30582. "whitecircleinverse",
  30583. 0x25d9,
  30584. "whitecornerbracketleft",
  30585. 0x300e,
  30586. "whitecornerbracketleftvertical",
  30587. 0xfe43,
  30588. "whitecornerbracketright",
  30589. 0x300f,
  30590. "whitecornerbracketrightvertical",
  30591. 0xfe44,
  30592. "whitediamond",
  30593. 0x25c7,
  30594. "whitediamondcontainingblacksmalldiamond",
  30595. 0x25c8,
  30596. "whitedownpointingsmalltriangle",
  30597. 0x25bf,
  30598. "whitedownpointingtriangle",
  30599. 0x25bd,
  30600. "whiteleftpointingsmalltriangle",
  30601. 0x25c3,
  30602. "whiteleftpointingtriangle",
  30603. 0x25c1,
  30604. "whitelenticularbracketleft",
  30605. 0x3016,
  30606. "whitelenticularbracketright",
  30607. 0x3017,
  30608. "whiterightpointingsmalltriangle",
  30609. 0x25b9,
  30610. "whiterightpointingtriangle",
  30611. 0x25b7,
  30612. "whitesmallsquare",
  30613. 0x25ab,
  30614. "whitesmilingface",
  30615. 0x263a,
  30616. "whitesquare",
  30617. 0x25a1,
  30618. "whitestar",
  30619. 0x2606,
  30620. "whitetelephone",
  30621. 0x260f,
  30622. "whitetortoiseshellbracketleft",
  30623. 0x3018,
  30624. "whitetortoiseshellbracketright",
  30625. 0x3019,
  30626. "whiteuppointingsmalltriangle",
  30627. 0x25b5,
  30628. "whiteuppointingtriangle",
  30629. 0x25b3,
  30630. "wihiragana",
  30631. 0x3090,
  30632. "wikatakana",
  30633. 0x30f0,
  30634. "wikorean",
  30635. 0x315f,
  30636. "wmonospace",
  30637. 0xff57,
  30638. "wohiragana",
  30639. 0x3092,
  30640. "wokatakana",
  30641. 0x30f2,
  30642. "wokatakanahalfwidth",
  30643. 0xff66,
  30644. "won",
  30645. 0x20a9,
  30646. "wonmonospace",
  30647. 0xffe6,
  30648. "wowaenthai",
  30649. 0x0e27,
  30650. "wparen",
  30651. 0x24b2,
  30652. "wring",
  30653. 0x1e98,
  30654. "wsuperior",
  30655. 0x02b7,
  30656. "wturned",
  30657. 0x028d,
  30658. "wynn",
  30659. 0x01bf,
  30660. "x",
  30661. 0x0078,
  30662. "xabovecmb",
  30663. 0x033d,
  30664. "xbopomofo",
  30665. 0x3112,
  30666. "xcircle",
  30667. 0x24e7,
  30668. "xdieresis",
  30669. 0x1e8d,
  30670. "xdotaccent",
  30671. 0x1e8b,
  30672. "xeharmenian",
  30673. 0x056d,
  30674. "xi",
  30675. 0x03be,
  30676. "xmonospace",
  30677. 0xff58,
  30678. "xparen",
  30679. 0x24b3,
  30680. "xsuperior",
  30681. 0x02e3,
  30682. "y",
  30683. 0x0079,
  30684. "yaadosquare",
  30685. 0x334e,
  30686. "yabengali",
  30687. 0x09af,
  30688. "yacute",
  30689. 0x00fd,
  30690. "yadeva",
  30691. 0x092f,
  30692. "yaekorean",
  30693. 0x3152,
  30694. "yagujarati",
  30695. 0x0aaf,
  30696. "yagurmukhi",
  30697. 0x0a2f,
  30698. "yahiragana",
  30699. 0x3084,
  30700. "yakatakana",
  30701. 0x30e4,
  30702. "yakatakanahalfwidth",
  30703. 0xff94,
  30704. "yakorean",
  30705. 0x3151,
  30706. "yamakkanthai",
  30707. 0x0e4e,
  30708. "yasmallhiragana",
  30709. 0x3083,
  30710. "yasmallkatakana",
  30711. 0x30e3,
  30712. "yasmallkatakanahalfwidth",
  30713. 0xff6c,
  30714. "yatcyrillic",
  30715. 0x0463,
  30716. "ycircle",
  30717. 0x24e8,
  30718. "ycircumflex",
  30719. 0x0177,
  30720. "ydieresis",
  30721. 0x00ff,
  30722. "ydotaccent",
  30723. 0x1e8f,
  30724. "ydotbelow",
  30725. 0x1ef5,
  30726. "yeharabic",
  30727. 0x064a,
  30728. "yehbarreearabic",
  30729. 0x06d2,
  30730. "yehbarreefinalarabic",
  30731. 0xfbaf,
  30732. "yehfinalarabic",
  30733. 0xfef2,
  30734. "yehhamzaabovearabic",
  30735. 0x0626,
  30736. "yehhamzaabovefinalarabic",
  30737. 0xfe8a,
  30738. "yehhamzaaboveinitialarabic",
  30739. 0xfe8b,
  30740. "yehhamzaabovemedialarabic",
  30741. 0xfe8c,
  30742. "yehinitialarabic",
  30743. 0xfef3,
  30744. "yehmedialarabic",
  30745. 0xfef4,
  30746. "yehmeeminitialarabic",
  30747. 0xfcdd,
  30748. "yehmeemisolatedarabic",
  30749. 0xfc58,
  30750. "yehnoonfinalarabic",
  30751. 0xfc94,
  30752. "yehthreedotsbelowarabic",
  30753. 0x06d1,
  30754. "yekorean",
  30755. 0x3156,
  30756. "yen",
  30757. 0x00a5,
  30758. "yenmonospace",
  30759. 0xffe5,
  30760. "yeokorean",
  30761. 0x3155,
  30762. "yeorinhieuhkorean",
  30763. 0x3186,
  30764. "yerahbenyomohebrew",
  30765. 0x05aa,
  30766. "yerahbenyomolefthebrew",
  30767. 0x05aa,
  30768. "yericyrillic",
  30769. 0x044b,
  30770. "yerudieresiscyrillic",
  30771. 0x04f9,
  30772. "yesieungkorean",
  30773. 0x3181,
  30774. "yesieungpansioskorean",
  30775. 0x3183,
  30776. "yesieungsioskorean",
  30777. 0x3182,
  30778. "yetivhebrew",
  30779. 0x059a,
  30780. "ygrave",
  30781. 0x1ef3,
  30782. "yhook",
  30783. 0x01b4,
  30784. "yhookabove",
  30785. 0x1ef7,
  30786. "yiarmenian",
  30787. 0x0575,
  30788. "yicyrillic",
  30789. 0x0457,
  30790. "yikorean",
  30791. 0x3162,
  30792. "yinyang",
  30793. 0x262f,
  30794. "yiwnarmenian",
  30795. 0x0582,
  30796. "ymonospace",
  30797. 0xff59,
  30798. "yod",
  30799. 0x05d9,
  30800. "yoddagesh",
  30801. 0xfb39,
  30802. "yoddageshhebrew",
  30803. 0xfb39,
  30804. "yodhebrew",
  30805. 0x05d9,
  30806. "yodyodhebrew",
  30807. 0x05f2,
  30808. "yodyodpatahhebrew",
  30809. 0xfb1f,
  30810. "yohiragana",
  30811. 0x3088,
  30812. "yoikorean",
  30813. 0x3189,
  30814. "yokatakana",
  30815. 0x30e8,
  30816. "yokatakanahalfwidth",
  30817. 0xff96,
  30818. "yokorean",
  30819. 0x315b,
  30820. "yosmallhiragana",
  30821. 0x3087,
  30822. "yosmallkatakana",
  30823. 0x30e7,
  30824. "yosmallkatakanahalfwidth",
  30825. 0xff6e,
  30826. "yotgreek",
  30827. 0x03f3,
  30828. "yoyaekorean",
  30829. 0x3188,
  30830. "yoyakorean",
  30831. 0x3187,
  30832. "yoyakthai",
  30833. 0x0e22,
  30834. "yoyingthai",
  30835. 0x0e0d,
  30836. "yparen",
  30837. 0x24b4,
  30838. "ypogegrammeni",
  30839. 0x037a,
  30840. "ypogegrammenigreekcmb",
  30841. 0x0345,
  30842. "yr",
  30843. 0x01a6,
  30844. "yring",
  30845. 0x1e99,
  30846. "ysuperior",
  30847. 0x02b8,
  30848. "ytilde",
  30849. 0x1ef9,
  30850. "yturned",
  30851. 0x028e,
  30852. "yuhiragana",
  30853. 0x3086,
  30854. "yuikorean",
  30855. 0x318c,
  30856. "yukatakana",
  30857. 0x30e6,
  30858. "yukatakanahalfwidth",
  30859. 0xff95,
  30860. "yukorean",
  30861. 0x3160,
  30862. "yusbigcyrillic",
  30863. 0x046b,
  30864. "yusbigiotifiedcyrillic",
  30865. 0x046d,
  30866. "yuslittlecyrillic",
  30867. 0x0467,
  30868. "yuslittleiotifiedcyrillic",
  30869. 0x0469,
  30870. "yusmallhiragana",
  30871. 0x3085,
  30872. "yusmallkatakana",
  30873. 0x30e5,
  30874. "yusmallkatakanahalfwidth",
  30875. 0xff6d,
  30876. "yuyekorean",
  30877. 0x318b,
  30878. "yuyeokorean",
  30879. 0x318a,
  30880. "yyabengali",
  30881. 0x09df,
  30882. "yyadeva",
  30883. 0x095f,
  30884. "z",
  30885. 0x007a,
  30886. "zaarmenian",
  30887. 0x0566,
  30888. "zacute",
  30889. 0x017a,
  30890. "zadeva",
  30891. 0x095b,
  30892. "zagurmukhi",
  30893. 0x0a5b,
  30894. "zaharabic",
  30895. 0x0638,
  30896. "zahfinalarabic",
  30897. 0xfec6,
  30898. "zahinitialarabic",
  30899. 0xfec7,
  30900. "zahiragana",
  30901. 0x3056,
  30902. "zahmedialarabic",
  30903. 0xfec8,
  30904. "zainarabic",
  30905. 0x0632,
  30906. "zainfinalarabic",
  30907. 0xfeb0,
  30908. "zakatakana",
  30909. 0x30b6,
  30910. "zaqefgadolhebrew",
  30911. 0x0595,
  30912. "zaqefqatanhebrew",
  30913. 0x0594,
  30914. "zarqahebrew",
  30915. 0x0598,
  30916. "zayin",
  30917. 0x05d6,
  30918. "zayindagesh",
  30919. 0xfb36,
  30920. "zayindageshhebrew",
  30921. 0xfb36,
  30922. "zayinhebrew",
  30923. 0x05d6,
  30924. "zbopomofo",
  30925. 0x3117,
  30926. "zcaron",
  30927. 0x017e,
  30928. "zcircle",
  30929. 0x24e9,
  30930. "zcircumflex",
  30931. 0x1e91,
  30932. "zcurl",
  30933. 0x0291,
  30934. "zdot",
  30935. 0x017c,
  30936. "zdotaccent",
  30937. 0x017c,
  30938. "zdotbelow",
  30939. 0x1e93,
  30940. "zecyrillic",
  30941. 0x0437,
  30942. "zedescendercyrillic",
  30943. 0x0499,
  30944. "zedieresiscyrillic",
  30945. 0x04df,
  30946. "zehiragana",
  30947. 0x305c,
  30948. "zekatakana",
  30949. 0x30bc,
  30950. "zero",
  30951. 0x0030,
  30952. "zeroarabic",
  30953. 0x0660,
  30954. "zerobengali",
  30955. 0x09e6,
  30956. "zerodeva",
  30957. 0x0966,
  30958. "zerogujarati",
  30959. 0x0ae6,
  30960. "zerogurmukhi",
  30961. 0x0a66,
  30962. "zerohackarabic",
  30963. 0x0660,
  30964. "zeroinferior",
  30965. 0x2080,
  30966. "zeromonospace",
  30967. 0xff10,
  30968. "zerooldstyle",
  30969. 0xf730,
  30970. "zeropersian",
  30971. 0x06f0,
  30972. "zerosuperior",
  30973. 0x2070,
  30974. "zerothai",
  30975. 0x0e50,
  30976. "zerowidthjoiner",
  30977. 0xfeff,
  30978. "zerowidthnonjoiner",
  30979. 0x200c,
  30980. "zerowidthspace",
  30981. 0x200b,
  30982. "zeta",
  30983. 0x03b6,
  30984. "zhbopomofo",
  30985. 0x3113,
  30986. "zhearmenian",
  30987. 0x056a,
  30988. "zhebrevecyrillic",
  30989. 0x04c2,
  30990. "zhecyrillic",
  30991. 0x0436,
  30992. "zhedescendercyrillic",
  30993. 0x0497,
  30994. "zhedieresiscyrillic",
  30995. 0x04dd,
  30996. "zihiragana",
  30997. 0x3058,
  30998. "zikatakana",
  30999. 0x30b8,
  31000. "zinorhebrew",
  31001. 0x05ae,
  31002. "zlinebelow",
  31003. 0x1e95,
  31004. "zmonospace",
  31005. 0xff5a,
  31006. "zohiragana",
  31007. 0x305e,
  31008. "zokatakana",
  31009. 0x30be,
  31010. "zparen",
  31011. 0x24b5,
  31012. "zretroflexhook",
  31013. 0x0290,
  31014. "zstroke",
  31015. 0x01b6,
  31016. "zuhiragana",
  31017. 0x305a,
  31018. "zukatakana",
  31019. 0x30ba,
  31020. ".notdef",
  31021. 0x0000,
  31022. "angbracketleftbig",
  31023. 0x2329,
  31024. "angbracketleftBig",
  31025. 0x2329,
  31026. "angbracketleftbigg",
  31027. 0x2329,
  31028. "angbracketleftBigg",
  31029. 0x2329,
  31030. "angbracketrightBig",
  31031. 0x232a,
  31032. "angbracketrightbig",
  31033. 0x232a,
  31034. "angbracketrightBigg",
  31035. 0x232a,
  31036. "angbracketrightbigg",
  31037. 0x232a,
  31038. "arrowhookleft",
  31039. 0x21aa,
  31040. "arrowhookright",
  31041. 0x21a9,
  31042. "arrowlefttophalf",
  31043. 0x21bc,
  31044. "arrowleftbothalf",
  31045. 0x21bd,
  31046. "arrownortheast",
  31047. 0x2197,
  31048. "arrownorthwest",
  31049. 0x2196,
  31050. "arrowrighttophalf",
  31051. 0x21c0,
  31052. "arrowrightbothalf",
  31053. 0x21c1,
  31054. "arrowsoutheast",
  31055. 0x2198,
  31056. "arrowsouthwest",
  31057. 0x2199,
  31058. "backslashbig",
  31059. 0x2216,
  31060. "backslashBig",
  31061. 0x2216,
  31062. "backslashBigg",
  31063. 0x2216,
  31064. "backslashbigg",
  31065. 0x2216,
  31066. "bardbl",
  31067. 0x2016,
  31068. "bracehtipdownleft",
  31069. 0xfe37,
  31070. "bracehtipdownright",
  31071. 0xfe37,
  31072. "bracehtipupleft",
  31073. 0xfe38,
  31074. "bracehtipupright",
  31075. 0xfe38,
  31076. "braceleftBig",
  31077. 0x007b,
  31078. "braceleftbig",
  31079. 0x007b,
  31080. "braceleftbigg",
  31081. 0x007b,
  31082. "braceleftBigg",
  31083. 0x007b,
  31084. "bracerightBig",
  31085. 0x007d,
  31086. "bracerightbig",
  31087. 0x007d,
  31088. "bracerightbigg",
  31089. 0x007d,
  31090. "bracerightBigg",
  31091. 0x007d,
  31092. "bracketleftbig",
  31093. 0x005b,
  31094. "bracketleftBig",
  31095. 0x005b,
  31096. "bracketleftbigg",
  31097. 0x005b,
  31098. "bracketleftBigg",
  31099. 0x005b,
  31100. "bracketrightBig",
  31101. 0x005d,
  31102. "bracketrightbig",
  31103. 0x005d,
  31104. "bracketrightbigg",
  31105. 0x005d,
  31106. "bracketrightBigg",
  31107. 0x005d,
  31108. "ceilingleftbig",
  31109. 0x2308,
  31110. "ceilingleftBig",
  31111. 0x2308,
  31112. "ceilingleftBigg",
  31113. 0x2308,
  31114. "ceilingleftbigg",
  31115. 0x2308,
  31116. "ceilingrightbig",
  31117. 0x2309,
  31118. "ceilingrightBig",
  31119. 0x2309,
  31120. "ceilingrightbigg",
  31121. 0x2309,
  31122. "ceilingrightBigg",
  31123. 0x2309,
  31124. "circledotdisplay",
  31125. 0x2299,
  31126. "circledottext",
  31127. 0x2299,
  31128. "circlemultiplydisplay",
  31129. 0x2297,
  31130. "circlemultiplytext",
  31131. 0x2297,
  31132. "circleplusdisplay",
  31133. 0x2295,
  31134. "circleplustext",
  31135. 0x2295,
  31136. "contintegraldisplay",
  31137. 0x222e,
  31138. "contintegraltext",
  31139. 0x222e,
  31140. "coproductdisplay",
  31141. 0x2210,
  31142. "coproducttext",
  31143. 0x2210,
  31144. "floorleftBig",
  31145. 0x230a,
  31146. "floorleftbig",
  31147. 0x230a,
  31148. "floorleftbigg",
  31149. 0x230a,
  31150. "floorleftBigg",
  31151. 0x230a,
  31152. "floorrightbig",
  31153. 0x230b,
  31154. "floorrightBig",
  31155. 0x230b,
  31156. "floorrightBigg",
  31157. 0x230b,
  31158. "floorrightbigg",
  31159. 0x230b,
  31160. "hatwide",
  31161. 0x0302,
  31162. "hatwider",
  31163. 0x0302,
  31164. "hatwidest",
  31165. 0x0302,
  31166. "intercal",
  31167. 0x1d40,
  31168. "integraldisplay",
  31169. 0x222b,
  31170. "integraltext",
  31171. 0x222b,
  31172. "intersectiondisplay",
  31173. 0x22c2,
  31174. "intersectiontext",
  31175. 0x22c2,
  31176. "logicalanddisplay",
  31177. 0x2227,
  31178. "logicalandtext",
  31179. 0x2227,
  31180. "logicalordisplay",
  31181. 0x2228,
  31182. "logicalortext",
  31183. 0x2228,
  31184. "parenleftBig",
  31185. 0x0028,
  31186. "parenleftbig",
  31187. 0x0028,
  31188. "parenleftBigg",
  31189. 0x0028,
  31190. "parenleftbigg",
  31191. 0x0028,
  31192. "parenrightBig",
  31193. 0x0029,
  31194. "parenrightbig",
  31195. 0x0029,
  31196. "parenrightBigg",
  31197. 0x0029,
  31198. "parenrightbigg",
  31199. 0x0029,
  31200. "prime",
  31201. 0x2032,
  31202. "productdisplay",
  31203. 0x220f,
  31204. "producttext",
  31205. 0x220f,
  31206. "radicalbig",
  31207. 0x221a,
  31208. "radicalBig",
  31209. 0x221a,
  31210. "radicalBigg",
  31211. 0x221a,
  31212. "radicalbigg",
  31213. 0x221a,
  31214. "radicalbt",
  31215. 0x221a,
  31216. "radicaltp",
  31217. 0x221a,
  31218. "radicalvertex",
  31219. 0x221a,
  31220. "slashbig",
  31221. 0x002f,
  31222. "slashBig",
  31223. 0x002f,
  31224. "slashBigg",
  31225. 0x002f,
  31226. "slashbigg",
  31227. 0x002f,
  31228. "summationdisplay",
  31229. 0x2211,
  31230. "summationtext",
  31231. 0x2211,
  31232. "tildewide",
  31233. 0x02dc,
  31234. "tildewider",
  31235. 0x02dc,
  31236. "tildewidest",
  31237. 0x02dc,
  31238. "uniondisplay",
  31239. 0x22c3,
  31240. "unionmultidisplay",
  31241. 0x228e,
  31242. "unionmultitext",
  31243. 0x228e,
  31244. "unionsqdisplay",
  31245. 0x2294,
  31246. "unionsqtext",
  31247. 0x2294,
  31248. "uniontext",
  31249. 0x22c3,
  31250. "vextenddouble",
  31251. 0x2225,
  31252. "vextendsingle",
  31253. 0x2223
  31254. ];
  31255. });
  31256. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  31257. return [
  31258. "space",
  31259. 0x0020,
  31260. "a1",
  31261. 0x2701,
  31262. "a2",
  31263. 0x2702,
  31264. "a202",
  31265. 0x2703,
  31266. "a3",
  31267. 0x2704,
  31268. "a4",
  31269. 0x260e,
  31270. "a5",
  31271. 0x2706,
  31272. "a119",
  31273. 0x2707,
  31274. "a118",
  31275. 0x2708,
  31276. "a117",
  31277. 0x2709,
  31278. "a11",
  31279. 0x261b,
  31280. "a12",
  31281. 0x261e,
  31282. "a13",
  31283. 0x270c,
  31284. "a14",
  31285. 0x270d,
  31286. "a15",
  31287. 0x270e,
  31288. "a16",
  31289. 0x270f,
  31290. "a105",
  31291. 0x2710,
  31292. "a17",
  31293. 0x2711,
  31294. "a18",
  31295. 0x2712,
  31296. "a19",
  31297. 0x2713,
  31298. "a20",
  31299. 0x2714,
  31300. "a21",
  31301. 0x2715,
  31302. "a22",
  31303. 0x2716,
  31304. "a23",
  31305. 0x2717,
  31306. "a24",
  31307. 0x2718,
  31308. "a25",
  31309. 0x2719,
  31310. "a26",
  31311. 0x271a,
  31312. "a27",
  31313. 0x271b,
  31314. "a28",
  31315. 0x271c,
  31316. "a6",
  31317. 0x271d,
  31318. "a7",
  31319. 0x271e,
  31320. "a8",
  31321. 0x271f,
  31322. "a9",
  31323. 0x2720,
  31324. "a10",
  31325. 0x2721,
  31326. "a29",
  31327. 0x2722,
  31328. "a30",
  31329. 0x2723,
  31330. "a31",
  31331. 0x2724,
  31332. "a32",
  31333. 0x2725,
  31334. "a33",
  31335. 0x2726,
  31336. "a34",
  31337. 0x2727,
  31338. "a35",
  31339. 0x2605,
  31340. "a36",
  31341. 0x2729,
  31342. "a37",
  31343. 0x272a,
  31344. "a38",
  31345. 0x272b,
  31346. "a39",
  31347. 0x272c,
  31348. "a40",
  31349. 0x272d,
  31350. "a41",
  31351. 0x272e,
  31352. "a42",
  31353. 0x272f,
  31354. "a43",
  31355. 0x2730,
  31356. "a44",
  31357. 0x2731,
  31358. "a45",
  31359. 0x2732,
  31360. "a46",
  31361. 0x2733,
  31362. "a47",
  31363. 0x2734,
  31364. "a48",
  31365. 0x2735,
  31366. "a49",
  31367. 0x2736,
  31368. "a50",
  31369. 0x2737,
  31370. "a51",
  31371. 0x2738,
  31372. "a52",
  31373. 0x2739,
  31374. "a53",
  31375. 0x273a,
  31376. "a54",
  31377. 0x273b,
  31378. "a55",
  31379. 0x273c,
  31380. "a56",
  31381. 0x273d,
  31382. "a57",
  31383. 0x273e,
  31384. "a58",
  31385. 0x273f,
  31386. "a59",
  31387. 0x2740,
  31388. "a60",
  31389. 0x2741,
  31390. "a61",
  31391. 0x2742,
  31392. "a62",
  31393. 0x2743,
  31394. "a63",
  31395. 0x2744,
  31396. "a64",
  31397. 0x2745,
  31398. "a65",
  31399. 0x2746,
  31400. "a66",
  31401. 0x2747,
  31402. "a67",
  31403. 0x2748,
  31404. "a68",
  31405. 0x2749,
  31406. "a69",
  31407. 0x274a,
  31408. "a70",
  31409. 0x274b,
  31410. "a71",
  31411. 0x25cf,
  31412. "a72",
  31413. 0x274d,
  31414. "a73",
  31415. 0x25a0,
  31416. "a74",
  31417. 0x274f,
  31418. "a203",
  31419. 0x2750,
  31420. "a75",
  31421. 0x2751,
  31422. "a204",
  31423. 0x2752,
  31424. "a76",
  31425. 0x25b2,
  31426. "a77",
  31427. 0x25bc,
  31428. "a78",
  31429. 0x25c6,
  31430. "a79",
  31431. 0x2756,
  31432. "a81",
  31433. 0x25d7,
  31434. "a82",
  31435. 0x2758,
  31436. "a83",
  31437. 0x2759,
  31438. "a84",
  31439. 0x275a,
  31440. "a97",
  31441. 0x275b,
  31442. "a98",
  31443. 0x275c,
  31444. "a99",
  31445. 0x275d,
  31446. "a100",
  31447. 0x275e,
  31448. "a101",
  31449. 0x2761,
  31450. "a102",
  31451. 0x2762,
  31452. "a103",
  31453. 0x2763,
  31454. "a104",
  31455. 0x2764,
  31456. "a106",
  31457. 0x2765,
  31458. "a107",
  31459. 0x2766,
  31460. "a108",
  31461. 0x2767,
  31462. "a112",
  31463. 0x2663,
  31464. "a111",
  31465. 0x2666,
  31466. "a110",
  31467. 0x2665,
  31468. "a109",
  31469. 0x2660,
  31470. "a120",
  31471. 0x2460,
  31472. "a121",
  31473. 0x2461,
  31474. "a122",
  31475. 0x2462,
  31476. "a123",
  31477. 0x2463,
  31478. "a124",
  31479. 0x2464,
  31480. "a125",
  31481. 0x2465,
  31482. "a126",
  31483. 0x2466,
  31484. "a127",
  31485. 0x2467,
  31486. "a128",
  31487. 0x2468,
  31488. "a129",
  31489. 0x2469,
  31490. "a130",
  31491. 0x2776,
  31492. "a131",
  31493. 0x2777,
  31494. "a132",
  31495. 0x2778,
  31496. "a133",
  31497. 0x2779,
  31498. "a134",
  31499. 0x277a,
  31500. "a135",
  31501. 0x277b,
  31502. "a136",
  31503. 0x277c,
  31504. "a137",
  31505. 0x277d,
  31506. "a138",
  31507. 0x277e,
  31508. "a139",
  31509. 0x277f,
  31510. "a140",
  31511. 0x2780,
  31512. "a141",
  31513. 0x2781,
  31514. "a142",
  31515. 0x2782,
  31516. "a143",
  31517. 0x2783,
  31518. "a144",
  31519. 0x2784,
  31520. "a145",
  31521. 0x2785,
  31522. "a146",
  31523. 0x2786,
  31524. "a147",
  31525. 0x2787,
  31526. "a148",
  31527. 0x2788,
  31528. "a149",
  31529. 0x2789,
  31530. "a150",
  31531. 0x278a,
  31532. "a151",
  31533. 0x278b,
  31534. "a152",
  31535. 0x278c,
  31536. "a153",
  31537. 0x278d,
  31538. "a154",
  31539. 0x278e,
  31540. "a155",
  31541. 0x278f,
  31542. "a156",
  31543. 0x2790,
  31544. "a157",
  31545. 0x2791,
  31546. "a158",
  31547. 0x2792,
  31548. "a159",
  31549. 0x2793,
  31550. "a160",
  31551. 0x2794,
  31552. "a161",
  31553. 0x2192,
  31554. "a163",
  31555. 0x2194,
  31556. "a164",
  31557. 0x2195,
  31558. "a196",
  31559. 0x2798,
  31560. "a165",
  31561. 0x2799,
  31562. "a192",
  31563. 0x279a,
  31564. "a166",
  31565. 0x279b,
  31566. "a167",
  31567. 0x279c,
  31568. "a168",
  31569. 0x279d,
  31570. "a169",
  31571. 0x279e,
  31572. "a170",
  31573. 0x279f,
  31574. "a171",
  31575. 0x27a0,
  31576. "a172",
  31577. 0x27a1,
  31578. "a173",
  31579. 0x27a2,
  31580. "a162",
  31581. 0x27a3,
  31582. "a174",
  31583. 0x27a4,
  31584. "a175",
  31585. 0x27a5,
  31586. "a176",
  31587. 0x27a6,
  31588. "a177",
  31589. 0x27a7,
  31590. "a178",
  31591. 0x27a8,
  31592. "a179",
  31593. 0x27a9,
  31594. "a193",
  31595. 0x27aa,
  31596. "a180",
  31597. 0x27ab,
  31598. "a199",
  31599. 0x27ac,
  31600. "a181",
  31601. 0x27ad,
  31602. "a200",
  31603. 0x27ae,
  31604. "a182",
  31605. 0x27af,
  31606. "a201",
  31607. 0x27b1,
  31608. "a183",
  31609. 0x27b2,
  31610. "a184",
  31611. 0x27b3,
  31612. "a197",
  31613. 0x27b4,
  31614. "a185",
  31615. 0x27b5,
  31616. "a194",
  31617. 0x27b6,
  31618. "a198",
  31619. 0x27b7,
  31620. "a186",
  31621. 0x27b8,
  31622. "a195",
  31623. 0x27b9,
  31624. "a187",
  31625. 0x27ba,
  31626. "a188",
  31627. 0x27bb,
  31628. "a189",
  31629. 0x27bc,
  31630. "a190",
  31631. 0x27bd,
  31632. "a191",
  31633. 0x27be,
  31634. "a89",
  31635. 0x2768,
  31636. "a90",
  31637. 0x2769,
  31638. "a93",
  31639. 0x276a,
  31640. "a94",
  31641. 0x276b,
  31642. "a91",
  31643. 0x276c,
  31644. "a92",
  31645. 0x276d,
  31646. "a205",
  31647. 0x276e,
  31648. "a85",
  31649. 0x276f,
  31650. "a206",
  31651. 0x2770,
  31652. "a86",
  31653. 0x2771,
  31654. "a87",
  31655. 0x2772,
  31656. "a88",
  31657. 0x2773,
  31658. "a95",
  31659. 0x2774,
  31660. "a96",
  31661. 0x2775,
  31662. ".notdef",
  31663. 0x0000
  31664. ];
  31665. });
  31666. /***/ }),
  31667. /* 40 */
  31668. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  31669. __w_pdfjs_require__.r(__webpack_exports__);
  31670. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  31671. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  31672. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  31673. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  31674. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  31675. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  31676. /* harmony export */ });
  31677. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  31678. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  31679. t[63721] = 0x00a9;
  31680. t[63193] = 0x00a9;
  31681. t[63720] = 0x00ae;
  31682. t[63194] = 0x00ae;
  31683. t[63722] = 0x2122;
  31684. t[63195] = 0x2122;
  31685. t[63729] = 0x23a7;
  31686. t[63730] = 0x23a8;
  31687. t[63731] = 0x23a9;
  31688. t[63740] = 0x23ab;
  31689. t[63741] = 0x23ac;
  31690. t[63742] = 0x23ad;
  31691. t[63726] = 0x23a1;
  31692. t[63727] = 0x23a2;
  31693. t[63728] = 0x23a3;
  31694. t[63737] = 0x23a4;
  31695. t[63738] = 0x23a5;
  31696. t[63739] = 0x23a6;
  31697. t[63723] = 0x239b;
  31698. t[63724] = 0x239c;
  31699. t[63725] = 0x239d;
  31700. t[63734] = 0x239e;
  31701. t[63735] = 0x239f;
  31702. t[63736] = 0x23a0;
  31703. });
  31704. function mapSpecialUnicodeValues(code) {
  31705. if (code >= 0xfff0 && code <= 0xffff) {
  31706. return 0;
  31707. } else if (code >= 0xf600 && code <= 0xf8ff) {
  31708. return getSpecialPUASymbols()[code] || code;
  31709. } else if (code === 0x00ad) {
  31710. return 0x002d;
  31711. }
  31712. return code;
  31713. }
  31714. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  31715. let unicode = glyphsUnicodeMap[name];
  31716. if (unicode !== undefined) {
  31717. return unicode;
  31718. }
  31719. if (!name) {
  31720. return -1;
  31721. }
  31722. if (name[0] === "u") {
  31723. const nameLen = name.length;
  31724. let hexStr;
  31725. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  31726. hexStr = name.substring(3);
  31727. } else if (nameLen >= 5 && nameLen <= 7) {
  31728. hexStr = name.substring(1);
  31729. } else {
  31730. return -1;
  31731. }
  31732. if (hexStr === hexStr.toUpperCase()) {
  31733. unicode = parseInt(hexStr, 16);
  31734. if (unicode >= 0) {
  31735. return unicode;
  31736. }
  31737. }
  31738. }
  31739. return -1;
  31740. }
  31741. const UnicodeRanges = [
  31742. {
  31743. begin: 0x0000,
  31744. end: 0x007f
  31745. },
  31746. {
  31747. begin: 0x0080,
  31748. end: 0x00ff
  31749. },
  31750. {
  31751. begin: 0x0100,
  31752. end: 0x017f
  31753. },
  31754. {
  31755. begin: 0x0180,
  31756. end: 0x024f
  31757. },
  31758. {
  31759. begin: 0x0250,
  31760. end: 0x02af
  31761. },
  31762. {
  31763. begin: 0x02b0,
  31764. end: 0x02ff
  31765. },
  31766. {
  31767. begin: 0x0300,
  31768. end: 0x036f
  31769. },
  31770. {
  31771. begin: 0x0370,
  31772. end: 0x03ff
  31773. },
  31774. {
  31775. begin: 0x2c80,
  31776. end: 0x2cff
  31777. },
  31778. {
  31779. begin: 0x0400,
  31780. end: 0x04ff
  31781. },
  31782. {
  31783. begin: 0x0530,
  31784. end: 0x058f
  31785. },
  31786. {
  31787. begin: 0x0590,
  31788. end: 0x05ff
  31789. },
  31790. {
  31791. begin: 0xa500,
  31792. end: 0xa63f
  31793. },
  31794. {
  31795. begin: 0x0600,
  31796. end: 0x06ff
  31797. },
  31798. {
  31799. begin: 0x07c0,
  31800. end: 0x07ff
  31801. },
  31802. {
  31803. begin: 0x0900,
  31804. end: 0x097f
  31805. },
  31806. {
  31807. begin: 0x0980,
  31808. end: 0x09ff
  31809. },
  31810. {
  31811. begin: 0x0a00,
  31812. end: 0x0a7f
  31813. },
  31814. {
  31815. begin: 0x0a80,
  31816. end: 0x0aff
  31817. },
  31818. {
  31819. begin: 0x0b00,
  31820. end: 0x0b7f
  31821. },
  31822. {
  31823. begin: 0x0b80,
  31824. end: 0x0bff
  31825. },
  31826. {
  31827. begin: 0x0c00,
  31828. end: 0x0c7f
  31829. },
  31830. {
  31831. begin: 0x0c80,
  31832. end: 0x0cff
  31833. },
  31834. {
  31835. begin: 0x0d00,
  31836. end: 0x0d7f
  31837. },
  31838. {
  31839. begin: 0x0e00,
  31840. end: 0x0e7f
  31841. },
  31842. {
  31843. begin: 0x0e80,
  31844. end: 0x0eff
  31845. },
  31846. {
  31847. begin: 0x10a0,
  31848. end: 0x10ff
  31849. },
  31850. {
  31851. begin: 0x1b00,
  31852. end: 0x1b7f
  31853. },
  31854. {
  31855. begin: 0x1100,
  31856. end: 0x11ff
  31857. },
  31858. {
  31859. begin: 0x1e00,
  31860. end: 0x1eff
  31861. },
  31862. {
  31863. begin: 0x1f00,
  31864. end: 0x1fff
  31865. },
  31866. {
  31867. begin: 0x2000,
  31868. end: 0x206f
  31869. },
  31870. {
  31871. begin: 0x2070,
  31872. end: 0x209f
  31873. },
  31874. {
  31875. begin: 0x20a0,
  31876. end: 0x20cf
  31877. },
  31878. {
  31879. begin: 0x20d0,
  31880. end: 0x20ff
  31881. },
  31882. {
  31883. begin: 0x2100,
  31884. end: 0x214f
  31885. },
  31886. {
  31887. begin: 0x2150,
  31888. end: 0x218f
  31889. },
  31890. {
  31891. begin: 0x2190,
  31892. end: 0x21ff
  31893. },
  31894. {
  31895. begin: 0x2200,
  31896. end: 0x22ff
  31897. },
  31898. {
  31899. begin: 0x2300,
  31900. end: 0x23ff
  31901. },
  31902. {
  31903. begin: 0x2400,
  31904. end: 0x243f
  31905. },
  31906. {
  31907. begin: 0x2440,
  31908. end: 0x245f
  31909. },
  31910. {
  31911. begin: 0x2460,
  31912. end: 0x24ff
  31913. },
  31914. {
  31915. begin: 0x2500,
  31916. end: 0x257f
  31917. },
  31918. {
  31919. begin: 0x2580,
  31920. end: 0x259f
  31921. },
  31922. {
  31923. begin: 0x25a0,
  31924. end: 0x25ff
  31925. },
  31926. {
  31927. begin: 0x2600,
  31928. end: 0x26ff
  31929. },
  31930. {
  31931. begin: 0x2700,
  31932. end: 0x27bf
  31933. },
  31934. {
  31935. begin: 0x3000,
  31936. end: 0x303f
  31937. },
  31938. {
  31939. begin: 0x3040,
  31940. end: 0x309f
  31941. },
  31942. {
  31943. begin: 0x30a0,
  31944. end: 0x30ff
  31945. },
  31946. {
  31947. begin: 0x3100,
  31948. end: 0x312f
  31949. },
  31950. {
  31951. begin: 0x3130,
  31952. end: 0x318f
  31953. },
  31954. {
  31955. begin: 0xa840,
  31956. end: 0xa87f
  31957. },
  31958. {
  31959. begin: 0x3200,
  31960. end: 0x32ff
  31961. },
  31962. {
  31963. begin: 0x3300,
  31964. end: 0x33ff
  31965. },
  31966. {
  31967. begin: 0xac00,
  31968. end: 0xd7af
  31969. },
  31970. {
  31971. begin: 0xd800,
  31972. end: 0xdfff
  31973. },
  31974. {
  31975. begin: 0x10900,
  31976. end: 0x1091f
  31977. },
  31978. {
  31979. begin: 0x4e00,
  31980. end: 0x9fff
  31981. },
  31982. {
  31983. begin: 0xe000,
  31984. end: 0xf8ff
  31985. },
  31986. {
  31987. begin: 0x31c0,
  31988. end: 0x31ef
  31989. },
  31990. {
  31991. begin: 0xfb00,
  31992. end: 0xfb4f
  31993. },
  31994. {
  31995. begin: 0xfb50,
  31996. end: 0xfdff
  31997. },
  31998. {
  31999. begin: 0xfe20,
  32000. end: 0xfe2f
  32001. },
  32002. {
  32003. begin: 0xfe10,
  32004. end: 0xfe1f
  32005. },
  32006. {
  32007. begin: 0xfe50,
  32008. end: 0xfe6f
  32009. },
  32010. {
  32011. begin: 0xfe70,
  32012. end: 0xfeff
  32013. },
  32014. {
  32015. begin: 0xff00,
  32016. end: 0xffef
  32017. },
  32018. {
  32019. begin: 0xfff0,
  32020. end: 0xffff
  32021. },
  32022. {
  32023. begin: 0x0f00,
  32024. end: 0x0fff
  32025. },
  32026. {
  32027. begin: 0x0700,
  32028. end: 0x074f
  32029. },
  32030. {
  32031. begin: 0x0780,
  32032. end: 0x07bf
  32033. },
  32034. {
  32035. begin: 0x0d80,
  32036. end: 0x0dff
  32037. },
  32038. {
  32039. begin: 0x1000,
  32040. end: 0x109f
  32041. },
  32042. {
  32043. begin: 0x1200,
  32044. end: 0x137f
  32045. },
  32046. {
  32047. begin: 0x13a0,
  32048. end: 0x13ff
  32049. },
  32050. {
  32051. begin: 0x1400,
  32052. end: 0x167f
  32053. },
  32054. {
  32055. begin: 0x1680,
  32056. end: 0x169f
  32057. },
  32058. {
  32059. begin: 0x16a0,
  32060. end: 0x16ff
  32061. },
  32062. {
  32063. begin: 0x1780,
  32064. end: 0x17ff
  32065. },
  32066. {
  32067. begin: 0x1800,
  32068. end: 0x18af
  32069. },
  32070. {
  32071. begin: 0x2800,
  32072. end: 0x28ff
  32073. },
  32074. {
  32075. begin: 0xa000,
  32076. end: 0xa48f
  32077. },
  32078. {
  32079. begin: 0x1700,
  32080. end: 0x171f
  32081. },
  32082. {
  32083. begin: 0x10300,
  32084. end: 0x1032f
  32085. },
  32086. {
  32087. begin: 0x10330,
  32088. end: 0x1034f
  32089. },
  32090. {
  32091. begin: 0x10400,
  32092. end: 0x1044f
  32093. },
  32094. {
  32095. begin: 0x1d000,
  32096. end: 0x1d0ff
  32097. },
  32098. {
  32099. begin: 0x1d400,
  32100. end: 0x1d7ff
  32101. },
  32102. {
  32103. begin: 0xff000,
  32104. end: 0xffffd
  32105. },
  32106. {
  32107. begin: 0xfe00,
  32108. end: 0xfe0f
  32109. },
  32110. {
  32111. begin: 0xe0000,
  32112. end: 0xe007f
  32113. },
  32114. {
  32115. begin: 0x1900,
  32116. end: 0x194f
  32117. },
  32118. {
  32119. begin: 0x1950,
  32120. end: 0x197f
  32121. },
  32122. {
  32123. begin: 0x1980,
  32124. end: 0x19df
  32125. },
  32126. {
  32127. begin: 0x1a00,
  32128. end: 0x1a1f
  32129. },
  32130. {
  32131. begin: 0x2c00,
  32132. end: 0x2c5f
  32133. },
  32134. {
  32135. begin: 0x2d30,
  32136. end: 0x2d7f
  32137. },
  32138. {
  32139. begin: 0x4dc0,
  32140. end: 0x4dff
  32141. },
  32142. {
  32143. begin: 0xa800,
  32144. end: 0xa82f
  32145. },
  32146. {
  32147. begin: 0x10000,
  32148. end: 0x1007f
  32149. },
  32150. {
  32151. begin: 0x10140,
  32152. end: 0x1018f
  32153. },
  32154. {
  32155. begin: 0x10380,
  32156. end: 0x1039f
  32157. },
  32158. {
  32159. begin: 0x103a0,
  32160. end: 0x103df
  32161. },
  32162. {
  32163. begin: 0x10450,
  32164. end: 0x1047f
  32165. },
  32166. {
  32167. begin: 0x10480,
  32168. end: 0x104af
  32169. },
  32170. {
  32171. begin: 0x10800,
  32172. end: 0x1083f
  32173. },
  32174. {
  32175. begin: 0x10a00,
  32176. end: 0x10a5f
  32177. },
  32178. {
  32179. begin: 0x1d300,
  32180. end: 0x1d35f
  32181. },
  32182. {
  32183. begin: 0x12000,
  32184. end: 0x123ff
  32185. },
  32186. {
  32187. begin: 0x1d360,
  32188. end: 0x1d37f
  32189. },
  32190. {
  32191. begin: 0x1b80,
  32192. end: 0x1bbf
  32193. },
  32194. {
  32195. begin: 0x1c00,
  32196. end: 0x1c4f
  32197. },
  32198. {
  32199. begin: 0x1c50,
  32200. end: 0x1c7f
  32201. },
  32202. {
  32203. begin: 0xa880,
  32204. end: 0xa8df
  32205. },
  32206. {
  32207. begin: 0xa900,
  32208. end: 0xa92f
  32209. },
  32210. {
  32211. begin: 0xa930,
  32212. end: 0xa95f
  32213. },
  32214. {
  32215. begin: 0xaa00,
  32216. end: 0xaa5f
  32217. },
  32218. {
  32219. begin: 0x10190,
  32220. end: 0x101cf
  32221. },
  32222. {
  32223. begin: 0x101d0,
  32224. end: 0x101ff
  32225. },
  32226. {
  32227. begin: 0x102a0,
  32228. end: 0x102df
  32229. },
  32230. {
  32231. begin: 0x1f030,
  32232. end: 0x1f09f
  32233. }
  32234. ];
  32235. function getUnicodeRangeFor(value) {
  32236. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  32237. const range = UnicodeRanges[i];
  32238. if (value >= range.begin && value < range.end) {
  32239. return i;
  32240. }
  32241. }
  32242. return -1;
  32243. }
  32244. function isRTLRangeFor(value) {
  32245. let range = UnicodeRanges[13];
  32246. if (value >= range.begin && value < range.end) {
  32247. return true;
  32248. }
  32249. range = UnicodeRanges[11];
  32250. if (value >= range.begin && value < range.end) {
  32251. return true;
  32252. }
  32253. return false;
  32254. }
  32255. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  32256. return [
  32257. "\u00A8",
  32258. "\u0020\u0308",
  32259. "\u00AF",
  32260. "\u0020\u0304",
  32261. "\u00B4",
  32262. "\u0020\u0301",
  32263. "\u00B5",
  32264. "\u03BC",
  32265. "\u00B8",
  32266. "\u0020\u0327",
  32267. "\u0132",
  32268. "\u0049\u004A",
  32269. "\u0133",
  32270. "\u0069\u006A",
  32271. "\u013F",
  32272. "\u004C\u00B7",
  32273. "\u0140",
  32274. "\u006C\u00B7",
  32275. "\u0149",
  32276. "\u02BC\u006E",
  32277. "\u017F",
  32278. "\u0073",
  32279. "\u01C4",
  32280. "\u0044\u017D",
  32281. "\u01C5",
  32282. "\u0044\u017E",
  32283. "\u01C6",
  32284. "\u0064\u017E",
  32285. "\u01C7",
  32286. "\u004C\u004A",
  32287. "\u01C8",
  32288. "\u004C\u006A",
  32289. "\u01C9",
  32290. "\u006C\u006A",
  32291. "\u01CA",
  32292. "\u004E\u004A",
  32293. "\u01CB",
  32294. "\u004E\u006A",
  32295. "\u01CC",
  32296. "\u006E\u006A",
  32297. "\u01F1",
  32298. "\u0044\u005A",
  32299. "\u01F2",
  32300. "\u0044\u007A",
  32301. "\u01F3",
  32302. "\u0064\u007A",
  32303. "\u02D8",
  32304. "\u0020\u0306",
  32305. "\u02D9",
  32306. "\u0020\u0307",
  32307. "\u02DA",
  32308. "\u0020\u030A",
  32309. "\u02DB",
  32310. "\u0020\u0328",
  32311. "\u02DC",
  32312. "\u0020\u0303",
  32313. "\u02DD",
  32314. "\u0020\u030B",
  32315. "\u037A",
  32316. "\u0020\u0345",
  32317. "\u0384",
  32318. "\u0020\u0301",
  32319. "\u03D0",
  32320. "\u03B2",
  32321. "\u03D1",
  32322. "\u03B8",
  32323. "\u03D2",
  32324. "\u03A5",
  32325. "\u03D5",
  32326. "\u03C6",
  32327. "\u03D6",
  32328. "\u03C0",
  32329. "\u03F0",
  32330. "\u03BA",
  32331. "\u03F1",
  32332. "\u03C1",
  32333. "\u03F2",
  32334. "\u03C2",
  32335. "\u03F4",
  32336. "\u0398",
  32337. "\u03F5",
  32338. "\u03B5",
  32339. "\u03F9",
  32340. "\u03A3",
  32341. "\u0587",
  32342. "\u0565\u0582",
  32343. "\u0675",
  32344. "\u0627\u0674",
  32345. "\u0676",
  32346. "\u0648\u0674",
  32347. "\u0677",
  32348. "\u06C7\u0674",
  32349. "\u0678",
  32350. "\u064A\u0674",
  32351. "\u0E33",
  32352. "\u0E4D\u0E32",
  32353. "\u0EB3",
  32354. "\u0ECD\u0EB2",
  32355. "\u0EDC",
  32356. "\u0EAB\u0E99",
  32357. "\u0EDD",
  32358. "\u0EAB\u0EA1",
  32359. "\u0F77",
  32360. "\u0FB2\u0F81",
  32361. "\u0F79",
  32362. "\u0FB3\u0F81",
  32363. "\u1E9A",
  32364. "\u0061\u02BE",
  32365. "\u1FBD",
  32366. "\u0020\u0313",
  32367. "\u1FBF",
  32368. "\u0020\u0313",
  32369. "\u1FC0",
  32370. "\u0020\u0342",
  32371. "\u1FFE",
  32372. "\u0020\u0314",
  32373. "\u2002",
  32374. "\u0020",
  32375. "\u2003",
  32376. "\u0020",
  32377. "\u2004",
  32378. "\u0020",
  32379. "\u2005",
  32380. "\u0020",
  32381. "\u2006",
  32382. "\u0020",
  32383. "\u2008",
  32384. "\u0020",
  32385. "\u2009",
  32386. "\u0020",
  32387. "\u200A",
  32388. "\u0020",
  32389. "\u2017",
  32390. "\u0020\u0333",
  32391. "\u2024",
  32392. "\u002E",
  32393. "\u2025",
  32394. "\u002E\u002E",
  32395. "\u2026",
  32396. "\u002E\u002E\u002E",
  32397. "\u2033",
  32398. "\u2032\u2032",
  32399. "\u2034",
  32400. "\u2032\u2032\u2032",
  32401. "\u2036",
  32402. "\u2035\u2035",
  32403. "\u2037",
  32404. "\u2035\u2035\u2035",
  32405. "\u203C",
  32406. "\u0021\u0021",
  32407. "\u203E",
  32408. "\u0020\u0305",
  32409. "\u2047",
  32410. "\u003F\u003F",
  32411. "\u2048",
  32412. "\u003F\u0021",
  32413. "\u2049",
  32414. "\u0021\u003F",
  32415. "\u2057",
  32416. "\u2032\u2032\u2032\u2032",
  32417. "\u205F",
  32418. "\u0020",
  32419. "\u20A8",
  32420. "\u0052\u0073",
  32421. "\u2100",
  32422. "\u0061\u002F\u0063",
  32423. "\u2101",
  32424. "\u0061\u002F\u0073",
  32425. "\u2103",
  32426. "\u00B0\u0043",
  32427. "\u2105",
  32428. "\u0063\u002F\u006F",
  32429. "\u2106",
  32430. "\u0063\u002F\u0075",
  32431. "\u2107",
  32432. "\u0190",
  32433. "\u2109",
  32434. "\u00B0\u0046",
  32435. "\u2116",
  32436. "\u004E\u006F",
  32437. "\u2121",
  32438. "\u0054\u0045\u004C",
  32439. "\u2135",
  32440. "\u05D0",
  32441. "\u2136",
  32442. "\u05D1",
  32443. "\u2137",
  32444. "\u05D2",
  32445. "\u2138",
  32446. "\u05D3",
  32447. "\u213B",
  32448. "\u0046\u0041\u0058",
  32449. "\u2160",
  32450. "\u0049",
  32451. "\u2161",
  32452. "\u0049\u0049",
  32453. "\u2162",
  32454. "\u0049\u0049\u0049",
  32455. "\u2163",
  32456. "\u0049\u0056",
  32457. "\u2164",
  32458. "\u0056",
  32459. "\u2165",
  32460. "\u0056\u0049",
  32461. "\u2166",
  32462. "\u0056\u0049\u0049",
  32463. "\u2167",
  32464. "\u0056\u0049\u0049\u0049",
  32465. "\u2168",
  32466. "\u0049\u0058",
  32467. "\u2169",
  32468. "\u0058",
  32469. "\u216A",
  32470. "\u0058\u0049",
  32471. "\u216B",
  32472. "\u0058\u0049\u0049",
  32473. "\u216C",
  32474. "\u004C",
  32475. "\u216D",
  32476. "\u0043",
  32477. "\u216E",
  32478. "\u0044",
  32479. "\u216F",
  32480. "\u004D",
  32481. "\u2170",
  32482. "\u0069",
  32483. "\u2171",
  32484. "\u0069\u0069",
  32485. "\u2172",
  32486. "\u0069\u0069\u0069",
  32487. "\u2173",
  32488. "\u0069\u0076",
  32489. "\u2174",
  32490. "\u0076",
  32491. "\u2175",
  32492. "\u0076\u0069",
  32493. "\u2176",
  32494. "\u0076\u0069\u0069",
  32495. "\u2177",
  32496. "\u0076\u0069\u0069\u0069",
  32497. "\u2178",
  32498. "\u0069\u0078",
  32499. "\u2179",
  32500. "\u0078",
  32501. "\u217A",
  32502. "\u0078\u0069",
  32503. "\u217B",
  32504. "\u0078\u0069\u0069",
  32505. "\u217C",
  32506. "\u006C",
  32507. "\u217D",
  32508. "\u0063",
  32509. "\u217E",
  32510. "\u0064",
  32511. "\u217F",
  32512. "\u006D",
  32513. "\u222C",
  32514. "\u222B\u222B",
  32515. "\u222D",
  32516. "\u222B\u222B\u222B",
  32517. "\u222F",
  32518. "\u222E\u222E",
  32519. "\u2230",
  32520. "\u222E\u222E\u222E",
  32521. "\u2474",
  32522. "\u0028\u0031\u0029",
  32523. "\u2475",
  32524. "\u0028\u0032\u0029",
  32525. "\u2476",
  32526. "\u0028\u0033\u0029",
  32527. "\u2477",
  32528. "\u0028\u0034\u0029",
  32529. "\u2478",
  32530. "\u0028\u0035\u0029",
  32531. "\u2479",
  32532. "\u0028\u0036\u0029",
  32533. "\u247A",
  32534. "\u0028\u0037\u0029",
  32535. "\u247B",
  32536. "\u0028\u0038\u0029",
  32537. "\u247C",
  32538. "\u0028\u0039\u0029",
  32539. "\u247D",
  32540. "\u0028\u0031\u0030\u0029",
  32541. "\u247E",
  32542. "\u0028\u0031\u0031\u0029",
  32543. "\u247F",
  32544. "\u0028\u0031\u0032\u0029",
  32545. "\u2480",
  32546. "\u0028\u0031\u0033\u0029",
  32547. "\u2481",
  32548. "\u0028\u0031\u0034\u0029",
  32549. "\u2482",
  32550. "\u0028\u0031\u0035\u0029",
  32551. "\u2483",
  32552. "\u0028\u0031\u0036\u0029",
  32553. "\u2484",
  32554. "\u0028\u0031\u0037\u0029",
  32555. "\u2485",
  32556. "\u0028\u0031\u0038\u0029",
  32557. "\u2486",
  32558. "\u0028\u0031\u0039\u0029",
  32559. "\u2487",
  32560. "\u0028\u0032\u0030\u0029",
  32561. "\u2488",
  32562. "\u0031\u002E",
  32563. "\u2489",
  32564. "\u0032\u002E",
  32565. "\u248A",
  32566. "\u0033\u002E",
  32567. "\u248B",
  32568. "\u0034\u002E",
  32569. "\u248C",
  32570. "\u0035\u002E",
  32571. "\u248D",
  32572. "\u0036\u002E",
  32573. "\u248E",
  32574. "\u0037\u002E",
  32575. "\u248F",
  32576. "\u0038\u002E",
  32577. "\u2490",
  32578. "\u0039\u002E",
  32579. "\u2491",
  32580. "\u0031\u0030\u002E",
  32581. "\u2492",
  32582. "\u0031\u0031\u002E",
  32583. "\u2493",
  32584. "\u0031\u0032\u002E",
  32585. "\u2494",
  32586. "\u0031\u0033\u002E",
  32587. "\u2495",
  32588. "\u0031\u0034\u002E",
  32589. "\u2496",
  32590. "\u0031\u0035\u002E",
  32591. "\u2497",
  32592. "\u0031\u0036\u002E",
  32593. "\u2498",
  32594. "\u0031\u0037\u002E",
  32595. "\u2499",
  32596. "\u0031\u0038\u002E",
  32597. "\u249A",
  32598. "\u0031\u0039\u002E",
  32599. "\u249B",
  32600. "\u0032\u0030\u002E",
  32601. "\u249C",
  32602. "\u0028\u0061\u0029",
  32603. "\u249D",
  32604. "\u0028\u0062\u0029",
  32605. "\u249E",
  32606. "\u0028\u0063\u0029",
  32607. "\u249F",
  32608. "\u0028\u0064\u0029",
  32609. "\u24A0",
  32610. "\u0028\u0065\u0029",
  32611. "\u24A1",
  32612. "\u0028\u0066\u0029",
  32613. "\u24A2",
  32614. "\u0028\u0067\u0029",
  32615. "\u24A3",
  32616. "\u0028\u0068\u0029",
  32617. "\u24A4",
  32618. "\u0028\u0069\u0029",
  32619. "\u24A5",
  32620. "\u0028\u006A\u0029",
  32621. "\u24A6",
  32622. "\u0028\u006B\u0029",
  32623. "\u24A7",
  32624. "\u0028\u006C\u0029",
  32625. "\u24A8",
  32626. "\u0028\u006D\u0029",
  32627. "\u24A9",
  32628. "\u0028\u006E\u0029",
  32629. "\u24AA",
  32630. "\u0028\u006F\u0029",
  32631. "\u24AB",
  32632. "\u0028\u0070\u0029",
  32633. "\u24AC",
  32634. "\u0028\u0071\u0029",
  32635. "\u24AD",
  32636. "\u0028\u0072\u0029",
  32637. "\u24AE",
  32638. "\u0028\u0073\u0029",
  32639. "\u24AF",
  32640. "\u0028\u0074\u0029",
  32641. "\u24B0",
  32642. "\u0028\u0075\u0029",
  32643. "\u24B1",
  32644. "\u0028\u0076\u0029",
  32645. "\u24B2",
  32646. "\u0028\u0077\u0029",
  32647. "\u24B3",
  32648. "\u0028\u0078\u0029",
  32649. "\u24B4",
  32650. "\u0028\u0079\u0029",
  32651. "\u24B5",
  32652. "\u0028\u007A\u0029",
  32653. "\u2A0C",
  32654. "\u222B\u222B\u222B\u222B",
  32655. "\u2A74",
  32656. "\u003A\u003A\u003D",
  32657. "\u2A75",
  32658. "\u003D\u003D",
  32659. "\u2A76",
  32660. "\u003D\u003D\u003D",
  32661. "\u2E9F",
  32662. "\u6BCD",
  32663. "\u2EF3",
  32664. "\u9F9F",
  32665. "\u2F00",
  32666. "\u4E00",
  32667. "\u2F01",
  32668. "\u4E28",
  32669. "\u2F02",
  32670. "\u4E36",
  32671. "\u2F03",
  32672. "\u4E3F",
  32673. "\u2F04",
  32674. "\u4E59",
  32675. "\u2F05",
  32676. "\u4E85",
  32677. "\u2F06",
  32678. "\u4E8C",
  32679. "\u2F07",
  32680. "\u4EA0",
  32681. "\u2F08",
  32682. "\u4EBA",
  32683. "\u2F09",
  32684. "\u513F",
  32685. "\u2F0A",
  32686. "\u5165",
  32687. "\u2F0B",
  32688. "\u516B",
  32689. "\u2F0C",
  32690. "\u5182",
  32691. "\u2F0D",
  32692. "\u5196",
  32693. "\u2F0E",
  32694. "\u51AB",
  32695. "\u2F0F",
  32696. "\u51E0",
  32697. "\u2F10",
  32698. "\u51F5",
  32699. "\u2F11",
  32700. "\u5200",
  32701. "\u2F12",
  32702. "\u529B",
  32703. "\u2F13",
  32704. "\u52F9",
  32705. "\u2F14",
  32706. "\u5315",
  32707. "\u2F15",
  32708. "\u531A",
  32709. "\u2F16",
  32710. "\u5338",
  32711. "\u2F17",
  32712. "\u5341",
  32713. "\u2F18",
  32714. "\u535C",
  32715. "\u2F19",
  32716. "\u5369",
  32717. "\u2F1A",
  32718. "\u5382",
  32719. "\u2F1B",
  32720. "\u53B6",
  32721. "\u2F1C",
  32722. "\u53C8",
  32723. "\u2F1D",
  32724. "\u53E3",
  32725. "\u2F1E",
  32726. "\u56D7",
  32727. "\u2F1F",
  32728. "\u571F",
  32729. "\u2F20",
  32730. "\u58EB",
  32731. "\u2F21",
  32732. "\u5902",
  32733. "\u2F22",
  32734. "\u590A",
  32735. "\u2F23",
  32736. "\u5915",
  32737. "\u2F24",
  32738. "\u5927",
  32739. "\u2F25",
  32740. "\u5973",
  32741. "\u2F26",
  32742. "\u5B50",
  32743. "\u2F27",
  32744. "\u5B80",
  32745. "\u2F28",
  32746. "\u5BF8",
  32747. "\u2F29",
  32748. "\u5C0F",
  32749. "\u2F2A",
  32750. "\u5C22",
  32751. "\u2F2B",
  32752. "\u5C38",
  32753. "\u2F2C",
  32754. "\u5C6E",
  32755. "\u2F2D",
  32756. "\u5C71",
  32757. "\u2F2E",
  32758. "\u5DDB",
  32759. "\u2F2F",
  32760. "\u5DE5",
  32761. "\u2F30",
  32762. "\u5DF1",
  32763. "\u2F31",
  32764. "\u5DFE",
  32765. "\u2F32",
  32766. "\u5E72",
  32767. "\u2F33",
  32768. "\u5E7A",
  32769. "\u2F34",
  32770. "\u5E7F",
  32771. "\u2F35",
  32772. "\u5EF4",
  32773. "\u2F36",
  32774. "\u5EFE",
  32775. "\u2F37",
  32776. "\u5F0B",
  32777. "\u2F38",
  32778. "\u5F13",
  32779. "\u2F39",
  32780. "\u5F50",
  32781. "\u2F3A",
  32782. "\u5F61",
  32783. "\u2F3B",
  32784. "\u5F73",
  32785. "\u2F3C",
  32786. "\u5FC3",
  32787. "\u2F3D",
  32788. "\u6208",
  32789. "\u2F3E",
  32790. "\u6236",
  32791. "\u2F3F",
  32792. "\u624B",
  32793. "\u2F40",
  32794. "\u652F",
  32795. "\u2F41",
  32796. "\u6534",
  32797. "\u2F42",
  32798. "\u6587",
  32799. "\u2F43",
  32800. "\u6597",
  32801. "\u2F44",
  32802. "\u65A4",
  32803. "\u2F45",
  32804. "\u65B9",
  32805. "\u2F46",
  32806. "\u65E0",
  32807. "\u2F47",
  32808. "\u65E5",
  32809. "\u2F48",
  32810. "\u66F0",
  32811. "\u2F49",
  32812. "\u6708",
  32813. "\u2F4A",
  32814. "\u6728",
  32815. "\u2F4B",
  32816. "\u6B20",
  32817. "\u2F4C",
  32818. "\u6B62",
  32819. "\u2F4D",
  32820. "\u6B79",
  32821. "\u2F4E",
  32822. "\u6BB3",
  32823. "\u2F4F",
  32824. "\u6BCB",
  32825. "\u2F50",
  32826. "\u6BD4",
  32827. "\u2F51",
  32828. "\u6BDB",
  32829. "\u2F52",
  32830. "\u6C0F",
  32831. "\u2F53",
  32832. "\u6C14",
  32833. "\u2F54",
  32834. "\u6C34",
  32835. "\u2F55",
  32836. "\u706B",
  32837. "\u2F56",
  32838. "\u722A",
  32839. "\u2F57",
  32840. "\u7236",
  32841. "\u2F58",
  32842. "\u723B",
  32843. "\u2F59",
  32844. "\u723F",
  32845. "\u2F5A",
  32846. "\u7247",
  32847. "\u2F5B",
  32848. "\u7259",
  32849. "\u2F5C",
  32850. "\u725B",
  32851. "\u2F5D",
  32852. "\u72AC",
  32853. "\u2F5E",
  32854. "\u7384",
  32855. "\u2F5F",
  32856. "\u7389",
  32857. "\u2F60",
  32858. "\u74DC",
  32859. "\u2F61",
  32860. "\u74E6",
  32861. "\u2F62",
  32862. "\u7518",
  32863. "\u2F63",
  32864. "\u751F",
  32865. "\u2F64",
  32866. "\u7528",
  32867. "\u2F65",
  32868. "\u7530",
  32869. "\u2F66",
  32870. "\u758B",
  32871. "\u2F67",
  32872. "\u7592",
  32873. "\u2F68",
  32874. "\u7676",
  32875. "\u2F69",
  32876. "\u767D",
  32877. "\u2F6A",
  32878. "\u76AE",
  32879. "\u2F6B",
  32880. "\u76BF",
  32881. "\u2F6C",
  32882. "\u76EE",
  32883. "\u2F6D",
  32884. "\u77DB",
  32885. "\u2F6E",
  32886. "\u77E2",
  32887. "\u2F6F",
  32888. "\u77F3",
  32889. "\u2F70",
  32890. "\u793A",
  32891. "\u2F71",
  32892. "\u79B8",
  32893. "\u2F72",
  32894. "\u79BE",
  32895. "\u2F73",
  32896. "\u7A74",
  32897. "\u2F74",
  32898. "\u7ACB",
  32899. "\u2F75",
  32900. "\u7AF9",
  32901. "\u2F76",
  32902. "\u7C73",
  32903. "\u2F77",
  32904. "\u7CF8",
  32905. "\u2F78",
  32906. "\u7F36",
  32907. "\u2F79",
  32908. "\u7F51",
  32909. "\u2F7A",
  32910. "\u7F8A",
  32911. "\u2F7B",
  32912. "\u7FBD",
  32913. "\u2F7C",
  32914. "\u8001",
  32915. "\u2F7D",
  32916. "\u800C",
  32917. "\u2F7E",
  32918. "\u8012",
  32919. "\u2F7F",
  32920. "\u8033",
  32921. "\u2F80",
  32922. "\u807F",
  32923. "\u2F81",
  32924. "\u8089",
  32925. "\u2F82",
  32926. "\u81E3",
  32927. "\u2F83",
  32928. "\u81EA",
  32929. "\u2F84",
  32930. "\u81F3",
  32931. "\u2F85",
  32932. "\u81FC",
  32933. "\u2F86",
  32934. "\u820C",
  32935. "\u2F87",
  32936. "\u821B",
  32937. "\u2F88",
  32938. "\u821F",
  32939. "\u2F89",
  32940. "\u826E",
  32941. "\u2F8A",
  32942. "\u8272",
  32943. "\u2F8B",
  32944. "\u8278",
  32945. "\u2F8C",
  32946. "\u864D",
  32947. "\u2F8D",
  32948. "\u866B",
  32949. "\u2F8E",
  32950. "\u8840",
  32951. "\u2F8F",
  32952. "\u884C",
  32953. "\u2F90",
  32954. "\u8863",
  32955. "\u2F91",
  32956. "\u897E",
  32957. "\u2F92",
  32958. "\u898B",
  32959. "\u2F93",
  32960. "\u89D2",
  32961. "\u2F94",
  32962. "\u8A00",
  32963. "\u2F95",
  32964. "\u8C37",
  32965. "\u2F96",
  32966. "\u8C46",
  32967. "\u2F97",
  32968. "\u8C55",
  32969. "\u2F98",
  32970. "\u8C78",
  32971. "\u2F99",
  32972. "\u8C9D",
  32973. "\u2F9A",
  32974. "\u8D64",
  32975. "\u2F9B",
  32976. "\u8D70",
  32977. "\u2F9C",
  32978. "\u8DB3",
  32979. "\u2F9D",
  32980. "\u8EAB",
  32981. "\u2F9E",
  32982. "\u8ECA",
  32983. "\u2F9F",
  32984. "\u8F9B",
  32985. "\u2FA0",
  32986. "\u8FB0",
  32987. "\u2FA1",
  32988. "\u8FB5",
  32989. "\u2FA2",
  32990. "\u9091",
  32991. "\u2FA3",
  32992. "\u9149",
  32993. "\u2FA4",
  32994. "\u91C6",
  32995. "\u2FA5",
  32996. "\u91CC",
  32997. "\u2FA6",
  32998. "\u91D1",
  32999. "\u2FA7",
  33000. "\u9577",
  33001. "\u2FA8",
  33002. "\u9580",
  33003. "\u2FA9",
  33004. "\u961C",
  33005. "\u2FAA",
  33006. "\u96B6",
  33007. "\u2FAB",
  33008. "\u96B9",
  33009. "\u2FAC",
  33010. "\u96E8",
  33011. "\u2FAD",
  33012. "\u9751",
  33013. "\u2FAE",
  33014. "\u975E",
  33015. "\u2FAF",
  33016. "\u9762",
  33017. "\u2FB0",
  33018. "\u9769",
  33019. "\u2FB1",
  33020. "\u97CB",
  33021. "\u2FB2",
  33022. "\u97ED",
  33023. "\u2FB3",
  33024. "\u97F3",
  33025. "\u2FB4",
  33026. "\u9801",
  33027. "\u2FB5",
  33028. "\u98A8",
  33029. "\u2FB6",
  33030. "\u98DB",
  33031. "\u2FB7",
  33032. "\u98DF",
  33033. "\u2FB8",
  33034. "\u9996",
  33035. "\u2FB9",
  33036. "\u9999",
  33037. "\u2FBA",
  33038. "\u99AC",
  33039. "\u2FBB",
  33040. "\u9AA8",
  33041. "\u2FBC",
  33042. "\u9AD8",
  33043. "\u2FBD",
  33044. "\u9ADF",
  33045. "\u2FBE",
  33046. "\u9B25",
  33047. "\u2FBF",
  33048. "\u9B2F",
  33049. "\u2FC0",
  33050. "\u9B32",
  33051. "\u2FC1",
  33052. "\u9B3C",
  33053. "\u2FC2",
  33054. "\u9B5A",
  33055. "\u2FC3",
  33056. "\u9CE5",
  33057. "\u2FC4",
  33058. "\u9E75",
  33059. "\u2FC5",
  33060. "\u9E7F",
  33061. "\u2FC6",
  33062. "\u9EA5",
  33063. "\u2FC7",
  33064. "\u9EBB",
  33065. "\u2FC8",
  33066. "\u9EC3",
  33067. "\u2FC9",
  33068. "\u9ECD",
  33069. "\u2FCA",
  33070. "\u9ED1",
  33071. "\u2FCB",
  33072. "\u9EF9",
  33073. "\u2FCC",
  33074. "\u9EFD",
  33075. "\u2FCD",
  33076. "\u9F0E",
  33077. "\u2FCE",
  33078. "\u9F13",
  33079. "\u2FCF",
  33080. "\u9F20",
  33081. "\u2FD0",
  33082. "\u9F3B",
  33083. "\u2FD1",
  33084. "\u9F4A",
  33085. "\u2FD2",
  33086. "\u9F52",
  33087. "\u2FD3",
  33088. "\u9F8D",
  33089. "\u2FD4",
  33090. "\u9F9C",
  33091. "\u2FD5",
  33092. "\u9FA0",
  33093. "\u3036",
  33094. "\u3012",
  33095. "\u3038",
  33096. "\u5341",
  33097. "\u3039",
  33098. "\u5344",
  33099. "\u303A",
  33100. "\u5345",
  33101. "\u309B",
  33102. "\u0020\u3099",
  33103. "\u309C",
  33104. "\u0020\u309A",
  33105. "\u3131",
  33106. "\u1100",
  33107. "\u3132",
  33108. "\u1101",
  33109. "\u3133",
  33110. "\u11AA",
  33111. "\u3134",
  33112. "\u1102",
  33113. "\u3135",
  33114. "\u11AC",
  33115. "\u3136",
  33116. "\u11AD",
  33117. "\u3137",
  33118. "\u1103",
  33119. "\u3138",
  33120. "\u1104",
  33121. "\u3139",
  33122. "\u1105",
  33123. "\u313A",
  33124. "\u11B0",
  33125. "\u313B",
  33126. "\u11B1",
  33127. "\u313C",
  33128. "\u11B2",
  33129. "\u313D",
  33130. "\u11B3",
  33131. "\u313E",
  33132. "\u11B4",
  33133. "\u313F",
  33134. "\u11B5",
  33135. "\u3140",
  33136. "\u111A",
  33137. "\u3141",
  33138. "\u1106",
  33139. "\u3142",
  33140. "\u1107",
  33141. "\u3143",
  33142. "\u1108",
  33143. "\u3144",
  33144. "\u1121",
  33145. "\u3145",
  33146. "\u1109",
  33147. "\u3146",
  33148. "\u110A",
  33149. "\u3147",
  33150. "\u110B",
  33151. "\u3148",
  33152. "\u110C",
  33153. "\u3149",
  33154. "\u110D",
  33155. "\u314A",
  33156. "\u110E",
  33157. "\u314B",
  33158. "\u110F",
  33159. "\u314C",
  33160. "\u1110",
  33161. "\u314D",
  33162. "\u1111",
  33163. "\u314E",
  33164. "\u1112",
  33165. "\u314F",
  33166. "\u1161",
  33167. "\u3150",
  33168. "\u1162",
  33169. "\u3151",
  33170. "\u1163",
  33171. "\u3152",
  33172. "\u1164",
  33173. "\u3153",
  33174. "\u1165",
  33175. "\u3154",
  33176. "\u1166",
  33177. "\u3155",
  33178. "\u1167",
  33179. "\u3156",
  33180. "\u1168",
  33181. "\u3157",
  33182. "\u1169",
  33183. "\u3158",
  33184. "\u116A",
  33185. "\u3159",
  33186. "\u116B",
  33187. "\u315A",
  33188. "\u116C",
  33189. "\u315B",
  33190. "\u116D",
  33191. "\u315C",
  33192. "\u116E",
  33193. "\u315D",
  33194. "\u116F",
  33195. "\u315E",
  33196. "\u1170",
  33197. "\u315F",
  33198. "\u1171",
  33199. "\u3160",
  33200. "\u1172",
  33201. "\u3161",
  33202. "\u1173",
  33203. "\u3162",
  33204. "\u1174",
  33205. "\u3163",
  33206. "\u1175",
  33207. "\u3164",
  33208. "\u1160",
  33209. "\u3165",
  33210. "\u1114",
  33211. "\u3166",
  33212. "\u1115",
  33213. "\u3167",
  33214. "\u11C7",
  33215. "\u3168",
  33216. "\u11C8",
  33217. "\u3169",
  33218. "\u11CC",
  33219. "\u316A",
  33220. "\u11CE",
  33221. "\u316B",
  33222. "\u11D3",
  33223. "\u316C",
  33224. "\u11D7",
  33225. "\u316D",
  33226. "\u11D9",
  33227. "\u316E",
  33228. "\u111C",
  33229. "\u316F",
  33230. "\u11DD",
  33231. "\u3170",
  33232. "\u11DF",
  33233. "\u3171",
  33234. "\u111D",
  33235. "\u3172",
  33236. "\u111E",
  33237. "\u3173",
  33238. "\u1120",
  33239. "\u3174",
  33240. "\u1122",
  33241. "\u3175",
  33242. "\u1123",
  33243. "\u3176",
  33244. "\u1127",
  33245. "\u3177",
  33246. "\u1129",
  33247. "\u3178",
  33248. "\u112B",
  33249. "\u3179",
  33250. "\u112C",
  33251. "\u317A",
  33252. "\u112D",
  33253. "\u317B",
  33254. "\u112E",
  33255. "\u317C",
  33256. "\u112F",
  33257. "\u317D",
  33258. "\u1132",
  33259. "\u317E",
  33260. "\u1136",
  33261. "\u317F",
  33262. "\u1140",
  33263. "\u3180",
  33264. "\u1147",
  33265. "\u3181",
  33266. "\u114C",
  33267. "\u3182",
  33268. "\u11F1",
  33269. "\u3183",
  33270. "\u11F2",
  33271. "\u3184",
  33272. "\u1157",
  33273. "\u3185",
  33274. "\u1158",
  33275. "\u3186",
  33276. "\u1159",
  33277. "\u3187",
  33278. "\u1184",
  33279. "\u3188",
  33280. "\u1185",
  33281. "\u3189",
  33282. "\u1188",
  33283. "\u318A",
  33284. "\u1191",
  33285. "\u318B",
  33286. "\u1192",
  33287. "\u318C",
  33288. "\u1194",
  33289. "\u318D",
  33290. "\u119E",
  33291. "\u318E",
  33292. "\u11A1",
  33293. "\u3200",
  33294. "\u0028\u1100\u0029",
  33295. "\u3201",
  33296. "\u0028\u1102\u0029",
  33297. "\u3202",
  33298. "\u0028\u1103\u0029",
  33299. "\u3203",
  33300. "\u0028\u1105\u0029",
  33301. "\u3204",
  33302. "\u0028\u1106\u0029",
  33303. "\u3205",
  33304. "\u0028\u1107\u0029",
  33305. "\u3206",
  33306. "\u0028\u1109\u0029",
  33307. "\u3207",
  33308. "\u0028\u110B\u0029",
  33309. "\u3208",
  33310. "\u0028\u110C\u0029",
  33311. "\u3209",
  33312. "\u0028\u110E\u0029",
  33313. "\u320A",
  33314. "\u0028\u110F\u0029",
  33315. "\u320B",
  33316. "\u0028\u1110\u0029",
  33317. "\u320C",
  33318. "\u0028\u1111\u0029",
  33319. "\u320D",
  33320. "\u0028\u1112\u0029",
  33321. "\u320E",
  33322. "\u0028\u1100\u1161\u0029",
  33323. "\u320F",
  33324. "\u0028\u1102\u1161\u0029",
  33325. "\u3210",
  33326. "\u0028\u1103\u1161\u0029",
  33327. "\u3211",
  33328. "\u0028\u1105\u1161\u0029",
  33329. "\u3212",
  33330. "\u0028\u1106\u1161\u0029",
  33331. "\u3213",
  33332. "\u0028\u1107\u1161\u0029",
  33333. "\u3214",
  33334. "\u0028\u1109\u1161\u0029",
  33335. "\u3215",
  33336. "\u0028\u110B\u1161\u0029",
  33337. "\u3216",
  33338. "\u0028\u110C\u1161\u0029",
  33339. "\u3217",
  33340. "\u0028\u110E\u1161\u0029",
  33341. "\u3218",
  33342. "\u0028\u110F\u1161\u0029",
  33343. "\u3219",
  33344. "\u0028\u1110\u1161\u0029",
  33345. "\u321A",
  33346. "\u0028\u1111\u1161\u0029",
  33347. "\u321B",
  33348. "\u0028\u1112\u1161\u0029",
  33349. "\u321C",
  33350. "\u0028\u110C\u116E\u0029",
  33351. "\u321D",
  33352. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  33353. "\u321E",
  33354. "\u0028\u110B\u1169\u1112\u116E\u0029",
  33355. "\u3220",
  33356. "\u0028\u4E00\u0029",
  33357. "\u3221",
  33358. "\u0028\u4E8C\u0029",
  33359. "\u3222",
  33360. "\u0028\u4E09\u0029",
  33361. "\u3223",
  33362. "\u0028\u56DB\u0029",
  33363. "\u3224",
  33364. "\u0028\u4E94\u0029",
  33365. "\u3225",
  33366. "\u0028\u516D\u0029",
  33367. "\u3226",
  33368. "\u0028\u4E03\u0029",
  33369. "\u3227",
  33370. "\u0028\u516B\u0029",
  33371. "\u3228",
  33372. "\u0028\u4E5D\u0029",
  33373. "\u3229",
  33374. "\u0028\u5341\u0029",
  33375. "\u322A",
  33376. "\u0028\u6708\u0029",
  33377. "\u322B",
  33378. "\u0028\u706B\u0029",
  33379. "\u322C",
  33380. "\u0028\u6C34\u0029",
  33381. "\u322D",
  33382. "\u0028\u6728\u0029",
  33383. "\u322E",
  33384. "\u0028\u91D1\u0029",
  33385. "\u322F",
  33386. "\u0028\u571F\u0029",
  33387. "\u3230",
  33388. "\u0028\u65E5\u0029",
  33389. "\u3231",
  33390. "\u0028\u682A\u0029",
  33391. "\u3232",
  33392. "\u0028\u6709\u0029",
  33393. "\u3233",
  33394. "\u0028\u793E\u0029",
  33395. "\u3234",
  33396. "\u0028\u540D\u0029",
  33397. "\u3235",
  33398. "\u0028\u7279\u0029",
  33399. "\u3236",
  33400. "\u0028\u8CA1\u0029",
  33401. "\u3237",
  33402. "\u0028\u795D\u0029",
  33403. "\u3238",
  33404. "\u0028\u52B4\u0029",
  33405. "\u3239",
  33406. "\u0028\u4EE3\u0029",
  33407. "\u323A",
  33408. "\u0028\u547C\u0029",
  33409. "\u323B",
  33410. "\u0028\u5B66\u0029",
  33411. "\u323C",
  33412. "\u0028\u76E3\u0029",
  33413. "\u323D",
  33414. "\u0028\u4F01\u0029",
  33415. "\u323E",
  33416. "\u0028\u8CC7\u0029",
  33417. "\u323F",
  33418. "\u0028\u5354\u0029",
  33419. "\u3240",
  33420. "\u0028\u796D\u0029",
  33421. "\u3241",
  33422. "\u0028\u4F11\u0029",
  33423. "\u3242",
  33424. "\u0028\u81EA\u0029",
  33425. "\u3243",
  33426. "\u0028\u81F3\u0029",
  33427. "\u32C0",
  33428. "\u0031\u6708",
  33429. "\u32C1",
  33430. "\u0032\u6708",
  33431. "\u32C2",
  33432. "\u0033\u6708",
  33433. "\u32C3",
  33434. "\u0034\u6708",
  33435. "\u32C4",
  33436. "\u0035\u6708",
  33437. "\u32C5",
  33438. "\u0036\u6708",
  33439. "\u32C6",
  33440. "\u0037\u6708",
  33441. "\u32C7",
  33442. "\u0038\u6708",
  33443. "\u32C8",
  33444. "\u0039\u6708",
  33445. "\u32C9",
  33446. "\u0031\u0030\u6708",
  33447. "\u32CA",
  33448. "\u0031\u0031\u6708",
  33449. "\u32CB",
  33450. "\u0031\u0032\u6708",
  33451. "\u3358",
  33452. "\u0030\u70B9",
  33453. "\u3359",
  33454. "\u0031\u70B9",
  33455. "\u335A",
  33456. "\u0032\u70B9",
  33457. "\u335B",
  33458. "\u0033\u70B9",
  33459. "\u335C",
  33460. "\u0034\u70B9",
  33461. "\u335D",
  33462. "\u0035\u70B9",
  33463. "\u335E",
  33464. "\u0036\u70B9",
  33465. "\u335F",
  33466. "\u0037\u70B9",
  33467. "\u3360",
  33468. "\u0038\u70B9",
  33469. "\u3361",
  33470. "\u0039\u70B9",
  33471. "\u3362",
  33472. "\u0031\u0030\u70B9",
  33473. "\u3363",
  33474. "\u0031\u0031\u70B9",
  33475. "\u3364",
  33476. "\u0031\u0032\u70B9",
  33477. "\u3365",
  33478. "\u0031\u0033\u70B9",
  33479. "\u3366",
  33480. "\u0031\u0034\u70B9",
  33481. "\u3367",
  33482. "\u0031\u0035\u70B9",
  33483. "\u3368",
  33484. "\u0031\u0036\u70B9",
  33485. "\u3369",
  33486. "\u0031\u0037\u70B9",
  33487. "\u336A",
  33488. "\u0031\u0038\u70B9",
  33489. "\u336B",
  33490. "\u0031\u0039\u70B9",
  33491. "\u336C",
  33492. "\u0032\u0030\u70B9",
  33493. "\u336D",
  33494. "\u0032\u0031\u70B9",
  33495. "\u336E",
  33496. "\u0032\u0032\u70B9",
  33497. "\u336F",
  33498. "\u0032\u0033\u70B9",
  33499. "\u3370",
  33500. "\u0032\u0034\u70B9",
  33501. "\u33E0",
  33502. "\u0031\u65E5",
  33503. "\u33E1",
  33504. "\u0032\u65E5",
  33505. "\u33E2",
  33506. "\u0033\u65E5",
  33507. "\u33E3",
  33508. "\u0034\u65E5",
  33509. "\u33E4",
  33510. "\u0035\u65E5",
  33511. "\u33E5",
  33512. "\u0036\u65E5",
  33513. "\u33E6",
  33514. "\u0037\u65E5",
  33515. "\u33E7",
  33516. "\u0038\u65E5",
  33517. "\u33E8",
  33518. "\u0039\u65E5",
  33519. "\u33E9",
  33520. "\u0031\u0030\u65E5",
  33521. "\u33EA",
  33522. "\u0031\u0031\u65E5",
  33523. "\u33EB",
  33524. "\u0031\u0032\u65E5",
  33525. "\u33EC",
  33526. "\u0031\u0033\u65E5",
  33527. "\u33ED",
  33528. "\u0031\u0034\u65E5",
  33529. "\u33EE",
  33530. "\u0031\u0035\u65E5",
  33531. "\u33EF",
  33532. "\u0031\u0036\u65E5",
  33533. "\u33F0",
  33534. "\u0031\u0037\u65E5",
  33535. "\u33F1",
  33536. "\u0031\u0038\u65E5",
  33537. "\u33F2",
  33538. "\u0031\u0039\u65E5",
  33539. "\u33F3",
  33540. "\u0032\u0030\u65E5",
  33541. "\u33F4",
  33542. "\u0032\u0031\u65E5",
  33543. "\u33F5",
  33544. "\u0032\u0032\u65E5",
  33545. "\u33F6",
  33546. "\u0032\u0033\u65E5",
  33547. "\u33F7",
  33548. "\u0032\u0034\u65E5",
  33549. "\u33F8",
  33550. "\u0032\u0035\u65E5",
  33551. "\u33F9",
  33552. "\u0032\u0036\u65E5",
  33553. "\u33FA",
  33554. "\u0032\u0037\u65E5",
  33555. "\u33FB",
  33556. "\u0032\u0038\u65E5",
  33557. "\u33FC",
  33558. "\u0032\u0039\u65E5",
  33559. "\u33FD",
  33560. "\u0033\u0030\u65E5",
  33561. "\u33FE",
  33562. "\u0033\u0031\u65E5",
  33563. "\uFB00",
  33564. "\u0066\u0066",
  33565. "\uFB01",
  33566. "\u0066\u0069",
  33567. "\uFB02",
  33568. "\u0066\u006C",
  33569. "\uFB03",
  33570. "\u0066\u0066\u0069",
  33571. "\uFB04",
  33572. "\u0066\u0066\u006C",
  33573. "\uFB05",
  33574. "\u017F\u0074",
  33575. "\uFB06",
  33576. "\u0073\u0074",
  33577. "\uFB13",
  33578. "\u0574\u0576",
  33579. "\uFB14",
  33580. "\u0574\u0565",
  33581. "\uFB15",
  33582. "\u0574\u056B",
  33583. "\uFB16",
  33584. "\u057E\u0576",
  33585. "\uFB17",
  33586. "\u0574\u056D",
  33587. "\uFB4F",
  33588. "\u05D0\u05DC",
  33589. "\uFB50",
  33590. "\u0671",
  33591. "\uFB51",
  33592. "\u0671",
  33593. "\uFB52",
  33594. "\u067B",
  33595. "\uFB53",
  33596. "\u067B",
  33597. "\uFB54",
  33598. "\u067B",
  33599. "\uFB55",
  33600. "\u067B",
  33601. "\uFB56",
  33602. "\u067E",
  33603. "\uFB57",
  33604. "\u067E",
  33605. "\uFB58",
  33606. "\u067E",
  33607. "\uFB59",
  33608. "\u067E",
  33609. "\uFB5A",
  33610. "\u0680",
  33611. "\uFB5B",
  33612. "\u0680",
  33613. "\uFB5C",
  33614. "\u0680",
  33615. "\uFB5D",
  33616. "\u0680",
  33617. "\uFB5E",
  33618. "\u067A",
  33619. "\uFB5F",
  33620. "\u067A",
  33621. "\uFB60",
  33622. "\u067A",
  33623. "\uFB61",
  33624. "\u067A",
  33625. "\uFB62",
  33626. "\u067F",
  33627. "\uFB63",
  33628. "\u067F",
  33629. "\uFB64",
  33630. "\u067F",
  33631. "\uFB65",
  33632. "\u067F",
  33633. "\uFB66",
  33634. "\u0679",
  33635. "\uFB67",
  33636. "\u0679",
  33637. "\uFB68",
  33638. "\u0679",
  33639. "\uFB69",
  33640. "\u0679",
  33641. "\uFB6A",
  33642. "\u06A4",
  33643. "\uFB6B",
  33644. "\u06A4",
  33645. "\uFB6C",
  33646. "\u06A4",
  33647. "\uFB6D",
  33648. "\u06A4",
  33649. "\uFB6E",
  33650. "\u06A6",
  33651. "\uFB6F",
  33652. "\u06A6",
  33653. "\uFB70",
  33654. "\u06A6",
  33655. "\uFB71",
  33656. "\u06A6",
  33657. "\uFB72",
  33658. "\u0684",
  33659. "\uFB73",
  33660. "\u0684",
  33661. "\uFB74",
  33662. "\u0684",
  33663. "\uFB75",
  33664. "\u0684",
  33665. "\uFB76",
  33666. "\u0683",
  33667. "\uFB77",
  33668. "\u0683",
  33669. "\uFB78",
  33670. "\u0683",
  33671. "\uFB79",
  33672. "\u0683",
  33673. "\uFB7A",
  33674. "\u0686",
  33675. "\uFB7B",
  33676. "\u0686",
  33677. "\uFB7C",
  33678. "\u0686",
  33679. "\uFB7D",
  33680. "\u0686",
  33681. "\uFB7E",
  33682. "\u0687",
  33683. "\uFB7F",
  33684. "\u0687",
  33685. "\uFB80",
  33686. "\u0687",
  33687. "\uFB81",
  33688. "\u0687",
  33689. "\uFB82",
  33690. "\u068D",
  33691. "\uFB83",
  33692. "\u068D",
  33693. "\uFB84",
  33694. "\u068C",
  33695. "\uFB85",
  33696. "\u068C",
  33697. "\uFB86",
  33698. "\u068E",
  33699. "\uFB87",
  33700. "\u068E",
  33701. "\uFB88",
  33702. "\u0688",
  33703. "\uFB89",
  33704. "\u0688",
  33705. "\uFB8A",
  33706. "\u0698",
  33707. "\uFB8B",
  33708. "\u0698",
  33709. "\uFB8C",
  33710. "\u0691",
  33711. "\uFB8D",
  33712. "\u0691",
  33713. "\uFB8E",
  33714. "\u06A9",
  33715. "\uFB8F",
  33716. "\u06A9",
  33717. "\uFB90",
  33718. "\u06A9",
  33719. "\uFB91",
  33720. "\u06A9",
  33721. "\uFB92",
  33722. "\u06AF",
  33723. "\uFB93",
  33724. "\u06AF",
  33725. "\uFB94",
  33726. "\u06AF",
  33727. "\uFB95",
  33728. "\u06AF",
  33729. "\uFB96",
  33730. "\u06B3",
  33731. "\uFB97",
  33732. "\u06B3",
  33733. "\uFB98",
  33734. "\u06B3",
  33735. "\uFB99",
  33736. "\u06B3",
  33737. "\uFB9A",
  33738. "\u06B1",
  33739. "\uFB9B",
  33740. "\u06B1",
  33741. "\uFB9C",
  33742. "\u06B1",
  33743. "\uFB9D",
  33744. "\u06B1",
  33745. "\uFB9E",
  33746. "\u06BA",
  33747. "\uFB9F",
  33748. "\u06BA",
  33749. "\uFBA0",
  33750. "\u06BB",
  33751. "\uFBA1",
  33752. "\u06BB",
  33753. "\uFBA2",
  33754. "\u06BB",
  33755. "\uFBA3",
  33756. "\u06BB",
  33757. "\uFBA4",
  33758. "\u06C0",
  33759. "\uFBA5",
  33760. "\u06C0",
  33761. "\uFBA6",
  33762. "\u06C1",
  33763. "\uFBA7",
  33764. "\u06C1",
  33765. "\uFBA8",
  33766. "\u06C1",
  33767. "\uFBA9",
  33768. "\u06C1",
  33769. "\uFBAA",
  33770. "\u06BE",
  33771. "\uFBAB",
  33772. "\u06BE",
  33773. "\uFBAC",
  33774. "\u06BE",
  33775. "\uFBAD",
  33776. "\u06BE",
  33777. "\uFBAE",
  33778. "\u06D2",
  33779. "\uFBAF",
  33780. "\u06D2",
  33781. "\uFBB0",
  33782. "\u06D3",
  33783. "\uFBB1",
  33784. "\u06D3",
  33785. "\uFBD3",
  33786. "\u06AD",
  33787. "\uFBD4",
  33788. "\u06AD",
  33789. "\uFBD5",
  33790. "\u06AD",
  33791. "\uFBD6",
  33792. "\u06AD",
  33793. "\uFBD7",
  33794. "\u06C7",
  33795. "\uFBD8",
  33796. "\u06C7",
  33797. "\uFBD9",
  33798. "\u06C6",
  33799. "\uFBDA",
  33800. "\u06C6",
  33801. "\uFBDB",
  33802. "\u06C8",
  33803. "\uFBDC",
  33804. "\u06C8",
  33805. "\uFBDD",
  33806. "\u0677",
  33807. "\uFBDE",
  33808. "\u06CB",
  33809. "\uFBDF",
  33810. "\u06CB",
  33811. "\uFBE0",
  33812. "\u06C5",
  33813. "\uFBE1",
  33814. "\u06C5",
  33815. "\uFBE2",
  33816. "\u06C9",
  33817. "\uFBE3",
  33818. "\u06C9",
  33819. "\uFBE4",
  33820. "\u06D0",
  33821. "\uFBE5",
  33822. "\u06D0",
  33823. "\uFBE6",
  33824. "\u06D0",
  33825. "\uFBE7",
  33826. "\u06D0",
  33827. "\uFBE8",
  33828. "\u0649",
  33829. "\uFBE9",
  33830. "\u0649",
  33831. "\uFBEA",
  33832. "\u0626\u0627",
  33833. "\uFBEB",
  33834. "\u0626\u0627",
  33835. "\uFBEC",
  33836. "\u0626\u06D5",
  33837. "\uFBED",
  33838. "\u0626\u06D5",
  33839. "\uFBEE",
  33840. "\u0626\u0648",
  33841. "\uFBEF",
  33842. "\u0626\u0648",
  33843. "\uFBF0",
  33844. "\u0626\u06C7",
  33845. "\uFBF1",
  33846. "\u0626\u06C7",
  33847. "\uFBF2",
  33848. "\u0626\u06C6",
  33849. "\uFBF3",
  33850. "\u0626\u06C6",
  33851. "\uFBF4",
  33852. "\u0626\u06C8",
  33853. "\uFBF5",
  33854. "\u0626\u06C8",
  33855. "\uFBF6",
  33856. "\u0626\u06D0",
  33857. "\uFBF7",
  33858. "\u0626\u06D0",
  33859. "\uFBF8",
  33860. "\u0626\u06D0",
  33861. "\uFBF9",
  33862. "\u0626\u0649",
  33863. "\uFBFA",
  33864. "\u0626\u0649",
  33865. "\uFBFB",
  33866. "\u0626\u0649",
  33867. "\uFBFC",
  33868. "\u06CC",
  33869. "\uFBFD",
  33870. "\u06CC",
  33871. "\uFBFE",
  33872. "\u06CC",
  33873. "\uFBFF",
  33874. "\u06CC",
  33875. "\uFC00",
  33876. "\u0626\u062C",
  33877. "\uFC01",
  33878. "\u0626\u062D",
  33879. "\uFC02",
  33880. "\u0626\u0645",
  33881. "\uFC03",
  33882. "\u0626\u0649",
  33883. "\uFC04",
  33884. "\u0626\u064A",
  33885. "\uFC05",
  33886. "\u0628\u062C",
  33887. "\uFC06",
  33888. "\u0628\u062D",
  33889. "\uFC07",
  33890. "\u0628\u062E",
  33891. "\uFC08",
  33892. "\u0628\u0645",
  33893. "\uFC09",
  33894. "\u0628\u0649",
  33895. "\uFC0A",
  33896. "\u0628\u064A",
  33897. "\uFC0B",
  33898. "\u062A\u062C",
  33899. "\uFC0C",
  33900. "\u062A\u062D",
  33901. "\uFC0D",
  33902. "\u062A\u062E",
  33903. "\uFC0E",
  33904. "\u062A\u0645",
  33905. "\uFC0F",
  33906. "\u062A\u0649",
  33907. "\uFC10",
  33908. "\u062A\u064A",
  33909. "\uFC11",
  33910. "\u062B\u062C",
  33911. "\uFC12",
  33912. "\u062B\u0645",
  33913. "\uFC13",
  33914. "\u062B\u0649",
  33915. "\uFC14",
  33916. "\u062B\u064A",
  33917. "\uFC15",
  33918. "\u062C\u062D",
  33919. "\uFC16",
  33920. "\u062C\u0645",
  33921. "\uFC17",
  33922. "\u062D\u062C",
  33923. "\uFC18",
  33924. "\u062D\u0645",
  33925. "\uFC19",
  33926. "\u062E\u062C",
  33927. "\uFC1A",
  33928. "\u062E\u062D",
  33929. "\uFC1B",
  33930. "\u062E\u0645",
  33931. "\uFC1C",
  33932. "\u0633\u062C",
  33933. "\uFC1D",
  33934. "\u0633\u062D",
  33935. "\uFC1E",
  33936. "\u0633\u062E",
  33937. "\uFC1F",
  33938. "\u0633\u0645",
  33939. "\uFC20",
  33940. "\u0635\u062D",
  33941. "\uFC21",
  33942. "\u0635\u0645",
  33943. "\uFC22",
  33944. "\u0636\u062C",
  33945. "\uFC23",
  33946. "\u0636\u062D",
  33947. "\uFC24",
  33948. "\u0636\u062E",
  33949. "\uFC25",
  33950. "\u0636\u0645",
  33951. "\uFC26",
  33952. "\u0637\u062D",
  33953. "\uFC27",
  33954. "\u0637\u0645",
  33955. "\uFC28",
  33956. "\u0638\u0645",
  33957. "\uFC29",
  33958. "\u0639\u062C",
  33959. "\uFC2A",
  33960. "\u0639\u0645",
  33961. "\uFC2B",
  33962. "\u063A\u062C",
  33963. "\uFC2C",
  33964. "\u063A\u0645",
  33965. "\uFC2D",
  33966. "\u0641\u062C",
  33967. "\uFC2E",
  33968. "\u0641\u062D",
  33969. "\uFC2F",
  33970. "\u0641\u062E",
  33971. "\uFC30",
  33972. "\u0641\u0645",
  33973. "\uFC31",
  33974. "\u0641\u0649",
  33975. "\uFC32",
  33976. "\u0641\u064A",
  33977. "\uFC33",
  33978. "\u0642\u062D",
  33979. "\uFC34",
  33980. "\u0642\u0645",
  33981. "\uFC35",
  33982. "\u0642\u0649",
  33983. "\uFC36",
  33984. "\u0642\u064A",
  33985. "\uFC37",
  33986. "\u0643\u0627",
  33987. "\uFC38",
  33988. "\u0643\u062C",
  33989. "\uFC39",
  33990. "\u0643\u062D",
  33991. "\uFC3A",
  33992. "\u0643\u062E",
  33993. "\uFC3B",
  33994. "\u0643\u0644",
  33995. "\uFC3C",
  33996. "\u0643\u0645",
  33997. "\uFC3D",
  33998. "\u0643\u0649",
  33999. "\uFC3E",
  34000. "\u0643\u064A",
  34001. "\uFC3F",
  34002. "\u0644\u062C",
  34003. "\uFC40",
  34004. "\u0644\u062D",
  34005. "\uFC41",
  34006. "\u0644\u062E",
  34007. "\uFC42",
  34008. "\u0644\u0645",
  34009. "\uFC43",
  34010. "\u0644\u0649",
  34011. "\uFC44",
  34012. "\u0644\u064A",
  34013. "\uFC45",
  34014. "\u0645\u062C",
  34015. "\uFC46",
  34016. "\u0645\u062D",
  34017. "\uFC47",
  34018. "\u0645\u062E",
  34019. "\uFC48",
  34020. "\u0645\u0645",
  34021. "\uFC49",
  34022. "\u0645\u0649",
  34023. "\uFC4A",
  34024. "\u0645\u064A",
  34025. "\uFC4B",
  34026. "\u0646\u062C",
  34027. "\uFC4C",
  34028. "\u0646\u062D",
  34029. "\uFC4D",
  34030. "\u0646\u062E",
  34031. "\uFC4E",
  34032. "\u0646\u0645",
  34033. "\uFC4F",
  34034. "\u0646\u0649",
  34035. "\uFC50",
  34036. "\u0646\u064A",
  34037. "\uFC51",
  34038. "\u0647\u062C",
  34039. "\uFC52",
  34040. "\u0647\u0645",
  34041. "\uFC53",
  34042. "\u0647\u0649",
  34043. "\uFC54",
  34044. "\u0647\u064A",
  34045. "\uFC55",
  34046. "\u064A\u062C",
  34047. "\uFC56",
  34048. "\u064A\u062D",
  34049. "\uFC57",
  34050. "\u064A\u062E",
  34051. "\uFC58",
  34052. "\u064A\u0645",
  34053. "\uFC59",
  34054. "\u064A\u0649",
  34055. "\uFC5A",
  34056. "\u064A\u064A",
  34057. "\uFC5B",
  34058. "\u0630\u0670",
  34059. "\uFC5C",
  34060. "\u0631\u0670",
  34061. "\uFC5D",
  34062. "\u0649\u0670",
  34063. "\uFC5E",
  34064. "\u0020\u064C\u0651",
  34065. "\uFC5F",
  34066. "\u0020\u064D\u0651",
  34067. "\uFC60",
  34068. "\u0020\u064E\u0651",
  34069. "\uFC61",
  34070. "\u0020\u064F\u0651",
  34071. "\uFC62",
  34072. "\u0020\u0650\u0651",
  34073. "\uFC63",
  34074. "\u0020\u0651\u0670",
  34075. "\uFC64",
  34076. "\u0626\u0631",
  34077. "\uFC65",
  34078. "\u0626\u0632",
  34079. "\uFC66",
  34080. "\u0626\u0645",
  34081. "\uFC67",
  34082. "\u0626\u0646",
  34083. "\uFC68",
  34084. "\u0626\u0649",
  34085. "\uFC69",
  34086. "\u0626\u064A",
  34087. "\uFC6A",
  34088. "\u0628\u0631",
  34089. "\uFC6B",
  34090. "\u0628\u0632",
  34091. "\uFC6C",
  34092. "\u0628\u0645",
  34093. "\uFC6D",
  34094. "\u0628\u0646",
  34095. "\uFC6E",
  34096. "\u0628\u0649",
  34097. "\uFC6F",
  34098. "\u0628\u064A",
  34099. "\uFC70",
  34100. "\u062A\u0631",
  34101. "\uFC71",
  34102. "\u062A\u0632",
  34103. "\uFC72",
  34104. "\u062A\u0645",
  34105. "\uFC73",
  34106. "\u062A\u0646",
  34107. "\uFC74",
  34108. "\u062A\u0649",
  34109. "\uFC75",
  34110. "\u062A\u064A",
  34111. "\uFC76",
  34112. "\u062B\u0631",
  34113. "\uFC77",
  34114. "\u062B\u0632",
  34115. "\uFC78",
  34116. "\u062B\u0645",
  34117. "\uFC79",
  34118. "\u062B\u0646",
  34119. "\uFC7A",
  34120. "\u062B\u0649",
  34121. "\uFC7B",
  34122. "\u062B\u064A",
  34123. "\uFC7C",
  34124. "\u0641\u0649",
  34125. "\uFC7D",
  34126. "\u0641\u064A",
  34127. "\uFC7E",
  34128. "\u0642\u0649",
  34129. "\uFC7F",
  34130. "\u0642\u064A",
  34131. "\uFC80",
  34132. "\u0643\u0627",
  34133. "\uFC81",
  34134. "\u0643\u0644",
  34135. "\uFC82",
  34136. "\u0643\u0645",
  34137. "\uFC83",
  34138. "\u0643\u0649",
  34139. "\uFC84",
  34140. "\u0643\u064A",
  34141. "\uFC85",
  34142. "\u0644\u0645",
  34143. "\uFC86",
  34144. "\u0644\u0649",
  34145. "\uFC87",
  34146. "\u0644\u064A",
  34147. "\uFC88",
  34148. "\u0645\u0627",
  34149. "\uFC89",
  34150. "\u0645\u0645",
  34151. "\uFC8A",
  34152. "\u0646\u0631",
  34153. "\uFC8B",
  34154. "\u0646\u0632",
  34155. "\uFC8C",
  34156. "\u0646\u0645",
  34157. "\uFC8D",
  34158. "\u0646\u0646",
  34159. "\uFC8E",
  34160. "\u0646\u0649",
  34161. "\uFC8F",
  34162. "\u0646\u064A",
  34163. "\uFC90",
  34164. "\u0649\u0670",
  34165. "\uFC91",
  34166. "\u064A\u0631",
  34167. "\uFC92",
  34168. "\u064A\u0632",
  34169. "\uFC93",
  34170. "\u064A\u0645",
  34171. "\uFC94",
  34172. "\u064A\u0646",
  34173. "\uFC95",
  34174. "\u064A\u0649",
  34175. "\uFC96",
  34176. "\u064A\u064A",
  34177. "\uFC97",
  34178. "\u0626\u062C",
  34179. "\uFC98",
  34180. "\u0626\u062D",
  34181. "\uFC99",
  34182. "\u0626\u062E",
  34183. "\uFC9A",
  34184. "\u0626\u0645",
  34185. "\uFC9B",
  34186. "\u0626\u0647",
  34187. "\uFC9C",
  34188. "\u0628\u062C",
  34189. "\uFC9D",
  34190. "\u0628\u062D",
  34191. "\uFC9E",
  34192. "\u0628\u062E",
  34193. "\uFC9F",
  34194. "\u0628\u0645",
  34195. "\uFCA0",
  34196. "\u0628\u0647",
  34197. "\uFCA1",
  34198. "\u062A\u062C",
  34199. "\uFCA2",
  34200. "\u062A\u062D",
  34201. "\uFCA3",
  34202. "\u062A\u062E",
  34203. "\uFCA4",
  34204. "\u062A\u0645",
  34205. "\uFCA5",
  34206. "\u062A\u0647",
  34207. "\uFCA6",
  34208. "\u062B\u0645",
  34209. "\uFCA7",
  34210. "\u062C\u062D",
  34211. "\uFCA8",
  34212. "\u062C\u0645",
  34213. "\uFCA9",
  34214. "\u062D\u062C",
  34215. "\uFCAA",
  34216. "\u062D\u0645",
  34217. "\uFCAB",
  34218. "\u062E\u062C",
  34219. "\uFCAC",
  34220. "\u062E\u0645",
  34221. "\uFCAD",
  34222. "\u0633\u062C",
  34223. "\uFCAE",
  34224. "\u0633\u062D",
  34225. "\uFCAF",
  34226. "\u0633\u062E",
  34227. "\uFCB0",
  34228. "\u0633\u0645",
  34229. "\uFCB1",
  34230. "\u0635\u062D",
  34231. "\uFCB2",
  34232. "\u0635\u062E",
  34233. "\uFCB3",
  34234. "\u0635\u0645",
  34235. "\uFCB4",
  34236. "\u0636\u062C",
  34237. "\uFCB5",
  34238. "\u0636\u062D",
  34239. "\uFCB6",
  34240. "\u0636\u062E",
  34241. "\uFCB7",
  34242. "\u0636\u0645",
  34243. "\uFCB8",
  34244. "\u0637\u062D",
  34245. "\uFCB9",
  34246. "\u0638\u0645",
  34247. "\uFCBA",
  34248. "\u0639\u062C",
  34249. "\uFCBB",
  34250. "\u0639\u0645",
  34251. "\uFCBC",
  34252. "\u063A\u062C",
  34253. "\uFCBD",
  34254. "\u063A\u0645",
  34255. "\uFCBE",
  34256. "\u0641\u062C",
  34257. "\uFCBF",
  34258. "\u0641\u062D",
  34259. "\uFCC0",
  34260. "\u0641\u062E",
  34261. "\uFCC1",
  34262. "\u0641\u0645",
  34263. "\uFCC2",
  34264. "\u0642\u062D",
  34265. "\uFCC3",
  34266. "\u0642\u0645",
  34267. "\uFCC4",
  34268. "\u0643\u062C",
  34269. "\uFCC5",
  34270. "\u0643\u062D",
  34271. "\uFCC6",
  34272. "\u0643\u062E",
  34273. "\uFCC7",
  34274. "\u0643\u0644",
  34275. "\uFCC8",
  34276. "\u0643\u0645",
  34277. "\uFCC9",
  34278. "\u0644\u062C",
  34279. "\uFCCA",
  34280. "\u0644\u062D",
  34281. "\uFCCB",
  34282. "\u0644\u062E",
  34283. "\uFCCC",
  34284. "\u0644\u0645",
  34285. "\uFCCD",
  34286. "\u0644\u0647",
  34287. "\uFCCE",
  34288. "\u0645\u062C",
  34289. "\uFCCF",
  34290. "\u0645\u062D",
  34291. "\uFCD0",
  34292. "\u0645\u062E",
  34293. "\uFCD1",
  34294. "\u0645\u0645",
  34295. "\uFCD2",
  34296. "\u0646\u062C",
  34297. "\uFCD3",
  34298. "\u0646\u062D",
  34299. "\uFCD4",
  34300. "\u0646\u062E",
  34301. "\uFCD5",
  34302. "\u0646\u0645",
  34303. "\uFCD6",
  34304. "\u0646\u0647",
  34305. "\uFCD7",
  34306. "\u0647\u062C",
  34307. "\uFCD8",
  34308. "\u0647\u0645",
  34309. "\uFCD9",
  34310. "\u0647\u0670",
  34311. "\uFCDA",
  34312. "\u064A\u062C",
  34313. "\uFCDB",
  34314. "\u064A\u062D",
  34315. "\uFCDC",
  34316. "\u064A\u062E",
  34317. "\uFCDD",
  34318. "\u064A\u0645",
  34319. "\uFCDE",
  34320. "\u064A\u0647",
  34321. "\uFCDF",
  34322. "\u0626\u0645",
  34323. "\uFCE0",
  34324. "\u0626\u0647",
  34325. "\uFCE1",
  34326. "\u0628\u0645",
  34327. "\uFCE2",
  34328. "\u0628\u0647",
  34329. "\uFCE3",
  34330. "\u062A\u0645",
  34331. "\uFCE4",
  34332. "\u062A\u0647",
  34333. "\uFCE5",
  34334. "\u062B\u0645",
  34335. "\uFCE6",
  34336. "\u062B\u0647",
  34337. "\uFCE7",
  34338. "\u0633\u0645",
  34339. "\uFCE8",
  34340. "\u0633\u0647",
  34341. "\uFCE9",
  34342. "\u0634\u0645",
  34343. "\uFCEA",
  34344. "\u0634\u0647",
  34345. "\uFCEB",
  34346. "\u0643\u0644",
  34347. "\uFCEC",
  34348. "\u0643\u0645",
  34349. "\uFCED",
  34350. "\u0644\u0645",
  34351. "\uFCEE",
  34352. "\u0646\u0645",
  34353. "\uFCEF",
  34354. "\u0646\u0647",
  34355. "\uFCF0",
  34356. "\u064A\u0645",
  34357. "\uFCF1",
  34358. "\u064A\u0647",
  34359. "\uFCF2",
  34360. "\u0640\u064E\u0651",
  34361. "\uFCF3",
  34362. "\u0640\u064F\u0651",
  34363. "\uFCF4",
  34364. "\u0640\u0650\u0651",
  34365. "\uFCF5",
  34366. "\u0637\u0649",
  34367. "\uFCF6",
  34368. "\u0637\u064A",
  34369. "\uFCF7",
  34370. "\u0639\u0649",
  34371. "\uFCF8",
  34372. "\u0639\u064A",
  34373. "\uFCF9",
  34374. "\u063A\u0649",
  34375. "\uFCFA",
  34376. "\u063A\u064A",
  34377. "\uFCFB",
  34378. "\u0633\u0649",
  34379. "\uFCFC",
  34380. "\u0633\u064A",
  34381. "\uFCFD",
  34382. "\u0634\u0649",
  34383. "\uFCFE",
  34384. "\u0634\u064A",
  34385. "\uFCFF",
  34386. "\u062D\u0649",
  34387. "\uFD00",
  34388. "\u062D\u064A",
  34389. "\uFD01",
  34390. "\u062C\u0649",
  34391. "\uFD02",
  34392. "\u062C\u064A",
  34393. "\uFD03",
  34394. "\u062E\u0649",
  34395. "\uFD04",
  34396. "\u062E\u064A",
  34397. "\uFD05",
  34398. "\u0635\u0649",
  34399. "\uFD06",
  34400. "\u0635\u064A",
  34401. "\uFD07",
  34402. "\u0636\u0649",
  34403. "\uFD08",
  34404. "\u0636\u064A",
  34405. "\uFD09",
  34406. "\u0634\u062C",
  34407. "\uFD0A",
  34408. "\u0634\u062D",
  34409. "\uFD0B",
  34410. "\u0634\u062E",
  34411. "\uFD0C",
  34412. "\u0634\u0645",
  34413. "\uFD0D",
  34414. "\u0634\u0631",
  34415. "\uFD0E",
  34416. "\u0633\u0631",
  34417. "\uFD0F",
  34418. "\u0635\u0631",
  34419. "\uFD10",
  34420. "\u0636\u0631",
  34421. "\uFD11",
  34422. "\u0637\u0649",
  34423. "\uFD12",
  34424. "\u0637\u064A",
  34425. "\uFD13",
  34426. "\u0639\u0649",
  34427. "\uFD14",
  34428. "\u0639\u064A",
  34429. "\uFD15",
  34430. "\u063A\u0649",
  34431. "\uFD16",
  34432. "\u063A\u064A",
  34433. "\uFD17",
  34434. "\u0633\u0649",
  34435. "\uFD18",
  34436. "\u0633\u064A",
  34437. "\uFD19",
  34438. "\u0634\u0649",
  34439. "\uFD1A",
  34440. "\u0634\u064A",
  34441. "\uFD1B",
  34442. "\u062D\u0649",
  34443. "\uFD1C",
  34444. "\u062D\u064A",
  34445. "\uFD1D",
  34446. "\u062C\u0649",
  34447. "\uFD1E",
  34448. "\u062C\u064A",
  34449. "\uFD1F",
  34450. "\u062E\u0649",
  34451. "\uFD20",
  34452. "\u062E\u064A",
  34453. "\uFD21",
  34454. "\u0635\u0649",
  34455. "\uFD22",
  34456. "\u0635\u064A",
  34457. "\uFD23",
  34458. "\u0636\u0649",
  34459. "\uFD24",
  34460. "\u0636\u064A",
  34461. "\uFD25",
  34462. "\u0634\u062C",
  34463. "\uFD26",
  34464. "\u0634\u062D",
  34465. "\uFD27",
  34466. "\u0634\u062E",
  34467. "\uFD28",
  34468. "\u0634\u0645",
  34469. "\uFD29",
  34470. "\u0634\u0631",
  34471. "\uFD2A",
  34472. "\u0633\u0631",
  34473. "\uFD2B",
  34474. "\u0635\u0631",
  34475. "\uFD2C",
  34476. "\u0636\u0631",
  34477. "\uFD2D",
  34478. "\u0634\u062C",
  34479. "\uFD2E",
  34480. "\u0634\u062D",
  34481. "\uFD2F",
  34482. "\u0634\u062E",
  34483. "\uFD30",
  34484. "\u0634\u0645",
  34485. "\uFD31",
  34486. "\u0633\u0647",
  34487. "\uFD32",
  34488. "\u0634\u0647",
  34489. "\uFD33",
  34490. "\u0637\u0645",
  34491. "\uFD34",
  34492. "\u0633\u062C",
  34493. "\uFD35",
  34494. "\u0633\u062D",
  34495. "\uFD36",
  34496. "\u0633\u062E",
  34497. "\uFD37",
  34498. "\u0634\u062C",
  34499. "\uFD38",
  34500. "\u0634\u062D",
  34501. "\uFD39",
  34502. "\u0634\u062E",
  34503. "\uFD3A",
  34504. "\u0637\u0645",
  34505. "\uFD3B",
  34506. "\u0638\u0645",
  34507. "\uFD3C",
  34508. "\u0627\u064B",
  34509. "\uFD3D",
  34510. "\u0627\u064B",
  34511. "\uFD50",
  34512. "\u062A\u062C\u0645",
  34513. "\uFD51",
  34514. "\u062A\u062D\u062C",
  34515. "\uFD52",
  34516. "\u062A\u062D\u062C",
  34517. "\uFD53",
  34518. "\u062A\u062D\u0645",
  34519. "\uFD54",
  34520. "\u062A\u062E\u0645",
  34521. "\uFD55",
  34522. "\u062A\u0645\u062C",
  34523. "\uFD56",
  34524. "\u062A\u0645\u062D",
  34525. "\uFD57",
  34526. "\u062A\u0645\u062E",
  34527. "\uFD58",
  34528. "\u062C\u0645\u062D",
  34529. "\uFD59",
  34530. "\u062C\u0645\u062D",
  34531. "\uFD5A",
  34532. "\u062D\u0645\u064A",
  34533. "\uFD5B",
  34534. "\u062D\u0645\u0649",
  34535. "\uFD5C",
  34536. "\u0633\u062D\u062C",
  34537. "\uFD5D",
  34538. "\u0633\u062C\u062D",
  34539. "\uFD5E",
  34540. "\u0633\u062C\u0649",
  34541. "\uFD5F",
  34542. "\u0633\u0645\u062D",
  34543. "\uFD60",
  34544. "\u0633\u0645\u062D",
  34545. "\uFD61",
  34546. "\u0633\u0645\u062C",
  34547. "\uFD62",
  34548. "\u0633\u0645\u0645",
  34549. "\uFD63",
  34550. "\u0633\u0645\u0645",
  34551. "\uFD64",
  34552. "\u0635\u062D\u062D",
  34553. "\uFD65",
  34554. "\u0635\u062D\u062D",
  34555. "\uFD66",
  34556. "\u0635\u0645\u0645",
  34557. "\uFD67",
  34558. "\u0634\u062D\u0645",
  34559. "\uFD68",
  34560. "\u0634\u062D\u0645",
  34561. "\uFD69",
  34562. "\u0634\u062C\u064A",
  34563. "\uFD6A",
  34564. "\u0634\u0645\u062E",
  34565. "\uFD6B",
  34566. "\u0634\u0645\u062E",
  34567. "\uFD6C",
  34568. "\u0634\u0645\u0645",
  34569. "\uFD6D",
  34570. "\u0634\u0645\u0645",
  34571. "\uFD6E",
  34572. "\u0636\u062D\u0649",
  34573. "\uFD6F",
  34574. "\u0636\u062E\u0645",
  34575. "\uFD70",
  34576. "\u0636\u062E\u0645",
  34577. "\uFD71",
  34578. "\u0637\u0645\u062D",
  34579. "\uFD72",
  34580. "\u0637\u0645\u062D",
  34581. "\uFD73",
  34582. "\u0637\u0645\u0645",
  34583. "\uFD74",
  34584. "\u0637\u0645\u064A",
  34585. "\uFD75",
  34586. "\u0639\u062C\u0645",
  34587. "\uFD76",
  34588. "\u0639\u0645\u0645",
  34589. "\uFD77",
  34590. "\u0639\u0645\u0645",
  34591. "\uFD78",
  34592. "\u0639\u0645\u0649",
  34593. "\uFD79",
  34594. "\u063A\u0645\u0645",
  34595. "\uFD7A",
  34596. "\u063A\u0645\u064A",
  34597. "\uFD7B",
  34598. "\u063A\u0645\u0649",
  34599. "\uFD7C",
  34600. "\u0641\u062E\u0645",
  34601. "\uFD7D",
  34602. "\u0641\u062E\u0645",
  34603. "\uFD7E",
  34604. "\u0642\u0645\u062D",
  34605. "\uFD7F",
  34606. "\u0642\u0645\u0645",
  34607. "\uFD80",
  34608. "\u0644\u062D\u0645",
  34609. "\uFD81",
  34610. "\u0644\u062D\u064A",
  34611. "\uFD82",
  34612. "\u0644\u062D\u0649",
  34613. "\uFD83",
  34614. "\u0644\u062C\u062C",
  34615. "\uFD84",
  34616. "\u0644\u062C\u062C",
  34617. "\uFD85",
  34618. "\u0644\u062E\u0645",
  34619. "\uFD86",
  34620. "\u0644\u062E\u0645",
  34621. "\uFD87",
  34622. "\u0644\u0645\u062D",
  34623. "\uFD88",
  34624. "\u0644\u0645\u062D",
  34625. "\uFD89",
  34626. "\u0645\u062D\u062C",
  34627. "\uFD8A",
  34628. "\u0645\u062D\u0645",
  34629. "\uFD8B",
  34630. "\u0645\u062D\u064A",
  34631. "\uFD8C",
  34632. "\u0645\u062C\u062D",
  34633. "\uFD8D",
  34634. "\u0645\u062C\u0645",
  34635. "\uFD8E",
  34636. "\u0645\u062E\u062C",
  34637. "\uFD8F",
  34638. "\u0645\u062E\u0645",
  34639. "\uFD92",
  34640. "\u0645\u062C\u062E",
  34641. "\uFD93",
  34642. "\u0647\u0645\u062C",
  34643. "\uFD94",
  34644. "\u0647\u0645\u0645",
  34645. "\uFD95",
  34646. "\u0646\u062D\u0645",
  34647. "\uFD96",
  34648. "\u0646\u062D\u0649",
  34649. "\uFD97",
  34650. "\u0646\u062C\u0645",
  34651. "\uFD98",
  34652. "\u0646\u062C\u0645",
  34653. "\uFD99",
  34654. "\u0646\u062C\u0649",
  34655. "\uFD9A",
  34656. "\u0646\u0645\u064A",
  34657. "\uFD9B",
  34658. "\u0646\u0645\u0649",
  34659. "\uFD9C",
  34660. "\u064A\u0645\u0645",
  34661. "\uFD9D",
  34662. "\u064A\u0645\u0645",
  34663. "\uFD9E",
  34664. "\u0628\u062E\u064A",
  34665. "\uFD9F",
  34666. "\u062A\u062C\u064A",
  34667. "\uFDA0",
  34668. "\u062A\u062C\u0649",
  34669. "\uFDA1",
  34670. "\u062A\u062E\u064A",
  34671. "\uFDA2",
  34672. "\u062A\u062E\u0649",
  34673. "\uFDA3",
  34674. "\u062A\u0645\u064A",
  34675. "\uFDA4",
  34676. "\u062A\u0645\u0649",
  34677. "\uFDA5",
  34678. "\u062C\u0645\u064A",
  34679. "\uFDA6",
  34680. "\u062C\u062D\u0649",
  34681. "\uFDA7",
  34682. "\u062C\u0645\u0649",
  34683. "\uFDA8",
  34684. "\u0633\u062E\u0649",
  34685. "\uFDA9",
  34686. "\u0635\u062D\u064A",
  34687. "\uFDAA",
  34688. "\u0634\u062D\u064A",
  34689. "\uFDAB",
  34690. "\u0636\u062D\u064A",
  34691. "\uFDAC",
  34692. "\u0644\u062C\u064A",
  34693. "\uFDAD",
  34694. "\u0644\u0645\u064A",
  34695. "\uFDAE",
  34696. "\u064A\u062D\u064A",
  34697. "\uFDAF",
  34698. "\u064A\u062C\u064A",
  34699. "\uFDB0",
  34700. "\u064A\u0645\u064A",
  34701. "\uFDB1",
  34702. "\u0645\u0645\u064A",
  34703. "\uFDB2",
  34704. "\u0642\u0645\u064A",
  34705. "\uFDB3",
  34706. "\u0646\u062D\u064A",
  34707. "\uFDB4",
  34708. "\u0642\u0645\u062D",
  34709. "\uFDB5",
  34710. "\u0644\u062D\u0645",
  34711. "\uFDB6",
  34712. "\u0639\u0645\u064A",
  34713. "\uFDB7",
  34714. "\u0643\u0645\u064A",
  34715. "\uFDB8",
  34716. "\u0646\u062C\u062D",
  34717. "\uFDB9",
  34718. "\u0645\u062E\u064A",
  34719. "\uFDBA",
  34720. "\u0644\u062C\u0645",
  34721. "\uFDBB",
  34722. "\u0643\u0645\u0645",
  34723. "\uFDBC",
  34724. "\u0644\u062C\u0645",
  34725. "\uFDBD",
  34726. "\u0646\u062C\u062D",
  34727. "\uFDBE",
  34728. "\u062C\u062D\u064A",
  34729. "\uFDBF",
  34730. "\u062D\u062C\u064A",
  34731. "\uFDC0",
  34732. "\u0645\u062C\u064A",
  34733. "\uFDC1",
  34734. "\u0641\u0645\u064A",
  34735. "\uFDC2",
  34736. "\u0628\u062D\u064A",
  34737. "\uFDC3",
  34738. "\u0643\u0645\u0645",
  34739. "\uFDC4",
  34740. "\u0639\u062C\u0645",
  34741. "\uFDC5",
  34742. "\u0635\u0645\u0645",
  34743. "\uFDC6",
  34744. "\u0633\u062E\u064A",
  34745. "\uFDC7",
  34746. "\u0646\u062C\u064A",
  34747. "\uFE49",
  34748. "\u203E",
  34749. "\uFE4A",
  34750. "\u203E",
  34751. "\uFE4B",
  34752. "\u203E",
  34753. "\uFE4C",
  34754. "\u203E",
  34755. "\uFE4D",
  34756. "\u005F",
  34757. "\uFE4E",
  34758. "\u005F",
  34759. "\uFE4F",
  34760. "\u005F",
  34761. "\uFE80",
  34762. "\u0621",
  34763. "\uFE81",
  34764. "\u0622",
  34765. "\uFE82",
  34766. "\u0622",
  34767. "\uFE83",
  34768. "\u0623",
  34769. "\uFE84",
  34770. "\u0623",
  34771. "\uFE85",
  34772. "\u0624",
  34773. "\uFE86",
  34774. "\u0624",
  34775. "\uFE87",
  34776. "\u0625",
  34777. "\uFE88",
  34778. "\u0625",
  34779. "\uFE89",
  34780. "\u0626",
  34781. "\uFE8A",
  34782. "\u0626",
  34783. "\uFE8B",
  34784. "\u0626",
  34785. "\uFE8C",
  34786. "\u0626",
  34787. "\uFE8D",
  34788. "\u0627",
  34789. "\uFE8E",
  34790. "\u0627",
  34791. "\uFE8F",
  34792. "\u0628",
  34793. "\uFE90",
  34794. "\u0628",
  34795. "\uFE91",
  34796. "\u0628",
  34797. "\uFE92",
  34798. "\u0628",
  34799. "\uFE93",
  34800. "\u0629",
  34801. "\uFE94",
  34802. "\u0629",
  34803. "\uFE95",
  34804. "\u062A",
  34805. "\uFE96",
  34806. "\u062A",
  34807. "\uFE97",
  34808. "\u062A",
  34809. "\uFE98",
  34810. "\u062A",
  34811. "\uFE99",
  34812. "\u062B",
  34813. "\uFE9A",
  34814. "\u062B",
  34815. "\uFE9B",
  34816. "\u062B",
  34817. "\uFE9C",
  34818. "\u062B",
  34819. "\uFE9D",
  34820. "\u062C",
  34821. "\uFE9E",
  34822. "\u062C",
  34823. "\uFE9F",
  34824. "\u062C",
  34825. "\uFEA0",
  34826. "\u062C",
  34827. "\uFEA1",
  34828. "\u062D",
  34829. "\uFEA2",
  34830. "\u062D",
  34831. "\uFEA3",
  34832. "\u062D",
  34833. "\uFEA4",
  34834. "\u062D",
  34835. "\uFEA5",
  34836. "\u062E",
  34837. "\uFEA6",
  34838. "\u062E",
  34839. "\uFEA7",
  34840. "\u062E",
  34841. "\uFEA8",
  34842. "\u062E",
  34843. "\uFEA9",
  34844. "\u062F",
  34845. "\uFEAA",
  34846. "\u062F",
  34847. "\uFEAB",
  34848. "\u0630",
  34849. "\uFEAC",
  34850. "\u0630",
  34851. "\uFEAD",
  34852. "\u0631",
  34853. "\uFEAE",
  34854. "\u0631",
  34855. "\uFEAF",
  34856. "\u0632",
  34857. "\uFEB0",
  34858. "\u0632",
  34859. "\uFEB1",
  34860. "\u0633",
  34861. "\uFEB2",
  34862. "\u0633",
  34863. "\uFEB3",
  34864. "\u0633",
  34865. "\uFEB4",
  34866. "\u0633",
  34867. "\uFEB5",
  34868. "\u0634",
  34869. "\uFEB6",
  34870. "\u0634",
  34871. "\uFEB7",
  34872. "\u0634",
  34873. "\uFEB8",
  34874. "\u0634",
  34875. "\uFEB9",
  34876. "\u0635",
  34877. "\uFEBA",
  34878. "\u0635",
  34879. "\uFEBB",
  34880. "\u0635",
  34881. "\uFEBC",
  34882. "\u0635",
  34883. "\uFEBD",
  34884. "\u0636",
  34885. "\uFEBE",
  34886. "\u0636",
  34887. "\uFEBF",
  34888. "\u0636",
  34889. "\uFEC0",
  34890. "\u0636",
  34891. "\uFEC1",
  34892. "\u0637",
  34893. "\uFEC2",
  34894. "\u0637",
  34895. "\uFEC3",
  34896. "\u0637",
  34897. "\uFEC4",
  34898. "\u0637",
  34899. "\uFEC5",
  34900. "\u0638",
  34901. "\uFEC6",
  34902. "\u0638",
  34903. "\uFEC7",
  34904. "\u0638",
  34905. "\uFEC8",
  34906. "\u0638",
  34907. "\uFEC9",
  34908. "\u0639",
  34909. "\uFECA",
  34910. "\u0639",
  34911. "\uFECB",
  34912. "\u0639",
  34913. "\uFECC",
  34914. "\u0639",
  34915. "\uFECD",
  34916. "\u063A",
  34917. "\uFECE",
  34918. "\u063A",
  34919. "\uFECF",
  34920. "\u063A",
  34921. "\uFED0",
  34922. "\u063A",
  34923. "\uFED1",
  34924. "\u0641",
  34925. "\uFED2",
  34926. "\u0641",
  34927. "\uFED3",
  34928. "\u0641",
  34929. "\uFED4",
  34930. "\u0641",
  34931. "\uFED5",
  34932. "\u0642",
  34933. "\uFED6",
  34934. "\u0642",
  34935. "\uFED7",
  34936. "\u0642",
  34937. "\uFED8",
  34938. "\u0642",
  34939. "\uFED9",
  34940. "\u0643",
  34941. "\uFEDA",
  34942. "\u0643",
  34943. "\uFEDB",
  34944. "\u0643",
  34945. "\uFEDC",
  34946. "\u0643",
  34947. "\uFEDD",
  34948. "\u0644",
  34949. "\uFEDE",
  34950. "\u0644",
  34951. "\uFEDF",
  34952. "\u0644",
  34953. "\uFEE0",
  34954. "\u0644",
  34955. "\uFEE1",
  34956. "\u0645",
  34957. "\uFEE2",
  34958. "\u0645",
  34959. "\uFEE3",
  34960. "\u0645",
  34961. "\uFEE4",
  34962. "\u0645",
  34963. "\uFEE5",
  34964. "\u0646",
  34965. "\uFEE6",
  34966. "\u0646",
  34967. "\uFEE7",
  34968. "\u0646",
  34969. "\uFEE8",
  34970. "\u0646",
  34971. "\uFEE9",
  34972. "\u0647",
  34973. "\uFEEA",
  34974. "\u0647",
  34975. "\uFEEB",
  34976. "\u0647",
  34977. "\uFEEC",
  34978. "\u0647",
  34979. "\uFEED",
  34980. "\u0648",
  34981. "\uFEEE",
  34982. "\u0648",
  34983. "\uFEEF",
  34984. "\u0649",
  34985. "\uFEF0",
  34986. "\u0649",
  34987. "\uFEF1",
  34988. "\u064A",
  34989. "\uFEF2",
  34990. "\u064A",
  34991. "\uFEF3",
  34992. "\u064A",
  34993. "\uFEF4",
  34994. "\u064A",
  34995. "\uFEF5",
  34996. "\u0644\u0622",
  34997. "\uFEF6",
  34998. "\u0644\u0622",
  34999. "\uFEF7",
  35000. "\u0644\u0623",
  35001. "\uFEF8",
  35002. "\u0644\u0623",
  35003. "\uFEF9",
  35004. "\u0644\u0625",
  35005. "\uFEFA",
  35006. "\u0644\u0625",
  35007. "\uFEFB",
  35008. "\u0644\u0627",
  35009. "\uFEFC",
  35010. "\u0644\u0627"
  35011. ];
  35012. });
  35013. function reverseIfRtl(chars) {
  35014. const charsLength = chars.length;
  35015. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  35016. return chars;
  35017. }
  35018. const buf = [];
  35019. for (let ii = charsLength - 1; ii >= 0; ii--) {
  35020. buf.push(chars[ii]);
  35021. }
  35022. return buf.join("");
  35023. }
  35024. /***/ }),
  35025. /* 41 */
  35026. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35027. Object.defineProperty(exports, "__esModule", ({
  35028. value: true
  35029. }));
  35030. exports.getStandardFontName = getStandardFontName;
  35031. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  35032. var _core_utils = __w_pdfjs_require__(9);
  35033. var _fonts_utils = __w_pdfjs_require__(38);
  35034. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35035. t["Times-Roman"] = "Times-Roman";
  35036. t.Helvetica = "Helvetica";
  35037. t.Courier = "Courier";
  35038. t.Symbol = "Symbol";
  35039. t["Times-Bold"] = "Times-Bold";
  35040. t["Helvetica-Bold"] = "Helvetica-Bold";
  35041. t["Courier-Bold"] = "Courier-Bold";
  35042. t.ZapfDingbats = "ZapfDingbats";
  35043. t["Times-Italic"] = "Times-Italic";
  35044. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  35045. t["Courier-Oblique"] = "Courier-Oblique";
  35046. t["Times-BoldItalic"] = "Times-BoldItalic";
  35047. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  35048. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  35049. t.ArialNarrow = "Helvetica";
  35050. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  35051. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  35052. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  35053. t.ArialBlack = "Helvetica";
  35054. t["ArialBlack-Bold"] = "Helvetica-Bold";
  35055. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  35056. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  35057. t["Arial-Black"] = "Helvetica";
  35058. t["Arial-Black-Bold"] = "Helvetica-Bold";
  35059. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  35060. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  35061. t.Arial = "Helvetica";
  35062. t["Arial-Bold"] = "Helvetica-Bold";
  35063. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  35064. t["Arial-Italic"] = "Helvetica-Oblique";
  35065. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  35066. t["Arial-BoldMT"] = "Helvetica-Bold";
  35067. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  35068. t.ArialMT = "Helvetica";
  35069. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  35070. t["Courier-Italic"] = "Courier-Oblique";
  35071. t.CourierNew = "Courier";
  35072. t["CourierNew-Bold"] = "Courier-Bold";
  35073. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  35074. t["CourierNew-Italic"] = "Courier-Oblique";
  35075. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  35076. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  35077. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  35078. t.CourierNewPSMT = "Courier";
  35079. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  35080. t["Helvetica-Italic"] = "Helvetica-Oblique";
  35081. t["Symbol-Bold"] = "Symbol";
  35082. t["Symbol-BoldItalic"] = "Symbol";
  35083. t["Symbol-Italic"] = "Symbol";
  35084. t.TimesNewRoman = "Times-Roman";
  35085. t["TimesNewRoman-Bold"] = "Times-Bold";
  35086. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  35087. t["TimesNewRoman-Italic"] = "Times-Italic";
  35088. t.TimesNewRomanPS = "Times-Roman";
  35089. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  35090. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  35091. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  35092. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  35093. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  35094. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  35095. t.TimesNewRomanPSMT = "Times-Roman";
  35096. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  35097. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  35098. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  35099. });
  35100. exports.getStdFontMap = getStdFontMap;
  35101. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35102. t.Courier = "FoxitFixed.pfb";
  35103. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  35104. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  35105. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  35106. t.Helvetica = "FoxitSans.pfb";
  35107. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  35108. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  35109. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  35110. t["Times-Roman"] = "FoxitSerif.pfb";
  35111. t["Times-Bold"] = "FoxitSerifBold.pfb";
  35112. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  35113. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  35114. t.Symbol = "FoxitSymbol.pfb";
  35115. t.ZapfDingbats = "FoxitDingbats.pfb";
  35116. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  35117. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  35118. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  35119. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  35120. });
  35121. exports.getFontNameToFileMap = getFontNameToFileMap;
  35122. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35123. t.Calibri = "Helvetica";
  35124. t["Calibri-Bold"] = "Helvetica-Bold";
  35125. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  35126. t["Calibri-Italic"] = "Helvetica-Oblique";
  35127. t.CenturyGothic = "Helvetica";
  35128. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  35129. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  35130. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  35131. t.ComicSansMS = "Comic Sans MS";
  35132. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  35133. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  35134. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  35135. t.LucidaConsole = "Courier";
  35136. t["LucidaConsole-Bold"] = "Courier-Bold";
  35137. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  35138. t["LucidaConsole-Italic"] = "Courier-Oblique";
  35139. t["LucidaSans-Demi"] = "Helvetica-Bold";
  35140. t["MS-Gothic"] = "MS Gothic";
  35141. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  35142. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  35143. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  35144. t["MS-Mincho"] = "MS Mincho";
  35145. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  35146. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  35147. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  35148. t["MS-PGothic"] = "MS PGothic";
  35149. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  35150. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  35151. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  35152. t["MS-PMincho"] = "MS PMincho";
  35153. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  35154. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  35155. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  35156. t.NuptialScript = "Times-Italic";
  35157. t.SegoeUISymbol = "Helvetica";
  35158. t.Wingdings = "ZapfDingbats";
  35159. t["Wingdings-Regular"] = "ZapfDingbats";
  35160. });
  35161. exports.getNonStdFontMap = getNonStdFontMap;
  35162. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35163. t["Adobe Jenson"] = true;
  35164. t["Adobe Text"] = true;
  35165. t.Albertus = true;
  35166. t.Aldus = true;
  35167. t.Alexandria = true;
  35168. t.Algerian = true;
  35169. t["American Typewriter"] = true;
  35170. t.Antiqua = true;
  35171. t.Apex = true;
  35172. t.Arno = true;
  35173. t.Aster = true;
  35174. t.Aurora = true;
  35175. t.Baskerville = true;
  35176. t.Bell = true;
  35177. t.Bembo = true;
  35178. t["Bembo Schoolbook"] = true;
  35179. t.Benguiat = true;
  35180. t["Berkeley Old Style"] = true;
  35181. t["Bernhard Modern"] = true;
  35182. t["Berthold City"] = true;
  35183. t.Bodoni = true;
  35184. t["Bauer Bodoni"] = true;
  35185. t["Book Antiqua"] = true;
  35186. t.Bookman = true;
  35187. t["Bordeaux Roman"] = true;
  35188. t["Californian FB"] = true;
  35189. t.Calisto = true;
  35190. t.Calvert = true;
  35191. t.Capitals = true;
  35192. t.Cambria = true;
  35193. t.Cartier = true;
  35194. t.Caslon = true;
  35195. t.Catull = true;
  35196. t.Centaur = true;
  35197. t["Century Old Style"] = true;
  35198. t["Century Schoolbook"] = true;
  35199. t.Chaparral = true;
  35200. t["Charis SIL"] = true;
  35201. t.Cheltenham = true;
  35202. t["Cholla Slab"] = true;
  35203. t.Clarendon = true;
  35204. t.Clearface = true;
  35205. t.Cochin = true;
  35206. t.Colonna = true;
  35207. t["Computer Modern"] = true;
  35208. t["Concrete Roman"] = true;
  35209. t.Constantia = true;
  35210. t["Cooper Black"] = true;
  35211. t.Corona = true;
  35212. t.Ecotype = true;
  35213. t.Egyptienne = true;
  35214. t.Elephant = true;
  35215. t.Excelsior = true;
  35216. t.Fairfield = true;
  35217. t["FF Scala"] = true;
  35218. t.Folkard = true;
  35219. t.Footlight = true;
  35220. t.FreeSerif = true;
  35221. t["Friz Quadrata"] = true;
  35222. t.Garamond = true;
  35223. t.Gentium = true;
  35224. t.Georgia = true;
  35225. t.Gloucester = true;
  35226. t["Goudy Old Style"] = true;
  35227. t["Goudy Schoolbook"] = true;
  35228. t["Goudy Pro Font"] = true;
  35229. t.Granjon = true;
  35230. t["Guardian Egyptian"] = true;
  35231. t.Heather = true;
  35232. t.Hercules = true;
  35233. t["High Tower Text"] = true;
  35234. t.Hiroshige = true;
  35235. t["Hoefler Text"] = true;
  35236. t["Humana Serif"] = true;
  35237. t.Imprint = true;
  35238. t["Ionic No. 5"] = true;
  35239. t.Janson = true;
  35240. t.Joanna = true;
  35241. t.Korinna = true;
  35242. t.Lexicon = true;
  35243. t["Liberation Serif"] = true;
  35244. t["Linux Libertine"] = true;
  35245. t.Literaturnaya = true;
  35246. t.Lucida = true;
  35247. t["Lucida Bright"] = true;
  35248. t.Melior = true;
  35249. t.Memphis = true;
  35250. t.Miller = true;
  35251. t.Minion = true;
  35252. t.Modern = true;
  35253. t["Mona Lisa"] = true;
  35254. t["Mrs Eaves"] = true;
  35255. t["MS Serif"] = true;
  35256. t["Museo Slab"] = true;
  35257. t["New York"] = true;
  35258. t["Nimbus Roman"] = true;
  35259. t["NPS Rawlinson Roadway"] = true;
  35260. t.NuptialScript = true;
  35261. t.Palatino = true;
  35262. t.Perpetua = true;
  35263. t.Plantin = true;
  35264. t["Plantin Schoolbook"] = true;
  35265. t.Playbill = true;
  35266. t["Poor Richard"] = true;
  35267. t["Rawlinson Roadway"] = true;
  35268. t.Renault = true;
  35269. t.Requiem = true;
  35270. t.Rockwell = true;
  35271. t.Roman = true;
  35272. t["Rotis Serif"] = true;
  35273. t.Sabon = true;
  35274. t.Scala = true;
  35275. t.Seagull = true;
  35276. t.Sistina = true;
  35277. t.Souvenir = true;
  35278. t.STIX = true;
  35279. t["Stone Informal"] = true;
  35280. t["Stone Serif"] = true;
  35281. t.Sylfaen = true;
  35282. t.Times = true;
  35283. t.Trajan = true;
  35284. t["Trinité"] = true;
  35285. t["Trump Mediaeval"] = true;
  35286. t.Utopia = true;
  35287. t["Vale Type"] = true;
  35288. t["Bitstream Vera"] = true;
  35289. t["Vera Serif"] = true;
  35290. t.Versailles = true;
  35291. t.Wanted = true;
  35292. t.Weiss = true;
  35293. t["Wide Latin"] = true;
  35294. t.Windsor = true;
  35295. t.XITS = true;
  35296. });
  35297. exports.getSerifFonts = getSerifFonts;
  35298. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35299. t.Dingbats = true;
  35300. t.Symbol = true;
  35301. t.ZapfDingbats = true;
  35302. });
  35303. exports.getSymbolsFonts = getSymbolsFonts;
  35304. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35305. t[2] = 10;
  35306. t[3] = 32;
  35307. t[4] = 33;
  35308. t[5] = 34;
  35309. t[6] = 35;
  35310. t[7] = 36;
  35311. t[8] = 37;
  35312. t[9] = 38;
  35313. t[10] = 39;
  35314. t[11] = 40;
  35315. t[12] = 41;
  35316. t[13] = 42;
  35317. t[14] = 43;
  35318. t[15] = 44;
  35319. t[16] = 45;
  35320. t[17] = 46;
  35321. t[18] = 47;
  35322. t[19] = 48;
  35323. t[20] = 49;
  35324. t[21] = 50;
  35325. t[22] = 51;
  35326. t[23] = 52;
  35327. t[24] = 53;
  35328. t[25] = 54;
  35329. t[26] = 55;
  35330. t[27] = 56;
  35331. t[28] = 57;
  35332. t[29] = 58;
  35333. t[30] = 894;
  35334. t[31] = 60;
  35335. t[32] = 61;
  35336. t[33] = 62;
  35337. t[34] = 63;
  35338. t[35] = 64;
  35339. t[36] = 65;
  35340. t[37] = 66;
  35341. t[38] = 67;
  35342. t[39] = 68;
  35343. t[40] = 69;
  35344. t[41] = 70;
  35345. t[42] = 71;
  35346. t[43] = 72;
  35347. t[44] = 73;
  35348. t[45] = 74;
  35349. t[46] = 75;
  35350. t[47] = 76;
  35351. t[48] = 77;
  35352. t[49] = 78;
  35353. t[50] = 79;
  35354. t[51] = 80;
  35355. t[52] = 81;
  35356. t[53] = 82;
  35357. t[54] = 83;
  35358. t[55] = 84;
  35359. t[56] = 85;
  35360. t[57] = 86;
  35361. t[58] = 87;
  35362. t[59] = 88;
  35363. t[60] = 89;
  35364. t[61] = 90;
  35365. t[62] = 91;
  35366. t[63] = 92;
  35367. t[64] = 93;
  35368. t[65] = 94;
  35369. t[66] = 95;
  35370. t[67] = 96;
  35371. t[68] = 97;
  35372. t[69] = 98;
  35373. t[70] = 99;
  35374. t[71] = 100;
  35375. t[72] = 101;
  35376. t[73] = 102;
  35377. t[74] = 103;
  35378. t[75] = 104;
  35379. t[76] = 105;
  35380. t[77] = 106;
  35381. t[78] = 107;
  35382. t[79] = 108;
  35383. t[80] = 109;
  35384. t[81] = 110;
  35385. t[82] = 111;
  35386. t[83] = 112;
  35387. t[84] = 113;
  35388. t[85] = 114;
  35389. t[86] = 115;
  35390. t[87] = 116;
  35391. t[88] = 117;
  35392. t[89] = 118;
  35393. t[90] = 119;
  35394. t[91] = 120;
  35395. t[92] = 121;
  35396. t[93] = 122;
  35397. t[94] = 123;
  35398. t[95] = 124;
  35399. t[96] = 125;
  35400. t[97] = 126;
  35401. t[98] = 196;
  35402. t[99] = 197;
  35403. t[100] = 199;
  35404. t[101] = 201;
  35405. t[102] = 209;
  35406. t[103] = 214;
  35407. t[104] = 220;
  35408. t[105] = 225;
  35409. t[106] = 224;
  35410. t[107] = 226;
  35411. t[108] = 228;
  35412. t[109] = 227;
  35413. t[110] = 229;
  35414. t[111] = 231;
  35415. t[112] = 233;
  35416. t[113] = 232;
  35417. t[114] = 234;
  35418. t[115] = 235;
  35419. t[116] = 237;
  35420. t[117] = 236;
  35421. t[118] = 238;
  35422. t[119] = 239;
  35423. t[120] = 241;
  35424. t[121] = 243;
  35425. t[122] = 242;
  35426. t[123] = 244;
  35427. t[124] = 246;
  35428. t[125] = 245;
  35429. t[126] = 250;
  35430. t[127] = 249;
  35431. t[128] = 251;
  35432. t[129] = 252;
  35433. t[130] = 8224;
  35434. t[131] = 176;
  35435. t[132] = 162;
  35436. t[133] = 163;
  35437. t[134] = 167;
  35438. t[135] = 8226;
  35439. t[136] = 182;
  35440. t[137] = 223;
  35441. t[138] = 174;
  35442. t[139] = 169;
  35443. t[140] = 8482;
  35444. t[141] = 180;
  35445. t[142] = 168;
  35446. t[143] = 8800;
  35447. t[144] = 198;
  35448. t[145] = 216;
  35449. t[146] = 8734;
  35450. t[147] = 177;
  35451. t[148] = 8804;
  35452. t[149] = 8805;
  35453. t[150] = 165;
  35454. t[151] = 181;
  35455. t[152] = 8706;
  35456. t[153] = 8721;
  35457. t[154] = 8719;
  35458. t[156] = 8747;
  35459. t[157] = 170;
  35460. t[158] = 186;
  35461. t[159] = 8486;
  35462. t[160] = 230;
  35463. t[161] = 248;
  35464. t[162] = 191;
  35465. t[163] = 161;
  35466. t[164] = 172;
  35467. t[165] = 8730;
  35468. t[166] = 402;
  35469. t[167] = 8776;
  35470. t[168] = 8710;
  35471. t[169] = 171;
  35472. t[170] = 187;
  35473. t[171] = 8230;
  35474. t[210] = 218;
  35475. t[223] = 711;
  35476. t[224] = 321;
  35477. t[225] = 322;
  35478. t[227] = 353;
  35479. t[229] = 382;
  35480. t[234] = 253;
  35481. t[252] = 263;
  35482. t[253] = 268;
  35483. t[254] = 269;
  35484. t[258] = 258;
  35485. t[260] = 260;
  35486. t[261] = 261;
  35487. t[265] = 280;
  35488. t[266] = 281;
  35489. t[268] = 283;
  35490. t[269] = 313;
  35491. t[275] = 323;
  35492. t[276] = 324;
  35493. t[278] = 328;
  35494. t[284] = 345;
  35495. t[285] = 346;
  35496. t[286] = 347;
  35497. t[292] = 367;
  35498. t[295] = 377;
  35499. t[296] = 378;
  35500. t[298] = 380;
  35501. t[305] = 963;
  35502. t[306] = 964;
  35503. t[307] = 966;
  35504. t[308] = 8215;
  35505. t[309] = 8252;
  35506. t[310] = 8319;
  35507. t[311] = 8359;
  35508. t[312] = 8592;
  35509. t[313] = 8593;
  35510. t[337] = 9552;
  35511. t[493] = 1039;
  35512. t[494] = 1040;
  35513. t[705] = 1524;
  35514. t[706] = 8362;
  35515. t[710] = 64288;
  35516. t[711] = 64298;
  35517. t[759] = 1617;
  35518. t[761] = 1776;
  35519. t[763] = 1778;
  35520. t[775] = 1652;
  35521. t[777] = 1764;
  35522. t[778] = 1780;
  35523. t[779] = 1781;
  35524. t[780] = 1782;
  35525. t[782] = 771;
  35526. t[783] = 64726;
  35527. t[786] = 8363;
  35528. t[788] = 8532;
  35529. t[790] = 768;
  35530. t[791] = 769;
  35531. t[792] = 768;
  35532. t[795] = 803;
  35533. t[797] = 64336;
  35534. t[798] = 64337;
  35535. t[799] = 64342;
  35536. t[800] = 64343;
  35537. t[801] = 64344;
  35538. t[802] = 64345;
  35539. t[803] = 64362;
  35540. t[804] = 64363;
  35541. t[805] = 64364;
  35542. t[2424] = 7821;
  35543. t[2425] = 7822;
  35544. t[2426] = 7823;
  35545. t[2427] = 7824;
  35546. t[2428] = 7825;
  35547. t[2429] = 7826;
  35548. t[2430] = 7827;
  35549. t[2433] = 7682;
  35550. t[2678] = 8045;
  35551. t[2679] = 8046;
  35552. t[2830] = 1552;
  35553. t[2838] = 686;
  35554. t[2840] = 751;
  35555. t[2842] = 753;
  35556. t[2843] = 754;
  35557. t[2844] = 755;
  35558. t[2846] = 757;
  35559. t[2856] = 767;
  35560. t[2857] = 848;
  35561. t[2858] = 849;
  35562. t[2862] = 853;
  35563. t[2863] = 854;
  35564. t[2864] = 855;
  35565. t[2865] = 861;
  35566. t[2866] = 862;
  35567. t[2906] = 7460;
  35568. t[2908] = 7462;
  35569. t[2909] = 7463;
  35570. t[2910] = 7464;
  35571. t[2912] = 7466;
  35572. t[2913] = 7467;
  35573. t[2914] = 7468;
  35574. t[2916] = 7470;
  35575. t[2917] = 7471;
  35576. t[2918] = 7472;
  35577. t[2920] = 7474;
  35578. t[2921] = 7475;
  35579. t[2922] = 7476;
  35580. t[2924] = 7478;
  35581. t[2925] = 7479;
  35582. t[2926] = 7480;
  35583. t[2928] = 7482;
  35584. t[2929] = 7483;
  35585. t[2930] = 7484;
  35586. t[2932] = 7486;
  35587. t[2933] = 7487;
  35588. t[2934] = 7488;
  35589. t[2936] = 7490;
  35590. t[2937] = 7491;
  35591. t[2938] = 7492;
  35592. t[2940] = 7494;
  35593. t[2941] = 7495;
  35594. t[2942] = 7496;
  35595. t[2944] = 7498;
  35596. t[2946] = 7500;
  35597. t[2948] = 7502;
  35598. t[2950] = 7504;
  35599. t[2951] = 7505;
  35600. t[2952] = 7506;
  35601. t[2954] = 7508;
  35602. t[2955] = 7509;
  35603. t[2956] = 7510;
  35604. t[2958] = 7512;
  35605. t[2959] = 7513;
  35606. t[2960] = 7514;
  35607. t[2962] = 7516;
  35608. t[2963] = 7517;
  35609. t[2964] = 7518;
  35610. t[2966] = 7520;
  35611. t[2967] = 7521;
  35612. t[2968] = 7522;
  35613. t[2970] = 7524;
  35614. t[2971] = 7525;
  35615. t[2972] = 7526;
  35616. t[2974] = 7528;
  35617. t[2975] = 7529;
  35618. t[2976] = 7530;
  35619. t[2978] = 1537;
  35620. t[2979] = 1538;
  35621. t[2980] = 1539;
  35622. t[2982] = 1549;
  35623. t[2983] = 1551;
  35624. t[2984] = 1552;
  35625. t[2986] = 1554;
  35626. t[2987] = 1555;
  35627. t[2988] = 1556;
  35628. t[2990] = 1623;
  35629. t[2991] = 1624;
  35630. t[2995] = 1775;
  35631. t[2999] = 1791;
  35632. t[3002] = 64290;
  35633. t[3003] = 64291;
  35634. t[3004] = 64292;
  35635. t[3006] = 64294;
  35636. t[3007] = 64295;
  35637. t[3008] = 64296;
  35638. t[3011] = 1900;
  35639. t[3014] = 8223;
  35640. t[3015] = 8244;
  35641. t[3017] = 7532;
  35642. t[3018] = 7533;
  35643. t[3019] = 7534;
  35644. t[3075] = 7590;
  35645. t[3076] = 7591;
  35646. t[3079] = 7594;
  35647. t[3080] = 7595;
  35648. t[3083] = 7598;
  35649. t[3084] = 7599;
  35650. t[3087] = 7602;
  35651. t[3088] = 7603;
  35652. t[3091] = 7606;
  35653. t[3092] = 7607;
  35654. t[3095] = 7610;
  35655. t[3096] = 7611;
  35656. t[3099] = 7614;
  35657. t[3100] = 7615;
  35658. t[3103] = 7618;
  35659. t[3104] = 7619;
  35660. t[3107] = 8337;
  35661. t[3108] = 8338;
  35662. t[3116] = 1884;
  35663. t[3119] = 1885;
  35664. t[3120] = 1885;
  35665. t[3123] = 1886;
  35666. t[3124] = 1886;
  35667. t[3127] = 1887;
  35668. t[3128] = 1887;
  35669. t[3131] = 1888;
  35670. t[3132] = 1888;
  35671. t[3135] = 1889;
  35672. t[3136] = 1889;
  35673. t[3139] = 1890;
  35674. t[3140] = 1890;
  35675. t[3143] = 1891;
  35676. t[3144] = 1891;
  35677. t[3147] = 1892;
  35678. t[3148] = 1892;
  35679. t[3153] = 580;
  35680. t[3154] = 581;
  35681. t[3157] = 584;
  35682. t[3158] = 585;
  35683. t[3161] = 588;
  35684. t[3162] = 589;
  35685. t[3165] = 891;
  35686. t[3166] = 892;
  35687. t[3169] = 1274;
  35688. t[3170] = 1275;
  35689. t[3173] = 1278;
  35690. t[3174] = 1279;
  35691. t[3181] = 7622;
  35692. t[3182] = 7623;
  35693. t[3282] = 11799;
  35694. t[3316] = 578;
  35695. t[3379] = 42785;
  35696. t[3393] = 1159;
  35697. t[3416] = 8377;
  35698. });
  35699. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  35700. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  35701. t[227] = 322;
  35702. t[264] = 261;
  35703. t[291] = 346;
  35704. });
  35705. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  35706. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  35707. t[1] = 32;
  35708. t[4] = 65;
  35709. t[17] = 66;
  35710. t[18] = 67;
  35711. t[24] = 68;
  35712. t[28] = 69;
  35713. t[38] = 70;
  35714. t[39] = 71;
  35715. t[44] = 72;
  35716. t[47] = 73;
  35717. t[58] = 74;
  35718. t[60] = 75;
  35719. t[62] = 76;
  35720. t[68] = 77;
  35721. t[69] = 78;
  35722. t[75] = 79;
  35723. t[87] = 80;
  35724. t[89] = 81;
  35725. t[90] = 82;
  35726. t[94] = 83;
  35727. t[100] = 84;
  35728. t[104] = 85;
  35729. t[115] = 86;
  35730. t[116] = 87;
  35731. t[121] = 88;
  35732. t[122] = 89;
  35733. t[127] = 90;
  35734. t[258] = 97;
  35735. t[268] = 261;
  35736. t[271] = 98;
  35737. t[272] = 99;
  35738. t[273] = 263;
  35739. t[282] = 100;
  35740. t[286] = 101;
  35741. t[295] = 281;
  35742. t[296] = 102;
  35743. t[336] = 103;
  35744. t[346] = 104;
  35745. t[349] = 105;
  35746. t[361] = 106;
  35747. t[364] = 107;
  35748. t[367] = 108;
  35749. t[371] = 322;
  35750. t[373] = 109;
  35751. t[374] = 110;
  35752. t[381] = 111;
  35753. t[383] = 243;
  35754. t[393] = 112;
  35755. t[395] = 113;
  35756. t[396] = 114;
  35757. t[400] = 115;
  35758. t[401] = 347;
  35759. t[410] = 116;
  35760. t[437] = 117;
  35761. t[448] = 118;
  35762. t[449] = 119;
  35763. t[454] = 120;
  35764. t[455] = 121;
  35765. t[460] = 122;
  35766. t[463] = 380;
  35767. t[853] = 44;
  35768. t[855] = 58;
  35769. t[856] = 46;
  35770. t[876] = 47;
  35771. t[878] = 45;
  35772. t[882] = 45;
  35773. t[894] = 40;
  35774. t[895] = 41;
  35775. t[896] = 91;
  35776. t[897] = 93;
  35777. t[923] = 64;
  35778. t[1004] = 48;
  35779. t[1005] = 49;
  35780. t[1006] = 50;
  35781. t[1007] = 51;
  35782. t[1008] = 52;
  35783. t[1009] = 53;
  35784. t[1010] = 54;
  35785. t[1011] = 55;
  35786. t[1012] = 56;
  35787. t[1013] = 57;
  35788. t[1081] = 37;
  35789. t[1085] = 43;
  35790. t[1086] = 45;
  35791. });
  35792. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  35793. function getStandardFontName(name) {
  35794. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  35795. const stdFontMap = getStdFontMap();
  35796. return stdFontMap[fontName];
  35797. }
  35798. /***/ }),
  35799. /* 42 */
  35800. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35801. Object.defineProperty(exports, "__esModule", ({
  35802. value: true
  35803. }));
  35804. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  35805. var _util = __w_pdfjs_require__(2);
  35806. class ToUnicodeMap {
  35807. constructor(cmap = []) {
  35808. this._map = cmap;
  35809. }
  35810. get length() {
  35811. return this._map.length;
  35812. }
  35813. forEach(callback) {
  35814. for (const charCode in this._map) {
  35815. callback(charCode, this._map[charCode].charCodeAt(0));
  35816. }
  35817. }
  35818. has(i) {
  35819. return this._map[i] !== undefined;
  35820. }
  35821. get(i) {
  35822. return this._map[i];
  35823. }
  35824. charCodeOf(value) {
  35825. const map = this._map;
  35826. if (map.length <= 0x10000) {
  35827. return map.indexOf(value);
  35828. }
  35829. for (const charCode in map) {
  35830. if (map[charCode] === value) {
  35831. return charCode | 0;
  35832. }
  35833. }
  35834. return -1;
  35835. }
  35836. amend(map) {
  35837. for (const charCode in map) {
  35838. this._map[charCode] = map[charCode];
  35839. }
  35840. }
  35841. }
  35842. exports.ToUnicodeMap = ToUnicodeMap;
  35843. class IdentityToUnicodeMap {
  35844. constructor(firstChar, lastChar) {
  35845. this.firstChar = firstChar;
  35846. this.lastChar = lastChar;
  35847. }
  35848. get length() {
  35849. return this.lastChar + 1 - this.firstChar;
  35850. }
  35851. forEach(callback) {
  35852. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  35853. callback(i, i);
  35854. }
  35855. }
  35856. has(i) {
  35857. return this.firstChar <= i && i <= this.lastChar;
  35858. }
  35859. get(i) {
  35860. if (this.firstChar <= i && i <= this.lastChar) {
  35861. return String.fromCharCode(i);
  35862. }
  35863. return undefined;
  35864. }
  35865. charCodeOf(v) {
  35866. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  35867. }
  35868. amend(map) {
  35869. (0, _util.unreachable)("Should not call amend()");
  35870. }
  35871. }
  35872. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  35873. /***/ }),
  35874. /* 43 */
  35875. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35876. Object.defineProperty(exports, "__esModule", ({
  35877. value: true
  35878. }));
  35879. exports.CFFFont = void 0;
  35880. var _cff_parser = __w_pdfjs_require__(35);
  35881. var _fonts_utils = __w_pdfjs_require__(38);
  35882. var _util = __w_pdfjs_require__(2);
  35883. class CFFFont {
  35884. constructor(file, properties) {
  35885. this.properties = properties;
  35886. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  35887. this.cff = parser.parse();
  35888. this.cff.duplicateFirstGlyph();
  35889. const compiler = new _cff_parser.CFFCompiler(this.cff);
  35890. this.seacs = this.cff.seacs;
  35891. try {
  35892. this.data = compiler.compile();
  35893. } catch (e) {
  35894. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  35895. this.data = file;
  35896. }
  35897. this._createBuiltInEncoding();
  35898. }
  35899. get numGlyphs() {
  35900. return this.cff.charStrings.count;
  35901. }
  35902. getCharset() {
  35903. return this.cff.charset.charset;
  35904. }
  35905. getGlyphMapping() {
  35906. const cff = this.cff;
  35907. const properties = this.properties;
  35908. const charsets = cff.charset.charset;
  35909. let charCodeToGlyphId;
  35910. let glyphId;
  35911. if (properties.composite) {
  35912. charCodeToGlyphId = Object.create(null);
  35913. let charCode;
  35914. if (cff.isCIDFont) {
  35915. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  35916. const cid = charsets[glyphId];
  35917. charCode = properties.cMap.charCodeOf(cid);
  35918. charCodeToGlyphId[charCode] = glyphId;
  35919. }
  35920. } else {
  35921. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  35922. charCode = properties.cMap.charCodeOf(glyphId);
  35923. charCodeToGlyphId[charCode] = glyphId;
  35924. }
  35925. }
  35926. return charCodeToGlyphId;
  35927. }
  35928. let encoding = cff.encoding ? cff.encoding.encoding : null;
  35929. if (properties.isInternalFont) {
  35930. encoding = properties.defaultEncoding;
  35931. }
  35932. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  35933. return charCodeToGlyphId;
  35934. }
  35935. hasGlyphId(id) {
  35936. return this.cff.hasGlyphId(id);
  35937. }
  35938. _createBuiltInEncoding() {
  35939. const {
  35940. charset,
  35941. encoding
  35942. } = this.cff;
  35943. if (!charset || !encoding) {
  35944. return;
  35945. }
  35946. const charsets = charset.charset,
  35947. encodings = encoding.encoding;
  35948. const map = [];
  35949. for (const charCode in encodings) {
  35950. const glyphId = encodings[charCode];
  35951. if (glyphId >= 0) {
  35952. const glyphName = charsets[glyphId];
  35953. if (glyphName) {
  35954. map[charCode] = glyphName;
  35955. }
  35956. }
  35957. }
  35958. if (map.length > 0) {
  35959. this.properties.builtInEncoding = map;
  35960. }
  35961. }
  35962. }
  35963. exports.CFFFont = CFFFont;
  35964. /***/ }),
  35965. /* 44 */
  35966. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35967. Object.defineProperty(exports, "__esModule", ({
  35968. value: true
  35969. }));
  35970. exports.FontRendererFactory = void 0;
  35971. var _util = __w_pdfjs_require__(2);
  35972. var _cff_parser = __w_pdfjs_require__(35);
  35973. var _glyphlist = __w_pdfjs_require__(39);
  35974. var _encodings = __w_pdfjs_require__(37);
  35975. var _stream = __w_pdfjs_require__(10);
  35976. function getLong(data, offset) {
  35977. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  35978. }
  35979. function getUshort(data, offset) {
  35980. return data[offset] << 8 | data[offset + 1];
  35981. }
  35982. function getSubroutineBias(subrs) {
  35983. const numSubrs = subrs.length;
  35984. let bias = 32768;
  35985. if (numSubrs < 1240) {
  35986. bias = 107;
  35987. } else if (numSubrs < 33900) {
  35988. bias = 1131;
  35989. }
  35990. return bias;
  35991. }
  35992. function parseCmap(data, start, end) {
  35993. const offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  35994. const format = getUshort(data, start + offset);
  35995. let ranges, p, i;
  35996. if (format === 4) {
  35997. getUshort(data, start + offset + 2);
  35998. const segCount = getUshort(data, start + offset + 6) >> 1;
  35999. p = start + offset + 14;
  36000. ranges = [];
  36001. for (i = 0; i < segCount; i++, p += 2) {
  36002. ranges[i] = {
  36003. end: getUshort(data, p)
  36004. };
  36005. }
  36006. p += 2;
  36007. for (i = 0; i < segCount; i++, p += 2) {
  36008. ranges[i].start = getUshort(data, p);
  36009. }
  36010. for (i = 0; i < segCount; i++, p += 2) {
  36011. ranges[i].idDelta = getUshort(data, p);
  36012. }
  36013. for (i = 0; i < segCount; i++, p += 2) {
  36014. let idOffset = getUshort(data, p);
  36015. if (idOffset === 0) {
  36016. continue;
  36017. }
  36018. ranges[i].ids = [];
  36019. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  36020. ranges[i].ids[j] = getUshort(data, p + idOffset);
  36021. idOffset += 2;
  36022. }
  36023. }
  36024. return ranges;
  36025. } else if (format === 12) {
  36026. getLong(data, start + offset + 4);
  36027. const groups = getLong(data, start + offset + 12);
  36028. p = start + offset + 16;
  36029. ranges = [];
  36030. for (i = 0; i < groups; i++) {
  36031. ranges.push({
  36032. start: getLong(data, p),
  36033. end: getLong(data, p + 4),
  36034. idDelta: getLong(data, p + 8) - getLong(data, p)
  36035. });
  36036. p += 12;
  36037. }
  36038. return ranges;
  36039. }
  36040. throw new _util.FormatError(`unsupported cmap: ${format}`);
  36041. }
  36042. function parseCff(data, start, end, seacAnalysisEnabled) {
  36043. const properties = {};
  36044. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  36045. const cff = parser.parse();
  36046. return {
  36047. glyphs: cff.charStrings.objects,
  36048. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  36049. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  36050. isCFFCIDFont: cff.isCIDFont,
  36051. fdSelect: cff.fdSelect,
  36052. fdArray: cff.fdArray
  36053. };
  36054. }
  36055. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  36056. let itemSize, itemDecode;
  36057. if (isGlyphLocationsLong) {
  36058. itemSize = 4;
  36059. itemDecode = function fontItemDecodeLong(data, offset) {
  36060. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  36061. };
  36062. } else {
  36063. itemSize = 2;
  36064. itemDecode = function fontItemDecode(data, offset) {
  36065. return data[offset] << 9 | data[offset + 1] << 1;
  36066. };
  36067. }
  36068. const glyphs = [];
  36069. let startOffset = itemDecode(loca, 0);
  36070. for (let j = itemSize; j < loca.length; j += itemSize) {
  36071. const endOffset = itemDecode(loca, j);
  36072. glyphs.push(glyf.subarray(startOffset, endOffset));
  36073. startOffset = endOffset;
  36074. }
  36075. return glyphs;
  36076. }
  36077. function lookupCmap(ranges, unicode) {
  36078. const code = unicode.codePointAt(0);
  36079. let gid = 0,
  36080. l = 0,
  36081. r = ranges.length - 1;
  36082. while (l < r) {
  36083. const c = l + r + 1 >> 1;
  36084. if (code < ranges[c].start) {
  36085. r = c - 1;
  36086. } else {
  36087. l = c;
  36088. }
  36089. }
  36090. if (ranges[l].start <= code && code <= ranges[l].end) {
  36091. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  36092. }
  36093. return {
  36094. charCode: code,
  36095. glyphId: gid
  36096. };
  36097. }
  36098. function compileGlyf(code, cmds, font) {
  36099. function moveTo(x, y) {
  36100. cmds.push({
  36101. cmd: "moveTo",
  36102. args: [x, y]
  36103. });
  36104. }
  36105. function lineTo(x, y) {
  36106. cmds.push({
  36107. cmd: "lineTo",
  36108. args: [x, y]
  36109. });
  36110. }
  36111. function quadraticCurveTo(xa, ya, x, y) {
  36112. cmds.push({
  36113. cmd: "quadraticCurveTo",
  36114. args: [xa, ya, x, y]
  36115. });
  36116. }
  36117. let i = 0;
  36118. const numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  36119. let flags;
  36120. let x = 0,
  36121. y = 0;
  36122. i += 10;
  36123. if (numberOfContours < 0) {
  36124. do {
  36125. flags = code[i] << 8 | code[i + 1];
  36126. const glyphIndex = code[i + 2] << 8 | code[i + 3];
  36127. i += 4;
  36128. let arg1, arg2;
  36129. if (flags & 0x01) {
  36130. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  36131. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  36132. i += 4;
  36133. } else {
  36134. arg1 = code[i++];
  36135. arg2 = code[i++];
  36136. }
  36137. if (flags & 0x02) {
  36138. x = arg1;
  36139. y = arg2;
  36140. } else {
  36141. x = 0;
  36142. y = 0;
  36143. }
  36144. let scaleX = 1,
  36145. scaleY = 1,
  36146. scale01 = 0,
  36147. scale10 = 0;
  36148. if (flags & 0x08) {
  36149. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  36150. i += 2;
  36151. } else if (flags & 0x40) {
  36152. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  36153. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  36154. i += 4;
  36155. } else if (flags & 0x80) {
  36156. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  36157. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  36158. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  36159. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  36160. i += 8;
  36161. }
  36162. const subglyph = font.glyphs[glyphIndex];
  36163. if (subglyph) {
  36164. cmds.push({
  36165. cmd: "save"
  36166. }, {
  36167. cmd: "transform",
  36168. args: [scaleX, scale01, scale10, scaleY, x, y]
  36169. });
  36170. compileGlyf(subglyph, cmds, font);
  36171. cmds.push({
  36172. cmd: "restore"
  36173. });
  36174. }
  36175. } while (flags & 0x20);
  36176. } else {
  36177. const endPtsOfContours = [];
  36178. let j, jj;
  36179. for (j = 0; j < numberOfContours; j++) {
  36180. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  36181. i += 2;
  36182. }
  36183. const instructionLength = code[i] << 8 | code[i + 1];
  36184. i += 2 + instructionLength;
  36185. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  36186. const points = [];
  36187. while (points.length < numberOfPoints) {
  36188. flags = code[i++];
  36189. let repeat = 1;
  36190. if (flags & 0x08) {
  36191. repeat += code[i++];
  36192. }
  36193. while (repeat-- > 0) {
  36194. points.push({
  36195. flags
  36196. });
  36197. }
  36198. }
  36199. for (j = 0; j < numberOfPoints; j++) {
  36200. switch (points[j].flags & 0x12) {
  36201. case 0x00:
  36202. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  36203. i += 2;
  36204. break;
  36205. case 0x02:
  36206. x -= code[i++];
  36207. break;
  36208. case 0x12:
  36209. x += code[i++];
  36210. break;
  36211. }
  36212. points[j].x = x;
  36213. }
  36214. for (j = 0; j < numberOfPoints; j++) {
  36215. switch (points[j].flags & 0x24) {
  36216. case 0x00:
  36217. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  36218. i += 2;
  36219. break;
  36220. case 0x04:
  36221. y -= code[i++];
  36222. break;
  36223. case 0x24:
  36224. y += code[i++];
  36225. break;
  36226. }
  36227. points[j].y = y;
  36228. }
  36229. let startPoint = 0;
  36230. for (i = 0; i < numberOfContours; i++) {
  36231. const endPoint = endPtsOfContours[i];
  36232. const contour = points.slice(startPoint, endPoint + 1);
  36233. if (contour[0].flags & 1) {
  36234. contour.push(contour[0]);
  36235. } else if (contour[contour.length - 1].flags & 1) {
  36236. contour.unshift(contour[contour.length - 1]);
  36237. } else {
  36238. const p = {
  36239. flags: 1,
  36240. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  36241. y: (contour[0].y + contour[contour.length - 1].y) / 2
  36242. };
  36243. contour.unshift(p);
  36244. contour.push(p);
  36245. }
  36246. moveTo(contour[0].x, contour[0].y);
  36247. for (j = 1, jj = contour.length; j < jj; j++) {
  36248. if (contour[j].flags & 1) {
  36249. lineTo(contour[j].x, contour[j].y);
  36250. } else if (contour[j + 1].flags & 1) {
  36251. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  36252. j++;
  36253. } else {
  36254. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  36255. }
  36256. }
  36257. startPoint = endPoint + 1;
  36258. }
  36259. }
  36260. }
  36261. function compileCharString(charStringCode, cmds, font, glyphId) {
  36262. function moveTo(x, y) {
  36263. cmds.push({
  36264. cmd: "moveTo",
  36265. args: [x, y]
  36266. });
  36267. }
  36268. function lineTo(x, y) {
  36269. cmds.push({
  36270. cmd: "lineTo",
  36271. args: [x, y]
  36272. });
  36273. }
  36274. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  36275. cmds.push({
  36276. cmd: "bezierCurveTo",
  36277. args: [x1, y1, x2, y2, x, y]
  36278. });
  36279. }
  36280. const stack = [];
  36281. let x = 0,
  36282. y = 0;
  36283. let stems = 0;
  36284. function parse(code) {
  36285. let i = 0;
  36286. while (i < code.length) {
  36287. let stackClean = false;
  36288. let v = code[i++];
  36289. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  36290. switch (v) {
  36291. case 1:
  36292. stems += stack.length >> 1;
  36293. stackClean = true;
  36294. break;
  36295. case 3:
  36296. stems += stack.length >> 1;
  36297. stackClean = true;
  36298. break;
  36299. case 4:
  36300. y += stack.pop();
  36301. moveTo(x, y);
  36302. stackClean = true;
  36303. break;
  36304. case 5:
  36305. while (stack.length > 0) {
  36306. x += stack.shift();
  36307. y += stack.shift();
  36308. lineTo(x, y);
  36309. }
  36310. break;
  36311. case 6:
  36312. while (stack.length > 0) {
  36313. x += stack.shift();
  36314. lineTo(x, y);
  36315. if (stack.length === 0) {
  36316. break;
  36317. }
  36318. y += stack.shift();
  36319. lineTo(x, y);
  36320. }
  36321. break;
  36322. case 7:
  36323. while (stack.length > 0) {
  36324. y += stack.shift();
  36325. lineTo(x, y);
  36326. if (stack.length === 0) {
  36327. break;
  36328. }
  36329. x += stack.shift();
  36330. lineTo(x, y);
  36331. }
  36332. break;
  36333. case 8:
  36334. while (stack.length > 0) {
  36335. xa = x + stack.shift();
  36336. ya = y + stack.shift();
  36337. xb = xa + stack.shift();
  36338. yb = ya + stack.shift();
  36339. x = xb + stack.shift();
  36340. y = yb + stack.shift();
  36341. bezierCurveTo(xa, ya, xb, yb, x, y);
  36342. }
  36343. break;
  36344. case 10:
  36345. n = stack.pop();
  36346. subrCode = null;
  36347. if (font.isCFFCIDFont) {
  36348. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  36349. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  36350. const fontDict = font.fdArray[fdIndex];
  36351. let subrs;
  36352. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  36353. subrs = fontDict.privateDict.subrsIndex.objects;
  36354. }
  36355. if (subrs) {
  36356. n += getSubroutineBias(subrs);
  36357. subrCode = subrs[n];
  36358. }
  36359. } else {
  36360. (0, _util.warn)("Invalid fd index for glyph index.");
  36361. }
  36362. } else {
  36363. subrCode = font.subrs[n + font.subrsBias];
  36364. }
  36365. if (subrCode) {
  36366. parse(subrCode);
  36367. }
  36368. break;
  36369. case 11:
  36370. return;
  36371. case 12:
  36372. v = code[i++];
  36373. switch (v) {
  36374. case 34:
  36375. xa = x + stack.shift();
  36376. xb = xa + stack.shift();
  36377. y1 = y + stack.shift();
  36378. x = xb + stack.shift();
  36379. bezierCurveTo(xa, y, xb, y1, x, y1);
  36380. xa = x + stack.shift();
  36381. xb = xa + stack.shift();
  36382. x = xb + stack.shift();
  36383. bezierCurveTo(xa, y1, xb, y, x, y);
  36384. break;
  36385. case 35:
  36386. xa = x + stack.shift();
  36387. ya = y + stack.shift();
  36388. xb = xa + stack.shift();
  36389. yb = ya + stack.shift();
  36390. x = xb + stack.shift();
  36391. y = yb + stack.shift();
  36392. bezierCurveTo(xa, ya, xb, yb, x, y);
  36393. xa = x + stack.shift();
  36394. ya = y + stack.shift();
  36395. xb = xa + stack.shift();
  36396. yb = ya + stack.shift();
  36397. x = xb + stack.shift();
  36398. y = yb + stack.shift();
  36399. bezierCurveTo(xa, ya, xb, yb, x, y);
  36400. stack.pop();
  36401. break;
  36402. case 36:
  36403. xa = x + stack.shift();
  36404. y1 = y + stack.shift();
  36405. xb = xa + stack.shift();
  36406. y2 = y1 + stack.shift();
  36407. x = xb + stack.shift();
  36408. bezierCurveTo(xa, y1, xb, y2, x, y2);
  36409. xa = x + stack.shift();
  36410. xb = xa + stack.shift();
  36411. y3 = y2 + stack.shift();
  36412. x = xb + stack.shift();
  36413. bezierCurveTo(xa, y2, xb, y3, x, y);
  36414. break;
  36415. case 37:
  36416. const x0 = x,
  36417. y0 = y;
  36418. xa = x + stack.shift();
  36419. ya = y + stack.shift();
  36420. xb = xa + stack.shift();
  36421. yb = ya + stack.shift();
  36422. x = xb + stack.shift();
  36423. y = yb + stack.shift();
  36424. bezierCurveTo(xa, ya, xb, yb, x, y);
  36425. xa = x + stack.shift();
  36426. ya = y + stack.shift();
  36427. xb = xa + stack.shift();
  36428. yb = ya + stack.shift();
  36429. x = xb;
  36430. y = yb;
  36431. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  36432. x += stack.shift();
  36433. } else {
  36434. y += stack.shift();
  36435. }
  36436. bezierCurveTo(xa, ya, xb, yb, x, y);
  36437. break;
  36438. default:
  36439. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  36440. }
  36441. break;
  36442. case 14:
  36443. if (stack.length >= 4) {
  36444. const achar = stack.pop();
  36445. const bchar = stack.pop();
  36446. y = stack.pop();
  36447. x = stack.pop();
  36448. cmds.push({
  36449. cmd: "save"
  36450. }, {
  36451. cmd: "translate",
  36452. args: [x, y]
  36453. });
  36454. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  36455. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  36456. cmds.push({
  36457. cmd: "restore"
  36458. });
  36459. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  36460. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  36461. }
  36462. return;
  36463. case 18:
  36464. stems += stack.length >> 1;
  36465. stackClean = true;
  36466. break;
  36467. case 19:
  36468. stems += stack.length >> 1;
  36469. i += stems + 7 >> 3;
  36470. stackClean = true;
  36471. break;
  36472. case 20:
  36473. stems += stack.length >> 1;
  36474. i += stems + 7 >> 3;
  36475. stackClean = true;
  36476. break;
  36477. case 21:
  36478. y += stack.pop();
  36479. x += stack.pop();
  36480. moveTo(x, y);
  36481. stackClean = true;
  36482. break;
  36483. case 22:
  36484. x += stack.pop();
  36485. moveTo(x, y);
  36486. stackClean = true;
  36487. break;
  36488. case 23:
  36489. stems += stack.length >> 1;
  36490. stackClean = true;
  36491. break;
  36492. case 24:
  36493. while (stack.length > 2) {
  36494. xa = x + stack.shift();
  36495. ya = y + stack.shift();
  36496. xb = xa + stack.shift();
  36497. yb = ya + stack.shift();
  36498. x = xb + stack.shift();
  36499. y = yb + stack.shift();
  36500. bezierCurveTo(xa, ya, xb, yb, x, y);
  36501. }
  36502. x += stack.shift();
  36503. y += stack.shift();
  36504. lineTo(x, y);
  36505. break;
  36506. case 25:
  36507. while (stack.length > 6) {
  36508. x += stack.shift();
  36509. y += stack.shift();
  36510. lineTo(x, y);
  36511. }
  36512. xa = x + stack.shift();
  36513. ya = y + stack.shift();
  36514. xb = xa + stack.shift();
  36515. yb = ya + stack.shift();
  36516. x = xb + stack.shift();
  36517. y = yb + stack.shift();
  36518. bezierCurveTo(xa, ya, xb, yb, x, y);
  36519. break;
  36520. case 26:
  36521. if (stack.length % 2) {
  36522. x += stack.shift();
  36523. }
  36524. while (stack.length > 0) {
  36525. xa = x;
  36526. ya = y + stack.shift();
  36527. xb = xa + stack.shift();
  36528. yb = ya + stack.shift();
  36529. x = xb;
  36530. y = yb + stack.shift();
  36531. bezierCurveTo(xa, ya, xb, yb, x, y);
  36532. }
  36533. break;
  36534. case 27:
  36535. if (stack.length % 2) {
  36536. y += stack.shift();
  36537. }
  36538. while (stack.length > 0) {
  36539. xa = x + stack.shift();
  36540. ya = y;
  36541. xb = xa + stack.shift();
  36542. yb = ya + stack.shift();
  36543. x = xb + stack.shift();
  36544. y = yb;
  36545. bezierCurveTo(xa, ya, xb, yb, x, y);
  36546. }
  36547. break;
  36548. case 28:
  36549. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  36550. i += 2;
  36551. break;
  36552. case 29:
  36553. n = stack.pop() + font.gsubrsBias;
  36554. subrCode = font.gsubrs[n];
  36555. if (subrCode) {
  36556. parse(subrCode);
  36557. }
  36558. break;
  36559. case 30:
  36560. while (stack.length > 0) {
  36561. xa = x;
  36562. ya = y + stack.shift();
  36563. xb = xa + stack.shift();
  36564. yb = ya + stack.shift();
  36565. x = xb + stack.shift();
  36566. y = yb + (stack.length === 1 ? stack.shift() : 0);
  36567. bezierCurveTo(xa, ya, xb, yb, x, y);
  36568. if (stack.length === 0) {
  36569. break;
  36570. }
  36571. xa = x + stack.shift();
  36572. ya = y;
  36573. xb = xa + stack.shift();
  36574. yb = ya + stack.shift();
  36575. y = yb + stack.shift();
  36576. x = xb + (stack.length === 1 ? stack.shift() : 0);
  36577. bezierCurveTo(xa, ya, xb, yb, x, y);
  36578. }
  36579. break;
  36580. case 31:
  36581. while (stack.length > 0) {
  36582. xa = x + stack.shift();
  36583. ya = y;
  36584. xb = xa + stack.shift();
  36585. yb = ya + stack.shift();
  36586. y = yb + stack.shift();
  36587. x = xb + (stack.length === 1 ? stack.shift() : 0);
  36588. bezierCurveTo(xa, ya, xb, yb, x, y);
  36589. if (stack.length === 0) {
  36590. break;
  36591. }
  36592. xa = x;
  36593. ya = y + stack.shift();
  36594. xb = xa + stack.shift();
  36595. yb = ya + stack.shift();
  36596. x = xb + stack.shift();
  36597. y = yb + (stack.length === 1 ? stack.shift() : 0);
  36598. bezierCurveTo(xa, ya, xb, yb, x, y);
  36599. }
  36600. break;
  36601. default:
  36602. if (v < 32) {
  36603. throw new _util.FormatError(`unknown operator: ${v}`);
  36604. }
  36605. if (v < 247) {
  36606. stack.push(v - 139);
  36607. } else if (v < 251) {
  36608. stack.push((v - 247) * 256 + code[i++] + 108);
  36609. } else if (v < 255) {
  36610. stack.push(-(v - 251) * 256 - code[i++] - 108);
  36611. } else {
  36612. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  36613. i += 4;
  36614. }
  36615. break;
  36616. }
  36617. if (stackClean) {
  36618. stack.length = 0;
  36619. }
  36620. }
  36621. }
  36622. parse(charStringCode);
  36623. }
  36624. const NOOP = [];
  36625. class CompiledFont {
  36626. constructor(fontMatrix) {
  36627. if (this.constructor === CompiledFont) {
  36628. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  36629. }
  36630. this.fontMatrix = fontMatrix;
  36631. this.compiledGlyphs = Object.create(null);
  36632. this.compiledCharCodeToGlyphId = Object.create(null);
  36633. }
  36634. getPathJs(unicode) {
  36635. const {
  36636. charCode,
  36637. glyphId
  36638. } = lookupCmap(this.cmap, unicode);
  36639. let fn = this.compiledGlyphs[glyphId];
  36640. if (!fn) {
  36641. try {
  36642. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  36643. this.compiledGlyphs[glyphId] = fn;
  36644. } catch (ex) {
  36645. this.compiledGlyphs[glyphId] = NOOP;
  36646. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  36647. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  36648. }
  36649. throw ex;
  36650. }
  36651. }
  36652. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  36653. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  36654. }
  36655. return fn;
  36656. }
  36657. compileGlyph(code, glyphId) {
  36658. if (!code || code.length === 0 || code[0] === 14) {
  36659. return NOOP;
  36660. }
  36661. let fontMatrix = this.fontMatrix;
  36662. if (this.isCFFCIDFont) {
  36663. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  36664. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  36665. const fontDict = this.fdArray[fdIndex];
  36666. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  36667. } else {
  36668. (0, _util.warn)("Invalid fd index for glyph index.");
  36669. }
  36670. }
  36671. const cmds = [{
  36672. cmd: "save"
  36673. }, {
  36674. cmd: "transform",
  36675. args: fontMatrix.slice()
  36676. }, {
  36677. cmd: "scale",
  36678. args: ["size", "-size"]
  36679. }];
  36680. this.compileGlyphImpl(code, cmds, glyphId);
  36681. cmds.push({
  36682. cmd: "restore"
  36683. });
  36684. return cmds;
  36685. }
  36686. compileGlyphImpl() {
  36687. (0, _util.unreachable)("Children classes should implement this.");
  36688. }
  36689. hasBuiltPath(unicode) {
  36690. const {
  36691. charCode,
  36692. glyphId
  36693. } = lookupCmap(this.cmap, unicode);
  36694. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  36695. }
  36696. }
  36697. class TrueTypeCompiled extends CompiledFont {
  36698. constructor(glyphs, cmap, fontMatrix) {
  36699. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  36700. this.glyphs = glyphs;
  36701. this.cmap = cmap;
  36702. }
  36703. compileGlyphImpl(code, cmds) {
  36704. compileGlyf(code, cmds, this);
  36705. }
  36706. }
  36707. class Type2Compiled extends CompiledFont {
  36708. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  36709. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  36710. this.glyphs = cffInfo.glyphs;
  36711. this.gsubrs = cffInfo.gsubrs || [];
  36712. this.subrs = cffInfo.subrs || [];
  36713. this.cmap = cmap;
  36714. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  36715. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  36716. this.subrsBias = getSubroutineBias(this.subrs);
  36717. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  36718. this.fdSelect = cffInfo.fdSelect;
  36719. this.fdArray = cffInfo.fdArray;
  36720. }
  36721. compileGlyphImpl(code, cmds, glyphId) {
  36722. compileCharString(code, cmds, this, glyphId);
  36723. }
  36724. }
  36725. class FontRendererFactory {
  36726. static create(font, seacAnalysisEnabled) {
  36727. const data = new Uint8Array(font.data);
  36728. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  36729. const numTables = getUshort(data, 4);
  36730. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  36731. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  36732. const offset = getLong(data, p + 8);
  36733. const length = getLong(data, p + 12);
  36734. switch (tag) {
  36735. case "cmap":
  36736. cmap = parseCmap(data, offset, offset + length);
  36737. break;
  36738. case "glyf":
  36739. glyf = data.subarray(offset, offset + length);
  36740. break;
  36741. case "loca":
  36742. loca = data.subarray(offset, offset + length);
  36743. break;
  36744. case "head":
  36745. unitsPerEm = getUshort(data, offset + 18);
  36746. indexToLocFormat = getUshort(data, offset + 50);
  36747. break;
  36748. case "CFF ":
  36749. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  36750. break;
  36751. }
  36752. }
  36753. if (glyf) {
  36754. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  36755. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  36756. }
  36757. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  36758. }
  36759. }
  36760. exports.FontRendererFactory = FontRendererFactory;
  36761. /***/ }),
  36762. /* 45 */
  36763. /***/ ((__unused_webpack_module, exports) => {
  36764. Object.defineProperty(exports, "__esModule", ({
  36765. value: true
  36766. }));
  36767. exports.GlyfTable = void 0;
  36768. const ON_CURVE_POINT = 1 << 0;
  36769. const X_SHORT_VECTOR = 1 << 1;
  36770. const Y_SHORT_VECTOR = 1 << 2;
  36771. const REPEAT_FLAG = 1 << 3;
  36772. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  36773. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  36774. const OVERLAP_SIMPLE = 1 << 6;
  36775. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  36776. const ARGS_ARE_XY_VALUES = 1 << 1;
  36777. const WE_HAVE_A_SCALE = 1 << 3;
  36778. const MORE_COMPONENTS = 1 << 5;
  36779. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  36780. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  36781. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  36782. class GlyfTable {
  36783. constructor({
  36784. glyfTable,
  36785. isGlyphLocationsLong,
  36786. locaTable,
  36787. numGlyphs
  36788. }) {
  36789. this.glyphs = [];
  36790. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  36791. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  36792. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  36793. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  36794. let pos = 0;
  36795. for (let i = 0; i < numGlyphs; i++) {
  36796. pos += offsetSize;
  36797. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  36798. if (next === prev) {
  36799. this.glyphs.push(new Glyph({}));
  36800. continue;
  36801. }
  36802. const glyph = Glyph.parse(prev, glyf);
  36803. this.glyphs.push(glyph);
  36804. prev = next;
  36805. }
  36806. }
  36807. getSize() {
  36808. return this.glyphs.reduce((a, g) => {
  36809. const size = g.getSize();
  36810. return a + (size + 3 & ~3);
  36811. }, 0);
  36812. }
  36813. write() {
  36814. const totalSize = this.getSize();
  36815. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  36816. const isLocationLong = totalSize > 0x1fffe;
  36817. const offsetSize = isLocationLong ? 4 : 2;
  36818. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  36819. if (isLocationLong) {
  36820. locaTable.setUint32(0, 0);
  36821. } else {
  36822. locaTable.setUint16(0, 0);
  36823. }
  36824. let pos = 0;
  36825. let locaIndex = 0;
  36826. for (const glyph of this.glyphs) {
  36827. pos += glyph.write(pos, glyfTable);
  36828. pos = pos + 3 & ~3;
  36829. locaIndex += offsetSize;
  36830. if (isLocationLong) {
  36831. locaTable.setUint32(locaIndex, pos);
  36832. } else {
  36833. locaTable.setUint16(locaIndex, pos >> 1);
  36834. }
  36835. }
  36836. return {
  36837. isLocationLong,
  36838. loca: new Uint8Array(locaTable.buffer),
  36839. glyf: new Uint8Array(glyfTable.buffer)
  36840. };
  36841. }
  36842. scale(factors) {
  36843. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  36844. this.glyphs[i].scale(factors[i]);
  36845. }
  36846. }
  36847. }
  36848. exports.GlyfTable = GlyfTable;
  36849. class Glyph {
  36850. constructor({
  36851. header = null,
  36852. simple = null,
  36853. composites = null
  36854. }) {
  36855. this.header = header;
  36856. this.simple = simple;
  36857. this.composites = composites;
  36858. }
  36859. static parse(pos, glyf) {
  36860. const [read, header] = GlyphHeader.parse(pos, glyf);
  36861. pos += read;
  36862. if (header.numberOfContours < 0) {
  36863. const composites = [];
  36864. while (true) {
  36865. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  36866. pos += n;
  36867. composites.push(composite);
  36868. if (!(composite.flags & MORE_COMPONENTS)) {
  36869. break;
  36870. }
  36871. }
  36872. return new Glyph({
  36873. header,
  36874. composites
  36875. });
  36876. }
  36877. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  36878. return new Glyph({
  36879. header,
  36880. simple
  36881. });
  36882. }
  36883. getSize() {
  36884. if (!this.header) {
  36885. return 0;
  36886. }
  36887. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  36888. return this.header.getSize() + size;
  36889. }
  36890. write(pos, buf) {
  36891. if (!this.header) {
  36892. return 0;
  36893. }
  36894. const spos = pos;
  36895. pos += this.header.write(pos, buf);
  36896. if (this.simple) {
  36897. pos += this.simple.write(pos, buf);
  36898. } else {
  36899. for (const composite of this.composites) {
  36900. pos += composite.write(pos, buf);
  36901. }
  36902. }
  36903. return pos - spos;
  36904. }
  36905. scale(factor) {
  36906. if (!this.header) {
  36907. return;
  36908. }
  36909. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  36910. this.header.scale(xMiddle, factor);
  36911. if (this.simple) {
  36912. this.simple.scale(xMiddle, factor);
  36913. } else {
  36914. for (const composite of this.composites) {
  36915. composite.scale(xMiddle, factor);
  36916. }
  36917. }
  36918. }
  36919. }
  36920. class GlyphHeader {
  36921. constructor({
  36922. numberOfContours,
  36923. xMin,
  36924. yMin,
  36925. xMax,
  36926. yMax
  36927. }) {
  36928. this.numberOfContours = numberOfContours;
  36929. this.xMin = xMin;
  36930. this.yMin = yMin;
  36931. this.xMax = xMax;
  36932. this.yMax = yMax;
  36933. }
  36934. static parse(pos, glyf) {
  36935. return [10, new GlyphHeader({
  36936. numberOfContours: glyf.getInt16(pos),
  36937. xMin: glyf.getInt16(pos + 2),
  36938. yMin: glyf.getInt16(pos + 4),
  36939. xMax: glyf.getInt16(pos + 6),
  36940. yMax: glyf.getInt16(pos + 8)
  36941. })];
  36942. }
  36943. getSize() {
  36944. return 10;
  36945. }
  36946. write(pos, buf) {
  36947. buf.setInt16(pos, this.numberOfContours);
  36948. buf.setInt16(pos + 2, this.xMin);
  36949. buf.setInt16(pos + 4, this.yMin);
  36950. buf.setInt16(pos + 6, this.xMax);
  36951. buf.setInt16(pos + 8, this.yMax);
  36952. return 10;
  36953. }
  36954. scale(x, factor) {
  36955. this.xMin = Math.round(x + (this.xMin - x) * factor);
  36956. this.xMax = Math.round(x + (this.xMax - x) * factor);
  36957. }
  36958. }
  36959. class Contour {
  36960. constructor({
  36961. flags,
  36962. xCoordinates,
  36963. yCoordinates
  36964. }) {
  36965. this.xCoordinates = xCoordinates;
  36966. this.yCoordinates = yCoordinates;
  36967. this.flags = flags;
  36968. }
  36969. }
  36970. class SimpleGlyph {
  36971. constructor({
  36972. contours,
  36973. instructions
  36974. }) {
  36975. this.contours = contours;
  36976. this.instructions = instructions;
  36977. }
  36978. static parse(pos, glyf, numberOfContours) {
  36979. const endPtsOfContours = [];
  36980. for (let i = 0; i < numberOfContours; i++) {
  36981. const endPt = glyf.getUint16(pos);
  36982. pos += 2;
  36983. endPtsOfContours.push(endPt);
  36984. }
  36985. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  36986. const instructionLength = glyf.getUint16(pos);
  36987. pos += 2;
  36988. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  36989. pos += instructionLength;
  36990. const flags = [];
  36991. for (let i = 0; i < numberOfPt; pos++, i++) {
  36992. let flag = glyf.getUint8(pos);
  36993. flags.push(flag);
  36994. if (flag & REPEAT_FLAG) {
  36995. const count = glyf.getUint8(++pos);
  36996. flag ^= REPEAT_FLAG;
  36997. for (let m = 0; m < count; m++) {
  36998. flags.push(flag);
  36999. }
  37000. i += count;
  37001. }
  37002. }
  37003. const allXCoordinates = [];
  37004. let xCoordinates = [];
  37005. let yCoordinates = [];
  37006. let pointFlags = [];
  37007. const contours = [];
  37008. let endPtsOfContoursIndex = 0;
  37009. let lastCoordinate = 0;
  37010. for (let i = 0; i < numberOfPt; i++) {
  37011. const flag = flags[i];
  37012. if (flag & X_SHORT_VECTOR) {
  37013. const x = glyf.getUint8(pos++);
  37014. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  37015. xCoordinates.push(lastCoordinate);
  37016. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  37017. xCoordinates.push(lastCoordinate);
  37018. } else {
  37019. lastCoordinate += glyf.getInt16(pos);
  37020. pos += 2;
  37021. xCoordinates.push(lastCoordinate);
  37022. }
  37023. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  37024. endPtsOfContoursIndex++;
  37025. allXCoordinates.push(xCoordinates);
  37026. xCoordinates = [];
  37027. }
  37028. }
  37029. lastCoordinate = 0;
  37030. endPtsOfContoursIndex = 0;
  37031. for (let i = 0; i < numberOfPt; i++) {
  37032. const flag = flags[i];
  37033. if (flag & Y_SHORT_VECTOR) {
  37034. const y = glyf.getUint8(pos++);
  37035. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  37036. yCoordinates.push(lastCoordinate);
  37037. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  37038. yCoordinates.push(lastCoordinate);
  37039. } else {
  37040. lastCoordinate += glyf.getInt16(pos);
  37041. pos += 2;
  37042. yCoordinates.push(lastCoordinate);
  37043. }
  37044. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  37045. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  37046. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  37047. endPtsOfContoursIndex++;
  37048. contours.push(new Contour({
  37049. flags: pointFlags,
  37050. xCoordinates,
  37051. yCoordinates
  37052. }));
  37053. yCoordinates = [];
  37054. pointFlags = [];
  37055. }
  37056. }
  37057. return new SimpleGlyph({
  37058. contours,
  37059. instructions
  37060. });
  37061. }
  37062. getSize() {
  37063. let size = this.contours.length * 2 + 2 + this.instructions.length;
  37064. let lastX = 0;
  37065. let lastY = 0;
  37066. for (const contour of this.contours) {
  37067. size += contour.flags.length;
  37068. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37069. const x = contour.xCoordinates[i];
  37070. const y = contour.yCoordinates[i];
  37071. let abs = Math.abs(x - lastX);
  37072. if (abs > 255) {
  37073. size += 2;
  37074. } else if (abs > 0) {
  37075. size += 1;
  37076. }
  37077. lastX = x;
  37078. abs = Math.abs(y - lastY);
  37079. if (abs > 255) {
  37080. size += 2;
  37081. } else if (abs > 0) {
  37082. size += 1;
  37083. }
  37084. lastY = y;
  37085. }
  37086. }
  37087. return size;
  37088. }
  37089. write(pos, buf) {
  37090. const spos = pos;
  37091. const xCoordinates = [];
  37092. const yCoordinates = [];
  37093. const flags = [];
  37094. let lastX = 0;
  37095. let lastY = 0;
  37096. for (const contour of this.contours) {
  37097. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37098. let flag = contour.flags[i];
  37099. const x = contour.xCoordinates[i];
  37100. let delta = x - lastX;
  37101. if (delta === 0) {
  37102. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  37103. xCoordinates.push(0);
  37104. } else {
  37105. const abs = Math.abs(delta);
  37106. if (abs <= 255) {
  37107. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  37108. xCoordinates.push(abs);
  37109. } else {
  37110. xCoordinates.push(delta);
  37111. }
  37112. }
  37113. lastX = x;
  37114. const y = contour.yCoordinates[i];
  37115. delta = y - lastY;
  37116. if (delta === 0) {
  37117. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  37118. yCoordinates.push(0);
  37119. } else {
  37120. const abs = Math.abs(delta);
  37121. if (abs <= 255) {
  37122. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  37123. yCoordinates.push(abs);
  37124. } else {
  37125. yCoordinates.push(delta);
  37126. }
  37127. }
  37128. lastY = y;
  37129. flags.push(flag);
  37130. }
  37131. buf.setUint16(pos, xCoordinates.length - 1);
  37132. pos += 2;
  37133. }
  37134. buf.setUint16(pos, this.instructions.length);
  37135. pos += 2;
  37136. if (this.instructions.length) {
  37137. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  37138. pos += this.instructions.length;
  37139. }
  37140. for (const flag of flags) {
  37141. buf.setUint8(pos++, flag);
  37142. }
  37143. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  37144. const x = xCoordinates[i];
  37145. const flag = flags[i];
  37146. if (flag & X_SHORT_VECTOR) {
  37147. buf.setUint8(pos++, x);
  37148. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  37149. buf.setInt16(pos, x);
  37150. pos += 2;
  37151. }
  37152. }
  37153. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  37154. const y = yCoordinates[i];
  37155. const flag = flags[i];
  37156. if (flag & Y_SHORT_VECTOR) {
  37157. buf.setUint8(pos++, y);
  37158. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  37159. buf.setInt16(pos, y);
  37160. pos += 2;
  37161. }
  37162. }
  37163. return pos - spos;
  37164. }
  37165. scale(x, factor) {
  37166. for (const contour of this.contours) {
  37167. if (contour.xCoordinates.length === 0) {
  37168. continue;
  37169. }
  37170. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37171. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  37172. }
  37173. }
  37174. }
  37175. }
  37176. class CompositeGlyph {
  37177. constructor({
  37178. flags,
  37179. glyphIndex,
  37180. argument1,
  37181. argument2,
  37182. transf,
  37183. instructions
  37184. }) {
  37185. this.flags = flags;
  37186. this.glyphIndex = glyphIndex;
  37187. this.argument1 = argument1;
  37188. this.argument2 = argument2;
  37189. this.transf = transf;
  37190. this.instructions = instructions;
  37191. }
  37192. static parse(pos, glyf) {
  37193. const spos = pos;
  37194. const transf = [];
  37195. let flags = glyf.getUint16(pos);
  37196. const glyphIndex = glyf.getUint16(pos + 2);
  37197. pos += 4;
  37198. let argument1, argument2;
  37199. if (flags & ARG_1_AND_2_ARE_WORDS) {
  37200. if (flags & ARGS_ARE_XY_VALUES) {
  37201. argument1 = glyf.getInt16(pos);
  37202. argument2 = glyf.getInt16(pos + 2);
  37203. } else {
  37204. argument1 = glyf.getUint16(pos);
  37205. argument2 = glyf.getUint16(pos + 2);
  37206. }
  37207. pos += 4;
  37208. flags ^= ARG_1_AND_2_ARE_WORDS;
  37209. } else {
  37210. argument1 = glyf.getUint8(pos);
  37211. argument2 = glyf.getUint8(pos + 1);
  37212. if (flags & ARGS_ARE_XY_VALUES) {
  37213. const abs1 = argument1 & 0x7f;
  37214. argument1 = argument1 & 0x80 ? -abs1 : abs1;
  37215. const abs2 = argument2 & 0x7f;
  37216. argument2 = argument2 & 0x80 ? -abs2 : abs2;
  37217. }
  37218. pos += 2;
  37219. }
  37220. if (flags & WE_HAVE_A_SCALE) {
  37221. transf.push(glyf.getUint16(pos));
  37222. pos += 2;
  37223. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  37224. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  37225. pos += 4;
  37226. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  37227. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  37228. pos += 8;
  37229. }
  37230. let instructions = null;
  37231. if (flags & WE_HAVE_INSTRUCTIONS) {
  37232. const instructionLength = glyf.getUint16(pos);
  37233. pos += 2;
  37234. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  37235. pos += instructionLength;
  37236. }
  37237. return [pos - spos, new CompositeGlyph({
  37238. flags,
  37239. glyphIndex,
  37240. argument1,
  37241. argument2,
  37242. transf,
  37243. instructions
  37244. })];
  37245. }
  37246. getSize() {
  37247. let size = 2 + 2 + this.transf.length * 2;
  37248. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  37249. size += 2 + this.instructions.length;
  37250. }
  37251. size += 2;
  37252. if (this.flags & 2) {
  37253. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  37254. size += 2;
  37255. }
  37256. } else {
  37257. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  37258. size += 2;
  37259. }
  37260. }
  37261. return size;
  37262. }
  37263. write(pos, buf) {
  37264. const spos = pos;
  37265. if (this.flags & ARGS_ARE_XY_VALUES) {
  37266. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  37267. this.flags |= ARG_1_AND_2_ARE_WORDS;
  37268. }
  37269. } else {
  37270. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  37271. this.flags |= ARG_1_AND_2_ARE_WORDS;
  37272. }
  37273. }
  37274. buf.setUint16(pos, this.flags);
  37275. buf.setUint16(pos + 2, this.glyphIndex);
  37276. pos += 4;
  37277. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  37278. if (this.flags & ARGS_ARE_XY_VALUES) {
  37279. buf.setInt16(pos, this.argument1);
  37280. buf.setInt16(pos + 2, this.argument2);
  37281. } else {
  37282. buf.setUint16(pos, this.argument1);
  37283. buf.setUint16(pos + 2, this.argument2);
  37284. }
  37285. pos += 4;
  37286. } else {
  37287. buf.setUint8(pos, this.argument1);
  37288. buf.setUint8(pos + 1, this.argument2);
  37289. pos += 2;
  37290. }
  37291. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  37292. buf.setUint16(pos, this.instructions.length);
  37293. pos += 2;
  37294. if (this.instructions.length) {
  37295. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  37296. pos += this.instructions.length;
  37297. }
  37298. }
  37299. return pos - spos;
  37300. }
  37301. scale(x, factor) {}
  37302. }
  37303. /***/ }),
  37304. /* 46 */
  37305. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37306. Object.defineProperty(exports, "__esModule", ({
  37307. value: true
  37308. }));
  37309. exports.OpenTypeFileBuilder = void 0;
  37310. var _core_utils = __w_pdfjs_require__(9);
  37311. var _util = __w_pdfjs_require__(2);
  37312. function writeInt16(dest, offset, num) {
  37313. dest[offset] = num >> 8 & 0xff;
  37314. dest[offset + 1] = num & 0xff;
  37315. }
  37316. function writeInt32(dest, offset, num) {
  37317. dest[offset] = num >> 24 & 0xff;
  37318. dest[offset + 1] = num >> 16 & 0xff;
  37319. dest[offset + 2] = num >> 8 & 0xff;
  37320. dest[offset + 3] = num & 0xff;
  37321. }
  37322. function writeData(dest, offset, data) {
  37323. if (data instanceof Uint8Array) {
  37324. dest.set(data, offset);
  37325. } else if (typeof data === "string") {
  37326. for (let i = 0, ii = data.length; i < ii; i++) {
  37327. dest[offset++] = data.charCodeAt(i) & 0xff;
  37328. }
  37329. } else {
  37330. for (let i = 0, ii = data.length; i < ii; i++) {
  37331. dest[offset++] = data[i] & 0xff;
  37332. }
  37333. }
  37334. }
  37335. const OTF_HEADER_SIZE = 12;
  37336. const OTF_TABLE_ENTRY_SIZE = 16;
  37337. class OpenTypeFileBuilder {
  37338. constructor(sfnt) {
  37339. this.sfnt = sfnt;
  37340. this.tables = Object.create(null);
  37341. }
  37342. static getSearchParams(entriesCount, entrySize) {
  37343. let maxPower2 = 1,
  37344. log2 = 0;
  37345. while ((maxPower2 ^ entriesCount) > maxPower2) {
  37346. maxPower2 <<= 1;
  37347. log2++;
  37348. }
  37349. const searchRange = maxPower2 * entrySize;
  37350. return {
  37351. range: searchRange,
  37352. entry: log2,
  37353. rangeShift: entrySize * entriesCount - searchRange
  37354. };
  37355. }
  37356. toArray() {
  37357. let sfnt = this.sfnt;
  37358. const tables = this.tables;
  37359. const tablesNames = Object.keys(tables);
  37360. tablesNames.sort();
  37361. const numTables = tablesNames.length;
  37362. let i, j, jj, table, tableName;
  37363. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  37364. const tableOffsets = [offset];
  37365. for (i = 0; i < numTables; i++) {
  37366. table = tables[tablesNames[i]];
  37367. const paddedLength = (table.length + 3 & ~3) >>> 0;
  37368. offset += paddedLength;
  37369. tableOffsets.push(offset);
  37370. }
  37371. const file = new Uint8Array(offset);
  37372. for (i = 0; i < numTables; i++) {
  37373. table = tables[tablesNames[i]];
  37374. writeData(file, tableOffsets[i], table);
  37375. }
  37376. if (sfnt === "true") {
  37377. sfnt = (0, _util.string32)(0x00010000);
  37378. }
  37379. file[0] = sfnt.charCodeAt(0) & 0xff;
  37380. file[1] = sfnt.charCodeAt(1) & 0xff;
  37381. file[2] = sfnt.charCodeAt(2) & 0xff;
  37382. file[3] = sfnt.charCodeAt(3) & 0xff;
  37383. writeInt16(file, 4, numTables);
  37384. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  37385. writeInt16(file, 6, searchParams.range);
  37386. writeInt16(file, 8, searchParams.entry);
  37387. writeInt16(file, 10, searchParams.rangeShift);
  37388. offset = OTF_HEADER_SIZE;
  37389. for (i = 0; i < numTables; i++) {
  37390. tableName = tablesNames[i];
  37391. file[offset] = tableName.charCodeAt(0) & 0xff;
  37392. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  37393. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  37394. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  37395. let checksum = 0;
  37396. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  37397. const quad = (0, _core_utils.readUint32)(file, j);
  37398. checksum = checksum + quad >>> 0;
  37399. }
  37400. writeInt32(file, offset + 4, checksum);
  37401. writeInt32(file, offset + 8, tableOffsets[i]);
  37402. writeInt32(file, offset + 12, tables[tableName].length);
  37403. offset += OTF_TABLE_ENTRY_SIZE;
  37404. }
  37405. return file;
  37406. }
  37407. addTable(tag, data) {
  37408. if (tag in this.tables) {
  37409. throw new Error("Table " + tag + " already exists");
  37410. }
  37411. this.tables[tag] = data;
  37412. }
  37413. }
  37414. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  37415. /***/ }),
  37416. /* 47 */
  37417. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37418. Object.defineProperty(exports, "__esModule", ({
  37419. value: true
  37420. }));
  37421. exports.Type1Font = void 0;
  37422. var _cff_parser = __w_pdfjs_require__(35);
  37423. var _fonts_utils = __w_pdfjs_require__(38);
  37424. var _core_utils = __w_pdfjs_require__(9);
  37425. var _stream = __w_pdfjs_require__(10);
  37426. var _type1_parser = __w_pdfjs_require__(48);
  37427. var _util = __w_pdfjs_require__(2);
  37428. function findBlock(streamBytes, signature, startIndex) {
  37429. const streamBytesLength = streamBytes.length;
  37430. const signatureLength = signature.length;
  37431. const scanLength = streamBytesLength - signatureLength;
  37432. let i = startIndex,
  37433. found = false;
  37434. while (i < scanLength) {
  37435. let j = 0;
  37436. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  37437. j++;
  37438. }
  37439. if (j >= signatureLength) {
  37440. i += j;
  37441. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  37442. i++;
  37443. }
  37444. found = true;
  37445. break;
  37446. }
  37447. i++;
  37448. }
  37449. return {
  37450. found,
  37451. length: i
  37452. };
  37453. }
  37454. function getHeaderBlock(stream, suggestedLength) {
  37455. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  37456. const streamStartPos = stream.pos;
  37457. let headerBytes, headerBytesLength, block;
  37458. try {
  37459. headerBytes = stream.getBytes(suggestedLength);
  37460. headerBytesLength = headerBytes.length;
  37461. } catch (ex) {}
  37462. if (headerBytesLength === suggestedLength) {
  37463. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  37464. if (block.found && block.length === suggestedLength) {
  37465. return {
  37466. stream: new _stream.Stream(headerBytes),
  37467. length: suggestedLength
  37468. };
  37469. }
  37470. }
  37471. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  37472. stream.pos = streamStartPos;
  37473. const SCAN_BLOCK_LENGTH = 2048;
  37474. let actualLength;
  37475. while (true) {
  37476. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  37477. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  37478. if (block.length === 0) {
  37479. break;
  37480. }
  37481. stream.pos += block.length;
  37482. if (block.found) {
  37483. actualLength = stream.pos - streamStartPos;
  37484. break;
  37485. }
  37486. }
  37487. stream.pos = streamStartPos;
  37488. if (actualLength) {
  37489. return {
  37490. stream: new _stream.Stream(stream.getBytes(actualLength)),
  37491. length: actualLength
  37492. };
  37493. }
  37494. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  37495. return {
  37496. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  37497. length: suggestedLength
  37498. };
  37499. }
  37500. function getEexecBlock(stream, suggestedLength) {
  37501. const eexecBytes = stream.getBytes();
  37502. return {
  37503. stream: new _stream.Stream(eexecBytes),
  37504. length: eexecBytes.length
  37505. };
  37506. }
  37507. class Type1Font {
  37508. constructor(name, file, properties) {
  37509. const PFB_HEADER_SIZE = 6;
  37510. let headerBlockLength = properties.length1;
  37511. let eexecBlockLength = properties.length2;
  37512. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  37513. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  37514. if (pfbHeaderPresent) {
  37515. file.skip(PFB_HEADER_SIZE);
  37516. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  37517. }
  37518. const headerBlock = getHeaderBlock(file, headerBlockLength);
  37519. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37520. headerBlockParser.extractFontHeader(properties);
  37521. if (pfbHeaderPresent) {
  37522. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  37523. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  37524. }
  37525. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  37526. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37527. const data = eexecBlockParser.extractFontProgram(properties);
  37528. for (const key in data.properties) {
  37529. properties[key] = data.properties[key];
  37530. }
  37531. const charstrings = data.charstrings;
  37532. const type2Charstrings = this.getType2Charstrings(charstrings);
  37533. const subrs = this.getType2Subrs(data.subrs);
  37534. this.charstrings = charstrings;
  37535. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  37536. this.seacs = this.getSeacs(data.charstrings);
  37537. }
  37538. get numGlyphs() {
  37539. return this.charstrings.length + 1;
  37540. }
  37541. getCharset() {
  37542. const charset = [".notdef"];
  37543. const charstrings = this.charstrings;
  37544. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  37545. charset.push(charstrings[glyphId].glyphName);
  37546. }
  37547. return charset;
  37548. }
  37549. getGlyphMapping(properties) {
  37550. const charstrings = this.charstrings;
  37551. if (properties.composite) {
  37552. const charCodeToGlyphId = Object.create(null);
  37553. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  37554. const charCode = properties.cMap.charCodeOf(glyphId);
  37555. charCodeToGlyphId[charCode] = glyphId + 1;
  37556. }
  37557. return charCodeToGlyphId;
  37558. }
  37559. const glyphNames = [".notdef"];
  37560. let builtInEncoding, glyphId;
  37561. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  37562. glyphNames.push(charstrings[glyphId].glyphName);
  37563. }
  37564. const encoding = properties.builtInEncoding;
  37565. if (encoding) {
  37566. builtInEncoding = Object.create(null);
  37567. for (const charCode in encoding) {
  37568. glyphId = glyphNames.indexOf(encoding[charCode]);
  37569. if (glyphId >= 0) {
  37570. builtInEncoding[charCode] = glyphId;
  37571. }
  37572. }
  37573. }
  37574. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  37575. }
  37576. hasGlyphId(id) {
  37577. if (id < 0 || id >= this.numGlyphs) {
  37578. return false;
  37579. }
  37580. if (id === 0) {
  37581. return true;
  37582. }
  37583. const glyph = this.charstrings[id - 1];
  37584. return glyph.charstring.length > 0;
  37585. }
  37586. getSeacs(charstrings) {
  37587. const seacMap = [];
  37588. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  37589. const charstring = charstrings[i];
  37590. if (charstring.seac) {
  37591. seacMap[i + 1] = charstring.seac;
  37592. }
  37593. }
  37594. return seacMap;
  37595. }
  37596. getType2Charstrings(type1Charstrings) {
  37597. const type2Charstrings = [];
  37598. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  37599. type2Charstrings.push(type1Charstrings[i].charstring);
  37600. }
  37601. return type2Charstrings;
  37602. }
  37603. getType2Subrs(type1Subrs) {
  37604. let bias = 0;
  37605. const count = type1Subrs.length;
  37606. if (count < 1133) {
  37607. bias = 107;
  37608. } else if (count < 33769) {
  37609. bias = 1131;
  37610. } else {
  37611. bias = 32768;
  37612. }
  37613. const type2Subrs = [];
  37614. let i;
  37615. for (i = 0; i < bias; i++) {
  37616. type2Subrs.push([0x0b]);
  37617. }
  37618. for (i = 0; i < count; i++) {
  37619. type2Subrs.push(type1Subrs[i]);
  37620. }
  37621. return type2Subrs;
  37622. }
  37623. wrap(name, glyphs, charstrings, subrs, properties) {
  37624. const cff = new _cff_parser.CFF();
  37625. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  37626. cff.names = [name];
  37627. const topDict = new _cff_parser.CFFTopDict();
  37628. topDict.setByName("version", 391);
  37629. topDict.setByName("Notice", 392);
  37630. topDict.setByName("FullName", 393);
  37631. topDict.setByName("FamilyName", 394);
  37632. topDict.setByName("Weight", 395);
  37633. topDict.setByName("Encoding", null);
  37634. topDict.setByName("FontMatrix", properties.fontMatrix);
  37635. topDict.setByName("FontBBox", properties.bbox);
  37636. topDict.setByName("charset", null);
  37637. topDict.setByName("CharStrings", null);
  37638. topDict.setByName("Private", null);
  37639. cff.topDict = topDict;
  37640. const strings = new _cff_parser.CFFStrings();
  37641. strings.add("Version 0.11");
  37642. strings.add("See original notice");
  37643. strings.add(name);
  37644. strings.add(name);
  37645. strings.add("Medium");
  37646. cff.strings = strings;
  37647. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  37648. const count = glyphs.length;
  37649. const charsetArray = [".notdef"];
  37650. let i, ii;
  37651. for (i = 0; i < count; i++) {
  37652. const glyphName = charstrings[i].glyphName;
  37653. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  37654. if (index === -1) {
  37655. strings.add(glyphName);
  37656. }
  37657. charsetArray.push(glyphName);
  37658. }
  37659. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  37660. const charStringsIndex = new _cff_parser.CFFIndex();
  37661. charStringsIndex.add([0x8b, 0x0e]);
  37662. for (i = 0; i < count; i++) {
  37663. charStringsIndex.add(glyphs[i]);
  37664. }
  37665. cff.charStrings = charStringsIndex;
  37666. const privateDict = new _cff_parser.CFFPrivateDict();
  37667. privateDict.setByName("Subrs", null);
  37668. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  37669. for (i = 0, ii = fields.length; i < ii; i++) {
  37670. const field = fields[i];
  37671. if (!(field in properties.privateData)) {
  37672. continue;
  37673. }
  37674. const value = properties.privateData[field];
  37675. if (Array.isArray(value)) {
  37676. for (let j = value.length - 1; j > 0; j--) {
  37677. value[j] -= value[j - 1];
  37678. }
  37679. }
  37680. privateDict.setByName(field, value);
  37681. }
  37682. cff.topDict.privateDict = privateDict;
  37683. const subrIndex = new _cff_parser.CFFIndex();
  37684. for (i = 0, ii = subrs.length; i < ii; i++) {
  37685. subrIndex.add(subrs[i]);
  37686. }
  37687. privateDict.subrsIndex = subrIndex;
  37688. const compiler = new _cff_parser.CFFCompiler(cff);
  37689. return compiler.compile();
  37690. }
  37691. }
  37692. exports.Type1Font = Type1Font;
  37693. /***/ }),
  37694. /* 48 */
  37695. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37696. Object.defineProperty(exports, "__esModule", ({
  37697. value: true
  37698. }));
  37699. exports.Type1Parser = void 0;
  37700. var _encodings = __w_pdfjs_require__(37);
  37701. var _core_utils = __w_pdfjs_require__(9);
  37702. var _stream = __w_pdfjs_require__(10);
  37703. var _util = __w_pdfjs_require__(2);
  37704. const HINTING_ENABLED = false;
  37705. const Type1CharString = function Type1CharStringClosure() {
  37706. const COMMAND_MAP = {
  37707. hstem: [1],
  37708. vstem: [3],
  37709. vmoveto: [4],
  37710. rlineto: [5],
  37711. hlineto: [6],
  37712. vlineto: [7],
  37713. rrcurveto: [8],
  37714. callsubr: [10],
  37715. flex: [12, 35],
  37716. drop: [12, 18],
  37717. endchar: [14],
  37718. rmoveto: [21],
  37719. hmoveto: [22],
  37720. vhcurveto: [30],
  37721. hvcurveto: [31]
  37722. };
  37723. class Type1CharString {
  37724. constructor() {
  37725. this.width = 0;
  37726. this.lsb = 0;
  37727. this.flexing = false;
  37728. this.output = [];
  37729. this.stack = [];
  37730. }
  37731. convert(encoded, subrs, seacAnalysisEnabled) {
  37732. const count = encoded.length;
  37733. let error = false;
  37734. let wx, sbx, subrNumber;
  37735. for (let i = 0; i < count; i++) {
  37736. let value = encoded[i];
  37737. if (value < 32) {
  37738. if (value === 12) {
  37739. value = (value << 8) + encoded[++i];
  37740. }
  37741. switch (value) {
  37742. case 1:
  37743. if (!HINTING_ENABLED) {
  37744. this.stack = [];
  37745. break;
  37746. }
  37747. error = this.executeCommand(2, COMMAND_MAP.hstem);
  37748. break;
  37749. case 3:
  37750. if (!HINTING_ENABLED) {
  37751. this.stack = [];
  37752. break;
  37753. }
  37754. error = this.executeCommand(2, COMMAND_MAP.vstem);
  37755. break;
  37756. case 4:
  37757. if (this.flexing) {
  37758. if (this.stack.length < 1) {
  37759. error = true;
  37760. break;
  37761. }
  37762. const dy = this.stack.pop();
  37763. this.stack.push(0, dy);
  37764. break;
  37765. }
  37766. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  37767. break;
  37768. case 5:
  37769. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  37770. break;
  37771. case 6:
  37772. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  37773. break;
  37774. case 7:
  37775. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  37776. break;
  37777. case 8:
  37778. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  37779. break;
  37780. case 9:
  37781. this.stack = [];
  37782. break;
  37783. case 10:
  37784. if (this.stack.length < 1) {
  37785. error = true;
  37786. break;
  37787. }
  37788. subrNumber = this.stack.pop();
  37789. if (!subrs[subrNumber]) {
  37790. error = true;
  37791. break;
  37792. }
  37793. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  37794. break;
  37795. case 11:
  37796. return error;
  37797. case 13:
  37798. if (this.stack.length < 2) {
  37799. error = true;
  37800. break;
  37801. }
  37802. wx = this.stack.pop();
  37803. sbx = this.stack.pop();
  37804. this.lsb = sbx;
  37805. this.width = wx;
  37806. this.stack.push(wx, sbx);
  37807. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  37808. break;
  37809. case 14:
  37810. this.output.push(COMMAND_MAP.endchar[0]);
  37811. break;
  37812. case 21:
  37813. if (this.flexing) {
  37814. break;
  37815. }
  37816. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  37817. break;
  37818. case 22:
  37819. if (this.flexing) {
  37820. this.stack.push(0);
  37821. break;
  37822. }
  37823. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  37824. break;
  37825. case 30:
  37826. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  37827. break;
  37828. case 31:
  37829. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  37830. break;
  37831. case (12 << 8) + 0:
  37832. this.stack = [];
  37833. break;
  37834. case (12 << 8) + 1:
  37835. if (!HINTING_ENABLED) {
  37836. this.stack = [];
  37837. break;
  37838. }
  37839. error = this.executeCommand(2, COMMAND_MAP.vstem);
  37840. break;
  37841. case (12 << 8) + 2:
  37842. if (!HINTING_ENABLED) {
  37843. this.stack = [];
  37844. break;
  37845. }
  37846. error = this.executeCommand(2, COMMAND_MAP.hstem);
  37847. break;
  37848. case (12 << 8) + 6:
  37849. if (seacAnalysisEnabled) {
  37850. const asb = this.stack[this.stack.length - 5];
  37851. this.seac = this.stack.splice(-4, 4);
  37852. this.seac[0] += this.lsb - asb;
  37853. error = this.executeCommand(0, COMMAND_MAP.endchar);
  37854. } else {
  37855. error = this.executeCommand(4, COMMAND_MAP.endchar);
  37856. }
  37857. break;
  37858. case (12 << 8) + 7:
  37859. if (this.stack.length < 4) {
  37860. error = true;
  37861. break;
  37862. }
  37863. this.stack.pop();
  37864. wx = this.stack.pop();
  37865. const sby = this.stack.pop();
  37866. sbx = this.stack.pop();
  37867. this.lsb = sbx;
  37868. this.width = wx;
  37869. this.stack.push(wx, sbx, sby);
  37870. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  37871. break;
  37872. case (12 << 8) + 12:
  37873. if (this.stack.length < 2) {
  37874. error = true;
  37875. break;
  37876. }
  37877. const num2 = this.stack.pop();
  37878. const num1 = this.stack.pop();
  37879. this.stack.push(num1 / num2);
  37880. break;
  37881. case (12 << 8) + 16:
  37882. if (this.stack.length < 2) {
  37883. error = true;
  37884. break;
  37885. }
  37886. subrNumber = this.stack.pop();
  37887. const numArgs = this.stack.pop();
  37888. if (subrNumber === 0 && numArgs === 3) {
  37889. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  37890. 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]);
  37891. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  37892. this.flexing = false;
  37893. this.stack.push(flexArgs[15], flexArgs[16]);
  37894. } else if (subrNumber === 1 && numArgs === 0) {
  37895. this.flexing = true;
  37896. }
  37897. break;
  37898. case (12 << 8) + 17:
  37899. break;
  37900. case (12 << 8) + 33:
  37901. this.stack = [];
  37902. break;
  37903. default:
  37904. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  37905. break;
  37906. }
  37907. if (error) {
  37908. break;
  37909. }
  37910. continue;
  37911. } else if (value <= 246) {
  37912. value -= 139;
  37913. } else if (value <= 250) {
  37914. value = (value - 247) * 256 + encoded[++i] + 108;
  37915. } else if (value <= 254) {
  37916. value = -((value - 251) * 256) - encoded[++i] - 108;
  37917. } else {
  37918. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  37919. }
  37920. this.stack.push(value);
  37921. }
  37922. return error;
  37923. }
  37924. executeCommand(howManyArgs, command, keepStack) {
  37925. const stackLength = this.stack.length;
  37926. if (howManyArgs > stackLength) {
  37927. return true;
  37928. }
  37929. const start = stackLength - howManyArgs;
  37930. for (let i = start; i < stackLength; i++) {
  37931. let value = this.stack[i];
  37932. if (Number.isInteger(value)) {
  37933. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  37934. } else {
  37935. value = 65536 * value | 0;
  37936. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  37937. }
  37938. }
  37939. this.output.push.apply(this.output, command);
  37940. if (keepStack) {
  37941. this.stack.splice(start, howManyArgs);
  37942. } else {
  37943. this.stack.length = 0;
  37944. }
  37945. return false;
  37946. }
  37947. }
  37948. return Type1CharString;
  37949. }();
  37950. const Type1Parser = function Type1ParserClosure() {
  37951. const EEXEC_ENCRYPT_KEY = 55665;
  37952. const CHAR_STRS_ENCRYPT_KEY = 4330;
  37953. function isHexDigit(code) {
  37954. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  37955. }
  37956. function decrypt(data, key, discardNumber) {
  37957. if (discardNumber >= data.length) {
  37958. return new Uint8Array(0);
  37959. }
  37960. const c1 = 52845,
  37961. c2 = 22719;
  37962. let r = key | 0,
  37963. i,
  37964. j;
  37965. for (i = 0; i < discardNumber; i++) {
  37966. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  37967. }
  37968. const count = data.length - discardNumber;
  37969. const decrypted = new Uint8Array(count);
  37970. for (i = discardNumber, j = 0; j < count; i++, j++) {
  37971. const value = data[i];
  37972. decrypted[j] = value ^ r >> 8;
  37973. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  37974. }
  37975. return decrypted;
  37976. }
  37977. function decryptAscii(data, key, discardNumber) {
  37978. const c1 = 52845,
  37979. c2 = 22719;
  37980. let r = key | 0;
  37981. const count = data.length,
  37982. maybeLength = count >>> 1;
  37983. const decrypted = new Uint8Array(maybeLength);
  37984. let i, j;
  37985. for (i = 0, j = 0; i < count; i++) {
  37986. const digit1 = data[i];
  37987. if (!isHexDigit(digit1)) {
  37988. continue;
  37989. }
  37990. i++;
  37991. let digit2;
  37992. while (i < count && !isHexDigit(digit2 = data[i])) {
  37993. i++;
  37994. }
  37995. if (i < count) {
  37996. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  37997. decrypted[j++] = value ^ r >> 8;
  37998. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  37999. }
  38000. }
  38001. return decrypted.slice(discardNumber, j);
  38002. }
  38003. function isSpecial(c) {
  38004. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  38005. }
  38006. class Type1Parser {
  38007. constructor(stream, encrypted, seacAnalysisEnabled) {
  38008. if (encrypted) {
  38009. const data = stream.getBytes();
  38010. 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]));
  38011. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  38012. }
  38013. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  38014. this.stream = stream;
  38015. this.nextChar();
  38016. }
  38017. readNumberArray() {
  38018. this.getToken();
  38019. const array = [];
  38020. while (true) {
  38021. const token = this.getToken();
  38022. if (token === null || token === "]" || token === "}") {
  38023. break;
  38024. }
  38025. array.push(parseFloat(token || 0));
  38026. }
  38027. return array;
  38028. }
  38029. readNumber() {
  38030. const token = this.getToken();
  38031. return parseFloat(token || 0);
  38032. }
  38033. readInt() {
  38034. const token = this.getToken();
  38035. return parseInt(token || 0, 10) | 0;
  38036. }
  38037. readBoolean() {
  38038. const token = this.getToken();
  38039. return token === "true" ? 1 : 0;
  38040. }
  38041. nextChar() {
  38042. return this.currentChar = this.stream.getByte();
  38043. }
  38044. getToken() {
  38045. let comment = false;
  38046. let ch = this.currentChar;
  38047. while (true) {
  38048. if (ch === -1) {
  38049. return null;
  38050. }
  38051. if (comment) {
  38052. if (ch === 0x0a || ch === 0x0d) {
  38053. comment = false;
  38054. }
  38055. } else if (ch === 0x25) {
  38056. comment = true;
  38057. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  38058. break;
  38059. }
  38060. ch = this.nextChar();
  38061. }
  38062. if (isSpecial(ch)) {
  38063. this.nextChar();
  38064. return String.fromCharCode(ch);
  38065. }
  38066. let token = "";
  38067. do {
  38068. token += String.fromCharCode(ch);
  38069. ch = this.nextChar();
  38070. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  38071. return token;
  38072. }
  38073. readCharStrings(bytes, lenIV) {
  38074. if (lenIV === -1) {
  38075. return bytes;
  38076. }
  38077. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  38078. }
  38079. extractFontProgram(properties) {
  38080. const stream = this.stream;
  38081. const subrs = [],
  38082. charstrings = [];
  38083. const privateData = Object.create(null);
  38084. privateData.lenIV = 4;
  38085. const program = {
  38086. subrs: [],
  38087. charstrings: [],
  38088. properties: {
  38089. privateData
  38090. }
  38091. };
  38092. let token, length, data, lenIV, encoded;
  38093. while ((token = this.getToken()) !== null) {
  38094. if (token !== "/") {
  38095. continue;
  38096. }
  38097. token = this.getToken();
  38098. switch (token) {
  38099. case "CharStrings":
  38100. this.getToken();
  38101. this.getToken();
  38102. this.getToken();
  38103. this.getToken();
  38104. while (true) {
  38105. token = this.getToken();
  38106. if (token === null || token === "end") {
  38107. break;
  38108. }
  38109. if (token !== "/") {
  38110. continue;
  38111. }
  38112. const glyph = this.getToken();
  38113. length = this.readInt();
  38114. this.getToken();
  38115. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  38116. lenIV = program.properties.privateData.lenIV;
  38117. encoded = this.readCharStrings(data, lenIV);
  38118. this.nextChar();
  38119. token = this.getToken();
  38120. if (token === "noaccess") {
  38121. this.getToken();
  38122. }
  38123. charstrings.push({
  38124. glyph,
  38125. encoded
  38126. });
  38127. }
  38128. break;
  38129. case "Subrs":
  38130. this.readInt();
  38131. this.getToken();
  38132. while (this.getToken() === "dup") {
  38133. const index = this.readInt();
  38134. length = this.readInt();
  38135. this.getToken();
  38136. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  38137. lenIV = program.properties.privateData.lenIV;
  38138. encoded = this.readCharStrings(data, lenIV);
  38139. this.nextChar();
  38140. token = this.getToken();
  38141. if (token === "noaccess") {
  38142. this.getToken();
  38143. }
  38144. subrs[index] = encoded;
  38145. }
  38146. break;
  38147. case "BlueValues":
  38148. case "OtherBlues":
  38149. case "FamilyBlues":
  38150. case "FamilyOtherBlues":
  38151. const blueArray = this.readNumberArray();
  38152. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  38153. program.properties.privateData[token] = blueArray;
  38154. }
  38155. break;
  38156. case "StemSnapH":
  38157. case "StemSnapV":
  38158. program.properties.privateData[token] = this.readNumberArray();
  38159. break;
  38160. case "StdHW":
  38161. case "StdVW":
  38162. program.properties.privateData[token] = this.readNumberArray()[0];
  38163. break;
  38164. case "BlueShift":
  38165. case "lenIV":
  38166. case "BlueFuzz":
  38167. case "BlueScale":
  38168. case "LanguageGroup":
  38169. case "ExpansionFactor":
  38170. program.properties.privateData[token] = this.readNumber();
  38171. break;
  38172. case "ForceBold":
  38173. program.properties.privateData[token] = this.readBoolean();
  38174. break;
  38175. }
  38176. }
  38177. for (let i = 0; i < charstrings.length; i++) {
  38178. const glyph = charstrings[i].glyph;
  38179. encoded = charstrings[i].encoded;
  38180. const charString = new Type1CharString();
  38181. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  38182. let output = charString.output;
  38183. if (error) {
  38184. output = [14];
  38185. }
  38186. const charStringObject = {
  38187. glyphName: glyph,
  38188. charstring: output,
  38189. width: charString.width,
  38190. lsb: charString.lsb,
  38191. seac: charString.seac
  38192. };
  38193. if (glyph === ".notdef") {
  38194. program.charstrings.unshift(charStringObject);
  38195. } else {
  38196. program.charstrings.push(charStringObject);
  38197. }
  38198. if (properties.builtInEncoding) {
  38199. const index = properties.builtInEncoding.indexOf(glyph);
  38200. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  38201. properties.widths[index] = charString.width;
  38202. }
  38203. }
  38204. }
  38205. return program;
  38206. }
  38207. extractFontHeader(properties) {
  38208. let token;
  38209. while ((token = this.getToken()) !== null) {
  38210. if (token !== "/") {
  38211. continue;
  38212. }
  38213. token = this.getToken();
  38214. switch (token) {
  38215. case "FontMatrix":
  38216. const matrix = this.readNumberArray();
  38217. properties.fontMatrix = matrix;
  38218. break;
  38219. case "Encoding":
  38220. const encodingArg = this.getToken();
  38221. let encoding;
  38222. if (!/^\d+$/.test(encodingArg)) {
  38223. encoding = (0, _encodings.getEncoding)(encodingArg);
  38224. } else {
  38225. encoding = [];
  38226. const size = parseInt(encodingArg, 10) | 0;
  38227. this.getToken();
  38228. for (let j = 0; j < size; j++) {
  38229. token = this.getToken();
  38230. while (token !== "dup" && token !== "def") {
  38231. token = this.getToken();
  38232. if (token === null) {
  38233. return;
  38234. }
  38235. }
  38236. if (token === "def") {
  38237. break;
  38238. }
  38239. const index = this.readInt();
  38240. this.getToken();
  38241. const glyph = this.getToken();
  38242. encoding[index] = glyph;
  38243. this.getToken();
  38244. }
  38245. }
  38246. properties.builtInEncoding = encoding;
  38247. break;
  38248. case "FontBBox":
  38249. const fontBBox = this.readNumberArray();
  38250. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  38251. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  38252. properties.ascentScaled = true;
  38253. break;
  38254. }
  38255. }
  38256. }
  38257. }
  38258. return Type1Parser;
  38259. }();
  38260. exports.Type1Parser = Type1Parser;
  38261. /***/ }),
  38262. /* 49 */
  38263. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38264. Object.defineProperty(exports, "__esModule", ({
  38265. value: true
  38266. }));
  38267. exports.getTilingPatternIR = getTilingPatternIR;
  38268. exports.Pattern = void 0;
  38269. var _util = __w_pdfjs_require__(2);
  38270. var _colorspace = __w_pdfjs_require__(14);
  38271. var _primitives = __w_pdfjs_require__(5);
  38272. var _core_utils = __w_pdfjs_require__(9);
  38273. const ShadingType = {
  38274. FUNCTION_BASED: 1,
  38275. AXIAL: 2,
  38276. RADIAL: 3,
  38277. FREE_FORM_MESH: 4,
  38278. LATTICE_FORM_MESH: 5,
  38279. COONS_PATCH_MESH: 6,
  38280. TENSOR_PATCH_MESH: 7
  38281. };
  38282. class Pattern {
  38283. constructor() {
  38284. (0, _util.unreachable)("Cannot initialize Pattern.");
  38285. }
  38286. static parseShading(shading, matrix, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  38287. const dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  38288. const type = dict.get("ShadingType");
  38289. try {
  38290. switch (type) {
  38291. case ShadingType.AXIAL:
  38292. case ShadingType.RADIAL:
  38293. return new RadialAxialShading(dict, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  38294. case ShadingType.FREE_FORM_MESH:
  38295. case ShadingType.LATTICE_FORM_MESH:
  38296. case ShadingType.COONS_PATCH_MESH:
  38297. case ShadingType.TENSOR_PATCH_MESH:
  38298. return new MeshShading(shading, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  38299. default:
  38300. throw new _util.FormatError("Unsupported ShadingType: " + type);
  38301. }
  38302. } catch (ex) {
  38303. if (ex instanceof _core_utils.MissingDataException) {
  38304. throw ex;
  38305. }
  38306. handler.send("UnsupportedFeature", {
  38307. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  38308. });
  38309. (0, _util.warn)(ex);
  38310. return new DummyShading();
  38311. }
  38312. }
  38313. }
  38314. exports.Pattern = Pattern;
  38315. class BaseShading {
  38316. static get SMALL_NUMBER() {
  38317. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  38318. }
  38319. constructor() {
  38320. if (this.constructor === BaseShading) {
  38321. (0, _util.unreachable)("Cannot initialize BaseShading.");
  38322. }
  38323. }
  38324. getIR() {
  38325. (0, _util.unreachable)("Abstract method `getIR` called.");
  38326. }
  38327. }
  38328. class RadialAxialShading extends BaseShading {
  38329. constructor(dict, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  38330. super();
  38331. this.matrix = matrix;
  38332. this.coordsArr = dict.getArray("Coords");
  38333. this.shadingType = dict.get("ShadingType");
  38334. const cs = _colorspace.ColorSpace.parse({
  38335. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  38336. xref,
  38337. resources,
  38338. pdfFunctionFactory,
  38339. localColorSpaceCache
  38340. });
  38341. const bbox = dict.getArray("BBox");
  38342. if (Array.isArray(bbox) && bbox.length === 4) {
  38343. this.bbox = _util.Util.normalizeRect(bbox);
  38344. } else {
  38345. this.bbox = null;
  38346. }
  38347. let t0 = 0.0,
  38348. t1 = 1.0;
  38349. if (dict.has("Domain")) {
  38350. const domainArr = dict.getArray("Domain");
  38351. t0 = domainArr[0];
  38352. t1 = domainArr[1];
  38353. }
  38354. let extendStart = false,
  38355. extendEnd = false;
  38356. if (dict.has("Extend")) {
  38357. const extendArr = dict.getArray("Extend");
  38358. extendStart = extendArr[0];
  38359. extendEnd = extendArr[1];
  38360. }
  38361. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  38362. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  38363. const distance = Math.hypot(x1 - x2, y1 - y2);
  38364. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  38365. (0, _util.warn)("Unsupported radial gradient.");
  38366. }
  38367. }
  38368. this.extendStart = extendStart;
  38369. this.extendEnd = extendEnd;
  38370. const fnObj = dict.getRaw("Function");
  38371. const fn = pdfFunctionFactory.createFromArray(fnObj);
  38372. const NUMBER_OF_SAMPLES = 10;
  38373. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  38374. const colorStops = this.colorStops = [];
  38375. if (t0 >= t1 || step <= 0) {
  38376. (0, _util.info)("Bad shading domain.");
  38377. return;
  38378. }
  38379. const color = new Float32Array(cs.numComps),
  38380. ratio = new Float32Array(1);
  38381. let rgbColor;
  38382. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  38383. ratio[0] = t0 + i * step;
  38384. fn(ratio, 0, color, 0);
  38385. rgbColor = cs.getRgb(color, 0);
  38386. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  38387. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  38388. }
  38389. let background = "transparent";
  38390. if (dict.has("Background")) {
  38391. rgbColor = cs.getRgb(dict.get("Background"), 0);
  38392. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  38393. }
  38394. if (!extendStart) {
  38395. colorStops.unshift([0, background]);
  38396. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  38397. }
  38398. if (!extendEnd) {
  38399. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  38400. colorStops.push([1, background]);
  38401. }
  38402. this.colorStops = colorStops;
  38403. }
  38404. getIR() {
  38405. const coordsArr = this.coordsArr;
  38406. const shadingType = this.shadingType;
  38407. let type, p0, p1, r0, r1;
  38408. if (shadingType === ShadingType.AXIAL) {
  38409. p0 = [coordsArr[0], coordsArr[1]];
  38410. p1 = [coordsArr[2], coordsArr[3]];
  38411. r0 = null;
  38412. r1 = null;
  38413. type = "axial";
  38414. } else if (shadingType === ShadingType.RADIAL) {
  38415. p0 = [coordsArr[0], coordsArr[1]];
  38416. p1 = [coordsArr[3], coordsArr[4]];
  38417. r0 = coordsArr[2];
  38418. r1 = coordsArr[5];
  38419. type = "radial";
  38420. } else {
  38421. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  38422. }
  38423. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1, this.matrix];
  38424. }
  38425. }
  38426. class MeshStreamReader {
  38427. constructor(stream, context) {
  38428. this.stream = stream;
  38429. this.context = context;
  38430. this.buffer = 0;
  38431. this.bufferLength = 0;
  38432. const numComps = context.numComps;
  38433. this.tmpCompsBuf = new Float32Array(numComps);
  38434. const csNumComps = context.colorSpace.numComps;
  38435. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  38436. }
  38437. get hasData() {
  38438. if (this.stream.end) {
  38439. return this.stream.pos < this.stream.end;
  38440. }
  38441. if (this.bufferLength > 0) {
  38442. return true;
  38443. }
  38444. const nextByte = this.stream.getByte();
  38445. if (nextByte < 0) {
  38446. return false;
  38447. }
  38448. this.buffer = nextByte;
  38449. this.bufferLength = 8;
  38450. return true;
  38451. }
  38452. readBits(n) {
  38453. let buffer = this.buffer;
  38454. let bufferLength = this.bufferLength;
  38455. if (n === 32) {
  38456. if (bufferLength === 0) {
  38457. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  38458. }
  38459. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  38460. const nextByte = this.stream.getByte();
  38461. this.buffer = nextByte & (1 << bufferLength) - 1;
  38462. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  38463. }
  38464. if (n === 8 && bufferLength === 0) {
  38465. return this.stream.getByte();
  38466. }
  38467. while (bufferLength < n) {
  38468. buffer = buffer << 8 | this.stream.getByte();
  38469. bufferLength += 8;
  38470. }
  38471. bufferLength -= n;
  38472. this.bufferLength = bufferLength;
  38473. this.buffer = buffer & (1 << bufferLength) - 1;
  38474. return buffer >> bufferLength;
  38475. }
  38476. align() {
  38477. this.buffer = 0;
  38478. this.bufferLength = 0;
  38479. }
  38480. readFlag() {
  38481. return this.readBits(this.context.bitsPerFlag);
  38482. }
  38483. readCoordinate() {
  38484. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  38485. const xi = this.readBits(bitsPerCoordinate);
  38486. const yi = this.readBits(bitsPerCoordinate);
  38487. const decode = this.context.decode;
  38488. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  38489. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  38490. }
  38491. readComponents() {
  38492. const numComps = this.context.numComps;
  38493. const bitsPerComponent = this.context.bitsPerComponent;
  38494. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  38495. const decode = this.context.decode;
  38496. const components = this.tmpCompsBuf;
  38497. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  38498. const ci = this.readBits(bitsPerComponent);
  38499. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  38500. }
  38501. const color = this.tmpCsCompsBuf;
  38502. if (this.context.colorFn) {
  38503. this.context.colorFn(components, 0, color, 0);
  38504. }
  38505. return this.context.colorSpace.getRgb(color, 0);
  38506. }
  38507. }
  38508. const getB = function getBClosure() {
  38509. function buildB(count) {
  38510. const lut = [];
  38511. for (let i = 0; i <= count; i++) {
  38512. const t = i / count,
  38513. t_ = 1 - t;
  38514. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  38515. }
  38516. return lut;
  38517. }
  38518. const cache = [];
  38519. return function (count) {
  38520. if (!cache[count]) {
  38521. cache[count] = buildB(count);
  38522. }
  38523. return cache[count];
  38524. };
  38525. }();
  38526. class MeshShading extends BaseShading {
  38527. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  38528. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  38529. }
  38530. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  38531. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  38532. }
  38533. static get TRIANGLE_DENSITY() {
  38534. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  38535. }
  38536. constructor(stream, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  38537. super();
  38538. if (!(0, _primitives.isStream)(stream)) {
  38539. throw new _util.FormatError("Mesh data is not a stream");
  38540. }
  38541. const dict = stream.dict;
  38542. this.matrix = matrix;
  38543. this.shadingType = dict.get("ShadingType");
  38544. const bbox = dict.getArray("BBox");
  38545. if (Array.isArray(bbox) && bbox.length === 4) {
  38546. this.bbox = _util.Util.normalizeRect(bbox);
  38547. } else {
  38548. this.bbox = null;
  38549. }
  38550. const cs = _colorspace.ColorSpace.parse({
  38551. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  38552. xref,
  38553. resources,
  38554. pdfFunctionFactory,
  38555. localColorSpaceCache
  38556. });
  38557. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  38558. const fnObj = dict.getRaw("Function");
  38559. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  38560. this.coords = [];
  38561. this.colors = [];
  38562. this.figures = [];
  38563. const decodeContext = {
  38564. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  38565. bitsPerComponent: dict.get("BitsPerComponent"),
  38566. bitsPerFlag: dict.get("BitsPerFlag"),
  38567. decode: dict.getArray("Decode"),
  38568. colorFn: fn,
  38569. colorSpace: cs,
  38570. numComps: fn ? 1 : cs.numComps
  38571. };
  38572. const reader = new MeshStreamReader(stream, decodeContext);
  38573. let patchMesh = false;
  38574. switch (this.shadingType) {
  38575. case ShadingType.FREE_FORM_MESH:
  38576. this._decodeType4Shading(reader);
  38577. break;
  38578. case ShadingType.LATTICE_FORM_MESH:
  38579. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  38580. if (verticesPerRow < 2) {
  38581. throw new _util.FormatError("Invalid VerticesPerRow");
  38582. }
  38583. this._decodeType5Shading(reader, verticesPerRow);
  38584. break;
  38585. case ShadingType.COONS_PATCH_MESH:
  38586. this._decodeType6Shading(reader);
  38587. patchMesh = true;
  38588. break;
  38589. case ShadingType.TENSOR_PATCH_MESH:
  38590. this._decodeType7Shading(reader);
  38591. patchMesh = true;
  38592. break;
  38593. default:
  38594. (0, _util.unreachable)("Unsupported mesh type.");
  38595. break;
  38596. }
  38597. if (patchMesh) {
  38598. this._updateBounds();
  38599. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  38600. this._buildFigureFromPatch(i);
  38601. }
  38602. }
  38603. this._updateBounds();
  38604. this._packData();
  38605. }
  38606. _decodeType4Shading(reader) {
  38607. const coords = this.coords;
  38608. const colors = this.colors;
  38609. const operators = [];
  38610. const ps = [];
  38611. let verticesLeft = 0;
  38612. while (reader.hasData) {
  38613. const f = reader.readFlag();
  38614. const coord = reader.readCoordinate();
  38615. const color = reader.readComponents();
  38616. if (verticesLeft === 0) {
  38617. if (!(0 <= f && f <= 2)) {
  38618. throw new _util.FormatError("Unknown type4 flag");
  38619. }
  38620. switch (f) {
  38621. case 0:
  38622. verticesLeft = 3;
  38623. break;
  38624. case 1:
  38625. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  38626. verticesLeft = 1;
  38627. break;
  38628. case 2:
  38629. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  38630. verticesLeft = 1;
  38631. break;
  38632. }
  38633. operators.push(f);
  38634. }
  38635. ps.push(coords.length);
  38636. coords.push(coord);
  38637. colors.push(color);
  38638. verticesLeft--;
  38639. reader.align();
  38640. }
  38641. this.figures.push({
  38642. type: "triangles",
  38643. coords: new Int32Array(ps),
  38644. colors: new Int32Array(ps)
  38645. });
  38646. }
  38647. _decodeType5Shading(reader, verticesPerRow) {
  38648. const coords = this.coords;
  38649. const colors = this.colors;
  38650. const ps = [];
  38651. while (reader.hasData) {
  38652. const coord = reader.readCoordinate();
  38653. const color = reader.readComponents();
  38654. ps.push(coords.length);
  38655. coords.push(coord);
  38656. colors.push(color);
  38657. }
  38658. this.figures.push({
  38659. type: "lattice",
  38660. coords: new Int32Array(ps),
  38661. colors: new Int32Array(ps),
  38662. verticesPerRow
  38663. });
  38664. }
  38665. _decodeType6Shading(reader) {
  38666. const coords = this.coords;
  38667. const colors = this.colors;
  38668. const ps = new Int32Array(16);
  38669. const cs = new Int32Array(4);
  38670. while (reader.hasData) {
  38671. const f = reader.readFlag();
  38672. if (!(0 <= f && f <= 3)) {
  38673. throw new _util.FormatError("Unknown type6 flag");
  38674. }
  38675. const pi = coords.length;
  38676. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  38677. coords.push(reader.readCoordinate());
  38678. }
  38679. const ci = colors.length;
  38680. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  38681. colors.push(reader.readComponents());
  38682. }
  38683. let tmp1, tmp2, tmp3, tmp4;
  38684. switch (f) {
  38685. case 0:
  38686. ps[12] = pi + 3;
  38687. ps[13] = pi + 4;
  38688. ps[14] = pi + 5;
  38689. ps[15] = pi + 6;
  38690. ps[8] = pi + 2;
  38691. ps[11] = pi + 7;
  38692. ps[4] = pi + 1;
  38693. ps[7] = pi + 8;
  38694. ps[0] = pi;
  38695. ps[1] = pi + 11;
  38696. ps[2] = pi + 10;
  38697. ps[3] = pi + 9;
  38698. cs[2] = ci + 1;
  38699. cs[3] = ci + 2;
  38700. cs[0] = ci;
  38701. cs[1] = ci + 3;
  38702. break;
  38703. case 1:
  38704. tmp1 = ps[12];
  38705. tmp2 = ps[13];
  38706. tmp3 = ps[14];
  38707. tmp4 = ps[15];
  38708. ps[12] = tmp4;
  38709. ps[13] = pi + 0;
  38710. ps[14] = pi + 1;
  38711. ps[15] = pi + 2;
  38712. ps[8] = tmp3;
  38713. ps[11] = pi + 3;
  38714. ps[4] = tmp2;
  38715. ps[7] = pi + 4;
  38716. ps[0] = tmp1;
  38717. ps[1] = pi + 7;
  38718. ps[2] = pi + 6;
  38719. ps[3] = pi + 5;
  38720. tmp1 = cs[2];
  38721. tmp2 = cs[3];
  38722. cs[2] = tmp2;
  38723. cs[3] = ci;
  38724. cs[0] = tmp1;
  38725. cs[1] = ci + 1;
  38726. break;
  38727. case 2:
  38728. tmp1 = ps[15];
  38729. tmp2 = ps[11];
  38730. ps[12] = ps[3];
  38731. ps[13] = pi + 0;
  38732. ps[14] = pi + 1;
  38733. ps[15] = pi + 2;
  38734. ps[8] = ps[7];
  38735. ps[11] = pi + 3;
  38736. ps[4] = tmp2;
  38737. ps[7] = pi + 4;
  38738. ps[0] = tmp1;
  38739. ps[1] = pi + 7;
  38740. ps[2] = pi + 6;
  38741. ps[3] = pi + 5;
  38742. tmp1 = cs[3];
  38743. cs[2] = cs[1];
  38744. cs[3] = ci;
  38745. cs[0] = tmp1;
  38746. cs[1] = ci + 1;
  38747. break;
  38748. case 3:
  38749. ps[12] = ps[0];
  38750. ps[13] = pi + 0;
  38751. ps[14] = pi + 1;
  38752. ps[15] = pi + 2;
  38753. ps[8] = ps[1];
  38754. ps[11] = pi + 3;
  38755. ps[4] = ps[2];
  38756. ps[7] = pi + 4;
  38757. ps[0] = ps[3];
  38758. ps[1] = pi + 7;
  38759. ps[2] = pi + 6;
  38760. ps[3] = pi + 5;
  38761. cs[2] = cs[0];
  38762. cs[3] = ci;
  38763. cs[0] = cs[1];
  38764. cs[1] = ci + 1;
  38765. break;
  38766. }
  38767. ps[5] = coords.length;
  38768. 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]);
  38769. ps[6] = coords.length;
  38770. 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]);
  38771. ps[9] = coords.length;
  38772. 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]);
  38773. ps[10] = coords.length;
  38774. 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]);
  38775. this.figures.push({
  38776. type: "patch",
  38777. coords: new Int32Array(ps),
  38778. colors: new Int32Array(cs)
  38779. });
  38780. }
  38781. }
  38782. _decodeType7Shading(reader) {
  38783. const coords = this.coords;
  38784. const colors = this.colors;
  38785. const ps = new Int32Array(16);
  38786. const cs = new Int32Array(4);
  38787. while (reader.hasData) {
  38788. const f = reader.readFlag();
  38789. if (!(0 <= f && f <= 3)) {
  38790. throw new _util.FormatError("Unknown type7 flag");
  38791. }
  38792. const pi = coords.length;
  38793. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  38794. coords.push(reader.readCoordinate());
  38795. }
  38796. const ci = colors.length;
  38797. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  38798. colors.push(reader.readComponents());
  38799. }
  38800. let tmp1, tmp2, tmp3, tmp4;
  38801. switch (f) {
  38802. case 0:
  38803. ps[12] = pi + 3;
  38804. ps[13] = pi + 4;
  38805. ps[14] = pi + 5;
  38806. ps[15] = pi + 6;
  38807. ps[8] = pi + 2;
  38808. ps[9] = pi + 13;
  38809. ps[10] = pi + 14;
  38810. ps[11] = pi + 7;
  38811. ps[4] = pi + 1;
  38812. ps[5] = pi + 12;
  38813. ps[6] = pi + 15;
  38814. ps[7] = pi + 8;
  38815. ps[0] = pi;
  38816. ps[1] = pi + 11;
  38817. ps[2] = pi + 10;
  38818. ps[3] = pi + 9;
  38819. cs[2] = ci + 1;
  38820. cs[3] = ci + 2;
  38821. cs[0] = ci;
  38822. cs[1] = ci + 3;
  38823. break;
  38824. case 1:
  38825. tmp1 = ps[12];
  38826. tmp2 = ps[13];
  38827. tmp3 = ps[14];
  38828. tmp4 = ps[15];
  38829. ps[12] = tmp4;
  38830. ps[13] = pi + 0;
  38831. ps[14] = pi + 1;
  38832. ps[15] = pi + 2;
  38833. ps[8] = tmp3;
  38834. ps[9] = pi + 9;
  38835. ps[10] = pi + 10;
  38836. ps[11] = pi + 3;
  38837. ps[4] = tmp2;
  38838. ps[5] = pi + 8;
  38839. ps[6] = pi + 11;
  38840. ps[7] = pi + 4;
  38841. ps[0] = tmp1;
  38842. ps[1] = pi + 7;
  38843. ps[2] = pi + 6;
  38844. ps[3] = pi + 5;
  38845. tmp1 = cs[2];
  38846. tmp2 = cs[3];
  38847. cs[2] = tmp2;
  38848. cs[3] = ci;
  38849. cs[0] = tmp1;
  38850. cs[1] = ci + 1;
  38851. break;
  38852. case 2:
  38853. tmp1 = ps[15];
  38854. tmp2 = ps[11];
  38855. ps[12] = ps[3];
  38856. ps[13] = pi + 0;
  38857. ps[14] = pi + 1;
  38858. ps[15] = pi + 2;
  38859. ps[8] = ps[7];
  38860. ps[9] = pi + 9;
  38861. ps[10] = pi + 10;
  38862. ps[11] = pi + 3;
  38863. ps[4] = tmp2;
  38864. ps[5] = pi + 8;
  38865. ps[6] = pi + 11;
  38866. ps[7] = pi + 4;
  38867. ps[0] = tmp1;
  38868. ps[1] = pi + 7;
  38869. ps[2] = pi + 6;
  38870. ps[3] = pi + 5;
  38871. tmp1 = cs[3];
  38872. cs[2] = cs[1];
  38873. cs[3] = ci;
  38874. cs[0] = tmp1;
  38875. cs[1] = ci + 1;
  38876. break;
  38877. case 3:
  38878. ps[12] = ps[0];
  38879. ps[13] = pi + 0;
  38880. ps[14] = pi + 1;
  38881. ps[15] = pi + 2;
  38882. ps[8] = ps[1];
  38883. ps[9] = pi + 9;
  38884. ps[10] = pi + 10;
  38885. ps[11] = pi + 3;
  38886. ps[4] = ps[2];
  38887. ps[5] = pi + 8;
  38888. ps[6] = pi + 11;
  38889. ps[7] = pi + 4;
  38890. ps[0] = ps[3];
  38891. ps[1] = pi + 7;
  38892. ps[2] = pi + 6;
  38893. ps[3] = pi + 5;
  38894. cs[2] = cs[0];
  38895. cs[3] = ci;
  38896. cs[0] = cs[1];
  38897. cs[1] = ci + 1;
  38898. break;
  38899. }
  38900. this.figures.push({
  38901. type: "patch",
  38902. coords: new Int32Array(ps),
  38903. colors: new Int32Array(cs)
  38904. });
  38905. }
  38906. }
  38907. _buildFigureFromPatch(index) {
  38908. const figure = this.figures[index];
  38909. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  38910. const coords = this.coords,
  38911. colors = this.colors;
  38912. const pi = figure.coords;
  38913. const ci = figure.colors;
  38914. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  38915. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  38916. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  38917. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  38918. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  38919. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  38920. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  38921. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  38922. const verticesPerRow = splitXBy + 1;
  38923. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  38924. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  38925. let k = 0;
  38926. const cl = new Uint8Array(3),
  38927. cr = new Uint8Array(3);
  38928. const c0 = colors[ci[0]],
  38929. c1 = colors[ci[1]],
  38930. c2 = colors[ci[2]],
  38931. c3 = colors[ci[3]];
  38932. const bRow = getB(splitYBy),
  38933. bCol = getB(splitXBy);
  38934. for (let row = 0; row <= splitYBy; row++) {
  38935. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  38936. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  38937. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  38938. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  38939. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  38940. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  38941. for (let col = 0; col <= splitXBy; col++, k++) {
  38942. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  38943. continue;
  38944. }
  38945. let x = 0,
  38946. y = 0;
  38947. let q = 0;
  38948. for (let i = 0; i <= 3; i++) {
  38949. for (let j = 0; j <= 3; j++, q++) {
  38950. const m = bRow[row][i] * bCol[col][j];
  38951. x += coords[pi[q]][0] * m;
  38952. y += coords[pi[q]][1] * m;
  38953. }
  38954. }
  38955. figureCoords[k] = coords.length;
  38956. coords.push([x, y]);
  38957. figureColors[k] = colors.length;
  38958. const newColor = new Uint8Array(3);
  38959. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  38960. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  38961. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  38962. colors.push(newColor);
  38963. }
  38964. }
  38965. figureCoords[0] = pi[0];
  38966. figureColors[0] = ci[0];
  38967. figureCoords[splitXBy] = pi[3];
  38968. figureColors[splitXBy] = ci[1];
  38969. figureCoords[verticesPerRow * splitYBy] = pi[12];
  38970. figureColors[verticesPerRow * splitYBy] = ci[2];
  38971. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  38972. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  38973. this.figures[index] = {
  38974. type: "lattice",
  38975. coords: figureCoords,
  38976. colors: figureColors,
  38977. verticesPerRow
  38978. };
  38979. }
  38980. _updateBounds() {
  38981. let minX = this.coords[0][0],
  38982. minY = this.coords[0][1],
  38983. maxX = minX,
  38984. maxY = minY;
  38985. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  38986. const x = this.coords[i][0],
  38987. y = this.coords[i][1];
  38988. minX = minX > x ? x : minX;
  38989. minY = minY > y ? y : minY;
  38990. maxX = maxX < x ? x : maxX;
  38991. maxY = maxY < y ? y : maxY;
  38992. }
  38993. this.bounds = [minX, minY, maxX, maxY];
  38994. }
  38995. _packData() {
  38996. let i, ii, j, jj;
  38997. const coords = this.coords;
  38998. const coordsPacked = new Float32Array(coords.length * 2);
  38999. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  39000. const xy = coords[i];
  39001. coordsPacked[j++] = xy[0];
  39002. coordsPacked[j++] = xy[1];
  39003. }
  39004. this.coords = coordsPacked;
  39005. const colors = this.colors;
  39006. const colorsPacked = new Uint8Array(colors.length * 3);
  39007. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  39008. const c = colors[i];
  39009. colorsPacked[j++] = c[0];
  39010. colorsPacked[j++] = c[1];
  39011. colorsPacked[j++] = c[2];
  39012. }
  39013. this.colors = colorsPacked;
  39014. const figures = this.figures;
  39015. for (i = 0, ii = figures.length; i < ii; i++) {
  39016. const figure = figures[i],
  39017. ps = figure.coords,
  39018. cs = figure.colors;
  39019. for (j = 0, jj = ps.length; j < jj; j++) {
  39020. ps[j] *= 2;
  39021. cs[j] *= 3;
  39022. }
  39023. }
  39024. }
  39025. getIR() {
  39026. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  39027. }
  39028. }
  39029. class DummyShading extends BaseShading {
  39030. getIR() {
  39031. return ["Dummy"];
  39032. }
  39033. }
  39034. function getTilingPatternIR(operatorList, dict, color) {
  39035. const matrix = dict.getArray("Matrix");
  39036. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  39037. const xstep = dict.get("XStep");
  39038. const ystep = dict.get("YStep");
  39039. const paintType = dict.get("PaintType");
  39040. const tilingType = dict.get("TilingType");
  39041. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  39042. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  39043. }
  39044. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  39045. }
  39046. /***/ }),
  39047. /* 50 */
  39048. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39049. Object.defineProperty(exports, "__esModule", ({
  39050. value: true
  39051. }));
  39052. exports.isPDFFunction = isPDFFunction;
  39053. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  39054. var _primitives = __w_pdfjs_require__(5);
  39055. var _util = __w_pdfjs_require__(2);
  39056. var _ps_parser = __w_pdfjs_require__(51);
  39057. var _image_utils = __w_pdfjs_require__(52);
  39058. class PDFFunctionFactory {
  39059. constructor({
  39060. xref,
  39061. isEvalSupported = true
  39062. }) {
  39063. this.xref = xref;
  39064. this.isEvalSupported = isEvalSupported !== false;
  39065. }
  39066. create(fn) {
  39067. const cachedFunction = this.getCached(fn);
  39068. if (cachedFunction) {
  39069. return cachedFunction;
  39070. }
  39071. const parsedFunction = PDFFunction.parse({
  39072. xref: this.xref,
  39073. isEvalSupported: this.isEvalSupported,
  39074. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  39075. });
  39076. this._cache(fn, parsedFunction);
  39077. return parsedFunction;
  39078. }
  39079. createFromArray(fnObj) {
  39080. const cachedFunction = this.getCached(fnObj);
  39081. if (cachedFunction) {
  39082. return cachedFunction;
  39083. }
  39084. const parsedFunction = PDFFunction.parseArray({
  39085. xref: this.xref,
  39086. isEvalSupported: this.isEvalSupported,
  39087. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  39088. });
  39089. this._cache(fnObj, parsedFunction);
  39090. return parsedFunction;
  39091. }
  39092. getCached(cacheKey) {
  39093. let fnRef;
  39094. if (cacheKey instanceof _primitives.Ref) {
  39095. fnRef = cacheKey;
  39096. } else if (cacheKey instanceof _primitives.Dict) {
  39097. fnRef = cacheKey.objId;
  39098. } else if ((0, _primitives.isStream)(cacheKey)) {
  39099. fnRef = cacheKey.dict && cacheKey.dict.objId;
  39100. }
  39101. if (fnRef) {
  39102. const localFunction = this._localFunctionCache.getByRef(fnRef);
  39103. if (localFunction) {
  39104. return localFunction;
  39105. }
  39106. }
  39107. return null;
  39108. }
  39109. _cache(cacheKey, parsedFunction) {
  39110. if (!parsedFunction) {
  39111. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  39112. }
  39113. let fnRef;
  39114. if (cacheKey instanceof _primitives.Ref) {
  39115. fnRef = cacheKey;
  39116. } else if (cacheKey instanceof _primitives.Dict) {
  39117. fnRef = cacheKey.objId;
  39118. } else if ((0, _primitives.isStream)(cacheKey)) {
  39119. fnRef = cacheKey.dict && cacheKey.dict.objId;
  39120. }
  39121. if (fnRef) {
  39122. this._localFunctionCache.set(null, fnRef, parsedFunction);
  39123. }
  39124. }
  39125. get _localFunctionCache() {
  39126. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  39127. }
  39128. }
  39129. exports.PDFFunctionFactory = PDFFunctionFactory;
  39130. function toNumberArray(arr) {
  39131. if (!Array.isArray(arr)) {
  39132. return null;
  39133. }
  39134. const length = arr.length;
  39135. for (let i = 0; i < length; i++) {
  39136. if (typeof arr[i] !== "number") {
  39137. const result = new Array(length);
  39138. for (let j = 0; j < length; j++) {
  39139. result[j] = +arr[j];
  39140. }
  39141. return result;
  39142. }
  39143. }
  39144. return arr;
  39145. }
  39146. class PDFFunction {
  39147. static getSampleArray(size, outputSize, bps, stream) {
  39148. let i, ii;
  39149. let length = 1;
  39150. for (i = 0, ii = size.length; i < ii; i++) {
  39151. length *= size[i];
  39152. }
  39153. length *= outputSize;
  39154. const array = new Array(length);
  39155. let codeSize = 0;
  39156. let codeBuf = 0;
  39157. const sampleMul = 1.0 / (2.0 ** bps - 1);
  39158. const strBytes = stream.getBytes((length * bps + 7) / 8);
  39159. let strIdx = 0;
  39160. for (i = 0; i < length; i++) {
  39161. while (codeSize < bps) {
  39162. codeBuf <<= 8;
  39163. codeBuf |= strBytes[strIdx++];
  39164. codeSize += 8;
  39165. }
  39166. codeSize -= bps;
  39167. array[i] = (codeBuf >> codeSize) * sampleMul;
  39168. codeBuf &= (1 << codeSize) - 1;
  39169. }
  39170. return array;
  39171. }
  39172. static parse({
  39173. xref,
  39174. isEvalSupported,
  39175. fn
  39176. }) {
  39177. const dict = fn.dict || fn;
  39178. const typeNum = dict.get("FunctionType");
  39179. switch (typeNum) {
  39180. case 0:
  39181. return this.constructSampled({
  39182. xref,
  39183. isEvalSupported,
  39184. fn,
  39185. dict
  39186. });
  39187. case 1:
  39188. break;
  39189. case 2:
  39190. return this.constructInterpolated({
  39191. xref,
  39192. isEvalSupported,
  39193. dict
  39194. });
  39195. case 3:
  39196. return this.constructStiched({
  39197. xref,
  39198. isEvalSupported,
  39199. dict
  39200. });
  39201. case 4:
  39202. return this.constructPostScript({
  39203. xref,
  39204. isEvalSupported,
  39205. fn,
  39206. dict
  39207. });
  39208. }
  39209. throw new _util.FormatError("Unknown type of function");
  39210. }
  39211. static parseArray({
  39212. xref,
  39213. isEvalSupported,
  39214. fnObj
  39215. }) {
  39216. if (!Array.isArray(fnObj)) {
  39217. return this.parse({
  39218. xref,
  39219. isEvalSupported,
  39220. fn: fnObj
  39221. });
  39222. }
  39223. const fnArray = [];
  39224. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  39225. fnArray.push(this.parse({
  39226. xref,
  39227. isEvalSupported,
  39228. fn: xref.fetchIfRef(fnObj[j])
  39229. }));
  39230. }
  39231. return function (src, srcOffset, dest, destOffset) {
  39232. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  39233. fnArray[i](src, srcOffset, dest, destOffset + i);
  39234. }
  39235. };
  39236. }
  39237. static constructSampled({
  39238. xref,
  39239. isEvalSupported,
  39240. fn,
  39241. dict
  39242. }) {
  39243. function toMultiArray(arr) {
  39244. const inputLength = arr.length;
  39245. const out = [];
  39246. let index = 0;
  39247. for (let i = 0; i < inputLength; i += 2) {
  39248. out[index++] = [arr[i], arr[i + 1]];
  39249. }
  39250. return out;
  39251. }
  39252. function interpolate(x, xmin, xmax, ymin, ymax) {
  39253. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  39254. }
  39255. let domain = toNumberArray(dict.getArray("Domain"));
  39256. let range = toNumberArray(dict.getArray("Range"));
  39257. if (!domain || !range) {
  39258. throw new _util.FormatError("No domain or range");
  39259. }
  39260. const inputSize = domain.length / 2;
  39261. const outputSize = range.length / 2;
  39262. domain = toMultiArray(domain);
  39263. range = toMultiArray(range);
  39264. const size = toNumberArray(dict.getArray("Size"));
  39265. const bps = dict.get("BitsPerSample");
  39266. const order = dict.get("Order") || 1;
  39267. if (order !== 1) {
  39268. (0, _util.info)("No support for cubic spline interpolation: " + order);
  39269. }
  39270. let encode = toNumberArray(dict.getArray("Encode"));
  39271. if (!encode) {
  39272. encode = [];
  39273. for (let i = 0; i < inputSize; ++i) {
  39274. encode.push([0, size[i] - 1]);
  39275. }
  39276. } else {
  39277. encode = toMultiArray(encode);
  39278. }
  39279. let decode = toNumberArray(dict.getArray("Decode"));
  39280. if (!decode) {
  39281. decode = range;
  39282. } else {
  39283. decode = toMultiArray(decode);
  39284. }
  39285. const samples = this.getSampleArray(size, outputSize, bps, fn);
  39286. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  39287. const cubeVertices = 1 << inputSize;
  39288. const cubeN = new Float64Array(cubeVertices);
  39289. const cubeVertex = new Uint32Array(cubeVertices);
  39290. let i, j;
  39291. for (j = 0; j < cubeVertices; j++) {
  39292. cubeN[j] = 1;
  39293. }
  39294. let k = outputSize,
  39295. pos = 1;
  39296. for (i = 0; i < inputSize; ++i) {
  39297. const domain_2i = domain[i][0];
  39298. const domain_2i_1 = domain[i][1];
  39299. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  39300. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  39301. const size_i = size[i];
  39302. e = Math.min(Math.max(e, 0), size_i - 1);
  39303. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  39304. const n0 = e0 + 1 - e;
  39305. const n1 = e - e0;
  39306. const offset0 = e0 * k;
  39307. const offset1 = offset0 + k;
  39308. for (j = 0; j < cubeVertices; j++) {
  39309. if (j & pos) {
  39310. cubeN[j] *= n1;
  39311. cubeVertex[j] += offset1;
  39312. } else {
  39313. cubeN[j] *= n0;
  39314. cubeVertex[j] += offset0;
  39315. }
  39316. }
  39317. k *= size_i;
  39318. pos <<= 1;
  39319. }
  39320. for (j = 0; j < outputSize; ++j) {
  39321. let rj = 0;
  39322. for (i = 0; i < cubeVertices; i++) {
  39323. rj += samples[cubeVertex[i] + j] * cubeN[i];
  39324. }
  39325. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  39326. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  39327. }
  39328. };
  39329. }
  39330. static constructInterpolated({
  39331. xref,
  39332. isEvalSupported,
  39333. dict
  39334. }) {
  39335. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  39336. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  39337. const n = dict.get("N");
  39338. const diff = [];
  39339. for (let i = 0, ii = c0.length; i < ii; ++i) {
  39340. diff.push(c1[i] - c0[i]);
  39341. }
  39342. const length = diff.length;
  39343. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  39344. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  39345. for (let j = 0; j < length; ++j) {
  39346. dest[destOffset + j] = c0[j] + x * diff[j];
  39347. }
  39348. };
  39349. }
  39350. static constructStiched({
  39351. xref,
  39352. isEvalSupported,
  39353. dict
  39354. }) {
  39355. const domain = toNumberArray(dict.getArray("Domain"));
  39356. if (!domain) {
  39357. throw new _util.FormatError("No domain");
  39358. }
  39359. const inputSize = domain.length / 2;
  39360. if (inputSize !== 1) {
  39361. throw new _util.FormatError("Bad domain for stiched function");
  39362. }
  39363. const fnRefs = dict.get("Functions");
  39364. const fns = [];
  39365. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  39366. fns.push(this.parse({
  39367. xref,
  39368. isEvalSupported,
  39369. fn: xref.fetchIfRef(fnRefs[i])
  39370. }));
  39371. }
  39372. const bounds = toNumberArray(dict.getArray("Bounds"));
  39373. const encode = toNumberArray(dict.getArray("Encode"));
  39374. const tmpBuf = new Float32Array(1);
  39375. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  39376. const clip = function constructStichedFromIRClip(v, min, max) {
  39377. if (v > max) {
  39378. v = max;
  39379. } else if (v < min) {
  39380. v = min;
  39381. }
  39382. return v;
  39383. };
  39384. const v = clip(src[srcOffset], domain[0], domain[1]);
  39385. const length = bounds.length;
  39386. let i;
  39387. for (i = 0; i < length; ++i) {
  39388. if (v < bounds[i]) {
  39389. break;
  39390. }
  39391. }
  39392. let dmin = domain[0];
  39393. if (i > 0) {
  39394. dmin = bounds[i - 1];
  39395. }
  39396. let dmax = domain[1];
  39397. if (i < bounds.length) {
  39398. dmax = bounds[i];
  39399. }
  39400. const rmin = encode[2 * i];
  39401. const rmax = encode[2 * i + 1];
  39402. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  39403. fns[i](tmpBuf, 0, dest, destOffset);
  39404. };
  39405. }
  39406. static constructPostScript({
  39407. xref,
  39408. isEvalSupported,
  39409. fn,
  39410. dict
  39411. }) {
  39412. const domain = toNumberArray(dict.getArray("Domain"));
  39413. const range = toNumberArray(dict.getArray("Range"));
  39414. if (!domain) {
  39415. throw new _util.FormatError("No domain.");
  39416. }
  39417. if (!range) {
  39418. throw new _util.FormatError("No range.");
  39419. }
  39420. const lexer = new _ps_parser.PostScriptLexer(fn);
  39421. const parser = new _ps_parser.PostScriptParser(lexer);
  39422. const code = parser.parse();
  39423. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  39424. const compiled = new PostScriptCompiler().compile(code, domain, range);
  39425. if (compiled) {
  39426. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  39427. }
  39428. }
  39429. (0, _util.info)("Unable to compile PS function");
  39430. const numOutputs = range.length >> 1;
  39431. const numInputs = domain.length >> 1;
  39432. const evaluator = new PostScriptEvaluator(code);
  39433. const cache = Object.create(null);
  39434. const MAX_CACHE_SIZE = 2048 * 4;
  39435. let cache_available = MAX_CACHE_SIZE;
  39436. const tmpBuf = new Float32Array(numInputs);
  39437. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  39438. let i, value;
  39439. let key = "";
  39440. const input = tmpBuf;
  39441. for (i = 0; i < numInputs; i++) {
  39442. value = src[srcOffset + i];
  39443. input[i] = value;
  39444. key += value + "_";
  39445. }
  39446. const cachedValue = cache[key];
  39447. if (cachedValue !== undefined) {
  39448. dest.set(cachedValue, destOffset);
  39449. return;
  39450. }
  39451. const output = new Float32Array(numOutputs);
  39452. const stack = evaluator.execute(input);
  39453. const stackIndex = stack.length - numOutputs;
  39454. for (i = 0; i < numOutputs; i++) {
  39455. value = stack[stackIndex + i];
  39456. let bound = range[i * 2];
  39457. if (value < bound) {
  39458. value = bound;
  39459. } else {
  39460. bound = range[i * 2 + 1];
  39461. if (value > bound) {
  39462. value = bound;
  39463. }
  39464. }
  39465. output[i] = value;
  39466. }
  39467. if (cache_available > 0) {
  39468. cache_available--;
  39469. cache[key] = output;
  39470. }
  39471. dest.set(output, destOffset);
  39472. };
  39473. }
  39474. }
  39475. function isPDFFunction(v) {
  39476. let fnDict;
  39477. if (typeof v !== "object") {
  39478. return false;
  39479. } else if ((0, _primitives.isDict)(v)) {
  39480. fnDict = v;
  39481. } else if ((0, _primitives.isStream)(v)) {
  39482. fnDict = v.dict;
  39483. } else {
  39484. return false;
  39485. }
  39486. return fnDict.has("FunctionType");
  39487. }
  39488. class PostScriptStack {
  39489. static get MAX_STACK_SIZE() {
  39490. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  39491. }
  39492. constructor(initialStack) {
  39493. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  39494. }
  39495. push(value) {
  39496. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  39497. throw new Error("PostScript function stack overflow.");
  39498. }
  39499. this.stack.push(value);
  39500. }
  39501. pop() {
  39502. if (this.stack.length <= 0) {
  39503. throw new Error("PostScript function stack underflow.");
  39504. }
  39505. return this.stack.pop();
  39506. }
  39507. copy(n) {
  39508. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  39509. throw new Error("PostScript function stack overflow.");
  39510. }
  39511. const stack = this.stack;
  39512. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  39513. stack.push(stack[i]);
  39514. }
  39515. }
  39516. index(n) {
  39517. this.push(this.stack[this.stack.length - n - 1]);
  39518. }
  39519. roll(n, p) {
  39520. const stack = this.stack;
  39521. const l = stack.length - n;
  39522. const r = stack.length - 1;
  39523. const c = l + (p - Math.floor(p / n) * n);
  39524. for (let i = l, j = r; i < j; i++, j--) {
  39525. const t = stack[i];
  39526. stack[i] = stack[j];
  39527. stack[j] = t;
  39528. }
  39529. for (let i = l, j = c - 1; i < j; i++, j--) {
  39530. const t = stack[i];
  39531. stack[i] = stack[j];
  39532. stack[j] = t;
  39533. }
  39534. for (let i = c, j = r; i < j; i++, j--) {
  39535. const t = stack[i];
  39536. stack[i] = stack[j];
  39537. stack[j] = t;
  39538. }
  39539. }
  39540. }
  39541. class PostScriptEvaluator {
  39542. constructor(operators) {
  39543. this.operators = operators;
  39544. }
  39545. execute(initialStack) {
  39546. const stack = new PostScriptStack(initialStack);
  39547. let counter = 0;
  39548. const operators = this.operators;
  39549. const length = operators.length;
  39550. let operator, a, b;
  39551. while (counter < length) {
  39552. operator = operators[counter++];
  39553. if (typeof operator === "number") {
  39554. stack.push(operator);
  39555. continue;
  39556. }
  39557. switch (operator) {
  39558. case "jz":
  39559. b = stack.pop();
  39560. a = stack.pop();
  39561. if (!a) {
  39562. counter = b;
  39563. }
  39564. break;
  39565. case "j":
  39566. a = stack.pop();
  39567. counter = a;
  39568. break;
  39569. case "abs":
  39570. a = stack.pop();
  39571. stack.push(Math.abs(a));
  39572. break;
  39573. case "add":
  39574. b = stack.pop();
  39575. a = stack.pop();
  39576. stack.push(a + b);
  39577. break;
  39578. case "and":
  39579. b = stack.pop();
  39580. a = stack.pop();
  39581. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  39582. stack.push(a && b);
  39583. } else {
  39584. stack.push(a & b);
  39585. }
  39586. break;
  39587. case "atan":
  39588. a = stack.pop();
  39589. stack.push(Math.atan(a));
  39590. break;
  39591. case "bitshift":
  39592. b = stack.pop();
  39593. a = stack.pop();
  39594. if (a > 0) {
  39595. stack.push(a << b);
  39596. } else {
  39597. stack.push(a >> b);
  39598. }
  39599. break;
  39600. case "ceiling":
  39601. a = stack.pop();
  39602. stack.push(Math.ceil(a));
  39603. break;
  39604. case "copy":
  39605. a = stack.pop();
  39606. stack.copy(a);
  39607. break;
  39608. case "cos":
  39609. a = stack.pop();
  39610. stack.push(Math.cos(a));
  39611. break;
  39612. case "cvi":
  39613. a = stack.pop() | 0;
  39614. stack.push(a);
  39615. break;
  39616. case "cvr":
  39617. break;
  39618. case "div":
  39619. b = stack.pop();
  39620. a = stack.pop();
  39621. stack.push(a / b);
  39622. break;
  39623. case "dup":
  39624. stack.copy(1);
  39625. break;
  39626. case "eq":
  39627. b = stack.pop();
  39628. a = stack.pop();
  39629. stack.push(a === b);
  39630. break;
  39631. case "exch":
  39632. stack.roll(2, 1);
  39633. break;
  39634. case "exp":
  39635. b = stack.pop();
  39636. a = stack.pop();
  39637. stack.push(a ** b);
  39638. break;
  39639. case "false":
  39640. stack.push(false);
  39641. break;
  39642. case "floor":
  39643. a = stack.pop();
  39644. stack.push(Math.floor(a));
  39645. break;
  39646. case "ge":
  39647. b = stack.pop();
  39648. a = stack.pop();
  39649. stack.push(a >= b);
  39650. break;
  39651. case "gt":
  39652. b = stack.pop();
  39653. a = stack.pop();
  39654. stack.push(a > b);
  39655. break;
  39656. case "idiv":
  39657. b = stack.pop();
  39658. a = stack.pop();
  39659. stack.push(a / b | 0);
  39660. break;
  39661. case "index":
  39662. a = stack.pop();
  39663. stack.index(a);
  39664. break;
  39665. case "le":
  39666. b = stack.pop();
  39667. a = stack.pop();
  39668. stack.push(a <= b);
  39669. break;
  39670. case "ln":
  39671. a = stack.pop();
  39672. stack.push(Math.log(a));
  39673. break;
  39674. case "log":
  39675. a = stack.pop();
  39676. stack.push(Math.log(a) / Math.LN10);
  39677. break;
  39678. case "lt":
  39679. b = stack.pop();
  39680. a = stack.pop();
  39681. stack.push(a < b);
  39682. break;
  39683. case "mod":
  39684. b = stack.pop();
  39685. a = stack.pop();
  39686. stack.push(a % b);
  39687. break;
  39688. case "mul":
  39689. b = stack.pop();
  39690. a = stack.pop();
  39691. stack.push(a * b);
  39692. break;
  39693. case "ne":
  39694. b = stack.pop();
  39695. a = stack.pop();
  39696. stack.push(a !== b);
  39697. break;
  39698. case "neg":
  39699. a = stack.pop();
  39700. stack.push(-a);
  39701. break;
  39702. case "not":
  39703. a = stack.pop();
  39704. if ((0, _util.isBool)(a)) {
  39705. stack.push(!a);
  39706. } else {
  39707. stack.push(~a);
  39708. }
  39709. break;
  39710. case "or":
  39711. b = stack.pop();
  39712. a = stack.pop();
  39713. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  39714. stack.push(a || b);
  39715. } else {
  39716. stack.push(a | b);
  39717. }
  39718. break;
  39719. case "pop":
  39720. stack.pop();
  39721. break;
  39722. case "roll":
  39723. b = stack.pop();
  39724. a = stack.pop();
  39725. stack.roll(a, b);
  39726. break;
  39727. case "round":
  39728. a = stack.pop();
  39729. stack.push(Math.round(a));
  39730. break;
  39731. case "sin":
  39732. a = stack.pop();
  39733. stack.push(Math.sin(a));
  39734. break;
  39735. case "sqrt":
  39736. a = stack.pop();
  39737. stack.push(Math.sqrt(a));
  39738. break;
  39739. case "sub":
  39740. b = stack.pop();
  39741. a = stack.pop();
  39742. stack.push(a - b);
  39743. break;
  39744. case "true":
  39745. stack.push(true);
  39746. break;
  39747. case "truncate":
  39748. a = stack.pop();
  39749. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  39750. stack.push(a);
  39751. break;
  39752. case "xor":
  39753. b = stack.pop();
  39754. a = stack.pop();
  39755. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  39756. stack.push(a !== b);
  39757. } else {
  39758. stack.push(a ^ b);
  39759. }
  39760. break;
  39761. default:
  39762. throw new _util.FormatError(`Unknown operator ${operator}`);
  39763. }
  39764. }
  39765. return stack.stack;
  39766. }
  39767. }
  39768. exports.PostScriptEvaluator = PostScriptEvaluator;
  39769. const PostScriptCompiler = function PostScriptCompilerClosure() {
  39770. class AstNode {
  39771. constructor(type) {
  39772. this.type = type;
  39773. }
  39774. visit(visitor) {
  39775. (0, _util.unreachable)("abstract method");
  39776. }
  39777. }
  39778. class AstArgument extends AstNode {
  39779. constructor(index, min, max) {
  39780. super("args");
  39781. this.index = index;
  39782. this.min = min;
  39783. this.max = max;
  39784. }
  39785. visit(visitor) {
  39786. visitor.visitArgument(this);
  39787. }
  39788. }
  39789. class AstLiteral extends AstNode {
  39790. constructor(number) {
  39791. super("literal");
  39792. this.number = number;
  39793. this.min = number;
  39794. this.max = number;
  39795. }
  39796. visit(visitor) {
  39797. visitor.visitLiteral(this);
  39798. }
  39799. }
  39800. class AstBinaryOperation extends AstNode {
  39801. constructor(op, arg1, arg2, min, max) {
  39802. super("binary");
  39803. this.op = op;
  39804. this.arg1 = arg1;
  39805. this.arg2 = arg2;
  39806. this.min = min;
  39807. this.max = max;
  39808. }
  39809. visit(visitor) {
  39810. visitor.visitBinaryOperation(this);
  39811. }
  39812. }
  39813. class AstMin extends AstNode {
  39814. constructor(arg, max) {
  39815. super("max");
  39816. this.arg = arg;
  39817. this.min = arg.min;
  39818. this.max = max;
  39819. }
  39820. visit(visitor) {
  39821. visitor.visitMin(this);
  39822. }
  39823. }
  39824. class AstVariable extends AstNode {
  39825. constructor(index, min, max) {
  39826. super("var");
  39827. this.index = index;
  39828. this.min = min;
  39829. this.max = max;
  39830. }
  39831. visit(visitor) {
  39832. visitor.visitVariable(this);
  39833. }
  39834. }
  39835. class AstVariableDefinition extends AstNode {
  39836. constructor(variable, arg) {
  39837. super("definition");
  39838. this.variable = variable;
  39839. this.arg = arg;
  39840. }
  39841. visit(visitor) {
  39842. visitor.visitVariableDefinition(this);
  39843. }
  39844. }
  39845. class ExpressionBuilderVisitor {
  39846. constructor() {
  39847. this.parts = [];
  39848. }
  39849. visitArgument(arg) {
  39850. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  39851. }
  39852. visitVariable(variable) {
  39853. this.parts.push("v", variable.index);
  39854. }
  39855. visitLiteral(literal) {
  39856. this.parts.push(literal.number);
  39857. }
  39858. visitBinaryOperation(operation) {
  39859. this.parts.push("(");
  39860. operation.arg1.visit(this);
  39861. this.parts.push(" ", operation.op, " ");
  39862. operation.arg2.visit(this);
  39863. this.parts.push(")");
  39864. }
  39865. visitVariableDefinition(definition) {
  39866. this.parts.push("var ");
  39867. definition.variable.visit(this);
  39868. this.parts.push(" = ");
  39869. definition.arg.visit(this);
  39870. this.parts.push(";");
  39871. }
  39872. visitMin(max) {
  39873. this.parts.push("Math.min(");
  39874. max.arg.visit(this);
  39875. this.parts.push(", ", max.max, ")");
  39876. }
  39877. toString() {
  39878. return this.parts.join("");
  39879. }
  39880. }
  39881. function buildAddOperation(num1, num2) {
  39882. if (num2.type === "literal" && num2.number === 0) {
  39883. return num1;
  39884. }
  39885. if (num1.type === "literal" && num1.number === 0) {
  39886. return num2;
  39887. }
  39888. if (num2.type === "literal" && num1.type === "literal") {
  39889. return new AstLiteral(num1.number + num2.number);
  39890. }
  39891. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  39892. }
  39893. function buildMulOperation(num1, num2) {
  39894. if (num2.type === "literal") {
  39895. if (num2.number === 0) {
  39896. return new AstLiteral(0);
  39897. } else if (num2.number === 1) {
  39898. return num1;
  39899. } else if (num1.type === "literal") {
  39900. return new AstLiteral(num1.number * num2.number);
  39901. }
  39902. }
  39903. if (num1.type === "literal") {
  39904. if (num1.number === 0) {
  39905. return new AstLiteral(0);
  39906. } else if (num1.number === 1) {
  39907. return num2;
  39908. }
  39909. }
  39910. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  39911. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  39912. return new AstBinaryOperation("*", num1, num2, min, max);
  39913. }
  39914. function buildSubOperation(num1, num2) {
  39915. if (num2.type === "literal") {
  39916. if (num2.number === 0) {
  39917. return num1;
  39918. } else if (num1.type === "literal") {
  39919. return new AstLiteral(num1.number - num2.number);
  39920. }
  39921. }
  39922. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  39923. return num2.arg2;
  39924. }
  39925. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  39926. }
  39927. function buildMinOperation(num1, max) {
  39928. if (num1.min >= max) {
  39929. return new AstLiteral(max);
  39930. } else if (num1.max <= max) {
  39931. return num1;
  39932. }
  39933. return new AstMin(num1, max);
  39934. }
  39935. class PostScriptCompiler {
  39936. compile(code, domain, range) {
  39937. const stack = [];
  39938. const instructions = [];
  39939. const inputSize = domain.length >> 1,
  39940. outputSize = range.length >> 1;
  39941. let lastRegister = 0;
  39942. let n, j;
  39943. let num1, num2, ast1, ast2, tmpVar, item;
  39944. for (let i = 0; i < inputSize; i++) {
  39945. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  39946. }
  39947. for (let i = 0, ii = code.length; i < ii; i++) {
  39948. item = code[i];
  39949. if (typeof item === "number") {
  39950. stack.push(new AstLiteral(item));
  39951. continue;
  39952. }
  39953. switch (item) {
  39954. case "add":
  39955. if (stack.length < 2) {
  39956. return null;
  39957. }
  39958. num2 = stack.pop();
  39959. num1 = stack.pop();
  39960. stack.push(buildAddOperation(num1, num2));
  39961. break;
  39962. case "cvr":
  39963. if (stack.length < 1) {
  39964. return null;
  39965. }
  39966. break;
  39967. case "mul":
  39968. if (stack.length < 2) {
  39969. return null;
  39970. }
  39971. num2 = stack.pop();
  39972. num1 = stack.pop();
  39973. stack.push(buildMulOperation(num1, num2));
  39974. break;
  39975. case "sub":
  39976. if (stack.length < 2) {
  39977. return null;
  39978. }
  39979. num2 = stack.pop();
  39980. num1 = stack.pop();
  39981. stack.push(buildSubOperation(num1, num2));
  39982. break;
  39983. case "exch":
  39984. if (stack.length < 2) {
  39985. return null;
  39986. }
  39987. ast1 = stack.pop();
  39988. ast2 = stack.pop();
  39989. stack.push(ast1, ast2);
  39990. break;
  39991. case "pop":
  39992. if (stack.length < 1) {
  39993. return null;
  39994. }
  39995. stack.pop();
  39996. break;
  39997. case "index":
  39998. if (stack.length < 1) {
  39999. return null;
  40000. }
  40001. num1 = stack.pop();
  40002. if (num1.type !== "literal") {
  40003. return null;
  40004. }
  40005. n = num1.number;
  40006. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  40007. return null;
  40008. }
  40009. ast1 = stack[stack.length - n - 1];
  40010. if (ast1.type === "literal" || ast1.type === "var") {
  40011. stack.push(ast1);
  40012. break;
  40013. }
  40014. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  40015. stack[stack.length - n - 1] = tmpVar;
  40016. stack.push(tmpVar);
  40017. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  40018. break;
  40019. case "dup":
  40020. if (stack.length < 1) {
  40021. return null;
  40022. }
  40023. 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]) {
  40024. num1 = stack.pop();
  40025. stack.push(buildMinOperation(num1, code[i + 1]));
  40026. i += 6;
  40027. break;
  40028. }
  40029. ast1 = stack[stack.length - 1];
  40030. if (ast1.type === "literal" || ast1.type === "var") {
  40031. stack.push(ast1);
  40032. break;
  40033. }
  40034. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  40035. stack[stack.length - 1] = tmpVar;
  40036. stack.push(tmpVar);
  40037. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  40038. break;
  40039. case "roll":
  40040. if (stack.length < 2) {
  40041. return null;
  40042. }
  40043. num2 = stack.pop();
  40044. num1 = stack.pop();
  40045. if (num2.type !== "literal" || num1.type !== "literal") {
  40046. return null;
  40047. }
  40048. j = num2.number;
  40049. n = num1.number;
  40050. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  40051. return null;
  40052. }
  40053. j = (j % n + n) % n;
  40054. if (j === 0) {
  40055. break;
  40056. }
  40057. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  40058. break;
  40059. default:
  40060. return null;
  40061. }
  40062. }
  40063. if (stack.length !== outputSize) {
  40064. return null;
  40065. }
  40066. const result = [];
  40067. for (const instruction of instructions) {
  40068. const statementBuilder = new ExpressionBuilderVisitor();
  40069. instruction.visit(statementBuilder);
  40070. result.push(statementBuilder.toString());
  40071. }
  40072. for (let i = 0, ii = stack.length; i < ii; i++) {
  40073. const expr = stack[i],
  40074. statementBuilder = new ExpressionBuilderVisitor();
  40075. expr.visit(statementBuilder);
  40076. const min = range[i * 2],
  40077. max = range[i * 2 + 1];
  40078. const out = [statementBuilder.toString()];
  40079. if (min > expr.min) {
  40080. out.unshift("Math.max(", min, ", ");
  40081. out.push(")");
  40082. }
  40083. if (max < expr.max) {
  40084. out.unshift("Math.min(", max, ", ");
  40085. out.push(")");
  40086. }
  40087. out.unshift("dest[destOffset + ", i, "] = ");
  40088. out.push(";");
  40089. result.push(out.join(""));
  40090. }
  40091. return result.join("\n");
  40092. }
  40093. }
  40094. return PostScriptCompiler;
  40095. }();
  40096. exports.PostScriptCompiler = PostScriptCompiler;
  40097. /***/ }),
  40098. /* 51 */
  40099. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40100. Object.defineProperty(exports, "__esModule", ({
  40101. value: true
  40102. }));
  40103. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  40104. var _util = __w_pdfjs_require__(2);
  40105. var _primitives = __w_pdfjs_require__(5);
  40106. var _core_utils = __w_pdfjs_require__(9);
  40107. class PostScriptParser {
  40108. constructor(lexer) {
  40109. this.lexer = lexer;
  40110. this.operators = [];
  40111. this.token = null;
  40112. this.prev = null;
  40113. }
  40114. nextToken() {
  40115. this.prev = this.token;
  40116. this.token = this.lexer.getToken();
  40117. }
  40118. accept(type) {
  40119. if (this.token.type === type) {
  40120. this.nextToken();
  40121. return true;
  40122. }
  40123. return false;
  40124. }
  40125. expect(type) {
  40126. if (this.accept(type)) {
  40127. return true;
  40128. }
  40129. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  40130. }
  40131. parse() {
  40132. this.nextToken();
  40133. this.expect(PostScriptTokenTypes.LBRACE);
  40134. this.parseBlock();
  40135. this.expect(PostScriptTokenTypes.RBRACE);
  40136. return this.operators;
  40137. }
  40138. parseBlock() {
  40139. while (true) {
  40140. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  40141. this.operators.push(this.prev.value);
  40142. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  40143. this.operators.push(this.prev.value);
  40144. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  40145. this.parseCondition();
  40146. } else {
  40147. return;
  40148. }
  40149. }
  40150. }
  40151. parseCondition() {
  40152. const conditionLocation = this.operators.length;
  40153. this.operators.push(null, null);
  40154. this.parseBlock();
  40155. this.expect(PostScriptTokenTypes.RBRACE);
  40156. if (this.accept(PostScriptTokenTypes.IF)) {
  40157. this.operators[conditionLocation] = this.operators.length;
  40158. this.operators[conditionLocation + 1] = "jz";
  40159. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  40160. const jumpLocation = this.operators.length;
  40161. this.operators.push(null, null);
  40162. const endOfTrue = this.operators.length;
  40163. this.parseBlock();
  40164. this.expect(PostScriptTokenTypes.RBRACE);
  40165. this.expect(PostScriptTokenTypes.IFELSE);
  40166. this.operators[jumpLocation] = this.operators.length;
  40167. this.operators[jumpLocation + 1] = "j";
  40168. this.operators[conditionLocation] = endOfTrue;
  40169. this.operators[conditionLocation + 1] = "jz";
  40170. } else {
  40171. throw new _util.FormatError("PS Function: error parsing conditional.");
  40172. }
  40173. }
  40174. }
  40175. exports.PostScriptParser = PostScriptParser;
  40176. const PostScriptTokenTypes = {
  40177. LBRACE: 0,
  40178. RBRACE: 1,
  40179. NUMBER: 2,
  40180. OPERATOR: 3,
  40181. IF: 4,
  40182. IFELSE: 5
  40183. };
  40184. class PostScriptToken {
  40185. static get opCache() {
  40186. return (0, _util.shadow)(this, "opCache", Object.create(null));
  40187. }
  40188. constructor(type, value) {
  40189. this.type = type;
  40190. this.value = value;
  40191. }
  40192. static getOperator(op) {
  40193. const opValue = PostScriptToken.opCache[op];
  40194. if (opValue) {
  40195. return opValue;
  40196. }
  40197. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  40198. }
  40199. static get LBRACE() {
  40200. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  40201. }
  40202. static get RBRACE() {
  40203. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  40204. }
  40205. static get IF() {
  40206. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  40207. }
  40208. static get IFELSE() {
  40209. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  40210. }
  40211. }
  40212. class PostScriptLexer {
  40213. constructor(stream) {
  40214. this.stream = stream;
  40215. this.nextChar();
  40216. this.strBuf = [];
  40217. }
  40218. nextChar() {
  40219. return this.currentChar = this.stream.getByte();
  40220. }
  40221. getToken() {
  40222. let comment = false;
  40223. let ch = this.currentChar;
  40224. while (true) {
  40225. if (ch < 0) {
  40226. return _primitives.EOF;
  40227. }
  40228. if (comment) {
  40229. if (ch === 0x0a || ch === 0x0d) {
  40230. comment = false;
  40231. }
  40232. } else if (ch === 0x25) {
  40233. comment = true;
  40234. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  40235. break;
  40236. }
  40237. ch = this.nextChar();
  40238. }
  40239. switch (ch | 0) {
  40240. case 0x30:
  40241. case 0x31:
  40242. case 0x32:
  40243. case 0x33:
  40244. case 0x34:
  40245. case 0x35:
  40246. case 0x36:
  40247. case 0x37:
  40248. case 0x38:
  40249. case 0x39:
  40250. case 0x2b:
  40251. case 0x2d:
  40252. case 0x2e:
  40253. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  40254. case 0x7b:
  40255. this.nextChar();
  40256. return PostScriptToken.LBRACE;
  40257. case 0x7d:
  40258. this.nextChar();
  40259. return PostScriptToken.RBRACE;
  40260. }
  40261. const strBuf = this.strBuf;
  40262. strBuf.length = 0;
  40263. strBuf[0] = String.fromCharCode(ch);
  40264. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  40265. strBuf.push(String.fromCharCode(ch));
  40266. }
  40267. const str = strBuf.join("");
  40268. switch (str.toLowerCase()) {
  40269. case "if":
  40270. return PostScriptToken.IF;
  40271. case "ifelse":
  40272. return PostScriptToken.IFELSE;
  40273. default:
  40274. return PostScriptToken.getOperator(str);
  40275. }
  40276. }
  40277. getNumber() {
  40278. let ch = this.currentChar;
  40279. const strBuf = this.strBuf;
  40280. strBuf.length = 0;
  40281. strBuf[0] = String.fromCharCode(ch);
  40282. while ((ch = this.nextChar()) >= 0) {
  40283. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  40284. strBuf.push(String.fromCharCode(ch));
  40285. } else {
  40286. break;
  40287. }
  40288. }
  40289. const value = parseFloat(strBuf.join(""));
  40290. if (isNaN(value)) {
  40291. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  40292. }
  40293. return value;
  40294. }
  40295. }
  40296. exports.PostScriptLexer = PostScriptLexer;
  40297. /***/ }),
  40298. /* 52 */
  40299. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40300. Object.defineProperty(exports, "__esModule", ({
  40301. value: true
  40302. }));
  40303. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  40304. var _util = __w_pdfjs_require__(2);
  40305. var _primitives = __w_pdfjs_require__(5);
  40306. class BaseLocalCache {
  40307. constructor(options) {
  40308. if (this.constructor === BaseLocalCache) {
  40309. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  40310. }
  40311. if (!options || !options.onlyRefs) {
  40312. this._nameRefMap = new Map();
  40313. this._imageMap = new Map();
  40314. }
  40315. this._imageCache = new _primitives.RefSetCache();
  40316. }
  40317. getByName(name) {
  40318. const ref = this._nameRefMap.get(name);
  40319. if (ref) {
  40320. return this.getByRef(ref);
  40321. }
  40322. return this._imageMap.get(name) || null;
  40323. }
  40324. getByRef(ref) {
  40325. return this._imageCache.get(ref) || null;
  40326. }
  40327. set(name, ref, data) {
  40328. (0, _util.unreachable)("Abstract method `set` called.");
  40329. }
  40330. }
  40331. class LocalImageCache extends BaseLocalCache {
  40332. set(name, ref = null, data) {
  40333. if (typeof name !== "string") {
  40334. throw new Error('LocalImageCache.set - expected "name" argument.');
  40335. }
  40336. if (ref) {
  40337. if (this._imageCache.has(ref)) {
  40338. return;
  40339. }
  40340. this._nameRefMap.set(name, ref);
  40341. this._imageCache.put(ref, data);
  40342. return;
  40343. }
  40344. if (this._imageMap.has(name)) {
  40345. return;
  40346. }
  40347. this._imageMap.set(name, data);
  40348. }
  40349. }
  40350. exports.LocalImageCache = LocalImageCache;
  40351. class LocalColorSpaceCache extends BaseLocalCache {
  40352. set(name = null, ref = null, data) {
  40353. if (typeof name !== "string" && !ref) {
  40354. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  40355. }
  40356. if (ref) {
  40357. if (this._imageCache.has(ref)) {
  40358. return;
  40359. }
  40360. if (name !== null) {
  40361. this._nameRefMap.set(name, ref);
  40362. }
  40363. this._imageCache.put(ref, data);
  40364. return;
  40365. }
  40366. if (this._imageMap.has(name)) {
  40367. return;
  40368. }
  40369. this._imageMap.set(name, data);
  40370. }
  40371. }
  40372. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  40373. class LocalFunctionCache extends BaseLocalCache {
  40374. constructor(options) {
  40375. super({
  40376. onlyRefs: true
  40377. });
  40378. }
  40379. getByName(name) {
  40380. (0, _util.unreachable)("Should not call `getByName` method.");
  40381. }
  40382. set(name = null, ref, data) {
  40383. if (!ref) {
  40384. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  40385. }
  40386. if (this._imageCache.has(ref)) {
  40387. return;
  40388. }
  40389. this._imageCache.put(ref, data);
  40390. }
  40391. }
  40392. exports.LocalFunctionCache = LocalFunctionCache;
  40393. class LocalGStateCache extends BaseLocalCache {
  40394. set(name, ref = null, data) {
  40395. if (typeof name !== "string") {
  40396. throw new Error('LocalGStateCache.set - expected "name" argument.');
  40397. }
  40398. if (ref) {
  40399. if (this._imageCache.has(ref)) {
  40400. return;
  40401. }
  40402. this._nameRefMap.set(name, ref);
  40403. this._imageCache.put(ref, data);
  40404. return;
  40405. }
  40406. if (this._imageMap.has(name)) {
  40407. return;
  40408. }
  40409. this._imageMap.set(name, data);
  40410. }
  40411. }
  40412. exports.LocalGStateCache = LocalGStateCache;
  40413. class LocalTilingPatternCache extends BaseLocalCache {
  40414. set(name, ref = null, data) {
  40415. if (typeof name !== "string") {
  40416. throw new Error('LocalTilingPatternCache.set - expected "name" argument.');
  40417. }
  40418. if (ref) {
  40419. if (this._imageCache.has(ref)) {
  40420. return;
  40421. }
  40422. this._nameRefMap.set(name, ref);
  40423. this._imageCache.put(ref, data);
  40424. return;
  40425. }
  40426. if (this._imageMap.has(name)) {
  40427. return;
  40428. }
  40429. this._imageMap.set(name, data);
  40430. }
  40431. }
  40432. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  40433. class GlobalImageCache {
  40434. static get NUM_PAGES_THRESHOLD() {
  40435. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  40436. }
  40437. static get MIN_IMAGES_TO_CACHE() {
  40438. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  40439. }
  40440. static get MAX_BYTE_SIZE() {
  40441. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  40442. }
  40443. constructor() {
  40444. this._refCache = new _primitives.RefSetCache();
  40445. this._imageCache = new _primitives.RefSetCache();
  40446. }
  40447. get _byteSize() {
  40448. let byteSize = 0;
  40449. this._imageCache.forEach(imageData => {
  40450. byteSize += imageData.byteSize;
  40451. });
  40452. return byteSize;
  40453. }
  40454. get _cacheLimitReached() {
  40455. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  40456. return false;
  40457. }
  40458. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  40459. return false;
  40460. }
  40461. return true;
  40462. }
  40463. shouldCache(ref, pageIndex) {
  40464. const pageIndexSet = this._refCache.get(ref);
  40465. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  40466. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  40467. return false;
  40468. }
  40469. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  40470. return false;
  40471. }
  40472. return true;
  40473. }
  40474. addPageIndex(ref, pageIndex) {
  40475. let pageIndexSet = this._refCache.get(ref);
  40476. if (!pageIndexSet) {
  40477. pageIndexSet = new Set();
  40478. this._refCache.put(ref, pageIndexSet);
  40479. }
  40480. pageIndexSet.add(pageIndex);
  40481. }
  40482. addByteSize(ref, byteSize) {
  40483. const imageData = this._imageCache.get(ref);
  40484. if (!imageData) {
  40485. return;
  40486. }
  40487. if (imageData.byteSize) {
  40488. return;
  40489. }
  40490. imageData.byteSize = byteSize;
  40491. }
  40492. getData(ref, pageIndex) {
  40493. const pageIndexSet = this._refCache.get(ref);
  40494. if (!pageIndexSet) {
  40495. return null;
  40496. }
  40497. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  40498. return null;
  40499. }
  40500. const imageData = this._imageCache.get(ref);
  40501. if (!imageData) {
  40502. return null;
  40503. }
  40504. pageIndexSet.add(pageIndex);
  40505. return imageData;
  40506. }
  40507. setData(ref, data) {
  40508. if (!this._refCache.has(ref)) {
  40509. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  40510. }
  40511. if (this._imageCache.has(ref)) {
  40512. return;
  40513. }
  40514. if (this._cacheLimitReached) {
  40515. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  40516. return;
  40517. }
  40518. this._imageCache.put(ref, data);
  40519. }
  40520. clear(onlyData = false) {
  40521. if (!onlyData) {
  40522. this._refCache.clear();
  40523. }
  40524. this._imageCache.clear();
  40525. }
  40526. }
  40527. exports.GlobalImageCache = GlobalImageCache;
  40528. /***/ }),
  40529. /* 53 */
  40530. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40531. Object.defineProperty(exports, "__esModule", ({
  40532. value: true
  40533. }));
  40534. exports.bidi = bidi;
  40535. var _util = __w_pdfjs_require__(2);
  40536. 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"];
  40537. 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"];
  40538. function isOdd(i) {
  40539. return (i & 1) !== 0;
  40540. }
  40541. function isEven(i) {
  40542. return (i & 1) === 0;
  40543. }
  40544. function findUnequal(arr, start, value) {
  40545. let j, jj;
  40546. for (j = start, jj = arr.length; j < jj; ++j) {
  40547. if (arr[j] !== value) {
  40548. return j;
  40549. }
  40550. }
  40551. return j;
  40552. }
  40553. function setValues(arr, start, end, value) {
  40554. for (let j = start; j < end; ++j) {
  40555. arr[j] = value;
  40556. }
  40557. }
  40558. function reverseValues(arr, start, end) {
  40559. for (let i = start, j = end - 1; i < j; ++i, --j) {
  40560. const temp = arr[i];
  40561. arr[i] = arr[j];
  40562. arr[j] = temp;
  40563. }
  40564. }
  40565. function createBidiText(str, isLTR, vertical = false) {
  40566. let dir = "ltr";
  40567. if (vertical) {
  40568. dir = "ttb";
  40569. } else if (!isLTR) {
  40570. dir = "rtl";
  40571. }
  40572. return {
  40573. str,
  40574. dir
  40575. };
  40576. }
  40577. const chars = [];
  40578. const types = [];
  40579. function bidi(str, startLevel, vertical) {
  40580. let isLTR = true;
  40581. const strLength = str.length;
  40582. if (strLength === 0 || vertical) {
  40583. return createBidiText(str, isLTR, vertical);
  40584. }
  40585. chars.length = strLength;
  40586. types.length = strLength;
  40587. let numBidi = 0;
  40588. let i, ii;
  40589. for (i = 0; i < strLength; ++i) {
  40590. chars[i] = str.charAt(i);
  40591. const charCode = str.charCodeAt(i);
  40592. let charType = "L";
  40593. if (charCode <= 0x00ff) {
  40594. charType = baseTypes[charCode];
  40595. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  40596. charType = "R";
  40597. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  40598. charType = arabicTypes[charCode & 0xff];
  40599. if (!charType) {
  40600. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  40601. }
  40602. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  40603. charType = "AL";
  40604. }
  40605. if (charType === "R" || charType === "AL" || charType === "AN") {
  40606. numBidi++;
  40607. }
  40608. types[i] = charType;
  40609. }
  40610. if (numBidi === 0) {
  40611. isLTR = true;
  40612. return createBidiText(str, isLTR);
  40613. }
  40614. if (startLevel === -1) {
  40615. if (numBidi / strLength < 0.3) {
  40616. isLTR = true;
  40617. startLevel = 0;
  40618. } else {
  40619. isLTR = false;
  40620. startLevel = 1;
  40621. }
  40622. }
  40623. const levels = [];
  40624. for (i = 0; i < strLength; ++i) {
  40625. levels[i] = startLevel;
  40626. }
  40627. const e = isOdd(startLevel) ? "R" : "L";
  40628. const sor = e;
  40629. const eor = sor;
  40630. let lastType = sor;
  40631. for (i = 0; i < strLength; ++i) {
  40632. if (types[i] === "NSM") {
  40633. types[i] = lastType;
  40634. } else {
  40635. lastType = types[i];
  40636. }
  40637. }
  40638. lastType = sor;
  40639. let t;
  40640. for (i = 0; i < strLength; ++i) {
  40641. t = types[i];
  40642. if (t === "EN") {
  40643. types[i] = lastType === "AL" ? "AN" : "EN";
  40644. } else if (t === "R" || t === "L" || t === "AL") {
  40645. lastType = t;
  40646. }
  40647. }
  40648. for (i = 0; i < strLength; ++i) {
  40649. t = types[i];
  40650. if (t === "AL") {
  40651. types[i] = "R";
  40652. }
  40653. }
  40654. for (i = 1; i < strLength - 1; ++i) {
  40655. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  40656. types[i] = "EN";
  40657. }
  40658. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  40659. types[i] = types[i - 1];
  40660. }
  40661. }
  40662. for (i = 0; i < strLength; ++i) {
  40663. if (types[i] === "EN") {
  40664. for (let j = i - 1; j >= 0; --j) {
  40665. if (types[j] !== "ET") {
  40666. break;
  40667. }
  40668. types[j] = "EN";
  40669. }
  40670. for (let j = i + 1; j < strLength; ++j) {
  40671. if (types[j] !== "ET") {
  40672. break;
  40673. }
  40674. types[j] = "EN";
  40675. }
  40676. }
  40677. }
  40678. for (i = 0; i < strLength; ++i) {
  40679. t = types[i];
  40680. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  40681. types[i] = "ON";
  40682. }
  40683. }
  40684. lastType = sor;
  40685. for (i = 0; i < strLength; ++i) {
  40686. t = types[i];
  40687. if (t === "EN") {
  40688. types[i] = lastType === "L" ? "L" : "EN";
  40689. } else if (t === "R" || t === "L") {
  40690. lastType = t;
  40691. }
  40692. }
  40693. for (i = 0; i < strLength; ++i) {
  40694. if (types[i] === "ON") {
  40695. const end = findUnequal(types, i + 1, "ON");
  40696. let before = sor;
  40697. if (i > 0) {
  40698. before = types[i - 1];
  40699. }
  40700. let after = eor;
  40701. if (end + 1 < strLength) {
  40702. after = types[end + 1];
  40703. }
  40704. if (before !== "L") {
  40705. before = "R";
  40706. }
  40707. if (after !== "L") {
  40708. after = "R";
  40709. }
  40710. if (before === after) {
  40711. setValues(types, i, end, before);
  40712. }
  40713. i = end - 1;
  40714. }
  40715. }
  40716. for (i = 0; i < strLength; ++i) {
  40717. if (types[i] === "ON") {
  40718. types[i] = e;
  40719. }
  40720. }
  40721. for (i = 0; i < strLength; ++i) {
  40722. t = types[i];
  40723. if (isEven(levels[i])) {
  40724. if (t === "R") {
  40725. levels[i] += 1;
  40726. } else if (t === "AN" || t === "EN") {
  40727. levels[i] += 2;
  40728. }
  40729. } else {
  40730. if (t === "L" || t === "AN" || t === "EN") {
  40731. levels[i] += 1;
  40732. }
  40733. }
  40734. }
  40735. let highestLevel = -1;
  40736. let lowestOddLevel = 99;
  40737. let level;
  40738. for (i = 0, ii = levels.length; i < ii; ++i) {
  40739. level = levels[i];
  40740. if (highestLevel < level) {
  40741. highestLevel = level;
  40742. }
  40743. if (lowestOddLevel > level && isOdd(level)) {
  40744. lowestOddLevel = level;
  40745. }
  40746. }
  40747. for (level = highestLevel; level >= lowestOddLevel; --level) {
  40748. let start = -1;
  40749. for (i = 0, ii = levels.length; i < ii; ++i) {
  40750. if (levels[i] < level) {
  40751. if (start >= 0) {
  40752. reverseValues(chars, start, i);
  40753. start = -1;
  40754. }
  40755. } else if (start < 0) {
  40756. start = i;
  40757. }
  40758. }
  40759. if (start >= 0) {
  40760. reverseValues(chars, start, levels.length);
  40761. }
  40762. }
  40763. for (i = 0, ii = chars.length; i < ii; ++i) {
  40764. const ch = chars[i];
  40765. if (ch === "<" || ch === ">") {
  40766. chars[i] = "";
  40767. }
  40768. }
  40769. return createBidiText(chars.join(""), isLTR);
  40770. }
  40771. /***/ }),
  40772. /* 54 */
  40773. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40774. Object.defineProperty(exports, "__esModule", ({
  40775. value: true
  40776. }));
  40777. exports.getMetrics = void 0;
  40778. var _core_utils = __w_pdfjs_require__(9);
  40779. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  40780. t.Courier = 600;
  40781. t["Courier-Bold"] = 600;
  40782. t["Courier-BoldOblique"] = 600;
  40783. t["Courier-Oblique"] = 600;
  40784. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  40785. t.space = 278;
  40786. t.exclam = 278;
  40787. t.quotedbl = 355;
  40788. t.numbersign = 556;
  40789. t.dollar = 556;
  40790. t.percent = 889;
  40791. t.ampersand = 667;
  40792. t.quoteright = 222;
  40793. t.parenleft = 333;
  40794. t.parenright = 333;
  40795. t.asterisk = 389;
  40796. t.plus = 584;
  40797. t.comma = 278;
  40798. t.hyphen = 333;
  40799. t.period = 278;
  40800. t.slash = 278;
  40801. t.zero = 556;
  40802. t.one = 556;
  40803. t.two = 556;
  40804. t.three = 556;
  40805. t.four = 556;
  40806. t.five = 556;
  40807. t.six = 556;
  40808. t.seven = 556;
  40809. t.eight = 556;
  40810. t.nine = 556;
  40811. t.colon = 278;
  40812. t.semicolon = 278;
  40813. t.less = 584;
  40814. t.equal = 584;
  40815. t.greater = 584;
  40816. t.question = 556;
  40817. t.at = 1015;
  40818. t.A = 667;
  40819. t.B = 667;
  40820. t.C = 722;
  40821. t.D = 722;
  40822. t.E = 667;
  40823. t.F = 611;
  40824. t.G = 778;
  40825. t.H = 722;
  40826. t.I = 278;
  40827. t.J = 500;
  40828. t.K = 667;
  40829. t.L = 556;
  40830. t.M = 833;
  40831. t.N = 722;
  40832. t.O = 778;
  40833. t.P = 667;
  40834. t.Q = 778;
  40835. t.R = 722;
  40836. t.S = 667;
  40837. t.T = 611;
  40838. t.U = 722;
  40839. t.V = 667;
  40840. t.W = 944;
  40841. t.X = 667;
  40842. t.Y = 667;
  40843. t.Z = 611;
  40844. t.bracketleft = 278;
  40845. t.backslash = 278;
  40846. t.bracketright = 278;
  40847. t.asciicircum = 469;
  40848. t.underscore = 556;
  40849. t.quoteleft = 222;
  40850. t.a = 556;
  40851. t.b = 556;
  40852. t.c = 500;
  40853. t.d = 556;
  40854. t.e = 556;
  40855. t.f = 278;
  40856. t.g = 556;
  40857. t.h = 556;
  40858. t.i = 222;
  40859. t.j = 222;
  40860. t.k = 500;
  40861. t.l = 222;
  40862. t.m = 833;
  40863. t.n = 556;
  40864. t.o = 556;
  40865. t.p = 556;
  40866. t.q = 556;
  40867. t.r = 333;
  40868. t.s = 500;
  40869. t.t = 278;
  40870. t.u = 556;
  40871. t.v = 500;
  40872. t.w = 722;
  40873. t.x = 500;
  40874. t.y = 500;
  40875. t.z = 500;
  40876. t.braceleft = 334;
  40877. t.bar = 260;
  40878. t.braceright = 334;
  40879. t.asciitilde = 584;
  40880. t.exclamdown = 333;
  40881. t.cent = 556;
  40882. t.sterling = 556;
  40883. t.fraction = 167;
  40884. t.yen = 556;
  40885. t.florin = 556;
  40886. t.section = 556;
  40887. t.currency = 556;
  40888. t.quotesingle = 191;
  40889. t.quotedblleft = 333;
  40890. t.guillemotleft = 556;
  40891. t.guilsinglleft = 333;
  40892. t.guilsinglright = 333;
  40893. t.fi = 500;
  40894. t.fl = 500;
  40895. t.endash = 556;
  40896. t.dagger = 556;
  40897. t.daggerdbl = 556;
  40898. t.periodcentered = 278;
  40899. t.paragraph = 537;
  40900. t.bullet = 350;
  40901. t.quotesinglbase = 222;
  40902. t.quotedblbase = 333;
  40903. t.quotedblright = 333;
  40904. t.guillemotright = 556;
  40905. t.ellipsis = 1000;
  40906. t.perthousand = 1000;
  40907. t.questiondown = 611;
  40908. t.grave = 333;
  40909. t.acute = 333;
  40910. t.circumflex = 333;
  40911. t.tilde = 333;
  40912. t.macron = 333;
  40913. t.breve = 333;
  40914. t.dotaccent = 333;
  40915. t.dieresis = 333;
  40916. t.ring = 333;
  40917. t.cedilla = 333;
  40918. t.hungarumlaut = 333;
  40919. t.ogonek = 333;
  40920. t.caron = 333;
  40921. t.emdash = 1000;
  40922. t.AE = 1000;
  40923. t.ordfeminine = 370;
  40924. t.Lslash = 556;
  40925. t.Oslash = 778;
  40926. t.OE = 1000;
  40927. t.ordmasculine = 365;
  40928. t.ae = 889;
  40929. t.dotlessi = 278;
  40930. t.lslash = 222;
  40931. t.oslash = 611;
  40932. t.oe = 944;
  40933. t.germandbls = 611;
  40934. t.Idieresis = 278;
  40935. t.eacute = 556;
  40936. t.abreve = 556;
  40937. t.uhungarumlaut = 556;
  40938. t.ecaron = 556;
  40939. t.Ydieresis = 667;
  40940. t.divide = 584;
  40941. t.Yacute = 667;
  40942. t.Acircumflex = 667;
  40943. t.aacute = 556;
  40944. t.Ucircumflex = 722;
  40945. t.yacute = 500;
  40946. t.scommaaccent = 500;
  40947. t.ecircumflex = 556;
  40948. t.Uring = 722;
  40949. t.Udieresis = 722;
  40950. t.aogonek = 556;
  40951. t.Uacute = 722;
  40952. t.uogonek = 556;
  40953. t.Edieresis = 667;
  40954. t.Dcroat = 722;
  40955. t.commaaccent = 250;
  40956. t.copyright = 737;
  40957. t.Emacron = 667;
  40958. t.ccaron = 500;
  40959. t.aring = 556;
  40960. t.Ncommaaccent = 722;
  40961. t.lacute = 222;
  40962. t.agrave = 556;
  40963. t.Tcommaaccent = 611;
  40964. t.Cacute = 722;
  40965. t.atilde = 556;
  40966. t.Edotaccent = 667;
  40967. t.scaron = 500;
  40968. t.scedilla = 500;
  40969. t.iacute = 278;
  40970. t.lozenge = 471;
  40971. t.Rcaron = 722;
  40972. t.Gcommaaccent = 778;
  40973. t.ucircumflex = 556;
  40974. t.acircumflex = 556;
  40975. t.Amacron = 667;
  40976. t.rcaron = 333;
  40977. t.ccedilla = 500;
  40978. t.Zdotaccent = 611;
  40979. t.Thorn = 667;
  40980. t.Omacron = 778;
  40981. t.Racute = 722;
  40982. t.Sacute = 667;
  40983. t.dcaron = 643;
  40984. t.Umacron = 722;
  40985. t.uring = 556;
  40986. t.threesuperior = 333;
  40987. t.Ograve = 778;
  40988. t.Agrave = 667;
  40989. t.Abreve = 667;
  40990. t.multiply = 584;
  40991. t.uacute = 556;
  40992. t.Tcaron = 611;
  40993. t.partialdiff = 476;
  40994. t.ydieresis = 500;
  40995. t.Nacute = 722;
  40996. t.icircumflex = 278;
  40997. t.Ecircumflex = 667;
  40998. t.adieresis = 556;
  40999. t.edieresis = 556;
  41000. t.cacute = 500;
  41001. t.nacute = 556;
  41002. t.umacron = 556;
  41003. t.Ncaron = 722;
  41004. t.Iacute = 278;
  41005. t.plusminus = 584;
  41006. t.brokenbar = 260;
  41007. t.registered = 737;
  41008. t.Gbreve = 778;
  41009. t.Idotaccent = 278;
  41010. t.summation = 600;
  41011. t.Egrave = 667;
  41012. t.racute = 333;
  41013. t.omacron = 556;
  41014. t.Zacute = 611;
  41015. t.Zcaron = 611;
  41016. t.greaterequal = 549;
  41017. t.Eth = 722;
  41018. t.Ccedilla = 722;
  41019. t.lcommaaccent = 222;
  41020. t.tcaron = 317;
  41021. t.eogonek = 556;
  41022. t.Uogonek = 722;
  41023. t.Aacute = 667;
  41024. t.Adieresis = 667;
  41025. t.egrave = 556;
  41026. t.zacute = 500;
  41027. t.iogonek = 222;
  41028. t.Oacute = 778;
  41029. t.oacute = 556;
  41030. t.amacron = 556;
  41031. t.sacute = 500;
  41032. t.idieresis = 278;
  41033. t.Ocircumflex = 778;
  41034. t.Ugrave = 722;
  41035. t.Delta = 612;
  41036. t.thorn = 556;
  41037. t.twosuperior = 333;
  41038. t.Odieresis = 778;
  41039. t.mu = 556;
  41040. t.igrave = 278;
  41041. t.ohungarumlaut = 556;
  41042. t.Eogonek = 667;
  41043. t.dcroat = 556;
  41044. t.threequarters = 834;
  41045. t.Scedilla = 667;
  41046. t.lcaron = 299;
  41047. t.Kcommaaccent = 667;
  41048. t.Lacute = 556;
  41049. t.trademark = 1000;
  41050. t.edotaccent = 556;
  41051. t.Igrave = 278;
  41052. t.Imacron = 278;
  41053. t.Lcaron = 556;
  41054. t.onehalf = 834;
  41055. t.lessequal = 549;
  41056. t.ocircumflex = 556;
  41057. t.ntilde = 556;
  41058. t.Uhungarumlaut = 722;
  41059. t.Eacute = 667;
  41060. t.emacron = 556;
  41061. t.gbreve = 556;
  41062. t.onequarter = 834;
  41063. t.Scaron = 667;
  41064. t.Scommaaccent = 667;
  41065. t.Ohungarumlaut = 778;
  41066. t.degree = 400;
  41067. t.ograve = 556;
  41068. t.Ccaron = 722;
  41069. t.ugrave = 556;
  41070. t.radical = 453;
  41071. t.Dcaron = 722;
  41072. t.rcommaaccent = 333;
  41073. t.Ntilde = 722;
  41074. t.otilde = 556;
  41075. t.Rcommaaccent = 722;
  41076. t.Lcommaaccent = 556;
  41077. t.Atilde = 667;
  41078. t.Aogonek = 667;
  41079. t.Aring = 667;
  41080. t.Otilde = 778;
  41081. t.zdotaccent = 500;
  41082. t.Ecaron = 667;
  41083. t.Iogonek = 278;
  41084. t.kcommaaccent = 500;
  41085. t.minus = 584;
  41086. t.Icircumflex = 278;
  41087. t.ncaron = 556;
  41088. t.tcommaaccent = 278;
  41089. t.logicalnot = 584;
  41090. t.odieresis = 556;
  41091. t.udieresis = 556;
  41092. t.notequal = 549;
  41093. t.gcommaaccent = 556;
  41094. t.eth = 556;
  41095. t.zcaron = 500;
  41096. t.ncommaaccent = 556;
  41097. t.onesuperior = 333;
  41098. t.imacron = 278;
  41099. t.Euro = 556;
  41100. });
  41101. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41102. t.space = 278;
  41103. t.exclam = 333;
  41104. t.quotedbl = 474;
  41105. t.numbersign = 556;
  41106. t.dollar = 556;
  41107. t.percent = 889;
  41108. t.ampersand = 722;
  41109. t.quoteright = 278;
  41110. t.parenleft = 333;
  41111. t.parenright = 333;
  41112. t.asterisk = 389;
  41113. t.plus = 584;
  41114. t.comma = 278;
  41115. t.hyphen = 333;
  41116. t.period = 278;
  41117. t.slash = 278;
  41118. t.zero = 556;
  41119. t.one = 556;
  41120. t.two = 556;
  41121. t.three = 556;
  41122. t.four = 556;
  41123. t.five = 556;
  41124. t.six = 556;
  41125. t.seven = 556;
  41126. t.eight = 556;
  41127. t.nine = 556;
  41128. t.colon = 333;
  41129. t.semicolon = 333;
  41130. t.less = 584;
  41131. t.equal = 584;
  41132. t.greater = 584;
  41133. t.question = 611;
  41134. t.at = 975;
  41135. t.A = 722;
  41136. t.B = 722;
  41137. t.C = 722;
  41138. t.D = 722;
  41139. t.E = 667;
  41140. t.F = 611;
  41141. t.G = 778;
  41142. t.H = 722;
  41143. t.I = 278;
  41144. t.J = 556;
  41145. t.K = 722;
  41146. t.L = 611;
  41147. t.M = 833;
  41148. t.N = 722;
  41149. t.O = 778;
  41150. t.P = 667;
  41151. t.Q = 778;
  41152. t.R = 722;
  41153. t.S = 667;
  41154. t.T = 611;
  41155. t.U = 722;
  41156. t.V = 667;
  41157. t.W = 944;
  41158. t.X = 667;
  41159. t.Y = 667;
  41160. t.Z = 611;
  41161. t.bracketleft = 333;
  41162. t.backslash = 278;
  41163. t.bracketright = 333;
  41164. t.asciicircum = 584;
  41165. t.underscore = 556;
  41166. t.quoteleft = 278;
  41167. t.a = 556;
  41168. t.b = 611;
  41169. t.c = 556;
  41170. t.d = 611;
  41171. t.e = 556;
  41172. t.f = 333;
  41173. t.g = 611;
  41174. t.h = 611;
  41175. t.i = 278;
  41176. t.j = 278;
  41177. t.k = 556;
  41178. t.l = 278;
  41179. t.m = 889;
  41180. t.n = 611;
  41181. t.o = 611;
  41182. t.p = 611;
  41183. t.q = 611;
  41184. t.r = 389;
  41185. t.s = 556;
  41186. t.t = 333;
  41187. t.u = 611;
  41188. t.v = 556;
  41189. t.w = 778;
  41190. t.x = 556;
  41191. t.y = 556;
  41192. t.z = 500;
  41193. t.braceleft = 389;
  41194. t.bar = 280;
  41195. t.braceright = 389;
  41196. t.asciitilde = 584;
  41197. t.exclamdown = 333;
  41198. t.cent = 556;
  41199. t.sterling = 556;
  41200. t.fraction = 167;
  41201. t.yen = 556;
  41202. t.florin = 556;
  41203. t.section = 556;
  41204. t.currency = 556;
  41205. t.quotesingle = 238;
  41206. t.quotedblleft = 500;
  41207. t.guillemotleft = 556;
  41208. t.guilsinglleft = 333;
  41209. t.guilsinglright = 333;
  41210. t.fi = 611;
  41211. t.fl = 611;
  41212. t.endash = 556;
  41213. t.dagger = 556;
  41214. t.daggerdbl = 556;
  41215. t.periodcentered = 278;
  41216. t.paragraph = 556;
  41217. t.bullet = 350;
  41218. t.quotesinglbase = 278;
  41219. t.quotedblbase = 500;
  41220. t.quotedblright = 500;
  41221. t.guillemotright = 556;
  41222. t.ellipsis = 1000;
  41223. t.perthousand = 1000;
  41224. t.questiondown = 611;
  41225. t.grave = 333;
  41226. t.acute = 333;
  41227. t.circumflex = 333;
  41228. t.tilde = 333;
  41229. t.macron = 333;
  41230. t.breve = 333;
  41231. t.dotaccent = 333;
  41232. t.dieresis = 333;
  41233. t.ring = 333;
  41234. t.cedilla = 333;
  41235. t.hungarumlaut = 333;
  41236. t.ogonek = 333;
  41237. t.caron = 333;
  41238. t.emdash = 1000;
  41239. t.AE = 1000;
  41240. t.ordfeminine = 370;
  41241. t.Lslash = 611;
  41242. t.Oslash = 778;
  41243. t.OE = 1000;
  41244. t.ordmasculine = 365;
  41245. t.ae = 889;
  41246. t.dotlessi = 278;
  41247. t.lslash = 278;
  41248. t.oslash = 611;
  41249. t.oe = 944;
  41250. t.germandbls = 611;
  41251. t.Idieresis = 278;
  41252. t.eacute = 556;
  41253. t.abreve = 556;
  41254. t.uhungarumlaut = 611;
  41255. t.ecaron = 556;
  41256. t.Ydieresis = 667;
  41257. t.divide = 584;
  41258. t.Yacute = 667;
  41259. t.Acircumflex = 722;
  41260. t.aacute = 556;
  41261. t.Ucircumflex = 722;
  41262. t.yacute = 556;
  41263. t.scommaaccent = 556;
  41264. t.ecircumflex = 556;
  41265. t.Uring = 722;
  41266. t.Udieresis = 722;
  41267. t.aogonek = 556;
  41268. t.Uacute = 722;
  41269. t.uogonek = 611;
  41270. t.Edieresis = 667;
  41271. t.Dcroat = 722;
  41272. t.commaaccent = 250;
  41273. t.copyright = 737;
  41274. t.Emacron = 667;
  41275. t.ccaron = 556;
  41276. t.aring = 556;
  41277. t.Ncommaaccent = 722;
  41278. t.lacute = 278;
  41279. t.agrave = 556;
  41280. t.Tcommaaccent = 611;
  41281. t.Cacute = 722;
  41282. t.atilde = 556;
  41283. t.Edotaccent = 667;
  41284. t.scaron = 556;
  41285. t.scedilla = 556;
  41286. t.iacute = 278;
  41287. t.lozenge = 494;
  41288. t.Rcaron = 722;
  41289. t.Gcommaaccent = 778;
  41290. t.ucircumflex = 611;
  41291. t.acircumflex = 556;
  41292. t.Amacron = 722;
  41293. t.rcaron = 389;
  41294. t.ccedilla = 556;
  41295. t.Zdotaccent = 611;
  41296. t.Thorn = 667;
  41297. t.Omacron = 778;
  41298. t.Racute = 722;
  41299. t.Sacute = 667;
  41300. t.dcaron = 743;
  41301. t.Umacron = 722;
  41302. t.uring = 611;
  41303. t.threesuperior = 333;
  41304. t.Ograve = 778;
  41305. t.Agrave = 722;
  41306. t.Abreve = 722;
  41307. t.multiply = 584;
  41308. t.uacute = 611;
  41309. t.Tcaron = 611;
  41310. t.partialdiff = 494;
  41311. t.ydieresis = 556;
  41312. t.Nacute = 722;
  41313. t.icircumflex = 278;
  41314. t.Ecircumflex = 667;
  41315. t.adieresis = 556;
  41316. t.edieresis = 556;
  41317. t.cacute = 556;
  41318. t.nacute = 611;
  41319. t.umacron = 611;
  41320. t.Ncaron = 722;
  41321. t.Iacute = 278;
  41322. t.plusminus = 584;
  41323. t.brokenbar = 280;
  41324. t.registered = 737;
  41325. t.Gbreve = 778;
  41326. t.Idotaccent = 278;
  41327. t.summation = 600;
  41328. t.Egrave = 667;
  41329. t.racute = 389;
  41330. t.omacron = 611;
  41331. t.Zacute = 611;
  41332. t.Zcaron = 611;
  41333. t.greaterequal = 549;
  41334. t.Eth = 722;
  41335. t.Ccedilla = 722;
  41336. t.lcommaaccent = 278;
  41337. t.tcaron = 389;
  41338. t.eogonek = 556;
  41339. t.Uogonek = 722;
  41340. t.Aacute = 722;
  41341. t.Adieresis = 722;
  41342. t.egrave = 556;
  41343. t.zacute = 500;
  41344. t.iogonek = 278;
  41345. t.Oacute = 778;
  41346. t.oacute = 611;
  41347. t.amacron = 556;
  41348. t.sacute = 556;
  41349. t.idieresis = 278;
  41350. t.Ocircumflex = 778;
  41351. t.Ugrave = 722;
  41352. t.Delta = 612;
  41353. t.thorn = 611;
  41354. t.twosuperior = 333;
  41355. t.Odieresis = 778;
  41356. t.mu = 611;
  41357. t.igrave = 278;
  41358. t.ohungarumlaut = 611;
  41359. t.Eogonek = 667;
  41360. t.dcroat = 611;
  41361. t.threequarters = 834;
  41362. t.Scedilla = 667;
  41363. t.lcaron = 400;
  41364. t.Kcommaaccent = 722;
  41365. t.Lacute = 611;
  41366. t.trademark = 1000;
  41367. t.edotaccent = 556;
  41368. t.Igrave = 278;
  41369. t.Imacron = 278;
  41370. t.Lcaron = 611;
  41371. t.onehalf = 834;
  41372. t.lessequal = 549;
  41373. t.ocircumflex = 611;
  41374. t.ntilde = 611;
  41375. t.Uhungarumlaut = 722;
  41376. t.Eacute = 667;
  41377. t.emacron = 556;
  41378. t.gbreve = 611;
  41379. t.onequarter = 834;
  41380. t.Scaron = 667;
  41381. t.Scommaaccent = 667;
  41382. t.Ohungarumlaut = 778;
  41383. t.degree = 400;
  41384. t.ograve = 611;
  41385. t.Ccaron = 722;
  41386. t.ugrave = 611;
  41387. t.radical = 549;
  41388. t.Dcaron = 722;
  41389. t.rcommaaccent = 389;
  41390. t.Ntilde = 722;
  41391. t.otilde = 611;
  41392. t.Rcommaaccent = 722;
  41393. t.Lcommaaccent = 611;
  41394. t.Atilde = 722;
  41395. t.Aogonek = 722;
  41396. t.Aring = 722;
  41397. t.Otilde = 778;
  41398. t.zdotaccent = 500;
  41399. t.Ecaron = 667;
  41400. t.Iogonek = 278;
  41401. t.kcommaaccent = 556;
  41402. t.minus = 584;
  41403. t.Icircumflex = 278;
  41404. t.ncaron = 611;
  41405. t.tcommaaccent = 333;
  41406. t.logicalnot = 584;
  41407. t.odieresis = 611;
  41408. t.udieresis = 611;
  41409. t.notequal = 549;
  41410. t.gcommaaccent = 611;
  41411. t.eth = 611;
  41412. t.zcaron = 500;
  41413. t.ncommaaccent = 611;
  41414. t.onesuperior = 333;
  41415. t.imacron = 278;
  41416. t.Euro = 556;
  41417. });
  41418. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41419. t.space = 278;
  41420. t.exclam = 333;
  41421. t.quotedbl = 474;
  41422. t.numbersign = 556;
  41423. t.dollar = 556;
  41424. t.percent = 889;
  41425. t.ampersand = 722;
  41426. t.quoteright = 278;
  41427. t.parenleft = 333;
  41428. t.parenright = 333;
  41429. t.asterisk = 389;
  41430. t.plus = 584;
  41431. t.comma = 278;
  41432. t.hyphen = 333;
  41433. t.period = 278;
  41434. t.slash = 278;
  41435. t.zero = 556;
  41436. t.one = 556;
  41437. t.two = 556;
  41438. t.three = 556;
  41439. t.four = 556;
  41440. t.five = 556;
  41441. t.six = 556;
  41442. t.seven = 556;
  41443. t.eight = 556;
  41444. t.nine = 556;
  41445. t.colon = 333;
  41446. t.semicolon = 333;
  41447. t.less = 584;
  41448. t.equal = 584;
  41449. t.greater = 584;
  41450. t.question = 611;
  41451. t.at = 975;
  41452. t.A = 722;
  41453. t.B = 722;
  41454. t.C = 722;
  41455. t.D = 722;
  41456. t.E = 667;
  41457. t.F = 611;
  41458. t.G = 778;
  41459. t.H = 722;
  41460. t.I = 278;
  41461. t.J = 556;
  41462. t.K = 722;
  41463. t.L = 611;
  41464. t.M = 833;
  41465. t.N = 722;
  41466. t.O = 778;
  41467. t.P = 667;
  41468. t.Q = 778;
  41469. t.R = 722;
  41470. t.S = 667;
  41471. t.T = 611;
  41472. t.U = 722;
  41473. t.V = 667;
  41474. t.W = 944;
  41475. t.X = 667;
  41476. t.Y = 667;
  41477. t.Z = 611;
  41478. t.bracketleft = 333;
  41479. t.backslash = 278;
  41480. t.bracketright = 333;
  41481. t.asciicircum = 584;
  41482. t.underscore = 556;
  41483. t.quoteleft = 278;
  41484. t.a = 556;
  41485. t.b = 611;
  41486. t.c = 556;
  41487. t.d = 611;
  41488. t.e = 556;
  41489. t.f = 333;
  41490. t.g = 611;
  41491. t.h = 611;
  41492. t.i = 278;
  41493. t.j = 278;
  41494. t.k = 556;
  41495. t.l = 278;
  41496. t.m = 889;
  41497. t.n = 611;
  41498. t.o = 611;
  41499. t.p = 611;
  41500. t.q = 611;
  41501. t.r = 389;
  41502. t.s = 556;
  41503. t.t = 333;
  41504. t.u = 611;
  41505. t.v = 556;
  41506. t.w = 778;
  41507. t.x = 556;
  41508. t.y = 556;
  41509. t.z = 500;
  41510. t.braceleft = 389;
  41511. t.bar = 280;
  41512. t.braceright = 389;
  41513. t.asciitilde = 584;
  41514. t.exclamdown = 333;
  41515. t.cent = 556;
  41516. t.sterling = 556;
  41517. t.fraction = 167;
  41518. t.yen = 556;
  41519. t.florin = 556;
  41520. t.section = 556;
  41521. t.currency = 556;
  41522. t.quotesingle = 238;
  41523. t.quotedblleft = 500;
  41524. t.guillemotleft = 556;
  41525. t.guilsinglleft = 333;
  41526. t.guilsinglright = 333;
  41527. t.fi = 611;
  41528. t.fl = 611;
  41529. t.endash = 556;
  41530. t.dagger = 556;
  41531. t.daggerdbl = 556;
  41532. t.periodcentered = 278;
  41533. t.paragraph = 556;
  41534. t.bullet = 350;
  41535. t.quotesinglbase = 278;
  41536. t.quotedblbase = 500;
  41537. t.quotedblright = 500;
  41538. t.guillemotright = 556;
  41539. t.ellipsis = 1000;
  41540. t.perthousand = 1000;
  41541. t.questiondown = 611;
  41542. t.grave = 333;
  41543. t.acute = 333;
  41544. t.circumflex = 333;
  41545. t.tilde = 333;
  41546. t.macron = 333;
  41547. t.breve = 333;
  41548. t.dotaccent = 333;
  41549. t.dieresis = 333;
  41550. t.ring = 333;
  41551. t.cedilla = 333;
  41552. t.hungarumlaut = 333;
  41553. t.ogonek = 333;
  41554. t.caron = 333;
  41555. t.emdash = 1000;
  41556. t.AE = 1000;
  41557. t.ordfeminine = 370;
  41558. t.Lslash = 611;
  41559. t.Oslash = 778;
  41560. t.OE = 1000;
  41561. t.ordmasculine = 365;
  41562. t.ae = 889;
  41563. t.dotlessi = 278;
  41564. t.lslash = 278;
  41565. t.oslash = 611;
  41566. t.oe = 944;
  41567. t.germandbls = 611;
  41568. t.Idieresis = 278;
  41569. t.eacute = 556;
  41570. t.abreve = 556;
  41571. t.uhungarumlaut = 611;
  41572. t.ecaron = 556;
  41573. t.Ydieresis = 667;
  41574. t.divide = 584;
  41575. t.Yacute = 667;
  41576. t.Acircumflex = 722;
  41577. t.aacute = 556;
  41578. t.Ucircumflex = 722;
  41579. t.yacute = 556;
  41580. t.scommaaccent = 556;
  41581. t.ecircumflex = 556;
  41582. t.Uring = 722;
  41583. t.Udieresis = 722;
  41584. t.aogonek = 556;
  41585. t.Uacute = 722;
  41586. t.uogonek = 611;
  41587. t.Edieresis = 667;
  41588. t.Dcroat = 722;
  41589. t.commaaccent = 250;
  41590. t.copyright = 737;
  41591. t.Emacron = 667;
  41592. t.ccaron = 556;
  41593. t.aring = 556;
  41594. t.Ncommaaccent = 722;
  41595. t.lacute = 278;
  41596. t.agrave = 556;
  41597. t.Tcommaaccent = 611;
  41598. t.Cacute = 722;
  41599. t.atilde = 556;
  41600. t.Edotaccent = 667;
  41601. t.scaron = 556;
  41602. t.scedilla = 556;
  41603. t.iacute = 278;
  41604. t.lozenge = 494;
  41605. t.Rcaron = 722;
  41606. t.Gcommaaccent = 778;
  41607. t.ucircumflex = 611;
  41608. t.acircumflex = 556;
  41609. t.Amacron = 722;
  41610. t.rcaron = 389;
  41611. t.ccedilla = 556;
  41612. t.Zdotaccent = 611;
  41613. t.Thorn = 667;
  41614. t.Omacron = 778;
  41615. t.Racute = 722;
  41616. t.Sacute = 667;
  41617. t.dcaron = 743;
  41618. t.Umacron = 722;
  41619. t.uring = 611;
  41620. t.threesuperior = 333;
  41621. t.Ograve = 778;
  41622. t.Agrave = 722;
  41623. t.Abreve = 722;
  41624. t.multiply = 584;
  41625. t.uacute = 611;
  41626. t.Tcaron = 611;
  41627. t.partialdiff = 494;
  41628. t.ydieresis = 556;
  41629. t.Nacute = 722;
  41630. t.icircumflex = 278;
  41631. t.Ecircumflex = 667;
  41632. t.adieresis = 556;
  41633. t.edieresis = 556;
  41634. t.cacute = 556;
  41635. t.nacute = 611;
  41636. t.umacron = 611;
  41637. t.Ncaron = 722;
  41638. t.Iacute = 278;
  41639. t.plusminus = 584;
  41640. t.brokenbar = 280;
  41641. t.registered = 737;
  41642. t.Gbreve = 778;
  41643. t.Idotaccent = 278;
  41644. t.summation = 600;
  41645. t.Egrave = 667;
  41646. t.racute = 389;
  41647. t.omacron = 611;
  41648. t.Zacute = 611;
  41649. t.Zcaron = 611;
  41650. t.greaterequal = 549;
  41651. t.Eth = 722;
  41652. t.Ccedilla = 722;
  41653. t.lcommaaccent = 278;
  41654. t.tcaron = 389;
  41655. t.eogonek = 556;
  41656. t.Uogonek = 722;
  41657. t.Aacute = 722;
  41658. t.Adieresis = 722;
  41659. t.egrave = 556;
  41660. t.zacute = 500;
  41661. t.iogonek = 278;
  41662. t.Oacute = 778;
  41663. t.oacute = 611;
  41664. t.amacron = 556;
  41665. t.sacute = 556;
  41666. t.idieresis = 278;
  41667. t.Ocircumflex = 778;
  41668. t.Ugrave = 722;
  41669. t.Delta = 612;
  41670. t.thorn = 611;
  41671. t.twosuperior = 333;
  41672. t.Odieresis = 778;
  41673. t.mu = 611;
  41674. t.igrave = 278;
  41675. t.ohungarumlaut = 611;
  41676. t.Eogonek = 667;
  41677. t.dcroat = 611;
  41678. t.threequarters = 834;
  41679. t.Scedilla = 667;
  41680. t.lcaron = 400;
  41681. t.Kcommaaccent = 722;
  41682. t.Lacute = 611;
  41683. t.trademark = 1000;
  41684. t.edotaccent = 556;
  41685. t.Igrave = 278;
  41686. t.Imacron = 278;
  41687. t.Lcaron = 611;
  41688. t.onehalf = 834;
  41689. t.lessequal = 549;
  41690. t.ocircumflex = 611;
  41691. t.ntilde = 611;
  41692. t.Uhungarumlaut = 722;
  41693. t.Eacute = 667;
  41694. t.emacron = 556;
  41695. t.gbreve = 611;
  41696. t.onequarter = 834;
  41697. t.Scaron = 667;
  41698. t.Scommaaccent = 667;
  41699. t.Ohungarumlaut = 778;
  41700. t.degree = 400;
  41701. t.ograve = 611;
  41702. t.Ccaron = 722;
  41703. t.ugrave = 611;
  41704. t.radical = 549;
  41705. t.Dcaron = 722;
  41706. t.rcommaaccent = 389;
  41707. t.Ntilde = 722;
  41708. t.otilde = 611;
  41709. t.Rcommaaccent = 722;
  41710. t.Lcommaaccent = 611;
  41711. t.Atilde = 722;
  41712. t.Aogonek = 722;
  41713. t.Aring = 722;
  41714. t.Otilde = 778;
  41715. t.zdotaccent = 500;
  41716. t.Ecaron = 667;
  41717. t.Iogonek = 278;
  41718. t.kcommaaccent = 556;
  41719. t.minus = 584;
  41720. t.Icircumflex = 278;
  41721. t.ncaron = 611;
  41722. t.tcommaaccent = 333;
  41723. t.logicalnot = 584;
  41724. t.odieresis = 611;
  41725. t.udieresis = 611;
  41726. t.notequal = 549;
  41727. t.gcommaaccent = 611;
  41728. t.eth = 611;
  41729. t.zcaron = 500;
  41730. t.ncommaaccent = 611;
  41731. t.onesuperior = 333;
  41732. t.imacron = 278;
  41733. t.Euro = 556;
  41734. });
  41735. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41736. t.space = 278;
  41737. t.exclam = 278;
  41738. t.quotedbl = 355;
  41739. t.numbersign = 556;
  41740. t.dollar = 556;
  41741. t.percent = 889;
  41742. t.ampersand = 667;
  41743. t.quoteright = 222;
  41744. t.parenleft = 333;
  41745. t.parenright = 333;
  41746. t.asterisk = 389;
  41747. t.plus = 584;
  41748. t.comma = 278;
  41749. t.hyphen = 333;
  41750. t.period = 278;
  41751. t.slash = 278;
  41752. t.zero = 556;
  41753. t.one = 556;
  41754. t.two = 556;
  41755. t.three = 556;
  41756. t.four = 556;
  41757. t.five = 556;
  41758. t.six = 556;
  41759. t.seven = 556;
  41760. t.eight = 556;
  41761. t.nine = 556;
  41762. t.colon = 278;
  41763. t.semicolon = 278;
  41764. t.less = 584;
  41765. t.equal = 584;
  41766. t.greater = 584;
  41767. t.question = 556;
  41768. t.at = 1015;
  41769. t.A = 667;
  41770. t.B = 667;
  41771. t.C = 722;
  41772. t.D = 722;
  41773. t.E = 667;
  41774. t.F = 611;
  41775. t.G = 778;
  41776. t.H = 722;
  41777. t.I = 278;
  41778. t.J = 500;
  41779. t.K = 667;
  41780. t.L = 556;
  41781. t.M = 833;
  41782. t.N = 722;
  41783. t.O = 778;
  41784. t.P = 667;
  41785. t.Q = 778;
  41786. t.R = 722;
  41787. t.S = 667;
  41788. t.T = 611;
  41789. t.U = 722;
  41790. t.V = 667;
  41791. t.W = 944;
  41792. t.X = 667;
  41793. t.Y = 667;
  41794. t.Z = 611;
  41795. t.bracketleft = 278;
  41796. t.backslash = 278;
  41797. t.bracketright = 278;
  41798. t.asciicircum = 469;
  41799. t.underscore = 556;
  41800. t.quoteleft = 222;
  41801. t.a = 556;
  41802. t.b = 556;
  41803. t.c = 500;
  41804. t.d = 556;
  41805. t.e = 556;
  41806. t.f = 278;
  41807. t.g = 556;
  41808. t.h = 556;
  41809. t.i = 222;
  41810. t.j = 222;
  41811. t.k = 500;
  41812. t.l = 222;
  41813. t.m = 833;
  41814. t.n = 556;
  41815. t.o = 556;
  41816. t.p = 556;
  41817. t.q = 556;
  41818. t.r = 333;
  41819. t.s = 500;
  41820. t.t = 278;
  41821. t.u = 556;
  41822. t.v = 500;
  41823. t.w = 722;
  41824. t.x = 500;
  41825. t.y = 500;
  41826. t.z = 500;
  41827. t.braceleft = 334;
  41828. t.bar = 260;
  41829. t.braceright = 334;
  41830. t.asciitilde = 584;
  41831. t.exclamdown = 333;
  41832. t.cent = 556;
  41833. t.sterling = 556;
  41834. t.fraction = 167;
  41835. t.yen = 556;
  41836. t.florin = 556;
  41837. t.section = 556;
  41838. t.currency = 556;
  41839. t.quotesingle = 191;
  41840. t.quotedblleft = 333;
  41841. t.guillemotleft = 556;
  41842. t.guilsinglleft = 333;
  41843. t.guilsinglright = 333;
  41844. t.fi = 500;
  41845. t.fl = 500;
  41846. t.endash = 556;
  41847. t.dagger = 556;
  41848. t.daggerdbl = 556;
  41849. t.periodcentered = 278;
  41850. t.paragraph = 537;
  41851. t.bullet = 350;
  41852. t.quotesinglbase = 222;
  41853. t.quotedblbase = 333;
  41854. t.quotedblright = 333;
  41855. t.guillemotright = 556;
  41856. t.ellipsis = 1000;
  41857. t.perthousand = 1000;
  41858. t.questiondown = 611;
  41859. t.grave = 333;
  41860. t.acute = 333;
  41861. t.circumflex = 333;
  41862. t.tilde = 333;
  41863. t.macron = 333;
  41864. t.breve = 333;
  41865. t.dotaccent = 333;
  41866. t.dieresis = 333;
  41867. t.ring = 333;
  41868. t.cedilla = 333;
  41869. t.hungarumlaut = 333;
  41870. t.ogonek = 333;
  41871. t.caron = 333;
  41872. t.emdash = 1000;
  41873. t.AE = 1000;
  41874. t.ordfeminine = 370;
  41875. t.Lslash = 556;
  41876. t.Oslash = 778;
  41877. t.OE = 1000;
  41878. t.ordmasculine = 365;
  41879. t.ae = 889;
  41880. t.dotlessi = 278;
  41881. t.lslash = 222;
  41882. t.oslash = 611;
  41883. t.oe = 944;
  41884. t.germandbls = 611;
  41885. t.Idieresis = 278;
  41886. t.eacute = 556;
  41887. t.abreve = 556;
  41888. t.uhungarumlaut = 556;
  41889. t.ecaron = 556;
  41890. t.Ydieresis = 667;
  41891. t.divide = 584;
  41892. t.Yacute = 667;
  41893. t.Acircumflex = 667;
  41894. t.aacute = 556;
  41895. t.Ucircumflex = 722;
  41896. t.yacute = 500;
  41897. t.scommaaccent = 500;
  41898. t.ecircumflex = 556;
  41899. t.Uring = 722;
  41900. t.Udieresis = 722;
  41901. t.aogonek = 556;
  41902. t.Uacute = 722;
  41903. t.uogonek = 556;
  41904. t.Edieresis = 667;
  41905. t.Dcroat = 722;
  41906. t.commaaccent = 250;
  41907. t.copyright = 737;
  41908. t.Emacron = 667;
  41909. t.ccaron = 500;
  41910. t.aring = 556;
  41911. t.Ncommaaccent = 722;
  41912. t.lacute = 222;
  41913. t.agrave = 556;
  41914. t.Tcommaaccent = 611;
  41915. t.Cacute = 722;
  41916. t.atilde = 556;
  41917. t.Edotaccent = 667;
  41918. t.scaron = 500;
  41919. t.scedilla = 500;
  41920. t.iacute = 278;
  41921. t.lozenge = 471;
  41922. t.Rcaron = 722;
  41923. t.Gcommaaccent = 778;
  41924. t.ucircumflex = 556;
  41925. t.acircumflex = 556;
  41926. t.Amacron = 667;
  41927. t.rcaron = 333;
  41928. t.ccedilla = 500;
  41929. t.Zdotaccent = 611;
  41930. t.Thorn = 667;
  41931. t.Omacron = 778;
  41932. t.Racute = 722;
  41933. t.Sacute = 667;
  41934. t.dcaron = 643;
  41935. t.Umacron = 722;
  41936. t.uring = 556;
  41937. t.threesuperior = 333;
  41938. t.Ograve = 778;
  41939. t.Agrave = 667;
  41940. t.Abreve = 667;
  41941. t.multiply = 584;
  41942. t.uacute = 556;
  41943. t.Tcaron = 611;
  41944. t.partialdiff = 476;
  41945. t.ydieresis = 500;
  41946. t.Nacute = 722;
  41947. t.icircumflex = 278;
  41948. t.Ecircumflex = 667;
  41949. t.adieresis = 556;
  41950. t.edieresis = 556;
  41951. t.cacute = 500;
  41952. t.nacute = 556;
  41953. t.umacron = 556;
  41954. t.Ncaron = 722;
  41955. t.Iacute = 278;
  41956. t.plusminus = 584;
  41957. t.brokenbar = 260;
  41958. t.registered = 737;
  41959. t.Gbreve = 778;
  41960. t.Idotaccent = 278;
  41961. t.summation = 600;
  41962. t.Egrave = 667;
  41963. t.racute = 333;
  41964. t.omacron = 556;
  41965. t.Zacute = 611;
  41966. t.Zcaron = 611;
  41967. t.greaterequal = 549;
  41968. t.Eth = 722;
  41969. t.Ccedilla = 722;
  41970. t.lcommaaccent = 222;
  41971. t.tcaron = 317;
  41972. t.eogonek = 556;
  41973. t.Uogonek = 722;
  41974. t.Aacute = 667;
  41975. t.Adieresis = 667;
  41976. t.egrave = 556;
  41977. t.zacute = 500;
  41978. t.iogonek = 222;
  41979. t.Oacute = 778;
  41980. t.oacute = 556;
  41981. t.amacron = 556;
  41982. t.sacute = 500;
  41983. t.idieresis = 278;
  41984. t.Ocircumflex = 778;
  41985. t.Ugrave = 722;
  41986. t.Delta = 612;
  41987. t.thorn = 556;
  41988. t.twosuperior = 333;
  41989. t.Odieresis = 778;
  41990. t.mu = 556;
  41991. t.igrave = 278;
  41992. t.ohungarumlaut = 556;
  41993. t.Eogonek = 667;
  41994. t.dcroat = 556;
  41995. t.threequarters = 834;
  41996. t.Scedilla = 667;
  41997. t.lcaron = 299;
  41998. t.Kcommaaccent = 667;
  41999. t.Lacute = 556;
  42000. t.trademark = 1000;
  42001. t.edotaccent = 556;
  42002. t.Igrave = 278;
  42003. t.Imacron = 278;
  42004. t.Lcaron = 556;
  42005. t.onehalf = 834;
  42006. t.lessequal = 549;
  42007. t.ocircumflex = 556;
  42008. t.ntilde = 556;
  42009. t.Uhungarumlaut = 722;
  42010. t.Eacute = 667;
  42011. t.emacron = 556;
  42012. t.gbreve = 556;
  42013. t.onequarter = 834;
  42014. t.Scaron = 667;
  42015. t.Scommaaccent = 667;
  42016. t.Ohungarumlaut = 778;
  42017. t.degree = 400;
  42018. t.ograve = 556;
  42019. t.Ccaron = 722;
  42020. t.ugrave = 556;
  42021. t.radical = 453;
  42022. t.Dcaron = 722;
  42023. t.rcommaaccent = 333;
  42024. t.Ntilde = 722;
  42025. t.otilde = 556;
  42026. t.Rcommaaccent = 722;
  42027. t.Lcommaaccent = 556;
  42028. t.Atilde = 667;
  42029. t.Aogonek = 667;
  42030. t.Aring = 667;
  42031. t.Otilde = 778;
  42032. t.zdotaccent = 500;
  42033. t.Ecaron = 667;
  42034. t.Iogonek = 278;
  42035. t.kcommaaccent = 500;
  42036. t.minus = 584;
  42037. t.Icircumflex = 278;
  42038. t.ncaron = 556;
  42039. t.tcommaaccent = 278;
  42040. t.logicalnot = 584;
  42041. t.odieresis = 556;
  42042. t.udieresis = 556;
  42043. t.notequal = 549;
  42044. t.gcommaaccent = 556;
  42045. t.eth = 556;
  42046. t.zcaron = 500;
  42047. t.ncommaaccent = 556;
  42048. t.onesuperior = 333;
  42049. t.imacron = 278;
  42050. t.Euro = 556;
  42051. });
  42052. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  42053. t.space = 250;
  42054. t.exclam = 333;
  42055. t.universal = 713;
  42056. t.numbersign = 500;
  42057. t.existential = 549;
  42058. t.percent = 833;
  42059. t.ampersand = 778;
  42060. t.suchthat = 439;
  42061. t.parenleft = 333;
  42062. t.parenright = 333;
  42063. t.asteriskmath = 500;
  42064. t.plus = 549;
  42065. t.comma = 250;
  42066. t.minus = 549;
  42067. t.period = 250;
  42068. t.slash = 278;
  42069. t.zero = 500;
  42070. t.one = 500;
  42071. t.two = 500;
  42072. t.three = 500;
  42073. t.four = 500;
  42074. t.five = 500;
  42075. t.six = 500;
  42076. t.seven = 500;
  42077. t.eight = 500;
  42078. t.nine = 500;
  42079. t.colon = 278;
  42080. t.semicolon = 278;
  42081. t.less = 549;
  42082. t.equal = 549;
  42083. t.greater = 549;
  42084. t.question = 444;
  42085. t.congruent = 549;
  42086. t.Alpha = 722;
  42087. t.Beta = 667;
  42088. t.Chi = 722;
  42089. t.Delta = 612;
  42090. t.Epsilon = 611;
  42091. t.Phi = 763;
  42092. t.Gamma = 603;
  42093. t.Eta = 722;
  42094. t.Iota = 333;
  42095. t.theta1 = 631;
  42096. t.Kappa = 722;
  42097. t.Lambda = 686;
  42098. t.Mu = 889;
  42099. t.Nu = 722;
  42100. t.Omicron = 722;
  42101. t.Pi = 768;
  42102. t.Theta = 741;
  42103. t.Rho = 556;
  42104. t.Sigma = 592;
  42105. t.Tau = 611;
  42106. t.Upsilon = 690;
  42107. t.sigma1 = 439;
  42108. t.Omega = 768;
  42109. t.Xi = 645;
  42110. t.Psi = 795;
  42111. t.Zeta = 611;
  42112. t.bracketleft = 333;
  42113. t.therefore = 863;
  42114. t.bracketright = 333;
  42115. t.perpendicular = 658;
  42116. t.underscore = 500;
  42117. t.radicalex = 500;
  42118. t.alpha = 631;
  42119. t.beta = 549;
  42120. t.chi = 549;
  42121. t.delta = 494;
  42122. t.epsilon = 439;
  42123. t.phi = 521;
  42124. t.gamma = 411;
  42125. t.eta = 603;
  42126. t.iota = 329;
  42127. t.phi1 = 603;
  42128. t.kappa = 549;
  42129. t.lambda = 549;
  42130. t.mu = 576;
  42131. t.nu = 521;
  42132. t.omicron = 549;
  42133. t.pi = 549;
  42134. t.theta = 521;
  42135. t.rho = 549;
  42136. t.sigma = 603;
  42137. t.tau = 439;
  42138. t.upsilon = 576;
  42139. t.omega1 = 713;
  42140. t.omega = 686;
  42141. t.xi = 493;
  42142. t.psi = 686;
  42143. t.zeta = 494;
  42144. t.braceleft = 480;
  42145. t.bar = 200;
  42146. t.braceright = 480;
  42147. t.similar = 549;
  42148. t.Euro = 750;
  42149. t.Upsilon1 = 620;
  42150. t.minute = 247;
  42151. t.lessequal = 549;
  42152. t.fraction = 167;
  42153. t.infinity = 713;
  42154. t.florin = 500;
  42155. t.club = 753;
  42156. t.diamond = 753;
  42157. t.heart = 753;
  42158. t.spade = 753;
  42159. t.arrowboth = 1042;
  42160. t.arrowleft = 987;
  42161. t.arrowup = 603;
  42162. t.arrowright = 987;
  42163. t.arrowdown = 603;
  42164. t.degree = 400;
  42165. t.plusminus = 549;
  42166. t.second = 411;
  42167. t.greaterequal = 549;
  42168. t.multiply = 549;
  42169. t.proportional = 713;
  42170. t.partialdiff = 494;
  42171. t.bullet = 460;
  42172. t.divide = 549;
  42173. t.notequal = 549;
  42174. t.equivalence = 549;
  42175. t.approxequal = 549;
  42176. t.ellipsis = 1000;
  42177. t.arrowvertex = 603;
  42178. t.arrowhorizex = 1000;
  42179. t.carriagereturn = 658;
  42180. t.aleph = 823;
  42181. t.Ifraktur = 686;
  42182. t.Rfraktur = 795;
  42183. t.weierstrass = 987;
  42184. t.circlemultiply = 768;
  42185. t.circleplus = 768;
  42186. t.emptyset = 823;
  42187. t.intersection = 768;
  42188. t.union = 768;
  42189. t.propersuperset = 713;
  42190. t.reflexsuperset = 713;
  42191. t.notsubset = 713;
  42192. t.propersubset = 713;
  42193. t.reflexsubset = 713;
  42194. t.element = 713;
  42195. t.notelement = 713;
  42196. t.angle = 768;
  42197. t.gradient = 713;
  42198. t.registerserif = 790;
  42199. t.copyrightserif = 790;
  42200. t.trademarkserif = 890;
  42201. t.product = 823;
  42202. t.radical = 549;
  42203. t.dotmath = 250;
  42204. t.logicalnot = 713;
  42205. t.logicaland = 603;
  42206. t.logicalor = 603;
  42207. t.arrowdblboth = 1042;
  42208. t.arrowdblleft = 987;
  42209. t.arrowdblup = 603;
  42210. t.arrowdblright = 987;
  42211. t.arrowdbldown = 603;
  42212. t.lozenge = 494;
  42213. t.angleleft = 329;
  42214. t.registersans = 790;
  42215. t.copyrightsans = 790;
  42216. t.trademarksans = 786;
  42217. t.summation = 713;
  42218. t.parenlefttp = 384;
  42219. t.parenleftex = 384;
  42220. t.parenleftbt = 384;
  42221. t.bracketlefttp = 384;
  42222. t.bracketleftex = 384;
  42223. t.bracketleftbt = 384;
  42224. t.bracelefttp = 494;
  42225. t.braceleftmid = 494;
  42226. t.braceleftbt = 494;
  42227. t.braceex = 494;
  42228. t.angleright = 329;
  42229. t.integral = 274;
  42230. t.integraltp = 686;
  42231. t.integralex = 686;
  42232. t.integralbt = 686;
  42233. t.parenrighttp = 384;
  42234. t.parenrightex = 384;
  42235. t.parenrightbt = 384;
  42236. t.bracketrighttp = 384;
  42237. t.bracketrightex = 384;
  42238. t.bracketrightbt = 384;
  42239. t.bracerighttp = 494;
  42240. t.bracerightmid = 494;
  42241. t.bracerightbt = 494;
  42242. t.apple = 790;
  42243. });
  42244. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42245. t.space = 250;
  42246. t.exclam = 333;
  42247. t.quotedbl = 408;
  42248. t.numbersign = 500;
  42249. t.dollar = 500;
  42250. t.percent = 833;
  42251. t.ampersand = 778;
  42252. t.quoteright = 333;
  42253. t.parenleft = 333;
  42254. t.parenright = 333;
  42255. t.asterisk = 500;
  42256. t.plus = 564;
  42257. t.comma = 250;
  42258. t.hyphen = 333;
  42259. t.period = 250;
  42260. t.slash = 278;
  42261. t.zero = 500;
  42262. t.one = 500;
  42263. t.two = 500;
  42264. t.three = 500;
  42265. t.four = 500;
  42266. t.five = 500;
  42267. t.six = 500;
  42268. t.seven = 500;
  42269. t.eight = 500;
  42270. t.nine = 500;
  42271. t.colon = 278;
  42272. t.semicolon = 278;
  42273. t.less = 564;
  42274. t.equal = 564;
  42275. t.greater = 564;
  42276. t.question = 444;
  42277. t.at = 921;
  42278. t.A = 722;
  42279. t.B = 667;
  42280. t.C = 667;
  42281. t.D = 722;
  42282. t.E = 611;
  42283. t.F = 556;
  42284. t.G = 722;
  42285. t.H = 722;
  42286. t.I = 333;
  42287. t.J = 389;
  42288. t.K = 722;
  42289. t.L = 611;
  42290. t.M = 889;
  42291. t.N = 722;
  42292. t.O = 722;
  42293. t.P = 556;
  42294. t.Q = 722;
  42295. t.R = 667;
  42296. t.S = 556;
  42297. t.T = 611;
  42298. t.U = 722;
  42299. t.V = 722;
  42300. t.W = 944;
  42301. t.X = 722;
  42302. t.Y = 722;
  42303. t.Z = 611;
  42304. t.bracketleft = 333;
  42305. t.backslash = 278;
  42306. t.bracketright = 333;
  42307. t.asciicircum = 469;
  42308. t.underscore = 500;
  42309. t.quoteleft = 333;
  42310. t.a = 444;
  42311. t.b = 500;
  42312. t.c = 444;
  42313. t.d = 500;
  42314. t.e = 444;
  42315. t.f = 333;
  42316. t.g = 500;
  42317. t.h = 500;
  42318. t.i = 278;
  42319. t.j = 278;
  42320. t.k = 500;
  42321. t.l = 278;
  42322. t.m = 778;
  42323. t.n = 500;
  42324. t.o = 500;
  42325. t.p = 500;
  42326. t.q = 500;
  42327. t.r = 333;
  42328. t.s = 389;
  42329. t.t = 278;
  42330. t.u = 500;
  42331. t.v = 500;
  42332. t.w = 722;
  42333. t.x = 500;
  42334. t.y = 500;
  42335. t.z = 444;
  42336. t.braceleft = 480;
  42337. t.bar = 200;
  42338. t.braceright = 480;
  42339. t.asciitilde = 541;
  42340. t.exclamdown = 333;
  42341. t.cent = 500;
  42342. t.sterling = 500;
  42343. t.fraction = 167;
  42344. t.yen = 500;
  42345. t.florin = 500;
  42346. t.section = 500;
  42347. t.currency = 500;
  42348. t.quotesingle = 180;
  42349. t.quotedblleft = 444;
  42350. t.guillemotleft = 500;
  42351. t.guilsinglleft = 333;
  42352. t.guilsinglright = 333;
  42353. t.fi = 556;
  42354. t.fl = 556;
  42355. t.endash = 500;
  42356. t.dagger = 500;
  42357. t.daggerdbl = 500;
  42358. t.periodcentered = 250;
  42359. t.paragraph = 453;
  42360. t.bullet = 350;
  42361. t.quotesinglbase = 333;
  42362. t.quotedblbase = 444;
  42363. t.quotedblright = 444;
  42364. t.guillemotright = 500;
  42365. t.ellipsis = 1000;
  42366. t.perthousand = 1000;
  42367. t.questiondown = 444;
  42368. t.grave = 333;
  42369. t.acute = 333;
  42370. t.circumflex = 333;
  42371. t.tilde = 333;
  42372. t.macron = 333;
  42373. t.breve = 333;
  42374. t.dotaccent = 333;
  42375. t.dieresis = 333;
  42376. t.ring = 333;
  42377. t.cedilla = 333;
  42378. t.hungarumlaut = 333;
  42379. t.ogonek = 333;
  42380. t.caron = 333;
  42381. t.emdash = 1000;
  42382. t.AE = 889;
  42383. t.ordfeminine = 276;
  42384. t.Lslash = 611;
  42385. t.Oslash = 722;
  42386. t.OE = 889;
  42387. t.ordmasculine = 310;
  42388. t.ae = 667;
  42389. t.dotlessi = 278;
  42390. t.lslash = 278;
  42391. t.oslash = 500;
  42392. t.oe = 722;
  42393. t.germandbls = 500;
  42394. t.Idieresis = 333;
  42395. t.eacute = 444;
  42396. t.abreve = 444;
  42397. t.uhungarumlaut = 500;
  42398. t.ecaron = 444;
  42399. t.Ydieresis = 722;
  42400. t.divide = 564;
  42401. t.Yacute = 722;
  42402. t.Acircumflex = 722;
  42403. t.aacute = 444;
  42404. t.Ucircumflex = 722;
  42405. t.yacute = 500;
  42406. t.scommaaccent = 389;
  42407. t.ecircumflex = 444;
  42408. t.Uring = 722;
  42409. t.Udieresis = 722;
  42410. t.aogonek = 444;
  42411. t.Uacute = 722;
  42412. t.uogonek = 500;
  42413. t.Edieresis = 611;
  42414. t.Dcroat = 722;
  42415. t.commaaccent = 250;
  42416. t.copyright = 760;
  42417. t.Emacron = 611;
  42418. t.ccaron = 444;
  42419. t.aring = 444;
  42420. t.Ncommaaccent = 722;
  42421. t.lacute = 278;
  42422. t.agrave = 444;
  42423. t.Tcommaaccent = 611;
  42424. t.Cacute = 667;
  42425. t.atilde = 444;
  42426. t.Edotaccent = 611;
  42427. t.scaron = 389;
  42428. t.scedilla = 389;
  42429. t.iacute = 278;
  42430. t.lozenge = 471;
  42431. t.Rcaron = 667;
  42432. t.Gcommaaccent = 722;
  42433. t.ucircumflex = 500;
  42434. t.acircumflex = 444;
  42435. t.Amacron = 722;
  42436. t.rcaron = 333;
  42437. t.ccedilla = 444;
  42438. t.Zdotaccent = 611;
  42439. t.Thorn = 556;
  42440. t.Omacron = 722;
  42441. t.Racute = 667;
  42442. t.Sacute = 556;
  42443. t.dcaron = 588;
  42444. t.Umacron = 722;
  42445. t.uring = 500;
  42446. t.threesuperior = 300;
  42447. t.Ograve = 722;
  42448. t.Agrave = 722;
  42449. t.Abreve = 722;
  42450. t.multiply = 564;
  42451. t.uacute = 500;
  42452. t.Tcaron = 611;
  42453. t.partialdiff = 476;
  42454. t.ydieresis = 500;
  42455. t.Nacute = 722;
  42456. t.icircumflex = 278;
  42457. t.Ecircumflex = 611;
  42458. t.adieresis = 444;
  42459. t.edieresis = 444;
  42460. t.cacute = 444;
  42461. t.nacute = 500;
  42462. t.umacron = 500;
  42463. t.Ncaron = 722;
  42464. t.Iacute = 333;
  42465. t.plusminus = 564;
  42466. t.brokenbar = 200;
  42467. t.registered = 760;
  42468. t.Gbreve = 722;
  42469. t.Idotaccent = 333;
  42470. t.summation = 600;
  42471. t.Egrave = 611;
  42472. t.racute = 333;
  42473. t.omacron = 500;
  42474. t.Zacute = 611;
  42475. t.Zcaron = 611;
  42476. t.greaterequal = 549;
  42477. t.Eth = 722;
  42478. t.Ccedilla = 667;
  42479. t.lcommaaccent = 278;
  42480. t.tcaron = 326;
  42481. t.eogonek = 444;
  42482. t.Uogonek = 722;
  42483. t.Aacute = 722;
  42484. t.Adieresis = 722;
  42485. t.egrave = 444;
  42486. t.zacute = 444;
  42487. t.iogonek = 278;
  42488. t.Oacute = 722;
  42489. t.oacute = 500;
  42490. t.amacron = 444;
  42491. t.sacute = 389;
  42492. t.idieresis = 278;
  42493. t.Ocircumflex = 722;
  42494. t.Ugrave = 722;
  42495. t.Delta = 612;
  42496. t.thorn = 500;
  42497. t.twosuperior = 300;
  42498. t.Odieresis = 722;
  42499. t.mu = 500;
  42500. t.igrave = 278;
  42501. t.ohungarumlaut = 500;
  42502. t.Eogonek = 611;
  42503. t.dcroat = 500;
  42504. t.threequarters = 750;
  42505. t.Scedilla = 556;
  42506. t.lcaron = 344;
  42507. t.Kcommaaccent = 722;
  42508. t.Lacute = 611;
  42509. t.trademark = 980;
  42510. t.edotaccent = 444;
  42511. t.Igrave = 333;
  42512. t.Imacron = 333;
  42513. t.Lcaron = 611;
  42514. t.onehalf = 750;
  42515. t.lessequal = 549;
  42516. t.ocircumflex = 500;
  42517. t.ntilde = 500;
  42518. t.Uhungarumlaut = 722;
  42519. t.Eacute = 611;
  42520. t.emacron = 444;
  42521. t.gbreve = 500;
  42522. t.onequarter = 750;
  42523. t.Scaron = 556;
  42524. t.Scommaaccent = 556;
  42525. t.Ohungarumlaut = 722;
  42526. t.degree = 400;
  42527. t.ograve = 500;
  42528. t.Ccaron = 667;
  42529. t.ugrave = 500;
  42530. t.radical = 453;
  42531. t.Dcaron = 722;
  42532. t.rcommaaccent = 333;
  42533. t.Ntilde = 722;
  42534. t.otilde = 500;
  42535. t.Rcommaaccent = 667;
  42536. t.Lcommaaccent = 611;
  42537. t.Atilde = 722;
  42538. t.Aogonek = 722;
  42539. t.Aring = 722;
  42540. t.Otilde = 722;
  42541. t.zdotaccent = 444;
  42542. t.Ecaron = 611;
  42543. t.Iogonek = 333;
  42544. t.kcommaaccent = 500;
  42545. t.minus = 564;
  42546. t.Icircumflex = 333;
  42547. t.ncaron = 500;
  42548. t.tcommaaccent = 278;
  42549. t.logicalnot = 564;
  42550. t.odieresis = 500;
  42551. t.udieresis = 500;
  42552. t.notequal = 549;
  42553. t.gcommaaccent = 500;
  42554. t.eth = 500;
  42555. t.zcaron = 444;
  42556. t.ncommaaccent = 500;
  42557. t.onesuperior = 300;
  42558. t.imacron = 278;
  42559. t.Euro = 500;
  42560. });
  42561. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42562. t.space = 250;
  42563. t.exclam = 333;
  42564. t.quotedbl = 555;
  42565. t.numbersign = 500;
  42566. t.dollar = 500;
  42567. t.percent = 1000;
  42568. t.ampersand = 833;
  42569. t.quoteright = 333;
  42570. t.parenleft = 333;
  42571. t.parenright = 333;
  42572. t.asterisk = 500;
  42573. t.plus = 570;
  42574. t.comma = 250;
  42575. t.hyphen = 333;
  42576. t.period = 250;
  42577. t.slash = 278;
  42578. t.zero = 500;
  42579. t.one = 500;
  42580. t.two = 500;
  42581. t.three = 500;
  42582. t.four = 500;
  42583. t.five = 500;
  42584. t.six = 500;
  42585. t.seven = 500;
  42586. t.eight = 500;
  42587. t.nine = 500;
  42588. t.colon = 333;
  42589. t.semicolon = 333;
  42590. t.less = 570;
  42591. t.equal = 570;
  42592. t.greater = 570;
  42593. t.question = 500;
  42594. t.at = 930;
  42595. t.A = 722;
  42596. t.B = 667;
  42597. t.C = 722;
  42598. t.D = 722;
  42599. t.E = 667;
  42600. t.F = 611;
  42601. t.G = 778;
  42602. t.H = 778;
  42603. t.I = 389;
  42604. t.J = 500;
  42605. t.K = 778;
  42606. t.L = 667;
  42607. t.M = 944;
  42608. t.N = 722;
  42609. t.O = 778;
  42610. t.P = 611;
  42611. t.Q = 778;
  42612. t.R = 722;
  42613. t.S = 556;
  42614. t.T = 667;
  42615. t.U = 722;
  42616. t.V = 722;
  42617. t.W = 1000;
  42618. t.X = 722;
  42619. t.Y = 722;
  42620. t.Z = 667;
  42621. t.bracketleft = 333;
  42622. t.backslash = 278;
  42623. t.bracketright = 333;
  42624. t.asciicircum = 581;
  42625. t.underscore = 500;
  42626. t.quoteleft = 333;
  42627. t.a = 500;
  42628. t.b = 556;
  42629. t.c = 444;
  42630. t.d = 556;
  42631. t.e = 444;
  42632. t.f = 333;
  42633. t.g = 500;
  42634. t.h = 556;
  42635. t.i = 278;
  42636. t.j = 333;
  42637. t.k = 556;
  42638. t.l = 278;
  42639. t.m = 833;
  42640. t.n = 556;
  42641. t.o = 500;
  42642. t.p = 556;
  42643. t.q = 556;
  42644. t.r = 444;
  42645. t.s = 389;
  42646. t.t = 333;
  42647. t.u = 556;
  42648. t.v = 500;
  42649. t.w = 722;
  42650. t.x = 500;
  42651. t.y = 500;
  42652. t.z = 444;
  42653. t.braceleft = 394;
  42654. t.bar = 220;
  42655. t.braceright = 394;
  42656. t.asciitilde = 520;
  42657. t.exclamdown = 333;
  42658. t.cent = 500;
  42659. t.sterling = 500;
  42660. t.fraction = 167;
  42661. t.yen = 500;
  42662. t.florin = 500;
  42663. t.section = 500;
  42664. t.currency = 500;
  42665. t.quotesingle = 278;
  42666. t.quotedblleft = 500;
  42667. t.guillemotleft = 500;
  42668. t.guilsinglleft = 333;
  42669. t.guilsinglright = 333;
  42670. t.fi = 556;
  42671. t.fl = 556;
  42672. t.endash = 500;
  42673. t.dagger = 500;
  42674. t.daggerdbl = 500;
  42675. t.periodcentered = 250;
  42676. t.paragraph = 540;
  42677. t.bullet = 350;
  42678. t.quotesinglbase = 333;
  42679. t.quotedblbase = 500;
  42680. t.quotedblright = 500;
  42681. t.guillemotright = 500;
  42682. t.ellipsis = 1000;
  42683. t.perthousand = 1000;
  42684. t.questiondown = 500;
  42685. t.grave = 333;
  42686. t.acute = 333;
  42687. t.circumflex = 333;
  42688. t.tilde = 333;
  42689. t.macron = 333;
  42690. t.breve = 333;
  42691. t.dotaccent = 333;
  42692. t.dieresis = 333;
  42693. t.ring = 333;
  42694. t.cedilla = 333;
  42695. t.hungarumlaut = 333;
  42696. t.ogonek = 333;
  42697. t.caron = 333;
  42698. t.emdash = 1000;
  42699. t.AE = 1000;
  42700. t.ordfeminine = 300;
  42701. t.Lslash = 667;
  42702. t.Oslash = 778;
  42703. t.OE = 1000;
  42704. t.ordmasculine = 330;
  42705. t.ae = 722;
  42706. t.dotlessi = 278;
  42707. t.lslash = 278;
  42708. t.oslash = 500;
  42709. t.oe = 722;
  42710. t.germandbls = 556;
  42711. t.Idieresis = 389;
  42712. t.eacute = 444;
  42713. t.abreve = 500;
  42714. t.uhungarumlaut = 556;
  42715. t.ecaron = 444;
  42716. t.Ydieresis = 722;
  42717. t.divide = 570;
  42718. t.Yacute = 722;
  42719. t.Acircumflex = 722;
  42720. t.aacute = 500;
  42721. t.Ucircumflex = 722;
  42722. t.yacute = 500;
  42723. t.scommaaccent = 389;
  42724. t.ecircumflex = 444;
  42725. t.Uring = 722;
  42726. t.Udieresis = 722;
  42727. t.aogonek = 500;
  42728. t.Uacute = 722;
  42729. t.uogonek = 556;
  42730. t.Edieresis = 667;
  42731. t.Dcroat = 722;
  42732. t.commaaccent = 250;
  42733. t.copyright = 747;
  42734. t.Emacron = 667;
  42735. t.ccaron = 444;
  42736. t.aring = 500;
  42737. t.Ncommaaccent = 722;
  42738. t.lacute = 278;
  42739. t.agrave = 500;
  42740. t.Tcommaaccent = 667;
  42741. t.Cacute = 722;
  42742. t.atilde = 500;
  42743. t.Edotaccent = 667;
  42744. t.scaron = 389;
  42745. t.scedilla = 389;
  42746. t.iacute = 278;
  42747. t.lozenge = 494;
  42748. t.Rcaron = 722;
  42749. t.Gcommaaccent = 778;
  42750. t.ucircumflex = 556;
  42751. t.acircumflex = 500;
  42752. t.Amacron = 722;
  42753. t.rcaron = 444;
  42754. t.ccedilla = 444;
  42755. t.Zdotaccent = 667;
  42756. t.Thorn = 611;
  42757. t.Omacron = 778;
  42758. t.Racute = 722;
  42759. t.Sacute = 556;
  42760. t.dcaron = 672;
  42761. t.Umacron = 722;
  42762. t.uring = 556;
  42763. t.threesuperior = 300;
  42764. t.Ograve = 778;
  42765. t.Agrave = 722;
  42766. t.Abreve = 722;
  42767. t.multiply = 570;
  42768. t.uacute = 556;
  42769. t.Tcaron = 667;
  42770. t.partialdiff = 494;
  42771. t.ydieresis = 500;
  42772. t.Nacute = 722;
  42773. t.icircumflex = 278;
  42774. t.Ecircumflex = 667;
  42775. t.adieresis = 500;
  42776. t.edieresis = 444;
  42777. t.cacute = 444;
  42778. t.nacute = 556;
  42779. t.umacron = 556;
  42780. t.Ncaron = 722;
  42781. t.Iacute = 389;
  42782. t.plusminus = 570;
  42783. t.brokenbar = 220;
  42784. t.registered = 747;
  42785. t.Gbreve = 778;
  42786. t.Idotaccent = 389;
  42787. t.summation = 600;
  42788. t.Egrave = 667;
  42789. t.racute = 444;
  42790. t.omacron = 500;
  42791. t.Zacute = 667;
  42792. t.Zcaron = 667;
  42793. t.greaterequal = 549;
  42794. t.Eth = 722;
  42795. t.Ccedilla = 722;
  42796. t.lcommaaccent = 278;
  42797. t.tcaron = 416;
  42798. t.eogonek = 444;
  42799. t.Uogonek = 722;
  42800. t.Aacute = 722;
  42801. t.Adieresis = 722;
  42802. t.egrave = 444;
  42803. t.zacute = 444;
  42804. t.iogonek = 278;
  42805. t.Oacute = 778;
  42806. t.oacute = 500;
  42807. t.amacron = 500;
  42808. t.sacute = 389;
  42809. t.idieresis = 278;
  42810. t.Ocircumflex = 778;
  42811. t.Ugrave = 722;
  42812. t.Delta = 612;
  42813. t.thorn = 556;
  42814. t.twosuperior = 300;
  42815. t.Odieresis = 778;
  42816. t.mu = 556;
  42817. t.igrave = 278;
  42818. t.ohungarumlaut = 500;
  42819. t.Eogonek = 667;
  42820. t.dcroat = 556;
  42821. t.threequarters = 750;
  42822. t.Scedilla = 556;
  42823. t.lcaron = 394;
  42824. t.Kcommaaccent = 778;
  42825. t.Lacute = 667;
  42826. t.trademark = 1000;
  42827. t.edotaccent = 444;
  42828. t.Igrave = 389;
  42829. t.Imacron = 389;
  42830. t.Lcaron = 667;
  42831. t.onehalf = 750;
  42832. t.lessequal = 549;
  42833. t.ocircumflex = 500;
  42834. t.ntilde = 556;
  42835. t.Uhungarumlaut = 722;
  42836. t.Eacute = 667;
  42837. t.emacron = 444;
  42838. t.gbreve = 500;
  42839. t.onequarter = 750;
  42840. t.Scaron = 556;
  42841. t.Scommaaccent = 556;
  42842. t.Ohungarumlaut = 778;
  42843. t.degree = 400;
  42844. t.ograve = 500;
  42845. t.Ccaron = 722;
  42846. t.ugrave = 556;
  42847. t.radical = 549;
  42848. t.Dcaron = 722;
  42849. t.rcommaaccent = 444;
  42850. t.Ntilde = 722;
  42851. t.otilde = 500;
  42852. t.Rcommaaccent = 722;
  42853. t.Lcommaaccent = 667;
  42854. t.Atilde = 722;
  42855. t.Aogonek = 722;
  42856. t.Aring = 722;
  42857. t.Otilde = 778;
  42858. t.zdotaccent = 444;
  42859. t.Ecaron = 667;
  42860. t.Iogonek = 389;
  42861. t.kcommaaccent = 556;
  42862. t.minus = 570;
  42863. t.Icircumflex = 389;
  42864. t.ncaron = 556;
  42865. t.tcommaaccent = 333;
  42866. t.logicalnot = 570;
  42867. t.odieresis = 500;
  42868. t.udieresis = 556;
  42869. t.notequal = 549;
  42870. t.gcommaaccent = 500;
  42871. t.eth = 500;
  42872. t.zcaron = 444;
  42873. t.ncommaaccent = 556;
  42874. t.onesuperior = 300;
  42875. t.imacron = 278;
  42876. t.Euro = 500;
  42877. });
  42878. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42879. t.space = 250;
  42880. t.exclam = 389;
  42881. t.quotedbl = 555;
  42882. t.numbersign = 500;
  42883. t.dollar = 500;
  42884. t.percent = 833;
  42885. t.ampersand = 778;
  42886. t.quoteright = 333;
  42887. t.parenleft = 333;
  42888. t.parenright = 333;
  42889. t.asterisk = 500;
  42890. t.plus = 570;
  42891. t.comma = 250;
  42892. t.hyphen = 333;
  42893. t.period = 250;
  42894. t.slash = 278;
  42895. t.zero = 500;
  42896. t.one = 500;
  42897. t.two = 500;
  42898. t.three = 500;
  42899. t.four = 500;
  42900. t.five = 500;
  42901. t.six = 500;
  42902. t.seven = 500;
  42903. t.eight = 500;
  42904. t.nine = 500;
  42905. t.colon = 333;
  42906. t.semicolon = 333;
  42907. t.less = 570;
  42908. t.equal = 570;
  42909. t.greater = 570;
  42910. t.question = 500;
  42911. t.at = 832;
  42912. t.A = 667;
  42913. t.B = 667;
  42914. t.C = 667;
  42915. t.D = 722;
  42916. t.E = 667;
  42917. t.F = 667;
  42918. t.G = 722;
  42919. t.H = 778;
  42920. t.I = 389;
  42921. t.J = 500;
  42922. t.K = 667;
  42923. t.L = 611;
  42924. t.M = 889;
  42925. t.N = 722;
  42926. t.O = 722;
  42927. t.P = 611;
  42928. t.Q = 722;
  42929. t.R = 667;
  42930. t.S = 556;
  42931. t.T = 611;
  42932. t.U = 722;
  42933. t.V = 667;
  42934. t.W = 889;
  42935. t.X = 667;
  42936. t.Y = 611;
  42937. t.Z = 611;
  42938. t.bracketleft = 333;
  42939. t.backslash = 278;
  42940. t.bracketright = 333;
  42941. t.asciicircum = 570;
  42942. t.underscore = 500;
  42943. t.quoteleft = 333;
  42944. t.a = 500;
  42945. t.b = 500;
  42946. t.c = 444;
  42947. t.d = 500;
  42948. t.e = 444;
  42949. t.f = 333;
  42950. t.g = 500;
  42951. t.h = 556;
  42952. t.i = 278;
  42953. t.j = 278;
  42954. t.k = 500;
  42955. t.l = 278;
  42956. t.m = 778;
  42957. t.n = 556;
  42958. t.o = 500;
  42959. t.p = 500;
  42960. t.q = 500;
  42961. t.r = 389;
  42962. t.s = 389;
  42963. t.t = 278;
  42964. t.u = 556;
  42965. t.v = 444;
  42966. t.w = 667;
  42967. t.x = 500;
  42968. t.y = 444;
  42969. t.z = 389;
  42970. t.braceleft = 348;
  42971. t.bar = 220;
  42972. t.braceright = 348;
  42973. t.asciitilde = 570;
  42974. t.exclamdown = 389;
  42975. t.cent = 500;
  42976. t.sterling = 500;
  42977. t.fraction = 167;
  42978. t.yen = 500;
  42979. t.florin = 500;
  42980. t.section = 500;
  42981. t.currency = 500;
  42982. t.quotesingle = 278;
  42983. t.quotedblleft = 500;
  42984. t.guillemotleft = 500;
  42985. t.guilsinglleft = 333;
  42986. t.guilsinglright = 333;
  42987. t.fi = 556;
  42988. t.fl = 556;
  42989. t.endash = 500;
  42990. t.dagger = 500;
  42991. t.daggerdbl = 500;
  42992. t.periodcentered = 250;
  42993. t.paragraph = 500;
  42994. t.bullet = 350;
  42995. t.quotesinglbase = 333;
  42996. t.quotedblbase = 500;
  42997. t.quotedblright = 500;
  42998. t.guillemotright = 500;
  42999. t.ellipsis = 1000;
  43000. t.perthousand = 1000;
  43001. t.questiondown = 500;
  43002. t.grave = 333;
  43003. t.acute = 333;
  43004. t.circumflex = 333;
  43005. t.tilde = 333;
  43006. t.macron = 333;
  43007. t.breve = 333;
  43008. t.dotaccent = 333;
  43009. t.dieresis = 333;
  43010. t.ring = 333;
  43011. t.cedilla = 333;
  43012. t.hungarumlaut = 333;
  43013. t.ogonek = 333;
  43014. t.caron = 333;
  43015. t.emdash = 1000;
  43016. t.AE = 944;
  43017. t.ordfeminine = 266;
  43018. t.Lslash = 611;
  43019. t.Oslash = 722;
  43020. t.OE = 944;
  43021. t.ordmasculine = 300;
  43022. t.ae = 722;
  43023. t.dotlessi = 278;
  43024. t.lslash = 278;
  43025. t.oslash = 500;
  43026. t.oe = 722;
  43027. t.germandbls = 500;
  43028. t.Idieresis = 389;
  43029. t.eacute = 444;
  43030. t.abreve = 500;
  43031. t.uhungarumlaut = 556;
  43032. t.ecaron = 444;
  43033. t.Ydieresis = 611;
  43034. t.divide = 570;
  43035. t.Yacute = 611;
  43036. t.Acircumflex = 667;
  43037. t.aacute = 500;
  43038. t.Ucircumflex = 722;
  43039. t.yacute = 444;
  43040. t.scommaaccent = 389;
  43041. t.ecircumflex = 444;
  43042. t.Uring = 722;
  43043. t.Udieresis = 722;
  43044. t.aogonek = 500;
  43045. t.Uacute = 722;
  43046. t.uogonek = 556;
  43047. t.Edieresis = 667;
  43048. t.Dcroat = 722;
  43049. t.commaaccent = 250;
  43050. t.copyright = 747;
  43051. t.Emacron = 667;
  43052. t.ccaron = 444;
  43053. t.aring = 500;
  43054. t.Ncommaaccent = 722;
  43055. t.lacute = 278;
  43056. t.agrave = 500;
  43057. t.Tcommaaccent = 611;
  43058. t.Cacute = 667;
  43059. t.atilde = 500;
  43060. t.Edotaccent = 667;
  43061. t.scaron = 389;
  43062. t.scedilla = 389;
  43063. t.iacute = 278;
  43064. t.lozenge = 494;
  43065. t.Rcaron = 667;
  43066. t.Gcommaaccent = 722;
  43067. t.ucircumflex = 556;
  43068. t.acircumflex = 500;
  43069. t.Amacron = 667;
  43070. t.rcaron = 389;
  43071. t.ccedilla = 444;
  43072. t.Zdotaccent = 611;
  43073. t.Thorn = 611;
  43074. t.Omacron = 722;
  43075. t.Racute = 667;
  43076. t.Sacute = 556;
  43077. t.dcaron = 608;
  43078. t.Umacron = 722;
  43079. t.uring = 556;
  43080. t.threesuperior = 300;
  43081. t.Ograve = 722;
  43082. t.Agrave = 667;
  43083. t.Abreve = 667;
  43084. t.multiply = 570;
  43085. t.uacute = 556;
  43086. t.Tcaron = 611;
  43087. t.partialdiff = 494;
  43088. t.ydieresis = 444;
  43089. t.Nacute = 722;
  43090. t.icircumflex = 278;
  43091. t.Ecircumflex = 667;
  43092. t.adieresis = 500;
  43093. t.edieresis = 444;
  43094. t.cacute = 444;
  43095. t.nacute = 556;
  43096. t.umacron = 556;
  43097. t.Ncaron = 722;
  43098. t.Iacute = 389;
  43099. t.plusminus = 570;
  43100. t.brokenbar = 220;
  43101. t.registered = 747;
  43102. t.Gbreve = 722;
  43103. t.Idotaccent = 389;
  43104. t.summation = 600;
  43105. t.Egrave = 667;
  43106. t.racute = 389;
  43107. t.omacron = 500;
  43108. t.Zacute = 611;
  43109. t.Zcaron = 611;
  43110. t.greaterequal = 549;
  43111. t.Eth = 722;
  43112. t.Ccedilla = 667;
  43113. t.lcommaaccent = 278;
  43114. t.tcaron = 366;
  43115. t.eogonek = 444;
  43116. t.Uogonek = 722;
  43117. t.Aacute = 667;
  43118. t.Adieresis = 667;
  43119. t.egrave = 444;
  43120. t.zacute = 389;
  43121. t.iogonek = 278;
  43122. t.Oacute = 722;
  43123. t.oacute = 500;
  43124. t.amacron = 500;
  43125. t.sacute = 389;
  43126. t.idieresis = 278;
  43127. t.Ocircumflex = 722;
  43128. t.Ugrave = 722;
  43129. t.Delta = 612;
  43130. t.thorn = 500;
  43131. t.twosuperior = 300;
  43132. t.Odieresis = 722;
  43133. t.mu = 576;
  43134. t.igrave = 278;
  43135. t.ohungarumlaut = 500;
  43136. t.Eogonek = 667;
  43137. t.dcroat = 500;
  43138. t.threequarters = 750;
  43139. t.Scedilla = 556;
  43140. t.lcaron = 382;
  43141. t.Kcommaaccent = 667;
  43142. t.Lacute = 611;
  43143. t.trademark = 1000;
  43144. t.edotaccent = 444;
  43145. t.Igrave = 389;
  43146. t.Imacron = 389;
  43147. t.Lcaron = 611;
  43148. t.onehalf = 750;
  43149. t.lessequal = 549;
  43150. t.ocircumflex = 500;
  43151. t.ntilde = 556;
  43152. t.Uhungarumlaut = 722;
  43153. t.Eacute = 667;
  43154. t.emacron = 444;
  43155. t.gbreve = 500;
  43156. t.onequarter = 750;
  43157. t.Scaron = 556;
  43158. t.Scommaaccent = 556;
  43159. t.Ohungarumlaut = 722;
  43160. t.degree = 400;
  43161. t.ograve = 500;
  43162. t.Ccaron = 667;
  43163. t.ugrave = 556;
  43164. t.radical = 549;
  43165. t.Dcaron = 722;
  43166. t.rcommaaccent = 389;
  43167. t.Ntilde = 722;
  43168. t.otilde = 500;
  43169. t.Rcommaaccent = 667;
  43170. t.Lcommaaccent = 611;
  43171. t.Atilde = 667;
  43172. t.Aogonek = 667;
  43173. t.Aring = 667;
  43174. t.Otilde = 722;
  43175. t.zdotaccent = 389;
  43176. t.Ecaron = 667;
  43177. t.Iogonek = 389;
  43178. t.kcommaaccent = 500;
  43179. t.minus = 606;
  43180. t.Icircumflex = 389;
  43181. t.ncaron = 556;
  43182. t.tcommaaccent = 278;
  43183. t.logicalnot = 606;
  43184. t.odieresis = 500;
  43185. t.udieresis = 556;
  43186. t.notequal = 549;
  43187. t.gcommaaccent = 500;
  43188. t.eth = 500;
  43189. t.zcaron = 389;
  43190. t.ncommaaccent = 556;
  43191. t.onesuperior = 300;
  43192. t.imacron = 278;
  43193. t.Euro = 500;
  43194. });
  43195. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43196. t.space = 250;
  43197. t.exclam = 333;
  43198. t.quotedbl = 420;
  43199. t.numbersign = 500;
  43200. t.dollar = 500;
  43201. t.percent = 833;
  43202. t.ampersand = 778;
  43203. t.quoteright = 333;
  43204. t.parenleft = 333;
  43205. t.parenright = 333;
  43206. t.asterisk = 500;
  43207. t.plus = 675;
  43208. t.comma = 250;
  43209. t.hyphen = 333;
  43210. t.period = 250;
  43211. t.slash = 278;
  43212. t.zero = 500;
  43213. t.one = 500;
  43214. t.two = 500;
  43215. t.three = 500;
  43216. t.four = 500;
  43217. t.five = 500;
  43218. t.six = 500;
  43219. t.seven = 500;
  43220. t.eight = 500;
  43221. t.nine = 500;
  43222. t.colon = 333;
  43223. t.semicolon = 333;
  43224. t.less = 675;
  43225. t.equal = 675;
  43226. t.greater = 675;
  43227. t.question = 500;
  43228. t.at = 920;
  43229. t.A = 611;
  43230. t.B = 611;
  43231. t.C = 667;
  43232. t.D = 722;
  43233. t.E = 611;
  43234. t.F = 611;
  43235. t.G = 722;
  43236. t.H = 722;
  43237. t.I = 333;
  43238. t.J = 444;
  43239. t.K = 667;
  43240. t.L = 556;
  43241. t.M = 833;
  43242. t.N = 667;
  43243. t.O = 722;
  43244. t.P = 611;
  43245. t.Q = 722;
  43246. t.R = 611;
  43247. t.S = 500;
  43248. t.T = 556;
  43249. t.U = 722;
  43250. t.V = 611;
  43251. t.W = 833;
  43252. t.X = 611;
  43253. t.Y = 556;
  43254. t.Z = 556;
  43255. t.bracketleft = 389;
  43256. t.backslash = 278;
  43257. t.bracketright = 389;
  43258. t.asciicircum = 422;
  43259. t.underscore = 500;
  43260. t.quoteleft = 333;
  43261. t.a = 500;
  43262. t.b = 500;
  43263. t.c = 444;
  43264. t.d = 500;
  43265. t.e = 444;
  43266. t.f = 278;
  43267. t.g = 500;
  43268. t.h = 500;
  43269. t.i = 278;
  43270. t.j = 278;
  43271. t.k = 444;
  43272. t.l = 278;
  43273. t.m = 722;
  43274. t.n = 500;
  43275. t.o = 500;
  43276. t.p = 500;
  43277. t.q = 500;
  43278. t.r = 389;
  43279. t.s = 389;
  43280. t.t = 278;
  43281. t.u = 500;
  43282. t.v = 444;
  43283. t.w = 667;
  43284. t.x = 444;
  43285. t.y = 444;
  43286. t.z = 389;
  43287. t.braceleft = 400;
  43288. t.bar = 275;
  43289. t.braceright = 400;
  43290. t.asciitilde = 541;
  43291. t.exclamdown = 389;
  43292. t.cent = 500;
  43293. t.sterling = 500;
  43294. t.fraction = 167;
  43295. t.yen = 500;
  43296. t.florin = 500;
  43297. t.section = 500;
  43298. t.currency = 500;
  43299. t.quotesingle = 214;
  43300. t.quotedblleft = 556;
  43301. t.guillemotleft = 500;
  43302. t.guilsinglleft = 333;
  43303. t.guilsinglright = 333;
  43304. t.fi = 500;
  43305. t.fl = 500;
  43306. t.endash = 500;
  43307. t.dagger = 500;
  43308. t.daggerdbl = 500;
  43309. t.periodcentered = 250;
  43310. t.paragraph = 523;
  43311. t.bullet = 350;
  43312. t.quotesinglbase = 333;
  43313. t.quotedblbase = 556;
  43314. t.quotedblright = 556;
  43315. t.guillemotright = 500;
  43316. t.ellipsis = 889;
  43317. t.perthousand = 1000;
  43318. t.questiondown = 500;
  43319. t.grave = 333;
  43320. t.acute = 333;
  43321. t.circumflex = 333;
  43322. t.tilde = 333;
  43323. t.macron = 333;
  43324. t.breve = 333;
  43325. t.dotaccent = 333;
  43326. t.dieresis = 333;
  43327. t.ring = 333;
  43328. t.cedilla = 333;
  43329. t.hungarumlaut = 333;
  43330. t.ogonek = 333;
  43331. t.caron = 333;
  43332. t.emdash = 889;
  43333. t.AE = 889;
  43334. t.ordfeminine = 276;
  43335. t.Lslash = 556;
  43336. t.Oslash = 722;
  43337. t.OE = 944;
  43338. t.ordmasculine = 310;
  43339. t.ae = 667;
  43340. t.dotlessi = 278;
  43341. t.lslash = 278;
  43342. t.oslash = 500;
  43343. t.oe = 667;
  43344. t.germandbls = 500;
  43345. t.Idieresis = 333;
  43346. t.eacute = 444;
  43347. t.abreve = 500;
  43348. t.uhungarumlaut = 500;
  43349. t.ecaron = 444;
  43350. t.Ydieresis = 556;
  43351. t.divide = 675;
  43352. t.Yacute = 556;
  43353. t.Acircumflex = 611;
  43354. t.aacute = 500;
  43355. t.Ucircumflex = 722;
  43356. t.yacute = 444;
  43357. t.scommaaccent = 389;
  43358. t.ecircumflex = 444;
  43359. t.Uring = 722;
  43360. t.Udieresis = 722;
  43361. t.aogonek = 500;
  43362. t.Uacute = 722;
  43363. t.uogonek = 500;
  43364. t.Edieresis = 611;
  43365. t.Dcroat = 722;
  43366. t.commaaccent = 250;
  43367. t.copyright = 760;
  43368. t.Emacron = 611;
  43369. t.ccaron = 444;
  43370. t.aring = 500;
  43371. t.Ncommaaccent = 667;
  43372. t.lacute = 278;
  43373. t.agrave = 500;
  43374. t.Tcommaaccent = 556;
  43375. t.Cacute = 667;
  43376. t.atilde = 500;
  43377. t.Edotaccent = 611;
  43378. t.scaron = 389;
  43379. t.scedilla = 389;
  43380. t.iacute = 278;
  43381. t.lozenge = 471;
  43382. t.Rcaron = 611;
  43383. t.Gcommaaccent = 722;
  43384. t.ucircumflex = 500;
  43385. t.acircumflex = 500;
  43386. t.Amacron = 611;
  43387. t.rcaron = 389;
  43388. t.ccedilla = 444;
  43389. t.Zdotaccent = 556;
  43390. t.Thorn = 611;
  43391. t.Omacron = 722;
  43392. t.Racute = 611;
  43393. t.Sacute = 500;
  43394. t.dcaron = 544;
  43395. t.Umacron = 722;
  43396. t.uring = 500;
  43397. t.threesuperior = 300;
  43398. t.Ograve = 722;
  43399. t.Agrave = 611;
  43400. t.Abreve = 611;
  43401. t.multiply = 675;
  43402. t.uacute = 500;
  43403. t.Tcaron = 556;
  43404. t.partialdiff = 476;
  43405. t.ydieresis = 444;
  43406. t.Nacute = 667;
  43407. t.icircumflex = 278;
  43408. t.Ecircumflex = 611;
  43409. t.adieresis = 500;
  43410. t.edieresis = 444;
  43411. t.cacute = 444;
  43412. t.nacute = 500;
  43413. t.umacron = 500;
  43414. t.Ncaron = 667;
  43415. t.Iacute = 333;
  43416. t.plusminus = 675;
  43417. t.brokenbar = 275;
  43418. t.registered = 760;
  43419. t.Gbreve = 722;
  43420. t.Idotaccent = 333;
  43421. t.summation = 600;
  43422. t.Egrave = 611;
  43423. t.racute = 389;
  43424. t.omacron = 500;
  43425. t.Zacute = 556;
  43426. t.Zcaron = 556;
  43427. t.greaterequal = 549;
  43428. t.Eth = 722;
  43429. t.Ccedilla = 667;
  43430. t.lcommaaccent = 278;
  43431. t.tcaron = 300;
  43432. t.eogonek = 444;
  43433. t.Uogonek = 722;
  43434. t.Aacute = 611;
  43435. t.Adieresis = 611;
  43436. t.egrave = 444;
  43437. t.zacute = 389;
  43438. t.iogonek = 278;
  43439. t.Oacute = 722;
  43440. t.oacute = 500;
  43441. t.amacron = 500;
  43442. t.sacute = 389;
  43443. t.idieresis = 278;
  43444. t.Ocircumflex = 722;
  43445. t.Ugrave = 722;
  43446. t.Delta = 612;
  43447. t.thorn = 500;
  43448. t.twosuperior = 300;
  43449. t.Odieresis = 722;
  43450. t.mu = 500;
  43451. t.igrave = 278;
  43452. t.ohungarumlaut = 500;
  43453. t.Eogonek = 611;
  43454. t.dcroat = 500;
  43455. t.threequarters = 750;
  43456. t.Scedilla = 500;
  43457. t.lcaron = 300;
  43458. t.Kcommaaccent = 667;
  43459. t.Lacute = 556;
  43460. t.trademark = 980;
  43461. t.edotaccent = 444;
  43462. t.Igrave = 333;
  43463. t.Imacron = 333;
  43464. t.Lcaron = 611;
  43465. t.onehalf = 750;
  43466. t.lessequal = 549;
  43467. t.ocircumflex = 500;
  43468. t.ntilde = 500;
  43469. t.Uhungarumlaut = 722;
  43470. t.Eacute = 611;
  43471. t.emacron = 444;
  43472. t.gbreve = 500;
  43473. t.onequarter = 750;
  43474. t.Scaron = 500;
  43475. t.Scommaaccent = 500;
  43476. t.Ohungarumlaut = 722;
  43477. t.degree = 400;
  43478. t.ograve = 500;
  43479. t.Ccaron = 667;
  43480. t.ugrave = 500;
  43481. t.radical = 453;
  43482. t.Dcaron = 722;
  43483. t.rcommaaccent = 389;
  43484. t.Ntilde = 667;
  43485. t.otilde = 500;
  43486. t.Rcommaaccent = 611;
  43487. t.Lcommaaccent = 556;
  43488. t.Atilde = 611;
  43489. t.Aogonek = 611;
  43490. t.Aring = 611;
  43491. t.Otilde = 722;
  43492. t.zdotaccent = 389;
  43493. t.Ecaron = 611;
  43494. t.Iogonek = 333;
  43495. t.kcommaaccent = 444;
  43496. t.minus = 675;
  43497. t.Icircumflex = 333;
  43498. t.ncaron = 500;
  43499. t.tcommaaccent = 278;
  43500. t.logicalnot = 675;
  43501. t.odieresis = 500;
  43502. t.udieresis = 500;
  43503. t.notequal = 549;
  43504. t.gcommaaccent = 500;
  43505. t.eth = 500;
  43506. t.zcaron = 389;
  43507. t.ncommaaccent = 500;
  43508. t.onesuperior = 300;
  43509. t.imacron = 278;
  43510. t.Euro = 500;
  43511. });
  43512. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  43513. t.space = 278;
  43514. t.a1 = 974;
  43515. t.a2 = 961;
  43516. t.a202 = 974;
  43517. t.a3 = 980;
  43518. t.a4 = 719;
  43519. t.a5 = 789;
  43520. t.a119 = 790;
  43521. t.a118 = 791;
  43522. t.a117 = 690;
  43523. t.a11 = 960;
  43524. t.a12 = 939;
  43525. t.a13 = 549;
  43526. t.a14 = 855;
  43527. t.a15 = 911;
  43528. t.a16 = 933;
  43529. t.a105 = 911;
  43530. t.a17 = 945;
  43531. t.a18 = 974;
  43532. t.a19 = 755;
  43533. t.a20 = 846;
  43534. t.a21 = 762;
  43535. t.a22 = 761;
  43536. t.a23 = 571;
  43537. t.a24 = 677;
  43538. t.a25 = 763;
  43539. t.a26 = 760;
  43540. t.a27 = 759;
  43541. t.a28 = 754;
  43542. t.a6 = 494;
  43543. t.a7 = 552;
  43544. t.a8 = 537;
  43545. t.a9 = 577;
  43546. t.a10 = 692;
  43547. t.a29 = 786;
  43548. t.a30 = 788;
  43549. t.a31 = 788;
  43550. t.a32 = 790;
  43551. t.a33 = 793;
  43552. t.a34 = 794;
  43553. t.a35 = 816;
  43554. t.a36 = 823;
  43555. t.a37 = 789;
  43556. t.a38 = 841;
  43557. t.a39 = 823;
  43558. t.a40 = 833;
  43559. t.a41 = 816;
  43560. t.a42 = 831;
  43561. t.a43 = 923;
  43562. t.a44 = 744;
  43563. t.a45 = 723;
  43564. t.a46 = 749;
  43565. t.a47 = 790;
  43566. t.a48 = 792;
  43567. t.a49 = 695;
  43568. t.a50 = 776;
  43569. t.a51 = 768;
  43570. t.a52 = 792;
  43571. t.a53 = 759;
  43572. t.a54 = 707;
  43573. t.a55 = 708;
  43574. t.a56 = 682;
  43575. t.a57 = 701;
  43576. t.a58 = 826;
  43577. t.a59 = 815;
  43578. t.a60 = 789;
  43579. t.a61 = 789;
  43580. t.a62 = 707;
  43581. t.a63 = 687;
  43582. t.a64 = 696;
  43583. t.a65 = 689;
  43584. t.a66 = 786;
  43585. t.a67 = 787;
  43586. t.a68 = 713;
  43587. t.a69 = 791;
  43588. t.a70 = 785;
  43589. t.a71 = 791;
  43590. t.a72 = 873;
  43591. t.a73 = 761;
  43592. t.a74 = 762;
  43593. t.a203 = 762;
  43594. t.a75 = 759;
  43595. t.a204 = 759;
  43596. t.a76 = 892;
  43597. t.a77 = 892;
  43598. t.a78 = 788;
  43599. t.a79 = 784;
  43600. t.a81 = 438;
  43601. t.a82 = 138;
  43602. t.a83 = 277;
  43603. t.a84 = 415;
  43604. t.a97 = 392;
  43605. t.a98 = 392;
  43606. t.a99 = 668;
  43607. t.a100 = 668;
  43608. t.a89 = 390;
  43609. t.a90 = 390;
  43610. t.a93 = 317;
  43611. t.a94 = 317;
  43612. t.a91 = 276;
  43613. t.a92 = 276;
  43614. t.a205 = 509;
  43615. t.a85 = 509;
  43616. t.a206 = 410;
  43617. t.a86 = 410;
  43618. t.a87 = 234;
  43619. t.a88 = 234;
  43620. t.a95 = 334;
  43621. t.a96 = 334;
  43622. t.a101 = 732;
  43623. t.a102 = 544;
  43624. t.a103 = 544;
  43625. t.a104 = 910;
  43626. t.a106 = 667;
  43627. t.a107 = 760;
  43628. t.a108 = 760;
  43629. t.a112 = 776;
  43630. t.a111 = 595;
  43631. t.a110 = 694;
  43632. t.a109 = 626;
  43633. t.a120 = 788;
  43634. t.a121 = 788;
  43635. t.a122 = 788;
  43636. t.a123 = 788;
  43637. t.a124 = 788;
  43638. t.a125 = 788;
  43639. t.a126 = 788;
  43640. t.a127 = 788;
  43641. t.a128 = 788;
  43642. t.a129 = 788;
  43643. t.a130 = 788;
  43644. t.a131 = 788;
  43645. t.a132 = 788;
  43646. t.a133 = 788;
  43647. t.a134 = 788;
  43648. t.a135 = 788;
  43649. t.a136 = 788;
  43650. t.a137 = 788;
  43651. t.a138 = 788;
  43652. t.a139 = 788;
  43653. t.a140 = 788;
  43654. t.a141 = 788;
  43655. t.a142 = 788;
  43656. t.a143 = 788;
  43657. t.a144 = 788;
  43658. t.a145 = 788;
  43659. t.a146 = 788;
  43660. t.a147 = 788;
  43661. t.a148 = 788;
  43662. t.a149 = 788;
  43663. t.a150 = 788;
  43664. t.a151 = 788;
  43665. t.a152 = 788;
  43666. t.a153 = 788;
  43667. t.a154 = 788;
  43668. t.a155 = 788;
  43669. t.a156 = 788;
  43670. t.a157 = 788;
  43671. t.a158 = 788;
  43672. t.a159 = 788;
  43673. t.a160 = 894;
  43674. t.a161 = 838;
  43675. t.a163 = 1016;
  43676. t.a164 = 458;
  43677. t.a196 = 748;
  43678. t.a165 = 924;
  43679. t.a192 = 748;
  43680. t.a166 = 918;
  43681. t.a167 = 927;
  43682. t.a168 = 928;
  43683. t.a169 = 928;
  43684. t.a170 = 834;
  43685. t.a171 = 873;
  43686. t.a172 = 828;
  43687. t.a173 = 924;
  43688. t.a162 = 924;
  43689. t.a174 = 917;
  43690. t.a175 = 930;
  43691. t.a176 = 931;
  43692. t.a177 = 463;
  43693. t.a178 = 883;
  43694. t.a179 = 836;
  43695. t.a193 = 836;
  43696. t.a180 = 867;
  43697. t.a199 = 867;
  43698. t.a181 = 696;
  43699. t.a200 = 696;
  43700. t.a182 = 874;
  43701. t.a201 = 874;
  43702. t.a183 = 760;
  43703. t.a184 = 946;
  43704. t.a197 = 771;
  43705. t.a185 = 865;
  43706. t.a194 = 771;
  43707. t.a198 = 888;
  43708. t.a186 = 967;
  43709. t.a195 = 888;
  43710. t.a187 = 831;
  43711. t.a188 = 873;
  43712. t.a189 = 927;
  43713. t.a190 = 970;
  43714. t.a191 = 918;
  43715. });
  43716. });
  43717. exports.getMetrics = getMetrics;
  43718. /***/ }),
  43719. /* 55 */
  43720. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43721. Object.defineProperty(exports, "__esModule", ({
  43722. value: true
  43723. }));
  43724. exports.getXfaFontName = getXfaFontName;
  43725. exports.getXfaFontWidths = getXfaFontWidths;
  43726. var _calibri_factors = __w_pdfjs_require__(56);
  43727. var _helvetica_factors = __w_pdfjs_require__(57);
  43728. var _liberationsans_widths = __w_pdfjs_require__(58);
  43729. var _myriadpro_factors = __w_pdfjs_require__(59);
  43730. var _segoeui_factors = __w_pdfjs_require__(60);
  43731. var _core_utils = __w_pdfjs_require__(9);
  43732. var _fonts_utils = __w_pdfjs_require__(38);
  43733. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  43734. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  43735. name: "LiberationSans-Regular",
  43736. factors: _myriadpro_factors.MyriadProRegularFactors,
  43737. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43738. lineHeight: _myriadpro_factors.MyriadProRegularLineHeight
  43739. };
  43740. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  43741. name: "LiberationSans-Bold",
  43742. factors: _myriadpro_factors.MyriadProBoldFactors,
  43743. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43744. lineHeight: _myriadpro_factors.MyriadProBoldLineHeight
  43745. };
  43746. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  43747. name: "LiberationSans-Italic",
  43748. factors: _myriadpro_factors.MyriadProItalicFactors,
  43749. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43750. lineHeight: _myriadpro_factors.MyriadProItalicLineHeight
  43751. };
  43752. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  43753. name: "LiberationSans-BoldItalic",
  43754. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  43755. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43756. lineHeight: _myriadpro_factors.MyriadProBoldItalicLineHeight
  43757. };
  43758. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  43759. name: "LiberationSans-Regular",
  43760. baseWidths: _liberationsans_widths.LiberationSansRegularWidths
  43761. };
  43762. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  43763. name: "LiberationSans-Bold",
  43764. baseWidths: _liberationsans_widths.LiberationSansBoldWidths
  43765. };
  43766. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  43767. name: "LiberationSans-Italic",
  43768. baseWidths: _liberationsans_widths.LiberationSansItalicWidths
  43769. };
  43770. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  43771. name: "LiberationSans-BoldItalic",
  43772. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths
  43773. };
  43774. t["Calibri-Regular"] = {
  43775. name: "LiberationSans-Regular",
  43776. factors: _calibri_factors.CalibriRegularFactors,
  43777. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43778. lineHeight: _calibri_factors.CalibriRegularLineHeight
  43779. };
  43780. t["Calibri-Bold"] = {
  43781. name: "LiberationSans-Bold",
  43782. factors: _calibri_factors.CalibriBoldFactors,
  43783. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43784. lineHeight: _calibri_factors.CalibriBoldLineHeight
  43785. };
  43786. t["Calibri-Italic"] = {
  43787. name: "LiberationSans-Italic",
  43788. factors: _calibri_factors.CalibriItalicFactors,
  43789. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43790. lineHeight: _calibri_factors.CalibriItalicLineHeight
  43791. };
  43792. t["Calibri-BoldItalic"] = {
  43793. name: "LiberationSans-BoldItalic",
  43794. factors: _calibri_factors.CalibriBoldItalicFactors,
  43795. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43796. lineHeight: _calibri_factors.CalibriBoldItalicLineHeight
  43797. };
  43798. t["Segoeui-Regular"] = {
  43799. name: "LiberationSans-Regular",
  43800. factors: _segoeui_factors.SegoeuiRegularFactors,
  43801. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43802. lineHeight: _segoeui_factors.SegoeuiRegularLineHeight
  43803. };
  43804. t["Segoeui-Bold"] = {
  43805. name: "LiberationSans-Bold",
  43806. factors: _segoeui_factors.SegoeuiBoldFactors,
  43807. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43808. lineHeight: _segoeui_factors.SegoeuiBoldLineHeight
  43809. };
  43810. t["Segoeui-Italic"] = {
  43811. name: "LiberationSans-Italic",
  43812. factors: _segoeui_factors.SegoeuiItalicFactors,
  43813. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43814. lineHeight: _segoeui_factors.SegoeuiItalicLineHeight
  43815. };
  43816. t["Segoeui-BoldItalic"] = {
  43817. name: "LiberationSans-BoldItalic",
  43818. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  43819. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43820. lineHeight: _segoeui_factors.SegoeuiBoldItalicLineHeight
  43821. };
  43822. t["Helvetica-Regular"] = t.Helvetica = {
  43823. name: "LiberationSans-Regular",
  43824. factors: _helvetica_factors.HelveticaRegularFactors,
  43825. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43826. lineHeight: _helvetica_factors.HelveticaRegularLineHeight
  43827. };
  43828. t["Helvetica-Bold"] = {
  43829. name: "LiberationSans-Bold",
  43830. factors: _helvetica_factors.HelveticaBoldFactors,
  43831. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43832. lineHeight: _helvetica_factors.HelveticaBoldLineHeight
  43833. };
  43834. t["Helvetica-Italic"] = {
  43835. name: "LiberationSans-Italic",
  43836. factors: _helvetica_factors.HelveticaItalicFactors,
  43837. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43838. lineHeight: _helvetica_factors.HelveticaItalicLineHeight
  43839. };
  43840. t["Helvetica-BoldItalic"] = {
  43841. name: "LiberationSans-BoldItalic",
  43842. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  43843. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43844. lineHeight: _helvetica_factors.HelveticaBoldItalicLineHeight
  43845. };
  43846. });
  43847. function getXfaFontName(name) {
  43848. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  43849. const fontMap = getXFAFontMap();
  43850. return fontMap[fontName];
  43851. }
  43852. function getXfaFontWidths(name) {
  43853. const info = getXfaFontName(name);
  43854. if (!info) {
  43855. return null;
  43856. }
  43857. const {
  43858. baseWidths,
  43859. factors
  43860. } = info;
  43861. if (!factors) {
  43862. return baseWidths;
  43863. }
  43864. return baseWidths.map((w, i) => w * factors[i]);
  43865. }
  43866. /***/ }),
  43867. /* 56 */
  43868. /***/ ((__unused_webpack_module, exports) => {
  43869. Object.defineProperty(exports, "__esModule", ({
  43870. value: true
  43871. }));
  43872. exports.CalibriRegularLineHeight = exports.CalibriRegularFactors = exports.CalibriItalicLineHeight = exports.CalibriItalicFactors = exports.CalibriBoldLineHeight = exports.CalibriBoldItalicLineHeight = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  43873. const CalibriBoldFactors = [1.3877, 1, 0.83908, 0.77539, 0.77539, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.7762, 0.7762, 0.73293, 0.73293, 0.73293, 0.73293, 0.73293, 0.73293, 0.82577, 0.87289, 0.87289, 0.88506, 0.80367, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.88656, 0.73133, 0.73133, 0.57184, 0.87356, 0.6965, 0.88506, 0.91133, 0.7514, 0.81921, 0.68156, 0.81921, 0.81921, 1, 0.81921, 0.87356, 1, 0.99862, 0.99862, 1, 0.91075, 0.87356, 0.95958, 0.76229, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.56289, 0.95958, 0.59526, 0.59526, 0.75727, 0.75727, 1, 0.69225, 0.69225, 0.89019, 0.70424, 1, 0.91926, 0.70823, 1.04924, 1.04924, 0.9121, 0.9121, 0.9121, 1, 0.9121, 0.9121, 0.86943, 0.87402, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.84896, 0.81235, 0.86943, 0.82001, 0.87508, 0.87508, 0.86943, 0.79795, 0.9762, 0.87356, 0.99819, 0.88198, 0.77958, 0.77958, 0.77958, 1, 0.79795, 0.70864, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.70864, 0.70864, 0.70864, 0.70864, 1, 0.78275, 0.81055, 0.81055, 0.81055, 0.81055, 1, 0.86943, 0.79795, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.77892, 0.56029, 0.90399, 0.90399, 0.88653, 0.96017, 0.96017, 0.96017, 0.96017, 0.96017, 0.82577, 0.7648, 0.77892, 0.77892, 0.77892, 0.77892, 0.77892, 0.78257, 0.78257, 0.78257, 0.78257, 0.78257, 0.88762, 0.88762, 0.88762, 0.88762, 0.90323, 1, 0.88762, 0.8715, 0.8715, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.88762, 0.96108, 0.96108, 0.88762, 0.97566, 0.80352, 0.88762, 0.90747, 0.88762, 0.88762, 1.31006, 1.81055, 0.90527, 0.90527, 1.81055, 1.53711, 0.94434, 0.85284, 0.85284, 1.2798, 0.92138, 0.88762, 0.8785, 1.54657, 1.69808, 0.8936, 1, 0.88331, 0.88331, 0.97507, 0.97507, 1.15543, 1, 1.7801, 1.42259, 0.75241, 0.75241, 1.20528, 1, 1, 0.75241, 0.75241, 0.75241, 0.75241, 0.91056, 0.89552, 0.78287, 0.91027, 1.20528, 1, 1, 0.82845, 0.92794, 1, 1, 1.13254, 0.89552, 1, 0.8785, 0.89552, 0.89552, 0.83016, 0.93125, 0.85592, 0.87842, 1, 1.24487, 1, 1.06303, 0.90747, 1, 1, 0.91133, 0.70674, 0.88401, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.91133, 1, 0.71143, 0.90518, 0.90527, 0.89552, 0.8785, 0.90518, 0.96399, 1.01407, 0.85284, 0.85356, 1.23108, 0.89049, 0.89049, 0.8785, 0.97801, 0.97171, 0.97801, 0.95015, 1, 1, 1, 0.91133, 0.88525, 1, 0.56892, 0.91133, 1, 0.83406, 0.77618, 0.84021, 0.77618, 0.77618, 1, 0.77618, 0.90807, 0.90176, 1, 0.85284, 0.90747, 0.96839, 0.96839, 1.03372, 1.03372, 0.8785, 0.89608, 0.8785, 1, 1.44947, 1.45894, 1, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.90167, 0.88401, 1.17534, 1.37077, 0.8941, 0.8941, 0.9716, 1, 1, 1, 0.88401, 1.02988, 1.02988, 1.02988, 1.02988, 0.88401, 0.91916, 0.91916, 0.86304, 0.86077, 1, 0.86304, 0.88401, 0.88401, 0.87445, 0.79468, 1, 0.88175, 0.85284, 0.90747, 1, 0.91133, 0.85284, 0.9297, 1.08004, 0.94903, 1, 0.91488, 0.70645, 1, 1, 0.85284, 1, 0.92099, 0.85284, 1, 1, 0.8785, 0.8785, 0.87802, 0.8785, 1, 0.91133, 1, 0.90747, 0.8785, 0.84723, 0.89552, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.89291, 0.94721, 0.8801, 0.8801, 0.8801, 0.84971, 0.84971, 0.8801, 0.8801, 0.91133, 0.83489, 0.82845, 0.78864, 0.99862, 1.12401, 1.19118, 0.69825, 0.89049, 0.89049, 0.8801, 0.8785, 1.07463, 0.93548, 0.93548, 1.08696, 0.81988, 0.96134, 1.06152, 0.84107, 0.97747, 0.75638, 0.85284, 0.90747, 0.95018, 0.97926, 0.8785, 0.75859, 0.75859, 0.92482, 0.87012, 0.87012, 0.87012, 0.92794, 0.92794, 0.92794, 0.92794, 0.98152, 0.91343, 0.91343, 0.90747, 0.91343, 1, 0.68787, 0.85284, 0.85714, 0.98387, 1, 0.7173, 0.7173, 0.7173, 0.7173, 0.7173, 1, 1, 0.89552, 0.91133, 0.81499, 1, 1, 0.79586, 0.78216, 0.91133, 1.54657, 1, 1, 0.91133, 0.77192, 1, 1.04106, 0.87965, 1.06452, 0.75841, 1, 1.00813, 0.8785, 0.91133, 0.88525, 0.84133, 1.33431, 1, 0.95161, 0.72021, 1, 1, 1, 1, 0.91133, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.89552, 0.90363, 1, 1, 1.01466, 1.0088, 1, 0.75806, 0.81055, 1.04106, 1, 0.82845, 0.73133, 0.90264, 0.90518, 0.90548, 1, 1, 1.4956, 0.93835, 1, 1, 2.2807, 1, 1, 1, 0.90727, 0.90727, 0.8785, 1, 0.94211, 0.94211, 0.94211, 0.94211, 0.8785, 0.8785, 0.85075, 0.95794, 0.95794, 0.95794, 0.95794, 0.95794, 0.82616, 0.86513, 0.85162, 0.85162, 0.85162, 0.85162, 0.91133, 0.85162, 0.79492, 0.79492, 0.79492, 0.79492, 0.91133, 0.79109];
  43874. exports.CalibriBoldFactors = CalibriBoldFactors;
  43875. const CalibriBoldLineHeight = 1.2207;
  43876. exports.CalibriBoldLineHeight = CalibriBoldLineHeight;
  43877. const CalibriBoldItalicFactors = [1.3877, 1, 0.83908, 0.77539, 0.77539, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.7762, 0.7762, 0.71805, 0.71805, 0.71805, 0.71805, 0.71805, 0.71805, 0.82577, 0.87289, 0.87289, 0.88506, 0.86036, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.88116, 0.73133, 0.73133, 0.57118, 0.87356, 0.6965, 0.88506, 0.91133, 0.7514, 0.81921, 0.67174, 0.81921, 0.81921, 1, 0.81921, 0.87356, 1, 0.99862, 0.99862, 1, 0.91075, 0.87356, 0.95958, 0.76467, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.56347, 0.95958, 0.59526, 0.59526, 0.75727, 0.75727, 1, 0.69225, 0.69225, 0.89019, 0.70424, 1, 0.91926, 0.70823, 1.04924, 1.04924, 0.90872, 0.90872, 0.90872, 1, 0.90872, 0.90872, 0.85938, 0.87402, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.87179, 0.80346, 0.85938, 0.79179, 0.87068, 0.87068, 0.85938, 0.79795, 0.97447, 0.87891, 0.97466, 0.87068, 0.77958, 0.77958, 0.77958, 1, 0.79795, 0.69766, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.69766, 0.69766, 0.69766, 0.69766, 1, 0.7957, 0.81055, 0.81055, 0.81055, 0.81055, 1, 0.86441, 0.79795, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.77892, 0.55853, 0.90399, 0.90399, 0.88653, 0.96068, 0.96068, 0.96068, 0.96068, 0.96068, 0.82577, 0.74889, 0.77892, 0.77892, 0.77892, 0.77892, 0.77892, 0.78257, 0.78257, 0.78257, 0.78257, 0.78257, 0.94908, 0.94908, 0.94908, 0.94908, 0.90323, 1, 0.94908, 0.85887, 0.85887, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.94908, 0.94252, 0.94252, 0.94908, 0.97566, 0.80352, 0.94908, 0.90747, 0.94908, 0.94908, 1.3107, 1.81055, 0.90616, 0.90527, 1.81055, 1.53711, 0.94434, 0.85284, 0.85284, 1.2798, 0.92138, 0.94908, 0.86411, 1.529, 1.69808, 0.87411, 1, 0.88331, 0.88331, 0.97507, 0.97507, 1.15543, 1, 1.7801, 1.42259, 0.74012, 0.74012, 1.20528, 1, 1, 0.74012, 0.74012, 0.74012, 0.74012, 0.91056, 0.89552, 0.78022, 0.91027, 1.20528, 1, 1, 0.82845, 0.92794, 1, 1, 1.13254, 0.89552, 1, 0.86411, 0.89552, 0.89552, 0.79538, 0.92726, 0.85592, 0.8728, 1, 1.24487, 1, 1.48387, 0.90747, 1, 1, 0.91133, 0.70088, 0.88401, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.91133, 1, 0.71094, 0.88323, 0.90527, 0.89552, 0.86331, 0.88323, 0.95612, 0.95612, 0.85284, 0.85356, 1.23108, 0.8753, 0.8753, 0.8785, 0.97801, 0.97171, 0.97801, 0.95015, 1, 1, 1, 0.91133, 0.88525, 1, 0.56892, 0.91133, 1, 0.83406, 0.86411, 0.84021, 0.86411, 0.86411, 1, 0.86411, 0.90807, 0.90176, 1, 0.85284, 0.90747, 0.96839, 0.96839, 1.03372, 1.03372, 0.86331, 0.8777, 0.86331, 1, 1.44947, 1.45894, 1, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.90167, 0.88401, 1.17534, 1.37077, 0.8941, 0.8941, 0.9716, 1, 1, 1, 0.88401, 1.02988, 1.02988, 1.02988, 1.02988, 0.88401, 0.91916, 0.91916, 0.86304, 0.84814, 1, 0.86304, 0.88401, 0.88401, 0.87445, 0.77312, 1, 0.88175, 0.85284, 0.90747, 1, 0.91133, 0.85284, 0.9297, 1.08004, 0.94903, 1, 0.9039, 0.70645, 1, 1, 0.85284, 1, 0.91822, 0.85284, 1, 1, 0.86331, 0.86331, 0.86906, 0.86331, 1, 0.91133, 1, 0.90747, 0.86331, 0.84723, 0.89552, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86549, 0.94721, 0.86331, 0.86331, 0.86331, 0.86015, 0.86015, 0.86331, 0.86331, 0.91133, 0.83489, 0.82845, 0.78864, 0.99862, 1.19129, 1.19118, 0.69825, 0.89049, 0.89049, 0.86331, 0.86411, 1.07463, 0.93548, 0.93548, 1.08696, 0.81988, 0.96134, 1.06152, 0.83326, 0.99375, 0.81344, 0.85284, 0.90747, 0.95018, 0.95452, 0.86411, 0.75859, 0.75859, 0.92482, 0.87012, 0.87012, 0.87012, 0.92794, 0.89807, 0.92794, 0.92794, 0.98152, 0.90464, 0.90464, 0.90747, 0.90464, 1, 0.68787, 0.85284, 0.87581, 0.98387, 1, 0.70852, 0.70852, 0.70852, 0.70852, 0.70852, 1, 1, 0.89552, 0.91133, 0.81499, 1, 1, 0.82046, 0.76422, 0.91133, 1.56239, 1, 1, 0.91133, 0.77192, 1, 1.04106, 0.96057, 1.06452, 0.75841, 1, 1.02189, 0.86411, 0.91133, 0.88525, 0.84133, 1.33431, 1, 0.95161, 0.72021, 1, 1, 1, 1, 0.91133, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.89552, 0.90363, 1, 1, 1.01466, 1.0088, 1, 0.75806, 0.81055, 1.04106, 1, 0.82845, 0.73133, 0.90631, 0.88323, 0.85174, 1, 1, 1.4956, 0.92972, 1, 1, 2.2807, 1, 1, 1, 0.90727, 0.90727, 0.86331, 1, 0.92733, 0.92733, 0.92733, 0.92733, 0.86331, 0.86331, 0.84372, 0.95794, 0.95794, 0.95794, 0.95794, 0.95794, 0.82616, 0.85668, 0.84548, 0.84548, 0.84548, 0.84548, 0.91133, 0.84548, 0.79492, 0.79492, 0.79492, 0.79492, 0.91133, 0.74081];
  43878. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  43879. const CalibriBoldItalicLineHeight = 1.2207;
  43880. exports.CalibriBoldItalicLineHeight = CalibriBoldItalicLineHeight;
  43881. const CalibriItalicFactors = [1.3877, 1, 0.8675, 0.76318, 0.76318, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.81552, 0.81552, 0.72346, 0.72346, 0.72346, 0.72346, 0.72346, 0.72346, 0.77818, 0.85193, 0.85193, 0.86477, 0.84134, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.86698, 0.73206, 0.73206, 0.6192, 0.86275, 0.7363, 0.86477, 0.91133, 0.7522, 0.81105, 0.7286, 0.81105, 0.81105, 1, 0.81105, 0.86275, 1, 0.99862, 0.99862, 1, 0.90872, 0.86275, 0.90685, 0.77896, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.64824, 0.90685, 0.6377, 0.6377, 0.77892, 0.77892, 1, 0.75593, 0.75593, 0.85871, 0.76032, 1, 0.98156, 0.77261, 1.02638, 1.02638, 0.89249, 0.89249, 0.89249, 1, 0.89249, 0.89249, 0.84118, 0.8667, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.87291, 0.85696, 0.84118, 0.82411, 0.84557, 0.84557, 0.84118, 0.77452, 0.90782, 0.85984, 0.903, 0.85374, 0.75186, 0.75186, 0.75186, 1, 0.77452, 0.67789, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.67789, 0.67789, 0.67789, 0.67789, 1, 0.76466, 0.79776, 0.79776, 0.79776, 0.79776, 1, 0.84369, 0.77452, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.7306, 0.56321, 0.88844, 0.88844, 0.85066, 0.94309, 0.94309, 0.94309, 0.94309, 0.94309, 0.77818, 0.75828, 0.7306, 0.7306, 0.7306, 0.7306, 0.7306, 0.76659, 0.76659, 0.76659, 0.76659, 0.76659, 0.9245, 0.9245, 0.9245, 0.9245, 0.87683, 1, 0.9245, 0.84843, 0.84843, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.9245, 0.99058, 0.99058, 0.9245, 1.02269, 0.90861, 0.9245, 0.90747, 0.9245, 0.9245, 1.28809, 1.81055, 0.90572, 0.90749, 1.81055, 1.55469, 0.94434, 1.06139, 0.85284, 1.2798, 0.88071, 0.9245, 0.9245, 1.38313, 1.77256, 0.92393, 1, 0.94152, 0.94152, 1.10369, 1.10369, 1.1437, 1, 1.91729, 1.42259, 0.83203, 0.83203, 1.18622, 1, 1, 0.83203, 0.83203, 0.83203, 0.83203, 0.92229, 0.89552, 0.78086, 0.91027, 1.18622, 1, 1, 0.96309, 0.89807, 1, 1, 1.13254, 0.89552, 1, 0.9245, 0.89552, 0.89552, 0.8875, 0.99034, 0.84737, 0.942, 1, 1.17889, 1, 1.48387, 0.90747, 1, 1, 0.91133, 0.67009, 0.82601, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.91133, 1, 0.68994, 0.85865, 0.90527, 0.89552, 0.9245, 0.85865, 1.03667, 1.03667, 0.85284, 0.85284, 1.23108, 0.94635, 0.94635, 0.94469, 1.17223, 1.11523, 0.97801, 1.09842, 1, 1, 1, 0.91133, 0.84426, 1, 0.54873, 0.91133, 1, 0.82616, 0.9245, 0.8916, 0.9245, 0.9245, 1, 0.9245, 0.86331, 0.8739, 1, 0.85284, 0.90747, 0.92098, 0.92098, 1.0176, 1.0176, 0.9245, 0.93591, 0.9245, 1, 1.44947, 1.40909, 1, 1.03297, 0.82601, 0.82601, 0.82601, 0.82601, 0.82601, 1.05611, 0.82601, 1.19658, 1.33512, 0.8941, 0.8941, 0.97622, 1, 1, 1, 1.03297, 1.23516, 1.23516, 1.23516, 1.23516, 0.82601, 1.07692, 1.07692, 0.90918, 0.90918, 1, 0.90918, 1.03297, 1.03297, 0.94048, 0.9375, 1, 0.93407, 0.85284, 0.90747, 1, 0.91133, 0.85284, 1.09231, 1.0336, 1.11429, 1, 0.94959, 0.71353, 1, 1, 0.85284, 1, 0.98217, 0.85284, 1, 1, 0.9245, 0.9245, 0.92534, 0.9245, 1, 0.91133, 1, 0.90747, 0.9245, 0.89746, 0.89552, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.86291, 0.93695, 0.92274, 0.92274, 0.92274, 0.89404, 0.89404, 0.92274, 0.92274, 0.91133, 0.79801, 0.80504, 0.76288, 0.99862, 1.16359, 1.15642, 0.69825, 0.86651, 0.86651, 0.92274, 0.9245, 1.09091, 0.91056, 0.91056, 1.07806, 0.80395, 0.90861, 1.03809, 0.83437, 1.00225, 0.82507, 0.85284, 0.90747, 0.97094, 0.97248, 0.9245, 0.83319, 0.75859, 1.1293, 1.2566, 1.2566, 1.2566, 1.12308, 1.12308, 1.12308, 1.12308, 1.15601, 1.02933, 1.02933, 0.90747, 1.02933, 1, 0.68787, 0.85284, 0.88832, 0.96334, 1, 0.77832, 0.77832, 0.77832, 0.77832, 0.77832, 1, 1, 0.89552, 0.91133, 0.774, 1, 1, 0.88178, 0.84438, 0.91133, 1.39543, 1, 1, 0.91133, 0.7589, 1, 1.20562, 1.03525, 1.23023, 0.97655, 1, 1.0297, 0.9245, 0.91133, 0.84426, 0.80972, 1.35191, 1, 0.95161, 0.70508, 1, 1, 1, 1, 0.91133, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.89552, 0.90186, 1, 1, 1.0088, 1.0044, 1, 0.739, 0.79776, 1.20562, 1, 0.96309, 0.73206, 0.89693, 0.85865, 0.90933, 1, 1, 1.4956, 0.97858, 1, 1, 2.01462, 1, 1, 1, 1.05859, 1.05859, 0.9245, 1, 0.9849, 0.9849, 0.9849, 0.9849, 0.9245, 0.9245, 0.8916, 0.98986, 0.98986, 0.98986, 0.98986, 0.98986, 0.86621, 0.84153, 0.89453, 0.89453, 0.89453, 0.89453, 0.91133, 0.89453, 0.79004, 0.79004, 0.79004, 0.79004, 0.91133, 0.75026];
  43882. exports.CalibriItalicFactors = CalibriItalicFactors;
  43883. const CalibriItalicLineHeight = 1.2207;
  43884. exports.CalibriItalicLineHeight = CalibriItalicLineHeight;
  43885. const CalibriRegularFactors = [1.3877, 1, 0.8675, 0.76318, 0.76318, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.86686, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.81552, 0.81552, 0.73834, 0.73834, 0.73834, 0.73834, 0.73834, 0.73834, 0.77818, 0.85193, 0.85193, 0.86477, 0.84503, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.86901, 0.73206, 0.73206, 0.62267, 0.86275, 0.74359, 0.86477, 0.91133, 0.7522, 0.81105, 0.75443, 0.81105, 0.81105, 1, 0.81105, 0.86275, 1, 0.99862, 0.99862, 1, 0.90872, 0.86275, 0.90685, 0.77741, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.65649, 0.90685, 0.6377, 0.6377, 0.77892, 0.77892, 1, 0.75593, 0.75593, 0.85746, 0.76032, 1, 0.98156, 0.77261, 1.02638, 1.02638, 0.89385, 0.89385, 0.89385, 1, 0.89385, 0.89385, 0.85122, 0.8667, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.88831, 0.88254, 0.85122, 0.85498, 0.85311, 0.85311, 0.85122, 0.77452, 0.95165, 0.86275, 0.89772, 0.86503, 0.75186, 0.75186, 0.75186, 1, 0.77452, 0.68887, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.68887, 0.68887, 0.68887, 0.68887, 1, 0.74171, 0.79776, 0.79776, 0.79776, 0.79776, 1, 0.85122, 0.77452, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.7306, 0.56963, 0.88844, 0.88844, 0.85066, 0.94258, 0.94258, 0.94258, 0.94258, 0.94258, 0.77818, 0.75657, 0.7306, 0.7306, 0.7306, 0.7306, 0.7306, 0.76659, 0.76659, 0.76659, 0.76659, 0.76659, 0.86128, 0.86128, 0.86128, 0.86128, 0.87683, 0.86128, 0.8693, 0.8693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.86128, 0.98142, 0.98142, 0.86128, 1.02269, 0.90861, 0.86128, 0.90747, 0.86128, 0.86128, 1.28809, 1.81055, 0.90527, 0.90527, 1.81055, 1.55469, 0.94434, 1.06139, 0.85284, 1.2798, 0.88071, 0.86128, 0.94469, 1.39016, 1.77256, 0.9236, 1, 0.94152, 0.94152, 1.10369, 1.10369, 1.1437, 1.91729, 1.42259, 0.8457, 0.8457, 1.18622, 0.8457, 0.8457, 0.8457, 0.8457, 0.92229, 0.89552, 0.81209, 0.91027, 1.18622, 1, 0.96309, 0.89807, 1.13254, 0.89552, 0.94469, 0.89552, 0.89552, 0.92454, 0.9921, 0.84737, 0.94035, 1, 1.17889, 1.48387, 0.90747, 1, 1, 0.91133, 0.67742, 0.82601, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.91133, 0.69043, 0.89464, 0.90527, 0.89552, 0.94469, 0.89464, 1.02191, 1.02191, 0.85284, 0.85356, 1.23108, 0.96576, 0.96576, 0.94469, 1.17223, 1.11523, 0.97801, 1.09842, 1, 1, 1, 0.91133, 0.84426, 0.54873, 0.91133, 0.82616, 0.84636, 0.89258, 0.84636, 0.84636, 1, 0.84636, 0.86331, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.8739, 0.85284, 0.90747, 0.92098, 0.92098, 1.0176, 1.0176, 0.94469, 0.95786, 0.94469, 1, 1.44947, 1.40909, 1.03297, 0.82601, 0.82601, 0.82601, 0.82601, 0.82601, 1.05611, 0.82601, 1.19658, 1.33512, 0.8941, 0.8941, 0.97622, 1, 1, 1, 1.03297, 1.23516, 1.23516, 1.23516, 1.23516, 0.82601, 1.07692, 1.07692, 0.90918, 0.90918, 1, 0.90918, 1.03297, 1.03297, 0.92578, 0.90452, 1, 1.11842, 0.85284, 0.90747, 1, 0.91133, 0.85284, 1.09231, 1.0336, 1.11429, 1, 0.95897, 0.71353, 1, 1, 0.85284, 1, 0.95424, 0.85284, 1, 1, 0.94469, 0.94469, 0.95877, 0.94469, 1, 0.91133, 1, 0.90747, 0.94469, 0.89746, 0.89552, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90016, 0.93695, 0.9482, 0.9482, 0.9482, 0.89181, 0.89181, 0.9482, 0.9482, 0.91133, 0.79801, 0.80504, 0.76288, 0.99862, 1.08707, 1.15642, 0.69825, 0.86651, 0.86651, 0.9482, 0.94469, 1.09091, 0.91056, 0.91056, 1.07806, 0.80395, 0.90861, 1.03809, 0.84286, 1.00452, 0.80113, 0.85284, 0.90747, 0.97094, 0.99247, 0.94469, 0.83319, 0.75859, 1.1293, 1.2566, 1.2566, 1.2566, 1.12308, 1.12308, 1.12308, 1.12308, 1.15601, 1.04692, 1.04692, 0.90747, 1.04692, 1, 0.68787, 0.85284, 0.89442, 0.96334, 1, 0.78223, 0.78223, 0.78223, 0.78223, 0.78223, 1, 1, 0.89552, 0.91133, 0.774, 1, 0.86155, 0.85208, 0.91133, 1.39016, 1, 1, 0.91133, 0.7589, 1, 1.20562, 0.98022, 1.23023, 0.92188, 1, 0.9561, 0.94469, 0.91133, 0.84426, 0.80972, 1.35191, 0.95161, 0.70508, 1, 1, 1, 1, 0.91133, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.89552, 0.90186, 1, 1, 1.0088, 1.0044, 1, 0.739, 0.79776, 1.20562, 1, 0.96309, 0.73206, 0.88844, 0.89464, 0.96766, 1, 1, 1.4956, 1.07185, 0.99413, 0.96334, 1.08065, 0.99331, 1, 1, 2.01462, 1, 1, 1, 1, 1.05859, 1.05859, 0.94469, 1, 0.99018, 0.99018, 0.99018, 0.99018, 0.94469, 0.94469, 0.90332, 0.98986, 0.98986, 0.98986, 0.98986, 0.98986, 0.86621, 0.83969, 0.90527, 0.90527, 0.90527, 0.90527, 0.91133, 0.90527, 0.79004, 0.79004, 0.79004, 0.79004, 0.91133, 0.78848];
  43886. exports.CalibriRegularFactors = CalibriRegularFactors;
  43887. const CalibriRegularLineHeight = 1.2207;
  43888. exports.CalibriRegularLineHeight = CalibriRegularLineHeight;
  43889. /***/ }),
  43890. /* 57 */
  43891. /***/ ((__unused_webpack_module, exports) => {
  43892. Object.defineProperty(exports, "__esModule", ({
  43893. value: true
  43894. }));
  43895. exports.HelveticaRegularLineHeight = exports.HelveticaRegularFactors = exports.HelveticaItalicLineHeight = exports.HelveticaItalicFactors = exports.HelveticaBoldLineHeight = exports.HelveticaBoldItalicLineHeight = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  43896. const HelveticaBoldFactors = [0.76116, 1, 0.99977, 1, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.85148, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 0.99997, 0.99977, 1.00026, 0.99977, 0.99973, 1.00026, 1.00022, 0.99988, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 1.00042, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00078, 1.0006, 0.99973, 0.99973, 0.99977, 0.99977, 0.99977, 1.00026, 1.00026, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 1.00013, 1.00022, 1.00036, 1.00022, 1.00022, 1.00022, 1.00001, 1.00024, 0.99977, 0.9999, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99984, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99973, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 1.00069, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 0.99982, 0.99982, 1, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00008, 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, 1.00038, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99989, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 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, 1.0005, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 0.99973, 1.00035, 1, 0.99999, 1, 0.99971, 1.00047, 1.00023, 0.99973, 1.00041, 1.00041, 0.99973, 0.99977, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1, 1, 1, 1, 1, 1, 1, 1.00003, 1.00003, 0.99959, 0.9999, 0.99973, 1.00026, 1.0006, 1.00077, 0.99942, 1.41144, 0.99959, 0.99959, 0.99998, 0.99998, 0.99998, 1, 1.00077, 0.99972, 0.99973, 0.99973, 0.99998, 1, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 0.99973, 1.00055, 0.99999, 0.99998, 1, 0.99962, 0.99998, 1.0006, 1, 1, 1.00025, 0.99973, 1, 1.00026, 0.99973, 0.99973, 1.03374, 1.00026, 1.00024, 0.99927, 0.9995, 0.99998, 1, 1.00034, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 1, 0.99973, 1.00026, 0.99973, 1.00082, 0.99962, 1.00003, 0.99915, 0.99984, 1.00026, 1.00026, 1.00026, 0.99998, 0.99999, 0.99998, 0.99998, 1, 0.99999, 1, 0.99973, 1.00002, 0.99998, 0.99973, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99998, 1, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 1.00026, 1.00026, 1.00026, 1.00042, 0.99999, 0.99998, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 0.99561, 0.99999, 0.99999, 0.99977, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.00069, 0.99973, 0.99973, 1.0006, 1.0006, 0.99973, 1.03828, 1.0006, 0.99999, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 1.0006, 0.99972, 1.0006, 1.40579, 0.99982, 0.60299, 1, 1, 1.00003, 1.00106, 0.99867, 1.00003, 1, 1, 1.00026, 1.00026, 0.9993, 1.00026, 1.00026, 0.99973, 1, 1.00031, 1.00026, 0.99973, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00016, 0.99998, 1.00026, 1.00026, 1.00026, 1.00032, 1.00032, 1.00026, 1.00026, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99998, 0.99998, 0.99972, 0.99982, 1.0006, 1, 1.00023, 0.99954, 1.00049, 1.00003, 1.06409, 1.20985, 0.99945, 1.00026, 1.00026, 1.00026, 0.99974, 1, 1, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.00087, 0.99959, 0.99959, 1.00031, 0.99959, 0.99959, 1.00025, 1.00003, 1.00056, 0.99998, 1.41144, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99973, 0.99973, 1.00002, 0.99998, 1.40579, 0.99988, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 0.99998, 0.99935, 0.99998, 0.8121, 0.99998, 1.00087, 1.00026, 0.99973, 1.00002, 1.00002, 0.99998, 1, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 0.99998, 0.99998, 1, 1.00001, 0.99561, 0.99973, 1.00041, 1, 1, 0.99998, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 1.00026, 1.41144, 0.99995, 0.99995, 0.99995, 0.99995, 1.00026, 1.00026, 0.99973, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 0.99973, 0.9993, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 1, 1, 1, 0.99973, 0.99902];
  43897. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  43898. const HelveticaBoldLineHeight = 1.2;
  43899. exports.HelveticaBoldLineHeight = HelveticaBoldLineHeight;
  43900. const HelveticaBoldItalicFactors = [0.76116, 1, 0.99977, 1, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.91155, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 1, 0.99977, 1.00026, 0.99977, 0.99973, 1.00026, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 0.99971, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99969, 1.0006, 0.99973, 0.99973, 0.99977, 0.99977, 0.99977, 1.00026, 1.00026, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 0.9998, 1.00022, 0.99972, 1.00022, 1.00022, 1.00022, 1.00001, 0.99968, 1.00032, 1.00047, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99944, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99981, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 0.99966, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 0.99982, 0.99982, 1, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 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.99966, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99964, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 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, 1.00044, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.99973, 0.99967, 1, 1.00026, 1, 0.99971, 0.99978, 1, 0.99973, 0.99981, 0.99981, 0.99973, 0.99977, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1.00049, 1, 1.00098, 1, 1, 1, 1, 1.00003, 1.00003, 0.99959, 0.9999, 0.99973, 1.00026, 1.0006, 1.00077, 1.00064, 1.41144, 0.99959, 0.99959, 0.99998, 0.99998, 0.99998, 1, 1.00077, 0.99972, 0.99973, 0.99973, 0.99998, 1, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 0.99973, 1.00063, 0.99999, 0.99998, 1, 0.99962, 0.99998, 1.0006, 1, 1, 1.00025, 0.99973, 1, 1.00026, 0.99973, 0.99973, 1.0044, 1.00026, 1.00024, 0.99942, 0.9995, 0.99998, 1, 0.99998, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 1, 0.99973, 1.00026, 0.99973, 1.00101, 1.00101, 1.00003, 0.99915, 0.99984, 1.00026, 1.00026, 1.00026, 0.99998, 0.99999, 0.99998, 0.99998, 1, 0.99999, 1, 0.99973, 1.00002, 0.99998, 0.99973, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99998, 1, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 1.00026, 1.00026, 1.00026, 1.00042, 0.99999, 0.99998, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 0.99561, 0.99999, 0.99999, 0.99977, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.00014, 0.99973, 0.99973, 1.0006, 1.0006, 0.99973, 1.01011, 1.0006, 0.99999, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 1.0006, 0.99972, 1.0006, 1.40579, 0.99982, 0.60299, 1, 1, 1.00003, 1.00106, 1.01322, 1.00003, 1, 1, 1.00026, 1.00026, 0.9993, 1.00026, 1.00026, 0.99973, 1, 1.00031, 1.00026, 0.99973, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00016, 0.99998, 1.00026, 1.00026, 1.00026, 0.99943, 0.99943, 1.00026, 1.00026, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99998, 0.99998, 0.99972, 0.99982, 1.0006, 1, 1, 1.00055, 1.00012, 1.00003, 1.06409, 1.20985, 1.00007, 1.00026, 1.00026, 1.00026, 0.99974, 1, 1, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.00087, 0.99959, 0.99959, 1.00031, 0.99959, 0.99959, 1.00025, 1.00003, 0.99923, 0.99998, 1.41144, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99973, 0.99973, 1.00002, 0.99998, 1.40579, 1.00064, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 0.99998, 1.00076, 0.99998, 0.8121, 0.99998, 1.00069, 1.00026, 0.99973, 1.00002, 1.00002, 0.99998, 1, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 0.99998, 0.99998, 1, 1.00001, 0.99967, 0.99973, 0.98685, 1, 1, 0.99998, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 1.00026, 1.41144, 0.99948, 0.99948, 0.99948, 0.99948, 1.00026, 1.00026, 0.99973, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 0.99973, 1.00065, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 1, 1, 1, 0.99973, 1.00061];
  43901. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  43902. const HelveticaBoldItalicLineHeight = 1.35;
  43903. exports.HelveticaBoldItalicLineHeight = HelveticaBoldItalicLineHeight;
  43904. const HelveticaItalicFactors = [0.76116, 1, 1.00001, 1, 1, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.91221, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 1.00054, 0.99977, 0.99977, 0.99977, 0.99973, 1.00026, 1.00022, 0.99945, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 0.99946, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00084, 1.0006, 1, 1, 1.00001, 1.00001, 1.00001, 0.99973, 0.99973, 1.00001, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 1.00013, 1.00022, 1.00007, 1.00022, 1.00022, 1.00022, 1.00001, 1.0001, 1.00054, 1.00052, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00065, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99973, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 0.99933, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 0.99982, 0.99982, 1, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 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.99962, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99975, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 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.99895, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 1, 1.00051, 1, 0.99973, 1, 1.00423, 0.99925, 0.99999, 0.99973, 0.99945, 0.99945, 0.99973, 1.00001, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1, 1, 1.00049, 1.00245, 1, 1, 1, 0.99949, 1.00003, 0.99959, 0.99987, 0.99973, 0.99973, 1.0006, 1.0009, 0.99949, 1.41144, 1.00005, 1.00005, 1.0006, 1.0006, 0.99998, 1, 1.0009, 0.99972, 1, 1, 0.99998, 1, 1, 1, 1, 1, 1, 0.99998, 0.99973, 1.00019, 0.99999, 0.99998, 1, 0.99962, 1.0006, 1.0006, 1, 1, 1.00025, 0.99973, 1, 0.99973, 0.99973, 0.99973, 1.0288, 0.99973, 1.00024, 1.0006, 0.9995, 0.99998, 1, 0.99998, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99897, 0.99897, 1.00003, 1.00003, 0.99984, 0.99968, 0.99968, 0.99973, 1.0006, 1, 0.99998, 1.0006, 1, 0.99999, 1, 0.99973, 1.00002, 0.99998, 0.99973, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.00026, 0.99998, 1, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 0.99973, 0.99973, 0.99973, 1.00042, 0.99999, 0.99998, 1, 0.99924, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00034, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 1.00035, 0.99999, 0.99999, 0.99977, 0.99924, 0.99924, 0.99924, 0.99924, 0.99924, 1.0006, 0.99924, 0.99924, 1, 1, 1, 1, 0.99924, 0.99924, 0.99962, 1.06311, 0.99924, 1.00024, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 0.99924, 0.95317, 0.99924, 1.40579, 0.99999, 0.60299, 1, 1, 1.00003, 1.00267, 1.01487, 1.00003, 1, 1, 0.99973, 0.99973, 1.00041, 0.99973, 0.99973, 0.99973, 1, 1.00031, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.00016, 0.99998, 0.99973, 0.99973, 0.99973, 1.00025, 1.00025, 0.99973, 0.99973, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 0.99973, 0.99973, 0.9998, 0.99998, 0.99998, 0.96329, 0.99982, 1.0006, 1, 1.00023, 0.99947, 1.00012, 1.00003, 1.06409, 1.20985, 1.00063, 0.99973, 0.99973, 1.00026, 1.00006, 0.99998, 0.99998, 0.99998, 0.99924, 0.99924, 0.99924, 0.99924, 1.00043, 0.99998, 0.99998, 0.8254, 0.99998, 0.99998, 1.00025, 1.00003, 1.00043, 0.99998, 1.41144, 1, 1, 1, 1, 1, 1, 0.99999, 0.99973, 0.99973, 1.00002, 0.99998, 1.40579, 0.99995, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 1.0006, 0.99994, 1.0006, 0.89547, 1.0006, 0.99911, 0.99973, 0.99973, 1.00002, 1.00002, 0.99998, 1, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 1.0006, 0.99998, 1, 1.00001, 0.99954, 0.99973, 0.98332, 1, 1, 0.99998, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 0.99973, 1.41144, 1.00036, 1.00036, 1.00036, 1.00036, 0.99973, 0.99973, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 1.0005, 1, 1, 1, 1, 0.99973, 1, 1, 1, 1, 1, 0.99973, 0.99918];
  43905. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  43906. const HelveticaItalicLineHeight = 1.35;
  43907. exports.HelveticaItalicLineHeight = HelveticaItalicLineHeight;
  43908. const HelveticaRegularFactors = [0.76116, 1, 1.00001, 1, 1, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99928, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.91621, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 0.99977, 0.99977, 1.00013, 0.99977, 0.99973, 1.00026, 1.00022, 1.0004, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 1.00019, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00055, 1.0006, 1, 1, 1.00001, 1.00001, 1.00001, 0.99973, 0.99973, 1.00005, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 0.99941, 1.00022, 0.99947, 1.00022, 1.00022, 1.00022, 1.00001, 1.00019, 0.99977, 0.99946, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99945, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 1.00015, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 0.99973, 0.99982, 0.99982, 1, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99928, 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, 1.00047, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.9996, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 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.99968, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1, 1.00035, 1, 0.99955, 1, 0.99971, 0.99925, 1.00023, 0.99973, 0.99978, 0.99978, 0.99973, 1.00001, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1, 1, 1, 1, 1, 1, 1, 0.99949, 1.00003, 0.99959, 0.99987, 0.99973, 0.99973, 1.0006, 1.0009, 0.99966, 1.41144, 1.00005, 1.00005, 1.0006, 1.0006, 0.99998, 1.0009, 0.99972, 1, 1, 0.99998, 1, 1, 1, 1, 0.99998, 0.99973, 1.00019, 0.99999, 0.99998, 0.99962, 1.0006, 1.0006, 1.00025, 0.99973, 0.99973, 0.99973, 0.99973, 1.04596, 0.99973, 1.00024, 1.00065, 0.9995, 0.99998, 0.99998, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 0.99973, 0.99973, 0.99973, 1.00045, 1.00045, 1.00003, 0.99915, 0.99984, 0.99973, 0.99973, 0.99973, 1.0006, 1, 0.99998, 1.0006, 1, 0.99999, 1, 0.99973, 1.00002, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.00026, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 0.99973, 0.99973, 0.99973, 1.00042, 0.99999, 0.99998, 0.99924, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00034, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 1.00035, 0.99999, 0.99999, 0.99977, 0.99924, 0.99924, 0.99924, 0.99924, 0.99924, 1.0006, 0.99924, 0.99924, 1, 1, 1, 1, 0.99924, 0.99924, 1, 1.02572, 0.99924, 1.00005, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 0.99924, 0.95317, 0.99924, 1.40579, 0.99999, 0.60299, 1, 1, 1.00003, 1.00267, 0.96499, 1.00003, 1, 1, 0.99973, 0.99973, 0.99999, 0.99973, 0.99973, 0.99973, 1, 1.00031, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.00016, 0.99998, 0.99973, 0.99973, 0.99973, 1.00031, 1.00031, 0.99973, 0.99973, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 0.99973, 0.99973, 0.9998, 0.99998, 0.99998, 0.96329, 0.99982, 1.0006, 1, 1.00023, 0.99933, 1.00008, 1.00003, 1.06409, 1.20985, 1.00015, 0.99973, 0.99973, 1.00026, 1.00006, 0.99998, 0.99998, 0.99998, 0.99924, 0.99924, 0.99924, 0.99924, 1.00043, 0.99998, 0.99998, 0.8254, 0.99998, 0.99998, 1.00025, 1.00003, 1.00027, 0.99998, 1.41144, 1, 1, 1, 1, 1, 1, 0.99999, 0.99973, 0.99973, 1.00002, 1.40579, 0.9997, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 1.0006, 0.99995, 1.0006, 0.84533, 1.0006, 0.99973, 0.99973, 0.99973, 1.00002, 1.00002, 0.99998, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 1.0006, 0.99998, 1, 1.00001, 0.99561, 0.99973, 1.00073, 1, 1, 0.99998, 1, 1, 1, 1, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 1, 0.99973, 1.41144, 1.00023, 1.00023, 1.00023, 1.00023, 0.99973, 0.99973, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 1.00055, 1, 1, 1, 1, 0.99973, 1, 1, 1, 1, 1, 0.99973, 1.00019];
  43909. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  43910. const HelveticaRegularLineHeight = 1.2;
  43911. exports.HelveticaRegularLineHeight = HelveticaRegularLineHeight;
  43912. /***/ }),
  43913. /* 58 */
  43914. /***/ ((__unused_webpack_module, exports) => {
  43915. Object.defineProperty(exports, "__esModule", ({
  43916. value: true
  43917. }));
  43918. exports.LiberationSansRegularWidths = exports.LiberationSansItalicWidths = exports.LiberationSansBoldWidths = exports.LiberationSansBoldItalicWidths = void 0;
  43919. const LiberationSansBoldWidths = [365, 0, 722, 1000, 1000, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 719, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 853, 722, 906, 722, 556, 611, 778, 601, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 785, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 474, 278, 556, 556, 722, 722, 722, 611, 611, 667, 611, 611, 611, 611, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 802, 838, 778, 825, 778, 778, 778, 667, 821, 722, 809, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 600, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 927, 722, 722, 667, 944, 944, 944, 944, 944, 667, 644, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 333, 556, 889, 889, 1000, 722, 719, 722, 567, 712, 667, 669, 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, 487, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 622, 556, 618, 615, 417, 635, 556, 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, 447, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 556, 719, 778, 604, 611, 885, 489, 1115, 556, 615, 615, 556, 722, 333, 556, 549, 556, 556, 1000, 500, 1000, 1000, 500, 500, 500, 584, 584, 389, 975, 556, 611, 278, 280, 610, 708, 389, 389, 333, 333, 333, 333, 280, 350, 556, 556, 333, 333, 222, 556, 556, 556, 556, 333, 556, 576, 604, 333, 333, 656, 333, 278, 333, 222, 737, 556, 333, 611, 556, 556, 719, 611, 400, 606, 510, 333, 333, 465, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 1000, 556, 1000, 556, 611, 556, 475, 451, 584, 583, 600, 611, 611, 611, 333, 604, 333, 333, 750, 604, 1000, 556, 834, 333, 556, 556, 333, 556, 611, 556, 611, 611, 611, 611, 611, 333, 333, 584, 549, 556, 556, 333, 333, 611, 611, 611, 594, 604, 333, 333, 278, 278, 278, 278, 278, 278, 556, 278, 713, 274, 604, 604, 722, 604, 604, 1052, 278, 278, 278, 278, 278, 278, 278, 278, 556, 558, 556, 556, 278, 278, 556, 385, 278, 479, 584, 549, 708, 556, 584, 278, 494, 278, 708, 889, 552, 750, 333, 584, 240, 612, 584, 500, 750, 611, 611, 708, 611, 611, 556, 333, 549, 611, 556, 556, 611, 611, 611, 611, 611, 944, 333, 611, 611, 611, 845, 845, 611, 611, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 611, 611, 556, 333, 333, 494, 889, 278, 1000, 1094, 715, 766, 584, 549, 823, 753, 611, 611, 611, 474, 500, 500, 500, 278, 278, 278, 278, 238, 389, 389, 549, 389, 389, 737, 584, 619, 333, 708, 556, 556, 556, 556, 556, 556, 479, 556, 556, 834, 333, 708, 684, 520, 556, 278, 1021, 531, 556, 713, 917, 333, 446, 333, 479, 333, 541, 611, 556, 834, 834, 333, 333, 333, 1000, 990, 990, 990, 990, 556, 611, 611, 611, 611, 611, 611, 611, 611, 556, 552, 278, 333, 333, 333, 576, 333, 611, 333, 333, 333, 667, 722, 556, 615, 333, 333, 333, 396, 768, 612, 167, 278, 750, 333, 611, 611, 611, 708, 582, 582, 582, 582, 611, 611, 556, 778, 778, 778, 778, 778, 556, 445, 556, 556, 556, 556, 556, 556, 500, 500, 500, 500, 556, 460];
  43920. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  43921. const LiberationSansBoldItalicWidths = [365, 0, 722, 1000, 1000, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 671, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 854, 722, 906, 722, 556, 611, 778, 610, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 782, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 473, 278, 556, 556, 722, 722, 722, 611, 611, 667, 611, 611, 611, 611, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 781, 847, 778, 844, 778, 778, 778, 667, 822, 718, 829, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 590, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 930, 722, 722, 667, 944, 944, 944, 944, 944, 667, 657, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 333, 556, 889, 889, 1000, 722, 708, 722, 614, 722, 667, 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, 575, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 677, 556, 619, 604, 534, 618, 556, 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, 467, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 556, 719, 778, 611, 611, 885, 516, 1146, 556, 620, 620, 556, 722, 333, 556, 549, 556, 556, 1000, 500, 999, 1000, 500, 500, 500, 584, 584, 389, 975, 556, 611, 278, 280, 621, 708, 389, 389, 333, 333, 333, 333, 280, 350, 556, 556, 333, 333, 222, 556, 556, 556, 556, 333, 556, 578, 604, 333, 333, 656, 333, 278, 333, 222, 737, 556, 333, 611, 556, 556, 740, 611, 400, 610, 510, 333, 333, 333, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 1000, 556, 1000, 556, 611, 556, 479, 479, 584, 583, 600, 611, 611, 611, 333, 604, 333, 333, 750, 604, 1000, 556, 834, 333, 556, 556, 333, 556, 611, 556, 611, 611, 611, 611, 611, 333, 333, 584, 549, 556, 556, 333, 333, 611, 611, 611, 594, 604, 333, 333, 278, 278, 278, 278, 278, 278, 556, 278, 713, 274, 604, 604, 722, 604, 604, 1052, 278, 278, 278, 278, 278, 278, 278, 278, 556, 566, 556, 556, 278, 278, 556, 396, 278, 479, 584, 549, 708, 556, 584, 278, 494, 278, 708, 889, 552, 750, 333, 584, 240, 603, 584, 500, 750, 611, 611, 708, 611, 611, 556, 333, 549, 611, 556, 556, 611, 611, 611, 611, 611, 944, 333, 611, 611, 611, 834, 834, 611, 611, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 611, 611, 556, 333, 333, 494, 889, 278, 1000, 1104, 704, 712, 584, 549, 823, 773, 611, 611, 611, 474, 500, 500, 500, 278, 278, 278, 278, 238, 389, 389, 549, 389, 389, 737, 584, 605, 333, 708, 556, 556, 556, 556, 556, 556, 479, 556, 556, 834, 333, 708, 664, 532, 556, 278, 1021, 531, 556, 713, 917, 333, 409, 333, 479, 333, 558, 611, 556, 834, 834, 333, 333, 333, 1000, 990, 990, 990, 990, 556, 611, 611, 611, 611, 611, 611, 611, 611, 556, 552, 278, 333, 333, 333, 576, 333, 611, 333, 333, 333, 667, 719, 556, 619, 333, 333, 333, 396, 768, 612, 167, 278, 750, 333, 611, 611, 611, 708, 591, 591, 591, 591, 611, 611, 556, 778, 778, 778, 778, 778, 556, 450, 556, 556, 556, 556, 556, 556, 500, 500, 500, 500, 556, 492];
  43922. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  43923. const LiberationSansItalicWidths = [365, 0, 667, 1000, 1000, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 671, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 789, 722, 846, 722, 556, 611, 778, 570, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 733, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 389, 278, 500, 500, 667, 667, 667, 556, 556, 667, 556, 556, 556, 556, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 761, 775, 778, 794, 778, 778, 778, 667, 837, 725, 831, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 600, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 865, 722, 722, 667, 944, 944, 944, 944, 944, 667, 648, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 294, 556, 889, 889, 1000, 667, 651, 667, 544, 704, 667, 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, 492, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 639, 556, 562, 522, 493, 553, 556, 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, 339, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 500, 724, 778, 556, 556, 885, 323, 1083, 556, 570, 570, 556, 667, 278, 556, 549, 556, 556, 1000, 500, 1000, 998, 500, 500, 500, 469, 584, 389, 1015, 556, 556, 278, 260, 571, 708, 334, 334, 278, 278, 333, 285, 260, 350, 500, 500, 333, 324, 222, 500, 500, 500, 500, 333, 556, 546, 604, 333, 324, 656, 278, 278, 333, 222, 737, 556, 333, 556, 556, 556, 625, 556, 400, 556, 510, 333, 316, 333, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 1000, 556, 1000, 556, 556, 556, 439, 439, 584, 584, 600, 555, 555, 556, 278, 500, 333, 278, 750, 604, 1000, 556, 834, 333, 556, 556, 333, 556, 556, 500, 556, 556, 556, 556, 611, 333, 294, 584, 549, 556, 556, 333, 333, 556, 556, 556, 594, 604, 333, 398, 222, 278, 278, 278, 278, 278, 444, 278, 713, 274, 604, 604, 719, 604, 604, 1052, 222, 222, 222, 222, 222, 278, 222, 222, 500, 500, 500, 500, 222, 222, 492, 281, 222, 400, 584, 549, 708, 556, 584, 222, 494, 222, 708, 833, 552, 750, 333, 584, 188, 548, 584, 500, 750, 556, 556, 615, 556, 556, 556, 333, 549, 556, 500, 556, 556, 556, 556, 556, 556, 944, 333, 556, 556, 556, 779, 779, 556, 556, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 556, 556, 537, 333, 333, 494, 889, 278, 1000, 1094, 652, 670, 584, 549, 823, 728, 556, 556, 611, 355, 333, 333, 333, 222, 222, 222, 222, 191, 333, 333, 549, 333, 333, 737, 584, 573, 333, 708, 500, 500, 500, 500, 500, 500, 354, 556, 556, 834, 333, 708, 603, 486, 556, 278, 1021, 531, 556, 713, 917, 278, 374, 278, 354, 278, 542, 556, 556, 834, 834, 333, 328, 333, 1000, 990, 990, 990, 990, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 552, 278, 333, 333, 333, 576, 333, 611, 278, 333, 278, 667, 715, 556, 565, 333, 333, 333, 365, 768, 612, 167, 278, 750, 333, 500, 500, 556, 708, 550, 550, 550, 550, 556, 556, 500, 722, 722, 722, 722, 722, 500, 447, 500, 500, 500, 500, 556, 500, 500, 500, 500, 500, 556, 463];
  43924. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  43925. const LiberationSansRegularWidths = [365, 0, 667, 1000, 1000, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 668, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 784, 722, 838, 722, 556, 611, 778, 551, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 735, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 384, 278, 500, 500, 667, 667, 667, 556, 556, 668, 556, 556, 556, 556, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 748, 752, 778, 774, 778, 778, 778, 667, 798, 722, 835, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 618, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 855, 722, 722, 667, 944, 944, 944, 944, 944, 667, 650, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 556, 889, 889, 1000, 667, 656, 667, 542, 677, 667, 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, 489, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 635, 556, 573, 531, 365, 583, 556, 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, 411, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 500, 719, 778, 552, 556, 885, 323, 1073, 556, 578, 578, 556, 667, 278, 556, 549, 556, 556, 1000, 500, 1000, 1000, 500, 500, 500, 469, 584, 389, 1015, 556, 556, 278, 260, 575, 708, 334, 334, 278, 278, 333, 260, 350, 500, 500, 333, 500, 500, 500, 500, 333, 556, 525, 604, 333, 656, 278, 278, 737, 556, 556, 556, 556, 615, 556, 400, 557, 510, 333, 333, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 1000, 556, 1000, 556, 556, 556, 446, 446, 584, 583, 600, 556, 556, 556, 278, 500, 333, 278, 750, 604, 1000, 556, 834, 556, 556, 556, 556, 500, 556, 556, 556, 556, 611, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285, 333, 584, 549, 556, 556, 333, 333, 556, 556, 556, 594, 604, 333, 222, 278, 278, 278, 278, 278, 444, 278, 713, 274, 604, 604, 719, 604, 604, 1052, 222, 222, 222, 222, 222, 278, 222, 222, 500, 500, 500, 500, 222, 222, 500, 292, 222, 334, 584, 549, 708, 556, 584, 222, 494, 222, 708, 833, 552, 750, 333, 584, 188, 576, 584, 500, 750, 556, 556, 604, 556, 556, 556, 333, 549, 556, 500, 556, 556, 556, 556, 556, 556, 944, 333, 556, 556, 556, 781, 781, 556, 556, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 556, 556, 537, 333, 333, 494, 889, 278, 1000, 1094, 648, 690, 584, 549, 823, 713, 556, 556, 611, 355, 333, 333, 333, 222, 222, 222, 222, 191, 333, 333, 549, 333, 333, 737, 584, 569, 333, 708, 500, 500, 500, 500, 500, 500, 354, 556, 556, 834, 708, 617, 482, 556, 278, 1021, 531, 556, 713, 917, 278, 395, 278, 375, 278, 556, 556, 556, 834, 834, 333, 333, 1000, 990, 990, 990, 990, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 552, 278, 333, 333, 333, 576, 333, 611, 278, 333, 278, 667, 722, 556, 559, 333, 333, 333, 333, 333, 333, 333, 365, 768, 612, 167, 278, 750, 333, 333, 500, 500, 556, 708, 547, 547, 547, 547, 556, 556, 500, 722, 722, 722, 722, 722, 500, 448, 500, 500, 500, 500, 556, 500, 500, 500, 500, 500, 556, 441];
  43926. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  43927. /***/ }),
  43928. /* 59 */
  43929. /***/ ((__unused_webpack_module, exports) => {
  43930. Object.defineProperty(exports, "__esModule", ({
  43931. value: true
  43932. }));
  43933. exports.MyriadProRegularLineHeight = exports.MyriadProRegularFactors = exports.MyriadProItalicLineHeight = exports.MyriadProItalicFactors = exports.MyriadProBoldLineHeight = exports.MyriadProBoldItalicLineHeight = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  43934. const MyriadProBoldFactors = [1.36898, 1, 0.90838, 0.868, 0.868, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.91945, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.83637, 0.83637, 0.82391, 0.82391, 0.82391, 0.82391, 0.82391, 0.82391, 0.91905, 0.96376, 0.96376, 0.97484, 0.90157, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.95417, 0.80061, 0.80061, 0.75261, 0.95407, 0.87992, 0.97484, 0.99793, 0.86275, 0.8768, 0.8019, 0.8768, 0.8768, 1, 0.8768, 0.95407, 1, 1, 1, 1, 0.97069, 0.95407, 1.0258, 0.887, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 0.82976, 1.0258, 0.73901, 0.73901, 0.85022, 0.85022, 1, 0.83655, 0.83655, 0.97153, 0.83655, 1, 0.83655, 0.84638, 1.0156, 1.0156, 0.95546, 0.95546, 0.95546, 1, 0.95546, 0.95546, 0.92179, 0.936, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 0.92796, 0.97268, 0.92179, 0.96034, 0.92179, 0.92179, 0.92179, 0.87107, 0.95638, 0.92361, 0.91709, 0.92179, 0.82114, 0.82114, 0.82114, 1, 0.87107, 0.8096, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.8096, 0.8096, 1, 0.8096, 1, 0.96318, 0.89713, 0.89713, 0.89713, 0.89713, 1, 0.92436, 0.86958, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.93704, 0.93704, 0.83689, 0.94438, 0.94438, 0.95353, 0.94083, 0.94083, 0.94083, 0.94083, 0.94083, 0.91905, 0.89192, 0.90406, 0.90406, 0.90406, 0.90406, 0.90406, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 0.94938, 0.94938, 0.94938, 0.94938, 0.90088, 1, 0.94938, 0.9031, 0.9031, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.94938, 0.94836, 0.94836, 0.94938, 0.93884, 0.83181, 0.94938, 1.08595, 0.94938, 0.94938, 1, 1, 1, 1, 1, 1, 1, 1.02058, 1.02058, 1.16661, 0.78966, 0.94938, 0.97898, 1.18777, 1.01149, 0.96174, 1, 0.80687, 0.80687, 0.94292, 0.94292, 0.90088, 1, 1.01149, 0.96544, 0.81093, 0.81093, 0.90088, 1, 1, 0.81093, 0.81093, 0.81093, 0.81093, 0.90088, 0.99793, 0.87548, 1, 0.90088, 1, 1, 0.78076, 0.93582, 1, 1, 0.91882, 0.99793, 1, 0.97571, 0.94219, 0.94219, 0.84313, 0.97571, 0.89022, 0.9498, 1, 0.90088, 1, 0.9358, 1.08595, 1, 1, 0.99793, 0.90088, 0.98621, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.99793, 1, 1, 0.94938, 1, 0.89903, 0.95933, 0.94938, 0.98607, 1.0373, 1.02058, 1, 1.36145, 0.95933, 0.95933, 0.93969, 0.80479, 1, 0.80479, 1.024, 1, 1, 1, 0.99793, 1, 1, 0.99793, 0.99793, 1, 1, 0.9577, 0.92601, 0.9577, 0.9577, 1, 0.9577, 0.98225, 0.90088, 1, 1.02058, 1.08595, 0.8361, 0.8361, 0.81079, 0.81079, 0.95933, 0.95933, 0.95933, 1, 1, 0.90088, 1, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 1.01591, 0.98621, 1.05486, 1.30692, 1, 1, 1, 1, 1, 1, 0.98621, 1.0078, 1.0078, 1.0078, 1.0078, 0.98621, 1.0474, 1.0474, 0.97455, 0.98275, 1, 0.97455, 0.98981, 0.98981, 0.9314, 0.73977, 1, 0.73903, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.16161, 1.033, 1, 0.9672, 0.54324, 1, 1, 1.02058, 1, 0.95617, 1.02058, 1, 1, 0.95933, 0.95933, 0.8271, 0.95933, 1, 0.99793, 1, 1.08595, 0.95933, 0.91701, 0.98894, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 0.91964, 0.90088, 0.9446, 0.9446, 0.9446, 0.86774, 0.86774, 0.9446, 0.9446, 0.99793, 1, 0.99642, 0.99642, 1, 1.0213, 1.05686, 1, 0.9446, 0.9446, 0.9446, 0.97898, 0.97455, 0.94292, 0.94292, 1.17173, 0.9897, 0.93582, 1.285, 1, 0.99394, 0.78367, 1.02058, 1.08595, 0.80535, 0.96361, 0.97407, 0.72851, 0.72851, 0.83734, 0.918, 0.908, 0.908, 0.93582, 1, 0.93582, 0.93582, 0.86209, 0.97646, 0.97646, 1.0732, 0.97646, 1, 0.62295, 1, 0.9553, 0.90088, 1, 0.78036, 0.78036, 0.78036, 1, 0.78036, 1, 1, 1.00872, 0.99793, 1, 1, 1, 0.86832, 1, 0.99793, 1.19137, 1, 1, 0.99793, 0.76169, 1, 1.10208, 1.0128, 1.10208, 0.77452, 1, 1.05453, 0.97898, 0.99793, 1, 0.99642, 0.90088, 1, 0.90989, 0.65, 1, 1, 1, 1, 0.99793, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.89903, 1, 0.72706, 0.96694, 1, 1, 1, 1, 0.89713, 1.10208, 0.90088, 0.78076, 1, 1, 1, 1, 0.96694, 1, 1, 1, 1, 1, 0.74854, 0.93582, 1, 1, 1, 1, 0.95442, 1, 0.95871, 0.95871, 0.95871, 0.95871, 0.95442, 0.95442, 0.95298, 0.97579, 0.97579, 0.97579, 0.97579, 0.97579, 0.9332, 1.05993, 0.94039, 0.94039, 0.94039, 0.94039, 0.99793, 0.94039, 0.938, 0.938, 0.938, 0.938, 0.99793, 0.95776];
  43935. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  43936. const MyriadProBoldLineHeight = 1.2;
  43937. exports.MyriadProBoldLineHeight = MyriadProBoldLineHeight;
  43938. const MyriadProBoldItalicFactors = [1.36898, 1, 0.85576, 0.845, 0.845, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.80591, 0.80591, 0.80729, 0.80729, 0.80729, 0.80729, 0.80729, 0.80729, 0.85308, 0.94299, 0.94299, 0.95961, 0.94729, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.92098, 0.77512, 0.77512, 0.66862, 0.92222, 0.7927, 0.95961, 0.97276, 0.83655, 0.86523, 0.7805, 0.86523, 0.86523, 1, 0.86523, 0.92222, 1, 1, 1, 1, 0.92222, 0.92222, 0.98621, 0.86036, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.69323, 0.98621, 0.71743, 0.71743, 0.81698, 0.81698, 1, 0.79726, 0.79726, 0.92655, 0.79726, 1, 0.79726, 0.81691, 0.98558, 0.98558, 0.92222, 0.92222, 0.92222, 1, 0.92222, 0.92222, 0.90637, 0.909, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 0.92346, 0.89711, 0.90637, 0.88127, 0.90251, 0.90251, 0.90637, 0.83809, 0.93157, 0.90976, 0.83392, 0.90637, 0.80729, 0.80729, 0.80729, 1, 0.83809, 0.76463, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.76463, 0.76463, 1, 0.76463, 1, 0.94523, 0.86275, 0.86275, 0.86275, 0.86275, 1, 0.90637, 0.83659, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.83509, 0.83509, 0.72459, 0.90699, 0.90699, 0.91605, 0.9154, 0.9154, 0.9154, 0.9154, 0.9154, 0.85308, 0.85359, 0.85458, 0.85458, 0.85458, 0.85458, 0.85458, 0.90531, 0.90531, 0.90531, 0.90531, 0.90531, 0.99613, 0.99613, 0.99613, 0.99613, 1.18616, 1, 0.99613, 0.85811, 0.85811, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.99613, 0.92886, 0.92886, 0.99613, 0.92222, 0.80178, 0.99613, 1.08595, 0.99613, 0.99613, 1, 1, 1, 1, 1, 1, 1, 1.02058, 1.02058, 1.16148, 0.76813, 0.99613, 0.91677, 1.21296, 0.8578, 0.90557, 1, 0.80687, 0.80687, 0.94292, 0.94292, 1.18616, 1, 0.8578, 0.95973, 0.78216, 0.78216, 1.18616, 1, 1, 0.78216, 0.78216, 0.78216, 0.78216, 1.18616, 0.97276, 0.81539, 1, 1.18616, 1, 1, 0.78076, 0.93582, 1, 1, 0.91339, 0.97276, 1, 0.91677, 0.9332, 0.9332, 0.76783, 0.91677, 0.89022, 0.90276, 1, 1.18616, 1, 1.30628, 1.08595, 1, 1, 0.97276, 1.18616, 0.95381, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.97276, 1, 1, 0.90083, 1, 0.89903, 0.92168, 0.90083, 0.91324, 0.91324, 1.02058, 1, 1.36145, 0.92168, 0.92168, 0.9135, 0.80779, 1, 0.80779, 0.98796, 1, 1, 1, 0.97276, 1, 1, 0.97276, 0.97276, 1, 1, 0.9135, 0.86847, 0.9135, 0.9135, 1, 0.9135, 0.94951, 1.18616, 1, 1.02058, 1.08595, 0.82891, 0.82711, 0.80479, 0.80178, 0.92168, 0.92168, 0.92168, 1, 1, 1.18616, 1, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.97096, 0.95381, 1.05486, 1.23026, 1, 1, 1, 1, 1, 1, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.98981, 0.98981, 0.95298, 0.9224, 1, 0.95298, 0.95381, 0.95381, 0.85408, 0.6894, 1, 0.74321, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.20006, 1.0006, 1, 0.93459, 0.71526, 1, 1, 1.02058, 1, 0.92699, 1.02058, 1, 1, 0.92168, 0.92168, 0.79464, 0.92168, 1, 0.97276, 1, 1.08595, 0.92168, 0.86847, 0.97276, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 0.87514, 1.18616, 0.91513, 0.91513, 0.91513, 0.85923, 0.85923, 0.91513, 0.91513, 0.97276, 1, 0.99043, 0.99043, 1, 1.08074, 1.04864, 1, 0.91677, 0.91677, 0.91513, 0.92004, 0.96736, 0.94292, 0.94292, 1.14542, 0.97733, 0.93582, 1.26, 1, 0.97355, 0.80487, 1.02058, 1.08595, 0.79199, 0.89398, 0.91677, 0.71541, 0.71541, 0.81625, 0.896, 0.896, 0.896, 0.91782, 1, 0.91782, 0.91782, 0.83266, 0.95077, 0.95077, 1.03493, 0.95077, 1, 0.55509, 1, 0.93481, 1.18616, 1, 0.748, 0.748, 0.748, 1, 0.748, 1, 1, 0.99973, 0.97276, 1, 1, 1, 0.88159, 1, 0.97276, 1.17337, 1, 1, 0.97276, 0.78694, 1, 1.04502, 1.05214, 1.04502, 0.72651, 1, 0.99531, 0.92332, 0.97276, 1, 0.99043, 1.18616, 1, 1.00899, 0.698, 1, 1, 1, 1, 0.97276, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89903, 1, 0.66227, 0.96694, 1, 1, 1, 1, 0.86275, 1.04502, 1.18616, 0.78076, 1, 1, 1, 1, 0.96694, 1, 1, 1, 1, 1, 0.85633, 0.93582, 1, 1, 1, 1, 0.91677, 1, 0.90646, 0.90646, 0.90646, 0.90646, 0.91677, 0.91677, 0.92061, 0.94236, 0.94236, 0.94236, 0.94236, 0.94236, 0.89544, 1.0051, 0.89364, 0.89364, 0.89364, 0.89364, 0.97276, 0.89364, 0.9, 0.9, 0.9, 0.9, 0.97276, 0.86842];
  43939. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  43940. const MyriadProBoldItalicLineHeight = 1.2;
  43941. exports.MyriadProBoldItalicLineHeight = MyriadProBoldItalicLineHeight;
  43942. const MyriadProItalicFactors = [1.36898, 1, 0.85158, 0.773, 0.773, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.77812, 0.77812, 0.76852, 0.76852, 0.76852, 0.76852, 0.76852, 0.76852, 0.78112, 0.89591, 0.89591, 0.90561, 0.88836, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.87396, 0.70466, 0.70466, 0.62264, 0.86822, 0.7646, 0.90561, 0.88465, 0.76125, 0.80094, 0.76449, 0.80094, 0.80094, 1, 0.80094, 0.86822, 1, 1, 1, 1, 0.86822, 0.86822, 0.83864, 0.81402, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.65351, 0.83864, 0.728, 0.728, 0.77212, 0.77212, 1, 0.79475, 0.79475, 0.85308, 0.79475, 1, 0.79475, 0.80553, 0.93637, 0.93637, 0.87514, 0.87514, 0.87514, 1, 0.87514, 0.87514, 0.8588, 0.867, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 0.89386, 0.89947, 0.8588, 0.86026, 0.85751, 0.85751, 0.8588, 0.76013, 0.82565, 0.85701, 0.77899, 0.8588, 0.72421, 0.72421, 0.72421, 1, 0.76013, 0.69866, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.69866, 0.69866, 1, 0.69866, 1, 0.89058, 0.77598, 0.77598, 0.77598, 0.77598, 1, 0.8588, 0.76013, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.8156, 0.8156, 0.69461, 0.85991, 0.85991, 0.80811, 0.87832, 0.87832, 0.87832, 0.87832, 0.87832, 0.78112, 0.82352, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.8562, 0.8562, 0.8562, 0.8562, 0.8562, 0.93859, 0.93859, 0.93859, 0.93859, 1.15012, 1, 0.93859, 0.8075, 0.8075, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.93859, 0.9486, 0.9486, 0.93859, 0.88307, 0.77025, 0.93859, 1.08595, 0.93859, 0.93859, 1, 1, 1, 1, 1, 1, 1, 1.27014, 1.02058, 1.06383, 0.70926, 0.93859, 0.94399, 1.18417, 0.83537, 0.93298, 1, 0.85034, 0.85034, 1.0222, 1.0222, 1.15012, 1, 0.83537, 0.79121, 0.846, 0.846, 1.15012, 1, 1, 0.846, 0.846, 0.846, 0.846, 1.15012, 0.88465, 0.77487, 1, 1.15012, 1, 1, 0.75945, 0.75945, 1, 1, 0.9161, 0.88465, 1, 0.94399, 0.86847, 0.86847, 0.8544, 0.94399, 0.79519, 0.93942, 1, 1.15012, 1, 1.03901, 1.08595, 1, 1, 0.88465, 1.15012, 0.82424, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.88465, 1, 1, 0.81453, 1, 0.89903, 0.96017, 0.81453, 0.92388, 0.92388, 1.02058, 1, 1.36145, 0.96186, 0.96186, 0.9278, 0.84943, 1, 0.70869, 1.0186, 1, 1, 1, 0.88465, 1, 1, 0.88465, 0.88465, 1, 1, 0.94219, 0.878, 0.94219, 0.94219, 1, 0.94219, 0.88075, 1.15012, 1, 1.02058, 1.08595, 0.73541, 0.73361, 0.73572, 0.73572, 0.96017, 0.96017, 0.96017, 1, 1, 1.15012, 1, 1.03075, 0.82424, 0.82424, 0.82424, 0.82424, 0.82424, 1.02738, 0.82424, 1.02119, 1.06233, 1, 1, 1, 1, 1, 1, 1.03075, 1.03075, 1.03075, 1.03075, 1.03075, 0.82424, 1.02175, 1.02175, 0.912, 0.922, 1, 0.912, 1.03075, 1.03075, 0.88787, 0.83911, 1, 0.66266, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.05233, 1.06676, 1, 0.96998, 0.69353, 1, 1, 1.02058, 1, 0.95829, 1.02058, 1, 1, 0.96017, 0.96017, 0.86865, 0.96017, 1, 0.88465, 1, 1.08595, 0.96017, 0.88, 0.88465, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.84759, 1.15012, 0.93859, 0.93859, 0.93859, 0.86799, 0.86799, 0.93859, 0.93859, 0.88465, 1, 0.9005, 0.9005, 1, 0.94565, 0.9446, 1, 0.8562, 0.8562, 0.93859, 0.94399, 0.91974, 0.85283, 0.85283, 1.04828, 0.86936, 0.75945, 1.124, 1, 0.93969, 0.78815, 1.02058, 1.08595, 0.74948, 0.85769, 0.94399, 0.69046, 0.62864, 0.85639, 1.027, 1.027, 1.027, 0.87321, 1, 0.87321, 0.87321, 0.86948, 0.95493, 0.95493, 0.98391, 0.95493, 1, 0.53609, 1, 0.93758, 1.15313, 1, 0.746, 0.746, 0.746, 1, 0.746, 1, 1, 0.90083, 0.88465, 1, 1, 1, 0.89217, 1, 0.88465, 1.17337, 1, 1, 0.88465, 0.75187, 1, 1.12658, 1.03737, 1.12658, 0.88417, 1, 0.95119, 0.94578, 0.88465, 1, 0.9005, 1.15012, 1, 1.08106, 0.669, 1, 1, 1, 1, 0.88465, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.89903, 1, 0.65507, 0.9219, 1, 1, 1, 1, 0.77598, 1.12658, 1.15012, 0.75945, 1, 1, 1, 1, 0.9219, 1, 1, 1, 1, 1, 0.85034, 0.75945, 1, 1, 1, 1, 0.94578, 1, 0.91123, 0.91123, 0.91123, 0.91123, 0.94578, 0.94578, 0.91, 0.979, 0.979, 0.979, 0.979, 0.979, 0.882, 0.93559, 0.882, 0.882, 0.882, 0.882, 0.88465, 0.882, 0.83, 0.83, 0.83, 0.83, 0.88465, 0.84596];
  43943. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  43944. const MyriadProItalicLineHeight = 1.2;
  43945. exports.MyriadProItalicLineHeight = MyriadProItalicLineHeight;
  43946. const MyriadProRegularFactors = [1.36898, 1, 0.91755, 0.788, 0.788, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.92138, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.8126, 0.8126, 0.80314, 0.80314, 0.80314, 0.80314, 0.80314, 0.80314, 0.85608, 0.92222, 0.92222, 0.92915, 0.92819, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.90991, 0.73764, 0.73764, 0.7154, 0.90284, 0.86169, 0.92915, 0.92241, 0.79726, 0.83051, 0.81884, 0.83051, 0.83051, 1, 0.83051, 0.90284, 1, 1, 1, 1, 0.90976, 0.90284, 0.86023, 0.82873, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.80513, 0.86023, 0.74, 0.74, 0.8126, 0.8126, 1, 0.84869, 0.84869, 0.91172, 0.84869, 1, 0.84869, 0.85588, 0.96518, 0.96518, 0.91115, 0.91115, 0.91115, 1, 0.91115, 0.91115, 0.8858, 0.894, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 0.94307, 0.98612, 0.8858, 0.94007, 0.8858, 0.8858, 0.8858, 0.79761, 0.89992, 0.87791, 0.81992, 0.8858, 0.74498, 0.74498, 0.74498, 1, 0.79761, 0.73914, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.73914, 0.73914, 1, 0.73914, 1, 0.89297, 0.81363, 0.81363, 0.81363, 0.81363, 1, 0.8858, 0.79611, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.88157, 0.88157, 0.82528, 0.89591, 0.89591, 0.83659, 0.89633, 0.89633, 0.89633, 0.89633, 0.89633, 0.85608, 0.83089, 0.8111, 0.8111, 0.8111, 0.8111, 0.8111, 0.90531, 0.90531, 0.90531, 0.90531, 0.90531, 0.86667, 0.86667, 0.86667, 0.86667, 0.90088, 0.86667, 0.86936, 0.86936, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.86667, 0.95308, 0.95308, 0.86667, 0.90706, 0.78105, 0.86667, 1.08595, 0.86667, 0.86667, 1, 1, 1, 1, 1, 1, 1, 1.27014, 1.02058, 1.0664, 0.72601, 0.86667, 1.0231, 1.22736, 0.92006, 0.97358, 1, 0.85034, 0.85034, 1.0222, 1.0222, 0.90088, 0.92006, 0.80549, 0.896, 0.896, 0.90088, 0.896, 0.896, 0.896, 0.896, 0.90088, 0.92241, 0.87064, 1, 0.90088, 1, 0.74505, 0.74505, 0.91882, 0.92241, 1.01411, 0.89903, 0.89903, 0.93372, 1.01411, 0.79519, 0.98088, 1, 0.90088, 1.03901, 1.08595, 1, 1, 0.92241, 0.90088, 0.84224, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.92241, 1, 0.90083, 1, 0.89903, 0.99793, 0.90083, 0.98699, 0.98699, 1.02058, 1, 1.36145, 0.99793, 0.99793, 0.97276, 0.82784, 1, 0.69067, 1.05099, 1, 1, 1, 0.92241, 1, 0.92241, 0.92241, 1, 1.00512, 0.928, 1.00512, 1.00512, 1, 1.00512, 0.89713, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90088, 1.02058, 1.08595, 0.75339, 0.75339, 0.76575, 0.76575, 0.99793, 0.99793, 0.99793, 1, 1, 0.90088, 1.05326, 0.84224, 0.84224, 0.84224, 0.84224, 0.84224, 1.07469, 0.84224, 1.02119, 1.1536, 1, 1, 1, 1, 1, 1, 1.05326, 1.06226, 1.06226, 1.06226, 1.06226, 0.84224, 1.09377, 1.09377, 0.938, 0.986, 1, 0.938, 1.06226, 1.06226, 0.944, 0.83704, 1, 0.81441, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.05638, 1.08927, 1, 1.00119, 0.54324, 1, 1, 1.02058, 1, 0.95978, 1.02058, 1, 1, 0.99793, 0.99793, 0.91887, 0.99793, 1, 0.92241, 1, 1.08595, 0.99793, 0.938, 0.89364, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 0.91434, 0.90088, 0.98714, 0.98714, 0.98714, 0.88888, 0.88888, 0.98714, 0.98714, 0.92241, 1, 0.91009, 0.91009, 1, 0.93484, 0.97198, 1, 0.89876, 0.89876, 0.98714, 1.0231, 0.95325, 0.85283, 0.85283, 1.07257, 0.89073, 0.74505, 1.156, 1, 0.99007, 0.80442, 1.02058, 1.08595, 0.74705, 0.91879, 1.01231, 0.73002, 0.66466, 0.94935, 1.06904, 1.06304, 1.06304, 0.93173, 1, 0.93173, 0.93173, 0.98472, 0.98196, 0.98196, 1.024, 0.98196, 1, 0.56866, 1, 0.98972, 0.90088, 1, 0.792, 0.792, 0.792, 1, 0.792, 1, 1, 0.9332, 0.92241, 1, 1, 0.89762, 1, 0.92241, 1.23456, 1, 1, 0.92241, 0.71119, 1, 1.19137, 1.04552, 1.19137, 0.904, 1, 0.96017, 1.0231, 0.92241, 1, 0.91009, 0.90088, 0.90388, 0.619, 1, 1, 1, 1, 0.92241, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.89903, 1, 0.76305, 0.9219, 1, 1, 1, 1, 0.81363, 1.19137, 0.90088, 0.74505, 1, 1, 1, 1, 0.9219, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.72458, 0.74505, 1, 1, 1, 1, 1, 0.99074, 1, 0.95817, 0.95817, 0.95817, 0.95817, 0.99074, 0.99074, 0.962, 1.01915, 1.01915, 1.01915, 1.01915, 1.01915, 0.926, 0.96705, 0.942, 0.942, 0.942, 0.942, 0.92241, 0.942, 0.856, 0.856, 0.856, 0.856, 0.92241, 0.92761];
  43947. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  43948. const MyriadProRegularLineHeight = 1.2;
  43949. exports.MyriadProRegularLineHeight = MyriadProRegularLineHeight;
  43950. /***/ }),
  43951. /* 60 */
  43952. /***/ ((__unused_webpack_module, exports) => {
  43953. Object.defineProperty(exports, "__esModule", ({
  43954. value: true
  43955. }));
  43956. exports.SegoeuiRegularLineHeight = exports.SegoeuiRegularFactors = exports.SegoeuiItalicLineHeight = exports.SegoeuiItalicFactors = exports.SegoeuiBoldLineHeight = exports.SegoeuiBoldItalicLineHeight = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  43957. const SegoeuiBoldFactors = [1.76738, 1, 0.97363, 0.93506, 0.93506, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 1.01149, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.88776, 0.88776, 0.8641, 0.8641, 0.8641, 0.8641, 0.8641, 0.8641, 0.98243, 1.02096, 1.02096, 1.02096, 0.97826, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 1.09251, 0.79795, 0.79795, 0.7676, 1.06085, 0.98167, 1.02096, 1.03424, 0.85132, 0.914, 0.85134, 0.914, 0.914, 1, 0.914, 1.06085, 1, 0.99862, 0.99862, 1, 1.06085, 1.06085, 1.1406, 0.97138, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.01134, 1.1406, 0.8007, 0.8007, 0.89858, 0.89858, 1, 0.83693, 0.83693, 1.0388, 0.83693, 1, 0.83693, 0.83693, 1.14889, 1.14889, 1.09398, 1.09398, 1.09398, 1, 1.09398, 1.09398, 0.97489, 0.93994, 0.97426, 0.97489, 0.97426, 0.97426, 0.97426, 0.97489, 0.97489, 0.95493, 1.03089, 0.97489, 1.02546, 0.97489, 0.97489, 0.97426, 0.92094, 0.99346, 1.0595, 1.02112, 0.97489, 0.90399, 0.90399, 0.90399, 1, 0.92094, 0.84041, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.84041, 0.84041, 0.84041, 0.84041, 1, 0.94793, 0.95923, 0.95923, 0.95923, 0.95923, 1, 0.97489, 0.92094, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.90996, 0.84097, 1.00135, 1.00135, 1, 1.06467, 1.06467, 1.06467, 1.06467, 1.06467, 0.98243, 0.86039, 0.90996, 0.90996, 0.90996, 0.90996, 0.90996, 0.99361, 0.99361, 0.99361, 0.99361, 0.99361, 0.96752, 0.96752, 0.96752, 0.96752, 0.91056, 1, 0.96752, 0.93136, 0.93136, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.96752, 1.03574, 1.03574, 0.96752, 1.17647, 0.81525, 0.96752, 1.29004, 0.96752, 0.96752, 0.86182, 0.94434, 0.86279, 0.86279, 0.94434, 1, 1, 1.2107, 1.2107, 1.16939, 0.97847, 0.96752, 1.01519, 1.56942, 1.16579, 1.0192, 1, 0.94856, 0.94856, 1.1085, 1.1085, 1.03959, 1, 1.16579, 1.20642, 0.86304, 0.86304, 1.15103, 1, 1, 0.86304, 0.86304, 0.86304, 0.86304, 0.64663, 1.03424, 0.96268, 1.42603, 1.15103, 1, 1.04315, 0.81378, 0.9754, 1, 1, 1.18622, 1, 1, 1.01359, 0.73047, 0.73047, 1.03057, 1.03517, 0.94994, 1.00886, 1.34163, 1.3871, 1, 0.87815, 1.28826, 1, 1, 1.03424, 0.75953, 1.02285, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 1.03424, 1, 0.91211, 0.97278, 1, 0.89903, 0.99041, 0.97278, 0.97531, 1.02597, 1.2107, 1.21172, 1, 1.0008, 1.0008, 0.97122, 0.9824, 0.96039, 0.9824, 1.15103, 1, 1.42603, 1, 1.03424, 1.15749, 1, 1.03424, 1.03424, 1, 0.93503, 1.01359, 1.01932, 1.01359, 1.01359, 1, 1.01359, 1.02798, 0.94282, 1, 1.2107, 1.29004, 1.04478, 1.04478, 1.03372, 1.03372, 0.98561, 1.00879, 0.98561, 1.15296, 1, 1.21994, 1, 1.02285, 1.02285, 1.02285, 1.02285, 1.02285, 1.02285, 1.08692, 1.02285, 1.13973, 2.10339, 1, 1, 0.9716, 1.42603, 1.42603, 1, 1.02285, 1.18102, 1.18102, 1.18102, 1.18102, 1.02285, 1.02285, 1.02285, 1.00527, 1.02277, 1, 1.00527, 1.02285, 1.02285, 0.98683, 0.9455, 1, 0.90418, 1.2107, 1.29004, 1, 1.03424, 1.2107, 1.07733, 1.18874, 1.13005, 1, 1.0302, 0.75155, 1, 1, 1.2107, 1.222, 1.0016, 1.2107, 1, 1, 0.99041, 0.99041, 0.96692, 0.99041, 1, 1.03424, 1, 1.29004, 0.99041, 0.99561, 1.06497, 1.0008, 1, 1.0008, 1, 1, 0.97931, 0.79912, 1, 1.0008, 1.0008, 0.98439, 0.98439, 1.0008, 1.0008, 1.03424, 1.15749, 1.15749, 1.14169, 0.99862, 1.10818, 1.24866, 0.69825, 1.0008, 1.0008, 1, 1.01519, 0.91572, 1.1085, 1.1085, 1.16897, 0.97529, 0.9754, 1.25635, 1.19687, 1.04983, 0.90434, 1.2107, 1.28826, 0.96085, 1.0499, 1.01359, 0.71703, 0.71703, 1.04016, 0.98633, 0.98633, 0.98633, 1.04394, 1.04394, 1.04394, 1.04394, 1.23203, 1.02258, 1.02258, 1.18416, 1.02258, 1, 1.18622, 1, 0.99921, 0.81378, 1, 0.79104, 0.79104, 0.79104, 0.79104, 0.79104, 1, 1.02956, 0.8727, 1.03424, 1.10948, 1, 1, 0.8965, 0.93803, 1.03424, 1.59578, 1, 1.2886, 1.03424, 0.90137, 1, 1.16862, 1.23085, 1.16862, 1.07034, 1, 1.13189, 1.01519, 1.03424, 1.15749, 1.17389, 1.15103, 1, 0.95161, 0.771, 0.87025, 0.87025, 0.87025, 0.87025, 1.03424, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.74627, 0.75155, 0.99297, 1.21408, 1.21408, 1.21408, 1, 1.18328, 0.95923, 1.16862, 1.01173, 0.81378, 0.79795, 1.09466, 0.97278, 1.02065, 1, 1.21408, 1.24633, 1.12454, 1, 1, 1, 0.9754, 1, 1, 1.09193, 1.09193, 0.99041, 1, 1.06628, 1.06628, 1.06628, 1.06628, 0.99041, 0.99041, 0.97454, 1.02511, 1.02511, 1.02511, 1.02511, 1.02511, 0.99298, 1.07237, 0.96752, 0.96752, 0.96752, 0.96752, 1.03424, 0.96752, 0.95801, 0.95801, 0.95801, 0.95801, 1.03424, 1.0106];
  43958. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  43959. const SegoeuiBoldLineHeight = 1.33008;
  43960. exports.SegoeuiBoldLineHeight = SegoeuiBoldLineHeight;
  43961. const SegoeuiBoldItalicFactors = [1.76738, 1, 0.97363, 0.94385, 0.94385, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 1.00811, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.89723, 0.89723, 0.87897, 0.87897, 0.87897, 0.87897, 0.87897, 0.87897, 0.9817, 1.0426, 1.0426, 1.0426, 1.09818, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 1.10466, 0.79429, 0.79429, 0.77702, 1.05815, 0.99137, 1.0426, 1.036, 0.85292, 0.91149, 0.86869, 0.91149, 0.91149, 1, 0.91149, 1.05815, 1, 0.99862, 0.99862, 1, 1.05815, 1.05815, 1.1406, 0.97441, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 0.95253, 1.1406, 0.79631, 0.79631, 0.90128, 0.90128, 1, 0.83853, 0.83853, 1.06662, 0.83853, 1, 0.83853, 0.83853, 1.04396, 1.04396, 1.10615, 1.10615, 1.10615, 1, 1.10615, 1.10615, 0.97552, 0.91602, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 0.98999, 1.07205, 0.97552, 1.0347, 0.97552, 0.97552, 0.97552, 0.94436, 1.00356, 1.04694, 1.01945, 0.97552, 0.88641, 0.88641, 0.88641, 1, 0.94436, 0.80527, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.80527, 0.80527, 0.80527, 0.80527, 1, 0.98015, 0.96083, 0.96083, 0.95923, 0.96083, 1, 0.97552, 0.94436, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.91142, 0.86142, 1.00135, 1.00135, 1, 1.06777, 1.06777, 1.06777, 1.06777, 1.06777, 0.9817, 0.84918, 0.91142, 0.91142, 0.91142, 0.91142, 0.91142, 0.99361, 0.99361, 0.99361, 0.99361, 0.99361, 1.06585, 1.06585, 1.06585, 1.06585, 1.31818, 1, 1.06585, 0.96705, 0.96705, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.06585, 1.04961, 1.04961, 1.06585, 1.10953, 0.83284, 1.06585, 1.29004, 1.06585, 1.06585, 0.86224, 0.94434, 0.86364, 0.86279, 0.94434, 1, 1, 1.21237, 1.21237, 1.16939, 0.97847, 1.06585, 0.97042, 1.57293, 1.16579, 0.99607, 1, 0.95107, 0.95107, 1.11144, 1.11144, 1.31818, 1, 1.16579, 1.20502, 0.83055, 0.83055, 1.31818, 1, 1, 0.83055, 0.83055, 0.83055, 0.83055, 1.31818, 1.036, 0.93491, 1.42603, 1.31818, 1, 1.04315, 0.81378, 0.9754, 1, 1, 1.18754, 1, 1, 0.97042, 0.72959, 0.72959, 1.0033, 0.97042, 0.94994, 1.008, 1.34163, 1.31818, 1, 1.27126, 1.29004, 1, 1, 1.036, 1.31818, 1.14236, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 1.036, 1, 0.91406, 0.93503, 1, 0.89903, 0.97922, 0.93503, 0.9898, 0.9898, 1.21237, 1.21339, 1, 1.00639, 1.00639, 0.93125, 1.03959, 0.96039, 1.03959, 1.1261, 1, 1.42603, 1, 1.036, 1.15574, 1, 1.036, 1.036, 1, 0.93327, 0.97042, 1.02897, 0.97042, 0.97042, 1, 0.97042, 0.98721, 1.31818, 1, 1.21237, 1.29004, 1.05356, 1.05356, 1.03372, 1.03372, 0.97922, 0.97922, 0.97922, 1.15296, 1, 1.31818, 1, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 1.04302, 1.14236, 1.13904, 2.10339, 1, 1, 0.9716, 1.42603, 1.42603, 1, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 0.94552, 1.01582, 1.01054, 1.00518, 1, 1.01054, 1.14236, 1.14236, 0.97981, 1.09125, 1, 0.90418, 1.21237, 1.29004, 1, 1.03336, 1.21237, 1.23199, 1.18775, 1.19508, 1, 1.02471, 0.79487, 1, 1, 1.21237, 1.222, 1.02186, 1.21237, 1, 1, 0.97922, 0.97922, 1.01034, 0.97922, 1, 1.036, 1, 1.29004, 0.97922, 1, 1.02809, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 0.91981, 1.31818, 0.94165, 0.94165, 0.94165, 1.00351, 1.00351, 0.94165, 0.94165, 1.036, 1.15574, 1.15574, 1.13934, 0.99862, 1.26781, 1.24866, 0.69825, 0.94165, 0.94165, 0.94165, 0.97042, 0.91484, 1.11144, 1.11144, 1.16798, 0.97639, 0.9754, 1.26514, 1.16541, 1.10687, 0.99314, 1.21237, 1.29004, 0.96085, 1.04232, 0.97042, 0.73541, 0.73541, 1.04016, 0.98633, 0.98633, 0.98633, 1.04745, 1.04394, 1.04745, 1.04745, 1.23203, 1.0276, 1.0276, 1.18416, 1.0276, 1, 1.18622, 1, 0.98387, 1.31818, 1, 0.78929, 0.78929, 0.78929, 0.78929, 0.78929, 1, 1.02956, 0.87357, 1.036, 1.15574, 1, 1, 0.93377, 0.93028, 1.036, 1.59754, 1, 1.2886, 1.036, 0.90068, 1, 1.1261, 1.35125, 1.16862, 1.05403, 1, 1.11121, 0.97042, 1.036, 1.15574, 1.17389, 1.31818, 1, 0.95161, 0.771, 0.87025, 0.87025, 0.87025, 0.87025, 1.036, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.74627, 0.75155, 0.98946, 1.21261, 1.24047, 1.24047, 1, 1.1349, 0.96083, 1.1261, 1.31818, 0.81378, 0.79429, 1.09097, 0.93503, 0.96609, 1, 1.21261, 1.24633, 1.09125, 1, 1, 1, 0.9754, 1, 1, 1.13269, 1.13269, 0.97922, 1, 1.07514, 1.07514, 1.07514, 1.07514, 0.97922, 0.97922, 0.95874, 1.02197, 1.02197, 1.02197, 1.02197, 1.02197, 0.98507, 1.08578, 0.96752, 0.96752, 0.96752, 0.96752, 1.036, 0.96752, 0.97168, 0.97168, 0.97168, 0.97168, 1.036, 0.95134];
  43962. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  43963. const SegoeuiBoldItalicLineHeight = 1.33008;
  43964. exports.SegoeuiBoldItalicLineHeight = SegoeuiBoldItalicLineHeight;
  43965. const SegoeuiItalicFactors = [1.76738, 1, 0.94729, 0.85498, 0.85498, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85944, 0.85944, 0.88506, 0.88506, 0.88506, 0.88506, 0.88506, 0.88506, 0.8858, 0.9858, 0.9858, 0.9858, 0.9607, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 1.03849, 0.74817, 0.74817, 0.71022, 0.98039, 0.90883, 0.9858, 0.96927, 0.80016, 0.88449, 0.82791, 0.88449, 0.88449, 1, 0.88449, 0.98039, 1, 0.99862, 0.99862, 1, 0.98039, 0.98039, 0.95782, 0.84421, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.84171, 0.95782, 0.69238, 0.69238, 0.89898, 0.89898, 1, 0.83231, 0.83231, 0.98316, 0.84723, 1, 0.84723, 0.83231, 0.98183, 0.98183, 1.03989, 1.03989, 1.03989, 1, 1.03989, 1.03989, 0.96924, 0.92383, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.01284, 1.05734, 0.96924, 0.99877, 0.96924, 0.96924, 0.96924, 0.86237, 0.90082, 0.97642, 0.97296, 0.96924, 0.80595, 0.80595, 0.80595, 1, 0.86237, 0.74524, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.74524, 0.74524, 0.74524, 0.74524, 1, 0.86075, 0.86091, 0.86091, 0.85771, 0.86091, 1, 0.96924, 0.86237, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.83089, 0.77596, 0.95402, 0.95402, 0.94143, 0.98448, 0.98448, 0.98448, 0.98448, 0.98448, 0.8858, 0.78614, 0.83089, 0.83089, 0.83089, 0.83089, 0.83089, 0.93285, 0.93285, 0.93285, 0.93285, 0.93285, 0.97454, 0.97454, 0.97454, 0.97454, 1.04839, 1, 0.97454, 0.92916, 0.92916, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.97454, 1.0976, 1.0976, 0.97454, 1.15373, 0.78032, 0.97454, 1.24822, 0.97454, 0.97454, 0.86182, 0.94434, 0.86321, 0.8649, 0.94434, 1, 1, 1.45994, 1.17308, 1.07403, 0.94565, 0.97454, 0.97454, 1.39016, 0.92481, 0.98205, 1, 0.91082, 0.91082, 1.0949, 1.0949, 1.04839, 1, 0.92481, 1.15621, 0.87207, 0.87207, 1.04839, 1, 1, 0.87207, 0.87207, 0.87207, 0.87207, 1.04839, 0.96927, 0.99821, 1.42603, 1.04839, 1, 1.04315, 0.78383, 0.78383, 1, 1, 1.23393, 1, 1, 0.97454, 0.67603, 0.67603, 0.95391, 0.97454, 0.94261, 1.05097, 1.34163, 1.04839, 1, 0.81965, 1.24822, 1, 1, 0.96927, 1.04839, 0.93146, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.96927, 1, 0.73584, 0.87533, 1, 0.89903, 1.01054, 0.87533, 1.04, 1.04, 1.17308, 1.17308, 1, 1.03342, 1.03342, 0.93854, 1.14763, 0.95996, 0.95748, 1.06151, 1, 1.42603, 1, 0.96927, 1.09836, 1, 0.96927, 0.96927, 1, 0.87709, 0.97454, 1.03809, 0.97454, 0.97454, 1, 0.97454, 0.88409, 1.04839, 1, 1.17308, 1.24822, 0.9245, 0.9245, 0.94868, 0.94868, 1.00176, 1.00176, 1.00176, 1.15296, 1, 1.04839, 1, 1.16484, 0.93146, 0.93146, 0.93146, 0.93146, 0.93146, 1.12761, 0.93146, 1.14589, 1.96791, 1, 1, 0.97622, 1.42603, 1.42603, 1, 1.16484, 1.2, 1.2, 1.2, 1.2, 0.93146, 1.08132, 1.08132, 0.98047, 1.02148, 1, 0.98047, 1.16484, 1.16484, 1.0119, 1.04861, 1, 0.78755, 1.17308, 1.24822, 1, 0.96927, 1.17308, 1.31868, 1.17984, 1.23736, 1, 1.02989, 0.63218, 1, 1, 1.17308, 1.22135, 1.04724, 1.17308, 1, 1, 1.01054, 1.01054, 0.9857, 1.01054, 1, 0.96927, 1, 1.24822, 1.01054, 1.0127, 1.06234, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 0.90171, 1.04839, 0.96225, 0.96225, 0.96225, 1.0326, 1.0326, 0.96225, 0.96225, 0.96927, 1.09836, 1.13525, 1.09836, 0.99862, 1.1781, 1.22326, 0.69825, 0.8761, 0.8761, 0.96225, 0.97454, 0.85273, 0.91349, 0.91349, 1.083, 0.92586, 0.78383, 1.21191, 1.01473, 1.11826, 0.8965, 1.17308, 1.24822, 0.91578, 1.0557, 0.97454, 0.77349, 0.70424, 1.05365, 1.12317, 1.12317, 1.12317, 0.94945, 0.94945, 0.94945, 0.94945, 1.18414, 1.06598, 1.06598, 1.18416, 1.06598, 1, 1.20808, 1, 0.97783, 1.04839, 1, 0.79004, 0.79004, 0.79004, 0.79004, 0.79004, 1, 1.06483, 0.80597, 0.96927, 1.01522, 1, 1, 0.94818, 0.93574, 0.96927, 1.42531, 1, 1.2886, 0.96927, 0.86438, 1, 1.16344, 1.30679, 1.16344, 1.02759, 1, 1.05401, 0.97454, 0.96927, 1.09836, 1.15222, 1.04839, 1, 0.81965, 0.77295, 0.87025, 0.87025, 0.87025, 0.87025, 0.96927, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 0.74627, 0.75155, 0.98946, 1.20088, 1.09971, 1.09971, 1, 1.09971, 0.86091, 1.16344, 1.04839, 0.78383, 0.74817, 1.03754, 0.87533, 0.98705, 1, 1.20088, 1.24633, 1.07497, 1, 1, 1, 0.78032, 1, 1, 1.10742, 1.10742, 1.00351, 1, 1.0675, 1.0675, 1.0675, 1.0675, 1.00351, 1.00351, 0.94629, 0.9973, 0.9973, 0.9973, 0.9973, 0.9973, 0.91016, 1.02732, 0.96777, 0.96777, 0.96777, 0.96777, 0.96927, 0.96777, 0.9043, 0.9043, 0.9043, 0.9043, 0.96927, 0.95364];
  43966. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  43967. const SegoeuiItalicLineHeight = 1.33008;
  43968. exports.SegoeuiItalicLineHeight = SegoeuiItalicLineHeight;
  43969. const SegoeuiRegularFactors = [1.76738, 1, 0.96706, 0.86035, 0.86035, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96635, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.85944, 0.85944, 0.85734, 0.85734, 0.85734, 0.85734, 0.85734, 0.85734, 0.88433, 0.97093, 0.97093, 0.97093, 0.96491, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 1.03444, 0.75842, 0.75842, 0.72727, 0.9831, 0.92366, 0.97093, 0.96927, 0.79936, 0.88198, 0.85638, 0.88198, 0.88198, 1, 0.88198, 0.9831, 1, 0.99862, 0.99862, 1, 0.9831, 0.9831, 0.95782, 0.84784, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.98601, 0.95782, 0.71387, 0.71387, 0.86969, 0.86969, 1, 0.84636, 0.84636, 0.94152, 0.84636, 1, 0.84636, 0.84636, 1.07796, 1.07796, 1.03584, 1.03584, 1.03584, 1, 1.03584, 1.03584, 0.96924, 0.93066, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.0098, 1.09799, 0.96924, 1.03405, 0.96924, 0.96924, 0.96924, 0.83968, 0.94492, 0.98715, 0.9287, 0.96924, 0.82826, 0.82826, 0.82826, 1, 0.83968, 0.79649, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.79649, 0.79649, 0.79649, 0.79649, 1, 0.83491, 0.85771, 0.85771, 0.85771, 0.85771, 1, 0.96924, 0.83968, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.8287, 0.77968, 0.95132, 0.95132, 0.93119, 0.98965, 0.98965, 0.98965, 0.98965, 0.98965, 0.88433, 0.78437, 0.8287, 0.8287, 0.8287, 0.8287, 0.8287, 0.93365, 0.93365, 0.93365, 0.93365, 0.93365, 0.91484, 0.91484, 0.91484, 0.91484, 0.84751, 0.91484, 0.93575, 0.93575, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.91484, 1.0625, 1.0625, 0.91484, 1.19985, 0.78032, 0.91484, 1.24822, 0.91484, 0.91484, 0.86182, 0.94434, 0.86279, 0.86279, 0.94434, 1, 1, 1.45786, 1.1714, 1.07152, 0.94084, 0.91484, 1.05707, 1.3638, 0.92105, 0.95246, 1, 0.90351, 0.90351, 1.08612, 1.08612, 0.91202, 0.92105, 1.16039, 0.92383, 0.92383, 1.11437, 0.92383, 0.92383, 0.92383, 0.92383, 0.61584, 0.96927, 1.02512, 1.42603, 1.11437, 1.04315, 0.78032, 0.78032, 1.20808, 0.99912, 1.05882, 0.67428, 0.67428, 1.0969, 1.05882, 0.94261, 1.04912, 1.34163, 1.2434, 0.81818, 1.24644, 1, 1, 0.96927, 0.60411, 0.8717, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.96927, 0.73291, 0.9403, 1, 0.89903, 1.01756, 0.9403, 0.98248, 0.98248, 1.1714, 1.17238, 1, 1.03424, 1.03424, 1.00527, 1.02285, 0.95996, 0.85337, 1.12654, 1, 1.42603, 1, 0.96927, 1.11358, 0.96927, 0.96927, 0.87796, 1.05882, 1.03809, 1.05882, 1.05882, 1, 1.05882, 0.89049, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.80499, 1.1714, 1.24822, 0.90957, 0.90957, 0.94868, 0.94868, 1.01756, 1.01756, 1.01756, 1.15296, 1, 0.97361, 1.09011, 0.8717, 0.8717, 0.8717, 0.8717, 0.8717, 1.11551, 0.8717, 1.14589, 1.9697, 1, 1, 0.97622, 1.42603, 1.42603, 1, 1.09011, 1.2, 1.2, 1.2, 1.2, 0.8717, 1.09011, 1.09011, 0.99414, 1.04785, 1, 0.99414, 1.09011, 1.09011, 0.99609, 1.0536, 1, 0.94298, 1.1714, 1.24822, 1, 0.96927, 1.1714, 1.08571, 1.18083, 1.23297, 1, 1.034, 0.75155, 1, 1, 1.1714, 1.22135, 1.00169, 1.1714, 1, 1, 1.01756, 1.01756, 1.00323, 1.01756, 1, 0.96927, 1, 1.24822, 1.01756, 1.05176, 1.06234, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 0.98293, 0.55572, 1.05356, 1.05356, 1.05356, 1.03502, 1.03502, 1.05356, 1.05356, 0.96927, 1.10539, 1.11593, 1.08665, 0.99862, 1.05937, 1.17914, 0.69825, 0.95923, 0.95923, 1.05356, 1.05707, 0.85273, 0.90616, 0.90616, 1.083, 0.92037, 0.78032, 1.20996, 1.01518, 1.07831, 0.9087, 1.1714, 1.24644, 0.91578, 1.05205, 1.05882, 0.80597, 0.73381, 1.10454, 1.13196, 1.13196, 1.13196, 1.03077, 1.03077, 1.03077, 1.03077, 1.2046, 1.04399, 1.04399, 1.18416, 1.04399, 1, 1.20808, 1, 1.03004, 0.84164, 1, 0.84863, 0.84863, 0.84863, 0.84863, 0.84863, 1, 1.06483, 0.80597, 0.96927, 1.06967, 1, 0.93117, 0.95542, 0.96927, 1.40246, 1, 1.2886, 0.96927, 0.86507, 1, 1.21968, 1.23362, 1.21968, 1.17318, 1, 1.05443, 1.05707, 0.96927, 1.10539, 1.14169, 1.01173, 0.81818, 0.77295, 0.87025, 0.87025, 0.87025, 0.87025, 0.96927, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 0.74627, 0.75155, 0.98594, 1.20088, 1.09971, 1.09971, 1, 1.05425, 0.85771, 1.21968, 0.93109, 0.78032, 0.75842, 1.03719, 0.9403, 1.04021, 1, 1.20088, 1.24633, 1.05425, 1.09971, 1.09971, 1.09971, 1.07497, 1, 1, 1, 0.78032, 1, 1, 1, 1.10938, 1.10938, 1.01756, 1, 1.01071, 1.01071, 1.01071, 1.01071, 1.01756, 1.01756, 0.95801, 1.00068, 1.00068, 1.00068, 1.00068, 1.00068, 0.91797, 0.99346, 0.96777, 0.96777, 0.96777, 0.96777, 0.96927, 0.96777, 0.9043, 0.9043, 0.9043, 0.9043, 0.96927, 1.00221];
  43970. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  43971. const SegoeuiRegularLineHeight = 1.33008;
  43972. exports.SegoeuiRegularLineHeight = SegoeuiRegularLineHeight;
  43973. /***/ }),
  43974. /* 61 */
  43975. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43976. Object.defineProperty(exports, "__esModule", ({
  43977. value: true
  43978. }));
  43979. exports.MurmurHash3_64 = void 0;
  43980. var _util = __w_pdfjs_require__(2);
  43981. const SEED = 0xc3d2e1f0;
  43982. const MASK_HIGH = 0xffff0000;
  43983. const MASK_LOW = 0xffff;
  43984. class MurmurHash3_64 {
  43985. constructor(seed) {
  43986. this.h1 = seed ? seed & 0xffffffff : SEED;
  43987. this.h2 = seed ? seed & 0xffffffff : SEED;
  43988. }
  43989. update(input) {
  43990. let data, length;
  43991. if ((0, _util.isString)(input)) {
  43992. data = new Uint8Array(input.length * 2);
  43993. length = 0;
  43994. for (let i = 0, ii = input.length; i < ii; i++) {
  43995. const code = input.charCodeAt(i);
  43996. if (code <= 0xff) {
  43997. data[length++] = code;
  43998. } else {
  43999. data[length++] = code >>> 8;
  44000. data[length++] = code & 0xff;
  44001. }
  44002. }
  44003. } else if ((0, _util.isArrayBuffer)(input)) {
  44004. data = input.slice();
  44005. length = data.byteLength;
  44006. } else {
  44007. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  44008. }
  44009. const blockCounts = length >> 2;
  44010. const tailLength = length - blockCounts * 4;
  44011. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  44012. let k1 = 0,
  44013. k2 = 0;
  44014. let h1 = this.h1,
  44015. h2 = this.h2;
  44016. const C1 = 0xcc9e2d51,
  44017. C2 = 0x1b873593;
  44018. const C1_LOW = C1 & MASK_LOW,
  44019. C2_LOW = C2 & MASK_LOW;
  44020. for (let i = 0; i < blockCounts; i++) {
  44021. if (i & 1) {
  44022. k1 = dataUint32[i];
  44023. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44024. k1 = k1 << 15 | k1 >>> 17;
  44025. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44026. h1 ^= k1;
  44027. h1 = h1 << 13 | h1 >>> 19;
  44028. h1 = h1 * 5 + 0xe6546b64;
  44029. } else {
  44030. k2 = dataUint32[i];
  44031. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  44032. k2 = k2 << 15 | k2 >>> 17;
  44033. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  44034. h2 ^= k2;
  44035. h2 = h2 << 13 | h2 >>> 19;
  44036. h2 = h2 * 5 + 0xe6546b64;
  44037. }
  44038. }
  44039. k1 = 0;
  44040. switch (tailLength) {
  44041. case 3:
  44042. k1 ^= data[blockCounts * 4 + 2] << 16;
  44043. case 2:
  44044. k1 ^= data[blockCounts * 4 + 1] << 8;
  44045. case 1:
  44046. k1 ^= data[blockCounts * 4];
  44047. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44048. k1 = k1 << 15 | k1 >>> 17;
  44049. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44050. if (blockCounts & 1) {
  44051. h1 ^= k1;
  44052. } else {
  44053. h2 ^= k1;
  44054. }
  44055. }
  44056. this.h1 = h1;
  44057. this.h2 = h2;
  44058. }
  44059. hexdigest() {
  44060. let h1 = this.h1,
  44061. h2 = this.h2;
  44062. h1 ^= h2 >>> 1;
  44063. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  44064. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  44065. h1 ^= h2 >>> 1;
  44066. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  44067. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  44068. h1 ^= h2 >>> 1;
  44069. const hex1 = (h1 >>> 0).toString(16),
  44070. hex2 = (h2 >>> 0).toString(16);
  44071. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  44072. }
  44073. }
  44074. exports.MurmurHash3_64 = MurmurHash3_64;
  44075. /***/ }),
  44076. /* 62 */
  44077. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44078. Object.defineProperty(exports, "__esModule", ({
  44079. value: true
  44080. }));
  44081. exports.OperatorList = void 0;
  44082. var _util = __w_pdfjs_require__(2);
  44083. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  44084. let state = parentState;
  44085. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  44086. const item = pattern[i];
  44087. state = state[item] || (state[item] = []);
  44088. }
  44089. state[pattern[pattern.length - 1]] = {
  44090. checkFn,
  44091. iterateFn,
  44092. processFn
  44093. };
  44094. }
  44095. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  44096. const iFirstPIMXO = iFirstSave + 2;
  44097. let i;
  44098. for (i = 0; i < count; i++) {
  44099. const arg = argsArray[iFirstPIMXO + 4 * i];
  44100. const imageMask = arg.length === 1 && arg[0];
  44101. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  44102. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  44103. continue;
  44104. }
  44105. break;
  44106. }
  44107. return count - i;
  44108. }
  44109. const InitialState = [];
  44110. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  44111. const fnArray = context.fnArray;
  44112. const iFirstSave = context.iCurr - 3;
  44113. const pos = (i - iFirstSave) % 4;
  44114. switch (pos) {
  44115. case 0:
  44116. return fnArray[i] === _util.OPS.save;
  44117. case 1:
  44118. return fnArray[i] === _util.OPS.transform;
  44119. case 2:
  44120. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  44121. case 3:
  44122. return fnArray[i] === _util.OPS.restore;
  44123. }
  44124. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  44125. }, function foundInlineImageGroup(context, i) {
  44126. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  44127. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  44128. const MAX_WIDTH = 1000;
  44129. const IMAGE_PADDING = 1;
  44130. const fnArray = context.fnArray,
  44131. argsArray = context.argsArray;
  44132. const curr = context.iCurr;
  44133. const iFirstSave = curr - 3;
  44134. const iFirstTransform = curr - 2;
  44135. const iFirstPIIXO = curr - 1;
  44136. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  44137. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  44138. return i - (i - iFirstSave) % 4;
  44139. }
  44140. let maxX = 0;
  44141. const map = [];
  44142. let maxLineHeight = 0;
  44143. let currentX = IMAGE_PADDING,
  44144. currentY = IMAGE_PADDING;
  44145. for (let q = 0; q < count; q++) {
  44146. const transform = argsArray[iFirstTransform + (q << 2)];
  44147. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  44148. if (currentX + img.width > MAX_WIDTH) {
  44149. maxX = Math.max(maxX, currentX);
  44150. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  44151. currentX = 0;
  44152. maxLineHeight = 0;
  44153. }
  44154. map.push({
  44155. transform,
  44156. x: currentX,
  44157. y: currentY,
  44158. w: img.width,
  44159. h: img.height
  44160. });
  44161. currentX += img.width + 2 * IMAGE_PADDING;
  44162. maxLineHeight = Math.max(maxLineHeight, img.height);
  44163. }
  44164. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  44165. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  44166. const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  44167. const imgRowSize = imgWidth << 2;
  44168. for (let q = 0; q < count; q++) {
  44169. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  44170. const rowSize = map[q].w << 2;
  44171. let dataOffset = 0;
  44172. let offset = map[q].x + map[q].y * imgWidth << 2;
  44173. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  44174. for (let k = 0, kk = map[q].h; k < kk; k++) {
  44175. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  44176. dataOffset += rowSize;
  44177. offset += imgRowSize;
  44178. }
  44179. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  44180. while (offset >= 0) {
  44181. data[offset - 4] = data[offset];
  44182. data[offset - 3] = data[offset + 1];
  44183. data[offset - 2] = data[offset + 2];
  44184. data[offset - 1] = data[offset + 3];
  44185. data[offset + rowSize] = data[offset + rowSize - 4];
  44186. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  44187. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  44188. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  44189. offset -= imgRowSize;
  44190. }
  44191. }
  44192. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  44193. argsArray.splice(iFirstSave, count * 4, [{
  44194. width: imgWidth,
  44195. height: imgHeight,
  44196. kind: _util.ImageKind.RGBA_32BPP,
  44197. data: imgData
  44198. }, map]);
  44199. return iFirstSave + 1;
  44200. });
  44201. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  44202. const fnArray = context.fnArray;
  44203. const iFirstSave = context.iCurr - 3;
  44204. const pos = (i - iFirstSave) % 4;
  44205. switch (pos) {
  44206. case 0:
  44207. return fnArray[i] === _util.OPS.save;
  44208. case 1:
  44209. return fnArray[i] === _util.OPS.transform;
  44210. case 2:
  44211. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  44212. case 3:
  44213. return fnArray[i] === _util.OPS.restore;
  44214. }
  44215. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  44216. }, function foundImageMaskGroup(context, i) {
  44217. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  44218. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  44219. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  44220. const fnArray = context.fnArray,
  44221. argsArray = context.argsArray;
  44222. const curr = context.iCurr;
  44223. const iFirstSave = curr - 3;
  44224. const iFirstTransform = curr - 2;
  44225. const iFirstPIMXO = curr - 1;
  44226. let count = Math.floor((i - iFirstSave) / 4);
  44227. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  44228. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  44229. return i - (i - iFirstSave) % 4;
  44230. }
  44231. let isSameImage = false;
  44232. let iTransform, transformArgs;
  44233. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  44234. const firstTransformArg0 = argsArray[iFirstTransform][0],
  44235. firstTransformArg1 = argsArray[iFirstTransform][1],
  44236. firstTransformArg2 = argsArray[iFirstTransform][2],
  44237. firstTransformArg3 = argsArray[iFirstTransform][3];
  44238. if (firstTransformArg1 === firstTransformArg2) {
  44239. isSameImage = true;
  44240. iTransform = iFirstTransform + 4;
  44241. let iPIMXO = iFirstPIMXO + 4;
  44242. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  44243. transformArgs = argsArray[iTransform];
  44244. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  44245. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  44246. isSameImage = false;
  44247. } else {
  44248. count = q;
  44249. }
  44250. break;
  44251. }
  44252. }
  44253. }
  44254. if (isSameImage) {
  44255. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  44256. const positions = new Float32Array(count * 2);
  44257. iTransform = iFirstTransform;
  44258. for (let q = 0; q < count; q++, iTransform += 4) {
  44259. transformArgs = argsArray[iTransform];
  44260. positions[q << 1] = transformArgs[4];
  44261. positions[(q << 1) + 1] = transformArgs[5];
  44262. }
  44263. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  44264. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  44265. } else {
  44266. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  44267. const images = [];
  44268. for (let q = 0; q < count; q++) {
  44269. transformArgs = argsArray[iFirstTransform + (q << 2)];
  44270. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  44271. images.push({
  44272. data: maskParams.data,
  44273. width: maskParams.width,
  44274. height: maskParams.height,
  44275. transform: transformArgs
  44276. });
  44277. }
  44278. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  44279. argsArray.splice(iFirstSave, count * 4, [images]);
  44280. }
  44281. return iFirstSave + 1;
  44282. });
  44283. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  44284. const argsArray = context.argsArray;
  44285. const iFirstTransform = context.iCurr - 2;
  44286. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  44287. }, function iterateImageGroup(context, i) {
  44288. const fnArray = context.fnArray,
  44289. argsArray = context.argsArray;
  44290. const iFirstSave = context.iCurr - 3;
  44291. const pos = (i - iFirstSave) % 4;
  44292. switch (pos) {
  44293. case 0:
  44294. return fnArray[i] === _util.OPS.save;
  44295. case 1:
  44296. if (fnArray[i] !== _util.OPS.transform) {
  44297. return false;
  44298. }
  44299. const iFirstTransform = context.iCurr - 2;
  44300. const firstTransformArg0 = argsArray[iFirstTransform][0];
  44301. const firstTransformArg3 = argsArray[iFirstTransform][3];
  44302. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  44303. return false;
  44304. }
  44305. return true;
  44306. case 2:
  44307. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  44308. return false;
  44309. }
  44310. const iFirstPIXO = context.iCurr - 1;
  44311. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  44312. if (argsArray[i][0] !== firstPIXOArg0) {
  44313. return false;
  44314. }
  44315. return true;
  44316. case 3:
  44317. return fnArray[i] === _util.OPS.restore;
  44318. }
  44319. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  44320. }, function (context, i) {
  44321. const MIN_IMAGES_IN_BLOCK = 3;
  44322. const MAX_IMAGES_IN_BLOCK = 1000;
  44323. const fnArray = context.fnArray,
  44324. argsArray = context.argsArray;
  44325. const curr = context.iCurr;
  44326. const iFirstSave = curr - 3;
  44327. const iFirstTransform = curr - 2;
  44328. const iFirstPIXO = curr - 1;
  44329. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  44330. const firstTransformArg0 = argsArray[iFirstTransform][0];
  44331. const firstTransformArg3 = argsArray[iFirstTransform][3];
  44332. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  44333. if (count < MIN_IMAGES_IN_BLOCK) {
  44334. return i - (i - iFirstSave) % 4;
  44335. }
  44336. const positions = new Float32Array(count * 2);
  44337. let iTransform = iFirstTransform;
  44338. for (let q = 0; q < count; q++, iTransform += 4) {
  44339. const transformArgs = argsArray[iTransform];
  44340. positions[q << 1] = transformArgs[4];
  44341. positions[(q << 1) + 1] = transformArgs[5];
  44342. }
  44343. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  44344. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  44345. argsArray.splice(iFirstSave, count * 4, args);
  44346. return iFirstSave + 1;
  44347. });
  44348. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  44349. const fnArray = context.fnArray,
  44350. argsArray = context.argsArray;
  44351. const iFirstSave = context.iCurr - 4;
  44352. const pos = (i - iFirstSave) % 5;
  44353. switch (pos) {
  44354. case 0:
  44355. return fnArray[i] === _util.OPS.beginText;
  44356. case 1:
  44357. return fnArray[i] === _util.OPS.setFont;
  44358. case 2:
  44359. return fnArray[i] === _util.OPS.setTextMatrix;
  44360. case 3:
  44361. if (fnArray[i] !== _util.OPS.showText) {
  44362. return false;
  44363. }
  44364. const iFirstSetFont = context.iCurr - 3;
  44365. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  44366. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  44367. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  44368. return false;
  44369. }
  44370. return true;
  44371. case 4:
  44372. return fnArray[i] === _util.OPS.endText;
  44373. }
  44374. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  44375. }, function (context, i) {
  44376. const MIN_CHARS_IN_BLOCK = 3;
  44377. const MAX_CHARS_IN_BLOCK = 1000;
  44378. const fnArray = context.fnArray,
  44379. argsArray = context.argsArray;
  44380. const curr = context.iCurr;
  44381. const iFirstBeginText = curr - 4;
  44382. const iFirstSetFont = curr - 3;
  44383. const iFirstSetTextMatrix = curr - 2;
  44384. const iFirstShowText = curr - 1;
  44385. const iFirstEndText = curr;
  44386. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  44387. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  44388. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  44389. if (count < MIN_CHARS_IN_BLOCK) {
  44390. return i - (i - iFirstBeginText) % 5;
  44391. }
  44392. let iFirst = iFirstBeginText;
  44393. 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) {
  44394. count++;
  44395. iFirst -= 5;
  44396. }
  44397. let iEndText = iFirst + 4;
  44398. for (let q = 1; q < count; q++) {
  44399. fnArray.splice(iEndText, 3);
  44400. argsArray.splice(iEndText, 3);
  44401. iEndText += 2;
  44402. }
  44403. return iEndText + 1;
  44404. });
  44405. class NullOptimizer {
  44406. constructor(queue) {
  44407. this.queue = queue;
  44408. }
  44409. _optimize() {}
  44410. push(fn, args) {
  44411. this.queue.fnArray.push(fn);
  44412. this.queue.argsArray.push(args);
  44413. this._optimize();
  44414. }
  44415. flush() {}
  44416. reset() {}
  44417. }
  44418. class QueueOptimizer extends NullOptimizer {
  44419. constructor(queue) {
  44420. super(queue);
  44421. this.state = null;
  44422. this.context = {
  44423. iCurr: 0,
  44424. fnArray: queue.fnArray,
  44425. argsArray: queue.argsArray
  44426. };
  44427. this.match = null;
  44428. this.lastProcessed = 0;
  44429. }
  44430. _optimize() {
  44431. const fnArray = this.queue.fnArray;
  44432. let i = this.lastProcessed,
  44433. ii = fnArray.length;
  44434. let state = this.state;
  44435. let match = this.match;
  44436. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  44437. this.lastProcessed = ii;
  44438. return;
  44439. }
  44440. const context = this.context;
  44441. while (i < ii) {
  44442. if (match) {
  44443. const iterate = (0, match.iterateFn)(context, i);
  44444. if (iterate) {
  44445. i++;
  44446. continue;
  44447. }
  44448. i = (0, match.processFn)(context, i + 1);
  44449. ii = fnArray.length;
  44450. match = null;
  44451. state = null;
  44452. if (i >= ii) {
  44453. break;
  44454. }
  44455. }
  44456. state = (state || InitialState)[fnArray[i]];
  44457. if (!state || Array.isArray(state)) {
  44458. i++;
  44459. continue;
  44460. }
  44461. context.iCurr = i;
  44462. i++;
  44463. if (state.checkFn && !(0, state.checkFn)(context)) {
  44464. state = null;
  44465. continue;
  44466. }
  44467. match = state;
  44468. state = null;
  44469. }
  44470. this.state = state;
  44471. this.match = match;
  44472. this.lastProcessed = i;
  44473. }
  44474. flush() {
  44475. while (this.match) {
  44476. const length = this.queue.fnArray.length;
  44477. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  44478. this.match = null;
  44479. this.state = null;
  44480. this._optimize();
  44481. }
  44482. }
  44483. reset() {
  44484. this.state = null;
  44485. this.match = null;
  44486. this.lastProcessed = 0;
  44487. }
  44488. }
  44489. class OperatorList {
  44490. static get CHUNK_SIZE() {
  44491. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  44492. }
  44493. static get CHUNK_SIZE_ABOUT() {
  44494. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  44495. }
  44496. constructor(intent, streamSink) {
  44497. this._streamSink = streamSink;
  44498. this.fnArray = [];
  44499. this.argsArray = [];
  44500. if (streamSink && !(intent && intent.startsWith("oplist-"))) {
  44501. this.optimizer = new QueueOptimizer(this);
  44502. } else {
  44503. this.optimizer = new NullOptimizer(this);
  44504. }
  44505. this.dependencies = new Set();
  44506. this._totalLength = 0;
  44507. this.weight = 0;
  44508. this._resolved = streamSink ? null : Promise.resolve();
  44509. }
  44510. get length() {
  44511. return this.argsArray.length;
  44512. }
  44513. get ready() {
  44514. return this._resolved || this._streamSink.ready;
  44515. }
  44516. get totalLength() {
  44517. return this._totalLength + this.length;
  44518. }
  44519. addOp(fn, args) {
  44520. this.optimizer.push(fn, args);
  44521. this.weight++;
  44522. if (this._streamSink) {
  44523. if (this.weight >= OperatorList.CHUNK_SIZE) {
  44524. this.flush();
  44525. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  44526. this.flush();
  44527. }
  44528. }
  44529. }
  44530. addDependency(dependency) {
  44531. if (this.dependencies.has(dependency)) {
  44532. return;
  44533. }
  44534. this.dependencies.add(dependency);
  44535. this.addOp(_util.OPS.dependency, [dependency]);
  44536. }
  44537. addDependencies(dependencies) {
  44538. for (const dependency of dependencies) {
  44539. this.addDependency(dependency);
  44540. }
  44541. }
  44542. addOpList(opList) {
  44543. if (!(opList instanceof OperatorList)) {
  44544. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  44545. return;
  44546. }
  44547. for (const dependency of opList.dependencies) {
  44548. this.dependencies.add(dependency);
  44549. }
  44550. for (let i = 0, ii = opList.length; i < ii; i++) {
  44551. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  44552. }
  44553. }
  44554. getIR() {
  44555. return {
  44556. fnArray: this.fnArray,
  44557. argsArray: this.argsArray,
  44558. length: this.length
  44559. };
  44560. }
  44561. get _transfers() {
  44562. const transfers = [];
  44563. const {
  44564. fnArray,
  44565. argsArray,
  44566. length
  44567. } = this;
  44568. for (let i = 0; i < length; i++) {
  44569. switch (fnArray[i]) {
  44570. case _util.OPS.paintInlineImageXObject:
  44571. case _util.OPS.paintInlineImageXObjectGroup:
  44572. case _util.OPS.paintImageMaskXObject:
  44573. const arg = argsArray[i][0];
  44574. ;
  44575. if (!arg.cached) {
  44576. transfers.push(arg.data.buffer);
  44577. }
  44578. break;
  44579. }
  44580. }
  44581. return transfers;
  44582. }
  44583. flush(lastChunk = false) {
  44584. this.optimizer.flush();
  44585. const length = this.length;
  44586. this._totalLength += length;
  44587. this._streamSink.enqueue({
  44588. fnArray: this.fnArray,
  44589. argsArray: this.argsArray,
  44590. lastChunk,
  44591. length
  44592. }, 1, this._transfers);
  44593. this.dependencies.clear();
  44594. this.fnArray.length = 0;
  44595. this.argsArray.length = 0;
  44596. this.weight = 0;
  44597. this.optimizer.reset();
  44598. }
  44599. }
  44600. exports.OperatorList = OperatorList;
  44601. /***/ }),
  44602. /* 63 */
  44603. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44604. Object.defineProperty(exports, "__esModule", ({
  44605. value: true
  44606. }));
  44607. exports.PDFImage = void 0;
  44608. var _util = __w_pdfjs_require__(2);
  44609. var _primitives = __w_pdfjs_require__(5);
  44610. var _colorspace = __w_pdfjs_require__(14);
  44611. var _decode_stream = __w_pdfjs_require__(19);
  44612. var _jpeg_stream = __w_pdfjs_require__(27);
  44613. var _jpx = __w_pdfjs_require__(30);
  44614. function decodeAndClamp(value, addend, coefficient, max) {
  44615. value = addend + value * coefficient;
  44616. if (value < 0) {
  44617. value = 0;
  44618. } else if (value > max) {
  44619. value = max;
  44620. }
  44621. return value;
  44622. }
  44623. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  44624. const length = w2 * h2;
  44625. let dest;
  44626. if (bpc <= 8) {
  44627. dest = new Uint8Array(length);
  44628. } else if (bpc <= 16) {
  44629. dest = new Uint16Array(length);
  44630. } else {
  44631. dest = new Uint32Array(length);
  44632. }
  44633. const xRatio = w1 / w2;
  44634. const yRatio = h1 / h2;
  44635. let i,
  44636. j,
  44637. py,
  44638. newIndex = 0,
  44639. oldIndex;
  44640. const xScaled = new Uint16Array(w2);
  44641. const w1Scanline = w1;
  44642. for (i = 0; i < w2; i++) {
  44643. xScaled[i] = Math.floor(i * xRatio);
  44644. }
  44645. for (i = 0; i < h2; i++) {
  44646. py = Math.floor(i * yRatio) * w1Scanline;
  44647. for (j = 0; j < w2; j++) {
  44648. oldIndex = py + xScaled[j];
  44649. dest[newIndex++] = src[oldIndex];
  44650. }
  44651. }
  44652. return dest;
  44653. }
  44654. class PDFImage {
  44655. constructor({
  44656. xref,
  44657. res,
  44658. image,
  44659. isInline = false,
  44660. smask = null,
  44661. mask = null,
  44662. isMask = false,
  44663. pdfFunctionFactory,
  44664. localColorSpaceCache
  44665. }) {
  44666. this.image = image;
  44667. const dict = image.dict;
  44668. const filter = dict.get("Filter");
  44669. if ((0, _primitives.isName)(filter)) {
  44670. switch (filter.name) {
  44671. case "JPXDecode":
  44672. const jpxImage = new _jpx.JpxImage();
  44673. jpxImage.parseImageProperties(image.stream);
  44674. image.stream.reset();
  44675. image.width = jpxImage.width;
  44676. image.height = jpxImage.height;
  44677. image.bitsPerComponent = jpxImage.bitsPerComponent;
  44678. image.numComps = jpxImage.componentsCount;
  44679. break;
  44680. case "JBIG2Decode":
  44681. image.bitsPerComponent = 1;
  44682. image.numComps = 1;
  44683. break;
  44684. }
  44685. }
  44686. let width = dict.get("Width", "W");
  44687. let height = dict.get("Height", "H");
  44688. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  44689. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  44690. width = image.width;
  44691. height = image.height;
  44692. }
  44693. if (width < 1 || height < 1) {
  44694. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  44695. }
  44696. this.width = width;
  44697. this.height = height;
  44698. this.interpolate = dict.get("Interpolate", "I") || false;
  44699. this.imageMask = dict.get("ImageMask", "IM") || false;
  44700. this.matte = dict.get("Matte") || false;
  44701. let bitsPerComponent = image.bitsPerComponent;
  44702. if (!bitsPerComponent) {
  44703. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  44704. if (!bitsPerComponent) {
  44705. if (this.imageMask) {
  44706. bitsPerComponent = 1;
  44707. } else {
  44708. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  44709. }
  44710. }
  44711. }
  44712. this.bpc = bitsPerComponent;
  44713. if (!this.imageMask) {
  44714. let colorSpace = dict.getRaw("ColorSpace") || dict.getRaw("CS");
  44715. if (!colorSpace) {
  44716. (0, _util.info)("JPX images (which do not require color spaces)");
  44717. switch (image.numComps) {
  44718. case 1:
  44719. colorSpace = _primitives.Name.get("DeviceGray");
  44720. break;
  44721. case 3:
  44722. colorSpace = _primitives.Name.get("DeviceRGB");
  44723. break;
  44724. case 4:
  44725. colorSpace = _primitives.Name.get("DeviceCMYK");
  44726. break;
  44727. default:
  44728. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  44729. }
  44730. }
  44731. this.colorSpace = _colorspace.ColorSpace.parse({
  44732. cs: colorSpace,
  44733. xref,
  44734. resources: isInline ? res : null,
  44735. pdfFunctionFactory,
  44736. localColorSpaceCache
  44737. });
  44738. this.numComps = this.colorSpace.numComps;
  44739. }
  44740. this.decode = dict.getArray("Decode", "D");
  44741. this.needsDecode = false;
  44742. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  44743. this.needsDecode = true;
  44744. const max = (1 << bitsPerComponent) - 1;
  44745. this.decodeCoefficients = [];
  44746. this.decodeAddends = [];
  44747. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  44748. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  44749. const dmin = this.decode[i];
  44750. const dmax = this.decode[i + 1];
  44751. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  44752. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  44753. }
  44754. }
  44755. if (smask) {
  44756. this.smask = new PDFImage({
  44757. xref,
  44758. res,
  44759. image: smask,
  44760. isInline,
  44761. pdfFunctionFactory,
  44762. localColorSpaceCache
  44763. });
  44764. } else if (mask) {
  44765. if ((0, _primitives.isStream)(mask)) {
  44766. const maskDict = mask.dict,
  44767. imageMask = maskDict.get("ImageMask", "IM");
  44768. if (!imageMask) {
  44769. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  44770. } else {
  44771. this.mask = new PDFImage({
  44772. xref,
  44773. res,
  44774. image: mask,
  44775. isInline,
  44776. isMask: true,
  44777. pdfFunctionFactory,
  44778. localColorSpaceCache
  44779. });
  44780. }
  44781. } else {
  44782. this.mask = mask;
  44783. }
  44784. }
  44785. }
  44786. static async buildImage({
  44787. xref,
  44788. res,
  44789. image,
  44790. isInline = false,
  44791. pdfFunctionFactory,
  44792. localColorSpaceCache
  44793. }) {
  44794. const imageData = image;
  44795. let smaskData = null;
  44796. let maskData = null;
  44797. const smask = image.dict.get("SMask");
  44798. const mask = image.dict.get("Mask");
  44799. if (smask) {
  44800. smaskData = smask;
  44801. } else if (mask) {
  44802. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  44803. maskData = mask;
  44804. } else {
  44805. (0, _util.warn)("Unsupported mask format.");
  44806. }
  44807. }
  44808. return new PDFImage({
  44809. xref,
  44810. res,
  44811. image: imageData,
  44812. isInline,
  44813. smask: smaskData,
  44814. mask: maskData,
  44815. pdfFunctionFactory,
  44816. localColorSpaceCache
  44817. });
  44818. }
  44819. static createMask({
  44820. imgArray,
  44821. width,
  44822. height,
  44823. imageIsFromDecodeStream,
  44824. inverseDecode
  44825. }) {
  44826. const computedLength = (width + 7 >> 3) * height;
  44827. const actualLength = imgArray.byteLength;
  44828. const haveFullData = computedLength === actualLength;
  44829. let data, i;
  44830. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  44831. data = imgArray;
  44832. } else if (!inverseDecode) {
  44833. data = new Uint8ClampedArray(actualLength);
  44834. data.set(imgArray);
  44835. } else {
  44836. data = new Uint8ClampedArray(computedLength);
  44837. data.set(imgArray);
  44838. for (i = actualLength; i < computedLength; i++) {
  44839. data[i] = 0xff;
  44840. }
  44841. }
  44842. if (inverseDecode) {
  44843. for (i = 0; i < actualLength; i++) {
  44844. data[i] ^= 0xff;
  44845. }
  44846. }
  44847. return {
  44848. data,
  44849. width,
  44850. height
  44851. };
  44852. }
  44853. get drawWidth() {
  44854. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  44855. }
  44856. get drawHeight() {
  44857. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  44858. }
  44859. decodeBuffer(buffer) {
  44860. const bpc = this.bpc;
  44861. const numComps = this.numComps;
  44862. const decodeAddends = this.decodeAddends;
  44863. const decodeCoefficients = this.decodeCoefficients;
  44864. const max = (1 << bpc) - 1;
  44865. let i, ii;
  44866. if (bpc === 1) {
  44867. for (i = 0, ii = buffer.length; i < ii; i++) {
  44868. buffer[i] = +!buffer[i];
  44869. }
  44870. return;
  44871. }
  44872. let index = 0;
  44873. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  44874. for (let j = 0; j < numComps; j++) {
  44875. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  44876. index++;
  44877. }
  44878. }
  44879. }
  44880. getComponents(buffer) {
  44881. const bpc = this.bpc;
  44882. if (bpc === 8) {
  44883. return buffer;
  44884. }
  44885. const width = this.width;
  44886. const height = this.height;
  44887. const numComps = this.numComps;
  44888. const length = width * height * numComps;
  44889. let bufferPos = 0;
  44890. let output;
  44891. if (bpc <= 8) {
  44892. output = new Uint8Array(length);
  44893. } else if (bpc <= 16) {
  44894. output = new Uint16Array(length);
  44895. } else {
  44896. output = new Uint32Array(length);
  44897. }
  44898. const rowComps = width * numComps;
  44899. const max = (1 << bpc) - 1;
  44900. let i = 0,
  44901. ii,
  44902. buf;
  44903. if (bpc === 1) {
  44904. let mask, loop1End, loop2End;
  44905. for (let j = 0; j < height; j++) {
  44906. loop1End = i + (rowComps & ~7);
  44907. loop2End = i + rowComps;
  44908. while (i < loop1End) {
  44909. buf = buffer[bufferPos++];
  44910. output[i] = buf >> 7 & 1;
  44911. output[i + 1] = buf >> 6 & 1;
  44912. output[i + 2] = buf >> 5 & 1;
  44913. output[i + 3] = buf >> 4 & 1;
  44914. output[i + 4] = buf >> 3 & 1;
  44915. output[i + 5] = buf >> 2 & 1;
  44916. output[i + 6] = buf >> 1 & 1;
  44917. output[i + 7] = buf & 1;
  44918. i += 8;
  44919. }
  44920. if (i < loop2End) {
  44921. buf = buffer[bufferPos++];
  44922. mask = 128;
  44923. while (i < loop2End) {
  44924. output[i++] = +!!(buf & mask);
  44925. mask >>= 1;
  44926. }
  44927. }
  44928. }
  44929. } else {
  44930. let bits = 0;
  44931. buf = 0;
  44932. for (i = 0, ii = length; i < ii; ++i) {
  44933. if (i % rowComps === 0) {
  44934. buf = 0;
  44935. bits = 0;
  44936. }
  44937. while (bits < bpc) {
  44938. buf = buf << 8 | buffer[bufferPos++];
  44939. bits += 8;
  44940. }
  44941. const remainingBits = bits - bpc;
  44942. let value = buf >> remainingBits;
  44943. if (value < 0) {
  44944. value = 0;
  44945. } else if (value > max) {
  44946. value = max;
  44947. }
  44948. output[i] = value;
  44949. buf &= (1 << remainingBits) - 1;
  44950. bits = remainingBits;
  44951. }
  44952. }
  44953. return output;
  44954. }
  44955. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  44956. const smask = this.smask;
  44957. const mask = this.mask;
  44958. let alphaBuf, sw, sh, i, ii, j;
  44959. if (smask) {
  44960. sw = smask.width;
  44961. sh = smask.height;
  44962. alphaBuf = new Uint8ClampedArray(sw * sh);
  44963. smask.fillGrayBuffer(alphaBuf);
  44964. if (sw !== width || sh !== height) {
  44965. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  44966. }
  44967. } else if (mask) {
  44968. if (mask instanceof PDFImage) {
  44969. sw = mask.width;
  44970. sh = mask.height;
  44971. alphaBuf = new Uint8ClampedArray(sw * sh);
  44972. mask.numComps = 1;
  44973. mask.fillGrayBuffer(alphaBuf);
  44974. for (i = 0, ii = sw * sh; i < ii; ++i) {
  44975. alphaBuf[i] = 255 - alphaBuf[i];
  44976. }
  44977. if (sw !== width || sh !== height) {
  44978. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  44979. }
  44980. } else if (Array.isArray(mask)) {
  44981. alphaBuf = new Uint8ClampedArray(width * height);
  44982. const numComps = this.numComps;
  44983. for (i = 0, ii = width * height; i < ii; ++i) {
  44984. let opacity = 0;
  44985. const imageOffset = i * numComps;
  44986. for (j = 0; j < numComps; ++j) {
  44987. const color = image[imageOffset + j];
  44988. const maskOffset = j * 2;
  44989. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  44990. opacity = 255;
  44991. break;
  44992. }
  44993. }
  44994. alphaBuf[i] = opacity;
  44995. }
  44996. } else {
  44997. throw new _util.FormatError("Unknown mask format.");
  44998. }
  44999. }
  45000. if (alphaBuf) {
  45001. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45002. rgbaBuf[j] = alphaBuf[i];
  45003. }
  45004. } else {
  45005. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45006. rgbaBuf[j] = 255;
  45007. }
  45008. }
  45009. }
  45010. undoPreblend(buffer, width, height) {
  45011. const matte = this.smask && this.smask.matte;
  45012. if (!matte) {
  45013. return;
  45014. }
  45015. const matteRgb = this.colorSpace.getRgb(matte, 0);
  45016. const matteR = matteRgb[0];
  45017. const matteG = matteRgb[1];
  45018. const matteB = matteRgb[2];
  45019. const length = width * height * 4;
  45020. for (let i = 0; i < length; i += 4) {
  45021. const alpha = buffer[i + 3];
  45022. if (alpha === 0) {
  45023. buffer[i] = 255;
  45024. buffer[i + 1] = 255;
  45025. buffer[i + 2] = 255;
  45026. continue;
  45027. }
  45028. const k = 255 / alpha;
  45029. buffer[i] = (buffer[i] - matteR) * k + matteR;
  45030. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  45031. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  45032. }
  45033. }
  45034. createImageData(forceRGBA = false) {
  45035. const drawWidth = this.drawWidth;
  45036. const drawHeight = this.drawHeight;
  45037. const imgData = {
  45038. width: drawWidth,
  45039. height: drawHeight,
  45040. kind: 0,
  45041. data: null
  45042. };
  45043. const numComps = this.numComps;
  45044. const originalWidth = this.width;
  45045. const originalHeight = this.height;
  45046. const bpc = this.bpc;
  45047. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  45048. let imgArray;
  45049. if (!forceRGBA) {
  45050. let kind;
  45051. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  45052. kind = _util.ImageKind.GRAYSCALE_1BPP;
  45053. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  45054. kind = _util.ImageKind.RGB_24BPP;
  45055. }
  45056. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  45057. imgData.kind = kind;
  45058. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45059. if (this.image instanceof _decode_stream.DecodeStream) {
  45060. imgData.data = imgArray;
  45061. } else {
  45062. const newArray = new Uint8ClampedArray(imgArray.length);
  45063. newArray.set(imgArray);
  45064. imgData.data = newArray;
  45065. }
  45066. if (this.needsDecode) {
  45067. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  45068. const buffer = imgData.data;
  45069. for (let i = 0, ii = buffer.length; i < ii; i++) {
  45070. buffer[i] ^= 0xff;
  45071. }
  45072. }
  45073. return imgData;
  45074. }
  45075. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  45076. let imageLength = originalHeight * rowBytes;
  45077. switch (this.colorSpace.name) {
  45078. case "DeviceGray":
  45079. imageLength *= 3;
  45080. case "DeviceRGB":
  45081. case "DeviceCMYK":
  45082. imgData.kind = _util.ImageKind.RGB_24BPP;
  45083. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  45084. return imgData;
  45085. }
  45086. }
  45087. }
  45088. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45089. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  45090. const comps = this.getComponents(imgArray);
  45091. let alpha01, maybeUndoPreblend;
  45092. if (!forceRGBA && !this.smask && !this.mask) {
  45093. imgData.kind = _util.ImageKind.RGB_24BPP;
  45094. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  45095. alpha01 = 0;
  45096. maybeUndoPreblend = false;
  45097. } else {
  45098. imgData.kind = _util.ImageKind.RGBA_32BPP;
  45099. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  45100. alpha01 = 1;
  45101. maybeUndoPreblend = true;
  45102. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  45103. }
  45104. if (this.needsDecode) {
  45105. this.decodeBuffer(comps);
  45106. }
  45107. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  45108. if (maybeUndoPreblend) {
  45109. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  45110. }
  45111. return imgData;
  45112. }
  45113. fillGrayBuffer(buffer) {
  45114. const numComps = this.numComps;
  45115. if (numComps !== 1) {
  45116. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  45117. }
  45118. const width = this.width;
  45119. const height = this.height;
  45120. const bpc = this.bpc;
  45121. const rowBytes = width * numComps * bpc + 7 >> 3;
  45122. const imgArray = this.getImageBytes(height * rowBytes);
  45123. const comps = this.getComponents(imgArray);
  45124. let i, length;
  45125. if (bpc === 1) {
  45126. length = width * height;
  45127. if (this.needsDecode) {
  45128. for (i = 0; i < length; ++i) {
  45129. buffer[i] = comps[i] - 1 & 255;
  45130. }
  45131. } else {
  45132. for (i = 0; i < length; ++i) {
  45133. buffer[i] = -comps[i] & 255;
  45134. }
  45135. }
  45136. return;
  45137. }
  45138. if (this.needsDecode) {
  45139. this.decodeBuffer(comps);
  45140. }
  45141. length = width * height;
  45142. const scale = 255 / ((1 << bpc) - 1);
  45143. for (i = 0; i < length; ++i) {
  45144. buffer[i] = scale * comps[i];
  45145. }
  45146. }
  45147. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  45148. this.image.reset();
  45149. this.image.drawWidth = drawWidth || this.width;
  45150. this.image.drawHeight = drawHeight || this.height;
  45151. this.image.forceRGB = !!forceRGB;
  45152. return this.image.getBytes(length, true);
  45153. }
  45154. }
  45155. exports.PDFImage = PDFImage;
  45156. /***/ }),
  45157. /* 64 */
  45158. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45159. Object.defineProperty(exports, "__esModule", ({
  45160. value: true
  45161. }));
  45162. exports.Catalog = void 0;
  45163. var _primitives = __w_pdfjs_require__(5);
  45164. var _core_utils = __w_pdfjs_require__(9);
  45165. var _util = __w_pdfjs_require__(2);
  45166. var _name_number_tree = __w_pdfjs_require__(65);
  45167. var _colorspace = __w_pdfjs_require__(14);
  45168. var _file_spec = __w_pdfjs_require__(66);
  45169. var _image_utils = __w_pdfjs_require__(52);
  45170. var _metadata_parser = __w_pdfjs_require__(67);
  45171. var _struct_tree = __w_pdfjs_require__(69);
  45172. function fetchDestination(dest) {
  45173. if (dest instanceof _primitives.Dict) {
  45174. dest = dest.get("D");
  45175. }
  45176. return Array.isArray(dest) ? dest : null;
  45177. }
  45178. class Catalog {
  45179. constructor(pdfManager, xref) {
  45180. this.pdfManager = pdfManager;
  45181. this.xref = xref;
  45182. this._catDict = xref.getCatalogObj();
  45183. if (!(0, _primitives.isDict)(this._catDict)) {
  45184. throw new _util.FormatError("Catalog object is not a dictionary.");
  45185. }
  45186. this.fontCache = new _primitives.RefSetCache();
  45187. this.builtInCMapCache = new Map();
  45188. this.standardFontDataCache = new Map();
  45189. this.globalImageCache = new _image_utils.GlobalImageCache();
  45190. this.pageKidsCountCache = new _primitives.RefSetCache();
  45191. this.pageIndexCache = new _primitives.RefSetCache();
  45192. this.nonBlendModesSet = new _primitives.RefSet();
  45193. }
  45194. get version() {
  45195. const version = this._catDict.get("Version");
  45196. if (!(0, _primitives.isName)(version)) {
  45197. return (0, _util.shadow)(this, "version", null);
  45198. }
  45199. return (0, _util.shadow)(this, "version", version.name);
  45200. }
  45201. get collection() {
  45202. let collection = null;
  45203. try {
  45204. const obj = this._catDict.get("Collection");
  45205. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  45206. collection = obj;
  45207. }
  45208. } catch (ex) {
  45209. if (ex instanceof _core_utils.MissingDataException) {
  45210. throw ex;
  45211. }
  45212. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  45213. }
  45214. return (0, _util.shadow)(this, "collection", collection);
  45215. }
  45216. get acroForm() {
  45217. let acroForm = null;
  45218. try {
  45219. const obj = this._catDict.get("AcroForm");
  45220. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  45221. acroForm = obj;
  45222. }
  45223. } catch (ex) {
  45224. if (ex instanceof _core_utils.MissingDataException) {
  45225. throw ex;
  45226. }
  45227. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  45228. }
  45229. return (0, _util.shadow)(this, "acroForm", acroForm);
  45230. }
  45231. get metadata() {
  45232. const streamRef = this._catDict.getRaw("Metadata");
  45233. if (!(0, _primitives.isRef)(streamRef)) {
  45234. return (0, _util.shadow)(this, "metadata", null);
  45235. }
  45236. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  45237. const stream = this.xref.fetch(streamRef, suppressEncryption);
  45238. let metadata = null;
  45239. if ((0, _primitives.isStream)(stream) && (0, _primitives.isDict)(stream.dict)) {
  45240. const type = stream.dict.get("Type");
  45241. const subtype = stream.dict.get("Subtype");
  45242. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  45243. try {
  45244. const data = (0, _util.stringToUTF8String)(stream.getString());
  45245. if (data) {
  45246. metadata = new _metadata_parser.MetadataParser(data).serializable;
  45247. }
  45248. } catch (e) {
  45249. if (e instanceof _core_utils.MissingDataException) {
  45250. throw e;
  45251. }
  45252. (0, _util.info)("Skipping invalid metadata.");
  45253. }
  45254. }
  45255. }
  45256. return (0, _util.shadow)(this, "metadata", metadata);
  45257. }
  45258. get markInfo() {
  45259. let markInfo = null;
  45260. try {
  45261. markInfo = this._readMarkInfo();
  45262. } catch (ex) {
  45263. if (ex instanceof _core_utils.MissingDataException) {
  45264. throw ex;
  45265. }
  45266. (0, _util.warn)("Unable to read mark info.");
  45267. }
  45268. return (0, _util.shadow)(this, "markInfo", markInfo);
  45269. }
  45270. _readMarkInfo() {
  45271. const obj = this._catDict.get("MarkInfo");
  45272. if (!(0, _primitives.isDict)(obj)) {
  45273. return null;
  45274. }
  45275. const markInfo = Object.assign(Object.create(null), {
  45276. Marked: false,
  45277. UserProperties: false,
  45278. Suspects: false
  45279. });
  45280. for (const key in markInfo) {
  45281. if (!obj.has(key)) {
  45282. continue;
  45283. }
  45284. const value = obj.get(key);
  45285. if (!(0, _util.isBool)(value)) {
  45286. continue;
  45287. }
  45288. markInfo[key] = value;
  45289. }
  45290. return markInfo;
  45291. }
  45292. get structTreeRoot() {
  45293. let structTree = null;
  45294. try {
  45295. structTree = this._readStructTreeRoot();
  45296. } catch (ex) {
  45297. if (ex instanceof _core_utils.MissingDataException) {
  45298. throw ex;
  45299. }
  45300. (0, _util.warn)("Unable read to structTreeRoot info.");
  45301. }
  45302. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  45303. }
  45304. _readStructTreeRoot() {
  45305. const obj = this._catDict.get("StructTreeRoot");
  45306. if (!(0, _primitives.isDict)(obj)) {
  45307. return null;
  45308. }
  45309. const root = new _struct_tree.StructTreeRoot(obj);
  45310. root.init();
  45311. return root;
  45312. }
  45313. get toplevelPagesDict() {
  45314. const pagesObj = this._catDict.get("Pages");
  45315. if (!(0, _primitives.isDict)(pagesObj)) {
  45316. throw new _util.FormatError("Invalid top-level pages dictionary.");
  45317. }
  45318. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  45319. }
  45320. get documentOutline() {
  45321. let obj = null;
  45322. try {
  45323. obj = this._readDocumentOutline();
  45324. } catch (ex) {
  45325. if (ex instanceof _core_utils.MissingDataException) {
  45326. throw ex;
  45327. }
  45328. (0, _util.warn)("Unable to read document outline.");
  45329. }
  45330. return (0, _util.shadow)(this, "documentOutline", obj);
  45331. }
  45332. _readDocumentOutline() {
  45333. let obj = this._catDict.get("Outlines");
  45334. if (!(0, _primitives.isDict)(obj)) {
  45335. return null;
  45336. }
  45337. obj = obj.getRaw("First");
  45338. if (!(0, _primitives.isRef)(obj)) {
  45339. return null;
  45340. }
  45341. const root = {
  45342. items: []
  45343. };
  45344. const queue = [{
  45345. obj,
  45346. parent: root
  45347. }];
  45348. const processed = new _primitives.RefSet();
  45349. processed.put(obj);
  45350. const xref = this.xref,
  45351. blackColor = new Uint8ClampedArray(3);
  45352. while (queue.length > 0) {
  45353. const i = queue.shift();
  45354. const outlineDict = xref.fetchIfRef(i.obj);
  45355. if (outlineDict === null) {
  45356. continue;
  45357. }
  45358. if (!outlineDict.has("Title")) {
  45359. throw new _util.FormatError("Invalid outline item encountered.");
  45360. }
  45361. const data = {
  45362. url: null,
  45363. dest: null
  45364. };
  45365. Catalog.parseDestDictionary({
  45366. destDict: outlineDict,
  45367. resultObj: data,
  45368. docBaseUrl: this.pdfManager.docBaseUrl
  45369. });
  45370. const title = outlineDict.get("Title");
  45371. const flags = outlineDict.get("F") || 0;
  45372. const color = outlineDict.getArray("C");
  45373. const count = outlineDict.get("Count");
  45374. let rgbColor = blackColor;
  45375. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  45376. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  45377. }
  45378. const outlineItem = {
  45379. dest: data.dest,
  45380. url: data.url,
  45381. unsafeUrl: data.unsafeUrl,
  45382. newWindow: data.newWindow,
  45383. title: (0, _util.stringToPDFString)(title),
  45384. color: rgbColor,
  45385. count: Number.isInteger(count) ? count : undefined,
  45386. bold: !!(flags & 2),
  45387. italic: !!(flags & 1),
  45388. items: []
  45389. };
  45390. i.parent.items.push(outlineItem);
  45391. obj = outlineDict.getRaw("First");
  45392. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  45393. queue.push({
  45394. obj,
  45395. parent: outlineItem
  45396. });
  45397. processed.put(obj);
  45398. }
  45399. obj = outlineDict.getRaw("Next");
  45400. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  45401. queue.push({
  45402. obj,
  45403. parent: i.parent
  45404. });
  45405. processed.put(obj);
  45406. }
  45407. }
  45408. return root.items.length > 0 ? root.items : null;
  45409. }
  45410. get permissions() {
  45411. let permissions = null;
  45412. try {
  45413. permissions = this._readPermissions();
  45414. } catch (ex) {
  45415. if (ex instanceof _core_utils.MissingDataException) {
  45416. throw ex;
  45417. }
  45418. (0, _util.warn)("Unable to read permissions.");
  45419. }
  45420. return (0, _util.shadow)(this, "permissions", permissions);
  45421. }
  45422. _readPermissions() {
  45423. const encrypt = this.xref.trailer.get("Encrypt");
  45424. if (!(0, _primitives.isDict)(encrypt)) {
  45425. return null;
  45426. }
  45427. let flags = encrypt.get("P");
  45428. if (!(0, _util.isNum)(flags)) {
  45429. return null;
  45430. }
  45431. flags += 2 ** 32;
  45432. const permissions = [];
  45433. for (const key in _util.PermissionFlag) {
  45434. const value = _util.PermissionFlag[key];
  45435. if (flags & value) {
  45436. permissions.push(value);
  45437. }
  45438. }
  45439. return permissions;
  45440. }
  45441. get optionalContentConfig() {
  45442. let config = null;
  45443. try {
  45444. const properties = this._catDict.get("OCProperties");
  45445. if (!properties) {
  45446. return (0, _util.shadow)(this, "optionalContentConfig", null);
  45447. }
  45448. const defaultConfig = properties.get("D");
  45449. if (!defaultConfig) {
  45450. return (0, _util.shadow)(this, "optionalContentConfig", null);
  45451. }
  45452. const groupsData = properties.get("OCGs");
  45453. if (!Array.isArray(groupsData)) {
  45454. return (0, _util.shadow)(this, "optionalContentConfig", null);
  45455. }
  45456. const groups = [];
  45457. const groupRefs = [];
  45458. for (const groupRef of groupsData) {
  45459. if (!(0, _primitives.isRef)(groupRef)) {
  45460. continue;
  45461. }
  45462. groupRefs.push(groupRef);
  45463. const group = this.xref.fetchIfRef(groupRef);
  45464. groups.push({
  45465. id: groupRef.toString(),
  45466. name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  45467. intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  45468. });
  45469. }
  45470. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  45471. config.groups = groups;
  45472. } catch (ex) {
  45473. if (ex instanceof _core_utils.MissingDataException) {
  45474. throw ex;
  45475. }
  45476. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  45477. }
  45478. return (0, _util.shadow)(this, "optionalContentConfig", config);
  45479. }
  45480. _readOptionalContentConfig(config, contentGroupRefs) {
  45481. function parseOnOff(refs) {
  45482. const onParsed = [];
  45483. if (Array.isArray(refs)) {
  45484. for (const value of refs) {
  45485. if (!(0, _primitives.isRef)(value)) {
  45486. continue;
  45487. }
  45488. if (contentGroupRefs.includes(value)) {
  45489. onParsed.push(value.toString());
  45490. }
  45491. }
  45492. }
  45493. return onParsed;
  45494. }
  45495. function parseOrder(refs, nestedLevels = 0) {
  45496. if (!Array.isArray(refs)) {
  45497. return null;
  45498. }
  45499. const order = [];
  45500. for (const value of refs) {
  45501. if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) {
  45502. parsedOrderRefs.put(value);
  45503. order.push(value.toString());
  45504. continue;
  45505. }
  45506. const nestedOrder = parseNestedOrder(value, nestedLevels);
  45507. if (nestedOrder) {
  45508. order.push(nestedOrder);
  45509. }
  45510. }
  45511. if (nestedLevels > 0) {
  45512. return order;
  45513. }
  45514. const hiddenGroups = [];
  45515. for (const groupRef of contentGroupRefs) {
  45516. if (parsedOrderRefs.has(groupRef)) {
  45517. continue;
  45518. }
  45519. hiddenGroups.push(groupRef.toString());
  45520. }
  45521. if (hiddenGroups.length) {
  45522. order.push({
  45523. name: null,
  45524. order: hiddenGroups
  45525. });
  45526. }
  45527. return order;
  45528. }
  45529. function parseNestedOrder(ref, nestedLevels) {
  45530. if (++nestedLevels > MAX_NESTED_LEVELS) {
  45531. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  45532. return null;
  45533. }
  45534. const value = xref.fetchIfRef(ref);
  45535. if (!Array.isArray(value)) {
  45536. return null;
  45537. }
  45538. const nestedName = xref.fetchIfRef(value[0]);
  45539. if (typeof nestedName !== "string") {
  45540. return null;
  45541. }
  45542. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  45543. if (!nestedOrder || !nestedOrder.length) {
  45544. return null;
  45545. }
  45546. return {
  45547. name: (0, _util.stringToPDFString)(nestedName),
  45548. order: nestedOrder
  45549. };
  45550. }
  45551. const xref = this.xref,
  45552. parsedOrderRefs = new _primitives.RefSet(),
  45553. MAX_NESTED_LEVELS = 10;
  45554. return {
  45555. name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  45556. creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  45557. baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null,
  45558. on: parseOnOff(config.get("ON")),
  45559. off: parseOnOff(config.get("OFF")),
  45560. order: parseOrder(config.get("Order")),
  45561. groups: null
  45562. };
  45563. }
  45564. get numPages() {
  45565. const obj = this.toplevelPagesDict.get("Count");
  45566. if (!Number.isInteger(obj)) {
  45567. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  45568. }
  45569. return (0, _util.shadow)(this, "numPages", obj);
  45570. }
  45571. get destinations() {
  45572. const obj = this._readDests(),
  45573. dests = Object.create(null);
  45574. if (obj instanceof _name_number_tree.NameTree) {
  45575. for (const [key, value] of obj.getAll()) {
  45576. const dest = fetchDestination(value);
  45577. if (dest) {
  45578. dests[key] = dest;
  45579. }
  45580. }
  45581. } else if (obj instanceof _primitives.Dict) {
  45582. obj.forEach(function (key, value) {
  45583. const dest = fetchDestination(value);
  45584. if (dest) {
  45585. dests[key] = dest;
  45586. }
  45587. });
  45588. }
  45589. return (0, _util.shadow)(this, "destinations", dests);
  45590. }
  45591. getDestination(id) {
  45592. const obj = this._readDests();
  45593. if (obj instanceof _name_number_tree.NameTree) {
  45594. const dest = fetchDestination(obj.get(id));
  45595. if (dest) {
  45596. return dest;
  45597. }
  45598. const allDest = this.destinations[id];
  45599. if (allDest) {
  45600. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  45601. return allDest;
  45602. }
  45603. } else if (obj instanceof _primitives.Dict) {
  45604. const dest = fetchDestination(obj.get(id));
  45605. if (dest) {
  45606. return dest;
  45607. }
  45608. }
  45609. return null;
  45610. }
  45611. _readDests() {
  45612. const obj = this._catDict.get("Names");
  45613. if (obj && obj.has("Dests")) {
  45614. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  45615. } else if (this._catDict.has("Dests")) {
  45616. return this._catDict.get("Dests");
  45617. }
  45618. return undefined;
  45619. }
  45620. get pageLabels() {
  45621. let obj = null;
  45622. try {
  45623. obj = this._readPageLabels();
  45624. } catch (ex) {
  45625. if (ex instanceof _core_utils.MissingDataException) {
  45626. throw ex;
  45627. }
  45628. (0, _util.warn)("Unable to read page labels.");
  45629. }
  45630. return (0, _util.shadow)(this, "pageLabels", obj);
  45631. }
  45632. _readPageLabels() {
  45633. const obj = this._catDict.getRaw("PageLabels");
  45634. if (!obj) {
  45635. return null;
  45636. }
  45637. const pageLabels = new Array(this.numPages);
  45638. let style = null,
  45639. prefix = "";
  45640. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  45641. const nums = numberTree.getAll();
  45642. let currentLabel = "",
  45643. currentIndex = 1;
  45644. for (let i = 0, ii = this.numPages; i < ii; i++) {
  45645. const labelDict = nums.get(i);
  45646. if (labelDict !== undefined) {
  45647. if (!(0, _primitives.isDict)(labelDict)) {
  45648. throw new _util.FormatError("PageLabel is not a dictionary.");
  45649. }
  45650. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  45651. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  45652. }
  45653. if (labelDict.has("S")) {
  45654. const s = labelDict.get("S");
  45655. if (!(0, _primitives.isName)(s)) {
  45656. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  45657. }
  45658. style = s.name;
  45659. } else {
  45660. style = null;
  45661. }
  45662. if (labelDict.has("P")) {
  45663. const p = labelDict.get("P");
  45664. if (!(0, _util.isString)(p)) {
  45665. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  45666. }
  45667. prefix = (0, _util.stringToPDFString)(p);
  45668. } else {
  45669. prefix = "";
  45670. }
  45671. if (labelDict.has("St")) {
  45672. const st = labelDict.get("St");
  45673. if (!(Number.isInteger(st) && st >= 1)) {
  45674. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  45675. }
  45676. currentIndex = st;
  45677. } else {
  45678. currentIndex = 1;
  45679. }
  45680. }
  45681. switch (style) {
  45682. case "D":
  45683. currentLabel = currentIndex;
  45684. break;
  45685. case "R":
  45686. case "r":
  45687. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  45688. break;
  45689. case "A":
  45690. case "a":
  45691. const LIMIT = 26;
  45692. const A_UPPER_CASE = 0x41,
  45693. A_LOWER_CASE = 0x61;
  45694. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  45695. const letterIndex = currentIndex - 1;
  45696. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  45697. const charBuf = [];
  45698. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  45699. charBuf.push(character);
  45700. }
  45701. currentLabel = charBuf.join("");
  45702. break;
  45703. default:
  45704. if (style) {
  45705. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  45706. }
  45707. currentLabel = "";
  45708. }
  45709. pageLabels[i] = prefix + currentLabel;
  45710. currentIndex++;
  45711. }
  45712. return pageLabels;
  45713. }
  45714. get pageLayout() {
  45715. const obj = this._catDict.get("PageLayout");
  45716. let pageLayout = "";
  45717. if ((0, _primitives.isName)(obj)) {
  45718. switch (obj.name) {
  45719. case "SinglePage":
  45720. case "OneColumn":
  45721. case "TwoColumnLeft":
  45722. case "TwoColumnRight":
  45723. case "TwoPageLeft":
  45724. case "TwoPageRight":
  45725. pageLayout = obj.name;
  45726. }
  45727. }
  45728. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  45729. }
  45730. get pageMode() {
  45731. const obj = this._catDict.get("PageMode");
  45732. let pageMode = "UseNone";
  45733. if ((0, _primitives.isName)(obj)) {
  45734. switch (obj.name) {
  45735. case "UseNone":
  45736. case "UseOutlines":
  45737. case "UseThumbs":
  45738. case "FullScreen":
  45739. case "UseOC":
  45740. case "UseAttachments":
  45741. pageMode = obj.name;
  45742. }
  45743. }
  45744. return (0, _util.shadow)(this, "pageMode", pageMode);
  45745. }
  45746. get viewerPreferences() {
  45747. const ViewerPreferencesValidators = {
  45748. HideToolbar: _util.isBool,
  45749. HideMenubar: _util.isBool,
  45750. HideWindowUI: _util.isBool,
  45751. FitWindow: _util.isBool,
  45752. CenterWindow: _util.isBool,
  45753. DisplayDocTitle: _util.isBool,
  45754. NonFullScreenPageMode: _primitives.isName,
  45755. Direction: _primitives.isName,
  45756. ViewArea: _primitives.isName,
  45757. ViewClip: _primitives.isName,
  45758. PrintArea: _primitives.isName,
  45759. PrintClip: _primitives.isName,
  45760. PrintScaling: _primitives.isName,
  45761. Duplex: _primitives.isName,
  45762. PickTrayByPDFSize: _util.isBool,
  45763. PrintPageRange: Array.isArray,
  45764. NumCopies: Number.isInteger
  45765. };
  45766. const obj = this._catDict.get("ViewerPreferences");
  45767. let prefs = null;
  45768. if ((0, _primitives.isDict)(obj)) {
  45769. for (const key in ViewerPreferencesValidators) {
  45770. if (!obj.has(key)) {
  45771. continue;
  45772. }
  45773. const value = obj.get(key);
  45774. if (!ViewerPreferencesValidators[key](value)) {
  45775. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  45776. continue;
  45777. }
  45778. let prefValue;
  45779. switch (key) {
  45780. case "NonFullScreenPageMode":
  45781. switch (value.name) {
  45782. case "UseNone":
  45783. case "UseOutlines":
  45784. case "UseThumbs":
  45785. case "UseOC":
  45786. prefValue = value.name;
  45787. break;
  45788. default:
  45789. prefValue = "UseNone";
  45790. }
  45791. break;
  45792. case "Direction":
  45793. switch (value.name) {
  45794. case "L2R":
  45795. case "R2L":
  45796. prefValue = value.name;
  45797. break;
  45798. default:
  45799. prefValue = "L2R";
  45800. }
  45801. break;
  45802. case "ViewArea":
  45803. case "ViewClip":
  45804. case "PrintArea":
  45805. case "PrintClip":
  45806. switch (value.name) {
  45807. case "MediaBox":
  45808. case "CropBox":
  45809. case "BleedBox":
  45810. case "TrimBox":
  45811. case "ArtBox":
  45812. prefValue = value.name;
  45813. break;
  45814. default:
  45815. prefValue = "CropBox";
  45816. }
  45817. break;
  45818. case "PrintScaling":
  45819. switch (value.name) {
  45820. case "None":
  45821. case "AppDefault":
  45822. prefValue = value.name;
  45823. break;
  45824. default:
  45825. prefValue = "AppDefault";
  45826. }
  45827. break;
  45828. case "Duplex":
  45829. switch (value.name) {
  45830. case "Simplex":
  45831. case "DuplexFlipShortEdge":
  45832. case "DuplexFlipLongEdge":
  45833. prefValue = value.name;
  45834. break;
  45835. default:
  45836. prefValue = "None";
  45837. }
  45838. break;
  45839. case "PrintPageRange":
  45840. const length = value.length;
  45841. if (length % 2 !== 0) {
  45842. break;
  45843. }
  45844. const isValid = value.every((page, i, arr) => {
  45845. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  45846. });
  45847. if (isValid) {
  45848. prefValue = value;
  45849. }
  45850. break;
  45851. case "NumCopies":
  45852. if (value > 0) {
  45853. prefValue = value;
  45854. }
  45855. break;
  45856. default:
  45857. if (typeof value !== "boolean") {
  45858. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  45859. }
  45860. prefValue = value;
  45861. }
  45862. if (prefValue !== undefined) {
  45863. if (!prefs) {
  45864. prefs = Object.create(null);
  45865. }
  45866. prefs[key] = prefValue;
  45867. } else {
  45868. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  45869. }
  45870. }
  45871. }
  45872. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  45873. }
  45874. get openAction() {
  45875. const obj = this._catDict.get("OpenAction");
  45876. const openAction = Object.create(null);
  45877. if ((0, _primitives.isDict)(obj)) {
  45878. const destDict = new _primitives.Dict(this.xref);
  45879. destDict.set("A", obj);
  45880. const resultObj = {
  45881. url: null,
  45882. dest: null,
  45883. action: null
  45884. };
  45885. Catalog.parseDestDictionary({
  45886. destDict,
  45887. resultObj
  45888. });
  45889. if (Array.isArray(resultObj.dest)) {
  45890. openAction.dest = resultObj.dest;
  45891. } else if (resultObj.action) {
  45892. openAction.action = resultObj.action;
  45893. }
  45894. } else if (Array.isArray(obj)) {
  45895. openAction.dest = obj;
  45896. }
  45897. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  45898. }
  45899. get attachments() {
  45900. const obj = this._catDict.get("Names");
  45901. let attachments = null;
  45902. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  45903. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  45904. for (const [key, value] of nameTree.getAll()) {
  45905. const fs = new _file_spec.FileSpec(value, this.xref);
  45906. if (!attachments) {
  45907. attachments = Object.create(null);
  45908. }
  45909. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  45910. }
  45911. }
  45912. return (0, _util.shadow)(this, "attachments", attachments);
  45913. }
  45914. get xfaImages() {
  45915. const obj = this._catDict.get("Names");
  45916. let xfaImages = null;
  45917. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  45918. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  45919. for (const [key, value] of nameTree.getAll()) {
  45920. if (!xfaImages) {
  45921. xfaImages = new _primitives.Dict(this.xref);
  45922. }
  45923. xfaImages.set(key, value);
  45924. }
  45925. }
  45926. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  45927. }
  45928. _collectJavaScript() {
  45929. const obj = this._catDict.get("Names");
  45930. let javaScript = null;
  45931. function appendIfJavaScriptDict(name, jsDict) {
  45932. if (!(jsDict instanceof _primitives.Dict)) {
  45933. return;
  45934. }
  45935. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  45936. return;
  45937. }
  45938. let js = jsDict.get("JS");
  45939. if ((0, _primitives.isStream)(js)) {
  45940. js = js.getString();
  45941. } else if (typeof js !== "string") {
  45942. return;
  45943. }
  45944. if (javaScript === null) {
  45945. javaScript = new Map();
  45946. }
  45947. javaScript.set(name, (0, _util.stringToPDFString)(js));
  45948. }
  45949. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  45950. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  45951. for (const [key, value] of nameTree.getAll()) {
  45952. appendIfJavaScriptDict(key, value);
  45953. }
  45954. }
  45955. const openAction = this._catDict.get("OpenAction");
  45956. if (openAction) {
  45957. appendIfJavaScriptDict("OpenAction", openAction);
  45958. }
  45959. return javaScript;
  45960. }
  45961. get javaScript() {
  45962. const javaScript = this._collectJavaScript();
  45963. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  45964. }
  45965. get jsActions() {
  45966. const javaScript = this._collectJavaScript();
  45967. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  45968. if (javaScript) {
  45969. if (!actions) {
  45970. actions = Object.create(null);
  45971. }
  45972. for (const [key, val] of javaScript) {
  45973. if (key in actions) {
  45974. actions[key].push(val);
  45975. } else {
  45976. actions[key] = [val];
  45977. }
  45978. }
  45979. }
  45980. return (0, _util.shadow)(this, "jsActions", actions);
  45981. }
  45982. fontFallback(id, handler) {
  45983. const promises = [];
  45984. this.fontCache.forEach(function (promise) {
  45985. promises.push(promise);
  45986. });
  45987. return Promise.all(promises).then(translatedFonts => {
  45988. for (const translatedFont of translatedFonts) {
  45989. if (translatedFont.loadedName === id) {
  45990. translatedFont.fallback(handler);
  45991. return;
  45992. }
  45993. }
  45994. });
  45995. }
  45996. cleanup(manuallyTriggered = false) {
  45997. (0, _primitives.clearPrimitiveCaches)();
  45998. this.globalImageCache.clear(manuallyTriggered);
  45999. this.pageKidsCountCache.clear();
  46000. this.pageIndexCache.clear();
  46001. this.nonBlendModesSet.clear();
  46002. const promises = [];
  46003. this.fontCache.forEach(function (promise) {
  46004. promises.push(promise);
  46005. });
  46006. return Promise.all(promises).then(translatedFonts => {
  46007. for (const {
  46008. dict
  46009. } of translatedFonts) {
  46010. delete dict.cacheKey;
  46011. }
  46012. this.fontCache.clear();
  46013. this.builtInCMapCache.clear();
  46014. this.standardFontDataCache.clear();
  46015. });
  46016. }
  46017. getPageDict(pageIndex) {
  46018. const capability = (0, _util.createPromiseCapability)();
  46019. const nodesToVisit = [this._catDict.getRaw("Pages")];
  46020. const visitedNodes = new _primitives.RefSet();
  46021. const xref = this.xref,
  46022. pageKidsCountCache = this.pageKidsCountCache;
  46023. let count,
  46024. currentPageIndex = 0;
  46025. function next() {
  46026. while (nodesToVisit.length) {
  46027. const currentNode = nodesToVisit.pop();
  46028. if ((0, _primitives.isRef)(currentNode)) {
  46029. count = pageKidsCountCache.get(currentNode);
  46030. if (count > 0 && currentPageIndex + count < pageIndex) {
  46031. currentPageIndex += count;
  46032. continue;
  46033. }
  46034. if (visitedNodes.has(currentNode)) {
  46035. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  46036. return;
  46037. }
  46038. visitedNodes.put(currentNode);
  46039. xref.fetchAsync(currentNode).then(function (obj) {
  46040. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  46041. if (pageIndex === currentPageIndex) {
  46042. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  46043. pageKidsCountCache.put(currentNode, 1);
  46044. }
  46045. capability.resolve([obj, currentNode]);
  46046. } else {
  46047. currentPageIndex++;
  46048. next();
  46049. }
  46050. return;
  46051. }
  46052. nodesToVisit.push(obj);
  46053. next();
  46054. }, capability.reject);
  46055. return;
  46056. }
  46057. if (!(0, _primitives.isDict)(currentNode)) {
  46058. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  46059. return;
  46060. }
  46061. count = currentNode.get("Count");
  46062. if (Number.isInteger(count) && count >= 0) {
  46063. const objId = currentNode.objId;
  46064. if (objId && !pageKidsCountCache.has(objId)) {
  46065. pageKidsCountCache.put(objId, count);
  46066. }
  46067. if (currentPageIndex + count <= pageIndex) {
  46068. currentPageIndex += count;
  46069. continue;
  46070. }
  46071. }
  46072. const kids = currentNode.get("Kids");
  46073. if (!Array.isArray(kids)) {
  46074. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  46075. if (currentPageIndex === pageIndex) {
  46076. capability.resolve([currentNode, null]);
  46077. return;
  46078. }
  46079. currentPageIndex++;
  46080. continue;
  46081. }
  46082. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  46083. return;
  46084. }
  46085. for (let last = kids.length - 1; last >= 0; last--) {
  46086. nodesToVisit.push(kids[last]);
  46087. }
  46088. }
  46089. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  46090. }
  46091. next();
  46092. return capability.promise;
  46093. }
  46094. getPageIndex(pageRef) {
  46095. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  46096. if (cachedPageIndex !== undefined) {
  46097. return Promise.resolve(cachedPageIndex);
  46098. }
  46099. const xref = this.xref;
  46100. function pagesBeforeRef(kidRef) {
  46101. let total = 0,
  46102. parentRef;
  46103. return xref.fetchAsync(kidRef).then(function (node) {
  46104. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  46105. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  46106. }
  46107. if (!node) {
  46108. return null;
  46109. }
  46110. if (!(0, _primitives.isDict)(node)) {
  46111. throw new _util.FormatError("Node must be a dictionary.");
  46112. }
  46113. parentRef = node.getRaw("Parent");
  46114. return node.getAsync("Parent");
  46115. }).then(function (parent) {
  46116. if (!parent) {
  46117. return null;
  46118. }
  46119. if (!(0, _primitives.isDict)(parent)) {
  46120. throw new _util.FormatError("Parent must be a dictionary.");
  46121. }
  46122. return parent.getAsync("Kids");
  46123. }).then(function (kids) {
  46124. if (!kids) {
  46125. return null;
  46126. }
  46127. const kidPromises = [];
  46128. let found = false;
  46129. for (let i = 0, ii = kids.length; i < ii; i++) {
  46130. const kid = kids[i];
  46131. if (!(0, _primitives.isRef)(kid)) {
  46132. throw new _util.FormatError("Kid must be a reference.");
  46133. }
  46134. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  46135. found = true;
  46136. break;
  46137. }
  46138. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  46139. if (!(0, _primitives.isDict)(obj)) {
  46140. throw new _util.FormatError("Kid node must be a dictionary.");
  46141. }
  46142. if (obj.has("Count")) {
  46143. total += obj.get("Count");
  46144. } else {
  46145. total++;
  46146. }
  46147. }));
  46148. }
  46149. if (!found) {
  46150. throw new _util.FormatError("Kid reference not found in parent's kids.");
  46151. }
  46152. return Promise.all(kidPromises).then(function () {
  46153. return [total, parentRef];
  46154. });
  46155. });
  46156. }
  46157. let total = 0;
  46158. const next = ref => pagesBeforeRef(ref).then(args => {
  46159. if (!args) {
  46160. this.pageIndexCache.put(pageRef, total);
  46161. return total;
  46162. }
  46163. const [count, parentRef] = args;
  46164. total += count;
  46165. return next(parentRef);
  46166. });
  46167. return next(pageRef);
  46168. }
  46169. static parseDestDictionary(params) {
  46170. function addDefaultProtocolToUrl(url) {
  46171. return url.startsWith("www.") ? `http://${url}` : url;
  46172. }
  46173. function tryConvertUrlEncoding(url) {
  46174. try {
  46175. return (0, _util.stringToUTF8String)(url);
  46176. } catch (e) {
  46177. return url;
  46178. }
  46179. }
  46180. const destDict = params.destDict;
  46181. if (!(0, _primitives.isDict)(destDict)) {
  46182. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  46183. return;
  46184. }
  46185. const resultObj = params.resultObj;
  46186. if (typeof resultObj !== "object") {
  46187. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  46188. return;
  46189. }
  46190. const docBaseUrl = params.docBaseUrl || null;
  46191. let action = destDict.get("A"),
  46192. url,
  46193. dest;
  46194. if (!(0, _primitives.isDict)(action)) {
  46195. if (destDict.has("Dest")) {
  46196. action = destDict.get("Dest");
  46197. } else {
  46198. action = destDict.get("AA");
  46199. if ((0, _primitives.isDict)(action)) {
  46200. if (action.has("D")) {
  46201. action = action.get("D");
  46202. } else if (action.has("U")) {
  46203. action = action.get("U");
  46204. }
  46205. }
  46206. }
  46207. }
  46208. if ((0, _primitives.isDict)(action)) {
  46209. const actionType = action.get("S");
  46210. if (!(0, _primitives.isName)(actionType)) {
  46211. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  46212. return;
  46213. }
  46214. const actionName = actionType.name;
  46215. switch (actionName) {
  46216. case "URI":
  46217. url = action.get("URI");
  46218. if ((0, _primitives.isName)(url)) {
  46219. url = "/" + url.name;
  46220. } else if ((0, _util.isString)(url)) {
  46221. url = addDefaultProtocolToUrl(url);
  46222. }
  46223. break;
  46224. case "GoTo":
  46225. dest = action.get("D");
  46226. break;
  46227. case "Launch":
  46228. case "GoToR":
  46229. const urlDict = action.get("F");
  46230. if ((0, _primitives.isDict)(urlDict)) {
  46231. url = urlDict.get("F") || null;
  46232. } else if ((0, _util.isString)(urlDict)) {
  46233. url = urlDict;
  46234. }
  46235. let remoteDest = action.get("D");
  46236. if (remoteDest) {
  46237. if ((0, _primitives.isName)(remoteDest)) {
  46238. remoteDest = remoteDest.name;
  46239. }
  46240. if ((0, _util.isString)(url)) {
  46241. const baseUrl = url.split("#")[0];
  46242. if ((0, _util.isString)(remoteDest)) {
  46243. url = baseUrl + "#" + remoteDest;
  46244. } else if (Array.isArray(remoteDest)) {
  46245. url = baseUrl + "#" + JSON.stringify(remoteDest);
  46246. }
  46247. }
  46248. }
  46249. const newWindow = action.get("NewWindow");
  46250. if ((0, _util.isBool)(newWindow)) {
  46251. resultObj.newWindow = newWindow;
  46252. }
  46253. break;
  46254. case "Named":
  46255. const namedAction = action.get("N");
  46256. if ((0, _primitives.isName)(namedAction)) {
  46257. resultObj.action = namedAction.name;
  46258. }
  46259. break;
  46260. case "JavaScript":
  46261. const jsAction = action.get("JS");
  46262. let js;
  46263. if ((0, _primitives.isStream)(jsAction)) {
  46264. js = jsAction.getString();
  46265. } else if ((0, _util.isString)(jsAction)) {
  46266. js = jsAction;
  46267. }
  46268. if (js) {
  46269. const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
  46270. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  46271. const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  46272. if (jsUrl && jsUrl[2]) {
  46273. url = jsUrl[2];
  46274. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  46275. resultObj.newWindow = true;
  46276. }
  46277. break;
  46278. }
  46279. }
  46280. default:
  46281. if (actionName === "JavaScript" || actionName === "ResetForm" || actionName === "SubmitForm") {
  46282. break;
  46283. }
  46284. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  46285. break;
  46286. }
  46287. } else if (destDict.has("Dest")) {
  46288. dest = destDict.get("Dest");
  46289. }
  46290. if ((0, _util.isString)(url)) {
  46291. url = tryConvertUrlEncoding(url);
  46292. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  46293. if (absoluteUrl) {
  46294. resultObj.url = absoluteUrl.href;
  46295. }
  46296. resultObj.unsafeUrl = url;
  46297. }
  46298. if (dest) {
  46299. if ((0, _primitives.isName)(dest)) {
  46300. dest = dest.name;
  46301. }
  46302. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  46303. resultObj.dest = dest;
  46304. }
  46305. }
  46306. }
  46307. }
  46308. exports.Catalog = Catalog;
  46309. /***/ }),
  46310. /* 65 */
  46311. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46312. Object.defineProperty(exports, "__esModule", ({
  46313. value: true
  46314. }));
  46315. exports.NumberTree = exports.NameTree = void 0;
  46316. var _util = __w_pdfjs_require__(2);
  46317. var _primitives = __w_pdfjs_require__(5);
  46318. class NameOrNumberTree {
  46319. constructor(root, xref, type) {
  46320. if (this.constructor === NameOrNumberTree) {
  46321. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  46322. }
  46323. this.root = root;
  46324. this.xref = xref;
  46325. this._type = type;
  46326. }
  46327. getAll() {
  46328. const map = new Map();
  46329. if (!this.root) {
  46330. return map;
  46331. }
  46332. const xref = this.xref;
  46333. const processed = new _primitives.RefSet();
  46334. processed.put(this.root);
  46335. const queue = [this.root];
  46336. while (queue.length > 0) {
  46337. const obj = xref.fetchIfRef(queue.shift());
  46338. if (!(0, _primitives.isDict)(obj)) {
  46339. continue;
  46340. }
  46341. if (obj.has("Kids")) {
  46342. const kids = obj.get("Kids");
  46343. for (let i = 0, ii = kids.length; i < ii; i++) {
  46344. const kid = kids[i];
  46345. if (processed.has(kid)) {
  46346. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  46347. }
  46348. queue.push(kid);
  46349. processed.put(kid);
  46350. }
  46351. continue;
  46352. }
  46353. const entries = obj.get(this._type);
  46354. if (!Array.isArray(entries)) {
  46355. continue;
  46356. }
  46357. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  46358. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  46359. }
  46360. }
  46361. return map;
  46362. }
  46363. get(key) {
  46364. if (!this.root) {
  46365. return null;
  46366. }
  46367. const xref = this.xref;
  46368. let kidsOrEntries = xref.fetchIfRef(this.root);
  46369. let loopCount = 0;
  46370. const MAX_LEVELS = 10;
  46371. while (kidsOrEntries.has("Kids")) {
  46372. if (++loopCount > MAX_LEVELS) {
  46373. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  46374. return null;
  46375. }
  46376. const kids = kidsOrEntries.get("Kids");
  46377. if (!Array.isArray(kids)) {
  46378. return null;
  46379. }
  46380. let l = 0,
  46381. r = kids.length - 1;
  46382. while (l <= r) {
  46383. const m = l + r >> 1;
  46384. const kid = xref.fetchIfRef(kids[m]);
  46385. const limits = kid.get("Limits");
  46386. if (key < xref.fetchIfRef(limits[0])) {
  46387. r = m - 1;
  46388. } else if (key > xref.fetchIfRef(limits[1])) {
  46389. l = m + 1;
  46390. } else {
  46391. kidsOrEntries = xref.fetchIfRef(kids[m]);
  46392. break;
  46393. }
  46394. }
  46395. if (l > r) {
  46396. return null;
  46397. }
  46398. }
  46399. const entries = kidsOrEntries.get(this._type);
  46400. if (Array.isArray(entries)) {
  46401. let l = 0,
  46402. r = entries.length - 2;
  46403. while (l <= r) {
  46404. const tmp = l + r >> 1,
  46405. m = tmp + (tmp & 1);
  46406. const currentKey = xref.fetchIfRef(entries[m]);
  46407. if (key < currentKey) {
  46408. r = m - 2;
  46409. } else if (key > currentKey) {
  46410. l = m + 2;
  46411. } else {
  46412. return xref.fetchIfRef(entries[m + 1]);
  46413. }
  46414. }
  46415. }
  46416. return null;
  46417. }
  46418. }
  46419. class NameTree extends NameOrNumberTree {
  46420. constructor(root, xref) {
  46421. super(root, xref, "Names");
  46422. }
  46423. }
  46424. exports.NameTree = NameTree;
  46425. class NumberTree extends NameOrNumberTree {
  46426. constructor(root, xref) {
  46427. super(root, xref, "Nums");
  46428. }
  46429. }
  46430. exports.NumberTree = NumberTree;
  46431. /***/ }),
  46432. /* 66 */
  46433. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46434. Object.defineProperty(exports, "__esModule", ({
  46435. value: true
  46436. }));
  46437. exports.FileSpec = void 0;
  46438. var _primitives = __w_pdfjs_require__(5);
  46439. var _util = __w_pdfjs_require__(2);
  46440. function pickPlatformItem(dict) {
  46441. if (dict.has("UF")) {
  46442. return dict.get("UF");
  46443. } else if (dict.has("F")) {
  46444. return dict.get("F");
  46445. } else if (dict.has("Unix")) {
  46446. return dict.get("Unix");
  46447. } else if (dict.has("Mac")) {
  46448. return dict.get("Mac");
  46449. } else if (dict.has("DOS")) {
  46450. return dict.get("DOS");
  46451. }
  46452. return null;
  46453. }
  46454. class FileSpec {
  46455. constructor(root, xref) {
  46456. if (!root || !(0, _primitives.isDict)(root)) {
  46457. return;
  46458. }
  46459. this.xref = xref;
  46460. this.root = root;
  46461. if (root.has("FS")) {
  46462. this.fs = root.get("FS");
  46463. }
  46464. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  46465. if (root.has("RF")) {
  46466. (0, _util.warn)("Related file specifications are not supported");
  46467. }
  46468. this.contentAvailable = true;
  46469. if (!root.has("EF")) {
  46470. this.contentAvailable = false;
  46471. (0, _util.warn)("Non-embedded file specifications are not supported");
  46472. }
  46473. }
  46474. get filename() {
  46475. if (!this._filename && this.root) {
  46476. const filename = pickPlatformItem(this.root) || "unnamed";
  46477. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  46478. }
  46479. return this._filename;
  46480. }
  46481. get content() {
  46482. if (!this.contentAvailable) {
  46483. return null;
  46484. }
  46485. if (!this.contentRef && this.root) {
  46486. this.contentRef = pickPlatformItem(this.root.get("EF"));
  46487. }
  46488. let content = null;
  46489. if (this.contentRef) {
  46490. const fileObj = this.xref.fetchIfRef(this.contentRef);
  46491. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  46492. content = fileObj.getBytes();
  46493. } else {
  46494. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  46495. }
  46496. } else {
  46497. (0, _util.warn)("Embedded file specification does not have a content");
  46498. }
  46499. return content;
  46500. }
  46501. get serializable() {
  46502. return {
  46503. filename: this.filename,
  46504. content: this.content
  46505. };
  46506. }
  46507. }
  46508. exports.FileSpec = FileSpec;
  46509. /***/ }),
  46510. /* 67 */
  46511. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46512. Object.defineProperty(exports, "__esModule", ({
  46513. value: true
  46514. }));
  46515. exports.MetadataParser = void 0;
  46516. var _xml_parser = __w_pdfjs_require__(68);
  46517. class MetadataParser {
  46518. constructor(data) {
  46519. data = this._repair(data);
  46520. const parser = new _xml_parser.SimpleXMLParser({
  46521. lowerCaseName: true
  46522. });
  46523. const xmlDocument = parser.parseFromString(data);
  46524. this._metadataMap = new Map();
  46525. this._data = data;
  46526. if (xmlDocument) {
  46527. this._parse(xmlDocument);
  46528. }
  46529. }
  46530. _repair(data) {
  46531. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  46532. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  46533. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  46534. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  46535. switch (name) {
  46536. case "amp":
  46537. return "&";
  46538. case "apos":
  46539. return "'";
  46540. case "gt":
  46541. return ">";
  46542. case "lt":
  46543. return "<";
  46544. case "quot":
  46545. return '"';
  46546. }
  46547. throw new Error(`_repair: ${name} isn't defined.`);
  46548. });
  46549. const charBuf = [];
  46550. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  46551. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  46552. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  46553. charBuf.push(String.fromCharCode(code));
  46554. } else {
  46555. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  46556. }
  46557. }
  46558. return ">" + charBuf.join("");
  46559. });
  46560. }
  46561. _getSequence(entry) {
  46562. const name = entry.nodeName;
  46563. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  46564. return null;
  46565. }
  46566. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  46567. }
  46568. _parseArray(entry) {
  46569. if (!entry.hasChildNodes()) {
  46570. return;
  46571. }
  46572. const [seqNode] = entry.childNodes;
  46573. const sequence = this._getSequence(seqNode) || [];
  46574. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  46575. }
  46576. _parse(xmlDocument) {
  46577. let rdf = xmlDocument.documentElement;
  46578. if (rdf.nodeName !== "rdf:rdf") {
  46579. rdf = rdf.firstChild;
  46580. while (rdf && rdf.nodeName !== "rdf:rdf") {
  46581. rdf = rdf.nextSibling;
  46582. }
  46583. }
  46584. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  46585. return;
  46586. }
  46587. for (const desc of rdf.childNodes) {
  46588. if (desc.nodeName !== "rdf:description") {
  46589. continue;
  46590. }
  46591. for (const entry of desc.childNodes) {
  46592. const name = entry.nodeName;
  46593. switch (name) {
  46594. case "#text":
  46595. continue;
  46596. case "dc:creator":
  46597. case "dc:subject":
  46598. this._parseArray(entry);
  46599. continue;
  46600. }
  46601. this._metadataMap.set(name, entry.textContent.trim());
  46602. }
  46603. }
  46604. }
  46605. get serializable() {
  46606. return {
  46607. parsedData: this._metadataMap,
  46608. rawData: this._data
  46609. };
  46610. }
  46611. }
  46612. exports.MetadataParser = MetadataParser;
  46613. /***/ }),
  46614. /* 68 */
  46615. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46616. Object.defineProperty(exports, "__esModule", ({
  46617. value: true
  46618. }));
  46619. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  46620. var _core_utils = __w_pdfjs_require__(9);
  46621. const XMLParserErrorCode = {
  46622. NoError: 0,
  46623. EndOfDocument: -1,
  46624. UnterminatedCdat: -2,
  46625. UnterminatedXmlDeclaration: -3,
  46626. UnterminatedDoctypeDeclaration: -4,
  46627. UnterminatedComment: -5,
  46628. MalformedElement: -6,
  46629. OutOfMemory: -7,
  46630. UnterminatedAttributeValue: -8,
  46631. UnterminatedElement: -9,
  46632. ElementNeverBegun: -10
  46633. };
  46634. exports.XMLParserErrorCode = XMLParserErrorCode;
  46635. function isWhitespace(s, index) {
  46636. const ch = s[index];
  46637. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  46638. }
  46639. function isWhitespaceString(s) {
  46640. for (let i = 0, ii = s.length; i < ii; i++) {
  46641. if (!isWhitespace(s, i)) {
  46642. return false;
  46643. }
  46644. }
  46645. return true;
  46646. }
  46647. class XMLParserBase {
  46648. _resolveEntities(s) {
  46649. return s.replace(/&([^;]+);/g, (all, entity) => {
  46650. if (entity.substring(0, 2) === "#x") {
  46651. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  46652. } else if (entity.substring(0, 1) === "#") {
  46653. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  46654. }
  46655. switch (entity) {
  46656. case "lt":
  46657. return "<";
  46658. case "gt":
  46659. return ">";
  46660. case "amp":
  46661. return "&";
  46662. case "quot":
  46663. return '"';
  46664. case "apos":
  46665. return "'";
  46666. }
  46667. return this.onResolveEntity(entity);
  46668. });
  46669. }
  46670. _parseContent(s, start) {
  46671. const attributes = [];
  46672. let pos = start;
  46673. function skipWs() {
  46674. while (pos < s.length && isWhitespace(s, pos)) {
  46675. ++pos;
  46676. }
  46677. }
  46678. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  46679. ++pos;
  46680. }
  46681. const name = s.substring(start, pos);
  46682. skipWs();
  46683. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  46684. skipWs();
  46685. let attrName = "",
  46686. attrValue = "";
  46687. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  46688. attrName += s[pos];
  46689. ++pos;
  46690. }
  46691. skipWs();
  46692. if (s[pos] !== "=") {
  46693. return null;
  46694. }
  46695. ++pos;
  46696. skipWs();
  46697. const attrEndChar = s[pos];
  46698. if (attrEndChar !== '"' && attrEndChar !== "'") {
  46699. return null;
  46700. }
  46701. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  46702. if (attrEndIndex < 0) {
  46703. return null;
  46704. }
  46705. attrValue = s.substring(pos, attrEndIndex);
  46706. attributes.push({
  46707. name: attrName,
  46708. value: this._resolveEntities(attrValue)
  46709. });
  46710. pos = attrEndIndex + 1;
  46711. skipWs();
  46712. }
  46713. return {
  46714. name,
  46715. attributes,
  46716. parsed: pos - start
  46717. };
  46718. }
  46719. _parseProcessingInstruction(s, start) {
  46720. let pos = start;
  46721. function skipWs() {
  46722. while (pos < s.length && isWhitespace(s, pos)) {
  46723. ++pos;
  46724. }
  46725. }
  46726. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  46727. ++pos;
  46728. }
  46729. const name = s.substring(start, pos);
  46730. skipWs();
  46731. const attrStart = pos;
  46732. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  46733. ++pos;
  46734. }
  46735. const value = s.substring(attrStart, pos);
  46736. return {
  46737. name,
  46738. value,
  46739. parsed: pos - start
  46740. };
  46741. }
  46742. parseXml(s) {
  46743. let i = 0;
  46744. while (i < s.length) {
  46745. const ch = s[i];
  46746. let j = i;
  46747. if (ch === "<") {
  46748. ++j;
  46749. const ch2 = s[j];
  46750. let q;
  46751. switch (ch2) {
  46752. case "/":
  46753. ++j;
  46754. q = s.indexOf(">", j);
  46755. if (q < 0) {
  46756. this.onError(XMLParserErrorCode.UnterminatedElement);
  46757. return;
  46758. }
  46759. this.onEndElement(s.substring(j, q));
  46760. j = q + 1;
  46761. break;
  46762. case "?":
  46763. ++j;
  46764. const pi = this._parseProcessingInstruction(s, j);
  46765. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  46766. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  46767. return;
  46768. }
  46769. this.onPi(pi.name, pi.value);
  46770. j += pi.parsed + 2;
  46771. break;
  46772. case "!":
  46773. if (s.substring(j + 1, j + 3) === "--") {
  46774. q = s.indexOf("-->", j + 3);
  46775. if (q < 0) {
  46776. this.onError(XMLParserErrorCode.UnterminatedComment);
  46777. return;
  46778. }
  46779. this.onComment(s.substring(j + 3, q));
  46780. j = q + 3;
  46781. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  46782. q = s.indexOf("]]>", j + 8);
  46783. if (q < 0) {
  46784. this.onError(XMLParserErrorCode.UnterminatedCdat);
  46785. return;
  46786. }
  46787. this.onCdata(s.substring(j + 8, q));
  46788. j = q + 3;
  46789. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  46790. const q2 = s.indexOf("[", j + 8);
  46791. let complexDoctype = false;
  46792. q = s.indexOf(">", j + 8);
  46793. if (q < 0) {
  46794. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  46795. return;
  46796. }
  46797. if (q2 > 0 && q > q2) {
  46798. q = s.indexOf("]>", j + 8);
  46799. if (q < 0) {
  46800. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  46801. return;
  46802. }
  46803. complexDoctype = true;
  46804. }
  46805. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  46806. this.onDoctype(doctypeContent);
  46807. j = q + (complexDoctype ? 2 : 1);
  46808. } else {
  46809. this.onError(XMLParserErrorCode.MalformedElement);
  46810. return;
  46811. }
  46812. break;
  46813. default:
  46814. const content = this._parseContent(s, j);
  46815. if (content === null) {
  46816. this.onError(XMLParserErrorCode.MalformedElement);
  46817. return;
  46818. }
  46819. let isClosed = false;
  46820. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  46821. isClosed = true;
  46822. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  46823. this.onError(XMLParserErrorCode.UnterminatedElement);
  46824. return;
  46825. }
  46826. this.onBeginElement(content.name, content.attributes, isClosed);
  46827. j += content.parsed + (isClosed ? 2 : 1);
  46828. break;
  46829. }
  46830. } else {
  46831. while (j < s.length && s[j] !== "<") {
  46832. j++;
  46833. }
  46834. const text = s.substring(i, j);
  46835. this.onText(this._resolveEntities(text));
  46836. }
  46837. i = j;
  46838. }
  46839. }
  46840. onResolveEntity(name) {
  46841. return `&${name};`;
  46842. }
  46843. onPi(name, value) {}
  46844. onComment(text) {}
  46845. onCdata(text) {}
  46846. onDoctype(doctypeContent) {}
  46847. onText(text) {}
  46848. onBeginElement(name, attributes, isEmpty) {}
  46849. onEndElement(name) {}
  46850. onError(code) {}
  46851. }
  46852. exports.XMLParserBase = XMLParserBase;
  46853. class SimpleDOMNode {
  46854. constructor(nodeName, nodeValue) {
  46855. this.nodeName = nodeName;
  46856. this.nodeValue = nodeValue;
  46857. Object.defineProperty(this, "parentNode", {
  46858. value: null,
  46859. writable: true
  46860. });
  46861. }
  46862. get firstChild() {
  46863. return this.childNodes && this.childNodes[0];
  46864. }
  46865. get nextSibling() {
  46866. const childNodes = this.parentNode.childNodes;
  46867. if (!childNodes) {
  46868. return undefined;
  46869. }
  46870. const index = childNodes.indexOf(this);
  46871. if (index === -1) {
  46872. return undefined;
  46873. }
  46874. return childNodes[index + 1];
  46875. }
  46876. get textContent() {
  46877. if (!this.childNodes) {
  46878. return this.nodeValue || "";
  46879. }
  46880. return this.childNodes.map(function (child) {
  46881. return child.textContent;
  46882. }).join("");
  46883. }
  46884. hasChildNodes() {
  46885. return this.childNodes && this.childNodes.length > 0;
  46886. }
  46887. searchNode(paths, pos) {
  46888. if (pos >= paths.length) {
  46889. return this;
  46890. }
  46891. const component = paths[pos];
  46892. const stack = [];
  46893. let node = this;
  46894. while (true) {
  46895. if (component.name === node.nodeName) {
  46896. if (component.pos === 0) {
  46897. const res = node.searchNode(paths, pos + 1);
  46898. if (res !== null) {
  46899. return res;
  46900. }
  46901. } else if (stack.length === 0) {
  46902. return null;
  46903. } else {
  46904. const [parent] = stack.pop();
  46905. let siblingPos = 0;
  46906. for (const child of parent.childNodes) {
  46907. if (component.name === child.nodeName) {
  46908. if (siblingPos === component.pos) {
  46909. return child.searchNode(paths, pos + 1);
  46910. }
  46911. siblingPos++;
  46912. }
  46913. }
  46914. return node.searchNode(paths, pos + 1);
  46915. }
  46916. }
  46917. if (node.childNodes && node.childNodes.length !== 0) {
  46918. stack.push([node, 0]);
  46919. node = node.childNodes[0];
  46920. } else if (stack.length === 0) {
  46921. return null;
  46922. } else {
  46923. while (stack.length !== 0) {
  46924. const [parent, currentPos] = stack.pop();
  46925. const newPos = currentPos + 1;
  46926. if (newPos < parent.childNodes.length) {
  46927. stack.push([parent, newPos]);
  46928. node = parent.childNodes[newPos];
  46929. break;
  46930. }
  46931. }
  46932. if (stack.length === 0) {
  46933. return null;
  46934. }
  46935. }
  46936. }
  46937. }
  46938. dump(buffer) {
  46939. if (this.nodeName === "#text") {
  46940. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  46941. return;
  46942. }
  46943. buffer.push(`<${this.nodeName}`);
  46944. if (this.attributes) {
  46945. for (const attribute of this.attributes) {
  46946. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  46947. }
  46948. }
  46949. if (this.hasChildNodes()) {
  46950. buffer.push(">");
  46951. for (const child of this.childNodes) {
  46952. child.dump(buffer);
  46953. }
  46954. buffer.push(`</${this.nodeName}>`);
  46955. } else if (this.nodeValue) {
  46956. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  46957. } else {
  46958. buffer.push("/>");
  46959. }
  46960. }
  46961. }
  46962. exports.SimpleDOMNode = SimpleDOMNode;
  46963. class SimpleXMLParser extends XMLParserBase {
  46964. constructor({
  46965. hasAttributes = false,
  46966. lowerCaseName = false
  46967. }) {
  46968. super();
  46969. this._currentFragment = null;
  46970. this._stack = null;
  46971. this._errorCode = XMLParserErrorCode.NoError;
  46972. this._hasAttributes = hasAttributes;
  46973. this._lowerCaseName = lowerCaseName;
  46974. }
  46975. parseFromString(data) {
  46976. this._currentFragment = [];
  46977. this._stack = [];
  46978. this._errorCode = XMLParserErrorCode.NoError;
  46979. this.parseXml(data);
  46980. if (this._errorCode !== XMLParserErrorCode.NoError) {
  46981. return undefined;
  46982. }
  46983. const [documentElement] = this._currentFragment;
  46984. if (!documentElement) {
  46985. return undefined;
  46986. }
  46987. return {
  46988. documentElement
  46989. };
  46990. }
  46991. onText(text) {
  46992. if (isWhitespaceString(text)) {
  46993. return;
  46994. }
  46995. const node = new SimpleDOMNode("#text", text);
  46996. this._currentFragment.push(node);
  46997. }
  46998. onCdata(text) {
  46999. const node = new SimpleDOMNode("#text", text);
  47000. this._currentFragment.push(node);
  47001. }
  47002. onBeginElement(name, attributes, isEmpty) {
  47003. if (this._lowerCaseName) {
  47004. name = name.toLowerCase();
  47005. }
  47006. const node = new SimpleDOMNode(name);
  47007. node.childNodes = [];
  47008. if (this._hasAttributes) {
  47009. node.attributes = attributes;
  47010. }
  47011. this._currentFragment.push(node);
  47012. if (isEmpty) {
  47013. return;
  47014. }
  47015. this._stack.push(this._currentFragment);
  47016. this._currentFragment = node.childNodes;
  47017. }
  47018. onEndElement(name) {
  47019. this._currentFragment = this._stack.pop() || [];
  47020. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  47021. if (!lastElement) {
  47022. return;
  47023. }
  47024. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  47025. lastElement.childNodes[i].parentNode = lastElement;
  47026. }
  47027. }
  47028. onError(code) {
  47029. this._errorCode = code;
  47030. }
  47031. }
  47032. exports.SimpleXMLParser = SimpleXMLParser;
  47033. /***/ }),
  47034. /* 69 */
  47035. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47036. Object.defineProperty(exports, "__esModule", ({
  47037. value: true
  47038. }));
  47039. exports.StructTreeRoot = exports.StructTreePage = void 0;
  47040. var _primitives = __w_pdfjs_require__(5);
  47041. var _util = __w_pdfjs_require__(2);
  47042. var _name_number_tree = __w_pdfjs_require__(65);
  47043. const MAX_DEPTH = 40;
  47044. const StructElementType = {
  47045. PAGE_CONTENT: "PAGE_CONTENT",
  47046. STREAM_CONTENT: "STREAM_CONTENT",
  47047. OBJECT: "OBJECT",
  47048. ELEMENT: "ELEMENT"
  47049. };
  47050. class StructTreeRoot {
  47051. constructor(rootDict) {
  47052. this.dict = rootDict;
  47053. this.roleMap = new Map();
  47054. }
  47055. init() {
  47056. this.readRoleMap();
  47057. }
  47058. readRoleMap() {
  47059. const roleMapDict = this.dict.get("RoleMap");
  47060. if (!(0, _primitives.isDict)(roleMapDict)) {
  47061. return;
  47062. }
  47063. roleMapDict.forEach((key, value) => {
  47064. if (!(0, _primitives.isName)(value)) {
  47065. return;
  47066. }
  47067. this.roleMap.set(key, value.name);
  47068. });
  47069. }
  47070. }
  47071. exports.StructTreeRoot = StructTreeRoot;
  47072. class StructElementNode {
  47073. constructor(tree, dict) {
  47074. this.tree = tree;
  47075. this.dict = dict;
  47076. this.kids = [];
  47077. this.parseKids();
  47078. }
  47079. get role() {
  47080. const nameObj = this.dict.get("S");
  47081. const name = (0, _primitives.isName)(nameObj) ? nameObj.name : "";
  47082. const {
  47083. root
  47084. } = this.tree;
  47085. if (root.roleMap.has(name)) {
  47086. return root.roleMap.get(name);
  47087. }
  47088. return name;
  47089. }
  47090. parseKids() {
  47091. let pageObjId = null;
  47092. const objRef = this.dict.getRaw("Pg");
  47093. if ((0, _primitives.isRef)(objRef)) {
  47094. pageObjId = objRef.toString();
  47095. }
  47096. const kids = this.dict.get("K");
  47097. if (Array.isArray(kids)) {
  47098. for (const kid of kids) {
  47099. const element = this.parseKid(pageObjId, kid);
  47100. if (element) {
  47101. this.kids.push(element);
  47102. }
  47103. }
  47104. } else {
  47105. const element = this.parseKid(pageObjId, kids);
  47106. if (element) {
  47107. this.kids.push(element);
  47108. }
  47109. }
  47110. }
  47111. parseKid(pageObjId, kid) {
  47112. if (Number.isInteger(kid)) {
  47113. if (this.tree.pageDict.objId !== pageObjId) {
  47114. return null;
  47115. }
  47116. return new StructElement({
  47117. type: StructElementType.PAGE_CONTENT,
  47118. mcid: kid,
  47119. pageObjId
  47120. });
  47121. }
  47122. let kidDict = null;
  47123. if ((0, _primitives.isRef)(kid)) {
  47124. kidDict = this.dict.xref.fetch(kid);
  47125. } else if ((0, _primitives.isDict)(kid)) {
  47126. kidDict = kid;
  47127. }
  47128. if (!kidDict) {
  47129. return null;
  47130. }
  47131. const pageRef = kidDict.getRaw("Pg");
  47132. if ((0, _primitives.isRef)(pageRef)) {
  47133. pageObjId = pageRef.toString();
  47134. }
  47135. const type = (0, _primitives.isName)(kidDict.get("Type")) ? kidDict.get("Type").name : null;
  47136. if (type === "MCR") {
  47137. if (this.tree.pageDict.objId !== pageObjId) {
  47138. return null;
  47139. }
  47140. return new StructElement({
  47141. type: StructElementType.STREAM_CONTENT,
  47142. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Stm")) ? kidDict.getRaw("Stm").toString() : null,
  47143. pageObjId,
  47144. mcid: kidDict.get("MCID")
  47145. });
  47146. }
  47147. if (type === "OBJR") {
  47148. if (this.tree.pageDict.objId !== pageObjId) {
  47149. return null;
  47150. }
  47151. return new StructElement({
  47152. type: StructElementType.OBJECT,
  47153. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Obj")) ? kidDict.getRaw("Obj").toString() : null,
  47154. pageObjId
  47155. });
  47156. }
  47157. return new StructElement({
  47158. type: StructElementType.ELEMENT,
  47159. dict: kidDict
  47160. });
  47161. }
  47162. }
  47163. class StructElement {
  47164. constructor({
  47165. type,
  47166. dict = null,
  47167. mcid = null,
  47168. pageObjId = null,
  47169. refObjId = null
  47170. }) {
  47171. this.type = type;
  47172. this.dict = dict;
  47173. this.mcid = mcid;
  47174. this.pageObjId = pageObjId;
  47175. this.refObjId = refObjId;
  47176. this.parentNode = null;
  47177. }
  47178. }
  47179. class StructTreePage {
  47180. constructor(structTreeRoot, pageDict) {
  47181. this.root = structTreeRoot;
  47182. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  47183. this.pageDict = pageDict;
  47184. this.nodes = [];
  47185. }
  47186. parse() {
  47187. if (!this.root || !this.rootDict) {
  47188. return;
  47189. }
  47190. const parentTree = this.rootDict.get("ParentTree");
  47191. if (!parentTree) {
  47192. return;
  47193. }
  47194. const id = this.pageDict.get("StructParents");
  47195. if (!Number.isInteger(id)) {
  47196. return;
  47197. }
  47198. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  47199. const parentArray = numberTree.get(id);
  47200. if (!Array.isArray(parentArray)) {
  47201. return;
  47202. }
  47203. const map = new Map();
  47204. for (const ref of parentArray) {
  47205. if ((0, _primitives.isRef)(ref)) {
  47206. this.addNode(this.rootDict.xref.fetch(ref), map);
  47207. }
  47208. }
  47209. }
  47210. addNode(dict, map, level = 0) {
  47211. if (level > MAX_DEPTH) {
  47212. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  47213. return null;
  47214. }
  47215. if (map.has(dict)) {
  47216. return map.get(dict);
  47217. }
  47218. const element = new StructElementNode(this, dict);
  47219. map.set(dict, element);
  47220. const parent = dict.get("P");
  47221. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  47222. if (!this.addTopLevelNode(dict, element)) {
  47223. map.delete(dict);
  47224. }
  47225. return element;
  47226. }
  47227. const parentNode = this.addNode(parent, map, level + 1);
  47228. if (!parentNode) {
  47229. return element;
  47230. }
  47231. let save = false;
  47232. for (const kid of parentNode.kids) {
  47233. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  47234. kid.parentNode = element;
  47235. save = true;
  47236. }
  47237. }
  47238. if (!save) {
  47239. map.delete(dict);
  47240. }
  47241. return element;
  47242. }
  47243. addTopLevelNode(dict, element) {
  47244. const obj = this.rootDict.get("K");
  47245. if (!obj) {
  47246. return false;
  47247. }
  47248. if ((0, _primitives.isDict)(obj)) {
  47249. if (obj.objId !== dict.objId) {
  47250. return false;
  47251. }
  47252. this.nodes[0] = element;
  47253. return true;
  47254. }
  47255. if (!Array.isArray(obj)) {
  47256. return true;
  47257. }
  47258. let save = false;
  47259. for (let i = 0; i < obj.length; i++) {
  47260. const kidRef = obj[i];
  47261. if (kidRef && kidRef.toString() === dict.objId) {
  47262. this.nodes[i] = element;
  47263. save = true;
  47264. }
  47265. }
  47266. return save;
  47267. }
  47268. get serializable() {
  47269. function nodeToSerializable(node, parent, level = 0) {
  47270. if (level > MAX_DEPTH) {
  47271. (0, _util.warn)("StructTree too deep to be fully serialized.");
  47272. return;
  47273. }
  47274. const obj = Object.create(null);
  47275. obj.role = node.role;
  47276. obj.children = [];
  47277. parent.children.push(obj);
  47278. const alt = node.dict.get("Alt");
  47279. if ((0, _util.isString)(alt)) {
  47280. obj.alt = (0, _util.stringToPDFString)(alt);
  47281. }
  47282. for (const kid of node.kids) {
  47283. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  47284. if (kidElement) {
  47285. nodeToSerializable(kidElement, obj, level + 1);
  47286. continue;
  47287. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  47288. obj.children.push({
  47289. type: "content",
  47290. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  47291. });
  47292. } else if (kid.type === StructElementType.OBJECT) {
  47293. obj.children.push({
  47294. type: "object",
  47295. id: kid.refObjId
  47296. });
  47297. }
  47298. }
  47299. }
  47300. const root = Object.create(null);
  47301. root.children = [];
  47302. root.role = "Root";
  47303. for (const child of this.nodes) {
  47304. if (!child) {
  47305. continue;
  47306. }
  47307. nodeToSerializable(child, root);
  47308. }
  47309. return root;
  47310. }
  47311. }
  47312. exports.StructTreePage = StructTreePage;
  47313. /***/ }),
  47314. /* 70 */
  47315. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47316. Object.defineProperty(exports, "__esModule", ({
  47317. value: true
  47318. }));
  47319. exports.ObjectLoader = void 0;
  47320. var _primitives = __w_pdfjs_require__(5);
  47321. var _core_utils = __w_pdfjs_require__(9);
  47322. var _util = __w_pdfjs_require__(2);
  47323. function mayHaveChildren(value) {
  47324. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  47325. }
  47326. function addChildren(node, nodesToVisit) {
  47327. if (node instanceof _primitives.Dict) {
  47328. node = node.getRawValues();
  47329. } else if ((0, _primitives.isStream)(node)) {
  47330. node = node.dict.getRawValues();
  47331. } else if (!Array.isArray(node)) {
  47332. return;
  47333. }
  47334. for (const rawValue of node) {
  47335. if (mayHaveChildren(rawValue)) {
  47336. nodesToVisit.push(rawValue);
  47337. }
  47338. }
  47339. }
  47340. class ObjectLoader {
  47341. constructor(dict, keys, xref) {
  47342. this.dict = dict;
  47343. this.keys = keys;
  47344. this.xref = xref;
  47345. this.refSet = null;
  47346. }
  47347. async load() {
  47348. if (this.xref.stream.isDataLoaded) {
  47349. return undefined;
  47350. }
  47351. const {
  47352. keys,
  47353. dict
  47354. } = this;
  47355. this.refSet = new _primitives.RefSet();
  47356. const nodesToVisit = [];
  47357. for (let i = 0, ii = keys.length; i < ii; i++) {
  47358. const rawValue = dict.getRaw(keys[i]);
  47359. if (rawValue !== undefined) {
  47360. nodesToVisit.push(rawValue);
  47361. }
  47362. }
  47363. return this._walk(nodesToVisit);
  47364. }
  47365. async _walk(nodesToVisit) {
  47366. const nodesToRevisit = [];
  47367. const pendingRequests = [];
  47368. while (nodesToVisit.length) {
  47369. let currentNode = nodesToVisit.pop();
  47370. if (currentNode instanceof _primitives.Ref) {
  47371. if (this.refSet.has(currentNode)) {
  47372. continue;
  47373. }
  47374. try {
  47375. this.refSet.put(currentNode);
  47376. currentNode = this.xref.fetch(currentNode);
  47377. } catch (ex) {
  47378. if (!(ex instanceof _core_utils.MissingDataException)) {
  47379. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  47380. this.refSet = null;
  47381. const {
  47382. manager
  47383. } = this.xref.stream;
  47384. return manager.requestAllChunks();
  47385. }
  47386. nodesToRevisit.push(currentNode);
  47387. pendingRequests.push({
  47388. begin: ex.begin,
  47389. end: ex.end
  47390. });
  47391. }
  47392. }
  47393. if ((0, _primitives.isStream)(currentNode)) {
  47394. const baseStreams = currentNode.getBaseStreams();
  47395. if (baseStreams) {
  47396. let foundMissingData = false;
  47397. for (const stream of baseStreams) {
  47398. if (stream.isDataLoaded) {
  47399. continue;
  47400. }
  47401. foundMissingData = true;
  47402. pendingRequests.push({
  47403. begin: stream.start,
  47404. end: stream.end
  47405. });
  47406. }
  47407. if (foundMissingData) {
  47408. nodesToRevisit.push(currentNode);
  47409. }
  47410. }
  47411. }
  47412. addChildren(currentNode, nodesToVisit);
  47413. }
  47414. if (pendingRequests.length) {
  47415. await this.xref.stream.manager.requestRanges(pendingRequests);
  47416. for (const node of nodesToRevisit) {
  47417. if (node instanceof _primitives.Ref) {
  47418. this.refSet.remove(node);
  47419. }
  47420. }
  47421. return this._walk(nodesToRevisit);
  47422. }
  47423. this.refSet = null;
  47424. return undefined;
  47425. }
  47426. }
  47427. exports.ObjectLoader = ObjectLoader;
  47428. /***/ }),
  47429. /* 71 */
  47430. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47431. Object.defineProperty(exports, "__esModule", ({
  47432. value: true
  47433. }));
  47434. exports.incrementalUpdate = incrementalUpdate;
  47435. exports.writeDict = writeDict;
  47436. var _util = __w_pdfjs_require__(2);
  47437. var _primitives = __w_pdfjs_require__(5);
  47438. var _core_utils = __w_pdfjs_require__(9);
  47439. var _xml_parser = __w_pdfjs_require__(68);
  47440. var _crypto = __w_pdfjs_require__(72);
  47441. function writeDict(dict, buffer, transform) {
  47442. buffer.push("<<");
  47443. for (const key of dict.getKeys()) {
  47444. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47445. writeValue(dict.getRaw(key), buffer, transform);
  47446. }
  47447. buffer.push(">>");
  47448. }
  47449. function writeStream(stream, buffer, transform) {
  47450. writeDict(stream.dict, buffer, transform);
  47451. buffer.push(" stream\n");
  47452. let string = stream.getString();
  47453. if (transform !== null) {
  47454. string = transform.encryptString(string);
  47455. }
  47456. buffer.push(string, "\nendstream\n");
  47457. }
  47458. function writeArray(array, buffer, transform) {
  47459. buffer.push("[");
  47460. let first = true;
  47461. for (const val of array) {
  47462. if (!first) {
  47463. buffer.push(" ");
  47464. } else {
  47465. first = false;
  47466. }
  47467. writeValue(val, buffer, transform);
  47468. }
  47469. buffer.push("]");
  47470. }
  47471. function numberToString(value) {
  47472. if (Number.isInteger(value)) {
  47473. return value.toString();
  47474. }
  47475. const roundedValue = Math.round(value * 100);
  47476. if (roundedValue % 100 === 0) {
  47477. return (roundedValue / 100).toString();
  47478. }
  47479. if (roundedValue % 10 === 0) {
  47480. return value.toFixed(1);
  47481. }
  47482. return value.toFixed(2);
  47483. }
  47484. function writeValue(value, buffer, transform) {
  47485. if ((0, _primitives.isName)(value)) {
  47486. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47487. } else if ((0, _primitives.isRef)(value)) {
  47488. buffer.push(`${value.num} ${value.gen} R`);
  47489. } else if (Array.isArray(value)) {
  47490. writeArray(value, buffer, transform);
  47491. } else if (typeof value === "string") {
  47492. if (transform !== null) {
  47493. value = transform.encryptString(value);
  47494. }
  47495. buffer.push(`(${(0, _util.escapeString)(value)})`);
  47496. } else if (typeof value === "number") {
  47497. buffer.push(numberToString(value));
  47498. } else if ((0, _primitives.isDict)(value)) {
  47499. writeDict(value, buffer, transform);
  47500. } else if ((0, _primitives.isStream)(value)) {
  47501. writeStream(value, buffer, transform);
  47502. }
  47503. }
  47504. function writeInt(number, size, offset, buffer) {
  47505. for (let i = size + offset - 1; i > offset - 1; i--) {
  47506. buffer[i] = number & 0xff;
  47507. number >>= 8;
  47508. }
  47509. return offset + size;
  47510. }
  47511. function writeString(string, offset, buffer) {
  47512. for (let i = 0, len = string.length; i < len; i++) {
  47513. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47514. }
  47515. }
  47516. function computeMD5(filesize, xrefInfo) {
  47517. const time = Math.floor(Date.now() / 1000);
  47518. const filename = xrefInfo.filename || "";
  47519. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47520. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47521. for (const value of Object.values(xrefInfo.info)) {
  47522. md5Buffer.push(value);
  47523. md5BufferLen += value.length;
  47524. }
  47525. const array = new Uint8Array(md5BufferLen);
  47526. let offset = 0;
  47527. for (const str of md5Buffer) {
  47528. writeString(str, offset, array);
  47529. offset += str.length;
  47530. }
  47531. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47532. }
  47533. function writeXFADataForAcroform(str, newRefs) {
  47534. const xml = new _xml_parser.SimpleXMLParser({
  47535. hasAttributes: true
  47536. }).parseFromString(str);
  47537. for (const {
  47538. xfa
  47539. } of newRefs) {
  47540. if (!xfa) {
  47541. continue;
  47542. }
  47543. const {
  47544. path,
  47545. value
  47546. } = xfa;
  47547. if (!path) {
  47548. continue;
  47549. }
  47550. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47551. if (node) {
  47552. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47553. } else {
  47554. (0, _util.warn)(`Node not found for path: ${path}`);
  47555. }
  47556. }
  47557. const buffer = [];
  47558. xml.documentElement.dump(buffer);
  47559. return buffer.join("");
  47560. }
  47561. function updateXFA(xfaData, datasetsRef, newRefs, xref) {
  47562. if (datasetsRef === null || xref === null) {
  47563. return;
  47564. }
  47565. if (xfaData === null) {
  47566. const datasets = xref.fetchIfRef(datasetsRef);
  47567. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47568. }
  47569. const encrypt = xref.encrypt;
  47570. if (encrypt) {
  47571. const transform = encrypt.createCipherTransform(datasetsRef.num, datasetsRef.gen);
  47572. xfaData = transform.encryptString(xfaData);
  47573. }
  47574. const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47575. newRefs.push({
  47576. ref: datasetsRef,
  47577. data
  47578. });
  47579. }
  47580. function incrementalUpdate({
  47581. originalData,
  47582. xrefInfo,
  47583. newRefs,
  47584. xref = null,
  47585. datasetsRef = null,
  47586. xfaData = null
  47587. }) {
  47588. updateXFA(xfaData, datasetsRef, newRefs, xref);
  47589. const newXref = new _primitives.Dict(null);
  47590. const refForXrefTable = xrefInfo.newRef;
  47591. let buffer, baseOffset;
  47592. const lastByte = originalData[originalData.length - 1];
  47593. if (lastByte === 0x0a || lastByte === 0x0d) {
  47594. buffer = [];
  47595. baseOffset = originalData.length;
  47596. } else {
  47597. buffer = ["\n"];
  47598. baseOffset = originalData.length + 1;
  47599. }
  47600. newXref.set("Size", refForXrefTable.num + 1);
  47601. newXref.set("Prev", xrefInfo.startXRef);
  47602. newXref.set("Type", _primitives.Name.get("XRef"));
  47603. if (xrefInfo.rootRef !== null) {
  47604. newXref.set("Root", xrefInfo.rootRef);
  47605. }
  47606. if (xrefInfo.infoRef !== null) {
  47607. newXref.set("Info", xrefInfo.infoRef);
  47608. }
  47609. if (xrefInfo.encryptRef !== null) {
  47610. newXref.set("Encrypt", xrefInfo.encryptRef);
  47611. }
  47612. newRefs.push({
  47613. ref: refForXrefTable,
  47614. data: ""
  47615. });
  47616. newRefs = newRefs.sort((a, b) => {
  47617. return a.ref.num - b.ref.num;
  47618. });
  47619. const xrefTableData = [[0, 1, 0xffff]];
  47620. const indexes = [0, 1];
  47621. let maxOffset = 0;
  47622. for (const {
  47623. ref,
  47624. data
  47625. } of newRefs) {
  47626. maxOffset = Math.max(maxOffset, baseOffset);
  47627. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47628. baseOffset += data.length;
  47629. indexes.push(ref.num, 1);
  47630. buffer.push(data);
  47631. }
  47632. newXref.set("Index", indexes);
  47633. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47634. const md5 = computeMD5(baseOffset, xrefInfo);
  47635. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47636. }
  47637. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47638. const sizes = [1, offsetSize, 2];
  47639. const structSize = sizes[0] + sizes[1] + sizes[2];
  47640. const tableLength = structSize * xrefTableData.length;
  47641. newXref.set("W", sizes);
  47642. newXref.set("Length", tableLength);
  47643. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47644. writeDict(newXref, buffer, null);
  47645. buffer.push(" stream\n");
  47646. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47647. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47648. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47649. array.set(originalData);
  47650. let offset = originalData.length;
  47651. for (const str of buffer) {
  47652. writeString(str, offset, array);
  47653. offset += str.length;
  47654. }
  47655. for (const [type, objOffset, gen] of xrefTableData) {
  47656. offset = writeInt(type, sizes[0], offset, array);
  47657. offset = writeInt(objOffset, sizes[1], offset, array);
  47658. offset = writeInt(gen, sizes[2], offset, array);
  47659. }
  47660. writeString(footer, offset, array);
  47661. return array;
  47662. }
  47663. /***/ }),
  47664. /* 72 */
  47665. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47666. Object.defineProperty(exports, "__esModule", ({
  47667. value: true
  47668. }));
  47669. exports.calculateSHA384 = calculateSHA384;
  47670. exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.calculateSHA512 = exports.calculateSHA256 = exports.calculateMD5 = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  47671. var _util = __w_pdfjs_require__(2);
  47672. var _primitives = __w_pdfjs_require__(5);
  47673. var _decrypt_stream = __w_pdfjs_require__(73);
  47674. class ARCFourCipher {
  47675. constructor(key) {
  47676. this.a = 0;
  47677. this.b = 0;
  47678. const s = new Uint8Array(256);
  47679. const keyLength = key.length;
  47680. for (let i = 0; i < 256; ++i) {
  47681. s[i] = i;
  47682. }
  47683. for (let i = 0, j = 0; i < 256; ++i) {
  47684. const tmp = s[i];
  47685. j = j + tmp + key[i % keyLength] & 0xff;
  47686. s[i] = s[j];
  47687. s[j] = tmp;
  47688. }
  47689. this.s = s;
  47690. }
  47691. encryptBlock(data) {
  47692. let a = this.a,
  47693. b = this.b;
  47694. const s = this.s;
  47695. const n = data.length;
  47696. const output = new Uint8Array(n);
  47697. for (let i = 0; i < n; ++i) {
  47698. a = a + 1 & 0xff;
  47699. const tmp = s[a];
  47700. b = b + tmp & 0xff;
  47701. const tmp2 = s[b];
  47702. s[a] = tmp2;
  47703. s[b] = tmp;
  47704. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  47705. }
  47706. this.a = a;
  47707. this.b = b;
  47708. return output;
  47709. }
  47710. decryptBlock(data) {
  47711. return this.encryptBlock(data);
  47712. }
  47713. encrypt(data) {
  47714. return this.encryptBlock(data);
  47715. }
  47716. }
  47717. exports.ARCFourCipher = ARCFourCipher;
  47718. const calculateMD5 = function calculateMD5Closure() {
  47719. 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]);
  47720. 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]);
  47721. function hash(data, offset, length) {
  47722. let h0 = 1732584193,
  47723. h1 = -271733879,
  47724. h2 = -1732584194,
  47725. h3 = 271733878;
  47726. const paddedLength = length + 72 & ~63;
  47727. const padded = new Uint8Array(paddedLength);
  47728. let i, j;
  47729. for (i = 0; i < length; ++i) {
  47730. padded[i] = data[offset++];
  47731. }
  47732. padded[i++] = 0x80;
  47733. const n = paddedLength - 8;
  47734. while (i < n) {
  47735. padded[i++] = 0;
  47736. }
  47737. padded[i++] = length << 3 & 0xff;
  47738. padded[i++] = length >> 5 & 0xff;
  47739. padded[i++] = length >> 13 & 0xff;
  47740. padded[i++] = length >> 21 & 0xff;
  47741. padded[i++] = length >>> 29 & 0xff;
  47742. padded[i++] = 0;
  47743. padded[i++] = 0;
  47744. padded[i++] = 0;
  47745. const w = new Int32Array(16);
  47746. for (i = 0; i < paddedLength;) {
  47747. for (j = 0; j < 16; ++j, i += 4) {
  47748. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  47749. }
  47750. let a = h0,
  47751. b = h1,
  47752. c = h2,
  47753. d = h3,
  47754. f,
  47755. g;
  47756. for (j = 0; j < 64; ++j) {
  47757. if (j < 16) {
  47758. f = b & c | ~b & d;
  47759. g = j;
  47760. } else if (j < 32) {
  47761. f = d & b | ~d & c;
  47762. g = 5 * j + 1 & 15;
  47763. } else if (j < 48) {
  47764. f = b ^ c ^ d;
  47765. g = 3 * j + 5 & 15;
  47766. } else {
  47767. f = c ^ (b | ~d);
  47768. g = 7 * j & 15;
  47769. }
  47770. const tmp = d,
  47771. rotateArg = a + f + k[j] + w[g] | 0,
  47772. rotate = r[j];
  47773. d = c;
  47774. c = b;
  47775. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  47776. a = tmp;
  47777. }
  47778. h0 = h0 + a | 0;
  47779. h1 = h1 + b | 0;
  47780. h2 = h2 + c | 0;
  47781. h3 = h3 + d | 0;
  47782. }
  47783. 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]);
  47784. }
  47785. return hash;
  47786. }();
  47787. exports.calculateMD5 = calculateMD5;
  47788. class Word64 {
  47789. constructor(highInteger, lowInteger) {
  47790. this.high = highInteger | 0;
  47791. this.low = lowInteger | 0;
  47792. }
  47793. and(word) {
  47794. this.high &= word.high;
  47795. this.low &= word.low;
  47796. }
  47797. xor(word) {
  47798. this.high ^= word.high;
  47799. this.low ^= word.low;
  47800. }
  47801. or(word) {
  47802. this.high |= word.high;
  47803. this.low |= word.low;
  47804. }
  47805. shiftRight(places) {
  47806. if (places >= 32) {
  47807. this.low = this.high >>> places - 32 | 0;
  47808. this.high = 0;
  47809. } else {
  47810. this.low = this.low >>> places | this.high << 32 - places;
  47811. this.high = this.high >>> places | 0;
  47812. }
  47813. }
  47814. shiftLeft(places) {
  47815. if (places >= 32) {
  47816. this.high = this.low << places - 32;
  47817. this.low = 0;
  47818. } else {
  47819. this.high = this.high << places | this.low >>> 32 - places;
  47820. this.low <<= places;
  47821. }
  47822. }
  47823. rotateRight(places) {
  47824. let low, high;
  47825. if (places & 32) {
  47826. high = this.low;
  47827. low = this.high;
  47828. } else {
  47829. low = this.low;
  47830. high = this.high;
  47831. }
  47832. places &= 31;
  47833. this.low = low >>> places | high << 32 - places;
  47834. this.high = high >>> places | low << 32 - places;
  47835. }
  47836. not() {
  47837. this.high = ~this.high;
  47838. this.low = ~this.low;
  47839. }
  47840. add(word) {
  47841. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  47842. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  47843. if (lowAdd > 0xffffffff) {
  47844. highAdd += 1;
  47845. }
  47846. this.low = lowAdd | 0;
  47847. this.high = highAdd | 0;
  47848. }
  47849. copyTo(bytes, offset) {
  47850. bytes[offset] = this.high >>> 24 & 0xff;
  47851. bytes[offset + 1] = this.high >> 16 & 0xff;
  47852. bytes[offset + 2] = this.high >> 8 & 0xff;
  47853. bytes[offset + 3] = this.high & 0xff;
  47854. bytes[offset + 4] = this.low >>> 24 & 0xff;
  47855. bytes[offset + 5] = this.low >> 16 & 0xff;
  47856. bytes[offset + 6] = this.low >> 8 & 0xff;
  47857. bytes[offset + 7] = this.low & 0xff;
  47858. }
  47859. assign(word) {
  47860. this.high = word.high;
  47861. this.low = word.low;
  47862. }
  47863. }
  47864. const calculateSHA256 = function calculateSHA256Closure() {
  47865. function rotr(x, n) {
  47866. return x >>> n | x << 32 - n;
  47867. }
  47868. function ch(x, y, z) {
  47869. return x & y ^ ~x & z;
  47870. }
  47871. function maj(x, y, z) {
  47872. return x & y ^ x & z ^ y & z;
  47873. }
  47874. function sigma(x) {
  47875. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  47876. }
  47877. function sigmaPrime(x) {
  47878. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  47879. }
  47880. function littleSigma(x) {
  47881. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  47882. }
  47883. function littleSigmaPrime(x) {
  47884. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  47885. }
  47886. 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];
  47887. function hash(data, offset, length) {
  47888. let h0 = 0x6a09e667,
  47889. h1 = 0xbb67ae85,
  47890. h2 = 0x3c6ef372,
  47891. h3 = 0xa54ff53a,
  47892. h4 = 0x510e527f,
  47893. h5 = 0x9b05688c,
  47894. h6 = 0x1f83d9ab,
  47895. h7 = 0x5be0cd19;
  47896. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  47897. const padded = new Uint8Array(paddedLength);
  47898. let i, j;
  47899. for (i = 0; i < length; ++i) {
  47900. padded[i] = data[offset++];
  47901. }
  47902. padded[i++] = 0x80;
  47903. const n = paddedLength - 8;
  47904. while (i < n) {
  47905. padded[i++] = 0;
  47906. }
  47907. padded[i++] = 0;
  47908. padded[i++] = 0;
  47909. padded[i++] = 0;
  47910. padded[i++] = length >>> 29 & 0xff;
  47911. padded[i++] = length >> 21 & 0xff;
  47912. padded[i++] = length >> 13 & 0xff;
  47913. padded[i++] = length >> 5 & 0xff;
  47914. padded[i++] = length << 3 & 0xff;
  47915. const w = new Uint32Array(64);
  47916. for (i = 0; i < paddedLength;) {
  47917. for (j = 0; j < 16; ++j) {
  47918. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  47919. i += 4;
  47920. }
  47921. for (j = 16; j < 64; ++j) {
  47922. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  47923. }
  47924. let a = h0,
  47925. b = h1,
  47926. c = h2,
  47927. d = h3,
  47928. e = h4,
  47929. f = h5,
  47930. g = h6,
  47931. h = h7,
  47932. t1,
  47933. t2;
  47934. for (j = 0; j < 64; ++j) {
  47935. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  47936. t2 = sigma(a) + maj(a, b, c);
  47937. h = g;
  47938. g = f;
  47939. f = e;
  47940. e = d + t1 | 0;
  47941. d = c;
  47942. c = b;
  47943. b = a;
  47944. a = t1 + t2 | 0;
  47945. }
  47946. h0 = h0 + a | 0;
  47947. h1 = h1 + b | 0;
  47948. h2 = h2 + c | 0;
  47949. h3 = h3 + d | 0;
  47950. h4 = h4 + e | 0;
  47951. h5 = h5 + f | 0;
  47952. h6 = h6 + g | 0;
  47953. h7 = h7 + h | 0;
  47954. }
  47955. 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]);
  47956. }
  47957. return hash;
  47958. }();
  47959. exports.calculateSHA256 = calculateSHA256;
  47960. const calculateSHA512 = function calculateSHA512Closure() {
  47961. function ch(result, x, y, z, tmp) {
  47962. result.assign(x);
  47963. result.and(y);
  47964. tmp.assign(x);
  47965. tmp.not();
  47966. tmp.and(z);
  47967. result.xor(tmp);
  47968. }
  47969. function maj(result, x, y, z, tmp) {
  47970. result.assign(x);
  47971. result.and(y);
  47972. tmp.assign(x);
  47973. tmp.and(z);
  47974. result.xor(tmp);
  47975. tmp.assign(y);
  47976. tmp.and(z);
  47977. result.xor(tmp);
  47978. }
  47979. function sigma(result, x, tmp) {
  47980. result.assign(x);
  47981. result.rotateRight(28);
  47982. tmp.assign(x);
  47983. tmp.rotateRight(34);
  47984. result.xor(tmp);
  47985. tmp.assign(x);
  47986. tmp.rotateRight(39);
  47987. result.xor(tmp);
  47988. }
  47989. function sigmaPrime(result, x, tmp) {
  47990. result.assign(x);
  47991. result.rotateRight(14);
  47992. tmp.assign(x);
  47993. tmp.rotateRight(18);
  47994. result.xor(tmp);
  47995. tmp.assign(x);
  47996. tmp.rotateRight(41);
  47997. result.xor(tmp);
  47998. }
  47999. function littleSigma(result, x, tmp) {
  48000. result.assign(x);
  48001. result.rotateRight(1);
  48002. tmp.assign(x);
  48003. tmp.rotateRight(8);
  48004. result.xor(tmp);
  48005. tmp.assign(x);
  48006. tmp.shiftRight(7);
  48007. result.xor(tmp);
  48008. }
  48009. function littleSigmaPrime(result, x, tmp) {
  48010. result.assign(x);
  48011. result.rotateRight(19);
  48012. tmp.assign(x);
  48013. tmp.rotateRight(61);
  48014. result.xor(tmp);
  48015. tmp.assign(x);
  48016. tmp.shiftRight(6);
  48017. result.xor(tmp);
  48018. }
  48019. 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)];
  48020. function hash(data, offset, length, mode384 = false) {
  48021. let h0, h1, h2, h3, h4, h5, h6, h7;
  48022. if (!mode384) {
  48023. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48024. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48025. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48026. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48027. h4 = new Word64(0x510e527f, 0xade682d1);
  48028. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48029. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48030. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48031. } else {
  48032. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48033. h1 = new Word64(0x629a292a, 0x367cd507);
  48034. h2 = new Word64(0x9159015a, 0x3070dd17);
  48035. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48036. h4 = new Word64(0x67332667, 0xffc00b31);
  48037. h5 = new Word64(0x8eb44a87, 0x68581511);
  48038. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48039. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48040. }
  48041. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48042. const padded = new Uint8Array(paddedLength);
  48043. let i, j;
  48044. for (i = 0; i < length; ++i) {
  48045. padded[i] = data[offset++];
  48046. }
  48047. padded[i++] = 0x80;
  48048. const n = paddedLength - 16;
  48049. while (i < n) {
  48050. padded[i++] = 0;
  48051. }
  48052. padded[i++] = 0;
  48053. padded[i++] = 0;
  48054. padded[i++] = 0;
  48055. padded[i++] = 0;
  48056. padded[i++] = 0;
  48057. padded[i++] = 0;
  48058. padded[i++] = 0;
  48059. padded[i++] = 0;
  48060. padded[i++] = 0;
  48061. padded[i++] = 0;
  48062. padded[i++] = 0;
  48063. padded[i++] = length >>> 29 & 0xff;
  48064. padded[i++] = length >> 21 & 0xff;
  48065. padded[i++] = length >> 13 & 0xff;
  48066. padded[i++] = length >> 5 & 0xff;
  48067. padded[i++] = length << 3 & 0xff;
  48068. const w = new Array(80);
  48069. for (i = 0; i < 80; i++) {
  48070. w[i] = new Word64(0, 0);
  48071. }
  48072. let a = new Word64(0, 0),
  48073. b = new Word64(0, 0),
  48074. c = new Word64(0, 0);
  48075. let d = new Word64(0, 0),
  48076. e = new Word64(0, 0),
  48077. f = new Word64(0, 0);
  48078. let g = new Word64(0, 0),
  48079. h = new Word64(0, 0);
  48080. const t1 = new Word64(0, 0),
  48081. t2 = new Word64(0, 0);
  48082. const tmp1 = new Word64(0, 0),
  48083. tmp2 = new Word64(0, 0);
  48084. let tmp3;
  48085. for (i = 0; i < paddedLength;) {
  48086. for (j = 0; j < 16; ++j) {
  48087. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48088. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48089. i += 8;
  48090. }
  48091. for (j = 16; j < 80; ++j) {
  48092. tmp3 = w[j];
  48093. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48094. tmp3.add(w[j - 7]);
  48095. littleSigma(tmp1, w[j - 15], tmp2);
  48096. tmp3.add(tmp1);
  48097. tmp3.add(w[j - 16]);
  48098. }
  48099. a.assign(h0);
  48100. b.assign(h1);
  48101. c.assign(h2);
  48102. d.assign(h3);
  48103. e.assign(h4);
  48104. f.assign(h5);
  48105. g.assign(h6);
  48106. h.assign(h7);
  48107. for (j = 0; j < 80; ++j) {
  48108. t1.assign(h);
  48109. sigmaPrime(tmp1, e, tmp2);
  48110. t1.add(tmp1);
  48111. ch(tmp1, e, f, g, tmp2);
  48112. t1.add(tmp1);
  48113. t1.add(k[j]);
  48114. t1.add(w[j]);
  48115. sigma(t2, a, tmp2);
  48116. maj(tmp1, a, b, c, tmp2);
  48117. t2.add(tmp1);
  48118. tmp3 = h;
  48119. h = g;
  48120. g = f;
  48121. f = e;
  48122. d.add(t1);
  48123. e = d;
  48124. d = c;
  48125. c = b;
  48126. b = a;
  48127. tmp3.assign(t1);
  48128. tmp3.add(t2);
  48129. a = tmp3;
  48130. }
  48131. h0.add(a);
  48132. h1.add(b);
  48133. h2.add(c);
  48134. h3.add(d);
  48135. h4.add(e);
  48136. h5.add(f);
  48137. h6.add(g);
  48138. h7.add(h);
  48139. }
  48140. let result;
  48141. if (!mode384) {
  48142. result = new Uint8Array(64);
  48143. h0.copyTo(result, 0);
  48144. h1.copyTo(result, 8);
  48145. h2.copyTo(result, 16);
  48146. h3.copyTo(result, 24);
  48147. h4.copyTo(result, 32);
  48148. h5.copyTo(result, 40);
  48149. h6.copyTo(result, 48);
  48150. h7.copyTo(result, 56);
  48151. } else {
  48152. result = new Uint8Array(48);
  48153. h0.copyTo(result, 0);
  48154. h1.copyTo(result, 8);
  48155. h2.copyTo(result, 16);
  48156. h3.copyTo(result, 24);
  48157. h4.copyTo(result, 32);
  48158. h5.copyTo(result, 40);
  48159. }
  48160. return result;
  48161. }
  48162. return hash;
  48163. }();
  48164. exports.calculateSHA512 = calculateSHA512;
  48165. function calculateSHA384(data, offset, length) {
  48166. return calculateSHA512(data, offset, length, true);
  48167. }
  48168. class NullCipher {
  48169. decryptBlock(data) {
  48170. return data;
  48171. }
  48172. encrypt(data) {
  48173. return data;
  48174. }
  48175. }
  48176. class AESBaseCipher {
  48177. constructor() {
  48178. if (this.constructor === AESBaseCipher) {
  48179. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48180. }
  48181. 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]);
  48182. 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]);
  48183. 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]);
  48184. this._mixCol = new Uint8Array(256);
  48185. for (let i = 0; i < 256; i++) {
  48186. if (i < 128) {
  48187. this._mixCol[i] = i << 1;
  48188. } else {
  48189. this._mixCol[i] = i << 1 ^ 0x1b;
  48190. }
  48191. }
  48192. this.buffer = new Uint8Array(16);
  48193. this.bufferPosition = 0;
  48194. }
  48195. _expandKey(cipherKey) {
  48196. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48197. }
  48198. _decrypt(input, key) {
  48199. let t, u, v;
  48200. const state = new Uint8Array(16);
  48201. state.set(input);
  48202. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48203. state[j] ^= key[k];
  48204. }
  48205. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48206. t = state[13];
  48207. state[13] = state[9];
  48208. state[9] = state[5];
  48209. state[5] = state[1];
  48210. state[1] = t;
  48211. t = state[14];
  48212. u = state[10];
  48213. state[14] = state[6];
  48214. state[10] = state[2];
  48215. state[6] = t;
  48216. state[2] = u;
  48217. t = state[15];
  48218. u = state[11];
  48219. v = state[7];
  48220. state[15] = state[3];
  48221. state[11] = t;
  48222. state[7] = u;
  48223. state[3] = v;
  48224. for (let j = 0; j < 16; ++j) {
  48225. state[j] = this._inv_s[state[j]];
  48226. }
  48227. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48228. state[j] ^= key[k];
  48229. }
  48230. for (let j = 0; j < 16; j += 4) {
  48231. const s0 = this._mix[state[j]];
  48232. const s1 = this._mix[state[j + 1]];
  48233. const s2 = this._mix[state[j + 2]];
  48234. const s3 = this._mix[state[j + 3]];
  48235. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48236. state[j] = t >>> 24 & 0xff;
  48237. state[j + 1] = t >> 16 & 0xff;
  48238. state[j + 2] = t >> 8 & 0xff;
  48239. state[j + 3] = t & 0xff;
  48240. }
  48241. }
  48242. t = state[13];
  48243. state[13] = state[9];
  48244. state[9] = state[5];
  48245. state[5] = state[1];
  48246. state[1] = t;
  48247. t = state[14];
  48248. u = state[10];
  48249. state[14] = state[6];
  48250. state[10] = state[2];
  48251. state[6] = t;
  48252. state[2] = u;
  48253. t = state[15];
  48254. u = state[11];
  48255. v = state[7];
  48256. state[15] = state[3];
  48257. state[11] = t;
  48258. state[7] = u;
  48259. state[3] = v;
  48260. for (let j = 0; j < 16; ++j) {
  48261. state[j] = this._inv_s[state[j]];
  48262. state[j] ^= key[j];
  48263. }
  48264. return state;
  48265. }
  48266. _encrypt(input, key) {
  48267. const s = this._s;
  48268. let t, u, v;
  48269. const state = new Uint8Array(16);
  48270. state.set(input);
  48271. for (let j = 0; j < 16; ++j) {
  48272. state[j] ^= key[j];
  48273. }
  48274. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48275. for (let j = 0; j < 16; ++j) {
  48276. state[j] = s[state[j]];
  48277. }
  48278. v = state[1];
  48279. state[1] = state[5];
  48280. state[5] = state[9];
  48281. state[9] = state[13];
  48282. state[13] = v;
  48283. v = state[2];
  48284. u = state[6];
  48285. state[2] = state[10];
  48286. state[6] = state[14];
  48287. state[10] = v;
  48288. state[14] = u;
  48289. v = state[3];
  48290. u = state[7];
  48291. t = state[11];
  48292. state[3] = state[15];
  48293. state[7] = v;
  48294. state[11] = u;
  48295. state[15] = t;
  48296. for (let j = 0; j < 16; j += 4) {
  48297. const s0 = state[j + 0];
  48298. const s1 = state[j + 1];
  48299. const s2 = state[j + 2];
  48300. const s3 = state[j + 3];
  48301. t = s0 ^ s1 ^ s2 ^ s3;
  48302. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48303. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48304. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48305. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48306. }
  48307. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48308. state[j] ^= key[k];
  48309. }
  48310. }
  48311. for (let j = 0; j < 16; ++j) {
  48312. state[j] = s[state[j]];
  48313. }
  48314. v = state[1];
  48315. state[1] = state[5];
  48316. state[5] = state[9];
  48317. state[9] = state[13];
  48318. state[13] = v;
  48319. v = state[2];
  48320. u = state[6];
  48321. state[2] = state[10];
  48322. state[6] = state[14];
  48323. state[10] = v;
  48324. state[14] = u;
  48325. v = state[3];
  48326. u = state[7];
  48327. t = state[11];
  48328. state[3] = state[15];
  48329. state[7] = v;
  48330. state[11] = u;
  48331. state[15] = t;
  48332. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48333. state[j] ^= key[k];
  48334. }
  48335. return state;
  48336. }
  48337. _decryptBlock2(data, finalize) {
  48338. const sourceLength = data.length;
  48339. let buffer = this.buffer,
  48340. bufferLength = this.bufferPosition;
  48341. const result = [];
  48342. let iv = this.iv;
  48343. for (let i = 0; i < sourceLength; ++i) {
  48344. buffer[bufferLength] = data[i];
  48345. ++bufferLength;
  48346. if (bufferLength < 16) {
  48347. continue;
  48348. }
  48349. const plain = this._decrypt(buffer, this._key);
  48350. for (let j = 0; j < 16; ++j) {
  48351. plain[j] ^= iv[j];
  48352. }
  48353. iv = buffer;
  48354. result.push(plain);
  48355. buffer = new Uint8Array(16);
  48356. bufferLength = 0;
  48357. }
  48358. this.buffer = buffer;
  48359. this.bufferLength = bufferLength;
  48360. this.iv = iv;
  48361. if (result.length === 0) {
  48362. return new Uint8Array(0);
  48363. }
  48364. let outputLength = 16 * result.length;
  48365. if (finalize) {
  48366. const lastBlock = result[result.length - 1];
  48367. let psLen = lastBlock[15];
  48368. if (psLen <= 16) {
  48369. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  48370. if (lastBlock[i] !== psLen) {
  48371. psLen = 0;
  48372. break;
  48373. }
  48374. }
  48375. outputLength -= psLen;
  48376. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  48377. }
  48378. }
  48379. const output = new Uint8Array(outputLength);
  48380. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48381. output.set(result[i], j);
  48382. }
  48383. return output;
  48384. }
  48385. decryptBlock(data, finalize, iv = null) {
  48386. const sourceLength = data.length;
  48387. const buffer = this.buffer;
  48388. let bufferLength = this.bufferPosition;
  48389. if (iv) {
  48390. this.iv = iv;
  48391. } else {
  48392. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  48393. buffer[bufferLength] = data[i];
  48394. }
  48395. if (bufferLength < 16) {
  48396. this.bufferLength = bufferLength;
  48397. return new Uint8Array(0);
  48398. }
  48399. this.iv = buffer;
  48400. data = data.subarray(16);
  48401. }
  48402. this.buffer = new Uint8Array(16);
  48403. this.bufferLength = 0;
  48404. this.decryptBlock = this._decryptBlock2;
  48405. return this.decryptBlock(data, finalize);
  48406. }
  48407. encrypt(data, iv) {
  48408. const sourceLength = data.length;
  48409. let buffer = this.buffer,
  48410. bufferLength = this.bufferPosition;
  48411. const result = [];
  48412. if (!iv) {
  48413. iv = new Uint8Array(16);
  48414. }
  48415. for (let i = 0; i < sourceLength; ++i) {
  48416. buffer[bufferLength] = data[i];
  48417. ++bufferLength;
  48418. if (bufferLength < 16) {
  48419. continue;
  48420. }
  48421. for (let j = 0; j < 16; ++j) {
  48422. buffer[j] ^= iv[j];
  48423. }
  48424. const cipher = this._encrypt(buffer, this._key);
  48425. iv = cipher;
  48426. result.push(cipher);
  48427. buffer = new Uint8Array(16);
  48428. bufferLength = 0;
  48429. }
  48430. this.buffer = buffer;
  48431. this.bufferLength = bufferLength;
  48432. this.iv = iv;
  48433. if (result.length === 0) {
  48434. return new Uint8Array(0);
  48435. }
  48436. const outputLength = 16 * result.length;
  48437. const output = new Uint8Array(outputLength);
  48438. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48439. output.set(result[i], j);
  48440. }
  48441. return output;
  48442. }
  48443. }
  48444. class AES128Cipher extends AESBaseCipher {
  48445. constructor(key) {
  48446. super();
  48447. this._cyclesOfRepetition = 10;
  48448. this._keySize = 160;
  48449. 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]);
  48450. this._key = this._expandKey(key);
  48451. }
  48452. _expandKey(cipherKey) {
  48453. const b = 176;
  48454. const s = this._s;
  48455. const rcon = this._rcon;
  48456. const result = new Uint8Array(b);
  48457. result.set(cipherKey);
  48458. for (let j = 16, i = 1; j < b; ++i) {
  48459. let t1 = result[j - 3];
  48460. let t2 = result[j - 2];
  48461. let t3 = result[j - 1];
  48462. let t4 = result[j - 4];
  48463. t1 = s[t1];
  48464. t2 = s[t2];
  48465. t3 = s[t3];
  48466. t4 = s[t4];
  48467. t1 ^= rcon[i];
  48468. for (let n = 0; n < 4; ++n) {
  48469. result[j] = t1 ^= result[j - 16];
  48470. j++;
  48471. result[j] = t2 ^= result[j - 16];
  48472. j++;
  48473. result[j] = t3 ^= result[j - 16];
  48474. j++;
  48475. result[j] = t4 ^= result[j - 16];
  48476. j++;
  48477. }
  48478. }
  48479. return result;
  48480. }
  48481. }
  48482. exports.AES128Cipher = AES128Cipher;
  48483. class AES256Cipher extends AESBaseCipher {
  48484. constructor(key) {
  48485. super();
  48486. this._cyclesOfRepetition = 14;
  48487. this._keySize = 224;
  48488. this._key = this._expandKey(key);
  48489. }
  48490. _expandKey(cipherKey) {
  48491. const b = 240;
  48492. const s = this._s;
  48493. const result = new Uint8Array(b);
  48494. result.set(cipherKey);
  48495. let r = 1;
  48496. let t1, t2, t3, t4;
  48497. for (let j = 32, i = 1; j < b; ++i) {
  48498. if (j % 32 === 16) {
  48499. t1 = s[t1];
  48500. t2 = s[t2];
  48501. t3 = s[t3];
  48502. t4 = s[t4];
  48503. } else if (j % 32 === 0) {
  48504. t1 = result[j - 3];
  48505. t2 = result[j - 2];
  48506. t3 = result[j - 1];
  48507. t4 = result[j - 4];
  48508. t1 = s[t1];
  48509. t2 = s[t2];
  48510. t3 = s[t3];
  48511. t4 = s[t4];
  48512. t1 ^= r;
  48513. if ((r <<= 1) >= 256) {
  48514. r = (r ^ 0x1b) & 0xff;
  48515. }
  48516. }
  48517. for (let n = 0; n < 4; ++n) {
  48518. result[j] = t1 ^= result[j - 32];
  48519. j++;
  48520. result[j] = t2 ^= result[j - 32];
  48521. j++;
  48522. result[j] = t3 ^= result[j - 32];
  48523. j++;
  48524. result[j] = t4 ^= result[j - 32];
  48525. j++;
  48526. }
  48527. }
  48528. return result;
  48529. }
  48530. }
  48531. exports.AES256Cipher = AES256Cipher;
  48532. class PDF17 {
  48533. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48534. const hashData = new Uint8Array(password.length + 56);
  48535. hashData.set(password, 0);
  48536. hashData.set(ownerValidationSalt, password.length);
  48537. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48538. const result = calculateSHA256(hashData, 0, hashData.length);
  48539. return (0, _util.isArrayEqual)(result, ownerPassword);
  48540. }
  48541. checkUserPassword(password, userValidationSalt, userPassword) {
  48542. const hashData = new Uint8Array(password.length + 8);
  48543. hashData.set(password, 0);
  48544. hashData.set(userValidationSalt, password.length);
  48545. const result = calculateSHA256(hashData, 0, hashData.length);
  48546. return (0, _util.isArrayEqual)(result, userPassword);
  48547. }
  48548. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48549. const hashData = new Uint8Array(password.length + 56);
  48550. hashData.set(password, 0);
  48551. hashData.set(ownerKeySalt, password.length);
  48552. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48553. const key = calculateSHA256(hashData, 0, hashData.length);
  48554. const cipher = new AES256Cipher(key);
  48555. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48556. }
  48557. getUserKey(password, userKeySalt, userEncryption) {
  48558. const hashData = new Uint8Array(password.length + 8);
  48559. hashData.set(password, 0);
  48560. hashData.set(userKeySalt, password.length);
  48561. const key = calculateSHA256(hashData, 0, hashData.length);
  48562. const cipher = new AES256Cipher(key);
  48563. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48564. }
  48565. }
  48566. exports.PDF17 = PDF17;
  48567. const PDF20 = function PDF20Closure() {
  48568. function calculatePDF20Hash(password, input, userBytes) {
  48569. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  48570. let e = [0];
  48571. let i = 0;
  48572. while (i < 64 || e[e.length - 1] > i - 32) {
  48573. const combinedLength = password.length + k.length + userBytes.length,
  48574. combinedArray = new Uint8Array(combinedLength);
  48575. let writeOffset = 0;
  48576. combinedArray.set(password, writeOffset);
  48577. writeOffset += password.length;
  48578. combinedArray.set(k, writeOffset);
  48579. writeOffset += k.length;
  48580. combinedArray.set(userBytes, writeOffset);
  48581. const k1 = new Uint8Array(combinedLength * 64);
  48582. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  48583. k1.set(combinedArray, pos);
  48584. }
  48585. const cipher = new AES128Cipher(k.subarray(0, 16));
  48586. e = cipher.encrypt(k1, k.subarray(16, 32));
  48587. let remainder = 0;
  48588. for (let z = 0; z < 16; z++) {
  48589. remainder *= 256 % 3;
  48590. remainder %= 3;
  48591. remainder += (e[z] >>> 0) % 3;
  48592. remainder %= 3;
  48593. }
  48594. if (remainder === 0) {
  48595. k = calculateSHA256(e, 0, e.length);
  48596. } else if (remainder === 1) {
  48597. k = calculateSHA384(e, 0, e.length);
  48598. } else if (remainder === 2) {
  48599. k = calculateSHA512(e, 0, e.length);
  48600. }
  48601. i++;
  48602. }
  48603. return k.subarray(0, 32);
  48604. }
  48605. class PDF20 {
  48606. hash(password, concatBytes, userBytes) {
  48607. return calculatePDF20Hash(password, concatBytes, userBytes);
  48608. }
  48609. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48610. const hashData = new Uint8Array(password.length + 56);
  48611. hashData.set(password, 0);
  48612. hashData.set(ownerValidationSalt, password.length);
  48613. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48614. const result = calculatePDF20Hash(password, hashData, userBytes);
  48615. return (0, _util.isArrayEqual)(result, ownerPassword);
  48616. }
  48617. checkUserPassword(password, userValidationSalt, userPassword) {
  48618. const hashData = new Uint8Array(password.length + 8);
  48619. hashData.set(password, 0);
  48620. hashData.set(userValidationSalt, password.length);
  48621. const result = calculatePDF20Hash(password, hashData, []);
  48622. return (0, _util.isArrayEqual)(result, userPassword);
  48623. }
  48624. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48625. const hashData = new Uint8Array(password.length + 56);
  48626. hashData.set(password, 0);
  48627. hashData.set(ownerKeySalt, password.length);
  48628. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48629. const key = calculatePDF20Hash(password, hashData, userBytes);
  48630. const cipher = new AES256Cipher(key);
  48631. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48632. }
  48633. getUserKey(password, userKeySalt, userEncryption) {
  48634. const hashData = new Uint8Array(password.length + 8);
  48635. hashData.set(password, 0);
  48636. hashData.set(userKeySalt, password.length);
  48637. const key = calculatePDF20Hash(password, hashData, []);
  48638. const cipher = new AES256Cipher(key);
  48639. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48640. }
  48641. }
  48642. return PDF20;
  48643. }();
  48644. exports.PDF20 = PDF20;
  48645. class CipherTransform {
  48646. constructor(stringCipherConstructor, streamCipherConstructor) {
  48647. this.StringCipherConstructor = stringCipherConstructor;
  48648. this.StreamCipherConstructor = streamCipherConstructor;
  48649. }
  48650. createStream(stream, length) {
  48651. const cipher = new this.StreamCipherConstructor();
  48652. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  48653. return cipher.decryptBlock(data, finalize);
  48654. });
  48655. }
  48656. decryptString(s) {
  48657. const cipher = new this.StringCipherConstructor();
  48658. let data = (0, _util.stringToBytes)(s);
  48659. data = cipher.decryptBlock(data, true);
  48660. return (0, _util.bytesToString)(data);
  48661. }
  48662. encryptString(s) {
  48663. const cipher = new this.StringCipherConstructor();
  48664. if (cipher instanceof AESBaseCipher) {
  48665. const strLen = s.length;
  48666. const pad = 16 - strLen % 16;
  48667. if (pad !== 16) {
  48668. s = s.padEnd(16 * Math.ceil(strLen / 16), String.fromCharCode(pad));
  48669. }
  48670. const iv = new Uint8Array(16);
  48671. if (typeof crypto !== "undefined") {
  48672. crypto.getRandomValues(iv);
  48673. } else {
  48674. for (let i = 0; i < 16; i++) {
  48675. iv[i] = Math.floor(256 * Math.random());
  48676. }
  48677. }
  48678. let data = (0, _util.stringToBytes)(s);
  48679. data = cipher.encrypt(data, iv);
  48680. const buf = new Uint8Array(16 + data.length);
  48681. buf.set(iv);
  48682. buf.set(data, 16);
  48683. return (0, _util.bytesToString)(buf);
  48684. }
  48685. let data = (0, _util.stringToBytes)(s);
  48686. data = cipher.encrypt(data);
  48687. return (0, _util.bytesToString)(data);
  48688. }
  48689. }
  48690. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  48691. 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]);
  48692. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  48693. if (password) {
  48694. const passwordLength = Math.min(127, password.length);
  48695. password = password.subarray(0, passwordLength);
  48696. } else {
  48697. password = [];
  48698. }
  48699. let pdfAlgorithm;
  48700. if (revision === 6) {
  48701. pdfAlgorithm = new PDF20();
  48702. } else {
  48703. pdfAlgorithm = new PDF17();
  48704. }
  48705. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  48706. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  48707. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  48708. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  48709. }
  48710. return null;
  48711. }
  48712. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  48713. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  48714. const hashData = new Uint8Array(hashDataSize);
  48715. let i = 0,
  48716. j,
  48717. n;
  48718. if (password) {
  48719. n = Math.min(32, password.length);
  48720. for (; i < n; ++i) {
  48721. hashData[i] = password[i];
  48722. }
  48723. }
  48724. j = 0;
  48725. while (i < 32) {
  48726. hashData[i++] = defaultPasswordBytes[j++];
  48727. }
  48728. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  48729. hashData[i++] = ownerPassword[j];
  48730. }
  48731. hashData[i++] = flags & 0xff;
  48732. hashData[i++] = flags >> 8 & 0xff;
  48733. hashData[i++] = flags >> 16 & 0xff;
  48734. hashData[i++] = flags >>> 24 & 0xff;
  48735. for (j = 0, n = fileId.length; j < n; ++j) {
  48736. hashData[i++] = fileId[j];
  48737. }
  48738. if (revision >= 4 && !encryptMetadata) {
  48739. hashData[i++] = 0xff;
  48740. hashData[i++] = 0xff;
  48741. hashData[i++] = 0xff;
  48742. hashData[i++] = 0xff;
  48743. }
  48744. let hash = calculateMD5(hashData, 0, i);
  48745. const keyLengthInBytes = keyLength >> 3;
  48746. if (revision >= 3) {
  48747. for (j = 0; j < 50; ++j) {
  48748. hash = calculateMD5(hash, 0, keyLengthInBytes);
  48749. }
  48750. }
  48751. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  48752. let cipher, checkData;
  48753. if (revision >= 3) {
  48754. for (i = 0; i < 32; ++i) {
  48755. hashData[i] = defaultPasswordBytes[i];
  48756. }
  48757. for (j = 0, n = fileId.length; j < n; ++j) {
  48758. hashData[i++] = fileId[j];
  48759. }
  48760. cipher = new ARCFourCipher(encryptionKey);
  48761. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  48762. n = encryptionKey.length;
  48763. const derivedKey = new Uint8Array(n);
  48764. for (j = 1; j <= 19; ++j) {
  48765. for (let k = 0; k < n; ++k) {
  48766. derivedKey[k] = encryptionKey[k] ^ j;
  48767. }
  48768. cipher = new ARCFourCipher(derivedKey);
  48769. checkData = cipher.encryptBlock(checkData);
  48770. }
  48771. for (j = 0, n = checkData.length; j < n; ++j) {
  48772. if (userPassword[j] !== checkData[j]) {
  48773. return null;
  48774. }
  48775. }
  48776. } else {
  48777. cipher = new ARCFourCipher(encryptionKey);
  48778. checkData = cipher.encryptBlock(defaultPasswordBytes);
  48779. for (j = 0, n = checkData.length; j < n; ++j) {
  48780. if (userPassword[j] !== checkData[j]) {
  48781. return null;
  48782. }
  48783. }
  48784. }
  48785. return encryptionKey;
  48786. }
  48787. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  48788. const hashData = new Uint8Array(32);
  48789. let i = 0;
  48790. const n = Math.min(32, password.length);
  48791. for (; i < n; ++i) {
  48792. hashData[i] = password[i];
  48793. }
  48794. let j = 0;
  48795. while (i < 32) {
  48796. hashData[i++] = defaultPasswordBytes[j++];
  48797. }
  48798. let hash = calculateMD5(hashData, 0, i);
  48799. const keyLengthInBytes = keyLength >> 3;
  48800. if (revision >= 3) {
  48801. for (j = 0; j < 50; ++j) {
  48802. hash = calculateMD5(hash, 0, hash.length);
  48803. }
  48804. }
  48805. let cipher, userPassword;
  48806. if (revision >= 3) {
  48807. userPassword = ownerPassword;
  48808. const derivedKey = new Uint8Array(keyLengthInBytes);
  48809. for (j = 19; j >= 0; j--) {
  48810. for (let k = 0; k < keyLengthInBytes; ++k) {
  48811. derivedKey[k] = hash[k] ^ j;
  48812. }
  48813. cipher = new ARCFourCipher(derivedKey);
  48814. userPassword = cipher.encryptBlock(userPassword);
  48815. }
  48816. } else {
  48817. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  48818. userPassword = cipher.encryptBlock(ownerPassword);
  48819. }
  48820. return userPassword;
  48821. }
  48822. const identityName = _primitives.Name.get("Identity");
  48823. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  48824. const key = new Uint8Array(encryptionKey.length + 9);
  48825. const n = encryptionKey.length;
  48826. let i;
  48827. for (i = 0; i < n; ++i) {
  48828. key[i] = encryptionKey[i];
  48829. }
  48830. key[i++] = num & 0xff;
  48831. key[i++] = num >> 8 & 0xff;
  48832. key[i++] = num >> 16 & 0xff;
  48833. key[i++] = gen & 0xff;
  48834. key[i++] = gen >> 8 & 0xff;
  48835. if (isAes) {
  48836. key[i++] = 0x73;
  48837. key[i++] = 0x41;
  48838. key[i++] = 0x6c;
  48839. key[i++] = 0x54;
  48840. }
  48841. const hash = calculateMD5(key, 0, i);
  48842. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  48843. }
  48844. function buildCipherConstructor(cf, name, num, gen, key) {
  48845. if (!(0, _primitives.isName)(name)) {
  48846. throw new _util.FormatError("Invalid crypt filter name.");
  48847. }
  48848. const cryptFilter = cf.get(name.name);
  48849. let cfm;
  48850. if (cryptFilter !== null && cryptFilter !== undefined) {
  48851. cfm = cryptFilter.get("CFM");
  48852. }
  48853. if (!cfm || cfm.name === "None") {
  48854. return function cipherTransformFactoryBuildCipherConstructorNone() {
  48855. return new NullCipher();
  48856. };
  48857. }
  48858. if (cfm.name === "V2") {
  48859. return function cipherTransformFactoryBuildCipherConstructorV2() {
  48860. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  48861. };
  48862. }
  48863. if (cfm.name === "AESV2") {
  48864. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  48865. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  48866. };
  48867. }
  48868. if (cfm.name === "AESV3") {
  48869. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  48870. return new AES256Cipher(key);
  48871. };
  48872. }
  48873. throw new _util.FormatError("Unknown crypto method");
  48874. }
  48875. class CipherTransformFactory {
  48876. constructor(dict, fileId, password) {
  48877. const filter = dict.get("Filter");
  48878. if (!(0, _primitives.isName)(filter, "Standard")) {
  48879. throw new _util.FormatError("unknown encryption method");
  48880. }
  48881. this.dict = dict;
  48882. const algorithm = dict.get("V");
  48883. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  48884. throw new _util.FormatError("unsupported encryption algorithm");
  48885. }
  48886. this.algorithm = algorithm;
  48887. let keyLength = dict.get("Length");
  48888. if (!keyLength) {
  48889. if (algorithm <= 3) {
  48890. keyLength = 40;
  48891. } else {
  48892. const cfDict = dict.get("CF");
  48893. const streamCryptoName = dict.get("StmF");
  48894. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  48895. cfDict.suppressEncryption = true;
  48896. const handlerDict = cfDict.get(streamCryptoName.name);
  48897. keyLength = handlerDict && handlerDict.get("Length") || 128;
  48898. if (keyLength < 40) {
  48899. keyLength <<= 3;
  48900. }
  48901. }
  48902. }
  48903. }
  48904. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  48905. throw new _util.FormatError("invalid key length");
  48906. }
  48907. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  48908. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  48909. const flags = dict.get("P");
  48910. const revision = dict.get("R");
  48911. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  48912. this.encryptMetadata = encryptMetadata;
  48913. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  48914. let passwordBytes;
  48915. if (password) {
  48916. if (revision === 6) {
  48917. try {
  48918. password = (0, _util.utf8StringToString)(password);
  48919. } catch (ex) {
  48920. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  48921. }
  48922. }
  48923. passwordBytes = (0, _util.stringToBytes)(password);
  48924. }
  48925. let encryptionKey;
  48926. if (algorithm !== 5) {
  48927. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  48928. } else {
  48929. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  48930. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  48931. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  48932. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  48933. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  48934. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  48935. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  48936. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  48937. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  48938. }
  48939. if (!encryptionKey && !password) {
  48940. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  48941. } else if (!encryptionKey && password) {
  48942. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  48943. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  48944. }
  48945. if (!encryptionKey) {
  48946. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  48947. }
  48948. this.encryptionKey = encryptionKey;
  48949. if (algorithm >= 4) {
  48950. const cf = dict.get("CF");
  48951. if ((0, _primitives.isDict)(cf)) {
  48952. cf.suppressEncryption = true;
  48953. }
  48954. this.cf = cf;
  48955. this.stmf = dict.get("StmF") || identityName;
  48956. this.strf = dict.get("StrF") || identityName;
  48957. this.eff = dict.get("EFF") || this.stmf;
  48958. }
  48959. }
  48960. createCipherTransform(num, gen) {
  48961. if (this.algorithm === 4 || this.algorithm === 5) {
  48962. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  48963. }
  48964. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  48965. const cipherConstructor = function buildCipherCipherConstructor() {
  48966. return new ARCFourCipher(key);
  48967. };
  48968. return new CipherTransform(cipherConstructor, cipherConstructor);
  48969. }
  48970. }
  48971. return CipherTransformFactory;
  48972. }();
  48973. exports.CipherTransformFactory = CipherTransformFactory;
  48974. /***/ }),
  48975. /* 73 */
  48976. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48977. Object.defineProperty(exports, "__esModule", ({
  48978. value: true
  48979. }));
  48980. exports.DecryptStream = void 0;
  48981. var _decode_stream = __w_pdfjs_require__(19);
  48982. const chunkSize = 512;
  48983. class DecryptStream extends _decode_stream.DecodeStream {
  48984. constructor(str, maybeLength, decrypt) {
  48985. super(maybeLength);
  48986. this.str = str;
  48987. this.dict = str.dict;
  48988. this.decrypt = decrypt;
  48989. this.nextChunk = null;
  48990. this.initialized = false;
  48991. }
  48992. readBlock() {
  48993. let chunk;
  48994. if (this.initialized) {
  48995. chunk = this.nextChunk;
  48996. } else {
  48997. chunk = this.str.getBytes(chunkSize);
  48998. this.initialized = true;
  48999. }
  49000. if (!chunk || chunk.length === 0) {
  49001. this.eof = true;
  49002. return;
  49003. }
  49004. this.nextChunk = this.str.getBytes(chunkSize);
  49005. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49006. const decrypt = this.decrypt;
  49007. chunk = decrypt(chunk, !hasMoreData);
  49008. let bufferLength = this.bufferLength;
  49009. const n = chunk.length,
  49010. buffer = this.ensureBuffer(bufferLength + n);
  49011. for (let i = 0; i < n; i++) {
  49012. buffer[bufferLength++] = chunk[i];
  49013. }
  49014. this.bufferLength = bufferLength;
  49015. }
  49016. }
  49017. exports.DecryptStream = DecryptStream;
  49018. /***/ }),
  49019. /* 74 */
  49020. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49021. Object.defineProperty(exports, "__esModule", ({
  49022. value: true
  49023. }));
  49024. exports.XFAFactory = void 0;
  49025. var _xfa_object = __w_pdfjs_require__(75);
  49026. var _bind = __w_pdfjs_require__(79);
  49027. var _data = __w_pdfjs_require__(85);
  49028. var _fonts = __w_pdfjs_require__(83);
  49029. var _utils = __w_pdfjs_require__(76);
  49030. var _util = __w_pdfjs_require__(2);
  49031. var _parser = __w_pdfjs_require__(86);
  49032. class XFAFactory {
  49033. constructor(data) {
  49034. try {
  49035. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  49036. const binder = new _bind.Binder(this.root);
  49037. this.form = binder.bind();
  49038. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  49039. this.form[_xfa_object.$globalData].template = this.form;
  49040. } catch (e) {
  49041. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  49042. }
  49043. }
  49044. isValid() {
  49045. return this.root && this.form;
  49046. }
  49047. _createPages() {
  49048. try {
  49049. this.pages = this.form[_xfa_object.$toHTML]();
  49050. this.dims = this.pages.children.map(c => {
  49051. const {
  49052. width,
  49053. height
  49054. } = c.attributes.style;
  49055. return [0, 0, parseInt(width), parseInt(height)];
  49056. });
  49057. } catch (e) {
  49058. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  49059. }
  49060. }
  49061. getBoundingBox(pageIndex) {
  49062. return this.dims[pageIndex];
  49063. }
  49064. get numberPages() {
  49065. if (!this.pages) {
  49066. this._createPages();
  49067. }
  49068. return this.dims.length;
  49069. }
  49070. setImages(images) {
  49071. this.form[_xfa_object.$globalData].images = images;
  49072. }
  49073. setFonts(fonts) {
  49074. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  49075. const missingFonts = [];
  49076. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  49077. typeface = (0, _utils.stripQuotes)(typeface);
  49078. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  49079. if (!font) {
  49080. missingFonts.push(typeface);
  49081. }
  49082. }
  49083. if (missingFonts.length > 0) {
  49084. return missingFonts;
  49085. }
  49086. return null;
  49087. }
  49088. appendFonts(fonts, reallyMissingFonts) {
  49089. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  49090. }
  49091. getPages() {
  49092. if (!this.pages) {
  49093. this._createPages();
  49094. }
  49095. const pages = this.pages;
  49096. this.pages = null;
  49097. return pages;
  49098. }
  49099. serializeData(storage) {
  49100. return this.dataHandler.serialize(storage);
  49101. }
  49102. static _createDocument(data) {
  49103. if (!data["/xdp:xdp"]) {
  49104. return data["xdp:xdp"];
  49105. }
  49106. return Object.values(data).join("");
  49107. }
  49108. }
  49109. exports.XFAFactory = XFAFactory;
  49110. /***/ }),
  49111. /* 75 */
  49112. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49113. Object.defineProperty(exports, "__esModule", ({
  49114. value: true
  49115. }));
  49116. 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.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushGlyphs = 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;
  49117. var _utils = __w_pdfjs_require__(76);
  49118. var _util = __w_pdfjs_require__(2);
  49119. var _core_utils = __w_pdfjs_require__(9);
  49120. var _namespaces = __w_pdfjs_require__(77);
  49121. var _som = __w_pdfjs_require__(78);
  49122. const $acceptWhitespace = Symbol();
  49123. exports.$acceptWhitespace = $acceptWhitespace;
  49124. const $addHTML = Symbol();
  49125. exports.$addHTML = $addHTML;
  49126. const $appendChild = Symbol();
  49127. exports.$appendChild = $appendChild;
  49128. const $childrenToHTML = Symbol();
  49129. exports.$childrenToHTML = $childrenToHTML;
  49130. const $clean = Symbol();
  49131. exports.$clean = $clean;
  49132. const $cleanPage = Symbol();
  49133. exports.$cleanPage = $cleanPage;
  49134. const $cleanup = Symbol();
  49135. exports.$cleanup = $cleanup;
  49136. const $clone = Symbol();
  49137. exports.$clone = $clone;
  49138. const $consumed = Symbol();
  49139. exports.$consumed = $consumed;
  49140. const $content = Symbol("content");
  49141. exports.$content = $content;
  49142. const $data = Symbol("data");
  49143. exports.$data = $data;
  49144. const $dump = Symbol();
  49145. exports.$dump = $dump;
  49146. const $extra = Symbol("extra");
  49147. exports.$extra = $extra;
  49148. const $finalize = Symbol();
  49149. exports.$finalize = $finalize;
  49150. const $flushHTML = Symbol();
  49151. exports.$flushHTML = $flushHTML;
  49152. const $getAttributeIt = Symbol();
  49153. exports.$getAttributeIt = $getAttributeIt;
  49154. const $getAttributes = Symbol();
  49155. exports.$getAttributes = $getAttributes;
  49156. const $getAvailableSpace = Symbol();
  49157. exports.$getAvailableSpace = $getAvailableSpace;
  49158. const $getChildrenByClass = Symbol();
  49159. exports.$getChildrenByClass = $getChildrenByClass;
  49160. const $getChildrenByName = Symbol();
  49161. exports.$getChildrenByName = $getChildrenByName;
  49162. const $getChildrenByNameIt = Symbol();
  49163. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  49164. const $getDataValue = Symbol();
  49165. exports.$getDataValue = $getDataValue;
  49166. const $getExtra = Symbol();
  49167. exports.$getExtra = $getExtra;
  49168. const $getRealChildrenByNameIt = Symbol();
  49169. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  49170. const $getChildren = Symbol();
  49171. exports.$getChildren = $getChildren;
  49172. const $getContainedChildren = Symbol();
  49173. exports.$getContainedChildren = $getContainedChildren;
  49174. const $getNextPage = Symbol();
  49175. exports.$getNextPage = $getNextPage;
  49176. const $getSubformParent = Symbol();
  49177. exports.$getSubformParent = $getSubformParent;
  49178. const $getParent = Symbol();
  49179. exports.$getParent = $getParent;
  49180. const $getTemplateRoot = Symbol();
  49181. exports.$getTemplateRoot = $getTemplateRoot;
  49182. const $globalData = Symbol();
  49183. exports.$globalData = $globalData;
  49184. const $hasSettableValue = Symbol();
  49185. exports.$hasSettableValue = $hasSettableValue;
  49186. const $ids = Symbol();
  49187. exports.$ids = $ids;
  49188. const $indexOf = Symbol();
  49189. exports.$indexOf = $indexOf;
  49190. const $insertAt = Symbol();
  49191. exports.$insertAt = $insertAt;
  49192. const $isCDATAXml = Symbol();
  49193. exports.$isCDATAXml = $isCDATAXml;
  49194. const $isBindable = Symbol();
  49195. exports.$isBindable = $isBindable;
  49196. const $isDataValue = Symbol();
  49197. exports.$isDataValue = $isDataValue;
  49198. const $isDescendent = Symbol();
  49199. exports.$isDescendent = $isDescendent;
  49200. const $isNsAgnostic = Symbol();
  49201. exports.$isNsAgnostic = $isNsAgnostic;
  49202. const $isSplittable = Symbol();
  49203. exports.$isSplittable = $isSplittable;
  49204. const $isThereMoreWidth = Symbol();
  49205. exports.$isThereMoreWidth = $isThereMoreWidth;
  49206. const $isTransparent = Symbol();
  49207. exports.$isTransparent = $isTransparent;
  49208. const $isUsable = Symbol();
  49209. exports.$isUsable = $isUsable;
  49210. const $lastAttribute = Symbol();
  49211. const $namespaceId = Symbol("namespaceId");
  49212. exports.$namespaceId = $namespaceId;
  49213. const $nodeName = Symbol("nodeName");
  49214. exports.$nodeName = $nodeName;
  49215. const $nsAttributes = Symbol();
  49216. exports.$nsAttributes = $nsAttributes;
  49217. const $onChild = Symbol();
  49218. exports.$onChild = $onChild;
  49219. const $onChildCheck = Symbol();
  49220. exports.$onChildCheck = $onChildCheck;
  49221. const $onText = Symbol();
  49222. exports.$onText = $onText;
  49223. const $pushGlyphs = Symbol();
  49224. exports.$pushGlyphs = $pushGlyphs;
  49225. const $removeChild = Symbol();
  49226. exports.$removeChild = $removeChild;
  49227. const $root = Symbol("root");
  49228. exports.$root = $root;
  49229. const $resolvePrototypes = Symbol();
  49230. exports.$resolvePrototypes = $resolvePrototypes;
  49231. const $searchNode = Symbol();
  49232. exports.$searchNode = $searchNode;
  49233. const $setId = Symbol();
  49234. exports.$setId = $setId;
  49235. const $setSetAttributes = Symbol();
  49236. exports.$setSetAttributes = $setSetAttributes;
  49237. const $setValue = Symbol();
  49238. exports.$setValue = $setValue;
  49239. const $tabIndex = Symbol();
  49240. exports.$tabIndex = $tabIndex;
  49241. const $text = Symbol();
  49242. exports.$text = $text;
  49243. const $toHTML = Symbol();
  49244. exports.$toHTML = $toHTML;
  49245. const $toString = Symbol();
  49246. exports.$toString = $toString;
  49247. const $toStyle = Symbol();
  49248. exports.$toStyle = $toStyle;
  49249. const $uid = Symbol("uid");
  49250. exports.$uid = $uid;
  49251. const _applyPrototype = Symbol();
  49252. const _attributes = Symbol();
  49253. const _attributeNames = Symbol();
  49254. const _children = Symbol("_children");
  49255. const _cloneAttribute = Symbol();
  49256. const _dataValue = Symbol();
  49257. const _defaultValue = Symbol();
  49258. const _filteredChildrenGenerator = Symbol();
  49259. const _getPrototype = Symbol();
  49260. const _getUnsetAttributes = Symbol();
  49261. const _hasChildren = Symbol();
  49262. const _max = Symbol();
  49263. const _options = Symbol();
  49264. const _parent = Symbol("parent");
  49265. const _resolvePrototypesHelper = Symbol();
  49266. const _setAttributes = Symbol();
  49267. const _validator = Symbol();
  49268. let uid = 0;
  49269. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  49270. class XFAObject {
  49271. constructor(nsId, name, hasChildren = false) {
  49272. this[$namespaceId] = nsId;
  49273. this[$nodeName] = name;
  49274. this[_hasChildren] = hasChildren;
  49275. this[_parent] = null;
  49276. this[_children] = [];
  49277. this[$uid] = `${name}${uid++}`;
  49278. this[$globalData] = null;
  49279. }
  49280. [$onChild](child) {
  49281. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  49282. return false;
  49283. }
  49284. const name = child[$nodeName];
  49285. const node = this[name];
  49286. if (node instanceof XFAObjectArray) {
  49287. if (node.push(child)) {
  49288. this[$appendChild](child);
  49289. return true;
  49290. }
  49291. } else {
  49292. if (node !== null) {
  49293. this[$removeChild](node);
  49294. }
  49295. this[name] = child;
  49296. this[$appendChild](child);
  49297. return true;
  49298. }
  49299. let id = "";
  49300. if (this.id) {
  49301. id = ` (id: ${this.id})`;
  49302. } else if (this.name) {
  49303. id = ` (name: ${this.name} ${this.h.value})`;
  49304. }
  49305. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  49306. return false;
  49307. }
  49308. [$onChildCheck](child) {
  49309. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  49310. }
  49311. [$isNsAgnostic]() {
  49312. return false;
  49313. }
  49314. [$acceptWhitespace]() {
  49315. return false;
  49316. }
  49317. [$isCDATAXml]() {
  49318. return false;
  49319. }
  49320. [$isBindable]() {
  49321. return false;
  49322. }
  49323. [$setId](ids) {
  49324. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  49325. ids.set(this.id, this);
  49326. }
  49327. }
  49328. [$getTemplateRoot]() {
  49329. return this[$globalData].template;
  49330. }
  49331. [$isSplittable]() {
  49332. return false;
  49333. }
  49334. [$isThereMoreWidth]() {
  49335. return false;
  49336. }
  49337. [$appendChild](child) {
  49338. child[_parent] = this;
  49339. this[_children].push(child);
  49340. }
  49341. [$removeChild](child) {
  49342. const i = this[_children].indexOf(child);
  49343. this[_children].splice(i, 1);
  49344. }
  49345. [$hasSettableValue]() {
  49346. return this.hasOwnProperty("value");
  49347. }
  49348. [$setValue](_) {}
  49349. [$onText](_) {}
  49350. [$finalize]() {}
  49351. [$clean](builder) {
  49352. delete this[_hasChildren];
  49353. if (this[$cleanup]) {
  49354. builder.clean(this[$cleanup]);
  49355. delete this[$cleanup];
  49356. }
  49357. }
  49358. [$indexOf](child) {
  49359. return this[_children].indexOf(child);
  49360. }
  49361. [$insertAt](i, child) {
  49362. child[_parent] = this;
  49363. this[_children].splice(i, 0, child);
  49364. }
  49365. [$isTransparent]() {
  49366. return !this.name;
  49367. }
  49368. [$lastAttribute]() {
  49369. return "";
  49370. }
  49371. [$text]() {
  49372. if (this[_children].length === 0) {
  49373. return this[$content];
  49374. }
  49375. return this[_children].map(c => c[$text]()).join("");
  49376. }
  49377. get [_attributeNames]() {
  49378. const proto = Object.getPrototypeOf(this);
  49379. if (!proto._attributes) {
  49380. const attributes = proto._attributes = new Set();
  49381. for (const name of Object.getOwnPropertyNames(this)) {
  49382. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  49383. break;
  49384. }
  49385. attributes.add(name);
  49386. }
  49387. }
  49388. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  49389. }
  49390. [$isDescendent](parent) {
  49391. let node = this;
  49392. while (node) {
  49393. if (node === parent) {
  49394. return true;
  49395. }
  49396. node = node[$getParent]();
  49397. }
  49398. return false;
  49399. }
  49400. [$getParent]() {
  49401. return this[_parent];
  49402. }
  49403. [$getSubformParent]() {
  49404. return this[$getParent]();
  49405. }
  49406. [$getChildren](name = null) {
  49407. if (!name) {
  49408. return this[_children];
  49409. }
  49410. return this[name];
  49411. }
  49412. [$dump]() {
  49413. const dumped = Object.create(null);
  49414. if (this[$content]) {
  49415. dumped.$content = this[$content];
  49416. }
  49417. for (const name of Object.getOwnPropertyNames(this)) {
  49418. const value = this[name];
  49419. if (value === null) {
  49420. continue;
  49421. }
  49422. if (value instanceof XFAObject) {
  49423. dumped[name] = value[$dump]();
  49424. } else if (value instanceof XFAObjectArray) {
  49425. if (!value.isEmpty()) {
  49426. dumped[name] = value.dump();
  49427. }
  49428. } else {
  49429. dumped[name] = value;
  49430. }
  49431. }
  49432. return dumped;
  49433. }
  49434. [$toStyle]() {
  49435. return null;
  49436. }
  49437. [$toHTML]() {
  49438. return _utils.HTMLResult.EMPTY;
  49439. }
  49440. *[$getContainedChildren]() {
  49441. for (const node of this[$getChildren]()) {
  49442. yield node;
  49443. }
  49444. }
  49445. *[_filteredChildrenGenerator](filter, include) {
  49446. for (const node of this[$getContainedChildren]()) {
  49447. if (!filter || include === filter.has(node[$nodeName])) {
  49448. const availableSpace = this[$getAvailableSpace]();
  49449. const res = node[$toHTML](availableSpace);
  49450. if (!res.success) {
  49451. this[$extra].failingNode = node;
  49452. }
  49453. yield res;
  49454. }
  49455. }
  49456. }
  49457. [$flushHTML]() {
  49458. return null;
  49459. }
  49460. [$addHTML](html, bbox) {
  49461. this[$extra].children.push(html);
  49462. }
  49463. [$getAvailableSpace]() {}
  49464. [$childrenToHTML]({
  49465. filter = null,
  49466. include = true
  49467. }) {
  49468. if (!this[$extra].generator) {
  49469. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  49470. } else {
  49471. const availableSpace = this[$getAvailableSpace]();
  49472. const res = this[$extra].failingNode[$toHTML](availableSpace);
  49473. if (!res.success) {
  49474. return res;
  49475. }
  49476. if (res.html) {
  49477. this[$addHTML](res.html, res.bbox);
  49478. }
  49479. delete this[$extra].failingNode;
  49480. }
  49481. while (true) {
  49482. const gen = this[$extra].generator.next();
  49483. if (gen.done) {
  49484. break;
  49485. }
  49486. const res = gen.value;
  49487. if (!res.success) {
  49488. return res;
  49489. }
  49490. if (res.html) {
  49491. this[$addHTML](res.html, res.bbox);
  49492. }
  49493. }
  49494. this[$extra].generator = null;
  49495. return _utils.HTMLResult.EMPTY;
  49496. }
  49497. [$setSetAttributes](attributes) {
  49498. this[_setAttributes] = new Set(Object.keys(attributes));
  49499. }
  49500. [_getUnsetAttributes](protoAttributes) {
  49501. const allAttr = this[_attributeNames];
  49502. const setAttr = this[_setAttributes];
  49503. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  49504. }
  49505. [$resolvePrototypes](ids, ancestors = new Set()) {
  49506. for (const child of this[_children]) {
  49507. child[_resolvePrototypesHelper](ids, ancestors);
  49508. }
  49509. }
  49510. [_resolvePrototypesHelper](ids, ancestors) {
  49511. const proto = this[_getPrototype](ids, ancestors);
  49512. if (proto) {
  49513. this[_applyPrototype](proto, ids, ancestors);
  49514. } else {
  49515. this[$resolvePrototypes](ids, ancestors);
  49516. }
  49517. }
  49518. [_getPrototype](ids, ancestors) {
  49519. const {
  49520. use,
  49521. usehref
  49522. } = this;
  49523. if (!use && !usehref) {
  49524. return null;
  49525. }
  49526. let proto = null;
  49527. let somExpression = null;
  49528. let id = null;
  49529. let ref = use;
  49530. if (usehref) {
  49531. ref = usehref;
  49532. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  49533. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  49534. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  49535. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  49536. } else if (usehref.startsWith("#")) {
  49537. id = usehref.slice(1);
  49538. } else if (usehref.startsWith(".#")) {
  49539. id = usehref.slice(2);
  49540. }
  49541. } else if (use.startsWith("#")) {
  49542. id = use.slice(1);
  49543. } else {
  49544. somExpression = use;
  49545. }
  49546. this.use = this.usehref = "";
  49547. if (id) {
  49548. proto = ids.get(id);
  49549. } else {
  49550. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  49551. if (proto) {
  49552. proto = proto[0];
  49553. }
  49554. }
  49555. if (!proto) {
  49556. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  49557. return null;
  49558. }
  49559. if (proto[$nodeName] !== this[$nodeName]) {
  49560. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  49561. return null;
  49562. }
  49563. if (ancestors.has(proto)) {
  49564. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  49565. return null;
  49566. }
  49567. ancestors.add(proto);
  49568. const protoProto = proto[_getPrototype](ids, ancestors);
  49569. if (protoProto) {
  49570. proto[_applyPrototype](protoProto, ids, ancestors);
  49571. }
  49572. proto[$resolvePrototypes](ids, ancestors);
  49573. ancestors.delete(proto);
  49574. return proto;
  49575. }
  49576. [_applyPrototype](proto, ids, ancestors) {
  49577. if (ancestors.has(proto)) {
  49578. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  49579. return;
  49580. }
  49581. if (!this[$content] && proto[$content]) {
  49582. this[$content] = proto[$content];
  49583. }
  49584. const newAncestors = new Set(ancestors);
  49585. newAncestors.add(proto);
  49586. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  49587. this[unsetAttrName] = proto[unsetAttrName];
  49588. if (this[_setAttributes]) {
  49589. this[_setAttributes].add(unsetAttrName);
  49590. }
  49591. }
  49592. for (const name of Object.getOwnPropertyNames(this)) {
  49593. if (this[_attributeNames].has(name)) {
  49594. continue;
  49595. }
  49596. const value = this[name];
  49597. const protoValue = proto[name];
  49598. if (value instanceof XFAObjectArray) {
  49599. for (const child of value[_children]) {
  49600. child[_resolvePrototypesHelper](ids, ancestors);
  49601. }
  49602. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  49603. const child = proto[_children][i][$clone]();
  49604. if (value.push(child)) {
  49605. child[_parent] = this;
  49606. this[_children].push(child);
  49607. child[_resolvePrototypesHelper](ids, ancestors);
  49608. } else {
  49609. break;
  49610. }
  49611. }
  49612. continue;
  49613. }
  49614. if (value !== null) {
  49615. value[$resolvePrototypes](ids, ancestors);
  49616. if (protoValue) {
  49617. value[_applyPrototype](protoValue, ids, ancestors);
  49618. }
  49619. continue;
  49620. }
  49621. if (protoValue !== null) {
  49622. const child = protoValue[$clone]();
  49623. child[_parent] = this;
  49624. this[name] = child;
  49625. this[_children].push(child);
  49626. child[_resolvePrototypesHelper](ids, ancestors);
  49627. }
  49628. }
  49629. }
  49630. static [_cloneAttribute](obj) {
  49631. if (Array.isArray(obj)) {
  49632. return obj.map(x => XFAObject[_cloneAttribute](x));
  49633. }
  49634. if (typeof obj === "object" && obj !== null) {
  49635. return Object.assign({}, obj);
  49636. }
  49637. return obj;
  49638. }
  49639. [$clone]() {
  49640. const clone = Object.create(Object.getPrototypeOf(this));
  49641. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  49642. try {
  49643. clone[$symbol] = this[$symbol];
  49644. } catch (_) {
  49645. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  49646. }
  49647. }
  49648. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  49649. clone[_children] = [];
  49650. for (const name of Object.getOwnPropertyNames(this)) {
  49651. if (this[_attributeNames].has(name)) {
  49652. clone[name] = XFAObject[_cloneAttribute](this[name]);
  49653. continue;
  49654. }
  49655. const value = this[name];
  49656. if (value instanceof XFAObjectArray) {
  49657. clone[name] = new XFAObjectArray(value[_max]);
  49658. } else {
  49659. clone[name] = null;
  49660. }
  49661. }
  49662. for (const child of this[_children]) {
  49663. const name = child[$nodeName];
  49664. const clonedChild = child[$clone]();
  49665. clone[_children].push(clonedChild);
  49666. clonedChild[_parent] = clone;
  49667. if (clone[name] === null) {
  49668. clone[name] = clonedChild;
  49669. } else {
  49670. clone[name][_children].push(clonedChild);
  49671. }
  49672. }
  49673. return clone;
  49674. }
  49675. [$getChildren](name = null) {
  49676. if (!name) {
  49677. return this[_children];
  49678. }
  49679. return this[_children].filter(c => c[$nodeName] === name);
  49680. }
  49681. [$getChildrenByClass](name) {
  49682. return this[name];
  49683. }
  49684. [$getChildrenByName](name, allTransparent, first = true) {
  49685. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  49686. }
  49687. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  49688. if (name === "parent") {
  49689. yield this[_parent];
  49690. return;
  49691. }
  49692. for (const child of this[_children]) {
  49693. if (child[$nodeName] === name) {
  49694. yield child;
  49695. }
  49696. if (child.name === name) {
  49697. yield child;
  49698. }
  49699. if (allTransparent || child[$isTransparent]()) {
  49700. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  49701. }
  49702. }
  49703. if (first && this[_attributeNames].has(name)) {
  49704. yield new XFAAttribute(this, name, this[name]);
  49705. }
  49706. }
  49707. }
  49708. exports.XFAObject = XFAObject;
  49709. class XFAObjectArray {
  49710. constructor(max = Infinity) {
  49711. this[_max] = max;
  49712. this[_children] = [];
  49713. }
  49714. push(child) {
  49715. const len = this[_children].length;
  49716. if (len <= this[_max]) {
  49717. this[_children].push(child);
  49718. return true;
  49719. }
  49720. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  49721. return false;
  49722. }
  49723. isEmpty() {
  49724. return this[_children].length === 0;
  49725. }
  49726. dump() {
  49727. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  49728. }
  49729. [$clone]() {
  49730. const clone = new XFAObjectArray(this[_max]);
  49731. clone[_children] = this[_children].map(c => c[$clone]());
  49732. return clone;
  49733. }
  49734. get children() {
  49735. return this[_children];
  49736. }
  49737. clear() {
  49738. this[_children].length = 0;
  49739. }
  49740. }
  49741. exports.XFAObjectArray = XFAObjectArray;
  49742. class XFAAttribute {
  49743. constructor(node, name, value) {
  49744. this[_parent] = node;
  49745. this[$nodeName] = name;
  49746. this[$content] = value;
  49747. this[$consumed] = false;
  49748. this[$uid] = `attribute${uid++}`;
  49749. }
  49750. [$getParent]() {
  49751. return this[_parent];
  49752. }
  49753. [$isDataValue]() {
  49754. return true;
  49755. }
  49756. [$getDataValue]() {
  49757. return this[$content].trim();
  49758. }
  49759. [$setValue](value) {
  49760. value = value.value || "";
  49761. this[$content] = value.toString();
  49762. }
  49763. [$text]() {
  49764. return this[$content];
  49765. }
  49766. [$isDescendent](parent) {
  49767. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  49768. }
  49769. }
  49770. exports.XFAAttribute = XFAAttribute;
  49771. class XmlObject extends XFAObject {
  49772. constructor(nsId, name, attributes = {}) {
  49773. super(nsId, name);
  49774. this[$content] = "";
  49775. this[_dataValue] = null;
  49776. if (name !== "#text") {
  49777. const map = new Map();
  49778. this[_attributes] = map;
  49779. for (const [attrName, value] of Object.entries(attributes)) {
  49780. map.set(attrName, new XFAAttribute(this, attrName, value));
  49781. }
  49782. if (attributes.hasOwnProperty($nsAttributes)) {
  49783. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  49784. if (dataNode !== undefined) {
  49785. if (dataNode === "dataGroup") {
  49786. this[_dataValue] = false;
  49787. } else if (dataNode === "dataValue") {
  49788. this[_dataValue] = true;
  49789. }
  49790. }
  49791. }
  49792. }
  49793. this[$consumed] = false;
  49794. }
  49795. [$toString](buf) {
  49796. const tagName = this[$nodeName];
  49797. if (tagName === "#text") {
  49798. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  49799. return;
  49800. }
  49801. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  49802. buf.push(`<${prefix}${tagName}`);
  49803. for (const [name, value] of this[_attributes].entries()) {
  49804. buf.push(` ${name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  49805. }
  49806. if (this[_dataValue] !== null) {
  49807. if (this[_dataValue]) {
  49808. buf.push(` xfa:dataNode="dataValue"`);
  49809. } else {
  49810. buf.push(` xfa:dataNode="dataGroup"`);
  49811. }
  49812. }
  49813. if (!this[$content] && this[_children].length === 0) {
  49814. buf.push("/>");
  49815. return;
  49816. }
  49817. buf.push(">");
  49818. if (this[$content]) {
  49819. if (typeof this[$content] === "string") {
  49820. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  49821. } else {
  49822. this[$content][$toString](buf);
  49823. }
  49824. } else {
  49825. for (const child of this[_children]) {
  49826. child[$toString](buf);
  49827. }
  49828. }
  49829. buf.push(`</${prefix}${tagName}>`);
  49830. }
  49831. [$onChild](child) {
  49832. if (this[$content]) {
  49833. const node = new XmlObject(this[$namespaceId], "#text");
  49834. this[$appendChild](node);
  49835. node[$content] = this[$content];
  49836. this[$content] = "";
  49837. }
  49838. this[$appendChild](child);
  49839. return true;
  49840. }
  49841. [$onText](str) {
  49842. this[$content] += str;
  49843. }
  49844. [$finalize]() {
  49845. if (this[$content] && this[_children].length > 0) {
  49846. const node = new XmlObject(this[$namespaceId], "#text");
  49847. this[$appendChild](node);
  49848. node[$content] = this[$content];
  49849. delete this[$content];
  49850. }
  49851. }
  49852. [$toHTML]() {
  49853. if (this[$nodeName] === "#text") {
  49854. return _utils.HTMLResult.success({
  49855. name: "#text",
  49856. value: this[$content]
  49857. });
  49858. }
  49859. return _utils.HTMLResult.EMPTY;
  49860. }
  49861. [$getChildren](name = null) {
  49862. if (!name) {
  49863. return this[_children];
  49864. }
  49865. return this[_children].filter(c => c[$nodeName] === name);
  49866. }
  49867. [$getAttributes]() {
  49868. return this[_attributes];
  49869. }
  49870. [$getChildrenByClass](name) {
  49871. const value = this[_attributes].get(name);
  49872. if (value !== undefined) {
  49873. return value;
  49874. }
  49875. return this[$getChildren](name);
  49876. }
  49877. *[$getChildrenByNameIt](name, allTransparent) {
  49878. const value = this[_attributes].get(name);
  49879. if (value) {
  49880. yield value;
  49881. }
  49882. for (const child of this[_children]) {
  49883. if (child[$nodeName] === name) {
  49884. yield child;
  49885. }
  49886. if (allTransparent) {
  49887. yield* child[$getChildrenByNameIt](name, allTransparent);
  49888. }
  49889. }
  49890. }
  49891. *[$getAttributeIt](name, skipConsumed) {
  49892. const value = this[_attributes].get(name);
  49893. if (value && (!skipConsumed || !value[$consumed])) {
  49894. yield value;
  49895. }
  49896. for (const child of this[_children]) {
  49897. yield* child[$getAttributeIt](name, skipConsumed);
  49898. }
  49899. }
  49900. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  49901. for (const child of this[_children]) {
  49902. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  49903. yield child;
  49904. }
  49905. if (allTransparent) {
  49906. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  49907. }
  49908. }
  49909. }
  49910. [$isDataValue]() {
  49911. if (this[_dataValue] === null) {
  49912. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  49913. }
  49914. return this[_dataValue];
  49915. }
  49916. [$getDataValue]() {
  49917. if (this[_dataValue] === null) {
  49918. if (this[_children].length === 0) {
  49919. return this[$content].trim();
  49920. }
  49921. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  49922. return this[_children][0][$text]().trim();
  49923. }
  49924. return null;
  49925. }
  49926. return this[$content].trim();
  49927. }
  49928. [$setValue](value) {
  49929. value = value.value || "";
  49930. this[$content] = value.toString();
  49931. }
  49932. [$dump]() {
  49933. const dumped = Object.create(null);
  49934. if (this[$content]) {
  49935. dumped.$content = this[$content];
  49936. }
  49937. dumped.$name = this[$nodeName];
  49938. dumped.children = [];
  49939. for (const child of this[_children]) {
  49940. dumped.children.push(child[$dump]());
  49941. }
  49942. dumped.attributes = Object.create(null);
  49943. for (const [name, value] of this[_attributes]) {
  49944. dumped.attributes[name] = value[$content];
  49945. }
  49946. return dumped;
  49947. }
  49948. }
  49949. exports.XmlObject = XmlObject;
  49950. class ContentObject extends XFAObject {
  49951. constructor(nsId, name) {
  49952. super(nsId, name);
  49953. this[$content] = "";
  49954. }
  49955. [$onText](text) {
  49956. this[$content] += text;
  49957. }
  49958. [$finalize]() {}
  49959. }
  49960. exports.ContentObject = ContentObject;
  49961. class OptionObject extends ContentObject {
  49962. constructor(nsId, name, options) {
  49963. super(nsId, name);
  49964. this[_options] = options;
  49965. }
  49966. [$finalize]() {
  49967. this[$content] = (0, _utils.getKeyword)({
  49968. data: this[$content],
  49969. defaultValue: this[_options][0],
  49970. validate: k => this[_options].includes(k)
  49971. });
  49972. }
  49973. [$clean](builder) {
  49974. super[$clean](builder);
  49975. delete this[_options];
  49976. }
  49977. }
  49978. exports.OptionObject = OptionObject;
  49979. class StringObject extends ContentObject {
  49980. [$finalize]() {
  49981. this[$content] = this[$content].trim();
  49982. }
  49983. }
  49984. exports.StringObject = StringObject;
  49985. class IntegerObject extends ContentObject {
  49986. constructor(nsId, name, defaultValue, validator) {
  49987. super(nsId, name);
  49988. this[_defaultValue] = defaultValue;
  49989. this[_validator] = validator;
  49990. }
  49991. [$finalize]() {
  49992. this[$content] = (0, _utils.getInteger)({
  49993. data: this[$content],
  49994. defaultValue: this[_defaultValue],
  49995. validate: this[_validator]
  49996. });
  49997. }
  49998. [$clean](builder) {
  49999. super[$clean](builder);
  50000. delete this[_defaultValue];
  50001. delete this[_validator];
  50002. }
  50003. }
  50004. exports.IntegerObject = IntegerObject;
  50005. class Option01 extends IntegerObject {
  50006. constructor(nsId, name) {
  50007. super(nsId, name, 0, n => n === 1);
  50008. }
  50009. }
  50010. exports.Option01 = Option01;
  50011. class Option10 extends IntegerObject {
  50012. constructor(nsId, name) {
  50013. super(nsId, name, 1, n => n === 0);
  50014. }
  50015. }
  50016. exports.Option10 = Option10;
  50017. /***/ }),
  50018. /* 76 */
  50019. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50020. Object.defineProperty(exports, "__esModule", ({
  50021. value: true
  50022. }));
  50023. exports.getBBox = getBBox;
  50024. exports.getColor = getColor;
  50025. exports.getFloat = getFloat;
  50026. exports.getInteger = getInteger;
  50027. exports.getKeyword = getKeyword;
  50028. exports.getMeasurement = getMeasurement;
  50029. exports.getRatio = getRatio;
  50030. exports.getRelevant = getRelevant;
  50031. exports.getStringOption = getStringOption;
  50032. exports.stripQuotes = stripQuotes;
  50033. exports.HTMLResult = void 0;
  50034. var _util = __w_pdfjs_require__(2);
  50035. const dimConverters = {
  50036. pt: x => x,
  50037. cm: x => x / 2.54 * 72,
  50038. mm: x => x / (10 * 2.54) * 72,
  50039. in: x => x * 72,
  50040. px: x => x
  50041. };
  50042. const measurementPattern = /([+-]?[0-9]+\.?[0-9]*)(.*)/;
  50043. function stripQuotes(str) {
  50044. if (str.startsWith("'") || str.startsWith('"')) {
  50045. return str.slice(1, str.length - 1);
  50046. }
  50047. return str;
  50048. }
  50049. function getInteger({
  50050. data,
  50051. defaultValue,
  50052. validate
  50053. }) {
  50054. if (!data) {
  50055. return defaultValue;
  50056. }
  50057. data = data.trim();
  50058. const n = parseInt(data, 10);
  50059. if (!isNaN(n) && validate(n)) {
  50060. return n;
  50061. }
  50062. return defaultValue;
  50063. }
  50064. function getFloat({
  50065. data,
  50066. defaultValue,
  50067. validate
  50068. }) {
  50069. if (!data) {
  50070. return defaultValue;
  50071. }
  50072. data = data.trim();
  50073. const n = parseFloat(data);
  50074. if (!isNaN(n) && validate(n)) {
  50075. return n;
  50076. }
  50077. return defaultValue;
  50078. }
  50079. function getKeyword({
  50080. data,
  50081. defaultValue,
  50082. validate
  50083. }) {
  50084. if (!data) {
  50085. return defaultValue;
  50086. }
  50087. data = data.trim();
  50088. if (validate(data)) {
  50089. return data;
  50090. }
  50091. return defaultValue;
  50092. }
  50093. function getStringOption(data, options) {
  50094. return getKeyword({
  50095. data,
  50096. defaultValue: options[0],
  50097. validate: k => options.includes(k)
  50098. });
  50099. }
  50100. function getMeasurement(str, def = "0") {
  50101. def = def || "0";
  50102. if (!str) {
  50103. return getMeasurement(def);
  50104. }
  50105. const match = str.trim().match(measurementPattern);
  50106. if (!match) {
  50107. return getMeasurement(def);
  50108. }
  50109. const [, valueStr, unit] = match;
  50110. const value = parseFloat(valueStr);
  50111. if (isNaN(value)) {
  50112. return getMeasurement(def);
  50113. }
  50114. if (value === 0) {
  50115. return 0;
  50116. }
  50117. const conv = dimConverters[unit];
  50118. if (conv) {
  50119. return conv(value);
  50120. }
  50121. return value;
  50122. }
  50123. function getRatio(data) {
  50124. if (!data) {
  50125. return {
  50126. num: 1,
  50127. den: 1
  50128. };
  50129. }
  50130. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  50131. if (ratio.length === 1) {
  50132. ratio.push(1);
  50133. }
  50134. if (ratio.length === 0) {
  50135. return {
  50136. num: 1,
  50137. den: 1
  50138. };
  50139. }
  50140. const [num, den] = ratio;
  50141. return {
  50142. num,
  50143. den
  50144. };
  50145. }
  50146. function getRelevant(data) {
  50147. if (!data) {
  50148. return [];
  50149. }
  50150. return data.trim().split(/\s+/).map(e => {
  50151. return {
  50152. excluded: e[0] === "-",
  50153. viewname: e.substring(1)
  50154. };
  50155. });
  50156. }
  50157. function getColor(data, def = [0, 0, 0]) {
  50158. let [r, g, b] = def;
  50159. if (!data) {
  50160. return {
  50161. r,
  50162. g,
  50163. b
  50164. };
  50165. }
  50166. 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);
  50167. if (color.length < 3) {
  50168. return {
  50169. r,
  50170. g,
  50171. b
  50172. };
  50173. }
  50174. [r, g, b] = color;
  50175. return {
  50176. r,
  50177. g,
  50178. b
  50179. };
  50180. }
  50181. function getBBox(data) {
  50182. const def = -1;
  50183. if (!data) {
  50184. return {
  50185. x: def,
  50186. y: def,
  50187. width: def,
  50188. height: def
  50189. };
  50190. }
  50191. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  50192. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  50193. return {
  50194. x: def,
  50195. y: def,
  50196. width: def,
  50197. height: def
  50198. };
  50199. }
  50200. const [x, y, width, height] = bbox;
  50201. return {
  50202. x,
  50203. y,
  50204. width,
  50205. height
  50206. };
  50207. }
  50208. class HTMLResult {
  50209. static get FAILURE() {
  50210. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  50211. }
  50212. static get EMPTY() {
  50213. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  50214. }
  50215. constructor(success, html, bbox, breakNode) {
  50216. this.success = success;
  50217. this.html = html;
  50218. this.bbox = bbox;
  50219. this.breakNode = breakNode;
  50220. }
  50221. isBreak() {
  50222. return !!this.breakNode;
  50223. }
  50224. static breakNode(node) {
  50225. return new HTMLResult(false, null, null, node);
  50226. }
  50227. static success(html, bbox = null) {
  50228. return new HTMLResult(true, html, bbox, null);
  50229. }
  50230. }
  50231. exports.HTMLResult = HTMLResult;
  50232. /***/ }),
  50233. /* 77 */
  50234. /***/ ((__unused_webpack_module, exports) => {
  50235. Object.defineProperty(exports, "__esModule", ({
  50236. value: true
  50237. }));
  50238. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  50239. const $buildXFAObject = Symbol();
  50240. exports.$buildXFAObject = $buildXFAObject;
  50241. const NamespaceIds = {
  50242. config: {
  50243. id: 0,
  50244. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  50245. },
  50246. connectionSet: {
  50247. id: 1,
  50248. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  50249. },
  50250. datasets: {
  50251. id: 2,
  50252. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  50253. },
  50254. form: {
  50255. id: 3,
  50256. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  50257. },
  50258. localeSet: {
  50259. id: 4,
  50260. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  50261. },
  50262. pdf: {
  50263. id: 5,
  50264. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  50265. },
  50266. signature: {
  50267. id: 6,
  50268. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  50269. },
  50270. sourceSet: {
  50271. id: 7,
  50272. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  50273. },
  50274. stylesheet: {
  50275. id: 8,
  50276. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  50277. },
  50278. template: {
  50279. id: 9,
  50280. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  50281. },
  50282. xdc: {
  50283. id: 10,
  50284. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  50285. },
  50286. xdp: {
  50287. id: 11,
  50288. check: ns => ns === "http://ns.adobe.com/xdp/"
  50289. },
  50290. xfdf: {
  50291. id: 12,
  50292. check: ns => ns === "http://ns.adobe.com/xfdf/"
  50293. },
  50294. xhtml: {
  50295. id: 13,
  50296. check: ns => ns === "http://www.w3.org/1999/xhtml"
  50297. },
  50298. xmpmeta: {
  50299. id: 14,
  50300. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  50301. }
  50302. };
  50303. exports.NamespaceIds = NamespaceIds;
  50304. /***/ }),
  50305. /* 78 */
  50306. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50307. Object.defineProperty(exports, "__esModule", ({
  50308. value: true
  50309. }));
  50310. exports.createDataNode = createDataNode;
  50311. exports.searchNode = searchNode;
  50312. var _xfa_object = __w_pdfjs_require__(75);
  50313. var _util = __w_pdfjs_require__(2);
  50314. const namePattern = /^[^.[]+/;
  50315. const indexPattern = /^[^\]]+/;
  50316. const operators = {
  50317. dot: 0,
  50318. dotDot: 1,
  50319. dotHash: 2,
  50320. dotBracket: 3,
  50321. dotParen: 4
  50322. };
  50323. const shortcuts = new Map([["$data", (root, current) => root.datasets.data], ["$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]]);
  50324. const somCache = new WeakMap();
  50325. function parseIndex(index) {
  50326. index = index.trim();
  50327. if (index === "*") {
  50328. return Infinity;
  50329. }
  50330. return parseInt(index, 10) || 0;
  50331. }
  50332. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  50333. let match = expr.match(namePattern);
  50334. if (!match) {
  50335. return null;
  50336. }
  50337. let [name] = match;
  50338. const parsed = [{
  50339. name,
  50340. cacheName: "." + name,
  50341. index: 0,
  50342. js: null,
  50343. formCalc: null,
  50344. operator: operators.dot
  50345. }];
  50346. let pos = name.length;
  50347. while (pos < expr.length) {
  50348. const spos = pos;
  50349. const char = expr.charAt(pos++);
  50350. if (char === "[") {
  50351. match = expr.slice(pos).match(indexPattern);
  50352. if (!match) {
  50353. (0, _util.warn)("XFA - Invalid index in SOM expression");
  50354. return null;
  50355. }
  50356. parsed[parsed.length - 1].index = parseIndex(match[0]);
  50357. pos += match[0].length + 1;
  50358. continue;
  50359. }
  50360. let operator;
  50361. switch (expr.charAt(pos)) {
  50362. case ".":
  50363. if (!dotDotAllowed) {
  50364. return null;
  50365. }
  50366. pos++;
  50367. operator = operators.dotDot;
  50368. break;
  50369. case "#":
  50370. pos++;
  50371. operator = operators.dotHash;
  50372. break;
  50373. case "[":
  50374. if (noExpr) {
  50375. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  50376. return null;
  50377. }
  50378. operator = operators.dotBracket;
  50379. break;
  50380. case "(":
  50381. if (noExpr) {
  50382. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  50383. return null;
  50384. }
  50385. operator = operators.dotParen;
  50386. break;
  50387. default:
  50388. operator = operators.dot;
  50389. break;
  50390. }
  50391. match = expr.slice(pos).match(namePattern);
  50392. if (!match) {
  50393. break;
  50394. }
  50395. [name] = match;
  50396. pos += name.length;
  50397. parsed.push({
  50398. name,
  50399. cacheName: expr.slice(spos, pos),
  50400. operator,
  50401. index: 0,
  50402. js: null,
  50403. formCalc: null
  50404. });
  50405. }
  50406. return parsed;
  50407. }
  50408. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  50409. const parsed = parseExpression(expr, dotDotAllowed);
  50410. if (!parsed) {
  50411. return null;
  50412. }
  50413. const fn = shortcuts.get(parsed[0].name);
  50414. let i = 0;
  50415. let isQualified;
  50416. if (fn) {
  50417. isQualified = true;
  50418. root = [fn(root, container)];
  50419. i = 1;
  50420. } else {
  50421. isQualified = container === null;
  50422. root = [container || root];
  50423. }
  50424. for (let ii = parsed.length; i < ii; i++) {
  50425. const {
  50426. name,
  50427. cacheName,
  50428. operator,
  50429. index
  50430. } = parsed[i];
  50431. const nodes = [];
  50432. for (const node of root) {
  50433. if (!(node instanceof _xfa_object.XFAObject)) {
  50434. continue;
  50435. }
  50436. let children, cached;
  50437. if (useCache) {
  50438. cached = somCache.get(node);
  50439. if (!cached) {
  50440. cached = new Map();
  50441. somCache.set(node, cached);
  50442. }
  50443. children = cached.get(cacheName);
  50444. }
  50445. if (!children) {
  50446. switch (operator) {
  50447. case operators.dot:
  50448. children = node[_xfa_object.$getChildrenByName](name, false);
  50449. break;
  50450. case operators.dotDot:
  50451. children = node[_xfa_object.$getChildrenByName](name, true);
  50452. break;
  50453. case operators.dotHash:
  50454. children = node[_xfa_object.$getChildrenByClass](name);
  50455. if (children instanceof _xfa_object.XFAObjectArray) {
  50456. children = children.children;
  50457. } else {
  50458. children = [children];
  50459. }
  50460. break;
  50461. default:
  50462. break;
  50463. }
  50464. if (useCache) {
  50465. cached.set(cacheName, children);
  50466. }
  50467. }
  50468. if (children.length > 0) {
  50469. nodes.push(children);
  50470. }
  50471. }
  50472. if (nodes.length === 0 && !isQualified && i === 0) {
  50473. const parent = container[_xfa_object.$getParent]();
  50474. container = parent;
  50475. if (!container) {
  50476. return null;
  50477. }
  50478. i = -1;
  50479. root = [container];
  50480. continue;
  50481. }
  50482. if (isFinite(index)) {
  50483. root = nodes.filter(node => index < node.length).map(node => node[index]);
  50484. } else {
  50485. root = nodes.reduce((acc, node) => acc.concat(node), []);
  50486. }
  50487. }
  50488. if (root.length === 0) {
  50489. return null;
  50490. }
  50491. return root;
  50492. }
  50493. function createNodes(root, path) {
  50494. let node = null;
  50495. for (const {
  50496. name,
  50497. index
  50498. } of path) {
  50499. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  50500. node = new _xfa_object.XmlObject(root[_xfa_object.$namespaceId], name);
  50501. root[_xfa_object.$appendChild](node);
  50502. }
  50503. root = node;
  50504. }
  50505. return node;
  50506. }
  50507. function createDataNode(root, container, expr) {
  50508. const parsed = parseExpression(expr);
  50509. if (!parsed) {
  50510. return null;
  50511. }
  50512. if (parsed.some(x => x.operator === operators.dotDot)) {
  50513. return null;
  50514. }
  50515. const fn = shortcuts.get(parsed[0].name);
  50516. let i = 0;
  50517. if (fn) {
  50518. root = fn(root, container);
  50519. i = 1;
  50520. } else {
  50521. root = container || root;
  50522. }
  50523. for (let ii = parsed.length; i < ii; i++) {
  50524. const {
  50525. name,
  50526. operator,
  50527. index
  50528. } = parsed[i];
  50529. if (!isFinite(index)) {
  50530. parsed[i].index = 0;
  50531. return createNodes(root, parsed.slice(i));
  50532. }
  50533. let children;
  50534. switch (operator) {
  50535. case operators.dot:
  50536. children = root[_xfa_object.$getChildrenByName](name, false);
  50537. break;
  50538. case operators.dotDot:
  50539. children = root[_xfa_object.$getChildrenByName](name, true);
  50540. break;
  50541. case operators.dotHash:
  50542. children = root[_xfa_object.$getChildrenByClass](name);
  50543. if (children instanceof _xfa_object.XFAObjectArray) {
  50544. children = children.children;
  50545. } else {
  50546. children = [children];
  50547. }
  50548. break;
  50549. default:
  50550. break;
  50551. }
  50552. if (children.length === 0) {
  50553. return createNodes(root, parsed.slice(i));
  50554. }
  50555. if (index < children.length) {
  50556. const child = children[index];
  50557. if (!(child instanceof _xfa_object.XFAObject)) {
  50558. (0, _util.warn)(`XFA - Cannot create a node.`);
  50559. return null;
  50560. }
  50561. root = child;
  50562. } else {
  50563. parsed[i].index = index - children.length;
  50564. return createNodes(root, parsed.slice(i));
  50565. }
  50566. }
  50567. return null;
  50568. }
  50569. /***/ }),
  50570. /* 79 */
  50571. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50572. Object.defineProperty(exports, "__esModule", ({
  50573. value: true
  50574. }));
  50575. exports.Binder = void 0;
  50576. var _xfa_object = __w_pdfjs_require__(75);
  50577. var _template = __w_pdfjs_require__(80);
  50578. var _som = __w_pdfjs_require__(78);
  50579. var _namespaces = __w_pdfjs_require__(77);
  50580. var _util = __w_pdfjs_require__(2);
  50581. function createText(content) {
  50582. const node = new _template.Text({});
  50583. node[_xfa_object.$content] = content;
  50584. return node;
  50585. }
  50586. class Binder {
  50587. constructor(root) {
  50588. this.root = root;
  50589. this.datasets = root.datasets;
  50590. if (root.datasets && root.datasets.data) {
  50591. this.data = root.datasets.data;
  50592. } else {
  50593. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  50594. }
  50595. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  50596. this.root.form = this.form = root.template[_xfa_object.$clone]();
  50597. }
  50598. _isConsumeData() {
  50599. return !this.emptyMerge && this._mergeMode;
  50600. }
  50601. _isMatchTemplate() {
  50602. return !this._isConsumeData();
  50603. }
  50604. bind() {
  50605. this._bindElement(this.form, this.data);
  50606. return this.form;
  50607. }
  50608. getData() {
  50609. return this.data;
  50610. }
  50611. _bindValue(formNode, data, picture) {
  50612. formNode[_xfa_object.$data] = data;
  50613. if (formNode[_xfa_object.$hasSettableValue]()) {
  50614. if (data[_xfa_object.$isDataValue]()) {
  50615. const value = data[_xfa_object.$getDataValue]();
  50616. formNode[_xfa_object.$setValue](createText(value));
  50617. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  50618. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  50619. formNode[_xfa_object.$setValue](createText(value));
  50620. } else if (this._isConsumeData()) {
  50621. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  50622. }
  50623. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  50624. this._bindElement(formNode, data);
  50625. } else {
  50626. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  50627. }
  50628. }
  50629. _findDataByNameToConsume(name, isValue, dataNode, global) {
  50630. if (!name) {
  50631. return null;
  50632. }
  50633. let generator, match;
  50634. for (let i = 0; i < 3; i++) {
  50635. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  50636. while (true) {
  50637. match = generator.next().value;
  50638. if (!match) {
  50639. break;
  50640. }
  50641. if (isValue === match[_xfa_object.$isDataValue]()) {
  50642. return match;
  50643. }
  50644. }
  50645. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  50646. break;
  50647. }
  50648. dataNode = dataNode[_xfa_object.$getParent]();
  50649. }
  50650. if (!global) {
  50651. return null;
  50652. }
  50653. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  50654. match = generator.next().value;
  50655. if (match) {
  50656. return match;
  50657. }
  50658. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  50659. match = generator.next().value;
  50660. if (match && match[_xfa_object.$isDataValue]()) {
  50661. return match;
  50662. }
  50663. return null;
  50664. }
  50665. _setProperties(formNode, dataNode) {
  50666. if (!formNode.hasOwnProperty("setProperty")) {
  50667. return;
  50668. }
  50669. for (const {
  50670. ref,
  50671. target,
  50672. connection
  50673. } of formNode.setProperty.children) {
  50674. if (connection) {
  50675. continue;
  50676. }
  50677. if (!ref) {
  50678. continue;
  50679. }
  50680. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  50681. if (!nodes) {
  50682. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  50683. continue;
  50684. }
  50685. const [node] = nodes;
  50686. if (!node[_xfa_object.$isDescendent](this.data)) {
  50687. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  50688. continue;
  50689. }
  50690. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  50691. if (!targetNodes) {
  50692. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  50693. continue;
  50694. }
  50695. const [targetNode] = targetNodes;
  50696. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  50697. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  50698. continue;
  50699. }
  50700. const targetParent = targetNode[_xfa_object.$getParent]();
  50701. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  50702. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  50703. continue;
  50704. }
  50705. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  50706. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  50707. continue;
  50708. }
  50709. const content = node[_xfa_object.$text]();
  50710. const name = targetNode[_xfa_object.$nodeName];
  50711. if (targetNode instanceof _xfa_object.XFAAttribute) {
  50712. const attrs = Object.create(null);
  50713. attrs[name] = content;
  50714. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  50715. targetParent[name] = obj[name];
  50716. continue;
  50717. }
  50718. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  50719. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  50720. continue;
  50721. }
  50722. targetNode[_xfa_object.$data] = node;
  50723. targetNode[_xfa_object.$content] = content;
  50724. targetNode[_xfa_object.$finalize]();
  50725. }
  50726. }
  50727. _bindItems(formNode, dataNode) {
  50728. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  50729. return;
  50730. }
  50731. for (const item of formNode.items.children) {
  50732. formNode[_xfa_object.$removeChild](item);
  50733. }
  50734. formNode.items.clear();
  50735. const labels = new _template.Items({});
  50736. const values = new _template.Items({});
  50737. formNode[_xfa_object.$appendChild](labels);
  50738. formNode.items.push(labels);
  50739. formNode[_xfa_object.$appendChild](values);
  50740. formNode.items.push(values);
  50741. for (const {
  50742. ref,
  50743. labelRef,
  50744. valueRef,
  50745. connection
  50746. } of formNode.bindItems.children) {
  50747. if (connection) {
  50748. continue;
  50749. }
  50750. if (!ref) {
  50751. continue;
  50752. }
  50753. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  50754. if (!nodes) {
  50755. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  50756. continue;
  50757. }
  50758. for (const node of nodes) {
  50759. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  50760. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  50761. continue;
  50762. }
  50763. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  50764. if (!labelNodes) {
  50765. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  50766. continue;
  50767. }
  50768. const [labelNode] = labelNodes;
  50769. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  50770. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  50771. continue;
  50772. }
  50773. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  50774. if (!valueNodes) {
  50775. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  50776. continue;
  50777. }
  50778. const [valueNode] = valueNodes;
  50779. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  50780. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  50781. continue;
  50782. }
  50783. const label = createText(labelNode[_xfa_object.$text]());
  50784. const value = createText(valueNode[_xfa_object.$text]());
  50785. labels[_xfa_object.$appendChild](label);
  50786. labels.text.push(label);
  50787. values[_xfa_object.$appendChild](value);
  50788. values.text.push(value);
  50789. }
  50790. }
  50791. }
  50792. _bindOccurrences(formNode, matches, picture) {
  50793. let baseClone;
  50794. if (matches.length > 1) {
  50795. baseClone = formNode[_xfa_object.$clone]();
  50796. }
  50797. this._bindValue(formNode, matches[0], picture);
  50798. this._setProperties(formNode, matches[0]);
  50799. this._bindItems(formNode, matches[0]);
  50800. if (matches.length === 1) {
  50801. return;
  50802. }
  50803. const parent = formNode[_xfa_object.$getParent]();
  50804. const name = formNode[_xfa_object.$nodeName];
  50805. const pos = parent[_xfa_object.$indexOf](formNode);
  50806. for (let i = 1, ii = matches.length; i < ii; i++) {
  50807. const match = matches[i];
  50808. const clone = baseClone[_xfa_object.$clone]();
  50809. clone.occur.min = 1;
  50810. clone.occur.max = 1;
  50811. clone.occur.initial = 1;
  50812. parent[name].push(clone);
  50813. parent[_xfa_object.$insertAt](pos + i, clone);
  50814. this._bindValue(clone, match, picture);
  50815. this._setProperties(clone, match);
  50816. this._bindItems(clone, match);
  50817. }
  50818. }
  50819. _createOccurrences(formNode) {
  50820. if (!this.emptyMerge) {
  50821. return;
  50822. }
  50823. const {
  50824. occur
  50825. } = formNode;
  50826. if (!occur || occur.initial <= 1) {
  50827. return;
  50828. }
  50829. const parent = formNode[_xfa_object.$getParent]();
  50830. const name = formNode[_xfa_object.$nodeName];
  50831. for (let i = 0, ii = occur.initial; i < ii; i++) {
  50832. const clone = formNode[_xfa_object.$clone]();
  50833. clone.occur.min = 1;
  50834. clone.occur.max = 1;
  50835. clone.occur.initial = 1;
  50836. parent[name].push(clone);
  50837. parent[_xfa_object.$appendChild](clone);
  50838. }
  50839. }
  50840. _getOccurInfo(formNode) {
  50841. const {
  50842. occur
  50843. } = formNode;
  50844. const dataName = formNode.name;
  50845. if (!occur || !dataName) {
  50846. return [1, 1];
  50847. }
  50848. const max = occur.max === -1 ? Infinity : occur.max;
  50849. return [occur.min, max];
  50850. }
  50851. _bindElement(formNode, dataNode) {
  50852. const uselessNodes = [];
  50853. this._createOccurrences(formNode);
  50854. for (const child of formNode[_xfa_object.$getChildren]()) {
  50855. if (child[_xfa_object.$data]) {
  50856. continue;
  50857. }
  50858. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  50859. this._mergeMode = child.mergeMode === "consumeData";
  50860. const dataChildren = dataNode[_xfa_object.$getChildren]();
  50861. if (dataChildren.length > 0) {
  50862. this._bindOccurrences(child, [dataChildren[0]], null);
  50863. } else if (this.emptyMerge) {
  50864. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name || "root");
  50865. dataNode[_xfa_object.$appendChild](dataChild);
  50866. this._bindElement(child, dataChild);
  50867. }
  50868. continue;
  50869. }
  50870. if (!child[_xfa_object.$isBindable]()) {
  50871. continue;
  50872. }
  50873. let global = false;
  50874. let picture = null;
  50875. let ref = null;
  50876. let match = null;
  50877. if (child.bind) {
  50878. switch (child.bind.match) {
  50879. case "none":
  50880. this._bindElement(child, dataNode);
  50881. continue;
  50882. case "global":
  50883. global = true;
  50884. break;
  50885. case "dataRef":
  50886. if (!child.bind.ref) {
  50887. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  50888. this._bindElement(child, dataNode);
  50889. continue;
  50890. }
  50891. ref = child.bind.ref;
  50892. break;
  50893. default:
  50894. break;
  50895. }
  50896. if (child.bind.picture) {
  50897. picture = child.bind.picture[_xfa_object.$content];
  50898. }
  50899. }
  50900. const [min, max] = this._getOccurInfo(child);
  50901. if (ref) {
  50902. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  50903. if (match === null) {
  50904. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  50905. if (!match) {
  50906. continue;
  50907. }
  50908. if (this._isConsumeData()) {
  50909. match[_xfa_object.$consumed] = true;
  50910. }
  50911. this._bindElement(child, match);
  50912. continue;
  50913. } else {
  50914. if (this._isConsumeData()) {
  50915. match = match.filter(node => !node[_xfa_object.$consumed]);
  50916. }
  50917. if (match.length > max) {
  50918. match = match.slice(0, max);
  50919. } else if (match.length === 0) {
  50920. match = null;
  50921. }
  50922. if (match && this._isConsumeData()) {
  50923. match.forEach(node => {
  50924. node[_xfa_object.$consumed] = true;
  50925. });
  50926. }
  50927. }
  50928. } else {
  50929. if (!child.name) {
  50930. this._bindElement(child, dataNode);
  50931. continue;
  50932. }
  50933. if (this._isConsumeData()) {
  50934. const matches = [];
  50935. while (matches.length < max) {
  50936. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  50937. if (!found) {
  50938. break;
  50939. }
  50940. found[_xfa_object.$consumed] = true;
  50941. matches.push(found);
  50942. }
  50943. match = matches.length > 0 ? matches : null;
  50944. } else {
  50945. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  50946. if (!match) {
  50947. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name);
  50948. if (this.emptyMerge) {
  50949. match[_xfa_object.$consumed] = true;
  50950. }
  50951. dataNode[_xfa_object.$appendChild](match);
  50952. this._setProperties(child, match);
  50953. this._bindItems(child, match);
  50954. this._bindElement(child, match);
  50955. continue;
  50956. }
  50957. if (this.emptyMerge) {
  50958. match[_xfa_object.$consumed] = true;
  50959. }
  50960. match = [match];
  50961. }
  50962. }
  50963. if (match) {
  50964. if (match.length < min) {
  50965. (0, _util.warn)(`XFA - Must have at least ${min} occurrences: ${formNode[_xfa_object.$nodeName]}.`);
  50966. continue;
  50967. }
  50968. this._bindOccurrences(child, match, picture);
  50969. } else if (min > 0) {
  50970. this._setProperties(child, dataNode);
  50971. this._bindItems(child, dataNode);
  50972. this._bindElement(child, dataNode);
  50973. } else {
  50974. uselessNodes.push(child);
  50975. }
  50976. }
  50977. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  50978. }
  50979. }
  50980. exports.Binder = Binder;
  50981. /***/ }),
  50982. /* 80 */
  50983. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50984. Object.defineProperty(exports, "__esModule", ({
  50985. value: true
  50986. }));
  50987. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  50988. var _xfa_object = __w_pdfjs_require__(75);
  50989. var _namespaces = __w_pdfjs_require__(77);
  50990. var _layout = __w_pdfjs_require__(81);
  50991. var _html_utils = __w_pdfjs_require__(82);
  50992. var _utils = __w_pdfjs_require__(76);
  50993. var _util = __w_pdfjs_require__(2);
  50994. var _som = __w_pdfjs_require__(78);
  50995. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  50996. const SVG_NS = "http://www.w3.org/2000/svg";
  50997. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  50998. const MAX_EMPTY_PAGES = 3;
  50999. function hasMargin(node) {
  51000. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  51001. }
  51002. function _setValue(templateNode, value) {
  51003. if (!templateNode.value) {
  51004. const nodeValue = new Value({});
  51005. templateNode[_xfa_object.$appendChild](nodeValue);
  51006. templateNode.value = nodeValue;
  51007. }
  51008. templateNode.value[_xfa_object.$setValue](value);
  51009. }
  51010. function* getContainedChildren(node) {
  51011. for (const child of node[_xfa_object.$getChildren]()) {
  51012. if (child instanceof SubformSet) {
  51013. yield* child[_xfa_object.$getContainedChildren]();
  51014. continue;
  51015. }
  51016. yield child;
  51017. }
  51018. }
  51019. function setTabIndex(node) {
  51020. while (node) {
  51021. if (!node.traversal || node[_xfa_object.$tabIndex]) {
  51022. return;
  51023. }
  51024. let next = null;
  51025. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  51026. if (child.operation === "next") {
  51027. next = child;
  51028. break;
  51029. }
  51030. }
  51031. if (!next || !next.ref) {
  51032. return;
  51033. }
  51034. const root = node[_xfa_object.$getTemplateRoot]();
  51035. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  51036. const ref = root[_xfa_object.$searchNode](next.ref, node);
  51037. if (!ref) {
  51038. return;
  51039. }
  51040. node = ref[0];
  51041. }
  51042. }
  51043. function valueToHtml(value) {
  51044. return _utils.HTMLResult.success({
  51045. name: "div",
  51046. attributes: {
  51047. class: ["xfaRich"],
  51048. style: Object.create(null)
  51049. },
  51050. children: [{
  51051. name: "span",
  51052. attributes: {
  51053. style: Object.create(null)
  51054. },
  51055. value
  51056. }]
  51057. });
  51058. }
  51059. function setFirstUnsplittable(node) {
  51060. const root = node[_xfa_object.$getTemplateRoot]();
  51061. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  51062. root[_xfa_object.$extra].firstUnsplittable = node;
  51063. root[_xfa_object.$extra].noLayoutFailure = true;
  51064. }
  51065. }
  51066. function unsetFirstUnsplittable(node) {
  51067. const root = node[_xfa_object.$getTemplateRoot]();
  51068. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  51069. root[_xfa_object.$extra].noLayoutFailure = false;
  51070. }
  51071. }
  51072. function handleBreak(node) {
  51073. if (node[_xfa_object.$extra]) {
  51074. return false;
  51075. }
  51076. node[_xfa_object.$extra] = Object.create(null);
  51077. if (node.targetType === "auto") {
  51078. return false;
  51079. }
  51080. const root = node[_xfa_object.$getTemplateRoot]();
  51081. let target = null;
  51082. if (node.target) {
  51083. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  51084. if (!target) {
  51085. return false;
  51086. }
  51087. target = target[0];
  51088. }
  51089. const {
  51090. currentPageArea,
  51091. currentContentArea
  51092. } = root[_xfa_object.$extra];
  51093. if (node.targetType === "pageArea") {
  51094. if (!(target instanceof PageArea)) {
  51095. target = null;
  51096. }
  51097. if (node.startNew) {
  51098. node[_xfa_object.$extra].target = target || currentPageArea;
  51099. return true;
  51100. } else if (target && target !== currentPageArea) {
  51101. node[_xfa_object.$extra].target = target;
  51102. return true;
  51103. }
  51104. return false;
  51105. }
  51106. if (!(target instanceof ContentArea)) {
  51107. target = null;
  51108. }
  51109. const pageArea = target && target[_xfa_object.$getParent]();
  51110. let index;
  51111. if (node.startNew) {
  51112. if (target) {
  51113. const contentAreas = pageArea.contentArea.children;
  51114. index = contentAreas.findIndex(e => e === target) - 1;
  51115. } else {
  51116. index = currentPageArea.contentArea.children.findIndex(e => e === currentContentArea);
  51117. }
  51118. } else if (target && target !== currentContentArea) {
  51119. const contentAreas = pageArea.contentArea.children;
  51120. index = contentAreas.findIndex(e => e === target) - 1;
  51121. } else {
  51122. return false;
  51123. }
  51124. node[_xfa_object.$extra].target = pageArea === currentPageArea ? null : pageArea;
  51125. node[_xfa_object.$extra].index = index;
  51126. return true;
  51127. }
  51128. function handleOverflow(node, extraNode, space) {
  51129. const root = node[_xfa_object.$getTemplateRoot]();
  51130. const saved = root[_xfa_object.$extra].noLayoutFailure;
  51131. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  51132. extraNode[_xfa_object.$getSubformParent] = () => node;
  51133. root[_xfa_object.$extra].noLayoutFailure = true;
  51134. const res = extraNode[_xfa_object.$toHTML](space);
  51135. node[_xfa_object.$addHTML](res.html, res.bbox);
  51136. root[_xfa_object.$extra].noLayoutFailure = saved;
  51137. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  51138. }
  51139. class AppearanceFilter extends _xfa_object.StringObject {
  51140. constructor(attributes) {
  51141. super(TEMPLATE_NS_ID, "appearanceFilter");
  51142. this.id = attributes.id || "";
  51143. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51144. this.use = attributes.use || "";
  51145. this.usehref = attributes.usehref || "";
  51146. }
  51147. }
  51148. class Arc extends _xfa_object.XFAObject {
  51149. constructor(attributes) {
  51150. super(TEMPLATE_NS_ID, "arc", true);
  51151. this.circular = (0, _utils.getInteger)({
  51152. data: attributes.circular,
  51153. defaultValue: 0,
  51154. validate: x => x === 1
  51155. });
  51156. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  51157. this.id = attributes.id || "";
  51158. this.startAngle = (0, _utils.getFloat)({
  51159. data: attributes.startAngle,
  51160. defaultValue: 0,
  51161. validate: x => true
  51162. });
  51163. this.sweepAngle = (0, _utils.getFloat)({
  51164. data: attributes.sweepAngle,
  51165. defaultValue: 360,
  51166. validate: x => true
  51167. });
  51168. this.use = attributes.use || "";
  51169. this.usehref = attributes.usehref || "";
  51170. this.edge = null;
  51171. this.fill = null;
  51172. }
  51173. [_xfa_object.$toHTML]() {
  51174. const edge = this.edge ? this.edge : new Edge({});
  51175. const edgeStyle = edge[_xfa_object.$toStyle]();
  51176. const style = Object.create(null);
  51177. if (this.fill && this.fill.presence === "visible") {
  51178. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  51179. } else {
  51180. style.fill = "transparent";
  51181. }
  51182. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  51183. style.stroke = edgeStyle.color;
  51184. let arc;
  51185. const attributes = {
  51186. xmlns: SVG_NS,
  51187. style: {
  51188. width: "100%",
  51189. height: "100%",
  51190. overflow: "visible"
  51191. }
  51192. };
  51193. if (this.startAngle === 0 && this.sweepAngle === 360) {
  51194. arc = {
  51195. name: "ellipse",
  51196. attributes: {
  51197. xmlns: SVG_NS,
  51198. cx: "50%",
  51199. cy: "50%",
  51200. rx: "50%",
  51201. ry: "50%",
  51202. style
  51203. }
  51204. };
  51205. } else {
  51206. const startAngle = this.startAngle * Math.PI / 180;
  51207. const sweepAngle = this.sweepAngle * Math.PI / 180;
  51208. const largeArc = this.sweepAngle - this.startAngle > 180 ? 1 : 0;
  51209. const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(sweepAngle)), 50 * (1 - Math.sin(sweepAngle))];
  51210. arc = {
  51211. name: "path",
  51212. attributes: {
  51213. xmlns: SVG_NS,
  51214. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  51215. vectorEffect: "non-scaling-stroke",
  51216. style
  51217. }
  51218. };
  51219. Object.assign(attributes, {
  51220. viewBox: "0 0 100 100",
  51221. preserveAspectRatio: "none"
  51222. });
  51223. }
  51224. const svg = {
  51225. name: "svg",
  51226. children: [arc],
  51227. attributes
  51228. };
  51229. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  51230. if (hasMargin(parent)) {
  51231. return _utils.HTMLResult.success({
  51232. name: "div",
  51233. attributes: {
  51234. style: {
  51235. display: "inline",
  51236. width: "100%",
  51237. height: "100%"
  51238. }
  51239. },
  51240. children: [svg]
  51241. });
  51242. }
  51243. svg.attributes.style.position = "absolute";
  51244. return _utils.HTMLResult.success(svg);
  51245. }
  51246. }
  51247. class Area extends _xfa_object.XFAObject {
  51248. constructor(attributes) {
  51249. super(TEMPLATE_NS_ID, "area", true);
  51250. this.colSpan = (0, _utils.getInteger)({
  51251. data: attributes.colSpan,
  51252. defaultValue: 1,
  51253. validate: n => n >= 1 || n === -1
  51254. });
  51255. this.id = attributes.id || "";
  51256. this.name = attributes.name || "";
  51257. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51258. this.use = attributes.use || "";
  51259. this.usehref = attributes.usehref || "";
  51260. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  51261. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  51262. this.desc = null;
  51263. this.extras = null;
  51264. this.area = new _xfa_object.XFAObjectArray();
  51265. this.draw = new _xfa_object.XFAObjectArray();
  51266. this.exObject = new _xfa_object.XFAObjectArray();
  51267. this.exclGroup = new _xfa_object.XFAObjectArray();
  51268. this.field = new _xfa_object.XFAObjectArray();
  51269. this.subform = new _xfa_object.XFAObjectArray();
  51270. this.subformSet = new _xfa_object.XFAObjectArray();
  51271. }
  51272. *[_xfa_object.$getContainedChildren]() {
  51273. yield* getContainedChildren(this);
  51274. }
  51275. [_xfa_object.$isTransparent]() {
  51276. return true;
  51277. }
  51278. [_xfa_object.$addHTML](html, bbox) {
  51279. const [x, y, w, h] = bbox;
  51280. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  51281. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  51282. this[_xfa_object.$extra].children.push(html);
  51283. }
  51284. [_xfa_object.$getAvailableSpace]() {
  51285. return this[_xfa_object.$extra].availableSpace;
  51286. }
  51287. [_xfa_object.$toHTML](availableSpace) {
  51288. const style = (0, _html_utils.toStyle)(this, "position");
  51289. const attributes = {
  51290. style,
  51291. id: this[_xfa_object.$uid],
  51292. class: ["xfaArea"]
  51293. };
  51294. if ((0, _html_utils.isPrintOnly)(this)) {
  51295. attributes.class.push("xfaPrintOnly");
  51296. }
  51297. if (this.name) {
  51298. attributes.xfaName = this.name;
  51299. }
  51300. const children = [];
  51301. this[_xfa_object.$extra] = {
  51302. children,
  51303. width: 0,
  51304. height: 0,
  51305. availableSpace
  51306. };
  51307. const result = this[_xfa_object.$childrenToHTML]({
  51308. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  51309. include: true
  51310. });
  51311. if (!result.success) {
  51312. if (result.isBreak()) {
  51313. return result;
  51314. }
  51315. delete this[_xfa_object.$extra];
  51316. return _utils.HTMLResult.FAILURE;
  51317. }
  51318. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  51319. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  51320. const html = {
  51321. name: "div",
  51322. attributes,
  51323. children
  51324. };
  51325. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  51326. delete this[_xfa_object.$extra];
  51327. return _utils.HTMLResult.success(html, bbox);
  51328. }
  51329. }
  51330. class Assist extends _xfa_object.XFAObject {
  51331. constructor(attributes) {
  51332. super(TEMPLATE_NS_ID, "assist", true);
  51333. this.id = attributes.id || "";
  51334. this.role = attributes.role || "";
  51335. this.use = attributes.use || "";
  51336. this.usehref = attributes.usehref || "";
  51337. this.speak = null;
  51338. this.toolTip = null;
  51339. }
  51340. [_xfa_object.$toHTML]() {
  51341. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  51342. }
  51343. }
  51344. class Barcode extends _xfa_object.XFAObject {
  51345. constructor(attributes) {
  51346. super(TEMPLATE_NS_ID, "barcode", true);
  51347. this.charEncoding = (0, _utils.getKeyword)({
  51348. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  51349. defaultValue: "",
  51350. 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-[0-9]{2}/)
  51351. });
  51352. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  51353. this.dataColumnCount = (0, _utils.getInteger)({
  51354. data: attributes.dataColumnCount,
  51355. defaultValue: -1,
  51356. validate: x => x >= 0
  51357. });
  51358. this.dataLength = (0, _utils.getInteger)({
  51359. data: attributes.dataLength,
  51360. defaultValue: -1,
  51361. validate: x => x >= 0
  51362. });
  51363. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  51364. this.dataRowCount = (0, _utils.getInteger)({
  51365. data: attributes.dataRowCount,
  51366. defaultValue: -1,
  51367. validate: x => x >= 0
  51368. });
  51369. this.endChar = attributes.endChar || "";
  51370. this.errorCorrectionLevel = (0, _utils.getInteger)({
  51371. data: attributes.errorCorrectionLevel,
  51372. defaultValue: -1,
  51373. validate: x => x >= 0 && x <= 8
  51374. });
  51375. this.id = attributes.id || "";
  51376. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  51377. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  51378. this.printCheckDigit = (0, _utils.getInteger)({
  51379. data: attributes.printCheckDigit,
  51380. defaultValue: 0,
  51381. validate: x => x === 1
  51382. });
  51383. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  51384. this.startChar = attributes.startChar || "";
  51385. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  51386. this.truncate = (0, _utils.getInteger)({
  51387. data: attributes.truncate,
  51388. defaultValue: 0,
  51389. validate: x => x === 1
  51390. });
  51391. 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"]);
  51392. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  51393. this.use = attributes.use || "";
  51394. this.usehref = attributes.usehref || "";
  51395. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  51396. this.encrypt = null;
  51397. this.extras = null;
  51398. }
  51399. }
  51400. class Bind extends _xfa_object.XFAObject {
  51401. constructor(attributes) {
  51402. super(TEMPLATE_NS_ID, "bind", true);
  51403. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  51404. this.ref = attributes.ref || "";
  51405. this.picture = null;
  51406. }
  51407. }
  51408. class BindItems extends _xfa_object.XFAObject {
  51409. constructor(attributes) {
  51410. super(TEMPLATE_NS_ID, "bindItems");
  51411. this.connection = attributes.connection || "";
  51412. this.labelRef = attributes.labelRef || "";
  51413. this.ref = attributes.ref || "";
  51414. this.valueRef = attributes.valueRef || "";
  51415. }
  51416. }
  51417. exports.BindItems = BindItems;
  51418. class Bookend extends _xfa_object.XFAObject {
  51419. constructor(attributes) {
  51420. super(TEMPLATE_NS_ID, "bookend");
  51421. this.id = attributes.id || "";
  51422. this.leader = attributes.leader || "";
  51423. this.trailer = attributes.trailer || "";
  51424. this.use = attributes.use || "";
  51425. this.usehref = attributes.usehref || "";
  51426. }
  51427. }
  51428. class BooleanElement extends _xfa_object.Option01 {
  51429. constructor(attributes) {
  51430. super(TEMPLATE_NS_ID, "boolean");
  51431. this.id = attributes.id || "";
  51432. this.name = attributes.name || "";
  51433. this.use = attributes.use || "";
  51434. this.usehref = attributes.usehref || "";
  51435. }
  51436. [_xfa_object.$toHTML](availableSpace) {
  51437. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  51438. }
  51439. }
  51440. class Border extends _xfa_object.XFAObject {
  51441. constructor(attributes) {
  51442. super(TEMPLATE_NS_ID, "border", true);
  51443. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  51444. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  51445. this.id = attributes.id || "";
  51446. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  51447. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51448. this.use = attributes.use || "";
  51449. this.usehref = attributes.usehref || "";
  51450. this.corner = new _xfa_object.XFAObjectArray(4);
  51451. this.edge = new _xfa_object.XFAObjectArray(4);
  51452. this.extras = null;
  51453. this.fill = null;
  51454. this.margin = null;
  51455. }
  51456. [_xfa_object.$toStyle]() {
  51457. const edges = this.edge.children.slice();
  51458. if (edges.length < 4) {
  51459. const defaultEdge = edges[edges.length - 1] || new Edge({});
  51460. for (let i = edges.length; i < 4; i++) {
  51461. edges.push(defaultEdge);
  51462. }
  51463. }
  51464. const edgeStyles = edges.map(node => {
  51465. const style = node[_xfa_object.$toStyle]();
  51466. style.color = style.color || "#000000";
  51467. return style;
  51468. });
  51469. const widths = edges.map(edge => edge.thickness);
  51470. const insets = [0, 0, 0, 0];
  51471. if (this.margin) {
  51472. insets[0] = this.margin.topInset;
  51473. insets[1] = this.margin.rightInset;
  51474. insets[2] = this.margin.bottomInset;
  51475. insets[3] = this.margin.leftInset;
  51476. }
  51477. this[_xfa_object.$extra] = {
  51478. widths,
  51479. insets
  51480. };
  51481. const style = Object.create(null);
  51482. if (this.margin) {
  51483. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  51484. }
  51485. if (this.fill && this.fill.presence === "visible") {
  51486. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  51487. }
  51488. if (this.corner.children.some(node => node.radius !== 0)) {
  51489. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  51490. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  51491. const last = cornerStyles[cornerStyles.length - 1];
  51492. for (let i = cornerStyles.length; i < 4; i++) {
  51493. cornerStyles.push(last);
  51494. }
  51495. }
  51496. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  51497. }
  51498. switch (this.presence) {
  51499. case "invisible":
  51500. case "hidden":
  51501. style.borderStyle = "";
  51502. break;
  51503. case "inactive":
  51504. style.borderStyle = "none";
  51505. break;
  51506. default:
  51507. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  51508. break;
  51509. }
  51510. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  51511. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  51512. return style;
  51513. }
  51514. }
  51515. class Break extends _xfa_object.XFAObject {
  51516. constructor(attributes) {
  51517. super(TEMPLATE_NS_ID, "break", true);
  51518. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  51519. this.afterTarget = attributes.afterTarget || "";
  51520. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  51521. this.beforeTarget = attributes.beforeTarget || "";
  51522. this.bookendLeader = attributes.bookendLeader || "";
  51523. this.bookendTrailer = attributes.bookendTrailer || "";
  51524. this.id = attributes.id || "";
  51525. this.overflowLeader = attributes.overflowLeader || "";
  51526. this.overflowTarget = attributes.overflowTarget || "";
  51527. this.overflowTrailer = attributes.overflowTrailer || "";
  51528. this.startNew = (0, _utils.getInteger)({
  51529. data: attributes.startNew,
  51530. defaultValue: 0,
  51531. validate: x => x === 1
  51532. });
  51533. this.use = attributes.use || "";
  51534. this.usehref = attributes.usehref || "";
  51535. this.extras = null;
  51536. }
  51537. }
  51538. class BreakAfter extends _xfa_object.XFAObject {
  51539. constructor(attributes) {
  51540. super(TEMPLATE_NS_ID, "breakAfter", true);
  51541. this.id = attributes.id || "";
  51542. this.leader = attributes.leader || "";
  51543. this.startNew = (0, _utils.getInteger)({
  51544. data: attributes.startNew,
  51545. defaultValue: 0,
  51546. validate: x => x === 1
  51547. });
  51548. this.target = attributes.target || "";
  51549. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  51550. this.trailer = attributes.trailer || "";
  51551. this.use = attributes.use || "";
  51552. this.usehref = attributes.usehref || "";
  51553. this.script = null;
  51554. }
  51555. }
  51556. class BreakBefore extends _xfa_object.XFAObject {
  51557. constructor(attributes) {
  51558. super(TEMPLATE_NS_ID, "breakBefore", true);
  51559. this.id = attributes.id || "";
  51560. this.leader = attributes.leader || "";
  51561. this.startNew = (0, _utils.getInteger)({
  51562. data: attributes.startNew,
  51563. defaultValue: 0,
  51564. validate: x => x === 1
  51565. });
  51566. this.target = attributes.target || "";
  51567. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  51568. this.trailer = attributes.trailer || "";
  51569. this.use = attributes.use || "";
  51570. this.usehref = attributes.usehref || "";
  51571. this.script = null;
  51572. }
  51573. [_xfa_object.$toHTML](availableSpace) {
  51574. this[_xfa_object.$extra] = {};
  51575. return _utils.HTMLResult.FAILURE;
  51576. }
  51577. }
  51578. class Button extends _xfa_object.XFAObject {
  51579. constructor(attributes) {
  51580. super(TEMPLATE_NS_ID, "button", true);
  51581. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  51582. this.id = attributes.id || "";
  51583. this.use = attributes.use || "";
  51584. this.usehref = attributes.usehref || "";
  51585. this.extras = null;
  51586. }
  51587. [_xfa_object.$toHTML](availableSpace) {
  51588. return _utils.HTMLResult.success({
  51589. name: "button",
  51590. attributes: {
  51591. id: this[_xfa_object.$uid],
  51592. class: ["xfaButton"],
  51593. style: {}
  51594. },
  51595. children: []
  51596. });
  51597. }
  51598. }
  51599. class Calculate extends _xfa_object.XFAObject {
  51600. constructor(attributes) {
  51601. super(TEMPLATE_NS_ID, "calculate", true);
  51602. this.id = attributes.id || "";
  51603. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  51604. this.use = attributes.use || "";
  51605. this.usehref = attributes.usehref || "";
  51606. this.extras = null;
  51607. this.message = null;
  51608. this.script = null;
  51609. }
  51610. }
  51611. class Caption extends _xfa_object.XFAObject {
  51612. constructor(attributes) {
  51613. super(TEMPLATE_NS_ID, "caption", true);
  51614. this.id = attributes.id || "";
  51615. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  51616. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  51617. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  51618. this.use = attributes.use || "";
  51619. this.usehref = attributes.usehref || "";
  51620. this.extras = null;
  51621. this.font = null;
  51622. this.margin = null;
  51623. this.para = null;
  51624. this.value = null;
  51625. }
  51626. [_xfa_object.$setValue](value) {
  51627. _setValue(this, value);
  51628. }
  51629. [_xfa_object.$getExtra](availableSpace) {
  51630. if (!this[_xfa_object.$extra]) {
  51631. let {
  51632. width,
  51633. height
  51634. } = availableSpace;
  51635. switch (this.placement) {
  51636. case "left":
  51637. case "right":
  51638. case "inline":
  51639. width = this.reserve <= 0 ? width : this.reserve;
  51640. break;
  51641. case "top":
  51642. case "bottom":
  51643. height = this.reserve <= 0 ? height : this.reserve;
  51644. break;
  51645. }
  51646. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  51647. width,
  51648. height
  51649. });
  51650. }
  51651. return this[_xfa_object.$extra];
  51652. }
  51653. [_xfa_object.$toHTML](availableSpace) {
  51654. if (!this.value) {
  51655. return _utils.HTMLResult.EMPTY;
  51656. }
  51657. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  51658. if (!value) {
  51659. return _utils.HTMLResult.EMPTY;
  51660. }
  51661. const savedReserve = this.reserve;
  51662. if (this.reserve <= 0) {
  51663. const {
  51664. w,
  51665. h
  51666. } = this[_xfa_object.$getExtra](availableSpace);
  51667. switch (this.placement) {
  51668. case "left":
  51669. case "right":
  51670. case "inline":
  51671. this.reserve = w;
  51672. break;
  51673. case "top":
  51674. case "bottom":
  51675. this.reserve = h;
  51676. break;
  51677. }
  51678. }
  51679. const children = [];
  51680. if (typeof value === "string") {
  51681. children.push({
  51682. name: "#text",
  51683. value
  51684. });
  51685. } else {
  51686. children.push(value);
  51687. }
  51688. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  51689. switch (this.placement) {
  51690. case "left":
  51691. case "right":
  51692. if (this.reserve > 0) {
  51693. style.width = (0, _html_utils.measureToString)(this.reserve);
  51694. }
  51695. break;
  51696. case "top":
  51697. case "bottom":
  51698. if (this.reserve > 0) {
  51699. style.height = (0, _html_utils.measureToString)(this.reserve);
  51700. }
  51701. break;
  51702. }
  51703. (0, _html_utils.setPara)(this, null, value);
  51704. this.reserve = savedReserve;
  51705. return _utils.HTMLResult.success({
  51706. name: "div",
  51707. attributes: {
  51708. style,
  51709. class: ["xfaCaption"]
  51710. },
  51711. children
  51712. });
  51713. }
  51714. }
  51715. class Certificate extends _xfa_object.StringObject {
  51716. constructor(attributes) {
  51717. super(TEMPLATE_NS_ID, "certificate");
  51718. this.id = attributes.id || "";
  51719. this.name = attributes.name || "";
  51720. this.use = attributes.use || "";
  51721. this.usehref = attributes.usehref || "";
  51722. }
  51723. }
  51724. class Certificates extends _xfa_object.XFAObject {
  51725. constructor(attributes) {
  51726. super(TEMPLATE_NS_ID, "certificates", true);
  51727. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  51728. this.id = attributes.id || "";
  51729. this.url = attributes.url || "";
  51730. this.urlPolicy = attributes.urlPolicy || "";
  51731. this.use = attributes.use || "";
  51732. this.usehref = attributes.usehref || "";
  51733. this.encryption = null;
  51734. this.issuers = null;
  51735. this.keyUsage = null;
  51736. this.oids = null;
  51737. this.signing = null;
  51738. this.subjectDNs = null;
  51739. }
  51740. }
  51741. class CheckButton extends _xfa_object.XFAObject {
  51742. constructor(attributes) {
  51743. super(TEMPLATE_NS_ID, "checkButton", true);
  51744. this.id = attributes.id || "";
  51745. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  51746. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  51747. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  51748. this.use = attributes.use || "";
  51749. this.usehref = attributes.usehref || "";
  51750. this.border = null;
  51751. this.extras = null;
  51752. this.margin = null;
  51753. }
  51754. [_xfa_object.$toHTML](availableSpace) {
  51755. const style = (0, _html_utils.toStyle)("margin");
  51756. const size = (0, _html_utils.measureToString)(this.size);
  51757. style.width = style.height = size;
  51758. let type;
  51759. let className;
  51760. let groupId;
  51761. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  51762. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  51763. const exportedValue = {
  51764. on: (items[0] || "on").toString(),
  51765. off: (items[1] || "off").toString()
  51766. };
  51767. const value = field.value && field.value[_xfa_object.$text]() || "off";
  51768. const checked = value === exportedValue.on || undefined;
  51769. const container = field[_xfa_object.$getSubformParent]();
  51770. const fieldId = field[_xfa_object.$uid];
  51771. let dataId;
  51772. if (container instanceof ExclGroup) {
  51773. groupId = container[_xfa_object.$uid];
  51774. type = "radio";
  51775. className = "xfaRadio";
  51776. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  51777. } else {
  51778. type = "checkbox";
  51779. className = "xfaCheckbox";
  51780. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  51781. }
  51782. const input = {
  51783. name: "input",
  51784. attributes: {
  51785. class: [className],
  51786. style,
  51787. fieldId,
  51788. dataId,
  51789. type,
  51790. checked,
  51791. xfaOn: exportedValue.on
  51792. }
  51793. };
  51794. if (groupId) {
  51795. input.attributes.name = groupId;
  51796. }
  51797. return _utils.HTMLResult.success({
  51798. name: "label",
  51799. attributes: {
  51800. class: ["xfaLabel"]
  51801. },
  51802. children: [input]
  51803. });
  51804. }
  51805. }
  51806. class ChoiceList extends _xfa_object.XFAObject {
  51807. constructor(attributes) {
  51808. super(TEMPLATE_NS_ID, "choiceList", true);
  51809. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  51810. this.id = attributes.id || "";
  51811. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  51812. this.textEntry = (0, _utils.getInteger)({
  51813. data: attributes.textEntry,
  51814. defaultValue: 0,
  51815. validate: x => x === 1
  51816. });
  51817. this.use = attributes.use || "";
  51818. this.usehref = attributes.usehref || "";
  51819. this.border = null;
  51820. this.extras = null;
  51821. this.margin = null;
  51822. }
  51823. [_xfa_object.$toHTML](availableSpace) {
  51824. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  51825. const ui = this[_xfa_object.$getParent]();
  51826. const field = ui[_xfa_object.$getParent]();
  51827. const children = [];
  51828. if (field.items.children.length > 0) {
  51829. const items = field.items;
  51830. let displayedIndex = 0;
  51831. let saveIndex = 0;
  51832. if (items.children.length === 2) {
  51833. displayedIndex = items.children[0].save;
  51834. saveIndex = 1 - displayedIndex;
  51835. }
  51836. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  51837. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  51838. let selected = false;
  51839. const value = field.value && field.value[_xfa_object.$text]() || "";
  51840. for (let i = 0, ii = displayed.length; i < ii; i++) {
  51841. const option = {
  51842. name: "option",
  51843. attributes: {
  51844. value: values[i] || displayed[i]
  51845. },
  51846. value: displayed[i]
  51847. };
  51848. if (values[i] === value) {
  51849. option.attributes.selected = selected = true;
  51850. }
  51851. children.push(option);
  51852. }
  51853. if (!selected) {
  51854. children.splice(0, 0, {
  51855. name: "option",
  51856. attributes: {
  51857. hidden: true,
  51858. selected: true
  51859. },
  51860. value: " "
  51861. });
  51862. }
  51863. }
  51864. const selectAttributes = {
  51865. class: ["xfaSelect"],
  51866. fieldId: field[_xfa_object.$uid],
  51867. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  51868. style
  51869. };
  51870. if (this.open === "multiSelect") {
  51871. selectAttributes.multiple = true;
  51872. }
  51873. return _utils.HTMLResult.success({
  51874. name: "label",
  51875. attributes: {
  51876. class: ["xfaLabel"]
  51877. },
  51878. children: [{
  51879. name: "select",
  51880. children,
  51881. attributes: selectAttributes
  51882. }]
  51883. });
  51884. }
  51885. }
  51886. class Color extends _xfa_object.XFAObject {
  51887. constructor(attributes) {
  51888. super(TEMPLATE_NS_ID, "color", true);
  51889. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  51890. this.id = attributes.id || "";
  51891. this.use = attributes.use || "";
  51892. this.usehref = attributes.usehref || "";
  51893. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  51894. this.extras = null;
  51895. }
  51896. [_xfa_object.$hasSettableValue]() {
  51897. return false;
  51898. }
  51899. [_xfa_object.$toStyle]() {
  51900. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  51901. }
  51902. }
  51903. class Comb extends _xfa_object.XFAObject {
  51904. constructor(attributes) {
  51905. super(TEMPLATE_NS_ID, "comb");
  51906. this.id = attributes.id || "";
  51907. this.numberOfCells = (0, _utils.getInteger)({
  51908. data: attributes.numberOfCells,
  51909. defaultValue: 0,
  51910. validate: x => x >= 0
  51911. });
  51912. this.use = attributes.use || "";
  51913. this.usehref = attributes.usehref || "";
  51914. }
  51915. }
  51916. class Connect extends _xfa_object.XFAObject {
  51917. constructor(attributes) {
  51918. super(TEMPLATE_NS_ID, "connect", true);
  51919. this.connection = attributes.connection || "";
  51920. this.id = attributes.id || "";
  51921. this.ref = attributes.ref || "";
  51922. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  51923. this.use = attributes.use || "";
  51924. this.usehref = attributes.usehref || "";
  51925. this.picture = null;
  51926. }
  51927. }
  51928. class ContentArea extends _xfa_object.XFAObject {
  51929. constructor(attributes) {
  51930. super(TEMPLATE_NS_ID, "contentArea", true);
  51931. this.h = (0, _utils.getMeasurement)(attributes.h);
  51932. this.id = attributes.id || "";
  51933. this.name = attributes.name || "";
  51934. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51935. this.use = attributes.use || "";
  51936. this.usehref = attributes.usehref || "";
  51937. this.w = (0, _utils.getMeasurement)(attributes.w);
  51938. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  51939. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  51940. this.desc = null;
  51941. this.extras = null;
  51942. }
  51943. [_xfa_object.$toHTML](availableSpace) {
  51944. const left = (0, _html_utils.measureToString)(this.x);
  51945. const top = (0, _html_utils.measureToString)(this.y);
  51946. const style = {
  51947. left,
  51948. top,
  51949. width: (0, _html_utils.measureToString)(this.w),
  51950. height: (0, _html_utils.measureToString)(this.h)
  51951. };
  51952. const classNames = ["xfaContentarea"];
  51953. if ((0, _html_utils.isPrintOnly)(this)) {
  51954. classNames.push("xfaPrintOnly");
  51955. }
  51956. return _utils.HTMLResult.success({
  51957. name: "div",
  51958. children: [],
  51959. attributes: {
  51960. style,
  51961. class: classNames,
  51962. id: this[_xfa_object.$uid]
  51963. }
  51964. });
  51965. }
  51966. }
  51967. class Corner extends _xfa_object.XFAObject {
  51968. constructor(attributes) {
  51969. super(TEMPLATE_NS_ID, "corner", true);
  51970. this.id = attributes.id || "";
  51971. this.inverted = (0, _utils.getInteger)({
  51972. data: attributes.inverted,
  51973. defaultValue: 0,
  51974. validate: x => x === 1
  51975. });
  51976. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  51977. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  51978. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  51979. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  51980. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  51981. this.use = attributes.use || "";
  51982. this.usehref = attributes.usehref || "";
  51983. this.color = null;
  51984. this.extras = null;
  51985. }
  51986. [_xfa_object.$toStyle]() {
  51987. const style = (0, _html_utils.toStyle)(this, "visibility");
  51988. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  51989. return style;
  51990. }
  51991. }
  51992. class DateElement extends _xfa_object.ContentObject {
  51993. constructor(attributes) {
  51994. super(TEMPLATE_NS_ID, "date");
  51995. this.id = attributes.id || "";
  51996. this.name = attributes.name || "";
  51997. this.use = attributes.use || "";
  51998. this.usehref = attributes.usehref || "";
  51999. }
  52000. [_xfa_object.$finalize]() {
  52001. const date = this[_xfa_object.$content].trim();
  52002. this[_xfa_object.$content] = date ? new Date(date) : null;
  52003. }
  52004. [_xfa_object.$toHTML](availableSpace) {
  52005. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  52006. }
  52007. }
  52008. class DateTime extends _xfa_object.ContentObject {
  52009. constructor(attributes) {
  52010. super(TEMPLATE_NS_ID, "dateTime");
  52011. this.id = attributes.id || "";
  52012. this.name = attributes.name || "";
  52013. this.use = attributes.use || "";
  52014. this.usehref = attributes.usehref || "";
  52015. }
  52016. [_xfa_object.$finalize]() {
  52017. const date = this[_xfa_object.$content].trim();
  52018. this[_xfa_object.$content] = date ? new Date(date) : null;
  52019. }
  52020. [_xfa_object.$toHTML](availableSpace) {
  52021. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  52022. }
  52023. }
  52024. class DateTimeEdit extends _xfa_object.XFAObject {
  52025. constructor(attributes) {
  52026. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  52027. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  52028. this.id = attributes.id || "";
  52029. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  52030. this.use = attributes.use || "";
  52031. this.usehref = attributes.usehref || "";
  52032. this.border = null;
  52033. this.comb = null;
  52034. this.extras = null;
  52035. this.margin = null;
  52036. }
  52037. [_xfa_object.$toHTML](availableSpace) {
  52038. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  52039. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52040. const html = {
  52041. name: "input",
  52042. attributes: {
  52043. type: "text",
  52044. fieldId: field[_xfa_object.$uid],
  52045. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  52046. class: ["xfaTextfield"],
  52047. style
  52048. }
  52049. };
  52050. return _utils.HTMLResult.success({
  52051. name: "label",
  52052. attributes: {
  52053. class: ["xfaLabel"]
  52054. },
  52055. children: [html]
  52056. });
  52057. }
  52058. }
  52059. class Decimal extends _xfa_object.ContentObject {
  52060. constructor(attributes) {
  52061. super(TEMPLATE_NS_ID, "decimal");
  52062. this.fracDigits = (0, _utils.getInteger)({
  52063. data: attributes.fracDigits,
  52064. defaultValue: 2,
  52065. validate: x => true
  52066. });
  52067. this.id = attributes.id || "";
  52068. this.leadDigits = (0, _utils.getInteger)({
  52069. data: attributes.leadDigits,
  52070. defaultValue: -1,
  52071. validate: x => true
  52072. });
  52073. this.name = attributes.name || "";
  52074. this.use = attributes.use || "";
  52075. this.usehref = attributes.usehref || "";
  52076. }
  52077. [_xfa_object.$finalize]() {
  52078. const number = parseFloat(this[_xfa_object.$content].trim());
  52079. this[_xfa_object.$content] = isNaN(number) ? null : number;
  52080. }
  52081. [_xfa_object.$toHTML](availableSpace) {
  52082. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  52083. }
  52084. }
  52085. class DefaultUi extends _xfa_object.XFAObject {
  52086. constructor(attributes) {
  52087. super(TEMPLATE_NS_ID, "defaultUi", true);
  52088. this.id = attributes.id || "";
  52089. this.use = attributes.use || "";
  52090. this.usehref = attributes.usehref || "";
  52091. this.extras = null;
  52092. }
  52093. }
  52094. class Desc extends _xfa_object.XFAObject {
  52095. constructor(attributes) {
  52096. super(TEMPLATE_NS_ID, "desc", true);
  52097. this.id = attributes.id || "";
  52098. this.use = attributes.use || "";
  52099. this.usehref = attributes.usehref || "";
  52100. this.boolean = new _xfa_object.XFAObjectArray();
  52101. this.date = new _xfa_object.XFAObjectArray();
  52102. this.dateTime = new _xfa_object.XFAObjectArray();
  52103. this.decimal = new _xfa_object.XFAObjectArray();
  52104. this.exData = new _xfa_object.XFAObjectArray();
  52105. this.float = new _xfa_object.XFAObjectArray();
  52106. this.image = new _xfa_object.XFAObjectArray();
  52107. this.integer = new _xfa_object.XFAObjectArray();
  52108. this.text = new _xfa_object.XFAObjectArray();
  52109. this.time = new _xfa_object.XFAObjectArray();
  52110. }
  52111. }
  52112. class DigestMethod extends _xfa_object.OptionObject {
  52113. constructor(attributes) {
  52114. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  52115. this.id = attributes.id || "";
  52116. this.use = attributes.use || "";
  52117. this.usehref = attributes.usehref || "";
  52118. }
  52119. }
  52120. class DigestMethods extends _xfa_object.XFAObject {
  52121. constructor(attributes) {
  52122. super(TEMPLATE_NS_ID, "digestMethods", true);
  52123. this.id = attributes.id || "";
  52124. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52125. this.use = attributes.use || "";
  52126. this.usehref = attributes.usehref || "";
  52127. this.digestMethod = new _xfa_object.XFAObjectArray();
  52128. }
  52129. }
  52130. class Draw extends _xfa_object.XFAObject {
  52131. constructor(attributes) {
  52132. super(TEMPLATE_NS_ID, "draw", true);
  52133. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  52134. this.colSpan = (0, _utils.getInteger)({
  52135. data: attributes.colSpan,
  52136. defaultValue: 1,
  52137. validate: n => n >= 1 || n === -1
  52138. });
  52139. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  52140. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  52141. this.id = attributes.id || "";
  52142. this.locale = attributes.locale || "";
  52143. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  52144. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  52145. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  52146. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  52147. this.name = attributes.name || "";
  52148. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52149. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52150. this.rotate = (0, _utils.getInteger)({
  52151. data: attributes.rotate,
  52152. defaultValue: 0,
  52153. validate: x => x % 90 === 0
  52154. });
  52155. this.use = attributes.use || "";
  52156. this.usehref = attributes.usehref || "";
  52157. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  52158. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52159. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52160. this.assist = null;
  52161. this.border = null;
  52162. this.caption = null;
  52163. this.desc = null;
  52164. this.extras = null;
  52165. this.font = null;
  52166. this.keep = null;
  52167. this.margin = null;
  52168. this.para = null;
  52169. this.traversal = null;
  52170. this.ui = null;
  52171. this.value = null;
  52172. this.setProperty = new _xfa_object.XFAObjectArray();
  52173. }
  52174. [_xfa_object.$setValue](value) {
  52175. _setValue(this, value);
  52176. }
  52177. [_xfa_object.$toHTML](availableSpace) {
  52178. if (this.presence === "hidden" || this.presence === "inactive") {
  52179. return _utils.HTMLResult.EMPTY;
  52180. }
  52181. (0, _html_utils.fixDimensions)(this);
  52182. const savedW = this.w;
  52183. const savedH = this.h;
  52184. const {
  52185. w,
  52186. h,
  52187. isBroken
  52188. } = (0, _html_utils.layoutNode)(this, availableSpace);
  52189. if (w && this.w === "") {
  52190. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  52191. return _utils.HTMLResult.FAILURE;
  52192. }
  52193. this.w = w;
  52194. }
  52195. if (h && this.h === "") {
  52196. this.h = h;
  52197. }
  52198. setFirstUnsplittable(this);
  52199. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  52200. this.w = savedW;
  52201. this.h = savedH;
  52202. return _utils.HTMLResult.FAILURE;
  52203. }
  52204. unsetFirstUnsplittable(this);
  52205. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  52206. (0, _html_utils.setMinMaxDimensions)(this, style);
  52207. if (style.margin) {
  52208. style.padding = style.margin;
  52209. delete style.margin;
  52210. }
  52211. const classNames = ["xfaDraw"];
  52212. if (this.font) {
  52213. classNames.push("xfaFont");
  52214. }
  52215. if ((0, _html_utils.isPrintOnly)(this)) {
  52216. classNames.push("xfaPrintOnly");
  52217. }
  52218. const attributes = {
  52219. style,
  52220. id: this[_xfa_object.$uid],
  52221. class: classNames
  52222. };
  52223. if (this.name) {
  52224. attributes.xfaName = this.name;
  52225. }
  52226. const html = {
  52227. name: "div",
  52228. attributes,
  52229. children: []
  52230. };
  52231. const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null;
  52232. if (assist) {
  52233. html.attributes.title = assist;
  52234. }
  52235. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  52236. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  52237. if (value === null) {
  52238. this.w = savedW;
  52239. this.h = savedH;
  52240. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52241. }
  52242. html.children.push(value);
  52243. (0, _html_utils.setPara)(this, style, value);
  52244. this.w = savedW;
  52245. this.h = savedH;
  52246. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52247. }
  52248. }
  52249. class Edge extends _xfa_object.XFAObject {
  52250. constructor(attributes) {
  52251. super(TEMPLATE_NS_ID, "edge", true);
  52252. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  52253. this.id = attributes.id || "";
  52254. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52255. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  52256. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  52257. this.use = attributes.use || "";
  52258. this.usehref = attributes.usehref || "";
  52259. this.color = null;
  52260. this.extras = null;
  52261. }
  52262. [_xfa_object.$toStyle]() {
  52263. const style = (0, _html_utils.toStyle)(this, "visibility");
  52264. Object.assign(style, {
  52265. linecap: this.cap,
  52266. width: (0, _html_utils.measureToString)(this.thickness),
  52267. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  52268. style: ""
  52269. });
  52270. if (this.presence !== "visible") {
  52271. style.style = "none";
  52272. } else {
  52273. switch (this.stroke) {
  52274. case "solid":
  52275. style.style = "solid";
  52276. break;
  52277. case "dashDot":
  52278. style.style = "dashed";
  52279. break;
  52280. case "dashDotDot":
  52281. style.style = "dashed";
  52282. break;
  52283. case "dashed":
  52284. style.style = "dashed";
  52285. break;
  52286. case "dotted":
  52287. style.style = "dotted";
  52288. break;
  52289. case "embossed":
  52290. style.style = "ridge";
  52291. break;
  52292. case "etched":
  52293. style.style = "groove";
  52294. break;
  52295. case "lowered":
  52296. style.style = "inset";
  52297. break;
  52298. case "raised":
  52299. style.style = "outset";
  52300. break;
  52301. }
  52302. }
  52303. return style;
  52304. }
  52305. }
  52306. class Encoding extends _xfa_object.OptionObject {
  52307. constructor(attributes) {
  52308. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  52309. this.id = attributes.id || "";
  52310. this.use = attributes.use || "";
  52311. this.usehref = attributes.usehref || "";
  52312. }
  52313. }
  52314. class Encodings extends _xfa_object.XFAObject {
  52315. constructor(attributes) {
  52316. super(TEMPLATE_NS_ID, "encodings", true);
  52317. this.id = attributes.id || "";
  52318. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52319. this.use = attributes.use || "";
  52320. this.usehref = attributes.usehref || "";
  52321. this.encoding = new _xfa_object.XFAObjectArray();
  52322. }
  52323. }
  52324. class Encrypt extends _xfa_object.XFAObject {
  52325. constructor(attributes) {
  52326. super(TEMPLATE_NS_ID, "encrypt", true);
  52327. this.id = attributes.id || "";
  52328. this.use = attributes.use || "";
  52329. this.usehref = attributes.usehref || "";
  52330. this.certificate = null;
  52331. }
  52332. }
  52333. class EncryptData extends _xfa_object.XFAObject {
  52334. constructor(attributes) {
  52335. super(TEMPLATE_NS_ID, "encryptData", true);
  52336. this.id = attributes.id || "";
  52337. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  52338. this.target = attributes.target || "";
  52339. this.use = attributes.use || "";
  52340. this.usehref = attributes.usehref || "";
  52341. this.filter = null;
  52342. this.manifest = null;
  52343. }
  52344. }
  52345. class Encryption extends _xfa_object.XFAObject {
  52346. constructor(attributes) {
  52347. super(TEMPLATE_NS_ID, "encryption", true);
  52348. this.id = attributes.id || "";
  52349. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52350. this.use = attributes.use || "";
  52351. this.usehref = attributes.usehref || "";
  52352. this.certificate = new _xfa_object.XFAObjectArray();
  52353. }
  52354. }
  52355. class EncryptionMethod extends _xfa_object.OptionObject {
  52356. constructor(attributes) {
  52357. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  52358. this.id = attributes.id || "";
  52359. this.use = attributes.use || "";
  52360. this.usehref = attributes.usehref || "";
  52361. }
  52362. }
  52363. class EncryptionMethods extends _xfa_object.XFAObject {
  52364. constructor(attributes) {
  52365. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  52366. this.id = attributes.id || "";
  52367. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52368. this.use = attributes.use || "";
  52369. this.usehref = attributes.usehref || "";
  52370. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  52371. }
  52372. }
  52373. class Event extends _xfa_object.XFAObject {
  52374. constructor(attributes) {
  52375. super(TEMPLATE_NS_ID, "event", true);
  52376. 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"]);
  52377. this.id = attributes.id || "";
  52378. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  52379. this.name = attributes.name || "";
  52380. this.ref = attributes.ref || "";
  52381. this.use = attributes.use || "";
  52382. this.usehref = attributes.usehref || "";
  52383. this.extras = null;
  52384. this.encryptData = null;
  52385. this.execute = null;
  52386. this.script = null;
  52387. this.signData = null;
  52388. this.submit = null;
  52389. }
  52390. }
  52391. class ExData extends _xfa_object.ContentObject {
  52392. constructor(attributes) {
  52393. super(TEMPLATE_NS_ID, "exData");
  52394. this.contentType = attributes.contentType || "";
  52395. this.href = attributes.href || "";
  52396. this.id = attributes.id || "";
  52397. this.maxLength = (0, _utils.getInteger)({
  52398. data: attributes.maxLength,
  52399. defaultValue: -1,
  52400. validate: x => x >= -1
  52401. });
  52402. this.name = attributes.name || "";
  52403. this.rid = attributes.rid || "";
  52404. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  52405. this.use = attributes.use || "";
  52406. this.usehref = attributes.usehref || "";
  52407. }
  52408. [_xfa_object.$isCDATAXml]() {
  52409. return this.contentType === "text/html";
  52410. }
  52411. [_xfa_object.$onChild](child) {
  52412. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52413. this[_xfa_object.$content] = child;
  52414. return true;
  52415. }
  52416. if (this.contentType === "text/xml") {
  52417. this[_xfa_object.$content] = child;
  52418. return true;
  52419. }
  52420. return false;
  52421. }
  52422. [_xfa_object.$toHTML](availableSpace) {
  52423. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  52424. return _utils.HTMLResult.EMPTY;
  52425. }
  52426. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  52427. }
  52428. }
  52429. class ExObject extends _xfa_object.XFAObject {
  52430. constructor(attributes) {
  52431. super(TEMPLATE_NS_ID, "exObject", true);
  52432. this.archive = attributes.archive || "";
  52433. this.classId = attributes.classId || "";
  52434. this.codeBase = attributes.codeBase || "";
  52435. this.codeType = attributes.codeType || "";
  52436. this.id = attributes.id || "";
  52437. this.name = attributes.name || "";
  52438. this.use = attributes.use || "";
  52439. this.usehref = attributes.usehref || "";
  52440. this.extras = null;
  52441. this.boolean = new _xfa_object.XFAObjectArray();
  52442. this.date = new _xfa_object.XFAObjectArray();
  52443. this.dateTime = new _xfa_object.XFAObjectArray();
  52444. this.decimal = new _xfa_object.XFAObjectArray();
  52445. this.exData = new _xfa_object.XFAObjectArray();
  52446. this.exObject = new _xfa_object.XFAObjectArray();
  52447. this.float = new _xfa_object.XFAObjectArray();
  52448. this.image = new _xfa_object.XFAObjectArray();
  52449. this.integer = new _xfa_object.XFAObjectArray();
  52450. this.text = new _xfa_object.XFAObjectArray();
  52451. this.time = new _xfa_object.XFAObjectArray();
  52452. }
  52453. }
  52454. class ExclGroup extends _xfa_object.XFAObject {
  52455. constructor(attributes) {
  52456. super(TEMPLATE_NS_ID, "exclGroup", true);
  52457. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  52458. this.accessKey = attributes.accessKey || "";
  52459. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  52460. this.colSpan = (0, _utils.getInteger)({
  52461. data: attributes.colSpan,
  52462. defaultValue: 1,
  52463. validate: n => n >= 1 || n === -1
  52464. });
  52465. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  52466. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  52467. this.id = attributes.id || "";
  52468. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  52469. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  52470. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  52471. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  52472. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  52473. this.name = attributes.name || "";
  52474. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52475. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52476. this.use = attributes.use || "";
  52477. this.usehref = attributes.usehref || "";
  52478. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  52479. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52480. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52481. this.assist = null;
  52482. this.bind = null;
  52483. this.border = null;
  52484. this.calculate = null;
  52485. this.caption = null;
  52486. this.desc = null;
  52487. this.extras = null;
  52488. this.margin = null;
  52489. this.para = null;
  52490. this.traversal = null;
  52491. this.validate = null;
  52492. this.connect = new _xfa_object.XFAObjectArray();
  52493. this.event = new _xfa_object.XFAObjectArray();
  52494. this.field = new _xfa_object.XFAObjectArray();
  52495. this.setProperty = new _xfa_object.XFAObjectArray();
  52496. }
  52497. [_xfa_object.$isBindable]() {
  52498. return true;
  52499. }
  52500. [_xfa_object.$hasSettableValue]() {
  52501. return true;
  52502. }
  52503. [_xfa_object.$setValue](value) {
  52504. for (const field of this.field.children) {
  52505. if (!field.value) {
  52506. const nodeValue = new Value({});
  52507. field[_xfa_object.$appendChild](nodeValue);
  52508. field.value = nodeValue;
  52509. }
  52510. field.value[_xfa_object.$setValue](value);
  52511. }
  52512. }
  52513. [_xfa_object.$isThereMoreWidth]() {
  52514. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  52515. }
  52516. [_xfa_object.$isSplittable]() {
  52517. const parent = this[_xfa_object.$getSubformParent]();
  52518. if (!parent[_xfa_object.$isSplittable]()) {
  52519. return false;
  52520. }
  52521. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  52522. return this[_xfa_object.$extra]._isSplittable;
  52523. }
  52524. if (this.layout === "position" || this.layout.includes("row")) {
  52525. this[_xfa_object.$extra]._isSplittable = false;
  52526. return false;
  52527. }
  52528. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  52529. return false;
  52530. }
  52531. this[_xfa_object.$extra]._isSplittable = true;
  52532. return true;
  52533. }
  52534. [_xfa_object.$flushHTML]() {
  52535. return (0, _layout.flushHTML)(this);
  52536. }
  52537. [_xfa_object.$addHTML](html, bbox) {
  52538. (0, _layout.addHTML)(this, html, bbox);
  52539. }
  52540. [_xfa_object.$getAvailableSpace]() {
  52541. return (0, _layout.getAvailableSpace)(this);
  52542. }
  52543. [_xfa_object.$toHTML](availableSpace) {
  52544. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  52545. return _utils.HTMLResult.EMPTY;
  52546. }
  52547. (0, _html_utils.fixDimensions)(this);
  52548. const children = [];
  52549. const attributes = {
  52550. id: this[_xfa_object.$uid],
  52551. class: []
  52552. };
  52553. (0, _html_utils.setAccess)(this, attributes.class);
  52554. if (!this[_xfa_object.$extra]) {
  52555. this[_xfa_object.$extra] = Object.create(null);
  52556. }
  52557. Object.assign(this[_xfa_object.$extra], {
  52558. children,
  52559. attributes,
  52560. attempt: 0,
  52561. line: null,
  52562. numberInLine: 0,
  52563. availableSpace: {
  52564. width: Math.min(this.w || Infinity, availableSpace.width),
  52565. height: Math.min(this.h || Infinity, availableSpace.height)
  52566. },
  52567. width: 0,
  52568. height: 0,
  52569. prevHeight: 0,
  52570. currentWidth: 0
  52571. });
  52572. const isSplittable = this[_xfa_object.$isSplittable]();
  52573. if (!isSplittable) {
  52574. setFirstUnsplittable(this);
  52575. }
  52576. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  52577. return _utils.HTMLResult.FAILURE;
  52578. }
  52579. availableSpace = {
  52580. width: this.w === "" ? availableSpace.width : this.w,
  52581. height: this.h === "" ? availableSpace.height : this.h
  52582. };
  52583. const filter = new Set(["field"]);
  52584. if (this.layout.includes("row")) {
  52585. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  52586. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  52587. this[_xfa_object.$extra].columnWidths = columnWidths;
  52588. this[_xfa_object.$extra].currentColumn = 0;
  52589. }
  52590. }
  52591. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  52592. const classNames = ["xfaExclgroup"];
  52593. const cl = (0, _html_utils.layoutClass)(this);
  52594. if (cl) {
  52595. classNames.push(cl);
  52596. }
  52597. if ((0, _html_utils.isPrintOnly)(this)) {
  52598. classNames.push("xfaPrintOnly");
  52599. }
  52600. attributes.style = style;
  52601. attributes.class = classNames;
  52602. if (this.name) {
  52603. attributes.xfaName = this.name;
  52604. }
  52605. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  52606. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  52607. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  52608. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  52609. this[_xfa_object.$extra].numberInLine = 0;
  52610. }
  52611. const result = this[_xfa_object.$childrenToHTML]({
  52612. filter,
  52613. include: true
  52614. });
  52615. if (result.success) {
  52616. break;
  52617. }
  52618. if (result.isBreak()) {
  52619. return result;
  52620. }
  52621. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  52622. this[_xfa_object.$extra].attempt = maxRun;
  52623. break;
  52624. }
  52625. }
  52626. if (!isSplittable) {
  52627. unsetFirstUnsplittable(this);
  52628. }
  52629. if (this[_xfa_object.$extra].attempt === maxRun) {
  52630. if (!isSplittable) {
  52631. delete this[_xfa_object.$extra];
  52632. }
  52633. return _utils.HTMLResult.FAILURE;
  52634. }
  52635. let marginH = 0;
  52636. let marginV = 0;
  52637. if (this.margin) {
  52638. marginH = this.margin.leftInset + this.margin.rightInset;
  52639. marginV = this.margin.topInset + this.margin.bottomInset;
  52640. }
  52641. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  52642. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  52643. const bbox = [this.x, this.y, width, height];
  52644. if (this.w === "") {
  52645. style.width = (0, _html_utils.measureToString)(width);
  52646. }
  52647. if (this.h === "") {
  52648. style.height = (0, _html_utils.measureToString)(height);
  52649. }
  52650. const html = {
  52651. name: "div",
  52652. attributes,
  52653. children
  52654. };
  52655. const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null;
  52656. if (assist) {
  52657. html.attributes.title = assist;
  52658. }
  52659. delete this[_xfa_object.$extra];
  52660. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52661. }
  52662. }
  52663. class Execute extends _xfa_object.XFAObject {
  52664. constructor(attributes) {
  52665. super(TEMPLATE_NS_ID, "execute");
  52666. this.connection = attributes.connection || "";
  52667. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  52668. this.id = attributes.id || "";
  52669. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  52670. this.use = attributes.use || "";
  52671. this.usehref = attributes.usehref || "";
  52672. }
  52673. }
  52674. class Extras extends _xfa_object.XFAObject {
  52675. constructor(attributes) {
  52676. super(TEMPLATE_NS_ID, "extras", true);
  52677. this.id = attributes.id || "";
  52678. this.name = attributes.name || "";
  52679. this.use = attributes.use || "";
  52680. this.usehref = attributes.usehref || "";
  52681. this.boolean = new _xfa_object.XFAObjectArray();
  52682. this.date = new _xfa_object.XFAObjectArray();
  52683. this.dateTime = new _xfa_object.XFAObjectArray();
  52684. this.decimal = new _xfa_object.XFAObjectArray();
  52685. this.exData = new _xfa_object.XFAObjectArray();
  52686. this.extras = new _xfa_object.XFAObjectArray();
  52687. this.float = new _xfa_object.XFAObjectArray();
  52688. this.image = new _xfa_object.XFAObjectArray();
  52689. this.integer = new _xfa_object.XFAObjectArray();
  52690. this.text = new _xfa_object.XFAObjectArray();
  52691. this.time = new _xfa_object.XFAObjectArray();
  52692. }
  52693. }
  52694. class Field extends _xfa_object.XFAObject {
  52695. constructor(attributes) {
  52696. super(TEMPLATE_NS_ID, "field", true);
  52697. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  52698. this.accessKey = attributes.accessKey || "";
  52699. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  52700. this.colSpan = (0, _utils.getInteger)({
  52701. data: attributes.colSpan,
  52702. defaultValue: 1,
  52703. validate: n => n >= 1 || n === -1
  52704. });
  52705. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  52706. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  52707. this.id = attributes.id || "";
  52708. this.locale = attributes.locale || "";
  52709. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  52710. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  52711. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  52712. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  52713. this.name = attributes.name || "";
  52714. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52715. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52716. this.rotate = (0, _utils.getInteger)({
  52717. data: attributes.rotate,
  52718. defaultValue: 0,
  52719. validate: x => x % 90 === 0
  52720. });
  52721. this.use = attributes.use || "";
  52722. this.usehref = attributes.usehref || "";
  52723. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  52724. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52725. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52726. this.assist = null;
  52727. this.bind = null;
  52728. this.border = null;
  52729. this.calculate = null;
  52730. this.caption = null;
  52731. this.desc = null;
  52732. this.extras = null;
  52733. this.font = null;
  52734. this.format = null;
  52735. this.items = new _xfa_object.XFAObjectArray(2);
  52736. this.keep = null;
  52737. this.margin = null;
  52738. this.para = null;
  52739. this.traversal = null;
  52740. this.ui = null;
  52741. this.validate = null;
  52742. this.value = null;
  52743. this.bindItems = new _xfa_object.XFAObjectArray();
  52744. this.connect = new _xfa_object.XFAObjectArray();
  52745. this.event = new _xfa_object.XFAObjectArray();
  52746. this.setProperty = new _xfa_object.XFAObjectArray();
  52747. }
  52748. [_xfa_object.$isBindable]() {
  52749. return true;
  52750. }
  52751. [_xfa_object.$setValue](value) {
  52752. _setValue(this, value);
  52753. }
  52754. [_xfa_object.$toHTML](availableSpace) {
  52755. if (!this.ui) {
  52756. this.ui = new Ui({});
  52757. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  52758. this[_xfa_object.$appendChild](this.ui);
  52759. let node;
  52760. switch (this.items.children.length) {
  52761. case 0:
  52762. node = new TextEdit({});
  52763. this.ui.textEdit = node;
  52764. break;
  52765. case 1:
  52766. node = new CheckButton({});
  52767. this.ui.checkButton = node;
  52768. break;
  52769. case 2:
  52770. node = new ChoiceList({});
  52771. this.ui.choiceList = node;
  52772. break;
  52773. }
  52774. this.ui[_xfa_object.$appendChild](node);
  52775. }
  52776. setTabIndex(this);
  52777. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  52778. return _utils.HTMLResult.EMPTY;
  52779. }
  52780. if (this.caption) {
  52781. delete this.caption[_xfa_object.$extra];
  52782. }
  52783. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  52784. const savedW = this.w;
  52785. const savedH = this.h;
  52786. if (this.w === "" || this.h === "") {
  52787. let marginH = 0;
  52788. let marginV = 0;
  52789. if (this.margin) {
  52790. marginH = this.margin.leftInset + this.margin.rightInset;
  52791. marginV = this.margin.topInset + this.margin.bottomInset;
  52792. }
  52793. let width = null;
  52794. let height = null;
  52795. if (this.caption) {
  52796. const {
  52797. w,
  52798. h,
  52799. isBroken
  52800. } = this.caption[_xfa_object.$getExtra](availableSpace);
  52801. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  52802. return _utils.HTMLResult.FAILURE;
  52803. }
  52804. width = w;
  52805. height = h;
  52806. if (this.ui.checkButton) {
  52807. switch (this.caption.placement) {
  52808. case "left":
  52809. case "right":
  52810. case "inline":
  52811. width += this.ui.checkButton.size;
  52812. break;
  52813. case "top":
  52814. case "bottom":
  52815. height += this.ui.checkButton.size;
  52816. break;
  52817. }
  52818. }
  52819. }
  52820. if (width && this.w === "") {
  52821. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, Math.max(this.minW, width + marginH));
  52822. }
  52823. if (height && this.h === "") {
  52824. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, Math.max(this.minH, height + marginV));
  52825. }
  52826. }
  52827. (0, _html_utils.fixDimensions)(this);
  52828. setFirstUnsplittable(this);
  52829. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  52830. this.w = savedW;
  52831. this.h = savedH;
  52832. return _utils.HTMLResult.FAILURE;
  52833. }
  52834. unsetFirstUnsplittable(this);
  52835. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  52836. (0, _html_utils.setMinMaxDimensions)(this, style);
  52837. const classNames = ["xfaField"];
  52838. if (this.font) {
  52839. classNames.push("xfaFont");
  52840. }
  52841. if ((0, _html_utils.isPrintOnly)(this)) {
  52842. classNames.push("xfaPrintOnly");
  52843. }
  52844. const attributes = {
  52845. style,
  52846. id: this[_xfa_object.$uid],
  52847. class: classNames
  52848. };
  52849. if (style.margin) {
  52850. style.padding = style.margin;
  52851. delete style.margin;
  52852. }
  52853. (0, _html_utils.setAccess)(this, classNames);
  52854. if (this.name) {
  52855. attributes.xfaName = this.name;
  52856. }
  52857. const children = [];
  52858. const html = {
  52859. name: "div",
  52860. attributes,
  52861. children
  52862. };
  52863. const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null;
  52864. if (assist) {
  52865. html.attributes.title = assist;
  52866. }
  52867. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  52868. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  52869. const ui = this.ui[_xfa_object.$toHTML]().html;
  52870. if (!ui) {
  52871. Object.assign(style, borderStyle);
  52872. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52873. }
  52874. if (this[_xfa_object.$tabIndex]) {
  52875. if (ui.children && ui.children[0]) {
  52876. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  52877. } else {
  52878. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  52879. }
  52880. }
  52881. if (!ui.attributes.style) {
  52882. ui.attributes.style = Object.create(null);
  52883. }
  52884. if (this.ui.button) {
  52885. Object.assign(ui.attributes.style, borderStyle);
  52886. } else {
  52887. Object.assign(style, borderStyle);
  52888. }
  52889. children.push(ui);
  52890. if (this.value) {
  52891. if (this.ui.imageEdit) {
  52892. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  52893. } else if (!this.ui.button) {
  52894. let value = "";
  52895. if (this.value.exData) {
  52896. value = this.value.exData[_xfa_object.$text]();
  52897. } else {
  52898. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  52899. if (htmlValue !== null) {
  52900. value = htmlValue.children[0].value;
  52901. }
  52902. }
  52903. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  52904. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  52905. }
  52906. if (value) {
  52907. if (ui.children[0].name === "textarea") {
  52908. ui.children[0].attributes.textContent = value;
  52909. } else {
  52910. ui.children[0].attributes.value = value;
  52911. }
  52912. }
  52913. }
  52914. }
  52915. if (!caption) {
  52916. if (ui.attributes.class) {
  52917. ui.attributes.class.push("xfaLeft");
  52918. }
  52919. this.w = savedW;
  52920. this.h = savedH;
  52921. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52922. }
  52923. if (this.ui.button) {
  52924. if (style.padding) {
  52925. delete style.padding;
  52926. }
  52927. if (caption.name === "div") {
  52928. caption.name = "span";
  52929. }
  52930. ui.children.push(caption);
  52931. return _utils.HTMLResult.success(html, bbox);
  52932. } else if (this.ui.checkButton) {
  52933. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  52934. }
  52935. if (!ui.attributes.class) {
  52936. ui.attributes.class = [];
  52937. }
  52938. switch (this.caption.placement) {
  52939. case "left":
  52940. ui.children.splice(0, 0, caption);
  52941. ui.attributes.class.push("xfaLeft");
  52942. break;
  52943. case "right":
  52944. ui.children.push(caption);
  52945. ui.attributes.class.push("xfaLeft");
  52946. break;
  52947. case "top":
  52948. ui.children.splice(0, 0, caption);
  52949. ui.attributes.class.push("xfaTop");
  52950. break;
  52951. case "bottom":
  52952. ui.children.push(caption);
  52953. ui.attributes.class.push("xfaTop");
  52954. break;
  52955. case "inline":
  52956. ui.attributes.class.push("xfaLeft");
  52957. break;
  52958. }
  52959. this.w = savedW;
  52960. this.h = savedH;
  52961. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52962. }
  52963. }
  52964. exports.Field = Field;
  52965. class Fill extends _xfa_object.XFAObject {
  52966. constructor(attributes) {
  52967. super(TEMPLATE_NS_ID, "fill", true);
  52968. this.id = attributes.id || "";
  52969. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52970. this.use = attributes.use || "";
  52971. this.usehref = attributes.usehref || "";
  52972. this.color = null;
  52973. this.extras = null;
  52974. this.linear = null;
  52975. this.pattern = null;
  52976. this.radial = null;
  52977. this.solid = null;
  52978. this.stipple = null;
  52979. }
  52980. [_xfa_object.$toStyle]() {
  52981. const parent = this[_xfa_object.$getParent]();
  52982. const style = Object.create(null);
  52983. let propName = "color";
  52984. if (parent instanceof Border) {
  52985. propName = "background";
  52986. }
  52987. if (parent instanceof Rectangle || parent instanceof Arc) {
  52988. propName = "fill";
  52989. style.fill = "white";
  52990. }
  52991. for (const name of Object.getOwnPropertyNames(this)) {
  52992. if (name === "extras" || name === "color") {
  52993. continue;
  52994. }
  52995. const obj = this[name];
  52996. if (!(obj instanceof _xfa_object.XFAObject)) {
  52997. continue;
  52998. }
  52999. style[propName] = obj[_xfa_object.$toStyle](this.color);
  53000. return style;
  53001. }
  53002. if (this.color) {
  53003. style[propName] = this.color[_xfa_object.$toStyle]();
  53004. }
  53005. return style;
  53006. }
  53007. }
  53008. class Filter extends _xfa_object.XFAObject {
  53009. constructor(attributes) {
  53010. super(TEMPLATE_NS_ID, "filter", true);
  53011. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  53012. this.id = attributes.id || "";
  53013. this.name = attributes.name || "";
  53014. this.use = attributes.use || "";
  53015. this.usehref = attributes.usehref || "";
  53016. this.version = (0, _utils.getInteger)({
  53017. data: this.version,
  53018. defaultValue: 5,
  53019. validate: x => x >= 1 && x <= 5
  53020. });
  53021. this.appearanceFilter = null;
  53022. this.certificates = null;
  53023. this.digestMethods = null;
  53024. this.encodings = null;
  53025. this.encryptionMethods = null;
  53026. this.handler = null;
  53027. this.lockDocument = null;
  53028. this.mdp = null;
  53029. this.reasons = null;
  53030. this.timeStamp = null;
  53031. }
  53032. }
  53033. class Float extends _xfa_object.ContentObject {
  53034. constructor(attributes) {
  53035. super(TEMPLATE_NS_ID, "float");
  53036. this.id = attributes.id || "";
  53037. this.name = attributes.name || "";
  53038. this.use = attributes.use || "";
  53039. this.usehref = attributes.usehref || "";
  53040. }
  53041. [_xfa_object.$finalize]() {
  53042. const number = parseFloat(this[_xfa_object.$content].trim());
  53043. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53044. }
  53045. [_xfa_object.$toHTML](availableSpace) {
  53046. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53047. }
  53048. }
  53049. class Font extends _xfa_object.XFAObject {
  53050. constructor(attributes) {
  53051. super(TEMPLATE_NS_ID, "font", true);
  53052. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  53053. this.fontHorizontalScale = (0, _utils.getFloat)({
  53054. data: attributes.fontHorizontalScale,
  53055. defaultValue: 100,
  53056. validate: x => x >= 0
  53057. });
  53058. this.fontVerticalScale = (0, _utils.getFloat)({
  53059. data: attributes.fontVerticalScale,
  53060. defaultValue: 100,
  53061. validate: x => x >= 0
  53062. });
  53063. this.id = attributes.id || "";
  53064. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  53065. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  53066. this.lineThrough = (0, _utils.getInteger)({
  53067. data: attributes.lineThrough,
  53068. defaultValue: 0,
  53069. validate: x => x === 1 || x === 2
  53070. });
  53071. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  53072. this.overline = (0, _utils.getInteger)({
  53073. data: attributes.overline,
  53074. defaultValue: 0,
  53075. validate: x => x === 1 || x === 2
  53076. });
  53077. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  53078. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  53079. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  53080. this.typeface = attributes.typeface || "Courier";
  53081. this.underline = (0, _utils.getInteger)({
  53082. data: attributes.underline,
  53083. defaultValue: 0,
  53084. validate: x => x === 1 || x === 2
  53085. });
  53086. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  53087. this.use = attributes.use || "";
  53088. this.usehref = attributes.usehref || "";
  53089. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  53090. this.extras = null;
  53091. this.fill = null;
  53092. }
  53093. [_xfa_object.$clean](builder) {
  53094. super[_xfa_object.$clean](builder);
  53095. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  53096. }
  53097. [_xfa_object.$toStyle]() {
  53098. const style = (0, _html_utils.toStyle)(this, "fill");
  53099. const color = style.color;
  53100. if (color) {
  53101. if (color === "#000000") {
  53102. delete style.color;
  53103. } else if (!color.startsWith("#")) {
  53104. style.background = color;
  53105. style.backgroundClip = "text";
  53106. style.color = "transparent";
  53107. }
  53108. }
  53109. if (this.baselineShift) {
  53110. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  53111. }
  53112. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  53113. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  53114. if (this.lineThrough !== 0) {
  53115. style.textDecoration = "line-through";
  53116. if (this.lineThrough === 2) {
  53117. style.textDecorationStyle = "double";
  53118. }
  53119. }
  53120. if (this.overline !== 0) {
  53121. style.textDecoration = "overline";
  53122. if (this.overline === 2) {
  53123. style.textDecorationStyle = "double";
  53124. }
  53125. }
  53126. style.fontStyle = this.posture;
  53127. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  53128. (0, _html_utils.setFontFamily)(this, this[_xfa_object.$globalData].fontFinder, style);
  53129. if (this.underline !== 0) {
  53130. style.textDecoration = "underline";
  53131. if (this.underline === 2) {
  53132. style.textDecorationStyle = "double";
  53133. }
  53134. }
  53135. style.fontWeight = this.weight;
  53136. return style;
  53137. }
  53138. }
  53139. class Format extends _xfa_object.XFAObject {
  53140. constructor(attributes) {
  53141. super(TEMPLATE_NS_ID, "format", true);
  53142. this.id = attributes.id || "";
  53143. this.use = attributes.use || "";
  53144. this.usehref = attributes.usehref || "";
  53145. this.extras = null;
  53146. this.picture = null;
  53147. }
  53148. }
  53149. class Handler extends _xfa_object.StringObject {
  53150. constructor(attributes) {
  53151. super(TEMPLATE_NS_ID, "handler");
  53152. this.id = attributes.id || "";
  53153. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53154. this.use = attributes.use || "";
  53155. this.usehref = attributes.usehref || "";
  53156. }
  53157. }
  53158. class Hyphenation extends _xfa_object.XFAObject {
  53159. constructor(attributes) {
  53160. super(TEMPLATE_NS_ID, "hyphenation");
  53161. this.excludeAllCaps = (0, _utils.getInteger)({
  53162. data: attributes.excludeAllCaps,
  53163. defaultValue: 0,
  53164. validate: x => x === 1
  53165. });
  53166. this.excludeInitialCap = (0, _utils.getInteger)({
  53167. data: attributes.excludeInitialCap,
  53168. defaultValue: 0,
  53169. validate: x => x === 1
  53170. });
  53171. this.hyphenate = (0, _utils.getInteger)({
  53172. data: attributes.hyphenate,
  53173. defaultValue: 0,
  53174. validate: x => x === 1
  53175. });
  53176. this.id = attributes.id || "";
  53177. this.pushCharacterCount = (0, _utils.getInteger)({
  53178. data: attributes.pushCharacterCount,
  53179. defaultValue: 3,
  53180. validate: x => x >= 0
  53181. });
  53182. this.remainCharacterCount = (0, _utils.getInteger)({
  53183. data: attributes.remainCharacterCount,
  53184. defaultValue: 3,
  53185. validate: x => x >= 0
  53186. });
  53187. this.use = attributes.use || "";
  53188. this.usehref = attributes.usehref || "";
  53189. this.wordCharacterCount = (0, _utils.getInteger)({
  53190. data: attributes.wordCharacterCount,
  53191. defaultValue: 7,
  53192. validate: x => x >= 0
  53193. });
  53194. }
  53195. }
  53196. class Image extends _xfa_object.StringObject {
  53197. constructor(attributes) {
  53198. super(TEMPLATE_NS_ID, "image");
  53199. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  53200. this.contentType = attributes.contentType || "";
  53201. this.href = attributes.href || "";
  53202. this.id = attributes.id || "";
  53203. this.name = attributes.name || "";
  53204. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  53205. this.use = attributes.use || "";
  53206. this.usehref = attributes.usehref || "";
  53207. }
  53208. [_xfa_object.$toHTML]() {
  53209. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  53210. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  53211. return _utils.HTMLResult.EMPTY;
  53212. }
  53213. if (!buffer && this.transferEncoding === "base64") {
  53214. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  53215. }
  53216. if (!buffer) {
  53217. return _utils.HTMLResult.EMPTY;
  53218. }
  53219. const blob = new Blob([buffer], {
  53220. type: this.contentType
  53221. });
  53222. let style;
  53223. switch (this.aspect) {
  53224. case "fit":
  53225. case "actual":
  53226. break;
  53227. case "height":
  53228. style = {
  53229. height: "100%",
  53230. objectFit: "fill"
  53231. };
  53232. break;
  53233. case "none":
  53234. style = {
  53235. width: "100%",
  53236. height: "100%",
  53237. objectFit: "fill"
  53238. };
  53239. break;
  53240. case "width":
  53241. style = {
  53242. width: "100%",
  53243. objectFit: "fill"
  53244. };
  53245. break;
  53246. }
  53247. return _utils.HTMLResult.success({
  53248. name: "img",
  53249. attributes: {
  53250. class: ["xfaImage"],
  53251. style,
  53252. src: URL.createObjectURL(blob)
  53253. }
  53254. });
  53255. }
  53256. }
  53257. class ImageEdit extends _xfa_object.XFAObject {
  53258. constructor(attributes) {
  53259. super(TEMPLATE_NS_ID, "imageEdit", true);
  53260. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  53261. this.id = attributes.id || "";
  53262. this.use = attributes.use || "";
  53263. this.usehref = attributes.usehref || "";
  53264. this.border = null;
  53265. this.extras = null;
  53266. this.margin = null;
  53267. }
  53268. [_xfa_object.$toHTML](availableSpace) {
  53269. if (this.data === "embed") {
  53270. return _utils.HTMLResult.success({
  53271. name: "div",
  53272. children: [],
  53273. attributes: {}
  53274. });
  53275. }
  53276. return _utils.HTMLResult.EMPTY;
  53277. }
  53278. }
  53279. class Integer extends _xfa_object.ContentObject {
  53280. constructor(attributes) {
  53281. super(TEMPLATE_NS_ID, "integer");
  53282. this.id = attributes.id || "";
  53283. this.name = attributes.name || "";
  53284. this.use = attributes.use || "";
  53285. this.usehref = attributes.usehref || "";
  53286. }
  53287. [_xfa_object.$finalize]() {
  53288. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  53289. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53290. }
  53291. [_xfa_object.$toHTML](availableSpace) {
  53292. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53293. }
  53294. }
  53295. class Issuers extends _xfa_object.XFAObject {
  53296. constructor(attributes) {
  53297. super(TEMPLATE_NS_ID, "issuers", true);
  53298. this.id = attributes.id || "";
  53299. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53300. this.use = attributes.use || "";
  53301. this.usehref = attributes.usehref || "";
  53302. this.certificate = new _xfa_object.XFAObjectArray();
  53303. }
  53304. }
  53305. class Items extends _xfa_object.XFAObject {
  53306. constructor(attributes) {
  53307. super(TEMPLATE_NS_ID, "items", true);
  53308. this.id = attributes.id || "";
  53309. this.name = attributes.name || "";
  53310. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53311. this.ref = attributes.ref || "";
  53312. this.save = (0, _utils.getInteger)({
  53313. data: attributes.save,
  53314. defaultValue: 0,
  53315. validate: x => x === 1
  53316. });
  53317. this.use = attributes.use || "";
  53318. this.usehref = attributes.usehref || "";
  53319. this.boolean = new _xfa_object.XFAObjectArray();
  53320. this.date = new _xfa_object.XFAObjectArray();
  53321. this.dateTime = new _xfa_object.XFAObjectArray();
  53322. this.decimal = new _xfa_object.XFAObjectArray();
  53323. this.exData = new _xfa_object.XFAObjectArray();
  53324. this.float = new _xfa_object.XFAObjectArray();
  53325. this.image = new _xfa_object.XFAObjectArray();
  53326. this.integer = new _xfa_object.XFAObjectArray();
  53327. this.text = new _xfa_object.XFAObjectArray();
  53328. this.time = new _xfa_object.XFAObjectArray();
  53329. }
  53330. [_xfa_object.$toHTML]() {
  53331. const output = [];
  53332. for (const child of this[_xfa_object.$getChildren]()) {
  53333. output.push(child[_xfa_object.$text]());
  53334. }
  53335. return _utils.HTMLResult.success(output);
  53336. }
  53337. }
  53338. exports.Items = Items;
  53339. class Keep extends _xfa_object.XFAObject {
  53340. constructor(attributes) {
  53341. super(TEMPLATE_NS_ID, "keep", true);
  53342. this.id = attributes.id || "";
  53343. const options = ["none", "contentArea", "pageArea"];
  53344. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  53345. this.next = (0, _utils.getStringOption)(attributes.next, options);
  53346. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  53347. this.use = attributes.use || "";
  53348. this.usehref = attributes.usehref || "";
  53349. this.extras = null;
  53350. }
  53351. }
  53352. class KeyUsage extends _xfa_object.XFAObject {
  53353. constructor(attributes) {
  53354. super(TEMPLATE_NS_ID, "keyUsage");
  53355. const options = ["", "yes", "no"];
  53356. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  53357. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  53358. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  53359. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  53360. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  53361. this.id = attributes.id || "";
  53362. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  53363. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  53364. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  53365. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  53366. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53367. this.use = attributes.use || "";
  53368. this.usehref = attributes.usehref || "";
  53369. }
  53370. }
  53371. class Line extends _xfa_object.XFAObject {
  53372. constructor(attributes) {
  53373. super(TEMPLATE_NS_ID, "line", true);
  53374. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53375. this.id = attributes.id || "";
  53376. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  53377. this.use = attributes.use || "";
  53378. this.usehref = attributes.usehref || "";
  53379. this.edge = null;
  53380. }
  53381. [_xfa_object.$toHTML]() {
  53382. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53383. const edge = this.edge ? this.edge : new Edge({});
  53384. const edgeStyle = edge[_xfa_object.$toStyle]();
  53385. const style = Object.create(null);
  53386. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  53387. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  53388. style.stroke = edgeStyle.color;
  53389. let x1, y1, x2, y2;
  53390. let width = "100%";
  53391. let height = "100%";
  53392. if (parent.w <= thickness) {
  53393. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  53394. width = style.strokeWidth;
  53395. } else if (parent.h <= thickness) {
  53396. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  53397. height = style.strokeWidth;
  53398. } else {
  53399. if (this.slope === "\\") {
  53400. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  53401. } else {
  53402. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  53403. }
  53404. }
  53405. const line = {
  53406. name: "line",
  53407. attributes: {
  53408. xmlns: SVG_NS,
  53409. x1,
  53410. y1,
  53411. x2,
  53412. y2,
  53413. style
  53414. }
  53415. };
  53416. const svg = {
  53417. name: "svg",
  53418. children: [line],
  53419. attributes: {
  53420. xmlns: SVG_NS,
  53421. width,
  53422. height,
  53423. style: {
  53424. overflow: "visible"
  53425. }
  53426. }
  53427. };
  53428. if (hasMargin(parent)) {
  53429. return _utils.HTMLResult.success({
  53430. name: "div",
  53431. attributes: {
  53432. style: {
  53433. display: "inline",
  53434. width: "100%",
  53435. height: "100%"
  53436. }
  53437. },
  53438. children: [svg]
  53439. });
  53440. }
  53441. svg.attributes.style.position = "absolute";
  53442. return _utils.HTMLResult.success(svg);
  53443. }
  53444. }
  53445. class Linear extends _xfa_object.XFAObject {
  53446. constructor(attributes) {
  53447. super(TEMPLATE_NS_ID, "linear", true);
  53448. this.id = attributes.id || "";
  53449. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  53450. this.use = attributes.use || "";
  53451. this.usehref = attributes.usehref || "";
  53452. this.color = null;
  53453. this.extras = null;
  53454. }
  53455. [_xfa_object.$toStyle](startColor) {
  53456. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  53457. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  53458. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  53459. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  53460. }
  53461. }
  53462. class LockDocument extends _xfa_object.ContentObject {
  53463. constructor(attributes) {
  53464. super(TEMPLATE_NS_ID, "lockDocument");
  53465. this.id = attributes.id || "";
  53466. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53467. this.use = attributes.use || "";
  53468. this.usehref = attributes.usehref || "";
  53469. }
  53470. [_xfa_object.$finalize]() {
  53471. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  53472. }
  53473. }
  53474. class Manifest extends _xfa_object.XFAObject {
  53475. constructor(attributes) {
  53476. super(TEMPLATE_NS_ID, "manifest", true);
  53477. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  53478. this.id = attributes.id || "";
  53479. this.name = attributes.name || "";
  53480. this.use = attributes.use || "";
  53481. this.usehref = attributes.usehref || "";
  53482. this.extras = null;
  53483. this.ref = new _xfa_object.XFAObjectArray();
  53484. }
  53485. }
  53486. class Margin extends _xfa_object.XFAObject {
  53487. constructor(attributes) {
  53488. super(TEMPLATE_NS_ID, "margin", true);
  53489. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  53490. this.id = attributes.id || "";
  53491. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  53492. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  53493. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  53494. this.use = attributes.use || "";
  53495. this.usehref = attributes.usehref || "";
  53496. this.extras = null;
  53497. }
  53498. [_xfa_object.$toStyle]() {
  53499. return {
  53500. 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)
  53501. };
  53502. }
  53503. }
  53504. class Mdp extends _xfa_object.XFAObject {
  53505. constructor(attributes) {
  53506. super(TEMPLATE_NS_ID, "mdp");
  53507. this.id = attributes.id || "";
  53508. this.permissions = (0, _utils.getInteger)({
  53509. data: attributes.permissions,
  53510. defaultValue: 2,
  53511. validate: x => x === 1 || x === 3
  53512. });
  53513. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  53514. this.use = attributes.use || "";
  53515. this.usehref = attributes.usehref || "";
  53516. }
  53517. }
  53518. class Medium extends _xfa_object.XFAObject {
  53519. constructor(attributes) {
  53520. super(TEMPLATE_NS_ID, "medium");
  53521. this.id = attributes.id || "";
  53522. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  53523. this.long = (0, _utils.getMeasurement)(attributes.long);
  53524. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  53525. this.short = (0, _utils.getMeasurement)(attributes.short);
  53526. this.stock = attributes.stock || "";
  53527. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  53528. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  53529. this.use = attributes.use || "";
  53530. this.usehref = attributes.usehref || "";
  53531. }
  53532. }
  53533. class Message extends _xfa_object.XFAObject {
  53534. constructor(attributes) {
  53535. super(TEMPLATE_NS_ID, "message", true);
  53536. this.id = attributes.id || "";
  53537. this.use = attributes.use || "";
  53538. this.usehref = attributes.usehref || "";
  53539. this.text = new _xfa_object.XFAObjectArray();
  53540. }
  53541. }
  53542. class NumericEdit extends _xfa_object.XFAObject {
  53543. constructor(attributes) {
  53544. super(TEMPLATE_NS_ID, "numericEdit", true);
  53545. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  53546. this.id = attributes.id || "";
  53547. this.use = attributes.use || "";
  53548. this.usehref = attributes.usehref || "";
  53549. this.border = null;
  53550. this.comb = null;
  53551. this.extras = null;
  53552. this.margin = null;
  53553. }
  53554. [_xfa_object.$toHTML](availableSpace) {
  53555. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  53556. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53557. const html = {
  53558. name: "input",
  53559. attributes: {
  53560. type: "text",
  53561. fieldId: field[_xfa_object.$uid],
  53562. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53563. class: ["xfaTextfield"],
  53564. style
  53565. }
  53566. };
  53567. return _utils.HTMLResult.success({
  53568. name: "label",
  53569. attributes: {
  53570. class: ["xfaLabel"]
  53571. },
  53572. children: [html]
  53573. });
  53574. }
  53575. }
  53576. class Occur extends _xfa_object.XFAObject {
  53577. constructor(attributes) {
  53578. super(TEMPLATE_NS_ID, "occur", true);
  53579. this.id = attributes.id || "";
  53580. this.initial = (0, _utils.getInteger)({
  53581. data: attributes.initial,
  53582. defaultValue: 1,
  53583. validate: x => true
  53584. });
  53585. this.max = (0, _utils.getInteger)({
  53586. data: attributes.max,
  53587. defaultValue: 1,
  53588. validate: x => true
  53589. });
  53590. this.min = (0, _utils.getInteger)({
  53591. data: attributes.min,
  53592. defaultValue: 1,
  53593. validate: x => true
  53594. });
  53595. this.use = attributes.use || "";
  53596. this.usehref = attributes.usehref || "";
  53597. this.extras = null;
  53598. }
  53599. }
  53600. class Oid extends _xfa_object.StringObject {
  53601. constructor(attributes) {
  53602. super(TEMPLATE_NS_ID, "oid");
  53603. this.id = attributes.id || "";
  53604. this.name = attributes.name || "";
  53605. this.use = attributes.use || "";
  53606. this.usehref = attributes.usehref || "";
  53607. }
  53608. }
  53609. class Oids extends _xfa_object.XFAObject {
  53610. constructor(attributes) {
  53611. super(TEMPLATE_NS_ID, "oids", true);
  53612. this.id = attributes.id || "";
  53613. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53614. this.use = attributes.use || "";
  53615. this.usehref = attributes.usehref || "";
  53616. this.oid = new _xfa_object.XFAObjectArray();
  53617. }
  53618. }
  53619. class Overflow extends _xfa_object.XFAObject {
  53620. constructor(attributes) {
  53621. super(TEMPLATE_NS_ID, "overflow");
  53622. this.id = attributes.id || "";
  53623. this.leader = attributes.leader || "";
  53624. this.target = attributes.target || "";
  53625. this.trailer = attributes.trailer || "";
  53626. this.use = attributes.use || "";
  53627. this.usehref = attributes.usehref || "";
  53628. }
  53629. [_xfa_object.$getExtra]() {
  53630. if (!this[_xfa_object.$extra]) {
  53631. const parent = this[_xfa_object.$getParent]();
  53632. const root = this[_xfa_object.$getTemplateRoot]();
  53633. const target = root[_xfa_object.$searchNode](this.target, parent);
  53634. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  53635. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  53636. this[_xfa_object.$extra] = {
  53637. target: target && target[0] || null,
  53638. leader: leader && leader[0] || null,
  53639. trailer: trailer && trailer[0] || null,
  53640. addLeader: false,
  53641. addTrailer: false
  53642. };
  53643. }
  53644. return this[_xfa_object.$extra];
  53645. }
  53646. }
  53647. class PageArea extends _xfa_object.XFAObject {
  53648. constructor(attributes) {
  53649. super(TEMPLATE_NS_ID, "pageArea", true);
  53650. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  53651. this.id = attributes.id || "";
  53652. this.initialNumber = (0, _utils.getInteger)({
  53653. data: attributes.initialNumber,
  53654. defaultValue: 1,
  53655. validate: x => true
  53656. });
  53657. this.name = attributes.name || "";
  53658. this.numbered = (0, _utils.getInteger)({
  53659. data: attributes.numbered,
  53660. defaultValue: 1,
  53661. validate: x => true
  53662. });
  53663. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  53664. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  53665. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53666. this.use = attributes.use || "";
  53667. this.usehref = attributes.usehref || "";
  53668. this.desc = null;
  53669. this.extras = null;
  53670. this.medium = null;
  53671. this.occur = null;
  53672. this.area = new _xfa_object.XFAObjectArray();
  53673. this.contentArea = new _xfa_object.XFAObjectArray();
  53674. this.draw = new _xfa_object.XFAObjectArray();
  53675. this.exclGroup = new _xfa_object.XFAObjectArray();
  53676. this.field = new _xfa_object.XFAObjectArray();
  53677. this.subform = new _xfa_object.XFAObjectArray();
  53678. }
  53679. [_xfa_object.$isUsable]() {
  53680. if (!this[_xfa_object.$extra]) {
  53681. this[_xfa_object.$extra] = {
  53682. numberOfUse: 0
  53683. };
  53684. return true;
  53685. }
  53686. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  53687. }
  53688. [_xfa_object.$cleanPage]() {
  53689. delete this[_xfa_object.$extra];
  53690. }
  53691. [_xfa_object.$getNextPage]() {
  53692. if (!this[_xfa_object.$extra]) {
  53693. this[_xfa_object.$extra] = {
  53694. numberOfUse: 0
  53695. };
  53696. }
  53697. const parent = this[_xfa_object.$getParent]();
  53698. if (parent.relation === "orderedOccurrence") {
  53699. if (this[_xfa_object.$isUsable]()) {
  53700. this[_xfa_object.$extra].numberOfUse += 1;
  53701. return this;
  53702. }
  53703. }
  53704. return parent[_xfa_object.$getNextPage]();
  53705. }
  53706. [_xfa_object.$getAvailableSpace]() {
  53707. return this[_xfa_object.$extra].space || {
  53708. width: 0,
  53709. height: 0
  53710. };
  53711. }
  53712. [_xfa_object.$toHTML]() {
  53713. if (!this[_xfa_object.$extra]) {
  53714. this[_xfa_object.$extra] = {
  53715. numberOfUse: 1
  53716. };
  53717. }
  53718. const children = [];
  53719. this[_xfa_object.$extra].children = children;
  53720. const style = Object.create(null);
  53721. if (this.medium && this.medium.short && this.medium.long) {
  53722. style.width = (0, _html_utils.measureToString)(this.medium.short);
  53723. style.height = (0, _html_utils.measureToString)(this.medium.long);
  53724. this[_xfa_object.$extra].space = {
  53725. width: this.medium.short,
  53726. height: this.medium.long
  53727. };
  53728. if (this.medium.orientation === "landscape") {
  53729. const x = style.width;
  53730. style.width = style.height;
  53731. style.height = x;
  53732. this[_xfa_object.$extra].space = {
  53733. width: this.medium.long,
  53734. height: this.medium.short
  53735. };
  53736. }
  53737. } else {
  53738. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  53739. }
  53740. this[_xfa_object.$childrenToHTML]({
  53741. filter: new Set(["area", "draw", "field", "subform"]),
  53742. include: true
  53743. });
  53744. this[_xfa_object.$childrenToHTML]({
  53745. filter: new Set(["contentArea"]),
  53746. include: true
  53747. });
  53748. return _utils.HTMLResult.success({
  53749. name: "div",
  53750. children,
  53751. attributes: {
  53752. class: ["xfaPage"],
  53753. id: this[_xfa_object.$uid],
  53754. style,
  53755. xfaName: this.name
  53756. }
  53757. });
  53758. }
  53759. }
  53760. class PageSet extends _xfa_object.XFAObject {
  53761. constructor(attributes) {
  53762. super(TEMPLATE_NS_ID, "pageSet", true);
  53763. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  53764. this.id = attributes.id || "";
  53765. this.name = attributes.name || "";
  53766. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  53767. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53768. this.use = attributes.use || "";
  53769. this.usehref = attributes.usehref || "";
  53770. this.extras = null;
  53771. this.occur = null;
  53772. this.pageArea = new _xfa_object.XFAObjectArray();
  53773. this.pageSet = new _xfa_object.XFAObjectArray();
  53774. }
  53775. [_xfa_object.$cleanPage]() {
  53776. for (const page of this.pageArea.children) {
  53777. page[_xfa_object.$cleanPage]();
  53778. }
  53779. for (const page of this.pageSet.children) {
  53780. page[_xfa_object.$cleanPage]();
  53781. }
  53782. }
  53783. [_xfa_object.$isUsable]() {
  53784. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  53785. }
  53786. [_xfa_object.$getNextPage]() {
  53787. if (!this[_xfa_object.$extra]) {
  53788. this[_xfa_object.$extra] = {
  53789. numberOfUse: 1,
  53790. pageIndex: -1,
  53791. pageSetIndex: -1
  53792. };
  53793. }
  53794. if (this.relation === "orderedOccurrence") {
  53795. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  53796. this[_xfa_object.$extra].pageIndex += 1;
  53797. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  53798. return pageArea[_xfa_object.$getNextPage]();
  53799. }
  53800. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  53801. this[_xfa_object.$extra].pageSetIndex += 1;
  53802. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  53803. }
  53804. if (this[_xfa_object.$isUsable]()) {
  53805. this[_xfa_object.$extra].numberOfUse += 1;
  53806. this[_xfa_object.$extra].pageIndex = -1;
  53807. this[_xfa_object.$extra].pageSetIndex = -1;
  53808. return this[_xfa_object.$getNextPage]();
  53809. }
  53810. const parent = this[_xfa_object.$getParent]();
  53811. if (parent instanceof PageSet) {
  53812. return parent[_xfa_object.$getNextPage]();
  53813. }
  53814. this[_xfa_object.$cleanPage]();
  53815. return this[_xfa_object.$getNextPage]();
  53816. }
  53817. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  53818. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  53819. const position = pageNumber === 0 ? "first" : "rest";
  53820. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  53821. if (page) {
  53822. return page;
  53823. }
  53824. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  53825. if (page) {
  53826. return page;
  53827. }
  53828. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  53829. if (page) {
  53830. return page;
  53831. }
  53832. return this.pageArea.children[0];
  53833. }
  53834. }
  53835. class Para extends _xfa_object.XFAObject {
  53836. constructor(attributes) {
  53837. super(TEMPLATE_NS_ID, "para", true);
  53838. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53839. this.id = attributes.id || "";
  53840. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  53841. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  53842. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  53843. this.orphans = (0, _utils.getInteger)({
  53844. data: attributes.orphans,
  53845. defaultValue: 0,
  53846. validate: x => x >= 0
  53847. });
  53848. this.preserve = attributes.preserve || "";
  53849. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  53850. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  53851. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  53852. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  53853. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  53854. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  53855. this.use = attributes.use || "";
  53856. this.usehref = attributes.usehref || "";
  53857. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  53858. this.widows = (0, _utils.getInteger)({
  53859. data: attributes.widows,
  53860. defaultValue: 0,
  53861. validate: x => x >= 0
  53862. });
  53863. this.hyphenation = null;
  53864. }
  53865. [_xfa_object.$toStyle]() {
  53866. const style = (0, _html_utils.toStyle)(this, "hAlign");
  53867. if (this.marginLeft !== "") {
  53868. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  53869. }
  53870. if (this.marginRight !== "") {
  53871. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  53872. }
  53873. if (this.spaceAbove !== "") {
  53874. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  53875. }
  53876. if (this.spaceBelow !== "") {
  53877. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  53878. }
  53879. if (this.textIndent !== "") {
  53880. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  53881. (0, _html_utils.fixTextIndent)(style);
  53882. }
  53883. if (this.lineHeight > 0) {
  53884. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  53885. }
  53886. if (this.tabDefault !== "") {
  53887. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  53888. }
  53889. if (this.tabStops.length > 0) {}
  53890. if (this.hyphenatation) {
  53891. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  53892. }
  53893. return style;
  53894. }
  53895. }
  53896. class PasswordEdit extends _xfa_object.XFAObject {
  53897. constructor(attributes) {
  53898. super(TEMPLATE_NS_ID, "passwordEdit", true);
  53899. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  53900. this.id = attributes.id || "";
  53901. this.passwordChar = attributes.passwordChar || "*";
  53902. this.use = attributes.use || "";
  53903. this.usehref = attributes.usehref || "";
  53904. this.border = null;
  53905. this.extras = null;
  53906. this.margin = null;
  53907. }
  53908. }
  53909. class Pattern extends _xfa_object.XFAObject {
  53910. constructor(attributes) {
  53911. super(TEMPLATE_NS_ID, "pattern", true);
  53912. this.id = attributes.id || "";
  53913. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  53914. this.use = attributes.use || "";
  53915. this.usehref = attributes.usehref || "";
  53916. this.color = null;
  53917. this.extras = null;
  53918. }
  53919. [_xfa_object.$toStyle](startColor) {
  53920. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  53921. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  53922. const width = 5;
  53923. const cmd = "repeating-linear-gradient";
  53924. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  53925. switch (this.type) {
  53926. case "crossHatch":
  53927. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  53928. case "crossDiagonal":
  53929. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  53930. case "diagonalLeft":
  53931. return `${cmd}(45deg,${colors})`;
  53932. case "diagonalRight":
  53933. return `${cmd}(-45deg,${colors})`;
  53934. case "horizontal":
  53935. return `${cmd}(to top,${colors})`;
  53936. case "vertical":
  53937. return `${cmd}(to right,${colors})`;
  53938. }
  53939. return "";
  53940. }
  53941. }
  53942. class Picture extends _xfa_object.StringObject {
  53943. constructor(attributes) {
  53944. super(TEMPLATE_NS_ID, "picture");
  53945. this.id = attributes.id || "";
  53946. this.use = attributes.use || "";
  53947. this.usehref = attributes.usehref || "";
  53948. }
  53949. }
  53950. class Proto extends _xfa_object.XFAObject {
  53951. constructor(attributes) {
  53952. super(TEMPLATE_NS_ID, "proto", true);
  53953. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  53954. this.arc = new _xfa_object.XFAObjectArray();
  53955. this.area = new _xfa_object.XFAObjectArray();
  53956. this.assist = new _xfa_object.XFAObjectArray();
  53957. this.barcode = new _xfa_object.XFAObjectArray();
  53958. this.bindItems = new _xfa_object.XFAObjectArray();
  53959. this.bookend = new _xfa_object.XFAObjectArray();
  53960. this.boolean = new _xfa_object.XFAObjectArray();
  53961. this.border = new _xfa_object.XFAObjectArray();
  53962. this.break = new _xfa_object.XFAObjectArray();
  53963. this.breakAfter = new _xfa_object.XFAObjectArray();
  53964. this.breakBefore = new _xfa_object.XFAObjectArray();
  53965. this.button = new _xfa_object.XFAObjectArray();
  53966. this.calculate = new _xfa_object.XFAObjectArray();
  53967. this.caption = new _xfa_object.XFAObjectArray();
  53968. this.certificate = new _xfa_object.XFAObjectArray();
  53969. this.certificates = new _xfa_object.XFAObjectArray();
  53970. this.checkButton = new _xfa_object.XFAObjectArray();
  53971. this.choiceList = new _xfa_object.XFAObjectArray();
  53972. this.color = new _xfa_object.XFAObjectArray();
  53973. this.comb = new _xfa_object.XFAObjectArray();
  53974. this.connect = new _xfa_object.XFAObjectArray();
  53975. this.contentArea = new _xfa_object.XFAObjectArray();
  53976. this.corner = new _xfa_object.XFAObjectArray();
  53977. this.date = new _xfa_object.XFAObjectArray();
  53978. this.dateTime = new _xfa_object.XFAObjectArray();
  53979. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  53980. this.decimal = new _xfa_object.XFAObjectArray();
  53981. this.defaultUi = new _xfa_object.XFAObjectArray();
  53982. this.desc = new _xfa_object.XFAObjectArray();
  53983. this.digestMethod = new _xfa_object.XFAObjectArray();
  53984. this.digestMethods = new _xfa_object.XFAObjectArray();
  53985. this.draw = new _xfa_object.XFAObjectArray();
  53986. this.edge = new _xfa_object.XFAObjectArray();
  53987. this.encoding = new _xfa_object.XFAObjectArray();
  53988. this.encodings = new _xfa_object.XFAObjectArray();
  53989. this.encrypt = new _xfa_object.XFAObjectArray();
  53990. this.encryptData = new _xfa_object.XFAObjectArray();
  53991. this.encryption = new _xfa_object.XFAObjectArray();
  53992. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  53993. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  53994. this.event = new _xfa_object.XFAObjectArray();
  53995. this.exData = new _xfa_object.XFAObjectArray();
  53996. this.exObject = new _xfa_object.XFAObjectArray();
  53997. this.exclGroup = new _xfa_object.XFAObjectArray();
  53998. this.execute = new _xfa_object.XFAObjectArray();
  53999. this.extras = new _xfa_object.XFAObjectArray();
  54000. this.field = new _xfa_object.XFAObjectArray();
  54001. this.fill = new _xfa_object.XFAObjectArray();
  54002. this.filter = new _xfa_object.XFAObjectArray();
  54003. this.float = new _xfa_object.XFAObjectArray();
  54004. this.font = new _xfa_object.XFAObjectArray();
  54005. this.format = new _xfa_object.XFAObjectArray();
  54006. this.handler = new _xfa_object.XFAObjectArray();
  54007. this.hyphenation = new _xfa_object.XFAObjectArray();
  54008. this.image = new _xfa_object.XFAObjectArray();
  54009. this.imageEdit = new _xfa_object.XFAObjectArray();
  54010. this.integer = new _xfa_object.XFAObjectArray();
  54011. this.issuers = new _xfa_object.XFAObjectArray();
  54012. this.items = new _xfa_object.XFAObjectArray();
  54013. this.keep = new _xfa_object.XFAObjectArray();
  54014. this.keyUsage = new _xfa_object.XFAObjectArray();
  54015. this.line = new _xfa_object.XFAObjectArray();
  54016. this.linear = new _xfa_object.XFAObjectArray();
  54017. this.lockDocument = new _xfa_object.XFAObjectArray();
  54018. this.manifest = new _xfa_object.XFAObjectArray();
  54019. this.margin = new _xfa_object.XFAObjectArray();
  54020. this.mdp = new _xfa_object.XFAObjectArray();
  54021. this.medium = new _xfa_object.XFAObjectArray();
  54022. this.message = new _xfa_object.XFAObjectArray();
  54023. this.numericEdit = new _xfa_object.XFAObjectArray();
  54024. this.occur = new _xfa_object.XFAObjectArray();
  54025. this.oid = new _xfa_object.XFAObjectArray();
  54026. this.oids = new _xfa_object.XFAObjectArray();
  54027. this.overflow = new _xfa_object.XFAObjectArray();
  54028. this.pageArea = new _xfa_object.XFAObjectArray();
  54029. this.pageSet = new _xfa_object.XFAObjectArray();
  54030. this.para = new _xfa_object.XFAObjectArray();
  54031. this.passwordEdit = new _xfa_object.XFAObjectArray();
  54032. this.pattern = new _xfa_object.XFAObjectArray();
  54033. this.picture = new _xfa_object.XFAObjectArray();
  54034. this.radial = new _xfa_object.XFAObjectArray();
  54035. this.reason = new _xfa_object.XFAObjectArray();
  54036. this.reasons = new _xfa_object.XFAObjectArray();
  54037. this.rectangle = new _xfa_object.XFAObjectArray();
  54038. this.ref = new _xfa_object.XFAObjectArray();
  54039. this.script = new _xfa_object.XFAObjectArray();
  54040. this.setProperty = new _xfa_object.XFAObjectArray();
  54041. this.signData = new _xfa_object.XFAObjectArray();
  54042. this.signature = new _xfa_object.XFAObjectArray();
  54043. this.signing = new _xfa_object.XFAObjectArray();
  54044. this.solid = new _xfa_object.XFAObjectArray();
  54045. this.speak = new _xfa_object.XFAObjectArray();
  54046. this.stipple = new _xfa_object.XFAObjectArray();
  54047. this.subform = new _xfa_object.XFAObjectArray();
  54048. this.subformSet = new _xfa_object.XFAObjectArray();
  54049. this.subjectDN = new _xfa_object.XFAObjectArray();
  54050. this.subjectDNs = new _xfa_object.XFAObjectArray();
  54051. this.submit = new _xfa_object.XFAObjectArray();
  54052. this.text = new _xfa_object.XFAObjectArray();
  54053. this.textEdit = new _xfa_object.XFAObjectArray();
  54054. this.time = new _xfa_object.XFAObjectArray();
  54055. this.timeStamp = new _xfa_object.XFAObjectArray();
  54056. this.toolTip = new _xfa_object.XFAObjectArray();
  54057. this.traversal = new _xfa_object.XFAObjectArray();
  54058. this.traverse = new _xfa_object.XFAObjectArray();
  54059. this.ui = new _xfa_object.XFAObjectArray();
  54060. this.validate = new _xfa_object.XFAObjectArray();
  54061. this.value = new _xfa_object.XFAObjectArray();
  54062. this.variables = new _xfa_object.XFAObjectArray();
  54063. }
  54064. }
  54065. class Radial extends _xfa_object.XFAObject {
  54066. constructor(attributes) {
  54067. super(TEMPLATE_NS_ID, "radial", true);
  54068. this.id = attributes.id || "";
  54069. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  54070. this.use = attributes.use || "";
  54071. this.usehref = attributes.usehref || "";
  54072. this.color = null;
  54073. this.extras = null;
  54074. }
  54075. [_xfa_object.$toStyle](startColor) {
  54076. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54077. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  54078. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  54079. return `radial-gradient(circle at center, ${colors})`;
  54080. }
  54081. }
  54082. class Reason extends _xfa_object.StringObject {
  54083. constructor(attributes) {
  54084. super(TEMPLATE_NS_ID, "reason");
  54085. this.id = attributes.id || "";
  54086. this.name = attributes.name || "";
  54087. this.use = attributes.use || "";
  54088. this.usehref = attributes.usehref || "";
  54089. }
  54090. }
  54091. class Reasons extends _xfa_object.XFAObject {
  54092. constructor(attributes) {
  54093. super(TEMPLATE_NS_ID, "reasons", true);
  54094. this.id = attributes.id || "";
  54095. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54096. this.use = attributes.use || "";
  54097. this.usehref = attributes.usehref || "";
  54098. this.reason = new _xfa_object.XFAObjectArray();
  54099. }
  54100. }
  54101. class Rectangle extends _xfa_object.XFAObject {
  54102. constructor(attributes) {
  54103. super(TEMPLATE_NS_ID, "rectangle", true);
  54104. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54105. this.id = attributes.id || "";
  54106. this.use = attributes.use || "";
  54107. this.usehref = attributes.usehref || "";
  54108. this.corner = new _xfa_object.XFAObjectArray(4);
  54109. this.edge = new _xfa_object.XFAObjectArray(4);
  54110. this.fill = null;
  54111. }
  54112. [_xfa_object.$toHTML]() {
  54113. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  54114. const edgeStyle = edge[_xfa_object.$toStyle]();
  54115. const style = Object.create(null);
  54116. if (this.fill && this.fill.presence === "visible") {
  54117. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54118. } else {
  54119. style.fill = "transparent";
  54120. }
  54121. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  54122. style.stroke = edgeStyle.color;
  54123. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  54124. const cornerStyle = corner[_xfa_object.$toStyle]();
  54125. const rect = {
  54126. name: "rect",
  54127. attributes: {
  54128. xmlns: SVG_NS,
  54129. width: "100%",
  54130. height: "100%",
  54131. x: 0,
  54132. y: 0,
  54133. rx: cornerStyle.radius,
  54134. ry: cornerStyle.radius,
  54135. style
  54136. }
  54137. };
  54138. const svg = {
  54139. name: "svg",
  54140. children: [rect],
  54141. attributes: {
  54142. xmlns: SVG_NS,
  54143. style: {
  54144. overflow: "visible"
  54145. },
  54146. width: "100%",
  54147. height: "100%"
  54148. }
  54149. };
  54150. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54151. if (hasMargin(parent)) {
  54152. return _utils.HTMLResult.success({
  54153. name: "div",
  54154. attributes: {
  54155. style: {
  54156. display: "inline",
  54157. width: "100%",
  54158. height: "100%"
  54159. }
  54160. },
  54161. children: [svg]
  54162. });
  54163. }
  54164. svg.attributes.style.position = "absolute";
  54165. return _utils.HTMLResult.success(svg);
  54166. }
  54167. }
  54168. class RefElement extends _xfa_object.StringObject {
  54169. constructor(attributes) {
  54170. super(TEMPLATE_NS_ID, "ref");
  54171. this.id = attributes.id || "";
  54172. this.use = attributes.use || "";
  54173. this.usehref = attributes.usehref || "";
  54174. }
  54175. }
  54176. class Script extends _xfa_object.StringObject {
  54177. constructor(attributes) {
  54178. super(TEMPLATE_NS_ID, "script");
  54179. this.binding = attributes.binding || "";
  54180. this.contentType = attributes.contentType || "";
  54181. this.id = attributes.id || "";
  54182. this.name = attributes.name || "";
  54183. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  54184. this.use = attributes.use || "";
  54185. this.usehref = attributes.usehref || "";
  54186. }
  54187. }
  54188. class SetProperty extends _xfa_object.XFAObject {
  54189. constructor(attributes) {
  54190. super(TEMPLATE_NS_ID, "setProperty");
  54191. this.connection = attributes.connection || "";
  54192. this.ref = attributes.ref || "";
  54193. this.target = attributes.target || "";
  54194. }
  54195. }
  54196. exports.SetProperty = SetProperty;
  54197. class SignData extends _xfa_object.XFAObject {
  54198. constructor(attributes) {
  54199. super(TEMPLATE_NS_ID, "signData", true);
  54200. this.id = attributes.id || "";
  54201. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  54202. this.ref = attributes.ref || "";
  54203. this.target = attributes.target || "";
  54204. this.use = attributes.use || "";
  54205. this.usehref = attributes.usehref || "";
  54206. this.filter = null;
  54207. this.manifest = null;
  54208. }
  54209. }
  54210. class Signature extends _xfa_object.XFAObject {
  54211. constructor(attributes) {
  54212. super(TEMPLATE_NS_ID, "signature", true);
  54213. this.id = attributes.id || "";
  54214. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  54215. this.use = attributes.use || "";
  54216. this.usehref = attributes.usehref || "";
  54217. this.border = null;
  54218. this.extras = null;
  54219. this.filter = null;
  54220. this.manifest = null;
  54221. this.margin = null;
  54222. }
  54223. }
  54224. class Signing extends _xfa_object.XFAObject {
  54225. constructor(attributes) {
  54226. super(TEMPLATE_NS_ID, "signing", true);
  54227. this.id = attributes.id || "";
  54228. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54229. this.use = attributes.use || "";
  54230. this.usehref = attributes.usehref || "";
  54231. this.certificate = new _xfa_object.XFAObjectArray();
  54232. }
  54233. }
  54234. class Solid extends _xfa_object.XFAObject {
  54235. constructor(attributes) {
  54236. super(TEMPLATE_NS_ID, "solid", true);
  54237. this.id = attributes.id || "";
  54238. this.use = attributes.use || "";
  54239. this.usehref = attributes.usehref || "";
  54240. this.extras = null;
  54241. }
  54242. [_xfa_object.$toStyle](startColor) {
  54243. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54244. }
  54245. }
  54246. class Speak extends _xfa_object.StringObject {
  54247. constructor(attributes) {
  54248. super(TEMPLATE_NS_ID, "speak");
  54249. this.disable = (0, _utils.getInteger)({
  54250. data: attributes.disable,
  54251. defaultValue: 0,
  54252. validate: x => x === 1
  54253. });
  54254. this.id = attributes.id || "";
  54255. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  54256. this.rid = attributes.rid || "";
  54257. this.use = attributes.use || "";
  54258. this.usehref = attributes.usehref || "";
  54259. }
  54260. }
  54261. class Stipple extends _xfa_object.XFAObject {
  54262. constructor(attributes) {
  54263. super(TEMPLATE_NS_ID, "stipple", true);
  54264. this.id = attributes.id || "";
  54265. this.rate = (0, _utils.getInteger)({
  54266. data: attributes.rate,
  54267. defaultValue: 50,
  54268. validate: x => x >= 0 && x <= 100
  54269. });
  54270. this.use = attributes.use || "";
  54271. this.usehref = attributes.usehref || "";
  54272. this.color = null;
  54273. this.extras = null;
  54274. }
  54275. [_xfa_object.$toStyle](bgColor) {
  54276. const alpha = this.rate / 100;
  54277. 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));
  54278. }
  54279. }
  54280. class Subform extends _xfa_object.XFAObject {
  54281. constructor(attributes) {
  54282. super(TEMPLATE_NS_ID, "subform", true);
  54283. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54284. this.allowMacro = (0, _utils.getInteger)({
  54285. data: attributes.allowMacro,
  54286. defaultValue: 0,
  54287. validate: x => x === 1
  54288. });
  54289. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54290. this.colSpan = (0, _utils.getInteger)({
  54291. data: attributes.colSpan,
  54292. defaultValue: 1,
  54293. validate: n => n >= 1 || n === -1
  54294. });
  54295. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  54296. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54297. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54298. this.id = attributes.id || "";
  54299. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  54300. this.locale = attributes.locale || "";
  54301. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54302. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54303. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  54304. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54305. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54306. this.name = attributes.name || "";
  54307. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54308. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54309. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  54310. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  54311. this.use = attributes.use || "";
  54312. this.usehref = attributes.usehref || "";
  54313. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54314. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54315. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54316. this.assist = null;
  54317. this.bind = null;
  54318. this.bookend = null;
  54319. this.border = null;
  54320. this.break = null;
  54321. this.calculate = null;
  54322. this.desc = null;
  54323. this.extras = null;
  54324. this.keep = null;
  54325. this.margin = null;
  54326. this.occur = null;
  54327. this.overflow = null;
  54328. this.pageSet = null;
  54329. this.para = null;
  54330. this.traversal = null;
  54331. this.validate = null;
  54332. this.variables = null;
  54333. this.area = new _xfa_object.XFAObjectArray();
  54334. this.breakAfter = new _xfa_object.XFAObjectArray();
  54335. this.breakBefore = new _xfa_object.XFAObjectArray();
  54336. this.connect = new _xfa_object.XFAObjectArray();
  54337. this.draw = new _xfa_object.XFAObjectArray();
  54338. this.event = new _xfa_object.XFAObjectArray();
  54339. this.exObject = new _xfa_object.XFAObjectArray();
  54340. this.exclGroup = new _xfa_object.XFAObjectArray();
  54341. this.field = new _xfa_object.XFAObjectArray();
  54342. this.proto = new _xfa_object.XFAObjectArray();
  54343. this.setProperty = new _xfa_object.XFAObjectArray();
  54344. this.subform = new _xfa_object.XFAObjectArray();
  54345. this.subformSet = new _xfa_object.XFAObjectArray();
  54346. }
  54347. [_xfa_object.$getSubformParent]() {
  54348. const parent = this[_xfa_object.$getParent]();
  54349. if (parent instanceof SubformSet) {
  54350. return parent[_xfa_object.$getSubformParent]();
  54351. }
  54352. return parent;
  54353. }
  54354. [_xfa_object.$isBindable]() {
  54355. return true;
  54356. }
  54357. [_xfa_object.$isThereMoreWidth]() {
  54358. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  54359. }
  54360. *[_xfa_object.$getContainedChildren]() {
  54361. yield* getContainedChildren(this);
  54362. }
  54363. [_xfa_object.$flushHTML]() {
  54364. return (0, _layout.flushHTML)(this);
  54365. }
  54366. [_xfa_object.$addHTML](html, bbox) {
  54367. (0, _layout.addHTML)(this, html, bbox);
  54368. }
  54369. [_xfa_object.$getAvailableSpace]() {
  54370. return (0, _layout.getAvailableSpace)(this);
  54371. }
  54372. [_xfa_object.$isSplittable]() {
  54373. const parent = this[_xfa_object.$getSubformParent]();
  54374. if (!parent[_xfa_object.$isSplittable]()) {
  54375. return false;
  54376. }
  54377. const contentArea = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  54378. if (this.overflow && this.overflow[_xfa_object.$getExtra]().target === contentArea) {
  54379. return false;
  54380. }
  54381. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  54382. return this[_xfa_object.$extra]._isSplittable;
  54383. }
  54384. if (this.layout === "position" || this.layout.includes("row")) {
  54385. this[_xfa_object.$extra]._isSplittable = false;
  54386. return false;
  54387. }
  54388. if (this.keep && this.keep.intact !== "none") {
  54389. this[_xfa_object.$extra]._isSplittable = false;
  54390. return false;
  54391. }
  54392. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  54393. return false;
  54394. }
  54395. this[_xfa_object.$extra]._isSplittable = true;
  54396. return true;
  54397. }
  54398. [_xfa_object.$toHTML](availableSpace) {
  54399. if (this.break) {
  54400. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  54401. const node = new BreakAfter({
  54402. targetType: this.break.after,
  54403. target: this.break.afterTarget,
  54404. startNew: this.break.startNew.toString()
  54405. });
  54406. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  54407. this[_xfa_object.$appendChild](node);
  54408. this.breakAfter.push(node);
  54409. }
  54410. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  54411. const node = new BreakBefore({
  54412. targetType: this.break.before,
  54413. target: this.break.beforeTarget,
  54414. startNew: this.break.startNew.toString()
  54415. });
  54416. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  54417. this[_xfa_object.$appendChild](node);
  54418. this.breakBefore.push(node);
  54419. }
  54420. if (this.break.overflowTarget !== "") {
  54421. const node = new Overflow({
  54422. target: this.break.overflowTarget,
  54423. leader: this.break.overflowLeader,
  54424. trailer: this.break.overflowTrailer
  54425. });
  54426. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  54427. this[_xfa_object.$appendChild](node);
  54428. this.overflow.push(node);
  54429. }
  54430. this[_xfa_object.$removeChild](this.break);
  54431. this.break = null;
  54432. }
  54433. if (this.presence === "hidden" || this.presence === "inactive") {
  54434. return _utils.HTMLResult.EMPTY;
  54435. }
  54436. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  54437. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  54438. }
  54439. if (this.breakBefore.children.length >= 1) {
  54440. const breakBefore = this.breakBefore.children[0];
  54441. if (handleBreak(breakBefore)) {
  54442. return _utils.HTMLResult.breakNode(breakBefore);
  54443. }
  54444. }
  54445. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  54446. return _utils.HTMLResult.EMPTY;
  54447. }
  54448. (0, _html_utils.fixDimensions)(this);
  54449. const children = [];
  54450. const attributes = {
  54451. id: this[_xfa_object.$uid],
  54452. class: []
  54453. };
  54454. (0, _html_utils.setAccess)(this, attributes.class);
  54455. if (!this[_xfa_object.$extra]) {
  54456. this[_xfa_object.$extra] = Object.create(null);
  54457. }
  54458. Object.assign(this[_xfa_object.$extra], {
  54459. children,
  54460. line: null,
  54461. attributes,
  54462. attempt: 0,
  54463. numberInLine: 0,
  54464. availableSpace: {
  54465. width: Math.min(this.w || Infinity, availableSpace.width),
  54466. height: Math.min(this.h || Infinity, availableSpace.height)
  54467. },
  54468. width: 0,
  54469. height: 0,
  54470. prevHeight: 0,
  54471. currentWidth: 0
  54472. });
  54473. const root = this[_xfa_object.$getTemplateRoot]();
  54474. const currentContentArea = root[_xfa_object.$extra].currentContentArea;
  54475. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  54476. if (this.overflow) {
  54477. root[_xfa_object.$extra].noLayoutFailure = root[_xfa_object.$extra].noLayoutFailure || this.overflow[_xfa_object.$getExtra]().target === currentContentArea;
  54478. }
  54479. const isSplittable = this[_xfa_object.$isSplittable]();
  54480. if (!isSplittable) {
  54481. setFirstUnsplittable(this);
  54482. }
  54483. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54484. return _utils.HTMLResult.FAILURE;
  54485. }
  54486. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  54487. if (this.layout.includes("row")) {
  54488. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  54489. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  54490. this[_xfa_object.$extra].columnWidths = columnWidths;
  54491. this[_xfa_object.$extra].currentColumn = 0;
  54492. }
  54493. }
  54494. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  54495. const classNames = ["xfaSubform"];
  54496. const cl = (0, _html_utils.layoutClass)(this);
  54497. if (cl) {
  54498. classNames.push(cl);
  54499. }
  54500. attributes.style = style;
  54501. attributes.class = classNames;
  54502. if (this.name) {
  54503. attributes.xfaName = this.name;
  54504. }
  54505. if (this.overflow) {
  54506. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  54507. if (overflowExtra.addLeader) {
  54508. overflowExtra.addLeader = false;
  54509. handleOverflow(this, overflowExtra.leader, availableSpace);
  54510. }
  54511. }
  54512. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  54513. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  54514. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  54515. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  54516. this[_xfa_object.$extra].numberInLine = 0;
  54517. }
  54518. const result = this[_xfa_object.$childrenToHTML]({
  54519. filter,
  54520. include: true
  54521. });
  54522. if (result.success) {
  54523. break;
  54524. }
  54525. if (result.isBreak()) {
  54526. return result;
  54527. }
  54528. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  54529. this[_xfa_object.$extra].attempt = maxRun;
  54530. break;
  54531. }
  54532. }
  54533. if (!isSplittable) {
  54534. unsetFirstUnsplittable(this);
  54535. }
  54536. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  54537. if (this[_xfa_object.$extra].attempt === maxRun) {
  54538. if (this.overflow) {
  54539. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  54540. }
  54541. if (!isSplittable) {
  54542. delete this[_xfa_object.$extra];
  54543. }
  54544. return _utils.HTMLResult.FAILURE;
  54545. }
  54546. if (this.overflow) {
  54547. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  54548. if (overflowExtra.addTrailer) {
  54549. overflowExtra.addTrailer = false;
  54550. handleOverflow(this, overflowExtra.trailer, availableSpace);
  54551. }
  54552. }
  54553. let marginH = 0;
  54554. let marginV = 0;
  54555. if (this.margin) {
  54556. marginH = this.margin.leftInset + this.margin.rightInset;
  54557. marginV = this.margin.topInset + this.margin.bottomInset;
  54558. }
  54559. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  54560. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  54561. const bbox = [this.x, this.y, width, height];
  54562. if (this.w === "") {
  54563. style.width = (0, _html_utils.measureToString)(width);
  54564. }
  54565. if (this.h === "") {
  54566. style.height = (0, _html_utils.measureToString)(height);
  54567. }
  54568. const html = {
  54569. name: "div",
  54570. attributes,
  54571. children
  54572. };
  54573. const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null;
  54574. if (assist) {
  54575. html.attributes.title = assist;
  54576. }
  54577. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54578. if (this.breakAfter.children.length >= 1) {
  54579. const breakAfter = this.breakAfter.children[0];
  54580. if (handleBreak(breakAfter)) {
  54581. this[_xfa_object.$extra].afterBreakAfter = result;
  54582. return _utils.HTMLResult.breakNode(breakAfter);
  54583. }
  54584. }
  54585. delete this[_xfa_object.$extra];
  54586. return result;
  54587. }
  54588. }
  54589. class SubformSet extends _xfa_object.XFAObject {
  54590. constructor(attributes) {
  54591. super(TEMPLATE_NS_ID, "subformSet", true);
  54592. this.id = attributes.id || "";
  54593. this.name = attributes.name || "";
  54594. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  54595. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54596. this.use = attributes.use || "";
  54597. this.usehref = attributes.usehref || "";
  54598. this.bookend = null;
  54599. this.break = null;
  54600. this.desc = null;
  54601. this.extras = null;
  54602. this.occur = null;
  54603. this.overflow = null;
  54604. this.breakAfter = new _xfa_object.XFAObjectArray();
  54605. this.breakBefore = new _xfa_object.XFAObjectArray();
  54606. this.subform = new _xfa_object.XFAObjectArray();
  54607. this.subformSet = new _xfa_object.XFAObjectArray();
  54608. }
  54609. *[_xfa_object.$getContainedChildren]() {
  54610. yield* getContainedChildren(this);
  54611. }
  54612. [_xfa_object.$getSubformParent]() {
  54613. let parent = this[_xfa_object.$getParent]();
  54614. while (!(parent instanceof Subform)) {
  54615. parent = parent[_xfa_object.$getParent]();
  54616. }
  54617. return parent;
  54618. }
  54619. }
  54620. class SubjectDN extends _xfa_object.ContentObject {
  54621. constructor(attributes) {
  54622. super(TEMPLATE_NS_ID, "subjectDN");
  54623. this.delimiter = attributes.delimiter || ",";
  54624. this.id = attributes.id || "";
  54625. this.name = attributes.name || "";
  54626. this.use = attributes.use || "";
  54627. this.usehref = attributes.usehref || "";
  54628. }
  54629. [_xfa_object.$finalize]() {
  54630. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  54631. kv = kv.split("=", 2);
  54632. kv[0] = kv[0].trim();
  54633. return kv;
  54634. }));
  54635. }
  54636. }
  54637. class SubjectDNs extends _xfa_object.XFAObject {
  54638. constructor(attributes) {
  54639. super(TEMPLATE_NS_ID, "subjectDNs", true);
  54640. this.id = attributes.id || "";
  54641. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54642. this.use = attributes.use || "";
  54643. this.usehref = attributes.usehref || "";
  54644. this.subjectDN = new _xfa_object.XFAObjectArray();
  54645. }
  54646. }
  54647. class Submit extends _xfa_object.XFAObject {
  54648. constructor(attributes) {
  54649. super(TEMPLATE_NS_ID, "submit", true);
  54650. this.embedPDF = (0, _utils.getInteger)({
  54651. data: attributes.embedPDF,
  54652. defaultValue: 0,
  54653. validate: x => x === 1
  54654. });
  54655. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  54656. this.id = attributes.id || "";
  54657. this.target = attributes.target || "";
  54658. this.textEncoding = (0, _utils.getKeyword)({
  54659. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  54660. defaultValue: "",
  54661. 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-[0-9]{2}/)
  54662. });
  54663. this.use = attributes.use || "";
  54664. this.usehref = attributes.usehref || "";
  54665. this.xdpContent = attributes.xdpContent || "";
  54666. this.encrypt = null;
  54667. this.encryptData = new _xfa_object.XFAObjectArray();
  54668. this.signData = new _xfa_object.XFAObjectArray();
  54669. }
  54670. }
  54671. class Template extends _xfa_object.XFAObject {
  54672. constructor(attributes) {
  54673. super(TEMPLATE_NS_ID, "template", true);
  54674. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  54675. this.extras = null;
  54676. this.subform = new _xfa_object.XFAObjectArray();
  54677. }
  54678. [_xfa_object.$finalize]() {
  54679. if (this.subform.children.length === 0) {
  54680. (0, _util.warn)("XFA - No subforms in template node.");
  54681. }
  54682. if (this.subform.children.length >= 2) {
  54683. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  54684. }
  54685. this[_xfa_object.$tabIndex] = 1000;
  54686. }
  54687. [_xfa_object.$isSplittable]() {
  54688. return true;
  54689. }
  54690. [_xfa_object.$searchNode](expr, container) {
  54691. if (expr.startsWith("#")) {
  54692. return [this[_xfa_object.$ids].get(expr.slice(1))];
  54693. }
  54694. return (0, _som.searchNode)(this, container, expr, true, true);
  54695. }
  54696. [_xfa_object.$toHTML]() {
  54697. if (!this.subform.children.length) {
  54698. return _utils.HTMLResult.success({
  54699. name: "div",
  54700. children: []
  54701. });
  54702. }
  54703. this[_xfa_object.$extra] = {
  54704. overflowNode: null,
  54705. firstUnsplittable: null,
  54706. currentContentArea: null,
  54707. currentPageArea: null,
  54708. noLayoutFailure: false,
  54709. pageNumber: 1,
  54710. pagePosition: "first",
  54711. oddOrEven: "odd",
  54712. blankOrNotBlank: "nonBlank"
  54713. };
  54714. const root = this.subform.children[0];
  54715. root.pageSet[_xfa_object.$cleanPage]();
  54716. const pageAreas = root.pageSet.pageArea.children;
  54717. const mainHtml = {
  54718. name: "div",
  54719. children: []
  54720. };
  54721. let pageArea = null;
  54722. let breakBefore = null;
  54723. let breakBeforeTarget = null;
  54724. if (root.breakBefore.children.length >= 1) {
  54725. breakBefore = root.breakBefore.children[0];
  54726. breakBeforeTarget = breakBefore.target;
  54727. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  54728. breakBefore = root.subform.children[0].breakBefore.children[0];
  54729. breakBeforeTarget = breakBefore.target;
  54730. } else if (root.break && root.break.beforeTarget) {
  54731. breakBefore = root.break;
  54732. breakBeforeTarget = breakBefore.beforeTarget;
  54733. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  54734. breakBefore = root.subform.children[0].break;
  54735. breakBeforeTarget = breakBefore.beforeTarget;
  54736. }
  54737. if (breakBefore) {
  54738. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  54739. if (target instanceof PageArea) {
  54740. pageArea = target;
  54741. breakBefore[_xfa_object.$extra] = {};
  54742. }
  54743. }
  54744. if (!pageArea) {
  54745. pageArea = pageAreas[0];
  54746. }
  54747. pageArea[_xfa_object.$extra] = {
  54748. numberOfUse: 1
  54749. };
  54750. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  54751. pageAreaParent[_xfa_object.$extra] = {
  54752. numberOfUse: 1,
  54753. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  54754. pageSetIndex: 0
  54755. };
  54756. let targetPageArea;
  54757. let leader = null;
  54758. let trailer = null;
  54759. let hasSomething = true;
  54760. let hasSomethingCounter = 0;
  54761. let startIndex = 0;
  54762. while (true) {
  54763. if (!hasSomething) {
  54764. mainHtml.children.pop();
  54765. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  54766. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  54767. return mainHtml;
  54768. }
  54769. } else {
  54770. hasSomethingCounter = 0;
  54771. }
  54772. targetPageArea = null;
  54773. this[_xfa_object.$extra].currentPageArea = pageArea;
  54774. const page = pageArea[_xfa_object.$toHTML]().html;
  54775. mainHtml.children.push(page);
  54776. if (leader) {
  54777. this[_xfa_object.$extra].noLayoutFailure = true;
  54778. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  54779. leader = null;
  54780. }
  54781. if (trailer) {
  54782. this[_xfa_object.$extra].noLayoutFailure = true;
  54783. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  54784. trailer = null;
  54785. }
  54786. const contentAreas = pageArea.contentArea.children;
  54787. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  54788. hasSomething = false;
  54789. this[_xfa_object.$extra].firstUnsplittable = null;
  54790. this[_xfa_object.$extra].noLayoutFailure = false;
  54791. const flush = index => {
  54792. const html = root[_xfa_object.$flushHTML]();
  54793. if (html) {
  54794. hasSomething = hasSomething || html.children && html.children.length !== 0;
  54795. htmlContentAreas[index].children.push(html);
  54796. }
  54797. };
  54798. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  54799. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  54800. const space = {
  54801. width: contentArea.w,
  54802. height: contentArea.h
  54803. };
  54804. startIndex = 0;
  54805. if (leader) {
  54806. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  54807. leader = null;
  54808. }
  54809. if (trailer) {
  54810. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  54811. trailer = null;
  54812. }
  54813. const html = root[_xfa_object.$toHTML](space);
  54814. if (html.success) {
  54815. if (html.html) {
  54816. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  54817. htmlContentAreas[i].children.push(html.html);
  54818. } else if (!hasSomething) {
  54819. mainHtml.children.pop();
  54820. }
  54821. return mainHtml;
  54822. }
  54823. if (html.isBreak()) {
  54824. const node = html.breakNode;
  54825. flush(i);
  54826. if (node.targetType === "auto") {
  54827. continue;
  54828. }
  54829. if (node.leader) {
  54830. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  54831. leader = leader ? leader[0] : null;
  54832. }
  54833. if (node.trailer) {
  54834. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  54835. trailer = trailer ? trailer[0] : null;
  54836. }
  54837. if (node.targetType === "pageArea") {
  54838. targetPageArea = node[_xfa_object.$extra].target;
  54839. i = Infinity;
  54840. } else if (!node[_xfa_object.$extra].target) {
  54841. i = node[_xfa_object.$extra].index;
  54842. } else {
  54843. targetPageArea = node[_xfa_object.$extra].target;
  54844. startIndex = node[_xfa_object.$extra].index + 1;
  54845. i = Infinity;
  54846. }
  54847. continue;
  54848. }
  54849. if (this[_xfa_object.$extra].overflowNode) {
  54850. const node = this[_xfa_object.$extra].overflowNode;
  54851. this[_xfa_object.$extra].overflowNode = null;
  54852. const overflowExtra = node[_xfa_object.$getExtra]();
  54853. const target = overflowExtra.target;
  54854. overflowExtra.addLeader = overflowExtra.leader !== null;
  54855. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  54856. flush(i);
  54857. i = Infinity;
  54858. if (target instanceof PageArea) {
  54859. targetPageArea = target;
  54860. } else if (target instanceof ContentArea) {
  54861. const index = contentAreas.findIndex(e => e === target);
  54862. if (index !== -1) {
  54863. i = index - 1;
  54864. } else {
  54865. targetPageArea = target[_xfa_object.$getParent]();
  54866. startIndex = targetPageArea.contentArea.children.findIndex(e => e === target);
  54867. }
  54868. }
  54869. continue;
  54870. }
  54871. flush(i);
  54872. }
  54873. this[_xfa_object.$extra].pageNumber += 1;
  54874. if (targetPageArea) {
  54875. if (targetPageArea[_xfa_object.$isUsable]()) {
  54876. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  54877. } else {
  54878. targetPageArea = null;
  54879. }
  54880. }
  54881. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  54882. }
  54883. }
  54884. }
  54885. exports.Template = Template;
  54886. class Text extends _xfa_object.ContentObject {
  54887. constructor(attributes) {
  54888. super(TEMPLATE_NS_ID, "text");
  54889. this.id = attributes.id || "";
  54890. this.maxChars = (0, _utils.getInteger)({
  54891. data: attributes.maxChars,
  54892. defaultValue: 0,
  54893. validate: x => x >= 0
  54894. });
  54895. this.name = attributes.name || "";
  54896. this.rid = attributes.rid || "";
  54897. this.use = attributes.use || "";
  54898. this.usehref = attributes.usehref || "";
  54899. }
  54900. [_xfa_object.$acceptWhitespace]() {
  54901. return true;
  54902. }
  54903. [_xfa_object.$onChild](child) {
  54904. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  54905. this[_xfa_object.$content] = child;
  54906. return true;
  54907. }
  54908. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  54909. return false;
  54910. }
  54911. [_xfa_object.$onText](str) {
  54912. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  54913. return;
  54914. }
  54915. super[_xfa_object.$onText](str);
  54916. }
  54917. [_xfa_object.$toHTML](availableSpace) {
  54918. if (typeof this[_xfa_object.$content] === "string") {
  54919. const html = valueToHtml(this[_xfa_object.$content]).html;
  54920. if (this[_xfa_object.$content].includes("\u2029")) {
  54921. html.name = "div";
  54922. html.children = [];
  54923. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  54924. acc.push({
  54925. name: "span",
  54926. value: line
  54927. }, {
  54928. name: "br"
  54929. });
  54930. return acc;
  54931. }, [])).forEach(lines => {
  54932. html.children.push({
  54933. name: "p",
  54934. children: lines
  54935. });
  54936. });
  54937. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  54938. html.name = "div";
  54939. html.children = [];
  54940. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  54941. html.children.push({
  54942. name: "span",
  54943. value: line
  54944. }, {
  54945. name: "br"
  54946. });
  54947. });
  54948. }
  54949. return _utils.HTMLResult.success(html);
  54950. }
  54951. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  54952. }
  54953. }
  54954. exports.Text = Text;
  54955. class TextEdit extends _xfa_object.XFAObject {
  54956. constructor(attributes) {
  54957. super(TEMPLATE_NS_ID, "textEdit", true);
  54958. this.allowRichText = (0, _utils.getInteger)({
  54959. data: attributes.allowRichText,
  54960. defaultValue: 0,
  54961. validate: x => x === 1
  54962. });
  54963. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54964. this.id = attributes.id || "";
  54965. this.multiLine = attributes.multiLine || "";
  54966. this.use = attributes.use || "";
  54967. this.usehref = attributes.usehref || "";
  54968. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  54969. this.border = null;
  54970. this.comb = null;
  54971. this.extras = null;
  54972. this.margin = null;
  54973. }
  54974. [_xfa_object.$clean](builder) {
  54975. super[_xfa_object.$clean](builder);
  54976. const parent = this[_xfa_object.$getParent]();
  54977. const defaultValue = parent instanceof Draw ? 1 : 0;
  54978. this.multiLine = (0, _utils.getInteger)({
  54979. data: this.multiLine,
  54980. defaultValue,
  54981. validate: x => x === 0 || x === 1
  54982. });
  54983. }
  54984. [_xfa_object.$toHTML](availableSpace) {
  54985. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54986. let html;
  54987. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54988. if (this.multiLine === 1) {
  54989. html = {
  54990. name: "textarea",
  54991. attributes: {
  54992. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54993. fieldId: field[_xfa_object.$uid],
  54994. class: ["xfaTextfield"],
  54995. style
  54996. }
  54997. };
  54998. } else {
  54999. html = {
  55000. name: "input",
  55001. attributes: {
  55002. type: "text",
  55003. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  55004. fieldId: field[_xfa_object.$uid],
  55005. class: ["xfaTextfield"],
  55006. style
  55007. }
  55008. };
  55009. }
  55010. return _utils.HTMLResult.success({
  55011. name: "label",
  55012. attributes: {
  55013. class: ["xfaLabel"]
  55014. },
  55015. children: [html]
  55016. });
  55017. }
  55018. }
  55019. class Time extends _xfa_object.StringObject {
  55020. constructor(attributes) {
  55021. super(TEMPLATE_NS_ID, "time");
  55022. this.id = attributes.id || "";
  55023. this.name = attributes.name || "";
  55024. this.use = attributes.use || "";
  55025. this.usehref = attributes.usehref || "";
  55026. }
  55027. [_xfa_object.$finalize]() {
  55028. const date = this[_xfa_object.$content].trim();
  55029. this[_xfa_object.$content] = date ? new Date(date) : null;
  55030. }
  55031. [_xfa_object.$toHTML](availableSpace) {
  55032. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  55033. }
  55034. }
  55035. class TimeStamp extends _xfa_object.XFAObject {
  55036. constructor(attributes) {
  55037. super(TEMPLATE_NS_ID, "timeStamp");
  55038. this.id = attributes.id || "";
  55039. this.server = attributes.server || "";
  55040. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55041. this.use = attributes.use || "";
  55042. this.usehref = attributes.usehref || "";
  55043. }
  55044. }
  55045. class ToolTip extends _xfa_object.StringObject {
  55046. constructor(attributes) {
  55047. super(TEMPLATE_NS_ID, "toolTip");
  55048. this.id = attributes.id || "";
  55049. this.rid = attributes.rid || "";
  55050. this.use = attributes.use || "";
  55051. this.usehref = attributes.usehref || "";
  55052. }
  55053. }
  55054. class Traversal extends _xfa_object.XFAObject {
  55055. constructor(attributes) {
  55056. super(TEMPLATE_NS_ID, "traversal", true);
  55057. this.id = attributes.id || "";
  55058. this.use = attributes.use || "";
  55059. this.usehref = attributes.usehref || "";
  55060. this.extras = null;
  55061. this.traverse = new _xfa_object.XFAObjectArray();
  55062. }
  55063. }
  55064. class Traverse extends _xfa_object.XFAObject {
  55065. constructor(attributes) {
  55066. super(TEMPLATE_NS_ID, "traverse", true);
  55067. this.id = attributes.id || "";
  55068. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  55069. this.ref = attributes.ref || "";
  55070. this.use = attributes.use || "";
  55071. this.usehref = attributes.usehref || "";
  55072. this.extras = null;
  55073. this.script = null;
  55074. }
  55075. get name() {
  55076. return this.operation;
  55077. }
  55078. [_xfa_object.$isTransparent]() {
  55079. return false;
  55080. }
  55081. }
  55082. class Ui extends _xfa_object.XFAObject {
  55083. constructor(attributes) {
  55084. super(TEMPLATE_NS_ID, "ui", true);
  55085. this.id = attributes.id || "";
  55086. this.use = attributes.use || "";
  55087. this.usehref = attributes.usehref || "";
  55088. this.extras = null;
  55089. this.picture = null;
  55090. this.barcode = null;
  55091. this.button = null;
  55092. this.checkButton = null;
  55093. this.choiceList = null;
  55094. this.dateTimeEdit = null;
  55095. this.defaultUi = null;
  55096. this.imageEdit = null;
  55097. this.numericEdit = null;
  55098. this.passwordEdit = null;
  55099. this.signature = null;
  55100. this.textEdit = null;
  55101. }
  55102. [_xfa_object.$toHTML](availableSpace) {
  55103. for (const name of Object.getOwnPropertyNames(this)) {
  55104. if (name === "extras" || name === "picture") {
  55105. continue;
  55106. }
  55107. const obj = this[name];
  55108. if (!(obj instanceof _xfa_object.XFAObject)) {
  55109. continue;
  55110. }
  55111. return obj[_xfa_object.$toHTML](availableSpace);
  55112. }
  55113. return _utils.HTMLResult.EMPTY;
  55114. }
  55115. }
  55116. class Validate extends _xfa_object.XFAObject {
  55117. constructor(attributes) {
  55118. super(TEMPLATE_NS_ID, "validate", true);
  55119. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  55120. this.id = attributes.id || "";
  55121. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  55122. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  55123. this.use = attributes.use || "";
  55124. this.usehref = attributes.usehref || "";
  55125. this.extras = null;
  55126. this.message = null;
  55127. this.picture = null;
  55128. this.script = null;
  55129. }
  55130. }
  55131. class Value extends _xfa_object.XFAObject {
  55132. constructor(attributes) {
  55133. super(TEMPLATE_NS_ID, "value", true);
  55134. this.id = attributes.id || "";
  55135. this.override = (0, _utils.getInteger)({
  55136. data: attributes.override,
  55137. defaultValue: 0,
  55138. validate: x => x === 1
  55139. });
  55140. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55141. this.use = attributes.use || "";
  55142. this.usehref = attributes.usehref || "";
  55143. this.arc = null;
  55144. this.boolean = null;
  55145. this.date = null;
  55146. this.dateTime = null;
  55147. this.decimal = null;
  55148. this.exData = null;
  55149. this.float = null;
  55150. this.image = null;
  55151. this.integer = null;
  55152. this.line = null;
  55153. this.rectangle = null;
  55154. this.text = null;
  55155. this.time = null;
  55156. }
  55157. [_xfa_object.$setValue](value) {
  55158. const parent = this[_xfa_object.$getParent]();
  55159. if (parent instanceof Field) {
  55160. if (parent.ui && parent.ui.imageEdit) {
  55161. if (!this.image) {
  55162. this.image = new Image({});
  55163. }
  55164. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  55165. return;
  55166. }
  55167. }
  55168. const valueName = value[_xfa_object.$nodeName];
  55169. if (this[valueName] !== null) {
  55170. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  55171. return;
  55172. }
  55173. for (const name of Object.getOwnPropertyNames(this)) {
  55174. const obj = this[name];
  55175. if (obj instanceof _xfa_object.XFAObject) {
  55176. this[name] = null;
  55177. this[_xfa_object.$removeChild](obj);
  55178. }
  55179. }
  55180. this[value[_xfa_object.$nodeName]] = value;
  55181. this[_xfa_object.$appendChild](value);
  55182. }
  55183. [_xfa_object.$text]() {
  55184. if (this.exData) {
  55185. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  55186. }
  55187. for (const name of Object.getOwnPropertyNames(this)) {
  55188. if (name === "image") {
  55189. continue;
  55190. }
  55191. const obj = this[name];
  55192. if (obj instanceof _xfa_object.XFAObject) {
  55193. return (obj[_xfa_object.$content] || "").toString().trim();
  55194. }
  55195. }
  55196. return null;
  55197. }
  55198. [_xfa_object.$toHTML](availableSpace) {
  55199. for (const name of Object.getOwnPropertyNames(this)) {
  55200. const obj = this[name];
  55201. if (!(obj instanceof _xfa_object.XFAObject)) {
  55202. continue;
  55203. }
  55204. return obj[_xfa_object.$toHTML](availableSpace);
  55205. }
  55206. return _utils.HTMLResult.EMPTY;
  55207. }
  55208. }
  55209. exports.Value = Value;
  55210. class Variables extends _xfa_object.XFAObject {
  55211. constructor(attributes) {
  55212. super(TEMPLATE_NS_ID, "variables", true);
  55213. this.id = attributes.id || "";
  55214. this.use = attributes.use || "";
  55215. this.usehref = attributes.usehref || "";
  55216. this.boolean = new _xfa_object.XFAObjectArray();
  55217. this.date = new _xfa_object.XFAObjectArray();
  55218. this.dateTime = new _xfa_object.XFAObjectArray();
  55219. this.decimal = new _xfa_object.XFAObjectArray();
  55220. this.exData = new _xfa_object.XFAObjectArray();
  55221. this.float = new _xfa_object.XFAObjectArray();
  55222. this.image = new _xfa_object.XFAObjectArray();
  55223. this.integer = new _xfa_object.XFAObjectArray();
  55224. this.manifest = new _xfa_object.XFAObjectArray();
  55225. this.script = new _xfa_object.XFAObjectArray();
  55226. this.text = new _xfa_object.XFAObjectArray();
  55227. this.time = new _xfa_object.XFAObjectArray();
  55228. }
  55229. [_xfa_object.$isTransparent]() {
  55230. return true;
  55231. }
  55232. }
  55233. class TemplateNamespace {
  55234. static [_namespaces.$buildXFAObject](name, attributes) {
  55235. if (TemplateNamespace.hasOwnProperty(name)) {
  55236. const node = TemplateNamespace[name](attributes);
  55237. node[_xfa_object.$setSetAttributes](attributes);
  55238. return node;
  55239. }
  55240. return undefined;
  55241. }
  55242. static appearanceFilter(attrs) {
  55243. return new AppearanceFilter(attrs);
  55244. }
  55245. static arc(attrs) {
  55246. return new Arc(attrs);
  55247. }
  55248. static area(attrs) {
  55249. return new Area(attrs);
  55250. }
  55251. static assist(attrs) {
  55252. return new Assist(attrs);
  55253. }
  55254. static barcode(attrs) {
  55255. return new Barcode(attrs);
  55256. }
  55257. static bind(attrs) {
  55258. return new Bind(attrs);
  55259. }
  55260. static bindItems(attrs) {
  55261. return new BindItems(attrs);
  55262. }
  55263. static bookend(attrs) {
  55264. return new Bookend(attrs);
  55265. }
  55266. static boolean(attrs) {
  55267. return new BooleanElement(attrs);
  55268. }
  55269. static border(attrs) {
  55270. return new Border(attrs);
  55271. }
  55272. static break(attrs) {
  55273. return new Break(attrs);
  55274. }
  55275. static breakAfter(attrs) {
  55276. return new BreakAfter(attrs);
  55277. }
  55278. static breakBefore(attrs) {
  55279. return new BreakBefore(attrs);
  55280. }
  55281. static button(attrs) {
  55282. return new Button(attrs);
  55283. }
  55284. static calculate(attrs) {
  55285. return new Calculate(attrs);
  55286. }
  55287. static caption(attrs) {
  55288. return new Caption(attrs);
  55289. }
  55290. static certificate(attrs) {
  55291. return new Certificate(attrs);
  55292. }
  55293. static certificates(attrs) {
  55294. return new Certificates(attrs);
  55295. }
  55296. static checkButton(attrs) {
  55297. return new CheckButton(attrs);
  55298. }
  55299. static choiceList(attrs) {
  55300. return new ChoiceList(attrs);
  55301. }
  55302. static color(attrs) {
  55303. return new Color(attrs);
  55304. }
  55305. static comb(attrs) {
  55306. return new Comb(attrs);
  55307. }
  55308. static connect(attrs) {
  55309. return new Connect(attrs);
  55310. }
  55311. static contentArea(attrs) {
  55312. return new ContentArea(attrs);
  55313. }
  55314. static corner(attrs) {
  55315. return new Corner(attrs);
  55316. }
  55317. static date(attrs) {
  55318. return new DateElement(attrs);
  55319. }
  55320. static dateTime(attrs) {
  55321. return new DateTime(attrs);
  55322. }
  55323. static dateTimeEdit(attrs) {
  55324. return new DateTimeEdit(attrs);
  55325. }
  55326. static decimal(attrs) {
  55327. return new Decimal(attrs);
  55328. }
  55329. static defaultUi(attrs) {
  55330. return new DefaultUi(attrs);
  55331. }
  55332. static desc(attrs) {
  55333. return new Desc(attrs);
  55334. }
  55335. static digestMethod(attrs) {
  55336. return new DigestMethod(attrs);
  55337. }
  55338. static digestMethods(attrs) {
  55339. return new DigestMethods(attrs);
  55340. }
  55341. static draw(attrs) {
  55342. return new Draw(attrs);
  55343. }
  55344. static edge(attrs) {
  55345. return new Edge(attrs);
  55346. }
  55347. static encoding(attrs) {
  55348. return new Encoding(attrs);
  55349. }
  55350. static encodings(attrs) {
  55351. return new Encodings(attrs);
  55352. }
  55353. static encrypt(attrs) {
  55354. return new Encrypt(attrs);
  55355. }
  55356. static encryptData(attrs) {
  55357. return new EncryptData(attrs);
  55358. }
  55359. static encryption(attrs) {
  55360. return new Encryption(attrs);
  55361. }
  55362. static encryptionMethod(attrs) {
  55363. return new EncryptionMethod(attrs);
  55364. }
  55365. static encryptionMethods(attrs) {
  55366. return new EncryptionMethods(attrs);
  55367. }
  55368. static event(attrs) {
  55369. return new Event(attrs);
  55370. }
  55371. static exData(attrs) {
  55372. return new ExData(attrs);
  55373. }
  55374. static exObject(attrs) {
  55375. return new ExObject(attrs);
  55376. }
  55377. static exclGroup(attrs) {
  55378. return new ExclGroup(attrs);
  55379. }
  55380. static execute(attrs) {
  55381. return new Execute(attrs);
  55382. }
  55383. static extras(attrs) {
  55384. return new Extras(attrs);
  55385. }
  55386. static field(attrs) {
  55387. return new Field(attrs);
  55388. }
  55389. static fill(attrs) {
  55390. return new Fill(attrs);
  55391. }
  55392. static filter(attrs) {
  55393. return new Filter(attrs);
  55394. }
  55395. static float(attrs) {
  55396. return new Float(attrs);
  55397. }
  55398. static font(attrs) {
  55399. return new Font(attrs);
  55400. }
  55401. static format(attrs) {
  55402. return new Format(attrs);
  55403. }
  55404. static handler(attrs) {
  55405. return new Handler(attrs);
  55406. }
  55407. static hyphenation(attrs) {
  55408. return new Hyphenation(attrs);
  55409. }
  55410. static image(attrs) {
  55411. return new Image(attrs);
  55412. }
  55413. static imageEdit(attrs) {
  55414. return new ImageEdit(attrs);
  55415. }
  55416. static integer(attrs) {
  55417. return new Integer(attrs);
  55418. }
  55419. static issuers(attrs) {
  55420. return new Issuers(attrs);
  55421. }
  55422. static items(attrs) {
  55423. return new Items(attrs);
  55424. }
  55425. static keep(attrs) {
  55426. return new Keep(attrs);
  55427. }
  55428. static keyUsage(attrs) {
  55429. return new KeyUsage(attrs);
  55430. }
  55431. static line(attrs) {
  55432. return new Line(attrs);
  55433. }
  55434. static linear(attrs) {
  55435. return new Linear(attrs);
  55436. }
  55437. static lockDocument(attrs) {
  55438. return new LockDocument(attrs);
  55439. }
  55440. static manifest(attrs) {
  55441. return new Manifest(attrs);
  55442. }
  55443. static margin(attrs) {
  55444. return new Margin(attrs);
  55445. }
  55446. static mdp(attrs) {
  55447. return new Mdp(attrs);
  55448. }
  55449. static medium(attrs) {
  55450. return new Medium(attrs);
  55451. }
  55452. static message(attrs) {
  55453. return new Message(attrs);
  55454. }
  55455. static numericEdit(attrs) {
  55456. return new NumericEdit(attrs);
  55457. }
  55458. static occur(attrs) {
  55459. return new Occur(attrs);
  55460. }
  55461. static oid(attrs) {
  55462. return new Oid(attrs);
  55463. }
  55464. static oids(attrs) {
  55465. return new Oids(attrs);
  55466. }
  55467. static overflow(attrs) {
  55468. return new Overflow(attrs);
  55469. }
  55470. static pageArea(attrs) {
  55471. return new PageArea(attrs);
  55472. }
  55473. static pageSet(attrs) {
  55474. return new PageSet(attrs);
  55475. }
  55476. static para(attrs) {
  55477. return new Para(attrs);
  55478. }
  55479. static passwordEdit(attrs) {
  55480. return new PasswordEdit(attrs);
  55481. }
  55482. static pattern(attrs) {
  55483. return new Pattern(attrs);
  55484. }
  55485. static picture(attrs) {
  55486. return new Picture(attrs);
  55487. }
  55488. static proto(attrs) {
  55489. return new Proto(attrs);
  55490. }
  55491. static radial(attrs) {
  55492. return new Radial(attrs);
  55493. }
  55494. static reason(attrs) {
  55495. return new Reason(attrs);
  55496. }
  55497. static reasons(attrs) {
  55498. return new Reasons(attrs);
  55499. }
  55500. static rectangle(attrs) {
  55501. return new Rectangle(attrs);
  55502. }
  55503. static ref(attrs) {
  55504. return new RefElement(attrs);
  55505. }
  55506. static script(attrs) {
  55507. return new Script(attrs);
  55508. }
  55509. static setProperty(attrs) {
  55510. return new SetProperty(attrs);
  55511. }
  55512. static signData(attrs) {
  55513. return new SignData(attrs);
  55514. }
  55515. static signature(attrs) {
  55516. return new Signature(attrs);
  55517. }
  55518. static signing(attrs) {
  55519. return new Signing(attrs);
  55520. }
  55521. static solid(attrs) {
  55522. return new Solid(attrs);
  55523. }
  55524. static speak(attrs) {
  55525. return new Speak(attrs);
  55526. }
  55527. static stipple(attrs) {
  55528. return new Stipple(attrs);
  55529. }
  55530. static subform(attrs) {
  55531. return new Subform(attrs);
  55532. }
  55533. static subformSet(attrs) {
  55534. return new SubformSet(attrs);
  55535. }
  55536. static subjectDN(attrs) {
  55537. return new SubjectDN(attrs);
  55538. }
  55539. static subjectDNs(attrs) {
  55540. return new SubjectDNs(attrs);
  55541. }
  55542. static submit(attrs) {
  55543. return new Submit(attrs);
  55544. }
  55545. static template(attrs) {
  55546. return new Template(attrs);
  55547. }
  55548. static text(attrs) {
  55549. return new Text(attrs);
  55550. }
  55551. static textEdit(attrs) {
  55552. return new TextEdit(attrs);
  55553. }
  55554. static time(attrs) {
  55555. return new Time(attrs);
  55556. }
  55557. static timeStamp(attrs) {
  55558. return new TimeStamp(attrs);
  55559. }
  55560. static toolTip(attrs) {
  55561. return new ToolTip(attrs);
  55562. }
  55563. static traversal(attrs) {
  55564. return new Traversal(attrs);
  55565. }
  55566. static traverse(attrs) {
  55567. return new Traverse(attrs);
  55568. }
  55569. static ui(attrs) {
  55570. return new Ui(attrs);
  55571. }
  55572. static validate(attrs) {
  55573. return new Validate(attrs);
  55574. }
  55575. static value(attrs) {
  55576. return new Value(attrs);
  55577. }
  55578. static variables(attrs) {
  55579. return new Variables(attrs);
  55580. }
  55581. }
  55582. exports.TemplateNamespace = TemplateNamespace;
  55583. /***/ }),
  55584. /* 81 */
  55585. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55586. Object.defineProperty(exports, "__esModule", ({
  55587. value: true
  55588. }));
  55589. exports.addHTML = addHTML;
  55590. exports.checkDimensions = checkDimensions;
  55591. exports.flushHTML = flushHTML;
  55592. exports.getAvailableSpace = getAvailableSpace;
  55593. var _xfa_object = __w_pdfjs_require__(75);
  55594. var _html_utils = __w_pdfjs_require__(82);
  55595. function createLine(node, children) {
  55596. return {
  55597. name: "div",
  55598. attributes: {
  55599. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  55600. },
  55601. children
  55602. };
  55603. }
  55604. function flushHTML(node) {
  55605. if (!node[_xfa_object.$extra]) {
  55606. return null;
  55607. }
  55608. const attributes = node[_xfa_object.$extra].attributes;
  55609. const html = {
  55610. name: "div",
  55611. attributes,
  55612. children: node[_xfa_object.$extra].children
  55613. };
  55614. if (node[_xfa_object.$extra].failingNode) {
  55615. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  55616. if (htmlFromFailing) {
  55617. if (node.layout.endsWith("-tb")) {
  55618. html.children.push(createLine(node, [htmlFromFailing]));
  55619. } else {
  55620. html.children.push(htmlFromFailing);
  55621. }
  55622. }
  55623. }
  55624. if (html.children.length === 0) {
  55625. return null;
  55626. }
  55627. return html;
  55628. }
  55629. function addHTML(node, html, bbox) {
  55630. const extra = node[_xfa_object.$extra];
  55631. const availableSpace = extra.availableSpace;
  55632. const [x, y, w, h] = bbox;
  55633. switch (node.layout) {
  55634. case "position":
  55635. {
  55636. extra.width = Math.max(extra.width, x + w);
  55637. extra.height = Math.max(extra.height, y + h);
  55638. extra.children.push(html);
  55639. break;
  55640. }
  55641. case "lr-tb":
  55642. case "rl-tb":
  55643. if (!extra.line || extra.attempt === 1) {
  55644. extra.line = createLine(node, []);
  55645. extra.children.push(extra.line);
  55646. extra.numberInLine = 0;
  55647. }
  55648. extra.numberInLine += 1;
  55649. extra.line.children.push(html);
  55650. if (extra.attempt === 0) {
  55651. extra.currentWidth += w;
  55652. extra.height = Math.max(extra.height, extra.prevHeight + h);
  55653. } else {
  55654. extra.currentWidth = w;
  55655. extra.prevHeight = extra.height;
  55656. extra.height += h;
  55657. extra.attempt = 0;
  55658. }
  55659. extra.width = Math.max(extra.width, extra.currentWidth);
  55660. break;
  55661. case "rl-row":
  55662. case "row":
  55663. {
  55664. extra.children.push(html);
  55665. extra.width += w;
  55666. extra.height = Math.max(extra.height, h);
  55667. const height = (0, _html_utils.measureToString)(extra.height);
  55668. for (const child of extra.children) {
  55669. child.attributes.style.height = height;
  55670. }
  55671. break;
  55672. }
  55673. case "table":
  55674. {
  55675. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  55676. extra.height += h;
  55677. extra.children.push(html);
  55678. break;
  55679. }
  55680. case "tb":
  55681. {
  55682. extra.width = availableSpace.width;
  55683. extra.height += h;
  55684. extra.children.push(html);
  55685. break;
  55686. }
  55687. }
  55688. }
  55689. function getAvailableSpace(node) {
  55690. const availableSpace = node[_xfa_object.$extra].availableSpace;
  55691. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  55692. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  55693. switch (node.layout) {
  55694. case "lr-tb":
  55695. case "rl-tb":
  55696. if (node[_xfa_object.$extra].attempt === 0) {
  55697. return {
  55698. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  55699. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  55700. };
  55701. }
  55702. return {
  55703. width: availableSpace.width - marginH,
  55704. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  55705. };
  55706. case "rl-row":
  55707. case "row":
  55708. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  55709. return {
  55710. width,
  55711. height: availableSpace.height - marginH
  55712. };
  55713. case "table":
  55714. case "tb":
  55715. return {
  55716. width: availableSpace.width - marginH,
  55717. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  55718. };
  55719. case "position":
  55720. default:
  55721. return availableSpace;
  55722. }
  55723. }
  55724. function getTransformedBBox(node) {
  55725. let w = node.w === "" ? NaN : node.w;
  55726. let h = node.h === "" ? NaN : node.h;
  55727. let [centerX, centerY] = [0, 0];
  55728. switch (node.anchorType || "") {
  55729. case "bottomCenter":
  55730. [centerX, centerY] = [w / 2, h];
  55731. break;
  55732. case "bottomLeft":
  55733. [centerX, centerY] = [0, h];
  55734. break;
  55735. case "bottomRight":
  55736. [centerX, centerY] = [w, h];
  55737. break;
  55738. case "middleCenter":
  55739. [centerX, centerY] = [w / 2, h / 2];
  55740. break;
  55741. case "middleLeft":
  55742. [centerX, centerY] = [0, h / 2];
  55743. break;
  55744. case "middleRight":
  55745. [centerX, centerY] = [w, h / 2];
  55746. break;
  55747. case "topCenter":
  55748. [centerX, centerY] = [w / 2, 0];
  55749. break;
  55750. case "topRight":
  55751. [centerX, centerY] = [w, 0];
  55752. break;
  55753. }
  55754. let x, y;
  55755. switch (node.rotate || 0) {
  55756. case 0:
  55757. [x, y] = [-centerX, -centerY];
  55758. break;
  55759. case 90:
  55760. [x, y] = [-centerY, centerX];
  55761. [w, h] = [h, -w];
  55762. break;
  55763. case 180:
  55764. [x, y] = [centerX, centerY];
  55765. [w, h] = [-w, -h];
  55766. break;
  55767. case 270:
  55768. [x, y] = [centerY, -centerX];
  55769. [w, h] = [-h, w];
  55770. break;
  55771. }
  55772. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  55773. }
  55774. function checkDimensions(node, space) {
  55775. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  55776. return true;
  55777. }
  55778. if (node.w === 0 || node.h === 0) {
  55779. return true;
  55780. }
  55781. const ERROR = 2;
  55782. const parent = node[_xfa_object.$getSubformParent]();
  55783. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  55784. const [, y, w, h] = getTransformedBBox(node);
  55785. switch (parent.layout) {
  55786. case "lr-tb":
  55787. case "rl-tb":
  55788. if (attempt === 0) {
  55789. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55790. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  55791. return false;
  55792. }
  55793. if (node.w !== "") {
  55794. if (Math.round(w - space.width) <= ERROR) {
  55795. return true;
  55796. }
  55797. if (parent[_xfa_object.$extra].numberInLine === 0) {
  55798. return space.height > 0;
  55799. }
  55800. return false;
  55801. }
  55802. return space.width > 0;
  55803. }
  55804. if (node.w !== "") {
  55805. return Math.round(w - space.width) <= ERROR;
  55806. }
  55807. return space.width > 0;
  55808. }
  55809. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55810. return true;
  55811. }
  55812. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  55813. return false;
  55814. }
  55815. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  55816. return space.height > 0;
  55817. }
  55818. if (parent[_xfa_object.$isThereMoreWidth]()) {
  55819. return false;
  55820. }
  55821. return space.height > 0;
  55822. case "table":
  55823. case "tb":
  55824. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55825. return true;
  55826. }
  55827. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  55828. return Math.round(h - space.height) <= ERROR;
  55829. }
  55830. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  55831. return space.height > 0;
  55832. }
  55833. if (parent[_xfa_object.$isThereMoreWidth]()) {
  55834. return false;
  55835. }
  55836. return space.height > 0;
  55837. case "position":
  55838. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55839. return true;
  55840. }
  55841. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  55842. return true;
  55843. }
  55844. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  55845. return h + y > area.h;
  55846. case "rl-row":
  55847. case "row":
  55848. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55849. return true;
  55850. }
  55851. if (node.h !== "") {
  55852. return Math.round(h - space.height) <= ERROR;
  55853. }
  55854. return true;
  55855. default:
  55856. return true;
  55857. }
  55858. }
  55859. /***/ }),
  55860. /* 82 */
  55861. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55862. Object.defineProperty(exports, "__esModule", ({
  55863. value: true
  55864. }));
  55865. exports.computeBbox = computeBbox;
  55866. exports.createWrapper = createWrapper;
  55867. exports.fixDimensions = fixDimensions;
  55868. exports.fixTextIndent = fixTextIndent;
  55869. exports.isPrintOnly = isPrintOnly;
  55870. exports.layoutClass = layoutClass;
  55871. exports.layoutNode = layoutNode;
  55872. exports.measureToString = measureToString;
  55873. exports.setAccess = setAccess;
  55874. exports.setFontFamily = setFontFamily;
  55875. exports.setMinMaxDimensions = setMinMaxDimensions;
  55876. exports.setPara = setPara;
  55877. exports.toStyle = toStyle;
  55878. var _xfa_object = __w_pdfjs_require__(75);
  55879. var _utils = __w_pdfjs_require__(76);
  55880. var _fonts = __w_pdfjs_require__(83);
  55881. var _text = __w_pdfjs_require__(84);
  55882. var _util = __w_pdfjs_require__(2);
  55883. function measureToString(m) {
  55884. if (typeof m === "string") {
  55885. return "0px";
  55886. }
  55887. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  55888. }
  55889. const converters = {
  55890. anchorType(node, style) {
  55891. const parent = node[_xfa_object.$getSubformParent]();
  55892. if (!parent || parent.layout && parent.layout !== "position") {
  55893. return;
  55894. }
  55895. if (!("transform" in style)) {
  55896. style.transform = "";
  55897. }
  55898. switch (node.anchorType) {
  55899. case "bottomCenter":
  55900. style.transform += "translate(-50%, -100%)";
  55901. break;
  55902. case "bottomLeft":
  55903. style.transform += "translate(0,-100%)";
  55904. break;
  55905. case "bottomRight":
  55906. style.transform += "translate(-100%,-100%)";
  55907. break;
  55908. case "middleCenter":
  55909. style.transform += "translate(-50%,-50%)";
  55910. break;
  55911. case "middleLeft":
  55912. style.transform += "translate(0,-50%)";
  55913. break;
  55914. case "middleRight":
  55915. style.transform += "translate(-100%,-50%)";
  55916. break;
  55917. case "topCenter":
  55918. style.transform += "translate(-50%,0)";
  55919. break;
  55920. case "topRight":
  55921. style.transform += "translate(-100%,0)";
  55922. break;
  55923. }
  55924. },
  55925. dimensions(node, style) {
  55926. const parent = node[_xfa_object.$getSubformParent]();
  55927. let width = node.w;
  55928. const height = node.h;
  55929. if (parent.layout && parent.layout.includes("row")) {
  55930. const extra = parent[_xfa_object.$extra];
  55931. const colSpan = node.colSpan;
  55932. let w;
  55933. if (colSpan === -1) {
  55934. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  55935. extra.currentColumn = 0;
  55936. } else {
  55937. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  55938. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  55939. }
  55940. if (!isNaN(w)) {
  55941. width = node.w = w;
  55942. }
  55943. }
  55944. if (width !== "") {
  55945. style.width = measureToString(width);
  55946. } else {
  55947. style.width = "auto";
  55948. }
  55949. if (height !== "") {
  55950. style.height = measureToString(height);
  55951. } else {
  55952. style.height = "auto";
  55953. }
  55954. },
  55955. position(node, style) {
  55956. const parent = node[_xfa_object.$getSubformParent]();
  55957. if (parent && parent.layout && parent.layout !== "position") {
  55958. return;
  55959. }
  55960. style.position = "absolute";
  55961. style.left = measureToString(node.x);
  55962. style.top = measureToString(node.y);
  55963. },
  55964. rotate(node, style) {
  55965. if (node.rotate) {
  55966. if (!("transform" in style)) {
  55967. style.transform = "";
  55968. }
  55969. style.transform += `rotate(-${node.rotate}deg)`;
  55970. style.transformOrigin = "top left";
  55971. }
  55972. },
  55973. presence(node, style) {
  55974. switch (node.presence) {
  55975. case "invisible":
  55976. style.visibility = "hidden";
  55977. break;
  55978. case "hidden":
  55979. case "inactive":
  55980. style.display = "none";
  55981. break;
  55982. }
  55983. },
  55984. hAlign(node, style) {
  55985. if (node[_xfa_object.$nodeName] === "para") {
  55986. switch (node.hAlign) {
  55987. case "justifyAll":
  55988. style.textAlign = "justify-all";
  55989. break;
  55990. case "radix":
  55991. style.textAlign = "left";
  55992. break;
  55993. default:
  55994. style.textAlign = node.hAlign;
  55995. }
  55996. } else {
  55997. switch (node.hAlign) {
  55998. case "left":
  55999. style.alignSelf = "start";
  56000. break;
  56001. case "center":
  56002. style.alignSelf = "center";
  56003. break;
  56004. case "right":
  56005. style.alignSelf = "end";
  56006. break;
  56007. }
  56008. }
  56009. },
  56010. margin(node, style) {
  56011. if (node.margin) {
  56012. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  56013. }
  56014. }
  56015. };
  56016. function setMinMaxDimensions(node, style) {
  56017. const parent = node[_xfa_object.$getSubformParent]();
  56018. if (parent.layout === "position") {
  56019. if (node.minW > 0) {
  56020. style.minWidth = measureToString(node.minW);
  56021. }
  56022. if (node.maxW > 0) {
  56023. style.maxWidth = measureToString(node.maxW);
  56024. }
  56025. if (node.minH > 0) {
  56026. style.minHeight = measureToString(node.minH);
  56027. }
  56028. if (node.maxH > 0) {
  56029. style.maxHeight = measureToString(node.maxH);
  56030. }
  56031. }
  56032. }
  56033. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  56034. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  56035. if (typeof text === "string") {
  56036. measure.addString(text);
  56037. } else {
  56038. text[_xfa_object.$pushGlyphs](measure);
  56039. }
  56040. return measure.compute(width);
  56041. }
  56042. function layoutNode(node, availableSpace) {
  56043. let height = null;
  56044. let width = null;
  56045. let isBroken = false;
  56046. if ((!node.w || !node.h) && node.value) {
  56047. let marginH = 0;
  56048. let marginV = 0;
  56049. if (node.margin) {
  56050. marginH = node.margin.leftInset + node.margin.rightInset;
  56051. marginV = node.margin.topInset + node.margin.bottomInset;
  56052. }
  56053. let lineHeight = null;
  56054. let margin = null;
  56055. if (node.para) {
  56056. margin = Object.create(null);
  56057. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  56058. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  56059. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  56060. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  56061. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  56062. }
  56063. let font = node.font;
  56064. if (!font) {
  56065. const root = node[_xfa_object.$getTemplateRoot]();
  56066. let parent = node[_xfa_object.$getParent]();
  56067. while (parent !== root) {
  56068. if (parent.font) {
  56069. font = parent.font;
  56070. break;
  56071. }
  56072. parent = parent[_xfa_object.$getParent]();
  56073. }
  56074. }
  56075. const maxWidth = !node.w ? availableSpace.width : node.w;
  56076. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  56077. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  56078. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  56079. width = res.width;
  56080. height = res.height;
  56081. isBroken = res.isBroken;
  56082. } else {
  56083. const text = node.value[_xfa_object.$text]();
  56084. if (text) {
  56085. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  56086. width = res.width;
  56087. height = res.height;
  56088. isBroken = res.isBroken;
  56089. }
  56090. }
  56091. if (width !== null && !node.w) {
  56092. width += marginH;
  56093. }
  56094. if (height !== null && !node.h) {
  56095. height += marginV;
  56096. }
  56097. }
  56098. return {
  56099. w: width,
  56100. h: height,
  56101. isBroken
  56102. };
  56103. }
  56104. function computeBbox(node, html, availableSpace) {
  56105. let bbox;
  56106. if (node.w !== "" && node.h !== "") {
  56107. bbox = [node.x, node.y, node.w, node.h];
  56108. } else {
  56109. if (!availableSpace) {
  56110. return null;
  56111. }
  56112. let width = node.w;
  56113. if (width === "") {
  56114. if (node.maxW === 0) {
  56115. const parent = node[_xfa_object.$getSubformParent]();
  56116. if (parent.layout === "position" && parent.w !== "") {
  56117. width = 0;
  56118. } else {
  56119. width = node.minW;
  56120. }
  56121. } else {
  56122. width = Math.min(node.maxW, availableSpace.width);
  56123. }
  56124. html.attributes.style.width = measureToString(width);
  56125. }
  56126. let height = node.h;
  56127. if (height === "") {
  56128. if (node.maxH === 0) {
  56129. const parent = node[_xfa_object.$getSubformParent]();
  56130. if (parent.layout === "position" && parent.h !== "") {
  56131. height = 0;
  56132. } else {
  56133. height = node.minH;
  56134. }
  56135. } else {
  56136. height = Math.min(node.maxH, availableSpace.height);
  56137. }
  56138. html.attributes.style.height = measureToString(height);
  56139. }
  56140. bbox = [node.x, node.y, width, height];
  56141. }
  56142. return bbox;
  56143. }
  56144. function fixDimensions(node) {
  56145. const parent = node[_xfa_object.$getSubformParent]();
  56146. if (parent.layout && parent.layout.includes("row")) {
  56147. const extra = parent[_xfa_object.$extra];
  56148. const colSpan = node.colSpan;
  56149. let width;
  56150. if (colSpan === -1) {
  56151. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  56152. } else {
  56153. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  56154. }
  56155. if (!isNaN(width)) {
  56156. node.w = width;
  56157. }
  56158. }
  56159. if (parent.layout && parent.layout !== "position") {
  56160. node.x = node.y = 0;
  56161. }
  56162. if (node.layout === "table") {
  56163. if (node.w === "" && Array.isArray(node.columnWidths)) {
  56164. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  56165. }
  56166. }
  56167. }
  56168. function layoutClass(node) {
  56169. switch (node.layout) {
  56170. case "position":
  56171. return "xfaPosition";
  56172. case "lr-tb":
  56173. return "xfaLrTb";
  56174. case "rl-row":
  56175. return "xfaRlRow";
  56176. case "rl-tb":
  56177. return "xfaRlTb";
  56178. case "row":
  56179. return "xfaRow";
  56180. case "table":
  56181. return "xfaTable";
  56182. case "tb":
  56183. return "xfaTb";
  56184. default:
  56185. return "xfaPosition";
  56186. }
  56187. }
  56188. function toStyle(node, ...names) {
  56189. const style = Object.create(null);
  56190. for (const name of names) {
  56191. const value = node[name];
  56192. if (value === null) {
  56193. continue;
  56194. }
  56195. if (converters.hasOwnProperty(name)) {
  56196. converters[name](node, style);
  56197. continue;
  56198. }
  56199. if (value instanceof _xfa_object.XFAObject) {
  56200. const newStyle = value[_xfa_object.$toStyle]();
  56201. if (newStyle) {
  56202. Object.assign(style, newStyle);
  56203. } else {
  56204. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  56205. }
  56206. }
  56207. }
  56208. return style;
  56209. }
  56210. function createWrapper(node, html) {
  56211. const {
  56212. attributes
  56213. } = html;
  56214. const {
  56215. style
  56216. } = attributes;
  56217. const wrapper = {
  56218. name: "div",
  56219. attributes: {
  56220. class: ["xfaWrapper"],
  56221. style: Object.create(null)
  56222. },
  56223. children: []
  56224. };
  56225. attributes.class.push("xfaWrapped");
  56226. if (node.border) {
  56227. const {
  56228. widths,
  56229. insets
  56230. } = node.border[_xfa_object.$extra];
  56231. let width, height;
  56232. let top = insets[0];
  56233. let left = insets[3];
  56234. const insetsH = insets[0] + insets[2];
  56235. const insetsW = insets[1] + insets[3];
  56236. switch (node.border.hand) {
  56237. case "even":
  56238. top -= widths[0] / 2;
  56239. left -= widths[3] / 2;
  56240. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  56241. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  56242. break;
  56243. case "left":
  56244. top -= widths[0];
  56245. left -= widths[3];
  56246. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  56247. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  56248. break;
  56249. case "right":
  56250. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  56251. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  56252. break;
  56253. }
  56254. const classNames = ["xfaBorder"];
  56255. if (isPrintOnly(node.border)) {
  56256. classNames.push("xfaPrintOnly");
  56257. }
  56258. const border = {
  56259. name: "div",
  56260. attributes: {
  56261. class: classNames,
  56262. style: {
  56263. top: `${top}px`,
  56264. left: `${left}px`,
  56265. width,
  56266. height
  56267. }
  56268. },
  56269. children: []
  56270. };
  56271. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  56272. if (style[key] !== undefined) {
  56273. border.attributes.style[key] = style[key];
  56274. delete style[key];
  56275. }
  56276. }
  56277. wrapper.children.push(border, html);
  56278. } else {
  56279. wrapper.children.push(html);
  56280. }
  56281. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  56282. if (style[key] !== undefined) {
  56283. wrapper.attributes.style[key] = style[key];
  56284. delete style[key];
  56285. }
  56286. }
  56287. if (style.position === "absolute") {
  56288. wrapper.attributes.style.position = "absolute";
  56289. } else {
  56290. wrapper.attributes.style.position = "relative";
  56291. }
  56292. delete style.position;
  56293. if (style.alignSelf) {
  56294. wrapper.attributes.style.alignSelf = style.alignSelf;
  56295. delete style.alignSelf;
  56296. }
  56297. return wrapper;
  56298. }
  56299. function fixTextIndent(styles) {
  56300. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  56301. if (indent >= 0) {
  56302. return;
  56303. }
  56304. const align = styles.textAlign === "right" ? "right" : "left";
  56305. const name = "padding" + (align === "left" ? "Left" : "Right");
  56306. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  56307. styles[name] = `${padding - indent}px`;
  56308. }
  56309. function setAccess(node, classNames) {
  56310. switch (node.access) {
  56311. case "nonInteractive":
  56312. classNames.push("xfaNonInteractive");
  56313. break;
  56314. case "readOnly":
  56315. classNames.push("xfaReadOnly");
  56316. break;
  56317. case "protected":
  56318. classNames.push("xfaDisabled");
  56319. break;
  56320. }
  56321. }
  56322. function isPrintOnly(node) {
  56323. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  56324. }
  56325. function setPara(node, nodeStyle, value) {
  56326. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  56327. if (nodeStyle) {
  56328. if (node.h === "") {
  56329. nodeStyle.height = "auto";
  56330. }
  56331. if (node.w === "") {
  56332. nodeStyle.width = "auto";
  56333. }
  56334. }
  56335. if (node.para) {
  56336. const valueStyle = value.attributes.style;
  56337. valueStyle.display = "flex";
  56338. valueStyle.flexDirection = "column";
  56339. switch (node.para.vAlign) {
  56340. case "top":
  56341. valueStyle.justifyContent = "start";
  56342. break;
  56343. case "bottom":
  56344. valueStyle.justifyContent = "end";
  56345. break;
  56346. case "middle":
  56347. valueStyle.justifyContent = "center";
  56348. break;
  56349. }
  56350. const paraStyle = node.para[_xfa_object.$toStyle]();
  56351. for (const [key, val] of Object.entries(paraStyle)) {
  56352. if (!(key in valueStyle)) {
  56353. valueStyle[key] = val;
  56354. }
  56355. }
  56356. }
  56357. }
  56358. }
  56359. function setFontFamily(xfaFont, fontFinder, style) {
  56360. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  56361. const typeface = fontFinder.find(name);
  56362. style.fontFamily = `"${name}"`;
  56363. if (typeface) {
  56364. const {
  56365. fontFamily
  56366. } = typeface.regular.cssFontInfo;
  56367. if (fontFamily !== name) {
  56368. style.fontFamily = `"${fontFamily}"`;
  56369. }
  56370. if (style.lineHeight) {
  56371. return;
  56372. }
  56373. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  56374. if (pdfFont && pdfFont.lineHeight > 0) {
  56375. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  56376. } else {
  56377. style.lineHeight = 1.2;
  56378. }
  56379. }
  56380. }
  56381. /***/ }),
  56382. /* 83 */
  56383. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56384. Object.defineProperty(exports, "__esModule", ({
  56385. value: true
  56386. }));
  56387. exports.selectFont = selectFont;
  56388. exports.FontFinder = void 0;
  56389. var _util = __w_pdfjs_require__(2);
  56390. class FontFinder {
  56391. constructor(pdfFonts) {
  56392. this.fonts = new Map();
  56393. this.cache = new Map();
  56394. this.warned = new Set();
  56395. this.defaultFont = null;
  56396. this.add(pdfFonts);
  56397. }
  56398. add(pdfFonts, reallyMissingFonts = null) {
  56399. for (const pdfFont of pdfFonts) {
  56400. this.addPdfFont(pdfFont);
  56401. }
  56402. for (const pdfFont of this.fonts.values()) {
  56403. if (!pdfFont.regular) {
  56404. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  56405. }
  56406. }
  56407. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  56408. return;
  56409. }
  56410. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  56411. for (const missing of reallyMissingFonts) {
  56412. this.fonts.set(missing, myriad);
  56413. }
  56414. }
  56415. addPdfFont(pdfFont) {
  56416. const cssFontInfo = pdfFont.cssFontInfo;
  56417. const name = cssFontInfo.fontFamily;
  56418. let font = this.fonts.get(name);
  56419. if (!font) {
  56420. font = Object.create(null);
  56421. this.fonts.set(name, font);
  56422. if (!this.defaultFont) {
  56423. this.defaultFont = font;
  56424. }
  56425. }
  56426. let property = "";
  56427. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  56428. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  56429. property = fontWeight >= 700 ? "bolditalic" : "italic";
  56430. } else if (fontWeight >= 700) {
  56431. property = "bold";
  56432. }
  56433. if (!property) {
  56434. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  56435. property = "bold";
  56436. }
  56437. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  56438. property += "italic";
  56439. }
  56440. }
  56441. if (!property) {
  56442. property = "regular";
  56443. }
  56444. font[property] = pdfFont;
  56445. }
  56446. getDefault() {
  56447. return this.defaultFont;
  56448. }
  56449. find(fontName, mustWarn = true) {
  56450. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  56451. if (font) {
  56452. return font;
  56453. }
  56454. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  56455. let name = fontName.replace(pattern, "");
  56456. font = this.fonts.get(name);
  56457. if (font) {
  56458. this.cache.set(fontName, font);
  56459. return font;
  56460. }
  56461. name = name.toLowerCase();
  56462. const maybe = [];
  56463. for (const [family, pdfFont] of this.fonts.entries()) {
  56464. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  56465. maybe.push(pdfFont);
  56466. }
  56467. }
  56468. if (maybe.length === 0) {
  56469. for (const [, pdfFont] of this.fonts.entries()) {
  56470. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  56471. maybe.push(pdfFont);
  56472. }
  56473. }
  56474. }
  56475. if (maybe.length === 0) {
  56476. name = name.replace(/psmt|mt/gi, "");
  56477. for (const [family, pdfFont] of this.fonts.entries()) {
  56478. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  56479. maybe.push(pdfFont);
  56480. }
  56481. }
  56482. }
  56483. if (maybe.length === 0) {
  56484. for (const pdfFont of this.fonts.values()) {
  56485. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  56486. maybe.push(pdfFont);
  56487. }
  56488. }
  56489. }
  56490. if (maybe.length >= 1) {
  56491. if (maybe.length !== 1 && mustWarn) {
  56492. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  56493. }
  56494. this.cache.set(fontName, maybe[0]);
  56495. return maybe[0];
  56496. }
  56497. if (mustWarn && !this.warned.has(fontName)) {
  56498. this.warned.add(fontName);
  56499. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  56500. }
  56501. return null;
  56502. }
  56503. }
  56504. exports.FontFinder = FontFinder;
  56505. function selectFont(xfaFont, typeface) {
  56506. if (xfaFont.posture === "italic") {
  56507. if (xfaFont.weight === "bold") {
  56508. return typeface.bolditalic;
  56509. }
  56510. return typeface.italic;
  56511. } else if (xfaFont.weight === "bold") {
  56512. return typeface.bold;
  56513. }
  56514. return typeface.regular;
  56515. }
  56516. /***/ }),
  56517. /* 84 */
  56518. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56519. Object.defineProperty(exports, "__esModule", ({
  56520. value: true
  56521. }));
  56522. exports.TextMeasure = void 0;
  56523. var _fonts = __w_pdfjs_require__(83);
  56524. const WIDTH_FACTOR = 1.01;
  56525. class FontInfo {
  56526. constructor(xfaFont, margin, lineHeight, fontFinder) {
  56527. this.lineHeight = lineHeight;
  56528. this.paraMargin = margin || {
  56529. top: 0,
  56530. bottom: 0,
  56531. left: 0,
  56532. right: 0
  56533. };
  56534. if (!xfaFont) {
  56535. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  56536. return;
  56537. }
  56538. this.xfaFont = {
  56539. typeface: xfaFont.typeface,
  56540. posture: xfaFont.posture,
  56541. weight: xfaFont.weight,
  56542. size: xfaFont.size,
  56543. letterSpacing: xfaFont.letterSpacing
  56544. };
  56545. const typeface = fontFinder.find(xfaFont.typeface);
  56546. if (!typeface) {
  56547. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  56548. return;
  56549. }
  56550. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  56551. if (!this.pdfFont) {
  56552. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  56553. }
  56554. }
  56555. defaultFont(fontFinder) {
  56556. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  56557. if (font && font.regular) {
  56558. const pdfFont = font.regular;
  56559. const info = pdfFont.cssFontInfo;
  56560. const xfaFont = {
  56561. typeface: info.fontFamily,
  56562. posture: "normal",
  56563. weight: "normal",
  56564. size: 10,
  56565. letterSpacing: 0
  56566. };
  56567. return [pdfFont, xfaFont];
  56568. }
  56569. const xfaFont = {
  56570. typeface: "Courier",
  56571. posture: "normal",
  56572. weight: "normal",
  56573. size: 10,
  56574. letterSpacing: 0
  56575. };
  56576. return [null, xfaFont];
  56577. }
  56578. }
  56579. class FontSelector {
  56580. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  56581. this.fontFinder = fontFinder;
  56582. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  56583. }
  56584. pushData(xfaFont, margin, lineHeight) {
  56585. const lastFont = this.stack[this.stack.length - 1];
  56586. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  56587. if (!xfaFont[name]) {
  56588. xfaFont[name] = lastFont.xfaFont[name];
  56589. }
  56590. }
  56591. for (const name of ["top", "bottom", "left", "right"]) {
  56592. if (isNaN(margin[name])) {
  56593. margin[name] = lastFont.paraMargin[name];
  56594. }
  56595. }
  56596. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  56597. if (!fontInfo.pdfFont) {
  56598. fontInfo.pdfFont = lastFont.pdfFont;
  56599. }
  56600. this.stack.push(fontInfo);
  56601. }
  56602. popFont() {
  56603. this.stack.pop();
  56604. }
  56605. topFont() {
  56606. return this.stack[this.stack.length - 1];
  56607. }
  56608. }
  56609. class TextMeasure {
  56610. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  56611. this.glyphs = [];
  56612. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  56613. this.extraHeight = 0;
  56614. }
  56615. pushData(xfaFont, margin, lineHeight) {
  56616. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  56617. }
  56618. popFont(xfaFont) {
  56619. return this.fontSelector.popFont();
  56620. }
  56621. addPara() {
  56622. const lastFont = this.fontSelector.topFont();
  56623. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  56624. }
  56625. addString(str) {
  56626. if (!str) {
  56627. return;
  56628. }
  56629. const lastFont = this.fontSelector.topFont();
  56630. const fontSize = lastFont.xfaFont.size;
  56631. if (lastFont.pdfFont) {
  56632. const letterSpacing = lastFont.xfaFont.letterSpacing;
  56633. const pdfFont = lastFont.pdfFont;
  56634. const lineHeight = lastFont.lineHeight || Math.ceil(Math.max(1.2, pdfFont.lineHeight) * fontSize);
  56635. const scale = fontSize / 1000;
  56636. for (const line of str.split(/[\u2029\n]/)) {
  56637. const encodedLine = pdfFont.encodeString(line).join("");
  56638. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  56639. for (const glyph of glyphs) {
  56640. this.glyphs.push([glyph.width * scale + letterSpacing, lineHeight, glyph.unicode === " ", false]);
  56641. }
  56642. this.glyphs.push([0, 0, false, true]);
  56643. }
  56644. this.glyphs.pop();
  56645. return;
  56646. }
  56647. for (const line of str.split(/[\u2029\n]/)) {
  56648. for (const char of line.split("")) {
  56649. this.glyphs.push([fontSize, fontSize, char === " ", false]);
  56650. }
  56651. this.glyphs.push([0, 0, false, true]);
  56652. }
  56653. this.glyphs.pop();
  56654. }
  56655. compute(maxWidth) {
  56656. let lastSpacePos = -1,
  56657. lastSpaceWidth = 0,
  56658. width = 0,
  56659. height = 0,
  56660. currentLineWidth = 0,
  56661. currentLineHeight = 0;
  56662. let isBroken = false;
  56663. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  56664. const [glyphWidth, glyphHeight, isSpace, isEOL] = this.glyphs[i];
  56665. if (isEOL) {
  56666. width = Math.max(width, currentLineWidth);
  56667. currentLineWidth = 0;
  56668. height += currentLineHeight;
  56669. currentLineHeight = glyphHeight;
  56670. lastSpacePos = -1;
  56671. lastSpaceWidth = 0;
  56672. continue;
  56673. }
  56674. if (isSpace) {
  56675. if (currentLineWidth + glyphWidth > maxWidth) {
  56676. width = Math.max(width, currentLineWidth);
  56677. currentLineWidth = 0;
  56678. height += currentLineHeight;
  56679. currentLineHeight = glyphHeight;
  56680. lastSpacePos = -1;
  56681. lastSpaceWidth = 0;
  56682. isBroken = true;
  56683. } else {
  56684. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  56685. lastSpaceWidth = currentLineWidth;
  56686. currentLineWidth += glyphWidth;
  56687. lastSpacePos = i;
  56688. }
  56689. continue;
  56690. }
  56691. if (currentLineWidth + glyphWidth > maxWidth) {
  56692. height += currentLineHeight;
  56693. currentLineHeight = glyphHeight;
  56694. if (lastSpacePos !== -1) {
  56695. i = lastSpacePos;
  56696. width = Math.max(width, lastSpaceWidth);
  56697. currentLineWidth = 0;
  56698. lastSpacePos = -1;
  56699. lastSpaceWidth = 0;
  56700. } else {
  56701. width = Math.max(width, currentLineWidth);
  56702. currentLineWidth = glyphWidth;
  56703. }
  56704. isBroken = true;
  56705. continue;
  56706. }
  56707. currentLineWidth += glyphWidth;
  56708. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  56709. }
  56710. width = Math.max(width, currentLineWidth);
  56711. height += currentLineHeight + this.extraHeight;
  56712. return {
  56713. width: WIDTH_FACTOR * width,
  56714. height,
  56715. isBroken
  56716. };
  56717. }
  56718. }
  56719. exports.TextMeasure = TextMeasure;
  56720. /***/ }),
  56721. /* 85 */
  56722. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56723. Object.defineProperty(exports, "__esModule", ({
  56724. value: true
  56725. }));
  56726. exports.DataHandler = void 0;
  56727. var _xfa_object = __w_pdfjs_require__(75);
  56728. class DataHandler {
  56729. constructor(root, data) {
  56730. this.data = data;
  56731. this.dataset = root.datasets || null;
  56732. }
  56733. serialize(storage) {
  56734. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  56735. while (stack.length > 0) {
  56736. const last = stack[stack.length - 1];
  56737. const [i, children] = last;
  56738. if (i + 1 === children.length) {
  56739. stack.pop();
  56740. continue;
  56741. }
  56742. const child = children[++last[0]];
  56743. const storageEntry = storage.get(child[_xfa_object.$uid]);
  56744. if (storageEntry) {
  56745. child[_xfa_object.$setValue](storageEntry);
  56746. } else {
  56747. const attributes = child[_xfa_object.$getAttributes]();
  56748. for (const value of attributes.values()) {
  56749. const entry = storage.get(value[_xfa_object.$uid]);
  56750. if (entry) {
  56751. value[_xfa_object.$setValue](entry);
  56752. break;
  56753. }
  56754. }
  56755. }
  56756. const nodes = child[_xfa_object.$getChildren]();
  56757. if (nodes.length > 0) {
  56758. stack.push([-1, nodes]);
  56759. }
  56760. }
  56761. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  56762. if (this.dataset) {
  56763. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  56764. if (child[_xfa_object.$nodeName] !== "data") {
  56765. child[_xfa_object.$toString](buf);
  56766. }
  56767. }
  56768. }
  56769. this.data[_xfa_object.$toString](buf);
  56770. buf.push("</xfa:datasets>");
  56771. return buf.join("");
  56772. }
  56773. }
  56774. exports.DataHandler = DataHandler;
  56775. /***/ }),
  56776. /* 86 */
  56777. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56778. Object.defineProperty(exports, "__esModule", ({
  56779. value: true
  56780. }));
  56781. exports.XFAParser = void 0;
  56782. var _xfa_object = __w_pdfjs_require__(75);
  56783. var _xml_parser = __w_pdfjs_require__(68);
  56784. var _builder = __w_pdfjs_require__(87);
  56785. var _util = __w_pdfjs_require__(2);
  56786. class XFAParser extends _xml_parser.XMLParserBase {
  56787. constructor() {
  56788. super();
  56789. this._builder = new _builder.Builder();
  56790. this._stack = [];
  56791. this._globalData = {
  56792. usedTypefaces: new Set()
  56793. };
  56794. this._ids = new Map();
  56795. this._current = this._builder.buildRoot(this._ids);
  56796. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  56797. this._whiteRegex = /^\s+$/;
  56798. this._nbsps = /\xa0+/g;
  56799. }
  56800. parse(data) {
  56801. this.parseXml(data);
  56802. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  56803. return undefined;
  56804. }
  56805. this._current[_xfa_object.$finalize]();
  56806. return this._current.element;
  56807. }
  56808. onText(text) {
  56809. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  56810. if (this._current[_xfa_object.$acceptWhitespace]()) {
  56811. this._current[_xfa_object.$onText](text);
  56812. return;
  56813. }
  56814. if (this._whiteRegex.test(text)) {
  56815. return;
  56816. }
  56817. this._current[_xfa_object.$onText](text.trim());
  56818. }
  56819. onCdata(text) {
  56820. this._current[_xfa_object.$onText](text);
  56821. }
  56822. _mkAttributes(attributes, tagName) {
  56823. let namespace = null;
  56824. let prefixes = null;
  56825. const attributeObj = Object.create({});
  56826. for (const {
  56827. name,
  56828. value
  56829. } of attributes) {
  56830. if (name === "xmlns") {
  56831. if (!namespace) {
  56832. namespace = value;
  56833. } else {
  56834. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  56835. }
  56836. } else if (name.startsWith("xmlns:")) {
  56837. const prefix = name.substring("xmlns:".length);
  56838. if (!prefixes) {
  56839. prefixes = [];
  56840. }
  56841. prefixes.push({
  56842. prefix,
  56843. value
  56844. });
  56845. } else {
  56846. const i = name.indexOf(":");
  56847. if (i === -1) {
  56848. attributeObj[name] = value;
  56849. } else {
  56850. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  56851. if (!nsAttrs) {
  56852. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  56853. }
  56854. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  56855. let attrs = nsAttrs[ns];
  56856. if (!attrs) {
  56857. attrs = nsAttrs[ns] = Object.create(null);
  56858. }
  56859. attrs[attrName] = value;
  56860. }
  56861. }
  56862. }
  56863. return [namespace, prefixes, attributeObj];
  56864. }
  56865. _getNameAndPrefix(name, nsAgnostic) {
  56866. const i = name.indexOf(":");
  56867. if (i === -1) {
  56868. return [name, null];
  56869. }
  56870. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  56871. }
  56872. onBeginElement(tagName, attributes, isEmpty) {
  56873. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  56874. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  56875. const node = this._builder.build({
  56876. nsPrefix,
  56877. name,
  56878. attributes: attributesObj,
  56879. namespace,
  56880. prefixes
  56881. });
  56882. node[_xfa_object.$globalData] = this._globalData;
  56883. if (isEmpty) {
  56884. node[_xfa_object.$finalize]();
  56885. if (this._current[_xfa_object.$onChild](node)) {
  56886. node[_xfa_object.$setId](this._ids);
  56887. }
  56888. node[_xfa_object.$clean](this._builder);
  56889. return;
  56890. }
  56891. this._stack.push(this._current);
  56892. this._current = node;
  56893. }
  56894. onEndElement(name) {
  56895. const node = this._current;
  56896. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  56897. const parser = new XFAParser();
  56898. parser._globalData = this._globalData;
  56899. const root = parser.parse(node[_xfa_object.$content]);
  56900. node[_xfa_object.$content] = null;
  56901. node[_xfa_object.$onChild](root);
  56902. }
  56903. node[_xfa_object.$finalize]();
  56904. this._current = this._stack.pop();
  56905. if (this._current[_xfa_object.$onChild](node)) {
  56906. node[_xfa_object.$setId](this._ids);
  56907. }
  56908. node[_xfa_object.$clean](this._builder);
  56909. }
  56910. onError(code) {
  56911. this._errorCode = code;
  56912. }
  56913. }
  56914. exports.XFAParser = XFAParser;
  56915. /***/ }),
  56916. /* 87 */
  56917. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56918. Object.defineProperty(exports, "__esModule", ({
  56919. value: true
  56920. }));
  56921. exports.Builder = void 0;
  56922. var _namespaces = __w_pdfjs_require__(77);
  56923. var _xfa_object = __w_pdfjs_require__(75);
  56924. var _setup = __w_pdfjs_require__(88);
  56925. var _template = __w_pdfjs_require__(80);
  56926. var _unknown = __w_pdfjs_require__(97);
  56927. var _util = __w_pdfjs_require__(2);
  56928. class Root extends _xfa_object.XFAObject {
  56929. constructor(ids) {
  56930. super(-1, "root", Object.create(null));
  56931. this.element = null;
  56932. this[_xfa_object.$ids] = ids;
  56933. }
  56934. [_xfa_object.$onChild](child) {
  56935. this.element = child;
  56936. return true;
  56937. }
  56938. [_xfa_object.$finalize]() {
  56939. super[_xfa_object.$finalize]();
  56940. if (this.element.template instanceof _template.Template) {
  56941. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  56942. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  56943. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  56944. }
  56945. }
  56946. }
  56947. class Empty extends _xfa_object.XFAObject {
  56948. constructor() {
  56949. super(-1, "", Object.create(null));
  56950. }
  56951. [_xfa_object.$onChild](_) {
  56952. return false;
  56953. }
  56954. }
  56955. class Builder {
  56956. constructor() {
  56957. this._namespaceStack = [];
  56958. this._nsAgnosticLevel = 0;
  56959. this._namespacePrefixes = new Map();
  56960. this._namespaces = new Map();
  56961. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  56962. id
  56963. }) => id));
  56964. this._currentNamespace = new _unknown.UnknownNamespace(++this._nextNsId);
  56965. }
  56966. buildRoot(ids) {
  56967. return new Root(ids);
  56968. }
  56969. build({
  56970. nsPrefix,
  56971. name,
  56972. attributes,
  56973. namespace,
  56974. prefixes
  56975. }) {
  56976. const hasNamespaceDef = namespace !== null;
  56977. if (hasNamespaceDef) {
  56978. this._namespaceStack.push(this._currentNamespace);
  56979. this._currentNamespace = this._searchNamespace(namespace);
  56980. }
  56981. if (prefixes) {
  56982. this._addNamespacePrefix(prefixes);
  56983. }
  56984. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  56985. const dataTemplate = _setup.NamespaceSetUp.datasets;
  56986. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  56987. let xfaAttrs = null;
  56988. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  56989. const nsToUse = this._getNamespaceToUse(ns);
  56990. if (nsToUse === dataTemplate) {
  56991. xfaAttrs = {
  56992. xfa: attrs
  56993. };
  56994. break;
  56995. }
  56996. }
  56997. if (xfaAttrs) {
  56998. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  56999. } else {
  57000. delete attributes[_xfa_object.$nsAttributes];
  57001. }
  57002. }
  57003. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  57004. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  57005. if (node[_xfa_object.$isNsAgnostic]()) {
  57006. this._nsAgnosticLevel++;
  57007. }
  57008. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  57009. node[_xfa_object.$cleanup] = {
  57010. hasNamespace: hasNamespaceDef,
  57011. prefixes,
  57012. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  57013. };
  57014. }
  57015. return node;
  57016. }
  57017. isNsAgnostic() {
  57018. return this._nsAgnosticLevel > 0;
  57019. }
  57020. _searchNamespace(nsName) {
  57021. let ns = this._namespaces.get(nsName);
  57022. if (ns) {
  57023. return ns;
  57024. }
  57025. for (const [name, {
  57026. check
  57027. }] of Object.entries(_namespaces.NamespaceIds)) {
  57028. if (check(nsName)) {
  57029. ns = _setup.NamespaceSetUp[name];
  57030. if (ns) {
  57031. this._namespaces.set(nsName, ns);
  57032. return ns;
  57033. }
  57034. break;
  57035. }
  57036. }
  57037. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  57038. this._namespaces.set(nsName, ns);
  57039. return ns;
  57040. }
  57041. _addNamespacePrefix(prefixes) {
  57042. for (const {
  57043. prefix,
  57044. value
  57045. } of prefixes) {
  57046. const namespace = this._searchNamespace(value);
  57047. let prefixStack = this._namespacePrefixes.get(prefix);
  57048. if (!prefixStack) {
  57049. prefixStack = [];
  57050. this._namespacePrefixes.set(prefix, prefixStack);
  57051. }
  57052. prefixStack.push(namespace);
  57053. }
  57054. }
  57055. _getNamespaceToUse(prefix) {
  57056. if (!prefix) {
  57057. return this._currentNamespace;
  57058. }
  57059. const prefixStack = this._namespacePrefixes.get(prefix);
  57060. if (prefixStack && prefixStack.length > 0) {
  57061. return prefixStack[prefixStack.length - 1];
  57062. }
  57063. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  57064. return null;
  57065. }
  57066. clean(data) {
  57067. const {
  57068. hasNamespace,
  57069. prefixes,
  57070. nsAgnostic
  57071. } = data;
  57072. if (hasNamespace) {
  57073. this._currentNamespace = this._namespaceStack.pop();
  57074. }
  57075. if (prefixes) {
  57076. prefixes.forEach(({
  57077. prefix
  57078. }) => {
  57079. this._namespacePrefixes.get(prefix).pop();
  57080. });
  57081. }
  57082. if (nsAgnostic) {
  57083. this._nsAgnosticLevel--;
  57084. }
  57085. }
  57086. }
  57087. exports.Builder = Builder;
  57088. /***/ }),
  57089. /* 88 */
  57090. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57091. Object.defineProperty(exports, "__esModule", ({
  57092. value: true
  57093. }));
  57094. exports.NamespaceSetUp = void 0;
  57095. var _config = __w_pdfjs_require__(89);
  57096. var _connection_set = __w_pdfjs_require__(90);
  57097. var _datasets = __w_pdfjs_require__(91);
  57098. var _locale_set = __w_pdfjs_require__(92);
  57099. var _signature = __w_pdfjs_require__(93);
  57100. var _stylesheet = __w_pdfjs_require__(94);
  57101. var _template = __w_pdfjs_require__(80);
  57102. var _xdp = __w_pdfjs_require__(95);
  57103. var _xhtml = __w_pdfjs_require__(96);
  57104. const NamespaceSetUp = {
  57105. config: _config.ConfigNamespace,
  57106. connection: _connection_set.ConnectionSetNamespace,
  57107. datasets: _datasets.DatasetsNamespace,
  57108. localeSet: _locale_set.LocaleSetNamespace,
  57109. signature: _signature.SignatureNamespace,
  57110. stylesheet: _stylesheet.StylesheetNamespace,
  57111. template: _template.TemplateNamespace,
  57112. xdp: _xdp.XdpNamespace,
  57113. xhtml: _xhtml.XhtmlNamespace
  57114. };
  57115. exports.NamespaceSetUp = NamespaceSetUp;
  57116. /***/ }),
  57117. /* 89 */
  57118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57119. Object.defineProperty(exports, "__esModule", ({
  57120. value: true
  57121. }));
  57122. exports.ConfigNamespace = void 0;
  57123. var _namespaces = __w_pdfjs_require__(77);
  57124. var _xfa_object = __w_pdfjs_require__(75);
  57125. var _utils = __w_pdfjs_require__(76);
  57126. var _util = __w_pdfjs_require__(2);
  57127. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  57128. class Acrobat extends _xfa_object.XFAObject {
  57129. constructor(attributes) {
  57130. super(CONFIG_NS_ID, "acrobat", true);
  57131. this.acrobat7 = null;
  57132. this.autoSave = null;
  57133. this.common = null;
  57134. this.validate = null;
  57135. this.validateApprovalSignatures = null;
  57136. this.submitUrl = new _xfa_object.XFAObjectArray();
  57137. }
  57138. }
  57139. class Acrobat7 extends _xfa_object.XFAObject {
  57140. constructor(attributes) {
  57141. super(CONFIG_NS_ID, "acrobat7", true);
  57142. this.dynamicRender = null;
  57143. }
  57144. }
  57145. class ADBE_JSConsole extends _xfa_object.OptionObject {
  57146. constructor(attributes) {
  57147. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  57148. }
  57149. }
  57150. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  57151. constructor(attributes) {
  57152. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  57153. }
  57154. }
  57155. class AddSilentPrint extends _xfa_object.Option01 {
  57156. constructor(attributes) {
  57157. super(CONFIG_NS_ID, "addSilentPrint");
  57158. }
  57159. }
  57160. class AddViewerPreferences extends _xfa_object.Option01 {
  57161. constructor(attributes) {
  57162. super(CONFIG_NS_ID, "addViewerPreferences");
  57163. }
  57164. }
  57165. class AdjustData extends _xfa_object.Option10 {
  57166. constructor(attributes) {
  57167. super(CONFIG_NS_ID, "adjustData");
  57168. }
  57169. }
  57170. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  57171. constructor(attributes) {
  57172. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  57173. }
  57174. }
  57175. class Agent extends _xfa_object.XFAObject {
  57176. constructor(attributes) {
  57177. super(CONFIG_NS_ID, "agent", true);
  57178. this.name = attributes.name ? attributes.name.trim() : "";
  57179. this.common = new _xfa_object.XFAObjectArray();
  57180. }
  57181. }
  57182. class AlwaysEmbed extends _xfa_object.ContentObject {
  57183. constructor(attributes) {
  57184. super(CONFIG_NS_ID, "alwaysEmbed");
  57185. }
  57186. }
  57187. class Amd extends _xfa_object.StringObject {
  57188. constructor(attributes) {
  57189. super(CONFIG_NS_ID, "amd");
  57190. }
  57191. }
  57192. class Area extends _xfa_object.XFAObject {
  57193. constructor(attributes) {
  57194. super(CONFIG_NS_ID, "area");
  57195. this.level = (0, _utils.getInteger)({
  57196. data: attributes.level,
  57197. defaultValue: 0,
  57198. validate: n => n >= 1 && n <= 3
  57199. });
  57200. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  57201. }
  57202. }
  57203. class Attributes extends _xfa_object.OptionObject {
  57204. constructor(attributes) {
  57205. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  57206. }
  57207. }
  57208. class AutoSave extends _xfa_object.OptionObject {
  57209. constructor(attributes) {
  57210. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  57211. }
  57212. }
  57213. class Base extends _xfa_object.StringObject {
  57214. constructor(attributes) {
  57215. super(CONFIG_NS_ID, "base");
  57216. }
  57217. }
  57218. class BatchOutput extends _xfa_object.XFAObject {
  57219. constructor(attributes) {
  57220. super(CONFIG_NS_ID, "batchOutput");
  57221. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  57222. }
  57223. }
  57224. class BehaviorOverride extends _xfa_object.ContentObject {
  57225. constructor(attributes) {
  57226. super(CONFIG_NS_ID, "behaviorOverride");
  57227. }
  57228. [_xfa_object.$finalize]() {
  57229. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  57230. }
  57231. }
  57232. class Cache extends _xfa_object.XFAObject {
  57233. constructor(attributes) {
  57234. super(CONFIG_NS_ID, "cache", true);
  57235. this.templateCache = null;
  57236. }
  57237. }
  57238. class Change extends _xfa_object.Option01 {
  57239. constructor(attributes) {
  57240. super(CONFIG_NS_ID, "change");
  57241. }
  57242. }
  57243. class Common extends _xfa_object.XFAObject {
  57244. constructor(attributes) {
  57245. super(CONFIG_NS_ID, "common", true);
  57246. this.data = null;
  57247. this.locale = null;
  57248. this.localeSet = null;
  57249. this.messaging = null;
  57250. this.suppressBanner = null;
  57251. this.template = null;
  57252. this.validationMessaging = null;
  57253. this.versionControl = null;
  57254. this.log = new _xfa_object.XFAObjectArray();
  57255. }
  57256. }
  57257. class Compress extends _xfa_object.XFAObject {
  57258. constructor(attributes) {
  57259. super(CONFIG_NS_ID, "compress");
  57260. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  57261. }
  57262. }
  57263. class CompressLogicalStructure extends _xfa_object.Option01 {
  57264. constructor(attributes) {
  57265. super(CONFIG_NS_ID, "compressLogicalStructure");
  57266. }
  57267. }
  57268. class CompressObjectStream extends _xfa_object.Option10 {
  57269. constructor(attributes) {
  57270. super(CONFIG_NS_ID, "compressObjectStream");
  57271. }
  57272. }
  57273. class Compression extends _xfa_object.XFAObject {
  57274. constructor(attributes) {
  57275. super(CONFIG_NS_ID, "compression", true);
  57276. this.compressLogicalStructure = null;
  57277. this.compressObjectStream = null;
  57278. this.level = null;
  57279. this.type = null;
  57280. }
  57281. }
  57282. class Config extends _xfa_object.XFAObject {
  57283. constructor(attributes) {
  57284. super(CONFIG_NS_ID, "config", true);
  57285. this.acrobat = null;
  57286. this.present = null;
  57287. this.trace = null;
  57288. this.agent = new _xfa_object.XFAObjectArray();
  57289. }
  57290. }
  57291. class Conformance extends _xfa_object.OptionObject {
  57292. constructor(attributes) {
  57293. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  57294. }
  57295. }
  57296. class ContentCopy extends _xfa_object.Option01 {
  57297. constructor(attributes) {
  57298. super(CONFIG_NS_ID, "contentCopy");
  57299. }
  57300. }
  57301. class Copies extends _xfa_object.IntegerObject {
  57302. constructor(attributes) {
  57303. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  57304. }
  57305. }
  57306. class Creator extends _xfa_object.StringObject {
  57307. constructor(attributes) {
  57308. super(CONFIG_NS_ID, "creator");
  57309. }
  57310. }
  57311. class CurrentPage extends _xfa_object.IntegerObject {
  57312. constructor(attributes) {
  57313. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  57314. }
  57315. }
  57316. class Data extends _xfa_object.XFAObject {
  57317. constructor(attributes) {
  57318. super(CONFIG_NS_ID, "data", true);
  57319. this.adjustData = null;
  57320. this.attributes = null;
  57321. this.incrementalLoad = null;
  57322. this.outputXSL = null;
  57323. this.range = null;
  57324. this.record = null;
  57325. this.startNode = null;
  57326. this.uri = null;
  57327. this.window = null;
  57328. this.xsl = null;
  57329. this.excludeNS = new _xfa_object.XFAObjectArray();
  57330. this.transform = new _xfa_object.XFAObjectArray();
  57331. }
  57332. }
  57333. class Debug extends _xfa_object.XFAObject {
  57334. constructor(attributes) {
  57335. super(CONFIG_NS_ID, "debug", true);
  57336. this.uri = null;
  57337. }
  57338. }
  57339. class DefaultTypeface extends _xfa_object.ContentObject {
  57340. constructor(attributes) {
  57341. super(CONFIG_NS_ID, "defaultTypeface");
  57342. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  57343. }
  57344. }
  57345. class Destination extends _xfa_object.OptionObject {
  57346. constructor(attributes) {
  57347. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  57348. }
  57349. }
  57350. class DocumentAssembly extends _xfa_object.Option01 {
  57351. constructor(attributes) {
  57352. super(CONFIG_NS_ID, "documentAssembly");
  57353. }
  57354. }
  57355. class Driver extends _xfa_object.XFAObject {
  57356. constructor(attributes) {
  57357. super(CONFIG_NS_ID, "driver", true);
  57358. this.name = attributes.name ? attributes.name.trim() : "";
  57359. this.fontInfo = null;
  57360. this.xdc = null;
  57361. }
  57362. }
  57363. class DuplexOption extends _xfa_object.OptionObject {
  57364. constructor(attributes) {
  57365. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  57366. }
  57367. }
  57368. class DynamicRender extends _xfa_object.OptionObject {
  57369. constructor(attributes) {
  57370. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  57371. }
  57372. }
  57373. class Embed extends _xfa_object.Option01 {
  57374. constructor(attributes) {
  57375. super(CONFIG_NS_ID, "embed");
  57376. }
  57377. }
  57378. class Encrypt extends _xfa_object.Option01 {
  57379. constructor(attributes) {
  57380. super(CONFIG_NS_ID, "encrypt");
  57381. }
  57382. }
  57383. class Encryption extends _xfa_object.XFAObject {
  57384. constructor(attributes) {
  57385. super(CONFIG_NS_ID, "encryption", true);
  57386. this.encrypt = null;
  57387. this.encryptionLevel = null;
  57388. this.permissions = null;
  57389. }
  57390. }
  57391. class EncryptionLevel extends _xfa_object.OptionObject {
  57392. constructor(attributes) {
  57393. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  57394. }
  57395. }
  57396. class Enforce extends _xfa_object.StringObject {
  57397. constructor(attributes) {
  57398. super(CONFIG_NS_ID, "enforce");
  57399. }
  57400. }
  57401. class Equate extends _xfa_object.XFAObject {
  57402. constructor(attributes) {
  57403. super(CONFIG_NS_ID, "equate");
  57404. this.force = (0, _utils.getInteger)({
  57405. data: attributes.force,
  57406. defaultValue: 1,
  57407. validate: n => n === 0
  57408. });
  57409. this.from = attributes.from || "";
  57410. this.to = attributes.to || "";
  57411. }
  57412. }
  57413. class EquateRange extends _xfa_object.XFAObject {
  57414. constructor(attributes) {
  57415. super(CONFIG_NS_ID, "equateRange");
  57416. this.from = attributes.from || "";
  57417. this.to = attributes.to || "";
  57418. this._unicodeRange = attributes.unicodeRange || "";
  57419. }
  57420. get unicodeRange() {
  57421. const ranges = [];
  57422. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  57423. const unicodeRange = this._unicodeRange;
  57424. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  57425. range = range.split("-", 2).map(x => {
  57426. const found = x.match(unicodeRegex);
  57427. if (!found) {
  57428. return 0;
  57429. }
  57430. return parseInt(found[1], 16);
  57431. });
  57432. if (range.length === 1) {
  57433. range.push(range[0]);
  57434. }
  57435. ranges.push(range);
  57436. }
  57437. return (0, _util.shadow)(this, "unicodeRange", ranges);
  57438. }
  57439. }
  57440. class Exclude extends _xfa_object.ContentObject {
  57441. constructor(attributes) {
  57442. super(CONFIG_NS_ID, "exclude");
  57443. }
  57444. [_xfa_object.$finalize]() {
  57445. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  57446. }
  57447. }
  57448. class ExcludeNS extends _xfa_object.StringObject {
  57449. constructor(attributes) {
  57450. super(CONFIG_NS_ID, "excludeNS");
  57451. }
  57452. }
  57453. class FlipLabel extends _xfa_object.OptionObject {
  57454. constructor(attributes) {
  57455. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  57456. }
  57457. }
  57458. class FontInfo extends _xfa_object.XFAObject {
  57459. constructor(attributes) {
  57460. super(CONFIG_NS_ID, "fontInfo", true);
  57461. this.embed = null;
  57462. this.map = null;
  57463. this.subsetBelow = null;
  57464. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  57465. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  57466. this.neverEmbed = new _xfa_object.XFAObjectArray();
  57467. }
  57468. }
  57469. class FormFieldFilling extends _xfa_object.Option01 {
  57470. constructor(attributes) {
  57471. super(CONFIG_NS_ID, "formFieldFilling");
  57472. }
  57473. }
  57474. class GroupParent extends _xfa_object.StringObject {
  57475. constructor(attributes) {
  57476. super(CONFIG_NS_ID, "groupParent");
  57477. }
  57478. }
  57479. class IfEmpty extends _xfa_object.OptionObject {
  57480. constructor(attributes) {
  57481. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  57482. }
  57483. }
  57484. class IncludeXDPContent extends _xfa_object.StringObject {
  57485. constructor(attributes) {
  57486. super(CONFIG_NS_ID, "includeXDPContent");
  57487. }
  57488. }
  57489. class IncrementalLoad extends _xfa_object.OptionObject {
  57490. constructor(attributes) {
  57491. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  57492. }
  57493. }
  57494. class IncrementalMerge extends _xfa_object.Option01 {
  57495. constructor(attributes) {
  57496. super(CONFIG_NS_ID, "incrementalMerge");
  57497. }
  57498. }
  57499. class Interactive extends _xfa_object.Option01 {
  57500. constructor(attributes) {
  57501. super(CONFIG_NS_ID, "interactive");
  57502. }
  57503. }
  57504. class Jog extends _xfa_object.OptionObject {
  57505. constructor(attributes) {
  57506. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  57507. }
  57508. }
  57509. class LabelPrinter extends _xfa_object.XFAObject {
  57510. constructor(attributes) {
  57511. super(CONFIG_NS_ID, "labelPrinter", true);
  57512. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  57513. this.batchOutput = null;
  57514. this.flipLabel = null;
  57515. this.fontInfo = null;
  57516. this.xdc = null;
  57517. }
  57518. }
  57519. class Layout extends _xfa_object.OptionObject {
  57520. constructor(attributes) {
  57521. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  57522. }
  57523. }
  57524. class Level extends _xfa_object.IntegerObject {
  57525. constructor(attributes) {
  57526. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  57527. }
  57528. }
  57529. class Linearized extends _xfa_object.Option01 {
  57530. constructor(attributes) {
  57531. super(CONFIG_NS_ID, "linearized");
  57532. }
  57533. }
  57534. class Locale extends _xfa_object.StringObject {
  57535. constructor(attributes) {
  57536. super(CONFIG_NS_ID, "locale");
  57537. }
  57538. }
  57539. class LocaleSet extends _xfa_object.StringObject {
  57540. constructor(attributes) {
  57541. super(CONFIG_NS_ID, "localeSet");
  57542. }
  57543. }
  57544. class Log extends _xfa_object.XFAObject {
  57545. constructor(attributes) {
  57546. super(CONFIG_NS_ID, "log", true);
  57547. this.mode = null;
  57548. this.threshold = null;
  57549. this.to = null;
  57550. this.uri = null;
  57551. }
  57552. }
  57553. class MapElement extends _xfa_object.XFAObject {
  57554. constructor(attributes) {
  57555. super(CONFIG_NS_ID, "map", true);
  57556. this.equate = new _xfa_object.XFAObjectArray();
  57557. this.equateRange = new _xfa_object.XFAObjectArray();
  57558. }
  57559. }
  57560. class MediumInfo extends _xfa_object.XFAObject {
  57561. constructor(attributes) {
  57562. super(CONFIG_NS_ID, "mediumInfo", true);
  57563. this.map = null;
  57564. }
  57565. }
  57566. class Message extends _xfa_object.XFAObject {
  57567. constructor(attributes) {
  57568. super(CONFIG_NS_ID, "message", true);
  57569. this.msgId = null;
  57570. this.severity = null;
  57571. }
  57572. }
  57573. class Messaging extends _xfa_object.XFAObject {
  57574. constructor(attributes) {
  57575. super(CONFIG_NS_ID, "messaging", true);
  57576. this.message = new _xfa_object.XFAObjectArray();
  57577. }
  57578. }
  57579. class Mode extends _xfa_object.OptionObject {
  57580. constructor(attributes) {
  57581. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  57582. }
  57583. }
  57584. class ModifyAnnots extends _xfa_object.Option01 {
  57585. constructor(attributes) {
  57586. super(CONFIG_NS_ID, "modifyAnnots");
  57587. }
  57588. }
  57589. class MsgId extends _xfa_object.IntegerObject {
  57590. constructor(attributes) {
  57591. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  57592. }
  57593. }
  57594. class NameAttr extends _xfa_object.StringObject {
  57595. constructor(attributes) {
  57596. super(CONFIG_NS_ID, "nameAttr");
  57597. }
  57598. }
  57599. class NeverEmbed extends _xfa_object.ContentObject {
  57600. constructor(attributes) {
  57601. super(CONFIG_NS_ID, "neverEmbed");
  57602. }
  57603. }
  57604. class NumberOfCopies extends _xfa_object.IntegerObject {
  57605. constructor(attributes) {
  57606. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  57607. }
  57608. }
  57609. class OpenAction extends _xfa_object.XFAObject {
  57610. constructor(attributes) {
  57611. super(CONFIG_NS_ID, "openAction", true);
  57612. this.destination = null;
  57613. }
  57614. }
  57615. class Output extends _xfa_object.XFAObject {
  57616. constructor(attributes) {
  57617. super(CONFIG_NS_ID, "output", true);
  57618. this.to = null;
  57619. this.type = null;
  57620. this.uri = null;
  57621. }
  57622. }
  57623. class OutputBin extends _xfa_object.StringObject {
  57624. constructor(attributes) {
  57625. super(CONFIG_NS_ID, "outputBin");
  57626. }
  57627. }
  57628. class OutputXSL extends _xfa_object.XFAObject {
  57629. constructor(attributes) {
  57630. super(CONFIG_NS_ID, "outputXSL", true);
  57631. this.uri = null;
  57632. }
  57633. }
  57634. class Overprint extends _xfa_object.OptionObject {
  57635. constructor(attributes) {
  57636. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  57637. }
  57638. }
  57639. class Packets extends _xfa_object.StringObject {
  57640. constructor(attributes) {
  57641. super(CONFIG_NS_ID, "packets");
  57642. }
  57643. [_xfa_object.$finalize]() {
  57644. if (this[_xfa_object.$content] === "*") {
  57645. return;
  57646. }
  57647. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  57648. }
  57649. }
  57650. class PageOffset extends _xfa_object.XFAObject {
  57651. constructor(attributes) {
  57652. super(CONFIG_NS_ID, "pageOffset");
  57653. this.x = (0, _utils.getInteger)({
  57654. data: attributes.x,
  57655. defaultValue: "useXDCSetting",
  57656. validate: n => true
  57657. });
  57658. this.y = (0, _utils.getInteger)({
  57659. data: attributes.y,
  57660. defaultValue: "useXDCSetting",
  57661. validate: n => true
  57662. });
  57663. }
  57664. }
  57665. class PageRange extends _xfa_object.StringObject {
  57666. constructor(attributes) {
  57667. super(CONFIG_NS_ID, "pageRange");
  57668. }
  57669. [_xfa_object.$finalize]() {
  57670. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  57671. const ranges = [];
  57672. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  57673. ranges.push(numbers.slice(i, i + 2));
  57674. }
  57675. this[_xfa_object.$content] = ranges;
  57676. }
  57677. }
  57678. class Pagination extends _xfa_object.OptionObject {
  57679. constructor(attributes) {
  57680. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  57681. }
  57682. }
  57683. class PaginationOverride extends _xfa_object.OptionObject {
  57684. constructor(attributes) {
  57685. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  57686. }
  57687. }
  57688. class Part extends _xfa_object.IntegerObject {
  57689. constructor(attributes) {
  57690. super(CONFIG_NS_ID, "part", 1, n => false);
  57691. }
  57692. }
  57693. class Pcl extends _xfa_object.XFAObject {
  57694. constructor(attributes) {
  57695. super(CONFIG_NS_ID, "pcl", true);
  57696. this.name = attributes.name || "";
  57697. this.batchOutput = null;
  57698. this.fontInfo = null;
  57699. this.jog = null;
  57700. this.mediumInfo = null;
  57701. this.outputBin = null;
  57702. this.pageOffset = null;
  57703. this.staple = null;
  57704. this.xdc = null;
  57705. }
  57706. }
  57707. class Pdf extends _xfa_object.XFAObject {
  57708. constructor(attributes) {
  57709. super(CONFIG_NS_ID, "pdf", true);
  57710. this.name = attributes.name || "";
  57711. this.adobeExtensionLevel = null;
  57712. this.batchOutput = null;
  57713. this.compression = null;
  57714. this.creator = null;
  57715. this.encryption = null;
  57716. this.fontInfo = null;
  57717. this.interactive = null;
  57718. this.linearized = null;
  57719. this.openAction = null;
  57720. this.pdfa = null;
  57721. this.producer = null;
  57722. this.renderPolicy = null;
  57723. this.scriptModel = null;
  57724. this.silentPrint = null;
  57725. this.submitFormat = null;
  57726. this.tagged = null;
  57727. this.version = null;
  57728. this.viewerPreferences = null;
  57729. this.xdc = null;
  57730. }
  57731. }
  57732. class Pdfa extends _xfa_object.XFAObject {
  57733. constructor(attributes) {
  57734. super(CONFIG_NS_ID, "pdfa", true);
  57735. this.amd = null;
  57736. this.conformance = null;
  57737. this.includeXDPContent = null;
  57738. this.part = null;
  57739. }
  57740. }
  57741. class Permissions extends _xfa_object.XFAObject {
  57742. constructor(attributes) {
  57743. super(CONFIG_NS_ID, "permissions", true);
  57744. this.accessibleContent = null;
  57745. this.change = null;
  57746. this.contentCopy = null;
  57747. this.documentAssembly = null;
  57748. this.formFieldFilling = null;
  57749. this.modifyAnnots = null;
  57750. this.plaintextMetadata = null;
  57751. this.print = null;
  57752. this.printHighQuality = null;
  57753. }
  57754. }
  57755. class PickTrayByPDFSize extends _xfa_object.Option01 {
  57756. constructor(attributes) {
  57757. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  57758. }
  57759. }
  57760. class Picture extends _xfa_object.StringObject {
  57761. constructor(attributes) {
  57762. super(CONFIG_NS_ID, "picture");
  57763. }
  57764. }
  57765. class PlaintextMetadata extends _xfa_object.Option01 {
  57766. constructor(attributes) {
  57767. super(CONFIG_NS_ID, "plaintextMetadata");
  57768. }
  57769. }
  57770. class Presence extends _xfa_object.OptionObject {
  57771. constructor(attributes) {
  57772. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  57773. }
  57774. }
  57775. class Present extends _xfa_object.XFAObject {
  57776. constructor(attributes) {
  57777. super(CONFIG_NS_ID, "present", true);
  57778. this.behaviorOverride = null;
  57779. this.cache = null;
  57780. this.common = null;
  57781. this.copies = null;
  57782. this.destination = null;
  57783. this.incrementalMerge = null;
  57784. this.layout = null;
  57785. this.output = null;
  57786. this.overprint = null;
  57787. this.pagination = null;
  57788. this.paginationOverride = null;
  57789. this.script = null;
  57790. this.validate = null;
  57791. this.xdp = null;
  57792. this.driver = new _xfa_object.XFAObjectArray();
  57793. this.labelPrinter = new _xfa_object.XFAObjectArray();
  57794. this.pcl = new _xfa_object.XFAObjectArray();
  57795. this.pdf = new _xfa_object.XFAObjectArray();
  57796. this.ps = new _xfa_object.XFAObjectArray();
  57797. this.submitUrl = new _xfa_object.XFAObjectArray();
  57798. this.webClient = new _xfa_object.XFAObjectArray();
  57799. this.zpl = new _xfa_object.XFAObjectArray();
  57800. }
  57801. }
  57802. class Print extends _xfa_object.Option01 {
  57803. constructor(attributes) {
  57804. super(CONFIG_NS_ID, "print");
  57805. }
  57806. }
  57807. class PrintHighQuality extends _xfa_object.Option01 {
  57808. constructor(attributes) {
  57809. super(CONFIG_NS_ID, "printHighQuality");
  57810. }
  57811. }
  57812. class PrintScaling extends _xfa_object.OptionObject {
  57813. constructor(attributes) {
  57814. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  57815. }
  57816. }
  57817. class PrinterName extends _xfa_object.StringObject {
  57818. constructor(attributes) {
  57819. super(CONFIG_NS_ID, "printerName");
  57820. }
  57821. }
  57822. class Producer extends _xfa_object.StringObject {
  57823. constructor(attributes) {
  57824. super(CONFIG_NS_ID, "producer");
  57825. }
  57826. }
  57827. class Ps extends _xfa_object.XFAObject {
  57828. constructor(attributes) {
  57829. super(CONFIG_NS_ID, "ps", true);
  57830. this.name = attributes.name || "";
  57831. this.batchOutput = null;
  57832. this.fontInfo = null;
  57833. this.jog = null;
  57834. this.mediumInfo = null;
  57835. this.outputBin = null;
  57836. this.staple = null;
  57837. this.xdc = null;
  57838. }
  57839. }
  57840. class Range extends _xfa_object.ContentObject {
  57841. constructor(attributes) {
  57842. super(CONFIG_NS_ID, "range");
  57843. }
  57844. [_xfa_object.$finalize]() {
  57845. 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 => {
  57846. if (range.length === 1) {
  57847. range.push(range[0]);
  57848. }
  57849. return range;
  57850. });
  57851. }
  57852. }
  57853. class Record extends _xfa_object.ContentObject {
  57854. constructor(attributes) {
  57855. super(CONFIG_NS_ID, "record");
  57856. }
  57857. [_xfa_object.$finalize]() {
  57858. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  57859. const n = parseInt(this[_xfa_object.$content], 10);
  57860. if (!isNaN(n) && n >= 0) {
  57861. this[_xfa_object.$content] = n;
  57862. }
  57863. }
  57864. }
  57865. class Relevant extends _xfa_object.ContentObject {
  57866. constructor(attributes) {
  57867. super(CONFIG_NS_ID, "relevant");
  57868. }
  57869. [_xfa_object.$finalize]() {
  57870. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  57871. }
  57872. }
  57873. class Rename extends _xfa_object.ContentObject {
  57874. constructor(attributes) {
  57875. super(CONFIG_NS_ID, "rename");
  57876. }
  57877. [_xfa_object.$finalize]() {
  57878. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  57879. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  57880. (0, _util.warn)("XFA - Rename: invalid XFA name");
  57881. }
  57882. }
  57883. }
  57884. class RenderPolicy extends _xfa_object.OptionObject {
  57885. constructor(attributes) {
  57886. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  57887. }
  57888. }
  57889. class RunScripts extends _xfa_object.OptionObject {
  57890. constructor(attributes) {
  57891. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  57892. }
  57893. }
  57894. class Script extends _xfa_object.XFAObject {
  57895. constructor(attributes) {
  57896. super(CONFIG_NS_ID, "script", true);
  57897. this.currentPage = null;
  57898. this.exclude = null;
  57899. this.runScripts = null;
  57900. }
  57901. }
  57902. class ScriptModel extends _xfa_object.OptionObject {
  57903. constructor(attributes) {
  57904. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  57905. }
  57906. }
  57907. class Severity extends _xfa_object.OptionObject {
  57908. constructor(attributes) {
  57909. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  57910. }
  57911. }
  57912. class SilentPrint extends _xfa_object.XFAObject {
  57913. constructor(attributes) {
  57914. super(CONFIG_NS_ID, "silentPrint", true);
  57915. this.addSilentPrint = null;
  57916. this.printerName = null;
  57917. }
  57918. }
  57919. class Staple extends _xfa_object.XFAObject {
  57920. constructor(attributes) {
  57921. super(CONFIG_NS_ID, "staple");
  57922. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  57923. }
  57924. }
  57925. class StartNode extends _xfa_object.StringObject {
  57926. constructor(attributes) {
  57927. super(CONFIG_NS_ID, "startNode");
  57928. }
  57929. }
  57930. class StartPage extends _xfa_object.IntegerObject {
  57931. constructor(attributes) {
  57932. super(CONFIG_NS_ID, "startPage", 0, n => true);
  57933. }
  57934. }
  57935. class SubmitFormat extends _xfa_object.OptionObject {
  57936. constructor(attributes) {
  57937. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  57938. }
  57939. }
  57940. class SubmitUrl extends _xfa_object.StringObject {
  57941. constructor(attributes) {
  57942. super(CONFIG_NS_ID, "submitUrl");
  57943. }
  57944. }
  57945. class SubsetBelow extends _xfa_object.IntegerObject {
  57946. constructor(attributes) {
  57947. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  57948. }
  57949. }
  57950. class SuppressBanner extends _xfa_object.Option01 {
  57951. constructor(attributes) {
  57952. super(CONFIG_NS_ID, "suppressBanner");
  57953. }
  57954. }
  57955. class Tagged extends _xfa_object.Option01 {
  57956. constructor(attributes) {
  57957. super(CONFIG_NS_ID, "tagged");
  57958. }
  57959. }
  57960. class Template extends _xfa_object.XFAObject {
  57961. constructor(attributes) {
  57962. super(CONFIG_NS_ID, "template", true);
  57963. this.base = null;
  57964. this.relevant = null;
  57965. this.startPage = null;
  57966. this.uri = null;
  57967. this.xsl = null;
  57968. }
  57969. }
  57970. class Threshold extends _xfa_object.OptionObject {
  57971. constructor(attributes) {
  57972. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  57973. }
  57974. }
  57975. class To extends _xfa_object.OptionObject {
  57976. constructor(attributes) {
  57977. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  57978. }
  57979. }
  57980. class TemplateCache extends _xfa_object.XFAObject {
  57981. constructor(attributes) {
  57982. super(CONFIG_NS_ID, "templateCache");
  57983. this.maxEntries = (0, _utils.getInteger)({
  57984. data: attributes.maxEntries,
  57985. defaultValue: 5,
  57986. validate: n => n >= 0
  57987. });
  57988. }
  57989. }
  57990. class Trace extends _xfa_object.XFAObject {
  57991. constructor(attributes) {
  57992. super(CONFIG_NS_ID, "trace", true);
  57993. this.area = new _xfa_object.XFAObjectArray();
  57994. }
  57995. }
  57996. class Transform extends _xfa_object.XFAObject {
  57997. constructor(attributes) {
  57998. super(CONFIG_NS_ID, "transform", true);
  57999. this.groupParent = null;
  58000. this.ifEmpty = null;
  58001. this.nameAttr = null;
  58002. this.picture = null;
  58003. this.presence = null;
  58004. this.rename = null;
  58005. this.whitespace = null;
  58006. }
  58007. }
  58008. class Type extends _xfa_object.OptionObject {
  58009. constructor(attributes) {
  58010. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  58011. }
  58012. }
  58013. class Uri extends _xfa_object.StringObject {
  58014. constructor(attributes) {
  58015. super(CONFIG_NS_ID, "uri");
  58016. }
  58017. }
  58018. class Validate extends _xfa_object.OptionObject {
  58019. constructor(attributes) {
  58020. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  58021. }
  58022. }
  58023. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  58024. constructor(attributes) {
  58025. super(CONFIG_NS_ID, "validateApprovalSignatures");
  58026. }
  58027. [_xfa_object.$finalize]() {
  58028. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  58029. }
  58030. }
  58031. class ValidationMessaging extends _xfa_object.OptionObject {
  58032. constructor(attributes) {
  58033. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  58034. }
  58035. }
  58036. class Version extends _xfa_object.OptionObject {
  58037. constructor(attributes) {
  58038. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  58039. }
  58040. }
  58041. class VersionControl extends _xfa_object.XFAObject {
  58042. constructor(attributes) {
  58043. super(CONFIG_NS_ID, "VersionControl");
  58044. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  58045. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  58046. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  58047. }
  58048. }
  58049. class ViewerPreferences extends _xfa_object.XFAObject {
  58050. constructor(attributes) {
  58051. super(CONFIG_NS_ID, "viewerPreferences", true);
  58052. this.ADBE_JSConsole = null;
  58053. this.ADBE_JSDebugger = null;
  58054. this.addViewerPreferences = null;
  58055. this.duplexOption = null;
  58056. this.enforce = null;
  58057. this.numberOfCopies = null;
  58058. this.pageRange = null;
  58059. this.pickTrayByPDFSize = null;
  58060. this.printScaling = null;
  58061. }
  58062. }
  58063. class WebClient extends _xfa_object.XFAObject {
  58064. constructor(attributes) {
  58065. super(CONFIG_NS_ID, "webClient", true);
  58066. this.name = attributes.name ? attributes.name.trim() : "";
  58067. this.fontInfo = null;
  58068. this.xdc = null;
  58069. }
  58070. }
  58071. class Whitespace extends _xfa_object.OptionObject {
  58072. constructor(attributes) {
  58073. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  58074. }
  58075. }
  58076. class Window extends _xfa_object.ContentObject {
  58077. constructor(attributes) {
  58078. super(CONFIG_NS_ID, "window");
  58079. }
  58080. [_xfa_object.$finalize]() {
  58081. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  58082. if (pair.some(x => isNaN(x))) {
  58083. this[_xfa_object.$content] = [0, 0];
  58084. return;
  58085. }
  58086. if (pair.length === 1) {
  58087. pair.push(pair[0]);
  58088. }
  58089. this[_xfa_object.$content] = pair;
  58090. }
  58091. }
  58092. class Xdc extends _xfa_object.XFAObject {
  58093. constructor(attributes) {
  58094. super(CONFIG_NS_ID, "xdc", true);
  58095. this.uri = new _xfa_object.XFAObjectArray();
  58096. this.xsl = new _xfa_object.XFAObjectArray();
  58097. }
  58098. }
  58099. class Xdp extends _xfa_object.XFAObject {
  58100. constructor(attributes) {
  58101. super(CONFIG_NS_ID, "xdp", true);
  58102. this.packets = null;
  58103. }
  58104. }
  58105. class Xsl extends _xfa_object.XFAObject {
  58106. constructor(attributes) {
  58107. super(CONFIG_NS_ID, "xsl", true);
  58108. this.debug = null;
  58109. this.uri = null;
  58110. }
  58111. }
  58112. class Zpl extends _xfa_object.XFAObject {
  58113. constructor(attributes) {
  58114. super(CONFIG_NS_ID, "zpl", true);
  58115. this.name = attributes.name ? attributes.name.trim() : "";
  58116. this.batchOutput = null;
  58117. this.flipLabel = null;
  58118. this.fontInfo = null;
  58119. this.xdc = null;
  58120. }
  58121. }
  58122. class ConfigNamespace {
  58123. static [_namespaces.$buildXFAObject](name, attributes) {
  58124. if (ConfigNamespace.hasOwnProperty(name)) {
  58125. return ConfigNamespace[name](attributes);
  58126. }
  58127. return undefined;
  58128. }
  58129. static acrobat(attrs) {
  58130. return new Acrobat(attrs);
  58131. }
  58132. static acrobat7(attrs) {
  58133. return new Acrobat7(attrs);
  58134. }
  58135. static ADBE_JSConsole(attrs) {
  58136. return new ADBE_JSConsole(attrs);
  58137. }
  58138. static ADBE_JSDebugger(attrs) {
  58139. return new ADBE_JSDebugger(attrs);
  58140. }
  58141. static addSilentPrint(attrs) {
  58142. return new AddSilentPrint(attrs);
  58143. }
  58144. static addViewerPreferences(attrs) {
  58145. return new AddViewerPreferences(attrs);
  58146. }
  58147. static adjustData(attrs) {
  58148. return new AdjustData(attrs);
  58149. }
  58150. static adobeExtensionLevel(attrs) {
  58151. return new AdobeExtensionLevel(attrs);
  58152. }
  58153. static agent(attrs) {
  58154. return new Agent(attrs);
  58155. }
  58156. static alwaysEmbed(attrs) {
  58157. return new AlwaysEmbed(attrs);
  58158. }
  58159. static amd(attrs) {
  58160. return new Amd(attrs);
  58161. }
  58162. static area(attrs) {
  58163. return new Area(attrs);
  58164. }
  58165. static attributes(attrs) {
  58166. return new Attributes(attrs);
  58167. }
  58168. static autoSave(attrs) {
  58169. return new AutoSave(attrs);
  58170. }
  58171. static base(attrs) {
  58172. return new Base(attrs);
  58173. }
  58174. static batchOutput(attrs) {
  58175. return new BatchOutput(attrs);
  58176. }
  58177. static behaviorOverride(attrs) {
  58178. return new BehaviorOverride(attrs);
  58179. }
  58180. static cache(attrs) {
  58181. return new Cache(attrs);
  58182. }
  58183. static change(attrs) {
  58184. return new Change(attrs);
  58185. }
  58186. static common(attrs) {
  58187. return new Common(attrs);
  58188. }
  58189. static compress(attrs) {
  58190. return new Compress(attrs);
  58191. }
  58192. static compressLogicalStructure(attrs) {
  58193. return new CompressLogicalStructure(attrs);
  58194. }
  58195. static compressObjectStream(attrs) {
  58196. return new CompressObjectStream(attrs);
  58197. }
  58198. static compression(attrs) {
  58199. return new Compression(attrs);
  58200. }
  58201. static config(attrs) {
  58202. return new Config(attrs);
  58203. }
  58204. static conformance(attrs) {
  58205. return new Conformance(attrs);
  58206. }
  58207. static contentCopy(attrs) {
  58208. return new ContentCopy(attrs);
  58209. }
  58210. static copies(attrs) {
  58211. return new Copies(attrs);
  58212. }
  58213. static creator(attrs) {
  58214. return new Creator(attrs);
  58215. }
  58216. static currentPage(attrs) {
  58217. return new CurrentPage(attrs);
  58218. }
  58219. static data(attrs) {
  58220. return new Data(attrs);
  58221. }
  58222. static debug(attrs) {
  58223. return new Debug(attrs);
  58224. }
  58225. static defaultTypeface(attrs) {
  58226. return new DefaultTypeface(attrs);
  58227. }
  58228. static destination(attrs) {
  58229. return new Destination(attrs);
  58230. }
  58231. static documentAssembly(attrs) {
  58232. return new DocumentAssembly(attrs);
  58233. }
  58234. static driver(attrs) {
  58235. return new Driver(attrs);
  58236. }
  58237. static duplexOption(attrs) {
  58238. return new DuplexOption(attrs);
  58239. }
  58240. static dynamicRender(attrs) {
  58241. return new DynamicRender(attrs);
  58242. }
  58243. static embed(attrs) {
  58244. return new Embed(attrs);
  58245. }
  58246. static encrypt(attrs) {
  58247. return new Encrypt(attrs);
  58248. }
  58249. static encryption(attrs) {
  58250. return new Encryption(attrs);
  58251. }
  58252. static encryptionLevel(attrs) {
  58253. return new EncryptionLevel(attrs);
  58254. }
  58255. static enforce(attrs) {
  58256. return new Enforce(attrs);
  58257. }
  58258. static equate(attrs) {
  58259. return new Equate(attrs);
  58260. }
  58261. static equateRange(attrs) {
  58262. return new EquateRange(attrs);
  58263. }
  58264. static exclude(attrs) {
  58265. return new Exclude(attrs);
  58266. }
  58267. static excludeNS(attrs) {
  58268. return new ExcludeNS(attrs);
  58269. }
  58270. static flipLabel(attrs) {
  58271. return new FlipLabel(attrs);
  58272. }
  58273. static fontInfo(attrs) {
  58274. return new FontInfo(attrs);
  58275. }
  58276. static formFieldFilling(attrs) {
  58277. return new FormFieldFilling(attrs);
  58278. }
  58279. static groupParent(attrs) {
  58280. return new GroupParent(attrs);
  58281. }
  58282. static ifEmpty(attrs) {
  58283. return new IfEmpty(attrs);
  58284. }
  58285. static includeXDPContent(attrs) {
  58286. return new IncludeXDPContent(attrs);
  58287. }
  58288. static incrementalLoad(attrs) {
  58289. return new IncrementalLoad(attrs);
  58290. }
  58291. static incrementalMerge(attrs) {
  58292. return new IncrementalMerge(attrs);
  58293. }
  58294. static interactive(attrs) {
  58295. return new Interactive(attrs);
  58296. }
  58297. static jog(attrs) {
  58298. return new Jog(attrs);
  58299. }
  58300. static labelPrinter(attrs) {
  58301. return new LabelPrinter(attrs);
  58302. }
  58303. static layout(attrs) {
  58304. return new Layout(attrs);
  58305. }
  58306. static level(attrs) {
  58307. return new Level(attrs);
  58308. }
  58309. static linearized(attrs) {
  58310. return new Linearized(attrs);
  58311. }
  58312. static locale(attrs) {
  58313. return new Locale(attrs);
  58314. }
  58315. static localeSet(attrs) {
  58316. return new LocaleSet(attrs);
  58317. }
  58318. static log(attrs) {
  58319. return new Log(attrs);
  58320. }
  58321. static map(attrs) {
  58322. return new MapElement(attrs);
  58323. }
  58324. static mediumInfo(attrs) {
  58325. return new MediumInfo(attrs);
  58326. }
  58327. static message(attrs) {
  58328. return new Message(attrs);
  58329. }
  58330. static messaging(attrs) {
  58331. return new Messaging(attrs);
  58332. }
  58333. static mode(attrs) {
  58334. return new Mode(attrs);
  58335. }
  58336. static modifyAnnots(attrs) {
  58337. return new ModifyAnnots(attrs);
  58338. }
  58339. static msgId(attrs) {
  58340. return new MsgId(attrs);
  58341. }
  58342. static nameAttr(attrs) {
  58343. return new NameAttr(attrs);
  58344. }
  58345. static neverEmbed(attrs) {
  58346. return new NeverEmbed(attrs);
  58347. }
  58348. static numberOfCopies(attrs) {
  58349. return new NumberOfCopies(attrs);
  58350. }
  58351. static openAction(attrs) {
  58352. return new OpenAction(attrs);
  58353. }
  58354. static output(attrs) {
  58355. return new Output(attrs);
  58356. }
  58357. static outputBin(attrs) {
  58358. return new OutputBin(attrs);
  58359. }
  58360. static outputXSL(attrs) {
  58361. return new OutputXSL(attrs);
  58362. }
  58363. static overprint(attrs) {
  58364. return new Overprint(attrs);
  58365. }
  58366. static packets(attrs) {
  58367. return new Packets(attrs);
  58368. }
  58369. static pageOffset(attrs) {
  58370. return new PageOffset(attrs);
  58371. }
  58372. static pageRange(attrs) {
  58373. return new PageRange(attrs);
  58374. }
  58375. static pagination(attrs) {
  58376. return new Pagination(attrs);
  58377. }
  58378. static paginationOverride(attrs) {
  58379. return new PaginationOverride(attrs);
  58380. }
  58381. static part(attrs) {
  58382. return new Part(attrs);
  58383. }
  58384. static pcl(attrs) {
  58385. return new Pcl(attrs);
  58386. }
  58387. static pdf(attrs) {
  58388. return new Pdf(attrs);
  58389. }
  58390. static pdfa(attrs) {
  58391. return new Pdfa(attrs);
  58392. }
  58393. static permissions(attrs) {
  58394. return new Permissions(attrs);
  58395. }
  58396. static pickTrayByPDFSize(attrs) {
  58397. return new PickTrayByPDFSize(attrs);
  58398. }
  58399. static picture(attrs) {
  58400. return new Picture(attrs);
  58401. }
  58402. static plaintextMetadata(attrs) {
  58403. return new PlaintextMetadata(attrs);
  58404. }
  58405. static presence(attrs) {
  58406. return new Presence(attrs);
  58407. }
  58408. static present(attrs) {
  58409. return new Present(attrs);
  58410. }
  58411. static print(attrs) {
  58412. return new Print(attrs);
  58413. }
  58414. static printHighQuality(attrs) {
  58415. return new PrintHighQuality(attrs);
  58416. }
  58417. static printScaling(attrs) {
  58418. return new PrintScaling(attrs);
  58419. }
  58420. static printerName(attrs) {
  58421. return new PrinterName(attrs);
  58422. }
  58423. static producer(attrs) {
  58424. return new Producer(attrs);
  58425. }
  58426. static ps(attrs) {
  58427. return new Ps(attrs);
  58428. }
  58429. static range(attrs) {
  58430. return new Range(attrs);
  58431. }
  58432. static record(attrs) {
  58433. return new Record(attrs);
  58434. }
  58435. static relevant(attrs) {
  58436. return new Relevant(attrs);
  58437. }
  58438. static rename(attrs) {
  58439. return new Rename(attrs);
  58440. }
  58441. static renderPolicy(attrs) {
  58442. return new RenderPolicy(attrs);
  58443. }
  58444. static runScripts(attrs) {
  58445. return new RunScripts(attrs);
  58446. }
  58447. static script(attrs) {
  58448. return new Script(attrs);
  58449. }
  58450. static scriptModel(attrs) {
  58451. return new ScriptModel(attrs);
  58452. }
  58453. static severity(attrs) {
  58454. return new Severity(attrs);
  58455. }
  58456. static silentPrint(attrs) {
  58457. return new SilentPrint(attrs);
  58458. }
  58459. static staple(attrs) {
  58460. return new Staple(attrs);
  58461. }
  58462. static startNode(attrs) {
  58463. return new StartNode(attrs);
  58464. }
  58465. static startPage(attrs) {
  58466. return new StartPage(attrs);
  58467. }
  58468. static submitFormat(attrs) {
  58469. return new SubmitFormat(attrs);
  58470. }
  58471. static submitUrl(attrs) {
  58472. return new SubmitUrl(attrs);
  58473. }
  58474. static subsetBelow(attrs) {
  58475. return new SubsetBelow(attrs);
  58476. }
  58477. static suppressBanner(attrs) {
  58478. return new SuppressBanner(attrs);
  58479. }
  58480. static tagged(attrs) {
  58481. return new Tagged(attrs);
  58482. }
  58483. static template(attrs) {
  58484. return new Template(attrs);
  58485. }
  58486. static templateCache(attrs) {
  58487. return new TemplateCache(attrs);
  58488. }
  58489. static threshold(attrs) {
  58490. return new Threshold(attrs);
  58491. }
  58492. static to(attrs) {
  58493. return new To(attrs);
  58494. }
  58495. static trace(attrs) {
  58496. return new Trace(attrs);
  58497. }
  58498. static transform(attrs) {
  58499. return new Transform(attrs);
  58500. }
  58501. static type(attrs) {
  58502. return new Type(attrs);
  58503. }
  58504. static uri(attrs) {
  58505. return new Uri(attrs);
  58506. }
  58507. static validate(attrs) {
  58508. return new Validate(attrs);
  58509. }
  58510. static validateApprovalSignatures(attrs) {
  58511. return new ValidateApprovalSignatures(attrs);
  58512. }
  58513. static validationMessaging(attrs) {
  58514. return new ValidationMessaging(attrs);
  58515. }
  58516. static version(attrs) {
  58517. return new Version(attrs);
  58518. }
  58519. static versionControl(attrs) {
  58520. return new VersionControl(attrs);
  58521. }
  58522. static viewerPreferences(attrs) {
  58523. return new ViewerPreferences(attrs);
  58524. }
  58525. static webClient(attrs) {
  58526. return new WebClient(attrs);
  58527. }
  58528. static whitespace(attrs) {
  58529. return new Whitespace(attrs);
  58530. }
  58531. static window(attrs) {
  58532. return new Window(attrs);
  58533. }
  58534. static xdc(attrs) {
  58535. return new Xdc(attrs);
  58536. }
  58537. static xdp(attrs) {
  58538. return new Xdp(attrs);
  58539. }
  58540. static xsl(attrs) {
  58541. return new Xsl(attrs);
  58542. }
  58543. static zpl(attrs) {
  58544. return new Zpl(attrs);
  58545. }
  58546. }
  58547. exports.ConfigNamespace = ConfigNamespace;
  58548. /***/ }),
  58549. /* 90 */
  58550. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58551. Object.defineProperty(exports, "__esModule", ({
  58552. value: true
  58553. }));
  58554. exports.ConnectionSetNamespace = void 0;
  58555. var _namespaces = __w_pdfjs_require__(77);
  58556. var _xfa_object = __w_pdfjs_require__(75);
  58557. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  58558. class ConnectionSet extends _xfa_object.XFAObject {
  58559. constructor(attributes) {
  58560. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  58561. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  58562. this.xmlConnection = new _xfa_object.XFAObjectArray();
  58563. this.xsdConnection = new _xfa_object.XFAObjectArray();
  58564. }
  58565. }
  58566. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  58567. constructor(attributes) {
  58568. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  58569. this.id = attributes.id || "";
  58570. this.name = attributes.name || "";
  58571. this.use = attributes.use || "";
  58572. this.usehref = attributes.usehref || "";
  58573. }
  58574. }
  58575. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  58576. constructor(attributes) {
  58577. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  58578. this.id = attributes.id || "";
  58579. this.name = attributes.name || "";
  58580. this.use = attributes.use || "";
  58581. this.usehref = attributes.usehref || "";
  58582. }
  58583. }
  58584. class Operation extends _xfa_object.StringObject {
  58585. constructor(attributes) {
  58586. super(CONNECTION_SET_NS_ID, "operation");
  58587. this.id = attributes.id || "";
  58588. this.input = attributes.input || "";
  58589. this.name = attributes.name || "";
  58590. this.output = attributes.output || "";
  58591. this.use = attributes.use || "";
  58592. this.usehref = attributes.usehref || "";
  58593. }
  58594. }
  58595. class RootElement extends _xfa_object.StringObject {
  58596. constructor(attributes) {
  58597. super(CONNECTION_SET_NS_ID, "rootElement");
  58598. this.id = attributes.id || "";
  58599. this.name = attributes.name || "";
  58600. this.use = attributes.use || "";
  58601. this.usehref = attributes.usehref || "";
  58602. }
  58603. }
  58604. class SoapAction extends _xfa_object.StringObject {
  58605. constructor(attributes) {
  58606. super(CONNECTION_SET_NS_ID, "soapAction");
  58607. this.id = attributes.id || "";
  58608. this.name = attributes.name || "";
  58609. this.use = attributes.use || "";
  58610. this.usehref = attributes.usehref || "";
  58611. }
  58612. }
  58613. class SoapAddress extends _xfa_object.StringObject {
  58614. constructor(attributes) {
  58615. super(CONNECTION_SET_NS_ID, "soapAddress");
  58616. this.id = attributes.id || "";
  58617. this.name = attributes.name || "";
  58618. this.use = attributes.use || "";
  58619. this.usehref = attributes.usehref || "";
  58620. }
  58621. }
  58622. class Uri extends _xfa_object.StringObject {
  58623. constructor(attributes) {
  58624. super(CONNECTION_SET_NS_ID, "uri");
  58625. this.id = attributes.id || "";
  58626. this.name = attributes.name || "";
  58627. this.use = attributes.use || "";
  58628. this.usehref = attributes.usehref || "";
  58629. }
  58630. }
  58631. class WsdlAddress extends _xfa_object.StringObject {
  58632. constructor(attributes) {
  58633. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  58634. this.id = attributes.id || "";
  58635. this.name = attributes.name || "";
  58636. this.use = attributes.use || "";
  58637. this.usehref = attributes.usehref || "";
  58638. }
  58639. }
  58640. class WsdlConnection extends _xfa_object.XFAObject {
  58641. constructor(attributes) {
  58642. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  58643. this.dataDescription = attributes.dataDescription || "";
  58644. this.name = attributes.name || "";
  58645. this.effectiveInputPolicy = null;
  58646. this.effectiveOutputPolicy = null;
  58647. this.operation = null;
  58648. this.soapAction = null;
  58649. this.soapAddress = null;
  58650. this.wsdlAddress = null;
  58651. }
  58652. }
  58653. class XmlConnection extends _xfa_object.XFAObject {
  58654. constructor(attributes) {
  58655. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  58656. this.dataDescription = attributes.dataDescription || "";
  58657. this.name = attributes.name || "";
  58658. this.uri = null;
  58659. }
  58660. }
  58661. class XsdConnection extends _xfa_object.XFAObject {
  58662. constructor(attributes) {
  58663. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  58664. this.dataDescription = attributes.dataDescription || "";
  58665. this.name = attributes.name || "";
  58666. this.rootElement = null;
  58667. this.uri = null;
  58668. }
  58669. }
  58670. class ConnectionSetNamespace {
  58671. static [_namespaces.$buildXFAObject](name, attributes) {
  58672. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  58673. return ConnectionSetNamespace[name](attributes);
  58674. }
  58675. return undefined;
  58676. }
  58677. static connectionSet(attrs) {
  58678. return new ConnectionSet(attrs);
  58679. }
  58680. static effectiveInputPolicy(attrs) {
  58681. return new EffectiveInputPolicy(attrs);
  58682. }
  58683. static effectiveOutputPolicy(attrs) {
  58684. return new EffectiveOutputPolicy(attrs);
  58685. }
  58686. static operation(attrs) {
  58687. return new Operation(attrs);
  58688. }
  58689. static rootElement(attrs) {
  58690. return new RootElement(attrs);
  58691. }
  58692. static soapAction(attrs) {
  58693. return new SoapAction(attrs);
  58694. }
  58695. static soapAddress(attrs) {
  58696. return new SoapAddress(attrs);
  58697. }
  58698. static uri(attrs) {
  58699. return new Uri(attrs);
  58700. }
  58701. static wsdlAddress(attrs) {
  58702. return new WsdlAddress(attrs);
  58703. }
  58704. static wsdlConnection(attrs) {
  58705. return new WsdlConnection(attrs);
  58706. }
  58707. static xmlConnection(attrs) {
  58708. return new XmlConnection(attrs);
  58709. }
  58710. static xsdConnection(attrs) {
  58711. return new XsdConnection(attrs);
  58712. }
  58713. }
  58714. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  58715. /***/ }),
  58716. /* 91 */
  58717. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58718. Object.defineProperty(exports, "__esModule", ({
  58719. value: true
  58720. }));
  58721. exports.DatasetsNamespace = void 0;
  58722. var _xfa_object = __w_pdfjs_require__(75);
  58723. var _namespaces = __w_pdfjs_require__(77);
  58724. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  58725. class Data extends _xfa_object.XmlObject {
  58726. constructor(attributes) {
  58727. super(DATASETS_NS_ID, "data", attributes);
  58728. }
  58729. [_xfa_object.$isNsAgnostic]() {
  58730. return true;
  58731. }
  58732. }
  58733. class Datasets extends _xfa_object.XFAObject {
  58734. constructor(attributes) {
  58735. super(DATASETS_NS_ID, "datasets", true);
  58736. this.data = null;
  58737. this.Signature = null;
  58738. }
  58739. [_xfa_object.$onChild](child) {
  58740. const name = child[_xfa_object.$nodeName];
  58741. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  58742. this[name] = child;
  58743. }
  58744. this[_xfa_object.$appendChild](child);
  58745. }
  58746. }
  58747. class DatasetsNamespace {
  58748. static [_namespaces.$buildXFAObject](name, attributes) {
  58749. if (DatasetsNamespace.hasOwnProperty(name)) {
  58750. return DatasetsNamespace[name](attributes);
  58751. }
  58752. return undefined;
  58753. }
  58754. static datasets(attributes) {
  58755. return new Datasets(attributes);
  58756. }
  58757. static data(attributes) {
  58758. return new Data(attributes);
  58759. }
  58760. }
  58761. exports.DatasetsNamespace = DatasetsNamespace;
  58762. /***/ }),
  58763. /* 92 */
  58764. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58765. Object.defineProperty(exports, "__esModule", ({
  58766. value: true
  58767. }));
  58768. exports.LocaleSetNamespace = void 0;
  58769. var _namespaces = __w_pdfjs_require__(77);
  58770. var _xfa_object = __w_pdfjs_require__(75);
  58771. var _utils = __w_pdfjs_require__(76);
  58772. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  58773. class CalendarSymbols extends _xfa_object.XFAObject {
  58774. constructor(attributes) {
  58775. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  58776. this.name = "gregorian";
  58777. this.dayNames = new _xfa_object.XFAObjectArray(2);
  58778. this.eraNames = null;
  58779. this.meridiemNames = null;
  58780. this.monthNames = new _xfa_object.XFAObjectArray(2);
  58781. }
  58782. }
  58783. class CurrencySymbol extends _xfa_object.StringObject {
  58784. constructor(attributes) {
  58785. super(LOCALE_SET_NS_ID, "currencySymbol");
  58786. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  58787. }
  58788. }
  58789. class CurrencySymbols extends _xfa_object.XFAObject {
  58790. constructor(attributes) {
  58791. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  58792. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  58793. }
  58794. }
  58795. class DatePattern extends _xfa_object.StringObject {
  58796. constructor(attributes) {
  58797. super(LOCALE_SET_NS_ID, "datePattern");
  58798. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  58799. }
  58800. }
  58801. class DatePatterns extends _xfa_object.XFAObject {
  58802. constructor(attributes) {
  58803. super(LOCALE_SET_NS_ID, "datePatterns", true);
  58804. this.datePattern = new _xfa_object.XFAObjectArray(4);
  58805. }
  58806. }
  58807. class DateTimeSymbols extends _xfa_object.ContentObject {
  58808. constructor(attributes) {
  58809. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  58810. }
  58811. }
  58812. class Day extends _xfa_object.StringObject {
  58813. constructor(attributes) {
  58814. super(LOCALE_SET_NS_ID, "day");
  58815. }
  58816. }
  58817. class DayNames extends _xfa_object.XFAObject {
  58818. constructor(attributes) {
  58819. super(LOCALE_SET_NS_ID, "dayNames", true);
  58820. this.abbr = (0, _utils.getInteger)({
  58821. data: attributes.abbr,
  58822. defaultValue: 0,
  58823. validate: x => x === 1
  58824. });
  58825. this.day = new _xfa_object.XFAObjectArray(7);
  58826. }
  58827. }
  58828. class Era extends _xfa_object.StringObject {
  58829. constructor(attributes) {
  58830. super(LOCALE_SET_NS_ID, "era");
  58831. }
  58832. }
  58833. class EraNames extends _xfa_object.XFAObject {
  58834. constructor(attributes) {
  58835. super(LOCALE_SET_NS_ID, "eraNames", true);
  58836. this.era = new _xfa_object.XFAObjectArray(2);
  58837. }
  58838. }
  58839. class Locale extends _xfa_object.XFAObject {
  58840. constructor(attributes) {
  58841. super(LOCALE_SET_NS_ID, "locale", true);
  58842. this.desc = attributes.desc || "";
  58843. this.name = "isoname";
  58844. this.calendarSymbols = null;
  58845. this.currencySymbols = null;
  58846. this.datePatterns = null;
  58847. this.dateTimeSymbols = null;
  58848. this.numberPatterns = null;
  58849. this.numberSymbols = null;
  58850. this.timePatterns = null;
  58851. this.typeFaces = null;
  58852. }
  58853. }
  58854. class LocaleSet extends _xfa_object.XFAObject {
  58855. constructor(attributes) {
  58856. super(LOCALE_SET_NS_ID, "localeSet", true);
  58857. this.locale = new _xfa_object.XFAObjectArray();
  58858. }
  58859. }
  58860. class Meridiem extends _xfa_object.StringObject {
  58861. constructor(attributes) {
  58862. super(LOCALE_SET_NS_ID, "meridiem");
  58863. }
  58864. }
  58865. class MeridiemNames extends _xfa_object.XFAObject {
  58866. constructor(attributes) {
  58867. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  58868. this.meridiem = new _xfa_object.XFAObjectArray(2);
  58869. }
  58870. }
  58871. class Month extends _xfa_object.StringObject {
  58872. constructor(attributes) {
  58873. super(LOCALE_SET_NS_ID, "month");
  58874. }
  58875. }
  58876. class MonthNames extends _xfa_object.XFAObject {
  58877. constructor(attributes) {
  58878. super(LOCALE_SET_NS_ID, "monthNames", true);
  58879. this.abbr = (0, _utils.getInteger)({
  58880. data: attributes.abbr,
  58881. defaultValue: 0,
  58882. validate: x => x === 1
  58883. });
  58884. this.month = new _xfa_object.XFAObjectArray(12);
  58885. }
  58886. }
  58887. class NumberPattern extends _xfa_object.StringObject {
  58888. constructor(attributes) {
  58889. super(LOCALE_SET_NS_ID, "numberPattern");
  58890. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  58891. }
  58892. }
  58893. class NumberPatterns extends _xfa_object.XFAObject {
  58894. constructor(attributes) {
  58895. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  58896. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  58897. }
  58898. }
  58899. class NumberSymbol extends _xfa_object.StringObject {
  58900. constructor(attributes) {
  58901. super(LOCALE_SET_NS_ID, "numberSymbol");
  58902. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  58903. }
  58904. }
  58905. class NumberSymbols extends _xfa_object.XFAObject {
  58906. constructor(attributes) {
  58907. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  58908. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  58909. }
  58910. }
  58911. class TimePattern extends _xfa_object.StringObject {
  58912. constructor(attributes) {
  58913. super(LOCALE_SET_NS_ID, "timePattern");
  58914. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  58915. }
  58916. }
  58917. class TimePatterns extends _xfa_object.XFAObject {
  58918. constructor(attributes) {
  58919. super(LOCALE_SET_NS_ID, "timePatterns", true);
  58920. this.timePattern = new _xfa_object.XFAObjectArray(4);
  58921. }
  58922. }
  58923. class TypeFace extends _xfa_object.XFAObject {
  58924. constructor(attributes) {
  58925. super(LOCALE_SET_NS_ID, "typeFace", true);
  58926. this.name = attributes.name | "";
  58927. }
  58928. }
  58929. class TypeFaces extends _xfa_object.XFAObject {
  58930. constructor(attributes) {
  58931. super(LOCALE_SET_NS_ID, "typeFaces", true);
  58932. this.typeFace = new _xfa_object.XFAObjectArray();
  58933. }
  58934. }
  58935. class LocaleSetNamespace {
  58936. static [_namespaces.$buildXFAObject](name, attributes) {
  58937. if (LocaleSetNamespace.hasOwnProperty(name)) {
  58938. return LocaleSetNamespace[name](attributes);
  58939. }
  58940. return undefined;
  58941. }
  58942. static calendarSymbols(attrs) {
  58943. return new CalendarSymbols(attrs);
  58944. }
  58945. static currencySymbol(attrs) {
  58946. return new CurrencySymbol(attrs);
  58947. }
  58948. static currencySymbols(attrs) {
  58949. return new CurrencySymbols(attrs);
  58950. }
  58951. static datePattern(attrs) {
  58952. return new DatePattern(attrs);
  58953. }
  58954. static datePatterns(attrs) {
  58955. return new DatePatterns(attrs);
  58956. }
  58957. static dateTimeSymbols(attrs) {
  58958. return new DateTimeSymbols(attrs);
  58959. }
  58960. static day(attrs) {
  58961. return new Day(attrs);
  58962. }
  58963. static dayNames(attrs) {
  58964. return new DayNames(attrs);
  58965. }
  58966. static era(attrs) {
  58967. return new Era(attrs);
  58968. }
  58969. static eraNames(attrs) {
  58970. return new EraNames(attrs);
  58971. }
  58972. static locale(attrs) {
  58973. return new Locale(attrs);
  58974. }
  58975. static localeSet(attrs) {
  58976. return new LocaleSet(attrs);
  58977. }
  58978. static meridiem(attrs) {
  58979. return new Meridiem(attrs);
  58980. }
  58981. static meridiemNames(attrs) {
  58982. return new MeridiemNames(attrs);
  58983. }
  58984. static month(attrs) {
  58985. return new Month(attrs);
  58986. }
  58987. static monthNames(attrs) {
  58988. return new MonthNames(attrs);
  58989. }
  58990. static numberPattern(attrs) {
  58991. return new NumberPattern(attrs);
  58992. }
  58993. static numberPatterns(attrs) {
  58994. return new NumberPatterns(attrs);
  58995. }
  58996. static numberSymbol(attrs) {
  58997. return new NumberSymbol(attrs);
  58998. }
  58999. static numberSymbols(attrs) {
  59000. return new NumberSymbols(attrs);
  59001. }
  59002. static timePattern(attrs) {
  59003. return new TimePattern(attrs);
  59004. }
  59005. static timePatterns(attrs) {
  59006. return new TimePatterns(attrs);
  59007. }
  59008. static typeFace(attrs) {
  59009. return new TypeFace(attrs);
  59010. }
  59011. static typeFaces(attrs) {
  59012. return new TypeFaces(attrs);
  59013. }
  59014. }
  59015. exports.LocaleSetNamespace = LocaleSetNamespace;
  59016. /***/ }),
  59017. /* 93 */
  59018. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59019. Object.defineProperty(exports, "__esModule", ({
  59020. value: true
  59021. }));
  59022. exports.SignatureNamespace = void 0;
  59023. var _namespaces = __w_pdfjs_require__(77);
  59024. var _xfa_object = __w_pdfjs_require__(75);
  59025. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  59026. class Signature extends _xfa_object.XFAObject {
  59027. constructor(attributes) {
  59028. super(SIGNATURE_NS_ID, "signature", true);
  59029. }
  59030. }
  59031. class SignatureNamespace {
  59032. static [_namespaces.$buildXFAObject](name, attributes) {
  59033. if (SignatureNamespace.hasOwnProperty(name)) {
  59034. return SignatureNamespace[name](attributes);
  59035. }
  59036. return undefined;
  59037. }
  59038. static signature(attributes) {
  59039. return new Signature(attributes);
  59040. }
  59041. }
  59042. exports.SignatureNamespace = SignatureNamespace;
  59043. /***/ }),
  59044. /* 94 */
  59045. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59046. Object.defineProperty(exports, "__esModule", ({
  59047. value: true
  59048. }));
  59049. exports.StylesheetNamespace = void 0;
  59050. var _namespaces = __w_pdfjs_require__(77);
  59051. var _xfa_object = __w_pdfjs_require__(75);
  59052. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  59053. class Stylesheet extends _xfa_object.XFAObject {
  59054. constructor(attributes) {
  59055. super(STYLESHEET_NS_ID, "stylesheet", true);
  59056. }
  59057. }
  59058. class StylesheetNamespace {
  59059. static [_namespaces.$buildXFAObject](name, attributes) {
  59060. if (StylesheetNamespace.hasOwnProperty(name)) {
  59061. return StylesheetNamespace[name](attributes);
  59062. }
  59063. return undefined;
  59064. }
  59065. static stylesheet(attributes) {
  59066. return new Stylesheet(attributes);
  59067. }
  59068. }
  59069. exports.StylesheetNamespace = StylesheetNamespace;
  59070. /***/ }),
  59071. /* 95 */
  59072. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59073. Object.defineProperty(exports, "__esModule", ({
  59074. value: true
  59075. }));
  59076. exports.XdpNamespace = void 0;
  59077. var _namespaces = __w_pdfjs_require__(77);
  59078. var _xfa_object = __w_pdfjs_require__(75);
  59079. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  59080. class Xdp extends _xfa_object.XFAObject {
  59081. constructor(attributes) {
  59082. super(XDP_NS_ID, "xdp", true);
  59083. this.uuid = attributes.uuid || "";
  59084. this.timeStamp = attributes.timeStamp || "";
  59085. this.config = null;
  59086. this.connectionSet = null;
  59087. this.datasets = null;
  59088. this.localeSet = null;
  59089. this.stylesheet = new _xfa_object.XFAObjectArray();
  59090. this.template = null;
  59091. }
  59092. [_xfa_object.$onChildCheck](child) {
  59093. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  59094. return ns && child[_xfa_object.$namespaceId] === ns.id;
  59095. }
  59096. }
  59097. class XdpNamespace {
  59098. static [_namespaces.$buildXFAObject](name, attributes) {
  59099. if (XdpNamespace.hasOwnProperty(name)) {
  59100. return XdpNamespace[name](attributes);
  59101. }
  59102. return undefined;
  59103. }
  59104. static xdp(attributes) {
  59105. return new Xdp(attributes);
  59106. }
  59107. }
  59108. exports.XdpNamespace = XdpNamespace;
  59109. /***/ }),
  59110. /* 96 */
  59111. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59112. Object.defineProperty(exports, "__esModule", ({
  59113. value: true
  59114. }));
  59115. exports.XhtmlNamespace = void 0;
  59116. var _xfa_object = __w_pdfjs_require__(75);
  59117. var _namespaces = __w_pdfjs_require__(77);
  59118. var _html_utils = __w_pdfjs_require__(82);
  59119. var _utils = __w_pdfjs_require__(76);
  59120. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  59121. 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"]);
  59122. 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) => {
  59123. value = original.fontSize = (0, _utils.getMeasurement)(value);
  59124. return (0, _html_utils.measureToString)(0.99 * value);
  59125. }], ["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]]);
  59126. const spacesRegExp = /\s+/g;
  59127. const crlfRegExp = /[\r\n]+/g;
  59128. function mapStyle(styleStr, fontFinder) {
  59129. const style = Object.create(null);
  59130. if (!styleStr) {
  59131. return style;
  59132. }
  59133. const original = Object.create(null);
  59134. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  59135. const mapping = StyleMapping.get(key);
  59136. if (mapping === "") {
  59137. continue;
  59138. }
  59139. let newValue = value;
  59140. if (mapping) {
  59141. if (typeof mapping === "string") {
  59142. newValue = mapping;
  59143. } else {
  59144. newValue = mapping(value, original);
  59145. }
  59146. }
  59147. if (key.endsWith("scale")) {
  59148. if (style.transform) {
  59149. style.transform = `${style[key]} ${newValue}`;
  59150. } else {
  59151. style.transform = newValue;
  59152. }
  59153. } else {
  59154. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  59155. }
  59156. }
  59157. if (style.fontFamily) {
  59158. (0, _html_utils.setFontFamily)({
  59159. typeface: style.fontFamily,
  59160. weight: style.fontWeight || "normal",
  59161. posture: style.fontStyle || "normal",
  59162. size: original.fontSize || 0
  59163. }, fontFinder, style);
  59164. }
  59165. (0, _html_utils.fixTextIndent)(style);
  59166. return style;
  59167. }
  59168. function checkStyle(node) {
  59169. if (!node.style) {
  59170. return "";
  59171. }
  59172. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  59173. if (key === "font-family") {
  59174. node[_xfa_object.$globalData].usedTypefaces.add(value);
  59175. }
  59176. return VALID_STYLES.has(key);
  59177. }).map(kv => kv.join(":")).join(";");
  59178. }
  59179. const NoWhites = new Set(["body", "html"]);
  59180. class XhtmlObject extends _xfa_object.XmlObject {
  59181. constructor(attributes, name) {
  59182. super(XHTML_NS_ID, name);
  59183. this.style = attributes.style || "";
  59184. }
  59185. [_xfa_object.$clean](builder) {
  59186. super[_xfa_object.$clean](builder);
  59187. this.style = checkStyle(this);
  59188. }
  59189. [_xfa_object.$acceptWhitespace]() {
  59190. return !NoWhites.has(this[_xfa_object.$nodeName]);
  59191. }
  59192. [_xfa_object.$onText](str) {
  59193. str = str.replace(crlfRegExp, "");
  59194. if (!this.style.includes("xfa-spacerun:yes")) {
  59195. str = str.replace(spacesRegExp, " ");
  59196. }
  59197. if (str) {
  59198. this[_xfa_object.$content] += str;
  59199. }
  59200. }
  59201. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  59202. const xfaFont = Object.create(null);
  59203. const margin = {
  59204. top: NaN,
  59205. bottom: NaN,
  59206. left: NaN,
  59207. right: NaN
  59208. };
  59209. let lineHeight = null;
  59210. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  59211. switch (key) {
  59212. case "font-family":
  59213. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  59214. break;
  59215. case "font-size":
  59216. xfaFont.size = (0, _utils.getMeasurement)(value);
  59217. break;
  59218. case "font-weight":
  59219. xfaFont.weight = value;
  59220. break;
  59221. case "font-style":
  59222. xfaFont.posture = value;
  59223. break;
  59224. case "letter-spacing":
  59225. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  59226. break;
  59227. case "margin":
  59228. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  59229. switch (values.length) {
  59230. case 1:
  59231. margin.top = margin.bottom = margin.left = margin.right = values[0];
  59232. break;
  59233. case 2:
  59234. margin.top = margin.bottom = values[0];
  59235. margin.left = margin.right = values[1];
  59236. break;
  59237. case 3:
  59238. margin.top = values[0];
  59239. margin.bottom = values[2];
  59240. margin.left = margin.right = values[1];
  59241. break;
  59242. case 4:
  59243. margin.top = values[0];
  59244. margin.left = values[1];
  59245. margin.bottom = values[2];
  59246. margin.right = values[3];
  59247. break;
  59248. }
  59249. break;
  59250. case "margin-top":
  59251. margin.top = (0, _utils.getMeasurement)(value);
  59252. break;
  59253. case "margin-bottom":
  59254. margin.bottom = (0, _utils.getMeasurement)(value);
  59255. break;
  59256. case "margin-left":
  59257. margin.left = (0, _utils.getMeasurement)(value);
  59258. break;
  59259. case "margin-right":
  59260. margin.right = (0, _utils.getMeasurement)(value);
  59261. break;
  59262. case "line-height":
  59263. lineHeight = (0, _utils.getMeasurement)(value);
  59264. break;
  59265. }
  59266. }
  59267. measure.pushData(xfaFont, margin, lineHeight);
  59268. if (this[_xfa_object.$content]) {
  59269. measure.addString(this[_xfa_object.$content]);
  59270. } else {
  59271. for (const child of this[_xfa_object.$getChildren]()) {
  59272. if (child[_xfa_object.$nodeName] === "#text") {
  59273. measure.addString(child[_xfa_object.$content]);
  59274. continue;
  59275. }
  59276. child[_xfa_object.$pushGlyphs](measure);
  59277. }
  59278. }
  59279. if (mustPop) {
  59280. measure.popFont();
  59281. }
  59282. }
  59283. [_xfa_object.$toHTML](availableSpace) {
  59284. const children = [];
  59285. this[_xfa_object.$extra] = {
  59286. children
  59287. };
  59288. this[_xfa_object.$childrenToHTML]({});
  59289. if (children.length === 0 && !this[_xfa_object.$content]) {
  59290. return _utils.HTMLResult.EMPTY;
  59291. }
  59292. return _utils.HTMLResult.success({
  59293. name: this[_xfa_object.$nodeName],
  59294. attributes: {
  59295. href: this.href,
  59296. style: mapStyle(this.style, this[_xfa_object.$globalData].fontFinder)
  59297. },
  59298. children,
  59299. value: this[_xfa_object.$content] || ""
  59300. });
  59301. }
  59302. }
  59303. class A extends XhtmlObject {
  59304. constructor(attributes) {
  59305. super(attributes, "a");
  59306. this.href = attributes.href || "";
  59307. }
  59308. }
  59309. class B extends XhtmlObject {
  59310. constructor(attributes) {
  59311. super(attributes, "b");
  59312. }
  59313. [_xfa_object.$pushGlyphs](measure) {
  59314. measure.pushFont({
  59315. weight: "bold"
  59316. });
  59317. super[_xfa_object.$pushGlyphs](measure);
  59318. measure.popFont();
  59319. }
  59320. }
  59321. class Body extends XhtmlObject {
  59322. constructor(attributes) {
  59323. super(attributes, "body");
  59324. }
  59325. [_xfa_object.$toHTML](availableSpace) {
  59326. const res = super[_xfa_object.$toHTML](availableSpace);
  59327. const {
  59328. html
  59329. } = res;
  59330. if (!html) {
  59331. return _utils.HTMLResult.EMPTY;
  59332. }
  59333. html.name = "div";
  59334. html.attributes.class = ["xfaRich"];
  59335. return res;
  59336. }
  59337. }
  59338. class Br extends XhtmlObject {
  59339. constructor(attributes) {
  59340. super(attributes, "br");
  59341. }
  59342. [_xfa_object.$text]() {
  59343. return "\n";
  59344. }
  59345. [_xfa_object.$pushGlyphs](measure) {
  59346. measure.addString("\n");
  59347. }
  59348. [_xfa_object.$toHTML](availableSpace) {
  59349. return _utils.HTMLResult.success({
  59350. name: "br"
  59351. });
  59352. }
  59353. }
  59354. class Html extends XhtmlObject {
  59355. constructor(attributes) {
  59356. super(attributes, "html");
  59357. }
  59358. [_xfa_object.$toHTML](availableSpace) {
  59359. const children = [];
  59360. this[_xfa_object.$extra] = {
  59361. children
  59362. };
  59363. this[_xfa_object.$childrenToHTML]({});
  59364. if (children.length === 0) {
  59365. return _utils.HTMLResult.success({
  59366. name: "div",
  59367. attributes: {
  59368. class: ["xfaRich"],
  59369. style: {}
  59370. },
  59371. value: this[_xfa_object.$content] || ""
  59372. });
  59373. }
  59374. if (children.length === 1) {
  59375. const child = children[0];
  59376. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  59377. return _utils.HTMLResult.success(child);
  59378. }
  59379. }
  59380. return _utils.HTMLResult.success({
  59381. name: "div",
  59382. attributes: {
  59383. class: ["xfaRich"],
  59384. style: {}
  59385. },
  59386. children
  59387. });
  59388. }
  59389. }
  59390. class I extends XhtmlObject {
  59391. constructor(attributes) {
  59392. super(attributes, "i");
  59393. }
  59394. [_xfa_object.$pushGlyphs](measure) {
  59395. measure.pushFont({
  59396. posture: "italic"
  59397. });
  59398. super[_xfa_object.$pushGlyphs](measure);
  59399. measure.popFont();
  59400. }
  59401. }
  59402. class Li extends XhtmlObject {
  59403. constructor(attributes) {
  59404. super(attributes, "li");
  59405. }
  59406. }
  59407. class Ol extends XhtmlObject {
  59408. constructor(attributes) {
  59409. super(attributes, "ol");
  59410. }
  59411. }
  59412. class P extends XhtmlObject {
  59413. constructor(attributes) {
  59414. super(attributes, "p");
  59415. }
  59416. [_xfa_object.$pushGlyphs](measure) {
  59417. super[_xfa_object.$pushGlyphs](measure, false);
  59418. measure.addString("\n");
  59419. measure.addPara();
  59420. measure.popFont();
  59421. }
  59422. [_xfa_object.$text]() {
  59423. return super[_xfa_object.$text]() + "\n";
  59424. }
  59425. }
  59426. class Span extends XhtmlObject {
  59427. constructor(attributes) {
  59428. super(attributes, "span");
  59429. }
  59430. }
  59431. class Sub extends XhtmlObject {
  59432. constructor(attributes) {
  59433. super(attributes, "sub");
  59434. }
  59435. }
  59436. class Sup extends XhtmlObject {
  59437. constructor(attributes) {
  59438. super(attributes, "sup");
  59439. }
  59440. }
  59441. class Ul extends XhtmlObject {
  59442. constructor(attributes) {
  59443. super(attributes, "ul");
  59444. }
  59445. }
  59446. class XhtmlNamespace {
  59447. static [_namespaces.$buildXFAObject](name, attributes) {
  59448. if (XhtmlNamespace.hasOwnProperty(name)) {
  59449. return XhtmlNamespace[name](attributes);
  59450. }
  59451. return undefined;
  59452. }
  59453. static a(attributes) {
  59454. return new A(attributes);
  59455. }
  59456. static b(attributes) {
  59457. return new B(attributes);
  59458. }
  59459. static body(attributes) {
  59460. return new Body(attributes);
  59461. }
  59462. static br(attributes) {
  59463. return new Br(attributes);
  59464. }
  59465. static html(attributes) {
  59466. return new Html(attributes);
  59467. }
  59468. static i(attributes) {
  59469. return new I(attributes);
  59470. }
  59471. static li(attributes) {
  59472. return new Li(attributes);
  59473. }
  59474. static ol(attributes) {
  59475. return new Ol(attributes);
  59476. }
  59477. static p(attributes) {
  59478. return new P(attributes);
  59479. }
  59480. static span(attributes) {
  59481. return new Span(attributes);
  59482. }
  59483. static sub(attributes) {
  59484. return new Sub(attributes);
  59485. }
  59486. static sup(attributes) {
  59487. return new Sup(attributes);
  59488. }
  59489. static ul(attributes) {
  59490. return new Ul(attributes);
  59491. }
  59492. }
  59493. exports.XhtmlNamespace = XhtmlNamespace;
  59494. /***/ }),
  59495. /* 97 */
  59496. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59497. Object.defineProperty(exports, "__esModule", ({
  59498. value: true
  59499. }));
  59500. exports.UnknownNamespace = void 0;
  59501. var _namespaces = __w_pdfjs_require__(77);
  59502. var _xfa_object = __w_pdfjs_require__(75);
  59503. class UnknownNamespace {
  59504. constructor(nsId) {
  59505. this.namespaceId = nsId;
  59506. }
  59507. [_namespaces.$buildXFAObject](name, attributes) {
  59508. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  59509. }
  59510. }
  59511. exports.UnknownNamespace = UnknownNamespace;
  59512. /***/ }),
  59513. /* 98 */
  59514. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59515. Object.defineProperty(exports, "__esModule", ({
  59516. value: true
  59517. }));
  59518. exports.XRef = void 0;
  59519. var _util = __w_pdfjs_require__(2);
  59520. var _primitives = __w_pdfjs_require__(5);
  59521. var _parser = __w_pdfjs_require__(17);
  59522. var _core_utils = __w_pdfjs_require__(9);
  59523. var _crypto = __w_pdfjs_require__(72);
  59524. class XRef {
  59525. constructor(stream, pdfManager) {
  59526. this.stream = stream;
  59527. this.pdfManager = pdfManager;
  59528. this.entries = [];
  59529. this.xrefstms = Object.create(null);
  59530. this._cacheMap = new Map();
  59531. this.stats = {
  59532. streamTypes: Object.create(null),
  59533. fontTypes: Object.create(null)
  59534. };
  59535. this._newRefNum = null;
  59536. }
  59537. getNewRef() {
  59538. if (this._newRefNum === null) {
  59539. this._newRefNum = this.entries.length;
  59540. }
  59541. return _primitives.Ref.get(this._newRefNum++, 0);
  59542. }
  59543. resetNewRef() {
  59544. this._newRefNum = null;
  59545. }
  59546. setStartXRef(startXRef) {
  59547. this.startXRefQueue = [startXRef];
  59548. }
  59549. parse(recoveryMode = false) {
  59550. let trailerDict;
  59551. if (!recoveryMode) {
  59552. trailerDict = this.readXRef();
  59553. } else {
  59554. (0, _util.warn)("Indexing all PDF objects");
  59555. trailerDict = this.indexObjects();
  59556. }
  59557. trailerDict.assignXref(this);
  59558. this.trailer = trailerDict;
  59559. let encrypt;
  59560. try {
  59561. encrypt = trailerDict.get("Encrypt");
  59562. } catch (ex) {
  59563. if (ex instanceof _core_utils.MissingDataException) {
  59564. throw ex;
  59565. }
  59566. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  59567. }
  59568. if ((0, _primitives.isDict)(encrypt)) {
  59569. const ids = trailerDict.get("ID");
  59570. const fileId = ids && ids.length ? ids[0] : "";
  59571. encrypt.suppressEncryption = true;
  59572. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  59573. }
  59574. let root;
  59575. try {
  59576. root = trailerDict.get("Root");
  59577. } catch (ex) {
  59578. if (ex instanceof _core_utils.MissingDataException) {
  59579. throw ex;
  59580. }
  59581. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  59582. }
  59583. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  59584. this.root = root;
  59585. } else {
  59586. if (!recoveryMode) {
  59587. throw new _core_utils.XRefParseException();
  59588. }
  59589. throw new _util.FormatError("Invalid root reference");
  59590. }
  59591. }
  59592. processXRefTable(parser) {
  59593. if (!("tableState" in this)) {
  59594. this.tableState = {
  59595. entryNum: 0,
  59596. streamPos: parser.lexer.stream.pos,
  59597. parserBuf1: parser.buf1,
  59598. parserBuf2: parser.buf2
  59599. };
  59600. }
  59601. const obj = this.readXRefTable(parser);
  59602. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  59603. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  59604. }
  59605. let dict = parser.getObj();
  59606. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  59607. dict = dict.dict;
  59608. }
  59609. if (!(0, _primitives.isDict)(dict)) {
  59610. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  59611. }
  59612. delete this.tableState;
  59613. return dict;
  59614. }
  59615. readXRefTable(parser) {
  59616. const stream = parser.lexer.stream;
  59617. const tableState = this.tableState;
  59618. stream.pos = tableState.streamPos;
  59619. parser.buf1 = tableState.parserBuf1;
  59620. parser.buf2 = tableState.parserBuf2;
  59621. let obj;
  59622. while (true) {
  59623. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  59624. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  59625. break;
  59626. }
  59627. tableState.firstEntryNum = obj;
  59628. tableState.entryCount = parser.getObj();
  59629. }
  59630. let first = tableState.firstEntryNum;
  59631. const count = tableState.entryCount;
  59632. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  59633. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  59634. }
  59635. for (let i = tableState.entryNum; i < count; i++) {
  59636. tableState.streamPos = stream.pos;
  59637. tableState.entryNum = i;
  59638. tableState.parserBuf1 = parser.buf1;
  59639. tableState.parserBuf2 = parser.buf2;
  59640. const entry = {};
  59641. entry.offset = parser.getObj();
  59642. entry.gen = parser.getObj();
  59643. const type = parser.getObj();
  59644. if (type instanceof _primitives.Cmd) {
  59645. switch (type.cmd) {
  59646. case "f":
  59647. entry.free = true;
  59648. break;
  59649. case "n":
  59650. entry.uncompressed = true;
  59651. break;
  59652. }
  59653. }
  59654. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  59655. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  59656. }
  59657. if (i === 0 && entry.free && first === 1) {
  59658. first = 0;
  59659. }
  59660. if (!this.entries[i + first]) {
  59661. this.entries[i + first] = entry;
  59662. }
  59663. }
  59664. tableState.entryNum = 0;
  59665. tableState.streamPos = stream.pos;
  59666. tableState.parserBuf1 = parser.buf1;
  59667. tableState.parserBuf2 = parser.buf2;
  59668. delete tableState.firstEntryNum;
  59669. delete tableState.entryCount;
  59670. }
  59671. if (this.entries[0] && !this.entries[0].free) {
  59672. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  59673. }
  59674. return obj;
  59675. }
  59676. processXRefStream(stream) {
  59677. if (!("streamState" in this)) {
  59678. const streamParameters = stream.dict;
  59679. const byteWidths = streamParameters.get("W");
  59680. let range = streamParameters.get("Index");
  59681. if (!range) {
  59682. range = [0, streamParameters.get("Size")];
  59683. }
  59684. this.streamState = {
  59685. entryRanges: range,
  59686. byteWidths,
  59687. entryNum: 0,
  59688. streamPos: stream.pos
  59689. };
  59690. }
  59691. this.readXRefStream(stream);
  59692. delete this.streamState;
  59693. return stream.dict;
  59694. }
  59695. readXRefStream(stream) {
  59696. let i, j;
  59697. const streamState = this.streamState;
  59698. stream.pos = streamState.streamPos;
  59699. const byteWidths = streamState.byteWidths;
  59700. const typeFieldWidth = byteWidths[0];
  59701. const offsetFieldWidth = byteWidths[1];
  59702. const generationFieldWidth = byteWidths[2];
  59703. const entryRanges = streamState.entryRanges;
  59704. while (entryRanges.length > 0) {
  59705. const first = entryRanges[0];
  59706. const n = entryRanges[1];
  59707. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  59708. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  59709. }
  59710. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  59711. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  59712. }
  59713. for (i = streamState.entryNum; i < n; ++i) {
  59714. streamState.entryNum = i;
  59715. streamState.streamPos = stream.pos;
  59716. let type = 0,
  59717. offset = 0,
  59718. generation = 0;
  59719. for (j = 0; j < typeFieldWidth; ++j) {
  59720. type = type << 8 | stream.getByte();
  59721. }
  59722. if (typeFieldWidth === 0) {
  59723. type = 1;
  59724. }
  59725. for (j = 0; j < offsetFieldWidth; ++j) {
  59726. offset = offset << 8 | stream.getByte();
  59727. }
  59728. for (j = 0; j < generationFieldWidth; ++j) {
  59729. generation = generation << 8 | stream.getByte();
  59730. }
  59731. const entry = {};
  59732. entry.offset = offset;
  59733. entry.gen = generation;
  59734. switch (type) {
  59735. case 0:
  59736. entry.free = true;
  59737. break;
  59738. case 1:
  59739. entry.uncompressed = true;
  59740. break;
  59741. case 2:
  59742. break;
  59743. default:
  59744. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  59745. }
  59746. if (!this.entries[first + i]) {
  59747. this.entries[first + i] = entry;
  59748. }
  59749. }
  59750. streamState.entryNum = 0;
  59751. streamState.streamPos = stream.pos;
  59752. entryRanges.splice(0, 2);
  59753. }
  59754. }
  59755. indexObjects() {
  59756. const TAB = 0x9,
  59757. LF = 0xa,
  59758. CR = 0xd,
  59759. SPACE = 0x20;
  59760. const PERCENT = 0x25,
  59761. LT = 0x3c;
  59762. function readToken(data, offset) {
  59763. let token = "",
  59764. ch = data[offset];
  59765. while (ch !== LF && ch !== CR && ch !== LT) {
  59766. if (++offset >= data.length) {
  59767. break;
  59768. }
  59769. token += String.fromCharCode(ch);
  59770. ch = data[offset];
  59771. }
  59772. return token;
  59773. }
  59774. function skipUntil(data, offset, what) {
  59775. const length = what.length,
  59776. dataLength = data.length;
  59777. let skipped = 0;
  59778. while (offset < dataLength) {
  59779. let i = 0;
  59780. while (i < length && data[offset + i] === what[i]) {
  59781. ++i;
  59782. }
  59783. if (i >= length) {
  59784. break;
  59785. }
  59786. offset++;
  59787. skipped++;
  59788. }
  59789. return skipped;
  59790. }
  59791. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  59792. const endobjRegExp = /\bendobj[\b\s]$/;
  59793. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  59794. const CHECK_CONTENT_LENGTH = 25;
  59795. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  59796. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  59797. const objBytes = new Uint8Array([111, 98, 106]);
  59798. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  59799. this.entries.length = 0;
  59800. const stream = this.stream;
  59801. stream.pos = 0;
  59802. const buffer = stream.getBytes(),
  59803. length = buffer.length;
  59804. let position = stream.start;
  59805. const trailers = [],
  59806. xrefStms = [];
  59807. while (position < length) {
  59808. let ch = buffer[position];
  59809. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  59810. ++position;
  59811. continue;
  59812. }
  59813. if (ch === PERCENT) {
  59814. do {
  59815. ++position;
  59816. if (position >= length) {
  59817. break;
  59818. }
  59819. ch = buffer[position];
  59820. } while (ch !== LF && ch !== CR);
  59821. continue;
  59822. }
  59823. const token = readToken(buffer, position);
  59824. let m;
  59825. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  59826. position += skipUntil(buffer, position, trailerBytes);
  59827. trailers.push(position);
  59828. position += skipUntil(buffer, position, startxrefBytes);
  59829. } else if (m = objRegExp.exec(token)) {
  59830. const num = m[1] | 0,
  59831. gen = m[2] | 0;
  59832. let contentLength,
  59833. startPos = position + token.length,
  59834. updateEntries = false;
  59835. if (!this.entries[num]) {
  59836. updateEntries = true;
  59837. } else if (this.entries[num].gen === gen) {
  59838. try {
  59839. const parser = new _parser.Parser({
  59840. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  59841. });
  59842. parser.getObj();
  59843. updateEntries = true;
  59844. } catch (ex) {
  59845. if (ex instanceof _core_utils.ParserEOFException) {
  59846. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  59847. } else {
  59848. updateEntries = true;
  59849. }
  59850. }
  59851. }
  59852. if (updateEntries) {
  59853. this.entries[num] = {
  59854. offset: position - stream.start,
  59855. gen,
  59856. uncompressed: true
  59857. };
  59858. }
  59859. while (startPos < buffer.length) {
  59860. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  59861. contentLength = endPos - position;
  59862. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  59863. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  59864. if (endobjRegExp.test(tokenStr)) {
  59865. break;
  59866. } else {
  59867. const objToken = nestedObjRegExp.exec(tokenStr);
  59868. if (objToken && objToken[1]) {
  59869. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  59870. contentLength -= objToken[1].length;
  59871. break;
  59872. }
  59873. }
  59874. startPos = endPos;
  59875. }
  59876. const content = buffer.subarray(position, position + contentLength);
  59877. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  59878. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  59879. xrefStms.push(position - stream.start);
  59880. this.xrefstms[position - stream.start] = 1;
  59881. }
  59882. position += contentLength;
  59883. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  59884. trailers.push(position);
  59885. position += skipUntil(buffer, position, startxrefBytes);
  59886. } else {
  59887. position += token.length + 1;
  59888. }
  59889. }
  59890. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  59891. this.startXRefQueue.push(xrefStms[i]);
  59892. this.readXRef(true);
  59893. }
  59894. let trailerDict;
  59895. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  59896. stream.pos = trailers[i];
  59897. const parser = new _parser.Parser({
  59898. lexer: new _parser.Lexer(stream),
  59899. xref: this,
  59900. allowStreams: true,
  59901. recoveryMode: true
  59902. });
  59903. const obj = parser.getObj();
  59904. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  59905. continue;
  59906. }
  59907. const dict = parser.getObj();
  59908. if (!(0, _primitives.isDict)(dict)) {
  59909. continue;
  59910. }
  59911. try {
  59912. const rootDict = dict.get("Root");
  59913. if (!(rootDict instanceof _primitives.Dict)) {
  59914. continue;
  59915. }
  59916. const pagesDict = rootDict.get("Pages");
  59917. if (!(pagesDict instanceof _primitives.Dict)) {
  59918. continue;
  59919. }
  59920. const pagesCount = pagesDict.get("Count");
  59921. if (!Number.isInteger(pagesCount)) {
  59922. continue;
  59923. }
  59924. } catch (ex) {
  59925. continue;
  59926. }
  59927. if (dict.has("ID")) {
  59928. return dict;
  59929. }
  59930. trailerDict = dict;
  59931. }
  59932. if (trailerDict) {
  59933. return trailerDict;
  59934. }
  59935. throw new _util.InvalidPDFException("Invalid PDF structure.");
  59936. }
  59937. readXRef(recoveryMode = false) {
  59938. const stream = this.stream;
  59939. const startXRefParsedCache = new Set();
  59940. try {
  59941. while (this.startXRefQueue.length) {
  59942. const startXRef = this.startXRefQueue[0];
  59943. if (startXRefParsedCache.has(startXRef)) {
  59944. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  59945. this.startXRefQueue.shift();
  59946. continue;
  59947. }
  59948. startXRefParsedCache.add(startXRef);
  59949. stream.pos = startXRef + stream.start;
  59950. const parser = new _parser.Parser({
  59951. lexer: new _parser.Lexer(stream),
  59952. xref: this,
  59953. allowStreams: true
  59954. });
  59955. let obj = parser.getObj();
  59956. let dict;
  59957. if ((0, _primitives.isCmd)(obj, "xref")) {
  59958. dict = this.processXRefTable(parser);
  59959. if (!this.topDict) {
  59960. this.topDict = dict;
  59961. }
  59962. obj = dict.get("XRefStm");
  59963. if (Number.isInteger(obj)) {
  59964. const pos = obj;
  59965. if (!(pos in this.xrefstms)) {
  59966. this.xrefstms[pos] = 1;
  59967. this.startXRefQueue.push(pos);
  59968. }
  59969. }
  59970. } else if (Number.isInteger(obj)) {
  59971. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  59972. throw new _util.FormatError("Invalid XRef stream");
  59973. }
  59974. dict = this.processXRefStream(obj);
  59975. if (!this.topDict) {
  59976. this.topDict = dict;
  59977. }
  59978. if (!dict) {
  59979. throw new _util.FormatError("Failed to read XRef stream");
  59980. }
  59981. } else {
  59982. throw new _util.FormatError("Invalid XRef stream header");
  59983. }
  59984. obj = dict.get("Prev");
  59985. if (Number.isInteger(obj)) {
  59986. this.startXRefQueue.push(obj);
  59987. } else if ((0, _primitives.isRef)(obj)) {
  59988. this.startXRefQueue.push(obj.num);
  59989. }
  59990. this.startXRefQueue.shift();
  59991. }
  59992. return this.topDict;
  59993. } catch (e) {
  59994. if (e instanceof _core_utils.MissingDataException) {
  59995. throw e;
  59996. }
  59997. (0, _util.info)("(while reading XRef): " + e);
  59998. }
  59999. if (recoveryMode) {
  60000. return undefined;
  60001. }
  60002. throw new _core_utils.XRefParseException();
  60003. }
  60004. getEntry(i) {
  60005. const xrefEntry = this.entries[i];
  60006. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  60007. return xrefEntry;
  60008. }
  60009. return null;
  60010. }
  60011. fetchIfRef(obj, suppressEncryption = false) {
  60012. if (obj instanceof _primitives.Ref) {
  60013. return this.fetch(obj, suppressEncryption);
  60014. }
  60015. return obj;
  60016. }
  60017. fetch(ref, suppressEncryption = false) {
  60018. if (!(ref instanceof _primitives.Ref)) {
  60019. throw new Error("ref object is not a reference");
  60020. }
  60021. const num = ref.num;
  60022. const cacheEntry = this._cacheMap.get(num);
  60023. if (cacheEntry !== undefined) {
  60024. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  60025. cacheEntry.objId = ref.toString();
  60026. }
  60027. return cacheEntry;
  60028. }
  60029. let xrefEntry = this.getEntry(num);
  60030. if (xrefEntry === null) {
  60031. this._cacheMap.set(num, xrefEntry);
  60032. return xrefEntry;
  60033. }
  60034. if (xrefEntry.uncompressed) {
  60035. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  60036. } else {
  60037. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  60038. }
  60039. if ((0, _primitives.isDict)(xrefEntry)) {
  60040. xrefEntry.objId = ref.toString();
  60041. } else if ((0, _primitives.isStream)(xrefEntry)) {
  60042. xrefEntry.dict.objId = ref.toString();
  60043. }
  60044. return xrefEntry;
  60045. }
  60046. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  60047. const gen = ref.gen;
  60048. let num = ref.num;
  60049. if (xrefEntry.gen !== gen) {
  60050. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  60051. }
  60052. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  60053. const parser = new _parser.Parser({
  60054. lexer: new _parser.Lexer(stream),
  60055. xref: this,
  60056. allowStreams: true
  60057. });
  60058. const obj1 = parser.getObj();
  60059. const obj2 = parser.getObj();
  60060. const obj3 = parser.getObj();
  60061. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  60062. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  60063. }
  60064. if (obj3.cmd !== "obj") {
  60065. if (obj3.cmd.startsWith("obj")) {
  60066. num = parseInt(obj3.cmd.substring(3), 10);
  60067. if (!Number.isNaN(num)) {
  60068. return num;
  60069. }
  60070. }
  60071. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  60072. }
  60073. if (this.encrypt && !suppressEncryption) {
  60074. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  60075. } else {
  60076. xrefEntry = parser.getObj();
  60077. }
  60078. if (!(0, _primitives.isStream)(xrefEntry)) {
  60079. this._cacheMap.set(num, xrefEntry);
  60080. }
  60081. return xrefEntry;
  60082. }
  60083. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  60084. const tableOffset = xrefEntry.offset;
  60085. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  60086. if (!(0, _primitives.isStream)(stream)) {
  60087. throw new _util.FormatError("bad ObjStm stream");
  60088. }
  60089. const first = stream.dict.get("First");
  60090. const n = stream.dict.get("N");
  60091. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  60092. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  60093. }
  60094. let parser = new _parser.Parser({
  60095. lexer: new _parser.Lexer(stream),
  60096. xref: this,
  60097. allowStreams: true
  60098. });
  60099. const nums = new Array(n);
  60100. const offsets = new Array(n);
  60101. for (let i = 0; i < n; ++i) {
  60102. const num = parser.getObj();
  60103. if (!Number.isInteger(num)) {
  60104. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  60105. }
  60106. const offset = parser.getObj();
  60107. if (!Number.isInteger(offset)) {
  60108. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  60109. }
  60110. nums[i] = num;
  60111. offsets[i] = offset;
  60112. }
  60113. const start = (stream.start || 0) + first;
  60114. const entries = new Array(n);
  60115. for (let i = 0; i < n; ++i) {
  60116. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  60117. if (length < 0) {
  60118. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  60119. }
  60120. parser = new _parser.Parser({
  60121. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  60122. xref: this,
  60123. allowStreams: true
  60124. });
  60125. const obj = parser.getObj();
  60126. entries[i] = obj;
  60127. if ((0, _primitives.isStream)(obj)) {
  60128. continue;
  60129. }
  60130. const num = nums[i],
  60131. entry = this.entries[num];
  60132. if (entry && entry.offset === tableOffset && entry.gen === i) {
  60133. this._cacheMap.set(num, obj);
  60134. }
  60135. }
  60136. xrefEntry = entries[xrefEntry.gen];
  60137. if (xrefEntry === undefined) {
  60138. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  60139. }
  60140. return xrefEntry;
  60141. }
  60142. async fetchIfRefAsync(obj, suppressEncryption) {
  60143. if (obj instanceof _primitives.Ref) {
  60144. return this.fetchAsync(obj, suppressEncryption);
  60145. }
  60146. return obj;
  60147. }
  60148. async fetchAsync(ref, suppressEncryption) {
  60149. try {
  60150. return this.fetch(ref, suppressEncryption);
  60151. } catch (ex) {
  60152. if (!(ex instanceof _core_utils.MissingDataException)) {
  60153. throw ex;
  60154. }
  60155. await this.pdfManager.requestRange(ex.begin, ex.end);
  60156. return this.fetchAsync(ref, suppressEncryption);
  60157. }
  60158. }
  60159. getCatalogObj() {
  60160. return this.root;
  60161. }
  60162. }
  60163. exports.XRef = XRef;
  60164. /***/ }),
  60165. /* 99 */
  60166. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60167. Object.defineProperty(exports, "__esModule", ({
  60168. value: true
  60169. }));
  60170. exports.MessageHandler = void 0;
  60171. var _util = __w_pdfjs_require__(2);
  60172. const CallbackKind = {
  60173. UNKNOWN: 0,
  60174. DATA: 1,
  60175. ERROR: 2
  60176. };
  60177. const StreamKind = {
  60178. UNKNOWN: 0,
  60179. CANCEL: 1,
  60180. CANCEL_COMPLETE: 2,
  60181. CLOSE: 3,
  60182. ENQUEUE: 4,
  60183. ERROR: 5,
  60184. PULL: 6,
  60185. PULL_COMPLETE: 7,
  60186. START_COMPLETE: 8
  60187. };
  60188. function wrapReason(reason) {
  60189. if (typeof reason !== "object" || reason === null) {
  60190. return reason;
  60191. }
  60192. switch (reason.name) {
  60193. case "AbortException":
  60194. return new _util.AbortException(reason.message);
  60195. case "MissingPDFException":
  60196. return new _util.MissingPDFException(reason.message);
  60197. case "UnexpectedResponseException":
  60198. return new _util.UnexpectedResponseException(reason.message, reason.status);
  60199. case "UnknownErrorException":
  60200. return new _util.UnknownErrorException(reason.message, reason.details);
  60201. default:
  60202. return new _util.UnknownErrorException(reason.message, reason.toString());
  60203. }
  60204. }
  60205. class MessageHandler {
  60206. constructor(sourceName, targetName, comObj) {
  60207. this.sourceName = sourceName;
  60208. this.targetName = targetName;
  60209. this.comObj = comObj;
  60210. this.callbackId = 1;
  60211. this.streamId = 1;
  60212. this.postMessageTransfers = true;
  60213. this.streamSinks = Object.create(null);
  60214. this.streamControllers = Object.create(null);
  60215. this.callbackCapabilities = Object.create(null);
  60216. this.actionHandler = Object.create(null);
  60217. this._onComObjOnMessage = event => {
  60218. const data = event.data;
  60219. if (data.targetName !== this.sourceName) {
  60220. return;
  60221. }
  60222. if (data.stream) {
  60223. this._processStreamMessage(data);
  60224. return;
  60225. }
  60226. if (data.callback) {
  60227. const callbackId = data.callbackId;
  60228. const capability = this.callbackCapabilities[callbackId];
  60229. if (!capability) {
  60230. throw new Error(`Cannot resolve callback ${callbackId}`);
  60231. }
  60232. delete this.callbackCapabilities[callbackId];
  60233. if (data.callback === CallbackKind.DATA) {
  60234. capability.resolve(data.data);
  60235. } else if (data.callback === CallbackKind.ERROR) {
  60236. capability.reject(wrapReason(data.reason));
  60237. } else {
  60238. throw new Error("Unexpected callback case");
  60239. }
  60240. return;
  60241. }
  60242. const action = this.actionHandler[data.action];
  60243. if (!action) {
  60244. throw new Error(`Unknown action from worker: ${data.action}`);
  60245. }
  60246. if (data.callbackId) {
  60247. const cbSourceName = this.sourceName;
  60248. const cbTargetName = data.sourceName;
  60249. new Promise(function (resolve) {
  60250. resolve(action(data.data));
  60251. }).then(function (result) {
  60252. comObj.postMessage({
  60253. sourceName: cbSourceName,
  60254. targetName: cbTargetName,
  60255. callback: CallbackKind.DATA,
  60256. callbackId: data.callbackId,
  60257. data: result
  60258. });
  60259. }, function (reason) {
  60260. comObj.postMessage({
  60261. sourceName: cbSourceName,
  60262. targetName: cbTargetName,
  60263. callback: CallbackKind.ERROR,
  60264. callbackId: data.callbackId,
  60265. reason: wrapReason(reason)
  60266. });
  60267. });
  60268. return;
  60269. }
  60270. if (data.streamId) {
  60271. this._createStreamSink(data);
  60272. return;
  60273. }
  60274. action(data.data);
  60275. };
  60276. comObj.addEventListener("message", this._onComObjOnMessage);
  60277. }
  60278. on(actionName, handler) {
  60279. const ah = this.actionHandler;
  60280. if (ah[actionName]) {
  60281. throw new Error(`There is already an actionName called "${actionName}"`);
  60282. }
  60283. ah[actionName] = handler;
  60284. }
  60285. send(actionName, data, transfers) {
  60286. this._postMessage({
  60287. sourceName: this.sourceName,
  60288. targetName: this.targetName,
  60289. action: actionName,
  60290. data
  60291. }, transfers);
  60292. }
  60293. sendWithPromise(actionName, data, transfers) {
  60294. const callbackId = this.callbackId++;
  60295. const capability = (0, _util.createPromiseCapability)();
  60296. this.callbackCapabilities[callbackId] = capability;
  60297. try {
  60298. this._postMessage({
  60299. sourceName: this.sourceName,
  60300. targetName: this.targetName,
  60301. action: actionName,
  60302. callbackId,
  60303. data
  60304. }, transfers);
  60305. } catch (ex) {
  60306. capability.reject(ex);
  60307. }
  60308. return capability.promise;
  60309. }
  60310. sendWithStream(actionName, data, queueingStrategy, transfers) {
  60311. const streamId = this.streamId++;
  60312. const sourceName = this.sourceName;
  60313. const targetName = this.targetName;
  60314. const comObj = this.comObj;
  60315. return new ReadableStream({
  60316. start: controller => {
  60317. const startCapability = (0, _util.createPromiseCapability)();
  60318. this.streamControllers[streamId] = {
  60319. controller,
  60320. startCall: startCapability,
  60321. pullCall: null,
  60322. cancelCall: null,
  60323. isClosed: false
  60324. };
  60325. this._postMessage({
  60326. sourceName,
  60327. targetName,
  60328. action: actionName,
  60329. streamId,
  60330. data,
  60331. desiredSize: controller.desiredSize
  60332. }, transfers);
  60333. return startCapability.promise;
  60334. },
  60335. pull: controller => {
  60336. const pullCapability = (0, _util.createPromiseCapability)();
  60337. this.streamControllers[streamId].pullCall = pullCapability;
  60338. comObj.postMessage({
  60339. sourceName,
  60340. targetName,
  60341. stream: StreamKind.PULL,
  60342. streamId,
  60343. desiredSize: controller.desiredSize
  60344. });
  60345. return pullCapability.promise;
  60346. },
  60347. cancel: reason => {
  60348. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  60349. const cancelCapability = (0, _util.createPromiseCapability)();
  60350. this.streamControllers[streamId].cancelCall = cancelCapability;
  60351. this.streamControllers[streamId].isClosed = true;
  60352. comObj.postMessage({
  60353. sourceName,
  60354. targetName,
  60355. stream: StreamKind.CANCEL,
  60356. streamId,
  60357. reason: wrapReason(reason)
  60358. });
  60359. return cancelCapability.promise;
  60360. }
  60361. }, queueingStrategy);
  60362. }
  60363. _createStreamSink(data) {
  60364. const self = this;
  60365. const action = this.actionHandler[data.action];
  60366. const streamId = data.streamId;
  60367. const sourceName = this.sourceName;
  60368. const targetName = data.sourceName;
  60369. const comObj = this.comObj;
  60370. const streamSink = {
  60371. enqueue(chunk, size = 1, transfers) {
  60372. if (this.isCancelled) {
  60373. return;
  60374. }
  60375. const lastDesiredSize = this.desiredSize;
  60376. this.desiredSize -= size;
  60377. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  60378. this.sinkCapability = (0, _util.createPromiseCapability)();
  60379. this.ready = this.sinkCapability.promise;
  60380. }
  60381. self._postMessage({
  60382. sourceName,
  60383. targetName,
  60384. stream: StreamKind.ENQUEUE,
  60385. streamId,
  60386. chunk
  60387. }, transfers);
  60388. },
  60389. close() {
  60390. if (this.isCancelled) {
  60391. return;
  60392. }
  60393. this.isCancelled = true;
  60394. comObj.postMessage({
  60395. sourceName,
  60396. targetName,
  60397. stream: StreamKind.CLOSE,
  60398. streamId
  60399. });
  60400. delete self.streamSinks[streamId];
  60401. },
  60402. error(reason) {
  60403. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  60404. if (this.isCancelled) {
  60405. return;
  60406. }
  60407. this.isCancelled = true;
  60408. comObj.postMessage({
  60409. sourceName,
  60410. targetName,
  60411. stream: StreamKind.ERROR,
  60412. streamId,
  60413. reason: wrapReason(reason)
  60414. });
  60415. },
  60416. sinkCapability: (0, _util.createPromiseCapability)(),
  60417. onPull: null,
  60418. onCancel: null,
  60419. isCancelled: false,
  60420. desiredSize: data.desiredSize,
  60421. ready: null
  60422. };
  60423. streamSink.sinkCapability.resolve();
  60424. streamSink.ready = streamSink.sinkCapability.promise;
  60425. this.streamSinks[streamId] = streamSink;
  60426. new Promise(function (resolve) {
  60427. resolve(action(data.data, streamSink));
  60428. }).then(function () {
  60429. comObj.postMessage({
  60430. sourceName,
  60431. targetName,
  60432. stream: StreamKind.START_COMPLETE,
  60433. streamId,
  60434. success: true
  60435. });
  60436. }, function (reason) {
  60437. comObj.postMessage({
  60438. sourceName,
  60439. targetName,
  60440. stream: StreamKind.START_COMPLETE,
  60441. streamId,
  60442. reason: wrapReason(reason)
  60443. });
  60444. });
  60445. }
  60446. _processStreamMessage(data) {
  60447. const streamId = data.streamId;
  60448. const sourceName = this.sourceName;
  60449. const targetName = data.sourceName;
  60450. const comObj = this.comObj;
  60451. switch (data.stream) {
  60452. case StreamKind.START_COMPLETE:
  60453. if (data.success) {
  60454. this.streamControllers[streamId].startCall.resolve();
  60455. } else {
  60456. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  60457. }
  60458. break;
  60459. case StreamKind.PULL_COMPLETE:
  60460. if (data.success) {
  60461. this.streamControllers[streamId].pullCall.resolve();
  60462. } else {
  60463. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  60464. }
  60465. break;
  60466. case StreamKind.PULL:
  60467. if (!this.streamSinks[streamId]) {
  60468. comObj.postMessage({
  60469. sourceName,
  60470. targetName,
  60471. stream: StreamKind.PULL_COMPLETE,
  60472. streamId,
  60473. success: true
  60474. });
  60475. break;
  60476. }
  60477. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  60478. this.streamSinks[streamId].sinkCapability.resolve();
  60479. }
  60480. this.streamSinks[streamId].desiredSize = data.desiredSize;
  60481. const {
  60482. onPull
  60483. } = this.streamSinks[data.streamId];
  60484. new Promise(function (resolve) {
  60485. resolve(onPull && onPull());
  60486. }).then(function () {
  60487. comObj.postMessage({
  60488. sourceName,
  60489. targetName,
  60490. stream: StreamKind.PULL_COMPLETE,
  60491. streamId,
  60492. success: true
  60493. });
  60494. }, function (reason) {
  60495. comObj.postMessage({
  60496. sourceName,
  60497. targetName,
  60498. stream: StreamKind.PULL_COMPLETE,
  60499. streamId,
  60500. reason: wrapReason(reason)
  60501. });
  60502. });
  60503. break;
  60504. case StreamKind.ENQUEUE:
  60505. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  60506. if (this.streamControllers[streamId].isClosed) {
  60507. break;
  60508. }
  60509. this.streamControllers[streamId].controller.enqueue(data.chunk);
  60510. break;
  60511. case StreamKind.CLOSE:
  60512. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  60513. if (this.streamControllers[streamId].isClosed) {
  60514. break;
  60515. }
  60516. this.streamControllers[streamId].isClosed = true;
  60517. this.streamControllers[streamId].controller.close();
  60518. this._deleteStreamController(streamId);
  60519. break;
  60520. case StreamKind.ERROR:
  60521. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  60522. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  60523. this._deleteStreamController(streamId);
  60524. break;
  60525. case StreamKind.CANCEL_COMPLETE:
  60526. if (data.success) {
  60527. this.streamControllers[streamId].cancelCall.resolve();
  60528. } else {
  60529. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  60530. }
  60531. this._deleteStreamController(streamId);
  60532. break;
  60533. case StreamKind.CANCEL:
  60534. if (!this.streamSinks[streamId]) {
  60535. break;
  60536. }
  60537. const {
  60538. onCancel
  60539. } = this.streamSinks[data.streamId];
  60540. new Promise(function (resolve) {
  60541. resolve(onCancel && onCancel(wrapReason(data.reason)));
  60542. }).then(function () {
  60543. comObj.postMessage({
  60544. sourceName,
  60545. targetName,
  60546. stream: StreamKind.CANCEL_COMPLETE,
  60547. streamId,
  60548. success: true
  60549. });
  60550. }, function (reason) {
  60551. comObj.postMessage({
  60552. sourceName,
  60553. targetName,
  60554. stream: StreamKind.CANCEL_COMPLETE,
  60555. streamId,
  60556. reason: wrapReason(reason)
  60557. });
  60558. });
  60559. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  60560. this.streamSinks[streamId].isCancelled = true;
  60561. delete this.streamSinks[streamId];
  60562. break;
  60563. default:
  60564. throw new Error("Unexpected stream case");
  60565. }
  60566. }
  60567. async _deleteStreamController(streamId) {
  60568. await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  60569. return capability && capability.promise;
  60570. }));
  60571. delete this.streamControllers[streamId];
  60572. }
  60573. _postMessage(message, transfers) {
  60574. if (transfers && this.postMessageTransfers) {
  60575. this.comObj.postMessage(message, transfers);
  60576. } else {
  60577. this.comObj.postMessage(message);
  60578. }
  60579. }
  60580. destroy() {
  60581. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  60582. }
  60583. }
  60584. exports.MessageHandler = MessageHandler;
  60585. /***/ }),
  60586. /* 100 */
  60587. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60588. Object.defineProperty(exports, "__esModule", ({
  60589. value: true
  60590. }));
  60591. exports.PDFWorkerStream = void 0;
  60592. var _util = __w_pdfjs_require__(2);
  60593. class PDFWorkerStream {
  60594. constructor(msgHandler) {
  60595. this._msgHandler = msgHandler;
  60596. this._contentLength = null;
  60597. this._fullRequestReader = null;
  60598. this._rangeRequestReaders = [];
  60599. }
  60600. getFullReader() {
  60601. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  60602. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  60603. return this._fullRequestReader;
  60604. }
  60605. getRangeReader(begin, end) {
  60606. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  60607. this._rangeRequestReaders.push(reader);
  60608. return reader;
  60609. }
  60610. cancelAllRequests(reason) {
  60611. if (this._fullRequestReader) {
  60612. this._fullRequestReader.cancel(reason);
  60613. }
  60614. for (const reader of this._rangeRequestReaders.slice(0)) {
  60615. reader.cancel(reason);
  60616. }
  60617. }
  60618. }
  60619. exports.PDFWorkerStream = PDFWorkerStream;
  60620. class PDFWorkerStreamReader {
  60621. constructor(msgHandler) {
  60622. this._msgHandler = msgHandler;
  60623. this.onProgress = null;
  60624. this._contentLength = null;
  60625. this._isRangeSupported = false;
  60626. this._isStreamingSupported = false;
  60627. const readableStream = this._msgHandler.sendWithStream("GetReader");
  60628. this._reader = readableStream.getReader();
  60629. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  60630. this._isStreamingSupported = data.isStreamingSupported;
  60631. this._isRangeSupported = data.isRangeSupported;
  60632. this._contentLength = data.contentLength;
  60633. });
  60634. }
  60635. get headersReady() {
  60636. return this._headersReady;
  60637. }
  60638. get contentLength() {
  60639. return this._contentLength;
  60640. }
  60641. get isStreamingSupported() {
  60642. return this._isStreamingSupported;
  60643. }
  60644. get isRangeSupported() {
  60645. return this._isRangeSupported;
  60646. }
  60647. async read() {
  60648. const {
  60649. value,
  60650. done
  60651. } = await this._reader.read();
  60652. if (done) {
  60653. return {
  60654. value: undefined,
  60655. done: true
  60656. };
  60657. }
  60658. return {
  60659. value: value.buffer,
  60660. done: false
  60661. };
  60662. }
  60663. cancel(reason) {
  60664. this._reader.cancel(reason);
  60665. }
  60666. }
  60667. class PDFWorkerStreamRangeReader {
  60668. constructor(begin, end, msgHandler) {
  60669. this._msgHandler = msgHandler;
  60670. this.onProgress = null;
  60671. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  60672. begin,
  60673. end
  60674. });
  60675. this._reader = readableStream.getReader();
  60676. }
  60677. get isStreamingSupported() {
  60678. return false;
  60679. }
  60680. async read() {
  60681. const {
  60682. value,
  60683. done
  60684. } = await this._reader.read();
  60685. if (done) {
  60686. return {
  60687. value: undefined,
  60688. done: true
  60689. };
  60690. }
  60691. return {
  60692. value: value.buffer,
  60693. done: false
  60694. };
  60695. }
  60696. cancel(reason) {
  60697. this._reader.cancel(reason);
  60698. }
  60699. }
  60700. /***/ })
  60701. /******/ ]);
  60702. /************************************************************************/
  60703. /******/ // The module cache
  60704. /******/ var __webpack_module_cache__ = {};
  60705. /******/
  60706. /******/ // The require function
  60707. /******/ function __w_pdfjs_require__(moduleId) {
  60708. /******/ // Check if module is in cache
  60709. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  60710. /******/ if (cachedModule !== undefined) {
  60711. /******/ return cachedModule.exports;
  60712. /******/ }
  60713. /******/ // Create a new module (and put it into the cache)
  60714. /******/ var module = __webpack_module_cache__[moduleId] = {
  60715. /******/ // no module.id needed
  60716. /******/ // no module.loaded needed
  60717. /******/ exports: {}
  60718. /******/ };
  60719. /******/
  60720. /******/ // Execute the module function
  60721. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  60722. /******/
  60723. /******/ // Return the exports of the module
  60724. /******/ return module.exports;
  60725. /******/ }
  60726. /******/
  60727. /************************************************************************/
  60728. /******/ /* webpack/runtime/define property getters */
  60729. /******/ (() => {
  60730. /******/ // define getter functions for harmony exports
  60731. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  60732. /******/ for(var key in definition) {
  60733. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  60734. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  60735. /******/ }
  60736. /******/ }
  60737. /******/ };
  60738. /******/ })();
  60739. /******/
  60740. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  60741. /******/ (() => {
  60742. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  60743. /******/ })();
  60744. /******/
  60745. /******/ /* webpack/runtime/make namespace object */
  60746. /******/ (() => {
  60747. /******/ // define __esModule on exports
  60748. /******/ __w_pdfjs_require__.r = (exports) => {
  60749. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  60750. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  60751. /******/ }
  60752. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  60753. /******/ };
  60754. /******/ })();
  60755. /******/
  60756. /************************************************************************/
  60757. var __webpack_exports__ = {};
  60758. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  60759. (() => {
  60760. var exports = __webpack_exports__;
  60761. Object.defineProperty(exports, "__esModule", ({
  60762. value: true
  60763. }));
  60764. Object.defineProperty(exports, "WorkerMessageHandler", ({
  60765. enumerable: true,
  60766. get: function () {
  60767. return _worker.WorkerMessageHandler;
  60768. }
  60769. }));
  60770. var _worker = __w_pdfjs_require__(1);
  60771. const pdfjsVersion = '2.10.377';
  60772. const pdfjsBuild = '156762c48';
  60773. })();
  60774. /******/ return __webpack_exports__;
  60775. /******/ })()
  60776. ;
  60777. });
  60778. //# sourceMappingURL=pdf.worker.js.map