pdf.worker.js 1.6 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364
  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__(64);
  46. var _is_node = __w_pdfjs_require__(4);
  47. var _message_handler = __w_pdfjs_require__(89);
  48. var _worker_stream = __w_pdfjs_require__(90);
  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.9.359';
  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 [numPages, fingerprint, isPureXfa] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint"), pdfManager.ensureDoc("isPureXfa")]);
  144. if (isPureXfa) {
  145. const task = new WorkerTask("loadXfaFonts");
  146. startWorkerTask(task);
  147. await pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task));
  148. }
  149. return {
  150. numPages,
  151. fingerprint,
  152. isPureXfa
  153. };
  154. }
  155. function getPdfManager(data, evaluatorOptions, enableXfa) {
  156. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  157. let newPdfManager;
  158. const source = data.source;
  159. if (source.data) {
  160. try {
  161. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  162. pdfManagerCapability.resolve(newPdfManager);
  163. } catch (ex) {
  164. pdfManagerCapability.reject(ex);
  165. }
  166. return pdfManagerCapability.promise;
  167. }
  168. let pdfStream,
  169. cachedChunks = [];
  170. try {
  171. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  172. } catch (ex) {
  173. pdfManagerCapability.reject(ex);
  174. return pdfManagerCapability.promise;
  175. }
  176. const fullRequest = pdfStream.getFullReader();
  177. fullRequest.headersReady.then(function () {
  178. if (!fullRequest.isRangeSupported) {
  179. return;
  180. }
  181. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  182. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  183. msgHandler: handler,
  184. password: source.password,
  185. length: fullRequest.contentLength,
  186. disableAutoFetch,
  187. rangeChunkSize: source.rangeChunkSize
  188. }, evaluatorOptions, enableXfa, docBaseUrl);
  189. for (let i = 0; i < cachedChunks.length; i++) {
  190. newPdfManager.sendProgressiveData(cachedChunks[i]);
  191. }
  192. cachedChunks = [];
  193. pdfManagerCapability.resolve(newPdfManager);
  194. cancelXHRs = null;
  195. }).catch(function (reason) {
  196. pdfManagerCapability.reject(reason);
  197. cancelXHRs = null;
  198. });
  199. let loaded = 0;
  200. const flushChunks = function () {
  201. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  202. if (source.length && pdfFile.length !== source.length) {
  203. (0, _util.warn)("reported HTTP length is different from actual");
  204. }
  205. try {
  206. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  207. pdfManagerCapability.resolve(newPdfManager);
  208. } catch (ex) {
  209. pdfManagerCapability.reject(ex);
  210. }
  211. cachedChunks = [];
  212. };
  213. const readPromise = new Promise(function (resolve, reject) {
  214. const readChunk = function ({
  215. value,
  216. done
  217. }) {
  218. try {
  219. ensureNotTerminated();
  220. if (done) {
  221. if (!newPdfManager) {
  222. flushChunks();
  223. }
  224. cancelXHRs = null;
  225. return;
  226. }
  227. loaded += (0, _util.arrayByteLength)(value);
  228. if (!fullRequest.isStreamingSupported) {
  229. handler.send("DocProgress", {
  230. loaded,
  231. total: Math.max(loaded, fullRequest.contentLength || 0)
  232. });
  233. }
  234. if (newPdfManager) {
  235. newPdfManager.sendProgressiveData(value);
  236. } else {
  237. cachedChunks.push(value);
  238. }
  239. fullRequest.read().then(readChunk, reject);
  240. } catch (e) {
  241. reject(e);
  242. }
  243. };
  244. fullRequest.read().then(readChunk, reject);
  245. });
  246. readPromise.catch(function (e) {
  247. pdfManagerCapability.reject(e);
  248. cancelXHRs = null;
  249. });
  250. cancelXHRs = function (reason) {
  251. pdfStream.cancelAllRequests(reason);
  252. };
  253. return pdfManagerCapability.promise;
  254. }
  255. function setupDoc(data) {
  256. function onSuccess(doc) {
  257. ensureNotTerminated();
  258. handler.send("GetDoc", {
  259. pdfInfo: doc
  260. });
  261. }
  262. function onFailure(ex) {
  263. ensureNotTerminated();
  264. if (ex instanceof _util.PasswordException) {
  265. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  266. startWorkerTask(task);
  267. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  268. password
  269. }) {
  270. finishWorkerTask(task);
  271. pdfManager.updatePassword(password);
  272. pdfManagerReady();
  273. }).catch(function () {
  274. finishWorkerTask(task);
  275. handler.send("DocException", ex);
  276. });
  277. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  278. handler.send("DocException", ex);
  279. } else {
  280. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  281. }
  282. }
  283. function pdfManagerReady() {
  284. ensureNotTerminated();
  285. loadDocument(false).then(onSuccess, function (reason) {
  286. ensureNotTerminated();
  287. if (!(reason instanceof _core_utils.XRefParseException)) {
  288. onFailure(reason);
  289. return;
  290. }
  291. pdfManager.requestLoadedStream();
  292. pdfManager.onLoadedStream().then(function () {
  293. ensureNotTerminated();
  294. loadDocument(true).then(onSuccess, onFailure);
  295. });
  296. });
  297. }
  298. ensureNotTerminated();
  299. const evaluatorOptions = {
  300. maxImageSize: data.maxImageSize,
  301. disableFontFace: data.disableFontFace,
  302. ignoreErrors: data.ignoreErrors,
  303. isEvalSupported: data.isEvalSupported,
  304. fontExtraProperties: data.fontExtraProperties
  305. };
  306. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  307. if (terminated) {
  308. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  309. throw new Error("Worker was terminated");
  310. }
  311. pdfManager = newPdfManager;
  312. pdfManager.onLoadedStream().then(function (stream) {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function wphSetupGetPage(data) {
  320. return pdfManager.getPage(data.pageIndex).then(function (page) {
  321. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  322. return {
  323. rotate,
  324. ref,
  325. userUnit,
  326. view
  327. };
  328. });
  329. });
  330. });
  331. handler.on("GetPageIndex", function wphSetupGetPageIndex({
  332. ref
  333. }) {
  334. const pageRef = _primitives.Ref.get(ref.num, ref.gen);
  335. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  336. });
  337. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  338. return pdfManager.ensureCatalog("destinations");
  339. });
  340. handler.on("GetDestination", function wphSetupGetDestination(data) {
  341. return pdfManager.ensureCatalog("getDestination", [data.id]);
  342. });
  343. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  344. return pdfManager.ensureCatalog("pageLabels");
  345. });
  346. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  347. return pdfManager.ensureCatalog("pageLayout");
  348. });
  349. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  350. return pdfManager.ensureCatalog("pageMode");
  351. });
  352. handler.on("GetViewerPreferences", function (data) {
  353. return pdfManager.ensureCatalog("viewerPreferences");
  354. });
  355. handler.on("GetOpenAction", function (data) {
  356. return pdfManager.ensureCatalog("openAction");
  357. });
  358. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  359. return pdfManager.ensureCatalog("attachments");
  360. });
  361. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  362. return pdfManager.ensureCatalog("javaScript");
  363. });
  364. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  365. return pdfManager.ensureCatalog("jsActions");
  366. });
  367. handler.on("GetPageJSActions", function ({
  368. pageIndex
  369. }) {
  370. return pdfManager.getPage(pageIndex).then(function (page) {
  371. return pdfManager.ensure(page, "jsActions");
  372. });
  373. });
  374. handler.on("GetPageXfa", function wphSetupGetXfa({
  375. pageIndex
  376. }) {
  377. return pdfManager.getPage(pageIndex).then(function (page) {
  378. return pdfManager.ensure(page, "xfaData");
  379. });
  380. });
  381. handler.on("GetOutline", function wphSetupGetOutline(data) {
  382. return pdfManager.ensureCatalog("documentOutline");
  383. });
  384. handler.on("GetOptionalContentConfig", function (data) {
  385. return pdfManager.ensureCatalog("optionalContentConfig");
  386. });
  387. handler.on("GetPermissions", function (data) {
  388. return pdfManager.ensureCatalog("permissions");
  389. });
  390. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  391. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  392. });
  393. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  394. return pdfManager.ensureCatalog("markInfo");
  395. });
  396. handler.on("GetData", function wphSetupGetData(data) {
  397. pdfManager.requestLoadedStream();
  398. return pdfManager.onLoadedStream().then(function (stream) {
  399. return stream.bytes;
  400. });
  401. });
  402. handler.on("GetStats", function wphSetupGetStats(data) {
  403. return pdfManager.ensureXRef("stats");
  404. });
  405. handler.on("GetAnnotations", function ({
  406. pageIndex,
  407. intent
  408. }) {
  409. return pdfManager.getPage(pageIndex).then(function (page) {
  410. return page.getAnnotationsData(intent);
  411. });
  412. });
  413. handler.on("GetFieldObjects", function (data) {
  414. return pdfManager.ensureDoc("fieldObjects");
  415. });
  416. handler.on("HasJSActions", function (data) {
  417. return pdfManager.ensureDoc("hasJSActions");
  418. });
  419. handler.on("GetCalculationOrderIds", function (data) {
  420. return pdfManager.ensureDoc("calculationOrderIds");
  421. });
  422. handler.on("SaveDocument", function ({
  423. numPages,
  424. annotationStorage,
  425. filename
  426. }) {
  427. pdfManager.requestLoadedStream();
  428. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  429. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  430. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  431. const task = new WorkerTask(`Save: page ${pageIndex}`);
  432. startWorkerTask(task);
  433. return page.save(handler, task, annotationStorage).finally(function () {
  434. finishWorkerTask(task);
  435. });
  436. }));
  437. }
  438. return Promise.all(promises).then(function ([stream, acroForm, xref, startXRef, ...refs]) {
  439. let newRefs = [];
  440. for (const ref of refs) {
  441. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  442. }
  443. if (newRefs.length === 0) {
  444. return stream.bytes;
  445. }
  446. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || [];
  447. let xfaDatasets = null;
  448. if (Array.isArray(xfa)) {
  449. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  450. if (xfa[i] === "datasets") {
  451. xfaDatasets = xfa[i + 1];
  452. }
  453. }
  454. } else {
  455. (0, _util.warn)("Unsupported XFA type.");
  456. }
  457. let newXrefInfo = Object.create(null);
  458. if (xref.trailer) {
  459. const infoObj = Object.create(null);
  460. const xrefInfo = xref.trailer.get("Info") || null;
  461. if (xrefInfo instanceof _primitives.Dict) {
  462. xrefInfo.forEach((key, value) => {
  463. if ((0, _util.isString)(key) && (0, _util.isString)(value)) {
  464. infoObj[key] = (0, _util.stringToPDFString)(value);
  465. }
  466. });
  467. }
  468. newXrefInfo = {
  469. rootRef: xref.trailer.getRaw("Root") || null,
  470. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  471. newRef: xref.getNewRef(),
  472. infoRef: xref.trailer.getRaw("Info") || null,
  473. info: infoObj,
  474. fileIds: xref.trailer.get("ID") || null,
  475. startXRef,
  476. filename
  477. };
  478. }
  479. xref.resetNewRef();
  480. return (0, _writer.incrementalUpdate)({
  481. originalData: stream.bytes,
  482. xrefInfo: newXrefInfo,
  483. newRefs,
  484. xref,
  485. datasetsRef: xfaDatasets
  486. });
  487. });
  488. });
  489. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  490. const pageIndex = data.pageIndex;
  491. pdfManager.getPage(pageIndex).then(function (page) {
  492. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  493. startWorkerTask(task);
  494. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  495. page.getOperatorList({
  496. handler,
  497. sink,
  498. task,
  499. intent: data.intent,
  500. renderInteractiveForms: data.renderInteractiveForms,
  501. annotationStorage: data.annotationStorage
  502. }).then(function (operatorListInfo) {
  503. finishWorkerTask(task);
  504. if (start) {
  505. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  506. }
  507. sink.close();
  508. }, function (reason) {
  509. finishWorkerTask(task);
  510. if (task.terminated) {
  511. return;
  512. }
  513. handler.send("UnsupportedFeature", {
  514. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  515. });
  516. sink.error(reason);
  517. });
  518. });
  519. });
  520. handler.on("GetTextContent", function wphExtractText(data, sink) {
  521. const pageIndex = data.pageIndex;
  522. sink.onPull = function (desiredSize) {};
  523. sink.onCancel = function (reason) {};
  524. pdfManager.getPage(pageIndex).then(function (page) {
  525. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  526. startWorkerTask(task);
  527. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  528. page.extractTextContent({
  529. handler,
  530. task,
  531. sink,
  532. normalizeWhitespace: data.normalizeWhitespace,
  533. includeMarkedContent: data.includeMarkedContent,
  534. combineTextItems: data.combineTextItems
  535. }).then(function () {
  536. finishWorkerTask(task);
  537. if (start) {
  538. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  539. }
  540. sink.close();
  541. }, function (reason) {
  542. finishWorkerTask(task);
  543. if (task.terminated) {
  544. return;
  545. }
  546. sink.error(reason);
  547. });
  548. });
  549. });
  550. handler.on("GetStructTree", function wphGetStructTree(data) {
  551. return pdfManager.getPage(data.pageIndex).then(function (page) {
  552. return pdfManager.ensure(page, "getStructTree");
  553. });
  554. });
  555. handler.on("FontFallback", function (data) {
  556. return pdfManager.fontFallback(data.id, handler);
  557. });
  558. handler.on("Cleanup", function wphCleanup(data) {
  559. return pdfManager.cleanup(true);
  560. });
  561. handler.on("Terminate", function wphTerminate(data) {
  562. terminated = true;
  563. const waitOn = [];
  564. if (pdfManager) {
  565. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  566. const cleanupPromise = pdfManager.cleanup();
  567. waitOn.push(cleanupPromise);
  568. pdfManager = null;
  569. } else {
  570. (0, _primitives.clearPrimitiveCaches)();
  571. }
  572. if (cancelXHRs) {
  573. cancelXHRs(new _util.AbortException("Worker was terminated."));
  574. }
  575. for (const task of WorkerTasks) {
  576. waitOn.push(task.finished);
  577. task.terminate();
  578. }
  579. return Promise.all(waitOn).then(function () {
  580. handler.destroy();
  581. handler = null;
  582. });
  583. });
  584. handler.on("Ready", function wphReady(data) {
  585. setupDoc(docParams);
  586. docParams = null;
  587. });
  588. return workerHandlerName;
  589. }
  590. static initializeFromPort(port) {
  591. const handler = new _message_handler.MessageHandler("worker", "main", port);
  592. WorkerMessageHandler.setup(handler, port);
  593. handler.send("ready", null);
  594. }
  595. }
  596. exports.WorkerMessageHandler = WorkerMessageHandler;
  597. function isMessagePort(maybePort) {
  598. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  599. }
  600. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  601. WorkerMessageHandler.initializeFromPort(self);
  602. }
  603. /***/ }),
  604. /* 2 */
  605. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  606. Object.defineProperty(exports, "__esModule", ({
  607. value: true
  608. }));
  609. exports.arrayByteLength = arrayByteLength;
  610. exports.arraysToBytes = arraysToBytes;
  611. exports.assert = assert;
  612. exports.bytesToString = bytesToString;
  613. exports.createObjectURL = createObjectURL;
  614. exports.createPromiseCapability = createPromiseCapability;
  615. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  616. exports.escapeString = escapeString;
  617. exports.getModificationDate = getModificationDate;
  618. exports.getVerbosityLevel = getVerbosityLevel;
  619. exports.info = info;
  620. exports.isArrayBuffer = isArrayBuffer;
  621. exports.isArrayEqual = isArrayEqual;
  622. exports.isAscii = isAscii;
  623. exports.isBool = isBool;
  624. exports.isNum = isNum;
  625. exports.isSameOrigin = isSameOrigin;
  626. exports.isString = isString;
  627. exports.objectFromMap = objectFromMap;
  628. exports.objectSize = objectSize;
  629. exports.removeNullCharacters = removeNullCharacters;
  630. exports.setVerbosityLevel = setVerbosityLevel;
  631. exports.shadow = shadow;
  632. exports.string32 = string32;
  633. exports.stringToBytes = stringToBytes;
  634. exports.stringToPDFString = stringToPDFString;
  635. exports.stringToUTF16BEString = stringToUTF16BEString;
  636. exports.stringToUTF8String = stringToUTF8String;
  637. exports.unreachable = unreachable;
  638. exports.utf8StringToString = utf8StringToString;
  639. exports.warn = warn;
  640. 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;
  641. __w_pdfjs_require__(3);
  642. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  643. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  644. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  645. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  646. const PermissionFlag = {
  647. PRINT: 0x04,
  648. MODIFY_CONTENTS: 0x08,
  649. COPY: 0x10,
  650. MODIFY_ANNOTATIONS: 0x20,
  651. FILL_INTERACTIVE_FORMS: 0x100,
  652. COPY_FOR_ACCESSIBILITY: 0x200,
  653. ASSEMBLE: 0x400,
  654. PRINT_HIGH_QUALITY: 0x800
  655. };
  656. exports.PermissionFlag = PermissionFlag;
  657. const TextRenderingMode = {
  658. FILL: 0,
  659. STROKE: 1,
  660. FILL_STROKE: 2,
  661. INVISIBLE: 3,
  662. FILL_ADD_TO_PATH: 4,
  663. STROKE_ADD_TO_PATH: 5,
  664. FILL_STROKE_ADD_TO_PATH: 6,
  665. ADD_TO_PATH: 7,
  666. FILL_STROKE_MASK: 3,
  667. ADD_TO_PATH_FLAG: 4
  668. };
  669. exports.TextRenderingMode = TextRenderingMode;
  670. const ImageKind = {
  671. GRAYSCALE_1BPP: 1,
  672. RGB_24BPP: 2,
  673. RGBA_32BPP: 3
  674. };
  675. exports.ImageKind = ImageKind;
  676. const AnnotationType = {
  677. TEXT: 1,
  678. LINK: 2,
  679. FREETEXT: 3,
  680. LINE: 4,
  681. SQUARE: 5,
  682. CIRCLE: 6,
  683. POLYGON: 7,
  684. POLYLINE: 8,
  685. HIGHLIGHT: 9,
  686. UNDERLINE: 10,
  687. SQUIGGLY: 11,
  688. STRIKEOUT: 12,
  689. STAMP: 13,
  690. CARET: 14,
  691. INK: 15,
  692. POPUP: 16,
  693. FILEATTACHMENT: 17,
  694. SOUND: 18,
  695. MOVIE: 19,
  696. WIDGET: 20,
  697. SCREEN: 21,
  698. PRINTERMARK: 22,
  699. TRAPNET: 23,
  700. WATERMARK: 24,
  701. THREED: 25,
  702. REDACT: 26
  703. };
  704. exports.AnnotationType = AnnotationType;
  705. const AnnotationStateModelType = {
  706. MARKED: "Marked",
  707. REVIEW: "Review"
  708. };
  709. exports.AnnotationStateModelType = AnnotationStateModelType;
  710. const AnnotationMarkedState = {
  711. MARKED: "Marked",
  712. UNMARKED: "Unmarked"
  713. };
  714. exports.AnnotationMarkedState = AnnotationMarkedState;
  715. const AnnotationReviewState = {
  716. ACCEPTED: "Accepted",
  717. REJECTED: "Rejected",
  718. CANCELLED: "Cancelled",
  719. COMPLETED: "Completed",
  720. NONE: "None"
  721. };
  722. exports.AnnotationReviewState = AnnotationReviewState;
  723. const AnnotationReplyType = {
  724. GROUP: "Group",
  725. REPLY: "R"
  726. };
  727. exports.AnnotationReplyType = AnnotationReplyType;
  728. const AnnotationFlag = {
  729. INVISIBLE: 0x01,
  730. HIDDEN: 0x02,
  731. PRINT: 0x04,
  732. NOZOOM: 0x08,
  733. NOROTATE: 0x10,
  734. NOVIEW: 0x20,
  735. READONLY: 0x40,
  736. LOCKED: 0x80,
  737. TOGGLENOVIEW: 0x100,
  738. LOCKEDCONTENTS: 0x200
  739. };
  740. exports.AnnotationFlag = AnnotationFlag;
  741. const AnnotationFieldFlag = {
  742. READONLY: 0x0000001,
  743. REQUIRED: 0x0000002,
  744. NOEXPORT: 0x0000004,
  745. MULTILINE: 0x0001000,
  746. PASSWORD: 0x0002000,
  747. NOTOGGLETOOFF: 0x0004000,
  748. RADIO: 0x0008000,
  749. PUSHBUTTON: 0x0010000,
  750. COMBO: 0x0020000,
  751. EDIT: 0x0040000,
  752. SORT: 0x0080000,
  753. FILESELECT: 0x0100000,
  754. MULTISELECT: 0x0200000,
  755. DONOTSPELLCHECK: 0x0400000,
  756. DONOTSCROLL: 0x0800000,
  757. COMB: 0x1000000,
  758. RICHTEXT: 0x2000000,
  759. RADIOSINUNISON: 0x2000000,
  760. COMMITONSELCHANGE: 0x4000000
  761. };
  762. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  763. const AnnotationBorderStyleType = {
  764. SOLID: 1,
  765. DASHED: 2,
  766. BEVELED: 3,
  767. INSET: 4,
  768. UNDERLINE: 5
  769. };
  770. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  771. const AnnotationActionEventType = {
  772. E: "Mouse Enter",
  773. X: "Mouse Exit",
  774. D: "Mouse Down",
  775. U: "Mouse Up",
  776. Fo: "Focus",
  777. Bl: "Blur",
  778. PO: "PageOpen",
  779. PC: "PageClose",
  780. PV: "PageVisible",
  781. PI: "PageInvisible",
  782. K: "Keystroke",
  783. F: "Format",
  784. V: "Validate",
  785. C: "Calculate"
  786. };
  787. exports.AnnotationActionEventType = AnnotationActionEventType;
  788. const DocumentActionEventType = {
  789. WC: "WillClose",
  790. WS: "WillSave",
  791. DS: "DidSave",
  792. WP: "WillPrint",
  793. DP: "DidPrint"
  794. };
  795. exports.DocumentActionEventType = DocumentActionEventType;
  796. const PageActionEventType = {
  797. O: "PageOpen",
  798. C: "PageClose"
  799. };
  800. exports.PageActionEventType = PageActionEventType;
  801. const StreamType = {
  802. UNKNOWN: "UNKNOWN",
  803. FLATE: "FLATE",
  804. LZW: "LZW",
  805. DCT: "DCT",
  806. JPX: "JPX",
  807. JBIG: "JBIG",
  808. A85: "A85",
  809. AHX: "AHX",
  810. CCF: "CCF",
  811. RLX: "RLX"
  812. };
  813. exports.StreamType = StreamType;
  814. const FontType = {
  815. UNKNOWN: "UNKNOWN",
  816. TYPE1: "TYPE1",
  817. TYPE1C: "TYPE1C",
  818. CIDFONTTYPE0: "CIDFONTTYPE0",
  819. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  820. TRUETYPE: "TRUETYPE",
  821. CIDFONTTYPE2: "CIDFONTTYPE2",
  822. TYPE3: "TYPE3",
  823. OPENTYPE: "OPENTYPE",
  824. TYPE0: "TYPE0",
  825. MMTYPE1: "MMTYPE1"
  826. };
  827. exports.FontType = FontType;
  828. const VerbosityLevel = {
  829. ERRORS: 0,
  830. WARNINGS: 1,
  831. INFOS: 5
  832. };
  833. exports.VerbosityLevel = VerbosityLevel;
  834. const CMapCompressionType = {
  835. NONE: 0,
  836. BINARY: 1,
  837. STREAM: 2
  838. };
  839. exports.CMapCompressionType = CMapCompressionType;
  840. const OPS = {
  841. dependency: 1,
  842. setLineWidth: 2,
  843. setLineCap: 3,
  844. setLineJoin: 4,
  845. setMiterLimit: 5,
  846. setDash: 6,
  847. setRenderingIntent: 7,
  848. setFlatness: 8,
  849. setGState: 9,
  850. save: 10,
  851. restore: 11,
  852. transform: 12,
  853. moveTo: 13,
  854. lineTo: 14,
  855. curveTo: 15,
  856. curveTo2: 16,
  857. curveTo3: 17,
  858. closePath: 18,
  859. rectangle: 19,
  860. stroke: 20,
  861. closeStroke: 21,
  862. fill: 22,
  863. eoFill: 23,
  864. fillStroke: 24,
  865. eoFillStroke: 25,
  866. closeFillStroke: 26,
  867. closeEOFillStroke: 27,
  868. endPath: 28,
  869. clip: 29,
  870. eoClip: 30,
  871. beginText: 31,
  872. endText: 32,
  873. setCharSpacing: 33,
  874. setWordSpacing: 34,
  875. setHScale: 35,
  876. setLeading: 36,
  877. setFont: 37,
  878. setTextRenderingMode: 38,
  879. setTextRise: 39,
  880. moveText: 40,
  881. setLeadingMoveText: 41,
  882. setTextMatrix: 42,
  883. nextLine: 43,
  884. showText: 44,
  885. showSpacedText: 45,
  886. nextLineShowText: 46,
  887. nextLineSetSpacingShowText: 47,
  888. setCharWidth: 48,
  889. setCharWidthAndBounds: 49,
  890. setStrokeColorSpace: 50,
  891. setFillColorSpace: 51,
  892. setStrokeColor: 52,
  893. setStrokeColorN: 53,
  894. setFillColor: 54,
  895. setFillColorN: 55,
  896. setStrokeGray: 56,
  897. setFillGray: 57,
  898. setStrokeRGBColor: 58,
  899. setFillRGBColor: 59,
  900. setStrokeCMYKColor: 60,
  901. setFillCMYKColor: 61,
  902. shadingFill: 62,
  903. beginInlineImage: 63,
  904. beginImageData: 64,
  905. endInlineImage: 65,
  906. paintXObject: 66,
  907. markPoint: 67,
  908. markPointProps: 68,
  909. beginMarkedContent: 69,
  910. beginMarkedContentProps: 70,
  911. endMarkedContent: 71,
  912. beginCompat: 72,
  913. endCompat: 73,
  914. paintFormXObjectBegin: 74,
  915. paintFormXObjectEnd: 75,
  916. beginGroup: 76,
  917. endGroup: 77,
  918. beginAnnotations: 78,
  919. endAnnotations: 79,
  920. beginAnnotation: 80,
  921. endAnnotation: 81,
  922. paintJpegXObject: 82,
  923. paintImageMaskXObject: 83,
  924. paintImageMaskXObjectGroup: 84,
  925. paintImageXObject: 85,
  926. paintInlineImageXObject: 86,
  927. paintInlineImageXObjectGroup: 87,
  928. paintImageXObjectRepeat: 88,
  929. paintImageMaskXObjectRepeat: 89,
  930. paintSolidColorImageMask: 90,
  931. constructPath: 91
  932. };
  933. exports.OPS = OPS;
  934. const UNSUPPORTED_FEATURES = {
  935. unknown: "unknown",
  936. forms: "forms",
  937. javaScript: "javaScript",
  938. signatures: "signatures",
  939. smask: "smask",
  940. shadingPattern: "shadingPattern",
  941. font: "font",
  942. errorTilingPattern: "errorTilingPattern",
  943. errorExtGState: "errorExtGState",
  944. errorXObject: "errorXObject",
  945. errorFontLoadType3: "errorFontLoadType3",
  946. errorFontState: "errorFontState",
  947. errorFontMissing: "errorFontMissing",
  948. errorFontTranslate: "errorFontTranslate",
  949. errorColorSpace: "errorColorSpace",
  950. errorOperatorList: "errorOperatorList",
  951. errorFontToUnicode: "errorFontToUnicode",
  952. errorFontLoadNative: "errorFontLoadNative",
  953. errorFontBuildPath: "errorFontBuildPath",
  954. errorFontGetPath: "errorFontGetPath",
  955. errorMarkedContent: "errorMarkedContent"
  956. };
  957. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  958. const PasswordResponses = {
  959. NEED_PASSWORD: 1,
  960. INCORRECT_PASSWORD: 2
  961. };
  962. exports.PasswordResponses = PasswordResponses;
  963. let verbosity = VerbosityLevel.WARNINGS;
  964. function setVerbosityLevel(level) {
  965. if (Number.isInteger(level)) {
  966. verbosity = level;
  967. }
  968. }
  969. function getVerbosityLevel() {
  970. return verbosity;
  971. }
  972. function info(msg) {
  973. if (verbosity >= VerbosityLevel.INFOS) {
  974. console.log(`Info: ${msg}`);
  975. }
  976. }
  977. function warn(msg) {
  978. if (verbosity >= VerbosityLevel.WARNINGS) {
  979. console.log(`Warning: ${msg}`);
  980. }
  981. }
  982. function unreachable(msg) {
  983. throw new Error(msg);
  984. }
  985. function assert(cond, msg) {
  986. if (!cond) {
  987. unreachable(msg);
  988. }
  989. }
  990. function isSameOrigin(baseUrl, otherUrl) {
  991. let base;
  992. try {
  993. base = new URL(baseUrl);
  994. if (!base.origin || base.origin === "null") {
  995. return false;
  996. }
  997. } catch (e) {
  998. return false;
  999. }
  1000. const other = new URL(otherUrl, base);
  1001. return base.origin === other.origin;
  1002. }
  1003. function _isValidProtocol(url) {
  1004. if (!url) {
  1005. return false;
  1006. }
  1007. switch (url.protocol) {
  1008. case "http:":
  1009. case "https:":
  1010. case "ftp:":
  1011. case "mailto:":
  1012. case "tel:":
  1013. return true;
  1014. default:
  1015. return false;
  1016. }
  1017. }
  1018. function createValidAbsoluteUrl(url, baseUrl) {
  1019. if (!url) {
  1020. return null;
  1021. }
  1022. try {
  1023. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1024. if (_isValidProtocol(absoluteUrl)) {
  1025. return absoluteUrl;
  1026. }
  1027. } catch (ex) {}
  1028. return null;
  1029. }
  1030. function shadow(obj, prop, value) {
  1031. Object.defineProperty(obj, prop, {
  1032. value,
  1033. enumerable: true,
  1034. configurable: true,
  1035. writable: false
  1036. });
  1037. return value;
  1038. }
  1039. const BaseException = function BaseExceptionClosure() {
  1040. function BaseException(message) {
  1041. if (this.constructor === BaseException) {
  1042. unreachable("Cannot initialize BaseException.");
  1043. }
  1044. this.message = message;
  1045. this.name = this.constructor.name;
  1046. }
  1047. BaseException.prototype = new Error();
  1048. BaseException.constructor = BaseException;
  1049. return BaseException;
  1050. }();
  1051. exports.BaseException = BaseException;
  1052. class PasswordException extends BaseException {
  1053. constructor(msg, code) {
  1054. super(msg);
  1055. this.code = code;
  1056. }
  1057. }
  1058. exports.PasswordException = PasswordException;
  1059. class UnknownErrorException extends BaseException {
  1060. constructor(msg, details) {
  1061. super(msg);
  1062. this.details = details;
  1063. }
  1064. }
  1065. exports.UnknownErrorException = UnknownErrorException;
  1066. class InvalidPDFException extends BaseException {}
  1067. exports.InvalidPDFException = InvalidPDFException;
  1068. class MissingPDFException extends BaseException {}
  1069. exports.MissingPDFException = MissingPDFException;
  1070. class UnexpectedResponseException extends BaseException {
  1071. constructor(msg, status) {
  1072. super(msg);
  1073. this.status = status;
  1074. }
  1075. }
  1076. exports.UnexpectedResponseException = UnexpectedResponseException;
  1077. class FormatError extends BaseException {}
  1078. exports.FormatError = FormatError;
  1079. class AbortException extends BaseException {}
  1080. exports.AbortException = AbortException;
  1081. const NullCharactersRegExp = /\x00/g;
  1082. function removeNullCharacters(str) {
  1083. if (typeof str !== "string") {
  1084. warn("The argument for removeNullCharacters must be a string.");
  1085. return str;
  1086. }
  1087. return str.replace(NullCharactersRegExp, "");
  1088. }
  1089. function bytesToString(bytes) {
  1090. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1091. const length = bytes.length;
  1092. const MAX_ARGUMENT_COUNT = 8192;
  1093. if (length < MAX_ARGUMENT_COUNT) {
  1094. return String.fromCharCode.apply(null, bytes);
  1095. }
  1096. const strBuf = [];
  1097. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1098. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1099. const chunk = bytes.subarray(i, chunkEnd);
  1100. strBuf.push(String.fromCharCode.apply(null, chunk));
  1101. }
  1102. return strBuf.join("");
  1103. }
  1104. function stringToBytes(str) {
  1105. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1106. const length = str.length;
  1107. const bytes = new Uint8Array(length);
  1108. for (let i = 0; i < length; ++i) {
  1109. bytes[i] = str.charCodeAt(i) & 0xff;
  1110. }
  1111. return bytes;
  1112. }
  1113. function arrayByteLength(arr) {
  1114. if (arr.length !== undefined) {
  1115. return arr.length;
  1116. }
  1117. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1118. return arr.byteLength;
  1119. }
  1120. function arraysToBytes(arr) {
  1121. const length = arr.length;
  1122. if (length === 1 && arr[0] instanceof Uint8Array) {
  1123. return arr[0];
  1124. }
  1125. let resultLength = 0;
  1126. for (let i = 0; i < length; i++) {
  1127. resultLength += arrayByteLength(arr[i]);
  1128. }
  1129. let pos = 0;
  1130. const data = new Uint8Array(resultLength);
  1131. for (let i = 0; i < length; i++) {
  1132. let item = arr[i];
  1133. if (!(item instanceof Uint8Array)) {
  1134. if (typeof item === "string") {
  1135. item = stringToBytes(item);
  1136. } else {
  1137. item = new Uint8Array(item);
  1138. }
  1139. }
  1140. const itemLength = item.byteLength;
  1141. data.set(item, pos);
  1142. pos += itemLength;
  1143. }
  1144. return data;
  1145. }
  1146. function string32(value) {
  1147. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1148. }
  1149. function objectSize(obj) {
  1150. return Object.keys(obj).length;
  1151. }
  1152. function objectFromMap(map) {
  1153. const obj = Object.create(null);
  1154. for (const [key, value] of map) {
  1155. obj[key] = value;
  1156. }
  1157. return obj;
  1158. }
  1159. function isLittleEndian() {
  1160. const buffer8 = new Uint8Array(4);
  1161. buffer8[0] = 1;
  1162. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1163. return view32[0] === 1;
  1164. }
  1165. const IsLittleEndianCached = {
  1166. get value() {
  1167. return shadow(this, "value", isLittleEndian());
  1168. }
  1169. };
  1170. exports.IsLittleEndianCached = IsLittleEndianCached;
  1171. function isEvalSupported() {
  1172. try {
  1173. new Function("");
  1174. return true;
  1175. } catch (e) {
  1176. return false;
  1177. }
  1178. }
  1179. const IsEvalSupportedCached = {
  1180. get value() {
  1181. return shadow(this, "value", isEvalSupported());
  1182. }
  1183. };
  1184. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1185. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1186. class Util {
  1187. static makeHexColor(r, g, b) {
  1188. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1189. }
  1190. static transform(m1, m2) {
  1191. 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]];
  1192. }
  1193. static applyTransform(p, m) {
  1194. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1195. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1196. return [xt, yt];
  1197. }
  1198. static applyInverseTransform(p, m) {
  1199. const d = m[0] * m[3] - m[1] * m[2];
  1200. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1201. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1202. return [xt, yt];
  1203. }
  1204. static getAxialAlignedBoundingBox(r, m) {
  1205. const p1 = Util.applyTransform(r, m);
  1206. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1207. const p3 = Util.applyTransform([r[0], r[3]], m);
  1208. const p4 = Util.applyTransform([r[2], r[1]], m);
  1209. 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])];
  1210. }
  1211. static inverseTransform(m) {
  1212. const d = m[0] * m[3] - m[1] * m[2];
  1213. 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];
  1214. }
  1215. static apply3dTransform(m, v) {
  1216. 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]];
  1217. }
  1218. static singularValueDecompose2dScale(m) {
  1219. const transpose = [m[0], m[2], m[1], m[3]];
  1220. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1221. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1222. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1223. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1224. const first = (a + d) / 2;
  1225. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1226. const sx = first + second || 1;
  1227. const sy = first - second || 1;
  1228. return [Math.sqrt(sx), Math.sqrt(sy)];
  1229. }
  1230. static normalizeRect(rect) {
  1231. const r = rect.slice(0);
  1232. if (rect[0] > rect[2]) {
  1233. r[0] = rect[2];
  1234. r[2] = rect[0];
  1235. }
  1236. if (rect[1] > rect[3]) {
  1237. r[1] = rect[3];
  1238. r[3] = rect[1];
  1239. }
  1240. return r;
  1241. }
  1242. static intersect(rect1, rect2) {
  1243. function compare(a, b) {
  1244. return a - b;
  1245. }
  1246. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1247. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1248. const result = [];
  1249. rect1 = Util.normalizeRect(rect1);
  1250. rect2 = Util.normalizeRect(rect2);
  1251. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1252. result[0] = orderedX[1];
  1253. result[2] = orderedX[2];
  1254. } else {
  1255. return null;
  1256. }
  1257. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1258. result[1] = orderedY[1];
  1259. result[3] = orderedY[2];
  1260. } else {
  1261. return null;
  1262. }
  1263. return result;
  1264. }
  1265. }
  1266. exports.Util = Util;
  1267. 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];
  1268. function stringToPDFString(str) {
  1269. const length = str.length,
  1270. strBuf = [];
  1271. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1272. for (let i = 2; i < length; i += 2) {
  1273. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1274. }
  1275. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1276. for (let i = 2; i < length; i += 2) {
  1277. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1278. }
  1279. } else {
  1280. for (let i = 0; i < length; ++i) {
  1281. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1282. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1283. }
  1284. }
  1285. return strBuf.join("");
  1286. }
  1287. function escapeString(str) {
  1288. return str.replace(/([()\\\n\r])/g, match => {
  1289. if (match === "\n") {
  1290. return "\\n";
  1291. } else if (match === "\r") {
  1292. return "\\r";
  1293. }
  1294. return `\\${match}`;
  1295. });
  1296. }
  1297. function isAscii(str) {
  1298. return /^[\x00-\x7F]*$/.test(str);
  1299. }
  1300. function stringToUTF16BEString(str) {
  1301. const buf = ["\xFE\xFF"];
  1302. for (let i = 0, ii = str.length; i < ii; i++) {
  1303. const char = str.charCodeAt(i);
  1304. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1305. }
  1306. return buf.join("");
  1307. }
  1308. function stringToUTF8String(str) {
  1309. return decodeURIComponent(escape(str));
  1310. }
  1311. function utf8StringToString(str) {
  1312. return unescape(encodeURIComponent(str));
  1313. }
  1314. function isBool(v) {
  1315. return typeof v === "boolean";
  1316. }
  1317. function isNum(v) {
  1318. return typeof v === "number";
  1319. }
  1320. function isString(v) {
  1321. return typeof v === "string";
  1322. }
  1323. function isArrayBuffer(v) {
  1324. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1325. }
  1326. function isArrayEqual(arr1, arr2) {
  1327. if (arr1.length !== arr2.length) {
  1328. return false;
  1329. }
  1330. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1331. if (arr1[i] !== arr2[i]) {
  1332. return false;
  1333. }
  1334. }
  1335. return true;
  1336. }
  1337. function getModificationDate(date = new Date()) {
  1338. 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")];
  1339. return buffer.join("");
  1340. }
  1341. function createPromiseCapability() {
  1342. const capability = Object.create(null);
  1343. let isSettled = false;
  1344. Object.defineProperty(capability, "settled", {
  1345. get() {
  1346. return isSettled;
  1347. }
  1348. });
  1349. capability.promise = new Promise(function (resolve, reject) {
  1350. capability.resolve = function (data) {
  1351. isSettled = true;
  1352. resolve(data);
  1353. };
  1354. capability.reject = function (reason) {
  1355. isSettled = true;
  1356. reject(reason);
  1357. };
  1358. });
  1359. return capability;
  1360. }
  1361. function createObjectURL(data, contentType = "", forceDataSchema = false) {
  1362. if (URL.createObjectURL && !forceDataSchema) {
  1363. return URL.createObjectURL(new Blob([data], {
  1364. type: contentType
  1365. }));
  1366. }
  1367. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1368. let buffer = `data:${contentType};base64,`;
  1369. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1370. const b1 = data[i] & 0xff;
  1371. const b2 = data[i + 1] & 0xff;
  1372. const b3 = data[i + 2] & 0xff;
  1373. const d1 = b1 >> 2,
  1374. d2 = (b1 & 3) << 4 | b2 >> 4;
  1375. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1376. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1377. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1378. }
  1379. return buffer;
  1380. }
  1381. /***/ }),
  1382. /* 3 */
  1383. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1384. var _is_node = __w_pdfjs_require__(4);
  1385. ;
  1386. /***/ }),
  1387. /* 4 */
  1388. /***/ ((__unused_webpack_module, exports) => {
  1389. Object.defineProperty(exports, "__esModule", ({
  1390. value: true
  1391. }));
  1392. exports.isNodeJS = void 0;
  1393. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1394. exports.isNodeJS = isNodeJS;
  1395. /***/ }),
  1396. /* 5 */
  1397. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1398. Object.defineProperty(exports, "__esModule", ({
  1399. value: true
  1400. }));
  1401. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1402. exports.isCmd = isCmd;
  1403. exports.isDict = isDict;
  1404. exports.isEOF = isEOF;
  1405. exports.isName = isName;
  1406. exports.isRef = isRef;
  1407. exports.isRefsEqual = isRefsEqual;
  1408. exports.isStream = isStream;
  1409. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = void 0;
  1410. var _util = __w_pdfjs_require__(2);
  1411. var _base_stream = __w_pdfjs_require__(6);
  1412. const EOF = {};
  1413. exports.EOF = EOF;
  1414. const Name = function NameClosure() {
  1415. let nameCache = Object.create(null);
  1416. class Name {
  1417. constructor(name) {
  1418. this.name = name;
  1419. }
  1420. static get(name) {
  1421. const nameValue = nameCache[name];
  1422. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1423. }
  1424. static _clearCache() {
  1425. nameCache = Object.create(null);
  1426. }
  1427. }
  1428. return Name;
  1429. }();
  1430. exports.Name = Name;
  1431. const Cmd = function CmdClosure() {
  1432. let cmdCache = Object.create(null);
  1433. class Cmd {
  1434. constructor(cmd) {
  1435. this.cmd = cmd;
  1436. }
  1437. static get(cmd) {
  1438. const cmdValue = cmdCache[cmd];
  1439. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1440. }
  1441. static _clearCache() {
  1442. cmdCache = Object.create(null);
  1443. }
  1444. }
  1445. return Cmd;
  1446. }();
  1447. exports.Cmd = Cmd;
  1448. const nonSerializable = function nonSerializableClosure() {
  1449. return nonSerializable;
  1450. };
  1451. class Dict {
  1452. constructor(xref = null) {
  1453. this._map = Object.create(null);
  1454. this.xref = xref;
  1455. this.objId = null;
  1456. this.suppressEncryption = false;
  1457. this.__nonSerializable__ = nonSerializable;
  1458. }
  1459. assignXref(newXref) {
  1460. this.xref = newXref;
  1461. }
  1462. get size() {
  1463. return Object.keys(this._map).length;
  1464. }
  1465. get(key1, key2, key3) {
  1466. let value = this._map[key1];
  1467. if (value === undefined && key2 !== undefined) {
  1468. value = this._map[key2];
  1469. if (value === undefined && key3 !== undefined) {
  1470. value = this._map[key3];
  1471. }
  1472. }
  1473. if (value instanceof Ref && this.xref) {
  1474. return this.xref.fetch(value, this.suppressEncryption);
  1475. }
  1476. return value;
  1477. }
  1478. async getAsync(key1, key2, key3) {
  1479. let value = this._map[key1];
  1480. if (value === undefined && key2 !== undefined) {
  1481. value = this._map[key2];
  1482. if (value === undefined && key3 !== undefined) {
  1483. value = this._map[key3];
  1484. }
  1485. }
  1486. if (value instanceof Ref && this.xref) {
  1487. return this.xref.fetchAsync(value, this.suppressEncryption);
  1488. }
  1489. return value;
  1490. }
  1491. getArray(key1, key2, key3) {
  1492. let value = this._map[key1];
  1493. if (value === undefined && key2 !== undefined) {
  1494. value = this._map[key2];
  1495. if (value === undefined && key3 !== undefined) {
  1496. value = this._map[key3];
  1497. }
  1498. }
  1499. if (value instanceof Ref && this.xref) {
  1500. value = this.xref.fetch(value, this.suppressEncryption);
  1501. }
  1502. if (Array.isArray(value)) {
  1503. value = value.slice();
  1504. for (let i = 0, ii = value.length; i < ii; i++) {
  1505. if (value[i] instanceof Ref && this.xref) {
  1506. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1507. }
  1508. }
  1509. }
  1510. return value;
  1511. }
  1512. getRaw(key) {
  1513. return this._map[key];
  1514. }
  1515. getKeys() {
  1516. return Object.keys(this._map);
  1517. }
  1518. getRawValues() {
  1519. return Object.values(this._map);
  1520. }
  1521. set(key, value) {
  1522. this._map[key] = value;
  1523. }
  1524. has(key) {
  1525. return this._map[key] !== undefined;
  1526. }
  1527. forEach(callback) {
  1528. for (const key in this._map) {
  1529. callback(key, this.get(key));
  1530. }
  1531. }
  1532. static get empty() {
  1533. const emptyDict = new Dict(null);
  1534. emptyDict.set = (key, value) => {
  1535. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1536. };
  1537. return (0, _util.shadow)(this, "empty", emptyDict);
  1538. }
  1539. static merge({
  1540. xref,
  1541. dictArray,
  1542. mergeSubDicts = false
  1543. }) {
  1544. const mergedDict = new Dict(xref);
  1545. if (!mergeSubDicts) {
  1546. for (const dict of dictArray) {
  1547. if (!(dict instanceof Dict)) {
  1548. continue;
  1549. }
  1550. for (const [key, value] of Object.entries(dict._map)) {
  1551. if (mergedDict._map[key] === undefined) {
  1552. mergedDict._map[key] = value;
  1553. }
  1554. }
  1555. }
  1556. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1557. }
  1558. const properties = new Map();
  1559. for (const dict of dictArray) {
  1560. if (!(dict instanceof Dict)) {
  1561. continue;
  1562. }
  1563. for (const [key, value] of Object.entries(dict._map)) {
  1564. let property = properties.get(key);
  1565. if (property === undefined) {
  1566. property = [];
  1567. properties.set(key, property);
  1568. }
  1569. property.push(value);
  1570. }
  1571. }
  1572. for (const [name, values] of properties) {
  1573. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1574. mergedDict._map[name] = values[0];
  1575. continue;
  1576. }
  1577. const subDict = new Dict(xref);
  1578. for (const dict of values) {
  1579. if (!(dict instanceof Dict)) {
  1580. continue;
  1581. }
  1582. for (const [key, value] of Object.entries(dict._map)) {
  1583. if (subDict._map[key] === undefined) {
  1584. subDict._map[key] = value;
  1585. }
  1586. }
  1587. }
  1588. if (subDict.size > 0) {
  1589. mergedDict._map[name] = subDict;
  1590. }
  1591. }
  1592. properties.clear();
  1593. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1594. }
  1595. }
  1596. exports.Dict = Dict;
  1597. const Ref = function RefClosure() {
  1598. let refCache = Object.create(null);
  1599. class Ref {
  1600. constructor(num, gen) {
  1601. this.num = num;
  1602. this.gen = gen;
  1603. }
  1604. toString() {
  1605. if (this.gen === 0) {
  1606. return `${this.num}R`;
  1607. }
  1608. return `${this.num}R${this.gen}`;
  1609. }
  1610. static get(num, gen) {
  1611. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1612. const refValue = refCache[key];
  1613. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1614. }
  1615. static _clearCache() {
  1616. refCache = Object.create(null);
  1617. }
  1618. }
  1619. return Ref;
  1620. }();
  1621. exports.Ref = Ref;
  1622. class RefSet {
  1623. constructor(parent = null) {
  1624. this._set = new Set(parent && parent._set);
  1625. }
  1626. has(ref) {
  1627. return this._set.has(ref.toString());
  1628. }
  1629. put(ref) {
  1630. this._set.add(ref.toString());
  1631. }
  1632. remove(ref) {
  1633. this._set.delete(ref.toString());
  1634. }
  1635. forEach(callback) {
  1636. for (const ref of this._set.values()) {
  1637. callback(ref);
  1638. }
  1639. }
  1640. clear() {
  1641. this._set.clear();
  1642. }
  1643. }
  1644. exports.RefSet = RefSet;
  1645. class RefSetCache {
  1646. constructor() {
  1647. this._map = new Map();
  1648. }
  1649. get size() {
  1650. return this._map.size;
  1651. }
  1652. get(ref) {
  1653. return this._map.get(ref.toString());
  1654. }
  1655. has(ref) {
  1656. return this._map.has(ref.toString());
  1657. }
  1658. put(ref, obj) {
  1659. this._map.set(ref.toString(), obj);
  1660. }
  1661. putAlias(ref, aliasRef) {
  1662. this._map.set(ref.toString(), this.get(aliasRef));
  1663. }
  1664. forEach(callback) {
  1665. for (const value of this._map.values()) {
  1666. callback(value);
  1667. }
  1668. }
  1669. clear() {
  1670. this._map.clear();
  1671. }
  1672. }
  1673. exports.RefSetCache = RefSetCache;
  1674. function isEOF(v) {
  1675. return v === EOF;
  1676. }
  1677. function isName(v, name) {
  1678. return v instanceof Name && (name === undefined || v.name === name);
  1679. }
  1680. function isCmd(v, cmd) {
  1681. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1682. }
  1683. function isDict(v, type) {
  1684. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1685. }
  1686. function isRef(v) {
  1687. return v instanceof Ref;
  1688. }
  1689. function isRefsEqual(v1, v2) {
  1690. return v1.num === v2.num && v1.gen === v2.gen;
  1691. }
  1692. function isStream(v) {
  1693. return v instanceof _base_stream.BaseStream;
  1694. }
  1695. function clearPrimitiveCaches() {
  1696. Cmd._clearCache();
  1697. Name._clearCache();
  1698. Ref._clearCache();
  1699. }
  1700. /***/ }),
  1701. /* 6 */
  1702. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1703. Object.defineProperty(exports, "__esModule", ({
  1704. value: true
  1705. }));
  1706. exports.BaseStream = void 0;
  1707. var _util = __w_pdfjs_require__(2);
  1708. class BaseStream {
  1709. constructor() {
  1710. if (this.constructor === BaseStream) {
  1711. (0, _util.unreachable)("Cannot initialize BaseStream.");
  1712. }
  1713. }
  1714. get length() {
  1715. (0, _util.unreachable)("Abstract getter `length` accessed");
  1716. }
  1717. get isEmpty() {
  1718. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  1719. }
  1720. get isDataLoaded() {
  1721. return (0, _util.shadow)(this, "isDataLoaded", true);
  1722. }
  1723. getByte() {
  1724. (0, _util.unreachable)("Abstract method `getByte` called");
  1725. }
  1726. getBytes(length, forceClamped = false) {
  1727. (0, _util.unreachable)("Abstract method `getBytes` called");
  1728. }
  1729. peekByte() {
  1730. const peekedByte = this.getByte();
  1731. if (peekedByte !== -1) {
  1732. this.pos--;
  1733. }
  1734. return peekedByte;
  1735. }
  1736. peekBytes(length, forceClamped = false) {
  1737. const bytes = this.getBytes(length, forceClamped);
  1738. this.pos -= bytes.length;
  1739. return bytes;
  1740. }
  1741. getUint16() {
  1742. const b0 = this.getByte();
  1743. const b1 = this.getByte();
  1744. if (b0 === -1 || b1 === -1) {
  1745. return -1;
  1746. }
  1747. return (b0 << 8) + b1;
  1748. }
  1749. getInt32() {
  1750. const b0 = this.getByte();
  1751. const b1 = this.getByte();
  1752. const b2 = this.getByte();
  1753. const b3 = this.getByte();
  1754. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1755. }
  1756. getByteRange(begin, end) {
  1757. (0, _util.unreachable)("Abstract method `getByteRange` called");
  1758. }
  1759. getString(length) {
  1760. return (0, _util.bytesToString)(this.getBytes(length, false));
  1761. }
  1762. skip(n) {
  1763. this.pos += n || 1;
  1764. }
  1765. reset() {
  1766. (0, _util.unreachable)("Abstract method `reset` called");
  1767. }
  1768. moveStart() {
  1769. (0, _util.unreachable)("Abstract method `moveStart` called");
  1770. }
  1771. makeSubStream(start, length, dict = null) {
  1772. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  1773. }
  1774. getBaseStreams() {
  1775. return null;
  1776. }
  1777. }
  1778. exports.BaseStream = BaseStream;
  1779. /***/ }),
  1780. /* 7 */
  1781. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1782. Object.defineProperty(exports, "__esModule", ({
  1783. value: true
  1784. }));
  1785. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1786. var _util = __w_pdfjs_require__(2);
  1787. var _chunked_stream = __w_pdfjs_require__(8);
  1788. var _core_utils = __w_pdfjs_require__(9);
  1789. var _document = __w_pdfjs_require__(11);
  1790. var _stream = __w_pdfjs_require__(10);
  1791. function parseDocBaseUrl(url) {
  1792. if (url) {
  1793. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1794. if (absoluteUrl) {
  1795. return absoluteUrl.href;
  1796. }
  1797. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1798. }
  1799. return null;
  1800. }
  1801. class BasePdfManager {
  1802. constructor() {
  1803. if (this.constructor === BasePdfManager) {
  1804. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1805. }
  1806. }
  1807. get docId() {
  1808. return this._docId;
  1809. }
  1810. get password() {
  1811. return this._password;
  1812. }
  1813. get docBaseUrl() {
  1814. return this._docBaseUrl;
  1815. }
  1816. onLoadedStream() {
  1817. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1818. }
  1819. ensureDoc(prop, args) {
  1820. return this.ensure(this.pdfDocument, prop, args);
  1821. }
  1822. ensureXRef(prop, args) {
  1823. return this.ensure(this.pdfDocument.xref, prop, args);
  1824. }
  1825. ensureCatalog(prop, args) {
  1826. return this.ensure(this.pdfDocument.catalog, prop, args);
  1827. }
  1828. getPage(pageIndex) {
  1829. return this.pdfDocument.getPage(pageIndex);
  1830. }
  1831. fontFallback(id, handler) {
  1832. return this.pdfDocument.fontFallback(id, handler);
  1833. }
  1834. loadXfaFonts(handler, task) {
  1835. return this.pdfDocument.loadXfaFonts(handler, task);
  1836. }
  1837. cleanup(manuallyTriggered = false) {
  1838. return this.pdfDocument.cleanup(manuallyTriggered);
  1839. }
  1840. async ensure(obj, prop, args) {
  1841. (0, _util.unreachable)("Abstract method `ensure` called");
  1842. }
  1843. requestRange(begin, end) {
  1844. (0, _util.unreachable)("Abstract method `requestRange` called");
  1845. }
  1846. requestLoadedStream() {
  1847. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1848. }
  1849. sendProgressiveData(chunk) {
  1850. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1851. }
  1852. updatePassword(password) {
  1853. this._password = password;
  1854. }
  1855. terminate(reason) {
  1856. (0, _util.unreachable)("Abstract method `terminate` called");
  1857. }
  1858. }
  1859. class LocalPdfManager extends BasePdfManager {
  1860. constructor(docId, data, password, evaluatorOptions, enableXfa, docBaseUrl) {
  1861. super();
  1862. this._docId = docId;
  1863. this._password = password;
  1864. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1865. this.evaluatorOptions = evaluatorOptions;
  1866. this.enableXfa = enableXfa;
  1867. const stream = new _stream.Stream(data);
  1868. this.pdfDocument = new _document.PDFDocument(this, stream);
  1869. this._loadedStreamPromise = Promise.resolve(stream);
  1870. }
  1871. async ensure(obj, prop, args) {
  1872. const value = obj[prop];
  1873. if (typeof value === "function") {
  1874. return value.apply(obj, args);
  1875. }
  1876. return value;
  1877. }
  1878. requestRange(begin, end) {
  1879. return Promise.resolve();
  1880. }
  1881. requestLoadedStream() {}
  1882. onLoadedStream() {
  1883. return this._loadedStreamPromise;
  1884. }
  1885. terminate(reason) {}
  1886. }
  1887. exports.LocalPdfManager = LocalPdfManager;
  1888. class NetworkPdfManager extends BasePdfManager {
  1889. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1890. super();
  1891. this._docId = docId;
  1892. this._password = args.password;
  1893. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1894. this.msgHandler = args.msgHandler;
  1895. this.evaluatorOptions = evaluatorOptions;
  1896. this.enableXfa = enableXfa;
  1897. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1898. msgHandler: args.msgHandler,
  1899. length: args.length,
  1900. disableAutoFetch: args.disableAutoFetch,
  1901. rangeChunkSize: args.rangeChunkSize
  1902. });
  1903. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1904. }
  1905. async ensure(obj, prop, args) {
  1906. try {
  1907. const value = obj[prop];
  1908. if (typeof value === "function") {
  1909. return value.apply(obj, args);
  1910. }
  1911. return value;
  1912. } catch (ex) {
  1913. if (!(ex instanceof _core_utils.MissingDataException)) {
  1914. throw ex;
  1915. }
  1916. await this.requestRange(ex.begin, ex.end);
  1917. return this.ensure(obj, prop, args);
  1918. }
  1919. }
  1920. requestRange(begin, end) {
  1921. return this.streamManager.requestRange(begin, end);
  1922. }
  1923. requestLoadedStream() {
  1924. this.streamManager.requestAllChunks();
  1925. }
  1926. sendProgressiveData(chunk) {
  1927. this.streamManager.onReceiveData({
  1928. chunk
  1929. });
  1930. }
  1931. onLoadedStream() {
  1932. return this.streamManager.onLoadedStream();
  1933. }
  1934. terminate(reason) {
  1935. this.streamManager.abort(reason);
  1936. }
  1937. }
  1938. exports.NetworkPdfManager = NetworkPdfManager;
  1939. /***/ }),
  1940. /* 8 */
  1941. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1942. Object.defineProperty(exports, "__esModule", ({
  1943. value: true
  1944. }));
  1945. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1946. var _util = __w_pdfjs_require__(2);
  1947. var _core_utils = __w_pdfjs_require__(9);
  1948. var _stream = __w_pdfjs_require__(10);
  1949. class ChunkedStream extends _stream.Stream {
  1950. constructor(length, chunkSize, manager) {
  1951. super(new Uint8Array(length), 0, length, null);
  1952. this.chunkSize = chunkSize;
  1953. this._loadedChunks = new Set();
  1954. this.numChunks = Math.ceil(length / chunkSize);
  1955. this.manager = manager;
  1956. this.progressiveDataLength = 0;
  1957. this.lastSuccessfulEnsureByteChunk = -1;
  1958. }
  1959. getMissingChunks() {
  1960. const chunks = [];
  1961. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1962. if (!this._loadedChunks.has(chunk)) {
  1963. chunks.push(chunk);
  1964. }
  1965. }
  1966. return chunks;
  1967. }
  1968. get numChunksLoaded() {
  1969. return this._loadedChunks.size;
  1970. }
  1971. get isDataLoaded() {
  1972. return this.numChunksLoaded === this.numChunks;
  1973. }
  1974. onReceiveData(begin, chunk) {
  1975. const chunkSize = this.chunkSize;
  1976. if (begin % chunkSize !== 0) {
  1977. throw new Error(`Bad begin offset: ${begin}`);
  1978. }
  1979. const end = begin + chunk.byteLength;
  1980. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1981. throw new Error(`Bad end offset: ${end}`);
  1982. }
  1983. this.bytes.set(new Uint8Array(chunk), begin);
  1984. const beginChunk = Math.floor(begin / chunkSize);
  1985. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1986. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1987. this._loadedChunks.add(curChunk);
  1988. }
  1989. }
  1990. onReceiveProgressiveData(data) {
  1991. let position = this.progressiveDataLength;
  1992. const beginChunk = Math.floor(position / this.chunkSize);
  1993. this.bytes.set(new Uint8Array(data), position);
  1994. position += data.byteLength;
  1995. this.progressiveDataLength = position;
  1996. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1997. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1998. this._loadedChunks.add(curChunk);
  1999. }
  2000. }
  2001. ensureByte(pos) {
  2002. if (pos < this.progressiveDataLength) {
  2003. return;
  2004. }
  2005. const chunk = Math.floor(pos / this.chunkSize);
  2006. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2007. return;
  2008. }
  2009. if (!this._loadedChunks.has(chunk)) {
  2010. throw new _core_utils.MissingDataException(pos, pos + 1);
  2011. }
  2012. this.lastSuccessfulEnsureByteChunk = chunk;
  2013. }
  2014. ensureRange(begin, end) {
  2015. if (begin >= end) {
  2016. return;
  2017. }
  2018. if (end <= this.progressiveDataLength) {
  2019. return;
  2020. }
  2021. const chunkSize = this.chunkSize;
  2022. const beginChunk = Math.floor(begin / chunkSize);
  2023. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2024. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2025. if (!this._loadedChunks.has(chunk)) {
  2026. throw new _core_utils.MissingDataException(begin, end);
  2027. }
  2028. }
  2029. }
  2030. nextEmptyChunk(beginChunk) {
  2031. const numChunks = this.numChunks;
  2032. for (let i = 0; i < numChunks; ++i) {
  2033. const chunk = (beginChunk + i) % numChunks;
  2034. if (!this._loadedChunks.has(chunk)) {
  2035. return chunk;
  2036. }
  2037. }
  2038. return null;
  2039. }
  2040. hasChunk(chunk) {
  2041. return this._loadedChunks.has(chunk);
  2042. }
  2043. getByte() {
  2044. const pos = this.pos;
  2045. if (pos >= this.end) {
  2046. return -1;
  2047. }
  2048. if (pos >= this.progressiveDataLength) {
  2049. this.ensureByte(pos);
  2050. }
  2051. return this.bytes[this.pos++];
  2052. }
  2053. getBytes(length, forceClamped = false) {
  2054. const bytes = this.bytes;
  2055. const pos = this.pos;
  2056. const strEnd = this.end;
  2057. if (!length) {
  2058. if (strEnd > this.progressiveDataLength) {
  2059. this.ensureRange(pos, strEnd);
  2060. }
  2061. const subarray = bytes.subarray(pos, strEnd);
  2062. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2063. }
  2064. let end = pos + length;
  2065. if (end > strEnd) {
  2066. end = strEnd;
  2067. }
  2068. if (end > this.progressiveDataLength) {
  2069. this.ensureRange(pos, end);
  2070. }
  2071. this.pos = end;
  2072. const subarray = bytes.subarray(pos, end);
  2073. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2074. }
  2075. getByteRange(begin, end) {
  2076. if (begin < 0) {
  2077. begin = 0;
  2078. }
  2079. if (end > this.end) {
  2080. end = this.end;
  2081. }
  2082. if (end > this.progressiveDataLength) {
  2083. this.ensureRange(begin, end);
  2084. }
  2085. return this.bytes.subarray(begin, end);
  2086. }
  2087. makeSubStream(start, length, dict = null) {
  2088. if (length) {
  2089. if (start + length > this.progressiveDataLength) {
  2090. this.ensureRange(start, start + length);
  2091. }
  2092. } else {
  2093. if (start >= this.progressiveDataLength) {
  2094. this.ensureByte(start);
  2095. }
  2096. }
  2097. function ChunkedStreamSubstream() {}
  2098. ChunkedStreamSubstream.prototype = Object.create(this);
  2099. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2100. const chunkSize = this.chunkSize;
  2101. const beginChunk = Math.floor(this.start / chunkSize);
  2102. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2103. const missingChunks = [];
  2104. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2105. if (!this._loadedChunks.has(chunk)) {
  2106. missingChunks.push(chunk);
  2107. }
  2108. }
  2109. return missingChunks;
  2110. };
  2111. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2112. get() {
  2113. if (this.numChunksLoaded === this.numChunks) {
  2114. return true;
  2115. }
  2116. return this.getMissingChunks().length === 0;
  2117. },
  2118. configurable: true
  2119. });
  2120. const subStream = new ChunkedStreamSubstream();
  2121. subStream.pos = subStream.start = start;
  2122. subStream.end = start + length || this.end;
  2123. subStream.dict = dict;
  2124. return subStream;
  2125. }
  2126. getBaseStreams() {
  2127. return [this];
  2128. }
  2129. }
  2130. exports.ChunkedStream = ChunkedStream;
  2131. class ChunkedStreamManager {
  2132. constructor(pdfNetworkStream, args) {
  2133. this.length = args.length;
  2134. this.chunkSize = args.rangeChunkSize;
  2135. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2136. this.pdfNetworkStream = pdfNetworkStream;
  2137. this.disableAutoFetch = args.disableAutoFetch;
  2138. this.msgHandler = args.msgHandler;
  2139. this.currRequestId = 0;
  2140. this._chunksNeededByRequest = new Map();
  2141. this._requestsByChunk = new Map();
  2142. this._promisesByRequest = new Map();
  2143. this.progressiveDataLength = 0;
  2144. this.aborted = false;
  2145. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2146. }
  2147. onLoadedStream() {
  2148. return this._loadedStreamCapability.promise;
  2149. }
  2150. sendRequest(begin, end) {
  2151. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2152. if (!rangeReader.isStreamingSupported) {
  2153. rangeReader.onProgress = this.onProgress.bind(this);
  2154. }
  2155. let chunks = [],
  2156. loaded = 0;
  2157. const promise = new Promise((resolve, reject) => {
  2158. const readChunk = chunk => {
  2159. try {
  2160. if (!chunk.done) {
  2161. const data = chunk.value;
  2162. chunks.push(data);
  2163. loaded += (0, _util.arrayByteLength)(data);
  2164. if (rangeReader.isStreamingSupported) {
  2165. this.onProgress({
  2166. loaded
  2167. });
  2168. }
  2169. rangeReader.read().then(readChunk, reject);
  2170. return;
  2171. }
  2172. const chunkData = (0, _util.arraysToBytes)(chunks);
  2173. chunks = null;
  2174. resolve(chunkData);
  2175. } catch (e) {
  2176. reject(e);
  2177. }
  2178. };
  2179. rangeReader.read().then(readChunk, reject);
  2180. });
  2181. promise.then(data => {
  2182. if (this.aborted) {
  2183. return;
  2184. }
  2185. this.onReceiveData({
  2186. chunk: data,
  2187. begin
  2188. });
  2189. });
  2190. }
  2191. requestAllChunks() {
  2192. const missingChunks = this.stream.getMissingChunks();
  2193. this._requestChunks(missingChunks);
  2194. return this._loadedStreamCapability.promise;
  2195. }
  2196. _requestChunks(chunks) {
  2197. const requestId = this.currRequestId++;
  2198. const chunksNeeded = new Set();
  2199. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2200. for (const chunk of chunks) {
  2201. if (!this.stream.hasChunk(chunk)) {
  2202. chunksNeeded.add(chunk);
  2203. }
  2204. }
  2205. if (chunksNeeded.size === 0) {
  2206. return Promise.resolve();
  2207. }
  2208. const capability = (0, _util.createPromiseCapability)();
  2209. this._promisesByRequest.set(requestId, capability);
  2210. const chunksToRequest = [];
  2211. for (const chunk of chunksNeeded) {
  2212. let requestIds = this._requestsByChunk.get(chunk);
  2213. if (!requestIds) {
  2214. requestIds = [];
  2215. this._requestsByChunk.set(chunk, requestIds);
  2216. chunksToRequest.push(chunk);
  2217. }
  2218. requestIds.push(requestId);
  2219. }
  2220. if (chunksToRequest.length > 0) {
  2221. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2222. for (const groupedChunk of groupedChunksToRequest) {
  2223. const begin = groupedChunk.beginChunk * this.chunkSize;
  2224. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2225. this.sendRequest(begin, end);
  2226. }
  2227. }
  2228. return capability.promise.catch(reason => {
  2229. if (this.aborted) {
  2230. return;
  2231. }
  2232. throw reason;
  2233. });
  2234. }
  2235. getStream() {
  2236. return this.stream;
  2237. }
  2238. requestRange(begin, end) {
  2239. end = Math.min(end, this.length);
  2240. const beginChunk = this.getBeginChunk(begin);
  2241. const endChunk = this.getEndChunk(end);
  2242. const chunks = [];
  2243. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2244. chunks.push(chunk);
  2245. }
  2246. return this._requestChunks(chunks);
  2247. }
  2248. requestRanges(ranges = []) {
  2249. const chunksToRequest = [];
  2250. for (const range of ranges) {
  2251. const beginChunk = this.getBeginChunk(range.begin);
  2252. const endChunk = this.getEndChunk(range.end);
  2253. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2254. if (!chunksToRequest.includes(chunk)) {
  2255. chunksToRequest.push(chunk);
  2256. }
  2257. }
  2258. }
  2259. chunksToRequest.sort(function (a, b) {
  2260. return a - b;
  2261. });
  2262. return this._requestChunks(chunksToRequest);
  2263. }
  2264. groupChunks(chunks) {
  2265. const groupedChunks = [];
  2266. let beginChunk = -1;
  2267. let prevChunk = -1;
  2268. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2269. const chunk = chunks[i];
  2270. if (beginChunk < 0) {
  2271. beginChunk = chunk;
  2272. }
  2273. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2274. groupedChunks.push({
  2275. beginChunk,
  2276. endChunk: prevChunk + 1
  2277. });
  2278. beginChunk = chunk;
  2279. }
  2280. if (i + 1 === chunks.length) {
  2281. groupedChunks.push({
  2282. beginChunk,
  2283. endChunk: chunk + 1
  2284. });
  2285. }
  2286. prevChunk = chunk;
  2287. }
  2288. return groupedChunks;
  2289. }
  2290. onProgress(args) {
  2291. this.msgHandler.send("DocProgress", {
  2292. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2293. total: this.length
  2294. });
  2295. }
  2296. onReceiveData(args) {
  2297. const chunk = args.chunk;
  2298. const isProgressive = args.begin === undefined;
  2299. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2300. const end = begin + chunk.byteLength;
  2301. const beginChunk = Math.floor(begin / this.chunkSize);
  2302. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2303. if (isProgressive) {
  2304. this.stream.onReceiveProgressiveData(chunk);
  2305. this.progressiveDataLength = end;
  2306. } else {
  2307. this.stream.onReceiveData(begin, chunk);
  2308. }
  2309. if (this.stream.isDataLoaded) {
  2310. this._loadedStreamCapability.resolve(this.stream);
  2311. }
  2312. const loadedRequests = [];
  2313. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2314. const requestIds = this._requestsByChunk.get(curChunk);
  2315. if (!requestIds) {
  2316. continue;
  2317. }
  2318. this._requestsByChunk.delete(curChunk);
  2319. for (const requestId of requestIds) {
  2320. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2321. if (chunksNeeded.has(curChunk)) {
  2322. chunksNeeded.delete(curChunk);
  2323. }
  2324. if (chunksNeeded.size > 0) {
  2325. continue;
  2326. }
  2327. loadedRequests.push(requestId);
  2328. }
  2329. }
  2330. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2331. let nextEmptyChunk;
  2332. if (this.stream.numChunksLoaded === 1) {
  2333. const lastChunk = this.stream.numChunks - 1;
  2334. if (!this.stream.hasChunk(lastChunk)) {
  2335. nextEmptyChunk = lastChunk;
  2336. }
  2337. } else {
  2338. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2339. }
  2340. if (Number.isInteger(nextEmptyChunk)) {
  2341. this._requestChunks([nextEmptyChunk]);
  2342. }
  2343. }
  2344. for (const requestId of loadedRequests) {
  2345. const capability = this._promisesByRequest.get(requestId);
  2346. this._promisesByRequest.delete(requestId);
  2347. capability.resolve();
  2348. }
  2349. this.msgHandler.send("DocProgress", {
  2350. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2351. total: this.length
  2352. });
  2353. }
  2354. onError(err) {
  2355. this._loadedStreamCapability.reject(err);
  2356. }
  2357. getBeginChunk(begin) {
  2358. return Math.floor(begin / this.chunkSize);
  2359. }
  2360. getEndChunk(end) {
  2361. return Math.floor((end - 1) / this.chunkSize) + 1;
  2362. }
  2363. abort(reason) {
  2364. this.aborted = true;
  2365. if (this.pdfNetworkStream) {
  2366. this.pdfNetworkStream.cancelAllRequests(reason);
  2367. }
  2368. for (const capability of this._promisesByRequest.values()) {
  2369. capability.reject(reason);
  2370. }
  2371. }
  2372. }
  2373. exports.ChunkedStreamManager = ChunkedStreamManager;
  2374. /***/ }),
  2375. /* 9 */
  2376. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2377. Object.defineProperty(exports, "__esModule", ({
  2378. value: true
  2379. }));
  2380. exports.collectActions = collectActions;
  2381. exports.encodeToXmlString = encodeToXmlString;
  2382. exports.escapePDFName = escapePDFName;
  2383. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2384. exports.getInheritableProperty = getInheritableProperty;
  2385. exports.getLookupTableFactory = getLookupTableFactory;
  2386. exports.isWhiteSpace = isWhiteSpace;
  2387. exports.log2 = log2;
  2388. exports.parseXFAPath = parseXFAPath;
  2389. exports.readInt8 = readInt8;
  2390. exports.readUint16 = readUint16;
  2391. exports.readUint32 = readUint32;
  2392. exports.toRomanNumerals = toRomanNumerals;
  2393. exports.validateCSSFont = validateCSSFont;
  2394. exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
  2395. var _util = __w_pdfjs_require__(2);
  2396. var _primitives = __w_pdfjs_require__(5);
  2397. function getLookupTableFactory(initializer) {
  2398. let lookup;
  2399. return function () {
  2400. if (initializer) {
  2401. lookup = Object.create(null);
  2402. initializer(lookup);
  2403. initializer = null;
  2404. }
  2405. return lookup;
  2406. };
  2407. }
  2408. function getArrayLookupTableFactory(initializer) {
  2409. let lookup;
  2410. return function () {
  2411. if (initializer) {
  2412. let arr = initializer();
  2413. initializer = null;
  2414. lookup = Object.create(null);
  2415. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2416. lookup[arr[i]] = arr[i + 1];
  2417. }
  2418. arr = null;
  2419. }
  2420. return lookup;
  2421. };
  2422. }
  2423. class MissingDataException extends _util.BaseException {
  2424. constructor(begin, end) {
  2425. super(`Missing data [${begin}, ${end})`);
  2426. this.begin = begin;
  2427. this.end = end;
  2428. }
  2429. }
  2430. exports.MissingDataException = MissingDataException;
  2431. class XRefEntryException extends _util.BaseException {}
  2432. exports.XRefEntryException = XRefEntryException;
  2433. class XRefParseException extends _util.BaseException {}
  2434. exports.XRefParseException = XRefParseException;
  2435. function getInheritableProperty({
  2436. dict,
  2437. key,
  2438. getArray = false,
  2439. stopWhenFound = true
  2440. }) {
  2441. let values;
  2442. const visited = new _primitives.RefSet();
  2443. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2444. if (dict.objId) {
  2445. visited.put(dict.objId);
  2446. }
  2447. const value = getArray ? dict.getArray(key) : dict.get(key);
  2448. if (value !== undefined) {
  2449. if (stopWhenFound) {
  2450. return value;
  2451. }
  2452. if (!values) {
  2453. values = [];
  2454. }
  2455. values.push(value);
  2456. }
  2457. dict = dict.get("Parent");
  2458. }
  2459. return values;
  2460. }
  2461. 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"];
  2462. function toRomanNumerals(number, lowerCase = false) {
  2463. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2464. const romanBuf = [];
  2465. let pos;
  2466. while (number >= 1000) {
  2467. number -= 1000;
  2468. romanBuf.push("M");
  2469. }
  2470. pos = number / 100 | 0;
  2471. number %= 100;
  2472. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2473. pos = number / 10 | 0;
  2474. number %= 10;
  2475. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2476. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2477. const romanStr = romanBuf.join("");
  2478. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2479. }
  2480. function log2(x) {
  2481. if (x <= 0) {
  2482. return 0;
  2483. }
  2484. return Math.ceil(Math.log2(x));
  2485. }
  2486. function readInt8(data, offset) {
  2487. return data[offset] << 24 >> 24;
  2488. }
  2489. function readUint16(data, offset) {
  2490. return data[offset] << 8 | data[offset + 1];
  2491. }
  2492. function readUint32(data, offset) {
  2493. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2494. }
  2495. function isWhiteSpace(ch) {
  2496. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2497. }
  2498. function parseXFAPath(path) {
  2499. const positionPattern = /(.+)\[([0-9]+)\]$/;
  2500. return path.split(".").map(component => {
  2501. const m = component.match(positionPattern);
  2502. if (m) {
  2503. return {
  2504. name: m[1],
  2505. pos: parseInt(m[2], 10)
  2506. };
  2507. }
  2508. return {
  2509. name: component,
  2510. pos: 0
  2511. };
  2512. });
  2513. }
  2514. function escapePDFName(str) {
  2515. const buffer = [];
  2516. let start = 0;
  2517. for (let i = 0, ii = str.length; i < ii; i++) {
  2518. const char = str.charCodeAt(i);
  2519. 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) {
  2520. if (start < i) {
  2521. buffer.push(str.substring(start, i));
  2522. }
  2523. buffer.push(`#${char.toString(16)}`);
  2524. start = i + 1;
  2525. }
  2526. }
  2527. if (buffer.length === 0) {
  2528. return str;
  2529. }
  2530. if (start < str.length) {
  2531. buffer.push(str.substring(start, str.length));
  2532. }
  2533. return buffer.join("");
  2534. }
  2535. function _collectJS(entry, xref, list, parents) {
  2536. if (!entry) {
  2537. return;
  2538. }
  2539. let parent = null;
  2540. if ((0, _primitives.isRef)(entry)) {
  2541. if (parents.has(entry)) {
  2542. return;
  2543. }
  2544. parent = entry;
  2545. parents.put(parent);
  2546. entry = xref.fetch(entry);
  2547. }
  2548. if (Array.isArray(entry)) {
  2549. for (const element of entry) {
  2550. _collectJS(element, xref, list, parents);
  2551. }
  2552. } else if (entry instanceof _primitives.Dict) {
  2553. if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) {
  2554. const js = entry.get("JS");
  2555. let code;
  2556. if ((0, _primitives.isStream)(js)) {
  2557. code = js.getString();
  2558. } else {
  2559. code = js;
  2560. }
  2561. code = (0, _util.stringToPDFString)(code);
  2562. if (code) {
  2563. list.push(code);
  2564. }
  2565. }
  2566. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2567. }
  2568. if (parent) {
  2569. parents.remove(parent);
  2570. }
  2571. }
  2572. function collectActions(xref, dict, eventType) {
  2573. const actions = Object.create(null);
  2574. const additionalActionsDicts = getInheritableProperty({
  2575. dict,
  2576. key: "AA",
  2577. stopWhenFound: false
  2578. });
  2579. if (additionalActionsDicts) {
  2580. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2581. const additionalActions = additionalActionsDicts[i];
  2582. if (!(additionalActions instanceof _primitives.Dict)) {
  2583. continue;
  2584. }
  2585. for (const key of additionalActions.getKeys()) {
  2586. const action = eventType[key];
  2587. if (!action) {
  2588. continue;
  2589. }
  2590. const actionDict = additionalActions.getRaw(key);
  2591. const parents = new _primitives.RefSet();
  2592. const list = [];
  2593. _collectJS(actionDict, xref, list, parents);
  2594. if (list.length > 0) {
  2595. actions[action] = list;
  2596. }
  2597. }
  2598. }
  2599. }
  2600. if (dict.has("A")) {
  2601. const actionDict = dict.get("A");
  2602. const parents = new _primitives.RefSet();
  2603. const list = [];
  2604. _collectJS(actionDict, xref, list, parents);
  2605. if (list.length > 0) {
  2606. actions.Action = list;
  2607. }
  2608. }
  2609. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2610. }
  2611. const XMLEntities = {
  2612. 0x3c: "&lt;",
  2613. 0x3e: "&gt;",
  2614. 0x26: "&amp;",
  2615. 0x22: "&quot;",
  2616. 0x27: "&apos;"
  2617. };
  2618. function encodeToXmlString(str) {
  2619. const buffer = [];
  2620. let start = 0;
  2621. for (let i = 0, ii = str.length; i < ii; i++) {
  2622. const char = str.codePointAt(i);
  2623. if (0x20 <= char && char <= 0x7e) {
  2624. const entity = XMLEntities[char];
  2625. if (entity) {
  2626. if (start < i) {
  2627. buffer.push(str.substring(start, i));
  2628. }
  2629. buffer.push(entity);
  2630. start = i + 1;
  2631. }
  2632. } else {
  2633. if (start < i) {
  2634. buffer.push(str.substring(start, i));
  2635. }
  2636. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2637. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2638. i++;
  2639. }
  2640. start = i + 1;
  2641. }
  2642. }
  2643. if (buffer.length === 0) {
  2644. return str;
  2645. }
  2646. if (start < str.length) {
  2647. buffer.push(str.substring(start, str.length));
  2648. }
  2649. return buffer.join("");
  2650. }
  2651. function validateCSSFont(cssFontInfo) {
  2652. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2653. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2654. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2655. const {
  2656. fontFamily,
  2657. fontWeight,
  2658. italicAngle
  2659. } = cssFontInfo;
  2660. if (/^".*"$/.test(fontFamily)) {
  2661. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2662. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2663. return false;
  2664. }
  2665. } else if (/^'.*'$/.test(fontFamily)) {
  2666. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2667. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2668. return false;
  2669. }
  2670. } else {
  2671. for (const ident of fontFamily.split(/[ \t]+/)) {
  2672. if (/^([0-9]|(-([0-9]|-)))/.test(ident) || !/^[a-zA-Z0-9\-_\\]+$/.test(ident)) {
  2673. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2674. return false;
  2675. }
  2676. }
  2677. }
  2678. const weight = fontWeight ? fontWeight.toString() : "";
  2679. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2680. const angle = parseFloat(italicAngle);
  2681. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2682. return true;
  2683. }
  2684. /***/ }),
  2685. /* 10 */
  2686. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2687. Object.defineProperty(exports, "__esModule", ({
  2688. value: true
  2689. }));
  2690. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2691. var _base_stream = __w_pdfjs_require__(6);
  2692. var _util = __w_pdfjs_require__(2);
  2693. class Stream extends _base_stream.BaseStream {
  2694. constructor(arrayBuffer, start, length, dict) {
  2695. super();
  2696. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2697. this.start = start || 0;
  2698. this.pos = this.start;
  2699. this.end = start + length || this.bytes.length;
  2700. this.dict = dict;
  2701. }
  2702. get length() {
  2703. return this.end - this.start;
  2704. }
  2705. get isEmpty() {
  2706. return this.length === 0;
  2707. }
  2708. getByte() {
  2709. if (this.pos >= this.end) {
  2710. return -1;
  2711. }
  2712. return this.bytes[this.pos++];
  2713. }
  2714. getBytes(length, forceClamped = false) {
  2715. const bytes = this.bytes;
  2716. const pos = this.pos;
  2717. const strEnd = this.end;
  2718. if (!length) {
  2719. const subarray = bytes.subarray(pos, strEnd);
  2720. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2721. }
  2722. let end = pos + length;
  2723. if (end > strEnd) {
  2724. end = strEnd;
  2725. }
  2726. this.pos = end;
  2727. const subarray = bytes.subarray(pos, end);
  2728. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2729. }
  2730. getByteRange(begin, end) {
  2731. if (begin < 0) {
  2732. begin = 0;
  2733. }
  2734. if (end > this.end) {
  2735. end = this.end;
  2736. }
  2737. return this.bytes.subarray(begin, end);
  2738. }
  2739. reset() {
  2740. this.pos = this.start;
  2741. }
  2742. moveStart() {
  2743. this.start = this.pos;
  2744. }
  2745. makeSubStream(start, length, dict = null) {
  2746. return new Stream(this.bytes.buffer, start, length, dict);
  2747. }
  2748. }
  2749. exports.Stream = Stream;
  2750. class StringStream extends Stream {
  2751. constructor(str) {
  2752. super((0, _util.stringToBytes)(str));
  2753. }
  2754. }
  2755. exports.StringStream = StringStream;
  2756. class NullStream extends Stream {
  2757. constructor() {
  2758. super(new Uint8Array(0));
  2759. }
  2760. }
  2761. exports.NullStream = NullStream;
  2762. /***/ }),
  2763. /* 11 */
  2764. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2765. Object.defineProperty(exports, "__esModule", ({
  2766. value: true
  2767. }));
  2768. exports.PDFDocument = exports.Page = void 0;
  2769. var _util = __w_pdfjs_require__(2);
  2770. var _primitives = __w_pdfjs_require__(5);
  2771. var _core_utils = __w_pdfjs_require__(9);
  2772. var _stream = __w_pdfjs_require__(10);
  2773. var _annotation = __w_pdfjs_require__(12);
  2774. var _base_stream = __w_pdfjs_require__(6);
  2775. var _crypto = __w_pdfjs_require__(65);
  2776. var _catalog = __w_pdfjs_require__(57);
  2777. var _parser = __w_pdfjs_require__(17);
  2778. var _object_loader = __w_pdfjs_require__(63);
  2779. var _operator_list = __w_pdfjs_require__(55);
  2780. var _evaluator = __w_pdfjs_require__(15);
  2781. var _decode_stream = __w_pdfjs_require__(19);
  2782. var _struct_tree = __w_pdfjs_require__(62);
  2783. var _factory = __w_pdfjs_require__(67);
  2784. var _xref = __w_pdfjs_require__(88);
  2785. const DEFAULT_USER_UNIT = 1.0;
  2786. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2787. class Page {
  2788. constructor({
  2789. pdfManager,
  2790. xref,
  2791. pageIndex,
  2792. pageDict,
  2793. ref,
  2794. globalIdFactory,
  2795. fontCache,
  2796. builtInCMapCache,
  2797. globalImageCache,
  2798. nonBlendModesSet,
  2799. xfaFactory
  2800. }) {
  2801. this.pdfManager = pdfManager;
  2802. this.pageIndex = pageIndex;
  2803. this.pageDict = pageDict;
  2804. this.xref = xref;
  2805. this.ref = ref;
  2806. this.fontCache = fontCache;
  2807. this.builtInCMapCache = builtInCMapCache;
  2808. this.globalImageCache = globalImageCache;
  2809. this.nonBlendModesSet = nonBlendModesSet;
  2810. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2811. this.resourcesPromise = null;
  2812. this.xfaFactory = xfaFactory;
  2813. const idCounters = {
  2814. obj: 0
  2815. };
  2816. this._localIdFactory = class extends globalIdFactory {
  2817. static createObjId() {
  2818. return `p${pageIndex}_${++idCounters.obj}`;
  2819. }
  2820. static getPageObjId() {
  2821. return `page${ref.toString()}`;
  2822. }
  2823. };
  2824. }
  2825. _getInheritableProperty(key, getArray = false) {
  2826. const value = (0, _core_utils.getInheritableProperty)({
  2827. dict: this.pageDict,
  2828. key,
  2829. getArray,
  2830. stopWhenFound: false
  2831. });
  2832. if (!Array.isArray(value)) {
  2833. return value;
  2834. }
  2835. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2836. return value[0];
  2837. }
  2838. return _primitives.Dict.merge({
  2839. xref: this.xref,
  2840. dictArray: value
  2841. });
  2842. }
  2843. get content() {
  2844. return this.pageDict.getArray("Contents");
  2845. }
  2846. get resources() {
  2847. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2848. }
  2849. _getBoundingBox(name) {
  2850. if (this.xfaData) {
  2851. const {
  2852. width,
  2853. height
  2854. } = this.xfaData.attributes.style;
  2855. return [0, 0, parseInt(width), parseInt(height)];
  2856. }
  2857. const box = this._getInheritableProperty(name, true);
  2858. if (Array.isArray(box) && box.length === 4) {
  2859. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2860. return box;
  2861. }
  2862. (0, _util.warn)(`Empty /${name} entry.`);
  2863. }
  2864. return null;
  2865. }
  2866. get mediaBox() {
  2867. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2868. }
  2869. get cropBox() {
  2870. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2871. }
  2872. get userUnit() {
  2873. let obj = this.pageDict.get("UserUnit");
  2874. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2875. obj = DEFAULT_USER_UNIT;
  2876. }
  2877. return (0, _util.shadow)(this, "userUnit", obj);
  2878. }
  2879. get view() {
  2880. const {
  2881. cropBox,
  2882. mediaBox
  2883. } = this;
  2884. let view;
  2885. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2886. view = mediaBox;
  2887. } else {
  2888. const box = _util.Util.intersect(cropBox, mediaBox);
  2889. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2890. view = box;
  2891. } else {
  2892. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2893. }
  2894. }
  2895. return (0, _util.shadow)(this, "view", view || mediaBox);
  2896. }
  2897. get rotate() {
  2898. let rotate = this._getInheritableProperty("Rotate") || 0;
  2899. if (rotate % 90 !== 0) {
  2900. rotate = 0;
  2901. } else if (rotate >= 360) {
  2902. rotate = rotate % 360;
  2903. } else if (rotate < 0) {
  2904. rotate = (rotate % 360 + 360) % 360;
  2905. }
  2906. return (0, _util.shadow)(this, "rotate", rotate);
  2907. }
  2908. getContentStream() {
  2909. return this.pdfManager.ensure(this, "content").then(content => {
  2910. if (content instanceof _base_stream.BaseStream) {
  2911. return content;
  2912. }
  2913. if (Array.isArray(content)) {
  2914. return new _decode_stream.StreamsSequenceStream(content);
  2915. }
  2916. return new _stream.NullStream();
  2917. });
  2918. }
  2919. get xfaData() {
  2920. if (this.xfaFactory) {
  2921. return (0, _util.shadow)(this, "xfaData", this.xfaFactory.getPage(this.pageIndex));
  2922. }
  2923. return (0, _util.shadow)(this, "xfaData", null);
  2924. }
  2925. save(handler, task, annotationStorage) {
  2926. const partialEvaluator = new _evaluator.PartialEvaluator({
  2927. xref: this.xref,
  2928. handler,
  2929. pageIndex: this.pageIndex,
  2930. idFactory: this._localIdFactory,
  2931. fontCache: this.fontCache,
  2932. builtInCMapCache: this.builtInCMapCache,
  2933. globalImageCache: this.globalImageCache,
  2934. options: this.evaluatorOptions
  2935. });
  2936. return this._parsedAnnotations.then(function (annotations) {
  2937. const newRefsPromises = [];
  2938. for (const annotation of annotations) {
  2939. if (!annotation.mustBePrinted(annotationStorage)) {
  2940. continue;
  2941. }
  2942. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  2943. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2944. return null;
  2945. }));
  2946. }
  2947. return Promise.all(newRefsPromises);
  2948. });
  2949. }
  2950. loadResources(keys) {
  2951. if (!this.resourcesPromise) {
  2952. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  2953. }
  2954. return this.resourcesPromise.then(() => {
  2955. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  2956. return objectLoader.load();
  2957. });
  2958. }
  2959. getOperatorList({
  2960. handler,
  2961. sink,
  2962. task,
  2963. intent,
  2964. renderInteractiveForms,
  2965. annotationStorage
  2966. }) {
  2967. const contentStreamPromise = this.getContentStream();
  2968. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  2969. const partialEvaluator = new _evaluator.PartialEvaluator({
  2970. xref: this.xref,
  2971. handler,
  2972. pageIndex: this.pageIndex,
  2973. idFactory: this._localIdFactory,
  2974. fontCache: this.fontCache,
  2975. builtInCMapCache: this.builtInCMapCache,
  2976. globalImageCache: this.globalImageCache,
  2977. options: this.evaluatorOptions
  2978. });
  2979. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2980. const pageListPromise = dataPromises.then(([contentStream]) => {
  2981. const opList = new _operator_list.OperatorList(intent, sink);
  2982. handler.send("StartRenderPage", {
  2983. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  2984. pageIndex: this.pageIndex,
  2985. intent
  2986. });
  2987. return partialEvaluator.getOperatorList({
  2988. stream: contentStream,
  2989. task,
  2990. resources: this.resources,
  2991. operatorList: opList
  2992. }).then(function () {
  2993. return opList;
  2994. });
  2995. });
  2996. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  2997. if (annotations.length === 0) {
  2998. pageOpList.flush(true);
  2999. return {
  3000. length: pageOpList.totalLength
  3001. };
  3002. }
  3003. const opListPromises = [];
  3004. for (const annotation of annotations) {
  3005. if (intent === "display" && annotation.mustBeViewed(annotationStorage) || intent === "print" && annotation.mustBePrinted(annotationStorage)) {
  3006. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) {
  3007. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3008. return null;
  3009. }));
  3010. }
  3011. }
  3012. return Promise.all(opListPromises).then(function (opLists) {
  3013. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3014. for (const opList of opLists) {
  3015. pageOpList.addOpList(opList);
  3016. }
  3017. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3018. pageOpList.flush(true);
  3019. return {
  3020. length: pageOpList.totalLength
  3021. };
  3022. });
  3023. });
  3024. }
  3025. extractTextContent({
  3026. handler,
  3027. task,
  3028. normalizeWhitespace,
  3029. includeMarkedContent,
  3030. sink,
  3031. combineTextItems
  3032. }) {
  3033. const contentStreamPromise = this.getContentStream();
  3034. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3035. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3036. return dataPromises.then(([contentStream]) => {
  3037. const partialEvaluator = new _evaluator.PartialEvaluator({
  3038. xref: this.xref,
  3039. handler,
  3040. pageIndex: this.pageIndex,
  3041. idFactory: this._localIdFactory,
  3042. fontCache: this.fontCache,
  3043. builtInCMapCache: this.builtInCMapCache,
  3044. globalImageCache: this.globalImageCache,
  3045. options: this.evaluatorOptions
  3046. });
  3047. return partialEvaluator.getTextContent({
  3048. stream: contentStream,
  3049. task,
  3050. resources: this.resources,
  3051. normalizeWhitespace,
  3052. includeMarkedContent,
  3053. combineTextItems,
  3054. sink
  3055. });
  3056. });
  3057. }
  3058. async getStructTree() {
  3059. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3060. if (!structTreeRoot) {
  3061. return null;
  3062. }
  3063. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3064. return structTree.serializable;
  3065. }
  3066. _parseStructTree(structTreeRoot) {
  3067. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3068. tree.parse();
  3069. return tree;
  3070. }
  3071. getAnnotationsData(intent) {
  3072. return this._parsedAnnotations.then(function (annotations) {
  3073. const annotationsData = [];
  3074. for (let i = 0, ii = annotations.length; i < ii; i++) {
  3075. if (!intent || intent === "display" && annotations[i].viewable || intent === "print" && annotations[i].printable) {
  3076. annotationsData.push(annotations[i].data);
  3077. }
  3078. }
  3079. return annotationsData;
  3080. });
  3081. }
  3082. get annotations() {
  3083. const annots = this._getInheritableProperty("Annots");
  3084. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3085. }
  3086. get _parsedAnnotations() {
  3087. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3088. const annotationPromises = [];
  3089. for (const annotationRef of this.annotations) {
  3090. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3091. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3092. return null;
  3093. }));
  3094. }
  3095. return Promise.all(annotationPromises).then(function (annotations) {
  3096. return annotations.filter(annotation => !!annotation);
  3097. });
  3098. });
  3099. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3100. }
  3101. get jsActions() {
  3102. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3103. return (0, _util.shadow)(this, "jsActions", actions);
  3104. }
  3105. }
  3106. exports.Page = Page;
  3107. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3108. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3109. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3110. const FINGERPRINT_FIRST_BYTES = 1024;
  3111. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3112. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
  3113. function find(stream, signature, limit = 1024, backwards = false) {
  3114. const signatureLength = signature.length;
  3115. const scanBytes = stream.peekBytes(limit);
  3116. const scanLength = scanBytes.length - signatureLength;
  3117. if (scanLength <= 0) {
  3118. return false;
  3119. }
  3120. if (backwards) {
  3121. const signatureEnd = signatureLength - 1;
  3122. let pos = scanBytes.length - 1;
  3123. while (pos >= signatureEnd) {
  3124. let j = 0;
  3125. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3126. j++;
  3127. }
  3128. if (j >= signatureLength) {
  3129. stream.pos += pos - signatureEnd;
  3130. return true;
  3131. }
  3132. pos--;
  3133. }
  3134. } else {
  3135. let pos = 0;
  3136. while (pos <= scanLength) {
  3137. let j = 0;
  3138. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3139. j++;
  3140. }
  3141. if (j >= signatureLength) {
  3142. stream.pos += pos;
  3143. return true;
  3144. }
  3145. pos++;
  3146. }
  3147. }
  3148. return false;
  3149. }
  3150. class PDFDocument {
  3151. constructor(pdfManager, arg) {
  3152. let stream;
  3153. if ((0, _primitives.isStream)(arg)) {
  3154. stream = arg;
  3155. } else if ((0, _util.isArrayBuffer)(arg)) {
  3156. stream = new _stream.Stream(arg);
  3157. } else {
  3158. throw new Error("PDFDocument: Unknown argument type");
  3159. }
  3160. if (stream.length <= 0) {
  3161. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3162. }
  3163. this.pdfManager = pdfManager;
  3164. this.stream = stream;
  3165. this.xref = new _xref.XRef(stream, pdfManager);
  3166. this._pagePromises = [];
  3167. this._version = null;
  3168. const idCounters = {
  3169. font: 0
  3170. };
  3171. this._globalIdFactory = class {
  3172. static getDocId() {
  3173. return `g_${pdfManager.docId}`;
  3174. }
  3175. static createFontId() {
  3176. return `f${++idCounters.font}`;
  3177. }
  3178. static createObjId() {
  3179. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3180. }
  3181. static getPageObjId() {
  3182. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3183. }
  3184. };
  3185. }
  3186. parse(recoveryMode) {
  3187. this.xref.parse(recoveryMode);
  3188. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3189. if (this.catalog.version) {
  3190. this._version = this.catalog.version;
  3191. }
  3192. }
  3193. get linearization() {
  3194. let linearization = null;
  3195. try {
  3196. linearization = _parser.Linearization.create(this.stream);
  3197. } catch (err) {
  3198. if (err instanceof _core_utils.MissingDataException) {
  3199. throw err;
  3200. }
  3201. (0, _util.info)(err);
  3202. }
  3203. return (0, _util.shadow)(this, "linearization", linearization);
  3204. }
  3205. get startXRef() {
  3206. const stream = this.stream;
  3207. let startXRef = 0;
  3208. if (this.linearization) {
  3209. stream.reset();
  3210. if (find(stream, ENDOBJ_SIGNATURE)) {
  3211. startXRef = stream.pos + 6 - stream.start;
  3212. }
  3213. } else {
  3214. const step = 1024;
  3215. const startXRefLength = STARTXREF_SIGNATURE.length;
  3216. let found = false,
  3217. pos = stream.end;
  3218. while (!found && pos > 0) {
  3219. pos -= step - startXRefLength;
  3220. if (pos < 0) {
  3221. pos = 0;
  3222. }
  3223. stream.pos = pos;
  3224. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3225. }
  3226. if (found) {
  3227. stream.skip(9);
  3228. let ch;
  3229. do {
  3230. ch = stream.getByte();
  3231. } while ((0, _core_utils.isWhiteSpace)(ch));
  3232. let str = "";
  3233. while (ch >= 0x20 && ch <= 0x39) {
  3234. str += String.fromCharCode(ch);
  3235. ch = stream.getByte();
  3236. }
  3237. startXRef = parseInt(str, 10);
  3238. if (isNaN(startXRef)) {
  3239. startXRef = 0;
  3240. }
  3241. }
  3242. }
  3243. return (0, _util.shadow)(this, "startXRef", startXRef);
  3244. }
  3245. checkHeader() {
  3246. const stream = this.stream;
  3247. stream.reset();
  3248. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3249. return;
  3250. }
  3251. stream.moveStart();
  3252. const MAX_PDF_VERSION_LENGTH = 12;
  3253. let version = "",
  3254. ch;
  3255. while ((ch = stream.getByte()) > 0x20) {
  3256. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3257. break;
  3258. }
  3259. version += String.fromCharCode(ch);
  3260. }
  3261. if (!this._version) {
  3262. this._version = version.substring(5);
  3263. }
  3264. }
  3265. parseStartXRef() {
  3266. this.xref.setStartXRef(this.startXRef);
  3267. }
  3268. get numPages() {
  3269. if (this.xfaFactory) {
  3270. return (0, _util.shadow)(this, "numPages", this.xfaFactory.numberPages);
  3271. }
  3272. const linearization = this.linearization;
  3273. const num = linearization ? linearization.numPages : this.catalog.numPages;
  3274. return (0, _util.shadow)(this, "numPages", num);
  3275. }
  3276. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3277. const RECURSION_LIMIT = 10;
  3278. if (!Array.isArray(fields)) {
  3279. return false;
  3280. }
  3281. return fields.every(field => {
  3282. field = this.xref.fetchIfRef(field);
  3283. if (!(field instanceof _primitives.Dict)) {
  3284. return false;
  3285. }
  3286. if (field.has("Kids")) {
  3287. if (++recursionDepth > RECURSION_LIMIT) {
  3288. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3289. return false;
  3290. }
  3291. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3292. }
  3293. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3294. const rectangle = field.get("Rect");
  3295. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3296. return isSignature && isInvisible;
  3297. });
  3298. }
  3299. get xfaData() {
  3300. const acroForm = this.catalog.acroForm;
  3301. if (!acroForm) {
  3302. return null;
  3303. }
  3304. const xfa = acroForm.get("XFA");
  3305. const entries = {
  3306. "xdp:xdp": "",
  3307. template: "",
  3308. datasets: "",
  3309. config: "",
  3310. connectionSet: "",
  3311. localeSet: "",
  3312. stylesheet: "",
  3313. "/xdp:xdp": ""
  3314. };
  3315. if ((0, _primitives.isStream)(xfa) && !xfa.isEmpty) {
  3316. try {
  3317. entries["xdp:xdp"] = (0, _util.stringToUTF8String)(xfa.getString());
  3318. return entries;
  3319. } catch (_) {
  3320. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3321. return null;
  3322. }
  3323. }
  3324. if (!Array.isArray(xfa) || xfa.length === 0) {
  3325. return null;
  3326. }
  3327. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3328. let name;
  3329. if (i === 0) {
  3330. name = "xdp:xdp";
  3331. } else if (i === ii - 2) {
  3332. name = "/xdp:xdp";
  3333. } else {
  3334. name = xfa[i];
  3335. }
  3336. if (!entries.hasOwnProperty(name)) {
  3337. continue;
  3338. }
  3339. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3340. if (!(0, _primitives.isStream)(data) || data.isEmpty) {
  3341. continue;
  3342. }
  3343. try {
  3344. entries[name] = (0, _util.stringToUTF8String)(data.getString());
  3345. } catch (_) {
  3346. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3347. return null;
  3348. }
  3349. }
  3350. return entries;
  3351. }
  3352. get xfaFactory() {
  3353. if (this.pdfManager.enableXfa && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3354. const data = this.xfaData;
  3355. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3356. }
  3357. return (0, _util.shadow)(this, "xfaFaxtory", null);
  3358. }
  3359. get isPureXfa() {
  3360. return this.xfaFactory !== null;
  3361. }
  3362. async loadXfaFonts(handler, task) {
  3363. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3364. if (!acroForm) {
  3365. return;
  3366. }
  3367. const resources = await acroForm.getAsync("DR");
  3368. if (!(resources instanceof _primitives.Dict)) {
  3369. return;
  3370. }
  3371. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3372. await objectLoader.load();
  3373. const fontRes = resources.get("Font");
  3374. if (!(fontRes instanceof _primitives.Dict)) {
  3375. return;
  3376. }
  3377. const partialEvaluator = new _evaluator.PartialEvaluator({
  3378. xref: this.xref,
  3379. handler,
  3380. pageIndex: -1,
  3381. idFactory: this._globalIdFactory,
  3382. fontCache: this.catalog.fontCache,
  3383. builtInCMapCache: this.catalog.builtInCMapCache
  3384. });
  3385. const operatorList = new _operator_list.OperatorList();
  3386. const initialState = {
  3387. font: null,
  3388. clone() {
  3389. return this;
  3390. }
  3391. };
  3392. const fonts = new Map();
  3393. fontRes.forEach((fontName, font) => {
  3394. fonts.set(fontName, font);
  3395. });
  3396. const promises = [];
  3397. for (const [fontName, font] of fonts) {
  3398. const descriptor = font.get("FontDescriptor");
  3399. if (!(descriptor instanceof _primitives.Dict)) {
  3400. continue;
  3401. }
  3402. const fontFamily = descriptor.get("FontFamily");
  3403. const fontWeight = descriptor.get("FontWeight");
  3404. const italicAngle = -descriptor.get("ItalicAngle");
  3405. const cssFontInfo = {
  3406. fontFamily,
  3407. fontWeight,
  3408. italicAngle
  3409. };
  3410. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3411. continue;
  3412. }
  3413. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3414. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3415. return null;
  3416. }));
  3417. }
  3418. await Promise.all(promises);
  3419. }
  3420. get formInfo() {
  3421. const formInfo = {
  3422. hasFields: false,
  3423. hasAcroForm: false,
  3424. hasXfa: false,
  3425. hasSignatures: false
  3426. };
  3427. const acroForm = this.catalog.acroForm;
  3428. if (!acroForm) {
  3429. return (0, _util.shadow)(this, "formInfo", formInfo);
  3430. }
  3431. try {
  3432. const fields = acroForm.get("Fields");
  3433. const hasFields = Array.isArray(fields) && fields.length > 0;
  3434. formInfo.hasFields = hasFields;
  3435. const xfa = acroForm.get("XFA");
  3436. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
  3437. const sigFlags = acroForm.get("SigFlags");
  3438. const hasSignatures = !!(sigFlags & 0x1);
  3439. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3440. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3441. formInfo.hasSignatures = hasSignatures;
  3442. } catch (ex) {
  3443. if (ex instanceof _core_utils.MissingDataException) {
  3444. throw ex;
  3445. }
  3446. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3447. }
  3448. return (0, _util.shadow)(this, "formInfo", formInfo);
  3449. }
  3450. get documentInfo() {
  3451. const DocumentInfoValidators = {
  3452. Title: _util.isString,
  3453. Author: _util.isString,
  3454. Subject: _util.isString,
  3455. Keywords: _util.isString,
  3456. Creator: _util.isString,
  3457. Producer: _util.isString,
  3458. CreationDate: _util.isString,
  3459. ModDate: _util.isString,
  3460. Trapped: _primitives.isName
  3461. };
  3462. let version = this._version;
  3463. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3464. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3465. version = null;
  3466. }
  3467. const docInfo = {
  3468. PDFFormatVersion: version,
  3469. IsLinearized: !!this.linearization,
  3470. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3471. IsXFAPresent: this.formInfo.hasXfa,
  3472. IsCollectionPresent: !!this.catalog.collection,
  3473. IsSignaturesPresent: this.formInfo.hasSignatures
  3474. };
  3475. let infoDict;
  3476. try {
  3477. infoDict = this.xref.trailer.get("Info");
  3478. } catch (err) {
  3479. if (err instanceof _core_utils.MissingDataException) {
  3480. throw err;
  3481. }
  3482. (0, _util.info)("The document information dictionary is invalid.");
  3483. }
  3484. if ((0, _primitives.isDict)(infoDict)) {
  3485. for (const key of infoDict.getKeys()) {
  3486. const value = infoDict.get(key);
  3487. if (DocumentInfoValidators[key]) {
  3488. if (DocumentInfoValidators[key](value)) {
  3489. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  3490. } else {
  3491. (0, _util.info)(`Bad value in document info for "${key}".`);
  3492. }
  3493. } else if (typeof key === "string") {
  3494. let customValue;
  3495. if ((0, _util.isString)(value)) {
  3496. customValue = (0, _util.stringToPDFString)(value);
  3497. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  3498. customValue = value;
  3499. } else {
  3500. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  3501. continue;
  3502. }
  3503. if (!docInfo.Custom) {
  3504. docInfo.Custom = Object.create(null);
  3505. }
  3506. docInfo.Custom[key] = customValue;
  3507. }
  3508. }
  3509. }
  3510. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3511. }
  3512. get fingerprint() {
  3513. let hash;
  3514. const idArray = this.xref.trailer.get("ID");
  3515. if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  3516. hash = (0, _util.stringToBytes)(idArray[0]);
  3517. } else {
  3518. hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3519. }
  3520. const fingerprintBuf = [];
  3521. for (let i = 0, ii = hash.length; i < ii; i++) {
  3522. const hex = hash[i].toString(16);
  3523. fingerprintBuf.push(hex.padStart(2, "0"));
  3524. }
  3525. return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
  3526. }
  3527. _getLinearizationPage(pageIndex) {
  3528. const {
  3529. catalog,
  3530. linearization
  3531. } = this;
  3532. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3533. return this.xref.fetchAsync(ref).then(obj => {
  3534. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  3535. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  3536. catalog.pageKidsCountCache.put(ref, 1);
  3537. }
  3538. return [obj, ref];
  3539. }
  3540. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  3541. }).catch(reason => {
  3542. (0, _util.info)(reason);
  3543. return catalog.getPageDict(pageIndex);
  3544. });
  3545. }
  3546. getPage(pageIndex) {
  3547. if (this._pagePromises[pageIndex] !== undefined) {
  3548. return this._pagePromises[pageIndex];
  3549. }
  3550. const {
  3551. catalog,
  3552. linearization
  3553. } = this;
  3554. if (this.xfaFactory) {
  3555. return Promise.resolve(new Page({
  3556. pdfManager: this.pdfManager,
  3557. xref: this.xref,
  3558. pageIndex,
  3559. pageDict: _primitives.Dict.empty,
  3560. ref: null,
  3561. globalIdFactory: this._globalIdFactory,
  3562. fontCache: catalog.fontCache,
  3563. builtInCMapCache: catalog.builtInCMapCache,
  3564. globalImageCache: catalog.globalImageCache,
  3565. nonBlendModesSet: catalog.nonBlendModesSet,
  3566. xfaFactory: this.xfaFactory
  3567. }));
  3568. }
  3569. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  3570. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  3571. return new Page({
  3572. pdfManager: this.pdfManager,
  3573. xref: this.xref,
  3574. pageIndex,
  3575. pageDict,
  3576. ref,
  3577. globalIdFactory: this._globalIdFactory,
  3578. fontCache: catalog.fontCache,
  3579. builtInCMapCache: catalog.builtInCMapCache,
  3580. globalImageCache: catalog.globalImageCache,
  3581. nonBlendModesSet: catalog.nonBlendModesSet,
  3582. xfaFactory: null
  3583. });
  3584. });
  3585. }
  3586. checkFirstPage() {
  3587. return this.getPage(0).catch(async reason => {
  3588. if (reason instanceof _core_utils.XRefEntryException) {
  3589. this._pagePromises.length = 0;
  3590. await this.cleanup();
  3591. throw new _core_utils.XRefParseException();
  3592. }
  3593. });
  3594. }
  3595. fontFallback(id, handler) {
  3596. return this.catalog.fontFallback(id, handler);
  3597. }
  3598. async cleanup(manuallyTriggered = false) {
  3599. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  3600. }
  3601. _collectFieldObjects(name, fieldRef, promises) {
  3602. const field = this.xref.fetchIfRef(fieldRef);
  3603. if (field.has("T")) {
  3604. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3605. if (name === "") {
  3606. name = partName;
  3607. } else {
  3608. name = `${name}.${partName}`;
  3609. }
  3610. }
  3611. if (!promises.has(name)) {
  3612. promises.set(name, []);
  3613. }
  3614. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3615. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3616. return null;
  3617. }));
  3618. if (field.has("Kids")) {
  3619. const kids = field.get("Kids");
  3620. for (const kid of kids) {
  3621. this._collectFieldObjects(name, kid, promises);
  3622. }
  3623. }
  3624. }
  3625. get fieldObjects() {
  3626. if (!this.formInfo.hasFields) {
  3627. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3628. }
  3629. const allFields = Object.create(null);
  3630. const fieldPromises = new Map();
  3631. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3632. this._collectFieldObjects("", fieldRef, fieldPromises);
  3633. }
  3634. const allPromises = [];
  3635. for (const [name, promises] of fieldPromises) {
  3636. allPromises.push(Promise.all(promises).then(fields => {
  3637. fields = fields.filter(field => !!field);
  3638. if (fields.length > 0) {
  3639. allFields[name] = fields;
  3640. }
  3641. }));
  3642. }
  3643. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  3644. }
  3645. get hasJSActions() {
  3646. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  3647. return (0, _util.shadow)(this, "hasJSActions", promise);
  3648. }
  3649. async _parseHasJSActions() {
  3650. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  3651. if (catalogJsActions) {
  3652. return true;
  3653. }
  3654. if (fieldObjects) {
  3655. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  3656. }
  3657. return false;
  3658. }
  3659. get calculationOrderIds() {
  3660. const acroForm = this.catalog.acroForm;
  3661. if (!acroForm || !acroForm.has("CO")) {
  3662. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3663. }
  3664. const calculationOrder = acroForm.get("CO");
  3665. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  3666. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3667. }
  3668. const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString());
  3669. if (ids.length === 0) {
  3670. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3671. }
  3672. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  3673. }
  3674. }
  3675. exports.PDFDocument = PDFDocument;
  3676. /***/ }),
  3677. /* 12 */
  3678. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3679. Object.defineProperty(exports, "__esModule", ({
  3680. value: true
  3681. }));
  3682. exports.getQuadPoints = getQuadPoints;
  3683. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  3684. var _util = __w_pdfjs_require__(2);
  3685. var _core_utils = __w_pdfjs_require__(9);
  3686. var _default_appearance = __w_pdfjs_require__(13);
  3687. var _primitives = __w_pdfjs_require__(5);
  3688. var _catalog = __w_pdfjs_require__(57);
  3689. var _colorspace = __w_pdfjs_require__(14);
  3690. var _file_spec = __w_pdfjs_require__(59);
  3691. var _object_loader = __w_pdfjs_require__(63);
  3692. var _operator_list = __w_pdfjs_require__(55);
  3693. var _stream = __w_pdfjs_require__(10);
  3694. var _writer = __w_pdfjs_require__(64);
  3695. class AnnotationFactory {
  3696. static create(xref, ref, pdfManager, idFactory, collectFields) {
  3697. 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]));
  3698. }
  3699. static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex = -1) {
  3700. const dict = xref.fetchIfRef(ref);
  3701. if (!(0, _primitives.isDict)(dict)) {
  3702. return undefined;
  3703. }
  3704. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  3705. let subtype = dict.get("Subtype");
  3706. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  3707. const parameters = {
  3708. xref,
  3709. ref,
  3710. dict,
  3711. subtype,
  3712. id,
  3713. pdfManager,
  3714. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  3715. collectFields,
  3716. pageIndex
  3717. };
  3718. switch (subtype) {
  3719. case "Link":
  3720. return new LinkAnnotation(parameters);
  3721. case "Text":
  3722. return new TextAnnotation(parameters);
  3723. case "Widget":
  3724. let fieldType = (0, _core_utils.getInheritableProperty)({
  3725. dict,
  3726. key: "FT"
  3727. });
  3728. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  3729. switch (fieldType) {
  3730. case "Tx":
  3731. return new TextWidgetAnnotation(parameters);
  3732. case "Btn":
  3733. return new ButtonWidgetAnnotation(parameters);
  3734. case "Ch":
  3735. return new ChoiceWidgetAnnotation(parameters);
  3736. case "Sig":
  3737. return new SignatureWidgetAnnotation(parameters);
  3738. }
  3739. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  3740. return new WidgetAnnotation(parameters);
  3741. case "Popup":
  3742. return new PopupAnnotation(parameters);
  3743. case "FreeText":
  3744. return new FreeTextAnnotation(parameters);
  3745. case "Line":
  3746. return new LineAnnotation(parameters);
  3747. case "Square":
  3748. return new SquareAnnotation(parameters);
  3749. case "Circle":
  3750. return new CircleAnnotation(parameters);
  3751. case "PolyLine":
  3752. return new PolylineAnnotation(parameters);
  3753. case "Polygon":
  3754. return new PolygonAnnotation(parameters);
  3755. case "Caret":
  3756. return new CaretAnnotation(parameters);
  3757. case "Ink":
  3758. return new InkAnnotation(parameters);
  3759. case "Highlight":
  3760. return new HighlightAnnotation(parameters);
  3761. case "Underline":
  3762. return new UnderlineAnnotation(parameters);
  3763. case "Squiggly":
  3764. return new SquigglyAnnotation(parameters);
  3765. case "StrikeOut":
  3766. return new StrikeOutAnnotation(parameters);
  3767. case "Stamp":
  3768. return new StampAnnotation(parameters);
  3769. case "FileAttachment":
  3770. return new FileAttachmentAnnotation(parameters);
  3771. default:
  3772. if (!collectFields) {
  3773. if (!subtype) {
  3774. (0, _util.warn)("Annotation is missing the required /Subtype.");
  3775. } else {
  3776. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  3777. }
  3778. }
  3779. return new Annotation(parameters);
  3780. }
  3781. }
  3782. static async _getPageIndex(xref, ref, pdfManager) {
  3783. try {
  3784. const annotDict = await xref.fetchIfRefAsync(ref);
  3785. if (!(0, _primitives.isDict)(annotDict)) {
  3786. return -1;
  3787. }
  3788. const pageRef = annotDict.getRaw("P");
  3789. if (!(0, _primitives.isRef)(pageRef)) {
  3790. return -1;
  3791. }
  3792. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  3793. return pageIndex;
  3794. } catch (ex) {
  3795. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  3796. return -1;
  3797. }
  3798. }
  3799. }
  3800. exports.AnnotationFactory = AnnotationFactory;
  3801. function getRgbColor(color) {
  3802. const rgbColor = new Uint8ClampedArray(3);
  3803. if (!Array.isArray(color)) {
  3804. return rgbColor;
  3805. }
  3806. switch (color.length) {
  3807. case 0:
  3808. return null;
  3809. case 1:
  3810. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  3811. return rgbColor;
  3812. case 3:
  3813. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  3814. return rgbColor;
  3815. case 4:
  3816. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  3817. return rgbColor;
  3818. default:
  3819. return rgbColor;
  3820. }
  3821. }
  3822. function getQuadPoints(dict, rect) {
  3823. if (!dict.has("QuadPoints")) {
  3824. return null;
  3825. }
  3826. const quadPoints = dict.getArray("QuadPoints");
  3827. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  3828. return null;
  3829. }
  3830. const quadPointsLists = [];
  3831. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  3832. quadPointsLists.push([]);
  3833. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  3834. const x = quadPoints[j];
  3835. const y = quadPoints[j + 1];
  3836. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  3837. return null;
  3838. }
  3839. quadPointsLists[i].push({
  3840. x,
  3841. y
  3842. });
  3843. }
  3844. }
  3845. return quadPointsLists.map(quadPointsList => {
  3846. 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]);
  3847. return [{
  3848. x: minX,
  3849. y: maxY
  3850. }, {
  3851. x: maxX,
  3852. y: maxY
  3853. }, {
  3854. x: minX,
  3855. y: minY
  3856. }, {
  3857. x: maxX,
  3858. y: minY
  3859. }];
  3860. });
  3861. }
  3862. function getTransformMatrix(rect, bbox, matrix) {
  3863. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  3864. if (minX === maxX || minY === maxY) {
  3865. return [1, 0, 0, 1, rect[0], rect[1]];
  3866. }
  3867. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  3868. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  3869. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  3870. }
  3871. class Annotation {
  3872. constructor(params) {
  3873. const dict = params.dict;
  3874. this.setContents(dict.get("Contents"));
  3875. this.setModificationDate(dict.get("M"));
  3876. this.setFlags(dict.get("F"));
  3877. this.setRectangle(dict.getArray("Rect"));
  3878. this.setColor(dict.getArray("C"));
  3879. this.setBorderStyle(dict);
  3880. this.setAppearance(dict);
  3881. this._streams = [];
  3882. if (this.appearance) {
  3883. this._streams.push(this.appearance);
  3884. }
  3885. this.data = {
  3886. annotationFlags: this.flags,
  3887. borderStyle: this.borderStyle,
  3888. color: this.color,
  3889. contents: this.contents,
  3890. hasAppearance: !!this.appearance,
  3891. id: params.id,
  3892. modificationDate: this.modificationDate,
  3893. rect: this.rectangle,
  3894. subtype: params.subtype
  3895. };
  3896. if (params.collectFields) {
  3897. const kids = dict.get("Kids");
  3898. if (Array.isArray(kids)) {
  3899. const kidIds = [];
  3900. for (const kid of kids) {
  3901. if ((0, _primitives.isRef)(kid)) {
  3902. kidIds.push(kid.toString());
  3903. }
  3904. }
  3905. if (kidIds.length !== 0) {
  3906. this.data.kidIds = kidIds;
  3907. }
  3908. }
  3909. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  3910. this.data.fieldName = this._constructFieldName(dict);
  3911. this.data.pageIndex = params.pageIndex;
  3912. }
  3913. this._fallbackFontDict = null;
  3914. }
  3915. _hasFlag(flags, flag) {
  3916. return !!(flags & flag);
  3917. }
  3918. _isViewable(flags) {
  3919. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  3920. }
  3921. _isPrintable(flags) {
  3922. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  3923. }
  3924. mustBeViewed(annotationStorage) {
  3925. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  3926. if (storageEntry && storageEntry.hidden !== undefined) {
  3927. return !storageEntry.hidden;
  3928. }
  3929. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  3930. }
  3931. mustBePrinted(annotationStorage) {
  3932. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  3933. if (storageEntry && storageEntry.print !== undefined) {
  3934. return storageEntry.print;
  3935. }
  3936. return this.printable;
  3937. }
  3938. get viewable() {
  3939. if (this.data.quadPoints === null) {
  3940. return false;
  3941. }
  3942. if (this.flags === 0) {
  3943. return true;
  3944. }
  3945. return this._isViewable(this.flags);
  3946. }
  3947. get printable() {
  3948. if (this.data.quadPoints === null) {
  3949. return false;
  3950. }
  3951. if (this.flags === 0) {
  3952. return false;
  3953. }
  3954. return this._isPrintable(this.flags);
  3955. }
  3956. setContents(contents) {
  3957. this.contents = (0, _util.stringToPDFString)(contents || "");
  3958. }
  3959. setModificationDate(modificationDate) {
  3960. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  3961. }
  3962. setFlags(flags) {
  3963. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  3964. }
  3965. hasFlag(flag) {
  3966. return this._hasFlag(this.flags, flag);
  3967. }
  3968. setRectangle(rectangle) {
  3969. if (Array.isArray(rectangle) && rectangle.length === 4) {
  3970. this.rectangle = _util.Util.normalizeRect(rectangle);
  3971. } else {
  3972. this.rectangle = [0, 0, 0, 0];
  3973. }
  3974. }
  3975. setColor(color) {
  3976. this.color = getRgbColor(color);
  3977. }
  3978. setBorderStyle(borderStyle) {
  3979. this.borderStyle = new AnnotationBorderStyle();
  3980. if (!(0, _primitives.isDict)(borderStyle)) {
  3981. return;
  3982. }
  3983. if (borderStyle.has("BS")) {
  3984. const dict = borderStyle.get("BS");
  3985. const dictType = dict.get("Type");
  3986. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  3987. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  3988. this.borderStyle.setStyle(dict.get("S"));
  3989. this.borderStyle.setDashArray(dict.getArray("D"));
  3990. }
  3991. } else if (borderStyle.has("Border")) {
  3992. const array = borderStyle.getArray("Border");
  3993. if (Array.isArray(array) && array.length >= 3) {
  3994. this.borderStyle.setHorizontalCornerRadius(array[0]);
  3995. this.borderStyle.setVerticalCornerRadius(array[1]);
  3996. this.borderStyle.setWidth(array[2], this.rectangle);
  3997. if (array.length === 4) {
  3998. this.borderStyle.setDashArray(array[3]);
  3999. }
  4000. }
  4001. } else {
  4002. this.borderStyle.setWidth(0);
  4003. }
  4004. }
  4005. setAppearance(dict) {
  4006. this.appearance = null;
  4007. const appearanceStates = dict.get("AP");
  4008. if (!(0, _primitives.isDict)(appearanceStates)) {
  4009. return;
  4010. }
  4011. const normalAppearanceState = appearanceStates.get("N");
  4012. if ((0, _primitives.isStream)(normalAppearanceState)) {
  4013. this.appearance = normalAppearanceState;
  4014. return;
  4015. }
  4016. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  4017. return;
  4018. }
  4019. const as = dict.get("AS");
  4020. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  4021. return;
  4022. }
  4023. this.appearance = normalAppearanceState.get(as.name);
  4024. }
  4025. loadResources(keys) {
  4026. return this.appearance.dict.getAsync("Resources").then(resources => {
  4027. if (!resources) {
  4028. return undefined;
  4029. }
  4030. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4031. return objectLoader.load().then(function () {
  4032. return resources;
  4033. });
  4034. });
  4035. }
  4036. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  4037. if (!this.appearance) {
  4038. return Promise.resolve(new _operator_list.OperatorList());
  4039. }
  4040. const appearance = this.appearance;
  4041. const data = this.data;
  4042. const appearanceDict = appearance.dict;
  4043. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  4044. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4045. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4046. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4047. return resourcesPromise.then(resources => {
  4048. const opList = new _operator_list.OperatorList();
  4049. opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
  4050. return evaluator.getOperatorList({
  4051. stream: appearance,
  4052. task,
  4053. resources,
  4054. operatorList: opList,
  4055. fallbackFontDict: this._fallbackFontDict
  4056. }).then(() => {
  4057. opList.addOp(_util.OPS.endAnnotation, []);
  4058. this.reset();
  4059. return opList;
  4060. });
  4061. });
  4062. }
  4063. async save(evaluator, task, annotationStorage) {
  4064. return null;
  4065. }
  4066. getFieldObject() {
  4067. if (this.data.kidIds) {
  4068. return {
  4069. id: this.data.id,
  4070. actions: this.data.actions,
  4071. name: this.data.fieldName,
  4072. type: "",
  4073. kidIds: this.data.kidIds,
  4074. page: this.data.pageIndex
  4075. };
  4076. }
  4077. return null;
  4078. }
  4079. reset() {
  4080. for (const stream of this._streams) {
  4081. stream.reset();
  4082. }
  4083. }
  4084. _constructFieldName(dict) {
  4085. if (!dict.has("T") && !dict.has("Parent")) {
  4086. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4087. return "";
  4088. }
  4089. if (!dict.has("Parent")) {
  4090. return (0, _util.stringToPDFString)(dict.get("T"));
  4091. }
  4092. const fieldName = [];
  4093. if (dict.has("T")) {
  4094. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4095. }
  4096. let loopDict = dict;
  4097. const visited = new _primitives.RefSet();
  4098. if (dict.objId) {
  4099. visited.put(dict.objId);
  4100. }
  4101. while (loopDict.has("Parent")) {
  4102. loopDict = loopDict.get("Parent");
  4103. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4104. break;
  4105. }
  4106. if (loopDict.objId) {
  4107. visited.put(loopDict.objId);
  4108. }
  4109. if (loopDict.has("T")) {
  4110. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4111. }
  4112. }
  4113. return fieldName.join(".");
  4114. }
  4115. }
  4116. exports.Annotation = Annotation;
  4117. class AnnotationBorderStyle {
  4118. constructor() {
  4119. this.width = 1;
  4120. this.style = _util.AnnotationBorderStyleType.SOLID;
  4121. this.dashArray = [3];
  4122. this.horizontalCornerRadius = 0;
  4123. this.verticalCornerRadius = 0;
  4124. }
  4125. setWidth(width, rect = [0, 0, 0, 0]) {
  4126. if ((0, _primitives.isName)(width)) {
  4127. this.width = 0;
  4128. return;
  4129. }
  4130. if (Number.isInteger(width)) {
  4131. if (width > 0) {
  4132. const maxWidth = (rect[2] - rect[0]) / 2;
  4133. const maxHeight = (rect[3] - rect[1]) / 2;
  4134. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4135. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4136. width = 1;
  4137. }
  4138. }
  4139. this.width = width;
  4140. }
  4141. }
  4142. setStyle(style) {
  4143. if (!(0, _primitives.isName)(style)) {
  4144. return;
  4145. }
  4146. switch (style.name) {
  4147. case "S":
  4148. this.style = _util.AnnotationBorderStyleType.SOLID;
  4149. break;
  4150. case "D":
  4151. this.style = _util.AnnotationBorderStyleType.DASHED;
  4152. break;
  4153. case "B":
  4154. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4155. break;
  4156. case "I":
  4157. this.style = _util.AnnotationBorderStyleType.INSET;
  4158. break;
  4159. case "U":
  4160. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4161. break;
  4162. default:
  4163. break;
  4164. }
  4165. }
  4166. setDashArray(dashArray) {
  4167. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4168. let isValid = true;
  4169. let allZeros = true;
  4170. for (const element of dashArray) {
  4171. const validNumber = +element >= 0;
  4172. if (!validNumber) {
  4173. isValid = false;
  4174. break;
  4175. } else if (element > 0) {
  4176. allZeros = false;
  4177. }
  4178. }
  4179. if (isValid && !allZeros) {
  4180. this.dashArray = dashArray;
  4181. } else {
  4182. this.width = 0;
  4183. }
  4184. } else if (dashArray) {
  4185. this.width = 0;
  4186. }
  4187. }
  4188. setHorizontalCornerRadius(radius) {
  4189. if (Number.isInteger(radius)) {
  4190. this.horizontalCornerRadius = radius;
  4191. }
  4192. }
  4193. setVerticalCornerRadius(radius) {
  4194. if (Number.isInteger(radius)) {
  4195. this.verticalCornerRadius = radius;
  4196. }
  4197. }
  4198. }
  4199. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  4200. class MarkupAnnotation extends Annotation {
  4201. constructor(parameters) {
  4202. super(parameters);
  4203. const dict = parameters.dict;
  4204. if (dict.has("IRT")) {
  4205. const rawIRT = dict.getRaw("IRT");
  4206. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  4207. const rt = dict.get("RT");
  4208. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  4209. }
  4210. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  4211. const parent = dict.get("IRT");
  4212. this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
  4213. this.setContents(parent.get("Contents"));
  4214. this.data.contents = this.contents;
  4215. if (!parent.has("CreationDate")) {
  4216. this.data.creationDate = null;
  4217. } else {
  4218. this.setCreationDate(parent.get("CreationDate"));
  4219. this.data.creationDate = this.creationDate;
  4220. }
  4221. if (!parent.has("M")) {
  4222. this.data.modificationDate = null;
  4223. } else {
  4224. this.setModificationDate(parent.get("M"));
  4225. this.data.modificationDate = this.modificationDate;
  4226. }
  4227. this.data.hasPopup = parent.has("Popup");
  4228. if (!parent.has("C")) {
  4229. this.data.color = null;
  4230. } else {
  4231. this.setColor(parent.getArray("C"));
  4232. this.data.color = this.color;
  4233. }
  4234. } else {
  4235. this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
  4236. this.setCreationDate(dict.get("CreationDate"));
  4237. this.data.creationDate = this.creationDate;
  4238. this.data.hasPopup = dict.has("Popup");
  4239. if (!dict.has("C")) {
  4240. this.data.color = null;
  4241. }
  4242. }
  4243. }
  4244. setCreationDate(creationDate) {
  4245. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  4246. }
  4247. _setDefaultAppearance({
  4248. xref,
  4249. extra,
  4250. strokeColor,
  4251. fillColor,
  4252. blendMode,
  4253. strokeAlpha,
  4254. fillAlpha,
  4255. pointsCallback
  4256. }) {
  4257. let minX = Number.MAX_VALUE;
  4258. let minY = Number.MAX_VALUE;
  4259. let maxX = Number.MIN_VALUE;
  4260. let maxY = Number.MIN_VALUE;
  4261. const buffer = ["q"];
  4262. if (extra) {
  4263. buffer.push(extra);
  4264. }
  4265. if (strokeColor) {
  4266. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  4267. }
  4268. if (fillColor) {
  4269. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  4270. }
  4271. let pointsArray = this.data.quadPoints;
  4272. if (!pointsArray) {
  4273. pointsArray = [[{
  4274. x: this.rectangle[0],
  4275. y: this.rectangle[3]
  4276. }, {
  4277. x: this.rectangle[2],
  4278. y: this.rectangle[3]
  4279. }, {
  4280. x: this.rectangle[0],
  4281. y: this.rectangle[1]
  4282. }, {
  4283. x: this.rectangle[2],
  4284. y: this.rectangle[1]
  4285. }]];
  4286. }
  4287. for (const points of pointsArray) {
  4288. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  4289. minX = Math.min(minX, mX);
  4290. maxX = Math.max(maxX, MX);
  4291. minY = Math.min(minY, mY);
  4292. maxY = Math.max(maxY, MY);
  4293. }
  4294. buffer.push("Q");
  4295. const formDict = new _primitives.Dict(xref);
  4296. const appearanceStreamDict = new _primitives.Dict(xref);
  4297. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  4298. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  4299. appearanceStream.dict = appearanceStreamDict;
  4300. formDict.set("Fm0", appearanceStream);
  4301. const gsDict = new _primitives.Dict(xref);
  4302. if (blendMode) {
  4303. gsDict.set("BM", _primitives.Name.get(blendMode));
  4304. }
  4305. if (typeof strokeAlpha === "number") {
  4306. gsDict.set("CA", strokeAlpha);
  4307. }
  4308. if (typeof fillAlpha === "number") {
  4309. gsDict.set("ca", fillAlpha);
  4310. }
  4311. const stateDict = new _primitives.Dict(xref);
  4312. stateDict.set("GS0", gsDict);
  4313. const resources = new _primitives.Dict(xref);
  4314. resources.set("ExtGState", stateDict);
  4315. resources.set("XObject", formDict);
  4316. const appearanceDict = new _primitives.Dict(xref);
  4317. appearanceDict.set("Resources", resources);
  4318. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  4319. appearanceDict.set("BBox", bbox);
  4320. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  4321. this.appearance.dict = appearanceDict;
  4322. this._streams.push(this.appearance, appearanceStream);
  4323. }
  4324. }
  4325. exports.MarkupAnnotation = MarkupAnnotation;
  4326. class WidgetAnnotation extends Annotation {
  4327. constructor(params) {
  4328. super(params);
  4329. const dict = params.dict;
  4330. const data = this.data;
  4331. this.ref = params.ref;
  4332. data.annotationType = _util.AnnotationType.WIDGET;
  4333. if (data.fieldName === undefined) {
  4334. data.fieldName = this._constructFieldName(dict);
  4335. }
  4336. if (data.actions === undefined) {
  4337. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  4338. }
  4339. const fieldValue = (0, _core_utils.getInheritableProperty)({
  4340. dict,
  4341. key: "V",
  4342. getArray: true
  4343. });
  4344. data.fieldValue = this._decodeFormValue(fieldValue);
  4345. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  4346. dict,
  4347. key: "DV",
  4348. getArray: true
  4349. });
  4350. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  4351. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  4352. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  4353. dict,
  4354. key: "DA"
  4355. }) || params.acroForm.get("DA");
  4356. this._defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : "";
  4357. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  4358. const fieldType = (0, _core_utils.getInheritableProperty)({
  4359. dict,
  4360. key: "FT"
  4361. });
  4362. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  4363. const localResources = (0, _core_utils.getInheritableProperty)({
  4364. dict,
  4365. key: "DR"
  4366. });
  4367. const acroFormResources = params.acroForm.get("DR");
  4368. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  4369. this._fieldResources = {
  4370. localResources,
  4371. acroFormResources,
  4372. appearanceResources,
  4373. mergedResources: _primitives.Dict.merge({
  4374. xref: params.xref,
  4375. dictArray: [localResources, appearanceResources, acroFormResources],
  4376. mergeSubDicts: true
  4377. })
  4378. };
  4379. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  4380. dict,
  4381. key: "Ff"
  4382. });
  4383. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  4384. data.fieldFlags = 0;
  4385. }
  4386. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  4387. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  4388. }
  4389. _decodeFormValue(formValue) {
  4390. if (Array.isArray(formValue)) {
  4391. return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item));
  4392. } else if ((0, _primitives.isName)(formValue)) {
  4393. return (0, _util.stringToPDFString)(formValue.name);
  4394. } else if ((0, _util.isString)(formValue)) {
  4395. return (0, _util.stringToPDFString)(formValue);
  4396. }
  4397. return null;
  4398. }
  4399. hasFieldFlag(flag) {
  4400. return !!(this.data.fieldFlags & flag);
  4401. }
  4402. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  4403. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  4404. return Promise.resolve(new _operator_list.OperatorList());
  4405. }
  4406. if (!this._hasText) {
  4407. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4408. }
  4409. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  4410. if (this.appearance && content === null) {
  4411. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4412. }
  4413. const operatorList = new _operator_list.OperatorList();
  4414. if (!this._defaultAppearance || content === null) {
  4415. return operatorList;
  4416. }
  4417. const matrix = [1, 0, 0, 1, 0, 0];
  4418. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  4419. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  4420. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.rect, transform, matrix]);
  4421. const stream = new _stream.StringStream(content);
  4422. return evaluator.getOperatorList({
  4423. stream,
  4424. task,
  4425. resources: this._fieldResources.mergedResources,
  4426. operatorList
  4427. }).then(function () {
  4428. operatorList.addOp(_util.OPS.endAnnotation, []);
  4429. return operatorList;
  4430. });
  4431. });
  4432. }
  4433. async save(evaluator, task, annotationStorage) {
  4434. if (!annotationStorage) {
  4435. return null;
  4436. }
  4437. const storageEntry = annotationStorage.get(this.data.id);
  4438. const value = storageEntry && storageEntry.value;
  4439. if (value === this.data.fieldValue || value === undefined) {
  4440. return null;
  4441. }
  4442. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  4443. if (appearance === null) {
  4444. return null;
  4445. }
  4446. const {
  4447. xref
  4448. } = evaluator;
  4449. const dict = xref.fetchIfRef(this.ref);
  4450. if (!(0, _primitives.isDict)(dict)) {
  4451. return null;
  4452. }
  4453. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  4454. const xfa = {
  4455. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  4456. value
  4457. };
  4458. const newRef = xref.getNewRef();
  4459. const AP = new _primitives.Dict(xref);
  4460. AP.set("N", newRef);
  4461. const encrypt = xref.encrypt;
  4462. let originalTransform = null;
  4463. let newTransform = null;
  4464. if (encrypt) {
  4465. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  4466. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  4467. appearance = newTransform.encryptString(appearance);
  4468. }
  4469. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  4470. dict.set("AP", AP);
  4471. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  4472. const appearanceDict = new _primitives.Dict(xref);
  4473. appearanceDict.set("Length", appearance.length);
  4474. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  4475. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  4476. appearanceDict.set("BBox", bbox);
  4477. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  4478. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  4479. bufferOriginal.push("\nendobj\n");
  4480. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  4481. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  4482. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  4483. return [{
  4484. ref: this.ref,
  4485. data: bufferOriginal.join(""),
  4486. xfa
  4487. }, {
  4488. ref: newRef,
  4489. data: bufferNew.join(""),
  4490. xfa: null
  4491. }];
  4492. }
  4493. async _getAppearance(evaluator, task, annotationStorage) {
  4494. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  4495. if (!annotationStorage || isPassword) {
  4496. return null;
  4497. }
  4498. const storageEntry = annotationStorage.get(this.data.id);
  4499. let value = storageEntry && storageEntry.value;
  4500. if (value === undefined) {
  4501. return null;
  4502. }
  4503. value = value.trim();
  4504. if (value === "") {
  4505. return "";
  4506. }
  4507. let lineCount = -1;
  4508. if (this.data.multiLine) {
  4509. lineCount = value.split(/\r\n|\r|\n/).length;
  4510. }
  4511. const defaultPadding = 2;
  4512. const hPadding = defaultPadding;
  4513. const totalHeight = this.data.rect[3] - this.data.rect[1];
  4514. const totalWidth = this.data.rect[2] - this.data.rect[0];
  4515. if (!this._defaultAppearance) {
  4516. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  4517. }
  4518. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight, lineCount);
  4519. const font = await this._getFontData(evaluator, task);
  4520. let descent = font.descent;
  4521. if (isNaN(descent)) {
  4522. descent = 0;
  4523. }
  4524. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  4525. const alignment = this.data.textAlignment;
  4526. if (this.data.multiLine) {
  4527. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  4528. }
  4529. const encodedString = font.encodeString(value).join("");
  4530. if (this.data.comb) {
  4531. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  4532. }
  4533. if (alignment === 0 || alignment > 2) {
  4534. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  4535. }
  4536. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  4537. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  4538. }
  4539. async _getFontData(evaluator, task) {
  4540. const operatorList = new _operator_list.OperatorList();
  4541. const initialState = {
  4542. font: null,
  4543. clone() {
  4544. return this;
  4545. }
  4546. };
  4547. const {
  4548. fontName,
  4549. fontSize
  4550. } = this.data.defaultAppearanceData;
  4551. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  4552. return initialState.font;
  4553. }
  4554. _computeFontSize(height, lineCount) {
  4555. let {
  4556. fontSize
  4557. } = this.data.defaultAppearanceData;
  4558. if (!fontSize) {
  4559. const roundWithOneDigit = x => Math.round(x * 10) / 10;
  4560. const FONT_FACTOR = 0.8;
  4561. if (lineCount === -1) {
  4562. fontSize = roundWithOneDigit(FONT_FACTOR * height);
  4563. } else {
  4564. fontSize = 10;
  4565. let lineHeight = fontSize / FONT_FACTOR;
  4566. let numberOfLines = Math.round(height / lineHeight);
  4567. numberOfLines = Math.max(numberOfLines, lineCount);
  4568. lineHeight = height / numberOfLines;
  4569. fontSize = roundWithOneDigit(FONT_FACTOR * lineHeight);
  4570. }
  4571. const {
  4572. fontName,
  4573. fontColor
  4574. } = this.data.defaultAppearanceData;
  4575. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  4576. fontSize,
  4577. fontName,
  4578. fontColor
  4579. });
  4580. }
  4581. return [this._defaultAppearance, fontSize];
  4582. }
  4583. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  4584. const glyphs = font.charsToGlyphs(text);
  4585. const scale = fontSize / 1000;
  4586. let width = 0;
  4587. for (const glyph of glyphs) {
  4588. width += glyph.width * scale;
  4589. }
  4590. let shift;
  4591. if (alignment === 1) {
  4592. shift = (totalWidth - width) / 2;
  4593. } else if (alignment === 2) {
  4594. shift = totalWidth - width - hPadding;
  4595. } else {
  4596. shift = hPadding;
  4597. }
  4598. shift = shift.toFixed(2);
  4599. vPadding = vPadding.toFixed(2);
  4600. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  4601. }
  4602. _getSaveFieldResources(xref) {
  4603. const {
  4604. localResources,
  4605. appearanceResources,
  4606. acroFormResources
  4607. } = this._fieldResources;
  4608. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  4609. if (!fontName) {
  4610. return localResources || _primitives.Dict.empty;
  4611. }
  4612. for (const resources of [localResources, appearanceResources]) {
  4613. if (resources instanceof _primitives.Dict) {
  4614. const localFont = resources.get("Font");
  4615. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  4616. return resources;
  4617. }
  4618. }
  4619. }
  4620. if (acroFormResources instanceof _primitives.Dict) {
  4621. const acroFormFont = acroFormResources.get("Font");
  4622. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  4623. const subFontDict = new _primitives.Dict(xref);
  4624. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  4625. const subResourcesDict = new _primitives.Dict(xref);
  4626. subResourcesDict.set("Font", subFontDict);
  4627. return _primitives.Dict.merge({
  4628. xref,
  4629. dictArray: [subResourcesDict, localResources],
  4630. mergeSubDicts: true
  4631. });
  4632. }
  4633. }
  4634. return localResources || _primitives.Dict.empty;
  4635. }
  4636. getFieldObject() {
  4637. return null;
  4638. }
  4639. }
  4640. class TextWidgetAnnotation extends WidgetAnnotation {
  4641. constructor(params) {
  4642. super(params);
  4643. this._hasText = true;
  4644. const dict = params.dict;
  4645. if (!(0, _util.isString)(this.data.fieldValue)) {
  4646. this.data.fieldValue = "";
  4647. }
  4648. let alignment = (0, _core_utils.getInheritableProperty)({
  4649. dict,
  4650. key: "Q"
  4651. });
  4652. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  4653. alignment = null;
  4654. }
  4655. this.data.textAlignment = alignment;
  4656. let maximumLength = (0, _core_utils.getInheritableProperty)({
  4657. dict,
  4658. key: "MaxLen"
  4659. });
  4660. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  4661. maximumLength = null;
  4662. }
  4663. this.data.maxLen = maximumLength;
  4664. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  4665. 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;
  4666. }
  4667. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  4668. const combWidth = (width / this.data.maxLen).toFixed(2);
  4669. const buf = [];
  4670. const positions = font.getCharPositions(text);
  4671. for (const [start, end] of positions) {
  4672. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  4673. }
  4674. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  4675. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  4676. }
  4677. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  4678. const lines = text.split(/\r\n|\r|\n/);
  4679. const buf = [];
  4680. const totalWidth = width - 2 * hPadding;
  4681. for (const line of lines) {
  4682. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  4683. for (const chunk of chunks) {
  4684. const padding = buf.length === 0 ? hPadding : 0;
  4685. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  4686. }
  4687. }
  4688. const renderedText = buf.join("\n");
  4689. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  4690. }
  4691. _splitLine(line, font, fontSize, width) {
  4692. line = font.encodeString(line).join("");
  4693. const glyphs = font.charsToGlyphs(line);
  4694. if (glyphs.length <= 1) {
  4695. return [line];
  4696. }
  4697. const positions = font.getCharPositions(line);
  4698. const scale = fontSize / 1000;
  4699. const chunks = [];
  4700. let lastSpacePosInStringStart = -1,
  4701. lastSpacePosInStringEnd = -1,
  4702. lastSpacePos = -1,
  4703. startChunk = 0,
  4704. currentWidth = 0;
  4705. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  4706. const [start, end] = positions[i];
  4707. const glyph = glyphs[i];
  4708. const glyphWidth = glyph.width * scale;
  4709. if (glyph.unicode === " ") {
  4710. if (currentWidth + glyphWidth > width) {
  4711. chunks.push(line.substring(startChunk, start));
  4712. startChunk = start;
  4713. currentWidth = glyphWidth;
  4714. lastSpacePosInStringStart = -1;
  4715. lastSpacePos = -1;
  4716. } else {
  4717. currentWidth += glyphWidth;
  4718. lastSpacePosInStringStart = start;
  4719. lastSpacePosInStringEnd = end;
  4720. lastSpacePos = i;
  4721. }
  4722. } else {
  4723. if (currentWidth + glyphWidth > width) {
  4724. if (lastSpacePosInStringStart !== -1) {
  4725. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  4726. startChunk = lastSpacePosInStringEnd;
  4727. i = lastSpacePos + 1;
  4728. lastSpacePosInStringStart = -1;
  4729. currentWidth = 0;
  4730. } else {
  4731. chunks.push(line.substring(startChunk, start));
  4732. startChunk = start;
  4733. currentWidth = glyphWidth;
  4734. }
  4735. } else {
  4736. currentWidth += glyphWidth;
  4737. }
  4738. }
  4739. }
  4740. if (startChunk < line.length) {
  4741. chunks.push(line.substring(startChunk, line.length));
  4742. }
  4743. return chunks;
  4744. }
  4745. getFieldObject() {
  4746. return {
  4747. id: this.data.id,
  4748. value: this.data.fieldValue,
  4749. defaultValue: this.data.defaultFieldValue,
  4750. multiline: this.data.multiLine,
  4751. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  4752. charLimit: this.data.maxLen,
  4753. comb: this.data.comb,
  4754. editable: !this.data.readOnly,
  4755. hidden: this.data.hidden,
  4756. name: this.data.fieldName,
  4757. rect: this.data.rect,
  4758. actions: this.data.actions,
  4759. page: this.data.pageIndex,
  4760. type: "text"
  4761. };
  4762. }
  4763. }
  4764. class ButtonWidgetAnnotation extends WidgetAnnotation {
  4765. constructor(params) {
  4766. super(params);
  4767. this.checkedAppearance = null;
  4768. this.uncheckedAppearance = null;
  4769. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  4770. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  4771. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  4772. this.data.isTooltipOnly = false;
  4773. if (this.data.checkBox) {
  4774. this._processCheckBox(params);
  4775. } else if (this.data.radioButton) {
  4776. this._processRadioButton(params);
  4777. } else if (this.data.pushButton) {
  4778. this._processPushButton(params);
  4779. } else {
  4780. (0, _util.warn)("Invalid field flags for button widget annotation");
  4781. }
  4782. }
  4783. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  4784. if (this.data.pushButton) {
  4785. return super.getOperatorList(evaluator, task, false, annotationStorage);
  4786. }
  4787. if (annotationStorage) {
  4788. const storageEntry = annotationStorage.get(this.data.id);
  4789. const value = storageEntry && storageEntry.value;
  4790. if (value === undefined) {
  4791. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4792. }
  4793. let appearance;
  4794. if (value) {
  4795. appearance = this.checkedAppearance;
  4796. } else {
  4797. appearance = this.uncheckedAppearance;
  4798. }
  4799. if (appearance) {
  4800. const savedAppearance = this.appearance;
  4801. this.appearance = appearance;
  4802. const operatorList = super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4803. this.appearance = savedAppearance;
  4804. return operatorList;
  4805. }
  4806. return Promise.resolve(new _operator_list.OperatorList());
  4807. }
  4808. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  4809. }
  4810. async save(evaluator, task, annotationStorage) {
  4811. if (this.data.checkBox) {
  4812. return this._saveCheckbox(evaluator, task, annotationStorage);
  4813. }
  4814. if (this.data.radioButton) {
  4815. return this._saveRadioButton(evaluator, task, annotationStorage);
  4816. }
  4817. return null;
  4818. }
  4819. async _saveCheckbox(evaluator, task, annotationStorage) {
  4820. if (!annotationStorage) {
  4821. return null;
  4822. }
  4823. const storageEntry = annotationStorage.get(this.data.id);
  4824. const value = storageEntry && storageEntry.value;
  4825. if (value === undefined) {
  4826. return null;
  4827. }
  4828. const defaultValue = this.data.fieldValue && this.data.fieldValue !== "Off";
  4829. if (defaultValue === value) {
  4830. return null;
  4831. }
  4832. const dict = evaluator.xref.fetchIfRef(this.ref);
  4833. if (!(0, _primitives.isDict)(dict)) {
  4834. return null;
  4835. }
  4836. const xfa = {
  4837. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  4838. value: value ? this.data.exportValue : ""
  4839. };
  4840. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  4841. dict.set("V", name);
  4842. dict.set("AS", name);
  4843. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  4844. const encrypt = evaluator.xref.encrypt;
  4845. let originalTransform = null;
  4846. if (encrypt) {
  4847. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  4848. }
  4849. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  4850. (0, _writer.writeDict)(dict, buffer, originalTransform);
  4851. buffer.push("\nendobj\n");
  4852. return [{
  4853. ref: this.ref,
  4854. data: buffer.join(""),
  4855. xfa
  4856. }];
  4857. }
  4858. async _saveRadioButton(evaluator, task, annotationStorage) {
  4859. if (!annotationStorage) {
  4860. return null;
  4861. }
  4862. const storageEntry = annotationStorage.get(this.data.id);
  4863. const value = storageEntry && storageEntry.value;
  4864. if (value === undefined) {
  4865. return null;
  4866. }
  4867. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  4868. if (defaultValue === value) {
  4869. return null;
  4870. }
  4871. const dict = evaluator.xref.fetchIfRef(this.ref);
  4872. if (!(0, _primitives.isDict)(dict)) {
  4873. return null;
  4874. }
  4875. const xfa = {
  4876. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  4877. value: value ? this.data.buttonValue : ""
  4878. };
  4879. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  4880. let parentBuffer = null;
  4881. const encrypt = evaluator.xref.encrypt;
  4882. if (value) {
  4883. if ((0, _primitives.isRef)(this.parent)) {
  4884. const parent = evaluator.xref.fetch(this.parent);
  4885. let parentTransform = null;
  4886. if (encrypt) {
  4887. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  4888. }
  4889. parent.set("V", name);
  4890. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  4891. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  4892. parentBuffer.push("\nendobj\n");
  4893. } else if ((0, _primitives.isDict)(this.parent)) {
  4894. this.parent.set("V", name);
  4895. }
  4896. }
  4897. dict.set("AS", name);
  4898. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  4899. let originalTransform = null;
  4900. if (encrypt) {
  4901. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  4902. }
  4903. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  4904. (0, _writer.writeDict)(dict, buffer, originalTransform);
  4905. buffer.push("\nendobj\n");
  4906. const newRefs = [{
  4907. ref: this.ref,
  4908. data: buffer.join(""),
  4909. xfa
  4910. }];
  4911. if (parentBuffer !== null) {
  4912. newRefs.push({
  4913. ref: this.parent,
  4914. data: parentBuffer.join(""),
  4915. xfa: null
  4916. });
  4917. }
  4918. return newRefs;
  4919. }
  4920. _processCheckBox(params) {
  4921. const customAppearance = params.dict.get("AP");
  4922. if (!(0, _primitives.isDict)(customAppearance)) {
  4923. return;
  4924. }
  4925. const normalAppearance = customAppearance.get("N");
  4926. if (!(0, _primitives.isDict)(normalAppearance)) {
  4927. return;
  4928. }
  4929. const exportValues = normalAppearance.getKeys();
  4930. if (!exportValues.includes("Off")) {
  4931. exportValues.push("Off");
  4932. }
  4933. if (exportValues.length !== 2) {
  4934. return;
  4935. }
  4936. this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
  4937. this.checkedAppearance = normalAppearance.get(this.data.exportValue);
  4938. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  4939. this._streams.push(this.checkedAppearance);
  4940. if (this.uncheckedAppearance) {
  4941. this._streams.push(this.uncheckedAppearance);
  4942. }
  4943. this._fallbackFontDict = this.fallbackFontDict;
  4944. }
  4945. _processRadioButton(params) {
  4946. this.data.fieldValue = this.data.buttonValue = null;
  4947. const fieldParent = params.dict.get("Parent");
  4948. if ((0, _primitives.isDict)(fieldParent)) {
  4949. this.parent = params.dict.getRaw("Parent");
  4950. const fieldParentValue = fieldParent.get("V");
  4951. if ((0, _primitives.isName)(fieldParentValue)) {
  4952. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  4953. }
  4954. }
  4955. const appearanceStates = params.dict.get("AP");
  4956. if (!(0, _primitives.isDict)(appearanceStates)) {
  4957. return;
  4958. }
  4959. const normalAppearance = appearanceStates.get("N");
  4960. if (!(0, _primitives.isDict)(normalAppearance)) {
  4961. return;
  4962. }
  4963. for (const key of normalAppearance.getKeys()) {
  4964. if (key !== "Off") {
  4965. this.data.buttonValue = this._decodeFormValue(key);
  4966. break;
  4967. }
  4968. }
  4969. this.checkedAppearance = normalAppearance.get(this.data.buttonValue);
  4970. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  4971. this._streams.push(this.checkedAppearance);
  4972. if (this.uncheckedAppearance) {
  4973. this._streams.push(this.uncheckedAppearance);
  4974. }
  4975. this._fallbackFontDict = this.fallbackFontDict;
  4976. }
  4977. _processPushButton(params) {
  4978. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  4979. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  4980. return;
  4981. }
  4982. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  4983. _catalog.Catalog.parseDestDictionary({
  4984. destDict: params.dict,
  4985. resultObj: this.data,
  4986. docBaseUrl: params.pdfManager.docBaseUrl
  4987. });
  4988. }
  4989. getFieldObject() {
  4990. let type = "button";
  4991. let exportValues;
  4992. if (this.data.checkBox) {
  4993. type = "checkbox";
  4994. exportValues = this.data.exportValue;
  4995. } else if (this.data.radioButton) {
  4996. type = "radiobutton";
  4997. exportValues = this.data.buttonValue;
  4998. }
  4999. return {
  5000. id: this.data.id,
  5001. value: this.data.fieldValue || "Off",
  5002. defaultValue: this.data.defaultFieldValue,
  5003. exportValues,
  5004. editable: !this.data.readOnly,
  5005. name: this.data.fieldName,
  5006. rect: this.data.rect,
  5007. hidden: this.data.hidden,
  5008. actions: this.data.actions,
  5009. page: this.data.pageIndex,
  5010. type
  5011. };
  5012. }
  5013. get fallbackFontDict() {
  5014. const dict = new _primitives.Dict();
  5015. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  5016. dict.set("Type", _primitives.Name.get("FallbackType"));
  5017. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  5018. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  5019. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  5020. }
  5021. }
  5022. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  5023. constructor(params) {
  5024. super(params);
  5025. this.data.options = [];
  5026. const options = (0, _core_utils.getInheritableProperty)({
  5027. dict: params.dict,
  5028. key: "Opt"
  5029. });
  5030. if (Array.isArray(options)) {
  5031. const xref = params.xref;
  5032. for (let i = 0, ii = options.length; i < ii; i++) {
  5033. const option = xref.fetchIfRef(options[i]);
  5034. const isOptionArray = Array.isArray(option);
  5035. this.data.options[i] = {
  5036. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  5037. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  5038. };
  5039. }
  5040. }
  5041. if ((0, _util.isString)(this.data.fieldValue)) {
  5042. this.data.fieldValue = [this.data.fieldValue];
  5043. } else if (!this.data.fieldValue) {
  5044. this.data.fieldValue = [];
  5045. }
  5046. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  5047. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  5048. this._hasText = true;
  5049. }
  5050. getFieldObject() {
  5051. const type = this.data.combo ? "combobox" : "listbox";
  5052. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  5053. return {
  5054. id: this.data.id,
  5055. value,
  5056. defaultValue: this.data.defaultFieldValue,
  5057. editable: !this.data.readOnly,
  5058. name: this.data.fieldName,
  5059. rect: this.data.rect,
  5060. numItems: this.data.fieldValue.length,
  5061. multipleSelection: this.data.multiSelect,
  5062. hidden: this.data.hidden,
  5063. actions: this.data.actions,
  5064. items: this.data.options,
  5065. page: this.data.pageIndex,
  5066. type
  5067. };
  5068. }
  5069. }
  5070. class SignatureWidgetAnnotation extends WidgetAnnotation {
  5071. constructor(params) {
  5072. super(params);
  5073. this.data.fieldValue = null;
  5074. }
  5075. getFieldObject() {
  5076. return {
  5077. id: this.data.id,
  5078. value: null,
  5079. page: this.data.pageIndex,
  5080. type: "signature"
  5081. };
  5082. }
  5083. }
  5084. class TextAnnotation extends MarkupAnnotation {
  5085. constructor(parameters) {
  5086. const DEFAULT_ICON_SIZE = 22;
  5087. super(parameters);
  5088. const dict = parameters.dict;
  5089. this.data.annotationType = _util.AnnotationType.TEXT;
  5090. if (this.data.hasAppearance) {
  5091. this.data.name = "NoIcon";
  5092. } else {
  5093. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  5094. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  5095. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  5096. }
  5097. if (dict.has("State")) {
  5098. this.data.state = dict.get("State") || null;
  5099. this.data.stateModel = dict.get("StateModel") || null;
  5100. } else {
  5101. this.data.state = null;
  5102. this.data.stateModel = null;
  5103. }
  5104. }
  5105. }
  5106. class LinkAnnotation extends Annotation {
  5107. constructor(params) {
  5108. super(params);
  5109. this.data.annotationType = _util.AnnotationType.LINK;
  5110. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  5111. if (quadPoints) {
  5112. this.data.quadPoints = quadPoints;
  5113. }
  5114. _catalog.Catalog.parseDestDictionary({
  5115. destDict: params.dict,
  5116. resultObj: this.data,
  5117. docBaseUrl: params.pdfManager.docBaseUrl
  5118. });
  5119. }
  5120. }
  5121. class PopupAnnotation extends Annotation {
  5122. constructor(parameters) {
  5123. super(parameters);
  5124. this.data.annotationType = _util.AnnotationType.POPUP;
  5125. let parentItem = parameters.dict.get("Parent");
  5126. if (!parentItem) {
  5127. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  5128. return;
  5129. }
  5130. const parentSubtype = parentItem.get("Subtype");
  5131. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  5132. const rawParent = parameters.dict.getRaw("Parent");
  5133. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  5134. const parentRect = parentItem.getArray("Rect");
  5135. if (Array.isArray(parentRect) && parentRect.length === 4) {
  5136. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  5137. } else {
  5138. this.data.parentRect = [0, 0, 0, 0];
  5139. }
  5140. const rt = parentItem.get("RT");
  5141. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  5142. parentItem = parentItem.get("IRT");
  5143. }
  5144. if (!parentItem.has("M")) {
  5145. this.data.modificationDate = null;
  5146. } else {
  5147. this.setModificationDate(parentItem.get("M"));
  5148. this.data.modificationDate = this.modificationDate;
  5149. }
  5150. if (!parentItem.has("C")) {
  5151. this.data.color = null;
  5152. } else {
  5153. this.setColor(parentItem.getArray("C"));
  5154. this.data.color = this.color;
  5155. }
  5156. if (!this.viewable) {
  5157. const parentFlags = parentItem.get("F");
  5158. if (this._isViewable(parentFlags)) {
  5159. this.setFlags(parentFlags);
  5160. }
  5161. }
  5162. this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
  5163. this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
  5164. }
  5165. }
  5166. class FreeTextAnnotation extends MarkupAnnotation {
  5167. constructor(parameters) {
  5168. super(parameters);
  5169. this.data.annotationType = _util.AnnotationType.FREETEXT;
  5170. }
  5171. }
  5172. class LineAnnotation extends MarkupAnnotation {
  5173. constructor(parameters) {
  5174. super(parameters);
  5175. this.data.annotationType = _util.AnnotationType.LINE;
  5176. const lineCoordinates = parameters.dict.getArray("L");
  5177. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  5178. if (!this.appearance) {
  5179. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5180. const strokeAlpha = parameters.dict.get("CA");
  5181. let fillColor = null,
  5182. interiorColor = parameters.dict.getArray("IC");
  5183. if (interiorColor) {
  5184. interiorColor = getRgbColor(interiorColor);
  5185. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  5186. }
  5187. const fillAlpha = fillColor ? strokeAlpha : null;
  5188. const borderWidth = this.borderStyle.width || 1,
  5189. borderAdjust = 2 * borderWidth;
  5190. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  5191. if (!_util.Util.intersect(this.rectangle, bbox)) {
  5192. this.rectangle = bbox;
  5193. }
  5194. this._setDefaultAppearance({
  5195. xref: parameters.xref,
  5196. extra: `${borderWidth} w`,
  5197. strokeColor,
  5198. fillColor,
  5199. strokeAlpha,
  5200. fillAlpha,
  5201. pointsCallback: (buffer, points) => {
  5202. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  5203. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  5204. }
  5205. });
  5206. }
  5207. }
  5208. }
  5209. class SquareAnnotation extends MarkupAnnotation {
  5210. constructor(parameters) {
  5211. super(parameters);
  5212. this.data.annotationType = _util.AnnotationType.SQUARE;
  5213. if (!this.appearance) {
  5214. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5215. const strokeAlpha = parameters.dict.get("CA");
  5216. let fillColor = null,
  5217. interiorColor = parameters.dict.getArray("IC");
  5218. if (interiorColor) {
  5219. interiorColor = getRgbColor(interiorColor);
  5220. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  5221. }
  5222. const fillAlpha = fillColor ? strokeAlpha : null;
  5223. this._setDefaultAppearance({
  5224. xref: parameters.xref,
  5225. extra: `${this.borderStyle.width} w`,
  5226. strokeColor,
  5227. fillColor,
  5228. strokeAlpha,
  5229. fillAlpha,
  5230. pointsCallback: (buffer, points) => {
  5231. const x = points[2].x + this.borderStyle.width / 2;
  5232. const y = points[2].y + this.borderStyle.width / 2;
  5233. const width = points[3].x - points[2].x - this.borderStyle.width;
  5234. const height = points[1].y - points[3].y - this.borderStyle.width;
  5235. buffer.push(`${x} ${y} ${width} ${height} re`);
  5236. if (fillColor) {
  5237. buffer.push("B");
  5238. } else {
  5239. buffer.push("S");
  5240. }
  5241. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5242. }
  5243. });
  5244. }
  5245. }
  5246. }
  5247. class CircleAnnotation extends MarkupAnnotation {
  5248. constructor(parameters) {
  5249. super(parameters);
  5250. this.data.annotationType = _util.AnnotationType.CIRCLE;
  5251. if (!this.appearance) {
  5252. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5253. const strokeAlpha = parameters.dict.get("CA");
  5254. let fillColor = null;
  5255. let interiorColor = parameters.dict.getArray("IC");
  5256. if (interiorColor) {
  5257. interiorColor = getRgbColor(interiorColor);
  5258. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  5259. }
  5260. const fillAlpha = fillColor ? strokeAlpha : null;
  5261. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  5262. this._setDefaultAppearance({
  5263. xref: parameters.xref,
  5264. extra: `${this.borderStyle.width} w`,
  5265. strokeColor,
  5266. fillColor,
  5267. strokeAlpha,
  5268. fillAlpha,
  5269. pointsCallback: (buffer, points) => {
  5270. const x0 = points[0].x + this.borderStyle.width / 2;
  5271. const y0 = points[0].y - this.borderStyle.width / 2;
  5272. const x1 = points[3].x - this.borderStyle.width / 2;
  5273. const y1 = points[3].y + this.borderStyle.width / 2;
  5274. const xMid = x0 + (x1 - x0) / 2;
  5275. const yMid = y0 + (y1 - y0) / 2;
  5276. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  5277. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  5278. 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");
  5279. if (fillColor) {
  5280. buffer.push("B");
  5281. } else {
  5282. buffer.push("S");
  5283. }
  5284. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5285. }
  5286. });
  5287. }
  5288. }
  5289. }
  5290. class PolylineAnnotation extends MarkupAnnotation {
  5291. constructor(parameters) {
  5292. super(parameters);
  5293. this.data.annotationType = _util.AnnotationType.POLYLINE;
  5294. this.data.vertices = [];
  5295. const rawVertices = parameters.dict.getArray("Vertices");
  5296. if (!Array.isArray(rawVertices)) {
  5297. return;
  5298. }
  5299. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  5300. this.data.vertices.push({
  5301. x: rawVertices[i],
  5302. y: rawVertices[i + 1]
  5303. });
  5304. }
  5305. if (!this.appearance) {
  5306. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5307. const strokeAlpha = parameters.dict.get("CA");
  5308. const borderWidth = this.borderStyle.width || 1,
  5309. borderAdjust = 2 * borderWidth;
  5310. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  5311. for (const vertex of this.data.vertices) {
  5312. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  5313. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  5314. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  5315. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  5316. }
  5317. if (!_util.Util.intersect(this.rectangle, bbox)) {
  5318. this.rectangle = bbox;
  5319. }
  5320. this._setDefaultAppearance({
  5321. xref: parameters.xref,
  5322. extra: `${borderWidth} w`,
  5323. strokeColor,
  5324. strokeAlpha,
  5325. pointsCallback: (buffer, points) => {
  5326. const vertices = this.data.vertices;
  5327. for (let i = 0, ii = vertices.length; i < ii; i++) {
  5328. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  5329. }
  5330. buffer.push("S");
  5331. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5332. }
  5333. });
  5334. }
  5335. }
  5336. }
  5337. class PolygonAnnotation extends PolylineAnnotation {
  5338. constructor(parameters) {
  5339. super(parameters);
  5340. this.data.annotationType = _util.AnnotationType.POLYGON;
  5341. }
  5342. }
  5343. class CaretAnnotation extends MarkupAnnotation {
  5344. constructor(parameters) {
  5345. super(parameters);
  5346. this.data.annotationType = _util.AnnotationType.CARET;
  5347. }
  5348. }
  5349. class InkAnnotation extends MarkupAnnotation {
  5350. constructor(parameters) {
  5351. super(parameters);
  5352. this.data.annotationType = _util.AnnotationType.INK;
  5353. this.data.inkLists = [];
  5354. const rawInkLists = parameters.dict.getArray("InkList");
  5355. if (!Array.isArray(rawInkLists)) {
  5356. return;
  5357. }
  5358. const xref = parameters.xref;
  5359. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  5360. this.data.inkLists.push([]);
  5361. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  5362. this.data.inkLists[i].push({
  5363. x: xref.fetchIfRef(rawInkLists[i][j]),
  5364. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  5365. });
  5366. }
  5367. }
  5368. if (!this.appearance) {
  5369. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5370. const strokeAlpha = parameters.dict.get("CA");
  5371. const borderWidth = this.borderStyle.width || 1,
  5372. borderAdjust = 2 * borderWidth;
  5373. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  5374. for (const inkLists of this.data.inkLists) {
  5375. for (const vertex of inkLists) {
  5376. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  5377. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  5378. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  5379. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  5380. }
  5381. }
  5382. if (!_util.Util.intersect(this.rectangle, bbox)) {
  5383. this.rectangle = bbox;
  5384. }
  5385. this._setDefaultAppearance({
  5386. xref: parameters.xref,
  5387. extra: `${borderWidth} w`,
  5388. strokeColor,
  5389. strokeAlpha,
  5390. pointsCallback: (buffer, points) => {
  5391. for (const inkList of this.data.inkLists) {
  5392. for (let i = 0, ii = inkList.length; i < ii; i++) {
  5393. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  5394. }
  5395. buffer.push("S");
  5396. }
  5397. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5398. }
  5399. });
  5400. }
  5401. }
  5402. }
  5403. class HighlightAnnotation extends MarkupAnnotation {
  5404. constructor(parameters) {
  5405. super(parameters);
  5406. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  5407. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5408. if (quadPoints) {
  5409. const resources = this.appearance && this.appearance.dict.get("Resources");
  5410. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  5411. if (this.appearance) {
  5412. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  5413. }
  5414. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  5415. const fillAlpha = parameters.dict.get("CA");
  5416. this._setDefaultAppearance({
  5417. xref: parameters.xref,
  5418. fillColor,
  5419. blendMode: "Multiply",
  5420. fillAlpha,
  5421. pointsCallback: (buffer, points) => {
  5422. 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");
  5423. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5424. }
  5425. });
  5426. }
  5427. } else {
  5428. this.data.hasPopup = false;
  5429. }
  5430. }
  5431. }
  5432. class UnderlineAnnotation extends MarkupAnnotation {
  5433. constructor(parameters) {
  5434. super(parameters);
  5435. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  5436. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5437. if (quadPoints) {
  5438. if (!this.appearance) {
  5439. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5440. const strokeAlpha = parameters.dict.get("CA");
  5441. this._setDefaultAppearance({
  5442. xref: parameters.xref,
  5443. extra: "[] 0 d 1 w",
  5444. strokeColor,
  5445. strokeAlpha,
  5446. pointsCallback: (buffer, points) => {
  5447. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  5448. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5449. }
  5450. });
  5451. }
  5452. } else {
  5453. this.data.hasPopup = false;
  5454. }
  5455. }
  5456. }
  5457. class SquigglyAnnotation extends MarkupAnnotation {
  5458. constructor(parameters) {
  5459. super(parameters);
  5460. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  5461. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5462. if (quadPoints) {
  5463. if (!this.appearance) {
  5464. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5465. const strokeAlpha = parameters.dict.get("CA");
  5466. this._setDefaultAppearance({
  5467. xref: parameters.xref,
  5468. extra: "[] 0 d 1 w",
  5469. strokeColor,
  5470. strokeAlpha,
  5471. pointsCallback: (buffer, points) => {
  5472. const dy = (points[0].y - points[2].y) / 6;
  5473. let shift = dy;
  5474. let x = points[2].x;
  5475. const y = points[2].y;
  5476. const xEnd = points[3].x;
  5477. buffer.push(`${x} ${y + shift} m`);
  5478. do {
  5479. x += 2;
  5480. shift = shift === 0 ? dy : 0;
  5481. buffer.push(`${x} ${y + shift} l`);
  5482. } while (x < xEnd);
  5483. buffer.push("S");
  5484. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  5485. }
  5486. });
  5487. }
  5488. } else {
  5489. this.data.hasPopup = false;
  5490. }
  5491. }
  5492. }
  5493. class StrikeOutAnnotation extends MarkupAnnotation {
  5494. constructor(parameters) {
  5495. super(parameters);
  5496. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  5497. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  5498. if (quadPoints) {
  5499. if (!this.appearance) {
  5500. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  5501. const strokeAlpha = parameters.dict.get("CA");
  5502. this._setDefaultAppearance({
  5503. xref: parameters.xref,
  5504. extra: "[] 0 d 1 w",
  5505. strokeColor,
  5506. strokeAlpha,
  5507. pointsCallback: (buffer, points) => {
  5508. 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");
  5509. return [points[0].x, points[1].x, points[3].y, points[1].y];
  5510. }
  5511. });
  5512. }
  5513. } else {
  5514. this.data.hasPopup = false;
  5515. }
  5516. }
  5517. }
  5518. class StampAnnotation extends MarkupAnnotation {
  5519. constructor(parameters) {
  5520. super(parameters);
  5521. this.data.annotationType = _util.AnnotationType.STAMP;
  5522. }
  5523. }
  5524. class FileAttachmentAnnotation extends MarkupAnnotation {
  5525. constructor(parameters) {
  5526. super(parameters);
  5527. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  5528. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  5529. this.data.file = file.serializable;
  5530. }
  5531. }
  5532. /***/ }),
  5533. /* 13 */
  5534. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5535. Object.defineProperty(exports, "__esModule", ({
  5536. value: true
  5537. }));
  5538. exports.createDefaultAppearance = createDefaultAppearance;
  5539. exports.parseDefaultAppearance = parseDefaultAppearance;
  5540. var _util = __w_pdfjs_require__(2);
  5541. var _colorspace = __w_pdfjs_require__(14);
  5542. var _core_utils = __w_pdfjs_require__(9);
  5543. var _evaluator = __w_pdfjs_require__(15);
  5544. var _primitives = __w_pdfjs_require__(5);
  5545. var _stream = __w_pdfjs_require__(10);
  5546. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  5547. constructor(str) {
  5548. super(new _stream.StringStream(str));
  5549. }
  5550. parse() {
  5551. const operation = {
  5552. fn: 0,
  5553. args: []
  5554. };
  5555. const result = {
  5556. fontSize: 0,
  5557. fontName: "",
  5558. fontColor: new Uint8ClampedArray(3)
  5559. };
  5560. try {
  5561. while (true) {
  5562. operation.args.length = 0;
  5563. if (!this.read(operation)) {
  5564. break;
  5565. }
  5566. if (this.savedStatesDepth !== 0) {
  5567. continue;
  5568. }
  5569. const {
  5570. fn,
  5571. args
  5572. } = operation;
  5573. switch (fn | 0) {
  5574. case _util.OPS.setFont:
  5575. const [fontName, fontSize] = args;
  5576. if (fontName instanceof _primitives.Name) {
  5577. result.fontName = fontName.name;
  5578. }
  5579. if (typeof fontSize === "number" && fontSize > 0) {
  5580. result.fontSize = fontSize;
  5581. }
  5582. break;
  5583. case _util.OPS.setFillRGBColor:
  5584. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  5585. break;
  5586. case _util.OPS.setFillGray:
  5587. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  5588. break;
  5589. case _util.OPS.setFillColorSpace:
  5590. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  5591. break;
  5592. }
  5593. }
  5594. } catch (reason) {
  5595. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  5596. }
  5597. return result;
  5598. }
  5599. }
  5600. function parseDefaultAppearance(str) {
  5601. return new DefaultAppearanceEvaluator(str).parse();
  5602. }
  5603. function createDefaultAppearance({
  5604. fontSize,
  5605. fontName,
  5606. fontColor
  5607. }) {
  5608. let colorCmd;
  5609. if (fontColor.every(c => c === 0)) {
  5610. colorCmd = "0 g";
  5611. } else {
  5612. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  5613. }
  5614. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  5615. }
  5616. /***/ }),
  5617. /* 14 */
  5618. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5619. Object.defineProperty(exports, "__esModule", ({
  5620. value: true
  5621. }));
  5622. exports.ColorSpace = void 0;
  5623. var _util = __w_pdfjs_require__(2);
  5624. var _primitives = __w_pdfjs_require__(5);
  5625. var _core_utils = __w_pdfjs_require__(9);
  5626. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  5627. const COMPONENTS = 3;
  5628. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  5629. const xRatio = w1 / w2;
  5630. const yRatio = h1 / h2;
  5631. let newIndex = 0,
  5632. oldIndex;
  5633. const xScaled = new Uint16Array(w2);
  5634. const w1Scanline = w1 * COMPONENTS;
  5635. for (let i = 0; i < w2; i++) {
  5636. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  5637. }
  5638. for (let i = 0; i < h2; i++) {
  5639. const py = Math.floor(i * yRatio) * w1Scanline;
  5640. for (let j = 0; j < w2; j++) {
  5641. oldIndex = py + xScaled[j];
  5642. dest[newIndex++] = src[oldIndex++];
  5643. dest[newIndex++] = src[oldIndex++];
  5644. dest[newIndex++] = src[oldIndex++];
  5645. newIndex += alpha01;
  5646. }
  5647. }
  5648. }
  5649. class ColorSpace {
  5650. constructor(name, numComps) {
  5651. if (this.constructor === ColorSpace) {
  5652. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  5653. }
  5654. this.name = name;
  5655. this.numComps = numComps;
  5656. }
  5657. getRgb(src, srcOffset) {
  5658. const rgb = new Uint8ClampedArray(3);
  5659. this.getRgbItem(src, srcOffset, rgb, 0);
  5660. return rgb;
  5661. }
  5662. getRgbItem(src, srcOffset, dest, destOffset) {
  5663. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  5664. }
  5665. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  5666. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  5667. }
  5668. getOutputLength(inputLength, alpha01) {
  5669. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  5670. }
  5671. isPassthrough(bits) {
  5672. return false;
  5673. }
  5674. isDefaultDecode(decodeMap, bpc) {
  5675. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  5676. }
  5677. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  5678. const count = originalWidth * originalHeight;
  5679. let rgbBuf = null;
  5680. const numComponentColors = 1 << bpc;
  5681. const needsResizing = originalHeight !== height || originalWidth !== width;
  5682. if (this.isPassthrough(bpc)) {
  5683. rgbBuf = comps;
  5684. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  5685. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  5686. for (let i = 0; i < numComponentColors; i++) {
  5687. allColors[i] = i;
  5688. }
  5689. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  5690. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  5691. if (!needsResizing) {
  5692. let destPos = 0;
  5693. for (let i = 0; i < count; ++i) {
  5694. const key = comps[i] * 3;
  5695. dest[destPos++] = colorMap[key];
  5696. dest[destPos++] = colorMap[key + 1];
  5697. dest[destPos++] = colorMap[key + 2];
  5698. destPos += alpha01;
  5699. }
  5700. } else {
  5701. rgbBuf = new Uint8Array(count * 3);
  5702. let rgbPos = 0;
  5703. for (let i = 0; i < count; ++i) {
  5704. const key = comps[i] * 3;
  5705. rgbBuf[rgbPos++] = colorMap[key];
  5706. rgbBuf[rgbPos++] = colorMap[key + 1];
  5707. rgbBuf[rgbPos++] = colorMap[key + 2];
  5708. }
  5709. }
  5710. } else {
  5711. if (!needsResizing) {
  5712. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  5713. } else {
  5714. rgbBuf = new Uint8ClampedArray(count * 3);
  5715. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  5716. }
  5717. }
  5718. if (rgbBuf) {
  5719. if (needsResizing) {
  5720. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  5721. } else {
  5722. let destPos = 0,
  5723. rgbPos = 0;
  5724. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  5725. dest[destPos++] = rgbBuf[rgbPos++];
  5726. dest[destPos++] = rgbBuf[rgbPos++];
  5727. dest[destPos++] = rgbBuf[rgbPos++];
  5728. destPos += alpha01;
  5729. }
  5730. }
  5731. }
  5732. }
  5733. get usesZeroToOneRange() {
  5734. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  5735. }
  5736. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  5737. if (!localColorSpaceCache) {
  5738. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  5739. }
  5740. if (!parsedColorSpace) {
  5741. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  5742. }
  5743. let csName, csRef;
  5744. if (cacheKey instanceof _primitives.Ref) {
  5745. csRef = cacheKey;
  5746. cacheKey = xref.fetch(cacheKey);
  5747. }
  5748. if (cacheKey instanceof _primitives.Name) {
  5749. csName = cacheKey.name;
  5750. }
  5751. if (csName || csRef) {
  5752. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  5753. }
  5754. }
  5755. static getCached(cacheKey, xref, localColorSpaceCache) {
  5756. if (!localColorSpaceCache) {
  5757. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  5758. }
  5759. if (cacheKey instanceof _primitives.Ref) {
  5760. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  5761. if (localColorSpace) {
  5762. return localColorSpace;
  5763. }
  5764. try {
  5765. cacheKey = xref.fetch(cacheKey);
  5766. } catch (ex) {
  5767. if (ex instanceof _core_utils.MissingDataException) {
  5768. throw ex;
  5769. }
  5770. }
  5771. }
  5772. if (cacheKey instanceof _primitives.Name) {
  5773. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  5774. if (localColorSpace) {
  5775. return localColorSpace;
  5776. }
  5777. }
  5778. return null;
  5779. }
  5780. static async parseAsync({
  5781. cs,
  5782. xref,
  5783. resources = null,
  5784. pdfFunctionFactory,
  5785. localColorSpaceCache
  5786. }) {
  5787. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  5788. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  5789. return parsedColorSpace;
  5790. }
  5791. static parse({
  5792. cs,
  5793. xref,
  5794. resources = null,
  5795. pdfFunctionFactory,
  5796. localColorSpaceCache
  5797. }) {
  5798. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  5799. if (cachedColorSpace) {
  5800. return cachedColorSpace;
  5801. }
  5802. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  5803. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  5804. return parsedColorSpace;
  5805. }
  5806. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  5807. cs = xref.fetchIfRef(cs);
  5808. if ((0, _primitives.isName)(cs)) {
  5809. switch (cs.name) {
  5810. case "DeviceGray":
  5811. case "G":
  5812. return this.singletons.gray;
  5813. case "DeviceRGB":
  5814. case "RGB":
  5815. return this.singletons.rgb;
  5816. case "DeviceCMYK":
  5817. case "CMYK":
  5818. return this.singletons.cmyk;
  5819. case "Pattern":
  5820. return new PatternCS(null);
  5821. default:
  5822. if ((0, _primitives.isDict)(resources)) {
  5823. const colorSpaces = resources.get("ColorSpace");
  5824. if ((0, _primitives.isDict)(colorSpaces)) {
  5825. const resourcesCS = colorSpaces.get(cs.name);
  5826. if (resourcesCS) {
  5827. if ((0, _primitives.isName)(resourcesCS)) {
  5828. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  5829. }
  5830. cs = resourcesCS;
  5831. break;
  5832. }
  5833. }
  5834. }
  5835. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  5836. }
  5837. }
  5838. if (Array.isArray(cs)) {
  5839. const mode = xref.fetchIfRef(cs[0]).name;
  5840. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  5841. switch (mode) {
  5842. case "DeviceGray":
  5843. case "G":
  5844. return this.singletons.gray;
  5845. case "DeviceRGB":
  5846. case "RGB":
  5847. return this.singletons.rgb;
  5848. case "DeviceCMYK":
  5849. case "CMYK":
  5850. return this.singletons.cmyk;
  5851. case "CalGray":
  5852. params = xref.fetchIfRef(cs[1]);
  5853. whitePoint = params.getArray("WhitePoint");
  5854. blackPoint = params.getArray("BlackPoint");
  5855. gamma = params.get("Gamma");
  5856. return new CalGrayCS(whitePoint, blackPoint, gamma);
  5857. case "CalRGB":
  5858. params = xref.fetchIfRef(cs[1]);
  5859. whitePoint = params.getArray("WhitePoint");
  5860. blackPoint = params.getArray("BlackPoint");
  5861. gamma = params.getArray("Gamma");
  5862. const matrix = params.getArray("Matrix");
  5863. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  5864. case "ICCBased":
  5865. const stream = xref.fetchIfRef(cs[1]);
  5866. const dict = stream.dict;
  5867. numComps = dict.get("N");
  5868. const alt = dict.get("Alternate");
  5869. if (alt) {
  5870. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  5871. if (altCS.numComps === numComps) {
  5872. return altCS;
  5873. }
  5874. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  5875. }
  5876. if (numComps === 1) {
  5877. return this.singletons.gray;
  5878. } else if (numComps === 3) {
  5879. return this.singletons.rgb;
  5880. } else if (numComps === 4) {
  5881. return this.singletons.cmyk;
  5882. }
  5883. break;
  5884. case "Pattern":
  5885. baseCS = cs[1] || null;
  5886. if (baseCS) {
  5887. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  5888. }
  5889. return new PatternCS(baseCS);
  5890. case "Indexed":
  5891. case "I":
  5892. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  5893. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  5894. const lookup = xref.fetchIfRef(cs[3]);
  5895. return new IndexedCS(baseCS, hiVal, lookup);
  5896. case "Separation":
  5897. case "DeviceN":
  5898. const name = xref.fetchIfRef(cs[1]);
  5899. numComps = Array.isArray(name) ? name.length : 1;
  5900. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  5901. const tintFn = pdfFunctionFactory.create(cs[3]);
  5902. return new AlternateCS(numComps, baseCS, tintFn);
  5903. case "Lab":
  5904. params = xref.fetchIfRef(cs[1]);
  5905. whitePoint = params.getArray("WhitePoint");
  5906. blackPoint = params.getArray("BlackPoint");
  5907. const range = params.getArray("Range");
  5908. return new LabCS(whitePoint, blackPoint, range);
  5909. default:
  5910. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  5911. }
  5912. }
  5913. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  5914. }
  5915. static isDefaultDecode(decode, numComps) {
  5916. if (!Array.isArray(decode)) {
  5917. return true;
  5918. }
  5919. if (numComps * 2 !== decode.length) {
  5920. (0, _util.warn)("The decode map is not the correct length");
  5921. return true;
  5922. }
  5923. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  5924. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  5925. return false;
  5926. }
  5927. }
  5928. return true;
  5929. }
  5930. static get singletons() {
  5931. return (0, _util.shadow)(this, "singletons", {
  5932. get gray() {
  5933. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  5934. },
  5935. get rgb() {
  5936. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  5937. },
  5938. get cmyk() {
  5939. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  5940. }
  5941. });
  5942. }
  5943. }
  5944. exports.ColorSpace = ColorSpace;
  5945. class AlternateCS extends ColorSpace {
  5946. constructor(numComps, base, tintFn) {
  5947. super("Alternate", numComps);
  5948. this.base = base;
  5949. this.tintFn = tintFn;
  5950. this.tmpBuf = new Float32Array(base.numComps);
  5951. }
  5952. getRgbItem(src, srcOffset, dest, destOffset) {
  5953. const tmpBuf = this.tmpBuf;
  5954. this.tintFn(src, srcOffset, tmpBuf, 0);
  5955. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  5956. }
  5957. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  5958. const tintFn = this.tintFn;
  5959. const base = this.base;
  5960. const scale = 1 / ((1 << bits) - 1);
  5961. const baseNumComps = base.numComps;
  5962. const usesZeroToOneRange = base.usesZeroToOneRange;
  5963. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  5964. let pos = isPassthrough ? destOffset : 0;
  5965. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  5966. const numComps = this.numComps;
  5967. const scaled = new Float32Array(numComps);
  5968. const tinted = new Float32Array(baseNumComps);
  5969. let i, j;
  5970. for (i = 0; i < count; i++) {
  5971. for (j = 0; j < numComps; j++) {
  5972. scaled[j] = src[srcOffset++] * scale;
  5973. }
  5974. tintFn(scaled, 0, tinted, 0);
  5975. if (usesZeroToOneRange) {
  5976. for (j = 0; j < baseNumComps; j++) {
  5977. baseBuf[pos++] = tinted[j] * 255;
  5978. }
  5979. } else {
  5980. base.getRgbItem(tinted, 0, baseBuf, pos);
  5981. pos += baseNumComps;
  5982. }
  5983. }
  5984. if (!isPassthrough) {
  5985. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  5986. }
  5987. }
  5988. getOutputLength(inputLength, alpha01) {
  5989. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  5990. }
  5991. }
  5992. class PatternCS extends ColorSpace {
  5993. constructor(baseCS) {
  5994. super("Pattern", null);
  5995. this.base = baseCS;
  5996. }
  5997. isDefaultDecode(decodeMap, bpc) {
  5998. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  5999. }
  6000. }
  6001. class IndexedCS extends ColorSpace {
  6002. constructor(base, highVal, lookup) {
  6003. super("Indexed", 1);
  6004. this.base = base;
  6005. this.highVal = highVal;
  6006. const length = base.numComps * highVal;
  6007. this.lookup = new Uint8Array(length);
  6008. if ((0, _primitives.isStream)(lookup)) {
  6009. const bytes = lookup.getBytes(length);
  6010. this.lookup.set(bytes);
  6011. } else if (typeof lookup === "string") {
  6012. for (let i = 0; i < length; ++i) {
  6013. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  6014. }
  6015. } else {
  6016. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  6017. }
  6018. }
  6019. getRgbItem(src, srcOffset, dest, destOffset) {
  6020. const numComps = this.base.numComps;
  6021. const start = src[srcOffset] * numComps;
  6022. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  6023. }
  6024. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6025. const base = this.base;
  6026. const numComps = base.numComps;
  6027. const outputDelta = base.getOutputLength(numComps, alpha01);
  6028. const lookup = this.lookup;
  6029. for (let i = 0; i < count; ++i) {
  6030. const lookupPos = src[srcOffset++] * numComps;
  6031. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  6032. destOffset += outputDelta;
  6033. }
  6034. }
  6035. getOutputLength(inputLength, alpha01) {
  6036. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  6037. }
  6038. isDefaultDecode(decodeMap, bpc) {
  6039. if (!Array.isArray(decodeMap)) {
  6040. return true;
  6041. }
  6042. if (decodeMap.length !== 2) {
  6043. (0, _util.warn)("Decode map length is not correct");
  6044. return true;
  6045. }
  6046. if (!Number.isInteger(bpc) || bpc < 1) {
  6047. (0, _util.warn)("Bits per component is not correct");
  6048. return true;
  6049. }
  6050. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  6051. }
  6052. }
  6053. class DeviceGrayCS extends ColorSpace {
  6054. constructor() {
  6055. super("DeviceGray", 1);
  6056. }
  6057. getRgbItem(src, srcOffset, dest, destOffset) {
  6058. const c = src[srcOffset] * 255;
  6059. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  6060. }
  6061. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6062. const scale = 255 / ((1 << bits) - 1);
  6063. let j = srcOffset,
  6064. q = destOffset;
  6065. for (let i = 0; i < count; ++i) {
  6066. const c = scale * src[j++];
  6067. dest[q++] = c;
  6068. dest[q++] = c;
  6069. dest[q++] = c;
  6070. q += alpha01;
  6071. }
  6072. }
  6073. getOutputLength(inputLength, alpha01) {
  6074. return inputLength * (3 + alpha01);
  6075. }
  6076. }
  6077. class DeviceRgbCS extends ColorSpace {
  6078. constructor() {
  6079. super("DeviceRGB", 3);
  6080. }
  6081. getRgbItem(src, srcOffset, dest, destOffset) {
  6082. dest[destOffset] = src[srcOffset] * 255;
  6083. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  6084. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  6085. }
  6086. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6087. if (bits === 8 && alpha01 === 0) {
  6088. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  6089. return;
  6090. }
  6091. const scale = 255 / ((1 << bits) - 1);
  6092. let j = srcOffset,
  6093. q = destOffset;
  6094. for (let i = 0; i < count; ++i) {
  6095. dest[q++] = scale * src[j++];
  6096. dest[q++] = scale * src[j++];
  6097. dest[q++] = scale * src[j++];
  6098. q += alpha01;
  6099. }
  6100. }
  6101. getOutputLength(inputLength, alpha01) {
  6102. return inputLength * (3 + alpha01) / 3 | 0;
  6103. }
  6104. isPassthrough(bits) {
  6105. return bits === 8;
  6106. }
  6107. }
  6108. const DeviceCmykCS = function DeviceCmykCSClosure() {
  6109. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  6110. const c = src[srcOffset] * srcScale;
  6111. const m = src[srcOffset + 1] * srcScale;
  6112. const y = src[srcOffset + 2] * srcScale;
  6113. const k = src[srcOffset + 3] * srcScale;
  6114. 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);
  6115. 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);
  6116. 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);
  6117. }
  6118. class DeviceCmykCS extends ColorSpace {
  6119. constructor() {
  6120. super("DeviceCMYK", 4);
  6121. }
  6122. getRgbItem(src, srcOffset, dest, destOffset) {
  6123. convertToRgb(src, srcOffset, 1, dest, destOffset);
  6124. }
  6125. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6126. const scale = 1 / ((1 << bits) - 1);
  6127. for (let i = 0; i < count; i++) {
  6128. convertToRgb(src, srcOffset, scale, dest, destOffset);
  6129. srcOffset += 4;
  6130. destOffset += 3 + alpha01;
  6131. }
  6132. }
  6133. getOutputLength(inputLength, alpha01) {
  6134. return inputLength / 4 * (3 + alpha01) | 0;
  6135. }
  6136. }
  6137. return DeviceCmykCS;
  6138. }();
  6139. const CalGrayCS = function CalGrayCSClosure() {
  6140. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  6141. const A = src[srcOffset] * scale;
  6142. const AG = A ** cs.G;
  6143. const L = cs.YW * AG;
  6144. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  6145. dest[destOffset] = val;
  6146. dest[destOffset + 1] = val;
  6147. dest[destOffset + 2] = val;
  6148. }
  6149. class CalGrayCS extends ColorSpace {
  6150. constructor(whitePoint, blackPoint, gamma) {
  6151. super("CalGray", 1);
  6152. if (!whitePoint) {
  6153. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  6154. }
  6155. blackPoint = blackPoint || [0, 0, 0];
  6156. gamma = gamma || 1;
  6157. this.XW = whitePoint[0];
  6158. this.YW = whitePoint[1];
  6159. this.ZW = whitePoint[2];
  6160. this.XB = blackPoint[0];
  6161. this.YB = blackPoint[1];
  6162. this.ZB = blackPoint[2];
  6163. this.G = gamma;
  6164. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  6165. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  6166. }
  6167. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  6168. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  6169. this.XB = this.YB = this.ZB = 0;
  6170. }
  6171. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  6172. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  6173. }
  6174. if (this.G < 1) {
  6175. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  6176. this.G = 1;
  6177. }
  6178. }
  6179. getRgbItem(src, srcOffset, dest, destOffset) {
  6180. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  6181. }
  6182. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6183. const scale = 1 / ((1 << bits) - 1);
  6184. for (let i = 0; i < count; ++i) {
  6185. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  6186. srcOffset += 1;
  6187. destOffset += 3 + alpha01;
  6188. }
  6189. }
  6190. getOutputLength(inputLength, alpha01) {
  6191. return inputLength * (3 + alpha01);
  6192. }
  6193. }
  6194. return CalGrayCS;
  6195. }();
  6196. const CalRGBCS = function CalRGBCSClosure() {
  6197. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  6198. 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]);
  6199. 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]);
  6200. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  6201. const tempNormalizeMatrix = new Float32Array(3);
  6202. const tempConvertMatrix1 = new Float32Array(3);
  6203. const tempConvertMatrix2 = new Float32Array(3);
  6204. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  6205. function matrixProduct(a, b, result) {
  6206. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  6207. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  6208. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  6209. }
  6210. function convertToFlat(sourceWhitePoint, LMS, result) {
  6211. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  6212. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  6213. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  6214. }
  6215. function convertToD65(sourceWhitePoint, LMS, result) {
  6216. const D65X = 0.95047;
  6217. const D65Y = 1;
  6218. const D65Z = 1.08883;
  6219. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  6220. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  6221. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  6222. }
  6223. function sRGBTransferFunction(color) {
  6224. if (color <= 0.0031308) {
  6225. return adjustToRange(0, 1, 12.92 * color);
  6226. }
  6227. if (color >= 0.99554525) {
  6228. return 1;
  6229. }
  6230. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  6231. }
  6232. function adjustToRange(min, max, value) {
  6233. return Math.max(min, Math.min(max, value));
  6234. }
  6235. function decodeL(L) {
  6236. if (L < 0) {
  6237. return -decodeL(-L);
  6238. }
  6239. if (L > 8.0) {
  6240. return ((L + 16) / 116) ** 3;
  6241. }
  6242. return L * DECODE_L_CONSTANT;
  6243. }
  6244. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  6245. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  6246. result[0] = XYZ_Flat[0];
  6247. result[1] = XYZ_Flat[1];
  6248. result[2] = XYZ_Flat[2];
  6249. return;
  6250. }
  6251. const zeroDecodeL = decodeL(0);
  6252. const X_DST = zeroDecodeL;
  6253. const X_SRC = decodeL(sourceBlackPoint[0]);
  6254. const Y_DST = zeroDecodeL;
  6255. const Y_SRC = decodeL(sourceBlackPoint[1]);
  6256. const Z_DST = zeroDecodeL;
  6257. const Z_SRC = decodeL(sourceBlackPoint[2]);
  6258. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  6259. const X_Offset = 1 - X_Scale;
  6260. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  6261. const Y_Offset = 1 - Y_Scale;
  6262. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  6263. const Z_Offset = 1 - Z_Scale;
  6264. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  6265. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  6266. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  6267. }
  6268. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  6269. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  6270. result[0] = XYZ_In[0];
  6271. result[1] = XYZ_In[1];
  6272. result[2] = XYZ_In[2];
  6273. return;
  6274. }
  6275. const LMS = result;
  6276. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  6277. const LMS_Flat = tempNormalizeMatrix;
  6278. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  6279. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  6280. }
  6281. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  6282. const LMS = result;
  6283. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  6284. const LMS_D65 = tempNormalizeMatrix;
  6285. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  6286. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  6287. }
  6288. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  6289. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  6290. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  6291. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  6292. const AGR = A === 1 ? 1 : A ** cs.GR;
  6293. const BGG = B === 1 ? 1 : B ** cs.GG;
  6294. const CGB = C === 1 ? 1 : C ** cs.GB;
  6295. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  6296. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  6297. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  6298. const XYZ = tempConvertMatrix1;
  6299. XYZ[0] = X;
  6300. XYZ[1] = Y;
  6301. XYZ[2] = Z;
  6302. const XYZ_Flat = tempConvertMatrix2;
  6303. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  6304. const XYZ_Black = tempConvertMatrix1;
  6305. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  6306. const XYZ_D65 = tempConvertMatrix2;
  6307. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  6308. const SRGB = tempConvertMatrix1;
  6309. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  6310. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  6311. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  6312. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  6313. }
  6314. class CalRGBCS extends ColorSpace {
  6315. constructor(whitePoint, blackPoint, gamma, matrix) {
  6316. super("CalRGB", 3);
  6317. if (!whitePoint) {
  6318. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  6319. }
  6320. blackPoint = blackPoint || new Float32Array(3);
  6321. gamma = gamma || new Float32Array([1, 1, 1]);
  6322. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  6323. const XW = whitePoint[0];
  6324. const YW = whitePoint[1];
  6325. const ZW = whitePoint[2];
  6326. this.whitePoint = whitePoint;
  6327. const XB = blackPoint[0];
  6328. const YB = blackPoint[1];
  6329. const ZB = blackPoint[2];
  6330. this.blackPoint = blackPoint;
  6331. this.GR = gamma[0];
  6332. this.GG = gamma[1];
  6333. this.GB = gamma[2];
  6334. this.MXA = matrix[0];
  6335. this.MYA = matrix[1];
  6336. this.MZA = matrix[2];
  6337. this.MXB = matrix[3];
  6338. this.MYB = matrix[4];
  6339. this.MZB = matrix[5];
  6340. this.MXC = matrix[6];
  6341. this.MYC = matrix[7];
  6342. this.MZC = matrix[8];
  6343. if (XW < 0 || ZW < 0 || YW !== 1) {
  6344. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  6345. }
  6346. if (XB < 0 || YB < 0 || ZB < 0) {
  6347. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  6348. this.blackPoint = new Float32Array(3);
  6349. }
  6350. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  6351. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  6352. this.GR = this.GG = this.GB = 1;
  6353. }
  6354. }
  6355. getRgbItem(src, srcOffset, dest, destOffset) {
  6356. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  6357. }
  6358. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6359. const scale = 1 / ((1 << bits) - 1);
  6360. for (let i = 0; i < count; ++i) {
  6361. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  6362. srcOffset += 3;
  6363. destOffset += 3 + alpha01;
  6364. }
  6365. }
  6366. getOutputLength(inputLength, alpha01) {
  6367. return inputLength * (3 + alpha01) / 3 | 0;
  6368. }
  6369. }
  6370. return CalRGBCS;
  6371. }();
  6372. const LabCS = function LabCSClosure() {
  6373. function fn_g(x) {
  6374. let result;
  6375. if (x >= 6 / 29) {
  6376. result = x ** 3;
  6377. } else {
  6378. result = 108 / 841 * (x - 4 / 29);
  6379. }
  6380. return result;
  6381. }
  6382. function decode(value, high1, low2, high2) {
  6383. return low2 + value * (high2 - low2) / high1;
  6384. }
  6385. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  6386. let Ls = src[srcOffset];
  6387. let as = src[srcOffset + 1];
  6388. let bs = src[srcOffset + 2];
  6389. if (maxVal !== false) {
  6390. Ls = decode(Ls, maxVal, 0, 100);
  6391. as = decode(as, maxVal, cs.amin, cs.amax);
  6392. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  6393. }
  6394. if (as > cs.amax) {
  6395. as = cs.amax;
  6396. } else if (as < cs.amin) {
  6397. as = cs.amin;
  6398. }
  6399. if (bs > cs.bmax) {
  6400. bs = cs.bmax;
  6401. } else if (bs < cs.bmin) {
  6402. bs = cs.bmin;
  6403. }
  6404. const M = (Ls + 16) / 116;
  6405. const L = M + as / 500;
  6406. const N = M - bs / 200;
  6407. const X = cs.XW * fn_g(L);
  6408. const Y = cs.YW * fn_g(M);
  6409. const Z = cs.ZW * fn_g(N);
  6410. let r, g, b;
  6411. if (cs.ZW < 1) {
  6412. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  6413. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  6414. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  6415. } else {
  6416. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  6417. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  6418. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  6419. }
  6420. dest[destOffset] = Math.sqrt(r) * 255;
  6421. dest[destOffset + 1] = Math.sqrt(g) * 255;
  6422. dest[destOffset + 2] = Math.sqrt(b) * 255;
  6423. }
  6424. class LabCS extends ColorSpace {
  6425. constructor(whitePoint, blackPoint, range) {
  6426. super("Lab", 3);
  6427. if (!whitePoint) {
  6428. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  6429. }
  6430. blackPoint = blackPoint || [0, 0, 0];
  6431. range = range || [-100, 100, -100, 100];
  6432. this.XW = whitePoint[0];
  6433. this.YW = whitePoint[1];
  6434. this.ZW = whitePoint[2];
  6435. this.amin = range[0];
  6436. this.amax = range[1];
  6437. this.bmin = range[2];
  6438. this.bmax = range[3];
  6439. this.XB = blackPoint[0];
  6440. this.YB = blackPoint[1];
  6441. this.ZB = blackPoint[2];
  6442. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  6443. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  6444. }
  6445. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  6446. (0, _util.info)("Invalid BlackPoint, falling back to default");
  6447. this.XB = this.YB = this.ZB = 0;
  6448. }
  6449. if (this.amin > this.amax || this.bmin > this.bmax) {
  6450. (0, _util.info)("Invalid Range, falling back to defaults");
  6451. this.amin = -100;
  6452. this.amax = 100;
  6453. this.bmin = -100;
  6454. this.bmax = 100;
  6455. }
  6456. }
  6457. getRgbItem(src, srcOffset, dest, destOffset) {
  6458. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  6459. }
  6460. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  6461. const maxVal = (1 << bits) - 1;
  6462. for (let i = 0; i < count; i++) {
  6463. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  6464. srcOffset += 3;
  6465. destOffset += 3 + alpha01;
  6466. }
  6467. }
  6468. getOutputLength(inputLength, alpha01) {
  6469. return inputLength * (3 + alpha01) / 3 | 0;
  6470. }
  6471. isDefaultDecode(decodeMap, bpc) {
  6472. return true;
  6473. }
  6474. get usesZeroToOneRange() {
  6475. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  6476. }
  6477. }
  6478. return LabCS;
  6479. }();
  6480. /***/ }),
  6481. /* 15 */
  6482. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6483. Object.defineProperty(exports, "__esModule", ({
  6484. value: true
  6485. }));
  6486. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  6487. var _util = __w_pdfjs_require__(2);
  6488. var _cmap = __w_pdfjs_require__(16);
  6489. var _primitives = __w_pdfjs_require__(5);
  6490. var _fonts = __w_pdfjs_require__(34);
  6491. var _fonts_utils = __w_pdfjs_require__(38);
  6492. var _encodings = __w_pdfjs_require__(37);
  6493. var _unicode = __w_pdfjs_require__(40);
  6494. var _standard_fonts = __w_pdfjs_require__(41);
  6495. var _pattern = __w_pdfjs_require__(48);
  6496. var _to_unicode_map = __w_pdfjs_require__(42);
  6497. var _function = __w_pdfjs_require__(49);
  6498. var _parser = __w_pdfjs_require__(17);
  6499. var _image_utils = __w_pdfjs_require__(51);
  6500. var _bidi = __w_pdfjs_require__(52);
  6501. var _colorspace = __w_pdfjs_require__(14);
  6502. var _decode_stream = __w_pdfjs_require__(19);
  6503. var _glyphlist = __w_pdfjs_require__(39);
  6504. var _core_utils = __w_pdfjs_require__(9);
  6505. var _metrics = __w_pdfjs_require__(53);
  6506. var _murmurhash = __w_pdfjs_require__(54);
  6507. var _stream = __w_pdfjs_require__(10);
  6508. var _operator_list = __w_pdfjs_require__(55);
  6509. var _image = __w_pdfjs_require__(56);
  6510. const DefaultPartialEvaluatorOptions = Object.freeze({
  6511. maxImageSize: -1,
  6512. disableFontFace: false,
  6513. ignoreErrors: false,
  6514. isEvalSupported: true,
  6515. fontExtraProperties: false
  6516. });
  6517. const PatternType = {
  6518. TILING: 1,
  6519. SHADING: 2
  6520. };
  6521. const deferred = Promise.resolve();
  6522. function normalizeBlendMode(value, parsingArray = false) {
  6523. if (Array.isArray(value)) {
  6524. for (let i = 0, ii = value.length; i < ii; i++) {
  6525. const maybeBM = normalizeBlendMode(value[i], true);
  6526. if (maybeBM) {
  6527. return maybeBM;
  6528. }
  6529. }
  6530. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  6531. return "source-over";
  6532. }
  6533. if (!(0, _primitives.isName)(value)) {
  6534. if (parsingArray) {
  6535. return null;
  6536. }
  6537. return "source-over";
  6538. }
  6539. switch (value.name) {
  6540. case "Normal":
  6541. case "Compatible":
  6542. return "source-over";
  6543. case "Multiply":
  6544. return "multiply";
  6545. case "Screen":
  6546. return "screen";
  6547. case "Overlay":
  6548. return "overlay";
  6549. case "Darken":
  6550. return "darken";
  6551. case "Lighten":
  6552. return "lighten";
  6553. case "ColorDodge":
  6554. return "color-dodge";
  6555. case "ColorBurn":
  6556. return "color-burn";
  6557. case "HardLight":
  6558. return "hard-light";
  6559. case "SoftLight":
  6560. return "soft-light";
  6561. case "Difference":
  6562. return "difference";
  6563. case "Exclusion":
  6564. return "exclusion";
  6565. case "Hue":
  6566. return "hue";
  6567. case "Saturation":
  6568. return "saturation";
  6569. case "Color":
  6570. return "color";
  6571. case "Luminosity":
  6572. return "luminosity";
  6573. }
  6574. if (parsingArray) {
  6575. return null;
  6576. }
  6577. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  6578. return "source-over";
  6579. }
  6580. class TimeSlotManager {
  6581. static get TIME_SLOT_DURATION_MS() {
  6582. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  6583. }
  6584. static get CHECK_TIME_EVERY() {
  6585. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  6586. }
  6587. constructor() {
  6588. this.reset();
  6589. }
  6590. check() {
  6591. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  6592. return false;
  6593. }
  6594. this.checked = 0;
  6595. return this.endTime <= Date.now();
  6596. }
  6597. reset() {
  6598. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  6599. this.checked = 0;
  6600. }
  6601. }
  6602. class PartialEvaluator {
  6603. constructor({
  6604. xref,
  6605. handler,
  6606. pageIndex,
  6607. idFactory,
  6608. fontCache,
  6609. builtInCMapCache,
  6610. globalImageCache,
  6611. options = null
  6612. }) {
  6613. this.xref = xref;
  6614. this.handler = handler;
  6615. this.pageIndex = pageIndex;
  6616. this.idFactory = idFactory;
  6617. this.fontCache = fontCache;
  6618. this.builtInCMapCache = builtInCMapCache;
  6619. this.globalImageCache = globalImageCache;
  6620. this.options = options || DefaultPartialEvaluatorOptions;
  6621. this.parsingType3Font = false;
  6622. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  6623. }
  6624. get _pdfFunctionFactory() {
  6625. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  6626. xref: this.xref,
  6627. isEvalSupported: this.options.isEvalSupported
  6628. });
  6629. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  6630. }
  6631. clone(newOptions = DefaultPartialEvaluatorOptions) {
  6632. const newEvaluator = Object.create(this);
  6633. newEvaluator.options = newOptions;
  6634. return newEvaluator;
  6635. }
  6636. hasBlendModes(resources, nonBlendModesSet) {
  6637. if (!(resources instanceof _primitives.Dict)) {
  6638. return false;
  6639. }
  6640. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  6641. return false;
  6642. }
  6643. const processed = new _primitives.RefSet(nonBlendModesSet);
  6644. if (resources.objId) {
  6645. processed.put(resources.objId);
  6646. }
  6647. const nodes = [resources],
  6648. xref = this.xref;
  6649. while (nodes.length) {
  6650. const node = nodes.shift();
  6651. const graphicStates = node.get("ExtGState");
  6652. if (graphicStates instanceof _primitives.Dict) {
  6653. for (let graphicState of graphicStates.getRawValues()) {
  6654. if (graphicState instanceof _primitives.Ref) {
  6655. if (processed.has(graphicState)) {
  6656. continue;
  6657. }
  6658. try {
  6659. graphicState = xref.fetch(graphicState);
  6660. } catch (ex) {
  6661. processed.put(graphicState);
  6662. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  6663. continue;
  6664. }
  6665. }
  6666. if (!(graphicState instanceof _primitives.Dict)) {
  6667. continue;
  6668. }
  6669. if (graphicState.objId) {
  6670. processed.put(graphicState.objId);
  6671. }
  6672. const bm = graphicState.get("BM");
  6673. if (bm instanceof _primitives.Name) {
  6674. if (bm.name !== "Normal") {
  6675. return true;
  6676. }
  6677. continue;
  6678. }
  6679. if (bm !== undefined && Array.isArray(bm)) {
  6680. for (const element of bm) {
  6681. if (element instanceof _primitives.Name && element.name !== "Normal") {
  6682. return true;
  6683. }
  6684. }
  6685. }
  6686. }
  6687. }
  6688. const xObjects = node.get("XObject");
  6689. if (!(xObjects instanceof _primitives.Dict)) {
  6690. continue;
  6691. }
  6692. for (let xObject of xObjects.getRawValues()) {
  6693. if (xObject instanceof _primitives.Ref) {
  6694. if (processed.has(xObject)) {
  6695. continue;
  6696. }
  6697. try {
  6698. xObject = xref.fetch(xObject);
  6699. } catch (ex) {
  6700. processed.put(xObject);
  6701. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  6702. continue;
  6703. }
  6704. }
  6705. if (!(0, _primitives.isStream)(xObject)) {
  6706. continue;
  6707. }
  6708. if (xObject.dict.objId) {
  6709. processed.put(xObject.dict.objId);
  6710. }
  6711. const xResources = xObject.dict.get("Resources");
  6712. if (!(xResources instanceof _primitives.Dict)) {
  6713. continue;
  6714. }
  6715. if (xResources.objId && processed.has(xResources.objId)) {
  6716. continue;
  6717. }
  6718. nodes.push(xResources);
  6719. if (xResources.objId) {
  6720. processed.put(xResources.objId);
  6721. }
  6722. }
  6723. }
  6724. processed.forEach(ref => {
  6725. nonBlendModesSet.put(ref);
  6726. });
  6727. return false;
  6728. }
  6729. async fetchBuiltInCMap(name) {
  6730. const cachedData = this.builtInCMapCache.get(name);
  6731. if (cachedData) {
  6732. return cachedData;
  6733. }
  6734. const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", {
  6735. name
  6736. });
  6737. const reader = readableStream.getReader();
  6738. const data = await new Promise(function (resolve, reject) {
  6739. function pump() {
  6740. reader.read().then(function ({
  6741. value,
  6742. done
  6743. }) {
  6744. if (done) {
  6745. return;
  6746. }
  6747. resolve(value);
  6748. pump();
  6749. }, reject);
  6750. }
  6751. pump();
  6752. });
  6753. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  6754. this.builtInCMapCache.set(name, data);
  6755. }
  6756. return data;
  6757. }
  6758. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  6759. const dict = xobj.dict;
  6760. const matrix = dict.getArray("Matrix");
  6761. let bbox = dict.getArray("BBox");
  6762. if (Array.isArray(bbox) && bbox.length === 4) {
  6763. bbox = _util.Util.normalizeRect(bbox);
  6764. } else {
  6765. bbox = null;
  6766. }
  6767. let optionalContent = null,
  6768. groupOptions;
  6769. if (dict.has("OC")) {
  6770. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  6771. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  6772. }
  6773. const group = dict.get("Group");
  6774. if (group) {
  6775. groupOptions = {
  6776. matrix,
  6777. bbox,
  6778. smask,
  6779. isolated: false,
  6780. knockout: false
  6781. };
  6782. const groupSubtype = group.get("S");
  6783. let colorSpace = null;
  6784. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  6785. groupOptions.isolated = group.get("I") || false;
  6786. groupOptions.knockout = group.get("K") || false;
  6787. if (group.has("CS")) {
  6788. const cs = group.getRaw("CS");
  6789. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  6790. if (cachedColorSpace) {
  6791. colorSpace = cachedColorSpace;
  6792. } else {
  6793. colorSpace = await this.parseColorSpace({
  6794. cs,
  6795. resources,
  6796. localColorSpaceCache
  6797. });
  6798. }
  6799. }
  6800. }
  6801. if (smask && smask.backdrop) {
  6802. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  6803. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  6804. }
  6805. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  6806. }
  6807. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  6808. return this.getOperatorList({
  6809. stream: xobj,
  6810. task,
  6811. resources: dict.get("Resources") || resources,
  6812. operatorList,
  6813. initialState
  6814. }).then(function () {
  6815. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  6816. if (group) {
  6817. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  6818. }
  6819. if (optionalContent) {
  6820. operatorList.addOp(_util.OPS.endMarkedContent, []);
  6821. }
  6822. });
  6823. }
  6824. _sendImgData(objId, imgData, cacheGlobally = false) {
  6825. const transfers = imgData ? [imgData.data.buffer] : null;
  6826. if (this.parsingType3Font || cacheGlobally) {
  6827. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  6828. }
  6829. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  6830. }
  6831. async buildPaintImageXObject({
  6832. resources,
  6833. image,
  6834. isInline = false,
  6835. operatorList,
  6836. cacheKey,
  6837. localImageCache,
  6838. localColorSpaceCache
  6839. }) {
  6840. const dict = image.dict;
  6841. const imageRef = dict.objId;
  6842. const w = dict.get("Width", "W");
  6843. const h = dict.get("Height", "H");
  6844. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  6845. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  6846. return undefined;
  6847. }
  6848. const maxImageSize = this.options.maxImageSize;
  6849. if (maxImageSize !== -1 && w * h > maxImageSize) {
  6850. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  6851. return undefined;
  6852. }
  6853. const imageMask = dict.get("ImageMask", "IM") || false;
  6854. let imgData, args;
  6855. if (imageMask) {
  6856. const width = dict.get("Width", "W");
  6857. const height = dict.get("Height", "H");
  6858. const bitStrideLength = width + 7 >> 3;
  6859. const imgArray = image.getBytes(bitStrideLength * height, true);
  6860. const decode = dict.getArray("Decode", "D");
  6861. imgData = _image.PDFImage.createMask({
  6862. imgArray,
  6863. width,
  6864. height,
  6865. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  6866. inverseDecode: !!decode && decode[0] > 0
  6867. });
  6868. imgData.cached = !!cacheKey;
  6869. args = [imgData];
  6870. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  6871. if (cacheKey) {
  6872. localImageCache.set(cacheKey, imageRef, {
  6873. fn: _util.OPS.paintImageMaskXObject,
  6874. args
  6875. });
  6876. }
  6877. return undefined;
  6878. }
  6879. const softMask = dict.get("SMask", "SM") || false;
  6880. const mask = dict.get("Mask") || false;
  6881. const SMALL_IMAGE_DIMENSIONS = 200;
  6882. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  6883. const imageObj = new _image.PDFImage({
  6884. xref: this.xref,
  6885. res: resources,
  6886. image,
  6887. isInline,
  6888. pdfFunctionFactory: this._pdfFunctionFactory,
  6889. localColorSpaceCache
  6890. });
  6891. imgData = imageObj.createImageData(true);
  6892. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  6893. return undefined;
  6894. }
  6895. let objId = `img_${this.idFactory.createObjId()}`,
  6896. cacheGlobally = false;
  6897. if (this.parsingType3Font) {
  6898. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  6899. } else if (imageRef) {
  6900. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  6901. if (cacheGlobally) {
  6902. objId = `${this.idFactory.getDocId()}_${objId}`;
  6903. }
  6904. }
  6905. operatorList.addDependency(objId);
  6906. args = [objId, w, h];
  6907. _image.PDFImage.buildImage({
  6908. xref: this.xref,
  6909. res: resources,
  6910. image,
  6911. isInline,
  6912. pdfFunctionFactory: this._pdfFunctionFactory,
  6913. localColorSpaceCache
  6914. }).then(imageObj => {
  6915. imgData = imageObj.createImageData(false);
  6916. if (cacheKey && imageRef && cacheGlobally) {
  6917. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  6918. }
  6919. return this._sendImgData(objId, imgData, cacheGlobally);
  6920. }).catch(reason => {
  6921. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  6922. return this._sendImgData(objId, null, cacheGlobally);
  6923. });
  6924. operatorList.addOp(_util.OPS.paintImageXObject, args);
  6925. if (cacheKey) {
  6926. localImageCache.set(cacheKey, imageRef, {
  6927. fn: _util.OPS.paintImageXObject,
  6928. args
  6929. });
  6930. if (imageRef) {
  6931. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  6932. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  6933. if (cacheGlobally) {
  6934. this.globalImageCache.setData(imageRef, {
  6935. objId,
  6936. fn: _util.OPS.paintImageXObject,
  6937. args,
  6938. byteSize: 0
  6939. });
  6940. }
  6941. }
  6942. }
  6943. return undefined;
  6944. }
  6945. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  6946. const smaskContent = smask.get("G");
  6947. const smaskOptions = {
  6948. subtype: smask.get("S").name,
  6949. backdrop: smask.get("BC")
  6950. };
  6951. const transferObj = smask.get("TR");
  6952. if ((0, _function.isPDFFunction)(transferObj)) {
  6953. const transferFn = this._pdfFunctionFactory.create(transferObj);
  6954. const transferMap = new Uint8Array(256);
  6955. const tmp = new Float32Array(1);
  6956. for (let i = 0; i < 256; i++) {
  6957. tmp[0] = i / 255;
  6958. transferFn(tmp, 0, tmp, 0);
  6959. transferMap[i] = tmp[0] * 255 | 0;
  6960. }
  6961. smaskOptions.transferMap = transferMap;
  6962. }
  6963. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  6964. }
  6965. handleTransferFunction(tr) {
  6966. let transferArray;
  6967. if (Array.isArray(tr)) {
  6968. transferArray = tr;
  6969. } else if ((0, _function.isPDFFunction)(tr)) {
  6970. transferArray = [tr];
  6971. } else {
  6972. return null;
  6973. }
  6974. const transferMaps = [];
  6975. let numFns = 0,
  6976. numEffectfulFns = 0;
  6977. for (const entry of transferArray) {
  6978. const transferObj = this.xref.fetchIfRef(entry);
  6979. numFns++;
  6980. if ((0, _primitives.isName)(transferObj, "Identity")) {
  6981. transferMaps.push(null);
  6982. continue;
  6983. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  6984. return null;
  6985. }
  6986. const transferFn = this._pdfFunctionFactory.create(transferObj);
  6987. const transferMap = new Uint8Array(256),
  6988. tmp = new Float32Array(1);
  6989. for (let j = 0; j < 256; j++) {
  6990. tmp[0] = j / 255;
  6991. transferFn(tmp, 0, tmp, 0);
  6992. transferMap[j] = tmp[0] * 255 | 0;
  6993. }
  6994. transferMaps.push(transferMap);
  6995. numEffectfulFns++;
  6996. }
  6997. if (!(numFns === 1 || numFns === 4)) {
  6998. return null;
  6999. }
  7000. if (numEffectfulFns === 0) {
  7001. return null;
  7002. }
  7003. return transferMaps;
  7004. }
  7005. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, cacheKey, localTilingPatternCache) {
  7006. const tilingOpList = new _operator_list.OperatorList();
  7007. const patternResources = _primitives.Dict.merge({
  7008. xref: this.xref,
  7009. dictArray: [patternDict.get("Resources"), resources]
  7010. });
  7011. return this.getOperatorList({
  7012. stream: pattern,
  7013. task,
  7014. resources: patternResources,
  7015. operatorList: tilingOpList
  7016. }).then(function () {
  7017. const operatorListIR = tilingOpList.getIR();
  7018. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  7019. operatorList.addDependencies(tilingOpList.dependencies);
  7020. operatorList.addOp(fn, tilingPatternIR);
  7021. if (cacheKey) {
  7022. localTilingPatternCache.set(cacheKey, patternDict.objId, {
  7023. operatorListIR,
  7024. dict: patternDict
  7025. });
  7026. }
  7027. }).catch(reason => {
  7028. if (reason instanceof _util.AbortException) {
  7029. return;
  7030. }
  7031. if (this.options.ignoreErrors) {
  7032. this.handler.send("UnsupportedFeature", {
  7033. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  7034. });
  7035. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  7036. return;
  7037. }
  7038. throw reason;
  7039. });
  7040. }
  7041. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  7042. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  7043. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  7044. if (!translated.font.isType3Font) {
  7045. return translated;
  7046. }
  7047. return translated.loadType3Data(this, resources, task).then(function () {
  7048. operatorList.addDependencies(translated.type3Dependencies);
  7049. return translated;
  7050. }).catch(reason => {
  7051. this.handler.send("UnsupportedFeature", {
  7052. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  7053. });
  7054. return new TranslatedFont({
  7055. loadedName: "g_font_error",
  7056. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  7057. dict: translated.font,
  7058. evaluatorOptions: this.options
  7059. });
  7060. });
  7061. }).then(translated => {
  7062. state.font = translated.font;
  7063. translated.send(this.handler);
  7064. return translated.loadedName;
  7065. });
  7066. }
  7067. handleText(chars, state) {
  7068. const font = state.font;
  7069. const glyphs = font.charsToGlyphs(chars);
  7070. if (font.data) {
  7071. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  7072. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  7073. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  7074. }
  7075. }
  7076. return glyphs;
  7077. }
  7078. ensureStateFont(state) {
  7079. if (state.font) {
  7080. return;
  7081. }
  7082. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  7083. if (this.options.ignoreErrors) {
  7084. this.handler.send("UnsupportedFeature", {
  7085. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  7086. });
  7087. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  7088. return;
  7089. }
  7090. throw reason;
  7091. }
  7092. async setGState({
  7093. resources,
  7094. gState,
  7095. operatorList,
  7096. cacheKey,
  7097. task,
  7098. stateManager,
  7099. localGStateCache,
  7100. localColorSpaceCache
  7101. }) {
  7102. const gStateRef = gState.objId;
  7103. let isSimpleGState = true;
  7104. const gStateObj = [];
  7105. const gStateKeys = gState.getKeys();
  7106. let promise = Promise.resolve();
  7107. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  7108. const key = gStateKeys[i];
  7109. const value = gState.get(key);
  7110. switch (key) {
  7111. case "Type":
  7112. break;
  7113. case "LW":
  7114. case "LC":
  7115. case "LJ":
  7116. case "ML":
  7117. case "D":
  7118. case "RI":
  7119. case "FL":
  7120. case "CA":
  7121. case "ca":
  7122. gStateObj.push([key, value]);
  7123. break;
  7124. case "Font":
  7125. isSimpleGState = false;
  7126. promise = promise.then(() => {
  7127. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  7128. operatorList.addDependency(loadedName);
  7129. gStateObj.push([key, [loadedName, value[1]]]);
  7130. });
  7131. });
  7132. break;
  7133. case "BM":
  7134. gStateObj.push([key, normalizeBlendMode(value)]);
  7135. break;
  7136. case "SMask":
  7137. if ((0, _primitives.isName)(value, "None")) {
  7138. gStateObj.push([key, false]);
  7139. break;
  7140. }
  7141. if ((0, _primitives.isDict)(value)) {
  7142. isSimpleGState = false;
  7143. promise = promise.then(() => {
  7144. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  7145. });
  7146. gStateObj.push([key, true]);
  7147. } else {
  7148. (0, _util.warn)("Unsupported SMask type");
  7149. }
  7150. break;
  7151. case "TR":
  7152. const transferMaps = this.handleTransferFunction(value);
  7153. gStateObj.push([key, transferMaps]);
  7154. break;
  7155. case "OP":
  7156. case "op":
  7157. case "OPM":
  7158. case "BG":
  7159. case "BG2":
  7160. case "UCR":
  7161. case "UCR2":
  7162. case "TR2":
  7163. case "HT":
  7164. case "SM":
  7165. case "SA":
  7166. case "AIS":
  7167. case "TK":
  7168. (0, _util.info)("graphic state operator " + key);
  7169. break;
  7170. default:
  7171. (0, _util.info)("Unknown graphic state operator " + key);
  7172. break;
  7173. }
  7174. }
  7175. return promise.then(function () {
  7176. if (gStateObj.length > 0) {
  7177. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  7178. }
  7179. if (isSimpleGState) {
  7180. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  7181. }
  7182. });
  7183. }
  7184. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  7185. const errorFont = async () => {
  7186. return new TranslatedFont({
  7187. loadedName: "g_font_error",
  7188. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  7189. dict: font,
  7190. evaluatorOptions: this.options
  7191. });
  7192. };
  7193. const xref = this.xref;
  7194. let fontRef;
  7195. if (font) {
  7196. if (!(0, _primitives.isRef)(font)) {
  7197. throw new _util.FormatError('The "font" object should be a reference.');
  7198. }
  7199. fontRef = font;
  7200. } else {
  7201. const fontRes = resources.get("Font");
  7202. if (fontRes) {
  7203. fontRef = fontRes.getRaw(fontName);
  7204. }
  7205. }
  7206. if (!fontRef) {
  7207. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  7208. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  7209. (0, _util.warn)(`${partialMsg}.`);
  7210. return errorFont();
  7211. }
  7212. this.handler.send("UnsupportedFeature", {
  7213. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  7214. });
  7215. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  7216. if (fallbackFontDict) {
  7217. fontRef = fallbackFontDict;
  7218. } else {
  7219. fontRef = PartialEvaluator.fallbackFontDict;
  7220. }
  7221. }
  7222. if (this.fontCache.has(fontRef)) {
  7223. return this.fontCache.get(fontRef);
  7224. }
  7225. font = xref.fetchIfRef(fontRef);
  7226. if (!(0, _primitives.isDict)(font)) {
  7227. return errorFont();
  7228. }
  7229. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  7230. return this.fontCache.get(font.cacheKey);
  7231. }
  7232. const fontCapability = (0, _util.createPromiseCapability)();
  7233. let preEvaluatedFont;
  7234. try {
  7235. preEvaluatedFont = this.preEvaluateFont(font);
  7236. preEvaluatedFont.cssFontInfo = cssFontInfo;
  7237. } catch (reason) {
  7238. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  7239. return errorFont();
  7240. }
  7241. const {
  7242. descriptor,
  7243. hash
  7244. } = preEvaluatedFont;
  7245. const fontRefIsRef = (0, _primitives.isRef)(fontRef);
  7246. let fontID;
  7247. if (fontRefIsRef) {
  7248. fontID = `f${fontRef.toString()}`;
  7249. }
  7250. if (hash && (0, _primitives.isDict)(descriptor)) {
  7251. if (!descriptor.fontAliases) {
  7252. descriptor.fontAliases = Object.create(null);
  7253. }
  7254. const fontAliases = descriptor.fontAliases;
  7255. if (fontAliases[hash]) {
  7256. const aliasFontRef = fontAliases[hash].aliasRef;
  7257. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  7258. this.fontCache.putAlias(fontRef, aliasFontRef);
  7259. return this.fontCache.get(fontRef);
  7260. }
  7261. } else {
  7262. fontAliases[hash] = {
  7263. fontID: this.idFactory.createFontId()
  7264. };
  7265. }
  7266. if (fontRefIsRef) {
  7267. fontAliases[hash].aliasRef = fontRef;
  7268. }
  7269. fontID = fontAliases[hash].fontID;
  7270. }
  7271. if (fontRefIsRef) {
  7272. this.fontCache.put(fontRef, fontCapability.promise);
  7273. } else {
  7274. if (!fontID) {
  7275. fontID = this.idFactory.createFontId();
  7276. }
  7277. font.cacheKey = `cacheKey_${fontID}`;
  7278. this.fontCache.put(font.cacheKey, fontCapability.promise);
  7279. }
  7280. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  7281. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  7282. this.translateFont(preEvaluatedFont).then(translatedFont => {
  7283. if (translatedFont.fontType !== undefined) {
  7284. const xrefFontStats = xref.stats.fontTypes;
  7285. xrefFontStats[translatedFont.fontType] = true;
  7286. }
  7287. fontCapability.resolve(new TranslatedFont({
  7288. loadedName: font.loadedName,
  7289. font: translatedFont,
  7290. dict: font,
  7291. evaluatorOptions: this.options
  7292. }));
  7293. }).catch(reason => {
  7294. this.handler.send("UnsupportedFeature", {
  7295. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  7296. });
  7297. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  7298. try {
  7299. const fontFile3 = descriptor && descriptor.get("FontFile3");
  7300. const subtype = fontFile3 && fontFile3.get("Subtype");
  7301. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  7302. const xrefFontStats = xref.stats.fontTypes;
  7303. xrefFontStats[fontType] = true;
  7304. } catch (ex) {}
  7305. fontCapability.resolve(new TranslatedFont({
  7306. loadedName: font.loadedName,
  7307. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  7308. dict: font,
  7309. evaluatorOptions: this.options
  7310. }));
  7311. });
  7312. return fontCapability.promise;
  7313. }
  7314. buildPath(operatorList, fn, args, parsingText = false) {
  7315. const lastIndex = operatorList.length - 1;
  7316. if (!args) {
  7317. args = [];
  7318. }
  7319. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  7320. if (parsingText) {
  7321. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  7322. operatorList.addOp(_util.OPS.save, null);
  7323. }
  7324. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  7325. if (parsingText) {
  7326. operatorList.addOp(_util.OPS.restore, null);
  7327. }
  7328. } else {
  7329. const opArgs = operatorList.argsArray[lastIndex];
  7330. opArgs[0].push(fn);
  7331. Array.prototype.push.apply(opArgs[1], args);
  7332. }
  7333. }
  7334. parseColorSpace({
  7335. cs,
  7336. resources,
  7337. localColorSpaceCache
  7338. }) {
  7339. return _colorspace.ColorSpace.parseAsync({
  7340. cs,
  7341. xref: this.xref,
  7342. resources,
  7343. pdfFunctionFactory: this._pdfFunctionFactory,
  7344. localColorSpaceCache
  7345. }).catch(reason => {
  7346. if (reason instanceof _util.AbortException) {
  7347. return null;
  7348. }
  7349. if (this.options.ignoreErrors) {
  7350. this.handler.send("UnsupportedFeature", {
  7351. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  7352. });
  7353. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  7354. return null;
  7355. }
  7356. throw reason;
  7357. });
  7358. }
  7359. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache) {
  7360. const patternName = args.pop();
  7361. if (patternName instanceof _primitives.Name) {
  7362. const name = patternName.name;
  7363. const localTilingPattern = localTilingPatternCache.getByName(name);
  7364. if (localTilingPattern) {
  7365. try {
  7366. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  7367. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  7368. operatorList.addOp(fn, tilingPatternIR);
  7369. return undefined;
  7370. } catch (ex) {}
  7371. }
  7372. let pattern = patterns.get(name);
  7373. if (pattern) {
  7374. const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  7375. const typeNum = dict.get("PatternType");
  7376. if (typeNum === PatternType.TILING) {
  7377. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  7378. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, name, localTilingPatternCache);
  7379. } else if (typeNum === PatternType.SHADING) {
  7380. const shading = dict.get("Shading");
  7381. const matrix = dict.getArray("Matrix");
  7382. pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  7383. operatorList.addOp(fn, pattern.getIR());
  7384. return undefined;
  7385. }
  7386. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  7387. }
  7388. }
  7389. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  7390. }
  7391. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  7392. const MAX_NESTING = 10;
  7393. if (++nestingCounter > MAX_NESTING) {
  7394. (0, _util.warn)("Visibility expression is too deeply nested");
  7395. return;
  7396. }
  7397. const length = array.length;
  7398. const operator = this.xref.fetchIfRef(array[0]);
  7399. if (length < 2 || !(0, _primitives.isName)(operator)) {
  7400. (0, _util.warn)("Invalid visibility expression");
  7401. return;
  7402. }
  7403. switch (operator.name) {
  7404. case "And":
  7405. case "Or":
  7406. case "Not":
  7407. currentResult.push(operator.name);
  7408. break;
  7409. default:
  7410. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  7411. return;
  7412. }
  7413. for (let i = 1; i < length; i++) {
  7414. const raw = array[i];
  7415. const object = this.xref.fetchIfRef(raw);
  7416. if (Array.isArray(object)) {
  7417. const nestedResult = [];
  7418. currentResult.push(nestedResult);
  7419. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  7420. } else if ((0, _primitives.isRef)(raw)) {
  7421. currentResult.push(raw.toString());
  7422. }
  7423. }
  7424. }
  7425. async parseMarkedContentProps(contentProperties, resources) {
  7426. let optionalContent;
  7427. if ((0, _primitives.isName)(contentProperties)) {
  7428. const properties = resources.get("Properties");
  7429. optionalContent = properties.get(contentProperties.name);
  7430. } else if ((0, _primitives.isDict)(contentProperties)) {
  7431. optionalContent = contentProperties;
  7432. } else {
  7433. throw new _util.FormatError("Optional content properties malformed.");
  7434. }
  7435. const optionalContentType = optionalContent.get("Type").name;
  7436. if (optionalContentType === "OCG") {
  7437. return {
  7438. type: optionalContentType,
  7439. id: optionalContent.objId
  7440. };
  7441. } else if (optionalContentType === "OCMD") {
  7442. const expression = optionalContent.get("VE");
  7443. if (Array.isArray(expression)) {
  7444. const result = [];
  7445. this._parseVisibilityExpression(expression, 0, result);
  7446. if (result.length > 0) {
  7447. return {
  7448. type: "OCMD",
  7449. expression: result
  7450. };
  7451. }
  7452. }
  7453. const optionalContentGroups = optionalContent.get("OCGs");
  7454. if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) {
  7455. const groupIds = [];
  7456. if (Array.isArray(optionalContentGroups)) {
  7457. for (const ocg of optionalContentGroups) {
  7458. groupIds.push(ocg.toString());
  7459. }
  7460. } else {
  7461. groupIds.push(optionalContentGroups.objId);
  7462. }
  7463. return {
  7464. type: optionalContentType,
  7465. ids: groupIds,
  7466. policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null,
  7467. expression: null
  7468. };
  7469. } else if ((0, _primitives.isRef)(optionalContentGroups)) {
  7470. return {
  7471. type: optionalContentType,
  7472. id: optionalContentGroups.toString()
  7473. };
  7474. }
  7475. }
  7476. return null;
  7477. }
  7478. getOperatorList({
  7479. stream,
  7480. task,
  7481. resources,
  7482. operatorList,
  7483. initialState = null,
  7484. fallbackFontDict = null
  7485. }) {
  7486. resources = resources || _primitives.Dict.empty;
  7487. initialState = initialState || new EvalState();
  7488. if (!operatorList) {
  7489. throw new Error('getOperatorList: missing "operatorList" parameter');
  7490. }
  7491. const self = this;
  7492. const xref = this.xref;
  7493. let parsingText = false;
  7494. const localImageCache = new _image_utils.LocalImageCache();
  7495. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  7496. const localGStateCache = new _image_utils.LocalGStateCache();
  7497. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  7498. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  7499. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  7500. const stateManager = new StateManager(initialState);
  7501. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  7502. const timeSlotManager = new TimeSlotManager();
  7503. function closePendingRestoreOPS(argument) {
  7504. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  7505. operatorList.addOp(_util.OPS.restore, []);
  7506. }
  7507. }
  7508. return new Promise(function promiseBody(resolve, reject) {
  7509. const next = function (promise) {
  7510. Promise.all([promise, operatorList.ready]).then(function () {
  7511. try {
  7512. promiseBody(resolve, reject);
  7513. } catch (ex) {
  7514. reject(ex);
  7515. }
  7516. }, reject);
  7517. };
  7518. task.ensureNotTerminated();
  7519. timeSlotManager.reset();
  7520. const operation = {};
  7521. let stop, i, ii, cs, name;
  7522. while (!(stop = timeSlotManager.check())) {
  7523. operation.args = null;
  7524. if (!preprocessor.read(operation)) {
  7525. break;
  7526. }
  7527. let args = operation.args;
  7528. let fn = operation.fn;
  7529. switch (fn | 0) {
  7530. case _util.OPS.paintXObject:
  7531. name = args[0].name;
  7532. if (name) {
  7533. const localImage = localImageCache.getByName(name);
  7534. if (localImage) {
  7535. operatorList.addOp(localImage.fn, localImage.args);
  7536. args = null;
  7537. continue;
  7538. }
  7539. }
  7540. next(new Promise(function (resolveXObject, rejectXObject) {
  7541. if (!name) {
  7542. throw new _util.FormatError("XObject must be referred to by name.");
  7543. }
  7544. let xobj = xobjs.getRaw(name);
  7545. if (xobj instanceof _primitives.Ref) {
  7546. const localImage = localImageCache.getByRef(xobj);
  7547. if (localImage) {
  7548. operatorList.addOp(localImage.fn, localImage.args);
  7549. resolveXObject();
  7550. return;
  7551. }
  7552. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  7553. if (globalImage) {
  7554. operatorList.addDependency(globalImage.objId);
  7555. operatorList.addOp(globalImage.fn, globalImage.args);
  7556. resolveXObject();
  7557. return;
  7558. }
  7559. xobj = xref.fetch(xobj);
  7560. }
  7561. if (!(0, _primitives.isStream)(xobj)) {
  7562. throw new _util.FormatError("XObject should be a stream");
  7563. }
  7564. const type = xobj.dict.get("Subtype");
  7565. if (!(0, _primitives.isName)(type)) {
  7566. throw new _util.FormatError("XObject should have a Name subtype");
  7567. }
  7568. if (type.name === "Form") {
  7569. stateManager.save();
  7570. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  7571. stateManager.restore();
  7572. resolveXObject();
  7573. }, rejectXObject);
  7574. return;
  7575. } else if (type.name === "Image") {
  7576. self.buildPaintImageXObject({
  7577. resources,
  7578. image: xobj,
  7579. operatorList,
  7580. cacheKey: name,
  7581. localImageCache,
  7582. localColorSpaceCache
  7583. }).then(resolveXObject, rejectXObject);
  7584. return;
  7585. } else if (type.name === "PS") {
  7586. (0, _util.info)("Ignored XObject subtype PS");
  7587. } else {
  7588. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  7589. }
  7590. resolveXObject();
  7591. }).catch(function (reason) {
  7592. if (reason instanceof _util.AbortException) {
  7593. return;
  7594. }
  7595. if (self.options.ignoreErrors) {
  7596. self.handler.send("UnsupportedFeature", {
  7597. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  7598. });
  7599. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  7600. return;
  7601. }
  7602. throw reason;
  7603. }));
  7604. return;
  7605. case _util.OPS.setFont:
  7606. var fontSize = args[1];
  7607. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  7608. operatorList.addDependency(loadedName);
  7609. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  7610. }));
  7611. return;
  7612. case _util.OPS.beginText:
  7613. parsingText = true;
  7614. break;
  7615. case _util.OPS.endText:
  7616. parsingText = false;
  7617. break;
  7618. case _util.OPS.endInlineImage:
  7619. var cacheKey = args[0].cacheKey;
  7620. if (cacheKey) {
  7621. const localImage = localImageCache.getByName(cacheKey);
  7622. if (localImage) {
  7623. operatorList.addOp(localImage.fn, localImage.args);
  7624. args = null;
  7625. continue;
  7626. }
  7627. }
  7628. next(self.buildPaintImageXObject({
  7629. resources,
  7630. image: args[0],
  7631. isInline: true,
  7632. operatorList,
  7633. cacheKey,
  7634. localImageCache,
  7635. localColorSpaceCache
  7636. }));
  7637. return;
  7638. case _util.OPS.showText:
  7639. if (!stateManager.state.font) {
  7640. self.ensureStateFont(stateManager.state);
  7641. continue;
  7642. }
  7643. args[0] = self.handleText(args[0], stateManager.state);
  7644. break;
  7645. case _util.OPS.showSpacedText:
  7646. if (!stateManager.state.font) {
  7647. self.ensureStateFont(stateManager.state);
  7648. continue;
  7649. }
  7650. var arr = args[0];
  7651. var combinedGlyphs = [];
  7652. var arrLength = arr.length;
  7653. var state = stateManager.state;
  7654. for (i = 0; i < arrLength; ++i) {
  7655. const arrItem = arr[i];
  7656. if ((0, _util.isString)(arrItem)) {
  7657. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  7658. } else if ((0, _util.isNum)(arrItem)) {
  7659. combinedGlyphs.push(arrItem);
  7660. }
  7661. }
  7662. args[0] = combinedGlyphs;
  7663. fn = _util.OPS.showText;
  7664. break;
  7665. case _util.OPS.nextLineShowText:
  7666. if (!stateManager.state.font) {
  7667. self.ensureStateFont(stateManager.state);
  7668. continue;
  7669. }
  7670. operatorList.addOp(_util.OPS.nextLine);
  7671. args[0] = self.handleText(args[0], stateManager.state);
  7672. fn = _util.OPS.showText;
  7673. break;
  7674. case _util.OPS.nextLineSetSpacingShowText:
  7675. if (!stateManager.state.font) {
  7676. self.ensureStateFont(stateManager.state);
  7677. continue;
  7678. }
  7679. operatorList.addOp(_util.OPS.nextLine);
  7680. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  7681. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  7682. args[0] = self.handleText(args[0], stateManager.state);
  7683. fn = _util.OPS.showText;
  7684. break;
  7685. case _util.OPS.setTextRenderingMode:
  7686. stateManager.state.textRenderingMode = args[0];
  7687. break;
  7688. case _util.OPS.setFillColorSpace:
  7689. {
  7690. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  7691. if (cachedColorSpace) {
  7692. stateManager.state.fillColorSpace = cachedColorSpace;
  7693. continue;
  7694. }
  7695. next(self.parseColorSpace({
  7696. cs: args[0],
  7697. resources,
  7698. localColorSpaceCache
  7699. }).then(function (colorSpace) {
  7700. if (colorSpace) {
  7701. stateManager.state.fillColorSpace = colorSpace;
  7702. }
  7703. }));
  7704. return;
  7705. }
  7706. case _util.OPS.setStrokeColorSpace:
  7707. {
  7708. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  7709. if (cachedColorSpace) {
  7710. stateManager.state.strokeColorSpace = cachedColorSpace;
  7711. continue;
  7712. }
  7713. next(self.parseColorSpace({
  7714. cs: args[0],
  7715. resources,
  7716. localColorSpaceCache
  7717. }).then(function (colorSpace) {
  7718. if (colorSpace) {
  7719. stateManager.state.strokeColorSpace = colorSpace;
  7720. }
  7721. }));
  7722. return;
  7723. }
  7724. case _util.OPS.setFillColor:
  7725. cs = stateManager.state.fillColorSpace;
  7726. args = cs.getRgb(args, 0);
  7727. fn = _util.OPS.setFillRGBColor;
  7728. break;
  7729. case _util.OPS.setStrokeColor:
  7730. cs = stateManager.state.strokeColorSpace;
  7731. args = cs.getRgb(args, 0);
  7732. fn = _util.OPS.setStrokeRGBColor;
  7733. break;
  7734. case _util.OPS.setFillGray:
  7735. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  7736. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  7737. fn = _util.OPS.setFillRGBColor;
  7738. break;
  7739. case _util.OPS.setStrokeGray:
  7740. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  7741. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  7742. fn = _util.OPS.setStrokeRGBColor;
  7743. break;
  7744. case _util.OPS.setFillCMYKColor:
  7745. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  7746. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  7747. fn = _util.OPS.setFillRGBColor;
  7748. break;
  7749. case _util.OPS.setStrokeCMYKColor:
  7750. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  7751. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  7752. fn = _util.OPS.setStrokeRGBColor;
  7753. break;
  7754. case _util.OPS.setFillRGBColor:
  7755. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  7756. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  7757. break;
  7758. case _util.OPS.setStrokeRGBColor:
  7759. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  7760. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  7761. break;
  7762. case _util.OPS.setFillColorN:
  7763. cs = stateManager.state.fillColorSpace;
  7764. if (cs.name === "Pattern") {
  7765. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache));
  7766. return;
  7767. }
  7768. args = cs.getRgb(args, 0);
  7769. fn = _util.OPS.setFillRGBColor;
  7770. break;
  7771. case _util.OPS.setStrokeColorN:
  7772. cs = stateManager.state.strokeColorSpace;
  7773. if (cs.name === "Pattern") {
  7774. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache));
  7775. return;
  7776. }
  7777. args = cs.getRgb(args, 0);
  7778. fn = _util.OPS.setStrokeRGBColor;
  7779. break;
  7780. case _util.OPS.shadingFill:
  7781. var shadingRes = resources.get("Shading");
  7782. if (!shadingRes) {
  7783. throw new _util.FormatError("No shading resource found");
  7784. }
  7785. var shading = shadingRes.get(args[0].name);
  7786. if (!shading) {
  7787. throw new _util.FormatError("No shading object found");
  7788. }
  7789. var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self._pdfFunctionFactory, localColorSpaceCache);
  7790. var patternIR = shadingFill.getIR();
  7791. args = [patternIR];
  7792. fn = _util.OPS.shadingFill;
  7793. break;
  7794. case _util.OPS.setGState:
  7795. name = args[0].name;
  7796. if (name) {
  7797. const localGStateObj = localGStateCache.getByName(name);
  7798. if (localGStateObj) {
  7799. if (localGStateObj.length > 0) {
  7800. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  7801. }
  7802. args = null;
  7803. continue;
  7804. }
  7805. }
  7806. next(new Promise(function (resolveGState, rejectGState) {
  7807. if (!name) {
  7808. throw new _util.FormatError("GState must be referred to by name.");
  7809. }
  7810. const extGState = resources.get("ExtGState");
  7811. if (!(extGState instanceof _primitives.Dict)) {
  7812. throw new _util.FormatError("ExtGState should be a dictionary.");
  7813. }
  7814. const gState = extGState.get(name);
  7815. if (!(gState instanceof _primitives.Dict)) {
  7816. throw new _util.FormatError("GState should be a dictionary.");
  7817. }
  7818. self.setGState({
  7819. resources,
  7820. gState,
  7821. operatorList,
  7822. cacheKey: name,
  7823. task,
  7824. stateManager,
  7825. localGStateCache,
  7826. localColorSpaceCache
  7827. }).then(resolveGState, rejectGState);
  7828. }).catch(function (reason) {
  7829. if (reason instanceof _util.AbortException) {
  7830. return;
  7831. }
  7832. if (self.options.ignoreErrors) {
  7833. self.handler.send("UnsupportedFeature", {
  7834. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  7835. });
  7836. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  7837. return;
  7838. }
  7839. throw reason;
  7840. }));
  7841. return;
  7842. case _util.OPS.moveTo:
  7843. case _util.OPS.lineTo:
  7844. case _util.OPS.curveTo:
  7845. case _util.OPS.curveTo2:
  7846. case _util.OPS.curveTo3:
  7847. case _util.OPS.closePath:
  7848. case _util.OPS.rectangle:
  7849. self.buildPath(operatorList, fn, args, parsingText);
  7850. continue;
  7851. case _util.OPS.markPoint:
  7852. case _util.OPS.markPointProps:
  7853. case _util.OPS.beginCompat:
  7854. case _util.OPS.endCompat:
  7855. continue;
  7856. case _util.OPS.beginMarkedContentProps:
  7857. if (!(0, _primitives.isName)(args[0])) {
  7858. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  7859. continue;
  7860. }
  7861. if (args[0].name === "OC") {
  7862. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  7863. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  7864. }).catch(reason => {
  7865. if (reason instanceof _util.AbortException) {
  7866. return;
  7867. }
  7868. if (self.options.ignoreErrors) {
  7869. self.handler.send("UnsupportedFeature", {
  7870. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  7871. });
  7872. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  7873. return;
  7874. }
  7875. throw reason;
  7876. }));
  7877. return;
  7878. }
  7879. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  7880. break;
  7881. case _util.OPS.beginMarkedContent:
  7882. case _util.OPS.endMarkedContent:
  7883. default:
  7884. if (args !== null) {
  7885. for (i = 0, ii = args.length; i < ii; i++) {
  7886. if (args[i] instanceof _primitives.Dict) {
  7887. break;
  7888. }
  7889. }
  7890. if (i < ii) {
  7891. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  7892. continue;
  7893. }
  7894. }
  7895. }
  7896. operatorList.addOp(fn, args);
  7897. }
  7898. if (stop) {
  7899. next(deferred);
  7900. return;
  7901. }
  7902. closePendingRestoreOPS();
  7903. resolve();
  7904. }).catch(reason => {
  7905. if (reason instanceof _util.AbortException) {
  7906. return;
  7907. }
  7908. if (this.options.ignoreErrors) {
  7909. this.handler.send("UnsupportedFeature", {
  7910. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  7911. });
  7912. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  7913. closePendingRestoreOPS();
  7914. return;
  7915. }
  7916. throw reason;
  7917. });
  7918. }
  7919. getTextContent({
  7920. stream,
  7921. task,
  7922. resources,
  7923. stateManager = null,
  7924. normalizeWhitespace = false,
  7925. combineTextItems = false,
  7926. includeMarkedContent = false,
  7927. sink,
  7928. seenStyles = new Set()
  7929. }) {
  7930. resources = resources || _primitives.Dict.empty;
  7931. stateManager = stateManager || new StateManager(new TextState());
  7932. const WhitespaceRegexp = /\s/g;
  7933. const textContent = {
  7934. items: [],
  7935. styles: Object.create(null)
  7936. };
  7937. const textContentItem = {
  7938. initialized: false,
  7939. str: [],
  7940. totalWidth: 0,
  7941. totalHeight: 0,
  7942. width: 0,
  7943. height: 0,
  7944. vertical: false,
  7945. lastCharSize: 0,
  7946. prevTransform: null,
  7947. textAdvanceScale: 0,
  7948. spaceWidth: 0,
  7949. spaceInFlowMin: 0,
  7950. spaceInFlowMax: 0,
  7951. trackingSpaceMin: Infinity,
  7952. transform: null,
  7953. fontName: null,
  7954. hasEOL: false,
  7955. isLastCharWhiteSpace: false
  7956. };
  7957. const TRACKING_SPACE_FACTOR = 0.3;
  7958. const SPACE_IN_FLOW_MIN_FACTOR = 0.3;
  7959. const SPACE_IN_FLOW_MAX_FACTOR = 1.3;
  7960. const self = this;
  7961. const xref = this.xref;
  7962. const showSpacedTextBuffer = [];
  7963. let xobjs = null;
  7964. const emptyXObjectCache = new _image_utils.LocalImageCache();
  7965. const emptyGStateCache = new _image_utils.LocalGStateCache();
  7966. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  7967. let textState;
  7968. function getCurrentTextTransform() {
  7969. const font = textState.font;
  7970. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  7971. if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  7972. const glyphHeight = font.bbox[3] - font.bbox[1];
  7973. if (glyphHeight > 0) {
  7974. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  7975. }
  7976. }
  7977. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  7978. }
  7979. function ensureTextContentItem() {
  7980. if (textContentItem.initialized) {
  7981. return textContentItem;
  7982. }
  7983. const font = textState.font,
  7984. loadedName = font.loadedName;
  7985. if (!seenStyles.has(loadedName)) {
  7986. seenStyles.add(loadedName);
  7987. textContent.styles[loadedName] = {
  7988. fontFamily: font.fallbackName,
  7989. ascent: font.ascent,
  7990. descent: font.descent,
  7991. vertical: font.vertical
  7992. };
  7993. }
  7994. textContentItem.fontName = loadedName;
  7995. const trm = textContentItem.transform = getCurrentTextTransform();
  7996. if (!font.vertical) {
  7997. textContentItem.width = textContentItem.totalWidth = 0;
  7998. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  7999. textContentItem.vertical = false;
  8000. } else {
  8001. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  8002. textContentItem.height = textContentItem.totalHeight = 0;
  8003. textContentItem.vertical = true;
  8004. }
  8005. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  8006. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  8007. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  8008. textContentItem.lastCharSize = textContentItem.lastCharSize || 0;
  8009. const spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  8010. if (spaceWidth) {
  8011. textContentItem.spaceWidth = spaceWidth;
  8012. textContentItem.trackingSpaceMin = spaceWidth * TRACKING_SPACE_FACTOR;
  8013. textContentItem.spaceInFlowMin = spaceWidth * SPACE_IN_FLOW_MIN_FACTOR;
  8014. textContentItem.spaceInFlowMax = spaceWidth * SPACE_IN_FLOW_MAX_FACTOR;
  8015. } else {
  8016. textContentItem.spaceWidth = 0;
  8017. textContentItem.trackingSpaceMin = Infinity;
  8018. }
  8019. textContentItem.hasEOL = false;
  8020. textContentItem.initialized = true;
  8021. return textContentItem;
  8022. }
  8023. function updateAdvanceScale() {
  8024. if (!textContentItem.initialized) {
  8025. return;
  8026. }
  8027. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  8028. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  8029. const scaleFactor = scaleCtmX * scaleLineX;
  8030. if (scaleFactor === textContentItem.textAdvanceScale) {
  8031. return;
  8032. }
  8033. if (!textContentItem.vertical) {
  8034. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  8035. textContentItem.width = 0;
  8036. } else {
  8037. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  8038. textContentItem.height = 0;
  8039. }
  8040. textContentItem.textAdvanceScale = scaleFactor;
  8041. }
  8042. function replaceWhitespace(str) {
  8043. const ii = str.length;
  8044. let i = 0,
  8045. code;
  8046. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  8047. i++;
  8048. }
  8049. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  8050. }
  8051. function runBidiTransform(textChunk) {
  8052. const text = textChunk.str.join("");
  8053. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  8054. const str = normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str;
  8055. return {
  8056. str,
  8057. dir: bidiResult.dir,
  8058. width: textChunk.totalWidth,
  8059. height: textChunk.totalHeight,
  8060. transform: textChunk.transform,
  8061. fontName: textChunk.fontName,
  8062. hasEOL: textChunk.hasEOL
  8063. };
  8064. }
  8065. function handleSetFont(fontName, fontRef) {
  8066. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  8067. textState.font = translated.font;
  8068. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  8069. });
  8070. }
  8071. function compareWithLastPosition(fontSize) {
  8072. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  8073. return;
  8074. }
  8075. const currentTransform = getCurrentTextTransform();
  8076. const posX = currentTransform[4];
  8077. const posY = currentTransform[5];
  8078. const lastPosX = textContentItem.prevTransform[4];
  8079. const lastPosY = textContentItem.prevTransform[5];
  8080. if (lastPosX === posX && lastPosY === posY) {
  8081. return;
  8082. }
  8083. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  8084. const advanceY = (posY - lastPosY) / textContentItem.textAdvanceScale;
  8085. const HALF_LAST_CHAR = -0.5 * textContentItem.lastCharSize;
  8086. if (textState.font.vertical) {
  8087. if (Math.abs(advanceX) > textContentItem.width / textContentItem.textAdvanceScale) {
  8088. appendEOL();
  8089. return;
  8090. }
  8091. if (HALF_LAST_CHAR > advanceY) {
  8092. return;
  8093. }
  8094. if (advanceY > textContentItem.trackingSpaceMin) {
  8095. textContentItem.height += advanceY;
  8096. } else if (!addFakeSpaces(advanceY, 0, textContentItem.prevTransform)) {
  8097. if (textContentItem.str.length === 0) {
  8098. textContent.items.push({
  8099. str: " ",
  8100. dir: "ltr",
  8101. width: 0,
  8102. height: advanceY,
  8103. transform: textContentItem.prevTransform,
  8104. fontName: textContentItem.fontName,
  8105. hasEOL: false
  8106. });
  8107. textContentItem.isLastCharWhiteSpace = true;
  8108. } else {
  8109. textContentItem.height += advanceY;
  8110. }
  8111. }
  8112. return;
  8113. }
  8114. if (Math.abs(advanceY) > textContentItem.height / textContentItem.textAdvanceScale) {
  8115. appendEOL();
  8116. return;
  8117. }
  8118. if (HALF_LAST_CHAR > advanceX) {
  8119. return;
  8120. }
  8121. if (advanceX <= textContentItem.trackingSpaceMin) {
  8122. textContentItem.width += advanceX;
  8123. } else if (!addFakeSpaces(advanceX, 0, textContentItem.prevTransform)) {
  8124. if (textContentItem.str.length === 0) {
  8125. textContent.items.push({
  8126. str: " ",
  8127. dir: "ltr",
  8128. width: advanceX,
  8129. height: 0,
  8130. transform: textContentItem.prevTransform,
  8131. fontName: textContentItem.fontName,
  8132. hasEOL: false
  8133. });
  8134. textContentItem.isLastCharWhiteSpace = true;
  8135. } else {
  8136. textContentItem.width += advanceX;
  8137. }
  8138. }
  8139. }
  8140. function buildTextContentItem({
  8141. chars,
  8142. extraSpacing,
  8143. isFirstChunk
  8144. }) {
  8145. const font = textState.font;
  8146. if (!chars) {
  8147. const charSpacing = textState.charSpacing + extraSpacing;
  8148. if (charSpacing) {
  8149. if (!font.vertical) {
  8150. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  8151. } else {
  8152. textState.translateTextMatrix(0, charSpacing);
  8153. }
  8154. }
  8155. return;
  8156. }
  8157. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  8158. const glyphs = font.charsToGlyphs(chars);
  8159. const scale = textState.fontMatrix[0] * textState.fontSize;
  8160. if (isFirstChunk) {
  8161. compareWithLastPosition(scale);
  8162. }
  8163. let textChunk = ensureTextContentItem();
  8164. let size = 0;
  8165. let lastCharSize = 0;
  8166. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8167. const glyph = glyphs[i];
  8168. let charSpacing = textState.charSpacing + (i === ii - 1 ? extraSpacing : 0);
  8169. let glyphUnicode = glyph.unicode;
  8170. if (glyph.isSpace) {
  8171. charSpacing += textState.wordSpacing;
  8172. textChunk.isLastCharWhiteSpace = true;
  8173. } else {
  8174. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  8175. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  8176. textChunk.isLastCharWhiteSpace = false;
  8177. }
  8178. textChunk.str.push(glyphUnicode);
  8179. const glyphWidth = font.vertical && glyph.vmetric ? glyph.vmetric[0] : glyph.width;
  8180. let scaledDim = glyphWidth * scale;
  8181. if (!font.vertical) {
  8182. scaledDim *= textState.textHScale;
  8183. textState.translateTextMatrix(scaledDim, 0);
  8184. } else {
  8185. textState.translateTextMatrix(0, scaledDim);
  8186. scaledDim = Math.abs(scaledDim);
  8187. }
  8188. size += scaledDim;
  8189. if (charSpacing) {
  8190. if (!font.vertical) {
  8191. charSpacing *= textState.textHScale;
  8192. }
  8193. scaledDim += charSpacing;
  8194. const wasSplit = charSpacing > textContentItem.trackingSpaceMin && addFakeSpaces(charSpacing, size);
  8195. if (!font.vertical) {
  8196. textState.translateTextMatrix(charSpacing, 0);
  8197. } else {
  8198. textState.translateTextMatrix(0, charSpacing);
  8199. }
  8200. if (wasSplit) {
  8201. textChunk = ensureTextContentItem();
  8202. size = 0;
  8203. } else {
  8204. size += charSpacing;
  8205. }
  8206. }
  8207. lastCharSize = scaledDim;
  8208. }
  8209. textChunk.lastCharSize = lastCharSize;
  8210. if (!font.vertical) {
  8211. textChunk.width += size;
  8212. } else {
  8213. textChunk.height += size;
  8214. }
  8215. textChunk.prevTransform = getCurrentTextTransform();
  8216. }
  8217. function appendEOL() {
  8218. if (textContentItem.initialized) {
  8219. textContentItem.hasEOL = true;
  8220. flushTextContentItem();
  8221. } else if (textContent.items.length > 0) {
  8222. textContent.items[textContent.items.length - 1].hasEOL = true;
  8223. } else {
  8224. textContent.items.push({
  8225. str: "",
  8226. dir: "ltr",
  8227. width: 0,
  8228. height: 0,
  8229. transform: getCurrentTextTransform(),
  8230. fontName: textState.font.loadedName,
  8231. hasEOL: true
  8232. });
  8233. }
  8234. textContentItem.isLastCharWhiteSpace = false;
  8235. textContentItem.lastCharSize = 0;
  8236. }
  8237. function addFakeSpaces(width, size, transf = null) {
  8238. if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) {
  8239. if (textContentItem.initialized) {
  8240. textContentItem.str.push(" ");
  8241. textContentItem.isLastCharWhiteSpace = true;
  8242. }
  8243. return false;
  8244. }
  8245. const fontName = textContentItem.fontName;
  8246. let height = 0;
  8247. width *= textContentItem.textAdvanceScale;
  8248. if (!textContentItem.vertical) {
  8249. textContentItem.width += size;
  8250. } else {
  8251. textContentItem.height += size;
  8252. height = width;
  8253. width = 0;
  8254. }
  8255. flushTextContentItem();
  8256. if (textContentItem.isLastCharWhiteSpace) {
  8257. return true;
  8258. }
  8259. textContentItem.isLastCharWhiteSpace = true;
  8260. textContent.items.push({
  8261. str: " ",
  8262. dir: "ltr",
  8263. width,
  8264. height,
  8265. transform: transf ? transf : getCurrentTextTransform(),
  8266. fontName,
  8267. hasEOL: false
  8268. });
  8269. return true;
  8270. }
  8271. function flushTextContentItem() {
  8272. if (!textContentItem.initialized || !textContentItem.str) {
  8273. return;
  8274. }
  8275. if (!textContentItem.vertical) {
  8276. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  8277. } else {
  8278. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  8279. }
  8280. textContent.items.push(runBidiTransform(textContentItem));
  8281. textContentItem.initialized = false;
  8282. textContentItem.str.length = 0;
  8283. }
  8284. function enqueueChunk() {
  8285. const length = textContent.items.length;
  8286. if (length > 0) {
  8287. sink.enqueue(textContent, length);
  8288. textContent.items = [];
  8289. textContent.styles = Object.create(null);
  8290. }
  8291. }
  8292. const timeSlotManager = new TimeSlotManager();
  8293. return new Promise(function promiseBody(resolve, reject) {
  8294. const next = function (promise) {
  8295. enqueueChunk();
  8296. Promise.all([promise, sink.ready]).then(function () {
  8297. try {
  8298. promiseBody(resolve, reject);
  8299. } catch (ex) {
  8300. reject(ex);
  8301. }
  8302. }, reject);
  8303. };
  8304. task.ensureNotTerminated();
  8305. timeSlotManager.reset();
  8306. const operation = {};
  8307. let stop,
  8308. args = [];
  8309. while (!(stop = timeSlotManager.check())) {
  8310. args.length = 0;
  8311. operation.args = args;
  8312. if (!preprocessor.read(operation)) {
  8313. break;
  8314. }
  8315. textState = stateManager.state;
  8316. const fn = operation.fn;
  8317. args = operation.args;
  8318. switch (fn | 0) {
  8319. case _util.OPS.setFont:
  8320. var fontNameArg = args[0].name,
  8321. fontSizeArg = args[1];
  8322. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  8323. break;
  8324. }
  8325. flushTextContentItem();
  8326. textState.fontName = fontNameArg;
  8327. textState.fontSize = fontSizeArg;
  8328. next(handleSetFont(fontNameArg, null));
  8329. return;
  8330. case _util.OPS.setTextRise:
  8331. flushTextContentItem();
  8332. textState.textRise = args[0];
  8333. break;
  8334. case _util.OPS.setHScale:
  8335. flushTextContentItem();
  8336. textState.textHScale = args[0] / 100;
  8337. break;
  8338. case _util.OPS.setLeading:
  8339. flushTextContentItem();
  8340. textState.leading = args[0];
  8341. break;
  8342. case _util.OPS.moveText:
  8343. textState.translateTextLineMatrix(args[0], args[1]);
  8344. textState.textMatrix = textState.textLineMatrix.slice();
  8345. break;
  8346. case _util.OPS.setLeadingMoveText:
  8347. flushTextContentItem();
  8348. textState.leading = -args[1];
  8349. textState.translateTextLineMatrix(args[0], args[1]);
  8350. textState.textMatrix = textState.textLineMatrix.slice();
  8351. break;
  8352. case _util.OPS.nextLine:
  8353. appendEOL();
  8354. textState.carriageReturn();
  8355. break;
  8356. case _util.OPS.setTextMatrix:
  8357. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  8358. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  8359. updateAdvanceScale();
  8360. break;
  8361. case _util.OPS.setCharSpacing:
  8362. textState.charSpacing = args[0];
  8363. break;
  8364. case _util.OPS.setWordSpacing:
  8365. textState.wordSpacing = args[0];
  8366. break;
  8367. case _util.OPS.beginText:
  8368. flushTextContentItem();
  8369. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  8370. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  8371. break;
  8372. case _util.OPS.showSpacedText:
  8373. if (!stateManager.state.font) {
  8374. self.ensureStateFont(stateManager.state);
  8375. continue;
  8376. }
  8377. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  8378. const elements = args[0];
  8379. let isFirstChunk = true;
  8380. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  8381. const item = elements[i];
  8382. if (typeof item === "string") {
  8383. showSpacedTextBuffer.push(item);
  8384. } else if (typeof item === "number" && item !== 0) {
  8385. const str = showSpacedTextBuffer.join("");
  8386. showSpacedTextBuffer.length = 0;
  8387. buildTextContentItem({
  8388. chars: str,
  8389. extraSpacing: item * spaceFactor,
  8390. isFirstChunk
  8391. });
  8392. if (str && isFirstChunk) {
  8393. isFirstChunk = false;
  8394. }
  8395. }
  8396. }
  8397. const item = elements[elements.length - 1];
  8398. if (typeof item === "string") {
  8399. showSpacedTextBuffer.push(item);
  8400. }
  8401. if (showSpacedTextBuffer.length > 0) {
  8402. const str = showSpacedTextBuffer.join("");
  8403. showSpacedTextBuffer.length = 0;
  8404. buildTextContentItem({
  8405. chars: str,
  8406. extraSpacing: 0,
  8407. isFirstChunk
  8408. });
  8409. }
  8410. break;
  8411. case _util.OPS.showText:
  8412. if (!stateManager.state.font) {
  8413. self.ensureStateFont(stateManager.state);
  8414. continue;
  8415. }
  8416. buildTextContentItem({
  8417. chars: args[0],
  8418. extraSpacing: 0,
  8419. isFirstChunk: true
  8420. });
  8421. break;
  8422. case _util.OPS.nextLineShowText:
  8423. if (!stateManager.state.font) {
  8424. self.ensureStateFont(stateManager.state);
  8425. continue;
  8426. }
  8427. textContentItem.hasEOL = true;
  8428. flushTextContentItem();
  8429. textState.carriageReturn();
  8430. buildTextContentItem({
  8431. chars: args[0],
  8432. extraSpacing: 0,
  8433. isFirstChunk: true
  8434. });
  8435. break;
  8436. case _util.OPS.nextLineSetSpacingShowText:
  8437. if (!stateManager.state.font) {
  8438. self.ensureStateFont(stateManager.state);
  8439. continue;
  8440. }
  8441. textContentItem.hasEOL = true;
  8442. flushTextContentItem();
  8443. textState.wordSpacing = args[0];
  8444. textState.charSpacing = args[1];
  8445. textState.carriageReturn();
  8446. buildTextContentItem({
  8447. chars: args[2],
  8448. extraSpacing: 0,
  8449. isFirstChunk: true
  8450. });
  8451. break;
  8452. case _util.OPS.paintXObject:
  8453. flushTextContentItem();
  8454. if (!xobjs) {
  8455. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  8456. }
  8457. var name = args[0].name;
  8458. if (name && emptyXObjectCache.getByName(name)) {
  8459. break;
  8460. }
  8461. next(new Promise(function (resolveXObject, rejectXObject) {
  8462. if (!name) {
  8463. throw new _util.FormatError("XObject must be referred to by name.");
  8464. }
  8465. let xobj = xobjs.getRaw(name);
  8466. if (xobj instanceof _primitives.Ref) {
  8467. if (emptyXObjectCache.getByRef(xobj)) {
  8468. resolveXObject();
  8469. return;
  8470. }
  8471. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  8472. if (globalImage) {
  8473. resolveXObject();
  8474. return;
  8475. }
  8476. xobj = xref.fetch(xobj);
  8477. }
  8478. if (!(0, _primitives.isStream)(xobj)) {
  8479. throw new _util.FormatError("XObject should be a stream");
  8480. }
  8481. const type = xobj.dict.get("Subtype");
  8482. if (!(0, _primitives.isName)(type)) {
  8483. throw new _util.FormatError("XObject should have a Name subtype");
  8484. }
  8485. if (type.name !== "Form") {
  8486. emptyXObjectCache.set(name, xobj.dict.objId, true);
  8487. resolveXObject();
  8488. return;
  8489. }
  8490. const currentState = stateManager.state.clone();
  8491. const xObjStateManager = new StateManager(currentState);
  8492. const matrix = xobj.dict.getArray("Matrix");
  8493. if (Array.isArray(matrix) && matrix.length === 6) {
  8494. xObjStateManager.transform(matrix);
  8495. }
  8496. enqueueChunk();
  8497. const sinkWrapper = {
  8498. enqueueInvoked: false,
  8499. enqueue(chunk, size) {
  8500. this.enqueueInvoked = true;
  8501. sink.enqueue(chunk, size);
  8502. },
  8503. get desiredSize() {
  8504. return sink.desiredSize;
  8505. },
  8506. get ready() {
  8507. return sink.ready;
  8508. }
  8509. };
  8510. self.getTextContent({
  8511. stream: xobj,
  8512. task,
  8513. resources: xobj.dict.get("Resources") || resources,
  8514. stateManager: xObjStateManager,
  8515. normalizeWhitespace,
  8516. combineTextItems,
  8517. includeMarkedContent,
  8518. sink: sinkWrapper,
  8519. seenStyles
  8520. }).then(function () {
  8521. if (!sinkWrapper.enqueueInvoked) {
  8522. emptyXObjectCache.set(name, xobj.dict.objId, true);
  8523. }
  8524. resolveXObject();
  8525. }, rejectXObject);
  8526. }).catch(function (reason) {
  8527. if (reason instanceof _util.AbortException) {
  8528. return;
  8529. }
  8530. if (self.options.ignoreErrors) {
  8531. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  8532. return;
  8533. }
  8534. throw reason;
  8535. }));
  8536. return;
  8537. case _util.OPS.setGState:
  8538. name = args[0].name;
  8539. if (name && emptyGStateCache.getByName(name)) {
  8540. break;
  8541. }
  8542. next(new Promise(function (resolveGState, rejectGState) {
  8543. if (!name) {
  8544. throw new _util.FormatError("GState must be referred to by name.");
  8545. }
  8546. const extGState = resources.get("ExtGState");
  8547. if (!(extGState instanceof _primitives.Dict)) {
  8548. throw new _util.FormatError("ExtGState should be a dictionary.");
  8549. }
  8550. const gState = extGState.get(name);
  8551. if (!(gState instanceof _primitives.Dict)) {
  8552. throw new _util.FormatError("GState should be a dictionary.");
  8553. }
  8554. const gStateFont = gState.get("Font");
  8555. if (!gStateFont) {
  8556. emptyGStateCache.set(name, gState.objId, true);
  8557. resolveGState();
  8558. return;
  8559. }
  8560. flushTextContentItem();
  8561. textState.fontName = null;
  8562. textState.fontSize = gStateFont[1];
  8563. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  8564. }).catch(function (reason) {
  8565. if (reason instanceof _util.AbortException) {
  8566. return;
  8567. }
  8568. if (self.options.ignoreErrors) {
  8569. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  8570. return;
  8571. }
  8572. throw reason;
  8573. }));
  8574. return;
  8575. case _util.OPS.beginMarkedContent:
  8576. if (includeMarkedContent) {
  8577. textContent.items.push({
  8578. type: "beginMarkedContent",
  8579. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  8580. });
  8581. }
  8582. break;
  8583. case _util.OPS.beginMarkedContentProps:
  8584. if (includeMarkedContent) {
  8585. flushTextContentItem();
  8586. let mcid = null;
  8587. if ((0, _primitives.isDict)(args[1])) {
  8588. mcid = args[1].get("MCID");
  8589. }
  8590. textContent.items.push({
  8591. type: "beginMarkedContentProps",
  8592. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  8593. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  8594. });
  8595. }
  8596. break;
  8597. case _util.OPS.endMarkedContent:
  8598. if (includeMarkedContent) {
  8599. flushTextContentItem();
  8600. textContent.items.push({
  8601. type: "endMarkedContent"
  8602. });
  8603. }
  8604. break;
  8605. }
  8606. if (textContent.items.length >= sink.desiredSize) {
  8607. stop = true;
  8608. break;
  8609. }
  8610. }
  8611. if (stop) {
  8612. next(deferred);
  8613. return;
  8614. }
  8615. flushTextContentItem();
  8616. enqueueChunk();
  8617. resolve();
  8618. }).catch(reason => {
  8619. if (reason instanceof _util.AbortException) {
  8620. return;
  8621. }
  8622. if (this.options.ignoreErrors) {
  8623. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  8624. flushTextContentItem();
  8625. enqueueChunk();
  8626. return;
  8627. }
  8628. throw reason;
  8629. });
  8630. }
  8631. extractDataStructures(dict, baseDict, properties) {
  8632. const xref = this.xref;
  8633. let cidToGidBytes;
  8634. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  8635. if (properties.composite) {
  8636. const cidSystemInfo = dict.get("CIDSystemInfo");
  8637. if ((0, _primitives.isDict)(cidSystemInfo)) {
  8638. properties.cidSystemInfo = {
  8639. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  8640. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  8641. supplement: cidSystemInfo.get("Supplement")
  8642. };
  8643. }
  8644. const cidToGidMap = dict.get("CIDToGIDMap");
  8645. if ((0, _primitives.isStream)(cidToGidMap)) {
  8646. cidToGidBytes = cidToGidMap.getBytes();
  8647. }
  8648. }
  8649. const differences = [];
  8650. let baseEncodingName = null;
  8651. let encoding;
  8652. if (dict.has("Encoding")) {
  8653. encoding = dict.get("Encoding");
  8654. if ((0, _primitives.isDict)(encoding)) {
  8655. baseEncodingName = encoding.get("BaseEncoding");
  8656. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  8657. if (encoding.has("Differences")) {
  8658. const diffEncoding = encoding.get("Differences");
  8659. let index = 0;
  8660. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  8661. const data = xref.fetchIfRef(diffEncoding[j]);
  8662. if ((0, _util.isNum)(data)) {
  8663. index = data;
  8664. } else if ((0, _primitives.isName)(data)) {
  8665. differences[index++] = data.name;
  8666. } else {
  8667. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  8668. }
  8669. }
  8670. }
  8671. } else if ((0, _primitives.isName)(encoding)) {
  8672. baseEncodingName = encoding.name;
  8673. } else {
  8674. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  8675. }
  8676. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  8677. baseEncodingName = null;
  8678. }
  8679. }
  8680. if (baseEncodingName) {
  8681. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  8682. } else {
  8683. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  8684. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  8685. encoding = _encodings.StandardEncoding;
  8686. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  8687. encoding = _encodings.WinAnsiEncoding;
  8688. }
  8689. if (isSymbolicFont) {
  8690. encoding = _encodings.MacRomanEncoding;
  8691. if (!properties.file) {
  8692. if (/Symbol/i.test(properties.name)) {
  8693. encoding = _encodings.SymbolSetEncoding;
  8694. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  8695. encoding = _encodings.ZapfDingbatsEncoding;
  8696. }
  8697. }
  8698. }
  8699. properties.defaultEncoding = encoding;
  8700. }
  8701. properties.differences = differences;
  8702. properties.baseEncodingName = baseEncodingName;
  8703. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  8704. properties.dict = dict;
  8705. return toUnicodePromise.then(readToUnicode => {
  8706. properties.toUnicode = readToUnicode;
  8707. return this.buildToUnicode(properties);
  8708. }).then(builtToUnicode => {
  8709. properties.toUnicode = builtToUnicode;
  8710. if (cidToGidBytes) {
  8711. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  8712. }
  8713. return properties;
  8714. });
  8715. }
  8716. _buildSimpleFontToUnicode(properties, forceGlyphs = false) {
  8717. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  8718. const toUnicode = [];
  8719. const encoding = properties.defaultEncoding.slice();
  8720. const baseEncodingName = properties.baseEncodingName;
  8721. const differences = properties.differences;
  8722. for (const charcode in differences) {
  8723. const glyphName = differences[charcode];
  8724. if (glyphName === ".notdef") {
  8725. continue;
  8726. }
  8727. encoding[charcode] = glyphName;
  8728. }
  8729. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  8730. for (const charcode in encoding) {
  8731. let glyphName = encoding[charcode];
  8732. if (glyphName === "") {
  8733. continue;
  8734. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  8735. let code = 0;
  8736. switch (glyphName[0]) {
  8737. case "G":
  8738. if (glyphName.length === 3) {
  8739. code = parseInt(glyphName.substring(1), 16);
  8740. }
  8741. break;
  8742. case "g":
  8743. if (glyphName.length === 5) {
  8744. code = parseInt(glyphName.substring(1), 16);
  8745. }
  8746. break;
  8747. case "C":
  8748. case "c":
  8749. if (glyphName.length >= 3 && glyphName.length <= 4) {
  8750. const codeStr = glyphName.substring(1);
  8751. if (forceGlyphs) {
  8752. code = parseInt(codeStr, 16);
  8753. break;
  8754. }
  8755. code = +codeStr;
  8756. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  8757. return this._buildSimpleFontToUnicode(properties, true);
  8758. }
  8759. }
  8760. break;
  8761. default:
  8762. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  8763. if (unicode !== -1) {
  8764. code = unicode;
  8765. }
  8766. }
  8767. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  8768. if (baseEncodingName && code === +charcode) {
  8769. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  8770. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  8771. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  8772. continue;
  8773. }
  8774. }
  8775. toUnicode[charcode] = String.fromCodePoint(code);
  8776. }
  8777. continue;
  8778. }
  8779. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  8780. }
  8781. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  8782. }
  8783. buildToUnicode(properties) {
  8784. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  8785. if (properties.hasIncludedToUnicodeMap) {
  8786. if (!properties.composite && properties.hasEncoding) {
  8787. properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
  8788. }
  8789. return Promise.resolve(properties.toUnicode);
  8790. }
  8791. if (!properties.composite) {
  8792. return Promise.resolve(this._buildSimpleFontToUnicode(properties));
  8793. }
  8794. 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"))) {
  8795. const registry = properties.cidSystemInfo.registry;
  8796. const ordering = properties.cidSystemInfo.ordering;
  8797. const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
  8798. return _cmap.CMapFactory.create({
  8799. encoding: ucs2CMapName,
  8800. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  8801. useCMap: null
  8802. }).then(function (ucs2CMap) {
  8803. const cMap = properties.cMap;
  8804. const toUnicode = [];
  8805. cMap.forEach(function (charcode, cid) {
  8806. if (cid > 0xffff) {
  8807. throw new _util.FormatError("Max size of CID is 65,535");
  8808. }
  8809. const ucs2 = ucs2CMap.lookup(cid);
  8810. if (ucs2) {
  8811. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  8812. }
  8813. });
  8814. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  8815. });
  8816. }
  8817. return Promise.resolve(new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  8818. }
  8819. readToUnicode(cmapObj) {
  8820. if (!cmapObj) {
  8821. return Promise.resolve(null);
  8822. }
  8823. if ((0, _primitives.isName)(cmapObj)) {
  8824. return _cmap.CMapFactory.create({
  8825. encoding: cmapObj,
  8826. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  8827. useCMap: null
  8828. }).then(function (cmap) {
  8829. if (cmap instanceof _cmap.IdentityCMap) {
  8830. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  8831. }
  8832. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  8833. });
  8834. } else if ((0, _primitives.isStream)(cmapObj)) {
  8835. return _cmap.CMapFactory.create({
  8836. encoding: cmapObj,
  8837. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  8838. useCMap: null
  8839. }).then(function (cmap) {
  8840. if (cmap instanceof _cmap.IdentityCMap) {
  8841. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  8842. }
  8843. const map = new Array(cmap.length);
  8844. cmap.forEach(function (charCode, token) {
  8845. const str = [];
  8846. for (let k = 0; k < token.length; k += 2) {
  8847. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  8848. if ((w1 & 0xf800) !== 0xd800) {
  8849. str.push(w1);
  8850. continue;
  8851. }
  8852. k += 2;
  8853. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  8854. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  8855. }
  8856. map[charCode] = String.fromCodePoint.apply(String, str);
  8857. });
  8858. return new _to_unicode_map.ToUnicodeMap(map);
  8859. }, reason => {
  8860. if (reason instanceof _util.AbortException) {
  8861. return null;
  8862. }
  8863. if (this.options.ignoreErrors) {
  8864. this.handler.send("UnsupportedFeature", {
  8865. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  8866. });
  8867. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  8868. return null;
  8869. }
  8870. throw reason;
  8871. });
  8872. }
  8873. return Promise.resolve(null);
  8874. }
  8875. readCidToGidMap(glyphsData, toUnicode) {
  8876. const result = [];
  8877. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  8878. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  8879. const code = j >> 1;
  8880. if (glyphID === 0 && !toUnicode.has(code)) {
  8881. continue;
  8882. }
  8883. result[code] = glyphID;
  8884. }
  8885. return result;
  8886. }
  8887. extractWidths(dict, descriptor, properties) {
  8888. const xref = this.xref;
  8889. let glyphsWidths = [];
  8890. let defaultWidth = 0;
  8891. const glyphsVMetrics = [];
  8892. let defaultVMetrics;
  8893. let i, ii, j, jj, start, code, widths;
  8894. if (properties.composite) {
  8895. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  8896. widths = dict.get("W");
  8897. if (widths) {
  8898. for (i = 0, ii = widths.length; i < ii; i++) {
  8899. start = xref.fetchIfRef(widths[i++]);
  8900. code = xref.fetchIfRef(widths[i]);
  8901. if (Array.isArray(code)) {
  8902. for (j = 0, jj = code.length; j < jj; j++) {
  8903. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  8904. }
  8905. } else {
  8906. const width = xref.fetchIfRef(widths[++i]);
  8907. for (j = start; j <= code; j++) {
  8908. glyphsWidths[j] = width;
  8909. }
  8910. }
  8911. }
  8912. }
  8913. if (properties.vertical) {
  8914. let vmetrics = dict.getArray("DW2") || [880, -1000];
  8915. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  8916. vmetrics = dict.get("W2");
  8917. if (vmetrics) {
  8918. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  8919. start = xref.fetchIfRef(vmetrics[i++]);
  8920. code = xref.fetchIfRef(vmetrics[i]);
  8921. if (Array.isArray(code)) {
  8922. for (j = 0, jj = code.length; j < jj; j++) {
  8923. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  8924. }
  8925. } else {
  8926. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  8927. for (j = start; j <= code; j++) {
  8928. glyphsVMetrics[j] = vmetric;
  8929. }
  8930. }
  8931. }
  8932. }
  8933. }
  8934. } else {
  8935. const firstChar = properties.firstChar;
  8936. widths = dict.get("Widths");
  8937. if (widths) {
  8938. j = firstChar;
  8939. for (i = 0, ii = widths.length; i < ii; i++) {
  8940. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  8941. }
  8942. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  8943. } else {
  8944. const baseFontName = dict.get("BaseFont");
  8945. if ((0, _primitives.isName)(baseFontName)) {
  8946. const metrics = this.getBaseFontMetrics(baseFontName.name);
  8947. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  8948. defaultWidth = metrics.defaultWidth;
  8949. }
  8950. }
  8951. }
  8952. let isMonospace = true;
  8953. let firstWidth = defaultWidth;
  8954. for (const glyph in glyphsWidths) {
  8955. const glyphWidth = glyphsWidths[glyph];
  8956. if (!glyphWidth) {
  8957. continue;
  8958. }
  8959. if (!firstWidth) {
  8960. firstWidth = glyphWidth;
  8961. continue;
  8962. }
  8963. if (firstWidth !== glyphWidth) {
  8964. isMonospace = false;
  8965. break;
  8966. }
  8967. }
  8968. if (isMonospace) {
  8969. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  8970. }
  8971. properties.defaultWidth = defaultWidth;
  8972. properties.widths = glyphsWidths;
  8973. properties.defaultVMetrics = defaultVMetrics;
  8974. properties.vmetrics = glyphsVMetrics;
  8975. }
  8976. isSerifFont(baseFontName) {
  8977. const fontNameWoStyle = baseFontName.split("-")[0];
  8978. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  8979. }
  8980. getBaseFontMetrics(name) {
  8981. let defaultWidth = 0;
  8982. let widths = Object.create(null);
  8983. let monospace = false;
  8984. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  8985. let lookupName = stdFontMap[name] || name;
  8986. const Metrics = (0, _metrics.getMetrics)();
  8987. if (!(lookupName in Metrics)) {
  8988. if (this.isSerifFont(name)) {
  8989. lookupName = "Times-Roman";
  8990. } else {
  8991. lookupName = "Helvetica";
  8992. }
  8993. }
  8994. const glyphWidths = Metrics[lookupName];
  8995. if ((0, _util.isNum)(glyphWidths)) {
  8996. defaultWidth = glyphWidths;
  8997. monospace = true;
  8998. } else {
  8999. widths = glyphWidths();
  9000. }
  9001. return {
  9002. defaultWidth,
  9003. monospace,
  9004. widths
  9005. };
  9006. }
  9007. buildCharCodeToWidth(widthsByGlyphName, properties) {
  9008. const widths = Object.create(null);
  9009. const differences = properties.differences;
  9010. const encoding = properties.defaultEncoding;
  9011. for (let charCode = 0; charCode < 256; charCode++) {
  9012. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  9013. widths[charCode] = widthsByGlyphName[differences[charCode]];
  9014. continue;
  9015. }
  9016. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  9017. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  9018. continue;
  9019. }
  9020. }
  9021. return widths;
  9022. }
  9023. preEvaluateFont(dict) {
  9024. const baseDict = dict;
  9025. let type = dict.get("Subtype");
  9026. if (!(0, _primitives.isName)(type)) {
  9027. throw new _util.FormatError("invalid font Subtype");
  9028. }
  9029. let composite = false;
  9030. let hash, toUnicode;
  9031. if (type.name === "Type0") {
  9032. const df = dict.get("DescendantFonts");
  9033. if (!df) {
  9034. throw new _util.FormatError("Descendant fonts are not specified");
  9035. }
  9036. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  9037. if (!(dict instanceof _primitives.Dict)) {
  9038. throw new _util.FormatError("Descendant font is not a dictionary.");
  9039. }
  9040. type = dict.get("Subtype");
  9041. if (!(0, _primitives.isName)(type)) {
  9042. throw new _util.FormatError("invalid font Subtype");
  9043. }
  9044. composite = true;
  9045. }
  9046. const firstChar = dict.get("FirstChar") || 0,
  9047. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  9048. const descriptor = dict.get("FontDescriptor");
  9049. if (descriptor) {
  9050. hash = new _murmurhash.MurmurHash3_64();
  9051. const encoding = baseDict.getRaw("Encoding");
  9052. if ((0, _primitives.isName)(encoding)) {
  9053. hash.update(encoding.name);
  9054. } else if ((0, _primitives.isRef)(encoding)) {
  9055. hash.update(encoding.toString());
  9056. } else if ((0, _primitives.isDict)(encoding)) {
  9057. for (const entry of encoding.getRawValues()) {
  9058. if ((0, _primitives.isName)(entry)) {
  9059. hash.update(entry.name);
  9060. } else if ((0, _primitives.isRef)(entry)) {
  9061. hash.update(entry.toString());
  9062. } else if (Array.isArray(entry)) {
  9063. const diffLength = entry.length,
  9064. diffBuf = new Array(diffLength);
  9065. for (let j = 0; j < diffLength; j++) {
  9066. const diffEntry = entry[j];
  9067. if ((0, _primitives.isName)(diffEntry)) {
  9068. diffBuf[j] = diffEntry.name;
  9069. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  9070. diffBuf[j] = diffEntry.toString();
  9071. }
  9072. }
  9073. hash.update(diffBuf.join());
  9074. }
  9075. }
  9076. }
  9077. hash.update(`${firstChar}-${lastChar}`);
  9078. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  9079. if ((0, _primitives.isStream)(toUnicode)) {
  9080. const stream = toUnicode.str || toUnicode;
  9081. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  9082. hash.update(uint8array);
  9083. } else if ((0, _primitives.isName)(toUnicode)) {
  9084. hash.update(toUnicode.name);
  9085. }
  9086. const widths = dict.get("Widths") || baseDict.get("Widths");
  9087. if (Array.isArray(widths)) {
  9088. const widthsBuf = [];
  9089. for (const entry of widths) {
  9090. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  9091. widthsBuf.push(entry.toString());
  9092. }
  9093. }
  9094. hash.update(widthsBuf.join());
  9095. }
  9096. if (composite) {
  9097. hash.update("compositeFont");
  9098. const compositeWidths = dict.get("W") || baseDict.get("W");
  9099. if (Array.isArray(compositeWidths)) {
  9100. const widthsBuf = [];
  9101. for (const entry of compositeWidths) {
  9102. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  9103. widthsBuf.push(entry.toString());
  9104. } else if (Array.isArray(entry)) {
  9105. const subWidthsBuf = [];
  9106. for (const element of entry) {
  9107. if ((0, _util.isNum)(element) || (0, _primitives.isRef)(element)) {
  9108. subWidthsBuf.push(element.toString());
  9109. }
  9110. }
  9111. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  9112. }
  9113. }
  9114. hash.update(widthsBuf.join());
  9115. }
  9116. }
  9117. }
  9118. return {
  9119. descriptor,
  9120. dict,
  9121. baseDict,
  9122. composite,
  9123. type: type.name,
  9124. firstChar,
  9125. lastChar,
  9126. toUnicode,
  9127. hash: hash ? hash.hexdigest() : ""
  9128. };
  9129. }
  9130. async translateFont({
  9131. descriptor,
  9132. dict,
  9133. baseDict,
  9134. composite,
  9135. type,
  9136. firstChar,
  9137. lastChar,
  9138. toUnicode,
  9139. cssFontInfo
  9140. }) {
  9141. const isType3Font = type === "Type3";
  9142. let properties;
  9143. if (!descriptor) {
  9144. if (isType3Font) {
  9145. descriptor = new _primitives.Dict(null);
  9146. descriptor.set("FontName", _primitives.Name.get(type));
  9147. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  9148. } else {
  9149. let baseFontName = dict.get("BaseFont");
  9150. if (!(0, _primitives.isName)(baseFontName)) {
  9151. throw new _util.FormatError("Base font is not specified");
  9152. }
  9153. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  9154. const metrics = this.getBaseFontMetrics(baseFontName);
  9155. const fontNameWoStyle = baseFontName.split("-")[0];
  9156. 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);
  9157. properties = {
  9158. type,
  9159. name: baseFontName,
  9160. widths: metrics.widths,
  9161. defaultWidth: metrics.defaultWidth,
  9162. flags,
  9163. firstChar,
  9164. lastChar,
  9165. toUnicode,
  9166. isType3Font
  9167. };
  9168. const widths = dict.get("Widths");
  9169. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  9170. if (widths) {
  9171. const glyphWidths = [];
  9172. let j = firstChar;
  9173. for (let i = 0, ii = widths.length; i < ii; i++) {
  9174. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  9175. }
  9176. newProperties.widths = glyphWidths;
  9177. } else {
  9178. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  9179. }
  9180. return new _fonts.Font(baseFontName, null, newProperties);
  9181. });
  9182. }
  9183. }
  9184. let fontName = descriptor.get("FontName");
  9185. let baseFont = dict.get("BaseFont");
  9186. if ((0, _util.isString)(fontName)) {
  9187. fontName = _primitives.Name.get(fontName);
  9188. }
  9189. if ((0, _util.isString)(baseFont)) {
  9190. baseFont = _primitives.Name.get(baseFont);
  9191. }
  9192. if (!isType3Font) {
  9193. const fontNameStr = fontName && fontName.name;
  9194. const baseFontStr = baseFont && baseFont.name;
  9195. if (fontNameStr !== baseFontStr) {
  9196. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  9197. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  9198. fontName = baseFont;
  9199. }
  9200. }
  9201. }
  9202. fontName = fontName || baseFont;
  9203. if (!(0, _primitives.isName)(fontName)) {
  9204. throw new _util.FormatError("invalid font name");
  9205. }
  9206. let fontFile, subtype, length1, length2, length3;
  9207. try {
  9208. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  9209. } catch (ex) {
  9210. if (!this.options.ignoreErrors) {
  9211. throw ex;
  9212. }
  9213. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  9214. fontFile = new _stream.NullStream();
  9215. }
  9216. if (fontFile) {
  9217. if (fontFile.dict) {
  9218. const subtypeEntry = fontFile.dict.get("Subtype");
  9219. if (subtypeEntry instanceof _primitives.Name) {
  9220. subtype = subtypeEntry.name;
  9221. }
  9222. length1 = fontFile.dict.get("Length1");
  9223. length2 = fontFile.dict.get("Length2");
  9224. length3 = fontFile.dict.get("Length3");
  9225. }
  9226. }
  9227. properties = {
  9228. type,
  9229. name: fontName.name,
  9230. subtype,
  9231. file: fontFile,
  9232. length1,
  9233. length2,
  9234. length3,
  9235. loadedName: baseDict.loadedName,
  9236. composite,
  9237. fixedPitch: false,
  9238. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  9239. firstChar,
  9240. lastChar,
  9241. toUnicode,
  9242. bbox: descriptor.getArray("FontBBox"),
  9243. ascent: descriptor.get("Ascent"),
  9244. descent: descriptor.get("Descent"),
  9245. xHeight: descriptor.get("XHeight"),
  9246. capHeight: descriptor.get("CapHeight"),
  9247. flags: descriptor.get("Flags"),
  9248. italicAngle: descriptor.get("ItalicAngle"),
  9249. isType3Font,
  9250. cssFontInfo
  9251. };
  9252. if (composite) {
  9253. const cidEncoding = baseDict.get("Encoding");
  9254. if ((0, _primitives.isName)(cidEncoding)) {
  9255. properties.cidEncoding = cidEncoding.name;
  9256. }
  9257. const cMap = await _cmap.CMapFactory.create({
  9258. encoding: cidEncoding,
  9259. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  9260. useCMap: null
  9261. });
  9262. properties.cMap = cMap;
  9263. properties.vertical = properties.cMap.vertical;
  9264. }
  9265. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  9266. this.extractWidths(dict, descriptor, newProperties);
  9267. return new _fonts.Font(fontName.name, fontFile, newProperties);
  9268. });
  9269. }
  9270. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  9271. function buildPath(fontChar) {
  9272. const glyphName = `${font.loadedName}_path_${fontChar}`;
  9273. try {
  9274. if (font.renderer.hasBuiltPath(fontChar)) {
  9275. return;
  9276. }
  9277. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  9278. } catch (reason) {
  9279. if (evaluatorOptions.ignoreErrors) {
  9280. handler.send("UnsupportedFeature", {
  9281. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  9282. });
  9283. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  9284. return;
  9285. }
  9286. throw reason;
  9287. }
  9288. }
  9289. for (const glyph of glyphs) {
  9290. buildPath(glyph.fontChar);
  9291. const accent = glyph.accent;
  9292. if (accent && accent.fontChar) {
  9293. buildPath(accent.fontChar);
  9294. }
  9295. }
  9296. }
  9297. static get fallbackFontDict() {
  9298. const dict = new _primitives.Dict();
  9299. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  9300. dict.set("Type", _primitives.Name.get("FallbackType"));
  9301. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9302. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9303. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9304. }
  9305. }
  9306. exports.PartialEvaluator = PartialEvaluator;
  9307. class TranslatedFont {
  9308. constructor({
  9309. loadedName,
  9310. font,
  9311. dict,
  9312. evaluatorOptions
  9313. }) {
  9314. this.loadedName = loadedName;
  9315. this.font = font;
  9316. this.dict = dict;
  9317. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  9318. this.type3Loaded = null;
  9319. this.type3Dependencies = font.isType3Font ? new Set() : null;
  9320. this.sent = false;
  9321. }
  9322. send(handler) {
  9323. if (this.sent) {
  9324. return;
  9325. }
  9326. this.sent = true;
  9327. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  9328. }
  9329. fallback(handler) {
  9330. if (!this.font.data) {
  9331. return;
  9332. }
  9333. this.font.disableFontFace = true;
  9334. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  9335. }
  9336. loadType3Data(evaluator, resources, task) {
  9337. if (this.type3Loaded) {
  9338. return this.type3Loaded;
  9339. }
  9340. if (!this.font.isType3Font) {
  9341. throw new Error("Must be a Type3 font.");
  9342. }
  9343. const type3Options = Object.create(evaluator.options);
  9344. type3Options.ignoreErrors = false;
  9345. const type3Evaluator = evaluator.clone(type3Options);
  9346. type3Evaluator.parsingType3Font = true;
  9347. const translatedFont = this.font,
  9348. type3Dependencies = this.type3Dependencies;
  9349. let loadCharProcsPromise = Promise.resolve();
  9350. const charProcs = this.dict.get("CharProcs");
  9351. const fontResources = this.dict.get("Resources") || resources;
  9352. const charProcOperatorList = Object.create(null);
  9353. for (const key of charProcs.getKeys()) {
  9354. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  9355. const glyphStream = charProcs.get(key);
  9356. const operatorList = new _operator_list.OperatorList();
  9357. return type3Evaluator.getOperatorList({
  9358. stream: glyphStream,
  9359. task,
  9360. resources: fontResources,
  9361. operatorList
  9362. }).then(() => {
  9363. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  9364. this._removeType3ColorOperators(operatorList);
  9365. }
  9366. charProcOperatorList[key] = operatorList.getIR();
  9367. for (const dependency of operatorList.dependencies) {
  9368. type3Dependencies.add(dependency);
  9369. }
  9370. }).catch(function (reason) {
  9371. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  9372. const dummyOperatorList = new _operator_list.OperatorList();
  9373. charProcOperatorList[key] = dummyOperatorList.getIR();
  9374. });
  9375. });
  9376. }
  9377. this.type3Loaded = loadCharProcsPromise.then(function () {
  9378. translatedFont.charProcOperatorList = charProcOperatorList;
  9379. });
  9380. return this.type3Loaded;
  9381. }
  9382. _removeType3ColorOperators(operatorList) {
  9383. let i = 1,
  9384. ii = operatorList.length;
  9385. while (i < ii) {
  9386. switch (operatorList.fnArray[i]) {
  9387. case _util.OPS.setStrokeColorSpace:
  9388. case _util.OPS.setFillColorSpace:
  9389. case _util.OPS.setStrokeColor:
  9390. case _util.OPS.setStrokeColorN:
  9391. case _util.OPS.setFillColor:
  9392. case _util.OPS.setFillColorN:
  9393. case _util.OPS.setStrokeGray:
  9394. case _util.OPS.setFillGray:
  9395. case _util.OPS.setStrokeRGBColor:
  9396. case _util.OPS.setFillRGBColor:
  9397. case _util.OPS.setStrokeCMYKColor:
  9398. case _util.OPS.setFillCMYKColor:
  9399. case _util.OPS.shadingFill:
  9400. case _util.OPS.setRenderingIntent:
  9401. operatorList.fnArray.splice(i, 1);
  9402. operatorList.argsArray.splice(i, 1);
  9403. ii--;
  9404. continue;
  9405. case _util.OPS.setGState:
  9406. const [gStateObj] = operatorList.argsArray[i];
  9407. let j = 0,
  9408. jj = gStateObj.length;
  9409. while (j < jj) {
  9410. const [gStateKey] = gStateObj[j];
  9411. switch (gStateKey) {
  9412. case "TR":
  9413. case "TR2":
  9414. case "HT":
  9415. case "BG":
  9416. case "BG2":
  9417. case "UCR":
  9418. case "UCR2":
  9419. gStateObj.splice(j, 1);
  9420. jj--;
  9421. continue;
  9422. }
  9423. j++;
  9424. }
  9425. break;
  9426. }
  9427. i++;
  9428. }
  9429. }
  9430. }
  9431. class StateManager {
  9432. constructor(initialState = new EvalState()) {
  9433. this.state = initialState;
  9434. this.stateStack = [];
  9435. }
  9436. save() {
  9437. const old = this.state;
  9438. this.stateStack.push(this.state);
  9439. this.state = old.clone();
  9440. }
  9441. restore() {
  9442. const prev = this.stateStack.pop();
  9443. if (prev) {
  9444. this.state = prev;
  9445. }
  9446. }
  9447. transform(args) {
  9448. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  9449. }
  9450. }
  9451. class TextState {
  9452. constructor() {
  9453. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  9454. this.fontName = null;
  9455. this.fontSize = 0;
  9456. this.font = null;
  9457. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  9458. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  9459. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  9460. this.charSpacing = 0;
  9461. this.wordSpacing = 0;
  9462. this.leading = 0;
  9463. this.textHScale = 1;
  9464. this.textRise = 0;
  9465. }
  9466. setTextMatrix(a, b, c, d, e, f) {
  9467. const m = this.textMatrix;
  9468. m[0] = a;
  9469. m[1] = b;
  9470. m[2] = c;
  9471. m[3] = d;
  9472. m[4] = e;
  9473. m[5] = f;
  9474. }
  9475. setTextLineMatrix(a, b, c, d, e, f) {
  9476. const m = this.textLineMatrix;
  9477. m[0] = a;
  9478. m[1] = b;
  9479. m[2] = c;
  9480. m[3] = d;
  9481. m[4] = e;
  9482. m[5] = f;
  9483. }
  9484. translateTextMatrix(x, y) {
  9485. const m = this.textMatrix;
  9486. m[4] = m[0] * x + m[2] * y + m[4];
  9487. m[5] = m[1] * x + m[3] * y + m[5];
  9488. }
  9489. translateTextLineMatrix(x, y) {
  9490. const m = this.textLineMatrix;
  9491. m[4] = m[0] * x + m[2] * y + m[4];
  9492. m[5] = m[1] * x + m[3] * y + m[5];
  9493. }
  9494. carriageReturn() {
  9495. this.translateTextLineMatrix(0, -this.leading);
  9496. this.textMatrix = this.textLineMatrix.slice();
  9497. }
  9498. clone() {
  9499. const clone = Object.create(this);
  9500. clone.textMatrix = this.textMatrix.slice();
  9501. clone.textLineMatrix = this.textLineMatrix.slice();
  9502. clone.fontMatrix = this.fontMatrix.slice();
  9503. return clone;
  9504. }
  9505. }
  9506. class EvalState {
  9507. constructor() {
  9508. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  9509. this.font = null;
  9510. this.textRenderingMode = _util.TextRenderingMode.FILL;
  9511. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9512. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9513. }
  9514. clone() {
  9515. return Object.create(this);
  9516. }
  9517. }
  9518. class EvaluatorPreprocessor {
  9519. static get opMap() {
  9520. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  9521. t.w = {
  9522. id: _util.OPS.setLineWidth,
  9523. numArgs: 1,
  9524. variableArgs: false
  9525. };
  9526. t.J = {
  9527. id: _util.OPS.setLineCap,
  9528. numArgs: 1,
  9529. variableArgs: false
  9530. };
  9531. t.j = {
  9532. id: _util.OPS.setLineJoin,
  9533. numArgs: 1,
  9534. variableArgs: false
  9535. };
  9536. t.M = {
  9537. id: _util.OPS.setMiterLimit,
  9538. numArgs: 1,
  9539. variableArgs: false
  9540. };
  9541. t.d = {
  9542. id: _util.OPS.setDash,
  9543. numArgs: 2,
  9544. variableArgs: false
  9545. };
  9546. t.ri = {
  9547. id: _util.OPS.setRenderingIntent,
  9548. numArgs: 1,
  9549. variableArgs: false
  9550. };
  9551. t.i = {
  9552. id: _util.OPS.setFlatness,
  9553. numArgs: 1,
  9554. variableArgs: false
  9555. };
  9556. t.gs = {
  9557. id: _util.OPS.setGState,
  9558. numArgs: 1,
  9559. variableArgs: false
  9560. };
  9561. t.q = {
  9562. id: _util.OPS.save,
  9563. numArgs: 0,
  9564. variableArgs: false
  9565. };
  9566. t.Q = {
  9567. id: _util.OPS.restore,
  9568. numArgs: 0,
  9569. variableArgs: false
  9570. };
  9571. t.cm = {
  9572. id: _util.OPS.transform,
  9573. numArgs: 6,
  9574. variableArgs: false
  9575. };
  9576. t.m = {
  9577. id: _util.OPS.moveTo,
  9578. numArgs: 2,
  9579. variableArgs: false
  9580. };
  9581. t.l = {
  9582. id: _util.OPS.lineTo,
  9583. numArgs: 2,
  9584. variableArgs: false
  9585. };
  9586. t.c = {
  9587. id: _util.OPS.curveTo,
  9588. numArgs: 6,
  9589. variableArgs: false
  9590. };
  9591. t.v = {
  9592. id: _util.OPS.curveTo2,
  9593. numArgs: 4,
  9594. variableArgs: false
  9595. };
  9596. t.y = {
  9597. id: _util.OPS.curveTo3,
  9598. numArgs: 4,
  9599. variableArgs: false
  9600. };
  9601. t.h = {
  9602. id: _util.OPS.closePath,
  9603. numArgs: 0,
  9604. variableArgs: false
  9605. };
  9606. t.re = {
  9607. id: _util.OPS.rectangle,
  9608. numArgs: 4,
  9609. variableArgs: false
  9610. };
  9611. t.S = {
  9612. id: _util.OPS.stroke,
  9613. numArgs: 0,
  9614. variableArgs: false
  9615. };
  9616. t.s = {
  9617. id: _util.OPS.closeStroke,
  9618. numArgs: 0,
  9619. variableArgs: false
  9620. };
  9621. t.f = {
  9622. id: _util.OPS.fill,
  9623. numArgs: 0,
  9624. variableArgs: false
  9625. };
  9626. t.F = {
  9627. id: _util.OPS.fill,
  9628. numArgs: 0,
  9629. variableArgs: false
  9630. };
  9631. t["f*"] = {
  9632. id: _util.OPS.eoFill,
  9633. numArgs: 0,
  9634. variableArgs: false
  9635. };
  9636. t.B = {
  9637. id: _util.OPS.fillStroke,
  9638. numArgs: 0,
  9639. variableArgs: false
  9640. };
  9641. t["B*"] = {
  9642. id: _util.OPS.eoFillStroke,
  9643. numArgs: 0,
  9644. variableArgs: false
  9645. };
  9646. t.b = {
  9647. id: _util.OPS.closeFillStroke,
  9648. numArgs: 0,
  9649. variableArgs: false
  9650. };
  9651. t["b*"] = {
  9652. id: _util.OPS.closeEOFillStroke,
  9653. numArgs: 0,
  9654. variableArgs: false
  9655. };
  9656. t.n = {
  9657. id: _util.OPS.endPath,
  9658. numArgs: 0,
  9659. variableArgs: false
  9660. };
  9661. t.W = {
  9662. id: _util.OPS.clip,
  9663. numArgs: 0,
  9664. variableArgs: false
  9665. };
  9666. t["W*"] = {
  9667. id: _util.OPS.eoClip,
  9668. numArgs: 0,
  9669. variableArgs: false
  9670. };
  9671. t.BT = {
  9672. id: _util.OPS.beginText,
  9673. numArgs: 0,
  9674. variableArgs: false
  9675. };
  9676. t.ET = {
  9677. id: _util.OPS.endText,
  9678. numArgs: 0,
  9679. variableArgs: false
  9680. };
  9681. t.Tc = {
  9682. id: _util.OPS.setCharSpacing,
  9683. numArgs: 1,
  9684. variableArgs: false
  9685. };
  9686. t.Tw = {
  9687. id: _util.OPS.setWordSpacing,
  9688. numArgs: 1,
  9689. variableArgs: false
  9690. };
  9691. t.Tz = {
  9692. id: _util.OPS.setHScale,
  9693. numArgs: 1,
  9694. variableArgs: false
  9695. };
  9696. t.TL = {
  9697. id: _util.OPS.setLeading,
  9698. numArgs: 1,
  9699. variableArgs: false
  9700. };
  9701. t.Tf = {
  9702. id: _util.OPS.setFont,
  9703. numArgs: 2,
  9704. variableArgs: false
  9705. };
  9706. t.Tr = {
  9707. id: _util.OPS.setTextRenderingMode,
  9708. numArgs: 1,
  9709. variableArgs: false
  9710. };
  9711. t.Ts = {
  9712. id: _util.OPS.setTextRise,
  9713. numArgs: 1,
  9714. variableArgs: false
  9715. };
  9716. t.Td = {
  9717. id: _util.OPS.moveText,
  9718. numArgs: 2,
  9719. variableArgs: false
  9720. };
  9721. t.TD = {
  9722. id: _util.OPS.setLeadingMoveText,
  9723. numArgs: 2,
  9724. variableArgs: false
  9725. };
  9726. t.Tm = {
  9727. id: _util.OPS.setTextMatrix,
  9728. numArgs: 6,
  9729. variableArgs: false
  9730. };
  9731. t["T*"] = {
  9732. id: _util.OPS.nextLine,
  9733. numArgs: 0,
  9734. variableArgs: false
  9735. };
  9736. t.Tj = {
  9737. id: _util.OPS.showText,
  9738. numArgs: 1,
  9739. variableArgs: false
  9740. };
  9741. t.TJ = {
  9742. id: _util.OPS.showSpacedText,
  9743. numArgs: 1,
  9744. variableArgs: false
  9745. };
  9746. t["'"] = {
  9747. id: _util.OPS.nextLineShowText,
  9748. numArgs: 1,
  9749. variableArgs: false
  9750. };
  9751. t['"'] = {
  9752. id: _util.OPS.nextLineSetSpacingShowText,
  9753. numArgs: 3,
  9754. variableArgs: false
  9755. };
  9756. t.d0 = {
  9757. id: _util.OPS.setCharWidth,
  9758. numArgs: 2,
  9759. variableArgs: false
  9760. };
  9761. t.d1 = {
  9762. id: _util.OPS.setCharWidthAndBounds,
  9763. numArgs: 6,
  9764. variableArgs: false
  9765. };
  9766. t.CS = {
  9767. id: _util.OPS.setStrokeColorSpace,
  9768. numArgs: 1,
  9769. variableArgs: false
  9770. };
  9771. t.cs = {
  9772. id: _util.OPS.setFillColorSpace,
  9773. numArgs: 1,
  9774. variableArgs: false
  9775. };
  9776. t.SC = {
  9777. id: _util.OPS.setStrokeColor,
  9778. numArgs: 4,
  9779. variableArgs: true
  9780. };
  9781. t.SCN = {
  9782. id: _util.OPS.setStrokeColorN,
  9783. numArgs: 33,
  9784. variableArgs: true
  9785. };
  9786. t.sc = {
  9787. id: _util.OPS.setFillColor,
  9788. numArgs: 4,
  9789. variableArgs: true
  9790. };
  9791. t.scn = {
  9792. id: _util.OPS.setFillColorN,
  9793. numArgs: 33,
  9794. variableArgs: true
  9795. };
  9796. t.G = {
  9797. id: _util.OPS.setStrokeGray,
  9798. numArgs: 1,
  9799. variableArgs: false
  9800. };
  9801. t.g = {
  9802. id: _util.OPS.setFillGray,
  9803. numArgs: 1,
  9804. variableArgs: false
  9805. };
  9806. t.RG = {
  9807. id: _util.OPS.setStrokeRGBColor,
  9808. numArgs: 3,
  9809. variableArgs: false
  9810. };
  9811. t.rg = {
  9812. id: _util.OPS.setFillRGBColor,
  9813. numArgs: 3,
  9814. variableArgs: false
  9815. };
  9816. t.K = {
  9817. id: _util.OPS.setStrokeCMYKColor,
  9818. numArgs: 4,
  9819. variableArgs: false
  9820. };
  9821. t.k = {
  9822. id: _util.OPS.setFillCMYKColor,
  9823. numArgs: 4,
  9824. variableArgs: false
  9825. };
  9826. t.sh = {
  9827. id: _util.OPS.shadingFill,
  9828. numArgs: 1,
  9829. variableArgs: false
  9830. };
  9831. t.BI = {
  9832. id: _util.OPS.beginInlineImage,
  9833. numArgs: 0,
  9834. variableArgs: false
  9835. };
  9836. t.ID = {
  9837. id: _util.OPS.beginImageData,
  9838. numArgs: 0,
  9839. variableArgs: false
  9840. };
  9841. t.EI = {
  9842. id: _util.OPS.endInlineImage,
  9843. numArgs: 1,
  9844. variableArgs: false
  9845. };
  9846. t.Do = {
  9847. id: _util.OPS.paintXObject,
  9848. numArgs: 1,
  9849. variableArgs: false
  9850. };
  9851. t.MP = {
  9852. id: _util.OPS.markPoint,
  9853. numArgs: 1,
  9854. variableArgs: false
  9855. };
  9856. t.DP = {
  9857. id: _util.OPS.markPointProps,
  9858. numArgs: 2,
  9859. variableArgs: false
  9860. };
  9861. t.BMC = {
  9862. id: _util.OPS.beginMarkedContent,
  9863. numArgs: 1,
  9864. variableArgs: false
  9865. };
  9866. t.BDC = {
  9867. id: _util.OPS.beginMarkedContentProps,
  9868. numArgs: 2,
  9869. variableArgs: false
  9870. };
  9871. t.EMC = {
  9872. id: _util.OPS.endMarkedContent,
  9873. numArgs: 0,
  9874. variableArgs: false
  9875. };
  9876. t.BX = {
  9877. id: _util.OPS.beginCompat,
  9878. numArgs: 0,
  9879. variableArgs: false
  9880. };
  9881. t.EX = {
  9882. id: _util.OPS.endCompat,
  9883. numArgs: 0,
  9884. variableArgs: false
  9885. };
  9886. t.BM = null;
  9887. t.BD = null;
  9888. t.true = null;
  9889. t.fa = null;
  9890. t.fal = null;
  9891. t.fals = null;
  9892. t.false = null;
  9893. t.nu = null;
  9894. t.nul = null;
  9895. t.null = null;
  9896. });
  9897. return (0, _util.shadow)(this, "opMap", getOPMap());
  9898. }
  9899. static get MAX_INVALID_PATH_OPS() {
  9900. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20);
  9901. }
  9902. constructor(stream, xref, stateManager = new StateManager()) {
  9903. this.parser = new _parser.Parser({
  9904. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  9905. xref
  9906. });
  9907. this.stateManager = stateManager;
  9908. this.nonProcessedArgs = [];
  9909. this._numInvalidPathOPS = 0;
  9910. }
  9911. get savedStatesDepth() {
  9912. return this.stateManager.stateStack.length;
  9913. }
  9914. read(operation) {
  9915. let args = operation.args;
  9916. while (true) {
  9917. const obj = this.parser.getObj();
  9918. if (obj instanceof _primitives.Cmd) {
  9919. const cmd = obj.cmd;
  9920. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  9921. if (!opSpec) {
  9922. (0, _util.warn)(`Unknown command "${cmd}".`);
  9923. continue;
  9924. }
  9925. const fn = opSpec.id;
  9926. const numArgs = opSpec.numArgs;
  9927. let argsLength = args !== null ? args.length : 0;
  9928. if (!opSpec.variableArgs) {
  9929. if (argsLength !== numArgs) {
  9930. const nonProcessedArgs = this.nonProcessedArgs;
  9931. while (argsLength > numArgs) {
  9932. nonProcessedArgs.push(args.shift());
  9933. argsLength--;
  9934. }
  9935. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  9936. if (args === null) {
  9937. args = [];
  9938. }
  9939. args.unshift(nonProcessedArgs.pop());
  9940. argsLength++;
  9941. }
  9942. }
  9943. if (argsLength < numArgs) {
  9944. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  9945. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  9946. throw new _util.FormatError(`Invalid ${partialMsg}`);
  9947. }
  9948. (0, _util.warn)(`Skipping ${partialMsg}`);
  9949. if (args !== null) {
  9950. args.length = 0;
  9951. }
  9952. continue;
  9953. }
  9954. } else if (argsLength > numArgs) {
  9955. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  9956. }
  9957. this.preprocessCommand(fn, args);
  9958. operation.fn = fn;
  9959. operation.args = args;
  9960. return true;
  9961. }
  9962. if (obj === _primitives.EOF) {
  9963. return false;
  9964. }
  9965. if (obj !== null) {
  9966. if (args === null) {
  9967. args = [];
  9968. }
  9969. args.push(obj);
  9970. if (args.length > 33) {
  9971. throw new _util.FormatError("Too many arguments");
  9972. }
  9973. }
  9974. }
  9975. }
  9976. preprocessCommand(fn, args) {
  9977. switch (fn | 0) {
  9978. case _util.OPS.save:
  9979. this.stateManager.save();
  9980. break;
  9981. case _util.OPS.restore:
  9982. this.stateManager.restore();
  9983. break;
  9984. case _util.OPS.transform:
  9985. this.stateManager.transform(args);
  9986. break;
  9987. }
  9988. }
  9989. }
  9990. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  9991. /***/ }),
  9992. /* 16 */
  9993. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9994. Object.defineProperty(exports, "__esModule", ({
  9995. value: true
  9996. }));
  9997. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  9998. var _util = __w_pdfjs_require__(2);
  9999. var _primitives = __w_pdfjs_require__(5);
  10000. var _parser = __w_pdfjs_require__(17);
  10001. var _core_utils = __w_pdfjs_require__(9);
  10002. var _stream = __w_pdfjs_require__(10);
  10003. 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"];
  10004. const MAX_MAP_RANGE = 2 ** 24 - 1;
  10005. class CMap {
  10006. constructor(builtInCMap = false) {
  10007. this.codespaceRanges = [[], [], [], []];
  10008. this.numCodespaceRanges = 0;
  10009. this._map = [];
  10010. this.name = "";
  10011. this.vertical = false;
  10012. this.useCMap = null;
  10013. this.builtInCMap = builtInCMap;
  10014. }
  10015. addCodespaceRange(n, low, high) {
  10016. this.codespaceRanges[n - 1].push(low, high);
  10017. this.numCodespaceRanges++;
  10018. }
  10019. mapCidRange(low, high, dstLow) {
  10020. if (high - low > MAX_MAP_RANGE) {
  10021. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  10022. }
  10023. while (low <= high) {
  10024. this._map[low++] = dstLow++;
  10025. }
  10026. }
  10027. mapBfRange(low, high, dstLow) {
  10028. if (high - low > MAX_MAP_RANGE) {
  10029. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  10030. }
  10031. const lastByte = dstLow.length - 1;
  10032. while (low <= high) {
  10033. this._map[low++] = dstLow;
  10034. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  10035. }
  10036. }
  10037. mapBfRangeToArray(low, high, array) {
  10038. if (high - low > MAX_MAP_RANGE) {
  10039. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  10040. }
  10041. const ii = array.length;
  10042. let i = 0;
  10043. while (low <= high && i < ii) {
  10044. this._map[low] = array[i++];
  10045. ++low;
  10046. }
  10047. }
  10048. mapOne(src, dst) {
  10049. this._map[src] = dst;
  10050. }
  10051. lookup(code) {
  10052. return this._map[code];
  10053. }
  10054. contains(code) {
  10055. return this._map[code] !== undefined;
  10056. }
  10057. forEach(callback) {
  10058. const map = this._map;
  10059. const length = map.length;
  10060. if (length <= 0x10000) {
  10061. for (let i = 0; i < length; i++) {
  10062. if (map[i] !== undefined) {
  10063. callback(i, map[i]);
  10064. }
  10065. }
  10066. } else {
  10067. for (const i in map) {
  10068. callback(i, map[i]);
  10069. }
  10070. }
  10071. }
  10072. charCodeOf(value) {
  10073. const map = this._map;
  10074. if (map.length <= 0x10000) {
  10075. return map.indexOf(value);
  10076. }
  10077. for (const charCode in map) {
  10078. if (map[charCode] === value) {
  10079. return charCode | 0;
  10080. }
  10081. }
  10082. return -1;
  10083. }
  10084. getMap() {
  10085. return this._map;
  10086. }
  10087. readCharCode(str, offset, out) {
  10088. let c = 0;
  10089. const codespaceRanges = this.codespaceRanges;
  10090. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  10091. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  10092. const codespaceRange = codespaceRanges[n];
  10093. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  10094. const low = codespaceRange[k++];
  10095. const high = codespaceRange[k++];
  10096. if (c >= low && c <= high) {
  10097. out.charcode = c;
  10098. out.length = n + 1;
  10099. return;
  10100. }
  10101. }
  10102. }
  10103. out.charcode = 0;
  10104. out.length = 1;
  10105. }
  10106. getCharCodeLength(charCode) {
  10107. const codespaceRanges = this.codespaceRanges;
  10108. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  10109. const codespaceRange = codespaceRanges[n];
  10110. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  10111. const low = codespaceRange[k++];
  10112. const high = codespaceRange[k++];
  10113. if (charCode >= low && charCode <= high) {
  10114. return n + 1;
  10115. }
  10116. }
  10117. }
  10118. return 1;
  10119. }
  10120. get length() {
  10121. return this._map.length;
  10122. }
  10123. get isIdentityCMap() {
  10124. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  10125. return false;
  10126. }
  10127. if (this._map.length !== 0x10000) {
  10128. return false;
  10129. }
  10130. for (let i = 0; i < 0x10000; i++) {
  10131. if (this._map[i] !== i) {
  10132. return false;
  10133. }
  10134. }
  10135. return true;
  10136. }
  10137. }
  10138. exports.CMap = CMap;
  10139. class IdentityCMap extends CMap {
  10140. constructor(vertical, n) {
  10141. super();
  10142. this.vertical = vertical;
  10143. this.addCodespaceRange(n, 0, 0xffff);
  10144. }
  10145. mapCidRange(low, high, dstLow) {
  10146. (0, _util.unreachable)("should not call mapCidRange");
  10147. }
  10148. mapBfRange(low, high, dstLow) {
  10149. (0, _util.unreachable)("should not call mapBfRange");
  10150. }
  10151. mapBfRangeToArray(low, high, array) {
  10152. (0, _util.unreachable)("should not call mapBfRangeToArray");
  10153. }
  10154. mapOne(src, dst) {
  10155. (0, _util.unreachable)("should not call mapCidOne");
  10156. }
  10157. lookup(code) {
  10158. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  10159. }
  10160. contains(code) {
  10161. return Number.isInteger(code) && code <= 0xffff;
  10162. }
  10163. forEach(callback) {
  10164. for (let i = 0; i <= 0xffff; i++) {
  10165. callback(i, i);
  10166. }
  10167. }
  10168. charCodeOf(value) {
  10169. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  10170. }
  10171. getMap() {
  10172. const map = new Array(0x10000);
  10173. for (let i = 0; i <= 0xffff; i++) {
  10174. map[i] = i;
  10175. }
  10176. return map;
  10177. }
  10178. get length() {
  10179. return 0x10000;
  10180. }
  10181. get isIdentityCMap() {
  10182. (0, _util.unreachable)("should not access .isIdentityCMap");
  10183. }
  10184. }
  10185. exports.IdentityCMap = IdentityCMap;
  10186. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  10187. function hexToInt(a, size) {
  10188. let n = 0;
  10189. for (let i = 0; i <= size; i++) {
  10190. n = n << 8 | a[i];
  10191. }
  10192. return n >>> 0;
  10193. }
  10194. function hexToStr(a, size) {
  10195. if (size === 1) {
  10196. return String.fromCharCode(a[0], a[1]);
  10197. }
  10198. if (size === 3) {
  10199. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  10200. }
  10201. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  10202. }
  10203. function addHex(a, b, size) {
  10204. let c = 0;
  10205. for (let i = size; i >= 0; i--) {
  10206. c += a[i] + b[i];
  10207. a[i] = c & 255;
  10208. c >>= 8;
  10209. }
  10210. }
  10211. function incHex(a, size) {
  10212. let c = 1;
  10213. for (let i = size; i >= 0 && c > 0; i--) {
  10214. c += a[i];
  10215. a[i] = c & 255;
  10216. c >>= 8;
  10217. }
  10218. }
  10219. const MAX_NUM_SIZE = 16;
  10220. const MAX_ENCODED_NUM_SIZE = 19;
  10221. class BinaryCMapStream {
  10222. constructor(data) {
  10223. this.buffer = data;
  10224. this.pos = 0;
  10225. this.end = data.length;
  10226. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  10227. }
  10228. readByte() {
  10229. if (this.pos >= this.end) {
  10230. return -1;
  10231. }
  10232. return this.buffer[this.pos++];
  10233. }
  10234. readNumber() {
  10235. let n = 0;
  10236. let last;
  10237. do {
  10238. const b = this.readByte();
  10239. if (b < 0) {
  10240. throw new _util.FormatError("unexpected EOF in bcmap");
  10241. }
  10242. last = !(b & 0x80);
  10243. n = n << 7 | b & 0x7f;
  10244. } while (!last);
  10245. return n;
  10246. }
  10247. readSigned() {
  10248. const n = this.readNumber();
  10249. return n & 1 ? ~(n >>> 1) : n >>> 1;
  10250. }
  10251. readHex(num, size) {
  10252. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  10253. this.pos += size + 1;
  10254. }
  10255. readHexNumber(num, size) {
  10256. let last;
  10257. const stack = this.tmpBuf;
  10258. let sp = 0;
  10259. do {
  10260. const b = this.readByte();
  10261. if (b < 0) {
  10262. throw new _util.FormatError("unexpected EOF in bcmap");
  10263. }
  10264. last = !(b & 0x80);
  10265. stack[sp++] = b & 0x7f;
  10266. } while (!last);
  10267. let i = size,
  10268. buffer = 0,
  10269. bufferSize = 0;
  10270. while (i >= 0) {
  10271. while (bufferSize < 8 && stack.length > 0) {
  10272. buffer = stack[--sp] << bufferSize | buffer;
  10273. bufferSize += 7;
  10274. }
  10275. num[i] = buffer & 255;
  10276. i--;
  10277. buffer >>= 8;
  10278. bufferSize -= 8;
  10279. }
  10280. }
  10281. readHexSigned(num, size) {
  10282. this.readHexNumber(num, size);
  10283. const sign = num[size] & 1 ? 255 : 0;
  10284. let c = 0;
  10285. for (let i = 0; i <= size; i++) {
  10286. c = (c & 1) << 8 | num[i];
  10287. num[i] = c >> 1 ^ sign;
  10288. }
  10289. }
  10290. readString() {
  10291. const len = this.readNumber();
  10292. let s = "";
  10293. for (let i = 0; i < len; i++) {
  10294. s += String.fromCharCode(this.readNumber());
  10295. }
  10296. return s;
  10297. }
  10298. }
  10299. class BinaryCMapReader {
  10300. async process(data, cMap, extend) {
  10301. const stream = new BinaryCMapStream(data);
  10302. const header = stream.readByte();
  10303. cMap.vertical = !!(header & 1);
  10304. let useCMap = null;
  10305. const start = new Uint8Array(MAX_NUM_SIZE);
  10306. const end = new Uint8Array(MAX_NUM_SIZE);
  10307. const char = new Uint8Array(MAX_NUM_SIZE);
  10308. const charCode = new Uint8Array(MAX_NUM_SIZE);
  10309. const tmp = new Uint8Array(MAX_NUM_SIZE);
  10310. let code;
  10311. let b;
  10312. while ((b = stream.readByte()) >= 0) {
  10313. const type = b >> 5;
  10314. if (type === 7) {
  10315. switch (b & 0x1f) {
  10316. case 0:
  10317. stream.readString();
  10318. break;
  10319. case 1:
  10320. useCMap = stream.readString();
  10321. break;
  10322. }
  10323. continue;
  10324. }
  10325. const sequence = !!(b & 0x10);
  10326. const dataSize = b & 15;
  10327. if (dataSize + 1 > MAX_NUM_SIZE) {
  10328. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  10329. }
  10330. const ucs2DataSize = 1;
  10331. const subitemsCount = stream.readNumber();
  10332. switch (type) {
  10333. case 0:
  10334. stream.readHex(start, dataSize);
  10335. stream.readHexNumber(end, dataSize);
  10336. addHex(end, start, dataSize);
  10337. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  10338. for (let i = 1; i < subitemsCount; i++) {
  10339. incHex(end, dataSize);
  10340. stream.readHexNumber(start, dataSize);
  10341. addHex(start, end, dataSize);
  10342. stream.readHexNumber(end, dataSize);
  10343. addHex(end, start, dataSize);
  10344. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  10345. }
  10346. break;
  10347. case 1:
  10348. stream.readHex(start, dataSize);
  10349. stream.readHexNumber(end, dataSize);
  10350. addHex(end, start, dataSize);
  10351. stream.readNumber();
  10352. for (let i = 1; i < subitemsCount; i++) {
  10353. incHex(end, dataSize);
  10354. stream.readHexNumber(start, dataSize);
  10355. addHex(start, end, dataSize);
  10356. stream.readHexNumber(end, dataSize);
  10357. addHex(end, start, dataSize);
  10358. stream.readNumber();
  10359. }
  10360. break;
  10361. case 2:
  10362. stream.readHex(char, dataSize);
  10363. code = stream.readNumber();
  10364. cMap.mapOne(hexToInt(char, dataSize), code);
  10365. for (let i = 1; i < subitemsCount; i++) {
  10366. incHex(char, dataSize);
  10367. if (!sequence) {
  10368. stream.readHexNumber(tmp, dataSize);
  10369. addHex(char, tmp, dataSize);
  10370. }
  10371. code = stream.readSigned() + (code + 1);
  10372. cMap.mapOne(hexToInt(char, dataSize), code);
  10373. }
  10374. break;
  10375. case 3:
  10376. stream.readHex(start, dataSize);
  10377. stream.readHexNumber(end, dataSize);
  10378. addHex(end, start, dataSize);
  10379. code = stream.readNumber();
  10380. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  10381. for (let i = 1; i < subitemsCount; i++) {
  10382. incHex(end, dataSize);
  10383. if (!sequence) {
  10384. stream.readHexNumber(start, dataSize);
  10385. addHex(start, end, dataSize);
  10386. } else {
  10387. start.set(end);
  10388. }
  10389. stream.readHexNumber(end, dataSize);
  10390. addHex(end, start, dataSize);
  10391. code = stream.readNumber();
  10392. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  10393. }
  10394. break;
  10395. case 4:
  10396. stream.readHex(char, ucs2DataSize);
  10397. stream.readHex(charCode, dataSize);
  10398. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  10399. for (let i = 1; i < subitemsCount; i++) {
  10400. incHex(char, ucs2DataSize);
  10401. if (!sequence) {
  10402. stream.readHexNumber(tmp, ucs2DataSize);
  10403. addHex(char, tmp, ucs2DataSize);
  10404. }
  10405. incHex(charCode, dataSize);
  10406. stream.readHexSigned(tmp, dataSize);
  10407. addHex(charCode, tmp, dataSize);
  10408. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  10409. }
  10410. break;
  10411. case 5:
  10412. stream.readHex(start, ucs2DataSize);
  10413. stream.readHexNumber(end, ucs2DataSize);
  10414. addHex(end, start, ucs2DataSize);
  10415. stream.readHex(charCode, dataSize);
  10416. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  10417. for (let i = 1; i < subitemsCount; i++) {
  10418. incHex(end, ucs2DataSize);
  10419. if (!sequence) {
  10420. stream.readHexNumber(start, ucs2DataSize);
  10421. addHex(start, end, ucs2DataSize);
  10422. } else {
  10423. start.set(end);
  10424. }
  10425. stream.readHexNumber(end, ucs2DataSize);
  10426. addHex(end, start, ucs2DataSize);
  10427. stream.readHex(charCode, dataSize);
  10428. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  10429. }
  10430. break;
  10431. default:
  10432. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  10433. }
  10434. }
  10435. if (useCMap) {
  10436. return extend(useCMap);
  10437. }
  10438. return cMap;
  10439. }
  10440. }
  10441. return BinaryCMapReader;
  10442. }();
  10443. const CMapFactory = function CMapFactoryClosure() {
  10444. function strToInt(str) {
  10445. let a = 0;
  10446. for (let i = 0; i < str.length; i++) {
  10447. a = a << 8 | str.charCodeAt(i);
  10448. }
  10449. return a >>> 0;
  10450. }
  10451. function expectString(obj) {
  10452. if (!(0, _util.isString)(obj)) {
  10453. throw new _util.FormatError("Malformed CMap: expected string.");
  10454. }
  10455. }
  10456. function expectInt(obj) {
  10457. if (!Number.isInteger(obj)) {
  10458. throw new _util.FormatError("Malformed CMap: expected int.");
  10459. }
  10460. }
  10461. function parseBfChar(cMap, lexer) {
  10462. while (true) {
  10463. let obj = lexer.getObj();
  10464. if ((0, _primitives.isEOF)(obj)) {
  10465. break;
  10466. }
  10467. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  10468. return;
  10469. }
  10470. expectString(obj);
  10471. const src = strToInt(obj);
  10472. obj = lexer.getObj();
  10473. expectString(obj);
  10474. const dst = obj;
  10475. cMap.mapOne(src, dst);
  10476. }
  10477. }
  10478. function parseBfRange(cMap, lexer) {
  10479. while (true) {
  10480. let obj = lexer.getObj();
  10481. if ((0, _primitives.isEOF)(obj)) {
  10482. break;
  10483. }
  10484. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  10485. return;
  10486. }
  10487. expectString(obj);
  10488. const low = strToInt(obj);
  10489. obj = lexer.getObj();
  10490. expectString(obj);
  10491. const high = strToInt(obj);
  10492. obj = lexer.getObj();
  10493. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  10494. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  10495. cMap.mapBfRange(low, high, dstLow);
  10496. } else if ((0, _primitives.isCmd)(obj, "[")) {
  10497. obj = lexer.getObj();
  10498. const array = [];
  10499. while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
  10500. array.push(obj);
  10501. obj = lexer.getObj();
  10502. }
  10503. cMap.mapBfRangeToArray(low, high, array);
  10504. } else {
  10505. break;
  10506. }
  10507. }
  10508. throw new _util.FormatError("Invalid bf range.");
  10509. }
  10510. function parseCidChar(cMap, lexer) {
  10511. while (true) {
  10512. let obj = lexer.getObj();
  10513. if ((0, _primitives.isEOF)(obj)) {
  10514. break;
  10515. }
  10516. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  10517. return;
  10518. }
  10519. expectString(obj);
  10520. const src = strToInt(obj);
  10521. obj = lexer.getObj();
  10522. expectInt(obj);
  10523. const dst = obj;
  10524. cMap.mapOne(src, dst);
  10525. }
  10526. }
  10527. function parseCidRange(cMap, lexer) {
  10528. while (true) {
  10529. let obj = lexer.getObj();
  10530. if ((0, _primitives.isEOF)(obj)) {
  10531. break;
  10532. }
  10533. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  10534. return;
  10535. }
  10536. expectString(obj);
  10537. const low = strToInt(obj);
  10538. obj = lexer.getObj();
  10539. expectString(obj);
  10540. const high = strToInt(obj);
  10541. obj = lexer.getObj();
  10542. expectInt(obj);
  10543. const dstLow = obj;
  10544. cMap.mapCidRange(low, high, dstLow);
  10545. }
  10546. }
  10547. function parseCodespaceRange(cMap, lexer) {
  10548. while (true) {
  10549. let obj = lexer.getObj();
  10550. if ((0, _primitives.isEOF)(obj)) {
  10551. break;
  10552. }
  10553. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  10554. return;
  10555. }
  10556. if (!(0, _util.isString)(obj)) {
  10557. break;
  10558. }
  10559. const low = strToInt(obj);
  10560. obj = lexer.getObj();
  10561. if (!(0, _util.isString)(obj)) {
  10562. break;
  10563. }
  10564. const high = strToInt(obj);
  10565. cMap.addCodespaceRange(obj.length, low, high);
  10566. }
  10567. throw new _util.FormatError("Invalid codespace range.");
  10568. }
  10569. function parseWMode(cMap, lexer) {
  10570. const obj = lexer.getObj();
  10571. if (Number.isInteger(obj)) {
  10572. cMap.vertical = !!obj;
  10573. }
  10574. }
  10575. function parseCMapName(cMap, lexer) {
  10576. const obj = lexer.getObj();
  10577. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  10578. cMap.name = obj.name;
  10579. }
  10580. }
  10581. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  10582. let previous, embeddedUseCMap;
  10583. objLoop: while (true) {
  10584. try {
  10585. const obj = lexer.getObj();
  10586. if ((0, _primitives.isEOF)(obj)) {
  10587. break;
  10588. } else if ((0, _primitives.isName)(obj)) {
  10589. if (obj.name === "WMode") {
  10590. parseWMode(cMap, lexer);
  10591. } else if (obj.name === "CMapName") {
  10592. parseCMapName(cMap, lexer);
  10593. }
  10594. previous = obj;
  10595. } else if ((0, _primitives.isCmd)(obj)) {
  10596. switch (obj.cmd) {
  10597. case "endcmap":
  10598. break objLoop;
  10599. case "usecmap":
  10600. if ((0, _primitives.isName)(previous)) {
  10601. embeddedUseCMap = previous.name;
  10602. }
  10603. break;
  10604. case "begincodespacerange":
  10605. parseCodespaceRange(cMap, lexer);
  10606. break;
  10607. case "beginbfchar":
  10608. parseBfChar(cMap, lexer);
  10609. break;
  10610. case "begincidchar":
  10611. parseCidChar(cMap, lexer);
  10612. break;
  10613. case "beginbfrange":
  10614. parseBfRange(cMap, lexer);
  10615. break;
  10616. case "begincidrange":
  10617. parseCidRange(cMap, lexer);
  10618. break;
  10619. }
  10620. }
  10621. } catch (ex) {
  10622. if (ex instanceof _core_utils.MissingDataException) {
  10623. throw ex;
  10624. }
  10625. (0, _util.warn)("Invalid cMap data: " + ex);
  10626. continue;
  10627. }
  10628. }
  10629. if (!useCMap && embeddedUseCMap) {
  10630. useCMap = embeddedUseCMap;
  10631. }
  10632. if (useCMap) {
  10633. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  10634. }
  10635. return cMap;
  10636. }
  10637. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  10638. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  10639. if (cMap.numCodespaceRanges === 0) {
  10640. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  10641. for (let i = 0; i < useCodespaceRanges.length; i++) {
  10642. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  10643. }
  10644. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  10645. }
  10646. cMap.useCMap.forEach(function (key, value) {
  10647. if (!cMap.contains(key)) {
  10648. cMap.mapOne(key, cMap.useCMap.lookup(key));
  10649. }
  10650. });
  10651. return cMap;
  10652. }
  10653. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  10654. if (name === "Identity-H") {
  10655. return new IdentityCMap(false, 2);
  10656. } else if (name === "Identity-V") {
  10657. return new IdentityCMap(true, 2);
  10658. }
  10659. if (!BUILT_IN_CMAPS.includes(name)) {
  10660. throw new Error("Unknown CMap name: " + name);
  10661. }
  10662. if (!fetchBuiltInCMap) {
  10663. throw new Error("Built-in CMap parameters are not provided.");
  10664. }
  10665. const {
  10666. cMapData,
  10667. compressionType
  10668. } = await fetchBuiltInCMap(name);
  10669. const cMap = new CMap(true);
  10670. if (compressionType === _util.CMapCompressionType.BINARY) {
  10671. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  10672. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  10673. });
  10674. }
  10675. if (compressionType === _util.CMapCompressionType.NONE) {
  10676. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  10677. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  10678. }
  10679. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  10680. }
  10681. return {
  10682. async create(params) {
  10683. const encoding = params.encoding;
  10684. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  10685. const useCMap = params.useCMap;
  10686. if ((0, _primitives.isName)(encoding)) {
  10687. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  10688. } else if ((0, _primitives.isStream)(encoding)) {
  10689. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  10690. if (parsedCMap.isIdentityCMap) {
  10691. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  10692. }
  10693. return parsedCMap;
  10694. }
  10695. throw new Error("Encoding required.");
  10696. }
  10697. };
  10698. }();
  10699. exports.CMapFactory = CMapFactory;
  10700. /***/ }),
  10701. /* 17 */
  10702. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10703. Object.defineProperty(exports, "__esModule", ({
  10704. value: true
  10705. }));
  10706. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  10707. var _util = __w_pdfjs_require__(2);
  10708. var _primitives = __w_pdfjs_require__(5);
  10709. var _core_utils = __w_pdfjs_require__(9);
  10710. var _ascii_85_stream = __w_pdfjs_require__(18);
  10711. var _ascii_hex_stream = __w_pdfjs_require__(20);
  10712. var _ccitt_stream = __w_pdfjs_require__(21);
  10713. var _flate_stream = __w_pdfjs_require__(23);
  10714. var _jbig2_stream = __w_pdfjs_require__(24);
  10715. var _jpeg_stream = __w_pdfjs_require__(27);
  10716. var _jpx_stream = __w_pdfjs_require__(29);
  10717. var _lzw_stream = __w_pdfjs_require__(31);
  10718. var _stream = __w_pdfjs_require__(10);
  10719. var _predictor_stream = __w_pdfjs_require__(32);
  10720. var _run_length_stream = __w_pdfjs_require__(33);
  10721. const MAX_LENGTH_TO_CACHE = 1000;
  10722. const MAX_ADLER32_LENGTH = 5552;
  10723. function computeAdler32(bytes) {
  10724. const bytesLength = bytes.length;
  10725. let a = 1,
  10726. b = 0;
  10727. for (let i = 0; i < bytesLength; ++i) {
  10728. a += bytes[i] & 0xff;
  10729. b += a;
  10730. }
  10731. return b % 65521 << 16 | a % 65521;
  10732. }
  10733. class Parser {
  10734. constructor({
  10735. lexer,
  10736. xref,
  10737. allowStreams = false,
  10738. recoveryMode = false
  10739. }) {
  10740. this.lexer = lexer;
  10741. this.xref = xref;
  10742. this.allowStreams = allowStreams;
  10743. this.recoveryMode = recoveryMode;
  10744. this.imageCache = Object.create(null);
  10745. this.refill();
  10746. }
  10747. refill() {
  10748. this.buf1 = this.lexer.getObj();
  10749. this.buf2 = this.lexer.getObj();
  10750. }
  10751. shift() {
  10752. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  10753. this.buf1 = this.buf2;
  10754. this.buf2 = null;
  10755. } else {
  10756. this.buf1 = this.buf2;
  10757. this.buf2 = this.lexer.getObj();
  10758. }
  10759. }
  10760. tryShift() {
  10761. try {
  10762. this.shift();
  10763. return true;
  10764. } catch (e) {
  10765. if (e instanceof _core_utils.MissingDataException) {
  10766. throw e;
  10767. }
  10768. return false;
  10769. }
  10770. }
  10771. getObj(cipherTransform = null) {
  10772. const buf1 = this.buf1;
  10773. this.shift();
  10774. if (buf1 instanceof _primitives.Cmd) {
  10775. switch (buf1.cmd) {
  10776. case "BI":
  10777. return this.makeInlineImage(cipherTransform);
  10778. case "[":
  10779. const array = [];
  10780. while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
  10781. array.push(this.getObj(cipherTransform));
  10782. }
  10783. if ((0, _primitives.isEOF)(this.buf1)) {
  10784. if (!this.recoveryMode) {
  10785. throw new _util.FormatError("End of file inside array");
  10786. }
  10787. return array;
  10788. }
  10789. this.shift();
  10790. return array;
  10791. case "<<":
  10792. const dict = new _primitives.Dict(this.xref);
  10793. while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
  10794. if (!(0, _primitives.isName)(this.buf1)) {
  10795. (0, _util.info)("Malformed dictionary: key must be a name object");
  10796. this.shift();
  10797. continue;
  10798. }
  10799. const key = this.buf1.name;
  10800. this.shift();
  10801. if ((0, _primitives.isEOF)(this.buf1)) {
  10802. break;
  10803. }
  10804. dict.set(key, this.getObj(cipherTransform));
  10805. }
  10806. if ((0, _primitives.isEOF)(this.buf1)) {
  10807. if (!this.recoveryMode) {
  10808. throw new _util.FormatError("End of file inside dictionary");
  10809. }
  10810. return dict;
  10811. }
  10812. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  10813. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  10814. }
  10815. this.shift();
  10816. return dict;
  10817. default:
  10818. return buf1;
  10819. }
  10820. }
  10821. if (Number.isInteger(buf1)) {
  10822. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  10823. const ref = _primitives.Ref.get(buf1, this.buf1);
  10824. this.shift();
  10825. this.shift();
  10826. return ref;
  10827. }
  10828. return buf1;
  10829. }
  10830. if (typeof buf1 === "string") {
  10831. if (cipherTransform) {
  10832. return cipherTransform.decryptString(buf1);
  10833. }
  10834. return buf1;
  10835. }
  10836. return buf1;
  10837. }
  10838. findDefaultInlineStreamEnd(stream) {
  10839. const E = 0x45,
  10840. I = 0x49,
  10841. SPACE = 0x20,
  10842. LF = 0xa,
  10843. CR = 0xd,
  10844. NUL = 0x0;
  10845. const lexer = this.lexer,
  10846. startPos = stream.pos,
  10847. n = 10;
  10848. let state = 0,
  10849. ch,
  10850. maybeEIPos;
  10851. while ((ch = stream.getByte()) !== -1) {
  10852. if (state === 0) {
  10853. state = ch === E ? 1 : 0;
  10854. } else if (state === 1) {
  10855. state = ch === I ? 2 : 0;
  10856. } else {
  10857. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  10858. if (ch === SPACE || ch === LF || ch === CR) {
  10859. maybeEIPos = stream.pos;
  10860. const followingBytes = stream.peekBytes(n);
  10861. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  10862. ch = followingBytes[i];
  10863. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  10864. continue;
  10865. }
  10866. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  10867. state = 0;
  10868. break;
  10869. }
  10870. }
  10871. if (state !== 2) {
  10872. continue;
  10873. }
  10874. if (lexer.knownCommands) {
  10875. const nextObj = lexer.peekObj();
  10876. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  10877. state = 0;
  10878. }
  10879. } else {
  10880. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  10881. }
  10882. if (state === 2) {
  10883. break;
  10884. }
  10885. } else {
  10886. state = 0;
  10887. }
  10888. }
  10889. }
  10890. if (ch === -1) {
  10891. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  10892. if (maybeEIPos) {
  10893. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  10894. stream.skip(-(stream.pos - maybeEIPos));
  10895. }
  10896. }
  10897. let endOffset = 4;
  10898. stream.skip(-endOffset);
  10899. ch = stream.peekByte();
  10900. stream.skip(endOffset);
  10901. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  10902. endOffset--;
  10903. }
  10904. return stream.pos - endOffset - startPos;
  10905. }
  10906. findDCTDecodeInlineStreamEnd(stream) {
  10907. const startPos = stream.pos;
  10908. let foundEOI = false,
  10909. b,
  10910. markerLength;
  10911. while ((b = stream.getByte()) !== -1) {
  10912. if (b !== 0xff) {
  10913. continue;
  10914. }
  10915. switch (stream.getByte()) {
  10916. case 0x00:
  10917. break;
  10918. case 0xff:
  10919. stream.skip(-1);
  10920. break;
  10921. case 0xd9:
  10922. foundEOI = true;
  10923. break;
  10924. case 0xc0:
  10925. case 0xc1:
  10926. case 0xc2:
  10927. case 0xc3:
  10928. case 0xc5:
  10929. case 0xc6:
  10930. case 0xc7:
  10931. case 0xc9:
  10932. case 0xca:
  10933. case 0xcb:
  10934. case 0xcd:
  10935. case 0xce:
  10936. case 0xcf:
  10937. case 0xc4:
  10938. case 0xcc:
  10939. case 0xda:
  10940. case 0xdb:
  10941. case 0xdc:
  10942. case 0xdd:
  10943. case 0xde:
  10944. case 0xdf:
  10945. case 0xe0:
  10946. case 0xe1:
  10947. case 0xe2:
  10948. case 0xe3:
  10949. case 0xe4:
  10950. case 0xe5:
  10951. case 0xe6:
  10952. case 0xe7:
  10953. case 0xe8:
  10954. case 0xe9:
  10955. case 0xea:
  10956. case 0xeb:
  10957. case 0xec:
  10958. case 0xed:
  10959. case 0xee:
  10960. case 0xef:
  10961. case 0xfe:
  10962. markerLength = stream.getUint16();
  10963. if (markerLength > 2) {
  10964. stream.skip(markerLength - 2);
  10965. } else {
  10966. stream.skip(-2);
  10967. }
  10968. break;
  10969. }
  10970. if (foundEOI) {
  10971. break;
  10972. }
  10973. }
  10974. const length = stream.pos - startPos;
  10975. if (b === -1) {
  10976. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  10977. stream.skip(-length);
  10978. return this.findDefaultInlineStreamEnd(stream);
  10979. }
  10980. this.inlineStreamSkipEI(stream);
  10981. return length;
  10982. }
  10983. findASCII85DecodeInlineStreamEnd(stream) {
  10984. const TILDE = 0x7e,
  10985. GT = 0x3e;
  10986. const startPos = stream.pos;
  10987. let ch;
  10988. while ((ch = stream.getByte()) !== -1) {
  10989. if (ch === TILDE) {
  10990. const tildePos = stream.pos;
  10991. ch = stream.peekByte();
  10992. while ((0, _core_utils.isWhiteSpace)(ch)) {
  10993. stream.skip();
  10994. ch = stream.peekByte();
  10995. }
  10996. if (ch === GT) {
  10997. stream.skip();
  10998. break;
  10999. }
  11000. if (stream.pos > tildePos) {
  11001. const maybeEI = stream.peekBytes(2);
  11002. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  11003. break;
  11004. }
  11005. }
  11006. }
  11007. }
  11008. const length = stream.pos - startPos;
  11009. if (ch === -1) {
  11010. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  11011. stream.skip(-length);
  11012. return this.findDefaultInlineStreamEnd(stream);
  11013. }
  11014. this.inlineStreamSkipEI(stream);
  11015. return length;
  11016. }
  11017. findASCIIHexDecodeInlineStreamEnd(stream) {
  11018. const GT = 0x3e;
  11019. const startPos = stream.pos;
  11020. let ch;
  11021. while ((ch = stream.getByte()) !== -1) {
  11022. if (ch === GT) {
  11023. break;
  11024. }
  11025. }
  11026. const length = stream.pos - startPos;
  11027. if (ch === -1) {
  11028. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  11029. stream.skip(-length);
  11030. return this.findDefaultInlineStreamEnd(stream);
  11031. }
  11032. this.inlineStreamSkipEI(stream);
  11033. return length;
  11034. }
  11035. inlineStreamSkipEI(stream) {
  11036. const E = 0x45,
  11037. I = 0x49;
  11038. let state = 0,
  11039. ch;
  11040. while ((ch = stream.getByte()) !== -1) {
  11041. if (state === 0) {
  11042. state = ch === E ? 1 : 0;
  11043. } else if (state === 1) {
  11044. state = ch === I ? 2 : 0;
  11045. } else if (state === 2) {
  11046. break;
  11047. }
  11048. }
  11049. }
  11050. makeInlineImage(cipherTransform) {
  11051. const lexer = this.lexer;
  11052. const stream = lexer.stream;
  11053. const dict = new _primitives.Dict(this.xref);
  11054. let dictLength;
  11055. while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
  11056. if (!(0, _primitives.isName)(this.buf1)) {
  11057. throw new _util.FormatError("Dictionary key must be a name object");
  11058. }
  11059. const key = this.buf1.name;
  11060. this.shift();
  11061. if ((0, _primitives.isEOF)(this.buf1)) {
  11062. break;
  11063. }
  11064. dict.set(key, this.getObj(cipherTransform));
  11065. }
  11066. if (lexer.beginInlineImagePos !== -1) {
  11067. dictLength = stream.pos - lexer.beginInlineImagePos;
  11068. }
  11069. const filter = dict.get("Filter", "F");
  11070. let filterName;
  11071. if ((0, _primitives.isName)(filter)) {
  11072. filterName = filter.name;
  11073. } else if (Array.isArray(filter)) {
  11074. const filterZero = this.xref.fetchIfRef(filter[0]);
  11075. if ((0, _primitives.isName)(filterZero)) {
  11076. filterName = filterZero.name;
  11077. }
  11078. }
  11079. const startPos = stream.pos;
  11080. let length;
  11081. if (filterName === "DCTDecode" || filterName === "DCT") {
  11082. length = this.findDCTDecodeInlineStreamEnd(stream);
  11083. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  11084. length = this.findASCII85DecodeInlineStreamEnd(stream);
  11085. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  11086. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  11087. } else {
  11088. length = this.findDefaultInlineStreamEnd(stream);
  11089. }
  11090. let imageStream = stream.makeSubStream(startPos, length, dict);
  11091. let cacheKey;
  11092. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  11093. const imageBytes = imageStream.getBytes();
  11094. imageStream.reset();
  11095. const initialStreamPos = stream.pos;
  11096. stream.pos = lexer.beginInlineImagePos;
  11097. const dictBytes = stream.getBytes(dictLength);
  11098. stream.pos = initialStreamPos;
  11099. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  11100. const cacheEntry = this.imageCache[cacheKey];
  11101. if (cacheEntry !== undefined) {
  11102. this.buf2 = _primitives.Cmd.get("EI");
  11103. this.shift();
  11104. cacheEntry.reset();
  11105. return cacheEntry;
  11106. }
  11107. }
  11108. if (cipherTransform) {
  11109. imageStream = cipherTransform.createStream(imageStream, length);
  11110. }
  11111. imageStream = this.filter(imageStream, dict, length);
  11112. imageStream.dict = dict;
  11113. if (cacheKey !== undefined) {
  11114. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  11115. this.imageCache[cacheKey] = imageStream;
  11116. }
  11117. this.buf2 = _primitives.Cmd.get("EI");
  11118. this.shift();
  11119. return imageStream;
  11120. }
  11121. _findStreamLength(startPos, signature) {
  11122. const {
  11123. stream
  11124. } = this.lexer;
  11125. stream.pos = startPos;
  11126. const SCAN_BLOCK_LENGTH = 2048;
  11127. const signatureLength = signature.length;
  11128. while (stream.pos < stream.end) {
  11129. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  11130. const scanLength = scanBytes.length - signatureLength;
  11131. if (scanLength <= 0) {
  11132. break;
  11133. }
  11134. let pos = 0;
  11135. while (pos < scanLength) {
  11136. let j = 0;
  11137. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  11138. j++;
  11139. }
  11140. if (j >= signatureLength) {
  11141. stream.pos += pos;
  11142. return stream.pos - startPos;
  11143. }
  11144. pos++;
  11145. }
  11146. stream.pos += scanLength;
  11147. }
  11148. return -1;
  11149. }
  11150. makeStream(dict, cipherTransform) {
  11151. const lexer = this.lexer;
  11152. let stream = lexer.stream;
  11153. lexer.skipToNextLine();
  11154. const startPos = stream.pos - 1;
  11155. let length = dict.get("Length");
  11156. if (!Number.isInteger(length)) {
  11157. (0, _util.info)(`Bad length "${length}" in stream`);
  11158. length = 0;
  11159. }
  11160. stream.pos = startPos + length;
  11161. lexer.nextChar();
  11162. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  11163. this.shift();
  11164. } else {
  11165. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  11166. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  11167. if (actualLength < 0) {
  11168. const MAX_TRUNCATION = 1;
  11169. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  11170. const end = ENDSTREAM_SIGNATURE.length - i;
  11171. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  11172. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  11173. if (maybeLength >= 0) {
  11174. const lastByte = stream.peekBytes(end + 1)[end];
  11175. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  11176. break;
  11177. }
  11178. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  11179. actualLength = maybeLength;
  11180. break;
  11181. }
  11182. }
  11183. if (actualLength < 0) {
  11184. throw new _util.FormatError("Missing endstream command.");
  11185. }
  11186. }
  11187. length = actualLength;
  11188. lexer.nextChar();
  11189. this.shift();
  11190. this.shift();
  11191. }
  11192. this.shift();
  11193. stream = stream.makeSubStream(startPos, length, dict);
  11194. if (cipherTransform) {
  11195. stream = cipherTransform.createStream(stream, length);
  11196. }
  11197. stream = this.filter(stream, dict, length);
  11198. stream.dict = dict;
  11199. return stream;
  11200. }
  11201. filter(stream, dict, length) {
  11202. let filter = dict.get("Filter", "F");
  11203. let params = dict.get("DecodeParms", "DP");
  11204. if ((0, _primitives.isName)(filter)) {
  11205. if (Array.isArray(params)) {
  11206. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  11207. }
  11208. return this.makeFilter(stream, filter.name, length, params);
  11209. }
  11210. let maybeLength = length;
  11211. if (Array.isArray(filter)) {
  11212. const filterArray = filter;
  11213. const paramsArray = params;
  11214. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  11215. filter = this.xref.fetchIfRef(filterArray[i]);
  11216. if (!(0, _primitives.isName)(filter)) {
  11217. throw new _util.FormatError(`Bad filter name "${filter}"`);
  11218. }
  11219. params = null;
  11220. if (Array.isArray(paramsArray) && i in paramsArray) {
  11221. params = this.xref.fetchIfRef(paramsArray[i]);
  11222. }
  11223. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  11224. maybeLength = null;
  11225. }
  11226. }
  11227. return stream;
  11228. }
  11229. makeFilter(stream, name, maybeLength, params) {
  11230. if (maybeLength === 0) {
  11231. (0, _util.warn)(`Empty "${name}" stream.`);
  11232. return new _stream.NullStream();
  11233. }
  11234. try {
  11235. const xrefStreamStats = this.xref.stats.streamTypes;
  11236. if (name === "FlateDecode" || name === "Fl") {
  11237. xrefStreamStats[_util.StreamType.FLATE] = true;
  11238. if (params) {
  11239. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  11240. }
  11241. return new _flate_stream.FlateStream(stream, maybeLength);
  11242. }
  11243. if (name === "LZWDecode" || name === "LZW") {
  11244. xrefStreamStats[_util.StreamType.LZW] = true;
  11245. let earlyChange = 1;
  11246. if (params) {
  11247. if (params.has("EarlyChange")) {
  11248. earlyChange = params.get("EarlyChange");
  11249. }
  11250. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  11251. }
  11252. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  11253. }
  11254. if (name === "DCTDecode" || name === "DCT") {
  11255. xrefStreamStats[_util.StreamType.DCT] = true;
  11256. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  11257. }
  11258. if (name === "JPXDecode" || name === "JPX") {
  11259. xrefStreamStats[_util.StreamType.JPX] = true;
  11260. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  11261. }
  11262. if (name === "ASCII85Decode" || name === "A85") {
  11263. xrefStreamStats[_util.StreamType.A85] = true;
  11264. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  11265. }
  11266. if (name === "ASCIIHexDecode" || name === "AHx") {
  11267. xrefStreamStats[_util.StreamType.AHX] = true;
  11268. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  11269. }
  11270. if (name === "CCITTFaxDecode" || name === "CCF") {
  11271. xrefStreamStats[_util.StreamType.CCF] = true;
  11272. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  11273. }
  11274. if (name === "RunLengthDecode" || name === "RL") {
  11275. xrefStreamStats[_util.StreamType.RLX] = true;
  11276. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  11277. }
  11278. if (name === "JBIG2Decode") {
  11279. xrefStreamStats[_util.StreamType.JBIG] = true;
  11280. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  11281. }
  11282. (0, _util.warn)(`Filter "${name}" is not supported.`);
  11283. return stream;
  11284. } catch (ex) {
  11285. if (ex instanceof _core_utils.MissingDataException) {
  11286. throw ex;
  11287. }
  11288. (0, _util.warn)(`Invalid stream: "${ex}"`);
  11289. return new _stream.NullStream();
  11290. }
  11291. }
  11292. }
  11293. exports.Parser = Parser;
  11294. 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];
  11295. function toHexDigit(ch) {
  11296. if (ch >= 0x30 && ch <= 0x39) {
  11297. return ch & 0x0f;
  11298. }
  11299. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  11300. return (ch & 0x0f) + 9;
  11301. }
  11302. return -1;
  11303. }
  11304. class Lexer {
  11305. constructor(stream, knownCommands = null) {
  11306. this.stream = stream;
  11307. this.nextChar();
  11308. this.strBuf = [];
  11309. this.knownCommands = knownCommands;
  11310. this._hexStringNumWarn = 0;
  11311. this.beginInlineImagePos = -1;
  11312. }
  11313. nextChar() {
  11314. return this.currentChar = this.stream.getByte();
  11315. }
  11316. peekChar() {
  11317. return this.stream.peekByte();
  11318. }
  11319. getNumber() {
  11320. let ch = this.currentChar;
  11321. let eNotation = false;
  11322. let divideBy = 0;
  11323. let sign = 0;
  11324. if (ch === 0x2d) {
  11325. sign = -1;
  11326. ch = this.nextChar();
  11327. if (ch === 0x2d) {
  11328. ch = this.nextChar();
  11329. }
  11330. } else if (ch === 0x2b) {
  11331. sign = 1;
  11332. ch = this.nextChar();
  11333. }
  11334. if (ch === 0x0a || ch === 0x0d) {
  11335. do {
  11336. ch = this.nextChar();
  11337. } while (ch === 0x0a || ch === 0x0d);
  11338. }
  11339. if (ch === 0x2e) {
  11340. divideBy = 10;
  11341. ch = this.nextChar();
  11342. }
  11343. if (ch < 0x30 || ch > 0x39) {
  11344. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  11345. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  11346. return 0;
  11347. }
  11348. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  11349. }
  11350. sign = sign || 1;
  11351. let baseValue = ch - 0x30;
  11352. let powerValue = 0;
  11353. let powerValueSign = 1;
  11354. while ((ch = this.nextChar()) >= 0) {
  11355. if (ch >= 0x30 && ch <= 0x39) {
  11356. const currentDigit = ch - 0x30;
  11357. if (eNotation) {
  11358. powerValue = powerValue * 10 + currentDigit;
  11359. } else {
  11360. if (divideBy !== 0) {
  11361. divideBy *= 10;
  11362. }
  11363. baseValue = baseValue * 10 + currentDigit;
  11364. }
  11365. } else if (ch === 0x2e) {
  11366. if (divideBy === 0) {
  11367. divideBy = 1;
  11368. } else {
  11369. break;
  11370. }
  11371. } else if (ch === 0x2d) {
  11372. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  11373. } else if (ch === 0x45 || ch === 0x65) {
  11374. ch = this.peekChar();
  11375. if (ch === 0x2b || ch === 0x2d) {
  11376. powerValueSign = ch === 0x2d ? -1 : 1;
  11377. this.nextChar();
  11378. } else if (ch < 0x30 || ch > 0x39) {
  11379. break;
  11380. }
  11381. eNotation = true;
  11382. } else {
  11383. break;
  11384. }
  11385. }
  11386. if (divideBy !== 0) {
  11387. baseValue /= divideBy;
  11388. }
  11389. if (eNotation) {
  11390. baseValue *= 10 ** (powerValueSign * powerValue);
  11391. }
  11392. return sign * baseValue;
  11393. }
  11394. getString() {
  11395. let numParen = 1;
  11396. let done = false;
  11397. const strBuf = this.strBuf;
  11398. strBuf.length = 0;
  11399. let ch = this.nextChar();
  11400. while (true) {
  11401. let charBuffered = false;
  11402. switch (ch | 0) {
  11403. case -1:
  11404. (0, _util.warn)("Unterminated string");
  11405. done = true;
  11406. break;
  11407. case 0x28:
  11408. ++numParen;
  11409. strBuf.push("(");
  11410. break;
  11411. case 0x29:
  11412. if (--numParen === 0) {
  11413. this.nextChar();
  11414. done = true;
  11415. } else {
  11416. strBuf.push(")");
  11417. }
  11418. break;
  11419. case 0x5c:
  11420. ch = this.nextChar();
  11421. switch (ch) {
  11422. case -1:
  11423. (0, _util.warn)("Unterminated string");
  11424. done = true;
  11425. break;
  11426. case 0x6e:
  11427. strBuf.push("\n");
  11428. break;
  11429. case 0x72:
  11430. strBuf.push("\r");
  11431. break;
  11432. case 0x74:
  11433. strBuf.push("\t");
  11434. break;
  11435. case 0x62:
  11436. strBuf.push("\b");
  11437. break;
  11438. case 0x66:
  11439. strBuf.push("\f");
  11440. break;
  11441. case 0x5c:
  11442. case 0x28:
  11443. case 0x29:
  11444. strBuf.push(String.fromCharCode(ch));
  11445. break;
  11446. case 0x30:
  11447. case 0x31:
  11448. case 0x32:
  11449. case 0x33:
  11450. case 0x34:
  11451. case 0x35:
  11452. case 0x36:
  11453. case 0x37:
  11454. let x = ch & 0x0f;
  11455. ch = this.nextChar();
  11456. charBuffered = true;
  11457. if (ch >= 0x30 && ch <= 0x37) {
  11458. x = (x << 3) + (ch & 0x0f);
  11459. ch = this.nextChar();
  11460. if (ch >= 0x30 && ch <= 0x37) {
  11461. charBuffered = false;
  11462. x = (x << 3) + (ch & 0x0f);
  11463. }
  11464. }
  11465. strBuf.push(String.fromCharCode(x));
  11466. break;
  11467. case 0x0d:
  11468. if (this.peekChar() === 0x0a) {
  11469. this.nextChar();
  11470. }
  11471. break;
  11472. case 0x0a:
  11473. break;
  11474. default:
  11475. strBuf.push(String.fromCharCode(ch));
  11476. break;
  11477. }
  11478. break;
  11479. default:
  11480. strBuf.push(String.fromCharCode(ch));
  11481. break;
  11482. }
  11483. if (done) {
  11484. break;
  11485. }
  11486. if (!charBuffered) {
  11487. ch = this.nextChar();
  11488. }
  11489. }
  11490. return strBuf.join("");
  11491. }
  11492. getName() {
  11493. let ch, previousCh;
  11494. const strBuf = this.strBuf;
  11495. strBuf.length = 0;
  11496. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  11497. if (ch === 0x23) {
  11498. ch = this.nextChar();
  11499. if (specialChars[ch]) {
  11500. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  11501. strBuf.push("#");
  11502. break;
  11503. }
  11504. const x = toHexDigit(ch);
  11505. if (x !== -1) {
  11506. previousCh = ch;
  11507. ch = this.nextChar();
  11508. const x2 = toHexDigit(ch);
  11509. if (x2 === -1) {
  11510. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  11511. strBuf.push("#", String.fromCharCode(previousCh));
  11512. if (specialChars[ch]) {
  11513. break;
  11514. }
  11515. strBuf.push(String.fromCharCode(ch));
  11516. continue;
  11517. }
  11518. strBuf.push(String.fromCharCode(x << 4 | x2));
  11519. } else {
  11520. strBuf.push("#", String.fromCharCode(ch));
  11521. }
  11522. } else {
  11523. strBuf.push(String.fromCharCode(ch));
  11524. }
  11525. }
  11526. if (strBuf.length > 127) {
  11527. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  11528. }
  11529. return _primitives.Name.get(strBuf.join(""));
  11530. }
  11531. _hexStringWarn(ch) {
  11532. const MAX_HEX_STRING_NUM_WARN = 5;
  11533. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  11534. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  11535. return;
  11536. }
  11537. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  11538. return;
  11539. }
  11540. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  11541. }
  11542. getHexString() {
  11543. const strBuf = this.strBuf;
  11544. strBuf.length = 0;
  11545. let ch = this.currentChar;
  11546. let isFirstHex = true;
  11547. let firstDigit, secondDigit;
  11548. this._hexStringNumWarn = 0;
  11549. while (true) {
  11550. if (ch < 0) {
  11551. (0, _util.warn)("Unterminated hex string");
  11552. break;
  11553. } else if (ch === 0x3e) {
  11554. this.nextChar();
  11555. break;
  11556. } else if (specialChars[ch] === 1) {
  11557. ch = this.nextChar();
  11558. continue;
  11559. } else {
  11560. if (isFirstHex) {
  11561. firstDigit = toHexDigit(ch);
  11562. if (firstDigit === -1) {
  11563. this._hexStringWarn(ch);
  11564. ch = this.nextChar();
  11565. continue;
  11566. }
  11567. } else {
  11568. secondDigit = toHexDigit(ch);
  11569. if (secondDigit === -1) {
  11570. this._hexStringWarn(ch);
  11571. ch = this.nextChar();
  11572. continue;
  11573. }
  11574. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  11575. }
  11576. isFirstHex = !isFirstHex;
  11577. ch = this.nextChar();
  11578. }
  11579. }
  11580. return strBuf.join("");
  11581. }
  11582. getObj() {
  11583. let comment = false;
  11584. let ch = this.currentChar;
  11585. while (true) {
  11586. if (ch < 0) {
  11587. return _primitives.EOF;
  11588. }
  11589. if (comment) {
  11590. if (ch === 0x0a || ch === 0x0d) {
  11591. comment = false;
  11592. }
  11593. } else if (ch === 0x25) {
  11594. comment = true;
  11595. } else if (specialChars[ch] !== 1) {
  11596. break;
  11597. }
  11598. ch = this.nextChar();
  11599. }
  11600. switch (ch | 0) {
  11601. case 0x30:
  11602. case 0x31:
  11603. case 0x32:
  11604. case 0x33:
  11605. case 0x34:
  11606. case 0x35:
  11607. case 0x36:
  11608. case 0x37:
  11609. case 0x38:
  11610. case 0x39:
  11611. case 0x2b:
  11612. case 0x2d:
  11613. case 0x2e:
  11614. return this.getNumber();
  11615. case 0x28:
  11616. return this.getString();
  11617. case 0x2f:
  11618. return this.getName();
  11619. case 0x5b:
  11620. this.nextChar();
  11621. return _primitives.Cmd.get("[");
  11622. case 0x5d:
  11623. this.nextChar();
  11624. return _primitives.Cmd.get("]");
  11625. case 0x3c:
  11626. ch = this.nextChar();
  11627. if (ch === 0x3c) {
  11628. this.nextChar();
  11629. return _primitives.Cmd.get("<<");
  11630. }
  11631. return this.getHexString();
  11632. case 0x3e:
  11633. ch = this.nextChar();
  11634. if (ch === 0x3e) {
  11635. this.nextChar();
  11636. return _primitives.Cmd.get(">>");
  11637. }
  11638. return _primitives.Cmd.get(">");
  11639. case 0x7b:
  11640. this.nextChar();
  11641. return _primitives.Cmd.get("{");
  11642. case 0x7d:
  11643. this.nextChar();
  11644. return _primitives.Cmd.get("}");
  11645. case 0x29:
  11646. this.nextChar();
  11647. throw new _util.FormatError(`Illegal character: ${ch}`);
  11648. }
  11649. let str = String.fromCharCode(ch);
  11650. const knownCommands = this.knownCommands;
  11651. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  11652. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  11653. const possibleCommand = str + String.fromCharCode(ch);
  11654. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  11655. break;
  11656. }
  11657. if (str.length === 128) {
  11658. throw new _util.FormatError(`Command token too long: ${str.length}`);
  11659. }
  11660. str = possibleCommand;
  11661. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  11662. }
  11663. if (str === "true") {
  11664. return true;
  11665. }
  11666. if (str === "false") {
  11667. return false;
  11668. }
  11669. if (str === "null") {
  11670. return null;
  11671. }
  11672. if (str === "BI") {
  11673. this.beginInlineImagePos = this.stream.pos;
  11674. }
  11675. return _primitives.Cmd.get(str);
  11676. }
  11677. peekObj() {
  11678. const streamPos = this.stream.pos,
  11679. currentChar = this.currentChar,
  11680. beginInlineImagePos = this.beginInlineImagePos;
  11681. let nextObj;
  11682. try {
  11683. nextObj = this.getObj();
  11684. } catch (ex) {
  11685. if (ex instanceof _core_utils.MissingDataException) {
  11686. throw ex;
  11687. }
  11688. (0, _util.warn)(`peekObj: ${ex}`);
  11689. }
  11690. this.stream.pos = streamPos;
  11691. this.currentChar = currentChar;
  11692. this.beginInlineImagePos = beginInlineImagePos;
  11693. return nextObj;
  11694. }
  11695. skipToNextLine() {
  11696. let ch = this.currentChar;
  11697. while (ch >= 0) {
  11698. if (ch === 0x0d) {
  11699. ch = this.nextChar();
  11700. if (ch === 0x0a) {
  11701. this.nextChar();
  11702. }
  11703. break;
  11704. } else if (ch === 0x0a) {
  11705. this.nextChar();
  11706. break;
  11707. }
  11708. ch = this.nextChar();
  11709. }
  11710. }
  11711. }
  11712. exports.Lexer = Lexer;
  11713. class Linearization {
  11714. static create(stream) {
  11715. function getInt(linDict, name, allowZeroValue = false) {
  11716. const obj = linDict.get(name);
  11717. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  11718. return obj;
  11719. }
  11720. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  11721. }
  11722. function getHints(linDict) {
  11723. const hints = linDict.get("H");
  11724. let hintsLength;
  11725. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  11726. for (let index = 0; index < hintsLength; index++) {
  11727. const hint = hints[index];
  11728. if (!(Number.isInteger(hint) && hint > 0)) {
  11729. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  11730. }
  11731. }
  11732. return hints;
  11733. }
  11734. throw new Error("Hint array in the linearization dictionary is invalid.");
  11735. }
  11736. const parser = new Parser({
  11737. lexer: new Lexer(stream),
  11738. xref: null
  11739. });
  11740. const obj1 = parser.getObj();
  11741. const obj2 = parser.getObj();
  11742. const obj3 = parser.getObj();
  11743. const linDict = parser.getObj();
  11744. let obj, length;
  11745. 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)) {
  11746. return null;
  11747. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  11748. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  11749. }
  11750. return {
  11751. length,
  11752. hints: getHints(linDict),
  11753. objectNumberFirst: getInt(linDict, "O"),
  11754. endFirst: getInt(linDict, "E"),
  11755. numPages: getInt(linDict, "N"),
  11756. mainXRefEntriesOffset: getInt(linDict, "T"),
  11757. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  11758. };
  11759. }
  11760. }
  11761. exports.Linearization = Linearization;
  11762. /***/ }),
  11763. /* 18 */
  11764. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11765. Object.defineProperty(exports, "__esModule", ({
  11766. value: true
  11767. }));
  11768. exports.Ascii85Stream = void 0;
  11769. var _decode_stream = __w_pdfjs_require__(19);
  11770. var _core_utils = __w_pdfjs_require__(9);
  11771. class Ascii85Stream extends _decode_stream.DecodeStream {
  11772. constructor(str, maybeLength) {
  11773. if (maybeLength) {
  11774. maybeLength = 0.8 * maybeLength;
  11775. }
  11776. super(maybeLength);
  11777. this.str = str;
  11778. this.dict = str.dict;
  11779. this.input = new Uint8Array(5);
  11780. }
  11781. readBlock() {
  11782. const TILDA_CHAR = 0x7e;
  11783. const Z_LOWER_CHAR = 0x7a;
  11784. const EOF = -1;
  11785. const str = this.str;
  11786. let c = str.getByte();
  11787. while ((0, _core_utils.isWhiteSpace)(c)) {
  11788. c = str.getByte();
  11789. }
  11790. if (c === EOF || c === TILDA_CHAR) {
  11791. this.eof = true;
  11792. return;
  11793. }
  11794. const bufferLength = this.bufferLength;
  11795. let buffer, i;
  11796. if (c === Z_LOWER_CHAR) {
  11797. buffer = this.ensureBuffer(bufferLength + 4);
  11798. for (i = 0; i < 4; ++i) {
  11799. buffer[bufferLength + i] = 0;
  11800. }
  11801. this.bufferLength += 4;
  11802. } else {
  11803. const input = this.input;
  11804. input[0] = c;
  11805. for (i = 1; i < 5; ++i) {
  11806. c = str.getByte();
  11807. while ((0, _core_utils.isWhiteSpace)(c)) {
  11808. c = str.getByte();
  11809. }
  11810. input[i] = c;
  11811. if (c === EOF || c === TILDA_CHAR) {
  11812. break;
  11813. }
  11814. }
  11815. buffer = this.ensureBuffer(bufferLength + i - 1);
  11816. this.bufferLength += i - 1;
  11817. if (i < 5) {
  11818. for (; i < 5; ++i) {
  11819. input[i] = 0x21 + 84;
  11820. }
  11821. this.eof = true;
  11822. }
  11823. let t = 0;
  11824. for (i = 0; i < 5; ++i) {
  11825. t = t * 85 + (input[i] - 0x21);
  11826. }
  11827. for (i = 3; i >= 0; --i) {
  11828. buffer[bufferLength + i] = t & 0xff;
  11829. t >>= 8;
  11830. }
  11831. }
  11832. }
  11833. }
  11834. exports.Ascii85Stream = Ascii85Stream;
  11835. /***/ }),
  11836. /* 19 */
  11837. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11838. Object.defineProperty(exports, "__esModule", ({
  11839. value: true
  11840. }));
  11841. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  11842. var _base_stream = __w_pdfjs_require__(6);
  11843. var _stream = __w_pdfjs_require__(10);
  11844. const emptyBuffer = new Uint8Array(0);
  11845. class DecodeStream extends _base_stream.BaseStream {
  11846. constructor(maybeMinBufferLength) {
  11847. super();
  11848. this._rawMinBufferLength = maybeMinBufferLength || 0;
  11849. this.pos = 0;
  11850. this.bufferLength = 0;
  11851. this.eof = false;
  11852. this.buffer = emptyBuffer;
  11853. this.minBufferLength = 512;
  11854. if (maybeMinBufferLength) {
  11855. while (this.minBufferLength < maybeMinBufferLength) {
  11856. this.minBufferLength *= 2;
  11857. }
  11858. }
  11859. }
  11860. get isEmpty() {
  11861. while (!this.eof && this.bufferLength === 0) {
  11862. this.readBlock();
  11863. }
  11864. return this.bufferLength === 0;
  11865. }
  11866. ensureBuffer(requested) {
  11867. const buffer = this.buffer;
  11868. if (requested <= buffer.byteLength) {
  11869. return buffer;
  11870. }
  11871. let size = this.minBufferLength;
  11872. while (size < requested) {
  11873. size *= 2;
  11874. }
  11875. const buffer2 = new Uint8Array(size);
  11876. buffer2.set(buffer);
  11877. return this.buffer = buffer2;
  11878. }
  11879. getByte() {
  11880. const pos = this.pos;
  11881. while (this.bufferLength <= pos) {
  11882. if (this.eof) {
  11883. return -1;
  11884. }
  11885. this.readBlock();
  11886. }
  11887. return this.buffer[this.pos++];
  11888. }
  11889. getBytes(length, forceClamped = false) {
  11890. const pos = this.pos;
  11891. let end;
  11892. if (length) {
  11893. this.ensureBuffer(pos + length);
  11894. end = pos + length;
  11895. while (!this.eof && this.bufferLength < end) {
  11896. this.readBlock();
  11897. }
  11898. const bufEnd = this.bufferLength;
  11899. if (end > bufEnd) {
  11900. end = bufEnd;
  11901. }
  11902. } else {
  11903. while (!this.eof) {
  11904. this.readBlock();
  11905. }
  11906. end = this.bufferLength;
  11907. }
  11908. this.pos = end;
  11909. const subarray = this.buffer.subarray(pos, end);
  11910. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  11911. }
  11912. reset() {
  11913. this.pos = 0;
  11914. }
  11915. makeSubStream(start, length, dict = null) {
  11916. if (length === undefined) {
  11917. while (!this.eof) {
  11918. this.readBlock();
  11919. }
  11920. } else {
  11921. const end = start + length;
  11922. while (this.bufferLength <= end && !this.eof) {
  11923. this.readBlock();
  11924. }
  11925. }
  11926. return new _stream.Stream(this.buffer, start, length, dict);
  11927. }
  11928. getBaseStreams() {
  11929. return this.str ? this.str.getBaseStreams() : null;
  11930. }
  11931. }
  11932. exports.DecodeStream = DecodeStream;
  11933. class StreamsSequenceStream extends DecodeStream {
  11934. constructor(streams) {
  11935. let maybeLength = 0;
  11936. for (const stream of streams) {
  11937. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  11938. }
  11939. super(maybeLength);
  11940. this.streams = streams;
  11941. }
  11942. readBlock() {
  11943. const streams = this.streams;
  11944. if (streams.length === 0) {
  11945. this.eof = true;
  11946. return;
  11947. }
  11948. const stream = streams.shift();
  11949. const chunk = stream.getBytes();
  11950. const bufferLength = this.bufferLength;
  11951. const newLength = bufferLength + chunk.length;
  11952. const buffer = this.ensureBuffer(newLength);
  11953. buffer.set(chunk, bufferLength);
  11954. this.bufferLength = newLength;
  11955. }
  11956. getBaseStreams() {
  11957. const baseStreamsBuf = [];
  11958. for (const stream of this.streams) {
  11959. const baseStreams = stream.getBaseStreams();
  11960. if (baseStreams) {
  11961. baseStreamsBuf.push(...baseStreams);
  11962. }
  11963. }
  11964. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  11965. }
  11966. }
  11967. exports.StreamsSequenceStream = StreamsSequenceStream;
  11968. /***/ }),
  11969. /* 20 */
  11970. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11971. Object.defineProperty(exports, "__esModule", ({
  11972. value: true
  11973. }));
  11974. exports.AsciiHexStream = void 0;
  11975. var _decode_stream = __w_pdfjs_require__(19);
  11976. class AsciiHexStream extends _decode_stream.DecodeStream {
  11977. constructor(str, maybeLength) {
  11978. if (maybeLength) {
  11979. maybeLength = 0.5 * maybeLength;
  11980. }
  11981. super(maybeLength);
  11982. this.str = str;
  11983. this.dict = str.dict;
  11984. this.firstDigit = -1;
  11985. }
  11986. readBlock() {
  11987. const UPSTREAM_BLOCK_SIZE = 8000;
  11988. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  11989. if (!bytes.length) {
  11990. this.eof = true;
  11991. return;
  11992. }
  11993. const maxDecodeLength = bytes.length + 1 >> 1;
  11994. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  11995. let bufferLength = this.bufferLength;
  11996. let firstDigit = this.firstDigit;
  11997. for (const ch of bytes) {
  11998. let digit;
  11999. if (ch >= 0x30 && ch <= 0x39) {
  12000. digit = ch & 0x0f;
  12001. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  12002. digit = (ch & 0x0f) + 9;
  12003. } else if (ch === 0x3e) {
  12004. this.eof = true;
  12005. break;
  12006. } else {
  12007. continue;
  12008. }
  12009. if (firstDigit < 0) {
  12010. firstDigit = digit;
  12011. } else {
  12012. buffer[bufferLength++] = firstDigit << 4 | digit;
  12013. firstDigit = -1;
  12014. }
  12015. }
  12016. if (firstDigit >= 0 && this.eof) {
  12017. buffer[bufferLength++] = firstDigit << 4;
  12018. firstDigit = -1;
  12019. }
  12020. this.firstDigit = firstDigit;
  12021. this.bufferLength = bufferLength;
  12022. }
  12023. }
  12024. exports.AsciiHexStream = AsciiHexStream;
  12025. /***/ }),
  12026. /* 21 */
  12027. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12028. Object.defineProperty(exports, "__esModule", ({
  12029. value: true
  12030. }));
  12031. exports.CCITTFaxStream = void 0;
  12032. var _primitives = __w_pdfjs_require__(5);
  12033. var _ccitt = __w_pdfjs_require__(22);
  12034. var _decode_stream = __w_pdfjs_require__(19);
  12035. class CCITTFaxStream extends _decode_stream.DecodeStream {
  12036. constructor(str, maybeLength, params) {
  12037. super(maybeLength);
  12038. this.str = str;
  12039. this.dict = str.dict;
  12040. if (!(0, _primitives.isDict)(params)) {
  12041. params = _primitives.Dict.empty;
  12042. }
  12043. const source = {
  12044. next() {
  12045. return str.getByte();
  12046. }
  12047. };
  12048. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  12049. K: params.get("K"),
  12050. EndOfLine: params.get("EndOfLine"),
  12051. EncodedByteAlign: params.get("EncodedByteAlign"),
  12052. Columns: params.get("Columns"),
  12053. Rows: params.get("Rows"),
  12054. EndOfBlock: params.get("EndOfBlock"),
  12055. BlackIs1: params.get("BlackIs1")
  12056. });
  12057. }
  12058. readBlock() {
  12059. while (!this.eof) {
  12060. const c = this.ccittFaxDecoder.readNextChar();
  12061. if (c === -1) {
  12062. this.eof = true;
  12063. return;
  12064. }
  12065. this.ensureBuffer(this.bufferLength + 1);
  12066. this.buffer[this.bufferLength++] = c;
  12067. }
  12068. }
  12069. }
  12070. exports.CCITTFaxStream = CCITTFaxStream;
  12071. /***/ }),
  12072. /* 22 */
  12073. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12074. Object.defineProperty(exports, "__esModule", ({
  12075. value: true
  12076. }));
  12077. exports.CCITTFaxDecoder = void 0;
  12078. var _util = __w_pdfjs_require__(2);
  12079. const ccittEOL = -2;
  12080. const ccittEOF = -1;
  12081. const twoDimPass = 0;
  12082. const twoDimHoriz = 1;
  12083. const twoDimVert0 = 2;
  12084. const twoDimVertR1 = 3;
  12085. const twoDimVertL1 = 4;
  12086. const twoDimVertR2 = 5;
  12087. const twoDimVertL2 = 6;
  12088. const twoDimVertR3 = 7;
  12089. const twoDimVertL3 = 8;
  12090. 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]];
  12091. 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]];
  12092. 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]];
  12093. 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]];
  12094. 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]];
  12095. 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]];
  12096. class CCITTFaxDecoder {
  12097. constructor(source, options = {}) {
  12098. if (!source || typeof source.next !== "function") {
  12099. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  12100. }
  12101. this.source = source;
  12102. this.eof = false;
  12103. this.encoding = options.K || 0;
  12104. this.eoline = options.EndOfLine || false;
  12105. this.byteAlign = options.EncodedByteAlign || false;
  12106. this.columns = options.Columns || 1728;
  12107. this.rows = options.Rows || 0;
  12108. let eoblock = options.EndOfBlock;
  12109. if (eoblock === null || eoblock === undefined) {
  12110. eoblock = true;
  12111. }
  12112. this.eoblock = eoblock;
  12113. this.black = options.BlackIs1 || false;
  12114. this.codingLine = new Uint32Array(this.columns + 1);
  12115. this.refLine = new Uint32Array(this.columns + 2);
  12116. this.codingLine[0] = this.columns;
  12117. this.codingPos = 0;
  12118. this.row = 0;
  12119. this.nextLine2D = this.encoding < 0;
  12120. this.inputBits = 0;
  12121. this.inputBuf = 0;
  12122. this.outputBits = 0;
  12123. this.rowsDone = false;
  12124. let code1;
  12125. while ((code1 = this._lookBits(12)) === 0) {
  12126. this._eatBits(1);
  12127. }
  12128. if (code1 === 1) {
  12129. this._eatBits(12);
  12130. }
  12131. if (this.encoding > 0) {
  12132. this.nextLine2D = !this._lookBits(1);
  12133. this._eatBits(1);
  12134. }
  12135. }
  12136. readNextChar() {
  12137. if (this.eof) {
  12138. return -1;
  12139. }
  12140. const refLine = this.refLine;
  12141. const codingLine = this.codingLine;
  12142. const columns = this.columns;
  12143. let refPos, blackPixels, bits, i;
  12144. if (this.outputBits === 0) {
  12145. if (this.rowsDone) {
  12146. this.eof = true;
  12147. }
  12148. if (this.eof) {
  12149. return -1;
  12150. }
  12151. this.err = false;
  12152. let code1, code2, code3;
  12153. if (this.nextLine2D) {
  12154. for (i = 0; codingLine[i] < columns; ++i) {
  12155. refLine[i] = codingLine[i];
  12156. }
  12157. refLine[i++] = columns;
  12158. refLine[i] = columns;
  12159. codingLine[0] = 0;
  12160. this.codingPos = 0;
  12161. refPos = 0;
  12162. blackPixels = 0;
  12163. while (codingLine[this.codingPos] < columns) {
  12164. code1 = this._getTwoDimCode();
  12165. switch (code1) {
  12166. case twoDimPass:
  12167. this._addPixels(refLine[refPos + 1], blackPixels);
  12168. if (refLine[refPos + 1] < columns) {
  12169. refPos += 2;
  12170. }
  12171. break;
  12172. case twoDimHoriz:
  12173. code1 = code2 = 0;
  12174. if (blackPixels) {
  12175. do {
  12176. code1 += code3 = this._getBlackCode();
  12177. } while (code3 >= 64);
  12178. do {
  12179. code2 += code3 = this._getWhiteCode();
  12180. } while (code3 >= 64);
  12181. } else {
  12182. do {
  12183. code1 += code3 = this._getWhiteCode();
  12184. } while (code3 >= 64);
  12185. do {
  12186. code2 += code3 = this._getBlackCode();
  12187. } while (code3 >= 64);
  12188. }
  12189. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  12190. if (codingLine[this.codingPos] < columns) {
  12191. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  12192. }
  12193. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12194. refPos += 2;
  12195. }
  12196. break;
  12197. case twoDimVertR3:
  12198. this._addPixels(refLine[refPos] + 3, blackPixels);
  12199. blackPixels ^= 1;
  12200. if (codingLine[this.codingPos] < columns) {
  12201. ++refPos;
  12202. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12203. refPos += 2;
  12204. }
  12205. }
  12206. break;
  12207. case twoDimVertR2:
  12208. this._addPixels(refLine[refPos] + 2, blackPixels);
  12209. blackPixels ^= 1;
  12210. if (codingLine[this.codingPos] < columns) {
  12211. ++refPos;
  12212. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12213. refPos += 2;
  12214. }
  12215. }
  12216. break;
  12217. case twoDimVertR1:
  12218. this._addPixels(refLine[refPos] + 1, blackPixels);
  12219. blackPixels ^= 1;
  12220. if (codingLine[this.codingPos] < columns) {
  12221. ++refPos;
  12222. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12223. refPos += 2;
  12224. }
  12225. }
  12226. break;
  12227. case twoDimVert0:
  12228. this._addPixels(refLine[refPos], blackPixels);
  12229. blackPixels ^= 1;
  12230. if (codingLine[this.codingPos] < columns) {
  12231. ++refPos;
  12232. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12233. refPos += 2;
  12234. }
  12235. }
  12236. break;
  12237. case twoDimVertL3:
  12238. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  12239. blackPixels ^= 1;
  12240. if (codingLine[this.codingPos] < columns) {
  12241. if (refPos > 0) {
  12242. --refPos;
  12243. } else {
  12244. ++refPos;
  12245. }
  12246. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12247. refPos += 2;
  12248. }
  12249. }
  12250. break;
  12251. case twoDimVertL2:
  12252. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  12253. blackPixels ^= 1;
  12254. if (codingLine[this.codingPos] < columns) {
  12255. if (refPos > 0) {
  12256. --refPos;
  12257. } else {
  12258. ++refPos;
  12259. }
  12260. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12261. refPos += 2;
  12262. }
  12263. }
  12264. break;
  12265. case twoDimVertL1:
  12266. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  12267. blackPixels ^= 1;
  12268. if (codingLine[this.codingPos] < columns) {
  12269. if (refPos > 0) {
  12270. --refPos;
  12271. } else {
  12272. ++refPos;
  12273. }
  12274. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  12275. refPos += 2;
  12276. }
  12277. }
  12278. break;
  12279. case ccittEOF:
  12280. this._addPixels(columns, 0);
  12281. this.eof = true;
  12282. break;
  12283. default:
  12284. (0, _util.info)("bad 2d code");
  12285. this._addPixels(columns, 0);
  12286. this.err = true;
  12287. }
  12288. }
  12289. } else {
  12290. codingLine[0] = 0;
  12291. this.codingPos = 0;
  12292. blackPixels = 0;
  12293. while (codingLine[this.codingPos] < columns) {
  12294. code1 = 0;
  12295. if (blackPixels) {
  12296. do {
  12297. code1 += code3 = this._getBlackCode();
  12298. } while (code3 >= 64);
  12299. } else {
  12300. do {
  12301. code1 += code3 = this._getWhiteCode();
  12302. } while (code3 >= 64);
  12303. }
  12304. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  12305. blackPixels ^= 1;
  12306. }
  12307. }
  12308. let gotEOL = false;
  12309. if (this.byteAlign) {
  12310. this.inputBits &= ~7;
  12311. }
  12312. if (!this.eoblock && this.row === this.rows - 1) {
  12313. this.rowsDone = true;
  12314. } else {
  12315. code1 = this._lookBits(12);
  12316. if (this.eoline) {
  12317. while (code1 !== ccittEOF && code1 !== 1) {
  12318. this._eatBits(1);
  12319. code1 = this._lookBits(12);
  12320. }
  12321. } else {
  12322. while (code1 === 0) {
  12323. this._eatBits(1);
  12324. code1 = this._lookBits(12);
  12325. }
  12326. }
  12327. if (code1 === 1) {
  12328. this._eatBits(12);
  12329. gotEOL = true;
  12330. } else if (code1 === ccittEOF) {
  12331. this.eof = true;
  12332. }
  12333. }
  12334. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  12335. this.nextLine2D = !this._lookBits(1);
  12336. this._eatBits(1);
  12337. }
  12338. if (this.eoblock && gotEOL && this.byteAlign) {
  12339. code1 = this._lookBits(12);
  12340. if (code1 === 1) {
  12341. this._eatBits(12);
  12342. if (this.encoding > 0) {
  12343. this._lookBits(1);
  12344. this._eatBits(1);
  12345. }
  12346. if (this.encoding >= 0) {
  12347. for (i = 0; i < 4; ++i) {
  12348. code1 = this._lookBits(12);
  12349. if (code1 !== 1) {
  12350. (0, _util.info)("bad rtc code: " + code1);
  12351. }
  12352. this._eatBits(12);
  12353. if (this.encoding > 0) {
  12354. this._lookBits(1);
  12355. this._eatBits(1);
  12356. }
  12357. }
  12358. }
  12359. this.eof = true;
  12360. }
  12361. } else if (this.err && this.eoline) {
  12362. while (true) {
  12363. code1 = this._lookBits(13);
  12364. if (code1 === ccittEOF) {
  12365. this.eof = true;
  12366. return -1;
  12367. }
  12368. if (code1 >> 1 === 1) {
  12369. break;
  12370. }
  12371. this._eatBits(1);
  12372. }
  12373. this._eatBits(12);
  12374. if (this.encoding > 0) {
  12375. this._eatBits(1);
  12376. this.nextLine2D = !(code1 & 1);
  12377. }
  12378. }
  12379. if (codingLine[0] > 0) {
  12380. this.outputBits = codingLine[this.codingPos = 0];
  12381. } else {
  12382. this.outputBits = codingLine[this.codingPos = 1];
  12383. }
  12384. this.row++;
  12385. }
  12386. let c;
  12387. if (this.outputBits >= 8) {
  12388. c = this.codingPos & 1 ? 0 : 0xff;
  12389. this.outputBits -= 8;
  12390. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  12391. this.codingPos++;
  12392. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  12393. }
  12394. } else {
  12395. bits = 8;
  12396. c = 0;
  12397. do {
  12398. if (this.outputBits > bits) {
  12399. c <<= bits;
  12400. if (!(this.codingPos & 1)) {
  12401. c |= 0xff >> 8 - bits;
  12402. }
  12403. this.outputBits -= bits;
  12404. bits = 0;
  12405. } else {
  12406. c <<= this.outputBits;
  12407. if (!(this.codingPos & 1)) {
  12408. c |= 0xff >> 8 - this.outputBits;
  12409. }
  12410. bits -= this.outputBits;
  12411. this.outputBits = 0;
  12412. if (codingLine[this.codingPos] < columns) {
  12413. this.codingPos++;
  12414. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  12415. } else if (bits > 0) {
  12416. c <<= bits;
  12417. bits = 0;
  12418. }
  12419. }
  12420. } while (bits);
  12421. }
  12422. if (this.black) {
  12423. c ^= 0xff;
  12424. }
  12425. return c;
  12426. }
  12427. _addPixels(a1, blackPixels) {
  12428. const codingLine = this.codingLine;
  12429. let codingPos = this.codingPos;
  12430. if (a1 > codingLine[codingPos]) {
  12431. if (a1 > this.columns) {
  12432. (0, _util.info)("row is wrong length");
  12433. this.err = true;
  12434. a1 = this.columns;
  12435. }
  12436. if (codingPos & 1 ^ blackPixels) {
  12437. ++codingPos;
  12438. }
  12439. codingLine[codingPos] = a1;
  12440. }
  12441. this.codingPos = codingPos;
  12442. }
  12443. _addPixelsNeg(a1, blackPixels) {
  12444. const codingLine = this.codingLine;
  12445. let codingPos = this.codingPos;
  12446. if (a1 > codingLine[codingPos]) {
  12447. if (a1 > this.columns) {
  12448. (0, _util.info)("row is wrong length");
  12449. this.err = true;
  12450. a1 = this.columns;
  12451. }
  12452. if (codingPos & 1 ^ blackPixels) {
  12453. ++codingPos;
  12454. }
  12455. codingLine[codingPos] = a1;
  12456. } else if (a1 < codingLine[codingPos]) {
  12457. if (a1 < 0) {
  12458. (0, _util.info)("invalid code");
  12459. this.err = true;
  12460. a1 = 0;
  12461. }
  12462. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  12463. --codingPos;
  12464. }
  12465. codingLine[codingPos] = a1;
  12466. }
  12467. this.codingPos = codingPos;
  12468. }
  12469. _findTableCode(start, end, table, limit) {
  12470. const limitValue = limit || 0;
  12471. for (let i = start; i <= end; ++i) {
  12472. let code = this._lookBits(i);
  12473. if (code === ccittEOF) {
  12474. return [true, 1, false];
  12475. }
  12476. if (i < end) {
  12477. code <<= end - i;
  12478. }
  12479. if (!limitValue || code >= limitValue) {
  12480. const p = table[code - limitValue];
  12481. if (p[0] === i) {
  12482. this._eatBits(i);
  12483. return [true, p[1], true];
  12484. }
  12485. }
  12486. }
  12487. return [false, 0, false];
  12488. }
  12489. _getTwoDimCode() {
  12490. let code = 0;
  12491. let p;
  12492. if (this.eoblock) {
  12493. code = this._lookBits(7);
  12494. p = twoDimTable[code];
  12495. if (p && p[0] > 0) {
  12496. this._eatBits(p[0]);
  12497. return p[1];
  12498. }
  12499. } else {
  12500. const result = this._findTableCode(1, 7, twoDimTable);
  12501. if (result[0] && result[2]) {
  12502. return result[1];
  12503. }
  12504. }
  12505. (0, _util.info)("Bad two dim code");
  12506. return ccittEOF;
  12507. }
  12508. _getWhiteCode() {
  12509. let code = 0;
  12510. let p;
  12511. if (this.eoblock) {
  12512. code = this._lookBits(12);
  12513. if (code === ccittEOF) {
  12514. return 1;
  12515. }
  12516. if (code >> 5 === 0) {
  12517. p = whiteTable1[code];
  12518. } else {
  12519. p = whiteTable2[code >> 3];
  12520. }
  12521. if (p[0] > 0) {
  12522. this._eatBits(p[0]);
  12523. return p[1];
  12524. }
  12525. } else {
  12526. let result = this._findTableCode(1, 9, whiteTable2);
  12527. if (result[0]) {
  12528. return result[1];
  12529. }
  12530. result = this._findTableCode(11, 12, whiteTable1);
  12531. if (result[0]) {
  12532. return result[1];
  12533. }
  12534. }
  12535. (0, _util.info)("bad white code");
  12536. this._eatBits(1);
  12537. return 1;
  12538. }
  12539. _getBlackCode() {
  12540. let code, p;
  12541. if (this.eoblock) {
  12542. code = this._lookBits(13);
  12543. if (code === ccittEOF) {
  12544. return 1;
  12545. }
  12546. if (code >> 7 === 0) {
  12547. p = blackTable1[code];
  12548. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  12549. p = blackTable2[(code >> 1) - 64];
  12550. } else {
  12551. p = blackTable3[code >> 7];
  12552. }
  12553. if (p[0] > 0) {
  12554. this._eatBits(p[0]);
  12555. return p[1];
  12556. }
  12557. } else {
  12558. let result = this._findTableCode(2, 6, blackTable3);
  12559. if (result[0]) {
  12560. return result[1];
  12561. }
  12562. result = this._findTableCode(7, 12, blackTable2, 64);
  12563. if (result[0]) {
  12564. return result[1];
  12565. }
  12566. result = this._findTableCode(10, 13, blackTable1);
  12567. if (result[0]) {
  12568. return result[1];
  12569. }
  12570. }
  12571. (0, _util.info)("bad black code");
  12572. this._eatBits(1);
  12573. return 1;
  12574. }
  12575. _lookBits(n) {
  12576. let c;
  12577. while (this.inputBits < n) {
  12578. if ((c = this.source.next()) === -1) {
  12579. if (this.inputBits === 0) {
  12580. return ccittEOF;
  12581. }
  12582. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  12583. }
  12584. this.inputBuf = this.inputBuf << 8 | c;
  12585. this.inputBits += 8;
  12586. }
  12587. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  12588. }
  12589. _eatBits(n) {
  12590. if ((this.inputBits -= n) < 0) {
  12591. this.inputBits = 0;
  12592. }
  12593. }
  12594. }
  12595. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  12596. /***/ }),
  12597. /* 23 */
  12598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12599. Object.defineProperty(exports, "__esModule", ({
  12600. value: true
  12601. }));
  12602. exports.FlateStream = void 0;
  12603. var _decode_stream = __w_pdfjs_require__(19);
  12604. var _util = __w_pdfjs_require__(2);
  12605. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  12606. 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]);
  12607. 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]);
  12608. 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];
  12609. 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];
  12610. class FlateStream extends _decode_stream.DecodeStream {
  12611. constructor(str, maybeLength) {
  12612. super(maybeLength);
  12613. this.str = str;
  12614. this.dict = str.dict;
  12615. const cmf = str.getByte();
  12616. const flg = str.getByte();
  12617. if (cmf === -1 || flg === -1) {
  12618. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  12619. }
  12620. if ((cmf & 0x0f) !== 0x08) {
  12621. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  12622. }
  12623. if (((cmf << 8) + flg) % 31 !== 0) {
  12624. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  12625. }
  12626. if (flg & 0x20) {
  12627. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  12628. }
  12629. this.codeSize = 0;
  12630. this.codeBuf = 0;
  12631. }
  12632. getBits(bits) {
  12633. const str = this.str;
  12634. let codeSize = this.codeSize;
  12635. let codeBuf = this.codeBuf;
  12636. let b;
  12637. while (codeSize < bits) {
  12638. if ((b = str.getByte()) === -1) {
  12639. throw new _util.FormatError("Bad encoding in flate stream");
  12640. }
  12641. codeBuf |= b << codeSize;
  12642. codeSize += 8;
  12643. }
  12644. b = codeBuf & (1 << bits) - 1;
  12645. this.codeBuf = codeBuf >> bits;
  12646. this.codeSize = codeSize -= bits;
  12647. return b;
  12648. }
  12649. getCode(table) {
  12650. const str = this.str;
  12651. const codes = table[0];
  12652. const maxLen = table[1];
  12653. let codeSize = this.codeSize;
  12654. let codeBuf = this.codeBuf;
  12655. let b;
  12656. while (codeSize < maxLen) {
  12657. if ((b = str.getByte()) === -1) {
  12658. break;
  12659. }
  12660. codeBuf |= b << codeSize;
  12661. codeSize += 8;
  12662. }
  12663. const code = codes[codeBuf & (1 << maxLen) - 1];
  12664. const codeLen = code >> 16;
  12665. const codeVal = code & 0xffff;
  12666. if (codeLen < 1 || codeSize < codeLen) {
  12667. throw new _util.FormatError("Bad encoding in flate stream");
  12668. }
  12669. this.codeBuf = codeBuf >> codeLen;
  12670. this.codeSize = codeSize - codeLen;
  12671. return codeVal;
  12672. }
  12673. generateHuffmanTable(lengths) {
  12674. const n = lengths.length;
  12675. let maxLen = 0;
  12676. let i;
  12677. for (i = 0; i < n; ++i) {
  12678. if (lengths[i] > maxLen) {
  12679. maxLen = lengths[i];
  12680. }
  12681. }
  12682. const size = 1 << maxLen;
  12683. const codes = new Int32Array(size);
  12684. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  12685. for (let val = 0; val < n; ++val) {
  12686. if (lengths[val] === len) {
  12687. let code2 = 0;
  12688. let t = code;
  12689. for (i = 0; i < len; ++i) {
  12690. code2 = code2 << 1 | t & 1;
  12691. t >>= 1;
  12692. }
  12693. for (i = code2; i < size; i += skip) {
  12694. codes[i] = len << 16 | val;
  12695. }
  12696. ++code;
  12697. }
  12698. }
  12699. }
  12700. return [codes, maxLen];
  12701. }
  12702. readBlock() {
  12703. let buffer, len;
  12704. const str = this.str;
  12705. let hdr = this.getBits(3);
  12706. if (hdr & 1) {
  12707. this.eof = true;
  12708. }
  12709. hdr >>= 1;
  12710. if (hdr === 0) {
  12711. let b;
  12712. if ((b = str.getByte()) === -1) {
  12713. throw new _util.FormatError("Bad block header in flate stream");
  12714. }
  12715. let blockLen = b;
  12716. if ((b = str.getByte()) === -1) {
  12717. throw new _util.FormatError("Bad block header in flate stream");
  12718. }
  12719. blockLen |= b << 8;
  12720. if ((b = str.getByte()) === -1) {
  12721. throw new _util.FormatError("Bad block header in flate stream");
  12722. }
  12723. let check = b;
  12724. if ((b = str.getByte()) === -1) {
  12725. throw new _util.FormatError("Bad block header in flate stream");
  12726. }
  12727. check |= b << 8;
  12728. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  12729. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  12730. }
  12731. this.codeBuf = 0;
  12732. this.codeSize = 0;
  12733. const bufferLength = this.bufferLength,
  12734. end = bufferLength + blockLen;
  12735. buffer = this.ensureBuffer(end);
  12736. this.bufferLength = end;
  12737. if (blockLen === 0) {
  12738. if (str.peekByte() === -1) {
  12739. this.eof = true;
  12740. }
  12741. } else {
  12742. const block = str.getBytes(blockLen);
  12743. buffer.set(block, bufferLength);
  12744. if (block.length < blockLen) {
  12745. this.eof = true;
  12746. }
  12747. }
  12748. return;
  12749. }
  12750. let litCodeTable;
  12751. let distCodeTable;
  12752. if (hdr === 1) {
  12753. litCodeTable = fixedLitCodeTab;
  12754. distCodeTable = fixedDistCodeTab;
  12755. } else if (hdr === 2) {
  12756. const numLitCodes = this.getBits(5) + 257;
  12757. const numDistCodes = this.getBits(5) + 1;
  12758. const numCodeLenCodes = this.getBits(4) + 4;
  12759. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  12760. let i;
  12761. for (i = 0; i < numCodeLenCodes; ++i) {
  12762. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  12763. }
  12764. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  12765. len = 0;
  12766. i = 0;
  12767. const codes = numLitCodes + numDistCodes;
  12768. const codeLengths = new Uint8Array(codes);
  12769. let bitsLength, bitsOffset, what;
  12770. while (i < codes) {
  12771. const code = this.getCode(codeLenCodeTab);
  12772. if (code === 16) {
  12773. bitsLength = 2;
  12774. bitsOffset = 3;
  12775. what = len;
  12776. } else if (code === 17) {
  12777. bitsLength = 3;
  12778. bitsOffset = 3;
  12779. what = len = 0;
  12780. } else if (code === 18) {
  12781. bitsLength = 7;
  12782. bitsOffset = 11;
  12783. what = len = 0;
  12784. } else {
  12785. codeLengths[i++] = len = code;
  12786. continue;
  12787. }
  12788. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  12789. while (repeatLength-- > 0) {
  12790. codeLengths[i++] = what;
  12791. }
  12792. }
  12793. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  12794. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  12795. } else {
  12796. throw new _util.FormatError("Unknown block type in flate stream");
  12797. }
  12798. buffer = this.buffer;
  12799. let limit = buffer ? buffer.length : 0;
  12800. let pos = this.bufferLength;
  12801. while (true) {
  12802. let code1 = this.getCode(litCodeTable);
  12803. if (code1 < 256) {
  12804. if (pos + 1 >= limit) {
  12805. buffer = this.ensureBuffer(pos + 1);
  12806. limit = buffer.length;
  12807. }
  12808. buffer[pos++] = code1;
  12809. continue;
  12810. }
  12811. if (code1 === 256) {
  12812. this.bufferLength = pos;
  12813. return;
  12814. }
  12815. code1 -= 257;
  12816. code1 = lengthDecode[code1];
  12817. let code2 = code1 >> 16;
  12818. if (code2 > 0) {
  12819. code2 = this.getBits(code2);
  12820. }
  12821. len = (code1 & 0xffff) + code2;
  12822. code1 = this.getCode(distCodeTable);
  12823. code1 = distDecode[code1];
  12824. code2 = code1 >> 16;
  12825. if (code2 > 0) {
  12826. code2 = this.getBits(code2);
  12827. }
  12828. const dist = (code1 & 0xffff) + code2;
  12829. if (pos + len >= limit) {
  12830. buffer = this.ensureBuffer(pos + len);
  12831. limit = buffer.length;
  12832. }
  12833. for (let k = 0; k < len; ++k, ++pos) {
  12834. buffer[pos] = buffer[pos - dist];
  12835. }
  12836. }
  12837. }
  12838. }
  12839. exports.FlateStream = FlateStream;
  12840. /***/ }),
  12841. /* 24 */
  12842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12843. Object.defineProperty(exports, "__esModule", ({
  12844. value: true
  12845. }));
  12846. exports.Jbig2Stream = void 0;
  12847. var _primitives = __w_pdfjs_require__(5);
  12848. var _decode_stream = __w_pdfjs_require__(19);
  12849. var _jbig = __w_pdfjs_require__(25);
  12850. var _util = __w_pdfjs_require__(2);
  12851. class Jbig2Stream extends _decode_stream.DecodeStream {
  12852. constructor(stream, maybeLength, params) {
  12853. super(maybeLength);
  12854. this.stream = stream;
  12855. this.dict = stream.dict;
  12856. this.maybeLength = maybeLength;
  12857. this.params = params;
  12858. }
  12859. get bytes() {
  12860. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  12861. }
  12862. ensureBuffer(requested) {}
  12863. readBlock() {
  12864. if (this.eof) {
  12865. return;
  12866. }
  12867. const jbig2Image = new _jbig.Jbig2Image();
  12868. const chunks = [];
  12869. if ((0, _primitives.isDict)(this.params)) {
  12870. const globalsStream = this.params.get("JBIG2Globals");
  12871. if ((0, _primitives.isStream)(globalsStream)) {
  12872. const globals = globalsStream.getBytes();
  12873. chunks.push({
  12874. data: globals,
  12875. start: 0,
  12876. end: globals.length
  12877. });
  12878. }
  12879. }
  12880. chunks.push({
  12881. data: this.bytes,
  12882. start: 0,
  12883. end: this.bytes.length
  12884. });
  12885. const data = jbig2Image.parseChunks(chunks);
  12886. const dataLength = data.length;
  12887. for (let i = 0; i < dataLength; i++) {
  12888. data[i] ^= 0xff;
  12889. }
  12890. this.buffer = data;
  12891. this.bufferLength = dataLength;
  12892. this.eof = true;
  12893. }
  12894. }
  12895. exports.Jbig2Stream = Jbig2Stream;
  12896. /***/ }),
  12897. /* 25 */
  12898. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12899. Object.defineProperty(exports, "__esModule", ({
  12900. value: true
  12901. }));
  12902. exports.Jbig2Image = void 0;
  12903. var _util = __w_pdfjs_require__(2);
  12904. var _core_utils = __w_pdfjs_require__(9);
  12905. var _arithmetic_decoder = __w_pdfjs_require__(26);
  12906. var _ccitt = __w_pdfjs_require__(22);
  12907. class Jbig2Error extends _util.BaseException {
  12908. constructor(msg) {
  12909. super(`JBIG2 error: ${msg}`);
  12910. }
  12911. }
  12912. class ContextCache {
  12913. getContexts(id) {
  12914. if (id in this) {
  12915. return this[id];
  12916. }
  12917. return this[id] = new Int8Array(1 << 16);
  12918. }
  12919. }
  12920. class DecodingContext {
  12921. constructor(data, start, end) {
  12922. this.data = data;
  12923. this.start = start;
  12924. this.end = end;
  12925. }
  12926. get decoder() {
  12927. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  12928. return (0, _util.shadow)(this, "decoder", decoder);
  12929. }
  12930. get contextCache() {
  12931. const cache = new ContextCache();
  12932. return (0, _util.shadow)(this, "contextCache", cache);
  12933. }
  12934. }
  12935. function decodeInteger(contextCache, procedure, decoder) {
  12936. const contexts = contextCache.getContexts(procedure);
  12937. let prev = 1;
  12938. function readBits(length) {
  12939. let v = 0;
  12940. for (let i = 0; i < length; i++) {
  12941. const bit = decoder.readBit(contexts, prev);
  12942. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  12943. v = v << 1 | bit;
  12944. }
  12945. return v >>> 0;
  12946. }
  12947. const sign = readBits(1);
  12948. 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);
  12949. if (sign === 0) {
  12950. return value;
  12951. } else if (value > 0) {
  12952. return -value;
  12953. }
  12954. return null;
  12955. }
  12956. function decodeIAID(contextCache, decoder, codeLength) {
  12957. const contexts = contextCache.getContexts("IAID");
  12958. let prev = 1;
  12959. for (let i = 0; i < codeLength; i++) {
  12960. const bit = decoder.readBit(contexts, prev);
  12961. prev = prev << 1 | bit;
  12962. }
  12963. if (codeLength < 31) {
  12964. return prev & (1 << codeLength) - 1;
  12965. }
  12966. return prev & 0x7fffffff;
  12967. }
  12968. 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"];
  12969. const CodingTemplates = [[{
  12970. x: -1,
  12971. y: -2
  12972. }, {
  12973. x: 0,
  12974. y: -2
  12975. }, {
  12976. x: 1,
  12977. y: -2
  12978. }, {
  12979. x: -2,
  12980. y: -1
  12981. }, {
  12982. x: -1,
  12983. y: -1
  12984. }, {
  12985. x: 0,
  12986. y: -1
  12987. }, {
  12988. x: 1,
  12989. y: -1
  12990. }, {
  12991. x: 2,
  12992. y: -1
  12993. }, {
  12994. x: -4,
  12995. y: 0
  12996. }, {
  12997. x: -3,
  12998. y: 0
  12999. }, {
  13000. x: -2,
  13001. y: 0
  13002. }, {
  13003. x: -1,
  13004. y: 0
  13005. }], [{
  13006. x: -1,
  13007. y: -2
  13008. }, {
  13009. x: 0,
  13010. y: -2
  13011. }, {
  13012. x: 1,
  13013. y: -2
  13014. }, {
  13015. x: 2,
  13016. y: -2
  13017. }, {
  13018. x: -2,
  13019. y: -1
  13020. }, {
  13021. x: -1,
  13022. y: -1
  13023. }, {
  13024. x: 0,
  13025. y: -1
  13026. }, {
  13027. x: 1,
  13028. y: -1
  13029. }, {
  13030. x: 2,
  13031. y: -1
  13032. }, {
  13033. x: -3,
  13034. y: 0
  13035. }, {
  13036. x: -2,
  13037. y: 0
  13038. }, {
  13039. x: -1,
  13040. y: 0
  13041. }], [{
  13042. x: -1,
  13043. y: -2
  13044. }, {
  13045. x: 0,
  13046. y: -2
  13047. }, {
  13048. x: 1,
  13049. y: -2
  13050. }, {
  13051. x: -2,
  13052. y: -1
  13053. }, {
  13054. x: -1,
  13055. y: -1
  13056. }, {
  13057. x: 0,
  13058. y: -1
  13059. }, {
  13060. x: 1,
  13061. y: -1
  13062. }, {
  13063. x: -2,
  13064. y: 0
  13065. }, {
  13066. x: -1,
  13067. y: 0
  13068. }], [{
  13069. x: -3,
  13070. y: -1
  13071. }, {
  13072. x: -2,
  13073. y: -1
  13074. }, {
  13075. x: -1,
  13076. y: -1
  13077. }, {
  13078. x: 0,
  13079. y: -1
  13080. }, {
  13081. x: 1,
  13082. y: -1
  13083. }, {
  13084. x: -4,
  13085. y: 0
  13086. }, {
  13087. x: -3,
  13088. y: 0
  13089. }, {
  13090. x: -2,
  13091. y: 0
  13092. }, {
  13093. x: -1,
  13094. y: 0
  13095. }]];
  13096. const RefinementTemplates = [{
  13097. coding: [{
  13098. x: 0,
  13099. y: -1
  13100. }, {
  13101. x: 1,
  13102. y: -1
  13103. }, {
  13104. x: -1,
  13105. y: 0
  13106. }],
  13107. reference: [{
  13108. x: 0,
  13109. y: -1
  13110. }, {
  13111. x: 1,
  13112. y: -1
  13113. }, {
  13114. x: -1,
  13115. y: 0
  13116. }, {
  13117. x: 0,
  13118. y: 0
  13119. }, {
  13120. x: 1,
  13121. y: 0
  13122. }, {
  13123. x: -1,
  13124. y: 1
  13125. }, {
  13126. x: 0,
  13127. y: 1
  13128. }, {
  13129. x: 1,
  13130. y: 1
  13131. }]
  13132. }, {
  13133. coding: [{
  13134. x: -1,
  13135. y: -1
  13136. }, {
  13137. x: 0,
  13138. y: -1
  13139. }, {
  13140. x: 1,
  13141. y: -1
  13142. }, {
  13143. x: -1,
  13144. y: 0
  13145. }],
  13146. reference: [{
  13147. x: 0,
  13148. y: -1
  13149. }, {
  13150. x: -1,
  13151. y: 0
  13152. }, {
  13153. x: 0,
  13154. y: 0
  13155. }, {
  13156. x: 1,
  13157. y: 0
  13158. }, {
  13159. x: 0,
  13160. y: 1
  13161. }, {
  13162. x: 1,
  13163. y: 1
  13164. }]
  13165. }];
  13166. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  13167. const RefinementReusedContexts = [0x0020, 0x0008];
  13168. function decodeBitmapTemplate0(width, height, decodingContext) {
  13169. const decoder = decodingContext.decoder;
  13170. const contexts = decodingContext.contextCache.getContexts("GB");
  13171. const bitmap = [];
  13172. let contextLabel, i, j, pixel, row, row1, row2;
  13173. const OLD_PIXEL_MASK = 0x7bf7;
  13174. for (i = 0; i < height; i++) {
  13175. row = bitmap[i] = new Uint8Array(width);
  13176. row1 = i < 1 ? row : bitmap[i - 1];
  13177. row2 = i < 2 ? row : bitmap[i - 2];
  13178. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  13179. for (j = 0; j < width; j++) {
  13180. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  13181. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  13182. }
  13183. }
  13184. return bitmap;
  13185. }
  13186. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  13187. if (mmr) {
  13188. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  13189. return decodeMMRBitmap(input, width, height, false);
  13190. }
  13191. 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) {
  13192. return decodeBitmapTemplate0(width, height, decodingContext);
  13193. }
  13194. const useskip = !!skip;
  13195. const template = CodingTemplates[templateIndex].concat(at);
  13196. template.sort(function (a, b) {
  13197. return a.y - b.y || a.x - b.x;
  13198. });
  13199. const templateLength = template.length;
  13200. const templateX = new Int8Array(templateLength);
  13201. const templateY = new Int8Array(templateLength);
  13202. const changingTemplateEntries = [];
  13203. let reuseMask = 0,
  13204. minX = 0,
  13205. maxX = 0,
  13206. minY = 0;
  13207. let c, k;
  13208. for (k = 0; k < templateLength; k++) {
  13209. templateX[k] = template[k].x;
  13210. templateY[k] = template[k].y;
  13211. minX = Math.min(minX, template[k].x);
  13212. maxX = Math.max(maxX, template[k].x);
  13213. minY = Math.min(minY, template[k].y);
  13214. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  13215. reuseMask |= 1 << templateLength - 1 - k;
  13216. } else {
  13217. changingTemplateEntries.push(k);
  13218. }
  13219. }
  13220. const changingEntriesLength = changingTemplateEntries.length;
  13221. const changingTemplateX = new Int8Array(changingEntriesLength);
  13222. const changingTemplateY = new Int8Array(changingEntriesLength);
  13223. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  13224. for (c = 0; c < changingEntriesLength; c++) {
  13225. k = changingTemplateEntries[c];
  13226. changingTemplateX[c] = template[k].x;
  13227. changingTemplateY[c] = template[k].y;
  13228. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  13229. }
  13230. const sbb_left = -minX;
  13231. const sbb_top = -minY;
  13232. const sbb_right = width - maxX;
  13233. const pseudoPixelContext = ReusedContexts[templateIndex];
  13234. let row = new Uint8Array(width);
  13235. const bitmap = [];
  13236. const decoder = decodingContext.decoder;
  13237. const contexts = decodingContext.contextCache.getContexts("GB");
  13238. let ltp = 0,
  13239. j,
  13240. i0,
  13241. j0,
  13242. contextLabel = 0,
  13243. bit,
  13244. shift;
  13245. for (let i = 0; i < height; i++) {
  13246. if (prediction) {
  13247. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  13248. ltp ^= sltp;
  13249. if (ltp) {
  13250. bitmap.push(row);
  13251. continue;
  13252. }
  13253. }
  13254. row = new Uint8Array(row);
  13255. bitmap.push(row);
  13256. for (j = 0; j < width; j++) {
  13257. if (useskip && skip[i][j]) {
  13258. row[j] = 0;
  13259. continue;
  13260. }
  13261. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  13262. contextLabel = contextLabel << 1 & reuseMask;
  13263. for (k = 0; k < changingEntriesLength; k++) {
  13264. i0 = i + changingTemplateY[k];
  13265. j0 = j + changingTemplateX[k];
  13266. bit = bitmap[i0][j0];
  13267. if (bit) {
  13268. bit = changingTemplateBit[k];
  13269. contextLabel |= bit;
  13270. }
  13271. }
  13272. } else {
  13273. contextLabel = 0;
  13274. shift = templateLength - 1;
  13275. for (k = 0; k < templateLength; k++, shift--) {
  13276. j0 = j + templateX[k];
  13277. if (j0 >= 0 && j0 < width) {
  13278. i0 = i + templateY[k];
  13279. if (i0 >= 0) {
  13280. bit = bitmap[i0][j0];
  13281. if (bit) {
  13282. contextLabel |= bit << shift;
  13283. }
  13284. }
  13285. }
  13286. }
  13287. }
  13288. const pixel = decoder.readBit(contexts, contextLabel);
  13289. row[j] = pixel;
  13290. }
  13291. }
  13292. return bitmap;
  13293. }
  13294. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  13295. let codingTemplate = RefinementTemplates[templateIndex].coding;
  13296. if (templateIndex === 0) {
  13297. codingTemplate = codingTemplate.concat([at[0]]);
  13298. }
  13299. const codingTemplateLength = codingTemplate.length;
  13300. const codingTemplateX = new Int32Array(codingTemplateLength);
  13301. const codingTemplateY = new Int32Array(codingTemplateLength);
  13302. let k;
  13303. for (k = 0; k < codingTemplateLength; k++) {
  13304. codingTemplateX[k] = codingTemplate[k].x;
  13305. codingTemplateY[k] = codingTemplate[k].y;
  13306. }
  13307. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  13308. if (templateIndex === 0) {
  13309. referenceTemplate = referenceTemplate.concat([at[1]]);
  13310. }
  13311. const referenceTemplateLength = referenceTemplate.length;
  13312. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  13313. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  13314. for (k = 0; k < referenceTemplateLength; k++) {
  13315. referenceTemplateX[k] = referenceTemplate[k].x;
  13316. referenceTemplateY[k] = referenceTemplate[k].y;
  13317. }
  13318. const referenceWidth = referenceBitmap[0].length;
  13319. const referenceHeight = referenceBitmap.length;
  13320. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  13321. const bitmap = [];
  13322. const decoder = decodingContext.decoder;
  13323. const contexts = decodingContext.contextCache.getContexts("GR");
  13324. let ltp = 0;
  13325. for (let i = 0; i < height; i++) {
  13326. if (prediction) {
  13327. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  13328. ltp ^= sltp;
  13329. if (ltp) {
  13330. throw new Jbig2Error("prediction is not supported");
  13331. }
  13332. }
  13333. const row = new Uint8Array(width);
  13334. bitmap.push(row);
  13335. for (let j = 0; j < width; j++) {
  13336. let i0, j0;
  13337. let contextLabel = 0;
  13338. for (k = 0; k < codingTemplateLength; k++) {
  13339. i0 = i + codingTemplateY[k];
  13340. j0 = j + codingTemplateX[k];
  13341. if (i0 < 0 || j0 < 0 || j0 >= width) {
  13342. contextLabel <<= 1;
  13343. } else {
  13344. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  13345. }
  13346. }
  13347. for (k = 0; k < referenceTemplateLength; k++) {
  13348. i0 = i + referenceTemplateY[k] - offsetY;
  13349. j0 = j + referenceTemplateX[k] - offsetX;
  13350. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  13351. contextLabel <<= 1;
  13352. } else {
  13353. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  13354. }
  13355. }
  13356. const pixel = decoder.readBit(contexts, contextLabel);
  13357. row[j] = pixel;
  13358. }
  13359. }
  13360. return bitmap;
  13361. }
  13362. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  13363. if (huffman && refinement) {
  13364. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  13365. }
  13366. const newSymbols = [];
  13367. let currentHeight = 0;
  13368. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  13369. const decoder = decodingContext.decoder;
  13370. const contextCache = decodingContext.contextCache;
  13371. let tableB1, symbolWidths;
  13372. if (huffman) {
  13373. tableB1 = getStandardTable(1);
  13374. symbolWidths = [];
  13375. symbolCodeLength = Math.max(symbolCodeLength, 1);
  13376. }
  13377. while (newSymbols.length < numberOfNewSymbols) {
  13378. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  13379. currentHeight += deltaHeight;
  13380. let currentWidth = 0,
  13381. totalWidth = 0;
  13382. const firstSymbol = huffman ? symbolWidths.length : 0;
  13383. while (true) {
  13384. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  13385. if (deltaWidth === null) {
  13386. break;
  13387. }
  13388. currentWidth += deltaWidth;
  13389. totalWidth += currentWidth;
  13390. let bitmap;
  13391. if (refinement) {
  13392. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  13393. if (numberOfInstances > 1) {
  13394. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  13395. } else {
  13396. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  13397. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  13398. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  13399. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  13400. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  13401. }
  13402. newSymbols.push(bitmap);
  13403. } else if (huffman) {
  13404. symbolWidths.push(currentWidth);
  13405. } else {
  13406. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  13407. newSymbols.push(bitmap);
  13408. }
  13409. }
  13410. if (huffman && !refinement) {
  13411. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  13412. huffmanInput.byteAlign();
  13413. let collectiveBitmap;
  13414. if (bitmapSize === 0) {
  13415. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  13416. } else {
  13417. const originalEnd = huffmanInput.end;
  13418. const bitmapEnd = huffmanInput.position + bitmapSize;
  13419. huffmanInput.end = bitmapEnd;
  13420. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  13421. huffmanInput.end = originalEnd;
  13422. huffmanInput.position = bitmapEnd;
  13423. }
  13424. const numberOfSymbolsDecoded = symbolWidths.length;
  13425. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  13426. newSymbols.push(collectiveBitmap);
  13427. } else {
  13428. let i,
  13429. y,
  13430. xMin = 0,
  13431. xMax,
  13432. bitmapWidth,
  13433. symbolBitmap;
  13434. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  13435. bitmapWidth = symbolWidths[i];
  13436. xMax = xMin + bitmapWidth;
  13437. symbolBitmap = [];
  13438. for (y = 0; y < currentHeight; y++) {
  13439. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  13440. }
  13441. newSymbols.push(symbolBitmap);
  13442. xMin = xMax;
  13443. }
  13444. }
  13445. }
  13446. }
  13447. const exportedSymbols = [],
  13448. flags = [];
  13449. let currentFlag = false,
  13450. i,
  13451. ii;
  13452. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  13453. while (flags.length < totalSymbolsLength) {
  13454. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  13455. while (runLength--) {
  13456. flags.push(currentFlag);
  13457. }
  13458. currentFlag = !currentFlag;
  13459. }
  13460. for (i = 0, ii = symbols.length; i < ii; i++) {
  13461. if (flags[i]) {
  13462. exportedSymbols.push(symbols[i]);
  13463. }
  13464. }
  13465. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  13466. if (flags[i]) {
  13467. exportedSymbols.push(newSymbols[j]);
  13468. }
  13469. }
  13470. return exportedSymbols;
  13471. }
  13472. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  13473. if (huffman && refinement) {
  13474. throw new Jbig2Error("refinement with Huffman is not supported");
  13475. }
  13476. const bitmap = [];
  13477. let i, row;
  13478. for (i = 0; i < height; i++) {
  13479. row = new Uint8Array(width);
  13480. if (defaultPixelValue) {
  13481. for (let j = 0; j < width; j++) {
  13482. row[j] = defaultPixelValue;
  13483. }
  13484. }
  13485. bitmap.push(row);
  13486. }
  13487. const decoder = decodingContext.decoder;
  13488. const contextCache = decodingContext.contextCache;
  13489. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  13490. let firstS = 0;
  13491. i = 0;
  13492. while (i < numberOfSymbolInstances) {
  13493. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  13494. stripT += deltaT;
  13495. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  13496. firstS += deltaFirstS;
  13497. let currentS = firstS;
  13498. do {
  13499. let currentT = 0;
  13500. if (stripSize > 1) {
  13501. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  13502. }
  13503. const t = stripSize * stripT + currentT;
  13504. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  13505. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  13506. let symbolBitmap = inputSymbols[symbolId];
  13507. let symbolWidth = symbolBitmap[0].length;
  13508. let symbolHeight = symbolBitmap.length;
  13509. if (applyRefinement) {
  13510. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  13511. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  13512. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  13513. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  13514. symbolWidth += rdw;
  13515. symbolHeight += rdh;
  13516. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  13517. }
  13518. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  13519. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  13520. let s2, t2, symbolRow;
  13521. if (transposed) {
  13522. for (s2 = 0; s2 < symbolHeight; s2++) {
  13523. row = bitmap[offsetS + s2];
  13524. if (!row) {
  13525. continue;
  13526. }
  13527. symbolRow = symbolBitmap[s2];
  13528. const maxWidth = Math.min(width - offsetT, symbolWidth);
  13529. switch (combinationOperator) {
  13530. case 0:
  13531. for (t2 = 0; t2 < maxWidth; t2++) {
  13532. row[offsetT + t2] |= symbolRow[t2];
  13533. }
  13534. break;
  13535. case 2:
  13536. for (t2 = 0; t2 < maxWidth; t2++) {
  13537. row[offsetT + t2] ^= symbolRow[t2];
  13538. }
  13539. break;
  13540. default:
  13541. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  13542. }
  13543. }
  13544. currentS += symbolHeight - 1;
  13545. } else {
  13546. for (t2 = 0; t2 < symbolHeight; t2++) {
  13547. row = bitmap[offsetT + t2];
  13548. if (!row) {
  13549. continue;
  13550. }
  13551. symbolRow = symbolBitmap[t2];
  13552. switch (combinationOperator) {
  13553. case 0:
  13554. for (s2 = 0; s2 < symbolWidth; s2++) {
  13555. row[offsetS + s2] |= symbolRow[s2];
  13556. }
  13557. break;
  13558. case 2:
  13559. for (s2 = 0; s2 < symbolWidth; s2++) {
  13560. row[offsetS + s2] ^= symbolRow[s2];
  13561. }
  13562. break;
  13563. default:
  13564. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  13565. }
  13566. }
  13567. currentS += symbolWidth - 1;
  13568. }
  13569. i++;
  13570. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  13571. if (deltaS === null) {
  13572. break;
  13573. }
  13574. currentS += deltaS + dsOffset;
  13575. } while (true);
  13576. }
  13577. return bitmap;
  13578. }
  13579. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  13580. const at = [];
  13581. if (!mmr) {
  13582. at.push({
  13583. x: -patternWidth,
  13584. y: 0
  13585. });
  13586. if (template === 0) {
  13587. at.push({
  13588. x: -3,
  13589. y: -1
  13590. }, {
  13591. x: 2,
  13592. y: -2
  13593. }, {
  13594. x: -2,
  13595. y: -2
  13596. });
  13597. }
  13598. }
  13599. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  13600. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  13601. const patterns = [];
  13602. for (let i = 0; i <= maxPatternIndex; i++) {
  13603. const patternBitmap = [];
  13604. const xMin = patternWidth * i;
  13605. const xMax = xMin + patternWidth;
  13606. for (let y = 0; y < patternHeight; y++) {
  13607. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  13608. }
  13609. patterns.push(patternBitmap);
  13610. }
  13611. return patterns;
  13612. }
  13613. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  13614. const skip = null;
  13615. if (enableSkip) {
  13616. throw new Jbig2Error("skip is not supported");
  13617. }
  13618. if (combinationOperator !== 0) {
  13619. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  13620. }
  13621. const regionBitmap = [];
  13622. let i, j, row;
  13623. for (i = 0; i < regionHeight; i++) {
  13624. row = new Uint8Array(regionWidth);
  13625. if (defaultPixelValue) {
  13626. for (j = 0; j < regionWidth; j++) {
  13627. row[j] = defaultPixelValue;
  13628. }
  13629. }
  13630. regionBitmap.push(row);
  13631. }
  13632. const numberOfPatterns = patterns.length;
  13633. const pattern0 = patterns[0];
  13634. const patternWidth = pattern0[0].length,
  13635. patternHeight = pattern0.length;
  13636. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  13637. const at = [];
  13638. if (!mmr) {
  13639. at.push({
  13640. x: template <= 1 ? 3 : 2,
  13641. y: -1
  13642. });
  13643. if (template === 0) {
  13644. at.push({
  13645. x: -3,
  13646. y: -1
  13647. }, {
  13648. x: 2,
  13649. y: -2
  13650. }, {
  13651. x: -2,
  13652. y: -2
  13653. });
  13654. }
  13655. }
  13656. const grayScaleBitPlanes = [];
  13657. let mmrInput, bitmap;
  13658. if (mmr) {
  13659. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  13660. }
  13661. for (i = bitsPerValue - 1; i >= 0; i--) {
  13662. if (mmr) {
  13663. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  13664. } else {
  13665. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  13666. }
  13667. grayScaleBitPlanes[i] = bitmap;
  13668. }
  13669. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  13670. for (mg = 0; mg < gridHeight; mg++) {
  13671. for (ng = 0; ng < gridWidth; ng++) {
  13672. bit = 0;
  13673. patternIndex = 0;
  13674. for (j = bitsPerValue - 1; j >= 0; j--) {
  13675. bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
  13676. patternIndex |= bit << j;
  13677. }
  13678. patternBitmap = patterns[patternIndex];
  13679. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  13680. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  13681. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  13682. for (i = 0; i < patternHeight; i++) {
  13683. regionRow = regionBitmap[y + i];
  13684. patternRow = patternBitmap[i];
  13685. for (j = 0; j < patternWidth; j++) {
  13686. regionRow[x + j] |= patternRow[j];
  13687. }
  13688. }
  13689. } else {
  13690. let regionX, regionY;
  13691. for (i = 0; i < patternHeight; i++) {
  13692. regionY = y + i;
  13693. if (regionY < 0 || regionY >= regionHeight) {
  13694. continue;
  13695. }
  13696. regionRow = regionBitmap[regionY];
  13697. patternRow = patternBitmap[i];
  13698. for (j = 0; j < patternWidth; j++) {
  13699. regionX = x + j;
  13700. if (regionX >= 0 && regionX < regionWidth) {
  13701. regionRow[regionX] |= patternRow[j];
  13702. }
  13703. }
  13704. }
  13705. }
  13706. }
  13707. }
  13708. return regionBitmap;
  13709. }
  13710. function readSegmentHeader(data, start) {
  13711. const segmentHeader = {};
  13712. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  13713. const flags = data[start + 4];
  13714. const segmentType = flags & 0x3f;
  13715. if (!SegmentTypes[segmentType]) {
  13716. throw new Jbig2Error("invalid segment type: " + segmentType);
  13717. }
  13718. segmentHeader.type = segmentType;
  13719. segmentHeader.typeName = SegmentTypes[segmentType];
  13720. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  13721. const pageAssociationFieldSize = !!(flags & 0x40);
  13722. const referredFlags = data[start + 5];
  13723. let referredToCount = referredFlags >> 5 & 7;
  13724. const retainBits = [referredFlags & 31];
  13725. let position = start + 6;
  13726. if (referredFlags === 7) {
  13727. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  13728. position += 3;
  13729. let bytes = referredToCount + 7 >> 3;
  13730. retainBits[0] = data[position++];
  13731. while (--bytes > 0) {
  13732. retainBits.push(data[position++]);
  13733. }
  13734. } else if (referredFlags === 5 || referredFlags === 6) {
  13735. throw new Jbig2Error("invalid referred-to flags");
  13736. }
  13737. segmentHeader.retainBits = retainBits;
  13738. let referredToSegmentNumberSize = 4;
  13739. if (segmentHeader.number <= 256) {
  13740. referredToSegmentNumberSize = 1;
  13741. } else if (segmentHeader.number <= 65536) {
  13742. referredToSegmentNumberSize = 2;
  13743. }
  13744. const referredTo = [];
  13745. let i, ii;
  13746. for (i = 0; i < referredToCount; i++) {
  13747. let number;
  13748. if (referredToSegmentNumberSize === 1) {
  13749. number = data[position];
  13750. } else if (referredToSegmentNumberSize === 2) {
  13751. number = (0, _core_utils.readUint16)(data, position);
  13752. } else {
  13753. number = (0, _core_utils.readUint32)(data, position);
  13754. }
  13755. referredTo.push(number);
  13756. position += referredToSegmentNumberSize;
  13757. }
  13758. segmentHeader.referredTo = referredTo;
  13759. if (!pageAssociationFieldSize) {
  13760. segmentHeader.pageAssociation = data[position++];
  13761. } else {
  13762. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  13763. position += 4;
  13764. }
  13765. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  13766. position += 4;
  13767. if (segmentHeader.length === 0xffffffff) {
  13768. if (segmentType === 38) {
  13769. const genericRegionInfo = readRegionSegmentInformation(data, position);
  13770. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  13771. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  13772. const searchPatternLength = 6;
  13773. const searchPattern = new Uint8Array(searchPatternLength);
  13774. if (!genericRegionMmr) {
  13775. searchPattern[0] = 0xff;
  13776. searchPattern[1] = 0xac;
  13777. }
  13778. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  13779. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  13780. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  13781. searchPattern[5] = genericRegionInfo.height & 0xff;
  13782. for (i = position, ii = data.length; i < ii; i++) {
  13783. let j = 0;
  13784. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  13785. j++;
  13786. }
  13787. if (j === searchPatternLength) {
  13788. segmentHeader.length = i + searchPatternLength;
  13789. break;
  13790. }
  13791. }
  13792. if (segmentHeader.length === 0xffffffff) {
  13793. throw new Jbig2Error("segment end was not found");
  13794. }
  13795. } else {
  13796. throw new Jbig2Error("invalid unknown segment length");
  13797. }
  13798. }
  13799. segmentHeader.headerEnd = position;
  13800. return segmentHeader;
  13801. }
  13802. function readSegments(header, data, start, end) {
  13803. const segments = [];
  13804. let position = start;
  13805. while (position < end) {
  13806. const segmentHeader = readSegmentHeader(data, position);
  13807. position = segmentHeader.headerEnd;
  13808. const segment = {
  13809. header: segmentHeader,
  13810. data
  13811. };
  13812. if (!header.randomAccess) {
  13813. segment.start = position;
  13814. position += segmentHeader.length;
  13815. segment.end = position;
  13816. }
  13817. segments.push(segment);
  13818. if (segmentHeader.type === 51) {
  13819. break;
  13820. }
  13821. }
  13822. if (header.randomAccess) {
  13823. for (let i = 0, ii = segments.length; i < ii; i++) {
  13824. segments[i].start = position;
  13825. position += segments[i].header.length;
  13826. segments[i].end = position;
  13827. }
  13828. }
  13829. return segments;
  13830. }
  13831. function readRegionSegmentInformation(data, start) {
  13832. return {
  13833. width: (0, _core_utils.readUint32)(data, start),
  13834. height: (0, _core_utils.readUint32)(data, start + 4),
  13835. x: (0, _core_utils.readUint32)(data, start + 8),
  13836. y: (0, _core_utils.readUint32)(data, start + 12),
  13837. combinationOperator: data[start + 16] & 7
  13838. };
  13839. }
  13840. const RegionSegmentInformationFieldLength = 17;
  13841. function processSegment(segment, visitor) {
  13842. const header = segment.header;
  13843. const data = segment.data,
  13844. end = segment.end;
  13845. let position = segment.start;
  13846. let args, at, i, atLength;
  13847. switch (header.type) {
  13848. case 0:
  13849. const dictionary = {};
  13850. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  13851. dictionary.huffman = !!(dictionaryFlags & 1);
  13852. dictionary.refinement = !!(dictionaryFlags & 2);
  13853. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  13854. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  13855. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  13856. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  13857. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  13858. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  13859. dictionary.template = dictionaryFlags >> 10 & 3;
  13860. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  13861. position += 2;
  13862. if (!dictionary.huffman) {
  13863. atLength = dictionary.template === 0 ? 4 : 1;
  13864. at = [];
  13865. for (i = 0; i < atLength; i++) {
  13866. at.push({
  13867. x: (0, _core_utils.readInt8)(data, position),
  13868. y: (0, _core_utils.readInt8)(data, position + 1)
  13869. });
  13870. position += 2;
  13871. }
  13872. dictionary.at = at;
  13873. }
  13874. if (dictionary.refinement && !dictionary.refinementTemplate) {
  13875. at = [];
  13876. for (i = 0; i < 2; i++) {
  13877. at.push({
  13878. x: (0, _core_utils.readInt8)(data, position),
  13879. y: (0, _core_utils.readInt8)(data, position + 1)
  13880. });
  13881. position += 2;
  13882. }
  13883. dictionary.refinementAt = at;
  13884. }
  13885. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  13886. position += 4;
  13887. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  13888. position += 4;
  13889. args = [dictionary, header.number, header.referredTo, data, position, end];
  13890. break;
  13891. case 6:
  13892. case 7:
  13893. const textRegion = {};
  13894. textRegion.info = readRegionSegmentInformation(data, position);
  13895. position += RegionSegmentInformationFieldLength;
  13896. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  13897. position += 2;
  13898. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  13899. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  13900. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  13901. textRegion.stripSize = 1 << textRegion.logStripSize;
  13902. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  13903. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  13904. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  13905. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  13906. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  13907. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  13908. if (textRegion.huffman) {
  13909. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  13910. position += 2;
  13911. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  13912. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  13913. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  13914. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  13915. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  13916. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  13917. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  13918. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  13919. }
  13920. if (textRegion.refinement && !textRegion.refinementTemplate) {
  13921. at = [];
  13922. for (i = 0; i < 2; i++) {
  13923. at.push({
  13924. x: (0, _core_utils.readInt8)(data, position),
  13925. y: (0, _core_utils.readInt8)(data, position + 1)
  13926. });
  13927. position += 2;
  13928. }
  13929. textRegion.refinementAt = at;
  13930. }
  13931. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  13932. position += 4;
  13933. args = [textRegion, header.referredTo, data, position, end];
  13934. break;
  13935. case 16:
  13936. const patternDictionary = {};
  13937. const patternDictionaryFlags = data[position++];
  13938. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  13939. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  13940. patternDictionary.patternWidth = data[position++];
  13941. patternDictionary.patternHeight = data[position++];
  13942. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  13943. position += 4;
  13944. args = [patternDictionary, header.number, data, position, end];
  13945. break;
  13946. case 22:
  13947. case 23:
  13948. const halftoneRegion = {};
  13949. halftoneRegion.info = readRegionSegmentInformation(data, position);
  13950. position += RegionSegmentInformationFieldLength;
  13951. const halftoneRegionFlags = data[position++];
  13952. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  13953. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  13954. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  13955. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  13956. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  13957. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  13958. position += 4;
  13959. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  13960. position += 4;
  13961. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  13962. position += 4;
  13963. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  13964. position += 4;
  13965. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  13966. position += 2;
  13967. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  13968. position += 2;
  13969. args = [halftoneRegion, header.referredTo, data, position, end];
  13970. break;
  13971. case 38:
  13972. case 39:
  13973. const genericRegion = {};
  13974. genericRegion.info = readRegionSegmentInformation(data, position);
  13975. position += RegionSegmentInformationFieldLength;
  13976. const genericRegionSegmentFlags = data[position++];
  13977. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  13978. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  13979. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  13980. if (!genericRegion.mmr) {
  13981. atLength = genericRegion.template === 0 ? 4 : 1;
  13982. at = [];
  13983. for (i = 0; i < atLength; i++) {
  13984. at.push({
  13985. x: (0, _core_utils.readInt8)(data, position),
  13986. y: (0, _core_utils.readInt8)(data, position + 1)
  13987. });
  13988. position += 2;
  13989. }
  13990. genericRegion.at = at;
  13991. }
  13992. args = [genericRegion, data, position, end];
  13993. break;
  13994. case 48:
  13995. const pageInfo = {
  13996. width: (0, _core_utils.readUint32)(data, position),
  13997. height: (0, _core_utils.readUint32)(data, position + 4),
  13998. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  13999. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  14000. };
  14001. if (pageInfo.height === 0xffffffff) {
  14002. delete pageInfo.height;
  14003. }
  14004. const pageSegmentFlags = data[position + 16];
  14005. (0, _core_utils.readUint16)(data, position + 17);
  14006. pageInfo.lossless = !!(pageSegmentFlags & 1);
  14007. pageInfo.refinement = !!(pageSegmentFlags & 2);
  14008. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  14009. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  14010. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  14011. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  14012. args = [pageInfo];
  14013. break;
  14014. case 49:
  14015. break;
  14016. case 50:
  14017. break;
  14018. case 51:
  14019. break;
  14020. case 53:
  14021. args = [header.number, data, position, end];
  14022. break;
  14023. case 62:
  14024. break;
  14025. default:
  14026. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  14027. }
  14028. const callbackName = "on" + header.typeName;
  14029. if (callbackName in visitor) {
  14030. visitor[callbackName].apply(visitor, args);
  14031. }
  14032. }
  14033. function processSegments(segments, visitor) {
  14034. for (let i = 0, ii = segments.length; i < ii; i++) {
  14035. processSegment(segments[i], visitor);
  14036. }
  14037. }
  14038. function parseJbig2Chunks(chunks) {
  14039. const visitor = new SimpleSegmentVisitor();
  14040. for (let i = 0, ii = chunks.length; i < ii; i++) {
  14041. const chunk = chunks[i];
  14042. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  14043. processSegments(segments, visitor);
  14044. }
  14045. return visitor.buffer;
  14046. }
  14047. function parseJbig2(data) {
  14048. const end = data.length;
  14049. let position = 0;
  14050. 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) {
  14051. throw new Jbig2Error("parseJbig2 - invalid header.");
  14052. }
  14053. const header = Object.create(null);
  14054. position += 8;
  14055. const flags = data[position++];
  14056. header.randomAccess = !(flags & 1);
  14057. if (!(flags & 2)) {
  14058. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  14059. position += 4;
  14060. }
  14061. const segments = readSegments(header, data, position, end);
  14062. const visitor = new SimpleSegmentVisitor();
  14063. processSegments(segments, visitor);
  14064. const {
  14065. width,
  14066. height
  14067. } = visitor.currentPageInfo;
  14068. const bitPacked = visitor.buffer;
  14069. const imgData = new Uint8ClampedArray(width * height);
  14070. let q = 0,
  14071. k = 0;
  14072. for (let i = 0; i < height; i++) {
  14073. let mask = 0,
  14074. buffer;
  14075. for (let j = 0; j < width; j++) {
  14076. if (!mask) {
  14077. mask = 128;
  14078. buffer = bitPacked[k++];
  14079. }
  14080. imgData[q++] = buffer & mask ? 0 : 255;
  14081. mask >>= 1;
  14082. }
  14083. }
  14084. return {
  14085. imgData,
  14086. width,
  14087. height
  14088. };
  14089. }
  14090. class SimpleSegmentVisitor {
  14091. onPageInformation(info) {
  14092. this.currentPageInfo = info;
  14093. const rowSize = info.width + 7 >> 3;
  14094. const buffer = new Uint8ClampedArray(rowSize * info.height);
  14095. if (info.defaultPixelValue) {
  14096. for (let i = 0, ii = buffer.length; i < ii; i++) {
  14097. buffer[i] = 0xff;
  14098. }
  14099. }
  14100. this.buffer = buffer;
  14101. }
  14102. drawBitmap(regionInfo, bitmap) {
  14103. const pageInfo = this.currentPageInfo;
  14104. const width = regionInfo.width,
  14105. height = regionInfo.height;
  14106. const rowSize = pageInfo.width + 7 >> 3;
  14107. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  14108. const buffer = this.buffer;
  14109. const mask0 = 128 >> (regionInfo.x & 7);
  14110. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  14111. let i, j, mask, offset;
  14112. switch (combinationOperator) {
  14113. case 0:
  14114. for (i = 0; i < height; i++) {
  14115. mask = mask0;
  14116. offset = offset0;
  14117. for (j = 0; j < width; j++) {
  14118. if (bitmap[i][j]) {
  14119. buffer[offset] |= mask;
  14120. }
  14121. mask >>= 1;
  14122. if (!mask) {
  14123. mask = 128;
  14124. offset++;
  14125. }
  14126. }
  14127. offset0 += rowSize;
  14128. }
  14129. break;
  14130. case 2:
  14131. for (i = 0; i < height; i++) {
  14132. mask = mask0;
  14133. offset = offset0;
  14134. for (j = 0; j < width; j++) {
  14135. if (bitmap[i][j]) {
  14136. buffer[offset] ^= mask;
  14137. }
  14138. mask >>= 1;
  14139. if (!mask) {
  14140. mask = 128;
  14141. offset++;
  14142. }
  14143. }
  14144. offset0 += rowSize;
  14145. }
  14146. break;
  14147. default:
  14148. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  14149. }
  14150. }
  14151. onImmediateGenericRegion(region, data, start, end) {
  14152. const regionInfo = region.info;
  14153. const decodingContext = new DecodingContext(data, start, end);
  14154. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  14155. this.drawBitmap(regionInfo, bitmap);
  14156. }
  14157. onImmediateLosslessGenericRegion() {
  14158. this.onImmediateGenericRegion.apply(this, arguments);
  14159. }
  14160. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  14161. let huffmanTables, huffmanInput;
  14162. if (dictionary.huffman) {
  14163. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  14164. huffmanInput = new Reader(data, start, end);
  14165. }
  14166. let symbols = this.symbols;
  14167. if (!symbols) {
  14168. this.symbols = symbols = {};
  14169. }
  14170. let inputSymbols = [];
  14171. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  14172. const referredSymbols = symbols[referredSegments[i]];
  14173. if (referredSymbols) {
  14174. inputSymbols = inputSymbols.concat(referredSymbols);
  14175. }
  14176. }
  14177. const decodingContext = new DecodingContext(data, start, end);
  14178. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  14179. }
  14180. onImmediateTextRegion(region, referredSegments, data, start, end) {
  14181. const regionInfo = region.info;
  14182. let huffmanTables, huffmanInput;
  14183. const symbols = this.symbols;
  14184. let inputSymbols = [];
  14185. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  14186. const referredSymbols = symbols[referredSegments[i]];
  14187. if (referredSymbols) {
  14188. inputSymbols = inputSymbols.concat(referredSymbols);
  14189. }
  14190. }
  14191. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  14192. if (region.huffman) {
  14193. huffmanInput = new Reader(data, start, end);
  14194. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  14195. }
  14196. const decodingContext = new DecodingContext(data, start, end);
  14197. 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);
  14198. this.drawBitmap(regionInfo, bitmap);
  14199. }
  14200. onImmediateLosslessTextRegion() {
  14201. this.onImmediateTextRegion.apply(this, arguments);
  14202. }
  14203. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  14204. let patterns = this.patterns;
  14205. if (!patterns) {
  14206. this.patterns = patterns = {};
  14207. }
  14208. const decodingContext = new DecodingContext(data, start, end);
  14209. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  14210. }
  14211. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  14212. const patterns = this.patterns[referredSegments[0]];
  14213. const regionInfo = region.info;
  14214. const decodingContext = new DecodingContext(data, start, end);
  14215. 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);
  14216. this.drawBitmap(regionInfo, bitmap);
  14217. }
  14218. onImmediateLosslessHalftoneRegion() {
  14219. this.onImmediateHalftoneRegion.apply(this, arguments);
  14220. }
  14221. onTables(currentSegment, data, start, end) {
  14222. let customTables = this.customTables;
  14223. if (!customTables) {
  14224. this.customTables = customTables = {};
  14225. }
  14226. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  14227. }
  14228. }
  14229. class HuffmanLine {
  14230. constructor(lineData) {
  14231. if (lineData.length === 2) {
  14232. this.isOOB = true;
  14233. this.rangeLow = 0;
  14234. this.prefixLength = lineData[0];
  14235. this.rangeLength = 0;
  14236. this.prefixCode = lineData[1];
  14237. this.isLowerRange = false;
  14238. } else {
  14239. this.isOOB = false;
  14240. this.rangeLow = lineData[0];
  14241. this.prefixLength = lineData[1];
  14242. this.rangeLength = lineData[2];
  14243. this.prefixCode = lineData[3];
  14244. this.isLowerRange = lineData[4] === "lower";
  14245. }
  14246. }
  14247. }
  14248. class HuffmanTreeNode {
  14249. constructor(line) {
  14250. this.children = [];
  14251. if (line) {
  14252. this.isLeaf = true;
  14253. this.rangeLength = line.rangeLength;
  14254. this.rangeLow = line.rangeLow;
  14255. this.isLowerRange = line.isLowerRange;
  14256. this.isOOB = line.isOOB;
  14257. } else {
  14258. this.isLeaf = false;
  14259. }
  14260. }
  14261. buildTree(line, shift) {
  14262. const bit = line.prefixCode >> shift & 1;
  14263. if (shift <= 0) {
  14264. this.children[bit] = new HuffmanTreeNode(line);
  14265. } else {
  14266. let node = this.children[bit];
  14267. if (!node) {
  14268. this.children[bit] = node = new HuffmanTreeNode(null);
  14269. }
  14270. node.buildTree(line, shift - 1);
  14271. }
  14272. }
  14273. decodeNode(reader) {
  14274. if (this.isLeaf) {
  14275. if (this.isOOB) {
  14276. return null;
  14277. }
  14278. const htOffset = reader.readBits(this.rangeLength);
  14279. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  14280. }
  14281. const node = this.children[reader.readBit()];
  14282. if (!node) {
  14283. throw new Jbig2Error("invalid Huffman data");
  14284. }
  14285. return node.decodeNode(reader);
  14286. }
  14287. }
  14288. class HuffmanTable {
  14289. constructor(lines, prefixCodesDone) {
  14290. if (!prefixCodesDone) {
  14291. this.assignPrefixCodes(lines);
  14292. }
  14293. this.rootNode = new HuffmanTreeNode(null);
  14294. for (let i = 0, ii = lines.length; i < ii; i++) {
  14295. const line = lines[i];
  14296. if (line.prefixLength > 0) {
  14297. this.rootNode.buildTree(line, line.prefixLength - 1);
  14298. }
  14299. }
  14300. }
  14301. decode(reader) {
  14302. return this.rootNode.decodeNode(reader);
  14303. }
  14304. assignPrefixCodes(lines) {
  14305. const linesLength = lines.length;
  14306. let prefixLengthMax = 0;
  14307. for (let i = 0; i < linesLength; i++) {
  14308. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  14309. }
  14310. const histogram = new Uint32Array(prefixLengthMax + 1);
  14311. for (let i = 0; i < linesLength; i++) {
  14312. histogram[lines[i].prefixLength]++;
  14313. }
  14314. let currentLength = 1,
  14315. firstCode = 0,
  14316. currentCode,
  14317. currentTemp,
  14318. line;
  14319. histogram[0] = 0;
  14320. while (currentLength <= prefixLengthMax) {
  14321. firstCode = firstCode + histogram[currentLength - 1] << 1;
  14322. currentCode = firstCode;
  14323. currentTemp = 0;
  14324. while (currentTemp < linesLength) {
  14325. line = lines[currentTemp];
  14326. if (line.prefixLength === currentLength) {
  14327. line.prefixCode = currentCode;
  14328. currentCode++;
  14329. }
  14330. currentTemp++;
  14331. }
  14332. currentLength++;
  14333. }
  14334. }
  14335. }
  14336. function decodeTablesSegment(data, start, end) {
  14337. const flags = data[start];
  14338. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  14339. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  14340. const reader = new Reader(data, start + 9, end);
  14341. const prefixSizeBits = (flags >> 1 & 7) + 1;
  14342. const rangeSizeBits = (flags >> 4 & 7) + 1;
  14343. const lines = [];
  14344. let prefixLength,
  14345. rangeLength,
  14346. currentRangeLow = lowestValue;
  14347. do {
  14348. prefixLength = reader.readBits(prefixSizeBits);
  14349. rangeLength = reader.readBits(rangeSizeBits);
  14350. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  14351. currentRangeLow += 1 << rangeLength;
  14352. } while (currentRangeLow < highestValue);
  14353. prefixLength = reader.readBits(prefixSizeBits);
  14354. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  14355. prefixLength = reader.readBits(prefixSizeBits);
  14356. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  14357. if (flags & 1) {
  14358. prefixLength = reader.readBits(prefixSizeBits);
  14359. lines.push(new HuffmanLine([prefixLength, 0]));
  14360. }
  14361. return new HuffmanTable(lines, false);
  14362. }
  14363. const standardTablesCache = {};
  14364. function getStandardTable(number) {
  14365. let table = standardTablesCache[number];
  14366. if (table) {
  14367. return table;
  14368. }
  14369. let lines;
  14370. switch (number) {
  14371. case 1:
  14372. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  14373. break;
  14374. case 2:
  14375. 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]];
  14376. break;
  14377. case 3:
  14378. 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]];
  14379. break;
  14380. case 4:
  14381. 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]];
  14382. break;
  14383. case 5:
  14384. 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]];
  14385. break;
  14386. case 6:
  14387. 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]];
  14388. break;
  14389. case 7:
  14390. 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]];
  14391. break;
  14392. case 8:
  14393. 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]];
  14394. break;
  14395. case 9:
  14396. 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]];
  14397. break;
  14398. case 10:
  14399. 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]];
  14400. break;
  14401. case 11:
  14402. 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]];
  14403. break;
  14404. case 12:
  14405. 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]];
  14406. break;
  14407. case 13:
  14408. 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]];
  14409. break;
  14410. case 14:
  14411. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  14412. break;
  14413. case 15:
  14414. 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]];
  14415. break;
  14416. default:
  14417. throw new Jbig2Error(`standard table B.${number} does not exist`);
  14418. }
  14419. for (let i = 0, ii = lines.length; i < ii; i++) {
  14420. lines[i] = new HuffmanLine(lines[i]);
  14421. }
  14422. table = new HuffmanTable(lines, true);
  14423. standardTablesCache[number] = table;
  14424. return table;
  14425. }
  14426. class Reader {
  14427. constructor(data, start, end) {
  14428. this.data = data;
  14429. this.start = start;
  14430. this.end = end;
  14431. this.position = start;
  14432. this.shift = -1;
  14433. this.currentByte = 0;
  14434. }
  14435. readBit() {
  14436. if (this.shift < 0) {
  14437. if (this.position >= this.end) {
  14438. throw new Jbig2Error("end of data while reading bit");
  14439. }
  14440. this.currentByte = this.data[this.position++];
  14441. this.shift = 7;
  14442. }
  14443. const bit = this.currentByte >> this.shift & 1;
  14444. this.shift--;
  14445. return bit;
  14446. }
  14447. readBits(numBits) {
  14448. let result = 0,
  14449. i;
  14450. for (i = numBits - 1; i >= 0; i--) {
  14451. result |= this.readBit() << i;
  14452. }
  14453. return result;
  14454. }
  14455. byteAlign() {
  14456. this.shift = -1;
  14457. }
  14458. next() {
  14459. if (this.position >= this.end) {
  14460. return -1;
  14461. }
  14462. return this.data[this.position++];
  14463. }
  14464. }
  14465. function getCustomHuffmanTable(index, referredTo, customTables) {
  14466. let currentIndex = 0;
  14467. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  14468. const table = customTables[referredTo[i]];
  14469. if (table) {
  14470. if (index === currentIndex) {
  14471. return table;
  14472. }
  14473. currentIndex++;
  14474. }
  14475. }
  14476. throw new Jbig2Error("can't find custom Huffman table");
  14477. }
  14478. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  14479. const codes = [];
  14480. for (let i = 0; i <= 34; i++) {
  14481. const codeLength = reader.readBits(4);
  14482. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  14483. }
  14484. const runCodesTable = new HuffmanTable(codes, false);
  14485. codes.length = 0;
  14486. for (let i = 0; i < numberOfSymbols;) {
  14487. const codeLength = runCodesTable.decode(reader);
  14488. if (codeLength >= 32) {
  14489. let repeatedLength, numberOfRepeats, j;
  14490. switch (codeLength) {
  14491. case 32:
  14492. if (i === 0) {
  14493. throw new Jbig2Error("no previous value in symbol ID table");
  14494. }
  14495. numberOfRepeats = reader.readBits(2) + 3;
  14496. repeatedLength = codes[i - 1].prefixLength;
  14497. break;
  14498. case 33:
  14499. numberOfRepeats = reader.readBits(3) + 3;
  14500. repeatedLength = 0;
  14501. break;
  14502. case 34:
  14503. numberOfRepeats = reader.readBits(7) + 11;
  14504. repeatedLength = 0;
  14505. break;
  14506. default:
  14507. throw new Jbig2Error("invalid code length in symbol ID table");
  14508. }
  14509. for (j = 0; j < numberOfRepeats; j++) {
  14510. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  14511. i++;
  14512. }
  14513. } else {
  14514. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  14515. i++;
  14516. }
  14517. }
  14518. reader.byteAlign();
  14519. const symbolIDTable = new HuffmanTable(codes, false);
  14520. let customIndex = 0,
  14521. tableFirstS,
  14522. tableDeltaS,
  14523. tableDeltaT;
  14524. switch (textRegion.huffmanFS) {
  14525. case 0:
  14526. case 1:
  14527. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  14528. break;
  14529. case 3:
  14530. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14531. customIndex++;
  14532. break;
  14533. default:
  14534. throw new Jbig2Error("invalid Huffman FS selector");
  14535. }
  14536. switch (textRegion.huffmanDS) {
  14537. case 0:
  14538. case 1:
  14539. case 2:
  14540. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  14541. break;
  14542. case 3:
  14543. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14544. customIndex++;
  14545. break;
  14546. default:
  14547. throw new Jbig2Error("invalid Huffman DS selector");
  14548. }
  14549. switch (textRegion.huffmanDT) {
  14550. case 0:
  14551. case 1:
  14552. case 2:
  14553. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  14554. break;
  14555. case 3:
  14556. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14557. customIndex++;
  14558. break;
  14559. default:
  14560. throw new Jbig2Error("invalid Huffman DT selector");
  14561. }
  14562. if (textRegion.refinement) {
  14563. throw new Jbig2Error("refinement with Huffman is not supported");
  14564. }
  14565. return {
  14566. symbolIDTable,
  14567. tableFirstS,
  14568. tableDeltaS,
  14569. tableDeltaT
  14570. };
  14571. }
  14572. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  14573. let customIndex = 0,
  14574. tableDeltaHeight,
  14575. tableDeltaWidth;
  14576. switch (dictionary.huffmanDHSelector) {
  14577. case 0:
  14578. case 1:
  14579. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  14580. break;
  14581. case 3:
  14582. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14583. customIndex++;
  14584. break;
  14585. default:
  14586. throw new Jbig2Error("invalid Huffman DH selector");
  14587. }
  14588. switch (dictionary.huffmanDWSelector) {
  14589. case 0:
  14590. case 1:
  14591. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  14592. break;
  14593. case 3:
  14594. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14595. customIndex++;
  14596. break;
  14597. default:
  14598. throw new Jbig2Error("invalid Huffman DW selector");
  14599. }
  14600. let tableBitmapSize, tableAggregateInstances;
  14601. if (dictionary.bitmapSizeSelector) {
  14602. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14603. customIndex++;
  14604. } else {
  14605. tableBitmapSize = getStandardTable(1);
  14606. }
  14607. if (dictionary.aggregationInstancesSelector) {
  14608. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  14609. } else {
  14610. tableAggregateInstances = getStandardTable(1);
  14611. }
  14612. return {
  14613. tableDeltaHeight,
  14614. tableDeltaWidth,
  14615. tableBitmapSize,
  14616. tableAggregateInstances
  14617. };
  14618. }
  14619. function readUncompressedBitmap(reader, width, height) {
  14620. const bitmap = [];
  14621. for (let y = 0; y < height; y++) {
  14622. const row = new Uint8Array(width);
  14623. bitmap.push(row);
  14624. for (let x = 0; x < width; x++) {
  14625. row[x] = reader.readBit();
  14626. }
  14627. reader.byteAlign();
  14628. }
  14629. return bitmap;
  14630. }
  14631. function decodeMMRBitmap(input, width, height, endOfBlock) {
  14632. const params = {
  14633. K: -1,
  14634. Columns: width,
  14635. Rows: height,
  14636. BlackIs1: true,
  14637. EndOfBlock: endOfBlock
  14638. };
  14639. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  14640. const bitmap = [];
  14641. let currentByte,
  14642. eof = false;
  14643. for (let y = 0; y < height; y++) {
  14644. const row = new Uint8Array(width);
  14645. bitmap.push(row);
  14646. let shift = -1;
  14647. for (let x = 0; x < width; x++) {
  14648. if (shift < 0) {
  14649. currentByte = decoder.readNextChar();
  14650. if (currentByte === -1) {
  14651. currentByte = 0;
  14652. eof = true;
  14653. }
  14654. shift = 7;
  14655. }
  14656. row[x] = currentByte >> shift & 1;
  14657. shift--;
  14658. }
  14659. }
  14660. if (endOfBlock && !eof) {
  14661. const lookForEOFLimit = 5;
  14662. for (let i = 0; i < lookForEOFLimit; i++) {
  14663. if (decoder.readNextChar() === -1) {
  14664. break;
  14665. }
  14666. }
  14667. }
  14668. return bitmap;
  14669. }
  14670. class Jbig2Image {
  14671. parseChunks(chunks) {
  14672. return parseJbig2Chunks(chunks);
  14673. }
  14674. parse(data) {
  14675. const {
  14676. imgData,
  14677. width,
  14678. height
  14679. } = parseJbig2(data);
  14680. this.width = width;
  14681. this.height = height;
  14682. return imgData;
  14683. }
  14684. }
  14685. exports.Jbig2Image = Jbig2Image;
  14686. /***/ }),
  14687. /* 26 */
  14688. /***/ ((__unused_webpack_module, exports) => {
  14689. Object.defineProperty(exports, "__esModule", ({
  14690. value: true
  14691. }));
  14692. exports.ArithmeticDecoder = void 0;
  14693. const QeTable = [{
  14694. qe: 0x5601,
  14695. nmps: 1,
  14696. nlps: 1,
  14697. switchFlag: 1
  14698. }, {
  14699. qe: 0x3401,
  14700. nmps: 2,
  14701. nlps: 6,
  14702. switchFlag: 0
  14703. }, {
  14704. qe: 0x1801,
  14705. nmps: 3,
  14706. nlps: 9,
  14707. switchFlag: 0
  14708. }, {
  14709. qe: 0x0ac1,
  14710. nmps: 4,
  14711. nlps: 12,
  14712. switchFlag: 0
  14713. }, {
  14714. qe: 0x0521,
  14715. nmps: 5,
  14716. nlps: 29,
  14717. switchFlag: 0
  14718. }, {
  14719. qe: 0x0221,
  14720. nmps: 38,
  14721. nlps: 33,
  14722. switchFlag: 0
  14723. }, {
  14724. qe: 0x5601,
  14725. nmps: 7,
  14726. nlps: 6,
  14727. switchFlag: 1
  14728. }, {
  14729. qe: 0x5401,
  14730. nmps: 8,
  14731. nlps: 14,
  14732. switchFlag: 0
  14733. }, {
  14734. qe: 0x4801,
  14735. nmps: 9,
  14736. nlps: 14,
  14737. switchFlag: 0
  14738. }, {
  14739. qe: 0x3801,
  14740. nmps: 10,
  14741. nlps: 14,
  14742. switchFlag: 0
  14743. }, {
  14744. qe: 0x3001,
  14745. nmps: 11,
  14746. nlps: 17,
  14747. switchFlag: 0
  14748. }, {
  14749. qe: 0x2401,
  14750. nmps: 12,
  14751. nlps: 18,
  14752. switchFlag: 0
  14753. }, {
  14754. qe: 0x1c01,
  14755. nmps: 13,
  14756. nlps: 20,
  14757. switchFlag: 0
  14758. }, {
  14759. qe: 0x1601,
  14760. nmps: 29,
  14761. nlps: 21,
  14762. switchFlag: 0
  14763. }, {
  14764. qe: 0x5601,
  14765. nmps: 15,
  14766. nlps: 14,
  14767. switchFlag: 1
  14768. }, {
  14769. qe: 0x5401,
  14770. nmps: 16,
  14771. nlps: 14,
  14772. switchFlag: 0
  14773. }, {
  14774. qe: 0x5101,
  14775. nmps: 17,
  14776. nlps: 15,
  14777. switchFlag: 0
  14778. }, {
  14779. qe: 0x4801,
  14780. nmps: 18,
  14781. nlps: 16,
  14782. switchFlag: 0
  14783. }, {
  14784. qe: 0x3801,
  14785. nmps: 19,
  14786. nlps: 17,
  14787. switchFlag: 0
  14788. }, {
  14789. qe: 0x3401,
  14790. nmps: 20,
  14791. nlps: 18,
  14792. switchFlag: 0
  14793. }, {
  14794. qe: 0x3001,
  14795. nmps: 21,
  14796. nlps: 19,
  14797. switchFlag: 0
  14798. }, {
  14799. qe: 0x2801,
  14800. nmps: 22,
  14801. nlps: 19,
  14802. switchFlag: 0
  14803. }, {
  14804. qe: 0x2401,
  14805. nmps: 23,
  14806. nlps: 20,
  14807. switchFlag: 0
  14808. }, {
  14809. qe: 0x2201,
  14810. nmps: 24,
  14811. nlps: 21,
  14812. switchFlag: 0
  14813. }, {
  14814. qe: 0x1c01,
  14815. nmps: 25,
  14816. nlps: 22,
  14817. switchFlag: 0
  14818. }, {
  14819. qe: 0x1801,
  14820. nmps: 26,
  14821. nlps: 23,
  14822. switchFlag: 0
  14823. }, {
  14824. qe: 0x1601,
  14825. nmps: 27,
  14826. nlps: 24,
  14827. switchFlag: 0
  14828. }, {
  14829. qe: 0x1401,
  14830. nmps: 28,
  14831. nlps: 25,
  14832. switchFlag: 0
  14833. }, {
  14834. qe: 0x1201,
  14835. nmps: 29,
  14836. nlps: 26,
  14837. switchFlag: 0
  14838. }, {
  14839. qe: 0x1101,
  14840. nmps: 30,
  14841. nlps: 27,
  14842. switchFlag: 0
  14843. }, {
  14844. qe: 0x0ac1,
  14845. nmps: 31,
  14846. nlps: 28,
  14847. switchFlag: 0
  14848. }, {
  14849. qe: 0x09c1,
  14850. nmps: 32,
  14851. nlps: 29,
  14852. switchFlag: 0
  14853. }, {
  14854. qe: 0x08a1,
  14855. nmps: 33,
  14856. nlps: 30,
  14857. switchFlag: 0
  14858. }, {
  14859. qe: 0x0521,
  14860. nmps: 34,
  14861. nlps: 31,
  14862. switchFlag: 0
  14863. }, {
  14864. qe: 0x0441,
  14865. nmps: 35,
  14866. nlps: 32,
  14867. switchFlag: 0
  14868. }, {
  14869. qe: 0x02a1,
  14870. nmps: 36,
  14871. nlps: 33,
  14872. switchFlag: 0
  14873. }, {
  14874. qe: 0x0221,
  14875. nmps: 37,
  14876. nlps: 34,
  14877. switchFlag: 0
  14878. }, {
  14879. qe: 0x0141,
  14880. nmps: 38,
  14881. nlps: 35,
  14882. switchFlag: 0
  14883. }, {
  14884. qe: 0x0111,
  14885. nmps: 39,
  14886. nlps: 36,
  14887. switchFlag: 0
  14888. }, {
  14889. qe: 0x0085,
  14890. nmps: 40,
  14891. nlps: 37,
  14892. switchFlag: 0
  14893. }, {
  14894. qe: 0x0049,
  14895. nmps: 41,
  14896. nlps: 38,
  14897. switchFlag: 0
  14898. }, {
  14899. qe: 0x0025,
  14900. nmps: 42,
  14901. nlps: 39,
  14902. switchFlag: 0
  14903. }, {
  14904. qe: 0x0015,
  14905. nmps: 43,
  14906. nlps: 40,
  14907. switchFlag: 0
  14908. }, {
  14909. qe: 0x0009,
  14910. nmps: 44,
  14911. nlps: 41,
  14912. switchFlag: 0
  14913. }, {
  14914. qe: 0x0005,
  14915. nmps: 45,
  14916. nlps: 42,
  14917. switchFlag: 0
  14918. }, {
  14919. qe: 0x0001,
  14920. nmps: 45,
  14921. nlps: 43,
  14922. switchFlag: 0
  14923. }, {
  14924. qe: 0x5601,
  14925. nmps: 46,
  14926. nlps: 46,
  14927. switchFlag: 0
  14928. }];
  14929. class ArithmeticDecoder {
  14930. constructor(data, start, end) {
  14931. this.data = data;
  14932. this.bp = start;
  14933. this.dataEnd = end;
  14934. this.chigh = data[start];
  14935. this.clow = 0;
  14936. this.byteIn();
  14937. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  14938. this.clow = this.clow << 7 & 0xffff;
  14939. this.ct -= 7;
  14940. this.a = 0x8000;
  14941. }
  14942. byteIn() {
  14943. const data = this.data;
  14944. let bp = this.bp;
  14945. if (data[bp] === 0xff) {
  14946. if (data[bp + 1] > 0x8f) {
  14947. this.clow += 0xff00;
  14948. this.ct = 8;
  14949. } else {
  14950. bp++;
  14951. this.clow += data[bp] << 9;
  14952. this.ct = 7;
  14953. this.bp = bp;
  14954. }
  14955. } else {
  14956. bp++;
  14957. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  14958. this.ct = 8;
  14959. this.bp = bp;
  14960. }
  14961. if (this.clow > 0xffff) {
  14962. this.chigh += this.clow >> 16;
  14963. this.clow &= 0xffff;
  14964. }
  14965. }
  14966. readBit(contexts, pos) {
  14967. let cx_index = contexts[pos] >> 1,
  14968. cx_mps = contexts[pos] & 1;
  14969. const qeTableIcx = QeTable[cx_index];
  14970. const qeIcx = qeTableIcx.qe;
  14971. let d;
  14972. let a = this.a - qeIcx;
  14973. if (this.chigh < qeIcx) {
  14974. if (a < qeIcx) {
  14975. a = qeIcx;
  14976. d = cx_mps;
  14977. cx_index = qeTableIcx.nmps;
  14978. } else {
  14979. a = qeIcx;
  14980. d = 1 ^ cx_mps;
  14981. if (qeTableIcx.switchFlag === 1) {
  14982. cx_mps = d;
  14983. }
  14984. cx_index = qeTableIcx.nlps;
  14985. }
  14986. } else {
  14987. this.chigh -= qeIcx;
  14988. if ((a & 0x8000) !== 0) {
  14989. this.a = a;
  14990. return cx_mps;
  14991. }
  14992. if (a < qeIcx) {
  14993. d = 1 ^ cx_mps;
  14994. if (qeTableIcx.switchFlag === 1) {
  14995. cx_mps = d;
  14996. }
  14997. cx_index = qeTableIcx.nlps;
  14998. } else {
  14999. d = cx_mps;
  15000. cx_index = qeTableIcx.nmps;
  15001. }
  15002. }
  15003. do {
  15004. if (this.ct === 0) {
  15005. this.byteIn();
  15006. }
  15007. a <<= 1;
  15008. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  15009. this.clow = this.clow << 1 & 0xffff;
  15010. this.ct--;
  15011. } while ((a & 0x8000) === 0);
  15012. this.a = a;
  15013. contexts[pos] = cx_index << 1 | cx_mps;
  15014. return d;
  15015. }
  15016. }
  15017. exports.ArithmeticDecoder = ArithmeticDecoder;
  15018. /***/ }),
  15019. /* 27 */
  15020. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15021. Object.defineProperty(exports, "__esModule", ({
  15022. value: true
  15023. }));
  15024. exports.JpegStream = void 0;
  15025. var _decode_stream = __w_pdfjs_require__(19);
  15026. var _primitives = __w_pdfjs_require__(5);
  15027. var _jpg = __w_pdfjs_require__(28);
  15028. var _util = __w_pdfjs_require__(2);
  15029. class JpegStream extends _decode_stream.DecodeStream {
  15030. constructor(stream, maybeLength, params) {
  15031. let ch;
  15032. while ((ch = stream.getByte()) !== -1) {
  15033. if (ch === 0xff) {
  15034. stream.skip(-1);
  15035. break;
  15036. }
  15037. }
  15038. super(maybeLength);
  15039. this.stream = stream;
  15040. this.dict = stream.dict;
  15041. this.maybeLength = maybeLength;
  15042. this.params = params;
  15043. }
  15044. get bytes() {
  15045. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  15046. }
  15047. ensureBuffer(requested) {}
  15048. readBlock() {
  15049. if (this.eof) {
  15050. return;
  15051. }
  15052. const jpegOptions = {
  15053. decodeTransform: undefined,
  15054. colorTransform: undefined
  15055. };
  15056. const decodeArr = this.dict.getArray("Decode", "D");
  15057. if (this.forceRGB && Array.isArray(decodeArr)) {
  15058. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  15059. const decodeArrLength = decodeArr.length;
  15060. const transform = new Int32Array(decodeArrLength);
  15061. let transformNeeded = false;
  15062. const maxValue = (1 << bitsPerComponent) - 1;
  15063. for (let i = 0; i < decodeArrLength; i += 2) {
  15064. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  15065. transform[i + 1] = decodeArr[i] * maxValue | 0;
  15066. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  15067. transformNeeded = true;
  15068. }
  15069. }
  15070. if (transformNeeded) {
  15071. jpegOptions.decodeTransform = transform;
  15072. }
  15073. }
  15074. if ((0, _primitives.isDict)(this.params)) {
  15075. const colorTransform = this.params.get("ColorTransform");
  15076. if (Number.isInteger(colorTransform)) {
  15077. jpegOptions.colorTransform = colorTransform;
  15078. }
  15079. }
  15080. const jpegImage = new _jpg.JpegImage(jpegOptions);
  15081. jpegImage.parse(this.bytes);
  15082. const data = jpegImage.getData({
  15083. width: this.drawWidth,
  15084. height: this.drawHeight,
  15085. forceRGB: this.forceRGB,
  15086. isSourcePDF: true
  15087. });
  15088. this.buffer = data;
  15089. this.bufferLength = data.length;
  15090. this.eof = true;
  15091. }
  15092. }
  15093. exports.JpegStream = JpegStream;
  15094. /***/ }),
  15095. /* 28 */
  15096. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15097. Object.defineProperty(exports, "__esModule", ({
  15098. value: true
  15099. }));
  15100. exports.JpegImage = void 0;
  15101. var _util = __w_pdfjs_require__(2);
  15102. var _core_utils = __w_pdfjs_require__(9);
  15103. class JpegError extends _util.BaseException {
  15104. constructor(msg) {
  15105. super(`JPEG error: ${msg}`);
  15106. }
  15107. }
  15108. class DNLMarkerError extends _util.BaseException {
  15109. constructor(message, scanLines) {
  15110. super(message);
  15111. this.scanLines = scanLines;
  15112. }
  15113. }
  15114. class EOIMarkerError extends _util.BaseException {}
  15115. 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]);
  15116. const dctCos1 = 4017;
  15117. const dctSin1 = 799;
  15118. const dctCos3 = 3406;
  15119. const dctSin3 = 2276;
  15120. const dctCos6 = 1567;
  15121. const dctSin6 = 3784;
  15122. const dctSqrt2 = 5793;
  15123. const dctSqrt1d2 = 2896;
  15124. function buildHuffmanTable(codeLengths, values) {
  15125. let k = 0,
  15126. i,
  15127. j,
  15128. length = 16;
  15129. while (length > 0 && !codeLengths[length - 1]) {
  15130. length--;
  15131. }
  15132. const code = [{
  15133. children: [],
  15134. index: 0
  15135. }];
  15136. let p = code[0],
  15137. q;
  15138. for (i = 0; i < length; i++) {
  15139. for (j = 0; j < codeLengths[i]; j++) {
  15140. p = code.pop();
  15141. p.children[p.index] = values[k];
  15142. while (p.index > 0) {
  15143. p = code.pop();
  15144. }
  15145. p.index++;
  15146. code.push(p);
  15147. while (code.length <= i) {
  15148. code.push(q = {
  15149. children: [],
  15150. index: 0
  15151. });
  15152. p.children[p.index] = q.children;
  15153. p = q;
  15154. }
  15155. k++;
  15156. }
  15157. if (i + 1 < length) {
  15158. code.push(q = {
  15159. children: [],
  15160. index: 0
  15161. });
  15162. p.children[p.index] = q.children;
  15163. p = q;
  15164. }
  15165. }
  15166. return code[0].children;
  15167. }
  15168. function getBlockBufferOffset(component, row, col) {
  15169. return 64 * ((component.blocksPerLine + 1) * row + col);
  15170. }
  15171. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  15172. const mcusPerLine = frame.mcusPerLine;
  15173. const progressive = frame.progressive;
  15174. const startOffset = offset;
  15175. let bitsData = 0,
  15176. bitsCount = 0;
  15177. function readBit() {
  15178. if (bitsCount > 0) {
  15179. bitsCount--;
  15180. return bitsData >> bitsCount & 1;
  15181. }
  15182. bitsData = data[offset++];
  15183. if (bitsData === 0xff) {
  15184. const nextByte = data[offset++];
  15185. if (nextByte) {
  15186. if (nextByte === 0xdc && parseDNLMarker) {
  15187. offset += 2;
  15188. const scanLines = (0, _core_utils.readUint16)(data, offset);
  15189. offset += 2;
  15190. if (scanLines > 0 && scanLines !== frame.scanLines) {
  15191. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  15192. }
  15193. } else if (nextByte === 0xd9) {
  15194. if (parseDNLMarker) {
  15195. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  15196. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  15197. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  15198. }
  15199. }
  15200. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  15201. }
  15202. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  15203. }
  15204. }
  15205. bitsCount = 7;
  15206. return bitsData >>> 7;
  15207. }
  15208. function decodeHuffman(tree) {
  15209. let node = tree;
  15210. while (true) {
  15211. node = node[readBit()];
  15212. switch (typeof node) {
  15213. case "number":
  15214. return node;
  15215. case "object":
  15216. continue;
  15217. }
  15218. throw new JpegError("invalid huffman sequence");
  15219. }
  15220. }
  15221. function receive(length) {
  15222. let n = 0;
  15223. while (length > 0) {
  15224. n = n << 1 | readBit();
  15225. length--;
  15226. }
  15227. return n;
  15228. }
  15229. function receiveAndExtend(length) {
  15230. if (length === 1) {
  15231. return readBit() === 1 ? 1 : -1;
  15232. }
  15233. const n = receive(length);
  15234. if (n >= 1 << length - 1) {
  15235. return n;
  15236. }
  15237. return n + (-1 << length) + 1;
  15238. }
  15239. function decodeBaseline(component, blockOffset) {
  15240. const t = decodeHuffman(component.huffmanTableDC);
  15241. const diff = t === 0 ? 0 : receiveAndExtend(t);
  15242. component.blockData[blockOffset] = component.pred += diff;
  15243. let k = 1;
  15244. while (k < 64) {
  15245. const rs = decodeHuffman(component.huffmanTableAC);
  15246. const s = rs & 15,
  15247. r = rs >> 4;
  15248. if (s === 0) {
  15249. if (r < 15) {
  15250. break;
  15251. }
  15252. k += 16;
  15253. continue;
  15254. }
  15255. k += r;
  15256. const z = dctZigZag[k];
  15257. component.blockData[blockOffset + z] = receiveAndExtend(s);
  15258. k++;
  15259. }
  15260. }
  15261. function decodeDCFirst(component, blockOffset) {
  15262. const t = decodeHuffman(component.huffmanTableDC);
  15263. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  15264. component.blockData[blockOffset] = component.pred += diff;
  15265. }
  15266. function decodeDCSuccessive(component, blockOffset) {
  15267. component.blockData[blockOffset] |= readBit() << successive;
  15268. }
  15269. let eobrun = 0;
  15270. function decodeACFirst(component, blockOffset) {
  15271. if (eobrun > 0) {
  15272. eobrun--;
  15273. return;
  15274. }
  15275. let k = spectralStart;
  15276. const e = spectralEnd;
  15277. while (k <= e) {
  15278. const rs = decodeHuffman(component.huffmanTableAC);
  15279. const s = rs & 15,
  15280. r = rs >> 4;
  15281. if (s === 0) {
  15282. if (r < 15) {
  15283. eobrun = receive(r) + (1 << r) - 1;
  15284. break;
  15285. }
  15286. k += 16;
  15287. continue;
  15288. }
  15289. k += r;
  15290. const z = dctZigZag[k];
  15291. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  15292. k++;
  15293. }
  15294. }
  15295. let successiveACState = 0,
  15296. successiveACNextValue;
  15297. function decodeACSuccessive(component, blockOffset) {
  15298. let k = spectralStart;
  15299. const e = spectralEnd;
  15300. let r = 0;
  15301. let s;
  15302. let rs;
  15303. while (k <= e) {
  15304. const offsetZ = blockOffset + dctZigZag[k];
  15305. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  15306. switch (successiveACState) {
  15307. case 0:
  15308. rs = decodeHuffman(component.huffmanTableAC);
  15309. s = rs & 15;
  15310. r = rs >> 4;
  15311. if (s === 0) {
  15312. if (r < 15) {
  15313. eobrun = receive(r) + (1 << r);
  15314. successiveACState = 4;
  15315. } else {
  15316. r = 16;
  15317. successiveACState = 1;
  15318. }
  15319. } else {
  15320. if (s !== 1) {
  15321. throw new JpegError("invalid ACn encoding");
  15322. }
  15323. successiveACNextValue = receiveAndExtend(s);
  15324. successiveACState = r ? 2 : 3;
  15325. }
  15326. continue;
  15327. case 1:
  15328. case 2:
  15329. if (component.blockData[offsetZ]) {
  15330. component.blockData[offsetZ] += sign * (readBit() << successive);
  15331. } else {
  15332. r--;
  15333. if (r === 0) {
  15334. successiveACState = successiveACState === 2 ? 3 : 0;
  15335. }
  15336. }
  15337. break;
  15338. case 3:
  15339. if (component.blockData[offsetZ]) {
  15340. component.blockData[offsetZ] += sign * (readBit() << successive);
  15341. } else {
  15342. component.blockData[offsetZ] = successiveACNextValue << successive;
  15343. successiveACState = 0;
  15344. }
  15345. break;
  15346. case 4:
  15347. if (component.blockData[offsetZ]) {
  15348. component.blockData[offsetZ] += sign * (readBit() << successive);
  15349. }
  15350. break;
  15351. }
  15352. k++;
  15353. }
  15354. if (successiveACState === 4) {
  15355. eobrun--;
  15356. if (eobrun === 0) {
  15357. successiveACState = 0;
  15358. }
  15359. }
  15360. }
  15361. let blockRow = 0;
  15362. function decodeMcu(component, decode, mcu, row, col) {
  15363. const mcuRow = mcu / mcusPerLine | 0;
  15364. const mcuCol = mcu % mcusPerLine;
  15365. blockRow = mcuRow * component.v + row;
  15366. const blockCol = mcuCol * component.h + col;
  15367. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  15368. decode(component, blockOffset);
  15369. }
  15370. function decodeBlock(component, decode, mcu) {
  15371. blockRow = mcu / component.blocksPerLine | 0;
  15372. const blockCol = mcu % component.blocksPerLine;
  15373. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  15374. decode(component, blockOffset);
  15375. }
  15376. const componentsLength = components.length;
  15377. let component, i, j, k, n;
  15378. let decodeFn;
  15379. if (progressive) {
  15380. if (spectralStart === 0) {
  15381. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  15382. } else {
  15383. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  15384. }
  15385. } else {
  15386. decodeFn = decodeBaseline;
  15387. }
  15388. let mcu = 0,
  15389. fileMarker;
  15390. let mcuExpected;
  15391. if (componentsLength === 1) {
  15392. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  15393. } else {
  15394. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  15395. }
  15396. let h, v;
  15397. while (mcu <= mcuExpected) {
  15398. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  15399. if (mcuToRead > 0) {
  15400. for (i = 0; i < componentsLength; i++) {
  15401. components[i].pred = 0;
  15402. }
  15403. eobrun = 0;
  15404. if (componentsLength === 1) {
  15405. component = components[0];
  15406. for (n = 0; n < mcuToRead; n++) {
  15407. decodeBlock(component, decodeFn, mcu);
  15408. mcu++;
  15409. }
  15410. } else {
  15411. for (n = 0; n < mcuToRead; n++) {
  15412. for (i = 0; i < componentsLength; i++) {
  15413. component = components[i];
  15414. h = component.h;
  15415. v = component.v;
  15416. for (j = 0; j < v; j++) {
  15417. for (k = 0; k < h; k++) {
  15418. decodeMcu(component, decodeFn, mcu, j, k);
  15419. }
  15420. }
  15421. }
  15422. mcu++;
  15423. }
  15424. }
  15425. }
  15426. bitsCount = 0;
  15427. fileMarker = findNextFileMarker(data, offset);
  15428. if (!fileMarker) {
  15429. break;
  15430. }
  15431. if (fileMarker.invalid) {
  15432. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  15433. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  15434. offset = fileMarker.offset;
  15435. }
  15436. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  15437. offset += 2;
  15438. } else {
  15439. break;
  15440. }
  15441. }
  15442. return offset - startOffset;
  15443. }
  15444. function quantizeAndInverse(component, blockBufferOffset, p) {
  15445. const qt = component.quantizationTable,
  15446. blockData = component.blockData;
  15447. let v0, v1, v2, v3, v4, v5, v6, v7;
  15448. let p0, p1, p2, p3, p4, p5, p6, p7;
  15449. let t;
  15450. if (!qt) {
  15451. throw new JpegError("missing required Quantization Table.");
  15452. }
  15453. for (let row = 0; row < 64; row += 8) {
  15454. p0 = blockData[blockBufferOffset + row];
  15455. p1 = blockData[blockBufferOffset + row + 1];
  15456. p2 = blockData[blockBufferOffset + row + 2];
  15457. p3 = blockData[blockBufferOffset + row + 3];
  15458. p4 = blockData[blockBufferOffset + row + 4];
  15459. p5 = blockData[blockBufferOffset + row + 5];
  15460. p6 = blockData[blockBufferOffset + row + 6];
  15461. p7 = blockData[blockBufferOffset + row + 7];
  15462. p0 *= qt[row];
  15463. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  15464. t = dctSqrt2 * p0 + 512 >> 10;
  15465. p[row] = t;
  15466. p[row + 1] = t;
  15467. p[row + 2] = t;
  15468. p[row + 3] = t;
  15469. p[row + 4] = t;
  15470. p[row + 5] = t;
  15471. p[row + 6] = t;
  15472. p[row + 7] = t;
  15473. continue;
  15474. }
  15475. p1 *= qt[row + 1];
  15476. p2 *= qt[row + 2];
  15477. p3 *= qt[row + 3];
  15478. p4 *= qt[row + 4];
  15479. p5 *= qt[row + 5];
  15480. p6 *= qt[row + 6];
  15481. p7 *= qt[row + 7];
  15482. v0 = dctSqrt2 * p0 + 128 >> 8;
  15483. v1 = dctSqrt2 * p4 + 128 >> 8;
  15484. v2 = p2;
  15485. v3 = p6;
  15486. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  15487. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  15488. v5 = p3 << 4;
  15489. v6 = p5 << 4;
  15490. v0 = v0 + v1 + 1 >> 1;
  15491. v1 = v0 - v1;
  15492. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  15493. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  15494. v3 = t;
  15495. v4 = v4 + v6 + 1 >> 1;
  15496. v6 = v4 - v6;
  15497. v7 = v7 + v5 + 1 >> 1;
  15498. v5 = v7 - v5;
  15499. v0 = v0 + v3 + 1 >> 1;
  15500. v3 = v0 - v3;
  15501. v1 = v1 + v2 + 1 >> 1;
  15502. v2 = v1 - v2;
  15503. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  15504. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  15505. v7 = t;
  15506. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  15507. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  15508. v6 = t;
  15509. p[row] = v0 + v7;
  15510. p[row + 7] = v0 - v7;
  15511. p[row + 1] = v1 + v6;
  15512. p[row + 6] = v1 - v6;
  15513. p[row + 2] = v2 + v5;
  15514. p[row + 5] = v2 - v5;
  15515. p[row + 3] = v3 + v4;
  15516. p[row + 4] = v3 - v4;
  15517. }
  15518. for (let col = 0; col < 8; ++col) {
  15519. p0 = p[col];
  15520. p1 = p[col + 8];
  15521. p2 = p[col + 16];
  15522. p3 = p[col + 24];
  15523. p4 = p[col + 32];
  15524. p5 = p[col + 40];
  15525. p6 = p[col + 48];
  15526. p7 = p[col + 56];
  15527. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  15528. t = dctSqrt2 * p0 + 8192 >> 14;
  15529. if (t < -2040) {
  15530. t = 0;
  15531. } else if (t >= 2024) {
  15532. t = 255;
  15533. } else {
  15534. t = t + 2056 >> 4;
  15535. }
  15536. blockData[blockBufferOffset + col] = t;
  15537. blockData[blockBufferOffset + col + 8] = t;
  15538. blockData[blockBufferOffset + col + 16] = t;
  15539. blockData[blockBufferOffset + col + 24] = t;
  15540. blockData[blockBufferOffset + col + 32] = t;
  15541. blockData[blockBufferOffset + col + 40] = t;
  15542. blockData[blockBufferOffset + col + 48] = t;
  15543. blockData[blockBufferOffset + col + 56] = t;
  15544. continue;
  15545. }
  15546. v0 = dctSqrt2 * p0 + 2048 >> 12;
  15547. v1 = dctSqrt2 * p4 + 2048 >> 12;
  15548. v2 = p2;
  15549. v3 = p6;
  15550. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  15551. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  15552. v5 = p3;
  15553. v6 = p5;
  15554. v0 = (v0 + v1 + 1 >> 1) + 4112;
  15555. v1 = v0 - v1;
  15556. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  15557. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  15558. v3 = t;
  15559. v4 = v4 + v6 + 1 >> 1;
  15560. v6 = v4 - v6;
  15561. v7 = v7 + v5 + 1 >> 1;
  15562. v5 = v7 - v5;
  15563. v0 = v0 + v3 + 1 >> 1;
  15564. v3 = v0 - v3;
  15565. v1 = v1 + v2 + 1 >> 1;
  15566. v2 = v1 - v2;
  15567. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  15568. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  15569. v7 = t;
  15570. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  15571. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  15572. v6 = t;
  15573. p0 = v0 + v7;
  15574. p7 = v0 - v7;
  15575. p1 = v1 + v6;
  15576. p6 = v1 - v6;
  15577. p2 = v2 + v5;
  15578. p5 = v2 - v5;
  15579. p3 = v3 + v4;
  15580. p4 = v3 - v4;
  15581. if (p0 < 16) {
  15582. p0 = 0;
  15583. } else if (p0 >= 4080) {
  15584. p0 = 255;
  15585. } else {
  15586. p0 >>= 4;
  15587. }
  15588. if (p1 < 16) {
  15589. p1 = 0;
  15590. } else if (p1 >= 4080) {
  15591. p1 = 255;
  15592. } else {
  15593. p1 >>= 4;
  15594. }
  15595. if (p2 < 16) {
  15596. p2 = 0;
  15597. } else if (p2 >= 4080) {
  15598. p2 = 255;
  15599. } else {
  15600. p2 >>= 4;
  15601. }
  15602. if (p3 < 16) {
  15603. p3 = 0;
  15604. } else if (p3 >= 4080) {
  15605. p3 = 255;
  15606. } else {
  15607. p3 >>= 4;
  15608. }
  15609. if (p4 < 16) {
  15610. p4 = 0;
  15611. } else if (p4 >= 4080) {
  15612. p4 = 255;
  15613. } else {
  15614. p4 >>= 4;
  15615. }
  15616. if (p5 < 16) {
  15617. p5 = 0;
  15618. } else if (p5 >= 4080) {
  15619. p5 = 255;
  15620. } else {
  15621. p5 >>= 4;
  15622. }
  15623. if (p6 < 16) {
  15624. p6 = 0;
  15625. } else if (p6 >= 4080) {
  15626. p6 = 255;
  15627. } else {
  15628. p6 >>= 4;
  15629. }
  15630. if (p7 < 16) {
  15631. p7 = 0;
  15632. } else if (p7 >= 4080) {
  15633. p7 = 255;
  15634. } else {
  15635. p7 >>= 4;
  15636. }
  15637. blockData[blockBufferOffset + col] = p0;
  15638. blockData[blockBufferOffset + col + 8] = p1;
  15639. blockData[blockBufferOffset + col + 16] = p2;
  15640. blockData[blockBufferOffset + col + 24] = p3;
  15641. blockData[blockBufferOffset + col + 32] = p4;
  15642. blockData[blockBufferOffset + col + 40] = p5;
  15643. blockData[blockBufferOffset + col + 48] = p6;
  15644. blockData[blockBufferOffset + col + 56] = p7;
  15645. }
  15646. }
  15647. function buildComponentData(frame, component) {
  15648. const blocksPerLine = component.blocksPerLine;
  15649. const blocksPerColumn = component.blocksPerColumn;
  15650. const computationBuffer = new Int16Array(64);
  15651. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  15652. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  15653. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  15654. quantizeAndInverse(component, offset, computationBuffer);
  15655. }
  15656. }
  15657. return component.blockData;
  15658. }
  15659. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  15660. const maxPos = data.length - 1;
  15661. let newPos = startPos < currentPos ? startPos : currentPos;
  15662. if (currentPos >= maxPos) {
  15663. return null;
  15664. }
  15665. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  15666. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  15667. return {
  15668. invalid: null,
  15669. marker: currentMarker,
  15670. offset: currentPos
  15671. };
  15672. }
  15673. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  15674. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  15675. if (++newPos >= maxPos) {
  15676. return null;
  15677. }
  15678. newMarker = (0, _core_utils.readUint16)(data, newPos);
  15679. }
  15680. return {
  15681. invalid: currentMarker.toString(16),
  15682. marker: newMarker,
  15683. offset: newPos
  15684. };
  15685. }
  15686. class JpegImage {
  15687. constructor({
  15688. decodeTransform = null,
  15689. colorTransform = -1
  15690. } = {}) {
  15691. this._decodeTransform = decodeTransform;
  15692. this._colorTransform = colorTransform;
  15693. }
  15694. parse(data, {
  15695. dnlScanLines = null
  15696. } = {}) {
  15697. function readDataBlock() {
  15698. const length = (0, _core_utils.readUint16)(data, offset);
  15699. offset += 2;
  15700. let endOffset = offset + length - 2;
  15701. const fileMarker = findNextFileMarker(data, endOffset, offset);
  15702. if (fileMarker && fileMarker.invalid) {
  15703. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  15704. endOffset = fileMarker.offset;
  15705. }
  15706. const array = data.subarray(offset, endOffset);
  15707. offset += array.length;
  15708. return array;
  15709. }
  15710. function prepareComponents(frame) {
  15711. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  15712. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  15713. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  15714. const component = frame.components[i];
  15715. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  15716. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  15717. const blocksPerLineForMcu = mcusPerLine * component.h;
  15718. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  15719. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  15720. component.blockData = new Int16Array(blocksBufferSize);
  15721. component.blocksPerLine = blocksPerLine;
  15722. component.blocksPerColumn = blocksPerColumn;
  15723. }
  15724. frame.mcusPerLine = mcusPerLine;
  15725. frame.mcusPerColumn = mcusPerColumn;
  15726. }
  15727. let offset = 0;
  15728. let jfif = null;
  15729. let adobe = null;
  15730. let frame, resetInterval;
  15731. let numSOSMarkers = 0;
  15732. const quantizationTables = [];
  15733. const huffmanTablesAC = [],
  15734. huffmanTablesDC = [];
  15735. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  15736. offset += 2;
  15737. if (fileMarker !== 0xffd8) {
  15738. throw new JpegError("SOI not found");
  15739. }
  15740. fileMarker = (0, _core_utils.readUint16)(data, offset);
  15741. offset += 2;
  15742. markerLoop: while (fileMarker !== 0xffd9) {
  15743. let i, j, l;
  15744. switch (fileMarker) {
  15745. case 0xffe0:
  15746. case 0xffe1:
  15747. case 0xffe2:
  15748. case 0xffe3:
  15749. case 0xffe4:
  15750. case 0xffe5:
  15751. case 0xffe6:
  15752. case 0xffe7:
  15753. case 0xffe8:
  15754. case 0xffe9:
  15755. case 0xffea:
  15756. case 0xffeb:
  15757. case 0xffec:
  15758. case 0xffed:
  15759. case 0xffee:
  15760. case 0xffef:
  15761. case 0xfffe:
  15762. const appData = readDataBlock();
  15763. if (fileMarker === 0xffe0) {
  15764. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  15765. jfif = {
  15766. version: {
  15767. major: appData[5],
  15768. minor: appData[6]
  15769. },
  15770. densityUnits: appData[7],
  15771. xDensity: appData[8] << 8 | appData[9],
  15772. yDensity: appData[10] << 8 | appData[11],
  15773. thumbWidth: appData[12],
  15774. thumbHeight: appData[13],
  15775. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  15776. };
  15777. }
  15778. }
  15779. if (fileMarker === 0xffee) {
  15780. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  15781. adobe = {
  15782. version: appData[5] << 8 | appData[6],
  15783. flags0: appData[7] << 8 | appData[8],
  15784. flags1: appData[9] << 8 | appData[10],
  15785. transformCode: appData[11]
  15786. };
  15787. }
  15788. }
  15789. break;
  15790. case 0xffdb:
  15791. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  15792. offset += 2;
  15793. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  15794. let z;
  15795. while (offset < quantizationTablesEnd) {
  15796. const quantizationTableSpec = data[offset++];
  15797. const tableData = new Uint16Array(64);
  15798. if (quantizationTableSpec >> 4 === 0) {
  15799. for (j = 0; j < 64; j++) {
  15800. z = dctZigZag[j];
  15801. tableData[z] = data[offset++];
  15802. }
  15803. } else if (quantizationTableSpec >> 4 === 1) {
  15804. for (j = 0; j < 64; j++) {
  15805. z = dctZigZag[j];
  15806. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  15807. offset += 2;
  15808. }
  15809. } else {
  15810. throw new JpegError("DQT - invalid table spec");
  15811. }
  15812. quantizationTables[quantizationTableSpec & 15] = tableData;
  15813. }
  15814. break;
  15815. case 0xffc0:
  15816. case 0xffc1:
  15817. case 0xffc2:
  15818. if (frame) {
  15819. throw new JpegError("Only single frame JPEGs supported");
  15820. }
  15821. offset += 2;
  15822. frame = {};
  15823. frame.extended = fileMarker === 0xffc1;
  15824. frame.progressive = fileMarker === 0xffc2;
  15825. frame.precision = data[offset++];
  15826. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  15827. offset += 2;
  15828. frame.scanLines = dnlScanLines || sofScanLines;
  15829. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  15830. offset += 2;
  15831. frame.components = [];
  15832. frame.componentIds = {};
  15833. const componentsCount = data[offset++];
  15834. let maxH = 0,
  15835. maxV = 0;
  15836. for (i = 0; i < componentsCount; i++) {
  15837. const componentId = data[offset];
  15838. const h = data[offset + 1] >> 4;
  15839. const v = data[offset + 1] & 15;
  15840. if (maxH < h) {
  15841. maxH = h;
  15842. }
  15843. if (maxV < v) {
  15844. maxV = v;
  15845. }
  15846. const qId = data[offset + 2];
  15847. l = frame.components.push({
  15848. h,
  15849. v,
  15850. quantizationId: qId,
  15851. quantizationTable: null
  15852. });
  15853. frame.componentIds[componentId] = l - 1;
  15854. offset += 3;
  15855. }
  15856. frame.maxH = maxH;
  15857. frame.maxV = maxV;
  15858. prepareComponents(frame);
  15859. break;
  15860. case 0xffc4:
  15861. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  15862. offset += 2;
  15863. for (i = 2; i < huffmanLength;) {
  15864. const huffmanTableSpec = data[offset++];
  15865. const codeLengths = new Uint8Array(16);
  15866. let codeLengthSum = 0;
  15867. for (j = 0; j < 16; j++, offset++) {
  15868. codeLengthSum += codeLengths[j] = data[offset];
  15869. }
  15870. const huffmanValues = new Uint8Array(codeLengthSum);
  15871. for (j = 0; j < codeLengthSum; j++, offset++) {
  15872. huffmanValues[j] = data[offset];
  15873. }
  15874. i += 17 + codeLengthSum;
  15875. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  15876. }
  15877. break;
  15878. case 0xffdd:
  15879. offset += 2;
  15880. resetInterval = (0, _core_utils.readUint16)(data, offset);
  15881. offset += 2;
  15882. break;
  15883. case 0xffda:
  15884. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  15885. offset += 2;
  15886. const selectorsCount = data[offset++],
  15887. components = [];
  15888. for (i = 0; i < selectorsCount; i++) {
  15889. const index = data[offset++];
  15890. const componentIndex = frame.componentIds[index];
  15891. const component = frame.components[componentIndex];
  15892. component.index = index;
  15893. const tableSpec = data[offset++];
  15894. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  15895. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  15896. components.push(component);
  15897. }
  15898. const spectralStart = data[offset++],
  15899. spectralEnd = data[offset++],
  15900. successiveApproximation = data[offset++];
  15901. try {
  15902. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  15903. offset += processed;
  15904. } catch (ex) {
  15905. if (ex instanceof DNLMarkerError) {
  15906. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  15907. return this.parse(data, {
  15908. dnlScanLines: ex.scanLines
  15909. });
  15910. } else if (ex instanceof EOIMarkerError) {
  15911. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  15912. break markerLoop;
  15913. }
  15914. throw ex;
  15915. }
  15916. break;
  15917. case 0xffdc:
  15918. offset += 4;
  15919. break;
  15920. case 0xffff:
  15921. if (data[offset] !== 0xff) {
  15922. offset--;
  15923. }
  15924. break;
  15925. default:
  15926. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  15927. if (nextFileMarker && nextFileMarker.invalid) {
  15928. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  15929. offset = nextFileMarker.offset;
  15930. break;
  15931. }
  15932. if (!nextFileMarker || offset >= data.length - 1) {
  15933. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  15934. break markerLoop;
  15935. }
  15936. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  15937. }
  15938. fileMarker = (0, _core_utils.readUint16)(data, offset);
  15939. offset += 2;
  15940. }
  15941. this.width = frame.samplesPerLine;
  15942. this.height = frame.scanLines;
  15943. this.jfif = jfif;
  15944. this.adobe = adobe;
  15945. this.components = [];
  15946. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  15947. const component = frame.components[i];
  15948. const quantizationTable = quantizationTables[component.quantizationId];
  15949. if (quantizationTable) {
  15950. component.quantizationTable = quantizationTable;
  15951. }
  15952. this.components.push({
  15953. index: component.index,
  15954. output: buildComponentData(frame, component),
  15955. scaleX: component.h / frame.maxH,
  15956. scaleY: component.v / frame.maxV,
  15957. blocksPerLine: component.blocksPerLine,
  15958. blocksPerColumn: component.blocksPerColumn
  15959. });
  15960. }
  15961. this.numComponents = this.components.length;
  15962. return undefined;
  15963. }
  15964. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  15965. const scaleX = this.width / width,
  15966. scaleY = this.height / height;
  15967. let component, componentScaleX, componentScaleY, blocksPerScanline;
  15968. let x, y, i, j, k;
  15969. let index;
  15970. let offset = 0;
  15971. let output;
  15972. const numComponents = this.components.length;
  15973. const dataLength = width * height * numComponents;
  15974. const data = new Uint8ClampedArray(dataLength);
  15975. const xScaleBlockOffset = new Uint32Array(width);
  15976. const mask3LSB = 0xfffffff8;
  15977. let lastComponentScaleX;
  15978. for (i = 0; i < numComponents; i++) {
  15979. component = this.components[i];
  15980. componentScaleX = component.scaleX * scaleX;
  15981. componentScaleY = component.scaleY * scaleY;
  15982. offset = i;
  15983. output = component.output;
  15984. blocksPerScanline = component.blocksPerLine + 1 << 3;
  15985. if (componentScaleX !== lastComponentScaleX) {
  15986. for (x = 0; x < width; x++) {
  15987. j = 0 | x * componentScaleX;
  15988. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  15989. }
  15990. lastComponentScaleX = componentScaleX;
  15991. }
  15992. for (y = 0; y < height; y++) {
  15993. j = 0 | y * componentScaleY;
  15994. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  15995. for (x = 0; x < width; x++) {
  15996. data[offset] = output[index + xScaleBlockOffset[x]];
  15997. offset += numComponents;
  15998. }
  15999. }
  16000. }
  16001. let transform = this._decodeTransform;
  16002. if (!isSourcePDF && numComponents === 4 && !transform) {
  16003. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  16004. }
  16005. if (transform) {
  16006. for (i = 0; i < dataLength;) {
  16007. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  16008. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  16009. }
  16010. }
  16011. }
  16012. return data;
  16013. }
  16014. get _isColorConversionNeeded() {
  16015. if (this.adobe) {
  16016. return !!this.adobe.transformCode;
  16017. }
  16018. if (this.numComponents === 3) {
  16019. if (this._colorTransform === 0) {
  16020. return false;
  16021. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  16022. return false;
  16023. }
  16024. return true;
  16025. }
  16026. if (this._colorTransform === 1) {
  16027. return true;
  16028. }
  16029. return false;
  16030. }
  16031. _convertYccToRgb(data) {
  16032. let Y, Cb, Cr;
  16033. for (let i = 0, length = data.length; i < length; i += 3) {
  16034. Y = data[i];
  16035. Cb = data[i + 1];
  16036. Cr = data[i + 2];
  16037. data[i] = Y - 179.456 + 1.402 * Cr;
  16038. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  16039. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  16040. }
  16041. return data;
  16042. }
  16043. _convertYcckToRgb(data) {
  16044. let Y, Cb, Cr, k;
  16045. let offset = 0;
  16046. for (let i = 0, length = data.length; i < length; i += 4) {
  16047. Y = data[i];
  16048. Cb = data[i + 1];
  16049. Cr = data[i + 2];
  16050. k = data[i + 3];
  16051. 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);
  16052. 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);
  16053. 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);
  16054. }
  16055. return data.subarray(0, offset);
  16056. }
  16057. _convertYcckToCmyk(data) {
  16058. let Y, Cb, Cr;
  16059. for (let i = 0, length = data.length; i < length; i += 4) {
  16060. Y = data[i];
  16061. Cb = data[i + 1];
  16062. Cr = data[i + 2];
  16063. data[i] = 434.456 - Y - 1.402 * Cr;
  16064. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  16065. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  16066. }
  16067. return data;
  16068. }
  16069. _convertCmykToRgb(data) {
  16070. let c, m, y, k;
  16071. let offset = 0;
  16072. for (let i = 0, length = data.length; i < length; i += 4) {
  16073. c = data[i];
  16074. m = data[i + 1];
  16075. y = data[i + 2];
  16076. k = data[i + 3];
  16077. 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);
  16078. 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);
  16079. 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);
  16080. }
  16081. return data.subarray(0, offset);
  16082. }
  16083. getData({
  16084. width,
  16085. height,
  16086. forceRGB = false,
  16087. isSourcePDF = false
  16088. }) {
  16089. if (this.numComponents > 4) {
  16090. throw new JpegError("Unsupported color mode");
  16091. }
  16092. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  16093. if (this.numComponents === 1 && forceRGB) {
  16094. const dataLength = data.length;
  16095. const rgbData = new Uint8ClampedArray(dataLength * 3);
  16096. let offset = 0;
  16097. for (let i = 0; i < dataLength; i++) {
  16098. const grayColor = data[i];
  16099. rgbData[offset++] = grayColor;
  16100. rgbData[offset++] = grayColor;
  16101. rgbData[offset++] = grayColor;
  16102. }
  16103. return rgbData;
  16104. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  16105. return this._convertYccToRgb(data);
  16106. } else if (this.numComponents === 4) {
  16107. if (this._isColorConversionNeeded) {
  16108. if (forceRGB) {
  16109. return this._convertYcckToRgb(data);
  16110. }
  16111. return this._convertYcckToCmyk(data);
  16112. } else if (forceRGB) {
  16113. return this._convertCmykToRgb(data);
  16114. }
  16115. }
  16116. return data;
  16117. }
  16118. }
  16119. exports.JpegImage = JpegImage;
  16120. /***/ }),
  16121. /* 29 */
  16122. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16123. Object.defineProperty(exports, "__esModule", ({
  16124. value: true
  16125. }));
  16126. exports.JpxStream = void 0;
  16127. var _decode_stream = __w_pdfjs_require__(19);
  16128. var _jpx = __w_pdfjs_require__(30);
  16129. var _util = __w_pdfjs_require__(2);
  16130. class JpxStream extends _decode_stream.DecodeStream {
  16131. constructor(stream, maybeLength, params) {
  16132. super(maybeLength);
  16133. this.stream = stream;
  16134. this.dict = stream.dict;
  16135. this.maybeLength = maybeLength;
  16136. this.params = params;
  16137. }
  16138. get bytes() {
  16139. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  16140. }
  16141. ensureBuffer(requested) {}
  16142. readBlock() {
  16143. if (this.eof) {
  16144. return;
  16145. }
  16146. const jpxImage = new _jpx.JpxImage();
  16147. jpxImage.parse(this.bytes);
  16148. const width = jpxImage.width;
  16149. const height = jpxImage.height;
  16150. const componentsCount = jpxImage.componentsCount;
  16151. const tileCount = jpxImage.tiles.length;
  16152. if (tileCount === 1) {
  16153. this.buffer = jpxImage.tiles[0].items;
  16154. } else {
  16155. const data = new Uint8ClampedArray(width * height * componentsCount);
  16156. for (let k = 0; k < tileCount; k++) {
  16157. const tileComponents = jpxImage.tiles[k];
  16158. const tileWidth = tileComponents.width;
  16159. const tileHeight = tileComponents.height;
  16160. const tileLeft = tileComponents.left;
  16161. const tileTop = tileComponents.top;
  16162. const src = tileComponents.items;
  16163. let srcPosition = 0;
  16164. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  16165. const imgRowSize = width * componentsCount;
  16166. const tileRowSize = tileWidth * componentsCount;
  16167. for (let j = 0; j < tileHeight; j++) {
  16168. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  16169. data.set(rowBytes, dataPosition);
  16170. srcPosition += tileRowSize;
  16171. dataPosition += imgRowSize;
  16172. }
  16173. }
  16174. this.buffer = data;
  16175. }
  16176. this.bufferLength = this.buffer.length;
  16177. this.eof = true;
  16178. }
  16179. }
  16180. exports.JpxStream = JpxStream;
  16181. /***/ }),
  16182. /* 30 */
  16183. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16184. Object.defineProperty(exports, "__esModule", ({
  16185. value: true
  16186. }));
  16187. exports.JpxImage = void 0;
  16188. var _util = __w_pdfjs_require__(2);
  16189. var _core_utils = __w_pdfjs_require__(9);
  16190. var _arithmetic_decoder = __w_pdfjs_require__(26);
  16191. class JpxError extends _util.BaseException {
  16192. constructor(msg) {
  16193. super(`JPX error: ${msg}`);
  16194. }
  16195. }
  16196. const SubbandsGainLog2 = {
  16197. LL: 0,
  16198. LH: 1,
  16199. HL: 1,
  16200. HH: 2
  16201. };
  16202. class JpxImage {
  16203. constructor() {
  16204. this.failOnCorruptedImage = false;
  16205. }
  16206. parse(data) {
  16207. const head = (0, _core_utils.readUint16)(data, 0);
  16208. if (head === 0xff4f) {
  16209. this.parseCodestream(data, 0, data.length);
  16210. return;
  16211. }
  16212. const length = data.length;
  16213. let position = 0;
  16214. while (position < length) {
  16215. let headerSize = 8;
  16216. let lbox = (0, _core_utils.readUint32)(data, position);
  16217. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  16218. position += headerSize;
  16219. if (lbox === 1) {
  16220. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  16221. position += 8;
  16222. headerSize += 8;
  16223. }
  16224. if (lbox === 0) {
  16225. lbox = length - position + headerSize;
  16226. }
  16227. if (lbox < headerSize) {
  16228. throw new JpxError("Invalid box field size");
  16229. }
  16230. const dataLength = lbox - headerSize;
  16231. let jumpDataLength = true;
  16232. switch (tbox) {
  16233. case 0x6a703268:
  16234. jumpDataLength = false;
  16235. break;
  16236. case 0x636f6c72:
  16237. const method = data[position];
  16238. if (method === 1) {
  16239. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  16240. switch (colorspace) {
  16241. case 16:
  16242. case 17:
  16243. case 18:
  16244. break;
  16245. default:
  16246. (0, _util.warn)("Unknown colorspace " + colorspace);
  16247. break;
  16248. }
  16249. } else if (method === 2) {
  16250. (0, _util.info)("ICC profile not supported");
  16251. }
  16252. break;
  16253. case 0x6a703263:
  16254. this.parseCodestream(data, position, position + dataLength);
  16255. break;
  16256. case 0x6a502020:
  16257. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  16258. (0, _util.warn)("Invalid JP2 signature");
  16259. }
  16260. break;
  16261. case 0x6a501a1a:
  16262. case 0x66747970:
  16263. case 0x72726571:
  16264. case 0x72657320:
  16265. case 0x69686472:
  16266. break;
  16267. default:
  16268. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  16269. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  16270. break;
  16271. }
  16272. if (jumpDataLength) {
  16273. position += dataLength;
  16274. }
  16275. }
  16276. }
  16277. parseImageProperties(stream) {
  16278. let newByte = stream.getByte();
  16279. while (newByte >= 0) {
  16280. const oldByte = newByte;
  16281. newByte = stream.getByte();
  16282. const code = oldByte << 8 | newByte;
  16283. if (code === 0xff51) {
  16284. stream.skip(4);
  16285. const Xsiz = stream.getInt32() >>> 0;
  16286. const Ysiz = stream.getInt32() >>> 0;
  16287. const XOsiz = stream.getInt32() >>> 0;
  16288. const YOsiz = stream.getInt32() >>> 0;
  16289. stream.skip(16);
  16290. const Csiz = stream.getUint16();
  16291. this.width = Xsiz - XOsiz;
  16292. this.height = Ysiz - YOsiz;
  16293. this.componentsCount = Csiz;
  16294. this.bitsPerComponent = 8;
  16295. return;
  16296. }
  16297. }
  16298. throw new JpxError("No size marker found in JPX stream");
  16299. }
  16300. parseCodestream(data, start, end) {
  16301. const context = {};
  16302. let doNotRecover = false;
  16303. try {
  16304. let position = start;
  16305. while (position + 1 < end) {
  16306. const code = (0, _core_utils.readUint16)(data, position);
  16307. position += 2;
  16308. let length = 0,
  16309. j,
  16310. sqcd,
  16311. spqcds,
  16312. spqcdSize,
  16313. scalarExpounded,
  16314. tile;
  16315. switch (code) {
  16316. case 0xff4f:
  16317. context.mainHeader = true;
  16318. break;
  16319. case 0xffd9:
  16320. break;
  16321. case 0xff51:
  16322. length = (0, _core_utils.readUint16)(data, position);
  16323. const siz = {};
  16324. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  16325. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  16326. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  16327. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  16328. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  16329. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  16330. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  16331. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  16332. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  16333. siz.Csiz = componentsCount;
  16334. const components = [];
  16335. j = position + 38;
  16336. for (let i = 0; i < componentsCount; i++) {
  16337. const component = {
  16338. precision: (data[j] & 0x7f) + 1,
  16339. isSigned: !!(data[j] & 0x80),
  16340. XRsiz: data[j + 1],
  16341. YRsiz: data[j + 2]
  16342. };
  16343. j += 3;
  16344. calculateComponentDimensions(component, siz);
  16345. components.push(component);
  16346. }
  16347. context.SIZ = siz;
  16348. context.components = components;
  16349. calculateTileGrids(context, components);
  16350. context.QCC = [];
  16351. context.COC = [];
  16352. break;
  16353. case 0xff5c:
  16354. length = (0, _core_utils.readUint16)(data, position);
  16355. const qcd = {};
  16356. j = position + 2;
  16357. sqcd = data[j++];
  16358. switch (sqcd & 0x1f) {
  16359. case 0:
  16360. spqcdSize = 8;
  16361. scalarExpounded = true;
  16362. break;
  16363. case 1:
  16364. spqcdSize = 16;
  16365. scalarExpounded = false;
  16366. break;
  16367. case 2:
  16368. spqcdSize = 16;
  16369. scalarExpounded = true;
  16370. break;
  16371. default:
  16372. throw new Error("Invalid SQcd value " + sqcd);
  16373. }
  16374. qcd.noQuantization = spqcdSize === 8;
  16375. qcd.scalarExpounded = scalarExpounded;
  16376. qcd.guardBits = sqcd >> 5;
  16377. spqcds = [];
  16378. while (j < length + position) {
  16379. const spqcd = {};
  16380. if (spqcdSize === 8) {
  16381. spqcd.epsilon = data[j++] >> 3;
  16382. spqcd.mu = 0;
  16383. } else {
  16384. spqcd.epsilon = data[j] >> 3;
  16385. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  16386. j += 2;
  16387. }
  16388. spqcds.push(spqcd);
  16389. }
  16390. qcd.SPqcds = spqcds;
  16391. if (context.mainHeader) {
  16392. context.QCD = qcd;
  16393. } else {
  16394. context.currentTile.QCD = qcd;
  16395. context.currentTile.QCC = [];
  16396. }
  16397. break;
  16398. case 0xff5d:
  16399. length = (0, _core_utils.readUint16)(data, position);
  16400. const qcc = {};
  16401. j = position + 2;
  16402. let cqcc;
  16403. if (context.SIZ.Csiz < 257) {
  16404. cqcc = data[j++];
  16405. } else {
  16406. cqcc = (0, _core_utils.readUint16)(data, j);
  16407. j += 2;
  16408. }
  16409. sqcd = data[j++];
  16410. switch (sqcd & 0x1f) {
  16411. case 0:
  16412. spqcdSize = 8;
  16413. scalarExpounded = true;
  16414. break;
  16415. case 1:
  16416. spqcdSize = 16;
  16417. scalarExpounded = false;
  16418. break;
  16419. case 2:
  16420. spqcdSize = 16;
  16421. scalarExpounded = true;
  16422. break;
  16423. default:
  16424. throw new Error("Invalid SQcd value " + sqcd);
  16425. }
  16426. qcc.noQuantization = spqcdSize === 8;
  16427. qcc.scalarExpounded = scalarExpounded;
  16428. qcc.guardBits = sqcd >> 5;
  16429. spqcds = [];
  16430. while (j < length + position) {
  16431. const spqcd = {};
  16432. if (spqcdSize === 8) {
  16433. spqcd.epsilon = data[j++] >> 3;
  16434. spqcd.mu = 0;
  16435. } else {
  16436. spqcd.epsilon = data[j] >> 3;
  16437. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  16438. j += 2;
  16439. }
  16440. spqcds.push(spqcd);
  16441. }
  16442. qcc.SPqcds = spqcds;
  16443. if (context.mainHeader) {
  16444. context.QCC[cqcc] = qcc;
  16445. } else {
  16446. context.currentTile.QCC[cqcc] = qcc;
  16447. }
  16448. break;
  16449. case 0xff52:
  16450. length = (0, _core_utils.readUint16)(data, position);
  16451. const cod = {};
  16452. j = position + 2;
  16453. const scod = data[j++];
  16454. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  16455. cod.sopMarkerUsed = !!(scod & 2);
  16456. cod.ephMarkerUsed = !!(scod & 4);
  16457. cod.progressionOrder = data[j++];
  16458. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  16459. j += 2;
  16460. cod.multipleComponentTransform = data[j++];
  16461. cod.decompositionLevelsCount = data[j++];
  16462. cod.xcb = (data[j++] & 0xf) + 2;
  16463. cod.ycb = (data[j++] & 0xf) + 2;
  16464. const blockStyle = data[j++];
  16465. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  16466. cod.resetContextProbabilities = !!(blockStyle & 2);
  16467. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  16468. cod.verticallyStripe = !!(blockStyle & 8);
  16469. cod.predictableTermination = !!(blockStyle & 16);
  16470. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  16471. cod.reversibleTransformation = data[j++];
  16472. if (cod.entropyCoderWithCustomPrecincts) {
  16473. const precinctsSizes = [];
  16474. while (j < length + position) {
  16475. const precinctsSize = data[j++];
  16476. precinctsSizes.push({
  16477. PPx: precinctsSize & 0xf,
  16478. PPy: precinctsSize >> 4
  16479. });
  16480. }
  16481. cod.precinctsSizes = precinctsSizes;
  16482. }
  16483. const unsupported = [];
  16484. if (cod.selectiveArithmeticCodingBypass) {
  16485. unsupported.push("selectiveArithmeticCodingBypass");
  16486. }
  16487. if (cod.resetContextProbabilities) {
  16488. unsupported.push("resetContextProbabilities");
  16489. }
  16490. if (cod.terminationOnEachCodingPass) {
  16491. unsupported.push("terminationOnEachCodingPass");
  16492. }
  16493. if (cod.verticallyStripe) {
  16494. unsupported.push("verticallyStripe");
  16495. }
  16496. if (cod.predictableTermination) {
  16497. unsupported.push("predictableTermination");
  16498. }
  16499. if (unsupported.length > 0) {
  16500. doNotRecover = true;
  16501. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  16502. }
  16503. if (context.mainHeader) {
  16504. context.COD = cod;
  16505. } else {
  16506. context.currentTile.COD = cod;
  16507. context.currentTile.COC = [];
  16508. }
  16509. break;
  16510. case 0xff90:
  16511. length = (0, _core_utils.readUint16)(data, position);
  16512. tile = {};
  16513. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  16514. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  16515. tile.dataEnd = tile.length + position - 2;
  16516. tile.partIndex = data[position + 8];
  16517. tile.partsCount = data[position + 9];
  16518. context.mainHeader = false;
  16519. if (tile.partIndex === 0) {
  16520. tile.COD = context.COD;
  16521. tile.COC = context.COC.slice(0);
  16522. tile.QCD = context.QCD;
  16523. tile.QCC = context.QCC.slice(0);
  16524. }
  16525. context.currentTile = tile;
  16526. break;
  16527. case 0xff93:
  16528. tile = context.currentTile;
  16529. if (tile.partIndex === 0) {
  16530. initializeTile(context, tile.index);
  16531. buildPackets(context);
  16532. }
  16533. length = tile.dataEnd - position;
  16534. parseTilePackets(context, data, position, length);
  16535. break;
  16536. case 0xff53:
  16537. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  16538. case 0xff55:
  16539. case 0xff57:
  16540. case 0xff58:
  16541. case 0xff64:
  16542. length = (0, _core_utils.readUint16)(data, position);
  16543. break;
  16544. default:
  16545. throw new Error("Unknown codestream code: " + code.toString(16));
  16546. }
  16547. position += length;
  16548. }
  16549. } catch (e) {
  16550. if (doNotRecover || this.failOnCorruptedImage) {
  16551. throw new JpxError(e.message);
  16552. } else {
  16553. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  16554. }
  16555. }
  16556. this.tiles = transformComponents(context);
  16557. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  16558. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  16559. this.componentsCount = context.SIZ.Csiz;
  16560. }
  16561. }
  16562. exports.JpxImage = JpxImage;
  16563. function calculateComponentDimensions(component, siz) {
  16564. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  16565. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  16566. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  16567. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  16568. component.width = component.x1 - component.x0;
  16569. component.height = component.y1 - component.y0;
  16570. }
  16571. function calculateTileGrids(context, components) {
  16572. const siz = context.SIZ;
  16573. const tiles = [];
  16574. let tile;
  16575. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  16576. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  16577. for (let q = 0; q < numYtiles; q++) {
  16578. for (let p = 0; p < numXtiles; p++) {
  16579. tile = {};
  16580. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  16581. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  16582. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  16583. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  16584. tile.width = tile.tx1 - tile.tx0;
  16585. tile.height = tile.ty1 - tile.ty0;
  16586. tile.components = [];
  16587. tiles.push(tile);
  16588. }
  16589. }
  16590. context.tiles = tiles;
  16591. const componentsCount = siz.Csiz;
  16592. for (let i = 0, ii = componentsCount; i < ii; i++) {
  16593. const component = components[i];
  16594. for (let j = 0, jj = tiles.length; j < jj; j++) {
  16595. const tileComponent = {};
  16596. tile = tiles[j];
  16597. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  16598. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  16599. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  16600. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  16601. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  16602. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  16603. tile.components[i] = tileComponent;
  16604. }
  16605. }
  16606. }
  16607. function getBlocksDimensions(context, component, r) {
  16608. const codOrCoc = component.codingStyleParameters;
  16609. const result = {};
  16610. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  16611. result.PPx = 15;
  16612. result.PPy = 15;
  16613. } else {
  16614. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  16615. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  16616. }
  16617. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  16618. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  16619. return result;
  16620. }
  16621. function buildPrecincts(context, resolution, dimensions) {
  16622. const precinctWidth = 1 << dimensions.PPx;
  16623. const precinctHeight = 1 << dimensions.PPy;
  16624. const isZeroRes = resolution.resLevel === 0;
  16625. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  16626. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  16627. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  16628. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  16629. const numprecincts = numprecinctswide * numprecinctshigh;
  16630. resolution.precinctParameters = {
  16631. precinctWidth,
  16632. precinctHeight,
  16633. numprecinctswide,
  16634. numprecinctshigh,
  16635. numprecincts,
  16636. precinctWidthInSubband,
  16637. precinctHeightInSubband
  16638. };
  16639. }
  16640. function buildCodeblocks(context, subband, dimensions) {
  16641. const xcb_ = dimensions.xcb_;
  16642. const ycb_ = dimensions.ycb_;
  16643. const codeblockWidth = 1 << xcb_;
  16644. const codeblockHeight = 1 << ycb_;
  16645. const cbx0 = subband.tbx0 >> xcb_;
  16646. const cby0 = subband.tby0 >> ycb_;
  16647. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  16648. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  16649. const precinctParameters = subband.resolution.precinctParameters;
  16650. const codeblocks = [];
  16651. const precincts = [];
  16652. let i, j, codeblock, precinctNumber;
  16653. for (j = cby0; j < cby1; j++) {
  16654. for (i = cbx0; i < cbx1; i++) {
  16655. codeblock = {
  16656. cbx: i,
  16657. cby: j,
  16658. tbx0: codeblockWidth * i,
  16659. tby0: codeblockHeight * j,
  16660. tbx1: codeblockWidth * (i + 1),
  16661. tby1: codeblockHeight * (j + 1)
  16662. };
  16663. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  16664. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  16665. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  16666. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  16667. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  16668. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  16669. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  16670. codeblock.precinctNumber = precinctNumber;
  16671. codeblock.subbandType = subband.type;
  16672. codeblock.Lblock = 3;
  16673. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  16674. continue;
  16675. }
  16676. codeblocks.push(codeblock);
  16677. let precinct = precincts[precinctNumber];
  16678. if (precinct !== undefined) {
  16679. if (i < precinct.cbxMin) {
  16680. precinct.cbxMin = i;
  16681. } else if (i > precinct.cbxMax) {
  16682. precinct.cbxMax = i;
  16683. }
  16684. if (j < precinct.cbyMin) {
  16685. precinct.cbxMin = j;
  16686. } else if (j > precinct.cbyMax) {
  16687. precinct.cbyMax = j;
  16688. }
  16689. } else {
  16690. precincts[precinctNumber] = precinct = {
  16691. cbxMin: i,
  16692. cbyMin: j,
  16693. cbxMax: i,
  16694. cbyMax: j
  16695. };
  16696. }
  16697. codeblock.precinct = precinct;
  16698. }
  16699. }
  16700. subband.codeblockParameters = {
  16701. codeblockWidth: xcb_,
  16702. codeblockHeight: ycb_,
  16703. numcodeblockwide: cbx1 - cbx0 + 1,
  16704. numcodeblockhigh: cby1 - cby0 + 1
  16705. };
  16706. subband.codeblocks = codeblocks;
  16707. subband.precincts = precincts;
  16708. }
  16709. function createPacket(resolution, precinctNumber, layerNumber) {
  16710. const precinctCodeblocks = [];
  16711. const subbands = resolution.subbands;
  16712. for (let i = 0, ii = subbands.length; i < ii; i++) {
  16713. const subband = subbands[i];
  16714. const codeblocks = subband.codeblocks;
  16715. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  16716. const codeblock = codeblocks[j];
  16717. if (codeblock.precinctNumber !== precinctNumber) {
  16718. continue;
  16719. }
  16720. precinctCodeblocks.push(codeblock);
  16721. }
  16722. }
  16723. return {
  16724. layerNumber,
  16725. codeblocks: precinctCodeblocks
  16726. };
  16727. }
  16728. function LayerResolutionComponentPositionIterator(context) {
  16729. const siz = context.SIZ;
  16730. const tileIndex = context.currentTile.index;
  16731. const tile = context.tiles[tileIndex];
  16732. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  16733. const componentsCount = siz.Csiz;
  16734. let maxDecompositionLevelsCount = 0;
  16735. for (let q = 0; q < componentsCount; q++) {
  16736. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  16737. }
  16738. let l = 0,
  16739. r = 0,
  16740. i = 0,
  16741. k = 0;
  16742. this.nextPacket = function JpxImage_nextPacket() {
  16743. for (; l < layersCount; l++) {
  16744. for (; r <= maxDecompositionLevelsCount; r++) {
  16745. for (; i < componentsCount; i++) {
  16746. const component = tile.components[i];
  16747. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  16748. continue;
  16749. }
  16750. const resolution = component.resolutions[r];
  16751. const numprecincts = resolution.precinctParameters.numprecincts;
  16752. for (; k < numprecincts;) {
  16753. const packet = createPacket(resolution, k, l);
  16754. k++;
  16755. return packet;
  16756. }
  16757. k = 0;
  16758. }
  16759. i = 0;
  16760. }
  16761. r = 0;
  16762. }
  16763. throw new JpxError("Out of packets");
  16764. };
  16765. }
  16766. function ResolutionLayerComponentPositionIterator(context) {
  16767. const siz = context.SIZ;
  16768. const tileIndex = context.currentTile.index;
  16769. const tile = context.tiles[tileIndex];
  16770. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  16771. const componentsCount = siz.Csiz;
  16772. let maxDecompositionLevelsCount = 0;
  16773. for (let q = 0; q < componentsCount; q++) {
  16774. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  16775. }
  16776. let r = 0,
  16777. l = 0,
  16778. i = 0,
  16779. k = 0;
  16780. this.nextPacket = function JpxImage_nextPacket() {
  16781. for (; r <= maxDecompositionLevelsCount; r++) {
  16782. for (; l < layersCount; l++) {
  16783. for (; i < componentsCount; i++) {
  16784. const component = tile.components[i];
  16785. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  16786. continue;
  16787. }
  16788. const resolution = component.resolutions[r];
  16789. const numprecincts = resolution.precinctParameters.numprecincts;
  16790. for (; k < numprecincts;) {
  16791. const packet = createPacket(resolution, k, l);
  16792. k++;
  16793. return packet;
  16794. }
  16795. k = 0;
  16796. }
  16797. i = 0;
  16798. }
  16799. l = 0;
  16800. }
  16801. throw new JpxError("Out of packets");
  16802. };
  16803. }
  16804. function ResolutionPositionComponentLayerIterator(context) {
  16805. const siz = context.SIZ;
  16806. const tileIndex = context.currentTile.index;
  16807. const tile = context.tiles[tileIndex];
  16808. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  16809. const componentsCount = siz.Csiz;
  16810. let l, r, c, p;
  16811. let maxDecompositionLevelsCount = 0;
  16812. for (c = 0; c < componentsCount; c++) {
  16813. const component = tile.components[c];
  16814. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  16815. }
  16816. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  16817. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  16818. let maxNumPrecincts = 0;
  16819. for (c = 0; c < componentsCount; ++c) {
  16820. const resolutions = tile.components[c].resolutions;
  16821. if (r < resolutions.length) {
  16822. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  16823. }
  16824. }
  16825. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  16826. }
  16827. l = 0;
  16828. r = 0;
  16829. c = 0;
  16830. p = 0;
  16831. this.nextPacket = function JpxImage_nextPacket() {
  16832. for (; r <= maxDecompositionLevelsCount; r++) {
  16833. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  16834. for (; c < componentsCount; c++) {
  16835. const component = tile.components[c];
  16836. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  16837. continue;
  16838. }
  16839. const resolution = component.resolutions[r];
  16840. const numprecincts = resolution.precinctParameters.numprecincts;
  16841. if (p >= numprecincts) {
  16842. continue;
  16843. }
  16844. for (; l < layersCount;) {
  16845. const packet = createPacket(resolution, p, l);
  16846. l++;
  16847. return packet;
  16848. }
  16849. l = 0;
  16850. }
  16851. c = 0;
  16852. }
  16853. p = 0;
  16854. }
  16855. throw new JpxError("Out of packets");
  16856. };
  16857. }
  16858. function PositionComponentResolutionLayerIterator(context) {
  16859. const siz = context.SIZ;
  16860. const tileIndex = context.currentTile.index;
  16861. const tile = context.tiles[tileIndex];
  16862. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  16863. const componentsCount = siz.Csiz;
  16864. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  16865. const precinctsIterationSizes = precinctsSizes;
  16866. let l = 0,
  16867. r = 0,
  16868. c = 0,
  16869. px = 0,
  16870. py = 0;
  16871. this.nextPacket = function JpxImage_nextPacket() {
  16872. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  16873. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  16874. for (; c < componentsCount; c++) {
  16875. const component = tile.components[c];
  16876. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  16877. for (; r <= decompositionLevelsCount; r++) {
  16878. const resolution = component.resolutions[r];
  16879. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  16880. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  16881. if (k === null) {
  16882. continue;
  16883. }
  16884. for (; l < layersCount;) {
  16885. const packet = createPacket(resolution, k, l);
  16886. l++;
  16887. return packet;
  16888. }
  16889. l = 0;
  16890. }
  16891. r = 0;
  16892. }
  16893. c = 0;
  16894. }
  16895. px = 0;
  16896. }
  16897. throw new JpxError("Out of packets");
  16898. };
  16899. }
  16900. function ComponentPositionResolutionLayerIterator(context) {
  16901. const siz = context.SIZ;
  16902. const tileIndex = context.currentTile.index;
  16903. const tile = context.tiles[tileIndex];
  16904. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  16905. const componentsCount = siz.Csiz;
  16906. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  16907. let l = 0,
  16908. r = 0,
  16909. c = 0,
  16910. px = 0,
  16911. py = 0;
  16912. this.nextPacket = function JpxImage_nextPacket() {
  16913. for (; c < componentsCount; ++c) {
  16914. const component = tile.components[c];
  16915. const precinctsIterationSizes = precinctsSizes.components[c];
  16916. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  16917. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  16918. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  16919. for (; r <= decompositionLevelsCount; r++) {
  16920. const resolution = component.resolutions[r];
  16921. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  16922. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  16923. if (k === null) {
  16924. continue;
  16925. }
  16926. for (; l < layersCount;) {
  16927. const packet = createPacket(resolution, k, l);
  16928. l++;
  16929. return packet;
  16930. }
  16931. l = 0;
  16932. }
  16933. r = 0;
  16934. }
  16935. px = 0;
  16936. }
  16937. py = 0;
  16938. }
  16939. throw new JpxError("Out of packets");
  16940. };
  16941. }
  16942. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  16943. const posX = pxIndex * precinctIterationSizes.minWidth;
  16944. const posY = pyIndex * precinctIterationSizes.minHeight;
  16945. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  16946. return null;
  16947. }
  16948. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  16949. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  16950. }
  16951. function getPrecinctSizesInImageScale(tile) {
  16952. const componentsCount = tile.components.length;
  16953. let minWidth = Number.MAX_VALUE;
  16954. let minHeight = Number.MAX_VALUE;
  16955. let maxNumWide = 0;
  16956. let maxNumHigh = 0;
  16957. const sizePerComponent = new Array(componentsCount);
  16958. for (let c = 0; c < componentsCount; c++) {
  16959. const component = tile.components[c];
  16960. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  16961. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  16962. let minWidthCurrentComponent = Number.MAX_VALUE;
  16963. let minHeightCurrentComponent = Number.MAX_VALUE;
  16964. let maxNumWideCurrentComponent = 0;
  16965. let maxNumHighCurrentComponent = 0;
  16966. let scale = 1;
  16967. for (let r = decompositionLevelsCount; r >= 0; --r) {
  16968. const resolution = component.resolutions[r];
  16969. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  16970. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  16971. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  16972. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  16973. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  16974. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  16975. sizePerResolution[r] = {
  16976. width: widthCurrentResolution,
  16977. height: heightCurrentResolution
  16978. };
  16979. scale <<= 1;
  16980. }
  16981. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  16982. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  16983. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  16984. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  16985. sizePerComponent[c] = {
  16986. resolutions: sizePerResolution,
  16987. minWidth: minWidthCurrentComponent,
  16988. minHeight: minHeightCurrentComponent,
  16989. maxNumWide: maxNumWideCurrentComponent,
  16990. maxNumHigh: maxNumHighCurrentComponent
  16991. };
  16992. }
  16993. return {
  16994. components: sizePerComponent,
  16995. minWidth,
  16996. minHeight,
  16997. maxNumWide,
  16998. maxNumHigh
  16999. };
  17000. }
  17001. function buildPackets(context) {
  17002. const siz = context.SIZ;
  17003. const tileIndex = context.currentTile.index;
  17004. const tile = context.tiles[tileIndex];
  17005. const componentsCount = siz.Csiz;
  17006. for (let c = 0; c < componentsCount; c++) {
  17007. const component = tile.components[c];
  17008. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  17009. const resolutions = [];
  17010. const subbands = [];
  17011. for (let r = 0; r <= decompositionLevelsCount; r++) {
  17012. const blocksDimensions = getBlocksDimensions(context, component, r);
  17013. const resolution = {};
  17014. const scale = 1 << decompositionLevelsCount - r;
  17015. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  17016. resolution.try0 = Math.ceil(component.tcy0 / scale);
  17017. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  17018. resolution.try1 = Math.ceil(component.tcy1 / scale);
  17019. resolution.resLevel = r;
  17020. buildPrecincts(context, resolution, blocksDimensions);
  17021. resolutions.push(resolution);
  17022. let subband;
  17023. if (r === 0) {
  17024. subband = {};
  17025. subband.type = "LL";
  17026. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  17027. subband.tby0 = Math.ceil(component.tcy0 / scale);
  17028. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  17029. subband.tby1 = Math.ceil(component.tcy1 / scale);
  17030. subband.resolution = resolution;
  17031. buildCodeblocks(context, subband, blocksDimensions);
  17032. subbands.push(subband);
  17033. resolution.subbands = [subband];
  17034. } else {
  17035. const bscale = 1 << decompositionLevelsCount - r + 1;
  17036. const resolutionSubbands = [];
  17037. subband = {};
  17038. subband.type = "HL";
  17039. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  17040. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  17041. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  17042. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  17043. subband.resolution = resolution;
  17044. buildCodeblocks(context, subband, blocksDimensions);
  17045. subbands.push(subband);
  17046. resolutionSubbands.push(subband);
  17047. subband = {};
  17048. subband.type = "LH";
  17049. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  17050. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  17051. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  17052. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  17053. subband.resolution = resolution;
  17054. buildCodeblocks(context, subband, blocksDimensions);
  17055. subbands.push(subband);
  17056. resolutionSubbands.push(subband);
  17057. subband = {};
  17058. subband.type = "HH";
  17059. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  17060. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  17061. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  17062. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  17063. subband.resolution = resolution;
  17064. buildCodeblocks(context, subband, blocksDimensions);
  17065. subbands.push(subband);
  17066. resolutionSubbands.push(subband);
  17067. resolution.subbands = resolutionSubbands;
  17068. }
  17069. }
  17070. component.resolutions = resolutions;
  17071. component.subbands = subbands;
  17072. }
  17073. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  17074. switch (progressionOrder) {
  17075. case 0:
  17076. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  17077. break;
  17078. case 1:
  17079. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  17080. break;
  17081. case 2:
  17082. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  17083. break;
  17084. case 3:
  17085. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  17086. break;
  17087. case 4:
  17088. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  17089. break;
  17090. default:
  17091. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  17092. }
  17093. }
  17094. function parseTilePackets(context, data, offset, dataLength) {
  17095. let position = 0;
  17096. let buffer,
  17097. bufferSize = 0,
  17098. skipNextBit = false;
  17099. function readBits(count) {
  17100. while (bufferSize < count) {
  17101. const b = data[offset + position];
  17102. position++;
  17103. if (skipNextBit) {
  17104. buffer = buffer << 7 | b;
  17105. bufferSize += 7;
  17106. skipNextBit = false;
  17107. } else {
  17108. buffer = buffer << 8 | b;
  17109. bufferSize += 8;
  17110. }
  17111. if (b === 0xff) {
  17112. skipNextBit = true;
  17113. }
  17114. }
  17115. bufferSize -= count;
  17116. return buffer >>> bufferSize & (1 << count) - 1;
  17117. }
  17118. function skipMarkerIfEqual(value) {
  17119. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  17120. skipBytes(1);
  17121. return true;
  17122. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  17123. skipBytes(2);
  17124. return true;
  17125. }
  17126. return false;
  17127. }
  17128. function skipBytes(count) {
  17129. position += count;
  17130. }
  17131. function alignToByte() {
  17132. bufferSize = 0;
  17133. if (skipNextBit) {
  17134. position++;
  17135. skipNextBit = false;
  17136. }
  17137. }
  17138. function readCodingpasses() {
  17139. if (readBits(1) === 0) {
  17140. return 1;
  17141. }
  17142. if (readBits(1) === 0) {
  17143. return 2;
  17144. }
  17145. let value = readBits(2);
  17146. if (value < 3) {
  17147. return value + 3;
  17148. }
  17149. value = readBits(5);
  17150. if (value < 31) {
  17151. return value + 6;
  17152. }
  17153. value = readBits(7);
  17154. return value + 37;
  17155. }
  17156. const tileIndex = context.currentTile.index;
  17157. const tile = context.tiles[tileIndex];
  17158. const sopMarkerUsed = context.COD.sopMarkerUsed;
  17159. const ephMarkerUsed = context.COD.ephMarkerUsed;
  17160. const packetsIterator = tile.packetsIterator;
  17161. while (position < dataLength) {
  17162. alignToByte();
  17163. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  17164. skipBytes(4);
  17165. }
  17166. const packet = packetsIterator.nextPacket();
  17167. if (!readBits(1)) {
  17168. continue;
  17169. }
  17170. const layerNumber = packet.layerNumber,
  17171. queue = [];
  17172. let codeblock;
  17173. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  17174. codeblock = packet.codeblocks[i];
  17175. let precinct = codeblock.precinct;
  17176. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  17177. const codeblockRow = codeblock.cby - precinct.cbyMin;
  17178. let codeblockIncluded = false;
  17179. let firstTimeInclusion = false;
  17180. let valueReady, zeroBitPlanesTree;
  17181. if (codeblock.included !== undefined) {
  17182. codeblockIncluded = !!readBits(1);
  17183. } else {
  17184. precinct = codeblock.precinct;
  17185. let inclusionTree;
  17186. if (precinct.inclusionTree !== undefined) {
  17187. inclusionTree = precinct.inclusionTree;
  17188. } else {
  17189. const width = precinct.cbxMax - precinct.cbxMin + 1;
  17190. const height = precinct.cbyMax - precinct.cbyMin + 1;
  17191. inclusionTree = new InclusionTree(width, height, layerNumber);
  17192. zeroBitPlanesTree = new TagTree(width, height);
  17193. precinct.inclusionTree = inclusionTree;
  17194. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  17195. }
  17196. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  17197. while (true) {
  17198. if (readBits(1)) {
  17199. valueReady = !inclusionTree.nextLevel();
  17200. if (valueReady) {
  17201. codeblock.included = true;
  17202. codeblockIncluded = firstTimeInclusion = true;
  17203. break;
  17204. }
  17205. } else {
  17206. inclusionTree.incrementValue(layerNumber);
  17207. break;
  17208. }
  17209. }
  17210. }
  17211. }
  17212. if (!codeblockIncluded) {
  17213. continue;
  17214. }
  17215. if (firstTimeInclusion) {
  17216. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  17217. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  17218. while (true) {
  17219. if (readBits(1)) {
  17220. valueReady = !zeroBitPlanesTree.nextLevel();
  17221. if (valueReady) {
  17222. break;
  17223. }
  17224. } else {
  17225. zeroBitPlanesTree.incrementValue();
  17226. }
  17227. }
  17228. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  17229. }
  17230. const codingpasses = readCodingpasses();
  17231. while (readBits(1)) {
  17232. codeblock.Lblock++;
  17233. }
  17234. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  17235. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  17236. const codedDataLength = readBits(bits);
  17237. queue.push({
  17238. codeblock,
  17239. codingpasses,
  17240. dataLength: codedDataLength
  17241. });
  17242. }
  17243. alignToByte();
  17244. if (ephMarkerUsed) {
  17245. skipMarkerIfEqual(0x92);
  17246. }
  17247. while (queue.length > 0) {
  17248. const packetItem = queue.shift();
  17249. codeblock = packetItem.codeblock;
  17250. if (codeblock.data === undefined) {
  17251. codeblock.data = [];
  17252. }
  17253. codeblock.data.push({
  17254. data,
  17255. start: offset + position,
  17256. end: offset + position + packetItem.dataLength,
  17257. codingpasses: packetItem.codingpasses
  17258. });
  17259. position += packetItem.dataLength;
  17260. }
  17261. }
  17262. return position;
  17263. }
  17264. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  17265. const x0 = subband.tbx0;
  17266. const y0 = subband.tby0;
  17267. const width = subband.tbx1 - subband.tbx0;
  17268. const codeblocks = subband.codeblocks;
  17269. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  17270. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  17271. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  17272. const codeblock = codeblocks[i];
  17273. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  17274. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  17275. if (blockWidth === 0 || blockHeight === 0) {
  17276. continue;
  17277. }
  17278. if (codeblock.data === undefined) {
  17279. continue;
  17280. }
  17281. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  17282. let currentCodingpassType = 2;
  17283. const data = codeblock.data;
  17284. let totalLength = 0,
  17285. codingpasses = 0;
  17286. let j, jj, dataItem;
  17287. for (j = 0, jj = data.length; j < jj; j++) {
  17288. dataItem = data[j];
  17289. totalLength += dataItem.end - dataItem.start;
  17290. codingpasses += dataItem.codingpasses;
  17291. }
  17292. const encodedData = new Uint8Array(totalLength);
  17293. let position = 0;
  17294. for (j = 0, jj = data.length; j < jj; j++) {
  17295. dataItem = data[j];
  17296. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  17297. encodedData.set(chunk, position);
  17298. position += chunk.length;
  17299. }
  17300. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  17301. bitModel.setDecoder(decoder);
  17302. for (j = 0; j < codingpasses; j++) {
  17303. switch (currentCodingpassType) {
  17304. case 0:
  17305. bitModel.runSignificancePropagationPass();
  17306. break;
  17307. case 1:
  17308. bitModel.runMagnitudeRefinementPass();
  17309. break;
  17310. case 2:
  17311. bitModel.runCleanupPass();
  17312. if (segmentationSymbolUsed) {
  17313. bitModel.checkSegmentationSymbol();
  17314. }
  17315. break;
  17316. }
  17317. currentCodingpassType = (currentCodingpassType + 1) % 3;
  17318. }
  17319. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  17320. const sign = bitModel.coefficentsSign;
  17321. const magnitude = bitModel.coefficentsMagnitude;
  17322. const bitsDecoded = bitModel.bitsDecoded;
  17323. const magnitudeCorrection = reversible ? 0 : 0.5;
  17324. let k, n, nb;
  17325. position = 0;
  17326. const interleave = subband.type !== "LL";
  17327. for (j = 0; j < blockHeight; j++) {
  17328. const row = offset / width | 0;
  17329. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  17330. for (k = 0; k < blockWidth; k++) {
  17331. n = magnitude[position];
  17332. if (n !== 0) {
  17333. n = (n + magnitudeCorrection) * delta;
  17334. if (sign[position] !== 0) {
  17335. n = -n;
  17336. }
  17337. nb = bitsDecoded[position];
  17338. const pos = interleave ? levelOffset + (offset << 1) : offset;
  17339. if (reversible && nb >= mb) {
  17340. coefficients[pos] = n;
  17341. } else {
  17342. coefficients[pos] = n * (1 << mb - nb);
  17343. }
  17344. }
  17345. offset++;
  17346. position++;
  17347. }
  17348. offset += width - blockWidth;
  17349. }
  17350. }
  17351. }
  17352. function transformTile(context, tile, c) {
  17353. const component = tile.components[c];
  17354. const codingStyleParameters = component.codingStyleParameters;
  17355. const quantizationParameters = component.quantizationParameters;
  17356. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  17357. const spqcds = quantizationParameters.SPqcds;
  17358. const scalarExpounded = quantizationParameters.scalarExpounded;
  17359. const guardBits = quantizationParameters.guardBits;
  17360. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  17361. const precision = context.components[c].precision;
  17362. const reversible = codingStyleParameters.reversibleTransformation;
  17363. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  17364. const subbandCoefficients = [];
  17365. let b = 0;
  17366. for (let i = 0; i <= decompositionLevelsCount; i++) {
  17367. const resolution = component.resolutions[i];
  17368. const width = resolution.trx1 - resolution.trx0;
  17369. const height = resolution.try1 - resolution.try0;
  17370. const coefficients = new Float32Array(width * height);
  17371. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  17372. let mu, epsilon;
  17373. if (!scalarExpounded) {
  17374. mu = spqcds[0].mu;
  17375. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  17376. } else {
  17377. mu = spqcds[b].mu;
  17378. epsilon = spqcds[b].epsilon;
  17379. b++;
  17380. }
  17381. const subband = resolution.subbands[j];
  17382. const gainLog2 = SubbandsGainLog2[subband.type];
  17383. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  17384. const mb = guardBits + epsilon - 1;
  17385. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  17386. }
  17387. subbandCoefficients.push({
  17388. width,
  17389. height,
  17390. items: coefficients
  17391. });
  17392. }
  17393. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  17394. return {
  17395. left: component.tcx0,
  17396. top: component.tcy0,
  17397. width: result.width,
  17398. height: result.height,
  17399. items: result.items
  17400. };
  17401. }
  17402. function transformComponents(context) {
  17403. const siz = context.SIZ;
  17404. const components = context.components;
  17405. const componentsCount = siz.Csiz;
  17406. const resultImages = [];
  17407. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  17408. const tile = context.tiles[i];
  17409. const transformedTiles = [];
  17410. for (let c = 0; c < componentsCount; c++) {
  17411. transformedTiles[c] = transformTile(context, tile, c);
  17412. }
  17413. const tile0 = transformedTiles[0];
  17414. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  17415. const result = {
  17416. left: tile0.left,
  17417. top: tile0.top,
  17418. width: tile0.width,
  17419. height: tile0.height,
  17420. items: out
  17421. };
  17422. let shift, offset;
  17423. let pos = 0,
  17424. j,
  17425. jj,
  17426. y0,
  17427. y1,
  17428. y2;
  17429. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  17430. const fourComponents = componentsCount === 4;
  17431. const y0items = transformedTiles[0].items;
  17432. const y1items = transformedTiles[1].items;
  17433. const y2items = transformedTiles[2].items;
  17434. const y3items = fourComponents ? transformedTiles[3].items : null;
  17435. shift = components[0].precision - 8;
  17436. offset = (128 << shift) + 0.5;
  17437. const component0 = tile.components[0];
  17438. const alpha01 = componentsCount - 3;
  17439. jj = y0items.length;
  17440. if (!component0.codingStyleParameters.reversibleTransformation) {
  17441. for (j = 0; j < jj; j++, pos += alpha01) {
  17442. y0 = y0items[j] + offset;
  17443. y1 = y1items[j];
  17444. y2 = y2items[j];
  17445. out[pos++] = y0 + 1.402 * y2 >> shift;
  17446. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  17447. out[pos++] = y0 + 1.772 * y1 >> shift;
  17448. }
  17449. } else {
  17450. for (j = 0; j < jj; j++, pos += alpha01) {
  17451. y0 = y0items[j] + offset;
  17452. y1 = y1items[j];
  17453. y2 = y2items[j];
  17454. const g = y0 - (y2 + y1 >> 2);
  17455. out[pos++] = g + y2 >> shift;
  17456. out[pos++] = g >> shift;
  17457. out[pos++] = g + y1 >> shift;
  17458. }
  17459. }
  17460. if (fourComponents) {
  17461. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  17462. out[pos] = y3items[j] + offset >> shift;
  17463. }
  17464. }
  17465. } else {
  17466. for (let c = 0; c < componentsCount; c++) {
  17467. const items = transformedTiles[c].items;
  17468. shift = components[c].precision - 8;
  17469. offset = (128 << shift) + 0.5;
  17470. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  17471. out[pos] = items[j] + offset >> shift;
  17472. pos += componentsCount;
  17473. }
  17474. }
  17475. }
  17476. resultImages.push(result);
  17477. }
  17478. return resultImages;
  17479. }
  17480. function initializeTile(context, tileIndex) {
  17481. const siz = context.SIZ;
  17482. const componentsCount = siz.Csiz;
  17483. const tile = context.tiles[tileIndex];
  17484. for (let c = 0; c < componentsCount; c++) {
  17485. const component = tile.components[c];
  17486. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  17487. component.quantizationParameters = qcdOrQcc;
  17488. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  17489. component.codingStyleParameters = codOrCoc;
  17490. }
  17491. tile.codingStyleDefaultParameters = context.currentTile.COD;
  17492. }
  17493. class TagTree {
  17494. constructor(width, height) {
  17495. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  17496. this.levels = [];
  17497. for (let i = 0; i < levelsLength; i++) {
  17498. const level = {
  17499. width,
  17500. height,
  17501. items: []
  17502. };
  17503. this.levels.push(level);
  17504. width = Math.ceil(width / 2);
  17505. height = Math.ceil(height / 2);
  17506. }
  17507. }
  17508. reset(i, j) {
  17509. let currentLevel = 0,
  17510. value = 0,
  17511. level;
  17512. while (currentLevel < this.levels.length) {
  17513. level = this.levels[currentLevel];
  17514. const index = i + j * level.width;
  17515. if (level.items[index] !== undefined) {
  17516. value = level.items[index];
  17517. break;
  17518. }
  17519. level.index = index;
  17520. i >>= 1;
  17521. j >>= 1;
  17522. currentLevel++;
  17523. }
  17524. currentLevel--;
  17525. level = this.levels[currentLevel];
  17526. level.items[level.index] = value;
  17527. this.currentLevel = currentLevel;
  17528. delete this.value;
  17529. }
  17530. incrementValue() {
  17531. const level = this.levels[this.currentLevel];
  17532. level.items[level.index]++;
  17533. }
  17534. nextLevel() {
  17535. let currentLevel = this.currentLevel;
  17536. let level = this.levels[currentLevel];
  17537. const value = level.items[level.index];
  17538. currentLevel--;
  17539. if (currentLevel < 0) {
  17540. this.value = value;
  17541. return false;
  17542. }
  17543. this.currentLevel = currentLevel;
  17544. level = this.levels[currentLevel];
  17545. level.items[level.index] = value;
  17546. return true;
  17547. }
  17548. }
  17549. class InclusionTree {
  17550. constructor(width, height, defaultValue) {
  17551. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  17552. this.levels = [];
  17553. for (let i = 0; i < levelsLength; i++) {
  17554. const items = new Uint8Array(width * height);
  17555. for (let j = 0, jj = items.length; j < jj; j++) {
  17556. items[j] = defaultValue;
  17557. }
  17558. const level = {
  17559. width,
  17560. height,
  17561. items
  17562. };
  17563. this.levels.push(level);
  17564. width = Math.ceil(width / 2);
  17565. height = Math.ceil(height / 2);
  17566. }
  17567. }
  17568. reset(i, j, stopValue) {
  17569. let currentLevel = 0;
  17570. while (currentLevel < this.levels.length) {
  17571. const level = this.levels[currentLevel];
  17572. const index = i + j * level.width;
  17573. level.index = index;
  17574. const value = level.items[index];
  17575. if (value === 0xff) {
  17576. break;
  17577. }
  17578. if (value > stopValue) {
  17579. this.currentLevel = currentLevel;
  17580. this.propagateValues();
  17581. return false;
  17582. }
  17583. i >>= 1;
  17584. j >>= 1;
  17585. currentLevel++;
  17586. }
  17587. this.currentLevel = currentLevel - 1;
  17588. return true;
  17589. }
  17590. incrementValue(stopValue) {
  17591. const level = this.levels[this.currentLevel];
  17592. level.items[level.index] = stopValue + 1;
  17593. this.propagateValues();
  17594. }
  17595. propagateValues() {
  17596. let levelIndex = this.currentLevel;
  17597. let level = this.levels[levelIndex];
  17598. const currentValue = level.items[level.index];
  17599. while (--levelIndex >= 0) {
  17600. level = this.levels[levelIndex];
  17601. level.items[level.index] = currentValue;
  17602. }
  17603. }
  17604. nextLevel() {
  17605. let currentLevel = this.currentLevel;
  17606. let level = this.levels[currentLevel];
  17607. const value = level.items[level.index];
  17608. level.items[level.index] = 0xff;
  17609. currentLevel--;
  17610. if (currentLevel < 0) {
  17611. return false;
  17612. }
  17613. this.currentLevel = currentLevel;
  17614. level = this.levels[currentLevel];
  17615. level.items[level.index] = value;
  17616. return true;
  17617. }
  17618. }
  17619. const BitModel = function BitModelClosure() {
  17620. const UNIFORM_CONTEXT = 17;
  17621. const RUNLENGTH_CONTEXT = 18;
  17622. 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]);
  17623. 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]);
  17624. 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]);
  17625. class BitModel {
  17626. constructor(width, height, subband, zeroBitPlanes, mb) {
  17627. this.width = width;
  17628. this.height = height;
  17629. let contextLabelTable;
  17630. if (subband === "HH") {
  17631. contextLabelTable = HHContextLabel;
  17632. } else if (subband === "HL") {
  17633. contextLabelTable = HLContextLabel;
  17634. } else {
  17635. contextLabelTable = LLAndLHContextsLabel;
  17636. }
  17637. this.contextLabelTable = contextLabelTable;
  17638. const coefficientCount = width * height;
  17639. this.neighborsSignificance = new Uint8Array(coefficientCount);
  17640. this.coefficentsSign = new Uint8Array(coefficientCount);
  17641. let coefficentsMagnitude;
  17642. if (mb > 14) {
  17643. coefficentsMagnitude = new Uint32Array(coefficientCount);
  17644. } else if (mb > 6) {
  17645. coefficentsMagnitude = new Uint16Array(coefficientCount);
  17646. } else {
  17647. coefficentsMagnitude = new Uint8Array(coefficientCount);
  17648. }
  17649. this.coefficentsMagnitude = coefficentsMagnitude;
  17650. this.processingFlags = new Uint8Array(coefficientCount);
  17651. const bitsDecoded = new Uint8Array(coefficientCount);
  17652. if (zeroBitPlanes !== 0) {
  17653. for (let i = 0; i < coefficientCount; i++) {
  17654. bitsDecoded[i] = zeroBitPlanes;
  17655. }
  17656. }
  17657. this.bitsDecoded = bitsDecoded;
  17658. this.reset();
  17659. }
  17660. setDecoder(decoder) {
  17661. this.decoder = decoder;
  17662. }
  17663. reset() {
  17664. this.contexts = new Int8Array(19);
  17665. this.contexts[0] = 4 << 1 | 0;
  17666. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  17667. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  17668. }
  17669. setNeighborsSignificance(row, column, index) {
  17670. const neighborsSignificance = this.neighborsSignificance;
  17671. const width = this.width,
  17672. height = this.height;
  17673. const left = column > 0;
  17674. const right = column + 1 < width;
  17675. let i;
  17676. if (row > 0) {
  17677. i = index - width;
  17678. if (left) {
  17679. neighborsSignificance[i - 1] += 0x10;
  17680. }
  17681. if (right) {
  17682. neighborsSignificance[i + 1] += 0x10;
  17683. }
  17684. neighborsSignificance[i] += 0x04;
  17685. }
  17686. if (row + 1 < height) {
  17687. i = index + width;
  17688. if (left) {
  17689. neighborsSignificance[i - 1] += 0x10;
  17690. }
  17691. if (right) {
  17692. neighborsSignificance[i + 1] += 0x10;
  17693. }
  17694. neighborsSignificance[i] += 0x04;
  17695. }
  17696. if (left) {
  17697. neighborsSignificance[index - 1] += 0x01;
  17698. }
  17699. if (right) {
  17700. neighborsSignificance[index + 1] += 0x01;
  17701. }
  17702. neighborsSignificance[index] |= 0x80;
  17703. }
  17704. runSignificancePropagationPass() {
  17705. const decoder = this.decoder;
  17706. const width = this.width,
  17707. height = this.height;
  17708. const coefficentsMagnitude = this.coefficentsMagnitude;
  17709. const coefficentsSign = this.coefficentsSign;
  17710. const neighborsSignificance = this.neighborsSignificance;
  17711. const processingFlags = this.processingFlags;
  17712. const contexts = this.contexts;
  17713. const labels = this.contextLabelTable;
  17714. const bitsDecoded = this.bitsDecoded;
  17715. const processedInverseMask = ~1;
  17716. const processedMask = 1;
  17717. const firstMagnitudeBitMask = 2;
  17718. for (let i0 = 0; i0 < height; i0 += 4) {
  17719. for (let j = 0; j < width; j++) {
  17720. let index = i0 * width + j;
  17721. for (let i1 = 0; i1 < 4; i1++, index += width) {
  17722. const i = i0 + i1;
  17723. if (i >= height) {
  17724. break;
  17725. }
  17726. processingFlags[index] &= processedInverseMask;
  17727. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  17728. continue;
  17729. }
  17730. const contextLabel = labels[neighborsSignificance[index]];
  17731. const decision = decoder.readBit(contexts, contextLabel);
  17732. if (decision) {
  17733. const sign = this.decodeSignBit(i, j, index);
  17734. coefficentsSign[index] = sign;
  17735. coefficentsMagnitude[index] = 1;
  17736. this.setNeighborsSignificance(i, j, index);
  17737. processingFlags[index] |= firstMagnitudeBitMask;
  17738. }
  17739. bitsDecoded[index]++;
  17740. processingFlags[index] |= processedMask;
  17741. }
  17742. }
  17743. }
  17744. }
  17745. decodeSignBit(row, column, index) {
  17746. const width = this.width,
  17747. height = this.height;
  17748. const coefficentsMagnitude = this.coefficentsMagnitude;
  17749. const coefficentsSign = this.coefficentsSign;
  17750. let contribution, sign0, sign1, significance1;
  17751. let contextLabel, decoded;
  17752. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  17753. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  17754. sign1 = coefficentsSign[index + 1];
  17755. if (significance1) {
  17756. sign0 = coefficentsSign[index - 1];
  17757. contribution = 1 - sign1 - sign0;
  17758. } else {
  17759. contribution = 1 - sign1 - sign1;
  17760. }
  17761. } else if (significance1) {
  17762. sign0 = coefficentsSign[index - 1];
  17763. contribution = 1 - sign0 - sign0;
  17764. } else {
  17765. contribution = 0;
  17766. }
  17767. const horizontalContribution = 3 * contribution;
  17768. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  17769. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  17770. sign1 = coefficentsSign[index + width];
  17771. if (significance1) {
  17772. sign0 = coefficentsSign[index - width];
  17773. contribution = 1 - sign1 - sign0 + horizontalContribution;
  17774. } else {
  17775. contribution = 1 - sign1 - sign1 + horizontalContribution;
  17776. }
  17777. } else if (significance1) {
  17778. sign0 = coefficentsSign[index - width];
  17779. contribution = 1 - sign0 - sign0 + horizontalContribution;
  17780. } else {
  17781. contribution = horizontalContribution;
  17782. }
  17783. if (contribution >= 0) {
  17784. contextLabel = 9 + contribution;
  17785. decoded = this.decoder.readBit(this.contexts, contextLabel);
  17786. } else {
  17787. contextLabel = 9 - contribution;
  17788. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  17789. }
  17790. return decoded;
  17791. }
  17792. runMagnitudeRefinementPass() {
  17793. const decoder = this.decoder;
  17794. const width = this.width,
  17795. height = this.height;
  17796. const coefficentsMagnitude = this.coefficentsMagnitude;
  17797. const neighborsSignificance = this.neighborsSignificance;
  17798. const contexts = this.contexts;
  17799. const bitsDecoded = this.bitsDecoded;
  17800. const processingFlags = this.processingFlags;
  17801. const processedMask = 1;
  17802. const firstMagnitudeBitMask = 2;
  17803. const length = width * height;
  17804. const width4 = width * 4;
  17805. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  17806. indexNext = Math.min(length, index0 + width4);
  17807. for (let j = 0; j < width; j++) {
  17808. for (let index = index0 + j; index < indexNext; index += width) {
  17809. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  17810. continue;
  17811. }
  17812. let contextLabel = 16;
  17813. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  17814. processingFlags[index] ^= firstMagnitudeBitMask;
  17815. const significance = neighborsSignificance[index] & 127;
  17816. contextLabel = significance === 0 ? 15 : 14;
  17817. }
  17818. const bit = decoder.readBit(contexts, contextLabel);
  17819. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  17820. bitsDecoded[index]++;
  17821. processingFlags[index] |= processedMask;
  17822. }
  17823. }
  17824. }
  17825. }
  17826. runCleanupPass() {
  17827. const decoder = this.decoder;
  17828. const width = this.width,
  17829. height = this.height;
  17830. const neighborsSignificance = this.neighborsSignificance;
  17831. const coefficentsMagnitude = this.coefficentsMagnitude;
  17832. const coefficentsSign = this.coefficentsSign;
  17833. const contexts = this.contexts;
  17834. const labels = this.contextLabelTable;
  17835. const bitsDecoded = this.bitsDecoded;
  17836. const processingFlags = this.processingFlags;
  17837. const processedMask = 1;
  17838. const firstMagnitudeBitMask = 2;
  17839. const oneRowDown = width;
  17840. const twoRowsDown = width * 2;
  17841. const threeRowsDown = width * 3;
  17842. let iNext;
  17843. for (let i0 = 0; i0 < height; i0 = iNext) {
  17844. iNext = Math.min(i0 + 4, height);
  17845. const indexBase = i0 * width;
  17846. const checkAllEmpty = i0 + 3 < height;
  17847. for (let j = 0; j < width; j++) {
  17848. const index0 = indexBase + j;
  17849. 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;
  17850. let i1 = 0,
  17851. index = index0;
  17852. let i = i0,
  17853. sign;
  17854. if (allEmpty) {
  17855. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  17856. if (!hasSignificantCoefficent) {
  17857. bitsDecoded[index0]++;
  17858. bitsDecoded[index0 + oneRowDown]++;
  17859. bitsDecoded[index0 + twoRowsDown]++;
  17860. bitsDecoded[index0 + threeRowsDown]++;
  17861. continue;
  17862. }
  17863. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  17864. if (i1 !== 0) {
  17865. i = i0 + i1;
  17866. index += i1 * width;
  17867. }
  17868. sign = this.decodeSignBit(i, j, index);
  17869. coefficentsSign[index] = sign;
  17870. coefficentsMagnitude[index] = 1;
  17871. this.setNeighborsSignificance(i, j, index);
  17872. processingFlags[index] |= firstMagnitudeBitMask;
  17873. index = index0;
  17874. for (let i2 = i0; i2 <= i; i2++, index += width) {
  17875. bitsDecoded[index]++;
  17876. }
  17877. i1++;
  17878. }
  17879. for (i = i0 + i1; i < iNext; i++, index += width) {
  17880. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  17881. continue;
  17882. }
  17883. const contextLabel = labels[neighborsSignificance[index]];
  17884. const decision = decoder.readBit(contexts, contextLabel);
  17885. if (decision === 1) {
  17886. sign = this.decodeSignBit(i, j, index);
  17887. coefficentsSign[index] = sign;
  17888. coefficentsMagnitude[index] = 1;
  17889. this.setNeighborsSignificance(i, j, index);
  17890. processingFlags[index] |= firstMagnitudeBitMask;
  17891. }
  17892. bitsDecoded[index]++;
  17893. }
  17894. }
  17895. }
  17896. }
  17897. checkSegmentationSymbol() {
  17898. const decoder = this.decoder;
  17899. const contexts = this.contexts;
  17900. 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);
  17901. if (symbol !== 0xa) {
  17902. throw new JpxError("Invalid segmentation symbol");
  17903. }
  17904. }
  17905. }
  17906. return BitModel;
  17907. }();
  17908. class Transform {
  17909. constructor() {
  17910. if (this.constructor === Transform) {
  17911. (0, _util.unreachable)("Cannot initialize Transform.");
  17912. }
  17913. }
  17914. calculate(subbands, u0, v0) {
  17915. let ll = subbands[0];
  17916. for (let i = 1, ii = subbands.length; i < ii; i++) {
  17917. ll = this.iterate(ll, subbands[i], u0, v0);
  17918. }
  17919. return ll;
  17920. }
  17921. extend(buffer, offset, size) {
  17922. let i1 = offset - 1,
  17923. j1 = offset + 1;
  17924. let i2 = offset + size - 2,
  17925. j2 = offset + size;
  17926. buffer[i1--] = buffer[j1++];
  17927. buffer[j2++] = buffer[i2--];
  17928. buffer[i1--] = buffer[j1++];
  17929. buffer[j2++] = buffer[i2--];
  17930. buffer[i1--] = buffer[j1++];
  17931. buffer[j2++] = buffer[i2--];
  17932. buffer[i1] = buffer[j1];
  17933. buffer[j2] = buffer[i2];
  17934. }
  17935. filter(x, offset, length) {
  17936. (0, _util.unreachable)("Abstract method `filter` called");
  17937. }
  17938. iterate(ll, hl_lh_hh, u0, v0) {
  17939. const llWidth = ll.width,
  17940. llHeight = ll.height;
  17941. let llItems = ll.items;
  17942. const width = hl_lh_hh.width;
  17943. const height = hl_lh_hh.height;
  17944. const items = hl_lh_hh.items;
  17945. let i, j, k, l, u, v;
  17946. for (k = 0, i = 0; i < llHeight; i++) {
  17947. l = i * 2 * width;
  17948. for (j = 0; j < llWidth; j++, k++, l += 2) {
  17949. items[l] = llItems[k];
  17950. }
  17951. }
  17952. llItems = ll.items = null;
  17953. const bufferPadding = 4;
  17954. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  17955. if (width === 1) {
  17956. if ((u0 & 1) !== 0) {
  17957. for (v = 0, k = 0; v < height; v++, k += width) {
  17958. items[k] *= 0.5;
  17959. }
  17960. }
  17961. } else {
  17962. for (v = 0, k = 0; v < height; v++, k += width) {
  17963. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  17964. this.extend(rowBuffer, bufferPadding, width);
  17965. this.filter(rowBuffer, bufferPadding, width);
  17966. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  17967. }
  17968. }
  17969. let numBuffers = 16;
  17970. const colBuffers = [];
  17971. for (i = 0; i < numBuffers; i++) {
  17972. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  17973. }
  17974. let b,
  17975. currentBuffer = 0;
  17976. ll = bufferPadding + height;
  17977. if (height === 1) {
  17978. if ((v0 & 1) !== 0) {
  17979. for (u = 0; u < width; u++) {
  17980. items[u] *= 0.5;
  17981. }
  17982. }
  17983. } else {
  17984. for (u = 0; u < width; u++) {
  17985. if (currentBuffer === 0) {
  17986. numBuffers = Math.min(width - u, numBuffers);
  17987. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  17988. for (b = 0; b < numBuffers; b++) {
  17989. colBuffers[b][l] = items[k + b];
  17990. }
  17991. }
  17992. currentBuffer = numBuffers;
  17993. }
  17994. currentBuffer--;
  17995. const buffer = colBuffers[currentBuffer];
  17996. this.extend(buffer, bufferPadding, height);
  17997. this.filter(buffer, bufferPadding, height);
  17998. if (currentBuffer === 0) {
  17999. k = u - numBuffers + 1;
  18000. for (l = bufferPadding; l < ll; k += width, l++) {
  18001. for (b = 0; b < numBuffers; b++) {
  18002. items[k + b] = colBuffers[b][l];
  18003. }
  18004. }
  18005. }
  18006. }
  18007. }
  18008. return {
  18009. width,
  18010. height,
  18011. items
  18012. };
  18013. }
  18014. }
  18015. class IrreversibleTransform extends Transform {
  18016. filter(x, offset, length) {
  18017. const len = length >> 1;
  18018. offset = offset | 0;
  18019. let j, n, current, next;
  18020. const alpha = -1.586134342059924;
  18021. const beta = -0.052980118572961;
  18022. const gamma = 0.882911075530934;
  18023. const delta = 0.443506852043971;
  18024. const K = 1.230174104914001;
  18025. const K_ = 1 / K;
  18026. j = offset - 3;
  18027. for (n = len + 4; n--; j += 2) {
  18028. x[j] *= K_;
  18029. }
  18030. j = offset - 2;
  18031. current = delta * x[j - 1];
  18032. for (n = len + 3; n--; j += 2) {
  18033. next = delta * x[j + 1];
  18034. x[j] = K * x[j] - current - next;
  18035. if (n--) {
  18036. j += 2;
  18037. current = delta * x[j + 1];
  18038. x[j] = K * x[j] - current - next;
  18039. } else {
  18040. break;
  18041. }
  18042. }
  18043. j = offset - 1;
  18044. current = gamma * x[j - 1];
  18045. for (n = len + 2; n--; j += 2) {
  18046. next = gamma * x[j + 1];
  18047. x[j] -= current + next;
  18048. if (n--) {
  18049. j += 2;
  18050. current = gamma * x[j + 1];
  18051. x[j] -= current + next;
  18052. } else {
  18053. break;
  18054. }
  18055. }
  18056. j = offset;
  18057. current = beta * x[j - 1];
  18058. for (n = len + 1; n--; j += 2) {
  18059. next = beta * x[j + 1];
  18060. x[j] -= current + next;
  18061. if (n--) {
  18062. j += 2;
  18063. current = beta * x[j + 1];
  18064. x[j] -= current + next;
  18065. } else {
  18066. break;
  18067. }
  18068. }
  18069. if (len !== 0) {
  18070. j = offset + 1;
  18071. current = alpha * x[j - 1];
  18072. for (n = len; n--; j += 2) {
  18073. next = alpha * x[j + 1];
  18074. x[j] -= current + next;
  18075. if (n--) {
  18076. j += 2;
  18077. current = alpha * x[j + 1];
  18078. x[j] -= current + next;
  18079. } else {
  18080. break;
  18081. }
  18082. }
  18083. }
  18084. }
  18085. }
  18086. class ReversibleTransform extends Transform {
  18087. filter(x, offset, length) {
  18088. const len = length >> 1;
  18089. offset = offset | 0;
  18090. let j, n;
  18091. for (j = offset, n = len + 1; n--; j += 2) {
  18092. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  18093. }
  18094. for (j = offset + 1, n = len; n--; j += 2) {
  18095. x[j] += x[j - 1] + x[j + 1] >> 1;
  18096. }
  18097. }
  18098. }
  18099. /***/ }),
  18100. /* 31 */
  18101. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18102. Object.defineProperty(exports, "__esModule", ({
  18103. value: true
  18104. }));
  18105. exports.LZWStream = void 0;
  18106. var _decode_stream = __w_pdfjs_require__(19);
  18107. class LZWStream extends _decode_stream.DecodeStream {
  18108. constructor(str, maybeLength, earlyChange) {
  18109. super(maybeLength);
  18110. this.str = str;
  18111. this.dict = str.dict;
  18112. this.cachedData = 0;
  18113. this.bitsCached = 0;
  18114. const maxLzwDictionarySize = 4096;
  18115. const lzwState = {
  18116. earlyChange,
  18117. codeLength: 9,
  18118. nextCode: 258,
  18119. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  18120. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  18121. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  18122. currentSequence: new Uint8Array(maxLzwDictionarySize),
  18123. currentSequenceLength: 0
  18124. };
  18125. for (let i = 0; i < 256; ++i) {
  18126. lzwState.dictionaryValues[i] = i;
  18127. lzwState.dictionaryLengths[i] = 1;
  18128. }
  18129. this.lzwState = lzwState;
  18130. }
  18131. readBits(n) {
  18132. let bitsCached = this.bitsCached;
  18133. let cachedData = this.cachedData;
  18134. while (bitsCached < n) {
  18135. const c = this.str.getByte();
  18136. if (c === -1) {
  18137. this.eof = true;
  18138. return null;
  18139. }
  18140. cachedData = cachedData << 8 | c;
  18141. bitsCached += 8;
  18142. }
  18143. this.bitsCached = bitsCached -= n;
  18144. this.cachedData = cachedData;
  18145. this.lastCode = null;
  18146. return cachedData >>> bitsCached & (1 << n) - 1;
  18147. }
  18148. readBlock() {
  18149. const blockSize = 512,
  18150. decodedSizeDelta = blockSize;
  18151. let estimatedDecodedSize = blockSize * 2;
  18152. let i, j, q;
  18153. const lzwState = this.lzwState;
  18154. if (!lzwState) {
  18155. return;
  18156. }
  18157. const earlyChange = lzwState.earlyChange;
  18158. let nextCode = lzwState.nextCode;
  18159. const dictionaryValues = lzwState.dictionaryValues;
  18160. const dictionaryLengths = lzwState.dictionaryLengths;
  18161. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  18162. let codeLength = lzwState.codeLength;
  18163. let prevCode = lzwState.prevCode;
  18164. const currentSequence = lzwState.currentSequence;
  18165. let currentSequenceLength = lzwState.currentSequenceLength;
  18166. let decodedLength = 0;
  18167. let currentBufferLength = this.bufferLength;
  18168. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  18169. for (i = 0; i < blockSize; i++) {
  18170. const code = this.readBits(codeLength);
  18171. const hasPrev = currentSequenceLength > 0;
  18172. if (code < 256) {
  18173. currentSequence[0] = code;
  18174. currentSequenceLength = 1;
  18175. } else if (code >= 258) {
  18176. if (code < nextCode) {
  18177. currentSequenceLength = dictionaryLengths[code];
  18178. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  18179. currentSequence[j] = dictionaryValues[q];
  18180. q = dictionaryPrevCodes[q];
  18181. }
  18182. } else {
  18183. currentSequence[currentSequenceLength++] = currentSequence[0];
  18184. }
  18185. } else if (code === 256) {
  18186. codeLength = 9;
  18187. nextCode = 258;
  18188. currentSequenceLength = 0;
  18189. continue;
  18190. } else {
  18191. this.eof = true;
  18192. delete this.lzwState;
  18193. break;
  18194. }
  18195. if (hasPrev) {
  18196. dictionaryPrevCodes[nextCode] = prevCode;
  18197. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  18198. dictionaryValues[nextCode] = currentSequence[0];
  18199. nextCode++;
  18200. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  18201. }
  18202. prevCode = code;
  18203. decodedLength += currentSequenceLength;
  18204. if (estimatedDecodedSize < decodedLength) {
  18205. do {
  18206. estimatedDecodedSize += decodedSizeDelta;
  18207. } while (estimatedDecodedSize < decodedLength);
  18208. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  18209. }
  18210. for (j = 0; j < currentSequenceLength; j++) {
  18211. buffer[currentBufferLength++] = currentSequence[j];
  18212. }
  18213. }
  18214. lzwState.nextCode = nextCode;
  18215. lzwState.codeLength = codeLength;
  18216. lzwState.prevCode = prevCode;
  18217. lzwState.currentSequenceLength = currentSequenceLength;
  18218. this.bufferLength = currentBufferLength;
  18219. }
  18220. }
  18221. exports.LZWStream = LZWStream;
  18222. /***/ }),
  18223. /* 32 */
  18224. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18225. Object.defineProperty(exports, "__esModule", ({
  18226. value: true
  18227. }));
  18228. exports.PredictorStream = void 0;
  18229. var _decode_stream = __w_pdfjs_require__(19);
  18230. var _util = __w_pdfjs_require__(2);
  18231. var _primitives = __w_pdfjs_require__(5);
  18232. class PredictorStream extends _decode_stream.DecodeStream {
  18233. constructor(str, maybeLength, params) {
  18234. super(maybeLength);
  18235. if (!(0, _primitives.isDict)(params)) {
  18236. return str;
  18237. }
  18238. const predictor = this.predictor = params.get("Predictor") || 1;
  18239. if (predictor <= 1) {
  18240. return str;
  18241. }
  18242. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  18243. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  18244. }
  18245. if (predictor === 2) {
  18246. this.readBlock = this.readBlockTiff;
  18247. } else {
  18248. this.readBlock = this.readBlockPng;
  18249. }
  18250. this.str = str;
  18251. this.dict = str.dict;
  18252. const colors = this.colors = params.get("Colors") || 1;
  18253. const bits = this.bits = params.get("BitsPerComponent") || 8;
  18254. const columns = this.columns = params.get("Columns") || 1;
  18255. this.pixBytes = colors * bits + 7 >> 3;
  18256. this.rowBytes = columns * colors * bits + 7 >> 3;
  18257. return this;
  18258. }
  18259. readBlockTiff() {
  18260. const rowBytes = this.rowBytes;
  18261. const bufferLength = this.bufferLength;
  18262. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  18263. const bits = this.bits;
  18264. const colors = this.colors;
  18265. const rawBytes = this.str.getBytes(rowBytes);
  18266. this.eof = !rawBytes.length;
  18267. if (this.eof) {
  18268. return;
  18269. }
  18270. let inbuf = 0,
  18271. outbuf = 0;
  18272. let inbits = 0,
  18273. outbits = 0;
  18274. let pos = bufferLength;
  18275. let i;
  18276. if (bits === 1 && colors === 1) {
  18277. for (i = 0; i < rowBytes; ++i) {
  18278. let c = rawBytes[i] ^ inbuf;
  18279. c ^= c >> 1;
  18280. c ^= c >> 2;
  18281. c ^= c >> 4;
  18282. inbuf = (c & 1) << 7;
  18283. buffer[pos++] = c;
  18284. }
  18285. } else if (bits === 8) {
  18286. for (i = 0; i < colors; ++i) {
  18287. buffer[pos++] = rawBytes[i];
  18288. }
  18289. for (; i < rowBytes; ++i) {
  18290. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  18291. pos++;
  18292. }
  18293. } else if (bits === 16) {
  18294. const bytesPerPixel = colors * 2;
  18295. for (i = 0; i < bytesPerPixel; ++i) {
  18296. buffer[pos++] = rawBytes[i];
  18297. }
  18298. for (; i < rowBytes; i += 2) {
  18299. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  18300. buffer[pos++] = sum >> 8 & 0xff;
  18301. buffer[pos++] = sum & 0xff;
  18302. }
  18303. } else {
  18304. const compArray = new Uint8Array(colors + 1);
  18305. const bitMask = (1 << bits) - 1;
  18306. let j = 0,
  18307. k = bufferLength;
  18308. const columns = this.columns;
  18309. for (i = 0; i < columns; ++i) {
  18310. for (let kk = 0; kk < colors; ++kk) {
  18311. if (inbits < bits) {
  18312. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  18313. inbits += 8;
  18314. }
  18315. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  18316. inbits -= bits;
  18317. outbuf = outbuf << bits | compArray[kk];
  18318. outbits += bits;
  18319. if (outbits >= 8) {
  18320. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  18321. outbits -= 8;
  18322. }
  18323. }
  18324. }
  18325. if (outbits > 0) {
  18326. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  18327. }
  18328. }
  18329. this.bufferLength += rowBytes;
  18330. }
  18331. readBlockPng() {
  18332. const rowBytes = this.rowBytes;
  18333. const pixBytes = this.pixBytes;
  18334. const predictor = this.str.getByte();
  18335. const rawBytes = this.str.getBytes(rowBytes);
  18336. this.eof = !rawBytes.length;
  18337. if (this.eof) {
  18338. return;
  18339. }
  18340. const bufferLength = this.bufferLength;
  18341. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  18342. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  18343. if (prevRow.length === 0) {
  18344. prevRow = new Uint8Array(rowBytes);
  18345. }
  18346. let i,
  18347. j = bufferLength,
  18348. up,
  18349. c;
  18350. switch (predictor) {
  18351. case 0:
  18352. for (i = 0; i < rowBytes; ++i) {
  18353. buffer[j++] = rawBytes[i];
  18354. }
  18355. break;
  18356. case 1:
  18357. for (i = 0; i < pixBytes; ++i) {
  18358. buffer[j++] = rawBytes[i];
  18359. }
  18360. for (; i < rowBytes; ++i) {
  18361. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  18362. j++;
  18363. }
  18364. break;
  18365. case 2:
  18366. for (i = 0; i < rowBytes; ++i) {
  18367. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  18368. }
  18369. break;
  18370. case 3:
  18371. for (i = 0; i < pixBytes; ++i) {
  18372. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  18373. }
  18374. for (; i < rowBytes; ++i) {
  18375. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  18376. j++;
  18377. }
  18378. break;
  18379. case 4:
  18380. for (i = 0; i < pixBytes; ++i) {
  18381. up = prevRow[i];
  18382. c = rawBytes[i];
  18383. buffer[j++] = up + c;
  18384. }
  18385. for (; i < rowBytes; ++i) {
  18386. up = prevRow[i];
  18387. const upLeft = prevRow[i - pixBytes];
  18388. const left = buffer[j - pixBytes];
  18389. const p = left + up - upLeft;
  18390. let pa = p - left;
  18391. if (pa < 0) {
  18392. pa = -pa;
  18393. }
  18394. let pb = p - up;
  18395. if (pb < 0) {
  18396. pb = -pb;
  18397. }
  18398. let pc = p - upLeft;
  18399. if (pc < 0) {
  18400. pc = -pc;
  18401. }
  18402. c = rawBytes[i];
  18403. if (pa <= pb && pa <= pc) {
  18404. buffer[j++] = left + c;
  18405. } else if (pb <= pc) {
  18406. buffer[j++] = up + c;
  18407. } else {
  18408. buffer[j++] = upLeft + c;
  18409. }
  18410. }
  18411. break;
  18412. default:
  18413. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  18414. }
  18415. this.bufferLength += rowBytes;
  18416. }
  18417. }
  18418. exports.PredictorStream = PredictorStream;
  18419. /***/ }),
  18420. /* 33 */
  18421. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18422. Object.defineProperty(exports, "__esModule", ({
  18423. value: true
  18424. }));
  18425. exports.RunLengthStream = void 0;
  18426. var _decode_stream = __w_pdfjs_require__(19);
  18427. class RunLengthStream extends _decode_stream.DecodeStream {
  18428. constructor(str, maybeLength) {
  18429. super(maybeLength);
  18430. this.str = str;
  18431. this.dict = str.dict;
  18432. }
  18433. readBlock() {
  18434. const repeatHeader = this.str.getBytes(2);
  18435. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  18436. this.eof = true;
  18437. return;
  18438. }
  18439. let buffer;
  18440. let bufferLength = this.bufferLength;
  18441. let n = repeatHeader[0];
  18442. if (n < 128) {
  18443. buffer = this.ensureBuffer(bufferLength + n + 1);
  18444. buffer[bufferLength++] = repeatHeader[1];
  18445. if (n > 0) {
  18446. const source = this.str.getBytes(n);
  18447. buffer.set(source, bufferLength);
  18448. bufferLength += n;
  18449. }
  18450. } else {
  18451. n = 257 - n;
  18452. const b = repeatHeader[1];
  18453. buffer = this.ensureBuffer(bufferLength + n + 1);
  18454. for (let i = 0; i < n; i++) {
  18455. buffer[bufferLength++] = b;
  18456. }
  18457. }
  18458. this.bufferLength = bufferLength;
  18459. }
  18460. }
  18461. exports.RunLengthStream = RunLengthStream;
  18462. /***/ }),
  18463. /* 34 */
  18464. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18465. Object.defineProperty(exports, "__esModule", ({
  18466. value: true
  18467. }));
  18468. exports.Font = exports.ErrorFont = void 0;
  18469. var _util = __w_pdfjs_require__(2);
  18470. var _cff_parser = __w_pdfjs_require__(35);
  18471. var _fonts_utils = __w_pdfjs_require__(38);
  18472. var _glyphlist = __w_pdfjs_require__(39);
  18473. var _encodings = __w_pdfjs_require__(37);
  18474. var _standard_fonts = __w_pdfjs_require__(41);
  18475. var _unicode = __w_pdfjs_require__(40);
  18476. var _to_unicode_map = __w_pdfjs_require__(42);
  18477. var _cff_font = __w_pdfjs_require__(43);
  18478. var _font_renderer = __w_pdfjs_require__(44);
  18479. var _cmap = __w_pdfjs_require__(16);
  18480. var _opentype_file_builder = __w_pdfjs_require__(45);
  18481. var _core_utils = __w_pdfjs_require__(9);
  18482. var _stream = __w_pdfjs_require__(10);
  18483. var _type1_font = __w_pdfjs_require__(46);
  18484. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  18485. const PDF_GLYPH_SPACE_UNITS = 1000;
  18486. 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"];
  18487. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  18488. function adjustWidths(properties) {
  18489. if (!properties.fontMatrix) {
  18490. return;
  18491. }
  18492. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  18493. return;
  18494. }
  18495. const scale = 0.001 / properties.fontMatrix[0];
  18496. const glyphsWidths = properties.widths;
  18497. for (const glyph in glyphsWidths) {
  18498. glyphsWidths[glyph] *= scale;
  18499. }
  18500. properties.defaultWidth *= scale;
  18501. }
  18502. function adjustToUnicode(properties, builtInEncoding) {
  18503. if (properties.hasIncludedToUnicodeMap) {
  18504. return;
  18505. }
  18506. if (builtInEncoding === properties.defaultEncoding) {
  18507. return;
  18508. }
  18509. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  18510. return;
  18511. }
  18512. const toUnicode = [],
  18513. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  18514. for (const charCode in builtInEncoding) {
  18515. if (properties.hasEncoding && properties.differences[charCode] !== undefined) {
  18516. continue;
  18517. }
  18518. const glyphName = builtInEncoding[charCode];
  18519. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  18520. if (unicode !== -1) {
  18521. toUnicode[charCode] = String.fromCharCode(unicode);
  18522. }
  18523. }
  18524. properties.toUnicode.amend(toUnicode);
  18525. }
  18526. class Glyph {
  18527. constructor(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  18528. this.fontChar = fontChar;
  18529. this.unicode = unicode;
  18530. this.accent = accent;
  18531. this.width = width;
  18532. this.vmetric = vmetric;
  18533. this.operatorListId = operatorListId;
  18534. this.isSpace = isSpace;
  18535. this.isInFont = isInFont;
  18536. }
  18537. matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  18538. return this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  18539. }
  18540. }
  18541. function int16(b0, b1) {
  18542. return (b0 << 8) + b1;
  18543. }
  18544. function writeSignedInt16(bytes, index, value) {
  18545. bytes[index + 1] = value;
  18546. bytes[index] = value >>> 8;
  18547. }
  18548. function signedInt16(b0, b1) {
  18549. const value = (b0 << 8) + b1;
  18550. return value & 1 << 15 ? value - 0x10000 : value;
  18551. }
  18552. function int32(b0, b1, b2, b3) {
  18553. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  18554. }
  18555. function string16(value) {
  18556. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  18557. }
  18558. function safeString16(value) {
  18559. if (value > 0x7fff) {
  18560. value = 0x7fff;
  18561. } else if (value < -0x8000) {
  18562. value = -0x8000;
  18563. }
  18564. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  18565. }
  18566. function isTrueTypeFile(file) {
  18567. const header = file.peekBytes(4);
  18568. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  18569. }
  18570. function isTrueTypeCollectionFile(file) {
  18571. const header = file.peekBytes(4);
  18572. return (0, _util.bytesToString)(header) === "ttcf";
  18573. }
  18574. function isOpenTypeFile(file) {
  18575. const header = file.peekBytes(4);
  18576. return (0, _util.bytesToString)(header) === "OTTO";
  18577. }
  18578. function isType1File(file) {
  18579. const header = file.peekBytes(2);
  18580. if (header[0] === 0x25 && header[1] === 0x21) {
  18581. return true;
  18582. }
  18583. if (header[0] === 0x80 && header[1] === 0x01) {
  18584. return true;
  18585. }
  18586. return false;
  18587. }
  18588. function isCFFFile(file) {
  18589. const header = file.peekBytes(4);
  18590. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  18591. return true;
  18592. }
  18593. return false;
  18594. }
  18595. function getFontFileType(file, {
  18596. type,
  18597. subtype,
  18598. composite
  18599. }) {
  18600. let fileType, fileSubtype;
  18601. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  18602. if (composite) {
  18603. fileType = "CIDFontType2";
  18604. } else {
  18605. fileType = "TrueType";
  18606. }
  18607. } else if (isOpenTypeFile(file)) {
  18608. if (composite) {
  18609. fileType = "CIDFontType2";
  18610. } else {
  18611. fileType = "OpenType";
  18612. }
  18613. } else if (isType1File(file)) {
  18614. if (composite) {
  18615. fileType = "CIDFontType0";
  18616. } else {
  18617. fileType = type === "MMType1" ? "MMType1" : "Type1";
  18618. }
  18619. } else if (isCFFFile(file)) {
  18620. if (composite) {
  18621. fileType = "CIDFontType0";
  18622. fileSubtype = "CIDFontType0C";
  18623. } else {
  18624. fileType = type === "MMType1" ? "MMType1" : "Type1";
  18625. fileSubtype = "Type1C";
  18626. }
  18627. } else {
  18628. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  18629. fileType = type;
  18630. fileSubtype = subtype;
  18631. }
  18632. return [fileType, fileSubtype];
  18633. }
  18634. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  18635. const toFontChar = [];
  18636. let unicode;
  18637. for (let i = 0, ii = encoding.length; i < ii; i++) {
  18638. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  18639. if (unicode !== -1) {
  18640. toFontChar[i] = unicode;
  18641. }
  18642. }
  18643. for (const charCode in differences) {
  18644. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  18645. if (unicode !== -1) {
  18646. toFontChar[+charCode] = unicode;
  18647. }
  18648. }
  18649. return toFontChar;
  18650. }
  18651. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  18652. const newMap = Object.create(null);
  18653. const toFontChar = [];
  18654. let privateUseAreaIndex = 0;
  18655. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  18656. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  18657. for (let originalCharCode in charCodeToGlyphId) {
  18658. originalCharCode |= 0;
  18659. let glyphId = charCodeToGlyphId[originalCharCode];
  18660. if (!hasGlyph(glyphId)) {
  18661. continue;
  18662. }
  18663. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  18664. privateUseAreaIndex++;
  18665. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  18666. (0, _util.warn)("Ran out of space in font private use area.");
  18667. break;
  18668. }
  18669. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  18670. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  18671. }
  18672. const fontCharCode = nextAvailableFontCharCode++;
  18673. if (glyphId === 0) {
  18674. glyphId = newGlyphZeroId;
  18675. }
  18676. newMap[fontCharCode] = glyphId;
  18677. toFontChar[originalCharCode] = fontCharCode;
  18678. }
  18679. return {
  18680. toFontChar,
  18681. charCodeToGlyphId: newMap,
  18682. nextAvailableFontCharCode
  18683. };
  18684. }
  18685. function getRanges(glyphs, numGlyphs) {
  18686. const codes = [];
  18687. for (const charCode in glyphs) {
  18688. if (glyphs[charCode] >= numGlyphs) {
  18689. continue;
  18690. }
  18691. codes.push({
  18692. fontCharCode: charCode | 0,
  18693. glyphId: glyphs[charCode]
  18694. });
  18695. }
  18696. if (codes.length === 0) {
  18697. codes.push({
  18698. fontCharCode: 0,
  18699. glyphId: 0
  18700. });
  18701. }
  18702. codes.sort(function fontGetRangesSort(a, b) {
  18703. return a.fontCharCode - b.fontCharCode;
  18704. });
  18705. const ranges = [];
  18706. const length = codes.length;
  18707. for (let n = 0; n < length;) {
  18708. const start = codes[n].fontCharCode;
  18709. const codeIndices = [codes[n].glyphId];
  18710. ++n;
  18711. let end = start;
  18712. while (n < length && end + 1 === codes[n].fontCharCode) {
  18713. codeIndices.push(codes[n].glyphId);
  18714. ++end;
  18715. ++n;
  18716. if (end === 0xffff) {
  18717. break;
  18718. }
  18719. }
  18720. ranges.push([start, end, codeIndices]);
  18721. }
  18722. return ranges;
  18723. }
  18724. function createCmapTable(glyphs, numGlyphs) {
  18725. const ranges = getRanges(glyphs, numGlyphs);
  18726. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  18727. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  18728. let i, ii, j, jj;
  18729. for (i = ranges.length - 1; i >= 0; --i) {
  18730. if (ranges[i][0] <= 0xffff) {
  18731. break;
  18732. }
  18733. }
  18734. const bmpLength = i + 1;
  18735. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  18736. ranges[i][1] = 0xfffe;
  18737. }
  18738. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  18739. const segCount = bmpLength + trailingRangesCount;
  18740. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  18741. let startCount = "";
  18742. let endCount = "";
  18743. let idDeltas = "";
  18744. let idRangeOffsets = "";
  18745. let glyphsIds = "";
  18746. let bias = 0;
  18747. let range, start, end, codes;
  18748. for (i = 0, ii = bmpLength; i < ii; i++) {
  18749. range = ranges[i];
  18750. start = range[0];
  18751. end = range[1];
  18752. startCount += string16(start);
  18753. endCount += string16(end);
  18754. codes = range[2];
  18755. let contiguous = true;
  18756. for (j = 1, jj = codes.length; j < jj; ++j) {
  18757. if (codes[j] !== codes[j - 1] + 1) {
  18758. contiguous = false;
  18759. break;
  18760. }
  18761. }
  18762. if (!contiguous) {
  18763. const offset = (segCount - i) * 2 + bias * 2;
  18764. bias += end - start + 1;
  18765. idDeltas += string16(0);
  18766. idRangeOffsets += string16(offset);
  18767. for (j = 0, jj = codes.length; j < jj; ++j) {
  18768. glyphsIds += string16(codes[j]);
  18769. }
  18770. } else {
  18771. const startCode = codes[0];
  18772. idDeltas += string16(startCode - start & 0xffff);
  18773. idRangeOffsets += string16(0);
  18774. }
  18775. }
  18776. if (trailingRangesCount > 0) {
  18777. endCount += "\xFF\xFF";
  18778. startCount += "\xFF\xFF";
  18779. idDeltas += "\x00\x01";
  18780. idRangeOffsets += "\x00\x00";
  18781. }
  18782. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  18783. let format31012 = "";
  18784. let header31012 = "";
  18785. if (numTables > 1) {
  18786. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  18787. format31012 = "";
  18788. for (i = 0, ii = ranges.length; i < ii; i++) {
  18789. range = ranges[i];
  18790. start = range[0];
  18791. codes = range[2];
  18792. let code = codes[0];
  18793. for (j = 1, jj = codes.length; j < jj; ++j) {
  18794. if (codes[j] !== codes[j - 1] + 1) {
  18795. end = range[0] + j - 1;
  18796. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  18797. start = end + 1;
  18798. code = codes[j];
  18799. }
  18800. }
  18801. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  18802. }
  18803. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  18804. }
  18805. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  18806. }
  18807. function validateOS2Table(os2, file) {
  18808. file.pos = (file.start || 0) + os2.offset;
  18809. const version = file.getUint16();
  18810. file.skip(60);
  18811. const selection = file.getUint16();
  18812. if (version < 4 && selection & 0x0300) {
  18813. return false;
  18814. }
  18815. const firstChar = file.getUint16();
  18816. const lastChar = file.getUint16();
  18817. if (firstChar > lastChar) {
  18818. return false;
  18819. }
  18820. file.skip(6);
  18821. const usWinAscent = file.getUint16();
  18822. if (usWinAscent === 0) {
  18823. return false;
  18824. }
  18825. os2.data[8] = os2.data[9] = 0;
  18826. return true;
  18827. }
  18828. function createOS2Table(properties, charstrings, override) {
  18829. override = override || {
  18830. unitsPerEm: 0,
  18831. yMax: 0,
  18832. yMin: 0,
  18833. ascent: 0,
  18834. descent: 0
  18835. };
  18836. let ulUnicodeRange1 = 0;
  18837. let ulUnicodeRange2 = 0;
  18838. let ulUnicodeRange3 = 0;
  18839. let ulUnicodeRange4 = 0;
  18840. let firstCharIndex = null;
  18841. let lastCharIndex = 0;
  18842. if (charstrings) {
  18843. for (let code in charstrings) {
  18844. code |= 0;
  18845. if (firstCharIndex > code || !firstCharIndex) {
  18846. firstCharIndex = code;
  18847. }
  18848. if (lastCharIndex < code) {
  18849. lastCharIndex = code;
  18850. }
  18851. const position = (0, _unicode.getUnicodeRangeFor)(code);
  18852. if (position < 32) {
  18853. ulUnicodeRange1 |= 1 << position;
  18854. } else if (position < 64) {
  18855. ulUnicodeRange2 |= 1 << position - 32;
  18856. } else if (position < 96) {
  18857. ulUnicodeRange3 |= 1 << position - 64;
  18858. } else if (position < 123) {
  18859. ulUnicodeRange4 |= 1 << position - 96;
  18860. } else {
  18861. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  18862. }
  18863. }
  18864. if (lastCharIndex > 0xffff) {
  18865. lastCharIndex = 0xffff;
  18866. }
  18867. } else {
  18868. firstCharIndex = 0;
  18869. lastCharIndex = 255;
  18870. }
  18871. const bbox = properties.bbox || [0, 0, 0, 0];
  18872. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  18873. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  18874. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  18875. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  18876. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  18877. typoDescent = -typoDescent;
  18878. }
  18879. const winAscent = override.yMax || typoAscent;
  18880. const winDescent = -override.yMin || -typoDescent;
  18881. 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";
  18882. }
  18883. function createPostTable(properties) {
  18884. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  18885. return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  18886. }
  18887. function createPostscriptName(name) {
  18888. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  18889. }
  18890. function createNameTable(name, proto) {
  18891. if (!proto) {
  18892. proto = [[], []];
  18893. }
  18894. 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"];
  18895. const stringsUnicode = [];
  18896. let i, ii, j, jj, str;
  18897. for (i = 0, ii = strings.length; i < ii; i++) {
  18898. str = proto[1][i] || strings[i];
  18899. const strBufUnicode = [];
  18900. for (j = 0, jj = str.length; j < jj; j++) {
  18901. strBufUnicode.push(string16(str.charCodeAt(j)));
  18902. }
  18903. stringsUnicode.push(strBufUnicode.join(""));
  18904. }
  18905. const names = [strings, stringsUnicode];
  18906. const platforms = ["\x00\x01", "\x00\x03"];
  18907. const encodings = ["\x00\x00", "\x00\x01"];
  18908. const languages = ["\x00\x00", "\x04\x09"];
  18909. const namesRecordCount = strings.length * platforms.length;
  18910. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  18911. let strOffset = 0;
  18912. for (i = 0, ii = platforms.length; i < ii; i++) {
  18913. const strs = names[i];
  18914. for (j = 0, jj = strs.length; j < jj; j++) {
  18915. str = strs[j];
  18916. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  18917. nameTable += nameRecord;
  18918. strOffset += str.length;
  18919. }
  18920. }
  18921. nameTable += strings.join("") + stringsUnicode.join("");
  18922. return nameTable;
  18923. }
  18924. class Font {
  18925. constructor(name, file, properties) {
  18926. this.name = name;
  18927. this.mimetype = null;
  18928. this.disableFontFace = false;
  18929. this.loadedName = properties.loadedName;
  18930. this.isType3Font = properties.isType3Font;
  18931. this.missingFile = false;
  18932. this.cssFontInfo = properties.cssFontInfo;
  18933. this._charsCache = Object.create(null);
  18934. this._glyphCache = Object.create(null);
  18935. this.isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  18936. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  18937. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  18938. let type = properties.type;
  18939. let subtype = properties.subtype;
  18940. this.type = type;
  18941. this.subtype = subtype;
  18942. let fallbackName = "sans-serif";
  18943. if (this.isMonospace) {
  18944. fallbackName = "monospace";
  18945. } else if (this.isSerifFont) {
  18946. fallbackName = "serif";
  18947. }
  18948. this.fallbackName = fallbackName;
  18949. this.differences = properties.differences;
  18950. this.widths = properties.widths;
  18951. this.defaultWidth = properties.defaultWidth;
  18952. this.composite = properties.composite;
  18953. this.cMap = properties.cMap;
  18954. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  18955. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  18956. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  18957. this.fontMatrix = properties.fontMatrix;
  18958. this.bbox = properties.bbox;
  18959. this.defaultEncoding = properties.defaultEncoding;
  18960. this.toUnicode = properties.toUnicode;
  18961. this.fallbackToUnicode = properties.fallbackToUnicode || new _to_unicode_map.ToUnicodeMap();
  18962. this.toFontChar = [];
  18963. if (properties.type === "Type3") {
  18964. for (let charCode = 0; charCode < 256; charCode++) {
  18965. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  18966. }
  18967. this.fontType = _util.FontType.TYPE3;
  18968. return;
  18969. }
  18970. this.cidEncoding = properties.cidEncoding;
  18971. this.vertical = !!properties.vertical;
  18972. if (this.vertical) {
  18973. this.vmetrics = properties.vmetrics;
  18974. this.defaultVMetrics = properties.defaultVMetrics;
  18975. }
  18976. if (!file || file.isEmpty) {
  18977. if (file) {
  18978. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  18979. }
  18980. this.fallbackToSystemFont(properties);
  18981. return;
  18982. }
  18983. [type, subtype] = getFontFileType(file, properties);
  18984. if (type !== this.type || subtype !== this.subtype) {
  18985. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  18986. }
  18987. let data;
  18988. try {
  18989. switch (type) {
  18990. case "MMType1":
  18991. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  18992. case "Type1":
  18993. case "CIDFontType0":
  18994. this.mimetype = "font/opentype";
  18995. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  18996. adjustWidths(properties);
  18997. data = this.convert(name, cff, properties);
  18998. break;
  18999. case "OpenType":
  19000. case "TrueType":
  19001. case "CIDFontType2":
  19002. this.mimetype = "font/opentype";
  19003. data = this.checkAndRepair(name, file, properties);
  19004. if (this.isOpenType) {
  19005. adjustWidths(properties);
  19006. type = "OpenType";
  19007. }
  19008. break;
  19009. default:
  19010. throw new _util.FormatError(`Font ${type} is not supported`);
  19011. }
  19012. } catch (e) {
  19013. (0, _util.warn)(e);
  19014. this.fallbackToSystemFont(properties);
  19015. return;
  19016. }
  19017. this.data = data;
  19018. this.fontType = (0, _fonts_utils.getFontType)(type, subtype);
  19019. this.fontMatrix = properties.fontMatrix;
  19020. this.widths = properties.widths;
  19021. this.defaultWidth = properties.defaultWidth;
  19022. this.toUnicode = properties.toUnicode;
  19023. this.seacMap = properties.seacMap;
  19024. }
  19025. get renderer() {
  19026. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  19027. return (0, _util.shadow)(this, "renderer", renderer);
  19028. }
  19029. exportData(extraProperties = false) {
  19030. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  19031. const data = Object.create(null);
  19032. let property, value;
  19033. for (property of exportDataProperties) {
  19034. value = this[property];
  19035. if (value !== undefined) {
  19036. data[property] = value;
  19037. }
  19038. }
  19039. return data;
  19040. }
  19041. fallbackToSystemFont(properties) {
  19042. this.missingFile = true;
  19043. const name = this.name;
  19044. const type = this.type;
  19045. const subtype = this.subtype;
  19046. let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
  19047. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  19048. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  19049. const isStandardFont = !!stdFontMap[fontName];
  19050. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  19051. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  19052. this.bold = fontName.search(/bold/gi) !== -1;
  19053. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  19054. this.black = name.search(/Black/g) !== -1;
  19055. const isNarrow = name.search(/Narrow/g) !== -1;
  19056. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  19057. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  19058. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(),
  19059. cidToGidMap = properties.cidToGidMap;
  19060. const map = [];
  19061. for (const charCode in GlyphMapForStandardFonts) {
  19062. map[+charCode] = GlyphMapForStandardFonts[charCode];
  19063. }
  19064. if (/Arial-?Black/i.test(name)) {
  19065. const SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  19066. for (const charCode in SupplementalGlyphMapForArialBlack) {
  19067. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  19068. }
  19069. } else if (/Calibri/i.test(name)) {
  19070. const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
  19071. for (const charCode in SupplementalGlyphMapForCalibri) {
  19072. map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
  19073. }
  19074. }
  19075. if (cidToGidMap) {
  19076. for (const charCode in map) {
  19077. const cid = map[charCode];
  19078. if (cidToGidMap[cid] !== undefined) {
  19079. map[+charCode] = cidToGidMap[cid];
  19080. }
  19081. }
  19082. }
  19083. const isIdentityUnicode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap;
  19084. if (!isIdentityUnicode) {
  19085. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  19086. map[+charCode] = unicodeCharCode;
  19087. });
  19088. }
  19089. this.toFontChar = map;
  19090. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  19091. } else if (/Symbol/i.test(fontName)) {
  19092. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  19093. } else if (/Dingbats/i.test(fontName)) {
  19094. if (/Wingdings/i.test(name)) {
  19095. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  19096. }
  19097. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  19098. } else if (isStandardFont) {
  19099. this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  19100. } else {
  19101. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  19102. const map = [];
  19103. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  19104. if (!this.composite) {
  19105. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  19106. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  19107. if (unicode !== -1) {
  19108. unicodeCharCode = unicode;
  19109. }
  19110. }
  19111. map[+charCode] = unicodeCharCode;
  19112. });
  19113. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  19114. if (/Verdana/i.test(name)) {
  19115. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  19116. for (const charCode in GlyphMapForStandardFonts) {
  19117. map[+charCode] = GlyphMapForStandardFonts[charCode];
  19118. }
  19119. }
  19120. }
  19121. this.toFontChar = map;
  19122. }
  19123. this.loadedName = fontName.split("-")[0];
  19124. this.fontType = (0, _fonts_utils.getFontType)(type, subtype);
  19125. }
  19126. checkAndRepair(name, font, properties) {
  19127. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  19128. function readTables(file, numTables) {
  19129. const tables = Object.create(null);
  19130. tables["OS/2"] = null;
  19131. tables.cmap = null;
  19132. tables.head = null;
  19133. tables.hhea = null;
  19134. tables.hmtx = null;
  19135. tables.maxp = null;
  19136. tables.name = null;
  19137. tables.post = null;
  19138. for (let i = 0; i < numTables; i++) {
  19139. const table = readTableEntry(file);
  19140. if (!VALID_TABLES.includes(table.tag)) {
  19141. continue;
  19142. }
  19143. if (table.length === 0) {
  19144. continue;
  19145. }
  19146. tables[table.tag] = table;
  19147. }
  19148. return tables;
  19149. }
  19150. function readTableEntry(file) {
  19151. const tag = file.getString(4);
  19152. const checksum = file.getInt32() >>> 0;
  19153. const offset = file.getInt32() >>> 0;
  19154. const length = file.getInt32() >>> 0;
  19155. const previousPosition = file.pos;
  19156. file.pos = file.start ? file.start : 0;
  19157. file.skip(offset);
  19158. const data = file.getBytes(length);
  19159. file.pos = previousPosition;
  19160. if (tag === "head") {
  19161. data[8] = data[9] = data[10] = data[11] = 0;
  19162. data[17] |= 0x20;
  19163. }
  19164. return {
  19165. tag,
  19166. checksum,
  19167. length,
  19168. offset,
  19169. data
  19170. };
  19171. }
  19172. function readOpenTypeHeader(ttf) {
  19173. return {
  19174. version: ttf.getString(4),
  19175. numTables: ttf.getUint16(),
  19176. searchRange: ttf.getUint16(),
  19177. entrySelector: ttf.getUint16(),
  19178. rangeShift: ttf.getUint16()
  19179. };
  19180. }
  19181. function readTrueTypeCollectionHeader(ttc) {
  19182. const ttcTag = ttc.getString(4);
  19183. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  19184. const majorVersion = ttc.getUint16();
  19185. const minorVersion = ttc.getUint16();
  19186. const numFonts = ttc.getInt32() >>> 0;
  19187. const offsetTable = [];
  19188. for (let i = 0; i < numFonts; i++) {
  19189. offsetTable.push(ttc.getInt32() >>> 0);
  19190. }
  19191. const header = {
  19192. ttcTag,
  19193. majorVersion,
  19194. minorVersion,
  19195. numFonts,
  19196. offsetTable
  19197. };
  19198. switch (majorVersion) {
  19199. case 1:
  19200. return header;
  19201. case 2:
  19202. header.dsigTag = ttc.getInt32() >>> 0;
  19203. header.dsigLength = ttc.getInt32() >>> 0;
  19204. header.dsigOffset = ttc.getInt32() >>> 0;
  19205. return header;
  19206. }
  19207. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  19208. }
  19209. function readTrueTypeCollectionData(ttc, fontName) {
  19210. const {
  19211. numFonts,
  19212. offsetTable
  19213. } = readTrueTypeCollectionHeader(ttc);
  19214. const fontNameParts = fontName.split("+");
  19215. let fallbackData;
  19216. for (let i = 0; i < numFonts; i++) {
  19217. ttc.pos = (ttc.start || 0) + offsetTable[i];
  19218. const potentialHeader = readOpenTypeHeader(ttc);
  19219. const potentialTables = readTables(ttc, potentialHeader.numTables);
  19220. if (!potentialTables.name) {
  19221. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  19222. }
  19223. const nameTable = readNameTable(potentialTables.name);
  19224. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  19225. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  19226. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  19227. if (!nameEntry) {
  19228. continue;
  19229. }
  19230. if (nameEntry === fontName) {
  19231. return {
  19232. header: potentialHeader,
  19233. tables: potentialTables
  19234. };
  19235. }
  19236. if (fontNameParts.length < 2) {
  19237. continue;
  19238. }
  19239. for (const part of fontNameParts) {
  19240. if (nameEntry === part) {
  19241. fallbackData = {
  19242. name: part,
  19243. header: potentialHeader,
  19244. tables: potentialTables
  19245. };
  19246. }
  19247. }
  19248. }
  19249. }
  19250. }
  19251. if (fallbackData) {
  19252. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  19253. return {
  19254. header: fallbackData.header,
  19255. tables: fallbackData.tables
  19256. };
  19257. }
  19258. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  19259. }
  19260. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  19261. if (!cmap) {
  19262. (0, _util.warn)("No cmap table available.");
  19263. return {
  19264. platformId: -1,
  19265. encodingId: -1,
  19266. mappings: [],
  19267. hasShortCmap: false
  19268. };
  19269. }
  19270. let segment;
  19271. let start = (file.start ? file.start : 0) + cmap.offset;
  19272. file.pos = start;
  19273. file.skip(2);
  19274. const numTables = file.getUint16();
  19275. let potentialTable;
  19276. let canBreak = false;
  19277. for (let i = 0; i < numTables; i++) {
  19278. const platformId = file.getUint16();
  19279. const encodingId = file.getUint16();
  19280. const offset = file.getInt32() >>> 0;
  19281. let useTable = false;
  19282. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  19283. continue;
  19284. }
  19285. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  19286. useTable = true;
  19287. } else if (platformId === 1 && encodingId === 0) {
  19288. useTable = true;
  19289. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  19290. useTable = true;
  19291. if (!isSymbolicFont) {
  19292. canBreak = true;
  19293. }
  19294. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  19295. useTable = true;
  19296. canBreak = true;
  19297. }
  19298. if (useTable) {
  19299. potentialTable = {
  19300. platformId,
  19301. encodingId,
  19302. offset
  19303. };
  19304. }
  19305. if (canBreak) {
  19306. break;
  19307. }
  19308. }
  19309. if (potentialTable) {
  19310. file.pos = start + potentialTable.offset;
  19311. }
  19312. if (!potentialTable || file.peekByte() === -1) {
  19313. (0, _util.warn)("Could not find a preferred cmap table.");
  19314. return {
  19315. platformId: -1,
  19316. encodingId: -1,
  19317. mappings: [],
  19318. hasShortCmap: false
  19319. };
  19320. }
  19321. const format = file.getUint16();
  19322. file.skip(2 + 2);
  19323. let hasShortCmap = false;
  19324. const mappings = [];
  19325. let j, glyphId;
  19326. if (format === 0) {
  19327. for (j = 0; j < 256; j++) {
  19328. const index = file.getByte();
  19329. if (!index) {
  19330. continue;
  19331. }
  19332. mappings.push({
  19333. charCode: j,
  19334. glyphId: index
  19335. });
  19336. }
  19337. hasShortCmap = true;
  19338. } else if (format === 4) {
  19339. const segCount = file.getUint16() >> 1;
  19340. file.skip(6);
  19341. const segments = [];
  19342. let segIndex;
  19343. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19344. segments.push({
  19345. end: file.getUint16()
  19346. });
  19347. }
  19348. file.skip(2);
  19349. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19350. segments[segIndex].start = file.getUint16();
  19351. }
  19352. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19353. segments[segIndex].delta = file.getUint16();
  19354. }
  19355. let offsetsCount = 0,
  19356. offsetIndex;
  19357. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19358. segment = segments[segIndex];
  19359. const rangeOffset = file.getUint16();
  19360. if (!rangeOffset) {
  19361. segment.offsetIndex = -1;
  19362. continue;
  19363. }
  19364. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  19365. segment.offsetIndex = offsetIndex;
  19366. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  19367. }
  19368. const offsets = [];
  19369. for (j = 0; j < offsetsCount; j++) {
  19370. offsets.push(file.getUint16());
  19371. }
  19372. for (segIndex = 0; segIndex < segCount; segIndex++) {
  19373. segment = segments[segIndex];
  19374. start = segment.start;
  19375. const end = segment.end;
  19376. const delta = segment.delta;
  19377. offsetIndex = segment.offsetIndex;
  19378. for (j = start; j <= end; j++) {
  19379. if (j === 0xffff) {
  19380. continue;
  19381. }
  19382. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  19383. glyphId = glyphId + delta & 0xffff;
  19384. mappings.push({
  19385. charCode: j,
  19386. glyphId
  19387. });
  19388. }
  19389. }
  19390. } else if (format === 6) {
  19391. const firstCode = file.getUint16();
  19392. const entryCount = file.getUint16();
  19393. for (j = 0; j < entryCount; j++) {
  19394. glyphId = file.getUint16();
  19395. const charCode = firstCode + j;
  19396. mappings.push({
  19397. charCode,
  19398. glyphId
  19399. });
  19400. }
  19401. } else {
  19402. (0, _util.warn)("cmap table has unsupported format: " + format);
  19403. return {
  19404. platformId: -1,
  19405. encodingId: -1,
  19406. mappings: [],
  19407. hasShortCmap: false
  19408. };
  19409. }
  19410. mappings.sort(function (a, b) {
  19411. return a.charCode - b.charCode;
  19412. });
  19413. for (let i = 1; i < mappings.length; i++) {
  19414. if (mappings[i - 1].charCode === mappings[i].charCode) {
  19415. mappings.splice(i, 1);
  19416. i--;
  19417. }
  19418. }
  19419. return {
  19420. platformId: potentialTable.platformId,
  19421. encodingId: potentialTable.encodingId,
  19422. mappings,
  19423. hasShortCmap
  19424. };
  19425. }
  19426. function sanitizeMetrics(file, header, metrics, numGlyphs, dupFirstEntry) {
  19427. if (!header) {
  19428. if (metrics) {
  19429. metrics.data = null;
  19430. }
  19431. return;
  19432. }
  19433. file.pos = (file.start ? file.start : 0) + header.offset;
  19434. file.pos += 4;
  19435. file.pos += 2;
  19436. file.pos += 2;
  19437. file.pos += 2;
  19438. file.pos += 2;
  19439. file.pos += 2;
  19440. file.pos += 2;
  19441. file.pos += 2;
  19442. file.pos += 2;
  19443. file.pos += 2;
  19444. file.pos += 2;
  19445. file.pos += 8;
  19446. file.pos += 2;
  19447. let numOfMetrics = file.getUint16();
  19448. if (numOfMetrics > numGlyphs) {
  19449. (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")");
  19450. numOfMetrics = numGlyphs;
  19451. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  19452. header.data[35] = numOfMetrics & 0x00ff;
  19453. }
  19454. const numOfSidebearings = numGlyphs - numOfMetrics;
  19455. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  19456. if (numMissing > 0) {
  19457. const entries = new Uint8Array(metrics.length + numMissing * 2);
  19458. entries.set(metrics.data);
  19459. if (dupFirstEntry) {
  19460. entries[metrics.length] = metrics.data[2];
  19461. entries[metrics.length + 1] = metrics.data[3];
  19462. }
  19463. metrics.data = entries;
  19464. }
  19465. }
  19466. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  19467. const glyphProfile = {
  19468. length: 0,
  19469. sizeOfInstructions: 0
  19470. };
  19471. if (sourceEnd - sourceStart <= 12) {
  19472. return glyphProfile;
  19473. }
  19474. const glyf = source.subarray(sourceStart, sourceEnd);
  19475. let contoursCount = signedInt16(glyf[0], glyf[1]);
  19476. if (contoursCount < 0) {
  19477. contoursCount = -1;
  19478. writeSignedInt16(glyf, 0, contoursCount);
  19479. dest.set(glyf, destStart);
  19480. glyphProfile.length = glyf.length;
  19481. return glyphProfile;
  19482. }
  19483. let i,
  19484. j = 10,
  19485. flagsCount = 0;
  19486. for (i = 0; i < contoursCount; i++) {
  19487. const endPoint = glyf[j] << 8 | glyf[j + 1];
  19488. flagsCount = endPoint + 1;
  19489. j += 2;
  19490. }
  19491. const instructionsStart = j;
  19492. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  19493. glyphProfile.sizeOfInstructions = instructionsLength;
  19494. j += 2 + instructionsLength;
  19495. const instructionsEnd = j;
  19496. let coordinatesLength = 0;
  19497. for (i = 0; i < flagsCount; i++) {
  19498. const flag = glyf[j++];
  19499. if (flag & 0xc0) {
  19500. glyf[j - 1] = flag & 0x3f;
  19501. }
  19502. let xLength = 2;
  19503. if (flag & 2) {
  19504. xLength = 1;
  19505. } else if (flag & 16) {
  19506. xLength = 0;
  19507. }
  19508. let yLength = 2;
  19509. if (flag & 4) {
  19510. yLength = 1;
  19511. } else if (flag & 32) {
  19512. yLength = 0;
  19513. }
  19514. const xyLength = xLength + yLength;
  19515. coordinatesLength += xyLength;
  19516. if (flag & 8) {
  19517. const repeat = glyf[j++];
  19518. i += repeat;
  19519. coordinatesLength += repeat * xyLength;
  19520. }
  19521. }
  19522. if (coordinatesLength === 0) {
  19523. return glyphProfile;
  19524. }
  19525. let glyphDataLength = j + coordinatesLength;
  19526. if (glyphDataLength > glyf.length) {
  19527. return glyphProfile;
  19528. }
  19529. if (!hintsValid && instructionsLength > 0) {
  19530. dest.set(glyf.subarray(0, instructionsStart), destStart);
  19531. dest.set([0, 0], destStart + instructionsStart);
  19532. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  19533. glyphDataLength -= instructionsLength;
  19534. if (glyf.length - glyphDataLength > 3) {
  19535. glyphDataLength = glyphDataLength + 3 & ~3;
  19536. }
  19537. glyphProfile.length = glyphDataLength;
  19538. return glyphProfile;
  19539. }
  19540. if (glyf.length - glyphDataLength > 3) {
  19541. glyphDataLength = glyphDataLength + 3 & ~3;
  19542. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  19543. glyphProfile.length = glyphDataLength;
  19544. return glyphProfile;
  19545. }
  19546. dest.set(glyf, destStart);
  19547. glyphProfile.length = glyf.length;
  19548. return glyphProfile;
  19549. }
  19550. function sanitizeHead(head, numGlyphs, locaLength) {
  19551. const data = head.data;
  19552. const version = int32(data[0], data[1], data[2], data[3]);
  19553. if (version >> 16 !== 1) {
  19554. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  19555. data[0] = 0;
  19556. data[1] = 1;
  19557. data[2] = 0;
  19558. data[3] = 0;
  19559. }
  19560. const indexToLocFormat = int16(data[50], data[51]);
  19561. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  19562. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  19563. const numGlyphsPlusOne = numGlyphs + 1;
  19564. if (locaLength === numGlyphsPlusOne << 1) {
  19565. data[50] = 0;
  19566. data[51] = 0;
  19567. } else if (locaLength === numGlyphsPlusOne << 2) {
  19568. data[50] = 0;
  19569. data[51] = 1;
  19570. } else {
  19571. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  19572. }
  19573. }
  19574. }
  19575. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  19576. let itemSize, itemDecode, itemEncode;
  19577. if (isGlyphLocationsLong) {
  19578. itemSize = 4;
  19579. itemDecode = function fontItemDecodeLong(data, offset) {
  19580. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  19581. };
  19582. itemEncode = function fontItemEncodeLong(data, offset, value) {
  19583. data[offset] = value >>> 24 & 0xff;
  19584. data[offset + 1] = value >> 16 & 0xff;
  19585. data[offset + 2] = value >> 8 & 0xff;
  19586. data[offset + 3] = value & 0xff;
  19587. };
  19588. } else {
  19589. itemSize = 2;
  19590. itemDecode = function fontItemDecode(data, offset) {
  19591. return data[offset] << 9 | data[offset + 1] << 1;
  19592. };
  19593. itemEncode = function fontItemEncode(data, offset, value) {
  19594. data[offset] = value >> 9 & 0xff;
  19595. data[offset + 1] = value >> 1 & 0xff;
  19596. };
  19597. }
  19598. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  19599. const locaDataSize = itemSize * (1 + numGlyphsOut);
  19600. const locaData = new Uint8Array(locaDataSize);
  19601. locaData.set(loca.data.subarray(0, locaDataSize));
  19602. loca.data = locaData;
  19603. const oldGlyfData = glyf.data;
  19604. const oldGlyfDataLength = oldGlyfData.length;
  19605. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  19606. let i, j;
  19607. const locaEntries = [];
  19608. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  19609. let offset = itemDecode(locaData, j);
  19610. if (offset > oldGlyfDataLength) {
  19611. offset = oldGlyfDataLength;
  19612. }
  19613. locaEntries.push({
  19614. index: i,
  19615. offset,
  19616. endOffset: 0
  19617. });
  19618. }
  19619. locaEntries.sort((a, b) => {
  19620. return a.offset - b.offset;
  19621. });
  19622. for (i = 0; i < numGlyphs; i++) {
  19623. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  19624. }
  19625. locaEntries.sort((a, b) => {
  19626. return a.index - b.index;
  19627. });
  19628. const missingGlyphs = Object.create(null);
  19629. let writeOffset = 0;
  19630. itemEncode(locaData, 0, writeOffset);
  19631. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  19632. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  19633. const newLength = glyphProfile.length;
  19634. if (newLength === 0) {
  19635. missingGlyphs[i] = true;
  19636. }
  19637. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  19638. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  19639. }
  19640. writeOffset += newLength;
  19641. itemEncode(locaData, j, writeOffset);
  19642. }
  19643. if (writeOffset === 0) {
  19644. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  19645. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  19646. itemEncode(locaData, j, simpleGlyph.length);
  19647. }
  19648. glyf.data = simpleGlyph;
  19649. } else if (dupFirstEntry) {
  19650. const firstEntryLength = itemDecode(locaData, itemSize);
  19651. if (newGlyfData.length > firstEntryLength + writeOffset) {
  19652. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  19653. } else {
  19654. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  19655. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  19656. }
  19657. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  19658. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  19659. } else {
  19660. glyf.data = newGlyfData.subarray(0, writeOffset);
  19661. }
  19662. return {
  19663. missingGlyphs,
  19664. maxSizeOfInstructions
  19665. };
  19666. }
  19667. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  19668. const start = (font.start ? font.start : 0) + post.offset;
  19669. font.pos = start;
  19670. const length = post.length,
  19671. end = start + length;
  19672. const version = font.getInt32();
  19673. font.skip(28);
  19674. let glyphNames;
  19675. let valid = true;
  19676. let i;
  19677. switch (version) {
  19678. case 0x00010000:
  19679. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  19680. break;
  19681. case 0x00020000:
  19682. const numGlyphs = font.getUint16();
  19683. if (numGlyphs !== maxpNumGlyphs) {
  19684. valid = false;
  19685. break;
  19686. }
  19687. const glyphNameIndexes = [];
  19688. for (i = 0; i < numGlyphs; ++i) {
  19689. const index = font.getUint16();
  19690. if (index >= 32768) {
  19691. valid = false;
  19692. break;
  19693. }
  19694. glyphNameIndexes.push(index);
  19695. }
  19696. if (!valid) {
  19697. break;
  19698. }
  19699. const customNames = [],
  19700. strBuf = [];
  19701. while (font.pos < end) {
  19702. const stringLength = font.getByte();
  19703. strBuf.length = stringLength;
  19704. for (i = 0; i < stringLength; ++i) {
  19705. strBuf[i] = String.fromCharCode(font.getByte());
  19706. }
  19707. customNames.push(strBuf.join(""));
  19708. }
  19709. glyphNames = [];
  19710. for (i = 0; i < numGlyphs; ++i) {
  19711. const j = glyphNameIndexes[i];
  19712. if (j < 258) {
  19713. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  19714. continue;
  19715. }
  19716. glyphNames.push(customNames[j - 258]);
  19717. }
  19718. break;
  19719. case 0x00030000:
  19720. break;
  19721. default:
  19722. (0, _util.warn)("Unknown/unsupported post table version " + version);
  19723. valid = false;
  19724. if (propertiesObj.defaultEncoding) {
  19725. glyphNames = propertiesObj.defaultEncoding;
  19726. }
  19727. break;
  19728. }
  19729. propertiesObj.glyphNames = glyphNames;
  19730. return valid;
  19731. }
  19732. function readNameTable(nameTable) {
  19733. const start = (font.start ? font.start : 0) + nameTable.offset;
  19734. font.pos = start;
  19735. const names = [[], []];
  19736. const length = nameTable.length,
  19737. end = start + length;
  19738. const format = font.getUint16();
  19739. const FORMAT_0_HEADER_LENGTH = 6;
  19740. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  19741. return names;
  19742. }
  19743. const numRecords = font.getUint16();
  19744. const stringsStart = font.getUint16();
  19745. const records = [];
  19746. const NAME_RECORD_LENGTH = 12;
  19747. let i, ii;
  19748. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  19749. const r = {
  19750. platform: font.getUint16(),
  19751. encoding: font.getUint16(),
  19752. language: font.getUint16(),
  19753. name: font.getUint16(),
  19754. length: font.getUint16(),
  19755. offset: font.getUint16()
  19756. };
  19757. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  19758. records.push(r);
  19759. }
  19760. }
  19761. for (i = 0, ii = records.length; i < ii; i++) {
  19762. const record = records[i];
  19763. if (record.length <= 0) {
  19764. continue;
  19765. }
  19766. const pos = start + stringsStart + record.offset;
  19767. if (pos + record.length > end) {
  19768. continue;
  19769. }
  19770. font.pos = pos;
  19771. const nameIndex = record.name;
  19772. if (record.encoding) {
  19773. let str = "";
  19774. for (let j = 0, jj = record.length; j < jj; j += 2) {
  19775. str += String.fromCharCode(font.getUint16());
  19776. }
  19777. names[1][nameIndex] = str;
  19778. } else {
  19779. names[0][nameIndex] = font.getString(record.length);
  19780. }
  19781. }
  19782. return names;
  19783. }
  19784. 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];
  19785. function sanitizeTTProgram(table, ttContext) {
  19786. let data = table.data;
  19787. let i = 0,
  19788. j,
  19789. n,
  19790. b,
  19791. funcId,
  19792. pc,
  19793. lastEndf = 0,
  19794. lastDeff = 0;
  19795. const stack = [];
  19796. const callstack = [];
  19797. const functionsCalled = [];
  19798. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  19799. let inFDEF = false,
  19800. ifLevel = 0,
  19801. inELSE = 0;
  19802. for (let ii = data.length; i < ii;) {
  19803. const op = data[i++];
  19804. if (op === 0x40) {
  19805. n = data[i++];
  19806. if (inFDEF || inELSE) {
  19807. i += n;
  19808. } else {
  19809. for (j = 0; j < n; j++) {
  19810. stack.push(data[i++]);
  19811. }
  19812. }
  19813. } else if (op === 0x41) {
  19814. n = data[i++];
  19815. if (inFDEF || inELSE) {
  19816. i += n * 2;
  19817. } else {
  19818. for (j = 0; j < n; j++) {
  19819. b = data[i++];
  19820. stack.push(b << 8 | data[i++]);
  19821. }
  19822. }
  19823. } else if ((op & 0xf8) === 0xb0) {
  19824. n = op - 0xb0 + 1;
  19825. if (inFDEF || inELSE) {
  19826. i += n;
  19827. } else {
  19828. for (j = 0; j < n; j++) {
  19829. stack.push(data[i++]);
  19830. }
  19831. }
  19832. } else if ((op & 0xf8) === 0xb8) {
  19833. n = op - 0xb8 + 1;
  19834. if (inFDEF || inELSE) {
  19835. i += n * 2;
  19836. } else {
  19837. for (j = 0; j < n; j++) {
  19838. b = data[i++];
  19839. stack.push(b << 8 | data[i++]);
  19840. }
  19841. }
  19842. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  19843. if (!inFDEF && !inELSE) {
  19844. funcId = stack[stack.length - 1];
  19845. if (isNaN(funcId)) {
  19846. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  19847. } else {
  19848. ttContext.functionsUsed[funcId] = true;
  19849. if (funcId in ttContext.functionsStackDeltas) {
  19850. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  19851. if (newStackLength < 0) {
  19852. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  19853. ttContext.hintsValid = false;
  19854. return;
  19855. }
  19856. stack.length = newStackLength;
  19857. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  19858. callstack.push({
  19859. data,
  19860. i,
  19861. stackTop: stack.length - 1
  19862. });
  19863. functionsCalled.push(funcId);
  19864. pc = ttContext.functionsDefined[funcId];
  19865. if (!pc) {
  19866. (0, _util.warn)("TT: CALL non-existent function");
  19867. ttContext.hintsValid = false;
  19868. return;
  19869. }
  19870. data = pc.data;
  19871. i = pc.i;
  19872. }
  19873. }
  19874. }
  19875. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  19876. if (inFDEF || inELSE) {
  19877. (0, _util.warn)("TT: nested FDEFs not allowed");
  19878. tooComplexToFollowFunctions = true;
  19879. }
  19880. inFDEF = true;
  19881. lastDeff = i;
  19882. funcId = stack.pop();
  19883. ttContext.functionsDefined[funcId] = {
  19884. data,
  19885. i
  19886. };
  19887. } else if (op === 0x2d) {
  19888. if (inFDEF) {
  19889. inFDEF = false;
  19890. lastEndf = i;
  19891. } else {
  19892. pc = callstack.pop();
  19893. if (!pc) {
  19894. (0, _util.warn)("TT: ENDF bad stack");
  19895. ttContext.hintsValid = false;
  19896. return;
  19897. }
  19898. funcId = functionsCalled.pop();
  19899. data = pc.data;
  19900. i = pc.i;
  19901. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  19902. }
  19903. } else if (op === 0x89) {
  19904. if (inFDEF || inELSE) {
  19905. (0, _util.warn)("TT: nested IDEFs not allowed");
  19906. tooComplexToFollowFunctions = true;
  19907. }
  19908. inFDEF = true;
  19909. lastDeff = i;
  19910. } else if (op === 0x58) {
  19911. ++ifLevel;
  19912. } else if (op === 0x1b) {
  19913. inELSE = ifLevel;
  19914. } else if (op === 0x59) {
  19915. if (inELSE === ifLevel) {
  19916. inELSE = 0;
  19917. }
  19918. --ifLevel;
  19919. } else if (op === 0x1c) {
  19920. if (!inFDEF && !inELSE) {
  19921. const offset = stack[stack.length - 1];
  19922. if (offset > 0) {
  19923. i += offset - 1;
  19924. }
  19925. }
  19926. }
  19927. if (!inFDEF && !inELSE) {
  19928. let stackDelta = 0;
  19929. if (op <= 0x8e) {
  19930. stackDelta = TTOpsStackDeltas[op];
  19931. } else if (op >= 0xc0 && op <= 0xdf) {
  19932. stackDelta = -1;
  19933. } else if (op >= 0xe0) {
  19934. stackDelta = -2;
  19935. }
  19936. if (op >= 0x71 && op <= 0x75) {
  19937. n = stack.pop();
  19938. if (!isNaN(n)) {
  19939. stackDelta = -n * 2;
  19940. }
  19941. }
  19942. while (stackDelta < 0 && stack.length > 0) {
  19943. stack.pop();
  19944. stackDelta++;
  19945. }
  19946. while (stackDelta > 0) {
  19947. stack.push(NaN);
  19948. stackDelta--;
  19949. }
  19950. }
  19951. }
  19952. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  19953. const content = [data];
  19954. if (i > data.length) {
  19955. content.push(new Uint8Array(i - data.length));
  19956. }
  19957. if (lastDeff > lastEndf) {
  19958. (0, _util.warn)("TT: complementing a missing function tail");
  19959. content.push(new Uint8Array([0x22, 0x2d]));
  19960. }
  19961. foldTTTable(table, content);
  19962. }
  19963. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  19964. if (ttContext.tooComplexToFollowFunctions) {
  19965. return;
  19966. }
  19967. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  19968. (0, _util.warn)("TT: more functions defined than expected");
  19969. ttContext.hintsValid = false;
  19970. return;
  19971. }
  19972. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  19973. if (j > maxFunctionDefs) {
  19974. (0, _util.warn)("TT: invalid function id: " + j);
  19975. ttContext.hintsValid = false;
  19976. return;
  19977. }
  19978. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  19979. (0, _util.warn)("TT: undefined function: " + j);
  19980. ttContext.hintsValid = false;
  19981. return;
  19982. }
  19983. }
  19984. }
  19985. function foldTTTable(table, content) {
  19986. if (content.length > 1) {
  19987. let newLength = 0;
  19988. let j, jj;
  19989. for (j = 0, jj = content.length; j < jj; j++) {
  19990. newLength += content[j].length;
  19991. }
  19992. newLength = newLength + 3 & ~3;
  19993. const result = new Uint8Array(newLength);
  19994. let pos = 0;
  19995. for (j = 0, jj = content.length; j < jj; j++) {
  19996. result.set(content[j], pos);
  19997. pos += content[j].length;
  19998. }
  19999. table.data = result;
  20000. table.length = newLength;
  20001. }
  20002. }
  20003. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  20004. const ttContext = {
  20005. functionsDefined: [],
  20006. functionsUsed: [],
  20007. functionsStackDeltas: [],
  20008. tooComplexToFollowFunctions: false,
  20009. hintsValid: true
  20010. };
  20011. if (fpgm) {
  20012. sanitizeTTProgram(fpgm, ttContext);
  20013. }
  20014. if (prep) {
  20015. sanitizeTTProgram(prep, ttContext);
  20016. }
  20017. if (fpgm) {
  20018. checkInvalidFunctions(ttContext, maxFunctionDefs);
  20019. }
  20020. if (cvt && cvt.length & 1) {
  20021. const cvtData = new Uint8Array(cvt.length + 1);
  20022. cvtData.set(cvt.data);
  20023. cvt.data = cvtData;
  20024. }
  20025. return ttContext.hintsValid;
  20026. }
  20027. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  20028. let header, tables;
  20029. if (isTrueTypeCollectionFile(font)) {
  20030. const ttcData = readTrueTypeCollectionData(font, this.name);
  20031. header = ttcData.header;
  20032. tables = ttcData.tables;
  20033. } else {
  20034. header = readOpenTypeHeader(font);
  20035. tables = readTables(font, header.numTables);
  20036. }
  20037. let cff, cffFile;
  20038. const isTrueType = !tables["CFF "];
  20039. if (!isTrueType) {
  20040. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  20041. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  20042. cffFile = new _stream.Stream(tables["CFF "].data);
  20043. cff = new _cff_font.CFFFont(cffFile, properties);
  20044. adjustWidths(properties);
  20045. return this.convert(name, cff, properties);
  20046. }
  20047. delete tables.glyf;
  20048. delete tables.loca;
  20049. delete tables.fpgm;
  20050. delete tables.prep;
  20051. delete tables["cvt "];
  20052. this.isOpenType = true;
  20053. } else {
  20054. if (!tables.loca) {
  20055. throw new _util.FormatError('Required "loca" table is not found');
  20056. }
  20057. if (!tables.glyf) {
  20058. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  20059. tables.glyf = {
  20060. tag: "glyf",
  20061. data: new Uint8Array(0)
  20062. };
  20063. }
  20064. this.isOpenType = false;
  20065. }
  20066. if (!tables.maxp) {
  20067. throw new _util.FormatError('Required "maxp" table is not found');
  20068. }
  20069. font.pos = (font.start || 0) + tables.maxp.offset;
  20070. const version = font.getInt32();
  20071. const numGlyphs = font.getUint16();
  20072. let numGlyphsOut = numGlyphs + 1;
  20073. let dupFirstEntry = true;
  20074. if (numGlyphsOut > 0xffff) {
  20075. dupFirstEntry = false;
  20076. numGlyphsOut = numGlyphs;
  20077. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  20078. }
  20079. let maxFunctionDefs = 0;
  20080. let maxSizeOfInstructions = 0;
  20081. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  20082. font.pos += 8;
  20083. const maxZones = font.getUint16();
  20084. if (maxZones > 2) {
  20085. tables.maxp.data[14] = 0;
  20086. tables.maxp.data[15] = 2;
  20087. }
  20088. font.pos += 4;
  20089. maxFunctionDefs = font.getUint16();
  20090. font.pos += 4;
  20091. maxSizeOfInstructions = font.getUint16();
  20092. }
  20093. tables.maxp.data[4] = numGlyphsOut >> 8;
  20094. tables.maxp.data[5] = numGlyphsOut & 255;
  20095. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  20096. if (!hintsValid) {
  20097. delete tables.fpgm;
  20098. delete tables.prep;
  20099. delete tables["cvt "];
  20100. }
  20101. sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphsOut, dupFirstEntry);
  20102. if (!tables.head) {
  20103. throw new _util.FormatError('Required "head" table is not found');
  20104. }
  20105. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  20106. let missingGlyphs = Object.create(null);
  20107. if (isTrueType) {
  20108. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  20109. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  20110. missingGlyphs = glyphsInfo.missingGlyphs;
  20111. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  20112. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  20113. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  20114. }
  20115. }
  20116. if (!tables.hhea) {
  20117. throw new _util.FormatError('Required "hhea" table is not found');
  20118. }
  20119. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  20120. tables.hhea.data[10] = 0xff;
  20121. tables.hhea.data[11] = 0xff;
  20122. }
  20123. const metricsOverride = {
  20124. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  20125. yMax: int16(tables.head.data[42], tables.head.data[43]),
  20126. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  20127. ascent: int16(tables.hhea.data[4], tables.hhea.data[5]),
  20128. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7])
  20129. };
  20130. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  20131. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  20132. if (tables.post) {
  20133. readPostScriptTable(tables.post, properties, numGlyphs);
  20134. }
  20135. tables.post = {
  20136. tag: "post",
  20137. data: createPostTable(properties)
  20138. };
  20139. const charCodeToGlyphId = [];
  20140. function hasGlyph(glyphId) {
  20141. return !missingGlyphs[glyphId];
  20142. }
  20143. if (properties.composite) {
  20144. const cidToGidMap = properties.cidToGidMap || [];
  20145. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  20146. properties.cMap.forEach(function (charCode, cid) {
  20147. if (cid > 0xffff) {
  20148. throw new _util.FormatError("Max size of CID is 65,535");
  20149. }
  20150. let glyphId = -1;
  20151. if (isCidToGidMapEmpty) {
  20152. glyphId = cid;
  20153. } else if (cidToGidMap[cid] !== undefined) {
  20154. glyphId = cidToGidMap[cid];
  20155. }
  20156. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  20157. charCodeToGlyphId[charCode] = glyphId;
  20158. }
  20159. });
  20160. } else {
  20161. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  20162. const cmapPlatformId = cmapTable.platformId;
  20163. const cmapEncodingId = cmapTable.encodingId;
  20164. const cmapMappings = cmapTable.mappings;
  20165. const cmapMappingsLength = cmapMappings.length;
  20166. let baseEncoding = [];
  20167. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  20168. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  20169. }
  20170. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  20171. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20172. for (let charCode = 0; charCode < 256; charCode++) {
  20173. let glyphName;
  20174. if (this.differences && charCode in this.differences) {
  20175. glyphName = this.differences[charCode];
  20176. } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") {
  20177. glyphName = baseEncoding[charCode];
  20178. } else {
  20179. glyphName = _encodings.StandardEncoding[charCode];
  20180. }
  20181. if (!glyphName) {
  20182. continue;
  20183. }
  20184. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  20185. let unicodeOrCharCode;
  20186. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  20187. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  20188. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  20189. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  20190. }
  20191. for (let i = 0; i < cmapMappingsLength; ++i) {
  20192. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  20193. continue;
  20194. }
  20195. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  20196. break;
  20197. }
  20198. }
  20199. } else if (cmapPlatformId === 0) {
  20200. for (let i = 0; i < cmapMappingsLength; ++i) {
  20201. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  20202. }
  20203. } else {
  20204. for (let i = 0; i < cmapMappingsLength; ++i) {
  20205. let charCode = cmapMappings[i].charCode;
  20206. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  20207. charCode &= 0xff;
  20208. }
  20209. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  20210. }
  20211. }
  20212. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  20213. for (let i = 0; i < 256; ++i) {
  20214. if (charCodeToGlyphId[i] !== undefined) {
  20215. continue;
  20216. }
  20217. const glyphName = this.differences[i] || baseEncoding[i];
  20218. if (!glyphName) {
  20219. continue;
  20220. }
  20221. const glyphId = properties.glyphNames.indexOf(glyphName);
  20222. if (glyphId > 0 && hasGlyph(glyphId)) {
  20223. charCodeToGlyphId[i] = glyphId;
  20224. }
  20225. }
  20226. }
  20227. }
  20228. if (charCodeToGlyphId.length === 0) {
  20229. charCodeToGlyphId[0] = 0;
  20230. }
  20231. let glyphZeroId = numGlyphsOut - 1;
  20232. if (!dupFirstEntry) {
  20233. glyphZeroId = 0;
  20234. }
  20235. if (!properties.cssFontInfo) {
  20236. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  20237. this.toFontChar = newMapping.toFontChar;
  20238. tables.cmap = {
  20239. tag: "cmap",
  20240. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  20241. };
  20242. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  20243. tables["OS/2"] = {
  20244. tag: "OS/2",
  20245. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  20246. };
  20247. }
  20248. }
  20249. if (!isTrueType) {
  20250. try {
  20251. cffFile = new _stream.Stream(tables["CFF "].data);
  20252. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  20253. cff = parser.parse();
  20254. cff.duplicateFirstGlyph();
  20255. const compiler = new _cff_parser.CFFCompiler(cff);
  20256. tables["CFF "].data = compiler.compile();
  20257. } catch (e) {
  20258. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  20259. }
  20260. }
  20261. if (!tables.name) {
  20262. tables.name = {
  20263. tag: "name",
  20264. data: createNameTable(this.name)
  20265. };
  20266. } else {
  20267. const namePrototype = readNameTable(tables.name);
  20268. tables.name.data = createNameTable(name, namePrototype);
  20269. }
  20270. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  20271. for (const tableTag in tables) {
  20272. builder.addTable(tableTag, tables[tableTag].data);
  20273. }
  20274. return builder.toArray();
  20275. }
  20276. convert(fontName, font, properties) {
  20277. properties.fixedPitch = false;
  20278. if (properties.builtInEncoding) {
  20279. adjustToUnicode(properties, properties.builtInEncoding);
  20280. }
  20281. let glyphZeroId = 1;
  20282. if (font instanceof _cff_font.CFFFont) {
  20283. glyphZeroId = font.numGlyphs - 1;
  20284. }
  20285. const mapping = font.getGlyphMapping(properties);
  20286. let newMapping = null;
  20287. let newCharCodeToGlyphId = mapping;
  20288. if (!properties.cssFontInfo) {
  20289. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  20290. this.toFontChar = newMapping.toFontChar;
  20291. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  20292. }
  20293. const numGlyphs = font.numGlyphs;
  20294. function getCharCodes(charCodeToGlyphId, glyphId) {
  20295. let charCodes = null;
  20296. for (const charCode in charCodeToGlyphId) {
  20297. if (glyphId === charCodeToGlyphId[charCode]) {
  20298. if (!charCodes) {
  20299. charCodes = [];
  20300. }
  20301. charCodes.push(charCode | 0);
  20302. }
  20303. }
  20304. return charCodes;
  20305. }
  20306. function createCharCode(charCodeToGlyphId, glyphId) {
  20307. for (const charCode in charCodeToGlyphId) {
  20308. if (glyphId === charCodeToGlyphId[charCode]) {
  20309. return charCode | 0;
  20310. }
  20311. }
  20312. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  20313. return newMapping.nextAvailableFontCharCode++;
  20314. }
  20315. const seacs = font.seacs;
  20316. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  20317. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  20318. const charset = font.getCharset();
  20319. const seacMap = Object.create(null);
  20320. for (let glyphId in seacs) {
  20321. glyphId |= 0;
  20322. const seac = seacs[glyphId];
  20323. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  20324. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  20325. const baseGlyphId = charset.indexOf(baseGlyphName);
  20326. const accentGlyphId = charset.indexOf(accentGlyphName);
  20327. if (baseGlyphId < 0 || accentGlyphId < 0) {
  20328. continue;
  20329. }
  20330. const accentOffset = {
  20331. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  20332. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  20333. };
  20334. const charCodes = getCharCodes(mapping, glyphId);
  20335. if (!charCodes) {
  20336. continue;
  20337. }
  20338. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  20339. const charCode = charCodes[i];
  20340. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  20341. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  20342. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  20343. seacMap[charCode] = {
  20344. baseFontCharCode,
  20345. accentFontCharCode,
  20346. accentOffset
  20347. };
  20348. }
  20349. }
  20350. properties.seacMap = seacMap;
  20351. }
  20352. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  20353. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  20354. builder.addTable("CFF ", font.data);
  20355. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  20356. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  20357. 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");
  20358. 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));
  20359. builder.addTable("hmtx", function fontFieldsHmtx() {
  20360. const charstrings = font.charstrings;
  20361. const cffWidths = font.cff ? font.cff.widths : null;
  20362. let hmtx = "\x00\x00\x00\x00";
  20363. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  20364. let width = 0;
  20365. if (charstrings) {
  20366. const charstring = charstrings[i - 1];
  20367. width = "width" in charstring ? charstring.width : 0;
  20368. } else if (cffWidths) {
  20369. width = Math.ceil(cffWidths[i] || 0);
  20370. }
  20371. hmtx += string16(width) + string16(0);
  20372. }
  20373. return hmtx;
  20374. }());
  20375. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  20376. builder.addTable("name", createNameTable(fontName));
  20377. builder.addTable("post", createPostTable(properties));
  20378. return builder.toArray();
  20379. }
  20380. get spaceWidth() {
  20381. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  20382. let width;
  20383. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  20384. const glyphName = possibleSpaceReplacements[i];
  20385. if (glyphName in this.widths) {
  20386. width = this.widths[glyphName];
  20387. break;
  20388. }
  20389. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20390. const glyphUnicode = glyphsUnicodeMap[glyphName];
  20391. let charcode = 0;
  20392. if (this.composite && this.cMap.contains(glyphUnicode)) {
  20393. charcode = this.cMap.lookup(glyphUnicode);
  20394. }
  20395. if (!charcode && this.toUnicode) {
  20396. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  20397. }
  20398. if (charcode <= 0) {
  20399. charcode = glyphUnicode;
  20400. }
  20401. width = this.widths[charcode];
  20402. if (width) {
  20403. break;
  20404. }
  20405. }
  20406. width = width || this.defaultWidth;
  20407. return (0, _util.shadow)(this, "spaceWidth", width);
  20408. }
  20409. _charToGlyph(charcode, isSpace = false) {
  20410. let fontCharCode, width, operatorListId;
  20411. let widthCode = charcode;
  20412. if (this.cMap && this.cMap.contains(charcode)) {
  20413. widthCode = this.cMap.lookup(charcode);
  20414. }
  20415. width = this.widths[widthCode];
  20416. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  20417. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  20418. let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
  20419. if (typeof unicode === "number") {
  20420. unicode = String.fromCharCode(unicode);
  20421. }
  20422. let isInFont = (charcode in this.toFontChar);
  20423. fontCharCode = this.toFontChar[charcode] || charcode;
  20424. if (this.missingFile) {
  20425. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  20426. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  20427. fontCharCode = 0x20;
  20428. }
  20429. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  20430. }
  20431. if (this.isType3Font) {
  20432. operatorListId = fontCharCode;
  20433. }
  20434. let accent = null;
  20435. if (this.seacMap && this.seacMap[charcode]) {
  20436. isInFont = true;
  20437. const seac = this.seacMap[charcode];
  20438. fontCharCode = seac.baseFontCharCode;
  20439. accent = {
  20440. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  20441. offset: seac.accentOffset
  20442. };
  20443. }
  20444. let fontChar = "";
  20445. if (typeof fontCharCode === "number") {
  20446. if (fontCharCode <= 0x10ffff) {
  20447. fontChar = String.fromCodePoint(fontCharCode);
  20448. } else {
  20449. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  20450. }
  20451. }
  20452. let glyph = this._glyphCache[charcode];
  20453. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  20454. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  20455. this._glyphCache[charcode] = glyph;
  20456. }
  20457. return glyph;
  20458. }
  20459. charsToGlyphs(chars) {
  20460. let glyphs = this._charsCache[chars];
  20461. if (glyphs) {
  20462. return glyphs;
  20463. }
  20464. glyphs = [];
  20465. if (this.cMap) {
  20466. const c = Object.create(null),
  20467. ii = chars.length;
  20468. let i = 0;
  20469. while (i < ii) {
  20470. this.cMap.readCharCode(chars, i, c);
  20471. const {
  20472. charcode,
  20473. length
  20474. } = c;
  20475. i += length;
  20476. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  20477. glyphs.push(glyph);
  20478. }
  20479. } else {
  20480. for (let i = 0, ii = chars.length; i < ii; ++i) {
  20481. const charcode = chars.charCodeAt(i);
  20482. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  20483. glyphs.push(glyph);
  20484. }
  20485. }
  20486. return this._charsCache[chars] = glyphs;
  20487. }
  20488. getCharPositions(chars) {
  20489. const positions = [];
  20490. if (this.cMap) {
  20491. const c = Object.create(null);
  20492. let i = 0;
  20493. while (i < chars.length) {
  20494. this.cMap.readCharCode(chars, i, c);
  20495. const length = c.length;
  20496. positions.push([i, i + length]);
  20497. i += length;
  20498. }
  20499. } else {
  20500. for (let i = 0, ii = chars.length; i < ii; ++i) {
  20501. positions.push([i, i + 1]);
  20502. }
  20503. }
  20504. return positions;
  20505. }
  20506. get glyphCacheValues() {
  20507. return Object.values(this._glyphCache);
  20508. }
  20509. encodeString(str) {
  20510. const buffers = [];
  20511. const currentBuf = [];
  20512. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  20513. for (let i = 0, ii = str.length; i < ii; i++) {
  20514. const unicode = str.codePointAt(i);
  20515. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  20516. i++;
  20517. }
  20518. if (this.toUnicode) {
  20519. const char = String.fromCodePoint(unicode);
  20520. const charCode = this.toUnicode.charCodeOf(char);
  20521. if (charCode !== -1) {
  20522. if (hasCurrentBufErrors()) {
  20523. buffers.push(currentBuf.join(""));
  20524. currentBuf.length = 0;
  20525. }
  20526. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  20527. for (let j = charCodeLength - 1; j >= 0; j--) {
  20528. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  20529. }
  20530. continue;
  20531. }
  20532. }
  20533. if (!hasCurrentBufErrors()) {
  20534. buffers.push(currentBuf.join(""));
  20535. currentBuf.length = 0;
  20536. }
  20537. currentBuf.push(String.fromCodePoint(unicode));
  20538. }
  20539. buffers.push(currentBuf.join(""));
  20540. return buffers;
  20541. }
  20542. }
  20543. exports.Font = Font;
  20544. class ErrorFont {
  20545. constructor(error) {
  20546. this.error = error;
  20547. this.loadedName = "g_font_error";
  20548. this.missingFile = true;
  20549. }
  20550. charsToGlyphs() {
  20551. return [];
  20552. }
  20553. encodeString(chars) {
  20554. return [chars];
  20555. }
  20556. exportData(extraProperties = false) {
  20557. return {
  20558. error: this.error
  20559. };
  20560. }
  20561. }
  20562. exports.ErrorFont = ErrorFont;
  20563. /***/ }),
  20564. /* 35 */
  20565. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20566. Object.defineProperty(exports, "__esModule", ({
  20567. value: true
  20568. }));
  20569. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  20570. var _util = __w_pdfjs_require__(2);
  20571. var _charsets = __w_pdfjs_require__(36);
  20572. var _encodings = __w_pdfjs_require__(37);
  20573. const MAX_SUBR_NESTING = 10;
  20574. 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"];
  20575. exports.CFFStandardStrings = CFFStandardStrings;
  20576. const NUM_STANDARD_CFF_STRINGS = 391;
  20577. const CFFParser = function CFFParserClosure() {
  20578. const CharstringValidationData = [null, {
  20579. id: "hstem",
  20580. min: 2,
  20581. stackClearing: true,
  20582. stem: true
  20583. }, null, {
  20584. id: "vstem",
  20585. min: 2,
  20586. stackClearing: true,
  20587. stem: true
  20588. }, {
  20589. id: "vmoveto",
  20590. min: 1,
  20591. stackClearing: true
  20592. }, {
  20593. id: "rlineto",
  20594. min: 2,
  20595. resetStack: true
  20596. }, {
  20597. id: "hlineto",
  20598. min: 1,
  20599. resetStack: true
  20600. }, {
  20601. id: "vlineto",
  20602. min: 1,
  20603. resetStack: true
  20604. }, {
  20605. id: "rrcurveto",
  20606. min: 6,
  20607. resetStack: true
  20608. }, null, {
  20609. id: "callsubr",
  20610. min: 1,
  20611. undefStack: true
  20612. }, {
  20613. id: "return",
  20614. min: 0,
  20615. undefStack: true
  20616. }, null, null, {
  20617. id: "endchar",
  20618. min: 0,
  20619. stackClearing: true
  20620. }, null, null, null, {
  20621. id: "hstemhm",
  20622. min: 2,
  20623. stackClearing: true,
  20624. stem: true
  20625. }, {
  20626. id: "hintmask",
  20627. min: 0,
  20628. stackClearing: true
  20629. }, {
  20630. id: "cntrmask",
  20631. min: 0,
  20632. stackClearing: true
  20633. }, {
  20634. id: "rmoveto",
  20635. min: 2,
  20636. stackClearing: true
  20637. }, {
  20638. id: "hmoveto",
  20639. min: 1,
  20640. stackClearing: true
  20641. }, {
  20642. id: "vstemhm",
  20643. min: 2,
  20644. stackClearing: true,
  20645. stem: true
  20646. }, {
  20647. id: "rcurveline",
  20648. min: 8,
  20649. resetStack: true
  20650. }, {
  20651. id: "rlinecurve",
  20652. min: 8,
  20653. resetStack: true
  20654. }, {
  20655. id: "vvcurveto",
  20656. min: 4,
  20657. resetStack: true
  20658. }, {
  20659. id: "hhcurveto",
  20660. min: 4,
  20661. resetStack: true
  20662. }, null, {
  20663. id: "callgsubr",
  20664. min: 1,
  20665. undefStack: true
  20666. }, {
  20667. id: "vhcurveto",
  20668. min: 4,
  20669. resetStack: true
  20670. }, {
  20671. id: "hvcurveto",
  20672. min: 4,
  20673. resetStack: true
  20674. }];
  20675. const CharstringValidationData12 = [null, null, null, {
  20676. id: "and",
  20677. min: 2,
  20678. stackDelta: -1
  20679. }, {
  20680. id: "or",
  20681. min: 2,
  20682. stackDelta: -1
  20683. }, {
  20684. id: "not",
  20685. min: 1,
  20686. stackDelta: 0
  20687. }, null, null, null, {
  20688. id: "abs",
  20689. min: 1,
  20690. stackDelta: 0
  20691. }, {
  20692. id: "add",
  20693. min: 2,
  20694. stackDelta: -1,
  20695. stackFn: function stack_div(stack, index) {
  20696. stack[index - 2] = stack[index - 2] + stack[index - 1];
  20697. }
  20698. }, {
  20699. id: "sub",
  20700. min: 2,
  20701. stackDelta: -1,
  20702. stackFn: function stack_div(stack, index) {
  20703. stack[index - 2] = stack[index - 2] - stack[index - 1];
  20704. }
  20705. }, {
  20706. id: "div",
  20707. min: 2,
  20708. stackDelta: -1,
  20709. stackFn: function stack_div(stack, index) {
  20710. stack[index - 2] = stack[index - 2] / stack[index - 1];
  20711. }
  20712. }, null, {
  20713. id: "neg",
  20714. min: 1,
  20715. stackDelta: 0,
  20716. stackFn: function stack_div(stack, index) {
  20717. stack[index - 1] = -stack[index - 1];
  20718. }
  20719. }, {
  20720. id: "eq",
  20721. min: 2,
  20722. stackDelta: -1
  20723. }, null, null, {
  20724. id: "drop",
  20725. min: 1,
  20726. stackDelta: -1
  20727. }, null, {
  20728. id: "put",
  20729. min: 2,
  20730. stackDelta: -2
  20731. }, {
  20732. id: "get",
  20733. min: 1,
  20734. stackDelta: 0
  20735. }, {
  20736. id: "ifelse",
  20737. min: 4,
  20738. stackDelta: -3
  20739. }, {
  20740. id: "random",
  20741. min: 0,
  20742. stackDelta: 1
  20743. }, {
  20744. id: "mul",
  20745. min: 2,
  20746. stackDelta: -1,
  20747. stackFn: function stack_div(stack, index) {
  20748. stack[index - 2] = stack[index - 2] * stack[index - 1];
  20749. }
  20750. }, null, {
  20751. id: "sqrt",
  20752. min: 1,
  20753. stackDelta: 0
  20754. }, {
  20755. id: "dup",
  20756. min: 1,
  20757. stackDelta: 1
  20758. }, {
  20759. id: "exch",
  20760. min: 2,
  20761. stackDelta: 0
  20762. }, {
  20763. id: "index",
  20764. min: 2,
  20765. stackDelta: 0
  20766. }, {
  20767. id: "roll",
  20768. min: 3,
  20769. stackDelta: -2
  20770. }, null, null, null, {
  20771. id: "hflex",
  20772. min: 7,
  20773. resetStack: true
  20774. }, {
  20775. id: "flex",
  20776. min: 13,
  20777. resetStack: true
  20778. }, {
  20779. id: "hflex1",
  20780. min: 9,
  20781. resetStack: true
  20782. }, {
  20783. id: "flex1",
  20784. min: 11,
  20785. resetStack: true
  20786. }];
  20787. class CFFParser {
  20788. constructor(file, properties, seacAnalysisEnabled) {
  20789. this.bytes = file.getBytes();
  20790. this.properties = properties;
  20791. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  20792. }
  20793. parse() {
  20794. const properties = this.properties;
  20795. const cff = new CFF();
  20796. this.cff = cff;
  20797. const header = this.parseHeader();
  20798. const nameIndex = this.parseIndex(header.endPos);
  20799. const topDictIndex = this.parseIndex(nameIndex.endPos);
  20800. const stringIndex = this.parseIndex(topDictIndex.endPos);
  20801. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  20802. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  20803. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  20804. cff.header = header.obj;
  20805. cff.names = this.parseNameIndex(nameIndex.obj);
  20806. cff.strings = this.parseStringIndex(stringIndex.obj);
  20807. cff.topDict = topDict;
  20808. cff.globalSubrIndex = globalSubrIndex.obj;
  20809. this.parsePrivateDict(cff.topDict);
  20810. cff.isCIDFont = topDict.hasName("ROS");
  20811. const charStringOffset = topDict.getByName("CharStrings");
  20812. const charStringIndex = this.parseIndex(charStringOffset).obj;
  20813. const fontMatrix = topDict.getByName("FontMatrix");
  20814. if (fontMatrix) {
  20815. properties.fontMatrix = fontMatrix;
  20816. }
  20817. const fontBBox = topDict.getByName("FontBBox");
  20818. if (fontBBox) {
  20819. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  20820. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  20821. properties.ascentScaled = true;
  20822. }
  20823. let charset, encoding;
  20824. if (cff.isCIDFont) {
  20825. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  20826. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  20827. const dictRaw = fdArrayIndex.get(i);
  20828. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  20829. this.parsePrivateDict(fontDict);
  20830. cff.fdArray.push(fontDict);
  20831. }
  20832. encoding = null;
  20833. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  20834. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  20835. } else {
  20836. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  20837. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  20838. }
  20839. cff.charset = charset;
  20840. cff.encoding = encoding;
  20841. const charStringsAndSeacs = this.parseCharStrings({
  20842. charStrings: charStringIndex,
  20843. localSubrIndex: topDict.privateDict.subrsIndex,
  20844. globalSubrIndex: globalSubrIndex.obj,
  20845. fdSelect: cff.fdSelect,
  20846. fdArray: cff.fdArray,
  20847. privateDict: topDict.privateDict
  20848. });
  20849. cff.charStrings = charStringsAndSeacs.charStrings;
  20850. cff.seacs = charStringsAndSeacs.seacs;
  20851. cff.widths = charStringsAndSeacs.widths;
  20852. return cff;
  20853. }
  20854. parseHeader() {
  20855. let bytes = this.bytes;
  20856. const bytesLength = bytes.length;
  20857. let offset = 0;
  20858. while (offset < bytesLength && bytes[offset] !== 1) {
  20859. ++offset;
  20860. }
  20861. if (offset >= bytesLength) {
  20862. throw new _util.FormatError("Invalid CFF header");
  20863. }
  20864. if (offset !== 0) {
  20865. (0, _util.info)("cff data is shifted");
  20866. bytes = bytes.subarray(offset);
  20867. this.bytes = bytes;
  20868. }
  20869. const major = bytes[0];
  20870. const minor = bytes[1];
  20871. const hdrSize = bytes[2];
  20872. const offSize = bytes[3];
  20873. const header = new CFFHeader(major, minor, hdrSize, offSize);
  20874. return {
  20875. obj: header,
  20876. endPos: hdrSize
  20877. };
  20878. }
  20879. parseDict(dict) {
  20880. let pos = 0;
  20881. function parseOperand() {
  20882. let value = dict[pos++];
  20883. if (value === 30) {
  20884. return parseFloatOperand();
  20885. } else if (value === 28) {
  20886. value = dict[pos++];
  20887. value = (value << 24 | dict[pos++] << 16) >> 16;
  20888. return value;
  20889. } else if (value === 29) {
  20890. value = dict[pos++];
  20891. value = value << 8 | dict[pos++];
  20892. value = value << 8 | dict[pos++];
  20893. value = value << 8 | dict[pos++];
  20894. return value;
  20895. } else if (value >= 32 && value <= 246) {
  20896. return value - 139;
  20897. } else if (value >= 247 && value <= 250) {
  20898. return (value - 247) * 256 + dict[pos++] + 108;
  20899. } else if (value >= 251 && value <= 254) {
  20900. return -((value - 251) * 256) - dict[pos++] - 108;
  20901. }
  20902. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  20903. return NaN;
  20904. }
  20905. function parseFloatOperand() {
  20906. let str = "";
  20907. const eof = 15;
  20908. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  20909. const length = dict.length;
  20910. while (pos < length) {
  20911. const b = dict[pos++];
  20912. const b1 = b >> 4;
  20913. const b2 = b & 15;
  20914. if (b1 === eof) {
  20915. break;
  20916. }
  20917. str += lookup[b1];
  20918. if (b2 === eof) {
  20919. break;
  20920. }
  20921. str += lookup[b2];
  20922. }
  20923. return parseFloat(str);
  20924. }
  20925. let operands = [];
  20926. const entries = [];
  20927. pos = 0;
  20928. const end = dict.length;
  20929. while (pos < end) {
  20930. let b = dict[pos];
  20931. if (b <= 21) {
  20932. if (b === 12) {
  20933. b = b << 8 | dict[++pos];
  20934. }
  20935. entries.push([b, operands]);
  20936. operands = [];
  20937. ++pos;
  20938. } else {
  20939. operands.push(parseOperand());
  20940. }
  20941. }
  20942. return entries;
  20943. }
  20944. parseIndex(pos) {
  20945. const cffIndex = new CFFIndex();
  20946. const bytes = this.bytes;
  20947. const count = bytes[pos++] << 8 | bytes[pos++];
  20948. const offsets = [];
  20949. let end = pos;
  20950. let i, ii;
  20951. if (count !== 0) {
  20952. const offsetSize = bytes[pos++];
  20953. const startPos = pos + (count + 1) * offsetSize - 1;
  20954. for (i = 0, ii = count + 1; i < ii; ++i) {
  20955. let offset = 0;
  20956. for (let j = 0; j < offsetSize; ++j) {
  20957. offset <<= 8;
  20958. offset += bytes[pos++];
  20959. }
  20960. offsets.push(startPos + offset);
  20961. }
  20962. end = offsets[count];
  20963. }
  20964. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  20965. const offsetStart = offsets[i];
  20966. const offsetEnd = offsets[i + 1];
  20967. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  20968. }
  20969. return {
  20970. obj: cffIndex,
  20971. endPos: end
  20972. };
  20973. }
  20974. parseNameIndex(index) {
  20975. const names = [];
  20976. for (let i = 0, ii = index.count; i < ii; ++i) {
  20977. const name = index.get(i);
  20978. names.push((0, _util.bytesToString)(name));
  20979. }
  20980. return names;
  20981. }
  20982. parseStringIndex(index) {
  20983. const strings = new CFFStrings();
  20984. for (let i = 0, ii = index.count; i < ii; ++i) {
  20985. const data = index.get(i);
  20986. strings.add((0, _util.bytesToString)(data));
  20987. }
  20988. return strings;
  20989. }
  20990. createDict(Type, dict, strings) {
  20991. const cffDict = new Type(strings);
  20992. for (let i = 0, ii = dict.length; i < ii; ++i) {
  20993. const pair = dict[i];
  20994. const key = pair[0];
  20995. const value = pair[1];
  20996. cffDict.setByKey(key, value);
  20997. }
  20998. return cffDict;
  20999. }
  21000. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  21001. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  21002. return false;
  21003. }
  21004. let stackSize = state.stackSize;
  21005. const stack = state.stack;
  21006. const length = data.length;
  21007. for (let j = 0; j < length;) {
  21008. const value = data[j++];
  21009. let validationCommand = null;
  21010. if (value === 12) {
  21011. const q = data[j++];
  21012. if (q === 0) {
  21013. data[j - 2] = 139;
  21014. data[j - 1] = 22;
  21015. stackSize = 0;
  21016. } else {
  21017. validationCommand = CharstringValidationData12[q];
  21018. }
  21019. } else if (value === 28) {
  21020. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  21021. j += 2;
  21022. stackSize++;
  21023. } else if (value === 14) {
  21024. if (stackSize >= 4) {
  21025. stackSize -= 4;
  21026. if (this.seacAnalysisEnabled) {
  21027. state.seac = stack.slice(stackSize, stackSize + 4);
  21028. return false;
  21029. }
  21030. }
  21031. validationCommand = CharstringValidationData[value];
  21032. } else if (value >= 32 && value <= 246) {
  21033. stack[stackSize] = value - 139;
  21034. stackSize++;
  21035. } else if (value >= 247 && value <= 254) {
  21036. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  21037. j++;
  21038. stackSize++;
  21039. } else if (value === 255) {
  21040. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  21041. j += 4;
  21042. stackSize++;
  21043. } else if (value === 19 || value === 20) {
  21044. state.hints += stackSize >> 1;
  21045. j += state.hints + 7 >> 3;
  21046. stackSize %= 2;
  21047. validationCommand = CharstringValidationData[value];
  21048. } else if (value === 10 || value === 29) {
  21049. let subrsIndex;
  21050. if (value === 10) {
  21051. subrsIndex = localSubrIndex;
  21052. } else {
  21053. subrsIndex = globalSubrIndex;
  21054. }
  21055. if (!subrsIndex) {
  21056. validationCommand = CharstringValidationData[value];
  21057. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  21058. return false;
  21059. }
  21060. let bias = 32768;
  21061. if (subrsIndex.count < 1240) {
  21062. bias = 107;
  21063. } else if (subrsIndex.count < 33900) {
  21064. bias = 1131;
  21065. }
  21066. const subrNumber = stack[--stackSize] + bias;
  21067. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  21068. validationCommand = CharstringValidationData[value];
  21069. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  21070. return false;
  21071. }
  21072. state.stackSize = stackSize;
  21073. state.callDepth++;
  21074. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  21075. if (!valid) {
  21076. return false;
  21077. }
  21078. state.callDepth--;
  21079. stackSize = state.stackSize;
  21080. continue;
  21081. } else if (value === 11) {
  21082. state.stackSize = stackSize;
  21083. return true;
  21084. } else {
  21085. validationCommand = CharstringValidationData[value];
  21086. }
  21087. if (validationCommand) {
  21088. if (validationCommand.stem) {
  21089. state.hints += stackSize >> 1;
  21090. if (value === 3 || value === 23) {
  21091. state.hasVStems = true;
  21092. } else if (state.hasVStems && (value === 1 || value === 18)) {
  21093. (0, _util.warn)("CFF stem hints are in wrong order");
  21094. data[j - 1] = value === 1 ? 3 : 23;
  21095. }
  21096. }
  21097. if ("min" in validationCommand) {
  21098. if (!state.undefStack && stackSize < validationCommand.min) {
  21099. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  21100. return false;
  21101. }
  21102. }
  21103. if (state.firstStackClearing && validationCommand.stackClearing) {
  21104. state.firstStackClearing = false;
  21105. stackSize -= validationCommand.min;
  21106. if (stackSize >= 2 && validationCommand.stem) {
  21107. stackSize %= 2;
  21108. } else if (stackSize > 1) {
  21109. (0, _util.warn)("Found too many parameters for stack-clearing command");
  21110. }
  21111. if (stackSize > 0) {
  21112. state.width = stack[stackSize - 1];
  21113. }
  21114. }
  21115. if ("stackDelta" in validationCommand) {
  21116. if ("stackFn" in validationCommand) {
  21117. validationCommand.stackFn(stack, stackSize);
  21118. }
  21119. stackSize += validationCommand.stackDelta;
  21120. } else if (validationCommand.stackClearing) {
  21121. stackSize = 0;
  21122. } else if (validationCommand.resetStack) {
  21123. stackSize = 0;
  21124. state.undefStack = false;
  21125. } else if (validationCommand.undefStack) {
  21126. stackSize = 0;
  21127. state.undefStack = true;
  21128. state.firstStackClearing = false;
  21129. }
  21130. }
  21131. }
  21132. state.stackSize = stackSize;
  21133. return true;
  21134. }
  21135. parseCharStrings({
  21136. charStrings,
  21137. localSubrIndex,
  21138. globalSubrIndex,
  21139. fdSelect,
  21140. fdArray,
  21141. privateDict
  21142. }) {
  21143. const seacs = [];
  21144. const widths = [];
  21145. const count = charStrings.count;
  21146. for (let i = 0; i < count; i++) {
  21147. const charstring = charStrings.get(i);
  21148. const state = {
  21149. callDepth: 0,
  21150. stackSize: 0,
  21151. stack: [],
  21152. undefStack: true,
  21153. hints: 0,
  21154. firstStackClearing: true,
  21155. seac: null,
  21156. width: null,
  21157. hasVStems: false
  21158. };
  21159. let valid = true;
  21160. let localSubrToUse = null;
  21161. let privateDictToUse = privateDict;
  21162. if (fdSelect && fdArray.length) {
  21163. const fdIndex = fdSelect.getFDIndex(i);
  21164. if (fdIndex === -1) {
  21165. (0, _util.warn)("Glyph index is not in fd select.");
  21166. valid = false;
  21167. }
  21168. if (fdIndex >= fdArray.length) {
  21169. (0, _util.warn)("Invalid fd index for glyph index.");
  21170. valid = false;
  21171. }
  21172. if (valid) {
  21173. privateDictToUse = fdArray[fdIndex].privateDict;
  21174. localSubrToUse = privateDictToUse.subrsIndex;
  21175. }
  21176. } else if (localSubrIndex) {
  21177. localSubrToUse = localSubrIndex;
  21178. }
  21179. if (valid) {
  21180. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  21181. }
  21182. if (state.width !== null) {
  21183. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  21184. widths[i] = nominalWidth + state.width;
  21185. } else {
  21186. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  21187. widths[i] = defaultWidth;
  21188. }
  21189. if (state.seac !== null) {
  21190. seacs[i] = state.seac;
  21191. }
  21192. if (!valid) {
  21193. charStrings.set(i, new Uint8Array([14]));
  21194. }
  21195. }
  21196. return {
  21197. charStrings,
  21198. seacs,
  21199. widths
  21200. };
  21201. }
  21202. emptyPrivateDictionary(parentDict) {
  21203. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  21204. parentDict.setByKey(18, [0, 0]);
  21205. parentDict.privateDict = privateDict;
  21206. }
  21207. parsePrivateDict(parentDict) {
  21208. if (!parentDict.hasName("Private")) {
  21209. this.emptyPrivateDictionary(parentDict);
  21210. return;
  21211. }
  21212. const privateOffset = parentDict.getByName("Private");
  21213. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  21214. parentDict.removeByName("Private");
  21215. return;
  21216. }
  21217. const size = privateOffset[0];
  21218. const offset = privateOffset[1];
  21219. if (size === 0 || offset >= this.bytes.length) {
  21220. this.emptyPrivateDictionary(parentDict);
  21221. return;
  21222. }
  21223. const privateDictEnd = offset + size;
  21224. const dictData = this.bytes.subarray(offset, privateDictEnd);
  21225. const dict = this.parseDict(dictData);
  21226. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  21227. parentDict.privateDict = privateDict;
  21228. if (!privateDict.getByName("Subrs")) {
  21229. return;
  21230. }
  21231. const subrsOffset = privateDict.getByName("Subrs");
  21232. const relativeOffset = offset + subrsOffset;
  21233. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  21234. this.emptyPrivateDictionary(parentDict);
  21235. return;
  21236. }
  21237. const subrsIndex = this.parseIndex(relativeOffset);
  21238. privateDict.subrsIndex = subrsIndex.obj;
  21239. }
  21240. parseCharsets(pos, length, strings, cid) {
  21241. if (pos === 0) {
  21242. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  21243. } else if (pos === 1) {
  21244. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  21245. } else if (pos === 2) {
  21246. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  21247. }
  21248. const bytes = this.bytes;
  21249. const start = pos;
  21250. const format = bytes[pos++];
  21251. const charset = [cid ? 0 : ".notdef"];
  21252. let id, count, i;
  21253. length -= 1;
  21254. switch (format) {
  21255. case 0:
  21256. for (i = 0; i < length; i++) {
  21257. id = bytes[pos++] << 8 | bytes[pos++];
  21258. charset.push(cid ? id : strings.get(id));
  21259. }
  21260. break;
  21261. case 1:
  21262. while (charset.length <= length) {
  21263. id = bytes[pos++] << 8 | bytes[pos++];
  21264. count = bytes[pos++];
  21265. for (i = 0; i <= count; i++) {
  21266. charset.push(cid ? id++ : strings.get(id++));
  21267. }
  21268. }
  21269. break;
  21270. case 2:
  21271. while (charset.length <= length) {
  21272. id = bytes[pos++] << 8 | bytes[pos++];
  21273. count = bytes[pos++] << 8 | bytes[pos++];
  21274. for (i = 0; i <= count; i++) {
  21275. charset.push(cid ? id++ : strings.get(id++));
  21276. }
  21277. }
  21278. break;
  21279. default:
  21280. throw new _util.FormatError("Unknown charset format");
  21281. }
  21282. const end = pos;
  21283. const raw = bytes.subarray(start, end);
  21284. return new CFFCharset(false, format, charset, raw);
  21285. }
  21286. parseEncoding(pos, properties, strings, charset) {
  21287. const encoding = Object.create(null);
  21288. const bytes = this.bytes;
  21289. let predefined = false;
  21290. let format, i, ii;
  21291. let raw = null;
  21292. function readSupplement() {
  21293. const supplementsCount = bytes[pos++];
  21294. for (i = 0; i < supplementsCount; i++) {
  21295. const code = bytes[pos++];
  21296. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  21297. encoding[code] = charset.indexOf(strings.get(sid));
  21298. }
  21299. }
  21300. if (pos === 0 || pos === 1) {
  21301. predefined = true;
  21302. format = pos;
  21303. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  21304. for (i = 0, ii = charset.length; i < ii; i++) {
  21305. const index = baseEncoding.indexOf(charset[i]);
  21306. if (index !== -1) {
  21307. encoding[index] = i;
  21308. }
  21309. }
  21310. } else {
  21311. const dataStart = pos;
  21312. format = bytes[pos++];
  21313. switch (format & 0x7f) {
  21314. case 0:
  21315. const glyphsCount = bytes[pos++];
  21316. for (i = 1; i <= glyphsCount; i++) {
  21317. encoding[bytes[pos++]] = i;
  21318. }
  21319. break;
  21320. case 1:
  21321. const rangesCount = bytes[pos++];
  21322. let gid = 1;
  21323. for (i = 0; i < rangesCount; i++) {
  21324. const start = bytes[pos++];
  21325. const left = bytes[pos++];
  21326. for (let j = start; j <= start + left; j++) {
  21327. encoding[j] = gid++;
  21328. }
  21329. }
  21330. break;
  21331. default:
  21332. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  21333. }
  21334. const dataEnd = pos;
  21335. if (format & 0x80) {
  21336. bytes[dataStart] &= 0x7f;
  21337. readSupplement();
  21338. }
  21339. raw = bytes.subarray(dataStart, dataEnd);
  21340. }
  21341. format = format & 0x7f;
  21342. return new CFFEncoding(predefined, format, encoding, raw);
  21343. }
  21344. parseFDSelect(pos, length) {
  21345. const bytes = this.bytes;
  21346. const format = bytes[pos++];
  21347. const fdSelect = [];
  21348. let i;
  21349. switch (format) {
  21350. case 0:
  21351. for (i = 0; i < length; ++i) {
  21352. const id = bytes[pos++];
  21353. fdSelect.push(id);
  21354. }
  21355. break;
  21356. case 3:
  21357. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21358. for (i = 0; i < rangesCount; ++i) {
  21359. let first = bytes[pos++] << 8 | bytes[pos++];
  21360. if (i === 0 && first !== 0) {
  21361. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  21362. first = 0;
  21363. }
  21364. const fdIndex = bytes[pos++];
  21365. const next = bytes[pos] << 8 | bytes[pos + 1];
  21366. for (let j = first; j < next; ++j) {
  21367. fdSelect.push(fdIndex);
  21368. }
  21369. }
  21370. pos += 2;
  21371. break;
  21372. default:
  21373. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  21374. }
  21375. if (fdSelect.length !== length) {
  21376. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  21377. }
  21378. return new CFFFDSelect(format, fdSelect);
  21379. }
  21380. }
  21381. return CFFParser;
  21382. }();
  21383. exports.CFFParser = CFFParser;
  21384. class CFF {
  21385. constructor() {
  21386. this.header = null;
  21387. this.names = [];
  21388. this.topDict = null;
  21389. this.strings = new CFFStrings();
  21390. this.globalSubrIndex = null;
  21391. this.encoding = null;
  21392. this.charset = null;
  21393. this.charStrings = null;
  21394. this.fdArray = [];
  21395. this.fdSelect = null;
  21396. this.isCIDFont = false;
  21397. }
  21398. duplicateFirstGlyph() {
  21399. if (this.charStrings.count >= 65535) {
  21400. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  21401. return;
  21402. }
  21403. const glyphZero = this.charStrings.get(0);
  21404. this.charStrings.add(glyphZero);
  21405. if (this.isCIDFont) {
  21406. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  21407. }
  21408. }
  21409. hasGlyphId(id) {
  21410. if (id < 0 || id >= this.charStrings.count) {
  21411. return false;
  21412. }
  21413. const glyph = this.charStrings.get(id);
  21414. return glyph.length > 0;
  21415. }
  21416. }
  21417. exports.CFF = CFF;
  21418. class CFFHeader {
  21419. constructor(major, minor, hdrSize, offSize) {
  21420. this.major = major;
  21421. this.minor = minor;
  21422. this.hdrSize = hdrSize;
  21423. this.offSize = offSize;
  21424. }
  21425. }
  21426. exports.CFFHeader = CFFHeader;
  21427. class CFFStrings {
  21428. constructor() {
  21429. this.strings = [];
  21430. }
  21431. get(index) {
  21432. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  21433. return CFFStandardStrings[index];
  21434. }
  21435. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  21436. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  21437. }
  21438. return CFFStandardStrings[0];
  21439. }
  21440. getSID(str) {
  21441. let index = CFFStandardStrings.indexOf(str);
  21442. if (index !== -1) {
  21443. return index;
  21444. }
  21445. index = this.strings.indexOf(str);
  21446. if (index !== -1) {
  21447. return index + NUM_STANDARD_CFF_STRINGS;
  21448. }
  21449. return -1;
  21450. }
  21451. add(value) {
  21452. this.strings.push(value);
  21453. }
  21454. get count() {
  21455. return this.strings.length;
  21456. }
  21457. }
  21458. exports.CFFStrings = CFFStrings;
  21459. class CFFIndex {
  21460. constructor() {
  21461. this.objects = [];
  21462. this.length = 0;
  21463. }
  21464. add(data) {
  21465. this.length += data.length;
  21466. this.objects.push(data);
  21467. }
  21468. set(index, data) {
  21469. this.length += data.length - this.objects[index].length;
  21470. this.objects[index] = data;
  21471. }
  21472. get(index) {
  21473. return this.objects[index];
  21474. }
  21475. get count() {
  21476. return this.objects.length;
  21477. }
  21478. }
  21479. exports.CFFIndex = CFFIndex;
  21480. class CFFDict {
  21481. constructor(tables, strings) {
  21482. this.keyToNameMap = tables.keyToNameMap;
  21483. this.nameToKeyMap = tables.nameToKeyMap;
  21484. this.defaults = tables.defaults;
  21485. this.types = tables.types;
  21486. this.opcodes = tables.opcodes;
  21487. this.order = tables.order;
  21488. this.strings = strings;
  21489. this.values = Object.create(null);
  21490. }
  21491. setByKey(key, value) {
  21492. if (!(key in this.keyToNameMap)) {
  21493. return false;
  21494. }
  21495. const valueLength = value.length;
  21496. if (valueLength === 0) {
  21497. return true;
  21498. }
  21499. for (let i = 0; i < valueLength; i++) {
  21500. if (isNaN(value[i])) {
  21501. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21502. return true;
  21503. }
  21504. }
  21505. const type = this.types[key];
  21506. if (type === "num" || type === "sid" || type === "offset") {
  21507. value = value[0];
  21508. }
  21509. this.values[key] = value;
  21510. return true;
  21511. }
  21512. setByName(name, value) {
  21513. if (!(name in this.nameToKeyMap)) {
  21514. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  21515. }
  21516. this.values[this.nameToKeyMap[name]] = value;
  21517. }
  21518. hasName(name) {
  21519. return this.nameToKeyMap[name] in this.values;
  21520. }
  21521. getByName(name) {
  21522. if (!(name in this.nameToKeyMap)) {
  21523. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  21524. }
  21525. const key = this.nameToKeyMap[name];
  21526. if (!(key in this.values)) {
  21527. return this.defaults[key];
  21528. }
  21529. return this.values[key];
  21530. }
  21531. removeByName(name) {
  21532. delete this.values[this.nameToKeyMap[name]];
  21533. }
  21534. static createTables(layout) {
  21535. const tables = {
  21536. keyToNameMap: {},
  21537. nameToKeyMap: {},
  21538. defaults: {},
  21539. types: {},
  21540. opcodes: {},
  21541. order: []
  21542. };
  21543. for (let i = 0, ii = layout.length; i < ii; ++i) {
  21544. const entry = layout[i];
  21545. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21546. tables.keyToNameMap[key] = entry[1];
  21547. tables.nameToKeyMap[entry[1]] = key;
  21548. tables.types[key] = entry[2];
  21549. tables.defaults[key] = entry[3];
  21550. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  21551. tables.order.push(key);
  21552. }
  21553. return tables;
  21554. }
  21555. }
  21556. const CFFTopDict = function CFFTopDictClosure() {
  21557. 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]];
  21558. let tables = null;
  21559. class CFFTopDict extends CFFDict {
  21560. constructor(strings) {
  21561. if (tables === null) {
  21562. tables = CFFDict.createTables(layout);
  21563. }
  21564. super(tables, strings);
  21565. this.privateDict = null;
  21566. }
  21567. }
  21568. return CFFTopDict;
  21569. }();
  21570. exports.CFFTopDict = CFFTopDict;
  21571. const CFFPrivateDict = function CFFPrivateDictClosure() {
  21572. 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]];
  21573. let tables = null;
  21574. class CFFPrivateDict extends CFFDict {
  21575. constructor(strings) {
  21576. if (tables === null) {
  21577. tables = CFFDict.createTables(layout);
  21578. }
  21579. super(tables, strings);
  21580. this.subrsIndex = null;
  21581. }
  21582. }
  21583. return CFFPrivateDict;
  21584. }();
  21585. exports.CFFPrivateDict = CFFPrivateDict;
  21586. const CFFCharsetPredefinedTypes = {
  21587. ISO_ADOBE: 0,
  21588. EXPERT: 1,
  21589. EXPERT_SUBSET: 2
  21590. };
  21591. class CFFCharset {
  21592. constructor(predefined, format, charset, raw) {
  21593. this.predefined = predefined;
  21594. this.format = format;
  21595. this.charset = charset;
  21596. this.raw = raw;
  21597. }
  21598. }
  21599. exports.CFFCharset = CFFCharset;
  21600. class CFFEncoding {
  21601. constructor(predefined, format, encoding, raw) {
  21602. this.predefined = predefined;
  21603. this.format = format;
  21604. this.encoding = encoding;
  21605. this.raw = raw;
  21606. }
  21607. }
  21608. class CFFFDSelect {
  21609. constructor(format, fdSelect) {
  21610. this.format = format;
  21611. this.fdSelect = fdSelect;
  21612. }
  21613. getFDIndex(glyphIndex) {
  21614. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21615. return -1;
  21616. }
  21617. return this.fdSelect[glyphIndex];
  21618. }
  21619. }
  21620. exports.CFFFDSelect = CFFFDSelect;
  21621. class CFFOffsetTracker {
  21622. constructor() {
  21623. this.offsets = Object.create(null);
  21624. }
  21625. isTracking(key) {
  21626. return key in this.offsets;
  21627. }
  21628. track(key, location) {
  21629. if (key in this.offsets) {
  21630. throw new _util.FormatError(`Already tracking location of ${key}`);
  21631. }
  21632. this.offsets[key] = location;
  21633. }
  21634. offset(value) {
  21635. for (const key in this.offsets) {
  21636. this.offsets[key] += value;
  21637. }
  21638. }
  21639. setEntryLocation(key, values, output) {
  21640. if (!(key in this.offsets)) {
  21641. throw new _util.FormatError(`Not tracking location of ${key}`);
  21642. }
  21643. const data = output.data;
  21644. const dataOffset = this.offsets[key];
  21645. const size = 5;
  21646. for (let i = 0, ii = values.length; i < ii; ++i) {
  21647. const offset0 = i * size + dataOffset;
  21648. const offset1 = offset0 + 1;
  21649. const offset2 = offset0 + 2;
  21650. const offset3 = offset0 + 3;
  21651. const offset4 = offset0 + 4;
  21652. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  21653. throw new _util.FormatError("writing to an offset that is not empty");
  21654. }
  21655. const value = values[i];
  21656. data[offset0] = 0x1d;
  21657. data[offset1] = value >> 24 & 0xff;
  21658. data[offset2] = value >> 16 & 0xff;
  21659. data[offset3] = value >> 8 & 0xff;
  21660. data[offset4] = value & 0xff;
  21661. }
  21662. }
  21663. }
  21664. class CFFCompiler {
  21665. constructor(cff) {
  21666. this.cff = cff;
  21667. }
  21668. compile() {
  21669. const cff = this.cff;
  21670. const output = {
  21671. data: [],
  21672. length: 0,
  21673. add: function CFFCompiler_add(data) {
  21674. this.data = this.data.concat(data);
  21675. this.length = this.data.length;
  21676. }
  21677. };
  21678. const header = this.compileHeader(cff.header);
  21679. output.add(header);
  21680. const nameIndex = this.compileNameIndex(cff.names);
  21681. output.add(nameIndex);
  21682. if (cff.isCIDFont) {
  21683. if (cff.topDict.hasName("FontMatrix")) {
  21684. const base = cff.topDict.getByName("FontMatrix");
  21685. cff.topDict.removeByName("FontMatrix");
  21686. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  21687. const subDict = cff.fdArray[i];
  21688. let matrix = base.slice(0);
  21689. if (subDict.hasName("FontMatrix")) {
  21690. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  21691. }
  21692. subDict.setByName("FontMatrix", matrix);
  21693. }
  21694. }
  21695. }
  21696. const xuid = cff.topDict.getByName("XUID");
  21697. if (xuid && xuid.length > 16) {
  21698. cff.topDict.removeByName("XUID");
  21699. }
  21700. cff.topDict.setByName("charset", 0);
  21701. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  21702. output.add(compiled.output);
  21703. const topDictTracker = compiled.trackers[0];
  21704. const stringIndex = this.compileStringIndex(cff.strings.strings);
  21705. output.add(stringIndex);
  21706. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  21707. output.add(globalSubrIndex);
  21708. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  21709. if (cff.encoding.predefined) {
  21710. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  21711. } else {
  21712. const encoding = this.compileEncoding(cff.encoding);
  21713. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  21714. output.add(encoding);
  21715. }
  21716. }
  21717. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  21718. topDictTracker.setEntryLocation("charset", [output.length], output);
  21719. output.add(charset);
  21720. const charStrings = this.compileCharStrings(cff.charStrings);
  21721. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  21722. output.add(charStrings);
  21723. if (cff.isCIDFont) {
  21724. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  21725. const fdSelect = this.compileFDSelect(cff.fdSelect);
  21726. output.add(fdSelect);
  21727. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21728. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  21729. output.add(compiled.output);
  21730. const fontDictTrackers = compiled.trackers;
  21731. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21732. }
  21733. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21734. output.add([0]);
  21735. return output.data;
  21736. }
  21737. encodeNumber(value) {
  21738. if (Number.isInteger(value)) {
  21739. return this.encodeInteger(value);
  21740. }
  21741. return this.encodeFloat(value);
  21742. }
  21743. static get EncodeFloatRegExp() {
  21744. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  21745. }
  21746. encodeFloat(num) {
  21747. let value = num.toString();
  21748. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  21749. if (m) {
  21750. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  21751. value = (Math.round(num * epsilon) / epsilon).toString();
  21752. }
  21753. let nibbles = "";
  21754. let i, ii;
  21755. for (i = 0, ii = value.length; i < ii; ++i) {
  21756. const a = value[i];
  21757. if (a === "e") {
  21758. nibbles += value[++i] === "-" ? "c" : "b";
  21759. } else if (a === ".") {
  21760. nibbles += "a";
  21761. } else if (a === "-") {
  21762. nibbles += "e";
  21763. } else {
  21764. nibbles += a;
  21765. }
  21766. }
  21767. nibbles += nibbles.length & 1 ? "f" : "ff";
  21768. const out = [30];
  21769. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21770. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  21771. }
  21772. return out;
  21773. }
  21774. encodeInteger(value) {
  21775. let code;
  21776. if (value >= -107 && value <= 107) {
  21777. code = [value + 139];
  21778. } else if (value >= 108 && value <= 1131) {
  21779. value = value - 108;
  21780. code = [(value >> 8) + 247, value & 0xff];
  21781. } else if (value >= -1131 && value <= -108) {
  21782. value = -value - 108;
  21783. code = [(value >> 8) + 251, value & 0xff];
  21784. } else if (value >= -32768 && value <= 32767) {
  21785. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  21786. } else {
  21787. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  21788. }
  21789. return code;
  21790. }
  21791. compileHeader(header) {
  21792. return [header.major, header.minor, 4, header.offSize];
  21793. }
  21794. compileNameIndex(names) {
  21795. const nameIndex = new CFFIndex();
  21796. for (let i = 0, ii = names.length; i < ii; ++i) {
  21797. const name = names[i];
  21798. const length = Math.min(name.length, 127);
  21799. let sanitizedName = new Array(length);
  21800. for (let j = 0; j < length; j++) {
  21801. let char = name[j];
  21802. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  21803. char = "_";
  21804. }
  21805. sanitizedName[j] = char;
  21806. }
  21807. sanitizedName = sanitizedName.join("");
  21808. if (sanitizedName === "") {
  21809. sanitizedName = "Bad_Font_Name";
  21810. }
  21811. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  21812. }
  21813. return this.compileIndex(nameIndex);
  21814. }
  21815. compileTopDicts(dicts, length, removeCidKeys) {
  21816. const fontDictTrackers = [];
  21817. let fdArrayIndex = new CFFIndex();
  21818. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  21819. const fontDict = dicts[i];
  21820. if (removeCidKeys) {
  21821. fontDict.removeByName("CIDFontVersion");
  21822. fontDict.removeByName("CIDFontRevision");
  21823. fontDict.removeByName("CIDFontType");
  21824. fontDict.removeByName("CIDCount");
  21825. fontDict.removeByName("UIDBase");
  21826. }
  21827. const fontDictTracker = new CFFOffsetTracker();
  21828. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  21829. fontDictTrackers.push(fontDictTracker);
  21830. fdArrayIndex.add(fontDictData);
  21831. fontDictTracker.offset(length);
  21832. }
  21833. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21834. return {
  21835. trackers: fontDictTrackers,
  21836. output: fdArrayIndex
  21837. };
  21838. }
  21839. compilePrivateDicts(dicts, trackers, output) {
  21840. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  21841. const fontDict = dicts[i];
  21842. const privateDict = fontDict.privateDict;
  21843. if (!privateDict || !fontDict.hasName("Private")) {
  21844. throw new _util.FormatError("There must be a private dictionary.");
  21845. }
  21846. const privateDictTracker = new CFFOffsetTracker();
  21847. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  21848. let outputLength = output.length;
  21849. privateDictTracker.offset(outputLength);
  21850. if (!privateDictData.length) {
  21851. outputLength = 0;
  21852. }
  21853. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  21854. output.add(privateDictData);
  21855. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  21856. const subrs = this.compileIndex(privateDict.subrsIndex);
  21857. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  21858. output.add(subrs);
  21859. }
  21860. }
  21861. }
  21862. compileDict(dict, offsetTracker) {
  21863. let out = [];
  21864. const order = dict.order;
  21865. for (let i = 0; i < order.length; ++i) {
  21866. const key = order[i];
  21867. if (!(key in dict.values)) {
  21868. continue;
  21869. }
  21870. let values = dict.values[key];
  21871. let types = dict.types[key];
  21872. if (!Array.isArray(types)) {
  21873. types = [types];
  21874. }
  21875. if (!Array.isArray(values)) {
  21876. values = [values];
  21877. }
  21878. if (values.length === 0) {
  21879. continue;
  21880. }
  21881. for (let j = 0, jj = types.length; j < jj; ++j) {
  21882. const type = types[j];
  21883. const value = values[j];
  21884. switch (type) {
  21885. case "num":
  21886. case "sid":
  21887. out = out.concat(this.encodeNumber(value));
  21888. break;
  21889. case "offset":
  21890. const name = dict.keyToNameMap[key];
  21891. if (!offsetTracker.isTracking(name)) {
  21892. offsetTracker.track(name, out.length);
  21893. }
  21894. out = out.concat([0x1d, 0, 0, 0, 0]);
  21895. break;
  21896. case "array":
  21897. case "delta":
  21898. out = out.concat(this.encodeNumber(value));
  21899. for (let k = 1, kk = values.length; k < kk; ++k) {
  21900. out = out.concat(this.encodeNumber(values[k]));
  21901. }
  21902. break;
  21903. default:
  21904. throw new _util.FormatError(`Unknown data type of ${type}`);
  21905. }
  21906. }
  21907. out = out.concat(dict.opcodes[key]);
  21908. }
  21909. return out;
  21910. }
  21911. compileStringIndex(strings) {
  21912. const stringIndex = new CFFIndex();
  21913. for (let i = 0, ii = strings.length; i < ii; ++i) {
  21914. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  21915. }
  21916. return this.compileIndex(stringIndex);
  21917. }
  21918. compileGlobalSubrIndex() {
  21919. const globalSubrIndex = this.cff.globalSubrIndex;
  21920. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  21921. }
  21922. compileCharStrings(charStrings) {
  21923. const charStringsIndex = new CFFIndex();
  21924. for (let i = 0; i < charStrings.count; i++) {
  21925. const glyph = charStrings.get(i);
  21926. if (glyph.length === 0) {
  21927. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  21928. continue;
  21929. }
  21930. charStringsIndex.add(glyph);
  21931. }
  21932. return this.compileIndex(charStringsIndex);
  21933. }
  21934. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  21935. let out;
  21936. const numGlyphsLessNotDef = numGlyphs - 1;
  21937. if (isCIDFont) {
  21938. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  21939. } else {
  21940. const length = 1 + numGlyphsLessNotDef * 2;
  21941. out = new Uint8Array(length);
  21942. out[0] = 0;
  21943. let charsetIndex = 0;
  21944. const numCharsets = charset.charset.length;
  21945. let warned = false;
  21946. for (let i = 1; i < out.length; i += 2) {
  21947. let sid = 0;
  21948. if (charsetIndex < numCharsets) {
  21949. const name = charset.charset[charsetIndex++];
  21950. sid = strings.getSID(name);
  21951. if (sid === -1) {
  21952. sid = 0;
  21953. if (!warned) {
  21954. warned = true;
  21955. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  21956. }
  21957. }
  21958. }
  21959. out[i] = sid >> 8 & 0xff;
  21960. out[i + 1] = sid & 0xff;
  21961. }
  21962. }
  21963. return this.compileTypedArray(out);
  21964. }
  21965. compileEncoding(encoding) {
  21966. return this.compileTypedArray(encoding.raw);
  21967. }
  21968. compileFDSelect(fdSelect) {
  21969. const format = fdSelect.format;
  21970. let out, i;
  21971. switch (format) {
  21972. case 0:
  21973. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  21974. out[0] = format;
  21975. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  21976. out[i + 1] = fdSelect.fdSelect[i];
  21977. }
  21978. break;
  21979. case 3:
  21980. const start = 0;
  21981. let lastFD = fdSelect.fdSelect[0];
  21982. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  21983. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  21984. const currentFD = fdSelect.fdSelect[i];
  21985. if (currentFD !== lastFD) {
  21986. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  21987. lastFD = currentFD;
  21988. }
  21989. }
  21990. const numRanges = (ranges.length - 3) / 3;
  21991. ranges[1] = numRanges >> 8 & 0xff;
  21992. ranges[2] = numRanges & 0xff;
  21993. ranges.push(i >> 8 & 0xff, i & 0xff);
  21994. out = new Uint8Array(ranges);
  21995. break;
  21996. }
  21997. return this.compileTypedArray(out);
  21998. }
  21999. compileTypedArray(data) {
  22000. const out = [];
  22001. for (let i = 0, ii = data.length; i < ii; ++i) {
  22002. out[i] = data[i];
  22003. }
  22004. return out;
  22005. }
  22006. compileIndex(index, trackers = []) {
  22007. const objects = index.objects;
  22008. const count = objects.length;
  22009. if (count === 0) {
  22010. return [0, 0, 0];
  22011. }
  22012. const data = [count >> 8 & 0xff, count & 0xff];
  22013. let lastOffset = 1,
  22014. i;
  22015. for (i = 0; i < count; ++i) {
  22016. lastOffset += objects[i].length;
  22017. }
  22018. let offsetSize;
  22019. if (lastOffset < 0x100) {
  22020. offsetSize = 1;
  22021. } else if (lastOffset < 0x10000) {
  22022. offsetSize = 2;
  22023. } else if (lastOffset < 0x1000000) {
  22024. offsetSize = 3;
  22025. } else {
  22026. offsetSize = 4;
  22027. }
  22028. data.push(offsetSize);
  22029. let relativeOffset = 1;
  22030. for (i = 0; i < count + 1; i++) {
  22031. if (offsetSize === 1) {
  22032. data.push(relativeOffset & 0xff);
  22033. } else if (offsetSize === 2) {
  22034. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  22035. } else if (offsetSize === 3) {
  22036. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  22037. } else {
  22038. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  22039. }
  22040. if (objects[i]) {
  22041. relativeOffset += objects[i].length;
  22042. }
  22043. }
  22044. for (i = 0; i < count; i++) {
  22045. if (trackers[i]) {
  22046. trackers[i].offset(data.length);
  22047. }
  22048. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  22049. data.push(objects[i][j]);
  22050. }
  22051. }
  22052. return data;
  22053. }
  22054. }
  22055. exports.CFFCompiler = CFFCompiler;
  22056. /***/ }),
  22057. /* 36 */
  22058. /***/ ((__unused_webpack_module, exports) => {
  22059. Object.defineProperty(exports, "__esModule", ({
  22060. value: true
  22061. }));
  22062. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  22063. 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"];
  22064. exports.ISOAdobeCharset = ISOAdobeCharset;
  22065. 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"];
  22066. exports.ExpertCharset = ExpertCharset;
  22067. 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"];
  22068. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  22069. /***/ }),
  22070. /* 37 */
  22071. /***/ ((__unused_webpack_module, exports) => {
  22072. Object.defineProperty(exports, "__esModule", ({
  22073. value: true
  22074. }));
  22075. exports.getEncoding = getEncoding;
  22076. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  22077. 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"];
  22078. exports.ExpertEncoding = ExpertEncoding;
  22079. 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", "", "", "", ""];
  22080. 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"];
  22081. exports.MacRomanEncoding = MacRomanEncoding;
  22082. 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", "", "", "", ""];
  22083. exports.StandardEncoding = StandardEncoding;
  22084. 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"];
  22085. exports.WinAnsiEncoding = WinAnsiEncoding;
  22086. 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", ""];
  22087. exports.SymbolSetEncoding = SymbolSetEncoding;
  22088. 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", ""];
  22089. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  22090. function getEncoding(encodingName) {
  22091. switch (encodingName) {
  22092. case "WinAnsiEncoding":
  22093. return WinAnsiEncoding;
  22094. case "StandardEncoding":
  22095. return StandardEncoding;
  22096. case "MacRomanEncoding":
  22097. return MacRomanEncoding;
  22098. case "SymbolSetEncoding":
  22099. return SymbolSetEncoding;
  22100. case "ZapfDingbatsEncoding":
  22101. return ZapfDingbatsEncoding;
  22102. case "ExpertEncoding":
  22103. return ExpertEncoding;
  22104. case "MacExpertEncoding":
  22105. return MacExpertEncoding;
  22106. default:
  22107. return null;
  22108. }
  22109. }
  22110. /***/ }),
  22111. /* 38 */
  22112. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22113. Object.defineProperty(exports, "__esModule", ({
  22114. value: true
  22115. }));
  22116. exports.getFontType = getFontType;
  22117. exports.recoverGlyphName = recoverGlyphName;
  22118. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  22119. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  22120. var _util = __w_pdfjs_require__(2);
  22121. var _encodings = __w_pdfjs_require__(37);
  22122. var _glyphlist = __w_pdfjs_require__(39);
  22123. var _unicode = __w_pdfjs_require__(40);
  22124. const SEAC_ANALYSIS_ENABLED = true;
  22125. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  22126. const FontFlags = {
  22127. FixedPitch: 1,
  22128. Serif: 2,
  22129. Symbolic: 4,
  22130. Script: 8,
  22131. Nonsymbolic: 32,
  22132. Italic: 64,
  22133. AllCap: 65536,
  22134. SmallCap: 131072,
  22135. ForceBold: 262144
  22136. };
  22137. exports.FontFlags = FontFlags;
  22138. 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"];
  22139. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  22140. function getFontType(type, subtype) {
  22141. switch (type) {
  22142. case "Type1":
  22143. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  22144. case "CIDFontType0":
  22145. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  22146. case "OpenType":
  22147. return _util.FontType.OPENTYPE;
  22148. case "TrueType":
  22149. return _util.FontType.TRUETYPE;
  22150. case "CIDFontType2":
  22151. return _util.FontType.CIDFONTTYPE2;
  22152. case "MMType1":
  22153. return _util.FontType.MMTYPE1;
  22154. case "Type0":
  22155. return _util.FontType.TYPE0;
  22156. default:
  22157. return _util.FontType.UNKNOWN;
  22158. }
  22159. }
  22160. function recoverGlyphName(name, glyphsUnicodeMap) {
  22161. if (glyphsUnicodeMap[name] !== undefined) {
  22162. return name;
  22163. }
  22164. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  22165. if (unicode !== -1) {
  22166. for (const key in glyphsUnicodeMap) {
  22167. if (glyphsUnicodeMap[key] === unicode) {
  22168. return key;
  22169. }
  22170. }
  22171. }
  22172. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  22173. return name;
  22174. }
  22175. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  22176. const charCodeToGlyphId = Object.create(null);
  22177. let glyphId, charCode, baseEncoding;
  22178. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  22179. if (properties.baseEncodingName) {
  22180. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22181. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22182. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22183. if (glyphId >= 0) {
  22184. charCodeToGlyphId[charCode] = glyphId;
  22185. } else {
  22186. charCodeToGlyphId[charCode] = 0;
  22187. }
  22188. }
  22189. } else if (isSymbolicFont) {
  22190. for (charCode in builtInEncoding) {
  22191. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  22192. }
  22193. } else {
  22194. baseEncoding = _encodings.StandardEncoding;
  22195. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22196. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22197. if (glyphId >= 0) {
  22198. charCodeToGlyphId[charCode] = glyphId;
  22199. } else {
  22200. charCodeToGlyphId[charCode] = 0;
  22201. }
  22202. }
  22203. }
  22204. const differences = properties.differences;
  22205. let glyphsUnicodeMap;
  22206. if (differences) {
  22207. for (charCode in differences) {
  22208. const glyphName = differences[charCode];
  22209. glyphId = glyphNames.indexOf(glyphName);
  22210. if (glyphId === -1) {
  22211. if (!glyphsUnicodeMap) {
  22212. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22213. }
  22214. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  22215. if (standardGlyphName !== glyphName) {
  22216. glyphId = glyphNames.indexOf(standardGlyphName);
  22217. }
  22218. }
  22219. if (glyphId >= 0) {
  22220. charCodeToGlyphId[charCode] = glyphId;
  22221. } else {
  22222. charCodeToGlyphId[charCode] = 0;
  22223. }
  22224. }
  22225. }
  22226. return charCodeToGlyphId;
  22227. }
  22228. /***/ }),
  22229. /* 39 */
  22230. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  22231. __w_pdfjs_require__.r(__webpack_exports__);
  22232. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  22233. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  22234. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  22235. /* harmony export */ });
  22236. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  22237. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  22238. return [
  22239. "A",
  22240. 0x0041,
  22241. "AE",
  22242. 0x00c6,
  22243. "AEacute",
  22244. 0x01fc,
  22245. "AEmacron",
  22246. 0x01e2,
  22247. "AEsmall",
  22248. 0xf7e6,
  22249. "Aacute",
  22250. 0x00c1,
  22251. "Aacutesmall",
  22252. 0xf7e1,
  22253. "Abreve",
  22254. 0x0102,
  22255. "Abreveacute",
  22256. 0x1eae,
  22257. "Abrevecyrillic",
  22258. 0x04d0,
  22259. "Abrevedotbelow",
  22260. 0x1eb6,
  22261. "Abrevegrave",
  22262. 0x1eb0,
  22263. "Abrevehookabove",
  22264. 0x1eb2,
  22265. "Abrevetilde",
  22266. 0x1eb4,
  22267. "Acaron",
  22268. 0x01cd,
  22269. "Acircle",
  22270. 0x24b6,
  22271. "Acircumflex",
  22272. 0x00c2,
  22273. "Acircumflexacute",
  22274. 0x1ea4,
  22275. "Acircumflexdotbelow",
  22276. 0x1eac,
  22277. "Acircumflexgrave",
  22278. 0x1ea6,
  22279. "Acircumflexhookabove",
  22280. 0x1ea8,
  22281. "Acircumflexsmall",
  22282. 0xf7e2,
  22283. "Acircumflextilde",
  22284. 0x1eaa,
  22285. "Acute",
  22286. 0xf6c9,
  22287. "Acutesmall",
  22288. 0xf7b4,
  22289. "Acyrillic",
  22290. 0x0410,
  22291. "Adblgrave",
  22292. 0x0200,
  22293. "Adieresis",
  22294. 0x00c4,
  22295. "Adieresiscyrillic",
  22296. 0x04d2,
  22297. "Adieresismacron",
  22298. 0x01de,
  22299. "Adieresissmall",
  22300. 0xf7e4,
  22301. "Adotbelow",
  22302. 0x1ea0,
  22303. "Adotmacron",
  22304. 0x01e0,
  22305. "Agrave",
  22306. 0x00c0,
  22307. "Agravesmall",
  22308. 0xf7e0,
  22309. "Ahookabove",
  22310. 0x1ea2,
  22311. "Aiecyrillic",
  22312. 0x04d4,
  22313. "Ainvertedbreve",
  22314. 0x0202,
  22315. "Alpha",
  22316. 0x0391,
  22317. "Alphatonos",
  22318. 0x0386,
  22319. "Amacron",
  22320. 0x0100,
  22321. "Amonospace",
  22322. 0xff21,
  22323. "Aogonek",
  22324. 0x0104,
  22325. "Aring",
  22326. 0x00c5,
  22327. "Aringacute",
  22328. 0x01fa,
  22329. "Aringbelow",
  22330. 0x1e00,
  22331. "Aringsmall",
  22332. 0xf7e5,
  22333. "Asmall",
  22334. 0xf761,
  22335. "Atilde",
  22336. 0x00c3,
  22337. "Atildesmall",
  22338. 0xf7e3,
  22339. "Aybarmenian",
  22340. 0x0531,
  22341. "B",
  22342. 0x0042,
  22343. "Bcircle",
  22344. 0x24b7,
  22345. "Bdotaccent",
  22346. 0x1e02,
  22347. "Bdotbelow",
  22348. 0x1e04,
  22349. "Becyrillic",
  22350. 0x0411,
  22351. "Benarmenian",
  22352. 0x0532,
  22353. "Beta",
  22354. 0x0392,
  22355. "Bhook",
  22356. 0x0181,
  22357. "Blinebelow",
  22358. 0x1e06,
  22359. "Bmonospace",
  22360. 0xff22,
  22361. "Brevesmall",
  22362. 0xf6f4,
  22363. "Bsmall",
  22364. 0xf762,
  22365. "Btopbar",
  22366. 0x0182,
  22367. "C",
  22368. 0x0043,
  22369. "Caarmenian",
  22370. 0x053e,
  22371. "Cacute",
  22372. 0x0106,
  22373. "Caron",
  22374. 0xf6ca,
  22375. "Caronsmall",
  22376. 0xf6f5,
  22377. "Ccaron",
  22378. 0x010c,
  22379. "Ccedilla",
  22380. 0x00c7,
  22381. "Ccedillaacute",
  22382. 0x1e08,
  22383. "Ccedillasmall",
  22384. 0xf7e7,
  22385. "Ccircle",
  22386. 0x24b8,
  22387. "Ccircumflex",
  22388. 0x0108,
  22389. "Cdot",
  22390. 0x010a,
  22391. "Cdotaccent",
  22392. 0x010a,
  22393. "Cedillasmall",
  22394. 0xf7b8,
  22395. "Chaarmenian",
  22396. 0x0549,
  22397. "Cheabkhasiancyrillic",
  22398. 0x04bc,
  22399. "Checyrillic",
  22400. 0x0427,
  22401. "Chedescenderabkhasiancyrillic",
  22402. 0x04be,
  22403. "Chedescendercyrillic",
  22404. 0x04b6,
  22405. "Chedieresiscyrillic",
  22406. 0x04f4,
  22407. "Cheharmenian",
  22408. 0x0543,
  22409. "Chekhakassiancyrillic",
  22410. 0x04cb,
  22411. "Cheverticalstrokecyrillic",
  22412. 0x04b8,
  22413. "Chi",
  22414. 0x03a7,
  22415. "Chook",
  22416. 0x0187,
  22417. "Circumflexsmall",
  22418. 0xf6f6,
  22419. "Cmonospace",
  22420. 0xff23,
  22421. "Coarmenian",
  22422. 0x0551,
  22423. "Csmall",
  22424. 0xf763,
  22425. "D",
  22426. 0x0044,
  22427. "DZ",
  22428. 0x01f1,
  22429. "DZcaron",
  22430. 0x01c4,
  22431. "Daarmenian",
  22432. 0x0534,
  22433. "Dafrican",
  22434. 0x0189,
  22435. "Dcaron",
  22436. 0x010e,
  22437. "Dcedilla",
  22438. 0x1e10,
  22439. "Dcircle",
  22440. 0x24b9,
  22441. "Dcircumflexbelow",
  22442. 0x1e12,
  22443. "Dcroat",
  22444. 0x0110,
  22445. "Ddotaccent",
  22446. 0x1e0a,
  22447. "Ddotbelow",
  22448. 0x1e0c,
  22449. "Decyrillic",
  22450. 0x0414,
  22451. "Deicoptic",
  22452. 0x03ee,
  22453. "Delta",
  22454. 0x2206,
  22455. "Deltagreek",
  22456. 0x0394,
  22457. "Dhook",
  22458. 0x018a,
  22459. "Dieresis",
  22460. 0xf6cb,
  22461. "DieresisAcute",
  22462. 0xf6cc,
  22463. "DieresisGrave",
  22464. 0xf6cd,
  22465. "Dieresissmall",
  22466. 0xf7a8,
  22467. "Digammagreek",
  22468. 0x03dc,
  22469. "Djecyrillic",
  22470. 0x0402,
  22471. "Dlinebelow",
  22472. 0x1e0e,
  22473. "Dmonospace",
  22474. 0xff24,
  22475. "Dotaccentsmall",
  22476. 0xf6f7,
  22477. "Dslash",
  22478. 0x0110,
  22479. "Dsmall",
  22480. 0xf764,
  22481. "Dtopbar",
  22482. 0x018b,
  22483. "Dz",
  22484. 0x01f2,
  22485. "Dzcaron",
  22486. 0x01c5,
  22487. "Dzeabkhasiancyrillic",
  22488. 0x04e0,
  22489. "Dzecyrillic",
  22490. 0x0405,
  22491. "Dzhecyrillic",
  22492. 0x040f,
  22493. "E",
  22494. 0x0045,
  22495. "Eacute",
  22496. 0x00c9,
  22497. "Eacutesmall",
  22498. 0xf7e9,
  22499. "Ebreve",
  22500. 0x0114,
  22501. "Ecaron",
  22502. 0x011a,
  22503. "Ecedillabreve",
  22504. 0x1e1c,
  22505. "Echarmenian",
  22506. 0x0535,
  22507. "Ecircle",
  22508. 0x24ba,
  22509. "Ecircumflex",
  22510. 0x00ca,
  22511. "Ecircumflexacute",
  22512. 0x1ebe,
  22513. "Ecircumflexbelow",
  22514. 0x1e18,
  22515. "Ecircumflexdotbelow",
  22516. 0x1ec6,
  22517. "Ecircumflexgrave",
  22518. 0x1ec0,
  22519. "Ecircumflexhookabove",
  22520. 0x1ec2,
  22521. "Ecircumflexsmall",
  22522. 0xf7ea,
  22523. "Ecircumflextilde",
  22524. 0x1ec4,
  22525. "Ecyrillic",
  22526. 0x0404,
  22527. "Edblgrave",
  22528. 0x0204,
  22529. "Edieresis",
  22530. 0x00cb,
  22531. "Edieresissmall",
  22532. 0xf7eb,
  22533. "Edot",
  22534. 0x0116,
  22535. "Edotaccent",
  22536. 0x0116,
  22537. "Edotbelow",
  22538. 0x1eb8,
  22539. "Efcyrillic",
  22540. 0x0424,
  22541. "Egrave",
  22542. 0x00c8,
  22543. "Egravesmall",
  22544. 0xf7e8,
  22545. "Eharmenian",
  22546. 0x0537,
  22547. "Ehookabove",
  22548. 0x1eba,
  22549. "Eightroman",
  22550. 0x2167,
  22551. "Einvertedbreve",
  22552. 0x0206,
  22553. "Eiotifiedcyrillic",
  22554. 0x0464,
  22555. "Elcyrillic",
  22556. 0x041b,
  22557. "Elevenroman",
  22558. 0x216a,
  22559. "Emacron",
  22560. 0x0112,
  22561. "Emacronacute",
  22562. 0x1e16,
  22563. "Emacrongrave",
  22564. 0x1e14,
  22565. "Emcyrillic",
  22566. 0x041c,
  22567. "Emonospace",
  22568. 0xff25,
  22569. "Encyrillic",
  22570. 0x041d,
  22571. "Endescendercyrillic",
  22572. 0x04a2,
  22573. "Eng",
  22574. 0x014a,
  22575. "Enghecyrillic",
  22576. 0x04a4,
  22577. "Enhookcyrillic",
  22578. 0x04c7,
  22579. "Eogonek",
  22580. 0x0118,
  22581. "Eopen",
  22582. 0x0190,
  22583. "Epsilon",
  22584. 0x0395,
  22585. "Epsilontonos",
  22586. 0x0388,
  22587. "Ercyrillic",
  22588. 0x0420,
  22589. "Ereversed",
  22590. 0x018e,
  22591. "Ereversedcyrillic",
  22592. 0x042d,
  22593. "Escyrillic",
  22594. 0x0421,
  22595. "Esdescendercyrillic",
  22596. 0x04aa,
  22597. "Esh",
  22598. 0x01a9,
  22599. "Esmall",
  22600. 0xf765,
  22601. "Eta",
  22602. 0x0397,
  22603. "Etarmenian",
  22604. 0x0538,
  22605. "Etatonos",
  22606. 0x0389,
  22607. "Eth",
  22608. 0x00d0,
  22609. "Ethsmall",
  22610. 0xf7f0,
  22611. "Etilde",
  22612. 0x1ebc,
  22613. "Etildebelow",
  22614. 0x1e1a,
  22615. "Euro",
  22616. 0x20ac,
  22617. "Ezh",
  22618. 0x01b7,
  22619. "Ezhcaron",
  22620. 0x01ee,
  22621. "Ezhreversed",
  22622. 0x01b8,
  22623. "F",
  22624. 0x0046,
  22625. "Fcircle",
  22626. 0x24bb,
  22627. "Fdotaccent",
  22628. 0x1e1e,
  22629. "Feharmenian",
  22630. 0x0556,
  22631. "Feicoptic",
  22632. 0x03e4,
  22633. "Fhook",
  22634. 0x0191,
  22635. "Fitacyrillic",
  22636. 0x0472,
  22637. "Fiveroman",
  22638. 0x2164,
  22639. "Fmonospace",
  22640. 0xff26,
  22641. "Fourroman",
  22642. 0x2163,
  22643. "Fsmall",
  22644. 0xf766,
  22645. "G",
  22646. 0x0047,
  22647. "GBsquare",
  22648. 0x3387,
  22649. "Gacute",
  22650. 0x01f4,
  22651. "Gamma",
  22652. 0x0393,
  22653. "Gammaafrican",
  22654. 0x0194,
  22655. "Gangiacoptic",
  22656. 0x03ea,
  22657. "Gbreve",
  22658. 0x011e,
  22659. "Gcaron",
  22660. 0x01e6,
  22661. "Gcedilla",
  22662. 0x0122,
  22663. "Gcircle",
  22664. 0x24bc,
  22665. "Gcircumflex",
  22666. 0x011c,
  22667. "Gcommaaccent",
  22668. 0x0122,
  22669. "Gdot",
  22670. 0x0120,
  22671. "Gdotaccent",
  22672. 0x0120,
  22673. "Gecyrillic",
  22674. 0x0413,
  22675. "Ghadarmenian",
  22676. 0x0542,
  22677. "Ghemiddlehookcyrillic",
  22678. 0x0494,
  22679. "Ghestrokecyrillic",
  22680. 0x0492,
  22681. "Gheupturncyrillic",
  22682. 0x0490,
  22683. "Ghook",
  22684. 0x0193,
  22685. "Gimarmenian",
  22686. 0x0533,
  22687. "Gjecyrillic",
  22688. 0x0403,
  22689. "Gmacron",
  22690. 0x1e20,
  22691. "Gmonospace",
  22692. 0xff27,
  22693. "Grave",
  22694. 0xf6ce,
  22695. "Gravesmall",
  22696. 0xf760,
  22697. "Gsmall",
  22698. 0xf767,
  22699. "Gsmallhook",
  22700. 0x029b,
  22701. "Gstroke",
  22702. 0x01e4,
  22703. "H",
  22704. 0x0048,
  22705. "H18533",
  22706. 0x25cf,
  22707. "H18543",
  22708. 0x25aa,
  22709. "H18551",
  22710. 0x25ab,
  22711. "H22073",
  22712. 0x25a1,
  22713. "HPsquare",
  22714. 0x33cb,
  22715. "Haabkhasiancyrillic",
  22716. 0x04a8,
  22717. "Hadescendercyrillic",
  22718. 0x04b2,
  22719. "Hardsigncyrillic",
  22720. 0x042a,
  22721. "Hbar",
  22722. 0x0126,
  22723. "Hbrevebelow",
  22724. 0x1e2a,
  22725. "Hcedilla",
  22726. 0x1e28,
  22727. "Hcircle",
  22728. 0x24bd,
  22729. "Hcircumflex",
  22730. 0x0124,
  22731. "Hdieresis",
  22732. 0x1e26,
  22733. "Hdotaccent",
  22734. 0x1e22,
  22735. "Hdotbelow",
  22736. 0x1e24,
  22737. "Hmonospace",
  22738. 0xff28,
  22739. "Hoarmenian",
  22740. 0x0540,
  22741. "Horicoptic",
  22742. 0x03e8,
  22743. "Hsmall",
  22744. 0xf768,
  22745. "Hungarumlaut",
  22746. 0xf6cf,
  22747. "Hungarumlautsmall",
  22748. 0xf6f8,
  22749. "Hzsquare",
  22750. 0x3390,
  22751. "I",
  22752. 0x0049,
  22753. "IAcyrillic",
  22754. 0x042f,
  22755. "IJ",
  22756. 0x0132,
  22757. "IUcyrillic",
  22758. 0x042e,
  22759. "Iacute",
  22760. 0x00cd,
  22761. "Iacutesmall",
  22762. 0xf7ed,
  22763. "Ibreve",
  22764. 0x012c,
  22765. "Icaron",
  22766. 0x01cf,
  22767. "Icircle",
  22768. 0x24be,
  22769. "Icircumflex",
  22770. 0x00ce,
  22771. "Icircumflexsmall",
  22772. 0xf7ee,
  22773. "Icyrillic",
  22774. 0x0406,
  22775. "Idblgrave",
  22776. 0x0208,
  22777. "Idieresis",
  22778. 0x00cf,
  22779. "Idieresisacute",
  22780. 0x1e2e,
  22781. "Idieresiscyrillic",
  22782. 0x04e4,
  22783. "Idieresissmall",
  22784. 0xf7ef,
  22785. "Idot",
  22786. 0x0130,
  22787. "Idotaccent",
  22788. 0x0130,
  22789. "Idotbelow",
  22790. 0x1eca,
  22791. "Iebrevecyrillic",
  22792. 0x04d6,
  22793. "Iecyrillic",
  22794. 0x0415,
  22795. "Ifraktur",
  22796. 0x2111,
  22797. "Igrave",
  22798. 0x00cc,
  22799. "Igravesmall",
  22800. 0xf7ec,
  22801. "Ihookabove",
  22802. 0x1ec8,
  22803. "Iicyrillic",
  22804. 0x0418,
  22805. "Iinvertedbreve",
  22806. 0x020a,
  22807. "Iishortcyrillic",
  22808. 0x0419,
  22809. "Imacron",
  22810. 0x012a,
  22811. "Imacroncyrillic",
  22812. 0x04e2,
  22813. "Imonospace",
  22814. 0xff29,
  22815. "Iniarmenian",
  22816. 0x053b,
  22817. "Iocyrillic",
  22818. 0x0401,
  22819. "Iogonek",
  22820. 0x012e,
  22821. "Iota",
  22822. 0x0399,
  22823. "Iotaafrican",
  22824. 0x0196,
  22825. "Iotadieresis",
  22826. 0x03aa,
  22827. "Iotatonos",
  22828. 0x038a,
  22829. "Ismall",
  22830. 0xf769,
  22831. "Istroke",
  22832. 0x0197,
  22833. "Itilde",
  22834. 0x0128,
  22835. "Itildebelow",
  22836. 0x1e2c,
  22837. "Izhitsacyrillic",
  22838. 0x0474,
  22839. "Izhitsadblgravecyrillic",
  22840. 0x0476,
  22841. "J",
  22842. 0x004a,
  22843. "Jaarmenian",
  22844. 0x0541,
  22845. "Jcircle",
  22846. 0x24bf,
  22847. "Jcircumflex",
  22848. 0x0134,
  22849. "Jecyrillic",
  22850. 0x0408,
  22851. "Jheharmenian",
  22852. 0x054b,
  22853. "Jmonospace",
  22854. 0xff2a,
  22855. "Jsmall",
  22856. 0xf76a,
  22857. "K",
  22858. 0x004b,
  22859. "KBsquare",
  22860. 0x3385,
  22861. "KKsquare",
  22862. 0x33cd,
  22863. "Kabashkircyrillic",
  22864. 0x04a0,
  22865. "Kacute",
  22866. 0x1e30,
  22867. "Kacyrillic",
  22868. 0x041a,
  22869. "Kadescendercyrillic",
  22870. 0x049a,
  22871. "Kahookcyrillic",
  22872. 0x04c3,
  22873. "Kappa",
  22874. 0x039a,
  22875. "Kastrokecyrillic",
  22876. 0x049e,
  22877. "Kaverticalstrokecyrillic",
  22878. 0x049c,
  22879. "Kcaron",
  22880. 0x01e8,
  22881. "Kcedilla",
  22882. 0x0136,
  22883. "Kcircle",
  22884. 0x24c0,
  22885. "Kcommaaccent",
  22886. 0x0136,
  22887. "Kdotbelow",
  22888. 0x1e32,
  22889. "Keharmenian",
  22890. 0x0554,
  22891. "Kenarmenian",
  22892. 0x053f,
  22893. "Khacyrillic",
  22894. 0x0425,
  22895. "Kheicoptic",
  22896. 0x03e6,
  22897. "Khook",
  22898. 0x0198,
  22899. "Kjecyrillic",
  22900. 0x040c,
  22901. "Klinebelow",
  22902. 0x1e34,
  22903. "Kmonospace",
  22904. 0xff2b,
  22905. "Koppacyrillic",
  22906. 0x0480,
  22907. "Koppagreek",
  22908. 0x03de,
  22909. "Ksicyrillic",
  22910. 0x046e,
  22911. "Ksmall",
  22912. 0xf76b,
  22913. "L",
  22914. 0x004c,
  22915. "LJ",
  22916. 0x01c7,
  22917. "LL",
  22918. 0xf6bf,
  22919. "Lacute",
  22920. 0x0139,
  22921. "Lambda",
  22922. 0x039b,
  22923. "Lcaron",
  22924. 0x013d,
  22925. "Lcedilla",
  22926. 0x013b,
  22927. "Lcircle",
  22928. 0x24c1,
  22929. "Lcircumflexbelow",
  22930. 0x1e3c,
  22931. "Lcommaaccent",
  22932. 0x013b,
  22933. "Ldot",
  22934. 0x013f,
  22935. "Ldotaccent",
  22936. 0x013f,
  22937. "Ldotbelow",
  22938. 0x1e36,
  22939. "Ldotbelowmacron",
  22940. 0x1e38,
  22941. "Liwnarmenian",
  22942. 0x053c,
  22943. "Lj",
  22944. 0x01c8,
  22945. "Ljecyrillic",
  22946. 0x0409,
  22947. "Llinebelow",
  22948. 0x1e3a,
  22949. "Lmonospace",
  22950. 0xff2c,
  22951. "Lslash",
  22952. 0x0141,
  22953. "Lslashsmall",
  22954. 0xf6f9,
  22955. "Lsmall",
  22956. 0xf76c,
  22957. "M",
  22958. 0x004d,
  22959. "MBsquare",
  22960. 0x3386,
  22961. "Macron",
  22962. 0xf6d0,
  22963. "Macronsmall",
  22964. 0xf7af,
  22965. "Macute",
  22966. 0x1e3e,
  22967. "Mcircle",
  22968. 0x24c2,
  22969. "Mdotaccent",
  22970. 0x1e40,
  22971. "Mdotbelow",
  22972. 0x1e42,
  22973. "Menarmenian",
  22974. 0x0544,
  22975. "Mmonospace",
  22976. 0xff2d,
  22977. "Msmall",
  22978. 0xf76d,
  22979. "Mturned",
  22980. 0x019c,
  22981. "Mu",
  22982. 0x039c,
  22983. "N",
  22984. 0x004e,
  22985. "NJ",
  22986. 0x01ca,
  22987. "Nacute",
  22988. 0x0143,
  22989. "Ncaron",
  22990. 0x0147,
  22991. "Ncedilla",
  22992. 0x0145,
  22993. "Ncircle",
  22994. 0x24c3,
  22995. "Ncircumflexbelow",
  22996. 0x1e4a,
  22997. "Ncommaaccent",
  22998. 0x0145,
  22999. "Ndotaccent",
  23000. 0x1e44,
  23001. "Ndotbelow",
  23002. 0x1e46,
  23003. "Nhookleft",
  23004. 0x019d,
  23005. "Nineroman",
  23006. 0x2168,
  23007. "Nj",
  23008. 0x01cb,
  23009. "Njecyrillic",
  23010. 0x040a,
  23011. "Nlinebelow",
  23012. 0x1e48,
  23013. "Nmonospace",
  23014. 0xff2e,
  23015. "Nowarmenian",
  23016. 0x0546,
  23017. "Nsmall",
  23018. 0xf76e,
  23019. "Ntilde",
  23020. 0x00d1,
  23021. "Ntildesmall",
  23022. 0xf7f1,
  23023. "Nu",
  23024. 0x039d,
  23025. "O",
  23026. 0x004f,
  23027. "OE",
  23028. 0x0152,
  23029. "OEsmall",
  23030. 0xf6fa,
  23031. "Oacute",
  23032. 0x00d3,
  23033. "Oacutesmall",
  23034. 0xf7f3,
  23035. "Obarredcyrillic",
  23036. 0x04e8,
  23037. "Obarreddieresiscyrillic",
  23038. 0x04ea,
  23039. "Obreve",
  23040. 0x014e,
  23041. "Ocaron",
  23042. 0x01d1,
  23043. "Ocenteredtilde",
  23044. 0x019f,
  23045. "Ocircle",
  23046. 0x24c4,
  23047. "Ocircumflex",
  23048. 0x00d4,
  23049. "Ocircumflexacute",
  23050. 0x1ed0,
  23051. "Ocircumflexdotbelow",
  23052. 0x1ed8,
  23053. "Ocircumflexgrave",
  23054. 0x1ed2,
  23055. "Ocircumflexhookabove",
  23056. 0x1ed4,
  23057. "Ocircumflexsmall",
  23058. 0xf7f4,
  23059. "Ocircumflextilde",
  23060. 0x1ed6,
  23061. "Ocyrillic",
  23062. 0x041e,
  23063. "Odblacute",
  23064. 0x0150,
  23065. "Odblgrave",
  23066. 0x020c,
  23067. "Odieresis",
  23068. 0x00d6,
  23069. "Odieresiscyrillic",
  23070. 0x04e6,
  23071. "Odieresissmall",
  23072. 0xf7f6,
  23073. "Odotbelow",
  23074. 0x1ecc,
  23075. "Ogoneksmall",
  23076. 0xf6fb,
  23077. "Ograve",
  23078. 0x00d2,
  23079. "Ogravesmall",
  23080. 0xf7f2,
  23081. "Oharmenian",
  23082. 0x0555,
  23083. "Ohm",
  23084. 0x2126,
  23085. "Ohookabove",
  23086. 0x1ece,
  23087. "Ohorn",
  23088. 0x01a0,
  23089. "Ohornacute",
  23090. 0x1eda,
  23091. "Ohorndotbelow",
  23092. 0x1ee2,
  23093. "Ohorngrave",
  23094. 0x1edc,
  23095. "Ohornhookabove",
  23096. 0x1ede,
  23097. "Ohorntilde",
  23098. 0x1ee0,
  23099. "Ohungarumlaut",
  23100. 0x0150,
  23101. "Oi",
  23102. 0x01a2,
  23103. "Oinvertedbreve",
  23104. 0x020e,
  23105. "Omacron",
  23106. 0x014c,
  23107. "Omacronacute",
  23108. 0x1e52,
  23109. "Omacrongrave",
  23110. 0x1e50,
  23111. "Omega",
  23112. 0x2126,
  23113. "Omegacyrillic",
  23114. 0x0460,
  23115. "Omegagreek",
  23116. 0x03a9,
  23117. "Omegaroundcyrillic",
  23118. 0x047a,
  23119. "Omegatitlocyrillic",
  23120. 0x047c,
  23121. "Omegatonos",
  23122. 0x038f,
  23123. "Omicron",
  23124. 0x039f,
  23125. "Omicrontonos",
  23126. 0x038c,
  23127. "Omonospace",
  23128. 0xff2f,
  23129. "Oneroman",
  23130. 0x2160,
  23131. "Oogonek",
  23132. 0x01ea,
  23133. "Oogonekmacron",
  23134. 0x01ec,
  23135. "Oopen",
  23136. 0x0186,
  23137. "Oslash",
  23138. 0x00d8,
  23139. "Oslashacute",
  23140. 0x01fe,
  23141. "Oslashsmall",
  23142. 0xf7f8,
  23143. "Osmall",
  23144. 0xf76f,
  23145. "Ostrokeacute",
  23146. 0x01fe,
  23147. "Otcyrillic",
  23148. 0x047e,
  23149. "Otilde",
  23150. 0x00d5,
  23151. "Otildeacute",
  23152. 0x1e4c,
  23153. "Otildedieresis",
  23154. 0x1e4e,
  23155. "Otildesmall",
  23156. 0xf7f5,
  23157. "P",
  23158. 0x0050,
  23159. "Pacute",
  23160. 0x1e54,
  23161. "Pcircle",
  23162. 0x24c5,
  23163. "Pdotaccent",
  23164. 0x1e56,
  23165. "Pecyrillic",
  23166. 0x041f,
  23167. "Peharmenian",
  23168. 0x054a,
  23169. "Pemiddlehookcyrillic",
  23170. 0x04a6,
  23171. "Phi",
  23172. 0x03a6,
  23173. "Phook",
  23174. 0x01a4,
  23175. "Pi",
  23176. 0x03a0,
  23177. "Piwrarmenian",
  23178. 0x0553,
  23179. "Pmonospace",
  23180. 0xff30,
  23181. "Psi",
  23182. 0x03a8,
  23183. "Psicyrillic",
  23184. 0x0470,
  23185. "Psmall",
  23186. 0xf770,
  23187. "Q",
  23188. 0x0051,
  23189. "Qcircle",
  23190. 0x24c6,
  23191. "Qmonospace",
  23192. 0xff31,
  23193. "Qsmall",
  23194. 0xf771,
  23195. "R",
  23196. 0x0052,
  23197. "Raarmenian",
  23198. 0x054c,
  23199. "Racute",
  23200. 0x0154,
  23201. "Rcaron",
  23202. 0x0158,
  23203. "Rcedilla",
  23204. 0x0156,
  23205. "Rcircle",
  23206. 0x24c7,
  23207. "Rcommaaccent",
  23208. 0x0156,
  23209. "Rdblgrave",
  23210. 0x0210,
  23211. "Rdotaccent",
  23212. 0x1e58,
  23213. "Rdotbelow",
  23214. 0x1e5a,
  23215. "Rdotbelowmacron",
  23216. 0x1e5c,
  23217. "Reharmenian",
  23218. 0x0550,
  23219. "Rfraktur",
  23220. 0x211c,
  23221. "Rho",
  23222. 0x03a1,
  23223. "Ringsmall",
  23224. 0xf6fc,
  23225. "Rinvertedbreve",
  23226. 0x0212,
  23227. "Rlinebelow",
  23228. 0x1e5e,
  23229. "Rmonospace",
  23230. 0xff32,
  23231. "Rsmall",
  23232. 0xf772,
  23233. "Rsmallinverted",
  23234. 0x0281,
  23235. "Rsmallinvertedsuperior",
  23236. 0x02b6,
  23237. "S",
  23238. 0x0053,
  23239. "SF010000",
  23240. 0x250c,
  23241. "SF020000",
  23242. 0x2514,
  23243. "SF030000",
  23244. 0x2510,
  23245. "SF040000",
  23246. 0x2518,
  23247. "SF050000",
  23248. 0x253c,
  23249. "SF060000",
  23250. 0x252c,
  23251. "SF070000",
  23252. 0x2534,
  23253. "SF080000",
  23254. 0x251c,
  23255. "SF090000",
  23256. 0x2524,
  23257. "SF100000",
  23258. 0x2500,
  23259. "SF110000",
  23260. 0x2502,
  23261. "SF190000",
  23262. 0x2561,
  23263. "SF200000",
  23264. 0x2562,
  23265. "SF210000",
  23266. 0x2556,
  23267. "SF220000",
  23268. 0x2555,
  23269. "SF230000",
  23270. 0x2563,
  23271. "SF240000",
  23272. 0x2551,
  23273. "SF250000",
  23274. 0x2557,
  23275. "SF260000",
  23276. 0x255d,
  23277. "SF270000",
  23278. 0x255c,
  23279. "SF280000",
  23280. 0x255b,
  23281. "SF360000",
  23282. 0x255e,
  23283. "SF370000",
  23284. 0x255f,
  23285. "SF380000",
  23286. 0x255a,
  23287. "SF390000",
  23288. 0x2554,
  23289. "SF400000",
  23290. 0x2569,
  23291. "SF410000",
  23292. 0x2566,
  23293. "SF420000",
  23294. 0x2560,
  23295. "SF430000",
  23296. 0x2550,
  23297. "SF440000",
  23298. 0x256c,
  23299. "SF450000",
  23300. 0x2567,
  23301. "SF460000",
  23302. 0x2568,
  23303. "SF470000",
  23304. 0x2564,
  23305. "SF480000",
  23306. 0x2565,
  23307. "SF490000",
  23308. 0x2559,
  23309. "SF500000",
  23310. 0x2558,
  23311. "SF510000",
  23312. 0x2552,
  23313. "SF520000",
  23314. 0x2553,
  23315. "SF530000",
  23316. 0x256b,
  23317. "SF540000",
  23318. 0x256a,
  23319. "Sacute",
  23320. 0x015a,
  23321. "Sacutedotaccent",
  23322. 0x1e64,
  23323. "Sampigreek",
  23324. 0x03e0,
  23325. "Scaron",
  23326. 0x0160,
  23327. "Scarondotaccent",
  23328. 0x1e66,
  23329. "Scaronsmall",
  23330. 0xf6fd,
  23331. "Scedilla",
  23332. 0x015e,
  23333. "Schwa",
  23334. 0x018f,
  23335. "Schwacyrillic",
  23336. 0x04d8,
  23337. "Schwadieresiscyrillic",
  23338. 0x04da,
  23339. "Scircle",
  23340. 0x24c8,
  23341. "Scircumflex",
  23342. 0x015c,
  23343. "Scommaaccent",
  23344. 0x0218,
  23345. "Sdotaccent",
  23346. 0x1e60,
  23347. "Sdotbelow",
  23348. 0x1e62,
  23349. "Sdotbelowdotaccent",
  23350. 0x1e68,
  23351. "Seharmenian",
  23352. 0x054d,
  23353. "Sevenroman",
  23354. 0x2166,
  23355. "Shaarmenian",
  23356. 0x0547,
  23357. "Shacyrillic",
  23358. 0x0428,
  23359. "Shchacyrillic",
  23360. 0x0429,
  23361. "Sheicoptic",
  23362. 0x03e2,
  23363. "Shhacyrillic",
  23364. 0x04ba,
  23365. "Shimacoptic",
  23366. 0x03ec,
  23367. "Sigma",
  23368. 0x03a3,
  23369. "Sixroman",
  23370. 0x2165,
  23371. "Smonospace",
  23372. 0xff33,
  23373. "Softsigncyrillic",
  23374. 0x042c,
  23375. "Ssmall",
  23376. 0xf773,
  23377. "Stigmagreek",
  23378. 0x03da,
  23379. "T",
  23380. 0x0054,
  23381. "Tau",
  23382. 0x03a4,
  23383. "Tbar",
  23384. 0x0166,
  23385. "Tcaron",
  23386. 0x0164,
  23387. "Tcedilla",
  23388. 0x0162,
  23389. "Tcircle",
  23390. 0x24c9,
  23391. "Tcircumflexbelow",
  23392. 0x1e70,
  23393. "Tcommaaccent",
  23394. 0x0162,
  23395. "Tdotaccent",
  23396. 0x1e6a,
  23397. "Tdotbelow",
  23398. 0x1e6c,
  23399. "Tecyrillic",
  23400. 0x0422,
  23401. "Tedescendercyrillic",
  23402. 0x04ac,
  23403. "Tenroman",
  23404. 0x2169,
  23405. "Tetsecyrillic",
  23406. 0x04b4,
  23407. "Theta",
  23408. 0x0398,
  23409. "Thook",
  23410. 0x01ac,
  23411. "Thorn",
  23412. 0x00de,
  23413. "Thornsmall",
  23414. 0xf7fe,
  23415. "Threeroman",
  23416. 0x2162,
  23417. "Tildesmall",
  23418. 0xf6fe,
  23419. "Tiwnarmenian",
  23420. 0x054f,
  23421. "Tlinebelow",
  23422. 0x1e6e,
  23423. "Tmonospace",
  23424. 0xff34,
  23425. "Toarmenian",
  23426. 0x0539,
  23427. "Tonefive",
  23428. 0x01bc,
  23429. "Tonesix",
  23430. 0x0184,
  23431. "Tonetwo",
  23432. 0x01a7,
  23433. "Tretroflexhook",
  23434. 0x01ae,
  23435. "Tsecyrillic",
  23436. 0x0426,
  23437. "Tshecyrillic",
  23438. 0x040b,
  23439. "Tsmall",
  23440. 0xf774,
  23441. "Twelveroman",
  23442. 0x216b,
  23443. "Tworoman",
  23444. 0x2161,
  23445. "U",
  23446. 0x0055,
  23447. "Uacute",
  23448. 0x00da,
  23449. "Uacutesmall",
  23450. 0xf7fa,
  23451. "Ubreve",
  23452. 0x016c,
  23453. "Ucaron",
  23454. 0x01d3,
  23455. "Ucircle",
  23456. 0x24ca,
  23457. "Ucircumflex",
  23458. 0x00db,
  23459. "Ucircumflexbelow",
  23460. 0x1e76,
  23461. "Ucircumflexsmall",
  23462. 0xf7fb,
  23463. "Ucyrillic",
  23464. 0x0423,
  23465. "Udblacute",
  23466. 0x0170,
  23467. "Udblgrave",
  23468. 0x0214,
  23469. "Udieresis",
  23470. 0x00dc,
  23471. "Udieresisacute",
  23472. 0x01d7,
  23473. "Udieresisbelow",
  23474. 0x1e72,
  23475. "Udieresiscaron",
  23476. 0x01d9,
  23477. "Udieresiscyrillic",
  23478. 0x04f0,
  23479. "Udieresisgrave",
  23480. 0x01db,
  23481. "Udieresismacron",
  23482. 0x01d5,
  23483. "Udieresissmall",
  23484. 0xf7fc,
  23485. "Udotbelow",
  23486. 0x1ee4,
  23487. "Ugrave",
  23488. 0x00d9,
  23489. "Ugravesmall",
  23490. 0xf7f9,
  23491. "Uhookabove",
  23492. 0x1ee6,
  23493. "Uhorn",
  23494. 0x01af,
  23495. "Uhornacute",
  23496. 0x1ee8,
  23497. "Uhorndotbelow",
  23498. 0x1ef0,
  23499. "Uhorngrave",
  23500. 0x1eea,
  23501. "Uhornhookabove",
  23502. 0x1eec,
  23503. "Uhorntilde",
  23504. 0x1eee,
  23505. "Uhungarumlaut",
  23506. 0x0170,
  23507. "Uhungarumlautcyrillic",
  23508. 0x04f2,
  23509. "Uinvertedbreve",
  23510. 0x0216,
  23511. "Ukcyrillic",
  23512. 0x0478,
  23513. "Umacron",
  23514. 0x016a,
  23515. "Umacroncyrillic",
  23516. 0x04ee,
  23517. "Umacrondieresis",
  23518. 0x1e7a,
  23519. "Umonospace",
  23520. 0xff35,
  23521. "Uogonek",
  23522. 0x0172,
  23523. "Upsilon",
  23524. 0x03a5,
  23525. "Upsilon1",
  23526. 0x03d2,
  23527. "Upsilonacutehooksymbolgreek",
  23528. 0x03d3,
  23529. "Upsilonafrican",
  23530. 0x01b1,
  23531. "Upsilondieresis",
  23532. 0x03ab,
  23533. "Upsilondieresishooksymbolgreek",
  23534. 0x03d4,
  23535. "Upsilonhooksymbol",
  23536. 0x03d2,
  23537. "Upsilontonos",
  23538. 0x038e,
  23539. "Uring",
  23540. 0x016e,
  23541. "Ushortcyrillic",
  23542. 0x040e,
  23543. "Usmall",
  23544. 0xf775,
  23545. "Ustraightcyrillic",
  23546. 0x04ae,
  23547. "Ustraightstrokecyrillic",
  23548. 0x04b0,
  23549. "Utilde",
  23550. 0x0168,
  23551. "Utildeacute",
  23552. 0x1e78,
  23553. "Utildebelow",
  23554. 0x1e74,
  23555. "V",
  23556. 0x0056,
  23557. "Vcircle",
  23558. 0x24cb,
  23559. "Vdotbelow",
  23560. 0x1e7e,
  23561. "Vecyrillic",
  23562. 0x0412,
  23563. "Vewarmenian",
  23564. 0x054e,
  23565. "Vhook",
  23566. 0x01b2,
  23567. "Vmonospace",
  23568. 0xff36,
  23569. "Voarmenian",
  23570. 0x0548,
  23571. "Vsmall",
  23572. 0xf776,
  23573. "Vtilde",
  23574. 0x1e7c,
  23575. "W",
  23576. 0x0057,
  23577. "Wacute",
  23578. 0x1e82,
  23579. "Wcircle",
  23580. 0x24cc,
  23581. "Wcircumflex",
  23582. 0x0174,
  23583. "Wdieresis",
  23584. 0x1e84,
  23585. "Wdotaccent",
  23586. 0x1e86,
  23587. "Wdotbelow",
  23588. 0x1e88,
  23589. "Wgrave",
  23590. 0x1e80,
  23591. "Wmonospace",
  23592. 0xff37,
  23593. "Wsmall",
  23594. 0xf777,
  23595. "X",
  23596. 0x0058,
  23597. "Xcircle",
  23598. 0x24cd,
  23599. "Xdieresis",
  23600. 0x1e8c,
  23601. "Xdotaccent",
  23602. 0x1e8a,
  23603. "Xeharmenian",
  23604. 0x053d,
  23605. "Xi",
  23606. 0x039e,
  23607. "Xmonospace",
  23608. 0xff38,
  23609. "Xsmall",
  23610. 0xf778,
  23611. "Y",
  23612. 0x0059,
  23613. "Yacute",
  23614. 0x00dd,
  23615. "Yacutesmall",
  23616. 0xf7fd,
  23617. "Yatcyrillic",
  23618. 0x0462,
  23619. "Ycircle",
  23620. 0x24ce,
  23621. "Ycircumflex",
  23622. 0x0176,
  23623. "Ydieresis",
  23624. 0x0178,
  23625. "Ydieresissmall",
  23626. 0xf7ff,
  23627. "Ydotaccent",
  23628. 0x1e8e,
  23629. "Ydotbelow",
  23630. 0x1ef4,
  23631. "Yericyrillic",
  23632. 0x042b,
  23633. "Yerudieresiscyrillic",
  23634. 0x04f8,
  23635. "Ygrave",
  23636. 0x1ef2,
  23637. "Yhook",
  23638. 0x01b3,
  23639. "Yhookabove",
  23640. 0x1ef6,
  23641. "Yiarmenian",
  23642. 0x0545,
  23643. "Yicyrillic",
  23644. 0x0407,
  23645. "Yiwnarmenian",
  23646. 0x0552,
  23647. "Ymonospace",
  23648. 0xff39,
  23649. "Ysmall",
  23650. 0xf779,
  23651. "Ytilde",
  23652. 0x1ef8,
  23653. "Yusbigcyrillic",
  23654. 0x046a,
  23655. "Yusbigiotifiedcyrillic",
  23656. 0x046c,
  23657. "Yuslittlecyrillic",
  23658. 0x0466,
  23659. "Yuslittleiotifiedcyrillic",
  23660. 0x0468,
  23661. "Z",
  23662. 0x005a,
  23663. "Zaarmenian",
  23664. 0x0536,
  23665. "Zacute",
  23666. 0x0179,
  23667. "Zcaron",
  23668. 0x017d,
  23669. "Zcaronsmall",
  23670. 0xf6ff,
  23671. "Zcircle",
  23672. 0x24cf,
  23673. "Zcircumflex",
  23674. 0x1e90,
  23675. "Zdot",
  23676. 0x017b,
  23677. "Zdotaccent",
  23678. 0x017b,
  23679. "Zdotbelow",
  23680. 0x1e92,
  23681. "Zecyrillic",
  23682. 0x0417,
  23683. "Zedescendercyrillic",
  23684. 0x0498,
  23685. "Zedieresiscyrillic",
  23686. 0x04de,
  23687. "Zeta",
  23688. 0x0396,
  23689. "Zhearmenian",
  23690. 0x053a,
  23691. "Zhebrevecyrillic",
  23692. 0x04c1,
  23693. "Zhecyrillic",
  23694. 0x0416,
  23695. "Zhedescendercyrillic",
  23696. 0x0496,
  23697. "Zhedieresiscyrillic",
  23698. 0x04dc,
  23699. "Zlinebelow",
  23700. 0x1e94,
  23701. "Zmonospace",
  23702. 0xff3a,
  23703. "Zsmall",
  23704. 0xf77a,
  23705. "Zstroke",
  23706. 0x01b5,
  23707. "a",
  23708. 0x0061,
  23709. "aabengali",
  23710. 0x0986,
  23711. "aacute",
  23712. 0x00e1,
  23713. "aadeva",
  23714. 0x0906,
  23715. "aagujarati",
  23716. 0x0a86,
  23717. "aagurmukhi",
  23718. 0x0a06,
  23719. "aamatragurmukhi",
  23720. 0x0a3e,
  23721. "aarusquare",
  23722. 0x3303,
  23723. "aavowelsignbengali",
  23724. 0x09be,
  23725. "aavowelsigndeva",
  23726. 0x093e,
  23727. "aavowelsigngujarati",
  23728. 0x0abe,
  23729. "abbreviationmarkarmenian",
  23730. 0x055f,
  23731. "abbreviationsigndeva",
  23732. 0x0970,
  23733. "abengali",
  23734. 0x0985,
  23735. "abopomofo",
  23736. 0x311a,
  23737. "abreve",
  23738. 0x0103,
  23739. "abreveacute",
  23740. 0x1eaf,
  23741. "abrevecyrillic",
  23742. 0x04d1,
  23743. "abrevedotbelow",
  23744. 0x1eb7,
  23745. "abrevegrave",
  23746. 0x1eb1,
  23747. "abrevehookabove",
  23748. 0x1eb3,
  23749. "abrevetilde",
  23750. 0x1eb5,
  23751. "acaron",
  23752. 0x01ce,
  23753. "acircle",
  23754. 0x24d0,
  23755. "acircumflex",
  23756. 0x00e2,
  23757. "acircumflexacute",
  23758. 0x1ea5,
  23759. "acircumflexdotbelow",
  23760. 0x1ead,
  23761. "acircumflexgrave",
  23762. 0x1ea7,
  23763. "acircumflexhookabove",
  23764. 0x1ea9,
  23765. "acircumflextilde",
  23766. 0x1eab,
  23767. "acute",
  23768. 0x00b4,
  23769. "acutebelowcmb",
  23770. 0x0317,
  23771. "acutecmb",
  23772. 0x0301,
  23773. "acutecomb",
  23774. 0x0301,
  23775. "acutedeva",
  23776. 0x0954,
  23777. "acutelowmod",
  23778. 0x02cf,
  23779. "acutetonecmb",
  23780. 0x0341,
  23781. "acyrillic",
  23782. 0x0430,
  23783. "adblgrave",
  23784. 0x0201,
  23785. "addakgurmukhi",
  23786. 0x0a71,
  23787. "adeva",
  23788. 0x0905,
  23789. "adieresis",
  23790. 0x00e4,
  23791. "adieresiscyrillic",
  23792. 0x04d3,
  23793. "adieresismacron",
  23794. 0x01df,
  23795. "adotbelow",
  23796. 0x1ea1,
  23797. "adotmacron",
  23798. 0x01e1,
  23799. "ae",
  23800. 0x00e6,
  23801. "aeacute",
  23802. 0x01fd,
  23803. "aekorean",
  23804. 0x3150,
  23805. "aemacron",
  23806. 0x01e3,
  23807. "afii00208",
  23808. 0x2015,
  23809. "afii08941",
  23810. 0x20a4,
  23811. "afii10017",
  23812. 0x0410,
  23813. "afii10018",
  23814. 0x0411,
  23815. "afii10019",
  23816. 0x0412,
  23817. "afii10020",
  23818. 0x0413,
  23819. "afii10021",
  23820. 0x0414,
  23821. "afii10022",
  23822. 0x0415,
  23823. "afii10023",
  23824. 0x0401,
  23825. "afii10024",
  23826. 0x0416,
  23827. "afii10025",
  23828. 0x0417,
  23829. "afii10026",
  23830. 0x0418,
  23831. "afii10027",
  23832. 0x0419,
  23833. "afii10028",
  23834. 0x041a,
  23835. "afii10029",
  23836. 0x041b,
  23837. "afii10030",
  23838. 0x041c,
  23839. "afii10031",
  23840. 0x041d,
  23841. "afii10032",
  23842. 0x041e,
  23843. "afii10033",
  23844. 0x041f,
  23845. "afii10034",
  23846. 0x0420,
  23847. "afii10035",
  23848. 0x0421,
  23849. "afii10036",
  23850. 0x0422,
  23851. "afii10037",
  23852. 0x0423,
  23853. "afii10038",
  23854. 0x0424,
  23855. "afii10039",
  23856. 0x0425,
  23857. "afii10040",
  23858. 0x0426,
  23859. "afii10041",
  23860. 0x0427,
  23861. "afii10042",
  23862. 0x0428,
  23863. "afii10043",
  23864. 0x0429,
  23865. "afii10044",
  23866. 0x042a,
  23867. "afii10045",
  23868. 0x042b,
  23869. "afii10046",
  23870. 0x042c,
  23871. "afii10047",
  23872. 0x042d,
  23873. "afii10048",
  23874. 0x042e,
  23875. "afii10049",
  23876. 0x042f,
  23877. "afii10050",
  23878. 0x0490,
  23879. "afii10051",
  23880. 0x0402,
  23881. "afii10052",
  23882. 0x0403,
  23883. "afii10053",
  23884. 0x0404,
  23885. "afii10054",
  23886. 0x0405,
  23887. "afii10055",
  23888. 0x0406,
  23889. "afii10056",
  23890. 0x0407,
  23891. "afii10057",
  23892. 0x0408,
  23893. "afii10058",
  23894. 0x0409,
  23895. "afii10059",
  23896. 0x040a,
  23897. "afii10060",
  23898. 0x040b,
  23899. "afii10061",
  23900. 0x040c,
  23901. "afii10062",
  23902. 0x040e,
  23903. "afii10063",
  23904. 0xf6c4,
  23905. "afii10064",
  23906. 0xf6c5,
  23907. "afii10065",
  23908. 0x0430,
  23909. "afii10066",
  23910. 0x0431,
  23911. "afii10067",
  23912. 0x0432,
  23913. "afii10068",
  23914. 0x0433,
  23915. "afii10069",
  23916. 0x0434,
  23917. "afii10070",
  23918. 0x0435,
  23919. "afii10071",
  23920. 0x0451,
  23921. "afii10072",
  23922. 0x0436,
  23923. "afii10073",
  23924. 0x0437,
  23925. "afii10074",
  23926. 0x0438,
  23927. "afii10075",
  23928. 0x0439,
  23929. "afii10076",
  23930. 0x043a,
  23931. "afii10077",
  23932. 0x043b,
  23933. "afii10078",
  23934. 0x043c,
  23935. "afii10079",
  23936. 0x043d,
  23937. "afii10080",
  23938. 0x043e,
  23939. "afii10081",
  23940. 0x043f,
  23941. "afii10082",
  23942. 0x0440,
  23943. "afii10083",
  23944. 0x0441,
  23945. "afii10084",
  23946. 0x0442,
  23947. "afii10085",
  23948. 0x0443,
  23949. "afii10086",
  23950. 0x0444,
  23951. "afii10087",
  23952. 0x0445,
  23953. "afii10088",
  23954. 0x0446,
  23955. "afii10089",
  23956. 0x0447,
  23957. "afii10090",
  23958. 0x0448,
  23959. "afii10091",
  23960. 0x0449,
  23961. "afii10092",
  23962. 0x044a,
  23963. "afii10093",
  23964. 0x044b,
  23965. "afii10094",
  23966. 0x044c,
  23967. "afii10095",
  23968. 0x044d,
  23969. "afii10096",
  23970. 0x044e,
  23971. "afii10097",
  23972. 0x044f,
  23973. "afii10098",
  23974. 0x0491,
  23975. "afii10099",
  23976. 0x0452,
  23977. "afii10100",
  23978. 0x0453,
  23979. "afii10101",
  23980. 0x0454,
  23981. "afii10102",
  23982. 0x0455,
  23983. "afii10103",
  23984. 0x0456,
  23985. "afii10104",
  23986. 0x0457,
  23987. "afii10105",
  23988. 0x0458,
  23989. "afii10106",
  23990. 0x0459,
  23991. "afii10107",
  23992. 0x045a,
  23993. "afii10108",
  23994. 0x045b,
  23995. "afii10109",
  23996. 0x045c,
  23997. "afii10110",
  23998. 0x045e,
  23999. "afii10145",
  24000. 0x040f,
  24001. "afii10146",
  24002. 0x0462,
  24003. "afii10147",
  24004. 0x0472,
  24005. "afii10148",
  24006. 0x0474,
  24007. "afii10192",
  24008. 0xf6c6,
  24009. "afii10193",
  24010. 0x045f,
  24011. "afii10194",
  24012. 0x0463,
  24013. "afii10195",
  24014. 0x0473,
  24015. "afii10196",
  24016. 0x0475,
  24017. "afii10831",
  24018. 0xf6c7,
  24019. "afii10832",
  24020. 0xf6c8,
  24021. "afii10846",
  24022. 0x04d9,
  24023. "afii299",
  24024. 0x200e,
  24025. "afii300",
  24026. 0x200f,
  24027. "afii301",
  24028. 0x200d,
  24029. "afii57381",
  24030. 0x066a,
  24031. "afii57388",
  24032. 0x060c,
  24033. "afii57392",
  24034. 0x0660,
  24035. "afii57393",
  24036. 0x0661,
  24037. "afii57394",
  24038. 0x0662,
  24039. "afii57395",
  24040. 0x0663,
  24041. "afii57396",
  24042. 0x0664,
  24043. "afii57397",
  24044. 0x0665,
  24045. "afii57398",
  24046. 0x0666,
  24047. "afii57399",
  24048. 0x0667,
  24049. "afii57400",
  24050. 0x0668,
  24051. "afii57401",
  24052. 0x0669,
  24053. "afii57403",
  24054. 0x061b,
  24055. "afii57407",
  24056. 0x061f,
  24057. "afii57409",
  24058. 0x0621,
  24059. "afii57410",
  24060. 0x0622,
  24061. "afii57411",
  24062. 0x0623,
  24063. "afii57412",
  24064. 0x0624,
  24065. "afii57413",
  24066. 0x0625,
  24067. "afii57414",
  24068. 0x0626,
  24069. "afii57415",
  24070. 0x0627,
  24071. "afii57416",
  24072. 0x0628,
  24073. "afii57417",
  24074. 0x0629,
  24075. "afii57418",
  24076. 0x062a,
  24077. "afii57419",
  24078. 0x062b,
  24079. "afii57420",
  24080. 0x062c,
  24081. "afii57421",
  24082. 0x062d,
  24083. "afii57422",
  24084. 0x062e,
  24085. "afii57423",
  24086. 0x062f,
  24087. "afii57424",
  24088. 0x0630,
  24089. "afii57425",
  24090. 0x0631,
  24091. "afii57426",
  24092. 0x0632,
  24093. "afii57427",
  24094. 0x0633,
  24095. "afii57428",
  24096. 0x0634,
  24097. "afii57429",
  24098. 0x0635,
  24099. "afii57430",
  24100. 0x0636,
  24101. "afii57431",
  24102. 0x0637,
  24103. "afii57432",
  24104. 0x0638,
  24105. "afii57433",
  24106. 0x0639,
  24107. "afii57434",
  24108. 0x063a,
  24109. "afii57440",
  24110. 0x0640,
  24111. "afii57441",
  24112. 0x0641,
  24113. "afii57442",
  24114. 0x0642,
  24115. "afii57443",
  24116. 0x0643,
  24117. "afii57444",
  24118. 0x0644,
  24119. "afii57445",
  24120. 0x0645,
  24121. "afii57446",
  24122. 0x0646,
  24123. "afii57448",
  24124. 0x0648,
  24125. "afii57449",
  24126. 0x0649,
  24127. "afii57450",
  24128. 0x064a,
  24129. "afii57451",
  24130. 0x064b,
  24131. "afii57452",
  24132. 0x064c,
  24133. "afii57453",
  24134. 0x064d,
  24135. "afii57454",
  24136. 0x064e,
  24137. "afii57455",
  24138. 0x064f,
  24139. "afii57456",
  24140. 0x0650,
  24141. "afii57457",
  24142. 0x0651,
  24143. "afii57458",
  24144. 0x0652,
  24145. "afii57470",
  24146. 0x0647,
  24147. "afii57505",
  24148. 0x06a4,
  24149. "afii57506",
  24150. 0x067e,
  24151. "afii57507",
  24152. 0x0686,
  24153. "afii57508",
  24154. 0x0698,
  24155. "afii57509",
  24156. 0x06af,
  24157. "afii57511",
  24158. 0x0679,
  24159. "afii57512",
  24160. 0x0688,
  24161. "afii57513",
  24162. 0x0691,
  24163. "afii57514",
  24164. 0x06ba,
  24165. "afii57519",
  24166. 0x06d2,
  24167. "afii57534",
  24168. 0x06d5,
  24169. "afii57636",
  24170. 0x20aa,
  24171. "afii57645",
  24172. 0x05be,
  24173. "afii57658",
  24174. 0x05c3,
  24175. "afii57664",
  24176. 0x05d0,
  24177. "afii57665",
  24178. 0x05d1,
  24179. "afii57666",
  24180. 0x05d2,
  24181. "afii57667",
  24182. 0x05d3,
  24183. "afii57668",
  24184. 0x05d4,
  24185. "afii57669",
  24186. 0x05d5,
  24187. "afii57670",
  24188. 0x05d6,
  24189. "afii57671",
  24190. 0x05d7,
  24191. "afii57672",
  24192. 0x05d8,
  24193. "afii57673",
  24194. 0x05d9,
  24195. "afii57674",
  24196. 0x05da,
  24197. "afii57675",
  24198. 0x05db,
  24199. "afii57676",
  24200. 0x05dc,
  24201. "afii57677",
  24202. 0x05dd,
  24203. "afii57678",
  24204. 0x05de,
  24205. "afii57679",
  24206. 0x05df,
  24207. "afii57680",
  24208. 0x05e0,
  24209. "afii57681",
  24210. 0x05e1,
  24211. "afii57682",
  24212. 0x05e2,
  24213. "afii57683",
  24214. 0x05e3,
  24215. "afii57684",
  24216. 0x05e4,
  24217. "afii57685",
  24218. 0x05e5,
  24219. "afii57686",
  24220. 0x05e6,
  24221. "afii57687",
  24222. 0x05e7,
  24223. "afii57688",
  24224. 0x05e8,
  24225. "afii57689",
  24226. 0x05e9,
  24227. "afii57690",
  24228. 0x05ea,
  24229. "afii57694",
  24230. 0xfb2a,
  24231. "afii57695",
  24232. 0xfb2b,
  24233. "afii57700",
  24234. 0xfb4b,
  24235. "afii57705",
  24236. 0xfb1f,
  24237. "afii57716",
  24238. 0x05f0,
  24239. "afii57717",
  24240. 0x05f1,
  24241. "afii57718",
  24242. 0x05f2,
  24243. "afii57723",
  24244. 0xfb35,
  24245. "afii57793",
  24246. 0x05b4,
  24247. "afii57794",
  24248. 0x05b5,
  24249. "afii57795",
  24250. 0x05b6,
  24251. "afii57796",
  24252. 0x05bb,
  24253. "afii57797",
  24254. 0x05b8,
  24255. "afii57798",
  24256. 0x05b7,
  24257. "afii57799",
  24258. 0x05b0,
  24259. "afii57800",
  24260. 0x05b2,
  24261. "afii57801",
  24262. 0x05b1,
  24263. "afii57802",
  24264. 0x05b3,
  24265. "afii57803",
  24266. 0x05c2,
  24267. "afii57804",
  24268. 0x05c1,
  24269. "afii57806",
  24270. 0x05b9,
  24271. "afii57807",
  24272. 0x05bc,
  24273. "afii57839",
  24274. 0x05bd,
  24275. "afii57841",
  24276. 0x05bf,
  24277. "afii57842",
  24278. 0x05c0,
  24279. "afii57929",
  24280. 0x02bc,
  24281. "afii61248",
  24282. 0x2105,
  24283. "afii61289",
  24284. 0x2113,
  24285. "afii61352",
  24286. 0x2116,
  24287. "afii61573",
  24288. 0x202c,
  24289. "afii61574",
  24290. 0x202d,
  24291. "afii61575",
  24292. 0x202e,
  24293. "afii61664",
  24294. 0x200c,
  24295. "afii63167",
  24296. 0x066d,
  24297. "afii64937",
  24298. 0x02bd,
  24299. "agrave",
  24300. 0x00e0,
  24301. "agujarati",
  24302. 0x0a85,
  24303. "agurmukhi",
  24304. 0x0a05,
  24305. "ahiragana",
  24306. 0x3042,
  24307. "ahookabove",
  24308. 0x1ea3,
  24309. "aibengali",
  24310. 0x0990,
  24311. "aibopomofo",
  24312. 0x311e,
  24313. "aideva",
  24314. 0x0910,
  24315. "aiecyrillic",
  24316. 0x04d5,
  24317. "aigujarati",
  24318. 0x0a90,
  24319. "aigurmukhi",
  24320. 0x0a10,
  24321. "aimatragurmukhi",
  24322. 0x0a48,
  24323. "ainarabic",
  24324. 0x0639,
  24325. "ainfinalarabic",
  24326. 0xfeca,
  24327. "aininitialarabic",
  24328. 0xfecb,
  24329. "ainmedialarabic",
  24330. 0xfecc,
  24331. "ainvertedbreve",
  24332. 0x0203,
  24333. "aivowelsignbengali",
  24334. 0x09c8,
  24335. "aivowelsigndeva",
  24336. 0x0948,
  24337. "aivowelsigngujarati",
  24338. 0x0ac8,
  24339. "akatakana",
  24340. 0x30a2,
  24341. "akatakanahalfwidth",
  24342. 0xff71,
  24343. "akorean",
  24344. 0x314f,
  24345. "alef",
  24346. 0x05d0,
  24347. "alefarabic",
  24348. 0x0627,
  24349. "alefdageshhebrew",
  24350. 0xfb30,
  24351. "aleffinalarabic",
  24352. 0xfe8e,
  24353. "alefhamzaabovearabic",
  24354. 0x0623,
  24355. "alefhamzaabovefinalarabic",
  24356. 0xfe84,
  24357. "alefhamzabelowarabic",
  24358. 0x0625,
  24359. "alefhamzabelowfinalarabic",
  24360. 0xfe88,
  24361. "alefhebrew",
  24362. 0x05d0,
  24363. "aleflamedhebrew",
  24364. 0xfb4f,
  24365. "alefmaddaabovearabic",
  24366. 0x0622,
  24367. "alefmaddaabovefinalarabic",
  24368. 0xfe82,
  24369. "alefmaksuraarabic",
  24370. 0x0649,
  24371. "alefmaksurafinalarabic",
  24372. 0xfef0,
  24373. "alefmaksurainitialarabic",
  24374. 0xfef3,
  24375. "alefmaksuramedialarabic",
  24376. 0xfef4,
  24377. "alefpatahhebrew",
  24378. 0xfb2e,
  24379. "alefqamatshebrew",
  24380. 0xfb2f,
  24381. "aleph",
  24382. 0x2135,
  24383. "allequal",
  24384. 0x224c,
  24385. "alpha",
  24386. 0x03b1,
  24387. "alphatonos",
  24388. 0x03ac,
  24389. "amacron",
  24390. 0x0101,
  24391. "amonospace",
  24392. 0xff41,
  24393. "ampersand",
  24394. 0x0026,
  24395. "ampersandmonospace",
  24396. 0xff06,
  24397. "ampersandsmall",
  24398. 0xf726,
  24399. "amsquare",
  24400. 0x33c2,
  24401. "anbopomofo",
  24402. 0x3122,
  24403. "angbopomofo",
  24404. 0x3124,
  24405. "angbracketleft",
  24406. 0x3008,
  24407. "angbracketright",
  24408. 0x3009,
  24409. "angkhankhuthai",
  24410. 0x0e5a,
  24411. "angle",
  24412. 0x2220,
  24413. "anglebracketleft",
  24414. 0x3008,
  24415. "anglebracketleftvertical",
  24416. 0xfe3f,
  24417. "anglebracketright",
  24418. 0x3009,
  24419. "anglebracketrightvertical",
  24420. 0xfe40,
  24421. "angleleft",
  24422. 0x2329,
  24423. "angleright",
  24424. 0x232a,
  24425. "angstrom",
  24426. 0x212b,
  24427. "anoteleia",
  24428. 0x0387,
  24429. "anudattadeva",
  24430. 0x0952,
  24431. "anusvarabengali",
  24432. 0x0982,
  24433. "anusvaradeva",
  24434. 0x0902,
  24435. "anusvaragujarati",
  24436. 0x0a82,
  24437. "aogonek",
  24438. 0x0105,
  24439. "apaatosquare",
  24440. 0x3300,
  24441. "aparen",
  24442. 0x249c,
  24443. "apostrophearmenian",
  24444. 0x055a,
  24445. "apostrophemod",
  24446. 0x02bc,
  24447. "apple",
  24448. 0xf8ff,
  24449. "approaches",
  24450. 0x2250,
  24451. "approxequal",
  24452. 0x2248,
  24453. "approxequalorimage",
  24454. 0x2252,
  24455. "approximatelyequal",
  24456. 0x2245,
  24457. "araeaekorean",
  24458. 0x318e,
  24459. "araeakorean",
  24460. 0x318d,
  24461. "arc",
  24462. 0x2312,
  24463. "arighthalfring",
  24464. 0x1e9a,
  24465. "aring",
  24466. 0x00e5,
  24467. "aringacute",
  24468. 0x01fb,
  24469. "aringbelow",
  24470. 0x1e01,
  24471. "arrowboth",
  24472. 0x2194,
  24473. "arrowdashdown",
  24474. 0x21e3,
  24475. "arrowdashleft",
  24476. 0x21e0,
  24477. "arrowdashright",
  24478. 0x21e2,
  24479. "arrowdashup",
  24480. 0x21e1,
  24481. "arrowdblboth",
  24482. 0x21d4,
  24483. "arrowdbldown",
  24484. 0x21d3,
  24485. "arrowdblleft",
  24486. 0x21d0,
  24487. "arrowdblright",
  24488. 0x21d2,
  24489. "arrowdblup",
  24490. 0x21d1,
  24491. "arrowdown",
  24492. 0x2193,
  24493. "arrowdownleft",
  24494. 0x2199,
  24495. "arrowdownright",
  24496. 0x2198,
  24497. "arrowdownwhite",
  24498. 0x21e9,
  24499. "arrowheaddownmod",
  24500. 0x02c5,
  24501. "arrowheadleftmod",
  24502. 0x02c2,
  24503. "arrowheadrightmod",
  24504. 0x02c3,
  24505. "arrowheadupmod",
  24506. 0x02c4,
  24507. "arrowhorizex",
  24508. 0xf8e7,
  24509. "arrowleft",
  24510. 0x2190,
  24511. "arrowleftdbl",
  24512. 0x21d0,
  24513. "arrowleftdblstroke",
  24514. 0x21cd,
  24515. "arrowleftoverright",
  24516. 0x21c6,
  24517. "arrowleftwhite",
  24518. 0x21e6,
  24519. "arrowright",
  24520. 0x2192,
  24521. "arrowrightdblstroke",
  24522. 0x21cf,
  24523. "arrowrightheavy",
  24524. 0x279e,
  24525. "arrowrightoverleft",
  24526. 0x21c4,
  24527. "arrowrightwhite",
  24528. 0x21e8,
  24529. "arrowtableft",
  24530. 0x21e4,
  24531. "arrowtabright",
  24532. 0x21e5,
  24533. "arrowup",
  24534. 0x2191,
  24535. "arrowupdn",
  24536. 0x2195,
  24537. "arrowupdnbse",
  24538. 0x21a8,
  24539. "arrowupdownbase",
  24540. 0x21a8,
  24541. "arrowupleft",
  24542. 0x2196,
  24543. "arrowupleftofdown",
  24544. 0x21c5,
  24545. "arrowupright",
  24546. 0x2197,
  24547. "arrowupwhite",
  24548. 0x21e7,
  24549. "arrowvertex",
  24550. 0xf8e6,
  24551. "asciicircum",
  24552. 0x005e,
  24553. "asciicircummonospace",
  24554. 0xff3e,
  24555. "asciitilde",
  24556. 0x007e,
  24557. "asciitildemonospace",
  24558. 0xff5e,
  24559. "ascript",
  24560. 0x0251,
  24561. "ascriptturned",
  24562. 0x0252,
  24563. "asmallhiragana",
  24564. 0x3041,
  24565. "asmallkatakana",
  24566. 0x30a1,
  24567. "asmallkatakanahalfwidth",
  24568. 0xff67,
  24569. "asterisk",
  24570. 0x002a,
  24571. "asteriskaltonearabic",
  24572. 0x066d,
  24573. "asteriskarabic",
  24574. 0x066d,
  24575. "asteriskmath",
  24576. 0x2217,
  24577. "asteriskmonospace",
  24578. 0xff0a,
  24579. "asterisksmall",
  24580. 0xfe61,
  24581. "asterism",
  24582. 0x2042,
  24583. "asuperior",
  24584. 0xf6e9,
  24585. "asymptoticallyequal",
  24586. 0x2243,
  24587. "at",
  24588. 0x0040,
  24589. "atilde",
  24590. 0x00e3,
  24591. "atmonospace",
  24592. 0xff20,
  24593. "atsmall",
  24594. 0xfe6b,
  24595. "aturned",
  24596. 0x0250,
  24597. "aubengali",
  24598. 0x0994,
  24599. "aubopomofo",
  24600. 0x3120,
  24601. "audeva",
  24602. 0x0914,
  24603. "augujarati",
  24604. 0x0a94,
  24605. "augurmukhi",
  24606. 0x0a14,
  24607. "aulengthmarkbengali",
  24608. 0x09d7,
  24609. "aumatragurmukhi",
  24610. 0x0a4c,
  24611. "auvowelsignbengali",
  24612. 0x09cc,
  24613. "auvowelsigndeva",
  24614. 0x094c,
  24615. "auvowelsigngujarati",
  24616. 0x0acc,
  24617. "avagrahadeva",
  24618. 0x093d,
  24619. "aybarmenian",
  24620. 0x0561,
  24621. "ayin",
  24622. 0x05e2,
  24623. "ayinaltonehebrew",
  24624. 0xfb20,
  24625. "ayinhebrew",
  24626. 0x05e2,
  24627. "b",
  24628. 0x0062,
  24629. "babengali",
  24630. 0x09ac,
  24631. "backslash",
  24632. 0x005c,
  24633. "backslashmonospace",
  24634. 0xff3c,
  24635. "badeva",
  24636. 0x092c,
  24637. "bagujarati",
  24638. 0x0aac,
  24639. "bagurmukhi",
  24640. 0x0a2c,
  24641. "bahiragana",
  24642. 0x3070,
  24643. "bahtthai",
  24644. 0x0e3f,
  24645. "bakatakana",
  24646. 0x30d0,
  24647. "bar",
  24648. 0x007c,
  24649. "barmonospace",
  24650. 0xff5c,
  24651. "bbopomofo",
  24652. 0x3105,
  24653. "bcircle",
  24654. 0x24d1,
  24655. "bdotaccent",
  24656. 0x1e03,
  24657. "bdotbelow",
  24658. 0x1e05,
  24659. "beamedsixteenthnotes",
  24660. 0x266c,
  24661. "because",
  24662. 0x2235,
  24663. "becyrillic",
  24664. 0x0431,
  24665. "beharabic",
  24666. 0x0628,
  24667. "behfinalarabic",
  24668. 0xfe90,
  24669. "behinitialarabic",
  24670. 0xfe91,
  24671. "behiragana",
  24672. 0x3079,
  24673. "behmedialarabic",
  24674. 0xfe92,
  24675. "behmeeminitialarabic",
  24676. 0xfc9f,
  24677. "behmeemisolatedarabic",
  24678. 0xfc08,
  24679. "behnoonfinalarabic",
  24680. 0xfc6d,
  24681. "bekatakana",
  24682. 0x30d9,
  24683. "benarmenian",
  24684. 0x0562,
  24685. "bet",
  24686. 0x05d1,
  24687. "beta",
  24688. 0x03b2,
  24689. "betasymbolgreek",
  24690. 0x03d0,
  24691. "betdagesh",
  24692. 0xfb31,
  24693. "betdageshhebrew",
  24694. 0xfb31,
  24695. "bethebrew",
  24696. 0x05d1,
  24697. "betrafehebrew",
  24698. 0xfb4c,
  24699. "bhabengali",
  24700. 0x09ad,
  24701. "bhadeva",
  24702. 0x092d,
  24703. "bhagujarati",
  24704. 0x0aad,
  24705. "bhagurmukhi",
  24706. 0x0a2d,
  24707. "bhook",
  24708. 0x0253,
  24709. "bihiragana",
  24710. 0x3073,
  24711. "bikatakana",
  24712. 0x30d3,
  24713. "bilabialclick",
  24714. 0x0298,
  24715. "bindigurmukhi",
  24716. 0x0a02,
  24717. "birusquare",
  24718. 0x3331,
  24719. "blackcircle",
  24720. 0x25cf,
  24721. "blackdiamond",
  24722. 0x25c6,
  24723. "blackdownpointingtriangle",
  24724. 0x25bc,
  24725. "blackleftpointingpointer",
  24726. 0x25c4,
  24727. "blackleftpointingtriangle",
  24728. 0x25c0,
  24729. "blacklenticularbracketleft",
  24730. 0x3010,
  24731. "blacklenticularbracketleftvertical",
  24732. 0xfe3b,
  24733. "blacklenticularbracketright",
  24734. 0x3011,
  24735. "blacklenticularbracketrightvertical",
  24736. 0xfe3c,
  24737. "blacklowerlefttriangle",
  24738. 0x25e3,
  24739. "blacklowerrighttriangle",
  24740. 0x25e2,
  24741. "blackrectangle",
  24742. 0x25ac,
  24743. "blackrightpointingpointer",
  24744. 0x25ba,
  24745. "blackrightpointingtriangle",
  24746. 0x25b6,
  24747. "blacksmallsquare",
  24748. 0x25aa,
  24749. "blacksmilingface",
  24750. 0x263b,
  24751. "blacksquare",
  24752. 0x25a0,
  24753. "blackstar",
  24754. 0x2605,
  24755. "blackupperlefttriangle",
  24756. 0x25e4,
  24757. "blackupperrighttriangle",
  24758. 0x25e5,
  24759. "blackuppointingsmalltriangle",
  24760. 0x25b4,
  24761. "blackuppointingtriangle",
  24762. 0x25b2,
  24763. "blank",
  24764. 0x2423,
  24765. "blinebelow",
  24766. 0x1e07,
  24767. "block",
  24768. 0x2588,
  24769. "bmonospace",
  24770. 0xff42,
  24771. "bobaimaithai",
  24772. 0x0e1a,
  24773. "bohiragana",
  24774. 0x307c,
  24775. "bokatakana",
  24776. 0x30dc,
  24777. "bparen",
  24778. 0x249d,
  24779. "bqsquare",
  24780. 0x33c3,
  24781. "braceex",
  24782. 0xf8f4,
  24783. "braceleft",
  24784. 0x007b,
  24785. "braceleftbt",
  24786. 0xf8f3,
  24787. "braceleftmid",
  24788. 0xf8f2,
  24789. "braceleftmonospace",
  24790. 0xff5b,
  24791. "braceleftsmall",
  24792. 0xfe5b,
  24793. "bracelefttp",
  24794. 0xf8f1,
  24795. "braceleftvertical",
  24796. 0xfe37,
  24797. "braceright",
  24798. 0x007d,
  24799. "bracerightbt",
  24800. 0xf8fe,
  24801. "bracerightmid",
  24802. 0xf8fd,
  24803. "bracerightmonospace",
  24804. 0xff5d,
  24805. "bracerightsmall",
  24806. 0xfe5c,
  24807. "bracerighttp",
  24808. 0xf8fc,
  24809. "bracerightvertical",
  24810. 0xfe38,
  24811. "bracketleft",
  24812. 0x005b,
  24813. "bracketleftbt",
  24814. 0xf8f0,
  24815. "bracketleftex",
  24816. 0xf8ef,
  24817. "bracketleftmonospace",
  24818. 0xff3b,
  24819. "bracketlefttp",
  24820. 0xf8ee,
  24821. "bracketright",
  24822. 0x005d,
  24823. "bracketrightbt",
  24824. 0xf8fb,
  24825. "bracketrightex",
  24826. 0xf8fa,
  24827. "bracketrightmonospace",
  24828. 0xff3d,
  24829. "bracketrighttp",
  24830. 0xf8f9,
  24831. "breve",
  24832. 0x02d8,
  24833. "brevebelowcmb",
  24834. 0x032e,
  24835. "brevecmb",
  24836. 0x0306,
  24837. "breveinvertedbelowcmb",
  24838. 0x032f,
  24839. "breveinvertedcmb",
  24840. 0x0311,
  24841. "breveinverteddoublecmb",
  24842. 0x0361,
  24843. "bridgebelowcmb",
  24844. 0x032a,
  24845. "bridgeinvertedbelowcmb",
  24846. 0x033a,
  24847. "brokenbar",
  24848. 0x00a6,
  24849. "bstroke",
  24850. 0x0180,
  24851. "bsuperior",
  24852. 0xf6ea,
  24853. "btopbar",
  24854. 0x0183,
  24855. "buhiragana",
  24856. 0x3076,
  24857. "bukatakana",
  24858. 0x30d6,
  24859. "bullet",
  24860. 0x2022,
  24861. "bulletinverse",
  24862. 0x25d8,
  24863. "bulletoperator",
  24864. 0x2219,
  24865. "bullseye",
  24866. 0x25ce,
  24867. "c",
  24868. 0x0063,
  24869. "caarmenian",
  24870. 0x056e,
  24871. "cabengali",
  24872. 0x099a,
  24873. "cacute",
  24874. 0x0107,
  24875. "cadeva",
  24876. 0x091a,
  24877. "cagujarati",
  24878. 0x0a9a,
  24879. "cagurmukhi",
  24880. 0x0a1a,
  24881. "calsquare",
  24882. 0x3388,
  24883. "candrabindubengali",
  24884. 0x0981,
  24885. "candrabinducmb",
  24886. 0x0310,
  24887. "candrabindudeva",
  24888. 0x0901,
  24889. "candrabindugujarati",
  24890. 0x0a81,
  24891. "capslock",
  24892. 0x21ea,
  24893. "careof",
  24894. 0x2105,
  24895. "caron",
  24896. 0x02c7,
  24897. "caronbelowcmb",
  24898. 0x032c,
  24899. "caroncmb",
  24900. 0x030c,
  24901. "carriagereturn",
  24902. 0x21b5,
  24903. "cbopomofo",
  24904. 0x3118,
  24905. "ccaron",
  24906. 0x010d,
  24907. "ccedilla",
  24908. 0x00e7,
  24909. "ccedillaacute",
  24910. 0x1e09,
  24911. "ccircle",
  24912. 0x24d2,
  24913. "ccircumflex",
  24914. 0x0109,
  24915. "ccurl",
  24916. 0x0255,
  24917. "cdot",
  24918. 0x010b,
  24919. "cdotaccent",
  24920. 0x010b,
  24921. "cdsquare",
  24922. 0x33c5,
  24923. "cedilla",
  24924. 0x00b8,
  24925. "cedillacmb",
  24926. 0x0327,
  24927. "cent",
  24928. 0x00a2,
  24929. "centigrade",
  24930. 0x2103,
  24931. "centinferior",
  24932. 0xf6df,
  24933. "centmonospace",
  24934. 0xffe0,
  24935. "centoldstyle",
  24936. 0xf7a2,
  24937. "centsuperior",
  24938. 0xf6e0,
  24939. "chaarmenian",
  24940. 0x0579,
  24941. "chabengali",
  24942. 0x099b,
  24943. "chadeva",
  24944. 0x091b,
  24945. "chagujarati",
  24946. 0x0a9b,
  24947. "chagurmukhi",
  24948. 0x0a1b,
  24949. "chbopomofo",
  24950. 0x3114,
  24951. "cheabkhasiancyrillic",
  24952. 0x04bd,
  24953. "checkmark",
  24954. 0x2713,
  24955. "checyrillic",
  24956. 0x0447,
  24957. "chedescenderabkhasiancyrillic",
  24958. 0x04bf,
  24959. "chedescendercyrillic",
  24960. 0x04b7,
  24961. "chedieresiscyrillic",
  24962. 0x04f5,
  24963. "cheharmenian",
  24964. 0x0573,
  24965. "chekhakassiancyrillic",
  24966. 0x04cc,
  24967. "cheverticalstrokecyrillic",
  24968. 0x04b9,
  24969. "chi",
  24970. 0x03c7,
  24971. "chieuchacirclekorean",
  24972. 0x3277,
  24973. "chieuchaparenkorean",
  24974. 0x3217,
  24975. "chieuchcirclekorean",
  24976. 0x3269,
  24977. "chieuchkorean",
  24978. 0x314a,
  24979. "chieuchparenkorean",
  24980. 0x3209,
  24981. "chochangthai",
  24982. 0x0e0a,
  24983. "chochanthai",
  24984. 0x0e08,
  24985. "chochingthai",
  24986. 0x0e09,
  24987. "chochoethai",
  24988. 0x0e0c,
  24989. "chook",
  24990. 0x0188,
  24991. "cieucacirclekorean",
  24992. 0x3276,
  24993. "cieucaparenkorean",
  24994. 0x3216,
  24995. "cieuccirclekorean",
  24996. 0x3268,
  24997. "cieuckorean",
  24998. 0x3148,
  24999. "cieucparenkorean",
  25000. 0x3208,
  25001. "cieucuparenkorean",
  25002. 0x321c,
  25003. "circle",
  25004. 0x25cb,
  25005. "circlecopyrt",
  25006. 0x00a9,
  25007. "circlemultiply",
  25008. 0x2297,
  25009. "circleot",
  25010. 0x2299,
  25011. "circleplus",
  25012. 0x2295,
  25013. "circlepostalmark",
  25014. 0x3036,
  25015. "circlewithlefthalfblack",
  25016. 0x25d0,
  25017. "circlewithrighthalfblack",
  25018. 0x25d1,
  25019. "circumflex",
  25020. 0x02c6,
  25021. "circumflexbelowcmb",
  25022. 0x032d,
  25023. "circumflexcmb",
  25024. 0x0302,
  25025. "clear",
  25026. 0x2327,
  25027. "clickalveolar",
  25028. 0x01c2,
  25029. "clickdental",
  25030. 0x01c0,
  25031. "clicklateral",
  25032. 0x01c1,
  25033. "clickretroflex",
  25034. 0x01c3,
  25035. "club",
  25036. 0x2663,
  25037. "clubsuitblack",
  25038. 0x2663,
  25039. "clubsuitwhite",
  25040. 0x2667,
  25041. "cmcubedsquare",
  25042. 0x33a4,
  25043. "cmonospace",
  25044. 0xff43,
  25045. "cmsquaredsquare",
  25046. 0x33a0,
  25047. "coarmenian",
  25048. 0x0581,
  25049. "colon",
  25050. 0x003a,
  25051. "colonmonetary",
  25052. 0x20a1,
  25053. "colonmonospace",
  25054. 0xff1a,
  25055. "colonsign",
  25056. 0x20a1,
  25057. "colonsmall",
  25058. 0xfe55,
  25059. "colontriangularhalfmod",
  25060. 0x02d1,
  25061. "colontriangularmod",
  25062. 0x02d0,
  25063. "comma",
  25064. 0x002c,
  25065. "commaabovecmb",
  25066. 0x0313,
  25067. "commaaboverightcmb",
  25068. 0x0315,
  25069. "commaaccent",
  25070. 0xf6c3,
  25071. "commaarabic",
  25072. 0x060c,
  25073. "commaarmenian",
  25074. 0x055d,
  25075. "commainferior",
  25076. 0xf6e1,
  25077. "commamonospace",
  25078. 0xff0c,
  25079. "commareversedabovecmb",
  25080. 0x0314,
  25081. "commareversedmod",
  25082. 0x02bd,
  25083. "commasmall",
  25084. 0xfe50,
  25085. "commasuperior",
  25086. 0xf6e2,
  25087. "commaturnedabovecmb",
  25088. 0x0312,
  25089. "commaturnedmod",
  25090. 0x02bb,
  25091. "compass",
  25092. 0x263c,
  25093. "congruent",
  25094. 0x2245,
  25095. "contourintegral",
  25096. 0x222e,
  25097. "control",
  25098. 0x2303,
  25099. "controlACK",
  25100. 0x0006,
  25101. "controlBEL",
  25102. 0x0007,
  25103. "controlBS",
  25104. 0x0008,
  25105. "controlCAN",
  25106. 0x0018,
  25107. "controlCR",
  25108. 0x000d,
  25109. "controlDC1",
  25110. 0x0011,
  25111. "controlDC2",
  25112. 0x0012,
  25113. "controlDC3",
  25114. 0x0013,
  25115. "controlDC4",
  25116. 0x0014,
  25117. "controlDEL",
  25118. 0x007f,
  25119. "controlDLE",
  25120. 0x0010,
  25121. "controlEM",
  25122. 0x0019,
  25123. "controlENQ",
  25124. 0x0005,
  25125. "controlEOT",
  25126. 0x0004,
  25127. "controlESC",
  25128. 0x001b,
  25129. "controlETB",
  25130. 0x0017,
  25131. "controlETX",
  25132. 0x0003,
  25133. "controlFF",
  25134. 0x000c,
  25135. "controlFS",
  25136. 0x001c,
  25137. "controlGS",
  25138. 0x001d,
  25139. "controlHT",
  25140. 0x0009,
  25141. "controlLF",
  25142. 0x000a,
  25143. "controlNAK",
  25144. 0x0015,
  25145. "controlNULL",
  25146. 0x0000,
  25147. "controlRS",
  25148. 0x001e,
  25149. "controlSI",
  25150. 0x000f,
  25151. "controlSO",
  25152. 0x000e,
  25153. "controlSOT",
  25154. 0x0002,
  25155. "controlSTX",
  25156. 0x0001,
  25157. "controlSUB",
  25158. 0x001a,
  25159. "controlSYN",
  25160. 0x0016,
  25161. "controlUS",
  25162. 0x001f,
  25163. "controlVT",
  25164. 0x000b,
  25165. "copyright",
  25166. 0x00a9,
  25167. "copyrightsans",
  25168. 0xf8e9,
  25169. "copyrightserif",
  25170. 0xf6d9,
  25171. "cornerbracketleft",
  25172. 0x300c,
  25173. "cornerbracketlefthalfwidth",
  25174. 0xff62,
  25175. "cornerbracketleftvertical",
  25176. 0xfe41,
  25177. "cornerbracketright",
  25178. 0x300d,
  25179. "cornerbracketrighthalfwidth",
  25180. 0xff63,
  25181. "cornerbracketrightvertical",
  25182. 0xfe42,
  25183. "corporationsquare",
  25184. 0x337f,
  25185. "cosquare",
  25186. 0x33c7,
  25187. "coverkgsquare",
  25188. 0x33c6,
  25189. "cparen",
  25190. 0x249e,
  25191. "cruzeiro",
  25192. 0x20a2,
  25193. "cstretched",
  25194. 0x0297,
  25195. "curlyand",
  25196. 0x22cf,
  25197. "curlyor",
  25198. 0x22ce,
  25199. "currency",
  25200. 0x00a4,
  25201. "cyrBreve",
  25202. 0xf6d1,
  25203. "cyrFlex",
  25204. 0xf6d2,
  25205. "cyrbreve",
  25206. 0xf6d4,
  25207. "cyrflex",
  25208. 0xf6d5,
  25209. "d",
  25210. 0x0064,
  25211. "daarmenian",
  25212. 0x0564,
  25213. "dabengali",
  25214. 0x09a6,
  25215. "dadarabic",
  25216. 0x0636,
  25217. "dadeva",
  25218. 0x0926,
  25219. "dadfinalarabic",
  25220. 0xfebe,
  25221. "dadinitialarabic",
  25222. 0xfebf,
  25223. "dadmedialarabic",
  25224. 0xfec0,
  25225. "dagesh",
  25226. 0x05bc,
  25227. "dageshhebrew",
  25228. 0x05bc,
  25229. "dagger",
  25230. 0x2020,
  25231. "daggerdbl",
  25232. 0x2021,
  25233. "dagujarati",
  25234. 0x0aa6,
  25235. "dagurmukhi",
  25236. 0x0a26,
  25237. "dahiragana",
  25238. 0x3060,
  25239. "dakatakana",
  25240. 0x30c0,
  25241. "dalarabic",
  25242. 0x062f,
  25243. "dalet",
  25244. 0x05d3,
  25245. "daletdagesh",
  25246. 0xfb33,
  25247. "daletdageshhebrew",
  25248. 0xfb33,
  25249. "dalethebrew",
  25250. 0x05d3,
  25251. "dalfinalarabic",
  25252. 0xfeaa,
  25253. "dammaarabic",
  25254. 0x064f,
  25255. "dammalowarabic",
  25256. 0x064f,
  25257. "dammatanaltonearabic",
  25258. 0x064c,
  25259. "dammatanarabic",
  25260. 0x064c,
  25261. "danda",
  25262. 0x0964,
  25263. "dargahebrew",
  25264. 0x05a7,
  25265. "dargalefthebrew",
  25266. 0x05a7,
  25267. "dasiapneumatacyrilliccmb",
  25268. 0x0485,
  25269. "dblGrave",
  25270. 0xf6d3,
  25271. "dblanglebracketleft",
  25272. 0x300a,
  25273. "dblanglebracketleftvertical",
  25274. 0xfe3d,
  25275. "dblanglebracketright",
  25276. 0x300b,
  25277. "dblanglebracketrightvertical",
  25278. 0xfe3e,
  25279. "dblarchinvertedbelowcmb",
  25280. 0x032b,
  25281. "dblarrowleft",
  25282. 0x21d4,
  25283. "dblarrowright",
  25284. 0x21d2,
  25285. "dbldanda",
  25286. 0x0965,
  25287. "dblgrave",
  25288. 0xf6d6,
  25289. "dblgravecmb",
  25290. 0x030f,
  25291. "dblintegral",
  25292. 0x222c,
  25293. "dbllowline",
  25294. 0x2017,
  25295. "dbllowlinecmb",
  25296. 0x0333,
  25297. "dbloverlinecmb",
  25298. 0x033f,
  25299. "dblprimemod",
  25300. 0x02ba,
  25301. "dblverticalbar",
  25302. 0x2016,
  25303. "dblverticallineabovecmb",
  25304. 0x030e,
  25305. "dbopomofo",
  25306. 0x3109,
  25307. "dbsquare",
  25308. 0x33c8,
  25309. "dcaron",
  25310. 0x010f,
  25311. "dcedilla",
  25312. 0x1e11,
  25313. "dcircle",
  25314. 0x24d3,
  25315. "dcircumflexbelow",
  25316. 0x1e13,
  25317. "dcroat",
  25318. 0x0111,
  25319. "ddabengali",
  25320. 0x09a1,
  25321. "ddadeva",
  25322. 0x0921,
  25323. "ddagujarati",
  25324. 0x0aa1,
  25325. "ddagurmukhi",
  25326. 0x0a21,
  25327. "ddalarabic",
  25328. 0x0688,
  25329. "ddalfinalarabic",
  25330. 0xfb89,
  25331. "dddhadeva",
  25332. 0x095c,
  25333. "ddhabengali",
  25334. 0x09a2,
  25335. "ddhadeva",
  25336. 0x0922,
  25337. "ddhagujarati",
  25338. 0x0aa2,
  25339. "ddhagurmukhi",
  25340. 0x0a22,
  25341. "ddotaccent",
  25342. 0x1e0b,
  25343. "ddotbelow",
  25344. 0x1e0d,
  25345. "decimalseparatorarabic",
  25346. 0x066b,
  25347. "decimalseparatorpersian",
  25348. 0x066b,
  25349. "decyrillic",
  25350. 0x0434,
  25351. "degree",
  25352. 0x00b0,
  25353. "dehihebrew",
  25354. 0x05ad,
  25355. "dehiragana",
  25356. 0x3067,
  25357. "deicoptic",
  25358. 0x03ef,
  25359. "dekatakana",
  25360. 0x30c7,
  25361. "deleteleft",
  25362. 0x232b,
  25363. "deleteright",
  25364. 0x2326,
  25365. "delta",
  25366. 0x03b4,
  25367. "deltaturned",
  25368. 0x018d,
  25369. "denominatorminusonenumeratorbengali",
  25370. 0x09f8,
  25371. "dezh",
  25372. 0x02a4,
  25373. "dhabengali",
  25374. 0x09a7,
  25375. "dhadeva",
  25376. 0x0927,
  25377. "dhagujarati",
  25378. 0x0aa7,
  25379. "dhagurmukhi",
  25380. 0x0a27,
  25381. "dhook",
  25382. 0x0257,
  25383. "dialytikatonos",
  25384. 0x0385,
  25385. "dialytikatonoscmb",
  25386. 0x0344,
  25387. "diamond",
  25388. 0x2666,
  25389. "diamondsuitwhite",
  25390. 0x2662,
  25391. "dieresis",
  25392. 0x00a8,
  25393. "dieresisacute",
  25394. 0xf6d7,
  25395. "dieresisbelowcmb",
  25396. 0x0324,
  25397. "dieresiscmb",
  25398. 0x0308,
  25399. "dieresisgrave",
  25400. 0xf6d8,
  25401. "dieresistonos",
  25402. 0x0385,
  25403. "dihiragana",
  25404. 0x3062,
  25405. "dikatakana",
  25406. 0x30c2,
  25407. "dittomark",
  25408. 0x3003,
  25409. "divide",
  25410. 0x00f7,
  25411. "divides",
  25412. 0x2223,
  25413. "divisionslash",
  25414. 0x2215,
  25415. "djecyrillic",
  25416. 0x0452,
  25417. "dkshade",
  25418. 0x2593,
  25419. "dlinebelow",
  25420. 0x1e0f,
  25421. "dlsquare",
  25422. 0x3397,
  25423. "dmacron",
  25424. 0x0111,
  25425. "dmonospace",
  25426. 0xff44,
  25427. "dnblock",
  25428. 0x2584,
  25429. "dochadathai",
  25430. 0x0e0e,
  25431. "dodekthai",
  25432. 0x0e14,
  25433. "dohiragana",
  25434. 0x3069,
  25435. "dokatakana",
  25436. 0x30c9,
  25437. "dollar",
  25438. 0x0024,
  25439. "dollarinferior",
  25440. 0xf6e3,
  25441. "dollarmonospace",
  25442. 0xff04,
  25443. "dollaroldstyle",
  25444. 0xf724,
  25445. "dollarsmall",
  25446. 0xfe69,
  25447. "dollarsuperior",
  25448. 0xf6e4,
  25449. "dong",
  25450. 0x20ab,
  25451. "dorusquare",
  25452. 0x3326,
  25453. "dotaccent",
  25454. 0x02d9,
  25455. "dotaccentcmb",
  25456. 0x0307,
  25457. "dotbelowcmb",
  25458. 0x0323,
  25459. "dotbelowcomb",
  25460. 0x0323,
  25461. "dotkatakana",
  25462. 0x30fb,
  25463. "dotlessi",
  25464. 0x0131,
  25465. "dotlessj",
  25466. 0xf6be,
  25467. "dotlessjstrokehook",
  25468. 0x0284,
  25469. "dotmath",
  25470. 0x22c5,
  25471. "dottedcircle",
  25472. 0x25cc,
  25473. "doubleyodpatah",
  25474. 0xfb1f,
  25475. "doubleyodpatahhebrew",
  25476. 0xfb1f,
  25477. "downtackbelowcmb",
  25478. 0x031e,
  25479. "downtackmod",
  25480. 0x02d5,
  25481. "dparen",
  25482. 0x249f,
  25483. "dsuperior",
  25484. 0xf6eb,
  25485. "dtail",
  25486. 0x0256,
  25487. "dtopbar",
  25488. 0x018c,
  25489. "duhiragana",
  25490. 0x3065,
  25491. "dukatakana",
  25492. 0x30c5,
  25493. "dz",
  25494. 0x01f3,
  25495. "dzaltone",
  25496. 0x02a3,
  25497. "dzcaron",
  25498. 0x01c6,
  25499. "dzcurl",
  25500. 0x02a5,
  25501. "dzeabkhasiancyrillic",
  25502. 0x04e1,
  25503. "dzecyrillic",
  25504. 0x0455,
  25505. "dzhecyrillic",
  25506. 0x045f,
  25507. "e",
  25508. 0x0065,
  25509. "eacute",
  25510. 0x00e9,
  25511. "earth",
  25512. 0x2641,
  25513. "ebengali",
  25514. 0x098f,
  25515. "ebopomofo",
  25516. 0x311c,
  25517. "ebreve",
  25518. 0x0115,
  25519. "ecandradeva",
  25520. 0x090d,
  25521. "ecandragujarati",
  25522. 0x0a8d,
  25523. "ecandravowelsigndeva",
  25524. 0x0945,
  25525. "ecandravowelsigngujarati",
  25526. 0x0ac5,
  25527. "ecaron",
  25528. 0x011b,
  25529. "ecedillabreve",
  25530. 0x1e1d,
  25531. "echarmenian",
  25532. 0x0565,
  25533. "echyiwnarmenian",
  25534. 0x0587,
  25535. "ecircle",
  25536. 0x24d4,
  25537. "ecircumflex",
  25538. 0x00ea,
  25539. "ecircumflexacute",
  25540. 0x1ebf,
  25541. "ecircumflexbelow",
  25542. 0x1e19,
  25543. "ecircumflexdotbelow",
  25544. 0x1ec7,
  25545. "ecircumflexgrave",
  25546. 0x1ec1,
  25547. "ecircumflexhookabove",
  25548. 0x1ec3,
  25549. "ecircumflextilde",
  25550. 0x1ec5,
  25551. "ecyrillic",
  25552. 0x0454,
  25553. "edblgrave",
  25554. 0x0205,
  25555. "edeva",
  25556. 0x090f,
  25557. "edieresis",
  25558. 0x00eb,
  25559. "edot",
  25560. 0x0117,
  25561. "edotaccent",
  25562. 0x0117,
  25563. "edotbelow",
  25564. 0x1eb9,
  25565. "eegurmukhi",
  25566. 0x0a0f,
  25567. "eematragurmukhi",
  25568. 0x0a47,
  25569. "efcyrillic",
  25570. 0x0444,
  25571. "egrave",
  25572. 0x00e8,
  25573. "egujarati",
  25574. 0x0a8f,
  25575. "eharmenian",
  25576. 0x0567,
  25577. "ehbopomofo",
  25578. 0x311d,
  25579. "ehiragana",
  25580. 0x3048,
  25581. "ehookabove",
  25582. 0x1ebb,
  25583. "eibopomofo",
  25584. 0x311f,
  25585. "eight",
  25586. 0x0038,
  25587. "eightarabic",
  25588. 0x0668,
  25589. "eightbengali",
  25590. 0x09ee,
  25591. "eightcircle",
  25592. 0x2467,
  25593. "eightcircleinversesansserif",
  25594. 0x2791,
  25595. "eightdeva",
  25596. 0x096e,
  25597. "eighteencircle",
  25598. 0x2471,
  25599. "eighteenparen",
  25600. 0x2485,
  25601. "eighteenperiod",
  25602. 0x2499,
  25603. "eightgujarati",
  25604. 0x0aee,
  25605. "eightgurmukhi",
  25606. 0x0a6e,
  25607. "eighthackarabic",
  25608. 0x0668,
  25609. "eighthangzhou",
  25610. 0x3028,
  25611. "eighthnotebeamed",
  25612. 0x266b,
  25613. "eightideographicparen",
  25614. 0x3227,
  25615. "eightinferior",
  25616. 0x2088,
  25617. "eightmonospace",
  25618. 0xff18,
  25619. "eightoldstyle",
  25620. 0xf738,
  25621. "eightparen",
  25622. 0x247b,
  25623. "eightperiod",
  25624. 0x248f,
  25625. "eightpersian",
  25626. 0x06f8,
  25627. "eightroman",
  25628. 0x2177,
  25629. "eightsuperior",
  25630. 0x2078,
  25631. "eightthai",
  25632. 0x0e58,
  25633. "einvertedbreve",
  25634. 0x0207,
  25635. "eiotifiedcyrillic",
  25636. 0x0465,
  25637. "ekatakana",
  25638. 0x30a8,
  25639. "ekatakanahalfwidth",
  25640. 0xff74,
  25641. "ekonkargurmukhi",
  25642. 0x0a74,
  25643. "ekorean",
  25644. 0x3154,
  25645. "elcyrillic",
  25646. 0x043b,
  25647. "element",
  25648. 0x2208,
  25649. "elevencircle",
  25650. 0x246a,
  25651. "elevenparen",
  25652. 0x247e,
  25653. "elevenperiod",
  25654. 0x2492,
  25655. "elevenroman",
  25656. 0x217a,
  25657. "ellipsis",
  25658. 0x2026,
  25659. "ellipsisvertical",
  25660. 0x22ee,
  25661. "emacron",
  25662. 0x0113,
  25663. "emacronacute",
  25664. 0x1e17,
  25665. "emacrongrave",
  25666. 0x1e15,
  25667. "emcyrillic",
  25668. 0x043c,
  25669. "emdash",
  25670. 0x2014,
  25671. "emdashvertical",
  25672. 0xfe31,
  25673. "emonospace",
  25674. 0xff45,
  25675. "emphasismarkarmenian",
  25676. 0x055b,
  25677. "emptyset",
  25678. 0x2205,
  25679. "enbopomofo",
  25680. 0x3123,
  25681. "encyrillic",
  25682. 0x043d,
  25683. "endash",
  25684. 0x2013,
  25685. "endashvertical",
  25686. 0xfe32,
  25687. "endescendercyrillic",
  25688. 0x04a3,
  25689. "eng",
  25690. 0x014b,
  25691. "engbopomofo",
  25692. 0x3125,
  25693. "enghecyrillic",
  25694. 0x04a5,
  25695. "enhookcyrillic",
  25696. 0x04c8,
  25697. "enspace",
  25698. 0x2002,
  25699. "eogonek",
  25700. 0x0119,
  25701. "eokorean",
  25702. 0x3153,
  25703. "eopen",
  25704. 0x025b,
  25705. "eopenclosed",
  25706. 0x029a,
  25707. "eopenreversed",
  25708. 0x025c,
  25709. "eopenreversedclosed",
  25710. 0x025e,
  25711. "eopenreversedhook",
  25712. 0x025d,
  25713. "eparen",
  25714. 0x24a0,
  25715. "epsilon",
  25716. 0x03b5,
  25717. "epsilontonos",
  25718. 0x03ad,
  25719. "equal",
  25720. 0x003d,
  25721. "equalmonospace",
  25722. 0xff1d,
  25723. "equalsmall",
  25724. 0xfe66,
  25725. "equalsuperior",
  25726. 0x207c,
  25727. "equivalence",
  25728. 0x2261,
  25729. "erbopomofo",
  25730. 0x3126,
  25731. "ercyrillic",
  25732. 0x0440,
  25733. "ereversed",
  25734. 0x0258,
  25735. "ereversedcyrillic",
  25736. 0x044d,
  25737. "escyrillic",
  25738. 0x0441,
  25739. "esdescendercyrillic",
  25740. 0x04ab,
  25741. "esh",
  25742. 0x0283,
  25743. "eshcurl",
  25744. 0x0286,
  25745. "eshortdeva",
  25746. 0x090e,
  25747. "eshortvowelsigndeva",
  25748. 0x0946,
  25749. "eshreversedloop",
  25750. 0x01aa,
  25751. "eshsquatreversed",
  25752. 0x0285,
  25753. "esmallhiragana",
  25754. 0x3047,
  25755. "esmallkatakana",
  25756. 0x30a7,
  25757. "esmallkatakanahalfwidth",
  25758. 0xff6a,
  25759. "estimated",
  25760. 0x212e,
  25761. "esuperior",
  25762. 0xf6ec,
  25763. "eta",
  25764. 0x03b7,
  25765. "etarmenian",
  25766. 0x0568,
  25767. "etatonos",
  25768. 0x03ae,
  25769. "eth",
  25770. 0x00f0,
  25771. "etilde",
  25772. 0x1ebd,
  25773. "etildebelow",
  25774. 0x1e1b,
  25775. "etnahtafoukhhebrew",
  25776. 0x0591,
  25777. "etnahtafoukhlefthebrew",
  25778. 0x0591,
  25779. "etnahtahebrew",
  25780. 0x0591,
  25781. "etnahtalefthebrew",
  25782. 0x0591,
  25783. "eturned",
  25784. 0x01dd,
  25785. "eukorean",
  25786. 0x3161,
  25787. "euro",
  25788. 0x20ac,
  25789. "evowelsignbengali",
  25790. 0x09c7,
  25791. "evowelsigndeva",
  25792. 0x0947,
  25793. "evowelsigngujarati",
  25794. 0x0ac7,
  25795. "exclam",
  25796. 0x0021,
  25797. "exclamarmenian",
  25798. 0x055c,
  25799. "exclamdbl",
  25800. 0x203c,
  25801. "exclamdown",
  25802. 0x00a1,
  25803. "exclamdownsmall",
  25804. 0xf7a1,
  25805. "exclammonospace",
  25806. 0xff01,
  25807. "exclamsmall",
  25808. 0xf721,
  25809. "existential",
  25810. 0x2203,
  25811. "ezh",
  25812. 0x0292,
  25813. "ezhcaron",
  25814. 0x01ef,
  25815. "ezhcurl",
  25816. 0x0293,
  25817. "ezhreversed",
  25818. 0x01b9,
  25819. "ezhtail",
  25820. 0x01ba,
  25821. "f",
  25822. 0x0066,
  25823. "fadeva",
  25824. 0x095e,
  25825. "fagurmukhi",
  25826. 0x0a5e,
  25827. "fahrenheit",
  25828. 0x2109,
  25829. "fathaarabic",
  25830. 0x064e,
  25831. "fathalowarabic",
  25832. 0x064e,
  25833. "fathatanarabic",
  25834. 0x064b,
  25835. "fbopomofo",
  25836. 0x3108,
  25837. "fcircle",
  25838. 0x24d5,
  25839. "fdotaccent",
  25840. 0x1e1f,
  25841. "feharabic",
  25842. 0x0641,
  25843. "feharmenian",
  25844. 0x0586,
  25845. "fehfinalarabic",
  25846. 0xfed2,
  25847. "fehinitialarabic",
  25848. 0xfed3,
  25849. "fehmedialarabic",
  25850. 0xfed4,
  25851. "feicoptic",
  25852. 0x03e5,
  25853. "female",
  25854. 0x2640,
  25855. "ff",
  25856. 0xfb00,
  25857. "f_f",
  25858. 0xfb00,
  25859. "ffi",
  25860. 0xfb03,
  25861. "ffl",
  25862. 0xfb04,
  25863. "fi",
  25864. 0xfb01,
  25865. "fifteencircle",
  25866. 0x246e,
  25867. "fifteenparen",
  25868. 0x2482,
  25869. "fifteenperiod",
  25870. 0x2496,
  25871. "figuredash",
  25872. 0x2012,
  25873. "filledbox",
  25874. 0x25a0,
  25875. "filledrect",
  25876. 0x25ac,
  25877. "finalkaf",
  25878. 0x05da,
  25879. "finalkafdagesh",
  25880. 0xfb3a,
  25881. "finalkafdageshhebrew",
  25882. 0xfb3a,
  25883. "finalkafhebrew",
  25884. 0x05da,
  25885. "finalmem",
  25886. 0x05dd,
  25887. "finalmemhebrew",
  25888. 0x05dd,
  25889. "finalnun",
  25890. 0x05df,
  25891. "finalnunhebrew",
  25892. 0x05df,
  25893. "finalpe",
  25894. 0x05e3,
  25895. "finalpehebrew",
  25896. 0x05e3,
  25897. "finaltsadi",
  25898. 0x05e5,
  25899. "finaltsadihebrew",
  25900. 0x05e5,
  25901. "firsttonechinese",
  25902. 0x02c9,
  25903. "fisheye",
  25904. 0x25c9,
  25905. "fitacyrillic",
  25906. 0x0473,
  25907. "five",
  25908. 0x0035,
  25909. "fivearabic",
  25910. 0x0665,
  25911. "fivebengali",
  25912. 0x09eb,
  25913. "fivecircle",
  25914. 0x2464,
  25915. "fivecircleinversesansserif",
  25916. 0x278e,
  25917. "fivedeva",
  25918. 0x096b,
  25919. "fiveeighths",
  25920. 0x215d,
  25921. "fivegujarati",
  25922. 0x0aeb,
  25923. "fivegurmukhi",
  25924. 0x0a6b,
  25925. "fivehackarabic",
  25926. 0x0665,
  25927. "fivehangzhou",
  25928. 0x3025,
  25929. "fiveideographicparen",
  25930. 0x3224,
  25931. "fiveinferior",
  25932. 0x2085,
  25933. "fivemonospace",
  25934. 0xff15,
  25935. "fiveoldstyle",
  25936. 0xf735,
  25937. "fiveparen",
  25938. 0x2478,
  25939. "fiveperiod",
  25940. 0x248c,
  25941. "fivepersian",
  25942. 0x06f5,
  25943. "fiveroman",
  25944. 0x2174,
  25945. "fivesuperior",
  25946. 0x2075,
  25947. "fivethai",
  25948. 0x0e55,
  25949. "fl",
  25950. 0xfb02,
  25951. "florin",
  25952. 0x0192,
  25953. "fmonospace",
  25954. 0xff46,
  25955. "fmsquare",
  25956. 0x3399,
  25957. "fofanthai",
  25958. 0x0e1f,
  25959. "fofathai",
  25960. 0x0e1d,
  25961. "fongmanthai",
  25962. 0x0e4f,
  25963. "forall",
  25964. 0x2200,
  25965. "four",
  25966. 0x0034,
  25967. "fourarabic",
  25968. 0x0664,
  25969. "fourbengali",
  25970. 0x09ea,
  25971. "fourcircle",
  25972. 0x2463,
  25973. "fourcircleinversesansserif",
  25974. 0x278d,
  25975. "fourdeva",
  25976. 0x096a,
  25977. "fourgujarati",
  25978. 0x0aea,
  25979. "fourgurmukhi",
  25980. 0x0a6a,
  25981. "fourhackarabic",
  25982. 0x0664,
  25983. "fourhangzhou",
  25984. 0x3024,
  25985. "fourideographicparen",
  25986. 0x3223,
  25987. "fourinferior",
  25988. 0x2084,
  25989. "fourmonospace",
  25990. 0xff14,
  25991. "fournumeratorbengali",
  25992. 0x09f7,
  25993. "fouroldstyle",
  25994. 0xf734,
  25995. "fourparen",
  25996. 0x2477,
  25997. "fourperiod",
  25998. 0x248b,
  25999. "fourpersian",
  26000. 0x06f4,
  26001. "fourroman",
  26002. 0x2173,
  26003. "foursuperior",
  26004. 0x2074,
  26005. "fourteencircle",
  26006. 0x246d,
  26007. "fourteenparen",
  26008. 0x2481,
  26009. "fourteenperiod",
  26010. 0x2495,
  26011. "fourthai",
  26012. 0x0e54,
  26013. "fourthtonechinese",
  26014. 0x02cb,
  26015. "fparen",
  26016. 0x24a1,
  26017. "fraction",
  26018. 0x2044,
  26019. "franc",
  26020. 0x20a3,
  26021. "g",
  26022. 0x0067,
  26023. "gabengali",
  26024. 0x0997,
  26025. "gacute",
  26026. 0x01f5,
  26027. "gadeva",
  26028. 0x0917,
  26029. "gafarabic",
  26030. 0x06af,
  26031. "gaffinalarabic",
  26032. 0xfb93,
  26033. "gafinitialarabic",
  26034. 0xfb94,
  26035. "gafmedialarabic",
  26036. 0xfb95,
  26037. "gagujarati",
  26038. 0x0a97,
  26039. "gagurmukhi",
  26040. 0x0a17,
  26041. "gahiragana",
  26042. 0x304c,
  26043. "gakatakana",
  26044. 0x30ac,
  26045. "gamma",
  26046. 0x03b3,
  26047. "gammalatinsmall",
  26048. 0x0263,
  26049. "gammasuperior",
  26050. 0x02e0,
  26051. "gangiacoptic",
  26052. 0x03eb,
  26053. "gbopomofo",
  26054. 0x310d,
  26055. "gbreve",
  26056. 0x011f,
  26057. "gcaron",
  26058. 0x01e7,
  26059. "gcedilla",
  26060. 0x0123,
  26061. "gcircle",
  26062. 0x24d6,
  26063. "gcircumflex",
  26064. 0x011d,
  26065. "gcommaaccent",
  26066. 0x0123,
  26067. "gdot",
  26068. 0x0121,
  26069. "gdotaccent",
  26070. 0x0121,
  26071. "gecyrillic",
  26072. 0x0433,
  26073. "gehiragana",
  26074. 0x3052,
  26075. "gekatakana",
  26076. 0x30b2,
  26077. "geometricallyequal",
  26078. 0x2251,
  26079. "gereshaccenthebrew",
  26080. 0x059c,
  26081. "gereshhebrew",
  26082. 0x05f3,
  26083. "gereshmuqdamhebrew",
  26084. 0x059d,
  26085. "germandbls",
  26086. 0x00df,
  26087. "gershayimaccenthebrew",
  26088. 0x059e,
  26089. "gershayimhebrew",
  26090. 0x05f4,
  26091. "getamark",
  26092. 0x3013,
  26093. "ghabengali",
  26094. 0x0998,
  26095. "ghadarmenian",
  26096. 0x0572,
  26097. "ghadeva",
  26098. 0x0918,
  26099. "ghagujarati",
  26100. 0x0a98,
  26101. "ghagurmukhi",
  26102. 0x0a18,
  26103. "ghainarabic",
  26104. 0x063a,
  26105. "ghainfinalarabic",
  26106. 0xfece,
  26107. "ghaininitialarabic",
  26108. 0xfecf,
  26109. "ghainmedialarabic",
  26110. 0xfed0,
  26111. "ghemiddlehookcyrillic",
  26112. 0x0495,
  26113. "ghestrokecyrillic",
  26114. 0x0493,
  26115. "gheupturncyrillic",
  26116. 0x0491,
  26117. "ghhadeva",
  26118. 0x095a,
  26119. "ghhagurmukhi",
  26120. 0x0a5a,
  26121. "ghook",
  26122. 0x0260,
  26123. "ghzsquare",
  26124. 0x3393,
  26125. "gihiragana",
  26126. 0x304e,
  26127. "gikatakana",
  26128. 0x30ae,
  26129. "gimarmenian",
  26130. 0x0563,
  26131. "gimel",
  26132. 0x05d2,
  26133. "gimeldagesh",
  26134. 0xfb32,
  26135. "gimeldageshhebrew",
  26136. 0xfb32,
  26137. "gimelhebrew",
  26138. 0x05d2,
  26139. "gjecyrillic",
  26140. 0x0453,
  26141. "glottalinvertedstroke",
  26142. 0x01be,
  26143. "glottalstop",
  26144. 0x0294,
  26145. "glottalstopinverted",
  26146. 0x0296,
  26147. "glottalstopmod",
  26148. 0x02c0,
  26149. "glottalstopreversed",
  26150. 0x0295,
  26151. "glottalstopreversedmod",
  26152. 0x02c1,
  26153. "glottalstopreversedsuperior",
  26154. 0x02e4,
  26155. "glottalstopstroke",
  26156. 0x02a1,
  26157. "glottalstopstrokereversed",
  26158. 0x02a2,
  26159. "gmacron",
  26160. 0x1e21,
  26161. "gmonospace",
  26162. 0xff47,
  26163. "gohiragana",
  26164. 0x3054,
  26165. "gokatakana",
  26166. 0x30b4,
  26167. "gparen",
  26168. 0x24a2,
  26169. "gpasquare",
  26170. 0x33ac,
  26171. "gradient",
  26172. 0x2207,
  26173. "grave",
  26174. 0x0060,
  26175. "gravebelowcmb",
  26176. 0x0316,
  26177. "gravecmb",
  26178. 0x0300,
  26179. "gravecomb",
  26180. 0x0300,
  26181. "gravedeva",
  26182. 0x0953,
  26183. "gravelowmod",
  26184. 0x02ce,
  26185. "gravemonospace",
  26186. 0xff40,
  26187. "gravetonecmb",
  26188. 0x0340,
  26189. "greater",
  26190. 0x003e,
  26191. "greaterequal",
  26192. 0x2265,
  26193. "greaterequalorless",
  26194. 0x22db,
  26195. "greatermonospace",
  26196. 0xff1e,
  26197. "greaterorequivalent",
  26198. 0x2273,
  26199. "greaterorless",
  26200. 0x2277,
  26201. "greateroverequal",
  26202. 0x2267,
  26203. "greatersmall",
  26204. 0xfe65,
  26205. "gscript",
  26206. 0x0261,
  26207. "gstroke",
  26208. 0x01e5,
  26209. "guhiragana",
  26210. 0x3050,
  26211. "guillemotleft",
  26212. 0x00ab,
  26213. "guillemotright",
  26214. 0x00bb,
  26215. "guilsinglleft",
  26216. 0x2039,
  26217. "guilsinglright",
  26218. 0x203a,
  26219. "gukatakana",
  26220. 0x30b0,
  26221. "guramusquare",
  26222. 0x3318,
  26223. "gysquare",
  26224. 0x33c9,
  26225. "h",
  26226. 0x0068,
  26227. "haabkhasiancyrillic",
  26228. 0x04a9,
  26229. "haaltonearabic",
  26230. 0x06c1,
  26231. "habengali",
  26232. 0x09b9,
  26233. "hadescendercyrillic",
  26234. 0x04b3,
  26235. "hadeva",
  26236. 0x0939,
  26237. "hagujarati",
  26238. 0x0ab9,
  26239. "hagurmukhi",
  26240. 0x0a39,
  26241. "haharabic",
  26242. 0x062d,
  26243. "hahfinalarabic",
  26244. 0xfea2,
  26245. "hahinitialarabic",
  26246. 0xfea3,
  26247. "hahiragana",
  26248. 0x306f,
  26249. "hahmedialarabic",
  26250. 0xfea4,
  26251. "haitusquare",
  26252. 0x332a,
  26253. "hakatakana",
  26254. 0x30cf,
  26255. "hakatakanahalfwidth",
  26256. 0xff8a,
  26257. "halantgurmukhi",
  26258. 0x0a4d,
  26259. "hamzaarabic",
  26260. 0x0621,
  26261. "hamzalowarabic",
  26262. 0x0621,
  26263. "hangulfiller",
  26264. 0x3164,
  26265. "hardsigncyrillic",
  26266. 0x044a,
  26267. "harpoonleftbarbup",
  26268. 0x21bc,
  26269. "harpoonrightbarbup",
  26270. 0x21c0,
  26271. "hasquare",
  26272. 0x33ca,
  26273. "hatafpatah",
  26274. 0x05b2,
  26275. "hatafpatah16",
  26276. 0x05b2,
  26277. "hatafpatah23",
  26278. 0x05b2,
  26279. "hatafpatah2f",
  26280. 0x05b2,
  26281. "hatafpatahhebrew",
  26282. 0x05b2,
  26283. "hatafpatahnarrowhebrew",
  26284. 0x05b2,
  26285. "hatafpatahquarterhebrew",
  26286. 0x05b2,
  26287. "hatafpatahwidehebrew",
  26288. 0x05b2,
  26289. "hatafqamats",
  26290. 0x05b3,
  26291. "hatafqamats1b",
  26292. 0x05b3,
  26293. "hatafqamats28",
  26294. 0x05b3,
  26295. "hatafqamats34",
  26296. 0x05b3,
  26297. "hatafqamatshebrew",
  26298. 0x05b3,
  26299. "hatafqamatsnarrowhebrew",
  26300. 0x05b3,
  26301. "hatafqamatsquarterhebrew",
  26302. 0x05b3,
  26303. "hatafqamatswidehebrew",
  26304. 0x05b3,
  26305. "hatafsegol",
  26306. 0x05b1,
  26307. "hatafsegol17",
  26308. 0x05b1,
  26309. "hatafsegol24",
  26310. 0x05b1,
  26311. "hatafsegol30",
  26312. 0x05b1,
  26313. "hatafsegolhebrew",
  26314. 0x05b1,
  26315. "hatafsegolnarrowhebrew",
  26316. 0x05b1,
  26317. "hatafsegolquarterhebrew",
  26318. 0x05b1,
  26319. "hatafsegolwidehebrew",
  26320. 0x05b1,
  26321. "hbar",
  26322. 0x0127,
  26323. "hbopomofo",
  26324. 0x310f,
  26325. "hbrevebelow",
  26326. 0x1e2b,
  26327. "hcedilla",
  26328. 0x1e29,
  26329. "hcircle",
  26330. 0x24d7,
  26331. "hcircumflex",
  26332. 0x0125,
  26333. "hdieresis",
  26334. 0x1e27,
  26335. "hdotaccent",
  26336. 0x1e23,
  26337. "hdotbelow",
  26338. 0x1e25,
  26339. "he",
  26340. 0x05d4,
  26341. "heart",
  26342. 0x2665,
  26343. "heartsuitblack",
  26344. 0x2665,
  26345. "heartsuitwhite",
  26346. 0x2661,
  26347. "hedagesh",
  26348. 0xfb34,
  26349. "hedageshhebrew",
  26350. 0xfb34,
  26351. "hehaltonearabic",
  26352. 0x06c1,
  26353. "heharabic",
  26354. 0x0647,
  26355. "hehebrew",
  26356. 0x05d4,
  26357. "hehfinalaltonearabic",
  26358. 0xfba7,
  26359. "hehfinalalttwoarabic",
  26360. 0xfeea,
  26361. "hehfinalarabic",
  26362. 0xfeea,
  26363. "hehhamzaabovefinalarabic",
  26364. 0xfba5,
  26365. "hehhamzaaboveisolatedarabic",
  26366. 0xfba4,
  26367. "hehinitialaltonearabic",
  26368. 0xfba8,
  26369. "hehinitialarabic",
  26370. 0xfeeb,
  26371. "hehiragana",
  26372. 0x3078,
  26373. "hehmedialaltonearabic",
  26374. 0xfba9,
  26375. "hehmedialarabic",
  26376. 0xfeec,
  26377. "heiseierasquare",
  26378. 0x337b,
  26379. "hekatakana",
  26380. 0x30d8,
  26381. "hekatakanahalfwidth",
  26382. 0xff8d,
  26383. "hekutaarusquare",
  26384. 0x3336,
  26385. "henghook",
  26386. 0x0267,
  26387. "herutusquare",
  26388. 0x3339,
  26389. "het",
  26390. 0x05d7,
  26391. "hethebrew",
  26392. 0x05d7,
  26393. "hhook",
  26394. 0x0266,
  26395. "hhooksuperior",
  26396. 0x02b1,
  26397. "hieuhacirclekorean",
  26398. 0x327b,
  26399. "hieuhaparenkorean",
  26400. 0x321b,
  26401. "hieuhcirclekorean",
  26402. 0x326d,
  26403. "hieuhkorean",
  26404. 0x314e,
  26405. "hieuhparenkorean",
  26406. 0x320d,
  26407. "hihiragana",
  26408. 0x3072,
  26409. "hikatakana",
  26410. 0x30d2,
  26411. "hikatakanahalfwidth",
  26412. 0xff8b,
  26413. "hiriq",
  26414. 0x05b4,
  26415. "hiriq14",
  26416. 0x05b4,
  26417. "hiriq21",
  26418. 0x05b4,
  26419. "hiriq2d",
  26420. 0x05b4,
  26421. "hiriqhebrew",
  26422. 0x05b4,
  26423. "hiriqnarrowhebrew",
  26424. 0x05b4,
  26425. "hiriqquarterhebrew",
  26426. 0x05b4,
  26427. "hiriqwidehebrew",
  26428. 0x05b4,
  26429. "hlinebelow",
  26430. 0x1e96,
  26431. "hmonospace",
  26432. 0xff48,
  26433. "hoarmenian",
  26434. 0x0570,
  26435. "hohipthai",
  26436. 0x0e2b,
  26437. "hohiragana",
  26438. 0x307b,
  26439. "hokatakana",
  26440. 0x30db,
  26441. "hokatakanahalfwidth",
  26442. 0xff8e,
  26443. "holam",
  26444. 0x05b9,
  26445. "holam19",
  26446. 0x05b9,
  26447. "holam26",
  26448. 0x05b9,
  26449. "holam32",
  26450. 0x05b9,
  26451. "holamhebrew",
  26452. 0x05b9,
  26453. "holamnarrowhebrew",
  26454. 0x05b9,
  26455. "holamquarterhebrew",
  26456. 0x05b9,
  26457. "holamwidehebrew",
  26458. 0x05b9,
  26459. "honokhukthai",
  26460. 0x0e2e,
  26461. "hookabovecomb",
  26462. 0x0309,
  26463. "hookcmb",
  26464. 0x0309,
  26465. "hookpalatalizedbelowcmb",
  26466. 0x0321,
  26467. "hookretroflexbelowcmb",
  26468. 0x0322,
  26469. "hoonsquare",
  26470. 0x3342,
  26471. "horicoptic",
  26472. 0x03e9,
  26473. "horizontalbar",
  26474. 0x2015,
  26475. "horncmb",
  26476. 0x031b,
  26477. "hotsprings",
  26478. 0x2668,
  26479. "house",
  26480. 0x2302,
  26481. "hparen",
  26482. 0x24a3,
  26483. "hsuperior",
  26484. 0x02b0,
  26485. "hturned",
  26486. 0x0265,
  26487. "huhiragana",
  26488. 0x3075,
  26489. "huiitosquare",
  26490. 0x3333,
  26491. "hukatakana",
  26492. 0x30d5,
  26493. "hukatakanahalfwidth",
  26494. 0xff8c,
  26495. "hungarumlaut",
  26496. 0x02dd,
  26497. "hungarumlautcmb",
  26498. 0x030b,
  26499. "hv",
  26500. 0x0195,
  26501. "hyphen",
  26502. 0x002d,
  26503. "hypheninferior",
  26504. 0xf6e5,
  26505. "hyphenmonospace",
  26506. 0xff0d,
  26507. "hyphensmall",
  26508. 0xfe63,
  26509. "hyphensuperior",
  26510. 0xf6e6,
  26511. "hyphentwo",
  26512. 0x2010,
  26513. "i",
  26514. 0x0069,
  26515. "iacute",
  26516. 0x00ed,
  26517. "iacyrillic",
  26518. 0x044f,
  26519. "ibengali",
  26520. 0x0987,
  26521. "ibopomofo",
  26522. 0x3127,
  26523. "ibreve",
  26524. 0x012d,
  26525. "icaron",
  26526. 0x01d0,
  26527. "icircle",
  26528. 0x24d8,
  26529. "icircumflex",
  26530. 0x00ee,
  26531. "icyrillic",
  26532. 0x0456,
  26533. "idblgrave",
  26534. 0x0209,
  26535. "ideographearthcircle",
  26536. 0x328f,
  26537. "ideographfirecircle",
  26538. 0x328b,
  26539. "ideographicallianceparen",
  26540. 0x323f,
  26541. "ideographiccallparen",
  26542. 0x323a,
  26543. "ideographiccentrecircle",
  26544. 0x32a5,
  26545. "ideographicclose",
  26546. 0x3006,
  26547. "ideographiccomma",
  26548. 0x3001,
  26549. "ideographiccommaleft",
  26550. 0xff64,
  26551. "ideographiccongratulationparen",
  26552. 0x3237,
  26553. "ideographiccorrectcircle",
  26554. 0x32a3,
  26555. "ideographicearthparen",
  26556. 0x322f,
  26557. "ideographicenterpriseparen",
  26558. 0x323d,
  26559. "ideographicexcellentcircle",
  26560. 0x329d,
  26561. "ideographicfestivalparen",
  26562. 0x3240,
  26563. "ideographicfinancialcircle",
  26564. 0x3296,
  26565. "ideographicfinancialparen",
  26566. 0x3236,
  26567. "ideographicfireparen",
  26568. 0x322b,
  26569. "ideographichaveparen",
  26570. 0x3232,
  26571. "ideographichighcircle",
  26572. 0x32a4,
  26573. "ideographiciterationmark",
  26574. 0x3005,
  26575. "ideographiclaborcircle",
  26576. 0x3298,
  26577. "ideographiclaborparen",
  26578. 0x3238,
  26579. "ideographicleftcircle",
  26580. 0x32a7,
  26581. "ideographiclowcircle",
  26582. 0x32a6,
  26583. "ideographicmedicinecircle",
  26584. 0x32a9,
  26585. "ideographicmetalparen",
  26586. 0x322e,
  26587. "ideographicmoonparen",
  26588. 0x322a,
  26589. "ideographicnameparen",
  26590. 0x3234,
  26591. "ideographicperiod",
  26592. 0x3002,
  26593. "ideographicprintcircle",
  26594. 0x329e,
  26595. "ideographicreachparen",
  26596. 0x3243,
  26597. "ideographicrepresentparen",
  26598. 0x3239,
  26599. "ideographicresourceparen",
  26600. 0x323e,
  26601. "ideographicrightcircle",
  26602. 0x32a8,
  26603. "ideographicsecretcircle",
  26604. 0x3299,
  26605. "ideographicselfparen",
  26606. 0x3242,
  26607. "ideographicsocietyparen",
  26608. 0x3233,
  26609. "ideographicspace",
  26610. 0x3000,
  26611. "ideographicspecialparen",
  26612. 0x3235,
  26613. "ideographicstockparen",
  26614. 0x3231,
  26615. "ideographicstudyparen",
  26616. 0x323b,
  26617. "ideographicsunparen",
  26618. 0x3230,
  26619. "ideographicsuperviseparen",
  26620. 0x323c,
  26621. "ideographicwaterparen",
  26622. 0x322c,
  26623. "ideographicwoodparen",
  26624. 0x322d,
  26625. "ideographiczero",
  26626. 0x3007,
  26627. "ideographmetalcircle",
  26628. 0x328e,
  26629. "ideographmooncircle",
  26630. 0x328a,
  26631. "ideographnamecircle",
  26632. 0x3294,
  26633. "ideographsuncircle",
  26634. 0x3290,
  26635. "ideographwatercircle",
  26636. 0x328c,
  26637. "ideographwoodcircle",
  26638. 0x328d,
  26639. "ideva",
  26640. 0x0907,
  26641. "idieresis",
  26642. 0x00ef,
  26643. "idieresisacute",
  26644. 0x1e2f,
  26645. "idieresiscyrillic",
  26646. 0x04e5,
  26647. "idotbelow",
  26648. 0x1ecb,
  26649. "iebrevecyrillic",
  26650. 0x04d7,
  26651. "iecyrillic",
  26652. 0x0435,
  26653. "ieungacirclekorean",
  26654. 0x3275,
  26655. "ieungaparenkorean",
  26656. 0x3215,
  26657. "ieungcirclekorean",
  26658. 0x3267,
  26659. "ieungkorean",
  26660. 0x3147,
  26661. "ieungparenkorean",
  26662. 0x3207,
  26663. "igrave",
  26664. 0x00ec,
  26665. "igujarati",
  26666. 0x0a87,
  26667. "igurmukhi",
  26668. 0x0a07,
  26669. "ihiragana",
  26670. 0x3044,
  26671. "ihookabove",
  26672. 0x1ec9,
  26673. "iibengali",
  26674. 0x0988,
  26675. "iicyrillic",
  26676. 0x0438,
  26677. "iideva",
  26678. 0x0908,
  26679. "iigujarati",
  26680. 0x0a88,
  26681. "iigurmukhi",
  26682. 0x0a08,
  26683. "iimatragurmukhi",
  26684. 0x0a40,
  26685. "iinvertedbreve",
  26686. 0x020b,
  26687. "iishortcyrillic",
  26688. 0x0439,
  26689. "iivowelsignbengali",
  26690. 0x09c0,
  26691. "iivowelsigndeva",
  26692. 0x0940,
  26693. "iivowelsigngujarati",
  26694. 0x0ac0,
  26695. "ij",
  26696. 0x0133,
  26697. "ikatakana",
  26698. 0x30a4,
  26699. "ikatakanahalfwidth",
  26700. 0xff72,
  26701. "ikorean",
  26702. 0x3163,
  26703. "ilde",
  26704. 0x02dc,
  26705. "iluyhebrew",
  26706. 0x05ac,
  26707. "imacron",
  26708. 0x012b,
  26709. "imacroncyrillic",
  26710. 0x04e3,
  26711. "imageorapproximatelyequal",
  26712. 0x2253,
  26713. "imatragurmukhi",
  26714. 0x0a3f,
  26715. "imonospace",
  26716. 0xff49,
  26717. "increment",
  26718. 0x2206,
  26719. "infinity",
  26720. 0x221e,
  26721. "iniarmenian",
  26722. 0x056b,
  26723. "integral",
  26724. 0x222b,
  26725. "integralbottom",
  26726. 0x2321,
  26727. "integralbt",
  26728. 0x2321,
  26729. "integralex",
  26730. 0xf8f5,
  26731. "integraltop",
  26732. 0x2320,
  26733. "integraltp",
  26734. 0x2320,
  26735. "intersection",
  26736. 0x2229,
  26737. "intisquare",
  26738. 0x3305,
  26739. "invbullet",
  26740. 0x25d8,
  26741. "invcircle",
  26742. 0x25d9,
  26743. "invsmileface",
  26744. 0x263b,
  26745. "iocyrillic",
  26746. 0x0451,
  26747. "iogonek",
  26748. 0x012f,
  26749. "iota",
  26750. 0x03b9,
  26751. "iotadieresis",
  26752. 0x03ca,
  26753. "iotadieresistonos",
  26754. 0x0390,
  26755. "iotalatin",
  26756. 0x0269,
  26757. "iotatonos",
  26758. 0x03af,
  26759. "iparen",
  26760. 0x24a4,
  26761. "irigurmukhi",
  26762. 0x0a72,
  26763. "ismallhiragana",
  26764. 0x3043,
  26765. "ismallkatakana",
  26766. 0x30a3,
  26767. "ismallkatakanahalfwidth",
  26768. 0xff68,
  26769. "issharbengali",
  26770. 0x09fa,
  26771. "istroke",
  26772. 0x0268,
  26773. "isuperior",
  26774. 0xf6ed,
  26775. "iterationhiragana",
  26776. 0x309d,
  26777. "iterationkatakana",
  26778. 0x30fd,
  26779. "itilde",
  26780. 0x0129,
  26781. "itildebelow",
  26782. 0x1e2d,
  26783. "iubopomofo",
  26784. 0x3129,
  26785. "iucyrillic",
  26786. 0x044e,
  26787. "ivowelsignbengali",
  26788. 0x09bf,
  26789. "ivowelsigndeva",
  26790. 0x093f,
  26791. "ivowelsigngujarati",
  26792. 0x0abf,
  26793. "izhitsacyrillic",
  26794. 0x0475,
  26795. "izhitsadblgravecyrillic",
  26796. 0x0477,
  26797. "j",
  26798. 0x006a,
  26799. "jaarmenian",
  26800. 0x0571,
  26801. "jabengali",
  26802. 0x099c,
  26803. "jadeva",
  26804. 0x091c,
  26805. "jagujarati",
  26806. 0x0a9c,
  26807. "jagurmukhi",
  26808. 0x0a1c,
  26809. "jbopomofo",
  26810. 0x3110,
  26811. "jcaron",
  26812. 0x01f0,
  26813. "jcircle",
  26814. 0x24d9,
  26815. "jcircumflex",
  26816. 0x0135,
  26817. "jcrossedtail",
  26818. 0x029d,
  26819. "jdotlessstroke",
  26820. 0x025f,
  26821. "jecyrillic",
  26822. 0x0458,
  26823. "jeemarabic",
  26824. 0x062c,
  26825. "jeemfinalarabic",
  26826. 0xfe9e,
  26827. "jeeminitialarabic",
  26828. 0xfe9f,
  26829. "jeemmedialarabic",
  26830. 0xfea0,
  26831. "jeharabic",
  26832. 0x0698,
  26833. "jehfinalarabic",
  26834. 0xfb8b,
  26835. "jhabengali",
  26836. 0x099d,
  26837. "jhadeva",
  26838. 0x091d,
  26839. "jhagujarati",
  26840. 0x0a9d,
  26841. "jhagurmukhi",
  26842. 0x0a1d,
  26843. "jheharmenian",
  26844. 0x057b,
  26845. "jis",
  26846. 0x3004,
  26847. "jmonospace",
  26848. 0xff4a,
  26849. "jparen",
  26850. 0x24a5,
  26851. "jsuperior",
  26852. 0x02b2,
  26853. "k",
  26854. 0x006b,
  26855. "kabashkircyrillic",
  26856. 0x04a1,
  26857. "kabengali",
  26858. 0x0995,
  26859. "kacute",
  26860. 0x1e31,
  26861. "kacyrillic",
  26862. 0x043a,
  26863. "kadescendercyrillic",
  26864. 0x049b,
  26865. "kadeva",
  26866. 0x0915,
  26867. "kaf",
  26868. 0x05db,
  26869. "kafarabic",
  26870. 0x0643,
  26871. "kafdagesh",
  26872. 0xfb3b,
  26873. "kafdageshhebrew",
  26874. 0xfb3b,
  26875. "kaffinalarabic",
  26876. 0xfeda,
  26877. "kafhebrew",
  26878. 0x05db,
  26879. "kafinitialarabic",
  26880. 0xfedb,
  26881. "kafmedialarabic",
  26882. 0xfedc,
  26883. "kafrafehebrew",
  26884. 0xfb4d,
  26885. "kagujarati",
  26886. 0x0a95,
  26887. "kagurmukhi",
  26888. 0x0a15,
  26889. "kahiragana",
  26890. 0x304b,
  26891. "kahookcyrillic",
  26892. 0x04c4,
  26893. "kakatakana",
  26894. 0x30ab,
  26895. "kakatakanahalfwidth",
  26896. 0xff76,
  26897. "kappa",
  26898. 0x03ba,
  26899. "kappasymbolgreek",
  26900. 0x03f0,
  26901. "kapyeounmieumkorean",
  26902. 0x3171,
  26903. "kapyeounphieuphkorean",
  26904. 0x3184,
  26905. "kapyeounpieupkorean",
  26906. 0x3178,
  26907. "kapyeounssangpieupkorean",
  26908. 0x3179,
  26909. "karoriisquare",
  26910. 0x330d,
  26911. "kashidaautoarabic",
  26912. 0x0640,
  26913. "kashidaautonosidebearingarabic",
  26914. 0x0640,
  26915. "kasmallkatakana",
  26916. 0x30f5,
  26917. "kasquare",
  26918. 0x3384,
  26919. "kasraarabic",
  26920. 0x0650,
  26921. "kasratanarabic",
  26922. 0x064d,
  26923. "kastrokecyrillic",
  26924. 0x049f,
  26925. "katahiraprolongmarkhalfwidth",
  26926. 0xff70,
  26927. "kaverticalstrokecyrillic",
  26928. 0x049d,
  26929. "kbopomofo",
  26930. 0x310e,
  26931. "kcalsquare",
  26932. 0x3389,
  26933. "kcaron",
  26934. 0x01e9,
  26935. "kcedilla",
  26936. 0x0137,
  26937. "kcircle",
  26938. 0x24da,
  26939. "kcommaaccent",
  26940. 0x0137,
  26941. "kdotbelow",
  26942. 0x1e33,
  26943. "keharmenian",
  26944. 0x0584,
  26945. "kehiragana",
  26946. 0x3051,
  26947. "kekatakana",
  26948. 0x30b1,
  26949. "kekatakanahalfwidth",
  26950. 0xff79,
  26951. "kenarmenian",
  26952. 0x056f,
  26953. "kesmallkatakana",
  26954. 0x30f6,
  26955. "kgreenlandic",
  26956. 0x0138,
  26957. "khabengali",
  26958. 0x0996,
  26959. "khacyrillic",
  26960. 0x0445,
  26961. "khadeva",
  26962. 0x0916,
  26963. "khagujarati",
  26964. 0x0a96,
  26965. "khagurmukhi",
  26966. 0x0a16,
  26967. "khaharabic",
  26968. 0x062e,
  26969. "khahfinalarabic",
  26970. 0xfea6,
  26971. "khahinitialarabic",
  26972. 0xfea7,
  26973. "khahmedialarabic",
  26974. 0xfea8,
  26975. "kheicoptic",
  26976. 0x03e7,
  26977. "khhadeva",
  26978. 0x0959,
  26979. "khhagurmukhi",
  26980. 0x0a59,
  26981. "khieukhacirclekorean",
  26982. 0x3278,
  26983. "khieukhaparenkorean",
  26984. 0x3218,
  26985. "khieukhcirclekorean",
  26986. 0x326a,
  26987. "khieukhkorean",
  26988. 0x314b,
  26989. "khieukhparenkorean",
  26990. 0x320a,
  26991. "khokhaithai",
  26992. 0x0e02,
  26993. "khokhonthai",
  26994. 0x0e05,
  26995. "khokhuatthai",
  26996. 0x0e03,
  26997. "khokhwaithai",
  26998. 0x0e04,
  26999. "khomutthai",
  27000. 0x0e5b,
  27001. "khook",
  27002. 0x0199,
  27003. "khorakhangthai",
  27004. 0x0e06,
  27005. "khzsquare",
  27006. 0x3391,
  27007. "kihiragana",
  27008. 0x304d,
  27009. "kikatakana",
  27010. 0x30ad,
  27011. "kikatakanahalfwidth",
  27012. 0xff77,
  27013. "kiroguramusquare",
  27014. 0x3315,
  27015. "kiromeetorusquare",
  27016. 0x3316,
  27017. "kirosquare",
  27018. 0x3314,
  27019. "kiyeokacirclekorean",
  27020. 0x326e,
  27021. "kiyeokaparenkorean",
  27022. 0x320e,
  27023. "kiyeokcirclekorean",
  27024. 0x3260,
  27025. "kiyeokkorean",
  27026. 0x3131,
  27027. "kiyeokparenkorean",
  27028. 0x3200,
  27029. "kiyeoksioskorean",
  27030. 0x3133,
  27031. "kjecyrillic",
  27032. 0x045c,
  27033. "klinebelow",
  27034. 0x1e35,
  27035. "klsquare",
  27036. 0x3398,
  27037. "kmcubedsquare",
  27038. 0x33a6,
  27039. "kmonospace",
  27040. 0xff4b,
  27041. "kmsquaredsquare",
  27042. 0x33a2,
  27043. "kohiragana",
  27044. 0x3053,
  27045. "kohmsquare",
  27046. 0x33c0,
  27047. "kokaithai",
  27048. 0x0e01,
  27049. "kokatakana",
  27050. 0x30b3,
  27051. "kokatakanahalfwidth",
  27052. 0xff7a,
  27053. "kooposquare",
  27054. 0x331e,
  27055. "koppacyrillic",
  27056. 0x0481,
  27057. "koreanstandardsymbol",
  27058. 0x327f,
  27059. "koroniscmb",
  27060. 0x0343,
  27061. "kparen",
  27062. 0x24a6,
  27063. "kpasquare",
  27064. 0x33aa,
  27065. "ksicyrillic",
  27066. 0x046f,
  27067. "ktsquare",
  27068. 0x33cf,
  27069. "kturned",
  27070. 0x029e,
  27071. "kuhiragana",
  27072. 0x304f,
  27073. "kukatakana",
  27074. 0x30af,
  27075. "kukatakanahalfwidth",
  27076. 0xff78,
  27077. "kvsquare",
  27078. 0x33b8,
  27079. "kwsquare",
  27080. 0x33be,
  27081. "l",
  27082. 0x006c,
  27083. "labengali",
  27084. 0x09b2,
  27085. "lacute",
  27086. 0x013a,
  27087. "ladeva",
  27088. 0x0932,
  27089. "lagujarati",
  27090. 0x0ab2,
  27091. "lagurmukhi",
  27092. 0x0a32,
  27093. "lakkhangyaothai",
  27094. 0x0e45,
  27095. "lamaleffinalarabic",
  27096. 0xfefc,
  27097. "lamalefhamzaabovefinalarabic",
  27098. 0xfef8,
  27099. "lamalefhamzaaboveisolatedarabic",
  27100. 0xfef7,
  27101. "lamalefhamzabelowfinalarabic",
  27102. 0xfefa,
  27103. "lamalefhamzabelowisolatedarabic",
  27104. 0xfef9,
  27105. "lamalefisolatedarabic",
  27106. 0xfefb,
  27107. "lamalefmaddaabovefinalarabic",
  27108. 0xfef6,
  27109. "lamalefmaddaaboveisolatedarabic",
  27110. 0xfef5,
  27111. "lamarabic",
  27112. 0x0644,
  27113. "lambda",
  27114. 0x03bb,
  27115. "lambdastroke",
  27116. 0x019b,
  27117. "lamed",
  27118. 0x05dc,
  27119. "lameddagesh",
  27120. 0xfb3c,
  27121. "lameddageshhebrew",
  27122. 0xfb3c,
  27123. "lamedhebrew",
  27124. 0x05dc,
  27125. "lamfinalarabic",
  27126. 0xfede,
  27127. "lamhahinitialarabic",
  27128. 0xfcca,
  27129. "laminitialarabic",
  27130. 0xfedf,
  27131. "lamjeeminitialarabic",
  27132. 0xfcc9,
  27133. "lamkhahinitialarabic",
  27134. 0xfccb,
  27135. "lamlamhehisolatedarabic",
  27136. 0xfdf2,
  27137. "lammedialarabic",
  27138. 0xfee0,
  27139. "lammeemhahinitialarabic",
  27140. 0xfd88,
  27141. "lammeeminitialarabic",
  27142. 0xfccc,
  27143. "largecircle",
  27144. 0x25ef,
  27145. "lbar",
  27146. 0x019a,
  27147. "lbelt",
  27148. 0x026c,
  27149. "lbopomofo",
  27150. 0x310c,
  27151. "lcaron",
  27152. 0x013e,
  27153. "lcedilla",
  27154. 0x013c,
  27155. "lcircle",
  27156. 0x24db,
  27157. "lcircumflexbelow",
  27158. 0x1e3d,
  27159. "lcommaaccent",
  27160. 0x013c,
  27161. "ldot",
  27162. 0x0140,
  27163. "ldotaccent",
  27164. 0x0140,
  27165. "ldotbelow",
  27166. 0x1e37,
  27167. "ldotbelowmacron",
  27168. 0x1e39,
  27169. "leftangleabovecmb",
  27170. 0x031a,
  27171. "lefttackbelowcmb",
  27172. 0x0318,
  27173. "less",
  27174. 0x003c,
  27175. "lessequal",
  27176. 0x2264,
  27177. "lessequalorgreater",
  27178. 0x22da,
  27179. "lessmonospace",
  27180. 0xff1c,
  27181. "lessorequivalent",
  27182. 0x2272,
  27183. "lessorgreater",
  27184. 0x2276,
  27185. "lessoverequal",
  27186. 0x2266,
  27187. "lesssmall",
  27188. 0xfe64,
  27189. "lezh",
  27190. 0x026e,
  27191. "lfblock",
  27192. 0x258c,
  27193. "lhookretroflex",
  27194. 0x026d,
  27195. "lira",
  27196. 0x20a4,
  27197. "liwnarmenian",
  27198. 0x056c,
  27199. "lj",
  27200. 0x01c9,
  27201. "ljecyrillic",
  27202. 0x0459,
  27203. "ll",
  27204. 0xf6c0,
  27205. "lladeva",
  27206. 0x0933,
  27207. "llagujarati",
  27208. 0x0ab3,
  27209. "llinebelow",
  27210. 0x1e3b,
  27211. "llladeva",
  27212. 0x0934,
  27213. "llvocalicbengali",
  27214. 0x09e1,
  27215. "llvocalicdeva",
  27216. 0x0961,
  27217. "llvocalicvowelsignbengali",
  27218. 0x09e3,
  27219. "llvocalicvowelsigndeva",
  27220. 0x0963,
  27221. "lmiddletilde",
  27222. 0x026b,
  27223. "lmonospace",
  27224. 0xff4c,
  27225. "lmsquare",
  27226. 0x33d0,
  27227. "lochulathai",
  27228. 0x0e2c,
  27229. "logicaland",
  27230. 0x2227,
  27231. "logicalnot",
  27232. 0x00ac,
  27233. "logicalnotreversed",
  27234. 0x2310,
  27235. "logicalor",
  27236. 0x2228,
  27237. "lolingthai",
  27238. 0x0e25,
  27239. "longs",
  27240. 0x017f,
  27241. "lowlinecenterline",
  27242. 0xfe4e,
  27243. "lowlinecmb",
  27244. 0x0332,
  27245. "lowlinedashed",
  27246. 0xfe4d,
  27247. "lozenge",
  27248. 0x25ca,
  27249. "lparen",
  27250. 0x24a7,
  27251. "lslash",
  27252. 0x0142,
  27253. "lsquare",
  27254. 0x2113,
  27255. "lsuperior",
  27256. 0xf6ee,
  27257. "ltshade",
  27258. 0x2591,
  27259. "luthai",
  27260. 0x0e26,
  27261. "lvocalicbengali",
  27262. 0x098c,
  27263. "lvocalicdeva",
  27264. 0x090c,
  27265. "lvocalicvowelsignbengali",
  27266. 0x09e2,
  27267. "lvocalicvowelsigndeva",
  27268. 0x0962,
  27269. "lxsquare",
  27270. 0x33d3,
  27271. "m",
  27272. 0x006d,
  27273. "mabengali",
  27274. 0x09ae,
  27275. "macron",
  27276. 0x00af,
  27277. "macronbelowcmb",
  27278. 0x0331,
  27279. "macroncmb",
  27280. 0x0304,
  27281. "macronlowmod",
  27282. 0x02cd,
  27283. "macronmonospace",
  27284. 0xffe3,
  27285. "macute",
  27286. 0x1e3f,
  27287. "madeva",
  27288. 0x092e,
  27289. "magujarati",
  27290. 0x0aae,
  27291. "magurmukhi",
  27292. 0x0a2e,
  27293. "mahapakhhebrew",
  27294. 0x05a4,
  27295. "mahapakhlefthebrew",
  27296. 0x05a4,
  27297. "mahiragana",
  27298. 0x307e,
  27299. "maichattawalowleftthai",
  27300. 0xf895,
  27301. "maichattawalowrightthai",
  27302. 0xf894,
  27303. "maichattawathai",
  27304. 0x0e4b,
  27305. "maichattawaupperleftthai",
  27306. 0xf893,
  27307. "maieklowleftthai",
  27308. 0xf88c,
  27309. "maieklowrightthai",
  27310. 0xf88b,
  27311. "maiekthai",
  27312. 0x0e48,
  27313. "maiekupperleftthai",
  27314. 0xf88a,
  27315. "maihanakatleftthai",
  27316. 0xf884,
  27317. "maihanakatthai",
  27318. 0x0e31,
  27319. "maitaikhuleftthai",
  27320. 0xf889,
  27321. "maitaikhuthai",
  27322. 0x0e47,
  27323. "maitholowleftthai",
  27324. 0xf88f,
  27325. "maitholowrightthai",
  27326. 0xf88e,
  27327. "maithothai",
  27328. 0x0e49,
  27329. "maithoupperleftthai",
  27330. 0xf88d,
  27331. "maitrilowleftthai",
  27332. 0xf892,
  27333. "maitrilowrightthai",
  27334. 0xf891,
  27335. "maitrithai",
  27336. 0x0e4a,
  27337. "maitriupperleftthai",
  27338. 0xf890,
  27339. "maiyamokthai",
  27340. 0x0e46,
  27341. "makatakana",
  27342. 0x30de,
  27343. "makatakanahalfwidth",
  27344. 0xff8f,
  27345. "male",
  27346. 0x2642,
  27347. "mansyonsquare",
  27348. 0x3347,
  27349. "maqafhebrew",
  27350. 0x05be,
  27351. "mars",
  27352. 0x2642,
  27353. "masoracirclehebrew",
  27354. 0x05af,
  27355. "masquare",
  27356. 0x3383,
  27357. "mbopomofo",
  27358. 0x3107,
  27359. "mbsquare",
  27360. 0x33d4,
  27361. "mcircle",
  27362. 0x24dc,
  27363. "mcubedsquare",
  27364. 0x33a5,
  27365. "mdotaccent",
  27366. 0x1e41,
  27367. "mdotbelow",
  27368. 0x1e43,
  27369. "meemarabic",
  27370. 0x0645,
  27371. "meemfinalarabic",
  27372. 0xfee2,
  27373. "meeminitialarabic",
  27374. 0xfee3,
  27375. "meemmedialarabic",
  27376. 0xfee4,
  27377. "meemmeeminitialarabic",
  27378. 0xfcd1,
  27379. "meemmeemisolatedarabic",
  27380. 0xfc48,
  27381. "meetorusquare",
  27382. 0x334d,
  27383. "mehiragana",
  27384. 0x3081,
  27385. "meizierasquare",
  27386. 0x337e,
  27387. "mekatakana",
  27388. 0x30e1,
  27389. "mekatakanahalfwidth",
  27390. 0xff92,
  27391. "mem",
  27392. 0x05de,
  27393. "memdagesh",
  27394. 0xfb3e,
  27395. "memdageshhebrew",
  27396. 0xfb3e,
  27397. "memhebrew",
  27398. 0x05de,
  27399. "menarmenian",
  27400. 0x0574,
  27401. "merkhahebrew",
  27402. 0x05a5,
  27403. "merkhakefulahebrew",
  27404. 0x05a6,
  27405. "merkhakefulalefthebrew",
  27406. 0x05a6,
  27407. "merkhalefthebrew",
  27408. 0x05a5,
  27409. "mhook",
  27410. 0x0271,
  27411. "mhzsquare",
  27412. 0x3392,
  27413. "middledotkatakanahalfwidth",
  27414. 0xff65,
  27415. "middot",
  27416. 0x00b7,
  27417. "mieumacirclekorean",
  27418. 0x3272,
  27419. "mieumaparenkorean",
  27420. 0x3212,
  27421. "mieumcirclekorean",
  27422. 0x3264,
  27423. "mieumkorean",
  27424. 0x3141,
  27425. "mieumpansioskorean",
  27426. 0x3170,
  27427. "mieumparenkorean",
  27428. 0x3204,
  27429. "mieumpieupkorean",
  27430. 0x316e,
  27431. "mieumsioskorean",
  27432. 0x316f,
  27433. "mihiragana",
  27434. 0x307f,
  27435. "mikatakana",
  27436. 0x30df,
  27437. "mikatakanahalfwidth",
  27438. 0xff90,
  27439. "minus",
  27440. 0x2212,
  27441. "minusbelowcmb",
  27442. 0x0320,
  27443. "minuscircle",
  27444. 0x2296,
  27445. "minusmod",
  27446. 0x02d7,
  27447. "minusplus",
  27448. 0x2213,
  27449. "minute",
  27450. 0x2032,
  27451. "miribaarusquare",
  27452. 0x334a,
  27453. "mirisquare",
  27454. 0x3349,
  27455. "mlonglegturned",
  27456. 0x0270,
  27457. "mlsquare",
  27458. 0x3396,
  27459. "mmcubedsquare",
  27460. 0x33a3,
  27461. "mmonospace",
  27462. 0xff4d,
  27463. "mmsquaredsquare",
  27464. 0x339f,
  27465. "mohiragana",
  27466. 0x3082,
  27467. "mohmsquare",
  27468. 0x33c1,
  27469. "mokatakana",
  27470. 0x30e2,
  27471. "mokatakanahalfwidth",
  27472. 0xff93,
  27473. "molsquare",
  27474. 0x33d6,
  27475. "momathai",
  27476. 0x0e21,
  27477. "moverssquare",
  27478. 0x33a7,
  27479. "moverssquaredsquare",
  27480. 0x33a8,
  27481. "mparen",
  27482. 0x24a8,
  27483. "mpasquare",
  27484. 0x33ab,
  27485. "mssquare",
  27486. 0x33b3,
  27487. "msuperior",
  27488. 0xf6ef,
  27489. "mturned",
  27490. 0x026f,
  27491. "mu",
  27492. 0x00b5,
  27493. "mu1",
  27494. 0x00b5,
  27495. "muasquare",
  27496. 0x3382,
  27497. "muchgreater",
  27498. 0x226b,
  27499. "muchless",
  27500. 0x226a,
  27501. "mufsquare",
  27502. 0x338c,
  27503. "mugreek",
  27504. 0x03bc,
  27505. "mugsquare",
  27506. 0x338d,
  27507. "muhiragana",
  27508. 0x3080,
  27509. "mukatakana",
  27510. 0x30e0,
  27511. "mukatakanahalfwidth",
  27512. 0xff91,
  27513. "mulsquare",
  27514. 0x3395,
  27515. "multiply",
  27516. 0x00d7,
  27517. "mumsquare",
  27518. 0x339b,
  27519. "munahhebrew",
  27520. 0x05a3,
  27521. "munahlefthebrew",
  27522. 0x05a3,
  27523. "musicalnote",
  27524. 0x266a,
  27525. "musicalnotedbl",
  27526. 0x266b,
  27527. "musicflatsign",
  27528. 0x266d,
  27529. "musicsharpsign",
  27530. 0x266f,
  27531. "mussquare",
  27532. 0x33b2,
  27533. "muvsquare",
  27534. 0x33b6,
  27535. "muwsquare",
  27536. 0x33bc,
  27537. "mvmegasquare",
  27538. 0x33b9,
  27539. "mvsquare",
  27540. 0x33b7,
  27541. "mwmegasquare",
  27542. 0x33bf,
  27543. "mwsquare",
  27544. 0x33bd,
  27545. "n",
  27546. 0x006e,
  27547. "nabengali",
  27548. 0x09a8,
  27549. "nabla",
  27550. 0x2207,
  27551. "nacute",
  27552. 0x0144,
  27553. "nadeva",
  27554. 0x0928,
  27555. "nagujarati",
  27556. 0x0aa8,
  27557. "nagurmukhi",
  27558. 0x0a28,
  27559. "nahiragana",
  27560. 0x306a,
  27561. "nakatakana",
  27562. 0x30ca,
  27563. "nakatakanahalfwidth",
  27564. 0xff85,
  27565. "napostrophe",
  27566. 0x0149,
  27567. "nasquare",
  27568. 0x3381,
  27569. "nbopomofo",
  27570. 0x310b,
  27571. "nbspace",
  27572. 0x00a0,
  27573. "ncaron",
  27574. 0x0148,
  27575. "ncedilla",
  27576. 0x0146,
  27577. "ncircle",
  27578. 0x24dd,
  27579. "ncircumflexbelow",
  27580. 0x1e4b,
  27581. "ncommaaccent",
  27582. 0x0146,
  27583. "ndotaccent",
  27584. 0x1e45,
  27585. "ndotbelow",
  27586. 0x1e47,
  27587. "nehiragana",
  27588. 0x306d,
  27589. "nekatakana",
  27590. 0x30cd,
  27591. "nekatakanahalfwidth",
  27592. 0xff88,
  27593. "newsheqelsign",
  27594. 0x20aa,
  27595. "nfsquare",
  27596. 0x338b,
  27597. "ngabengali",
  27598. 0x0999,
  27599. "ngadeva",
  27600. 0x0919,
  27601. "ngagujarati",
  27602. 0x0a99,
  27603. "ngagurmukhi",
  27604. 0x0a19,
  27605. "ngonguthai",
  27606. 0x0e07,
  27607. "nhiragana",
  27608. 0x3093,
  27609. "nhookleft",
  27610. 0x0272,
  27611. "nhookretroflex",
  27612. 0x0273,
  27613. "nieunacirclekorean",
  27614. 0x326f,
  27615. "nieunaparenkorean",
  27616. 0x320f,
  27617. "nieuncieuckorean",
  27618. 0x3135,
  27619. "nieuncirclekorean",
  27620. 0x3261,
  27621. "nieunhieuhkorean",
  27622. 0x3136,
  27623. "nieunkorean",
  27624. 0x3134,
  27625. "nieunpansioskorean",
  27626. 0x3168,
  27627. "nieunparenkorean",
  27628. 0x3201,
  27629. "nieunsioskorean",
  27630. 0x3167,
  27631. "nieuntikeutkorean",
  27632. 0x3166,
  27633. "nihiragana",
  27634. 0x306b,
  27635. "nikatakana",
  27636. 0x30cb,
  27637. "nikatakanahalfwidth",
  27638. 0xff86,
  27639. "nikhahitleftthai",
  27640. 0xf899,
  27641. "nikhahitthai",
  27642. 0x0e4d,
  27643. "nine",
  27644. 0x0039,
  27645. "ninearabic",
  27646. 0x0669,
  27647. "ninebengali",
  27648. 0x09ef,
  27649. "ninecircle",
  27650. 0x2468,
  27651. "ninecircleinversesansserif",
  27652. 0x2792,
  27653. "ninedeva",
  27654. 0x096f,
  27655. "ninegujarati",
  27656. 0x0aef,
  27657. "ninegurmukhi",
  27658. 0x0a6f,
  27659. "ninehackarabic",
  27660. 0x0669,
  27661. "ninehangzhou",
  27662. 0x3029,
  27663. "nineideographicparen",
  27664. 0x3228,
  27665. "nineinferior",
  27666. 0x2089,
  27667. "ninemonospace",
  27668. 0xff19,
  27669. "nineoldstyle",
  27670. 0xf739,
  27671. "nineparen",
  27672. 0x247c,
  27673. "nineperiod",
  27674. 0x2490,
  27675. "ninepersian",
  27676. 0x06f9,
  27677. "nineroman",
  27678. 0x2178,
  27679. "ninesuperior",
  27680. 0x2079,
  27681. "nineteencircle",
  27682. 0x2472,
  27683. "nineteenparen",
  27684. 0x2486,
  27685. "nineteenperiod",
  27686. 0x249a,
  27687. "ninethai",
  27688. 0x0e59,
  27689. "nj",
  27690. 0x01cc,
  27691. "njecyrillic",
  27692. 0x045a,
  27693. "nkatakana",
  27694. 0x30f3,
  27695. "nkatakanahalfwidth",
  27696. 0xff9d,
  27697. "nlegrightlong",
  27698. 0x019e,
  27699. "nlinebelow",
  27700. 0x1e49,
  27701. "nmonospace",
  27702. 0xff4e,
  27703. "nmsquare",
  27704. 0x339a,
  27705. "nnabengali",
  27706. 0x09a3,
  27707. "nnadeva",
  27708. 0x0923,
  27709. "nnagujarati",
  27710. 0x0aa3,
  27711. "nnagurmukhi",
  27712. 0x0a23,
  27713. "nnnadeva",
  27714. 0x0929,
  27715. "nohiragana",
  27716. 0x306e,
  27717. "nokatakana",
  27718. 0x30ce,
  27719. "nokatakanahalfwidth",
  27720. 0xff89,
  27721. "nonbreakingspace",
  27722. 0x00a0,
  27723. "nonenthai",
  27724. 0x0e13,
  27725. "nonuthai",
  27726. 0x0e19,
  27727. "noonarabic",
  27728. 0x0646,
  27729. "noonfinalarabic",
  27730. 0xfee6,
  27731. "noonghunnaarabic",
  27732. 0x06ba,
  27733. "noonghunnafinalarabic",
  27734. 0xfb9f,
  27735. "nooninitialarabic",
  27736. 0xfee7,
  27737. "noonjeeminitialarabic",
  27738. 0xfcd2,
  27739. "noonjeemisolatedarabic",
  27740. 0xfc4b,
  27741. "noonmedialarabic",
  27742. 0xfee8,
  27743. "noonmeeminitialarabic",
  27744. 0xfcd5,
  27745. "noonmeemisolatedarabic",
  27746. 0xfc4e,
  27747. "noonnoonfinalarabic",
  27748. 0xfc8d,
  27749. "notcontains",
  27750. 0x220c,
  27751. "notelement",
  27752. 0x2209,
  27753. "notelementof",
  27754. 0x2209,
  27755. "notequal",
  27756. 0x2260,
  27757. "notgreater",
  27758. 0x226f,
  27759. "notgreaternorequal",
  27760. 0x2271,
  27761. "notgreaternorless",
  27762. 0x2279,
  27763. "notidentical",
  27764. 0x2262,
  27765. "notless",
  27766. 0x226e,
  27767. "notlessnorequal",
  27768. 0x2270,
  27769. "notparallel",
  27770. 0x2226,
  27771. "notprecedes",
  27772. 0x2280,
  27773. "notsubset",
  27774. 0x2284,
  27775. "notsucceeds",
  27776. 0x2281,
  27777. "notsuperset",
  27778. 0x2285,
  27779. "nowarmenian",
  27780. 0x0576,
  27781. "nparen",
  27782. 0x24a9,
  27783. "nssquare",
  27784. 0x33b1,
  27785. "nsuperior",
  27786. 0x207f,
  27787. "ntilde",
  27788. 0x00f1,
  27789. "nu",
  27790. 0x03bd,
  27791. "nuhiragana",
  27792. 0x306c,
  27793. "nukatakana",
  27794. 0x30cc,
  27795. "nukatakanahalfwidth",
  27796. 0xff87,
  27797. "nuktabengali",
  27798. 0x09bc,
  27799. "nuktadeva",
  27800. 0x093c,
  27801. "nuktagujarati",
  27802. 0x0abc,
  27803. "nuktagurmukhi",
  27804. 0x0a3c,
  27805. "numbersign",
  27806. 0x0023,
  27807. "numbersignmonospace",
  27808. 0xff03,
  27809. "numbersignsmall",
  27810. 0xfe5f,
  27811. "numeralsigngreek",
  27812. 0x0374,
  27813. "numeralsignlowergreek",
  27814. 0x0375,
  27815. "numero",
  27816. 0x2116,
  27817. "nun",
  27818. 0x05e0,
  27819. "nundagesh",
  27820. 0xfb40,
  27821. "nundageshhebrew",
  27822. 0xfb40,
  27823. "nunhebrew",
  27824. 0x05e0,
  27825. "nvsquare",
  27826. 0x33b5,
  27827. "nwsquare",
  27828. 0x33bb,
  27829. "nyabengali",
  27830. 0x099e,
  27831. "nyadeva",
  27832. 0x091e,
  27833. "nyagujarati",
  27834. 0x0a9e,
  27835. "nyagurmukhi",
  27836. 0x0a1e,
  27837. "o",
  27838. 0x006f,
  27839. "oacute",
  27840. 0x00f3,
  27841. "oangthai",
  27842. 0x0e2d,
  27843. "obarred",
  27844. 0x0275,
  27845. "obarredcyrillic",
  27846. 0x04e9,
  27847. "obarreddieresiscyrillic",
  27848. 0x04eb,
  27849. "obengali",
  27850. 0x0993,
  27851. "obopomofo",
  27852. 0x311b,
  27853. "obreve",
  27854. 0x014f,
  27855. "ocandradeva",
  27856. 0x0911,
  27857. "ocandragujarati",
  27858. 0x0a91,
  27859. "ocandravowelsigndeva",
  27860. 0x0949,
  27861. "ocandravowelsigngujarati",
  27862. 0x0ac9,
  27863. "ocaron",
  27864. 0x01d2,
  27865. "ocircle",
  27866. 0x24de,
  27867. "ocircumflex",
  27868. 0x00f4,
  27869. "ocircumflexacute",
  27870. 0x1ed1,
  27871. "ocircumflexdotbelow",
  27872. 0x1ed9,
  27873. "ocircumflexgrave",
  27874. 0x1ed3,
  27875. "ocircumflexhookabove",
  27876. 0x1ed5,
  27877. "ocircumflextilde",
  27878. 0x1ed7,
  27879. "ocyrillic",
  27880. 0x043e,
  27881. "odblacute",
  27882. 0x0151,
  27883. "odblgrave",
  27884. 0x020d,
  27885. "odeva",
  27886. 0x0913,
  27887. "odieresis",
  27888. 0x00f6,
  27889. "odieresiscyrillic",
  27890. 0x04e7,
  27891. "odotbelow",
  27892. 0x1ecd,
  27893. "oe",
  27894. 0x0153,
  27895. "oekorean",
  27896. 0x315a,
  27897. "ogonek",
  27898. 0x02db,
  27899. "ogonekcmb",
  27900. 0x0328,
  27901. "ograve",
  27902. 0x00f2,
  27903. "ogujarati",
  27904. 0x0a93,
  27905. "oharmenian",
  27906. 0x0585,
  27907. "ohiragana",
  27908. 0x304a,
  27909. "ohookabove",
  27910. 0x1ecf,
  27911. "ohorn",
  27912. 0x01a1,
  27913. "ohornacute",
  27914. 0x1edb,
  27915. "ohorndotbelow",
  27916. 0x1ee3,
  27917. "ohorngrave",
  27918. 0x1edd,
  27919. "ohornhookabove",
  27920. 0x1edf,
  27921. "ohorntilde",
  27922. 0x1ee1,
  27923. "ohungarumlaut",
  27924. 0x0151,
  27925. "oi",
  27926. 0x01a3,
  27927. "oinvertedbreve",
  27928. 0x020f,
  27929. "okatakana",
  27930. 0x30aa,
  27931. "okatakanahalfwidth",
  27932. 0xff75,
  27933. "okorean",
  27934. 0x3157,
  27935. "olehebrew",
  27936. 0x05ab,
  27937. "omacron",
  27938. 0x014d,
  27939. "omacronacute",
  27940. 0x1e53,
  27941. "omacrongrave",
  27942. 0x1e51,
  27943. "omdeva",
  27944. 0x0950,
  27945. "omega",
  27946. 0x03c9,
  27947. "omega1",
  27948. 0x03d6,
  27949. "omegacyrillic",
  27950. 0x0461,
  27951. "omegalatinclosed",
  27952. 0x0277,
  27953. "omegaroundcyrillic",
  27954. 0x047b,
  27955. "omegatitlocyrillic",
  27956. 0x047d,
  27957. "omegatonos",
  27958. 0x03ce,
  27959. "omgujarati",
  27960. 0x0ad0,
  27961. "omicron",
  27962. 0x03bf,
  27963. "omicrontonos",
  27964. 0x03cc,
  27965. "omonospace",
  27966. 0xff4f,
  27967. "one",
  27968. 0x0031,
  27969. "onearabic",
  27970. 0x0661,
  27971. "onebengali",
  27972. 0x09e7,
  27973. "onecircle",
  27974. 0x2460,
  27975. "onecircleinversesansserif",
  27976. 0x278a,
  27977. "onedeva",
  27978. 0x0967,
  27979. "onedotenleader",
  27980. 0x2024,
  27981. "oneeighth",
  27982. 0x215b,
  27983. "onefitted",
  27984. 0xf6dc,
  27985. "onegujarati",
  27986. 0x0ae7,
  27987. "onegurmukhi",
  27988. 0x0a67,
  27989. "onehackarabic",
  27990. 0x0661,
  27991. "onehalf",
  27992. 0x00bd,
  27993. "onehangzhou",
  27994. 0x3021,
  27995. "oneideographicparen",
  27996. 0x3220,
  27997. "oneinferior",
  27998. 0x2081,
  27999. "onemonospace",
  28000. 0xff11,
  28001. "onenumeratorbengali",
  28002. 0x09f4,
  28003. "oneoldstyle",
  28004. 0xf731,
  28005. "oneparen",
  28006. 0x2474,
  28007. "oneperiod",
  28008. 0x2488,
  28009. "onepersian",
  28010. 0x06f1,
  28011. "onequarter",
  28012. 0x00bc,
  28013. "oneroman",
  28014. 0x2170,
  28015. "onesuperior",
  28016. 0x00b9,
  28017. "onethai",
  28018. 0x0e51,
  28019. "onethird",
  28020. 0x2153,
  28021. "oogonek",
  28022. 0x01eb,
  28023. "oogonekmacron",
  28024. 0x01ed,
  28025. "oogurmukhi",
  28026. 0x0a13,
  28027. "oomatragurmukhi",
  28028. 0x0a4b,
  28029. "oopen",
  28030. 0x0254,
  28031. "oparen",
  28032. 0x24aa,
  28033. "openbullet",
  28034. 0x25e6,
  28035. "option",
  28036. 0x2325,
  28037. "ordfeminine",
  28038. 0x00aa,
  28039. "ordmasculine",
  28040. 0x00ba,
  28041. "orthogonal",
  28042. 0x221f,
  28043. "oshortdeva",
  28044. 0x0912,
  28045. "oshortvowelsigndeva",
  28046. 0x094a,
  28047. "oslash",
  28048. 0x00f8,
  28049. "oslashacute",
  28050. 0x01ff,
  28051. "osmallhiragana",
  28052. 0x3049,
  28053. "osmallkatakana",
  28054. 0x30a9,
  28055. "osmallkatakanahalfwidth",
  28056. 0xff6b,
  28057. "ostrokeacute",
  28058. 0x01ff,
  28059. "osuperior",
  28060. 0xf6f0,
  28061. "otcyrillic",
  28062. 0x047f,
  28063. "otilde",
  28064. 0x00f5,
  28065. "otildeacute",
  28066. 0x1e4d,
  28067. "otildedieresis",
  28068. 0x1e4f,
  28069. "oubopomofo",
  28070. 0x3121,
  28071. "overline",
  28072. 0x203e,
  28073. "overlinecenterline",
  28074. 0xfe4a,
  28075. "overlinecmb",
  28076. 0x0305,
  28077. "overlinedashed",
  28078. 0xfe49,
  28079. "overlinedblwavy",
  28080. 0xfe4c,
  28081. "overlinewavy",
  28082. 0xfe4b,
  28083. "overscore",
  28084. 0x00af,
  28085. "ovowelsignbengali",
  28086. 0x09cb,
  28087. "ovowelsigndeva",
  28088. 0x094b,
  28089. "ovowelsigngujarati",
  28090. 0x0acb,
  28091. "p",
  28092. 0x0070,
  28093. "paampssquare",
  28094. 0x3380,
  28095. "paasentosquare",
  28096. 0x332b,
  28097. "pabengali",
  28098. 0x09aa,
  28099. "pacute",
  28100. 0x1e55,
  28101. "padeva",
  28102. 0x092a,
  28103. "pagedown",
  28104. 0x21df,
  28105. "pageup",
  28106. 0x21de,
  28107. "pagujarati",
  28108. 0x0aaa,
  28109. "pagurmukhi",
  28110. 0x0a2a,
  28111. "pahiragana",
  28112. 0x3071,
  28113. "paiyannoithai",
  28114. 0x0e2f,
  28115. "pakatakana",
  28116. 0x30d1,
  28117. "palatalizationcyrilliccmb",
  28118. 0x0484,
  28119. "palochkacyrillic",
  28120. 0x04c0,
  28121. "pansioskorean",
  28122. 0x317f,
  28123. "paragraph",
  28124. 0x00b6,
  28125. "parallel",
  28126. 0x2225,
  28127. "parenleft",
  28128. 0x0028,
  28129. "parenleftaltonearabic",
  28130. 0xfd3e,
  28131. "parenleftbt",
  28132. 0xf8ed,
  28133. "parenleftex",
  28134. 0xf8ec,
  28135. "parenleftinferior",
  28136. 0x208d,
  28137. "parenleftmonospace",
  28138. 0xff08,
  28139. "parenleftsmall",
  28140. 0xfe59,
  28141. "parenleftsuperior",
  28142. 0x207d,
  28143. "parenlefttp",
  28144. 0xf8eb,
  28145. "parenleftvertical",
  28146. 0xfe35,
  28147. "parenright",
  28148. 0x0029,
  28149. "parenrightaltonearabic",
  28150. 0xfd3f,
  28151. "parenrightbt",
  28152. 0xf8f8,
  28153. "parenrightex",
  28154. 0xf8f7,
  28155. "parenrightinferior",
  28156. 0x208e,
  28157. "parenrightmonospace",
  28158. 0xff09,
  28159. "parenrightsmall",
  28160. 0xfe5a,
  28161. "parenrightsuperior",
  28162. 0x207e,
  28163. "parenrighttp",
  28164. 0xf8f6,
  28165. "parenrightvertical",
  28166. 0xfe36,
  28167. "partialdiff",
  28168. 0x2202,
  28169. "paseqhebrew",
  28170. 0x05c0,
  28171. "pashtahebrew",
  28172. 0x0599,
  28173. "pasquare",
  28174. 0x33a9,
  28175. "patah",
  28176. 0x05b7,
  28177. "patah11",
  28178. 0x05b7,
  28179. "patah1d",
  28180. 0x05b7,
  28181. "patah2a",
  28182. 0x05b7,
  28183. "patahhebrew",
  28184. 0x05b7,
  28185. "patahnarrowhebrew",
  28186. 0x05b7,
  28187. "patahquarterhebrew",
  28188. 0x05b7,
  28189. "patahwidehebrew",
  28190. 0x05b7,
  28191. "pazerhebrew",
  28192. 0x05a1,
  28193. "pbopomofo",
  28194. 0x3106,
  28195. "pcircle",
  28196. 0x24df,
  28197. "pdotaccent",
  28198. 0x1e57,
  28199. "pe",
  28200. 0x05e4,
  28201. "pecyrillic",
  28202. 0x043f,
  28203. "pedagesh",
  28204. 0xfb44,
  28205. "pedageshhebrew",
  28206. 0xfb44,
  28207. "peezisquare",
  28208. 0x333b,
  28209. "pefinaldageshhebrew",
  28210. 0xfb43,
  28211. "peharabic",
  28212. 0x067e,
  28213. "peharmenian",
  28214. 0x057a,
  28215. "pehebrew",
  28216. 0x05e4,
  28217. "pehfinalarabic",
  28218. 0xfb57,
  28219. "pehinitialarabic",
  28220. 0xfb58,
  28221. "pehiragana",
  28222. 0x307a,
  28223. "pehmedialarabic",
  28224. 0xfb59,
  28225. "pekatakana",
  28226. 0x30da,
  28227. "pemiddlehookcyrillic",
  28228. 0x04a7,
  28229. "perafehebrew",
  28230. 0xfb4e,
  28231. "percent",
  28232. 0x0025,
  28233. "percentarabic",
  28234. 0x066a,
  28235. "percentmonospace",
  28236. 0xff05,
  28237. "percentsmall",
  28238. 0xfe6a,
  28239. "period",
  28240. 0x002e,
  28241. "periodarmenian",
  28242. 0x0589,
  28243. "periodcentered",
  28244. 0x00b7,
  28245. "periodhalfwidth",
  28246. 0xff61,
  28247. "periodinferior",
  28248. 0xf6e7,
  28249. "periodmonospace",
  28250. 0xff0e,
  28251. "periodsmall",
  28252. 0xfe52,
  28253. "periodsuperior",
  28254. 0xf6e8,
  28255. "perispomenigreekcmb",
  28256. 0x0342,
  28257. "perpendicular",
  28258. 0x22a5,
  28259. "perthousand",
  28260. 0x2030,
  28261. "peseta",
  28262. 0x20a7,
  28263. "pfsquare",
  28264. 0x338a,
  28265. "phabengali",
  28266. 0x09ab,
  28267. "phadeva",
  28268. 0x092b,
  28269. "phagujarati",
  28270. 0x0aab,
  28271. "phagurmukhi",
  28272. 0x0a2b,
  28273. "phi",
  28274. 0x03c6,
  28275. "phi1",
  28276. 0x03d5,
  28277. "phieuphacirclekorean",
  28278. 0x327a,
  28279. "phieuphaparenkorean",
  28280. 0x321a,
  28281. "phieuphcirclekorean",
  28282. 0x326c,
  28283. "phieuphkorean",
  28284. 0x314d,
  28285. "phieuphparenkorean",
  28286. 0x320c,
  28287. "philatin",
  28288. 0x0278,
  28289. "phinthuthai",
  28290. 0x0e3a,
  28291. "phisymbolgreek",
  28292. 0x03d5,
  28293. "phook",
  28294. 0x01a5,
  28295. "phophanthai",
  28296. 0x0e1e,
  28297. "phophungthai",
  28298. 0x0e1c,
  28299. "phosamphaothai",
  28300. 0x0e20,
  28301. "pi",
  28302. 0x03c0,
  28303. "pieupacirclekorean",
  28304. 0x3273,
  28305. "pieupaparenkorean",
  28306. 0x3213,
  28307. "pieupcieuckorean",
  28308. 0x3176,
  28309. "pieupcirclekorean",
  28310. 0x3265,
  28311. "pieupkiyeokkorean",
  28312. 0x3172,
  28313. "pieupkorean",
  28314. 0x3142,
  28315. "pieupparenkorean",
  28316. 0x3205,
  28317. "pieupsioskiyeokkorean",
  28318. 0x3174,
  28319. "pieupsioskorean",
  28320. 0x3144,
  28321. "pieupsiostikeutkorean",
  28322. 0x3175,
  28323. "pieupthieuthkorean",
  28324. 0x3177,
  28325. "pieuptikeutkorean",
  28326. 0x3173,
  28327. "pihiragana",
  28328. 0x3074,
  28329. "pikatakana",
  28330. 0x30d4,
  28331. "pisymbolgreek",
  28332. 0x03d6,
  28333. "piwrarmenian",
  28334. 0x0583,
  28335. "plus",
  28336. 0x002b,
  28337. "plusbelowcmb",
  28338. 0x031f,
  28339. "pluscircle",
  28340. 0x2295,
  28341. "plusminus",
  28342. 0x00b1,
  28343. "plusmod",
  28344. 0x02d6,
  28345. "plusmonospace",
  28346. 0xff0b,
  28347. "plussmall",
  28348. 0xfe62,
  28349. "plussuperior",
  28350. 0x207a,
  28351. "pmonospace",
  28352. 0xff50,
  28353. "pmsquare",
  28354. 0x33d8,
  28355. "pohiragana",
  28356. 0x307d,
  28357. "pointingindexdownwhite",
  28358. 0x261f,
  28359. "pointingindexleftwhite",
  28360. 0x261c,
  28361. "pointingindexrightwhite",
  28362. 0x261e,
  28363. "pointingindexupwhite",
  28364. 0x261d,
  28365. "pokatakana",
  28366. 0x30dd,
  28367. "poplathai",
  28368. 0x0e1b,
  28369. "postalmark",
  28370. 0x3012,
  28371. "postalmarkface",
  28372. 0x3020,
  28373. "pparen",
  28374. 0x24ab,
  28375. "precedes",
  28376. 0x227a,
  28377. "prescription",
  28378. 0x211e,
  28379. "primemod",
  28380. 0x02b9,
  28381. "primereversed",
  28382. 0x2035,
  28383. "product",
  28384. 0x220f,
  28385. "projective",
  28386. 0x2305,
  28387. "prolongedkana",
  28388. 0x30fc,
  28389. "propellor",
  28390. 0x2318,
  28391. "propersubset",
  28392. 0x2282,
  28393. "propersuperset",
  28394. 0x2283,
  28395. "proportion",
  28396. 0x2237,
  28397. "proportional",
  28398. 0x221d,
  28399. "psi",
  28400. 0x03c8,
  28401. "psicyrillic",
  28402. 0x0471,
  28403. "psilipneumatacyrilliccmb",
  28404. 0x0486,
  28405. "pssquare",
  28406. 0x33b0,
  28407. "puhiragana",
  28408. 0x3077,
  28409. "pukatakana",
  28410. 0x30d7,
  28411. "pvsquare",
  28412. 0x33b4,
  28413. "pwsquare",
  28414. 0x33ba,
  28415. "q",
  28416. 0x0071,
  28417. "qadeva",
  28418. 0x0958,
  28419. "qadmahebrew",
  28420. 0x05a8,
  28421. "qafarabic",
  28422. 0x0642,
  28423. "qaffinalarabic",
  28424. 0xfed6,
  28425. "qafinitialarabic",
  28426. 0xfed7,
  28427. "qafmedialarabic",
  28428. 0xfed8,
  28429. "qamats",
  28430. 0x05b8,
  28431. "qamats10",
  28432. 0x05b8,
  28433. "qamats1a",
  28434. 0x05b8,
  28435. "qamats1c",
  28436. 0x05b8,
  28437. "qamats27",
  28438. 0x05b8,
  28439. "qamats29",
  28440. 0x05b8,
  28441. "qamats33",
  28442. 0x05b8,
  28443. "qamatsde",
  28444. 0x05b8,
  28445. "qamatshebrew",
  28446. 0x05b8,
  28447. "qamatsnarrowhebrew",
  28448. 0x05b8,
  28449. "qamatsqatanhebrew",
  28450. 0x05b8,
  28451. "qamatsqatannarrowhebrew",
  28452. 0x05b8,
  28453. "qamatsqatanquarterhebrew",
  28454. 0x05b8,
  28455. "qamatsqatanwidehebrew",
  28456. 0x05b8,
  28457. "qamatsquarterhebrew",
  28458. 0x05b8,
  28459. "qamatswidehebrew",
  28460. 0x05b8,
  28461. "qarneyparahebrew",
  28462. 0x059f,
  28463. "qbopomofo",
  28464. 0x3111,
  28465. "qcircle",
  28466. 0x24e0,
  28467. "qhook",
  28468. 0x02a0,
  28469. "qmonospace",
  28470. 0xff51,
  28471. "qof",
  28472. 0x05e7,
  28473. "qofdagesh",
  28474. 0xfb47,
  28475. "qofdageshhebrew",
  28476. 0xfb47,
  28477. "qofhebrew",
  28478. 0x05e7,
  28479. "qparen",
  28480. 0x24ac,
  28481. "quarternote",
  28482. 0x2669,
  28483. "qubuts",
  28484. 0x05bb,
  28485. "qubuts18",
  28486. 0x05bb,
  28487. "qubuts25",
  28488. 0x05bb,
  28489. "qubuts31",
  28490. 0x05bb,
  28491. "qubutshebrew",
  28492. 0x05bb,
  28493. "qubutsnarrowhebrew",
  28494. 0x05bb,
  28495. "qubutsquarterhebrew",
  28496. 0x05bb,
  28497. "qubutswidehebrew",
  28498. 0x05bb,
  28499. "question",
  28500. 0x003f,
  28501. "questionarabic",
  28502. 0x061f,
  28503. "questionarmenian",
  28504. 0x055e,
  28505. "questiondown",
  28506. 0x00bf,
  28507. "questiondownsmall",
  28508. 0xf7bf,
  28509. "questiongreek",
  28510. 0x037e,
  28511. "questionmonospace",
  28512. 0xff1f,
  28513. "questionsmall",
  28514. 0xf73f,
  28515. "quotedbl",
  28516. 0x0022,
  28517. "quotedblbase",
  28518. 0x201e,
  28519. "quotedblleft",
  28520. 0x201c,
  28521. "quotedblmonospace",
  28522. 0xff02,
  28523. "quotedblprime",
  28524. 0x301e,
  28525. "quotedblprimereversed",
  28526. 0x301d,
  28527. "quotedblright",
  28528. 0x201d,
  28529. "quoteleft",
  28530. 0x2018,
  28531. "quoteleftreversed",
  28532. 0x201b,
  28533. "quotereversed",
  28534. 0x201b,
  28535. "quoteright",
  28536. 0x2019,
  28537. "quoterightn",
  28538. 0x0149,
  28539. "quotesinglbase",
  28540. 0x201a,
  28541. "quotesingle",
  28542. 0x0027,
  28543. "quotesinglemonospace",
  28544. 0xff07,
  28545. "r",
  28546. 0x0072,
  28547. "raarmenian",
  28548. 0x057c,
  28549. "rabengali",
  28550. 0x09b0,
  28551. "racute",
  28552. 0x0155,
  28553. "radeva",
  28554. 0x0930,
  28555. "radical",
  28556. 0x221a,
  28557. "radicalex",
  28558. 0xf8e5,
  28559. "radoverssquare",
  28560. 0x33ae,
  28561. "radoverssquaredsquare",
  28562. 0x33af,
  28563. "radsquare",
  28564. 0x33ad,
  28565. "rafe",
  28566. 0x05bf,
  28567. "rafehebrew",
  28568. 0x05bf,
  28569. "ragujarati",
  28570. 0x0ab0,
  28571. "ragurmukhi",
  28572. 0x0a30,
  28573. "rahiragana",
  28574. 0x3089,
  28575. "rakatakana",
  28576. 0x30e9,
  28577. "rakatakanahalfwidth",
  28578. 0xff97,
  28579. "ralowerdiagonalbengali",
  28580. 0x09f1,
  28581. "ramiddlediagonalbengali",
  28582. 0x09f0,
  28583. "ramshorn",
  28584. 0x0264,
  28585. "ratio",
  28586. 0x2236,
  28587. "rbopomofo",
  28588. 0x3116,
  28589. "rcaron",
  28590. 0x0159,
  28591. "rcedilla",
  28592. 0x0157,
  28593. "rcircle",
  28594. 0x24e1,
  28595. "rcommaaccent",
  28596. 0x0157,
  28597. "rdblgrave",
  28598. 0x0211,
  28599. "rdotaccent",
  28600. 0x1e59,
  28601. "rdotbelow",
  28602. 0x1e5b,
  28603. "rdotbelowmacron",
  28604. 0x1e5d,
  28605. "referencemark",
  28606. 0x203b,
  28607. "reflexsubset",
  28608. 0x2286,
  28609. "reflexsuperset",
  28610. 0x2287,
  28611. "registered",
  28612. 0x00ae,
  28613. "registersans",
  28614. 0xf8e8,
  28615. "registerserif",
  28616. 0xf6da,
  28617. "reharabic",
  28618. 0x0631,
  28619. "reharmenian",
  28620. 0x0580,
  28621. "rehfinalarabic",
  28622. 0xfeae,
  28623. "rehiragana",
  28624. 0x308c,
  28625. "rekatakana",
  28626. 0x30ec,
  28627. "rekatakanahalfwidth",
  28628. 0xff9a,
  28629. "resh",
  28630. 0x05e8,
  28631. "reshdageshhebrew",
  28632. 0xfb48,
  28633. "reshhebrew",
  28634. 0x05e8,
  28635. "reversedtilde",
  28636. 0x223d,
  28637. "reviahebrew",
  28638. 0x0597,
  28639. "reviamugrashhebrew",
  28640. 0x0597,
  28641. "revlogicalnot",
  28642. 0x2310,
  28643. "rfishhook",
  28644. 0x027e,
  28645. "rfishhookreversed",
  28646. 0x027f,
  28647. "rhabengali",
  28648. 0x09dd,
  28649. "rhadeva",
  28650. 0x095d,
  28651. "rho",
  28652. 0x03c1,
  28653. "rhook",
  28654. 0x027d,
  28655. "rhookturned",
  28656. 0x027b,
  28657. "rhookturnedsuperior",
  28658. 0x02b5,
  28659. "rhosymbolgreek",
  28660. 0x03f1,
  28661. "rhotichookmod",
  28662. 0x02de,
  28663. "rieulacirclekorean",
  28664. 0x3271,
  28665. "rieulaparenkorean",
  28666. 0x3211,
  28667. "rieulcirclekorean",
  28668. 0x3263,
  28669. "rieulhieuhkorean",
  28670. 0x3140,
  28671. "rieulkiyeokkorean",
  28672. 0x313a,
  28673. "rieulkiyeoksioskorean",
  28674. 0x3169,
  28675. "rieulkorean",
  28676. 0x3139,
  28677. "rieulmieumkorean",
  28678. 0x313b,
  28679. "rieulpansioskorean",
  28680. 0x316c,
  28681. "rieulparenkorean",
  28682. 0x3203,
  28683. "rieulphieuphkorean",
  28684. 0x313f,
  28685. "rieulpieupkorean",
  28686. 0x313c,
  28687. "rieulpieupsioskorean",
  28688. 0x316b,
  28689. "rieulsioskorean",
  28690. 0x313d,
  28691. "rieulthieuthkorean",
  28692. 0x313e,
  28693. "rieultikeutkorean",
  28694. 0x316a,
  28695. "rieulyeorinhieuhkorean",
  28696. 0x316d,
  28697. "rightangle",
  28698. 0x221f,
  28699. "righttackbelowcmb",
  28700. 0x0319,
  28701. "righttriangle",
  28702. 0x22bf,
  28703. "rihiragana",
  28704. 0x308a,
  28705. "rikatakana",
  28706. 0x30ea,
  28707. "rikatakanahalfwidth",
  28708. 0xff98,
  28709. "ring",
  28710. 0x02da,
  28711. "ringbelowcmb",
  28712. 0x0325,
  28713. "ringcmb",
  28714. 0x030a,
  28715. "ringhalfleft",
  28716. 0x02bf,
  28717. "ringhalfleftarmenian",
  28718. 0x0559,
  28719. "ringhalfleftbelowcmb",
  28720. 0x031c,
  28721. "ringhalfleftcentered",
  28722. 0x02d3,
  28723. "ringhalfright",
  28724. 0x02be,
  28725. "ringhalfrightbelowcmb",
  28726. 0x0339,
  28727. "ringhalfrightcentered",
  28728. 0x02d2,
  28729. "rinvertedbreve",
  28730. 0x0213,
  28731. "rittorusquare",
  28732. 0x3351,
  28733. "rlinebelow",
  28734. 0x1e5f,
  28735. "rlongleg",
  28736. 0x027c,
  28737. "rlonglegturned",
  28738. 0x027a,
  28739. "rmonospace",
  28740. 0xff52,
  28741. "rohiragana",
  28742. 0x308d,
  28743. "rokatakana",
  28744. 0x30ed,
  28745. "rokatakanahalfwidth",
  28746. 0xff9b,
  28747. "roruathai",
  28748. 0x0e23,
  28749. "rparen",
  28750. 0x24ad,
  28751. "rrabengali",
  28752. 0x09dc,
  28753. "rradeva",
  28754. 0x0931,
  28755. "rragurmukhi",
  28756. 0x0a5c,
  28757. "rreharabic",
  28758. 0x0691,
  28759. "rrehfinalarabic",
  28760. 0xfb8d,
  28761. "rrvocalicbengali",
  28762. 0x09e0,
  28763. "rrvocalicdeva",
  28764. 0x0960,
  28765. "rrvocalicgujarati",
  28766. 0x0ae0,
  28767. "rrvocalicvowelsignbengali",
  28768. 0x09c4,
  28769. "rrvocalicvowelsigndeva",
  28770. 0x0944,
  28771. "rrvocalicvowelsigngujarati",
  28772. 0x0ac4,
  28773. "rsuperior",
  28774. 0xf6f1,
  28775. "rtblock",
  28776. 0x2590,
  28777. "rturned",
  28778. 0x0279,
  28779. "rturnedsuperior",
  28780. 0x02b4,
  28781. "ruhiragana",
  28782. 0x308b,
  28783. "rukatakana",
  28784. 0x30eb,
  28785. "rukatakanahalfwidth",
  28786. 0xff99,
  28787. "rupeemarkbengali",
  28788. 0x09f2,
  28789. "rupeesignbengali",
  28790. 0x09f3,
  28791. "rupiah",
  28792. 0xf6dd,
  28793. "ruthai",
  28794. 0x0e24,
  28795. "rvocalicbengali",
  28796. 0x098b,
  28797. "rvocalicdeva",
  28798. 0x090b,
  28799. "rvocalicgujarati",
  28800. 0x0a8b,
  28801. "rvocalicvowelsignbengali",
  28802. 0x09c3,
  28803. "rvocalicvowelsigndeva",
  28804. 0x0943,
  28805. "rvocalicvowelsigngujarati",
  28806. 0x0ac3,
  28807. "s",
  28808. 0x0073,
  28809. "sabengali",
  28810. 0x09b8,
  28811. "sacute",
  28812. 0x015b,
  28813. "sacutedotaccent",
  28814. 0x1e65,
  28815. "sadarabic",
  28816. 0x0635,
  28817. "sadeva",
  28818. 0x0938,
  28819. "sadfinalarabic",
  28820. 0xfeba,
  28821. "sadinitialarabic",
  28822. 0xfebb,
  28823. "sadmedialarabic",
  28824. 0xfebc,
  28825. "sagujarati",
  28826. 0x0ab8,
  28827. "sagurmukhi",
  28828. 0x0a38,
  28829. "sahiragana",
  28830. 0x3055,
  28831. "sakatakana",
  28832. 0x30b5,
  28833. "sakatakanahalfwidth",
  28834. 0xff7b,
  28835. "sallallahoualayhewasallamarabic",
  28836. 0xfdfa,
  28837. "samekh",
  28838. 0x05e1,
  28839. "samekhdagesh",
  28840. 0xfb41,
  28841. "samekhdageshhebrew",
  28842. 0xfb41,
  28843. "samekhhebrew",
  28844. 0x05e1,
  28845. "saraaathai",
  28846. 0x0e32,
  28847. "saraaethai",
  28848. 0x0e41,
  28849. "saraaimaimalaithai",
  28850. 0x0e44,
  28851. "saraaimaimuanthai",
  28852. 0x0e43,
  28853. "saraamthai",
  28854. 0x0e33,
  28855. "saraathai",
  28856. 0x0e30,
  28857. "saraethai",
  28858. 0x0e40,
  28859. "saraiileftthai",
  28860. 0xf886,
  28861. "saraiithai",
  28862. 0x0e35,
  28863. "saraileftthai",
  28864. 0xf885,
  28865. "saraithai",
  28866. 0x0e34,
  28867. "saraothai",
  28868. 0x0e42,
  28869. "saraueeleftthai",
  28870. 0xf888,
  28871. "saraueethai",
  28872. 0x0e37,
  28873. "saraueleftthai",
  28874. 0xf887,
  28875. "sarauethai",
  28876. 0x0e36,
  28877. "sarauthai",
  28878. 0x0e38,
  28879. "sarauuthai",
  28880. 0x0e39,
  28881. "sbopomofo",
  28882. 0x3119,
  28883. "scaron",
  28884. 0x0161,
  28885. "scarondotaccent",
  28886. 0x1e67,
  28887. "scedilla",
  28888. 0x015f,
  28889. "schwa",
  28890. 0x0259,
  28891. "schwacyrillic",
  28892. 0x04d9,
  28893. "schwadieresiscyrillic",
  28894. 0x04db,
  28895. "schwahook",
  28896. 0x025a,
  28897. "scircle",
  28898. 0x24e2,
  28899. "scircumflex",
  28900. 0x015d,
  28901. "scommaaccent",
  28902. 0x0219,
  28903. "sdotaccent",
  28904. 0x1e61,
  28905. "sdotbelow",
  28906. 0x1e63,
  28907. "sdotbelowdotaccent",
  28908. 0x1e69,
  28909. "seagullbelowcmb",
  28910. 0x033c,
  28911. "second",
  28912. 0x2033,
  28913. "secondtonechinese",
  28914. 0x02ca,
  28915. "section",
  28916. 0x00a7,
  28917. "seenarabic",
  28918. 0x0633,
  28919. "seenfinalarabic",
  28920. 0xfeb2,
  28921. "seeninitialarabic",
  28922. 0xfeb3,
  28923. "seenmedialarabic",
  28924. 0xfeb4,
  28925. "segol",
  28926. 0x05b6,
  28927. "segol13",
  28928. 0x05b6,
  28929. "segol1f",
  28930. 0x05b6,
  28931. "segol2c",
  28932. 0x05b6,
  28933. "segolhebrew",
  28934. 0x05b6,
  28935. "segolnarrowhebrew",
  28936. 0x05b6,
  28937. "segolquarterhebrew",
  28938. 0x05b6,
  28939. "segoltahebrew",
  28940. 0x0592,
  28941. "segolwidehebrew",
  28942. 0x05b6,
  28943. "seharmenian",
  28944. 0x057d,
  28945. "sehiragana",
  28946. 0x305b,
  28947. "sekatakana",
  28948. 0x30bb,
  28949. "sekatakanahalfwidth",
  28950. 0xff7e,
  28951. "semicolon",
  28952. 0x003b,
  28953. "semicolonarabic",
  28954. 0x061b,
  28955. "semicolonmonospace",
  28956. 0xff1b,
  28957. "semicolonsmall",
  28958. 0xfe54,
  28959. "semivoicedmarkkana",
  28960. 0x309c,
  28961. "semivoicedmarkkanahalfwidth",
  28962. 0xff9f,
  28963. "sentisquare",
  28964. 0x3322,
  28965. "sentosquare",
  28966. 0x3323,
  28967. "seven",
  28968. 0x0037,
  28969. "sevenarabic",
  28970. 0x0667,
  28971. "sevenbengali",
  28972. 0x09ed,
  28973. "sevencircle",
  28974. 0x2466,
  28975. "sevencircleinversesansserif",
  28976. 0x2790,
  28977. "sevendeva",
  28978. 0x096d,
  28979. "seveneighths",
  28980. 0x215e,
  28981. "sevengujarati",
  28982. 0x0aed,
  28983. "sevengurmukhi",
  28984. 0x0a6d,
  28985. "sevenhackarabic",
  28986. 0x0667,
  28987. "sevenhangzhou",
  28988. 0x3027,
  28989. "sevenideographicparen",
  28990. 0x3226,
  28991. "seveninferior",
  28992. 0x2087,
  28993. "sevenmonospace",
  28994. 0xff17,
  28995. "sevenoldstyle",
  28996. 0xf737,
  28997. "sevenparen",
  28998. 0x247a,
  28999. "sevenperiod",
  29000. 0x248e,
  29001. "sevenpersian",
  29002. 0x06f7,
  29003. "sevenroman",
  29004. 0x2176,
  29005. "sevensuperior",
  29006. 0x2077,
  29007. "seventeencircle",
  29008. 0x2470,
  29009. "seventeenparen",
  29010. 0x2484,
  29011. "seventeenperiod",
  29012. 0x2498,
  29013. "seventhai",
  29014. 0x0e57,
  29015. "sfthyphen",
  29016. 0x00ad,
  29017. "shaarmenian",
  29018. 0x0577,
  29019. "shabengali",
  29020. 0x09b6,
  29021. "shacyrillic",
  29022. 0x0448,
  29023. "shaddaarabic",
  29024. 0x0651,
  29025. "shaddadammaarabic",
  29026. 0xfc61,
  29027. "shaddadammatanarabic",
  29028. 0xfc5e,
  29029. "shaddafathaarabic",
  29030. 0xfc60,
  29031. "shaddakasraarabic",
  29032. 0xfc62,
  29033. "shaddakasratanarabic",
  29034. 0xfc5f,
  29035. "shade",
  29036. 0x2592,
  29037. "shadedark",
  29038. 0x2593,
  29039. "shadelight",
  29040. 0x2591,
  29041. "shademedium",
  29042. 0x2592,
  29043. "shadeva",
  29044. 0x0936,
  29045. "shagujarati",
  29046. 0x0ab6,
  29047. "shagurmukhi",
  29048. 0x0a36,
  29049. "shalshelethebrew",
  29050. 0x0593,
  29051. "shbopomofo",
  29052. 0x3115,
  29053. "shchacyrillic",
  29054. 0x0449,
  29055. "sheenarabic",
  29056. 0x0634,
  29057. "sheenfinalarabic",
  29058. 0xfeb6,
  29059. "sheeninitialarabic",
  29060. 0xfeb7,
  29061. "sheenmedialarabic",
  29062. 0xfeb8,
  29063. "sheicoptic",
  29064. 0x03e3,
  29065. "sheqel",
  29066. 0x20aa,
  29067. "sheqelhebrew",
  29068. 0x20aa,
  29069. "sheva",
  29070. 0x05b0,
  29071. "sheva115",
  29072. 0x05b0,
  29073. "sheva15",
  29074. 0x05b0,
  29075. "sheva22",
  29076. 0x05b0,
  29077. "sheva2e",
  29078. 0x05b0,
  29079. "shevahebrew",
  29080. 0x05b0,
  29081. "shevanarrowhebrew",
  29082. 0x05b0,
  29083. "shevaquarterhebrew",
  29084. 0x05b0,
  29085. "shevawidehebrew",
  29086. 0x05b0,
  29087. "shhacyrillic",
  29088. 0x04bb,
  29089. "shimacoptic",
  29090. 0x03ed,
  29091. "shin",
  29092. 0x05e9,
  29093. "shindagesh",
  29094. 0xfb49,
  29095. "shindageshhebrew",
  29096. 0xfb49,
  29097. "shindageshshindot",
  29098. 0xfb2c,
  29099. "shindageshshindothebrew",
  29100. 0xfb2c,
  29101. "shindageshsindot",
  29102. 0xfb2d,
  29103. "shindageshsindothebrew",
  29104. 0xfb2d,
  29105. "shindothebrew",
  29106. 0x05c1,
  29107. "shinhebrew",
  29108. 0x05e9,
  29109. "shinshindot",
  29110. 0xfb2a,
  29111. "shinshindothebrew",
  29112. 0xfb2a,
  29113. "shinsindot",
  29114. 0xfb2b,
  29115. "shinsindothebrew",
  29116. 0xfb2b,
  29117. "shook",
  29118. 0x0282,
  29119. "sigma",
  29120. 0x03c3,
  29121. "sigma1",
  29122. 0x03c2,
  29123. "sigmafinal",
  29124. 0x03c2,
  29125. "sigmalunatesymbolgreek",
  29126. 0x03f2,
  29127. "sihiragana",
  29128. 0x3057,
  29129. "sikatakana",
  29130. 0x30b7,
  29131. "sikatakanahalfwidth",
  29132. 0xff7c,
  29133. "siluqhebrew",
  29134. 0x05bd,
  29135. "siluqlefthebrew",
  29136. 0x05bd,
  29137. "similar",
  29138. 0x223c,
  29139. "sindothebrew",
  29140. 0x05c2,
  29141. "siosacirclekorean",
  29142. 0x3274,
  29143. "siosaparenkorean",
  29144. 0x3214,
  29145. "sioscieuckorean",
  29146. 0x317e,
  29147. "sioscirclekorean",
  29148. 0x3266,
  29149. "sioskiyeokkorean",
  29150. 0x317a,
  29151. "sioskorean",
  29152. 0x3145,
  29153. "siosnieunkorean",
  29154. 0x317b,
  29155. "siosparenkorean",
  29156. 0x3206,
  29157. "siospieupkorean",
  29158. 0x317d,
  29159. "siostikeutkorean",
  29160. 0x317c,
  29161. "six",
  29162. 0x0036,
  29163. "sixarabic",
  29164. 0x0666,
  29165. "sixbengali",
  29166. 0x09ec,
  29167. "sixcircle",
  29168. 0x2465,
  29169. "sixcircleinversesansserif",
  29170. 0x278f,
  29171. "sixdeva",
  29172. 0x096c,
  29173. "sixgujarati",
  29174. 0x0aec,
  29175. "sixgurmukhi",
  29176. 0x0a6c,
  29177. "sixhackarabic",
  29178. 0x0666,
  29179. "sixhangzhou",
  29180. 0x3026,
  29181. "sixideographicparen",
  29182. 0x3225,
  29183. "sixinferior",
  29184. 0x2086,
  29185. "sixmonospace",
  29186. 0xff16,
  29187. "sixoldstyle",
  29188. 0xf736,
  29189. "sixparen",
  29190. 0x2479,
  29191. "sixperiod",
  29192. 0x248d,
  29193. "sixpersian",
  29194. 0x06f6,
  29195. "sixroman",
  29196. 0x2175,
  29197. "sixsuperior",
  29198. 0x2076,
  29199. "sixteencircle",
  29200. 0x246f,
  29201. "sixteencurrencydenominatorbengali",
  29202. 0x09f9,
  29203. "sixteenparen",
  29204. 0x2483,
  29205. "sixteenperiod",
  29206. 0x2497,
  29207. "sixthai",
  29208. 0x0e56,
  29209. "slash",
  29210. 0x002f,
  29211. "slashmonospace",
  29212. 0xff0f,
  29213. "slong",
  29214. 0x017f,
  29215. "slongdotaccent",
  29216. 0x1e9b,
  29217. "smileface",
  29218. 0x263a,
  29219. "smonospace",
  29220. 0xff53,
  29221. "sofpasuqhebrew",
  29222. 0x05c3,
  29223. "softhyphen",
  29224. 0x00ad,
  29225. "softsigncyrillic",
  29226. 0x044c,
  29227. "sohiragana",
  29228. 0x305d,
  29229. "sokatakana",
  29230. 0x30bd,
  29231. "sokatakanahalfwidth",
  29232. 0xff7f,
  29233. "soliduslongoverlaycmb",
  29234. 0x0338,
  29235. "solidusshortoverlaycmb",
  29236. 0x0337,
  29237. "sorusithai",
  29238. 0x0e29,
  29239. "sosalathai",
  29240. 0x0e28,
  29241. "sosothai",
  29242. 0x0e0b,
  29243. "sosuathai",
  29244. 0x0e2a,
  29245. "space",
  29246. 0x0020,
  29247. "spacehackarabic",
  29248. 0x0020,
  29249. "spade",
  29250. 0x2660,
  29251. "spadesuitblack",
  29252. 0x2660,
  29253. "spadesuitwhite",
  29254. 0x2664,
  29255. "sparen",
  29256. 0x24ae,
  29257. "squarebelowcmb",
  29258. 0x033b,
  29259. "squarecc",
  29260. 0x33c4,
  29261. "squarecm",
  29262. 0x339d,
  29263. "squarediagonalcrosshatchfill",
  29264. 0x25a9,
  29265. "squarehorizontalfill",
  29266. 0x25a4,
  29267. "squarekg",
  29268. 0x338f,
  29269. "squarekm",
  29270. 0x339e,
  29271. "squarekmcapital",
  29272. 0x33ce,
  29273. "squareln",
  29274. 0x33d1,
  29275. "squarelog",
  29276. 0x33d2,
  29277. "squaremg",
  29278. 0x338e,
  29279. "squaremil",
  29280. 0x33d5,
  29281. "squaremm",
  29282. 0x339c,
  29283. "squaremsquared",
  29284. 0x33a1,
  29285. "squareorthogonalcrosshatchfill",
  29286. 0x25a6,
  29287. "squareupperlefttolowerrightfill",
  29288. 0x25a7,
  29289. "squareupperrighttolowerleftfill",
  29290. 0x25a8,
  29291. "squareverticalfill",
  29292. 0x25a5,
  29293. "squarewhitewithsmallblack",
  29294. 0x25a3,
  29295. "srsquare",
  29296. 0x33db,
  29297. "ssabengali",
  29298. 0x09b7,
  29299. "ssadeva",
  29300. 0x0937,
  29301. "ssagujarati",
  29302. 0x0ab7,
  29303. "ssangcieuckorean",
  29304. 0x3149,
  29305. "ssanghieuhkorean",
  29306. 0x3185,
  29307. "ssangieungkorean",
  29308. 0x3180,
  29309. "ssangkiyeokkorean",
  29310. 0x3132,
  29311. "ssangnieunkorean",
  29312. 0x3165,
  29313. "ssangpieupkorean",
  29314. 0x3143,
  29315. "ssangsioskorean",
  29316. 0x3146,
  29317. "ssangtikeutkorean",
  29318. 0x3138,
  29319. "ssuperior",
  29320. 0xf6f2,
  29321. "sterling",
  29322. 0x00a3,
  29323. "sterlingmonospace",
  29324. 0xffe1,
  29325. "strokelongoverlaycmb",
  29326. 0x0336,
  29327. "strokeshortoverlaycmb",
  29328. 0x0335,
  29329. "subset",
  29330. 0x2282,
  29331. "subsetnotequal",
  29332. 0x228a,
  29333. "subsetorequal",
  29334. 0x2286,
  29335. "succeeds",
  29336. 0x227b,
  29337. "suchthat",
  29338. 0x220b,
  29339. "suhiragana",
  29340. 0x3059,
  29341. "sukatakana",
  29342. 0x30b9,
  29343. "sukatakanahalfwidth",
  29344. 0xff7d,
  29345. "sukunarabic",
  29346. 0x0652,
  29347. "summation",
  29348. 0x2211,
  29349. "sun",
  29350. 0x263c,
  29351. "superset",
  29352. 0x2283,
  29353. "supersetnotequal",
  29354. 0x228b,
  29355. "supersetorequal",
  29356. 0x2287,
  29357. "svsquare",
  29358. 0x33dc,
  29359. "syouwaerasquare",
  29360. 0x337c,
  29361. "t",
  29362. 0x0074,
  29363. "tabengali",
  29364. 0x09a4,
  29365. "tackdown",
  29366. 0x22a4,
  29367. "tackleft",
  29368. 0x22a3,
  29369. "tadeva",
  29370. 0x0924,
  29371. "tagujarati",
  29372. 0x0aa4,
  29373. "tagurmukhi",
  29374. 0x0a24,
  29375. "taharabic",
  29376. 0x0637,
  29377. "tahfinalarabic",
  29378. 0xfec2,
  29379. "tahinitialarabic",
  29380. 0xfec3,
  29381. "tahiragana",
  29382. 0x305f,
  29383. "tahmedialarabic",
  29384. 0xfec4,
  29385. "taisyouerasquare",
  29386. 0x337d,
  29387. "takatakana",
  29388. 0x30bf,
  29389. "takatakanahalfwidth",
  29390. 0xff80,
  29391. "tatweelarabic",
  29392. 0x0640,
  29393. "tau",
  29394. 0x03c4,
  29395. "tav",
  29396. 0x05ea,
  29397. "tavdages",
  29398. 0xfb4a,
  29399. "tavdagesh",
  29400. 0xfb4a,
  29401. "tavdageshhebrew",
  29402. 0xfb4a,
  29403. "tavhebrew",
  29404. 0x05ea,
  29405. "tbar",
  29406. 0x0167,
  29407. "tbopomofo",
  29408. 0x310a,
  29409. "tcaron",
  29410. 0x0165,
  29411. "tccurl",
  29412. 0x02a8,
  29413. "tcedilla",
  29414. 0x0163,
  29415. "tcheharabic",
  29416. 0x0686,
  29417. "tchehfinalarabic",
  29418. 0xfb7b,
  29419. "tchehinitialarabic",
  29420. 0xfb7c,
  29421. "tchehmedialarabic",
  29422. 0xfb7d,
  29423. "tcircle",
  29424. 0x24e3,
  29425. "tcircumflexbelow",
  29426. 0x1e71,
  29427. "tcommaaccent",
  29428. 0x0163,
  29429. "tdieresis",
  29430. 0x1e97,
  29431. "tdotaccent",
  29432. 0x1e6b,
  29433. "tdotbelow",
  29434. 0x1e6d,
  29435. "tecyrillic",
  29436. 0x0442,
  29437. "tedescendercyrillic",
  29438. 0x04ad,
  29439. "teharabic",
  29440. 0x062a,
  29441. "tehfinalarabic",
  29442. 0xfe96,
  29443. "tehhahinitialarabic",
  29444. 0xfca2,
  29445. "tehhahisolatedarabic",
  29446. 0xfc0c,
  29447. "tehinitialarabic",
  29448. 0xfe97,
  29449. "tehiragana",
  29450. 0x3066,
  29451. "tehjeeminitialarabic",
  29452. 0xfca1,
  29453. "tehjeemisolatedarabic",
  29454. 0xfc0b,
  29455. "tehmarbutaarabic",
  29456. 0x0629,
  29457. "tehmarbutafinalarabic",
  29458. 0xfe94,
  29459. "tehmedialarabic",
  29460. 0xfe98,
  29461. "tehmeeminitialarabic",
  29462. 0xfca4,
  29463. "tehmeemisolatedarabic",
  29464. 0xfc0e,
  29465. "tehnoonfinalarabic",
  29466. 0xfc73,
  29467. "tekatakana",
  29468. 0x30c6,
  29469. "tekatakanahalfwidth",
  29470. 0xff83,
  29471. "telephone",
  29472. 0x2121,
  29473. "telephoneblack",
  29474. 0x260e,
  29475. "telishagedolahebrew",
  29476. 0x05a0,
  29477. "telishaqetanahebrew",
  29478. 0x05a9,
  29479. "tencircle",
  29480. 0x2469,
  29481. "tenideographicparen",
  29482. 0x3229,
  29483. "tenparen",
  29484. 0x247d,
  29485. "tenperiod",
  29486. 0x2491,
  29487. "tenroman",
  29488. 0x2179,
  29489. "tesh",
  29490. 0x02a7,
  29491. "tet",
  29492. 0x05d8,
  29493. "tetdagesh",
  29494. 0xfb38,
  29495. "tetdageshhebrew",
  29496. 0xfb38,
  29497. "tethebrew",
  29498. 0x05d8,
  29499. "tetsecyrillic",
  29500. 0x04b5,
  29501. "tevirhebrew",
  29502. 0x059b,
  29503. "tevirlefthebrew",
  29504. 0x059b,
  29505. "thabengali",
  29506. 0x09a5,
  29507. "thadeva",
  29508. 0x0925,
  29509. "thagujarati",
  29510. 0x0aa5,
  29511. "thagurmukhi",
  29512. 0x0a25,
  29513. "thalarabic",
  29514. 0x0630,
  29515. "thalfinalarabic",
  29516. 0xfeac,
  29517. "thanthakhatlowleftthai",
  29518. 0xf898,
  29519. "thanthakhatlowrightthai",
  29520. 0xf897,
  29521. "thanthakhatthai",
  29522. 0x0e4c,
  29523. "thanthakhatupperleftthai",
  29524. 0xf896,
  29525. "theharabic",
  29526. 0x062b,
  29527. "thehfinalarabic",
  29528. 0xfe9a,
  29529. "thehinitialarabic",
  29530. 0xfe9b,
  29531. "thehmedialarabic",
  29532. 0xfe9c,
  29533. "thereexists",
  29534. 0x2203,
  29535. "therefore",
  29536. 0x2234,
  29537. "theta",
  29538. 0x03b8,
  29539. "theta1",
  29540. 0x03d1,
  29541. "thetasymbolgreek",
  29542. 0x03d1,
  29543. "thieuthacirclekorean",
  29544. 0x3279,
  29545. "thieuthaparenkorean",
  29546. 0x3219,
  29547. "thieuthcirclekorean",
  29548. 0x326b,
  29549. "thieuthkorean",
  29550. 0x314c,
  29551. "thieuthparenkorean",
  29552. 0x320b,
  29553. "thirteencircle",
  29554. 0x246c,
  29555. "thirteenparen",
  29556. 0x2480,
  29557. "thirteenperiod",
  29558. 0x2494,
  29559. "thonangmonthothai",
  29560. 0x0e11,
  29561. "thook",
  29562. 0x01ad,
  29563. "thophuthaothai",
  29564. 0x0e12,
  29565. "thorn",
  29566. 0x00fe,
  29567. "thothahanthai",
  29568. 0x0e17,
  29569. "thothanthai",
  29570. 0x0e10,
  29571. "thothongthai",
  29572. 0x0e18,
  29573. "thothungthai",
  29574. 0x0e16,
  29575. "thousandcyrillic",
  29576. 0x0482,
  29577. "thousandsseparatorarabic",
  29578. 0x066c,
  29579. "thousandsseparatorpersian",
  29580. 0x066c,
  29581. "three",
  29582. 0x0033,
  29583. "threearabic",
  29584. 0x0663,
  29585. "threebengali",
  29586. 0x09e9,
  29587. "threecircle",
  29588. 0x2462,
  29589. "threecircleinversesansserif",
  29590. 0x278c,
  29591. "threedeva",
  29592. 0x0969,
  29593. "threeeighths",
  29594. 0x215c,
  29595. "threegujarati",
  29596. 0x0ae9,
  29597. "threegurmukhi",
  29598. 0x0a69,
  29599. "threehackarabic",
  29600. 0x0663,
  29601. "threehangzhou",
  29602. 0x3023,
  29603. "threeideographicparen",
  29604. 0x3222,
  29605. "threeinferior",
  29606. 0x2083,
  29607. "threemonospace",
  29608. 0xff13,
  29609. "threenumeratorbengali",
  29610. 0x09f6,
  29611. "threeoldstyle",
  29612. 0xf733,
  29613. "threeparen",
  29614. 0x2476,
  29615. "threeperiod",
  29616. 0x248a,
  29617. "threepersian",
  29618. 0x06f3,
  29619. "threequarters",
  29620. 0x00be,
  29621. "threequartersemdash",
  29622. 0xf6de,
  29623. "threeroman",
  29624. 0x2172,
  29625. "threesuperior",
  29626. 0x00b3,
  29627. "threethai",
  29628. 0x0e53,
  29629. "thzsquare",
  29630. 0x3394,
  29631. "tihiragana",
  29632. 0x3061,
  29633. "tikatakana",
  29634. 0x30c1,
  29635. "tikatakanahalfwidth",
  29636. 0xff81,
  29637. "tikeutacirclekorean",
  29638. 0x3270,
  29639. "tikeutaparenkorean",
  29640. 0x3210,
  29641. "tikeutcirclekorean",
  29642. 0x3262,
  29643. "tikeutkorean",
  29644. 0x3137,
  29645. "tikeutparenkorean",
  29646. 0x3202,
  29647. "tilde",
  29648. 0x02dc,
  29649. "tildebelowcmb",
  29650. 0x0330,
  29651. "tildecmb",
  29652. 0x0303,
  29653. "tildecomb",
  29654. 0x0303,
  29655. "tildedoublecmb",
  29656. 0x0360,
  29657. "tildeoperator",
  29658. 0x223c,
  29659. "tildeoverlaycmb",
  29660. 0x0334,
  29661. "tildeverticalcmb",
  29662. 0x033e,
  29663. "timescircle",
  29664. 0x2297,
  29665. "tipehahebrew",
  29666. 0x0596,
  29667. "tipehalefthebrew",
  29668. 0x0596,
  29669. "tippigurmukhi",
  29670. 0x0a70,
  29671. "titlocyrilliccmb",
  29672. 0x0483,
  29673. "tiwnarmenian",
  29674. 0x057f,
  29675. "tlinebelow",
  29676. 0x1e6f,
  29677. "tmonospace",
  29678. 0xff54,
  29679. "toarmenian",
  29680. 0x0569,
  29681. "tohiragana",
  29682. 0x3068,
  29683. "tokatakana",
  29684. 0x30c8,
  29685. "tokatakanahalfwidth",
  29686. 0xff84,
  29687. "tonebarextrahighmod",
  29688. 0x02e5,
  29689. "tonebarextralowmod",
  29690. 0x02e9,
  29691. "tonebarhighmod",
  29692. 0x02e6,
  29693. "tonebarlowmod",
  29694. 0x02e8,
  29695. "tonebarmidmod",
  29696. 0x02e7,
  29697. "tonefive",
  29698. 0x01bd,
  29699. "tonesix",
  29700. 0x0185,
  29701. "tonetwo",
  29702. 0x01a8,
  29703. "tonos",
  29704. 0x0384,
  29705. "tonsquare",
  29706. 0x3327,
  29707. "topatakthai",
  29708. 0x0e0f,
  29709. "tortoiseshellbracketleft",
  29710. 0x3014,
  29711. "tortoiseshellbracketleftsmall",
  29712. 0xfe5d,
  29713. "tortoiseshellbracketleftvertical",
  29714. 0xfe39,
  29715. "tortoiseshellbracketright",
  29716. 0x3015,
  29717. "tortoiseshellbracketrightsmall",
  29718. 0xfe5e,
  29719. "tortoiseshellbracketrightvertical",
  29720. 0xfe3a,
  29721. "totaothai",
  29722. 0x0e15,
  29723. "tpalatalhook",
  29724. 0x01ab,
  29725. "tparen",
  29726. 0x24af,
  29727. "trademark",
  29728. 0x2122,
  29729. "trademarksans",
  29730. 0xf8ea,
  29731. "trademarkserif",
  29732. 0xf6db,
  29733. "tretroflexhook",
  29734. 0x0288,
  29735. "triagdn",
  29736. 0x25bc,
  29737. "triaglf",
  29738. 0x25c4,
  29739. "triagrt",
  29740. 0x25ba,
  29741. "triagup",
  29742. 0x25b2,
  29743. "ts",
  29744. 0x02a6,
  29745. "tsadi",
  29746. 0x05e6,
  29747. "tsadidagesh",
  29748. 0xfb46,
  29749. "tsadidageshhebrew",
  29750. 0xfb46,
  29751. "tsadihebrew",
  29752. 0x05e6,
  29753. "tsecyrillic",
  29754. 0x0446,
  29755. "tsere",
  29756. 0x05b5,
  29757. "tsere12",
  29758. 0x05b5,
  29759. "tsere1e",
  29760. 0x05b5,
  29761. "tsere2b",
  29762. 0x05b5,
  29763. "tserehebrew",
  29764. 0x05b5,
  29765. "tserenarrowhebrew",
  29766. 0x05b5,
  29767. "tserequarterhebrew",
  29768. 0x05b5,
  29769. "tserewidehebrew",
  29770. 0x05b5,
  29771. "tshecyrillic",
  29772. 0x045b,
  29773. "tsuperior",
  29774. 0xf6f3,
  29775. "ttabengali",
  29776. 0x099f,
  29777. "ttadeva",
  29778. 0x091f,
  29779. "ttagujarati",
  29780. 0x0a9f,
  29781. "ttagurmukhi",
  29782. 0x0a1f,
  29783. "tteharabic",
  29784. 0x0679,
  29785. "ttehfinalarabic",
  29786. 0xfb67,
  29787. "ttehinitialarabic",
  29788. 0xfb68,
  29789. "ttehmedialarabic",
  29790. 0xfb69,
  29791. "tthabengali",
  29792. 0x09a0,
  29793. "tthadeva",
  29794. 0x0920,
  29795. "tthagujarati",
  29796. 0x0aa0,
  29797. "tthagurmukhi",
  29798. 0x0a20,
  29799. "tturned",
  29800. 0x0287,
  29801. "tuhiragana",
  29802. 0x3064,
  29803. "tukatakana",
  29804. 0x30c4,
  29805. "tukatakanahalfwidth",
  29806. 0xff82,
  29807. "tusmallhiragana",
  29808. 0x3063,
  29809. "tusmallkatakana",
  29810. 0x30c3,
  29811. "tusmallkatakanahalfwidth",
  29812. 0xff6f,
  29813. "twelvecircle",
  29814. 0x246b,
  29815. "twelveparen",
  29816. 0x247f,
  29817. "twelveperiod",
  29818. 0x2493,
  29819. "twelveroman",
  29820. 0x217b,
  29821. "twentycircle",
  29822. 0x2473,
  29823. "twentyhangzhou",
  29824. 0x5344,
  29825. "twentyparen",
  29826. 0x2487,
  29827. "twentyperiod",
  29828. 0x249b,
  29829. "two",
  29830. 0x0032,
  29831. "twoarabic",
  29832. 0x0662,
  29833. "twobengali",
  29834. 0x09e8,
  29835. "twocircle",
  29836. 0x2461,
  29837. "twocircleinversesansserif",
  29838. 0x278b,
  29839. "twodeva",
  29840. 0x0968,
  29841. "twodotenleader",
  29842. 0x2025,
  29843. "twodotleader",
  29844. 0x2025,
  29845. "twodotleadervertical",
  29846. 0xfe30,
  29847. "twogujarati",
  29848. 0x0ae8,
  29849. "twogurmukhi",
  29850. 0x0a68,
  29851. "twohackarabic",
  29852. 0x0662,
  29853. "twohangzhou",
  29854. 0x3022,
  29855. "twoideographicparen",
  29856. 0x3221,
  29857. "twoinferior",
  29858. 0x2082,
  29859. "twomonospace",
  29860. 0xff12,
  29861. "twonumeratorbengali",
  29862. 0x09f5,
  29863. "twooldstyle",
  29864. 0xf732,
  29865. "twoparen",
  29866. 0x2475,
  29867. "twoperiod",
  29868. 0x2489,
  29869. "twopersian",
  29870. 0x06f2,
  29871. "tworoman",
  29872. 0x2171,
  29873. "twostroke",
  29874. 0x01bb,
  29875. "twosuperior",
  29876. 0x00b2,
  29877. "twothai",
  29878. 0x0e52,
  29879. "twothirds",
  29880. 0x2154,
  29881. "u",
  29882. 0x0075,
  29883. "uacute",
  29884. 0x00fa,
  29885. "ubar",
  29886. 0x0289,
  29887. "ubengali",
  29888. 0x0989,
  29889. "ubopomofo",
  29890. 0x3128,
  29891. "ubreve",
  29892. 0x016d,
  29893. "ucaron",
  29894. 0x01d4,
  29895. "ucircle",
  29896. 0x24e4,
  29897. "ucircumflex",
  29898. 0x00fb,
  29899. "ucircumflexbelow",
  29900. 0x1e77,
  29901. "ucyrillic",
  29902. 0x0443,
  29903. "udattadeva",
  29904. 0x0951,
  29905. "udblacute",
  29906. 0x0171,
  29907. "udblgrave",
  29908. 0x0215,
  29909. "udeva",
  29910. 0x0909,
  29911. "udieresis",
  29912. 0x00fc,
  29913. "udieresisacute",
  29914. 0x01d8,
  29915. "udieresisbelow",
  29916. 0x1e73,
  29917. "udieresiscaron",
  29918. 0x01da,
  29919. "udieresiscyrillic",
  29920. 0x04f1,
  29921. "udieresisgrave",
  29922. 0x01dc,
  29923. "udieresismacron",
  29924. 0x01d6,
  29925. "udotbelow",
  29926. 0x1ee5,
  29927. "ugrave",
  29928. 0x00f9,
  29929. "ugujarati",
  29930. 0x0a89,
  29931. "ugurmukhi",
  29932. 0x0a09,
  29933. "uhiragana",
  29934. 0x3046,
  29935. "uhookabove",
  29936. 0x1ee7,
  29937. "uhorn",
  29938. 0x01b0,
  29939. "uhornacute",
  29940. 0x1ee9,
  29941. "uhorndotbelow",
  29942. 0x1ef1,
  29943. "uhorngrave",
  29944. 0x1eeb,
  29945. "uhornhookabove",
  29946. 0x1eed,
  29947. "uhorntilde",
  29948. 0x1eef,
  29949. "uhungarumlaut",
  29950. 0x0171,
  29951. "uhungarumlautcyrillic",
  29952. 0x04f3,
  29953. "uinvertedbreve",
  29954. 0x0217,
  29955. "ukatakana",
  29956. 0x30a6,
  29957. "ukatakanahalfwidth",
  29958. 0xff73,
  29959. "ukcyrillic",
  29960. 0x0479,
  29961. "ukorean",
  29962. 0x315c,
  29963. "umacron",
  29964. 0x016b,
  29965. "umacroncyrillic",
  29966. 0x04ef,
  29967. "umacrondieresis",
  29968. 0x1e7b,
  29969. "umatragurmukhi",
  29970. 0x0a41,
  29971. "umonospace",
  29972. 0xff55,
  29973. "underscore",
  29974. 0x005f,
  29975. "underscoredbl",
  29976. 0x2017,
  29977. "underscoremonospace",
  29978. 0xff3f,
  29979. "underscorevertical",
  29980. 0xfe33,
  29981. "underscorewavy",
  29982. 0xfe4f,
  29983. "union",
  29984. 0x222a,
  29985. "universal",
  29986. 0x2200,
  29987. "uogonek",
  29988. 0x0173,
  29989. "uparen",
  29990. 0x24b0,
  29991. "upblock",
  29992. 0x2580,
  29993. "upperdothebrew",
  29994. 0x05c4,
  29995. "upsilon",
  29996. 0x03c5,
  29997. "upsilondieresis",
  29998. 0x03cb,
  29999. "upsilondieresistonos",
  30000. 0x03b0,
  30001. "upsilonlatin",
  30002. 0x028a,
  30003. "upsilontonos",
  30004. 0x03cd,
  30005. "uptackbelowcmb",
  30006. 0x031d,
  30007. "uptackmod",
  30008. 0x02d4,
  30009. "uragurmukhi",
  30010. 0x0a73,
  30011. "uring",
  30012. 0x016f,
  30013. "ushortcyrillic",
  30014. 0x045e,
  30015. "usmallhiragana",
  30016. 0x3045,
  30017. "usmallkatakana",
  30018. 0x30a5,
  30019. "usmallkatakanahalfwidth",
  30020. 0xff69,
  30021. "ustraightcyrillic",
  30022. 0x04af,
  30023. "ustraightstrokecyrillic",
  30024. 0x04b1,
  30025. "utilde",
  30026. 0x0169,
  30027. "utildeacute",
  30028. 0x1e79,
  30029. "utildebelow",
  30030. 0x1e75,
  30031. "uubengali",
  30032. 0x098a,
  30033. "uudeva",
  30034. 0x090a,
  30035. "uugujarati",
  30036. 0x0a8a,
  30037. "uugurmukhi",
  30038. 0x0a0a,
  30039. "uumatragurmukhi",
  30040. 0x0a42,
  30041. "uuvowelsignbengali",
  30042. 0x09c2,
  30043. "uuvowelsigndeva",
  30044. 0x0942,
  30045. "uuvowelsigngujarati",
  30046. 0x0ac2,
  30047. "uvowelsignbengali",
  30048. 0x09c1,
  30049. "uvowelsigndeva",
  30050. 0x0941,
  30051. "uvowelsigngujarati",
  30052. 0x0ac1,
  30053. "v",
  30054. 0x0076,
  30055. "vadeva",
  30056. 0x0935,
  30057. "vagujarati",
  30058. 0x0ab5,
  30059. "vagurmukhi",
  30060. 0x0a35,
  30061. "vakatakana",
  30062. 0x30f7,
  30063. "vav",
  30064. 0x05d5,
  30065. "vavdagesh",
  30066. 0xfb35,
  30067. "vavdagesh65",
  30068. 0xfb35,
  30069. "vavdageshhebrew",
  30070. 0xfb35,
  30071. "vavhebrew",
  30072. 0x05d5,
  30073. "vavholam",
  30074. 0xfb4b,
  30075. "vavholamhebrew",
  30076. 0xfb4b,
  30077. "vavvavhebrew",
  30078. 0x05f0,
  30079. "vavyodhebrew",
  30080. 0x05f1,
  30081. "vcircle",
  30082. 0x24e5,
  30083. "vdotbelow",
  30084. 0x1e7f,
  30085. "vecyrillic",
  30086. 0x0432,
  30087. "veharabic",
  30088. 0x06a4,
  30089. "vehfinalarabic",
  30090. 0xfb6b,
  30091. "vehinitialarabic",
  30092. 0xfb6c,
  30093. "vehmedialarabic",
  30094. 0xfb6d,
  30095. "vekatakana",
  30096. 0x30f9,
  30097. "venus",
  30098. 0x2640,
  30099. "verticalbar",
  30100. 0x007c,
  30101. "verticallineabovecmb",
  30102. 0x030d,
  30103. "verticallinebelowcmb",
  30104. 0x0329,
  30105. "verticallinelowmod",
  30106. 0x02cc,
  30107. "verticallinemod",
  30108. 0x02c8,
  30109. "vewarmenian",
  30110. 0x057e,
  30111. "vhook",
  30112. 0x028b,
  30113. "vikatakana",
  30114. 0x30f8,
  30115. "viramabengali",
  30116. 0x09cd,
  30117. "viramadeva",
  30118. 0x094d,
  30119. "viramagujarati",
  30120. 0x0acd,
  30121. "visargabengali",
  30122. 0x0983,
  30123. "visargadeva",
  30124. 0x0903,
  30125. "visargagujarati",
  30126. 0x0a83,
  30127. "vmonospace",
  30128. 0xff56,
  30129. "voarmenian",
  30130. 0x0578,
  30131. "voicediterationhiragana",
  30132. 0x309e,
  30133. "voicediterationkatakana",
  30134. 0x30fe,
  30135. "voicedmarkkana",
  30136. 0x309b,
  30137. "voicedmarkkanahalfwidth",
  30138. 0xff9e,
  30139. "vokatakana",
  30140. 0x30fa,
  30141. "vparen",
  30142. 0x24b1,
  30143. "vtilde",
  30144. 0x1e7d,
  30145. "vturned",
  30146. 0x028c,
  30147. "vuhiragana",
  30148. 0x3094,
  30149. "vukatakana",
  30150. 0x30f4,
  30151. "w",
  30152. 0x0077,
  30153. "wacute",
  30154. 0x1e83,
  30155. "waekorean",
  30156. 0x3159,
  30157. "wahiragana",
  30158. 0x308f,
  30159. "wakatakana",
  30160. 0x30ef,
  30161. "wakatakanahalfwidth",
  30162. 0xff9c,
  30163. "wakorean",
  30164. 0x3158,
  30165. "wasmallhiragana",
  30166. 0x308e,
  30167. "wasmallkatakana",
  30168. 0x30ee,
  30169. "wattosquare",
  30170. 0x3357,
  30171. "wavedash",
  30172. 0x301c,
  30173. "wavyunderscorevertical",
  30174. 0xfe34,
  30175. "wawarabic",
  30176. 0x0648,
  30177. "wawfinalarabic",
  30178. 0xfeee,
  30179. "wawhamzaabovearabic",
  30180. 0x0624,
  30181. "wawhamzaabovefinalarabic",
  30182. 0xfe86,
  30183. "wbsquare",
  30184. 0x33dd,
  30185. "wcircle",
  30186. 0x24e6,
  30187. "wcircumflex",
  30188. 0x0175,
  30189. "wdieresis",
  30190. 0x1e85,
  30191. "wdotaccent",
  30192. 0x1e87,
  30193. "wdotbelow",
  30194. 0x1e89,
  30195. "wehiragana",
  30196. 0x3091,
  30197. "weierstrass",
  30198. 0x2118,
  30199. "wekatakana",
  30200. 0x30f1,
  30201. "wekorean",
  30202. 0x315e,
  30203. "weokorean",
  30204. 0x315d,
  30205. "wgrave",
  30206. 0x1e81,
  30207. "whitebullet",
  30208. 0x25e6,
  30209. "whitecircle",
  30210. 0x25cb,
  30211. "whitecircleinverse",
  30212. 0x25d9,
  30213. "whitecornerbracketleft",
  30214. 0x300e,
  30215. "whitecornerbracketleftvertical",
  30216. 0xfe43,
  30217. "whitecornerbracketright",
  30218. 0x300f,
  30219. "whitecornerbracketrightvertical",
  30220. 0xfe44,
  30221. "whitediamond",
  30222. 0x25c7,
  30223. "whitediamondcontainingblacksmalldiamond",
  30224. 0x25c8,
  30225. "whitedownpointingsmalltriangle",
  30226. 0x25bf,
  30227. "whitedownpointingtriangle",
  30228. 0x25bd,
  30229. "whiteleftpointingsmalltriangle",
  30230. 0x25c3,
  30231. "whiteleftpointingtriangle",
  30232. 0x25c1,
  30233. "whitelenticularbracketleft",
  30234. 0x3016,
  30235. "whitelenticularbracketright",
  30236. 0x3017,
  30237. "whiterightpointingsmalltriangle",
  30238. 0x25b9,
  30239. "whiterightpointingtriangle",
  30240. 0x25b7,
  30241. "whitesmallsquare",
  30242. 0x25ab,
  30243. "whitesmilingface",
  30244. 0x263a,
  30245. "whitesquare",
  30246. 0x25a1,
  30247. "whitestar",
  30248. 0x2606,
  30249. "whitetelephone",
  30250. 0x260f,
  30251. "whitetortoiseshellbracketleft",
  30252. 0x3018,
  30253. "whitetortoiseshellbracketright",
  30254. 0x3019,
  30255. "whiteuppointingsmalltriangle",
  30256. 0x25b5,
  30257. "whiteuppointingtriangle",
  30258. 0x25b3,
  30259. "wihiragana",
  30260. 0x3090,
  30261. "wikatakana",
  30262. 0x30f0,
  30263. "wikorean",
  30264. 0x315f,
  30265. "wmonospace",
  30266. 0xff57,
  30267. "wohiragana",
  30268. 0x3092,
  30269. "wokatakana",
  30270. 0x30f2,
  30271. "wokatakanahalfwidth",
  30272. 0xff66,
  30273. "won",
  30274. 0x20a9,
  30275. "wonmonospace",
  30276. 0xffe6,
  30277. "wowaenthai",
  30278. 0x0e27,
  30279. "wparen",
  30280. 0x24b2,
  30281. "wring",
  30282. 0x1e98,
  30283. "wsuperior",
  30284. 0x02b7,
  30285. "wturned",
  30286. 0x028d,
  30287. "wynn",
  30288. 0x01bf,
  30289. "x",
  30290. 0x0078,
  30291. "xabovecmb",
  30292. 0x033d,
  30293. "xbopomofo",
  30294. 0x3112,
  30295. "xcircle",
  30296. 0x24e7,
  30297. "xdieresis",
  30298. 0x1e8d,
  30299. "xdotaccent",
  30300. 0x1e8b,
  30301. "xeharmenian",
  30302. 0x056d,
  30303. "xi",
  30304. 0x03be,
  30305. "xmonospace",
  30306. 0xff58,
  30307. "xparen",
  30308. 0x24b3,
  30309. "xsuperior",
  30310. 0x02e3,
  30311. "y",
  30312. 0x0079,
  30313. "yaadosquare",
  30314. 0x334e,
  30315. "yabengali",
  30316. 0x09af,
  30317. "yacute",
  30318. 0x00fd,
  30319. "yadeva",
  30320. 0x092f,
  30321. "yaekorean",
  30322. 0x3152,
  30323. "yagujarati",
  30324. 0x0aaf,
  30325. "yagurmukhi",
  30326. 0x0a2f,
  30327. "yahiragana",
  30328. 0x3084,
  30329. "yakatakana",
  30330. 0x30e4,
  30331. "yakatakanahalfwidth",
  30332. 0xff94,
  30333. "yakorean",
  30334. 0x3151,
  30335. "yamakkanthai",
  30336. 0x0e4e,
  30337. "yasmallhiragana",
  30338. 0x3083,
  30339. "yasmallkatakana",
  30340. 0x30e3,
  30341. "yasmallkatakanahalfwidth",
  30342. 0xff6c,
  30343. "yatcyrillic",
  30344. 0x0463,
  30345. "ycircle",
  30346. 0x24e8,
  30347. "ycircumflex",
  30348. 0x0177,
  30349. "ydieresis",
  30350. 0x00ff,
  30351. "ydotaccent",
  30352. 0x1e8f,
  30353. "ydotbelow",
  30354. 0x1ef5,
  30355. "yeharabic",
  30356. 0x064a,
  30357. "yehbarreearabic",
  30358. 0x06d2,
  30359. "yehbarreefinalarabic",
  30360. 0xfbaf,
  30361. "yehfinalarabic",
  30362. 0xfef2,
  30363. "yehhamzaabovearabic",
  30364. 0x0626,
  30365. "yehhamzaabovefinalarabic",
  30366. 0xfe8a,
  30367. "yehhamzaaboveinitialarabic",
  30368. 0xfe8b,
  30369. "yehhamzaabovemedialarabic",
  30370. 0xfe8c,
  30371. "yehinitialarabic",
  30372. 0xfef3,
  30373. "yehmedialarabic",
  30374. 0xfef4,
  30375. "yehmeeminitialarabic",
  30376. 0xfcdd,
  30377. "yehmeemisolatedarabic",
  30378. 0xfc58,
  30379. "yehnoonfinalarabic",
  30380. 0xfc94,
  30381. "yehthreedotsbelowarabic",
  30382. 0x06d1,
  30383. "yekorean",
  30384. 0x3156,
  30385. "yen",
  30386. 0x00a5,
  30387. "yenmonospace",
  30388. 0xffe5,
  30389. "yeokorean",
  30390. 0x3155,
  30391. "yeorinhieuhkorean",
  30392. 0x3186,
  30393. "yerahbenyomohebrew",
  30394. 0x05aa,
  30395. "yerahbenyomolefthebrew",
  30396. 0x05aa,
  30397. "yericyrillic",
  30398. 0x044b,
  30399. "yerudieresiscyrillic",
  30400. 0x04f9,
  30401. "yesieungkorean",
  30402. 0x3181,
  30403. "yesieungpansioskorean",
  30404. 0x3183,
  30405. "yesieungsioskorean",
  30406. 0x3182,
  30407. "yetivhebrew",
  30408. 0x059a,
  30409. "ygrave",
  30410. 0x1ef3,
  30411. "yhook",
  30412. 0x01b4,
  30413. "yhookabove",
  30414. 0x1ef7,
  30415. "yiarmenian",
  30416. 0x0575,
  30417. "yicyrillic",
  30418. 0x0457,
  30419. "yikorean",
  30420. 0x3162,
  30421. "yinyang",
  30422. 0x262f,
  30423. "yiwnarmenian",
  30424. 0x0582,
  30425. "ymonospace",
  30426. 0xff59,
  30427. "yod",
  30428. 0x05d9,
  30429. "yoddagesh",
  30430. 0xfb39,
  30431. "yoddageshhebrew",
  30432. 0xfb39,
  30433. "yodhebrew",
  30434. 0x05d9,
  30435. "yodyodhebrew",
  30436. 0x05f2,
  30437. "yodyodpatahhebrew",
  30438. 0xfb1f,
  30439. "yohiragana",
  30440. 0x3088,
  30441. "yoikorean",
  30442. 0x3189,
  30443. "yokatakana",
  30444. 0x30e8,
  30445. "yokatakanahalfwidth",
  30446. 0xff96,
  30447. "yokorean",
  30448. 0x315b,
  30449. "yosmallhiragana",
  30450. 0x3087,
  30451. "yosmallkatakana",
  30452. 0x30e7,
  30453. "yosmallkatakanahalfwidth",
  30454. 0xff6e,
  30455. "yotgreek",
  30456. 0x03f3,
  30457. "yoyaekorean",
  30458. 0x3188,
  30459. "yoyakorean",
  30460. 0x3187,
  30461. "yoyakthai",
  30462. 0x0e22,
  30463. "yoyingthai",
  30464. 0x0e0d,
  30465. "yparen",
  30466. 0x24b4,
  30467. "ypogegrammeni",
  30468. 0x037a,
  30469. "ypogegrammenigreekcmb",
  30470. 0x0345,
  30471. "yr",
  30472. 0x01a6,
  30473. "yring",
  30474. 0x1e99,
  30475. "ysuperior",
  30476. 0x02b8,
  30477. "ytilde",
  30478. 0x1ef9,
  30479. "yturned",
  30480. 0x028e,
  30481. "yuhiragana",
  30482. 0x3086,
  30483. "yuikorean",
  30484. 0x318c,
  30485. "yukatakana",
  30486. 0x30e6,
  30487. "yukatakanahalfwidth",
  30488. 0xff95,
  30489. "yukorean",
  30490. 0x3160,
  30491. "yusbigcyrillic",
  30492. 0x046b,
  30493. "yusbigiotifiedcyrillic",
  30494. 0x046d,
  30495. "yuslittlecyrillic",
  30496. 0x0467,
  30497. "yuslittleiotifiedcyrillic",
  30498. 0x0469,
  30499. "yusmallhiragana",
  30500. 0x3085,
  30501. "yusmallkatakana",
  30502. 0x30e5,
  30503. "yusmallkatakanahalfwidth",
  30504. 0xff6d,
  30505. "yuyekorean",
  30506. 0x318b,
  30507. "yuyeokorean",
  30508. 0x318a,
  30509. "yyabengali",
  30510. 0x09df,
  30511. "yyadeva",
  30512. 0x095f,
  30513. "z",
  30514. 0x007a,
  30515. "zaarmenian",
  30516. 0x0566,
  30517. "zacute",
  30518. 0x017a,
  30519. "zadeva",
  30520. 0x095b,
  30521. "zagurmukhi",
  30522. 0x0a5b,
  30523. "zaharabic",
  30524. 0x0638,
  30525. "zahfinalarabic",
  30526. 0xfec6,
  30527. "zahinitialarabic",
  30528. 0xfec7,
  30529. "zahiragana",
  30530. 0x3056,
  30531. "zahmedialarabic",
  30532. 0xfec8,
  30533. "zainarabic",
  30534. 0x0632,
  30535. "zainfinalarabic",
  30536. 0xfeb0,
  30537. "zakatakana",
  30538. 0x30b6,
  30539. "zaqefgadolhebrew",
  30540. 0x0595,
  30541. "zaqefqatanhebrew",
  30542. 0x0594,
  30543. "zarqahebrew",
  30544. 0x0598,
  30545. "zayin",
  30546. 0x05d6,
  30547. "zayindagesh",
  30548. 0xfb36,
  30549. "zayindageshhebrew",
  30550. 0xfb36,
  30551. "zayinhebrew",
  30552. 0x05d6,
  30553. "zbopomofo",
  30554. 0x3117,
  30555. "zcaron",
  30556. 0x017e,
  30557. "zcircle",
  30558. 0x24e9,
  30559. "zcircumflex",
  30560. 0x1e91,
  30561. "zcurl",
  30562. 0x0291,
  30563. "zdot",
  30564. 0x017c,
  30565. "zdotaccent",
  30566. 0x017c,
  30567. "zdotbelow",
  30568. 0x1e93,
  30569. "zecyrillic",
  30570. 0x0437,
  30571. "zedescendercyrillic",
  30572. 0x0499,
  30573. "zedieresiscyrillic",
  30574. 0x04df,
  30575. "zehiragana",
  30576. 0x305c,
  30577. "zekatakana",
  30578. 0x30bc,
  30579. "zero",
  30580. 0x0030,
  30581. "zeroarabic",
  30582. 0x0660,
  30583. "zerobengali",
  30584. 0x09e6,
  30585. "zerodeva",
  30586. 0x0966,
  30587. "zerogujarati",
  30588. 0x0ae6,
  30589. "zerogurmukhi",
  30590. 0x0a66,
  30591. "zerohackarabic",
  30592. 0x0660,
  30593. "zeroinferior",
  30594. 0x2080,
  30595. "zeromonospace",
  30596. 0xff10,
  30597. "zerooldstyle",
  30598. 0xf730,
  30599. "zeropersian",
  30600. 0x06f0,
  30601. "zerosuperior",
  30602. 0x2070,
  30603. "zerothai",
  30604. 0x0e50,
  30605. "zerowidthjoiner",
  30606. 0xfeff,
  30607. "zerowidthnonjoiner",
  30608. 0x200c,
  30609. "zerowidthspace",
  30610. 0x200b,
  30611. "zeta",
  30612. 0x03b6,
  30613. "zhbopomofo",
  30614. 0x3113,
  30615. "zhearmenian",
  30616. 0x056a,
  30617. "zhebrevecyrillic",
  30618. 0x04c2,
  30619. "zhecyrillic",
  30620. 0x0436,
  30621. "zhedescendercyrillic",
  30622. 0x0497,
  30623. "zhedieresiscyrillic",
  30624. 0x04dd,
  30625. "zihiragana",
  30626. 0x3058,
  30627. "zikatakana",
  30628. 0x30b8,
  30629. "zinorhebrew",
  30630. 0x05ae,
  30631. "zlinebelow",
  30632. 0x1e95,
  30633. "zmonospace",
  30634. 0xff5a,
  30635. "zohiragana",
  30636. 0x305e,
  30637. "zokatakana",
  30638. 0x30be,
  30639. "zparen",
  30640. 0x24b5,
  30641. "zretroflexhook",
  30642. 0x0290,
  30643. "zstroke",
  30644. 0x01b6,
  30645. "zuhiragana",
  30646. 0x305a,
  30647. "zukatakana",
  30648. 0x30ba,
  30649. ".notdef",
  30650. 0x0000,
  30651. "angbracketleftbig",
  30652. 0x2329,
  30653. "angbracketleftBig",
  30654. 0x2329,
  30655. "angbracketleftbigg",
  30656. 0x2329,
  30657. "angbracketleftBigg",
  30658. 0x2329,
  30659. "angbracketrightBig",
  30660. 0x232a,
  30661. "angbracketrightbig",
  30662. 0x232a,
  30663. "angbracketrightBigg",
  30664. 0x232a,
  30665. "angbracketrightbigg",
  30666. 0x232a,
  30667. "arrowhookleft",
  30668. 0x21aa,
  30669. "arrowhookright",
  30670. 0x21a9,
  30671. "arrowlefttophalf",
  30672. 0x21bc,
  30673. "arrowleftbothalf",
  30674. 0x21bd,
  30675. "arrownortheast",
  30676. 0x2197,
  30677. "arrownorthwest",
  30678. 0x2196,
  30679. "arrowrighttophalf",
  30680. 0x21c0,
  30681. "arrowrightbothalf",
  30682. 0x21c1,
  30683. "arrowsoutheast",
  30684. 0x2198,
  30685. "arrowsouthwest",
  30686. 0x2199,
  30687. "backslashbig",
  30688. 0x2216,
  30689. "backslashBig",
  30690. 0x2216,
  30691. "backslashBigg",
  30692. 0x2216,
  30693. "backslashbigg",
  30694. 0x2216,
  30695. "bardbl",
  30696. 0x2016,
  30697. "bracehtipdownleft",
  30698. 0xfe37,
  30699. "bracehtipdownright",
  30700. 0xfe37,
  30701. "bracehtipupleft",
  30702. 0xfe38,
  30703. "bracehtipupright",
  30704. 0xfe38,
  30705. "braceleftBig",
  30706. 0x007b,
  30707. "braceleftbig",
  30708. 0x007b,
  30709. "braceleftbigg",
  30710. 0x007b,
  30711. "braceleftBigg",
  30712. 0x007b,
  30713. "bracerightBig",
  30714. 0x007d,
  30715. "bracerightbig",
  30716. 0x007d,
  30717. "bracerightbigg",
  30718. 0x007d,
  30719. "bracerightBigg",
  30720. 0x007d,
  30721. "bracketleftbig",
  30722. 0x005b,
  30723. "bracketleftBig",
  30724. 0x005b,
  30725. "bracketleftbigg",
  30726. 0x005b,
  30727. "bracketleftBigg",
  30728. 0x005b,
  30729. "bracketrightBig",
  30730. 0x005d,
  30731. "bracketrightbig",
  30732. 0x005d,
  30733. "bracketrightbigg",
  30734. 0x005d,
  30735. "bracketrightBigg",
  30736. 0x005d,
  30737. "ceilingleftbig",
  30738. 0x2308,
  30739. "ceilingleftBig",
  30740. 0x2308,
  30741. "ceilingleftBigg",
  30742. 0x2308,
  30743. "ceilingleftbigg",
  30744. 0x2308,
  30745. "ceilingrightbig",
  30746. 0x2309,
  30747. "ceilingrightBig",
  30748. 0x2309,
  30749. "ceilingrightbigg",
  30750. 0x2309,
  30751. "ceilingrightBigg",
  30752. 0x2309,
  30753. "circledotdisplay",
  30754. 0x2299,
  30755. "circledottext",
  30756. 0x2299,
  30757. "circlemultiplydisplay",
  30758. 0x2297,
  30759. "circlemultiplytext",
  30760. 0x2297,
  30761. "circleplusdisplay",
  30762. 0x2295,
  30763. "circleplustext",
  30764. 0x2295,
  30765. "contintegraldisplay",
  30766. 0x222e,
  30767. "contintegraltext",
  30768. 0x222e,
  30769. "coproductdisplay",
  30770. 0x2210,
  30771. "coproducttext",
  30772. 0x2210,
  30773. "floorleftBig",
  30774. 0x230a,
  30775. "floorleftbig",
  30776. 0x230a,
  30777. "floorleftbigg",
  30778. 0x230a,
  30779. "floorleftBigg",
  30780. 0x230a,
  30781. "floorrightbig",
  30782. 0x230b,
  30783. "floorrightBig",
  30784. 0x230b,
  30785. "floorrightBigg",
  30786. 0x230b,
  30787. "floorrightbigg",
  30788. 0x230b,
  30789. "hatwide",
  30790. 0x0302,
  30791. "hatwider",
  30792. 0x0302,
  30793. "hatwidest",
  30794. 0x0302,
  30795. "intercal",
  30796. 0x1d40,
  30797. "integraldisplay",
  30798. 0x222b,
  30799. "integraltext",
  30800. 0x222b,
  30801. "intersectiondisplay",
  30802. 0x22c2,
  30803. "intersectiontext",
  30804. 0x22c2,
  30805. "logicalanddisplay",
  30806. 0x2227,
  30807. "logicalandtext",
  30808. 0x2227,
  30809. "logicalordisplay",
  30810. 0x2228,
  30811. "logicalortext",
  30812. 0x2228,
  30813. "parenleftBig",
  30814. 0x0028,
  30815. "parenleftbig",
  30816. 0x0028,
  30817. "parenleftBigg",
  30818. 0x0028,
  30819. "parenleftbigg",
  30820. 0x0028,
  30821. "parenrightBig",
  30822. 0x0029,
  30823. "parenrightbig",
  30824. 0x0029,
  30825. "parenrightBigg",
  30826. 0x0029,
  30827. "parenrightbigg",
  30828. 0x0029,
  30829. "prime",
  30830. 0x2032,
  30831. "productdisplay",
  30832. 0x220f,
  30833. "producttext",
  30834. 0x220f,
  30835. "radicalbig",
  30836. 0x221a,
  30837. "radicalBig",
  30838. 0x221a,
  30839. "radicalBigg",
  30840. 0x221a,
  30841. "radicalbigg",
  30842. 0x221a,
  30843. "radicalbt",
  30844. 0x221a,
  30845. "radicaltp",
  30846. 0x221a,
  30847. "radicalvertex",
  30848. 0x221a,
  30849. "slashbig",
  30850. 0x002f,
  30851. "slashBig",
  30852. 0x002f,
  30853. "slashBigg",
  30854. 0x002f,
  30855. "slashbigg",
  30856. 0x002f,
  30857. "summationdisplay",
  30858. 0x2211,
  30859. "summationtext",
  30860. 0x2211,
  30861. "tildewide",
  30862. 0x02dc,
  30863. "tildewider",
  30864. 0x02dc,
  30865. "tildewidest",
  30866. 0x02dc,
  30867. "uniondisplay",
  30868. 0x22c3,
  30869. "unionmultidisplay",
  30870. 0x228e,
  30871. "unionmultitext",
  30872. 0x228e,
  30873. "unionsqdisplay",
  30874. 0x2294,
  30875. "unionsqtext",
  30876. 0x2294,
  30877. "uniontext",
  30878. 0x22c3,
  30879. "vextenddouble",
  30880. 0x2225,
  30881. "vextendsingle",
  30882. 0x2223
  30883. ];
  30884. });
  30885. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  30886. return [
  30887. "space",
  30888. 0x0020,
  30889. "a1",
  30890. 0x2701,
  30891. "a2",
  30892. 0x2702,
  30893. "a202",
  30894. 0x2703,
  30895. "a3",
  30896. 0x2704,
  30897. "a4",
  30898. 0x260e,
  30899. "a5",
  30900. 0x2706,
  30901. "a119",
  30902. 0x2707,
  30903. "a118",
  30904. 0x2708,
  30905. "a117",
  30906. 0x2709,
  30907. "a11",
  30908. 0x261b,
  30909. "a12",
  30910. 0x261e,
  30911. "a13",
  30912. 0x270c,
  30913. "a14",
  30914. 0x270d,
  30915. "a15",
  30916. 0x270e,
  30917. "a16",
  30918. 0x270f,
  30919. "a105",
  30920. 0x2710,
  30921. "a17",
  30922. 0x2711,
  30923. "a18",
  30924. 0x2712,
  30925. "a19",
  30926. 0x2713,
  30927. "a20",
  30928. 0x2714,
  30929. "a21",
  30930. 0x2715,
  30931. "a22",
  30932. 0x2716,
  30933. "a23",
  30934. 0x2717,
  30935. "a24",
  30936. 0x2718,
  30937. "a25",
  30938. 0x2719,
  30939. "a26",
  30940. 0x271a,
  30941. "a27",
  30942. 0x271b,
  30943. "a28",
  30944. 0x271c,
  30945. "a6",
  30946. 0x271d,
  30947. "a7",
  30948. 0x271e,
  30949. "a8",
  30950. 0x271f,
  30951. "a9",
  30952. 0x2720,
  30953. "a10",
  30954. 0x2721,
  30955. "a29",
  30956. 0x2722,
  30957. "a30",
  30958. 0x2723,
  30959. "a31",
  30960. 0x2724,
  30961. "a32",
  30962. 0x2725,
  30963. "a33",
  30964. 0x2726,
  30965. "a34",
  30966. 0x2727,
  30967. "a35",
  30968. 0x2605,
  30969. "a36",
  30970. 0x2729,
  30971. "a37",
  30972. 0x272a,
  30973. "a38",
  30974. 0x272b,
  30975. "a39",
  30976. 0x272c,
  30977. "a40",
  30978. 0x272d,
  30979. "a41",
  30980. 0x272e,
  30981. "a42",
  30982. 0x272f,
  30983. "a43",
  30984. 0x2730,
  30985. "a44",
  30986. 0x2731,
  30987. "a45",
  30988. 0x2732,
  30989. "a46",
  30990. 0x2733,
  30991. "a47",
  30992. 0x2734,
  30993. "a48",
  30994. 0x2735,
  30995. "a49",
  30996. 0x2736,
  30997. "a50",
  30998. 0x2737,
  30999. "a51",
  31000. 0x2738,
  31001. "a52",
  31002. 0x2739,
  31003. "a53",
  31004. 0x273a,
  31005. "a54",
  31006. 0x273b,
  31007. "a55",
  31008. 0x273c,
  31009. "a56",
  31010. 0x273d,
  31011. "a57",
  31012. 0x273e,
  31013. "a58",
  31014. 0x273f,
  31015. "a59",
  31016. 0x2740,
  31017. "a60",
  31018. 0x2741,
  31019. "a61",
  31020. 0x2742,
  31021. "a62",
  31022. 0x2743,
  31023. "a63",
  31024. 0x2744,
  31025. "a64",
  31026. 0x2745,
  31027. "a65",
  31028. 0x2746,
  31029. "a66",
  31030. 0x2747,
  31031. "a67",
  31032. 0x2748,
  31033. "a68",
  31034. 0x2749,
  31035. "a69",
  31036. 0x274a,
  31037. "a70",
  31038. 0x274b,
  31039. "a71",
  31040. 0x25cf,
  31041. "a72",
  31042. 0x274d,
  31043. "a73",
  31044. 0x25a0,
  31045. "a74",
  31046. 0x274f,
  31047. "a203",
  31048. 0x2750,
  31049. "a75",
  31050. 0x2751,
  31051. "a204",
  31052. 0x2752,
  31053. "a76",
  31054. 0x25b2,
  31055. "a77",
  31056. 0x25bc,
  31057. "a78",
  31058. 0x25c6,
  31059. "a79",
  31060. 0x2756,
  31061. "a81",
  31062. 0x25d7,
  31063. "a82",
  31064. 0x2758,
  31065. "a83",
  31066. 0x2759,
  31067. "a84",
  31068. 0x275a,
  31069. "a97",
  31070. 0x275b,
  31071. "a98",
  31072. 0x275c,
  31073. "a99",
  31074. 0x275d,
  31075. "a100",
  31076. 0x275e,
  31077. "a101",
  31078. 0x2761,
  31079. "a102",
  31080. 0x2762,
  31081. "a103",
  31082. 0x2763,
  31083. "a104",
  31084. 0x2764,
  31085. "a106",
  31086. 0x2765,
  31087. "a107",
  31088. 0x2766,
  31089. "a108",
  31090. 0x2767,
  31091. "a112",
  31092. 0x2663,
  31093. "a111",
  31094. 0x2666,
  31095. "a110",
  31096. 0x2665,
  31097. "a109",
  31098. 0x2660,
  31099. "a120",
  31100. 0x2460,
  31101. "a121",
  31102. 0x2461,
  31103. "a122",
  31104. 0x2462,
  31105. "a123",
  31106. 0x2463,
  31107. "a124",
  31108. 0x2464,
  31109. "a125",
  31110. 0x2465,
  31111. "a126",
  31112. 0x2466,
  31113. "a127",
  31114. 0x2467,
  31115. "a128",
  31116. 0x2468,
  31117. "a129",
  31118. 0x2469,
  31119. "a130",
  31120. 0x2776,
  31121. "a131",
  31122. 0x2777,
  31123. "a132",
  31124. 0x2778,
  31125. "a133",
  31126. 0x2779,
  31127. "a134",
  31128. 0x277a,
  31129. "a135",
  31130. 0x277b,
  31131. "a136",
  31132. 0x277c,
  31133. "a137",
  31134. 0x277d,
  31135. "a138",
  31136. 0x277e,
  31137. "a139",
  31138. 0x277f,
  31139. "a140",
  31140. 0x2780,
  31141. "a141",
  31142. 0x2781,
  31143. "a142",
  31144. 0x2782,
  31145. "a143",
  31146. 0x2783,
  31147. "a144",
  31148. 0x2784,
  31149. "a145",
  31150. 0x2785,
  31151. "a146",
  31152. 0x2786,
  31153. "a147",
  31154. 0x2787,
  31155. "a148",
  31156. 0x2788,
  31157. "a149",
  31158. 0x2789,
  31159. "a150",
  31160. 0x278a,
  31161. "a151",
  31162. 0x278b,
  31163. "a152",
  31164. 0x278c,
  31165. "a153",
  31166. 0x278d,
  31167. "a154",
  31168. 0x278e,
  31169. "a155",
  31170. 0x278f,
  31171. "a156",
  31172. 0x2790,
  31173. "a157",
  31174. 0x2791,
  31175. "a158",
  31176. 0x2792,
  31177. "a159",
  31178. 0x2793,
  31179. "a160",
  31180. 0x2794,
  31181. "a161",
  31182. 0x2192,
  31183. "a163",
  31184. 0x2194,
  31185. "a164",
  31186. 0x2195,
  31187. "a196",
  31188. 0x2798,
  31189. "a165",
  31190. 0x2799,
  31191. "a192",
  31192. 0x279a,
  31193. "a166",
  31194. 0x279b,
  31195. "a167",
  31196. 0x279c,
  31197. "a168",
  31198. 0x279d,
  31199. "a169",
  31200. 0x279e,
  31201. "a170",
  31202. 0x279f,
  31203. "a171",
  31204. 0x27a0,
  31205. "a172",
  31206. 0x27a1,
  31207. "a173",
  31208. 0x27a2,
  31209. "a162",
  31210. 0x27a3,
  31211. "a174",
  31212. 0x27a4,
  31213. "a175",
  31214. 0x27a5,
  31215. "a176",
  31216. 0x27a6,
  31217. "a177",
  31218. 0x27a7,
  31219. "a178",
  31220. 0x27a8,
  31221. "a179",
  31222. 0x27a9,
  31223. "a193",
  31224. 0x27aa,
  31225. "a180",
  31226. 0x27ab,
  31227. "a199",
  31228. 0x27ac,
  31229. "a181",
  31230. 0x27ad,
  31231. "a200",
  31232. 0x27ae,
  31233. "a182",
  31234. 0x27af,
  31235. "a201",
  31236. 0x27b1,
  31237. "a183",
  31238. 0x27b2,
  31239. "a184",
  31240. 0x27b3,
  31241. "a197",
  31242. 0x27b4,
  31243. "a185",
  31244. 0x27b5,
  31245. "a194",
  31246. 0x27b6,
  31247. "a198",
  31248. 0x27b7,
  31249. "a186",
  31250. 0x27b8,
  31251. "a195",
  31252. 0x27b9,
  31253. "a187",
  31254. 0x27ba,
  31255. "a188",
  31256. 0x27bb,
  31257. "a189",
  31258. 0x27bc,
  31259. "a190",
  31260. 0x27bd,
  31261. "a191",
  31262. 0x27be,
  31263. "a89",
  31264. 0x2768,
  31265. "a90",
  31266. 0x2769,
  31267. "a93",
  31268. 0x276a,
  31269. "a94",
  31270. 0x276b,
  31271. "a91",
  31272. 0x276c,
  31273. "a92",
  31274. 0x276d,
  31275. "a205",
  31276. 0x276e,
  31277. "a85",
  31278. 0x276f,
  31279. "a206",
  31280. 0x2770,
  31281. "a86",
  31282. 0x2771,
  31283. "a87",
  31284. 0x2772,
  31285. "a88",
  31286. 0x2773,
  31287. "a95",
  31288. 0x2774,
  31289. "a96",
  31290. 0x2775,
  31291. ".notdef",
  31292. 0x0000
  31293. ];
  31294. });
  31295. /***/ }),
  31296. /* 40 */
  31297. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  31298. __w_pdfjs_require__.r(__webpack_exports__);
  31299. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  31300. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  31301. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  31302. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  31303. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  31304. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  31305. /* harmony export */ });
  31306. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  31307. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  31308. t[63721] = 0x00a9;
  31309. t[63193] = 0x00a9;
  31310. t[63720] = 0x00ae;
  31311. t[63194] = 0x00ae;
  31312. t[63722] = 0x2122;
  31313. t[63195] = 0x2122;
  31314. t[63729] = 0x23a7;
  31315. t[63730] = 0x23a8;
  31316. t[63731] = 0x23a9;
  31317. t[63740] = 0x23ab;
  31318. t[63741] = 0x23ac;
  31319. t[63742] = 0x23ad;
  31320. t[63726] = 0x23a1;
  31321. t[63727] = 0x23a2;
  31322. t[63728] = 0x23a3;
  31323. t[63737] = 0x23a4;
  31324. t[63738] = 0x23a5;
  31325. t[63739] = 0x23a6;
  31326. t[63723] = 0x239b;
  31327. t[63724] = 0x239c;
  31328. t[63725] = 0x239d;
  31329. t[63734] = 0x239e;
  31330. t[63735] = 0x239f;
  31331. t[63736] = 0x23a0;
  31332. });
  31333. function mapSpecialUnicodeValues(code) {
  31334. if (code >= 0xfff0 && code <= 0xffff) {
  31335. return 0;
  31336. } else if (code >= 0xf600 && code <= 0xf8ff) {
  31337. return getSpecialPUASymbols()[code] || code;
  31338. } else if (code === 0x00ad) {
  31339. return 0x002d;
  31340. }
  31341. return code;
  31342. }
  31343. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  31344. let unicode = glyphsUnicodeMap[name];
  31345. if (unicode !== undefined) {
  31346. return unicode;
  31347. }
  31348. if (!name) {
  31349. return -1;
  31350. }
  31351. if (name[0] === "u") {
  31352. const nameLen = name.length;
  31353. let hexStr;
  31354. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  31355. hexStr = name.substring(3);
  31356. } else if (nameLen >= 5 && nameLen <= 7) {
  31357. hexStr = name.substring(1);
  31358. } else {
  31359. return -1;
  31360. }
  31361. if (hexStr === hexStr.toUpperCase()) {
  31362. unicode = parseInt(hexStr, 16);
  31363. if (unicode >= 0) {
  31364. return unicode;
  31365. }
  31366. }
  31367. }
  31368. return -1;
  31369. }
  31370. const UnicodeRanges = [
  31371. {
  31372. begin: 0x0000,
  31373. end: 0x007f
  31374. },
  31375. {
  31376. begin: 0x0080,
  31377. end: 0x00ff
  31378. },
  31379. {
  31380. begin: 0x0100,
  31381. end: 0x017f
  31382. },
  31383. {
  31384. begin: 0x0180,
  31385. end: 0x024f
  31386. },
  31387. {
  31388. begin: 0x0250,
  31389. end: 0x02af
  31390. },
  31391. {
  31392. begin: 0x02b0,
  31393. end: 0x02ff
  31394. },
  31395. {
  31396. begin: 0x0300,
  31397. end: 0x036f
  31398. },
  31399. {
  31400. begin: 0x0370,
  31401. end: 0x03ff
  31402. },
  31403. {
  31404. begin: 0x2c80,
  31405. end: 0x2cff
  31406. },
  31407. {
  31408. begin: 0x0400,
  31409. end: 0x04ff
  31410. },
  31411. {
  31412. begin: 0x0530,
  31413. end: 0x058f
  31414. },
  31415. {
  31416. begin: 0x0590,
  31417. end: 0x05ff
  31418. },
  31419. {
  31420. begin: 0xa500,
  31421. end: 0xa63f
  31422. },
  31423. {
  31424. begin: 0x0600,
  31425. end: 0x06ff
  31426. },
  31427. {
  31428. begin: 0x07c0,
  31429. end: 0x07ff
  31430. },
  31431. {
  31432. begin: 0x0900,
  31433. end: 0x097f
  31434. },
  31435. {
  31436. begin: 0x0980,
  31437. end: 0x09ff
  31438. },
  31439. {
  31440. begin: 0x0a00,
  31441. end: 0x0a7f
  31442. },
  31443. {
  31444. begin: 0x0a80,
  31445. end: 0x0aff
  31446. },
  31447. {
  31448. begin: 0x0b00,
  31449. end: 0x0b7f
  31450. },
  31451. {
  31452. begin: 0x0b80,
  31453. end: 0x0bff
  31454. },
  31455. {
  31456. begin: 0x0c00,
  31457. end: 0x0c7f
  31458. },
  31459. {
  31460. begin: 0x0c80,
  31461. end: 0x0cff
  31462. },
  31463. {
  31464. begin: 0x0d00,
  31465. end: 0x0d7f
  31466. },
  31467. {
  31468. begin: 0x0e00,
  31469. end: 0x0e7f
  31470. },
  31471. {
  31472. begin: 0x0e80,
  31473. end: 0x0eff
  31474. },
  31475. {
  31476. begin: 0x10a0,
  31477. end: 0x10ff
  31478. },
  31479. {
  31480. begin: 0x1b00,
  31481. end: 0x1b7f
  31482. },
  31483. {
  31484. begin: 0x1100,
  31485. end: 0x11ff
  31486. },
  31487. {
  31488. begin: 0x1e00,
  31489. end: 0x1eff
  31490. },
  31491. {
  31492. begin: 0x1f00,
  31493. end: 0x1fff
  31494. },
  31495. {
  31496. begin: 0x2000,
  31497. end: 0x206f
  31498. },
  31499. {
  31500. begin: 0x2070,
  31501. end: 0x209f
  31502. },
  31503. {
  31504. begin: 0x20a0,
  31505. end: 0x20cf
  31506. },
  31507. {
  31508. begin: 0x20d0,
  31509. end: 0x20ff
  31510. },
  31511. {
  31512. begin: 0x2100,
  31513. end: 0x214f
  31514. },
  31515. {
  31516. begin: 0x2150,
  31517. end: 0x218f
  31518. },
  31519. {
  31520. begin: 0x2190,
  31521. end: 0x21ff
  31522. },
  31523. {
  31524. begin: 0x2200,
  31525. end: 0x22ff
  31526. },
  31527. {
  31528. begin: 0x2300,
  31529. end: 0x23ff
  31530. },
  31531. {
  31532. begin: 0x2400,
  31533. end: 0x243f
  31534. },
  31535. {
  31536. begin: 0x2440,
  31537. end: 0x245f
  31538. },
  31539. {
  31540. begin: 0x2460,
  31541. end: 0x24ff
  31542. },
  31543. {
  31544. begin: 0x2500,
  31545. end: 0x257f
  31546. },
  31547. {
  31548. begin: 0x2580,
  31549. end: 0x259f
  31550. },
  31551. {
  31552. begin: 0x25a0,
  31553. end: 0x25ff
  31554. },
  31555. {
  31556. begin: 0x2600,
  31557. end: 0x26ff
  31558. },
  31559. {
  31560. begin: 0x2700,
  31561. end: 0x27bf
  31562. },
  31563. {
  31564. begin: 0x3000,
  31565. end: 0x303f
  31566. },
  31567. {
  31568. begin: 0x3040,
  31569. end: 0x309f
  31570. },
  31571. {
  31572. begin: 0x30a0,
  31573. end: 0x30ff
  31574. },
  31575. {
  31576. begin: 0x3100,
  31577. end: 0x312f
  31578. },
  31579. {
  31580. begin: 0x3130,
  31581. end: 0x318f
  31582. },
  31583. {
  31584. begin: 0xa840,
  31585. end: 0xa87f
  31586. },
  31587. {
  31588. begin: 0x3200,
  31589. end: 0x32ff
  31590. },
  31591. {
  31592. begin: 0x3300,
  31593. end: 0x33ff
  31594. },
  31595. {
  31596. begin: 0xac00,
  31597. end: 0xd7af
  31598. },
  31599. {
  31600. begin: 0xd800,
  31601. end: 0xdfff
  31602. },
  31603. {
  31604. begin: 0x10900,
  31605. end: 0x1091f
  31606. },
  31607. {
  31608. begin: 0x4e00,
  31609. end: 0x9fff
  31610. },
  31611. {
  31612. begin: 0xe000,
  31613. end: 0xf8ff
  31614. },
  31615. {
  31616. begin: 0x31c0,
  31617. end: 0x31ef
  31618. },
  31619. {
  31620. begin: 0xfb00,
  31621. end: 0xfb4f
  31622. },
  31623. {
  31624. begin: 0xfb50,
  31625. end: 0xfdff
  31626. },
  31627. {
  31628. begin: 0xfe20,
  31629. end: 0xfe2f
  31630. },
  31631. {
  31632. begin: 0xfe10,
  31633. end: 0xfe1f
  31634. },
  31635. {
  31636. begin: 0xfe50,
  31637. end: 0xfe6f
  31638. },
  31639. {
  31640. begin: 0xfe70,
  31641. end: 0xfeff
  31642. },
  31643. {
  31644. begin: 0xff00,
  31645. end: 0xffef
  31646. },
  31647. {
  31648. begin: 0xfff0,
  31649. end: 0xffff
  31650. },
  31651. {
  31652. begin: 0x0f00,
  31653. end: 0x0fff
  31654. },
  31655. {
  31656. begin: 0x0700,
  31657. end: 0x074f
  31658. },
  31659. {
  31660. begin: 0x0780,
  31661. end: 0x07bf
  31662. },
  31663. {
  31664. begin: 0x0d80,
  31665. end: 0x0dff
  31666. },
  31667. {
  31668. begin: 0x1000,
  31669. end: 0x109f
  31670. },
  31671. {
  31672. begin: 0x1200,
  31673. end: 0x137f
  31674. },
  31675. {
  31676. begin: 0x13a0,
  31677. end: 0x13ff
  31678. },
  31679. {
  31680. begin: 0x1400,
  31681. end: 0x167f
  31682. },
  31683. {
  31684. begin: 0x1680,
  31685. end: 0x169f
  31686. },
  31687. {
  31688. begin: 0x16a0,
  31689. end: 0x16ff
  31690. },
  31691. {
  31692. begin: 0x1780,
  31693. end: 0x17ff
  31694. },
  31695. {
  31696. begin: 0x1800,
  31697. end: 0x18af
  31698. },
  31699. {
  31700. begin: 0x2800,
  31701. end: 0x28ff
  31702. },
  31703. {
  31704. begin: 0xa000,
  31705. end: 0xa48f
  31706. },
  31707. {
  31708. begin: 0x1700,
  31709. end: 0x171f
  31710. },
  31711. {
  31712. begin: 0x10300,
  31713. end: 0x1032f
  31714. },
  31715. {
  31716. begin: 0x10330,
  31717. end: 0x1034f
  31718. },
  31719. {
  31720. begin: 0x10400,
  31721. end: 0x1044f
  31722. },
  31723. {
  31724. begin: 0x1d000,
  31725. end: 0x1d0ff
  31726. },
  31727. {
  31728. begin: 0x1d400,
  31729. end: 0x1d7ff
  31730. },
  31731. {
  31732. begin: 0xff000,
  31733. end: 0xffffd
  31734. },
  31735. {
  31736. begin: 0xfe00,
  31737. end: 0xfe0f
  31738. },
  31739. {
  31740. begin: 0xe0000,
  31741. end: 0xe007f
  31742. },
  31743. {
  31744. begin: 0x1900,
  31745. end: 0x194f
  31746. },
  31747. {
  31748. begin: 0x1950,
  31749. end: 0x197f
  31750. },
  31751. {
  31752. begin: 0x1980,
  31753. end: 0x19df
  31754. },
  31755. {
  31756. begin: 0x1a00,
  31757. end: 0x1a1f
  31758. },
  31759. {
  31760. begin: 0x2c00,
  31761. end: 0x2c5f
  31762. },
  31763. {
  31764. begin: 0x2d30,
  31765. end: 0x2d7f
  31766. },
  31767. {
  31768. begin: 0x4dc0,
  31769. end: 0x4dff
  31770. },
  31771. {
  31772. begin: 0xa800,
  31773. end: 0xa82f
  31774. },
  31775. {
  31776. begin: 0x10000,
  31777. end: 0x1007f
  31778. },
  31779. {
  31780. begin: 0x10140,
  31781. end: 0x1018f
  31782. },
  31783. {
  31784. begin: 0x10380,
  31785. end: 0x1039f
  31786. },
  31787. {
  31788. begin: 0x103a0,
  31789. end: 0x103df
  31790. },
  31791. {
  31792. begin: 0x10450,
  31793. end: 0x1047f
  31794. },
  31795. {
  31796. begin: 0x10480,
  31797. end: 0x104af
  31798. },
  31799. {
  31800. begin: 0x10800,
  31801. end: 0x1083f
  31802. },
  31803. {
  31804. begin: 0x10a00,
  31805. end: 0x10a5f
  31806. },
  31807. {
  31808. begin: 0x1d300,
  31809. end: 0x1d35f
  31810. },
  31811. {
  31812. begin: 0x12000,
  31813. end: 0x123ff
  31814. },
  31815. {
  31816. begin: 0x1d360,
  31817. end: 0x1d37f
  31818. },
  31819. {
  31820. begin: 0x1b80,
  31821. end: 0x1bbf
  31822. },
  31823. {
  31824. begin: 0x1c00,
  31825. end: 0x1c4f
  31826. },
  31827. {
  31828. begin: 0x1c50,
  31829. end: 0x1c7f
  31830. },
  31831. {
  31832. begin: 0xa880,
  31833. end: 0xa8df
  31834. },
  31835. {
  31836. begin: 0xa900,
  31837. end: 0xa92f
  31838. },
  31839. {
  31840. begin: 0xa930,
  31841. end: 0xa95f
  31842. },
  31843. {
  31844. begin: 0xaa00,
  31845. end: 0xaa5f
  31846. },
  31847. {
  31848. begin: 0x10190,
  31849. end: 0x101cf
  31850. },
  31851. {
  31852. begin: 0x101d0,
  31853. end: 0x101ff
  31854. },
  31855. {
  31856. begin: 0x102a0,
  31857. end: 0x102df
  31858. },
  31859. {
  31860. begin: 0x1f030,
  31861. end: 0x1f09f
  31862. }
  31863. ];
  31864. function getUnicodeRangeFor(value) {
  31865. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  31866. const range = UnicodeRanges[i];
  31867. if (value >= range.begin && value < range.end) {
  31868. return i;
  31869. }
  31870. }
  31871. return -1;
  31872. }
  31873. function isRTLRangeFor(value) {
  31874. let range = UnicodeRanges[13];
  31875. if (value >= range.begin && value < range.end) {
  31876. return true;
  31877. }
  31878. range = UnicodeRanges[11];
  31879. if (value >= range.begin && value < range.end) {
  31880. return true;
  31881. }
  31882. return false;
  31883. }
  31884. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  31885. return [
  31886. "\u00A8",
  31887. "\u0020\u0308",
  31888. "\u00AF",
  31889. "\u0020\u0304",
  31890. "\u00B4",
  31891. "\u0020\u0301",
  31892. "\u00B5",
  31893. "\u03BC",
  31894. "\u00B8",
  31895. "\u0020\u0327",
  31896. "\u0132",
  31897. "\u0049\u004A",
  31898. "\u0133",
  31899. "\u0069\u006A",
  31900. "\u013F",
  31901. "\u004C\u00B7",
  31902. "\u0140",
  31903. "\u006C\u00B7",
  31904. "\u0149",
  31905. "\u02BC\u006E",
  31906. "\u017F",
  31907. "\u0073",
  31908. "\u01C4",
  31909. "\u0044\u017D",
  31910. "\u01C5",
  31911. "\u0044\u017E",
  31912. "\u01C6",
  31913. "\u0064\u017E",
  31914. "\u01C7",
  31915. "\u004C\u004A",
  31916. "\u01C8",
  31917. "\u004C\u006A",
  31918. "\u01C9",
  31919. "\u006C\u006A",
  31920. "\u01CA",
  31921. "\u004E\u004A",
  31922. "\u01CB",
  31923. "\u004E\u006A",
  31924. "\u01CC",
  31925. "\u006E\u006A",
  31926. "\u01F1",
  31927. "\u0044\u005A",
  31928. "\u01F2",
  31929. "\u0044\u007A",
  31930. "\u01F3",
  31931. "\u0064\u007A",
  31932. "\u02D8",
  31933. "\u0020\u0306",
  31934. "\u02D9",
  31935. "\u0020\u0307",
  31936. "\u02DA",
  31937. "\u0020\u030A",
  31938. "\u02DB",
  31939. "\u0020\u0328",
  31940. "\u02DC",
  31941. "\u0020\u0303",
  31942. "\u02DD",
  31943. "\u0020\u030B",
  31944. "\u037A",
  31945. "\u0020\u0345",
  31946. "\u0384",
  31947. "\u0020\u0301",
  31948. "\u03D0",
  31949. "\u03B2",
  31950. "\u03D1",
  31951. "\u03B8",
  31952. "\u03D2",
  31953. "\u03A5",
  31954. "\u03D5",
  31955. "\u03C6",
  31956. "\u03D6",
  31957. "\u03C0",
  31958. "\u03F0",
  31959. "\u03BA",
  31960. "\u03F1",
  31961. "\u03C1",
  31962. "\u03F2",
  31963. "\u03C2",
  31964. "\u03F4",
  31965. "\u0398",
  31966. "\u03F5",
  31967. "\u03B5",
  31968. "\u03F9",
  31969. "\u03A3",
  31970. "\u0587",
  31971. "\u0565\u0582",
  31972. "\u0675",
  31973. "\u0627\u0674",
  31974. "\u0676",
  31975. "\u0648\u0674",
  31976. "\u0677",
  31977. "\u06C7\u0674",
  31978. "\u0678",
  31979. "\u064A\u0674",
  31980. "\u0E33",
  31981. "\u0E4D\u0E32",
  31982. "\u0EB3",
  31983. "\u0ECD\u0EB2",
  31984. "\u0EDC",
  31985. "\u0EAB\u0E99",
  31986. "\u0EDD",
  31987. "\u0EAB\u0EA1",
  31988. "\u0F77",
  31989. "\u0FB2\u0F81",
  31990. "\u0F79",
  31991. "\u0FB3\u0F81",
  31992. "\u1E9A",
  31993. "\u0061\u02BE",
  31994. "\u1FBD",
  31995. "\u0020\u0313",
  31996. "\u1FBF",
  31997. "\u0020\u0313",
  31998. "\u1FC0",
  31999. "\u0020\u0342",
  32000. "\u1FFE",
  32001. "\u0020\u0314",
  32002. "\u2002",
  32003. "\u0020",
  32004. "\u2003",
  32005. "\u0020",
  32006. "\u2004",
  32007. "\u0020",
  32008. "\u2005",
  32009. "\u0020",
  32010. "\u2006",
  32011. "\u0020",
  32012. "\u2008",
  32013. "\u0020",
  32014. "\u2009",
  32015. "\u0020",
  32016. "\u200A",
  32017. "\u0020",
  32018. "\u2017",
  32019. "\u0020\u0333",
  32020. "\u2024",
  32021. "\u002E",
  32022. "\u2025",
  32023. "\u002E\u002E",
  32024. "\u2026",
  32025. "\u002E\u002E\u002E",
  32026. "\u2033",
  32027. "\u2032\u2032",
  32028. "\u2034",
  32029. "\u2032\u2032\u2032",
  32030. "\u2036",
  32031. "\u2035\u2035",
  32032. "\u2037",
  32033. "\u2035\u2035\u2035",
  32034. "\u203C",
  32035. "\u0021\u0021",
  32036. "\u203E",
  32037. "\u0020\u0305",
  32038. "\u2047",
  32039. "\u003F\u003F",
  32040. "\u2048",
  32041. "\u003F\u0021",
  32042. "\u2049",
  32043. "\u0021\u003F",
  32044. "\u2057",
  32045. "\u2032\u2032\u2032\u2032",
  32046. "\u205F",
  32047. "\u0020",
  32048. "\u20A8",
  32049. "\u0052\u0073",
  32050. "\u2100",
  32051. "\u0061\u002F\u0063",
  32052. "\u2101",
  32053. "\u0061\u002F\u0073",
  32054. "\u2103",
  32055. "\u00B0\u0043",
  32056. "\u2105",
  32057. "\u0063\u002F\u006F",
  32058. "\u2106",
  32059. "\u0063\u002F\u0075",
  32060. "\u2107",
  32061. "\u0190",
  32062. "\u2109",
  32063. "\u00B0\u0046",
  32064. "\u2116",
  32065. "\u004E\u006F",
  32066. "\u2121",
  32067. "\u0054\u0045\u004C",
  32068. "\u2135",
  32069. "\u05D0",
  32070. "\u2136",
  32071. "\u05D1",
  32072. "\u2137",
  32073. "\u05D2",
  32074. "\u2138",
  32075. "\u05D3",
  32076. "\u213B",
  32077. "\u0046\u0041\u0058",
  32078. "\u2160",
  32079. "\u0049",
  32080. "\u2161",
  32081. "\u0049\u0049",
  32082. "\u2162",
  32083. "\u0049\u0049\u0049",
  32084. "\u2163",
  32085. "\u0049\u0056",
  32086. "\u2164",
  32087. "\u0056",
  32088. "\u2165",
  32089. "\u0056\u0049",
  32090. "\u2166",
  32091. "\u0056\u0049\u0049",
  32092. "\u2167",
  32093. "\u0056\u0049\u0049\u0049",
  32094. "\u2168",
  32095. "\u0049\u0058",
  32096. "\u2169",
  32097. "\u0058",
  32098. "\u216A",
  32099. "\u0058\u0049",
  32100. "\u216B",
  32101. "\u0058\u0049\u0049",
  32102. "\u216C",
  32103. "\u004C",
  32104. "\u216D",
  32105. "\u0043",
  32106. "\u216E",
  32107. "\u0044",
  32108. "\u216F",
  32109. "\u004D",
  32110. "\u2170",
  32111. "\u0069",
  32112. "\u2171",
  32113. "\u0069\u0069",
  32114. "\u2172",
  32115. "\u0069\u0069\u0069",
  32116. "\u2173",
  32117. "\u0069\u0076",
  32118. "\u2174",
  32119. "\u0076",
  32120. "\u2175",
  32121. "\u0076\u0069",
  32122. "\u2176",
  32123. "\u0076\u0069\u0069",
  32124. "\u2177",
  32125. "\u0076\u0069\u0069\u0069",
  32126. "\u2178",
  32127. "\u0069\u0078",
  32128. "\u2179",
  32129. "\u0078",
  32130. "\u217A",
  32131. "\u0078\u0069",
  32132. "\u217B",
  32133. "\u0078\u0069\u0069",
  32134. "\u217C",
  32135. "\u006C",
  32136. "\u217D",
  32137. "\u0063",
  32138. "\u217E",
  32139. "\u0064",
  32140. "\u217F",
  32141. "\u006D",
  32142. "\u222C",
  32143. "\u222B\u222B",
  32144. "\u222D",
  32145. "\u222B\u222B\u222B",
  32146. "\u222F",
  32147. "\u222E\u222E",
  32148. "\u2230",
  32149. "\u222E\u222E\u222E",
  32150. "\u2474",
  32151. "\u0028\u0031\u0029",
  32152. "\u2475",
  32153. "\u0028\u0032\u0029",
  32154. "\u2476",
  32155. "\u0028\u0033\u0029",
  32156. "\u2477",
  32157. "\u0028\u0034\u0029",
  32158. "\u2478",
  32159. "\u0028\u0035\u0029",
  32160. "\u2479",
  32161. "\u0028\u0036\u0029",
  32162. "\u247A",
  32163. "\u0028\u0037\u0029",
  32164. "\u247B",
  32165. "\u0028\u0038\u0029",
  32166. "\u247C",
  32167. "\u0028\u0039\u0029",
  32168. "\u247D",
  32169. "\u0028\u0031\u0030\u0029",
  32170. "\u247E",
  32171. "\u0028\u0031\u0031\u0029",
  32172. "\u247F",
  32173. "\u0028\u0031\u0032\u0029",
  32174. "\u2480",
  32175. "\u0028\u0031\u0033\u0029",
  32176. "\u2481",
  32177. "\u0028\u0031\u0034\u0029",
  32178. "\u2482",
  32179. "\u0028\u0031\u0035\u0029",
  32180. "\u2483",
  32181. "\u0028\u0031\u0036\u0029",
  32182. "\u2484",
  32183. "\u0028\u0031\u0037\u0029",
  32184. "\u2485",
  32185. "\u0028\u0031\u0038\u0029",
  32186. "\u2486",
  32187. "\u0028\u0031\u0039\u0029",
  32188. "\u2487",
  32189. "\u0028\u0032\u0030\u0029",
  32190. "\u2488",
  32191. "\u0031\u002E",
  32192. "\u2489",
  32193. "\u0032\u002E",
  32194. "\u248A",
  32195. "\u0033\u002E",
  32196. "\u248B",
  32197. "\u0034\u002E",
  32198. "\u248C",
  32199. "\u0035\u002E",
  32200. "\u248D",
  32201. "\u0036\u002E",
  32202. "\u248E",
  32203. "\u0037\u002E",
  32204. "\u248F",
  32205. "\u0038\u002E",
  32206. "\u2490",
  32207. "\u0039\u002E",
  32208. "\u2491",
  32209. "\u0031\u0030\u002E",
  32210. "\u2492",
  32211. "\u0031\u0031\u002E",
  32212. "\u2493",
  32213. "\u0031\u0032\u002E",
  32214. "\u2494",
  32215. "\u0031\u0033\u002E",
  32216. "\u2495",
  32217. "\u0031\u0034\u002E",
  32218. "\u2496",
  32219. "\u0031\u0035\u002E",
  32220. "\u2497",
  32221. "\u0031\u0036\u002E",
  32222. "\u2498",
  32223. "\u0031\u0037\u002E",
  32224. "\u2499",
  32225. "\u0031\u0038\u002E",
  32226. "\u249A",
  32227. "\u0031\u0039\u002E",
  32228. "\u249B",
  32229. "\u0032\u0030\u002E",
  32230. "\u249C",
  32231. "\u0028\u0061\u0029",
  32232. "\u249D",
  32233. "\u0028\u0062\u0029",
  32234. "\u249E",
  32235. "\u0028\u0063\u0029",
  32236. "\u249F",
  32237. "\u0028\u0064\u0029",
  32238. "\u24A0",
  32239. "\u0028\u0065\u0029",
  32240. "\u24A1",
  32241. "\u0028\u0066\u0029",
  32242. "\u24A2",
  32243. "\u0028\u0067\u0029",
  32244. "\u24A3",
  32245. "\u0028\u0068\u0029",
  32246. "\u24A4",
  32247. "\u0028\u0069\u0029",
  32248. "\u24A5",
  32249. "\u0028\u006A\u0029",
  32250. "\u24A6",
  32251. "\u0028\u006B\u0029",
  32252. "\u24A7",
  32253. "\u0028\u006C\u0029",
  32254. "\u24A8",
  32255. "\u0028\u006D\u0029",
  32256. "\u24A9",
  32257. "\u0028\u006E\u0029",
  32258. "\u24AA",
  32259. "\u0028\u006F\u0029",
  32260. "\u24AB",
  32261. "\u0028\u0070\u0029",
  32262. "\u24AC",
  32263. "\u0028\u0071\u0029",
  32264. "\u24AD",
  32265. "\u0028\u0072\u0029",
  32266. "\u24AE",
  32267. "\u0028\u0073\u0029",
  32268. "\u24AF",
  32269. "\u0028\u0074\u0029",
  32270. "\u24B0",
  32271. "\u0028\u0075\u0029",
  32272. "\u24B1",
  32273. "\u0028\u0076\u0029",
  32274. "\u24B2",
  32275. "\u0028\u0077\u0029",
  32276. "\u24B3",
  32277. "\u0028\u0078\u0029",
  32278. "\u24B4",
  32279. "\u0028\u0079\u0029",
  32280. "\u24B5",
  32281. "\u0028\u007A\u0029",
  32282. "\u2A0C",
  32283. "\u222B\u222B\u222B\u222B",
  32284. "\u2A74",
  32285. "\u003A\u003A\u003D",
  32286. "\u2A75",
  32287. "\u003D\u003D",
  32288. "\u2A76",
  32289. "\u003D\u003D\u003D",
  32290. "\u2E9F",
  32291. "\u6BCD",
  32292. "\u2EF3",
  32293. "\u9F9F",
  32294. "\u2F00",
  32295. "\u4E00",
  32296. "\u2F01",
  32297. "\u4E28",
  32298. "\u2F02",
  32299. "\u4E36",
  32300. "\u2F03",
  32301. "\u4E3F",
  32302. "\u2F04",
  32303. "\u4E59",
  32304. "\u2F05",
  32305. "\u4E85",
  32306. "\u2F06",
  32307. "\u4E8C",
  32308. "\u2F07",
  32309. "\u4EA0",
  32310. "\u2F08",
  32311. "\u4EBA",
  32312. "\u2F09",
  32313. "\u513F",
  32314. "\u2F0A",
  32315. "\u5165",
  32316. "\u2F0B",
  32317. "\u516B",
  32318. "\u2F0C",
  32319. "\u5182",
  32320. "\u2F0D",
  32321. "\u5196",
  32322. "\u2F0E",
  32323. "\u51AB",
  32324. "\u2F0F",
  32325. "\u51E0",
  32326. "\u2F10",
  32327. "\u51F5",
  32328. "\u2F11",
  32329. "\u5200",
  32330. "\u2F12",
  32331. "\u529B",
  32332. "\u2F13",
  32333. "\u52F9",
  32334. "\u2F14",
  32335. "\u5315",
  32336. "\u2F15",
  32337. "\u531A",
  32338. "\u2F16",
  32339. "\u5338",
  32340. "\u2F17",
  32341. "\u5341",
  32342. "\u2F18",
  32343. "\u535C",
  32344. "\u2F19",
  32345. "\u5369",
  32346. "\u2F1A",
  32347. "\u5382",
  32348. "\u2F1B",
  32349. "\u53B6",
  32350. "\u2F1C",
  32351. "\u53C8",
  32352. "\u2F1D",
  32353. "\u53E3",
  32354. "\u2F1E",
  32355. "\u56D7",
  32356. "\u2F1F",
  32357. "\u571F",
  32358. "\u2F20",
  32359. "\u58EB",
  32360. "\u2F21",
  32361. "\u5902",
  32362. "\u2F22",
  32363. "\u590A",
  32364. "\u2F23",
  32365. "\u5915",
  32366. "\u2F24",
  32367. "\u5927",
  32368. "\u2F25",
  32369. "\u5973",
  32370. "\u2F26",
  32371. "\u5B50",
  32372. "\u2F27",
  32373. "\u5B80",
  32374. "\u2F28",
  32375. "\u5BF8",
  32376. "\u2F29",
  32377. "\u5C0F",
  32378. "\u2F2A",
  32379. "\u5C22",
  32380. "\u2F2B",
  32381. "\u5C38",
  32382. "\u2F2C",
  32383. "\u5C6E",
  32384. "\u2F2D",
  32385. "\u5C71",
  32386. "\u2F2E",
  32387. "\u5DDB",
  32388. "\u2F2F",
  32389. "\u5DE5",
  32390. "\u2F30",
  32391. "\u5DF1",
  32392. "\u2F31",
  32393. "\u5DFE",
  32394. "\u2F32",
  32395. "\u5E72",
  32396. "\u2F33",
  32397. "\u5E7A",
  32398. "\u2F34",
  32399. "\u5E7F",
  32400. "\u2F35",
  32401. "\u5EF4",
  32402. "\u2F36",
  32403. "\u5EFE",
  32404. "\u2F37",
  32405. "\u5F0B",
  32406. "\u2F38",
  32407. "\u5F13",
  32408. "\u2F39",
  32409. "\u5F50",
  32410. "\u2F3A",
  32411. "\u5F61",
  32412. "\u2F3B",
  32413. "\u5F73",
  32414. "\u2F3C",
  32415. "\u5FC3",
  32416. "\u2F3D",
  32417. "\u6208",
  32418. "\u2F3E",
  32419. "\u6236",
  32420. "\u2F3F",
  32421. "\u624B",
  32422. "\u2F40",
  32423. "\u652F",
  32424. "\u2F41",
  32425. "\u6534",
  32426. "\u2F42",
  32427. "\u6587",
  32428. "\u2F43",
  32429. "\u6597",
  32430. "\u2F44",
  32431. "\u65A4",
  32432. "\u2F45",
  32433. "\u65B9",
  32434. "\u2F46",
  32435. "\u65E0",
  32436. "\u2F47",
  32437. "\u65E5",
  32438. "\u2F48",
  32439. "\u66F0",
  32440. "\u2F49",
  32441. "\u6708",
  32442. "\u2F4A",
  32443. "\u6728",
  32444. "\u2F4B",
  32445. "\u6B20",
  32446. "\u2F4C",
  32447. "\u6B62",
  32448. "\u2F4D",
  32449. "\u6B79",
  32450. "\u2F4E",
  32451. "\u6BB3",
  32452. "\u2F4F",
  32453. "\u6BCB",
  32454. "\u2F50",
  32455. "\u6BD4",
  32456. "\u2F51",
  32457. "\u6BDB",
  32458. "\u2F52",
  32459. "\u6C0F",
  32460. "\u2F53",
  32461. "\u6C14",
  32462. "\u2F54",
  32463. "\u6C34",
  32464. "\u2F55",
  32465. "\u706B",
  32466. "\u2F56",
  32467. "\u722A",
  32468. "\u2F57",
  32469. "\u7236",
  32470. "\u2F58",
  32471. "\u723B",
  32472. "\u2F59",
  32473. "\u723F",
  32474. "\u2F5A",
  32475. "\u7247",
  32476. "\u2F5B",
  32477. "\u7259",
  32478. "\u2F5C",
  32479. "\u725B",
  32480. "\u2F5D",
  32481. "\u72AC",
  32482. "\u2F5E",
  32483. "\u7384",
  32484. "\u2F5F",
  32485. "\u7389",
  32486. "\u2F60",
  32487. "\u74DC",
  32488. "\u2F61",
  32489. "\u74E6",
  32490. "\u2F62",
  32491. "\u7518",
  32492. "\u2F63",
  32493. "\u751F",
  32494. "\u2F64",
  32495. "\u7528",
  32496. "\u2F65",
  32497. "\u7530",
  32498. "\u2F66",
  32499. "\u758B",
  32500. "\u2F67",
  32501. "\u7592",
  32502. "\u2F68",
  32503. "\u7676",
  32504. "\u2F69",
  32505. "\u767D",
  32506. "\u2F6A",
  32507. "\u76AE",
  32508. "\u2F6B",
  32509. "\u76BF",
  32510. "\u2F6C",
  32511. "\u76EE",
  32512. "\u2F6D",
  32513. "\u77DB",
  32514. "\u2F6E",
  32515. "\u77E2",
  32516. "\u2F6F",
  32517. "\u77F3",
  32518. "\u2F70",
  32519. "\u793A",
  32520. "\u2F71",
  32521. "\u79B8",
  32522. "\u2F72",
  32523. "\u79BE",
  32524. "\u2F73",
  32525. "\u7A74",
  32526. "\u2F74",
  32527. "\u7ACB",
  32528. "\u2F75",
  32529. "\u7AF9",
  32530. "\u2F76",
  32531. "\u7C73",
  32532. "\u2F77",
  32533. "\u7CF8",
  32534. "\u2F78",
  32535. "\u7F36",
  32536. "\u2F79",
  32537. "\u7F51",
  32538. "\u2F7A",
  32539. "\u7F8A",
  32540. "\u2F7B",
  32541. "\u7FBD",
  32542. "\u2F7C",
  32543. "\u8001",
  32544. "\u2F7D",
  32545. "\u800C",
  32546. "\u2F7E",
  32547. "\u8012",
  32548. "\u2F7F",
  32549. "\u8033",
  32550. "\u2F80",
  32551. "\u807F",
  32552. "\u2F81",
  32553. "\u8089",
  32554. "\u2F82",
  32555. "\u81E3",
  32556. "\u2F83",
  32557. "\u81EA",
  32558. "\u2F84",
  32559. "\u81F3",
  32560. "\u2F85",
  32561. "\u81FC",
  32562. "\u2F86",
  32563. "\u820C",
  32564. "\u2F87",
  32565. "\u821B",
  32566. "\u2F88",
  32567. "\u821F",
  32568. "\u2F89",
  32569. "\u826E",
  32570. "\u2F8A",
  32571. "\u8272",
  32572. "\u2F8B",
  32573. "\u8278",
  32574. "\u2F8C",
  32575. "\u864D",
  32576. "\u2F8D",
  32577. "\u866B",
  32578. "\u2F8E",
  32579. "\u8840",
  32580. "\u2F8F",
  32581. "\u884C",
  32582. "\u2F90",
  32583. "\u8863",
  32584. "\u2F91",
  32585. "\u897E",
  32586. "\u2F92",
  32587. "\u898B",
  32588. "\u2F93",
  32589. "\u89D2",
  32590. "\u2F94",
  32591. "\u8A00",
  32592. "\u2F95",
  32593. "\u8C37",
  32594. "\u2F96",
  32595. "\u8C46",
  32596. "\u2F97",
  32597. "\u8C55",
  32598. "\u2F98",
  32599. "\u8C78",
  32600. "\u2F99",
  32601. "\u8C9D",
  32602. "\u2F9A",
  32603. "\u8D64",
  32604. "\u2F9B",
  32605. "\u8D70",
  32606. "\u2F9C",
  32607. "\u8DB3",
  32608. "\u2F9D",
  32609. "\u8EAB",
  32610. "\u2F9E",
  32611. "\u8ECA",
  32612. "\u2F9F",
  32613. "\u8F9B",
  32614. "\u2FA0",
  32615. "\u8FB0",
  32616. "\u2FA1",
  32617. "\u8FB5",
  32618. "\u2FA2",
  32619. "\u9091",
  32620. "\u2FA3",
  32621. "\u9149",
  32622. "\u2FA4",
  32623. "\u91C6",
  32624. "\u2FA5",
  32625. "\u91CC",
  32626. "\u2FA6",
  32627. "\u91D1",
  32628. "\u2FA7",
  32629. "\u9577",
  32630. "\u2FA8",
  32631. "\u9580",
  32632. "\u2FA9",
  32633. "\u961C",
  32634. "\u2FAA",
  32635. "\u96B6",
  32636. "\u2FAB",
  32637. "\u96B9",
  32638. "\u2FAC",
  32639. "\u96E8",
  32640. "\u2FAD",
  32641. "\u9751",
  32642. "\u2FAE",
  32643. "\u975E",
  32644. "\u2FAF",
  32645. "\u9762",
  32646. "\u2FB0",
  32647. "\u9769",
  32648. "\u2FB1",
  32649. "\u97CB",
  32650. "\u2FB2",
  32651. "\u97ED",
  32652. "\u2FB3",
  32653. "\u97F3",
  32654. "\u2FB4",
  32655. "\u9801",
  32656. "\u2FB5",
  32657. "\u98A8",
  32658. "\u2FB6",
  32659. "\u98DB",
  32660. "\u2FB7",
  32661. "\u98DF",
  32662. "\u2FB8",
  32663. "\u9996",
  32664. "\u2FB9",
  32665. "\u9999",
  32666. "\u2FBA",
  32667. "\u99AC",
  32668. "\u2FBB",
  32669. "\u9AA8",
  32670. "\u2FBC",
  32671. "\u9AD8",
  32672. "\u2FBD",
  32673. "\u9ADF",
  32674. "\u2FBE",
  32675. "\u9B25",
  32676. "\u2FBF",
  32677. "\u9B2F",
  32678. "\u2FC0",
  32679. "\u9B32",
  32680. "\u2FC1",
  32681. "\u9B3C",
  32682. "\u2FC2",
  32683. "\u9B5A",
  32684. "\u2FC3",
  32685. "\u9CE5",
  32686. "\u2FC4",
  32687. "\u9E75",
  32688. "\u2FC5",
  32689. "\u9E7F",
  32690. "\u2FC6",
  32691. "\u9EA5",
  32692. "\u2FC7",
  32693. "\u9EBB",
  32694. "\u2FC8",
  32695. "\u9EC3",
  32696. "\u2FC9",
  32697. "\u9ECD",
  32698. "\u2FCA",
  32699. "\u9ED1",
  32700. "\u2FCB",
  32701. "\u9EF9",
  32702. "\u2FCC",
  32703. "\u9EFD",
  32704. "\u2FCD",
  32705. "\u9F0E",
  32706. "\u2FCE",
  32707. "\u9F13",
  32708. "\u2FCF",
  32709. "\u9F20",
  32710. "\u2FD0",
  32711. "\u9F3B",
  32712. "\u2FD1",
  32713. "\u9F4A",
  32714. "\u2FD2",
  32715. "\u9F52",
  32716. "\u2FD3",
  32717. "\u9F8D",
  32718. "\u2FD4",
  32719. "\u9F9C",
  32720. "\u2FD5",
  32721. "\u9FA0",
  32722. "\u3036",
  32723. "\u3012",
  32724. "\u3038",
  32725. "\u5341",
  32726. "\u3039",
  32727. "\u5344",
  32728. "\u303A",
  32729. "\u5345",
  32730. "\u309B",
  32731. "\u0020\u3099",
  32732. "\u309C",
  32733. "\u0020\u309A",
  32734. "\u3131",
  32735. "\u1100",
  32736. "\u3132",
  32737. "\u1101",
  32738. "\u3133",
  32739. "\u11AA",
  32740. "\u3134",
  32741. "\u1102",
  32742. "\u3135",
  32743. "\u11AC",
  32744. "\u3136",
  32745. "\u11AD",
  32746. "\u3137",
  32747. "\u1103",
  32748. "\u3138",
  32749. "\u1104",
  32750. "\u3139",
  32751. "\u1105",
  32752. "\u313A",
  32753. "\u11B0",
  32754. "\u313B",
  32755. "\u11B1",
  32756. "\u313C",
  32757. "\u11B2",
  32758. "\u313D",
  32759. "\u11B3",
  32760. "\u313E",
  32761. "\u11B4",
  32762. "\u313F",
  32763. "\u11B5",
  32764. "\u3140",
  32765. "\u111A",
  32766. "\u3141",
  32767. "\u1106",
  32768. "\u3142",
  32769. "\u1107",
  32770. "\u3143",
  32771. "\u1108",
  32772. "\u3144",
  32773. "\u1121",
  32774. "\u3145",
  32775. "\u1109",
  32776. "\u3146",
  32777. "\u110A",
  32778. "\u3147",
  32779. "\u110B",
  32780. "\u3148",
  32781. "\u110C",
  32782. "\u3149",
  32783. "\u110D",
  32784. "\u314A",
  32785. "\u110E",
  32786. "\u314B",
  32787. "\u110F",
  32788. "\u314C",
  32789. "\u1110",
  32790. "\u314D",
  32791. "\u1111",
  32792. "\u314E",
  32793. "\u1112",
  32794. "\u314F",
  32795. "\u1161",
  32796. "\u3150",
  32797. "\u1162",
  32798. "\u3151",
  32799. "\u1163",
  32800. "\u3152",
  32801. "\u1164",
  32802. "\u3153",
  32803. "\u1165",
  32804. "\u3154",
  32805. "\u1166",
  32806. "\u3155",
  32807. "\u1167",
  32808. "\u3156",
  32809. "\u1168",
  32810. "\u3157",
  32811. "\u1169",
  32812. "\u3158",
  32813. "\u116A",
  32814. "\u3159",
  32815. "\u116B",
  32816. "\u315A",
  32817. "\u116C",
  32818. "\u315B",
  32819. "\u116D",
  32820. "\u315C",
  32821. "\u116E",
  32822. "\u315D",
  32823. "\u116F",
  32824. "\u315E",
  32825. "\u1170",
  32826. "\u315F",
  32827. "\u1171",
  32828. "\u3160",
  32829. "\u1172",
  32830. "\u3161",
  32831. "\u1173",
  32832. "\u3162",
  32833. "\u1174",
  32834. "\u3163",
  32835. "\u1175",
  32836. "\u3164",
  32837. "\u1160",
  32838. "\u3165",
  32839. "\u1114",
  32840. "\u3166",
  32841. "\u1115",
  32842. "\u3167",
  32843. "\u11C7",
  32844. "\u3168",
  32845. "\u11C8",
  32846. "\u3169",
  32847. "\u11CC",
  32848. "\u316A",
  32849. "\u11CE",
  32850. "\u316B",
  32851. "\u11D3",
  32852. "\u316C",
  32853. "\u11D7",
  32854. "\u316D",
  32855. "\u11D9",
  32856. "\u316E",
  32857. "\u111C",
  32858. "\u316F",
  32859. "\u11DD",
  32860. "\u3170",
  32861. "\u11DF",
  32862. "\u3171",
  32863. "\u111D",
  32864. "\u3172",
  32865. "\u111E",
  32866. "\u3173",
  32867. "\u1120",
  32868. "\u3174",
  32869. "\u1122",
  32870. "\u3175",
  32871. "\u1123",
  32872. "\u3176",
  32873. "\u1127",
  32874. "\u3177",
  32875. "\u1129",
  32876. "\u3178",
  32877. "\u112B",
  32878. "\u3179",
  32879. "\u112C",
  32880. "\u317A",
  32881. "\u112D",
  32882. "\u317B",
  32883. "\u112E",
  32884. "\u317C",
  32885. "\u112F",
  32886. "\u317D",
  32887. "\u1132",
  32888. "\u317E",
  32889. "\u1136",
  32890. "\u317F",
  32891. "\u1140",
  32892. "\u3180",
  32893. "\u1147",
  32894. "\u3181",
  32895. "\u114C",
  32896. "\u3182",
  32897. "\u11F1",
  32898. "\u3183",
  32899. "\u11F2",
  32900. "\u3184",
  32901. "\u1157",
  32902. "\u3185",
  32903. "\u1158",
  32904. "\u3186",
  32905. "\u1159",
  32906. "\u3187",
  32907. "\u1184",
  32908. "\u3188",
  32909. "\u1185",
  32910. "\u3189",
  32911. "\u1188",
  32912. "\u318A",
  32913. "\u1191",
  32914. "\u318B",
  32915. "\u1192",
  32916. "\u318C",
  32917. "\u1194",
  32918. "\u318D",
  32919. "\u119E",
  32920. "\u318E",
  32921. "\u11A1",
  32922. "\u3200",
  32923. "\u0028\u1100\u0029",
  32924. "\u3201",
  32925. "\u0028\u1102\u0029",
  32926. "\u3202",
  32927. "\u0028\u1103\u0029",
  32928. "\u3203",
  32929. "\u0028\u1105\u0029",
  32930. "\u3204",
  32931. "\u0028\u1106\u0029",
  32932. "\u3205",
  32933. "\u0028\u1107\u0029",
  32934. "\u3206",
  32935. "\u0028\u1109\u0029",
  32936. "\u3207",
  32937. "\u0028\u110B\u0029",
  32938. "\u3208",
  32939. "\u0028\u110C\u0029",
  32940. "\u3209",
  32941. "\u0028\u110E\u0029",
  32942. "\u320A",
  32943. "\u0028\u110F\u0029",
  32944. "\u320B",
  32945. "\u0028\u1110\u0029",
  32946. "\u320C",
  32947. "\u0028\u1111\u0029",
  32948. "\u320D",
  32949. "\u0028\u1112\u0029",
  32950. "\u320E",
  32951. "\u0028\u1100\u1161\u0029",
  32952. "\u320F",
  32953. "\u0028\u1102\u1161\u0029",
  32954. "\u3210",
  32955. "\u0028\u1103\u1161\u0029",
  32956. "\u3211",
  32957. "\u0028\u1105\u1161\u0029",
  32958. "\u3212",
  32959. "\u0028\u1106\u1161\u0029",
  32960. "\u3213",
  32961. "\u0028\u1107\u1161\u0029",
  32962. "\u3214",
  32963. "\u0028\u1109\u1161\u0029",
  32964. "\u3215",
  32965. "\u0028\u110B\u1161\u0029",
  32966. "\u3216",
  32967. "\u0028\u110C\u1161\u0029",
  32968. "\u3217",
  32969. "\u0028\u110E\u1161\u0029",
  32970. "\u3218",
  32971. "\u0028\u110F\u1161\u0029",
  32972. "\u3219",
  32973. "\u0028\u1110\u1161\u0029",
  32974. "\u321A",
  32975. "\u0028\u1111\u1161\u0029",
  32976. "\u321B",
  32977. "\u0028\u1112\u1161\u0029",
  32978. "\u321C",
  32979. "\u0028\u110C\u116E\u0029",
  32980. "\u321D",
  32981. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  32982. "\u321E",
  32983. "\u0028\u110B\u1169\u1112\u116E\u0029",
  32984. "\u3220",
  32985. "\u0028\u4E00\u0029",
  32986. "\u3221",
  32987. "\u0028\u4E8C\u0029",
  32988. "\u3222",
  32989. "\u0028\u4E09\u0029",
  32990. "\u3223",
  32991. "\u0028\u56DB\u0029",
  32992. "\u3224",
  32993. "\u0028\u4E94\u0029",
  32994. "\u3225",
  32995. "\u0028\u516D\u0029",
  32996. "\u3226",
  32997. "\u0028\u4E03\u0029",
  32998. "\u3227",
  32999. "\u0028\u516B\u0029",
  33000. "\u3228",
  33001. "\u0028\u4E5D\u0029",
  33002. "\u3229",
  33003. "\u0028\u5341\u0029",
  33004. "\u322A",
  33005. "\u0028\u6708\u0029",
  33006. "\u322B",
  33007. "\u0028\u706B\u0029",
  33008. "\u322C",
  33009. "\u0028\u6C34\u0029",
  33010. "\u322D",
  33011. "\u0028\u6728\u0029",
  33012. "\u322E",
  33013. "\u0028\u91D1\u0029",
  33014. "\u322F",
  33015. "\u0028\u571F\u0029",
  33016. "\u3230",
  33017. "\u0028\u65E5\u0029",
  33018. "\u3231",
  33019. "\u0028\u682A\u0029",
  33020. "\u3232",
  33021. "\u0028\u6709\u0029",
  33022. "\u3233",
  33023. "\u0028\u793E\u0029",
  33024. "\u3234",
  33025. "\u0028\u540D\u0029",
  33026. "\u3235",
  33027. "\u0028\u7279\u0029",
  33028. "\u3236",
  33029. "\u0028\u8CA1\u0029",
  33030. "\u3237",
  33031. "\u0028\u795D\u0029",
  33032. "\u3238",
  33033. "\u0028\u52B4\u0029",
  33034. "\u3239",
  33035. "\u0028\u4EE3\u0029",
  33036. "\u323A",
  33037. "\u0028\u547C\u0029",
  33038. "\u323B",
  33039. "\u0028\u5B66\u0029",
  33040. "\u323C",
  33041. "\u0028\u76E3\u0029",
  33042. "\u323D",
  33043. "\u0028\u4F01\u0029",
  33044. "\u323E",
  33045. "\u0028\u8CC7\u0029",
  33046. "\u323F",
  33047. "\u0028\u5354\u0029",
  33048. "\u3240",
  33049. "\u0028\u796D\u0029",
  33050. "\u3241",
  33051. "\u0028\u4F11\u0029",
  33052. "\u3242",
  33053. "\u0028\u81EA\u0029",
  33054. "\u3243",
  33055. "\u0028\u81F3\u0029",
  33056. "\u32C0",
  33057. "\u0031\u6708",
  33058. "\u32C1",
  33059. "\u0032\u6708",
  33060. "\u32C2",
  33061. "\u0033\u6708",
  33062. "\u32C3",
  33063. "\u0034\u6708",
  33064. "\u32C4",
  33065. "\u0035\u6708",
  33066. "\u32C5",
  33067. "\u0036\u6708",
  33068. "\u32C6",
  33069. "\u0037\u6708",
  33070. "\u32C7",
  33071. "\u0038\u6708",
  33072. "\u32C8",
  33073. "\u0039\u6708",
  33074. "\u32C9",
  33075. "\u0031\u0030\u6708",
  33076. "\u32CA",
  33077. "\u0031\u0031\u6708",
  33078. "\u32CB",
  33079. "\u0031\u0032\u6708",
  33080. "\u3358",
  33081. "\u0030\u70B9",
  33082. "\u3359",
  33083. "\u0031\u70B9",
  33084. "\u335A",
  33085. "\u0032\u70B9",
  33086. "\u335B",
  33087. "\u0033\u70B9",
  33088. "\u335C",
  33089. "\u0034\u70B9",
  33090. "\u335D",
  33091. "\u0035\u70B9",
  33092. "\u335E",
  33093. "\u0036\u70B9",
  33094. "\u335F",
  33095. "\u0037\u70B9",
  33096. "\u3360",
  33097. "\u0038\u70B9",
  33098. "\u3361",
  33099. "\u0039\u70B9",
  33100. "\u3362",
  33101. "\u0031\u0030\u70B9",
  33102. "\u3363",
  33103. "\u0031\u0031\u70B9",
  33104. "\u3364",
  33105. "\u0031\u0032\u70B9",
  33106. "\u3365",
  33107. "\u0031\u0033\u70B9",
  33108. "\u3366",
  33109. "\u0031\u0034\u70B9",
  33110. "\u3367",
  33111. "\u0031\u0035\u70B9",
  33112. "\u3368",
  33113. "\u0031\u0036\u70B9",
  33114. "\u3369",
  33115. "\u0031\u0037\u70B9",
  33116. "\u336A",
  33117. "\u0031\u0038\u70B9",
  33118. "\u336B",
  33119. "\u0031\u0039\u70B9",
  33120. "\u336C",
  33121. "\u0032\u0030\u70B9",
  33122. "\u336D",
  33123. "\u0032\u0031\u70B9",
  33124. "\u336E",
  33125. "\u0032\u0032\u70B9",
  33126. "\u336F",
  33127. "\u0032\u0033\u70B9",
  33128. "\u3370",
  33129. "\u0032\u0034\u70B9",
  33130. "\u33E0",
  33131. "\u0031\u65E5",
  33132. "\u33E1",
  33133. "\u0032\u65E5",
  33134. "\u33E2",
  33135. "\u0033\u65E5",
  33136. "\u33E3",
  33137. "\u0034\u65E5",
  33138. "\u33E4",
  33139. "\u0035\u65E5",
  33140. "\u33E5",
  33141. "\u0036\u65E5",
  33142. "\u33E6",
  33143. "\u0037\u65E5",
  33144. "\u33E7",
  33145. "\u0038\u65E5",
  33146. "\u33E8",
  33147. "\u0039\u65E5",
  33148. "\u33E9",
  33149. "\u0031\u0030\u65E5",
  33150. "\u33EA",
  33151. "\u0031\u0031\u65E5",
  33152. "\u33EB",
  33153. "\u0031\u0032\u65E5",
  33154. "\u33EC",
  33155. "\u0031\u0033\u65E5",
  33156. "\u33ED",
  33157. "\u0031\u0034\u65E5",
  33158. "\u33EE",
  33159. "\u0031\u0035\u65E5",
  33160. "\u33EF",
  33161. "\u0031\u0036\u65E5",
  33162. "\u33F0",
  33163. "\u0031\u0037\u65E5",
  33164. "\u33F1",
  33165. "\u0031\u0038\u65E5",
  33166. "\u33F2",
  33167. "\u0031\u0039\u65E5",
  33168. "\u33F3",
  33169. "\u0032\u0030\u65E5",
  33170. "\u33F4",
  33171. "\u0032\u0031\u65E5",
  33172. "\u33F5",
  33173. "\u0032\u0032\u65E5",
  33174. "\u33F6",
  33175. "\u0032\u0033\u65E5",
  33176. "\u33F7",
  33177. "\u0032\u0034\u65E5",
  33178. "\u33F8",
  33179. "\u0032\u0035\u65E5",
  33180. "\u33F9",
  33181. "\u0032\u0036\u65E5",
  33182. "\u33FA",
  33183. "\u0032\u0037\u65E5",
  33184. "\u33FB",
  33185. "\u0032\u0038\u65E5",
  33186. "\u33FC",
  33187. "\u0032\u0039\u65E5",
  33188. "\u33FD",
  33189. "\u0033\u0030\u65E5",
  33190. "\u33FE",
  33191. "\u0033\u0031\u65E5",
  33192. "\uFB00",
  33193. "\u0066\u0066",
  33194. "\uFB01",
  33195. "\u0066\u0069",
  33196. "\uFB02",
  33197. "\u0066\u006C",
  33198. "\uFB03",
  33199. "\u0066\u0066\u0069",
  33200. "\uFB04",
  33201. "\u0066\u0066\u006C",
  33202. "\uFB05",
  33203. "\u017F\u0074",
  33204. "\uFB06",
  33205. "\u0073\u0074",
  33206. "\uFB13",
  33207. "\u0574\u0576",
  33208. "\uFB14",
  33209. "\u0574\u0565",
  33210. "\uFB15",
  33211. "\u0574\u056B",
  33212. "\uFB16",
  33213. "\u057E\u0576",
  33214. "\uFB17",
  33215. "\u0574\u056D",
  33216. "\uFB4F",
  33217. "\u05D0\u05DC",
  33218. "\uFB50",
  33219. "\u0671",
  33220. "\uFB51",
  33221. "\u0671",
  33222. "\uFB52",
  33223. "\u067B",
  33224. "\uFB53",
  33225. "\u067B",
  33226. "\uFB54",
  33227. "\u067B",
  33228. "\uFB55",
  33229. "\u067B",
  33230. "\uFB56",
  33231. "\u067E",
  33232. "\uFB57",
  33233. "\u067E",
  33234. "\uFB58",
  33235. "\u067E",
  33236. "\uFB59",
  33237. "\u067E",
  33238. "\uFB5A",
  33239. "\u0680",
  33240. "\uFB5B",
  33241. "\u0680",
  33242. "\uFB5C",
  33243. "\u0680",
  33244. "\uFB5D",
  33245. "\u0680",
  33246. "\uFB5E",
  33247. "\u067A",
  33248. "\uFB5F",
  33249. "\u067A",
  33250. "\uFB60",
  33251. "\u067A",
  33252. "\uFB61",
  33253. "\u067A",
  33254. "\uFB62",
  33255. "\u067F",
  33256. "\uFB63",
  33257. "\u067F",
  33258. "\uFB64",
  33259. "\u067F",
  33260. "\uFB65",
  33261. "\u067F",
  33262. "\uFB66",
  33263. "\u0679",
  33264. "\uFB67",
  33265. "\u0679",
  33266. "\uFB68",
  33267. "\u0679",
  33268. "\uFB69",
  33269. "\u0679",
  33270. "\uFB6A",
  33271. "\u06A4",
  33272. "\uFB6B",
  33273. "\u06A4",
  33274. "\uFB6C",
  33275. "\u06A4",
  33276. "\uFB6D",
  33277. "\u06A4",
  33278. "\uFB6E",
  33279. "\u06A6",
  33280. "\uFB6F",
  33281. "\u06A6",
  33282. "\uFB70",
  33283. "\u06A6",
  33284. "\uFB71",
  33285. "\u06A6",
  33286. "\uFB72",
  33287. "\u0684",
  33288. "\uFB73",
  33289. "\u0684",
  33290. "\uFB74",
  33291. "\u0684",
  33292. "\uFB75",
  33293. "\u0684",
  33294. "\uFB76",
  33295. "\u0683",
  33296. "\uFB77",
  33297. "\u0683",
  33298. "\uFB78",
  33299. "\u0683",
  33300. "\uFB79",
  33301. "\u0683",
  33302. "\uFB7A",
  33303. "\u0686",
  33304. "\uFB7B",
  33305. "\u0686",
  33306. "\uFB7C",
  33307. "\u0686",
  33308. "\uFB7D",
  33309. "\u0686",
  33310. "\uFB7E",
  33311. "\u0687",
  33312. "\uFB7F",
  33313. "\u0687",
  33314. "\uFB80",
  33315. "\u0687",
  33316. "\uFB81",
  33317. "\u0687",
  33318. "\uFB82",
  33319. "\u068D",
  33320. "\uFB83",
  33321. "\u068D",
  33322. "\uFB84",
  33323. "\u068C",
  33324. "\uFB85",
  33325. "\u068C",
  33326. "\uFB86",
  33327. "\u068E",
  33328. "\uFB87",
  33329. "\u068E",
  33330. "\uFB88",
  33331. "\u0688",
  33332. "\uFB89",
  33333. "\u0688",
  33334. "\uFB8A",
  33335. "\u0698",
  33336. "\uFB8B",
  33337. "\u0698",
  33338. "\uFB8C",
  33339. "\u0691",
  33340. "\uFB8D",
  33341. "\u0691",
  33342. "\uFB8E",
  33343. "\u06A9",
  33344. "\uFB8F",
  33345. "\u06A9",
  33346. "\uFB90",
  33347. "\u06A9",
  33348. "\uFB91",
  33349. "\u06A9",
  33350. "\uFB92",
  33351. "\u06AF",
  33352. "\uFB93",
  33353. "\u06AF",
  33354. "\uFB94",
  33355. "\u06AF",
  33356. "\uFB95",
  33357. "\u06AF",
  33358. "\uFB96",
  33359. "\u06B3",
  33360. "\uFB97",
  33361. "\u06B3",
  33362. "\uFB98",
  33363. "\u06B3",
  33364. "\uFB99",
  33365. "\u06B3",
  33366. "\uFB9A",
  33367. "\u06B1",
  33368. "\uFB9B",
  33369. "\u06B1",
  33370. "\uFB9C",
  33371. "\u06B1",
  33372. "\uFB9D",
  33373. "\u06B1",
  33374. "\uFB9E",
  33375. "\u06BA",
  33376. "\uFB9F",
  33377. "\u06BA",
  33378. "\uFBA0",
  33379. "\u06BB",
  33380. "\uFBA1",
  33381. "\u06BB",
  33382. "\uFBA2",
  33383. "\u06BB",
  33384. "\uFBA3",
  33385. "\u06BB",
  33386. "\uFBA4",
  33387. "\u06C0",
  33388. "\uFBA5",
  33389. "\u06C0",
  33390. "\uFBA6",
  33391. "\u06C1",
  33392. "\uFBA7",
  33393. "\u06C1",
  33394. "\uFBA8",
  33395. "\u06C1",
  33396. "\uFBA9",
  33397. "\u06C1",
  33398. "\uFBAA",
  33399. "\u06BE",
  33400. "\uFBAB",
  33401. "\u06BE",
  33402. "\uFBAC",
  33403. "\u06BE",
  33404. "\uFBAD",
  33405. "\u06BE",
  33406. "\uFBAE",
  33407. "\u06D2",
  33408. "\uFBAF",
  33409. "\u06D2",
  33410. "\uFBB0",
  33411. "\u06D3",
  33412. "\uFBB1",
  33413. "\u06D3",
  33414. "\uFBD3",
  33415. "\u06AD",
  33416. "\uFBD4",
  33417. "\u06AD",
  33418. "\uFBD5",
  33419. "\u06AD",
  33420. "\uFBD6",
  33421. "\u06AD",
  33422. "\uFBD7",
  33423. "\u06C7",
  33424. "\uFBD8",
  33425. "\u06C7",
  33426. "\uFBD9",
  33427. "\u06C6",
  33428. "\uFBDA",
  33429. "\u06C6",
  33430. "\uFBDB",
  33431. "\u06C8",
  33432. "\uFBDC",
  33433. "\u06C8",
  33434. "\uFBDD",
  33435. "\u0677",
  33436. "\uFBDE",
  33437. "\u06CB",
  33438. "\uFBDF",
  33439. "\u06CB",
  33440. "\uFBE0",
  33441. "\u06C5",
  33442. "\uFBE1",
  33443. "\u06C5",
  33444. "\uFBE2",
  33445. "\u06C9",
  33446. "\uFBE3",
  33447. "\u06C9",
  33448. "\uFBE4",
  33449. "\u06D0",
  33450. "\uFBE5",
  33451. "\u06D0",
  33452. "\uFBE6",
  33453. "\u06D0",
  33454. "\uFBE7",
  33455. "\u06D0",
  33456. "\uFBE8",
  33457. "\u0649",
  33458. "\uFBE9",
  33459. "\u0649",
  33460. "\uFBEA",
  33461. "\u0626\u0627",
  33462. "\uFBEB",
  33463. "\u0626\u0627",
  33464. "\uFBEC",
  33465. "\u0626\u06D5",
  33466. "\uFBED",
  33467. "\u0626\u06D5",
  33468. "\uFBEE",
  33469. "\u0626\u0648",
  33470. "\uFBEF",
  33471. "\u0626\u0648",
  33472. "\uFBF0",
  33473. "\u0626\u06C7",
  33474. "\uFBF1",
  33475. "\u0626\u06C7",
  33476. "\uFBF2",
  33477. "\u0626\u06C6",
  33478. "\uFBF3",
  33479. "\u0626\u06C6",
  33480. "\uFBF4",
  33481. "\u0626\u06C8",
  33482. "\uFBF5",
  33483. "\u0626\u06C8",
  33484. "\uFBF6",
  33485. "\u0626\u06D0",
  33486. "\uFBF7",
  33487. "\u0626\u06D0",
  33488. "\uFBF8",
  33489. "\u0626\u06D0",
  33490. "\uFBF9",
  33491. "\u0626\u0649",
  33492. "\uFBFA",
  33493. "\u0626\u0649",
  33494. "\uFBFB",
  33495. "\u0626\u0649",
  33496. "\uFBFC",
  33497. "\u06CC",
  33498. "\uFBFD",
  33499. "\u06CC",
  33500. "\uFBFE",
  33501. "\u06CC",
  33502. "\uFBFF",
  33503. "\u06CC",
  33504. "\uFC00",
  33505. "\u0626\u062C",
  33506. "\uFC01",
  33507. "\u0626\u062D",
  33508. "\uFC02",
  33509. "\u0626\u0645",
  33510. "\uFC03",
  33511. "\u0626\u0649",
  33512. "\uFC04",
  33513. "\u0626\u064A",
  33514. "\uFC05",
  33515. "\u0628\u062C",
  33516. "\uFC06",
  33517. "\u0628\u062D",
  33518. "\uFC07",
  33519. "\u0628\u062E",
  33520. "\uFC08",
  33521. "\u0628\u0645",
  33522. "\uFC09",
  33523. "\u0628\u0649",
  33524. "\uFC0A",
  33525. "\u0628\u064A",
  33526. "\uFC0B",
  33527. "\u062A\u062C",
  33528. "\uFC0C",
  33529. "\u062A\u062D",
  33530. "\uFC0D",
  33531. "\u062A\u062E",
  33532. "\uFC0E",
  33533. "\u062A\u0645",
  33534. "\uFC0F",
  33535. "\u062A\u0649",
  33536. "\uFC10",
  33537. "\u062A\u064A",
  33538. "\uFC11",
  33539. "\u062B\u062C",
  33540. "\uFC12",
  33541. "\u062B\u0645",
  33542. "\uFC13",
  33543. "\u062B\u0649",
  33544. "\uFC14",
  33545. "\u062B\u064A",
  33546. "\uFC15",
  33547. "\u062C\u062D",
  33548. "\uFC16",
  33549. "\u062C\u0645",
  33550. "\uFC17",
  33551. "\u062D\u062C",
  33552. "\uFC18",
  33553. "\u062D\u0645",
  33554. "\uFC19",
  33555. "\u062E\u062C",
  33556. "\uFC1A",
  33557. "\u062E\u062D",
  33558. "\uFC1B",
  33559. "\u062E\u0645",
  33560. "\uFC1C",
  33561. "\u0633\u062C",
  33562. "\uFC1D",
  33563. "\u0633\u062D",
  33564. "\uFC1E",
  33565. "\u0633\u062E",
  33566. "\uFC1F",
  33567. "\u0633\u0645",
  33568. "\uFC20",
  33569. "\u0635\u062D",
  33570. "\uFC21",
  33571. "\u0635\u0645",
  33572. "\uFC22",
  33573. "\u0636\u062C",
  33574. "\uFC23",
  33575. "\u0636\u062D",
  33576. "\uFC24",
  33577. "\u0636\u062E",
  33578. "\uFC25",
  33579. "\u0636\u0645",
  33580. "\uFC26",
  33581. "\u0637\u062D",
  33582. "\uFC27",
  33583. "\u0637\u0645",
  33584. "\uFC28",
  33585. "\u0638\u0645",
  33586. "\uFC29",
  33587. "\u0639\u062C",
  33588. "\uFC2A",
  33589. "\u0639\u0645",
  33590. "\uFC2B",
  33591. "\u063A\u062C",
  33592. "\uFC2C",
  33593. "\u063A\u0645",
  33594. "\uFC2D",
  33595. "\u0641\u062C",
  33596. "\uFC2E",
  33597. "\u0641\u062D",
  33598. "\uFC2F",
  33599. "\u0641\u062E",
  33600. "\uFC30",
  33601. "\u0641\u0645",
  33602. "\uFC31",
  33603. "\u0641\u0649",
  33604. "\uFC32",
  33605. "\u0641\u064A",
  33606. "\uFC33",
  33607. "\u0642\u062D",
  33608. "\uFC34",
  33609. "\u0642\u0645",
  33610. "\uFC35",
  33611. "\u0642\u0649",
  33612. "\uFC36",
  33613. "\u0642\u064A",
  33614. "\uFC37",
  33615. "\u0643\u0627",
  33616. "\uFC38",
  33617. "\u0643\u062C",
  33618. "\uFC39",
  33619. "\u0643\u062D",
  33620. "\uFC3A",
  33621. "\u0643\u062E",
  33622. "\uFC3B",
  33623. "\u0643\u0644",
  33624. "\uFC3C",
  33625. "\u0643\u0645",
  33626. "\uFC3D",
  33627. "\u0643\u0649",
  33628. "\uFC3E",
  33629. "\u0643\u064A",
  33630. "\uFC3F",
  33631. "\u0644\u062C",
  33632. "\uFC40",
  33633. "\u0644\u062D",
  33634. "\uFC41",
  33635. "\u0644\u062E",
  33636. "\uFC42",
  33637. "\u0644\u0645",
  33638. "\uFC43",
  33639. "\u0644\u0649",
  33640. "\uFC44",
  33641. "\u0644\u064A",
  33642. "\uFC45",
  33643. "\u0645\u062C",
  33644. "\uFC46",
  33645. "\u0645\u062D",
  33646. "\uFC47",
  33647. "\u0645\u062E",
  33648. "\uFC48",
  33649. "\u0645\u0645",
  33650. "\uFC49",
  33651. "\u0645\u0649",
  33652. "\uFC4A",
  33653. "\u0645\u064A",
  33654. "\uFC4B",
  33655. "\u0646\u062C",
  33656. "\uFC4C",
  33657. "\u0646\u062D",
  33658. "\uFC4D",
  33659. "\u0646\u062E",
  33660. "\uFC4E",
  33661. "\u0646\u0645",
  33662. "\uFC4F",
  33663. "\u0646\u0649",
  33664. "\uFC50",
  33665. "\u0646\u064A",
  33666. "\uFC51",
  33667. "\u0647\u062C",
  33668. "\uFC52",
  33669. "\u0647\u0645",
  33670. "\uFC53",
  33671. "\u0647\u0649",
  33672. "\uFC54",
  33673. "\u0647\u064A",
  33674. "\uFC55",
  33675. "\u064A\u062C",
  33676. "\uFC56",
  33677. "\u064A\u062D",
  33678. "\uFC57",
  33679. "\u064A\u062E",
  33680. "\uFC58",
  33681. "\u064A\u0645",
  33682. "\uFC59",
  33683. "\u064A\u0649",
  33684. "\uFC5A",
  33685. "\u064A\u064A",
  33686. "\uFC5B",
  33687. "\u0630\u0670",
  33688. "\uFC5C",
  33689. "\u0631\u0670",
  33690. "\uFC5D",
  33691. "\u0649\u0670",
  33692. "\uFC5E",
  33693. "\u0020\u064C\u0651",
  33694. "\uFC5F",
  33695. "\u0020\u064D\u0651",
  33696. "\uFC60",
  33697. "\u0020\u064E\u0651",
  33698. "\uFC61",
  33699. "\u0020\u064F\u0651",
  33700. "\uFC62",
  33701. "\u0020\u0650\u0651",
  33702. "\uFC63",
  33703. "\u0020\u0651\u0670",
  33704. "\uFC64",
  33705. "\u0626\u0631",
  33706. "\uFC65",
  33707. "\u0626\u0632",
  33708. "\uFC66",
  33709. "\u0626\u0645",
  33710. "\uFC67",
  33711. "\u0626\u0646",
  33712. "\uFC68",
  33713. "\u0626\u0649",
  33714. "\uFC69",
  33715. "\u0626\u064A",
  33716. "\uFC6A",
  33717. "\u0628\u0631",
  33718. "\uFC6B",
  33719. "\u0628\u0632",
  33720. "\uFC6C",
  33721. "\u0628\u0645",
  33722. "\uFC6D",
  33723. "\u0628\u0646",
  33724. "\uFC6E",
  33725. "\u0628\u0649",
  33726. "\uFC6F",
  33727. "\u0628\u064A",
  33728. "\uFC70",
  33729. "\u062A\u0631",
  33730. "\uFC71",
  33731. "\u062A\u0632",
  33732. "\uFC72",
  33733. "\u062A\u0645",
  33734. "\uFC73",
  33735. "\u062A\u0646",
  33736. "\uFC74",
  33737. "\u062A\u0649",
  33738. "\uFC75",
  33739. "\u062A\u064A",
  33740. "\uFC76",
  33741. "\u062B\u0631",
  33742. "\uFC77",
  33743. "\u062B\u0632",
  33744. "\uFC78",
  33745. "\u062B\u0645",
  33746. "\uFC79",
  33747. "\u062B\u0646",
  33748. "\uFC7A",
  33749. "\u062B\u0649",
  33750. "\uFC7B",
  33751. "\u062B\u064A",
  33752. "\uFC7C",
  33753. "\u0641\u0649",
  33754. "\uFC7D",
  33755. "\u0641\u064A",
  33756. "\uFC7E",
  33757. "\u0642\u0649",
  33758. "\uFC7F",
  33759. "\u0642\u064A",
  33760. "\uFC80",
  33761. "\u0643\u0627",
  33762. "\uFC81",
  33763. "\u0643\u0644",
  33764. "\uFC82",
  33765. "\u0643\u0645",
  33766. "\uFC83",
  33767. "\u0643\u0649",
  33768. "\uFC84",
  33769. "\u0643\u064A",
  33770. "\uFC85",
  33771. "\u0644\u0645",
  33772. "\uFC86",
  33773. "\u0644\u0649",
  33774. "\uFC87",
  33775. "\u0644\u064A",
  33776. "\uFC88",
  33777. "\u0645\u0627",
  33778. "\uFC89",
  33779. "\u0645\u0645",
  33780. "\uFC8A",
  33781. "\u0646\u0631",
  33782. "\uFC8B",
  33783. "\u0646\u0632",
  33784. "\uFC8C",
  33785. "\u0646\u0645",
  33786. "\uFC8D",
  33787. "\u0646\u0646",
  33788. "\uFC8E",
  33789. "\u0646\u0649",
  33790. "\uFC8F",
  33791. "\u0646\u064A",
  33792. "\uFC90",
  33793. "\u0649\u0670",
  33794. "\uFC91",
  33795. "\u064A\u0631",
  33796. "\uFC92",
  33797. "\u064A\u0632",
  33798. "\uFC93",
  33799. "\u064A\u0645",
  33800. "\uFC94",
  33801. "\u064A\u0646",
  33802. "\uFC95",
  33803. "\u064A\u0649",
  33804. "\uFC96",
  33805. "\u064A\u064A",
  33806. "\uFC97",
  33807. "\u0626\u062C",
  33808. "\uFC98",
  33809. "\u0626\u062D",
  33810. "\uFC99",
  33811. "\u0626\u062E",
  33812. "\uFC9A",
  33813. "\u0626\u0645",
  33814. "\uFC9B",
  33815. "\u0626\u0647",
  33816. "\uFC9C",
  33817. "\u0628\u062C",
  33818. "\uFC9D",
  33819. "\u0628\u062D",
  33820. "\uFC9E",
  33821. "\u0628\u062E",
  33822. "\uFC9F",
  33823. "\u0628\u0645",
  33824. "\uFCA0",
  33825. "\u0628\u0647",
  33826. "\uFCA1",
  33827. "\u062A\u062C",
  33828. "\uFCA2",
  33829. "\u062A\u062D",
  33830. "\uFCA3",
  33831. "\u062A\u062E",
  33832. "\uFCA4",
  33833. "\u062A\u0645",
  33834. "\uFCA5",
  33835. "\u062A\u0647",
  33836. "\uFCA6",
  33837. "\u062B\u0645",
  33838. "\uFCA7",
  33839. "\u062C\u062D",
  33840. "\uFCA8",
  33841. "\u062C\u0645",
  33842. "\uFCA9",
  33843. "\u062D\u062C",
  33844. "\uFCAA",
  33845. "\u062D\u0645",
  33846. "\uFCAB",
  33847. "\u062E\u062C",
  33848. "\uFCAC",
  33849. "\u062E\u0645",
  33850. "\uFCAD",
  33851. "\u0633\u062C",
  33852. "\uFCAE",
  33853. "\u0633\u062D",
  33854. "\uFCAF",
  33855. "\u0633\u062E",
  33856. "\uFCB0",
  33857. "\u0633\u0645",
  33858. "\uFCB1",
  33859. "\u0635\u062D",
  33860. "\uFCB2",
  33861. "\u0635\u062E",
  33862. "\uFCB3",
  33863. "\u0635\u0645",
  33864. "\uFCB4",
  33865. "\u0636\u062C",
  33866. "\uFCB5",
  33867. "\u0636\u062D",
  33868. "\uFCB6",
  33869. "\u0636\u062E",
  33870. "\uFCB7",
  33871. "\u0636\u0645",
  33872. "\uFCB8",
  33873. "\u0637\u062D",
  33874. "\uFCB9",
  33875. "\u0638\u0645",
  33876. "\uFCBA",
  33877. "\u0639\u062C",
  33878. "\uFCBB",
  33879. "\u0639\u0645",
  33880. "\uFCBC",
  33881. "\u063A\u062C",
  33882. "\uFCBD",
  33883. "\u063A\u0645",
  33884. "\uFCBE",
  33885. "\u0641\u062C",
  33886. "\uFCBF",
  33887. "\u0641\u062D",
  33888. "\uFCC0",
  33889. "\u0641\u062E",
  33890. "\uFCC1",
  33891. "\u0641\u0645",
  33892. "\uFCC2",
  33893. "\u0642\u062D",
  33894. "\uFCC3",
  33895. "\u0642\u0645",
  33896. "\uFCC4",
  33897. "\u0643\u062C",
  33898. "\uFCC5",
  33899. "\u0643\u062D",
  33900. "\uFCC6",
  33901. "\u0643\u062E",
  33902. "\uFCC7",
  33903. "\u0643\u0644",
  33904. "\uFCC8",
  33905. "\u0643\u0645",
  33906. "\uFCC9",
  33907. "\u0644\u062C",
  33908. "\uFCCA",
  33909. "\u0644\u062D",
  33910. "\uFCCB",
  33911. "\u0644\u062E",
  33912. "\uFCCC",
  33913. "\u0644\u0645",
  33914. "\uFCCD",
  33915. "\u0644\u0647",
  33916. "\uFCCE",
  33917. "\u0645\u062C",
  33918. "\uFCCF",
  33919. "\u0645\u062D",
  33920. "\uFCD0",
  33921. "\u0645\u062E",
  33922. "\uFCD1",
  33923. "\u0645\u0645",
  33924. "\uFCD2",
  33925. "\u0646\u062C",
  33926. "\uFCD3",
  33927. "\u0646\u062D",
  33928. "\uFCD4",
  33929. "\u0646\u062E",
  33930. "\uFCD5",
  33931. "\u0646\u0645",
  33932. "\uFCD6",
  33933. "\u0646\u0647",
  33934. "\uFCD7",
  33935. "\u0647\u062C",
  33936. "\uFCD8",
  33937. "\u0647\u0645",
  33938. "\uFCD9",
  33939. "\u0647\u0670",
  33940. "\uFCDA",
  33941. "\u064A\u062C",
  33942. "\uFCDB",
  33943. "\u064A\u062D",
  33944. "\uFCDC",
  33945. "\u064A\u062E",
  33946. "\uFCDD",
  33947. "\u064A\u0645",
  33948. "\uFCDE",
  33949. "\u064A\u0647",
  33950. "\uFCDF",
  33951. "\u0626\u0645",
  33952. "\uFCE0",
  33953. "\u0626\u0647",
  33954. "\uFCE1",
  33955. "\u0628\u0645",
  33956. "\uFCE2",
  33957. "\u0628\u0647",
  33958. "\uFCE3",
  33959. "\u062A\u0645",
  33960. "\uFCE4",
  33961. "\u062A\u0647",
  33962. "\uFCE5",
  33963. "\u062B\u0645",
  33964. "\uFCE6",
  33965. "\u062B\u0647",
  33966. "\uFCE7",
  33967. "\u0633\u0645",
  33968. "\uFCE8",
  33969. "\u0633\u0647",
  33970. "\uFCE9",
  33971. "\u0634\u0645",
  33972. "\uFCEA",
  33973. "\u0634\u0647",
  33974. "\uFCEB",
  33975. "\u0643\u0644",
  33976. "\uFCEC",
  33977. "\u0643\u0645",
  33978. "\uFCED",
  33979. "\u0644\u0645",
  33980. "\uFCEE",
  33981. "\u0646\u0645",
  33982. "\uFCEF",
  33983. "\u0646\u0647",
  33984. "\uFCF0",
  33985. "\u064A\u0645",
  33986. "\uFCF1",
  33987. "\u064A\u0647",
  33988. "\uFCF2",
  33989. "\u0640\u064E\u0651",
  33990. "\uFCF3",
  33991. "\u0640\u064F\u0651",
  33992. "\uFCF4",
  33993. "\u0640\u0650\u0651",
  33994. "\uFCF5",
  33995. "\u0637\u0649",
  33996. "\uFCF6",
  33997. "\u0637\u064A",
  33998. "\uFCF7",
  33999. "\u0639\u0649",
  34000. "\uFCF8",
  34001. "\u0639\u064A",
  34002. "\uFCF9",
  34003. "\u063A\u0649",
  34004. "\uFCFA",
  34005. "\u063A\u064A",
  34006. "\uFCFB",
  34007. "\u0633\u0649",
  34008. "\uFCFC",
  34009. "\u0633\u064A",
  34010. "\uFCFD",
  34011. "\u0634\u0649",
  34012. "\uFCFE",
  34013. "\u0634\u064A",
  34014. "\uFCFF",
  34015. "\u062D\u0649",
  34016. "\uFD00",
  34017. "\u062D\u064A",
  34018. "\uFD01",
  34019. "\u062C\u0649",
  34020. "\uFD02",
  34021. "\u062C\u064A",
  34022. "\uFD03",
  34023. "\u062E\u0649",
  34024. "\uFD04",
  34025. "\u062E\u064A",
  34026. "\uFD05",
  34027. "\u0635\u0649",
  34028. "\uFD06",
  34029. "\u0635\u064A",
  34030. "\uFD07",
  34031. "\u0636\u0649",
  34032. "\uFD08",
  34033. "\u0636\u064A",
  34034. "\uFD09",
  34035. "\u0634\u062C",
  34036. "\uFD0A",
  34037. "\u0634\u062D",
  34038. "\uFD0B",
  34039. "\u0634\u062E",
  34040. "\uFD0C",
  34041. "\u0634\u0645",
  34042. "\uFD0D",
  34043. "\u0634\u0631",
  34044. "\uFD0E",
  34045. "\u0633\u0631",
  34046. "\uFD0F",
  34047. "\u0635\u0631",
  34048. "\uFD10",
  34049. "\u0636\u0631",
  34050. "\uFD11",
  34051. "\u0637\u0649",
  34052. "\uFD12",
  34053. "\u0637\u064A",
  34054. "\uFD13",
  34055. "\u0639\u0649",
  34056. "\uFD14",
  34057. "\u0639\u064A",
  34058. "\uFD15",
  34059. "\u063A\u0649",
  34060. "\uFD16",
  34061. "\u063A\u064A",
  34062. "\uFD17",
  34063. "\u0633\u0649",
  34064. "\uFD18",
  34065. "\u0633\u064A",
  34066. "\uFD19",
  34067. "\u0634\u0649",
  34068. "\uFD1A",
  34069. "\u0634\u064A",
  34070. "\uFD1B",
  34071. "\u062D\u0649",
  34072. "\uFD1C",
  34073. "\u062D\u064A",
  34074. "\uFD1D",
  34075. "\u062C\u0649",
  34076. "\uFD1E",
  34077. "\u062C\u064A",
  34078. "\uFD1F",
  34079. "\u062E\u0649",
  34080. "\uFD20",
  34081. "\u062E\u064A",
  34082. "\uFD21",
  34083. "\u0635\u0649",
  34084. "\uFD22",
  34085. "\u0635\u064A",
  34086. "\uFD23",
  34087. "\u0636\u0649",
  34088. "\uFD24",
  34089. "\u0636\u064A",
  34090. "\uFD25",
  34091. "\u0634\u062C",
  34092. "\uFD26",
  34093. "\u0634\u062D",
  34094. "\uFD27",
  34095. "\u0634\u062E",
  34096. "\uFD28",
  34097. "\u0634\u0645",
  34098. "\uFD29",
  34099. "\u0634\u0631",
  34100. "\uFD2A",
  34101. "\u0633\u0631",
  34102. "\uFD2B",
  34103. "\u0635\u0631",
  34104. "\uFD2C",
  34105. "\u0636\u0631",
  34106. "\uFD2D",
  34107. "\u0634\u062C",
  34108. "\uFD2E",
  34109. "\u0634\u062D",
  34110. "\uFD2F",
  34111. "\u0634\u062E",
  34112. "\uFD30",
  34113. "\u0634\u0645",
  34114. "\uFD31",
  34115. "\u0633\u0647",
  34116. "\uFD32",
  34117. "\u0634\u0647",
  34118. "\uFD33",
  34119. "\u0637\u0645",
  34120. "\uFD34",
  34121. "\u0633\u062C",
  34122. "\uFD35",
  34123. "\u0633\u062D",
  34124. "\uFD36",
  34125. "\u0633\u062E",
  34126. "\uFD37",
  34127. "\u0634\u062C",
  34128. "\uFD38",
  34129. "\u0634\u062D",
  34130. "\uFD39",
  34131. "\u0634\u062E",
  34132. "\uFD3A",
  34133. "\u0637\u0645",
  34134. "\uFD3B",
  34135. "\u0638\u0645",
  34136. "\uFD3C",
  34137. "\u0627\u064B",
  34138. "\uFD3D",
  34139. "\u0627\u064B",
  34140. "\uFD50",
  34141. "\u062A\u062C\u0645",
  34142. "\uFD51",
  34143. "\u062A\u062D\u062C",
  34144. "\uFD52",
  34145. "\u062A\u062D\u062C",
  34146. "\uFD53",
  34147. "\u062A\u062D\u0645",
  34148. "\uFD54",
  34149. "\u062A\u062E\u0645",
  34150. "\uFD55",
  34151. "\u062A\u0645\u062C",
  34152. "\uFD56",
  34153. "\u062A\u0645\u062D",
  34154. "\uFD57",
  34155. "\u062A\u0645\u062E",
  34156. "\uFD58",
  34157. "\u062C\u0645\u062D",
  34158. "\uFD59",
  34159. "\u062C\u0645\u062D",
  34160. "\uFD5A",
  34161. "\u062D\u0645\u064A",
  34162. "\uFD5B",
  34163. "\u062D\u0645\u0649",
  34164. "\uFD5C",
  34165. "\u0633\u062D\u062C",
  34166. "\uFD5D",
  34167. "\u0633\u062C\u062D",
  34168. "\uFD5E",
  34169. "\u0633\u062C\u0649",
  34170. "\uFD5F",
  34171. "\u0633\u0645\u062D",
  34172. "\uFD60",
  34173. "\u0633\u0645\u062D",
  34174. "\uFD61",
  34175. "\u0633\u0645\u062C",
  34176. "\uFD62",
  34177. "\u0633\u0645\u0645",
  34178. "\uFD63",
  34179. "\u0633\u0645\u0645",
  34180. "\uFD64",
  34181. "\u0635\u062D\u062D",
  34182. "\uFD65",
  34183. "\u0635\u062D\u062D",
  34184. "\uFD66",
  34185. "\u0635\u0645\u0645",
  34186. "\uFD67",
  34187. "\u0634\u062D\u0645",
  34188. "\uFD68",
  34189. "\u0634\u062D\u0645",
  34190. "\uFD69",
  34191. "\u0634\u062C\u064A",
  34192. "\uFD6A",
  34193. "\u0634\u0645\u062E",
  34194. "\uFD6B",
  34195. "\u0634\u0645\u062E",
  34196. "\uFD6C",
  34197. "\u0634\u0645\u0645",
  34198. "\uFD6D",
  34199. "\u0634\u0645\u0645",
  34200. "\uFD6E",
  34201. "\u0636\u062D\u0649",
  34202. "\uFD6F",
  34203. "\u0636\u062E\u0645",
  34204. "\uFD70",
  34205. "\u0636\u062E\u0645",
  34206. "\uFD71",
  34207. "\u0637\u0645\u062D",
  34208. "\uFD72",
  34209. "\u0637\u0645\u062D",
  34210. "\uFD73",
  34211. "\u0637\u0645\u0645",
  34212. "\uFD74",
  34213. "\u0637\u0645\u064A",
  34214. "\uFD75",
  34215. "\u0639\u062C\u0645",
  34216. "\uFD76",
  34217. "\u0639\u0645\u0645",
  34218. "\uFD77",
  34219. "\u0639\u0645\u0645",
  34220. "\uFD78",
  34221. "\u0639\u0645\u0649",
  34222. "\uFD79",
  34223. "\u063A\u0645\u0645",
  34224. "\uFD7A",
  34225. "\u063A\u0645\u064A",
  34226. "\uFD7B",
  34227. "\u063A\u0645\u0649",
  34228. "\uFD7C",
  34229. "\u0641\u062E\u0645",
  34230. "\uFD7D",
  34231. "\u0641\u062E\u0645",
  34232. "\uFD7E",
  34233. "\u0642\u0645\u062D",
  34234. "\uFD7F",
  34235. "\u0642\u0645\u0645",
  34236. "\uFD80",
  34237. "\u0644\u062D\u0645",
  34238. "\uFD81",
  34239. "\u0644\u062D\u064A",
  34240. "\uFD82",
  34241. "\u0644\u062D\u0649",
  34242. "\uFD83",
  34243. "\u0644\u062C\u062C",
  34244. "\uFD84",
  34245. "\u0644\u062C\u062C",
  34246. "\uFD85",
  34247. "\u0644\u062E\u0645",
  34248. "\uFD86",
  34249. "\u0644\u062E\u0645",
  34250. "\uFD87",
  34251. "\u0644\u0645\u062D",
  34252. "\uFD88",
  34253. "\u0644\u0645\u062D",
  34254. "\uFD89",
  34255. "\u0645\u062D\u062C",
  34256. "\uFD8A",
  34257. "\u0645\u062D\u0645",
  34258. "\uFD8B",
  34259. "\u0645\u062D\u064A",
  34260. "\uFD8C",
  34261. "\u0645\u062C\u062D",
  34262. "\uFD8D",
  34263. "\u0645\u062C\u0645",
  34264. "\uFD8E",
  34265. "\u0645\u062E\u062C",
  34266. "\uFD8F",
  34267. "\u0645\u062E\u0645",
  34268. "\uFD92",
  34269. "\u0645\u062C\u062E",
  34270. "\uFD93",
  34271. "\u0647\u0645\u062C",
  34272. "\uFD94",
  34273. "\u0647\u0645\u0645",
  34274. "\uFD95",
  34275. "\u0646\u062D\u0645",
  34276. "\uFD96",
  34277. "\u0646\u062D\u0649",
  34278. "\uFD97",
  34279. "\u0646\u062C\u0645",
  34280. "\uFD98",
  34281. "\u0646\u062C\u0645",
  34282. "\uFD99",
  34283. "\u0646\u062C\u0649",
  34284. "\uFD9A",
  34285. "\u0646\u0645\u064A",
  34286. "\uFD9B",
  34287. "\u0646\u0645\u0649",
  34288. "\uFD9C",
  34289. "\u064A\u0645\u0645",
  34290. "\uFD9D",
  34291. "\u064A\u0645\u0645",
  34292. "\uFD9E",
  34293. "\u0628\u062E\u064A",
  34294. "\uFD9F",
  34295. "\u062A\u062C\u064A",
  34296. "\uFDA0",
  34297. "\u062A\u062C\u0649",
  34298. "\uFDA1",
  34299. "\u062A\u062E\u064A",
  34300. "\uFDA2",
  34301. "\u062A\u062E\u0649",
  34302. "\uFDA3",
  34303. "\u062A\u0645\u064A",
  34304. "\uFDA4",
  34305. "\u062A\u0645\u0649",
  34306. "\uFDA5",
  34307. "\u062C\u0645\u064A",
  34308. "\uFDA6",
  34309. "\u062C\u062D\u0649",
  34310. "\uFDA7",
  34311. "\u062C\u0645\u0649",
  34312. "\uFDA8",
  34313. "\u0633\u062E\u0649",
  34314. "\uFDA9",
  34315. "\u0635\u062D\u064A",
  34316. "\uFDAA",
  34317. "\u0634\u062D\u064A",
  34318. "\uFDAB",
  34319. "\u0636\u062D\u064A",
  34320. "\uFDAC",
  34321. "\u0644\u062C\u064A",
  34322. "\uFDAD",
  34323. "\u0644\u0645\u064A",
  34324. "\uFDAE",
  34325. "\u064A\u062D\u064A",
  34326. "\uFDAF",
  34327. "\u064A\u062C\u064A",
  34328. "\uFDB0",
  34329. "\u064A\u0645\u064A",
  34330. "\uFDB1",
  34331. "\u0645\u0645\u064A",
  34332. "\uFDB2",
  34333. "\u0642\u0645\u064A",
  34334. "\uFDB3",
  34335. "\u0646\u062D\u064A",
  34336. "\uFDB4",
  34337. "\u0642\u0645\u062D",
  34338. "\uFDB5",
  34339. "\u0644\u062D\u0645",
  34340. "\uFDB6",
  34341. "\u0639\u0645\u064A",
  34342. "\uFDB7",
  34343. "\u0643\u0645\u064A",
  34344. "\uFDB8",
  34345. "\u0646\u062C\u062D",
  34346. "\uFDB9",
  34347. "\u0645\u062E\u064A",
  34348. "\uFDBA",
  34349. "\u0644\u062C\u0645",
  34350. "\uFDBB",
  34351. "\u0643\u0645\u0645",
  34352. "\uFDBC",
  34353. "\u0644\u062C\u0645",
  34354. "\uFDBD",
  34355. "\u0646\u062C\u062D",
  34356. "\uFDBE",
  34357. "\u062C\u062D\u064A",
  34358. "\uFDBF",
  34359. "\u062D\u062C\u064A",
  34360. "\uFDC0",
  34361. "\u0645\u062C\u064A",
  34362. "\uFDC1",
  34363. "\u0641\u0645\u064A",
  34364. "\uFDC2",
  34365. "\u0628\u062D\u064A",
  34366. "\uFDC3",
  34367. "\u0643\u0645\u0645",
  34368. "\uFDC4",
  34369. "\u0639\u062C\u0645",
  34370. "\uFDC5",
  34371. "\u0635\u0645\u0645",
  34372. "\uFDC6",
  34373. "\u0633\u062E\u064A",
  34374. "\uFDC7",
  34375. "\u0646\u062C\u064A",
  34376. "\uFE49",
  34377. "\u203E",
  34378. "\uFE4A",
  34379. "\u203E",
  34380. "\uFE4B",
  34381. "\u203E",
  34382. "\uFE4C",
  34383. "\u203E",
  34384. "\uFE4D",
  34385. "\u005F",
  34386. "\uFE4E",
  34387. "\u005F",
  34388. "\uFE4F",
  34389. "\u005F",
  34390. "\uFE80",
  34391. "\u0621",
  34392. "\uFE81",
  34393. "\u0622",
  34394. "\uFE82",
  34395. "\u0622",
  34396. "\uFE83",
  34397. "\u0623",
  34398. "\uFE84",
  34399. "\u0623",
  34400. "\uFE85",
  34401. "\u0624",
  34402. "\uFE86",
  34403. "\u0624",
  34404. "\uFE87",
  34405. "\u0625",
  34406. "\uFE88",
  34407. "\u0625",
  34408. "\uFE89",
  34409. "\u0626",
  34410. "\uFE8A",
  34411. "\u0626",
  34412. "\uFE8B",
  34413. "\u0626",
  34414. "\uFE8C",
  34415. "\u0626",
  34416. "\uFE8D",
  34417. "\u0627",
  34418. "\uFE8E",
  34419. "\u0627",
  34420. "\uFE8F",
  34421. "\u0628",
  34422. "\uFE90",
  34423. "\u0628",
  34424. "\uFE91",
  34425. "\u0628",
  34426. "\uFE92",
  34427. "\u0628",
  34428. "\uFE93",
  34429. "\u0629",
  34430. "\uFE94",
  34431. "\u0629",
  34432. "\uFE95",
  34433. "\u062A",
  34434. "\uFE96",
  34435. "\u062A",
  34436. "\uFE97",
  34437. "\u062A",
  34438. "\uFE98",
  34439. "\u062A",
  34440. "\uFE99",
  34441. "\u062B",
  34442. "\uFE9A",
  34443. "\u062B",
  34444. "\uFE9B",
  34445. "\u062B",
  34446. "\uFE9C",
  34447. "\u062B",
  34448. "\uFE9D",
  34449. "\u062C",
  34450. "\uFE9E",
  34451. "\u062C",
  34452. "\uFE9F",
  34453. "\u062C",
  34454. "\uFEA0",
  34455. "\u062C",
  34456. "\uFEA1",
  34457. "\u062D",
  34458. "\uFEA2",
  34459. "\u062D",
  34460. "\uFEA3",
  34461. "\u062D",
  34462. "\uFEA4",
  34463. "\u062D",
  34464. "\uFEA5",
  34465. "\u062E",
  34466. "\uFEA6",
  34467. "\u062E",
  34468. "\uFEA7",
  34469. "\u062E",
  34470. "\uFEA8",
  34471. "\u062E",
  34472. "\uFEA9",
  34473. "\u062F",
  34474. "\uFEAA",
  34475. "\u062F",
  34476. "\uFEAB",
  34477. "\u0630",
  34478. "\uFEAC",
  34479. "\u0630",
  34480. "\uFEAD",
  34481. "\u0631",
  34482. "\uFEAE",
  34483. "\u0631",
  34484. "\uFEAF",
  34485. "\u0632",
  34486. "\uFEB0",
  34487. "\u0632",
  34488. "\uFEB1",
  34489. "\u0633",
  34490. "\uFEB2",
  34491. "\u0633",
  34492. "\uFEB3",
  34493. "\u0633",
  34494. "\uFEB4",
  34495. "\u0633",
  34496. "\uFEB5",
  34497. "\u0634",
  34498. "\uFEB6",
  34499. "\u0634",
  34500. "\uFEB7",
  34501. "\u0634",
  34502. "\uFEB8",
  34503. "\u0634",
  34504. "\uFEB9",
  34505. "\u0635",
  34506. "\uFEBA",
  34507. "\u0635",
  34508. "\uFEBB",
  34509. "\u0635",
  34510. "\uFEBC",
  34511. "\u0635",
  34512. "\uFEBD",
  34513. "\u0636",
  34514. "\uFEBE",
  34515. "\u0636",
  34516. "\uFEBF",
  34517. "\u0636",
  34518. "\uFEC0",
  34519. "\u0636",
  34520. "\uFEC1",
  34521. "\u0637",
  34522. "\uFEC2",
  34523. "\u0637",
  34524. "\uFEC3",
  34525. "\u0637",
  34526. "\uFEC4",
  34527. "\u0637",
  34528. "\uFEC5",
  34529. "\u0638",
  34530. "\uFEC6",
  34531. "\u0638",
  34532. "\uFEC7",
  34533. "\u0638",
  34534. "\uFEC8",
  34535. "\u0638",
  34536. "\uFEC9",
  34537. "\u0639",
  34538. "\uFECA",
  34539. "\u0639",
  34540. "\uFECB",
  34541. "\u0639",
  34542. "\uFECC",
  34543. "\u0639",
  34544. "\uFECD",
  34545. "\u063A",
  34546. "\uFECE",
  34547. "\u063A",
  34548. "\uFECF",
  34549. "\u063A",
  34550. "\uFED0",
  34551. "\u063A",
  34552. "\uFED1",
  34553. "\u0641",
  34554. "\uFED2",
  34555. "\u0641",
  34556. "\uFED3",
  34557. "\u0641",
  34558. "\uFED4",
  34559. "\u0641",
  34560. "\uFED5",
  34561. "\u0642",
  34562. "\uFED6",
  34563. "\u0642",
  34564. "\uFED7",
  34565. "\u0642",
  34566. "\uFED8",
  34567. "\u0642",
  34568. "\uFED9",
  34569. "\u0643",
  34570. "\uFEDA",
  34571. "\u0643",
  34572. "\uFEDB",
  34573. "\u0643",
  34574. "\uFEDC",
  34575. "\u0643",
  34576. "\uFEDD",
  34577. "\u0644",
  34578. "\uFEDE",
  34579. "\u0644",
  34580. "\uFEDF",
  34581. "\u0644",
  34582. "\uFEE0",
  34583. "\u0644",
  34584. "\uFEE1",
  34585. "\u0645",
  34586. "\uFEE2",
  34587. "\u0645",
  34588. "\uFEE3",
  34589. "\u0645",
  34590. "\uFEE4",
  34591. "\u0645",
  34592. "\uFEE5",
  34593. "\u0646",
  34594. "\uFEE6",
  34595. "\u0646",
  34596. "\uFEE7",
  34597. "\u0646",
  34598. "\uFEE8",
  34599. "\u0646",
  34600. "\uFEE9",
  34601. "\u0647",
  34602. "\uFEEA",
  34603. "\u0647",
  34604. "\uFEEB",
  34605. "\u0647",
  34606. "\uFEEC",
  34607. "\u0647",
  34608. "\uFEED",
  34609. "\u0648",
  34610. "\uFEEE",
  34611. "\u0648",
  34612. "\uFEEF",
  34613. "\u0649",
  34614. "\uFEF0",
  34615. "\u0649",
  34616. "\uFEF1",
  34617. "\u064A",
  34618. "\uFEF2",
  34619. "\u064A",
  34620. "\uFEF3",
  34621. "\u064A",
  34622. "\uFEF4",
  34623. "\u064A",
  34624. "\uFEF5",
  34625. "\u0644\u0622",
  34626. "\uFEF6",
  34627. "\u0644\u0622",
  34628. "\uFEF7",
  34629. "\u0644\u0623",
  34630. "\uFEF8",
  34631. "\u0644\u0623",
  34632. "\uFEF9",
  34633. "\u0644\u0625",
  34634. "\uFEFA",
  34635. "\u0644\u0625",
  34636. "\uFEFB",
  34637. "\u0644\u0627",
  34638. "\uFEFC",
  34639. "\u0644\u0627"
  34640. ];
  34641. });
  34642. function reverseIfRtl(chars) {
  34643. const charsLength = chars.length;
  34644. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  34645. return chars;
  34646. }
  34647. const buf = [];
  34648. for (let ii = charsLength - 1; ii >= 0; ii--) {
  34649. buf.push(chars[ii]);
  34650. }
  34651. return buf.join("");
  34652. }
  34653. /***/ }),
  34654. /* 41 */
  34655. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34656. Object.defineProperty(exports, "__esModule", ({
  34657. value: true
  34658. }));
  34659. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = void 0;
  34660. var _core_utils = __w_pdfjs_require__(9);
  34661. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  34662. t.ArialNarrow = "Helvetica";
  34663. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  34664. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  34665. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  34666. t.ArialBlack = "Helvetica";
  34667. t["ArialBlack-Bold"] = "Helvetica-Bold";
  34668. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  34669. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  34670. t["Arial-Black"] = "Helvetica";
  34671. t["Arial-Black-Bold"] = "Helvetica-Bold";
  34672. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  34673. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  34674. t.Arial = "Helvetica";
  34675. t["Arial-Bold"] = "Helvetica-Bold";
  34676. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  34677. t["Arial-Italic"] = "Helvetica-Oblique";
  34678. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  34679. t["Arial-BoldMT"] = "Helvetica-Bold";
  34680. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  34681. t.ArialMT = "Helvetica";
  34682. t["Courier-Bold"] = "Courier-Bold";
  34683. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  34684. t["Courier-Italic"] = "Courier-Oblique";
  34685. t.CourierNew = "Courier";
  34686. t["CourierNew-Bold"] = "Courier-Bold";
  34687. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  34688. t["CourierNew-Italic"] = "Courier-Oblique";
  34689. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  34690. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  34691. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  34692. t.CourierNewPSMT = "Courier";
  34693. t.Helvetica = "Helvetica";
  34694. t["Helvetica-Bold"] = "Helvetica-Bold";
  34695. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  34696. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  34697. t["Helvetica-Italic"] = "Helvetica-Oblique";
  34698. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  34699. t["Symbol-Bold"] = "Symbol";
  34700. t["Symbol-BoldItalic"] = "Symbol";
  34701. t["Symbol-Italic"] = "Symbol";
  34702. t.TimesNewRoman = "Times-Roman";
  34703. t["TimesNewRoman-Bold"] = "Times-Bold";
  34704. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  34705. t["TimesNewRoman-Italic"] = "Times-Italic";
  34706. t.TimesNewRomanPS = "Times-Roman";
  34707. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  34708. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  34709. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  34710. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  34711. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  34712. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  34713. t.TimesNewRomanPSMT = "Times-Roman";
  34714. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  34715. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  34716. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  34717. });
  34718. exports.getStdFontMap = getStdFontMap;
  34719. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  34720. t.Calibri = "Helvetica";
  34721. t["Calibri-Bold"] = "Helvetica-Bold";
  34722. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  34723. t["Calibri-Italic"] = "Helvetica-Oblique";
  34724. t.CenturyGothic = "Helvetica";
  34725. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  34726. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  34727. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  34728. t.ComicSansMS = "Comic Sans MS";
  34729. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  34730. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  34731. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  34732. t.LucidaConsole = "Courier";
  34733. t["LucidaConsole-Bold"] = "Courier-Bold";
  34734. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  34735. t["LucidaConsole-Italic"] = "Courier-Oblique";
  34736. t["LucidaSans-Demi"] = "Helvetica-Bold";
  34737. t["MS-Gothic"] = "MS Gothic";
  34738. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  34739. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  34740. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  34741. t["MS-Mincho"] = "MS Mincho";
  34742. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  34743. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  34744. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  34745. t["MS-PGothic"] = "MS PGothic";
  34746. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  34747. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  34748. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  34749. t["MS-PMincho"] = "MS PMincho";
  34750. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  34751. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  34752. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  34753. t.NuptialScript = "Times-Italic";
  34754. t.SegoeUISymbol = "Helvetica";
  34755. t.Wingdings = "ZapfDingbats";
  34756. t["Wingdings-Regular"] = "ZapfDingbats";
  34757. });
  34758. exports.getNonStdFontMap = getNonStdFontMap;
  34759. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  34760. t["Adobe Jenson"] = true;
  34761. t["Adobe Text"] = true;
  34762. t.Albertus = true;
  34763. t.Aldus = true;
  34764. t.Alexandria = true;
  34765. t.Algerian = true;
  34766. t["American Typewriter"] = true;
  34767. t.Antiqua = true;
  34768. t.Apex = true;
  34769. t.Arno = true;
  34770. t.Aster = true;
  34771. t.Aurora = true;
  34772. t.Baskerville = true;
  34773. t.Bell = true;
  34774. t.Bembo = true;
  34775. t["Bembo Schoolbook"] = true;
  34776. t.Benguiat = true;
  34777. t["Berkeley Old Style"] = true;
  34778. t["Bernhard Modern"] = true;
  34779. t["Berthold City"] = true;
  34780. t.Bodoni = true;
  34781. t["Bauer Bodoni"] = true;
  34782. t["Book Antiqua"] = true;
  34783. t.Bookman = true;
  34784. t["Bordeaux Roman"] = true;
  34785. t["Californian FB"] = true;
  34786. t.Calisto = true;
  34787. t.Calvert = true;
  34788. t.Capitals = true;
  34789. t.Cambria = true;
  34790. t.Cartier = true;
  34791. t.Caslon = true;
  34792. t.Catull = true;
  34793. t.Centaur = true;
  34794. t["Century Old Style"] = true;
  34795. t["Century Schoolbook"] = true;
  34796. t.Chaparral = true;
  34797. t["Charis SIL"] = true;
  34798. t.Cheltenham = true;
  34799. t["Cholla Slab"] = true;
  34800. t.Clarendon = true;
  34801. t.Clearface = true;
  34802. t.Cochin = true;
  34803. t.Colonna = true;
  34804. t["Computer Modern"] = true;
  34805. t["Concrete Roman"] = true;
  34806. t.Constantia = true;
  34807. t["Cooper Black"] = true;
  34808. t.Corona = true;
  34809. t.Ecotype = true;
  34810. t.Egyptienne = true;
  34811. t.Elephant = true;
  34812. t.Excelsior = true;
  34813. t.Fairfield = true;
  34814. t["FF Scala"] = true;
  34815. t.Folkard = true;
  34816. t.Footlight = true;
  34817. t.FreeSerif = true;
  34818. t["Friz Quadrata"] = true;
  34819. t.Garamond = true;
  34820. t.Gentium = true;
  34821. t.Georgia = true;
  34822. t.Gloucester = true;
  34823. t["Goudy Old Style"] = true;
  34824. t["Goudy Schoolbook"] = true;
  34825. t["Goudy Pro Font"] = true;
  34826. t.Granjon = true;
  34827. t["Guardian Egyptian"] = true;
  34828. t.Heather = true;
  34829. t.Hercules = true;
  34830. t["High Tower Text"] = true;
  34831. t.Hiroshige = true;
  34832. t["Hoefler Text"] = true;
  34833. t["Humana Serif"] = true;
  34834. t.Imprint = true;
  34835. t["Ionic No. 5"] = true;
  34836. t.Janson = true;
  34837. t.Joanna = true;
  34838. t.Korinna = true;
  34839. t.Lexicon = true;
  34840. t["Liberation Serif"] = true;
  34841. t["Linux Libertine"] = true;
  34842. t.Literaturnaya = true;
  34843. t.Lucida = true;
  34844. t["Lucida Bright"] = true;
  34845. t.Melior = true;
  34846. t.Memphis = true;
  34847. t.Miller = true;
  34848. t.Minion = true;
  34849. t.Modern = true;
  34850. t["Mona Lisa"] = true;
  34851. t["Mrs Eaves"] = true;
  34852. t["MS Serif"] = true;
  34853. t["Museo Slab"] = true;
  34854. t["New York"] = true;
  34855. t["Nimbus Roman"] = true;
  34856. t["NPS Rawlinson Roadway"] = true;
  34857. t.NuptialScript = true;
  34858. t.Palatino = true;
  34859. t.Perpetua = true;
  34860. t.Plantin = true;
  34861. t["Plantin Schoolbook"] = true;
  34862. t.Playbill = true;
  34863. t["Poor Richard"] = true;
  34864. t["Rawlinson Roadway"] = true;
  34865. t.Renault = true;
  34866. t.Requiem = true;
  34867. t.Rockwell = true;
  34868. t.Roman = true;
  34869. t["Rotis Serif"] = true;
  34870. t.Sabon = true;
  34871. t.Scala = true;
  34872. t.Seagull = true;
  34873. t.Sistina = true;
  34874. t.Souvenir = true;
  34875. t.STIX = true;
  34876. t["Stone Informal"] = true;
  34877. t["Stone Serif"] = true;
  34878. t.Sylfaen = true;
  34879. t.Times = true;
  34880. t.Trajan = true;
  34881. t["Trinité"] = true;
  34882. t["Trump Mediaeval"] = true;
  34883. t.Utopia = true;
  34884. t["Vale Type"] = true;
  34885. t["Bitstream Vera"] = true;
  34886. t["Vera Serif"] = true;
  34887. t.Versailles = true;
  34888. t.Wanted = true;
  34889. t.Weiss = true;
  34890. t["Wide Latin"] = true;
  34891. t.Windsor = true;
  34892. t.XITS = true;
  34893. });
  34894. exports.getSerifFonts = getSerifFonts;
  34895. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  34896. t.Dingbats = true;
  34897. t.Symbol = true;
  34898. t.ZapfDingbats = true;
  34899. });
  34900. exports.getSymbolsFonts = getSymbolsFonts;
  34901. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  34902. t[2] = 10;
  34903. t[3] = 32;
  34904. t[4] = 33;
  34905. t[5] = 34;
  34906. t[6] = 35;
  34907. t[7] = 36;
  34908. t[8] = 37;
  34909. t[9] = 38;
  34910. t[10] = 39;
  34911. t[11] = 40;
  34912. t[12] = 41;
  34913. t[13] = 42;
  34914. t[14] = 43;
  34915. t[15] = 44;
  34916. t[16] = 45;
  34917. t[17] = 46;
  34918. t[18] = 47;
  34919. t[19] = 48;
  34920. t[20] = 49;
  34921. t[21] = 50;
  34922. t[22] = 51;
  34923. t[23] = 52;
  34924. t[24] = 53;
  34925. t[25] = 54;
  34926. t[26] = 55;
  34927. t[27] = 56;
  34928. t[28] = 57;
  34929. t[29] = 58;
  34930. t[30] = 894;
  34931. t[31] = 60;
  34932. t[32] = 61;
  34933. t[33] = 62;
  34934. t[34] = 63;
  34935. t[35] = 64;
  34936. t[36] = 65;
  34937. t[37] = 66;
  34938. t[38] = 67;
  34939. t[39] = 68;
  34940. t[40] = 69;
  34941. t[41] = 70;
  34942. t[42] = 71;
  34943. t[43] = 72;
  34944. t[44] = 73;
  34945. t[45] = 74;
  34946. t[46] = 75;
  34947. t[47] = 76;
  34948. t[48] = 77;
  34949. t[49] = 78;
  34950. t[50] = 79;
  34951. t[51] = 80;
  34952. t[52] = 81;
  34953. t[53] = 82;
  34954. t[54] = 83;
  34955. t[55] = 84;
  34956. t[56] = 85;
  34957. t[57] = 86;
  34958. t[58] = 87;
  34959. t[59] = 88;
  34960. t[60] = 89;
  34961. t[61] = 90;
  34962. t[62] = 91;
  34963. t[63] = 92;
  34964. t[64] = 93;
  34965. t[65] = 94;
  34966. t[66] = 95;
  34967. t[67] = 96;
  34968. t[68] = 97;
  34969. t[69] = 98;
  34970. t[70] = 99;
  34971. t[71] = 100;
  34972. t[72] = 101;
  34973. t[73] = 102;
  34974. t[74] = 103;
  34975. t[75] = 104;
  34976. t[76] = 105;
  34977. t[77] = 106;
  34978. t[78] = 107;
  34979. t[79] = 108;
  34980. t[80] = 109;
  34981. t[81] = 110;
  34982. t[82] = 111;
  34983. t[83] = 112;
  34984. t[84] = 113;
  34985. t[85] = 114;
  34986. t[86] = 115;
  34987. t[87] = 116;
  34988. t[88] = 117;
  34989. t[89] = 118;
  34990. t[90] = 119;
  34991. t[91] = 120;
  34992. t[92] = 121;
  34993. t[93] = 122;
  34994. t[94] = 123;
  34995. t[95] = 124;
  34996. t[96] = 125;
  34997. t[97] = 126;
  34998. t[98] = 196;
  34999. t[99] = 197;
  35000. t[100] = 199;
  35001. t[101] = 201;
  35002. t[102] = 209;
  35003. t[103] = 214;
  35004. t[104] = 220;
  35005. t[105] = 225;
  35006. t[106] = 224;
  35007. t[107] = 226;
  35008. t[108] = 228;
  35009. t[109] = 227;
  35010. t[110] = 229;
  35011. t[111] = 231;
  35012. t[112] = 233;
  35013. t[113] = 232;
  35014. t[114] = 234;
  35015. t[115] = 235;
  35016. t[116] = 237;
  35017. t[117] = 236;
  35018. t[118] = 238;
  35019. t[119] = 239;
  35020. t[120] = 241;
  35021. t[121] = 243;
  35022. t[122] = 242;
  35023. t[123] = 244;
  35024. t[124] = 246;
  35025. t[125] = 245;
  35026. t[126] = 250;
  35027. t[127] = 249;
  35028. t[128] = 251;
  35029. t[129] = 252;
  35030. t[130] = 8224;
  35031. t[131] = 176;
  35032. t[132] = 162;
  35033. t[133] = 163;
  35034. t[134] = 167;
  35035. t[135] = 8226;
  35036. t[136] = 182;
  35037. t[137] = 223;
  35038. t[138] = 174;
  35039. t[139] = 169;
  35040. t[140] = 8482;
  35041. t[141] = 180;
  35042. t[142] = 168;
  35043. t[143] = 8800;
  35044. t[144] = 198;
  35045. t[145] = 216;
  35046. t[146] = 8734;
  35047. t[147] = 177;
  35048. t[148] = 8804;
  35049. t[149] = 8805;
  35050. t[150] = 165;
  35051. t[151] = 181;
  35052. t[152] = 8706;
  35053. t[153] = 8721;
  35054. t[154] = 8719;
  35055. t[156] = 8747;
  35056. t[157] = 170;
  35057. t[158] = 186;
  35058. t[159] = 8486;
  35059. t[160] = 230;
  35060. t[161] = 248;
  35061. t[162] = 191;
  35062. t[163] = 161;
  35063. t[164] = 172;
  35064. t[165] = 8730;
  35065. t[166] = 402;
  35066. t[167] = 8776;
  35067. t[168] = 8710;
  35068. t[169] = 171;
  35069. t[170] = 187;
  35070. t[171] = 8230;
  35071. t[210] = 218;
  35072. t[223] = 711;
  35073. t[224] = 321;
  35074. t[225] = 322;
  35075. t[227] = 353;
  35076. t[229] = 382;
  35077. t[234] = 253;
  35078. t[252] = 263;
  35079. t[253] = 268;
  35080. t[254] = 269;
  35081. t[258] = 258;
  35082. t[260] = 260;
  35083. t[261] = 261;
  35084. t[265] = 280;
  35085. t[266] = 281;
  35086. t[268] = 283;
  35087. t[269] = 313;
  35088. t[275] = 323;
  35089. t[276] = 324;
  35090. t[278] = 328;
  35091. t[284] = 345;
  35092. t[285] = 346;
  35093. t[286] = 347;
  35094. t[292] = 367;
  35095. t[295] = 377;
  35096. t[296] = 378;
  35097. t[298] = 380;
  35098. t[305] = 963;
  35099. t[306] = 964;
  35100. t[307] = 966;
  35101. t[308] = 8215;
  35102. t[309] = 8252;
  35103. t[310] = 8319;
  35104. t[311] = 8359;
  35105. t[312] = 8592;
  35106. t[313] = 8593;
  35107. t[337] = 9552;
  35108. t[493] = 1039;
  35109. t[494] = 1040;
  35110. t[705] = 1524;
  35111. t[706] = 8362;
  35112. t[710] = 64288;
  35113. t[711] = 64298;
  35114. t[759] = 1617;
  35115. t[761] = 1776;
  35116. t[763] = 1778;
  35117. t[775] = 1652;
  35118. t[777] = 1764;
  35119. t[778] = 1780;
  35120. t[779] = 1781;
  35121. t[780] = 1782;
  35122. t[782] = 771;
  35123. t[783] = 64726;
  35124. t[786] = 8363;
  35125. t[788] = 8532;
  35126. t[790] = 768;
  35127. t[791] = 769;
  35128. t[792] = 768;
  35129. t[795] = 803;
  35130. t[797] = 64336;
  35131. t[798] = 64337;
  35132. t[799] = 64342;
  35133. t[800] = 64343;
  35134. t[801] = 64344;
  35135. t[802] = 64345;
  35136. t[803] = 64362;
  35137. t[804] = 64363;
  35138. t[805] = 64364;
  35139. t[2424] = 7821;
  35140. t[2425] = 7822;
  35141. t[2426] = 7823;
  35142. t[2427] = 7824;
  35143. t[2428] = 7825;
  35144. t[2429] = 7826;
  35145. t[2430] = 7827;
  35146. t[2433] = 7682;
  35147. t[2678] = 8045;
  35148. t[2679] = 8046;
  35149. t[2830] = 1552;
  35150. t[2838] = 686;
  35151. t[2840] = 751;
  35152. t[2842] = 753;
  35153. t[2843] = 754;
  35154. t[2844] = 755;
  35155. t[2846] = 757;
  35156. t[2856] = 767;
  35157. t[2857] = 848;
  35158. t[2858] = 849;
  35159. t[2862] = 853;
  35160. t[2863] = 854;
  35161. t[2864] = 855;
  35162. t[2865] = 861;
  35163. t[2866] = 862;
  35164. t[2906] = 7460;
  35165. t[2908] = 7462;
  35166. t[2909] = 7463;
  35167. t[2910] = 7464;
  35168. t[2912] = 7466;
  35169. t[2913] = 7467;
  35170. t[2914] = 7468;
  35171. t[2916] = 7470;
  35172. t[2917] = 7471;
  35173. t[2918] = 7472;
  35174. t[2920] = 7474;
  35175. t[2921] = 7475;
  35176. t[2922] = 7476;
  35177. t[2924] = 7478;
  35178. t[2925] = 7479;
  35179. t[2926] = 7480;
  35180. t[2928] = 7482;
  35181. t[2929] = 7483;
  35182. t[2930] = 7484;
  35183. t[2932] = 7486;
  35184. t[2933] = 7487;
  35185. t[2934] = 7488;
  35186. t[2936] = 7490;
  35187. t[2937] = 7491;
  35188. t[2938] = 7492;
  35189. t[2940] = 7494;
  35190. t[2941] = 7495;
  35191. t[2942] = 7496;
  35192. t[2944] = 7498;
  35193. t[2946] = 7500;
  35194. t[2948] = 7502;
  35195. t[2950] = 7504;
  35196. t[2951] = 7505;
  35197. t[2952] = 7506;
  35198. t[2954] = 7508;
  35199. t[2955] = 7509;
  35200. t[2956] = 7510;
  35201. t[2958] = 7512;
  35202. t[2959] = 7513;
  35203. t[2960] = 7514;
  35204. t[2962] = 7516;
  35205. t[2963] = 7517;
  35206. t[2964] = 7518;
  35207. t[2966] = 7520;
  35208. t[2967] = 7521;
  35209. t[2968] = 7522;
  35210. t[2970] = 7524;
  35211. t[2971] = 7525;
  35212. t[2972] = 7526;
  35213. t[2974] = 7528;
  35214. t[2975] = 7529;
  35215. t[2976] = 7530;
  35216. t[2978] = 1537;
  35217. t[2979] = 1538;
  35218. t[2980] = 1539;
  35219. t[2982] = 1549;
  35220. t[2983] = 1551;
  35221. t[2984] = 1552;
  35222. t[2986] = 1554;
  35223. t[2987] = 1555;
  35224. t[2988] = 1556;
  35225. t[2990] = 1623;
  35226. t[2991] = 1624;
  35227. t[2995] = 1775;
  35228. t[2999] = 1791;
  35229. t[3002] = 64290;
  35230. t[3003] = 64291;
  35231. t[3004] = 64292;
  35232. t[3006] = 64294;
  35233. t[3007] = 64295;
  35234. t[3008] = 64296;
  35235. t[3011] = 1900;
  35236. t[3014] = 8223;
  35237. t[3015] = 8244;
  35238. t[3017] = 7532;
  35239. t[3018] = 7533;
  35240. t[3019] = 7534;
  35241. t[3075] = 7590;
  35242. t[3076] = 7591;
  35243. t[3079] = 7594;
  35244. t[3080] = 7595;
  35245. t[3083] = 7598;
  35246. t[3084] = 7599;
  35247. t[3087] = 7602;
  35248. t[3088] = 7603;
  35249. t[3091] = 7606;
  35250. t[3092] = 7607;
  35251. t[3095] = 7610;
  35252. t[3096] = 7611;
  35253. t[3099] = 7614;
  35254. t[3100] = 7615;
  35255. t[3103] = 7618;
  35256. t[3104] = 7619;
  35257. t[3107] = 8337;
  35258. t[3108] = 8338;
  35259. t[3116] = 1884;
  35260. t[3119] = 1885;
  35261. t[3120] = 1885;
  35262. t[3123] = 1886;
  35263. t[3124] = 1886;
  35264. t[3127] = 1887;
  35265. t[3128] = 1887;
  35266. t[3131] = 1888;
  35267. t[3132] = 1888;
  35268. t[3135] = 1889;
  35269. t[3136] = 1889;
  35270. t[3139] = 1890;
  35271. t[3140] = 1890;
  35272. t[3143] = 1891;
  35273. t[3144] = 1891;
  35274. t[3147] = 1892;
  35275. t[3148] = 1892;
  35276. t[3153] = 580;
  35277. t[3154] = 581;
  35278. t[3157] = 584;
  35279. t[3158] = 585;
  35280. t[3161] = 588;
  35281. t[3162] = 589;
  35282. t[3165] = 891;
  35283. t[3166] = 892;
  35284. t[3169] = 1274;
  35285. t[3170] = 1275;
  35286. t[3173] = 1278;
  35287. t[3174] = 1279;
  35288. t[3181] = 7622;
  35289. t[3182] = 7623;
  35290. t[3282] = 11799;
  35291. t[3316] = 578;
  35292. t[3379] = 42785;
  35293. t[3393] = 1159;
  35294. t[3416] = 8377;
  35295. });
  35296. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  35297. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  35298. t[227] = 322;
  35299. t[264] = 261;
  35300. t[291] = 346;
  35301. });
  35302. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  35303. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  35304. t[1] = 32;
  35305. t[4] = 65;
  35306. t[17] = 66;
  35307. t[18] = 67;
  35308. t[24] = 68;
  35309. t[28] = 69;
  35310. t[38] = 70;
  35311. t[39] = 71;
  35312. t[44] = 72;
  35313. t[47] = 73;
  35314. t[58] = 74;
  35315. t[60] = 75;
  35316. t[62] = 76;
  35317. t[68] = 77;
  35318. t[69] = 78;
  35319. t[75] = 79;
  35320. t[87] = 80;
  35321. t[89] = 81;
  35322. t[90] = 82;
  35323. t[94] = 83;
  35324. t[100] = 84;
  35325. t[104] = 85;
  35326. t[115] = 86;
  35327. t[116] = 87;
  35328. t[121] = 88;
  35329. t[122] = 89;
  35330. t[127] = 90;
  35331. t[258] = 97;
  35332. t[268] = 261;
  35333. t[271] = 98;
  35334. t[272] = 99;
  35335. t[273] = 263;
  35336. t[282] = 100;
  35337. t[286] = 101;
  35338. t[295] = 281;
  35339. t[296] = 102;
  35340. t[336] = 103;
  35341. t[346] = 104;
  35342. t[349] = 105;
  35343. t[361] = 106;
  35344. t[364] = 107;
  35345. t[367] = 108;
  35346. t[371] = 322;
  35347. t[373] = 109;
  35348. t[374] = 110;
  35349. t[381] = 111;
  35350. t[383] = 243;
  35351. t[393] = 112;
  35352. t[395] = 113;
  35353. t[396] = 114;
  35354. t[400] = 115;
  35355. t[401] = 347;
  35356. t[410] = 116;
  35357. t[437] = 117;
  35358. t[448] = 118;
  35359. t[449] = 119;
  35360. t[454] = 120;
  35361. t[455] = 121;
  35362. t[460] = 122;
  35363. t[463] = 380;
  35364. t[853] = 44;
  35365. t[855] = 58;
  35366. t[856] = 46;
  35367. t[876] = 47;
  35368. t[878] = 45;
  35369. t[882] = 45;
  35370. t[894] = 40;
  35371. t[895] = 41;
  35372. t[896] = 91;
  35373. t[897] = 93;
  35374. t[923] = 64;
  35375. t[1004] = 48;
  35376. t[1005] = 49;
  35377. t[1006] = 50;
  35378. t[1007] = 51;
  35379. t[1008] = 52;
  35380. t[1009] = 53;
  35381. t[1010] = 54;
  35382. t[1011] = 55;
  35383. t[1012] = 56;
  35384. t[1013] = 57;
  35385. t[1081] = 37;
  35386. t[1085] = 43;
  35387. t[1086] = 45;
  35388. });
  35389. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  35390. /***/ }),
  35391. /* 42 */
  35392. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35393. Object.defineProperty(exports, "__esModule", ({
  35394. value: true
  35395. }));
  35396. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  35397. var _util = __w_pdfjs_require__(2);
  35398. class ToUnicodeMap {
  35399. constructor(cmap = []) {
  35400. this._map = cmap;
  35401. }
  35402. get length() {
  35403. return this._map.length;
  35404. }
  35405. forEach(callback) {
  35406. for (const charCode in this._map) {
  35407. callback(charCode, this._map[charCode].charCodeAt(0));
  35408. }
  35409. }
  35410. has(i) {
  35411. return this._map[i] !== undefined;
  35412. }
  35413. get(i) {
  35414. return this._map[i];
  35415. }
  35416. charCodeOf(value) {
  35417. const map = this._map;
  35418. if (map.length <= 0x10000) {
  35419. return map.indexOf(value);
  35420. }
  35421. for (const charCode in map) {
  35422. if (map[charCode] === value) {
  35423. return charCode | 0;
  35424. }
  35425. }
  35426. return -1;
  35427. }
  35428. amend(map) {
  35429. for (const charCode in map) {
  35430. this._map[charCode] = map[charCode];
  35431. }
  35432. }
  35433. }
  35434. exports.ToUnicodeMap = ToUnicodeMap;
  35435. class IdentityToUnicodeMap {
  35436. constructor(firstChar, lastChar) {
  35437. this.firstChar = firstChar;
  35438. this.lastChar = lastChar;
  35439. }
  35440. get length() {
  35441. return this.lastChar + 1 - this.firstChar;
  35442. }
  35443. forEach(callback) {
  35444. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  35445. callback(i, i);
  35446. }
  35447. }
  35448. has(i) {
  35449. return this.firstChar <= i && i <= this.lastChar;
  35450. }
  35451. get(i) {
  35452. if (this.firstChar <= i && i <= this.lastChar) {
  35453. return String.fromCharCode(i);
  35454. }
  35455. return undefined;
  35456. }
  35457. charCodeOf(v) {
  35458. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  35459. }
  35460. amend(map) {
  35461. (0, _util.unreachable)("Should not call amend()");
  35462. }
  35463. }
  35464. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  35465. /***/ }),
  35466. /* 43 */
  35467. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35468. Object.defineProperty(exports, "__esModule", ({
  35469. value: true
  35470. }));
  35471. exports.CFFFont = void 0;
  35472. var _cff_parser = __w_pdfjs_require__(35);
  35473. var _fonts_utils = __w_pdfjs_require__(38);
  35474. var _util = __w_pdfjs_require__(2);
  35475. class CFFFont {
  35476. constructor(file, properties) {
  35477. this.properties = properties;
  35478. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  35479. this.cff = parser.parse();
  35480. this.cff.duplicateFirstGlyph();
  35481. const compiler = new _cff_parser.CFFCompiler(this.cff);
  35482. this.seacs = this.cff.seacs;
  35483. try {
  35484. this.data = compiler.compile();
  35485. } catch (e) {
  35486. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  35487. this.data = file;
  35488. }
  35489. this._createBuiltInEncoding();
  35490. }
  35491. get numGlyphs() {
  35492. return this.cff.charStrings.count;
  35493. }
  35494. getCharset() {
  35495. return this.cff.charset.charset;
  35496. }
  35497. getGlyphMapping() {
  35498. const cff = this.cff;
  35499. const properties = this.properties;
  35500. const charsets = cff.charset.charset;
  35501. let charCodeToGlyphId;
  35502. let glyphId;
  35503. if (properties.composite) {
  35504. charCodeToGlyphId = Object.create(null);
  35505. let charCode;
  35506. if (cff.isCIDFont) {
  35507. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  35508. const cid = charsets[glyphId];
  35509. charCode = properties.cMap.charCodeOf(cid);
  35510. charCodeToGlyphId[charCode] = glyphId;
  35511. }
  35512. } else {
  35513. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  35514. charCode = properties.cMap.charCodeOf(glyphId);
  35515. charCodeToGlyphId[charCode] = glyphId;
  35516. }
  35517. }
  35518. return charCodeToGlyphId;
  35519. }
  35520. const encoding = cff.encoding ? cff.encoding.encoding : null;
  35521. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  35522. return charCodeToGlyphId;
  35523. }
  35524. hasGlyphId(id) {
  35525. return this.cff.hasGlyphId(id);
  35526. }
  35527. _createBuiltInEncoding() {
  35528. const {
  35529. charset,
  35530. encoding
  35531. } = this.cff;
  35532. if (!charset || !encoding) {
  35533. return;
  35534. }
  35535. const charsets = charset.charset,
  35536. encodings = encoding.encoding;
  35537. const map = [];
  35538. for (const charCode in encodings) {
  35539. const glyphId = encodings[charCode];
  35540. if (glyphId >= 0) {
  35541. const glyphName = charsets[glyphId];
  35542. if (glyphName) {
  35543. map[charCode] = glyphName;
  35544. }
  35545. }
  35546. }
  35547. if (map.length > 0) {
  35548. this.properties.builtInEncoding = map;
  35549. }
  35550. }
  35551. }
  35552. exports.CFFFont = CFFFont;
  35553. /***/ }),
  35554. /* 44 */
  35555. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35556. Object.defineProperty(exports, "__esModule", ({
  35557. value: true
  35558. }));
  35559. exports.FontRendererFactory = void 0;
  35560. var _util = __w_pdfjs_require__(2);
  35561. var _cff_parser = __w_pdfjs_require__(35);
  35562. var _glyphlist = __w_pdfjs_require__(39);
  35563. var _encodings = __w_pdfjs_require__(37);
  35564. var _stream = __w_pdfjs_require__(10);
  35565. function getLong(data, offset) {
  35566. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  35567. }
  35568. function getUshort(data, offset) {
  35569. return data[offset] << 8 | data[offset + 1];
  35570. }
  35571. function getSubroutineBias(subrs) {
  35572. const numSubrs = subrs.length;
  35573. let bias = 32768;
  35574. if (numSubrs < 1240) {
  35575. bias = 107;
  35576. } else if (numSubrs < 33900) {
  35577. bias = 1131;
  35578. }
  35579. return bias;
  35580. }
  35581. function parseCmap(data, start, end) {
  35582. const offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  35583. const format = getUshort(data, start + offset);
  35584. let ranges, p, i;
  35585. if (format === 4) {
  35586. getUshort(data, start + offset + 2);
  35587. const segCount = getUshort(data, start + offset + 6) >> 1;
  35588. p = start + offset + 14;
  35589. ranges = [];
  35590. for (i = 0; i < segCount; i++, p += 2) {
  35591. ranges[i] = {
  35592. end: getUshort(data, p)
  35593. };
  35594. }
  35595. p += 2;
  35596. for (i = 0; i < segCount; i++, p += 2) {
  35597. ranges[i].start = getUshort(data, p);
  35598. }
  35599. for (i = 0; i < segCount; i++, p += 2) {
  35600. ranges[i].idDelta = getUshort(data, p);
  35601. }
  35602. for (i = 0; i < segCount; i++, p += 2) {
  35603. let idOffset = getUshort(data, p);
  35604. if (idOffset === 0) {
  35605. continue;
  35606. }
  35607. ranges[i].ids = [];
  35608. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  35609. ranges[i].ids[j] = getUshort(data, p + idOffset);
  35610. idOffset += 2;
  35611. }
  35612. }
  35613. return ranges;
  35614. } else if (format === 12) {
  35615. getLong(data, start + offset + 4);
  35616. const groups = getLong(data, start + offset + 12);
  35617. p = start + offset + 16;
  35618. ranges = [];
  35619. for (i = 0; i < groups; i++) {
  35620. ranges.push({
  35621. start: getLong(data, p),
  35622. end: getLong(data, p + 4),
  35623. idDelta: getLong(data, p + 8) - getLong(data, p)
  35624. });
  35625. p += 12;
  35626. }
  35627. return ranges;
  35628. }
  35629. throw new _util.FormatError(`unsupported cmap: ${format}`);
  35630. }
  35631. function parseCff(data, start, end, seacAnalysisEnabled) {
  35632. const properties = {};
  35633. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  35634. const cff = parser.parse();
  35635. return {
  35636. glyphs: cff.charStrings.objects,
  35637. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  35638. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  35639. isCFFCIDFont: cff.isCIDFont,
  35640. fdSelect: cff.fdSelect,
  35641. fdArray: cff.fdArray
  35642. };
  35643. }
  35644. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  35645. let itemSize, itemDecode;
  35646. if (isGlyphLocationsLong) {
  35647. itemSize = 4;
  35648. itemDecode = function fontItemDecodeLong(data, offset) {
  35649. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  35650. };
  35651. } else {
  35652. itemSize = 2;
  35653. itemDecode = function fontItemDecode(data, offset) {
  35654. return data[offset] << 9 | data[offset + 1] << 1;
  35655. };
  35656. }
  35657. const glyphs = [];
  35658. let startOffset = itemDecode(loca, 0);
  35659. for (let j = itemSize; j < loca.length; j += itemSize) {
  35660. const endOffset = itemDecode(loca, j);
  35661. glyphs.push(glyf.subarray(startOffset, endOffset));
  35662. startOffset = endOffset;
  35663. }
  35664. return glyphs;
  35665. }
  35666. function lookupCmap(ranges, unicode) {
  35667. const code = unicode.codePointAt(0);
  35668. let gid = 0,
  35669. l = 0,
  35670. r = ranges.length - 1;
  35671. while (l < r) {
  35672. const c = l + r + 1 >> 1;
  35673. if (code < ranges[c].start) {
  35674. r = c - 1;
  35675. } else {
  35676. l = c;
  35677. }
  35678. }
  35679. if (ranges[l].start <= code && code <= ranges[l].end) {
  35680. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  35681. }
  35682. return {
  35683. charCode: code,
  35684. glyphId: gid
  35685. };
  35686. }
  35687. function compileGlyf(code, cmds, font) {
  35688. function moveTo(x, y) {
  35689. cmds.push({
  35690. cmd: "moveTo",
  35691. args: [x, y]
  35692. });
  35693. }
  35694. function lineTo(x, y) {
  35695. cmds.push({
  35696. cmd: "lineTo",
  35697. args: [x, y]
  35698. });
  35699. }
  35700. function quadraticCurveTo(xa, ya, x, y) {
  35701. cmds.push({
  35702. cmd: "quadraticCurveTo",
  35703. args: [xa, ya, x, y]
  35704. });
  35705. }
  35706. let i = 0;
  35707. const numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  35708. let flags;
  35709. let x = 0,
  35710. y = 0;
  35711. i += 10;
  35712. if (numberOfContours < 0) {
  35713. do {
  35714. flags = code[i] << 8 | code[i + 1];
  35715. const glyphIndex = code[i + 2] << 8 | code[i + 3];
  35716. i += 4;
  35717. let arg1, arg2;
  35718. if (flags & 0x01) {
  35719. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  35720. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  35721. i += 4;
  35722. } else {
  35723. arg1 = code[i++];
  35724. arg2 = code[i++];
  35725. }
  35726. if (flags & 0x02) {
  35727. x = arg1;
  35728. y = arg2;
  35729. } else {
  35730. x = 0;
  35731. y = 0;
  35732. }
  35733. let scaleX = 1,
  35734. scaleY = 1,
  35735. scale01 = 0,
  35736. scale10 = 0;
  35737. if (flags & 0x08) {
  35738. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  35739. i += 2;
  35740. } else if (flags & 0x40) {
  35741. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  35742. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  35743. i += 4;
  35744. } else if (flags & 0x80) {
  35745. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  35746. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  35747. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  35748. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  35749. i += 8;
  35750. }
  35751. const subglyph = font.glyphs[glyphIndex];
  35752. if (subglyph) {
  35753. cmds.push({
  35754. cmd: "save"
  35755. }, {
  35756. cmd: "transform",
  35757. args: [scaleX, scale01, scale10, scaleY, x, y]
  35758. });
  35759. compileGlyf(subglyph, cmds, font);
  35760. cmds.push({
  35761. cmd: "restore"
  35762. });
  35763. }
  35764. } while (flags & 0x20);
  35765. } else {
  35766. const endPtsOfContours = [];
  35767. let j, jj;
  35768. for (j = 0; j < numberOfContours; j++) {
  35769. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  35770. i += 2;
  35771. }
  35772. const instructionLength = code[i] << 8 | code[i + 1];
  35773. i += 2 + instructionLength;
  35774. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  35775. const points = [];
  35776. while (points.length < numberOfPoints) {
  35777. flags = code[i++];
  35778. let repeat = 1;
  35779. if (flags & 0x08) {
  35780. repeat += code[i++];
  35781. }
  35782. while (repeat-- > 0) {
  35783. points.push({
  35784. flags
  35785. });
  35786. }
  35787. }
  35788. for (j = 0; j < numberOfPoints; j++) {
  35789. switch (points[j].flags & 0x12) {
  35790. case 0x00:
  35791. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  35792. i += 2;
  35793. break;
  35794. case 0x02:
  35795. x -= code[i++];
  35796. break;
  35797. case 0x12:
  35798. x += code[i++];
  35799. break;
  35800. }
  35801. points[j].x = x;
  35802. }
  35803. for (j = 0; j < numberOfPoints; j++) {
  35804. switch (points[j].flags & 0x24) {
  35805. case 0x00:
  35806. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  35807. i += 2;
  35808. break;
  35809. case 0x04:
  35810. y -= code[i++];
  35811. break;
  35812. case 0x24:
  35813. y += code[i++];
  35814. break;
  35815. }
  35816. points[j].y = y;
  35817. }
  35818. let startPoint = 0;
  35819. for (i = 0; i < numberOfContours; i++) {
  35820. const endPoint = endPtsOfContours[i];
  35821. const contour = points.slice(startPoint, endPoint + 1);
  35822. if (contour[0].flags & 1) {
  35823. contour.push(contour[0]);
  35824. } else if (contour[contour.length - 1].flags & 1) {
  35825. contour.unshift(contour[contour.length - 1]);
  35826. } else {
  35827. const p = {
  35828. flags: 1,
  35829. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  35830. y: (contour[0].y + contour[contour.length - 1].y) / 2
  35831. };
  35832. contour.unshift(p);
  35833. contour.push(p);
  35834. }
  35835. moveTo(contour[0].x, contour[0].y);
  35836. for (j = 1, jj = contour.length; j < jj; j++) {
  35837. if (contour[j].flags & 1) {
  35838. lineTo(contour[j].x, contour[j].y);
  35839. } else if (contour[j + 1].flags & 1) {
  35840. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  35841. j++;
  35842. } else {
  35843. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  35844. }
  35845. }
  35846. startPoint = endPoint + 1;
  35847. }
  35848. }
  35849. }
  35850. function compileCharString(charStringCode, cmds, font, glyphId) {
  35851. function moveTo(x, y) {
  35852. cmds.push({
  35853. cmd: "moveTo",
  35854. args: [x, y]
  35855. });
  35856. }
  35857. function lineTo(x, y) {
  35858. cmds.push({
  35859. cmd: "lineTo",
  35860. args: [x, y]
  35861. });
  35862. }
  35863. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  35864. cmds.push({
  35865. cmd: "bezierCurveTo",
  35866. args: [x1, y1, x2, y2, x, y]
  35867. });
  35868. }
  35869. const stack = [];
  35870. let x = 0,
  35871. y = 0;
  35872. let stems = 0;
  35873. function parse(code) {
  35874. let i = 0;
  35875. while (i < code.length) {
  35876. let stackClean = false;
  35877. let v = code[i++];
  35878. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  35879. switch (v) {
  35880. case 1:
  35881. stems += stack.length >> 1;
  35882. stackClean = true;
  35883. break;
  35884. case 3:
  35885. stems += stack.length >> 1;
  35886. stackClean = true;
  35887. break;
  35888. case 4:
  35889. y += stack.pop();
  35890. moveTo(x, y);
  35891. stackClean = true;
  35892. break;
  35893. case 5:
  35894. while (stack.length > 0) {
  35895. x += stack.shift();
  35896. y += stack.shift();
  35897. lineTo(x, y);
  35898. }
  35899. break;
  35900. case 6:
  35901. while (stack.length > 0) {
  35902. x += stack.shift();
  35903. lineTo(x, y);
  35904. if (stack.length === 0) {
  35905. break;
  35906. }
  35907. y += stack.shift();
  35908. lineTo(x, y);
  35909. }
  35910. break;
  35911. case 7:
  35912. while (stack.length > 0) {
  35913. y += stack.shift();
  35914. lineTo(x, y);
  35915. if (stack.length === 0) {
  35916. break;
  35917. }
  35918. x += stack.shift();
  35919. lineTo(x, y);
  35920. }
  35921. break;
  35922. case 8:
  35923. while (stack.length > 0) {
  35924. xa = x + stack.shift();
  35925. ya = y + stack.shift();
  35926. xb = xa + stack.shift();
  35927. yb = ya + stack.shift();
  35928. x = xb + stack.shift();
  35929. y = yb + stack.shift();
  35930. bezierCurveTo(xa, ya, xb, yb, x, y);
  35931. }
  35932. break;
  35933. case 10:
  35934. n = stack.pop();
  35935. subrCode = null;
  35936. if (font.isCFFCIDFont) {
  35937. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  35938. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  35939. const fontDict = font.fdArray[fdIndex];
  35940. let subrs;
  35941. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  35942. subrs = fontDict.privateDict.subrsIndex.objects;
  35943. }
  35944. if (subrs) {
  35945. n += getSubroutineBias(subrs);
  35946. subrCode = subrs[n];
  35947. }
  35948. } else {
  35949. (0, _util.warn)("Invalid fd index for glyph index.");
  35950. }
  35951. } else {
  35952. subrCode = font.subrs[n + font.subrsBias];
  35953. }
  35954. if (subrCode) {
  35955. parse(subrCode);
  35956. }
  35957. break;
  35958. case 11:
  35959. return;
  35960. case 12:
  35961. v = code[i++];
  35962. switch (v) {
  35963. case 34:
  35964. xa = x + stack.shift();
  35965. xb = xa + stack.shift();
  35966. y1 = y + stack.shift();
  35967. x = xb + stack.shift();
  35968. bezierCurveTo(xa, y, xb, y1, x, y1);
  35969. xa = x + stack.shift();
  35970. xb = xa + stack.shift();
  35971. x = xb + stack.shift();
  35972. bezierCurveTo(xa, y1, xb, y, x, y);
  35973. break;
  35974. case 35:
  35975. xa = x + stack.shift();
  35976. ya = y + stack.shift();
  35977. xb = xa + stack.shift();
  35978. yb = ya + stack.shift();
  35979. x = xb + stack.shift();
  35980. y = yb + stack.shift();
  35981. bezierCurveTo(xa, ya, xb, yb, x, y);
  35982. xa = x + stack.shift();
  35983. ya = y + stack.shift();
  35984. xb = xa + stack.shift();
  35985. yb = ya + stack.shift();
  35986. x = xb + stack.shift();
  35987. y = yb + stack.shift();
  35988. bezierCurveTo(xa, ya, xb, yb, x, y);
  35989. stack.pop();
  35990. break;
  35991. case 36:
  35992. xa = x + stack.shift();
  35993. y1 = y + stack.shift();
  35994. xb = xa + stack.shift();
  35995. y2 = y1 + stack.shift();
  35996. x = xb + stack.shift();
  35997. bezierCurveTo(xa, y1, xb, y2, x, y2);
  35998. xa = x + stack.shift();
  35999. xb = xa + stack.shift();
  36000. y3 = y2 + stack.shift();
  36001. x = xb + stack.shift();
  36002. bezierCurveTo(xa, y2, xb, y3, x, y);
  36003. break;
  36004. case 37:
  36005. const x0 = x,
  36006. y0 = y;
  36007. xa = x + stack.shift();
  36008. ya = y + stack.shift();
  36009. xb = xa + stack.shift();
  36010. yb = ya + stack.shift();
  36011. x = xb + stack.shift();
  36012. y = yb + stack.shift();
  36013. bezierCurveTo(xa, ya, xb, yb, x, y);
  36014. xa = x + stack.shift();
  36015. ya = y + stack.shift();
  36016. xb = xa + stack.shift();
  36017. yb = ya + stack.shift();
  36018. x = xb;
  36019. y = yb;
  36020. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  36021. x += stack.shift();
  36022. } else {
  36023. y += stack.shift();
  36024. }
  36025. bezierCurveTo(xa, ya, xb, yb, x, y);
  36026. break;
  36027. default:
  36028. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  36029. }
  36030. break;
  36031. case 14:
  36032. if (stack.length >= 4) {
  36033. const achar = stack.pop();
  36034. const bchar = stack.pop();
  36035. y = stack.pop();
  36036. x = stack.pop();
  36037. cmds.push({
  36038. cmd: "save"
  36039. }, {
  36040. cmd: "translate",
  36041. args: [x, y]
  36042. });
  36043. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  36044. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  36045. cmds.push({
  36046. cmd: "restore"
  36047. });
  36048. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  36049. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  36050. }
  36051. return;
  36052. case 18:
  36053. stems += stack.length >> 1;
  36054. stackClean = true;
  36055. break;
  36056. case 19:
  36057. stems += stack.length >> 1;
  36058. i += stems + 7 >> 3;
  36059. stackClean = true;
  36060. break;
  36061. case 20:
  36062. stems += stack.length >> 1;
  36063. i += stems + 7 >> 3;
  36064. stackClean = true;
  36065. break;
  36066. case 21:
  36067. y += stack.pop();
  36068. x += stack.pop();
  36069. moveTo(x, y);
  36070. stackClean = true;
  36071. break;
  36072. case 22:
  36073. x += stack.pop();
  36074. moveTo(x, y);
  36075. stackClean = true;
  36076. break;
  36077. case 23:
  36078. stems += stack.length >> 1;
  36079. stackClean = true;
  36080. break;
  36081. case 24:
  36082. while (stack.length > 2) {
  36083. xa = x + stack.shift();
  36084. ya = y + stack.shift();
  36085. xb = xa + stack.shift();
  36086. yb = ya + stack.shift();
  36087. x = xb + stack.shift();
  36088. y = yb + stack.shift();
  36089. bezierCurveTo(xa, ya, xb, yb, x, y);
  36090. }
  36091. x += stack.shift();
  36092. y += stack.shift();
  36093. lineTo(x, y);
  36094. break;
  36095. case 25:
  36096. while (stack.length > 6) {
  36097. x += stack.shift();
  36098. y += stack.shift();
  36099. lineTo(x, y);
  36100. }
  36101. xa = x + stack.shift();
  36102. ya = y + stack.shift();
  36103. xb = xa + stack.shift();
  36104. yb = ya + stack.shift();
  36105. x = xb + stack.shift();
  36106. y = yb + stack.shift();
  36107. bezierCurveTo(xa, ya, xb, yb, x, y);
  36108. break;
  36109. case 26:
  36110. if (stack.length % 2) {
  36111. x += stack.shift();
  36112. }
  36113. while (stack.length > 0) {
  36114. xa = x;
  36115. ya = y + stack.shift();
  36116. xb = xa + stack.shift();
  36117. yb = ya + stack.shift();
  36118. x = xb;
  36119. y = yb + stack.shift();
  36120. bezierCurveTo(xa, ya, xb, yb, x, y);
  36121. }
  36122. break;
  36123. case 27:
  36124. if (stack.length % 2) {
  36125. y += stack.shift();
  36126. }
  36127. while (stack.length > 0) {
  36128. xa = x + stack.shift();
  36129. ya = y;
  36130. xb = xa + stack.shift();
  36131. yb = ya + stack.shift();
  36132. x = xb + stack.shift();
  36133. y = yb;
  36134. bezierCurveTo(xa, ya, xb, yb, x, y);
  36135. }
  36136. break;
  36137. case 28:
  36138. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  36139. i += 2;
  36140. break;
  36141. case 29:
  36142. n = stack.pop() + font.gsubrsBias;
  36143. subrCode = font.gsubrs[n];
  36144. if (subrCode) {
  36145. parse(subrCode);
  36146. }
  36147. break;
  36148. case 30:
  36149. while (stack.length > 0) {
  36150. xa = x;
  36151. ya = y + stack.shift();
  36152. xb = xa + stack.shift();
  36153. yb = ya + stack.shift();
  36154. x = xb + stack.shift();
  36155. y = yb + (stack.length === 1 ? stack.shift() : 0);
  36156. bezierCurveTo(xa, ya, xb, yb, x, y);
  36157. if (stack.length === 0) {
  36158. break;
  36159. }
  36160. xa = x + stack.shift();
  36161. ya = y;
  36162. xb = xa + stack.shift();
  36163. yb = ya + stack.shift();
  36164. y = yb + stack.shift();
  36165. x = xb + (stack.length === 1 ? stack.shift() : 0);
  36166. bezierCurveTo(xa, ya, xb, yb, x, y);
  36167. }
  36168. break;
  36169. case 31:
  36170. while (stack.length > 0) {
  36171. xa = x + stack.shift();
  36172. ya = y;
  36173. xb = xa + stack.shift();
  36174. yb = ya + stack.shift();
  36175. y = yb + stack.shift();
  36176. x = xb + (stack.length === 1 ? stack.shift() : 0);
  36177. bezierCurveTo(xa, ya, xb, yb, x, y);
  36178. if (stack.length === 0) {
  36179. break;
  36180. }
  36181. xa = x;
  36182. ya = y + stack.shift();
  36183. xb = xa + stack.shift();
  36184. yb = ya + stack.shift();
  36185. x = xb + stack.shift();
  36186. y = yb + (stack.length === 1 ? stack.shift() : 0);
  36187. bezierCurveTo(xa, ya, xb, yb, x, y);
  36188. }
  36189. break;
  36190. default:
  36191. if (v < 32) {
  36192. throw new _util.FormatError(`unknown operator: ${v}`);
  36193. }
  36194. if (v < 247) {
  36195. stack.push(v - 139);
  36196. } else if (v < 251) {
  36197. stack.push((v - 247) * 256 + code[i++] + 108);
  36198. } else if (v < 255) {
  36199. stack.push(-(v - 251) * 256 - code[i++] - 108);
  36200. } else {
  36201. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  36202. i += 4;
  36203. }
  36204. break;
  36205. }
  36206. if (stackClean) {
  36207. stack.length = 0;
  36208. }
  36209. }
  36210. }
  36211. parse(charStringCode);
  36212. }
  36213. const NOOP = [];
  36214. class CompiledFont {
  36215. constructor(fontMatrix) {
  36216. if (this.constructor === CompiledFont) {
  36217. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  36218. }
  36219. this.fontMatrix = fontMatrix;
  36220. this.compiledGlyphs = Object.create(null);
  36221. this.compiledCharCodeToGlyphId = Object.create(null);
  36222. }
  36223. getPathJs(unicode) {
  36224. const {
  36225. charCode,
  36226. glyphId
  36227. } = lookupCmap(this.cmap, unicode);
  36228. let fn = this.compiledGlyphs[glyphId];
  36229. if (!fn) {
  36230. try {
  36231. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  36232. this.compiledGlyphs[glyphId] = fn;
  36233. } catch (ex) {
  36234. this.compiledGlyphs[glyphId] = NOOP;
  36235. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  36236. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  36237. }
  36238. throw ex;
  36239. }
  36240. }
  36241. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  36242. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  36243. }
  36244. return fn;
  36245. }
  36246. compileGlyph(code, glyphId) {
  36247. if (!code || code.length === 0 || code[0] === 14) {
  36248. return NOOP;
  36249. }
  36250. let fontMatrix = this.fontMatrix;
  36251. if (this.isCFFCIDFont) {
  36252. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  36253. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  36254. const fontDict = this.fdArray[fdIndex];
  36255. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  36256. } else {
  36257. (0, _util.warn)("Invalid fd index for glyph index.");
  36258. }
  36259. }
  36260. const cmds = [{
  36261. cmd: "save"
  36262. }, {
  36263. cmd: "transform",
  36264. args: fontMatrix.slice()
  36265. }, {
  36266. cmd: "scale",
  36267. args: ["size", "-size"]
  36268. }];
  36269. this.compileGlyphImpl(code, cmds, glyphId);
  36270. cmds.push({
  36271. cmd: "restore"
  36272. });
  36273. return cmds;
  36274. }
  36275. compileGlyphImpl() {
  36276. (0, _util.unreachable)("Children classes should implement this.");
  36277. }
  36278. hasBuiltPath(unicode) {
  36279. const {
  36280. charCode,
  36281. glyphId
  36282. } = lookupCmap(this.cmap, unicode);
  36283. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  36284. }
  36285. }
  36286. class TrueTypeCompiled extends CompiledFont {
  36287. constructor(glyphs, cmap, fontMatrix) {
  36288. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  36289. this.glyphs = glyphs;
  36290. this.cmap = cmap;
  36291. }
  36292. compileGlyphImpl(code, cmds) {
  36293. compileGlyf(code, cmds, this);
  36294. }
  36295. }
  36296. class Type2Compiled extends CompiledFont {
  36297. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  36298. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  36299. this.glyphs = cffInfo.glyphs;
  36300. this.gsubrs = cffInfo.gsubrs || [];
  36301. this.subrs = cffInfo.subrs || [];
  36302. this.cmap = cmap;
  36303. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  36304. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  36305. this.subrsBias = getSubroutineBias(this.subrs);
  36306. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  36307. this.fdSelect = cffInfo.fdSelect;
  36308. this.fdArray = cffInfo.fdArray;
  36309. }
  36310. compileGlyphImpl(code, cmds, glyphId) {
  36311. compileCharString(code, cmds, this, glyphId);
  36312. }
  36313. }
  36314. class FontRendererFactory {
  36315. static create(font, seacAnalysisEnabled) {
  36316. const data = new Uint8Array(font.data);
  36317. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  36318. const numTables = getUshort(data, 4);
  36319. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  36320. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  36321. const offset = getLong(data, p + 8);
  36322. const length = getLong(data, p + 12);
  36323. switch (tag) {
  36324. case "cmap":
  36325. cmap = parseCmap(data, offset, offset + length);
  36326. break;
  36327. case "glyf":
  36328. glyf = data.subarray(offset, offset + length);
  36329. break;
  36330. case "loca":
  36331. loca = data.subarray(offset, offset + length);
  36332. break;
  36333. case "head":
  36334. unitsPerEm = getUshort(data, offset + 18);
  36335. indexToLocFormat = getUshort(data, offset + 50);
  36336. break;
  36337. case "CFF ":
  36338. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  36339. break;
  36340. }
  36341. }
  36342. if (glyf) {
  36343. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  36344. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  36345. }
  36346. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  36347. }
  36348. }
  36349. exports.FontRendererFactory = FontRendererFactory;
  36350. /***/ }),
  36351. /* 45 */
  36352. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36353. Object.defineProperty(exports, "__esModule", ({
  36354. value: true
  36355. }));
  36356. exports.OpenTypeFileBuilder = void 0;
  36357. var _core_utils = __w_pdfjs_require__(9);
  36358. var _util = __w_pdfjs_require__(2);
  36359. function writeInt16(dest, offset, num) {
  36360. dest[offset] = num >> 8 & 0xff;
  36361. dest[offset + 1] = num & 0xff;
  36362. }
  36363. function writeInt32(dest, offset, num) {
  36364. dest[offset] = num >> 24 & 0xff;
  36365. dest[offset + 1] = num >> 16 & 0xff;
  36366. dest[offset + 2] = num >> 8 & 0xff;
  36367. dest[offset + 3] = num & 0xff;
  36368. }
  36369. function writeData(dest, offset, data) {
  36370. if (data instanceof Uint8Array) {
  36371. dest.set(data, offset);
  36372. } else if (typeof data === "string") {
  36373. for (let i = 0, ii = data.length; i < ii; i++) {
  36374. dest[offset++] = data.charCodeAt(i) & 0xff;
  36375. }
  36376. } else {
  36377. for (let i = 0, ii = data.length; i < ii; i++) {
  36378. dest[offset++] = data[i] & 0xff;
  36379. }
  36380. }
  36381. }
  36382. const OTF_HEADER_SIZE = 12;
  36383. const OTF_TABLE_ENTRY_SIZE = 16;
  36384. class OpenTypeFileBuilder {
  36385. constructor(sfnt) {
  36386. this.sfnt = sfnt;
  36387. this.tables = Object.create(null);
  36388. }
  36389. static getSearchParams(entriesCount, entrySize) {
  36390. let maxPower2 = 1,
  36391. log2 = 0;
  36392. while ((maxPower2 ^ entriesCount) > maxPower2) {
  36393. maxPower2 <<= 1;
  36394. log2++;
  36395. }
  36396. const searchRange = maxPower2 * entrySize;
  36397. return {
  36398. range: searchRange,
  36399. entry: log2,
  36400. rangeShift: entrySize * entriesCount - searchRange
  36401. };
  36402. }
  36403. toArray() {
  36404. let sfnt = this.sfnt;
  36405. const tables = this.tables;
  36406. const tablesNames = Object.keys(tables);
  36407. tablesNames.sort();
  36408. const numTables = tablesNames.length;
  36409. let i, j, jj, table, tableName;
  36410. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  36411. const tableOffsets = [offset];
  36412. for (i = 0; i < numTables; i++) {
  36413. table = tables[tablesNames[i]];
  36414. const paddedLength = (table.length + 3 & ~3) >>> 0;
  36415. offset += paddedLength;
  36416. tableOffsets.push(offset);
  36417. }
  36418. const file = new Uint8Array(offset);
  36419. for (i = 0; i < numTables; i++) {
  36420. table = tables[tablesNames[i]];
  36421. writeData(file, tableOffsets[i], table);
  36422. }
  36423. if (sfnt === "true") {
  36424. sfnt = (0, _util.string32)(0x00010000);
  36425. }
  36426. file[0] = sfnt.charCodeAt(0) & 0xff;
  36427. file[1] = sfnt.charCodeAt(1) & 0xff;
  36428. file[2] = sfnt.charCodeAt(2) & 0xff;
  36429. file[3] = sfnt.charCodeAt(3) & 0xff;
  36430. writeInt16(file, 4, numTables);
  36431. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  36432. writeInt16(file, 6, searchParams.range);
  36433. writeInt16(file, 8, searchParams.entry);
  36434. writeInt16(file, 10, searchParams.rangeShift);
  36435. offset = OTF_HEADER_SIZE;
  36436. for (i = 0; i < numTables; i++) {
  36437. tableName = tablesNames[i];
  36438. file[offset] = tableName.charCodeAt(0) & 0xff;
  36439. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  36440. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  36441. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  36442. let checksum = 0;
  36443. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  36444. const quad = (0, _core_utils.readUint32)(file, j);
  36445. checksum = checksum + quad >>> 0;
  36446. }
  36447. writeInt32(file, offset + 4, checksum);
  36448. writeInt32(file, offset + 8, tableOffsets[i]);
  36449. writeInt32(file, offset + 12, tables[tableName].length);
  36450. offset += OTF_TABLE_ENTRY_SIZE;
  36451. }
  36452. return file;
  36453. }
  36454. addTable(tag, data) {
  36455. if (tag in this.tables) {
  36456. throw new Error("Table " + tag + " already exists");
  36457. }
  36458. this.tables[tag] = data;
  36459. }
  36460. }
  36461. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  36462. /***/ }),
  36463. /* 46 */
  36464. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36465. Object.defineProperty(exports, "__esModule", ({
  36466. value: true
  36467. }));
  36468. exports.Type1Font = void 0;
  36469. var _cff_parser = __w_pdfjs_require__(35);
  36470. var _fonts_utils = __w_pdfjs_require__(38);
  36471. var _core_utils = __w_pdfjs_require__(9);
  36472. var _stream = __w_pdfjs_require__(10);
  36473. var _type1_parser = __w_pdfjs_require__(47);
  36474. var _util = __w_pdfjs_require__(2);
  36475. function findBlock(streamBytes, signature, startIndex) {
  36476. const streamBytesLength = streamBytes.length;
  36477. const signatureLength = signature.length;
  36478. const scanLength = streamBytesLength - signatureLength;
  36479. let i = startIndex,
  36480. found = false;
  36481. while (i < scanLength) {
  36482. let j = 0;
  36483. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  36484. j++;
  36485. }
  36486. if (j >= signatureLength) {
  36487. i += j;
  36488. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  36489. i++;
  36490. }
  36491. found = true;
  36492. break;
  36493. }
  36494. i++;
  36495. }
  36496. return {
  36497. found,
  36498. length: i
  36499. };
  36500. }
  36501. function getHeaderBlock(stream, suggestedLength) {
  36502. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  36503. const streamStartPos = stream.pos;
  36504. let headerBytes, headerBytesLength, block;
  36505. try {
  36506. headerBytes = stream.getBytes(suggestedLength);
  36507. headerBytesLength = headerBytes.length;
  36508. } catch (ex) {}
  36509. if (headerBytesLength === suggestedLength) {
  36510. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  36511. if (block.found && block.length === suggestedLength) {
  36512. return {
  36513. stream: new _stream.Stream(headerBytes),
  36514. length: suggestedLength
  36515. };
  36516. }
  36517. }
  36518. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  36519. stream.pos = streamStartPos;
  36520. const SCAN_BLOCK_LENGTH = 2048;
  36521. let actualLength;
  36522. while (true) {
  36523. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  36524. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  36525. if (block.length === 0) {
  36526. break;
  36527. }
  36528. stream.pos += block.length;
  36529. if (block.found) {
  36530. actualLength = stream.pos - streamStartPos;
  36531. break;
  36532. }
  36533. }
  36534. stream.pos = streamStartPos;
  36535. if (actualLength) {
  36536. return {
  36537. stream: new _stream.Stream(stream.getBytes(actualLength)),
  36538. length: actualLength
  36539. };
  36540. }
  36541. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  36542. return {
  36543. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  36544. length: suggestedLength
  36545. };
  36546. }
  36547. function getEexecBlock(stream, suggestedLength) {
  36548. const eexecBytes = stream.getBytes();
  36549. return {
  36550. stream: new _stream.Stream(eexecBytes),
  36551. length: eexecBytes.length
  36552. };
  36553. }
  36554. class Type1Font {
  36555. constructor(name, file, properties) {
  36556. const PFB_HEADER_SIZE = 6;
  36557. let headerBlockLength = properties.length1;
  36558. let eexecBlockLength = properties.length2;
  36559. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  36560. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  36561. if (pfbHeaderPresent) {
  36562. file.skip(PFB_HEADER_SIZE);
  36563. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  36564. }
  36565. const headerBlock = getHeaderBlock(file, headerBlockLength);
  36566. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  36567. headerBlockParser.extractFontHeader(properties);
  36568. if (pfbHeaderPresent) {
  36569. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  36570. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  36571. }
  36572. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  36573. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  36574. const data = eexecBlockParser.extractFontProgram(properties);
  36575. for (const key in data.properties) {
  36576. properties[key] = data.properties[key];
  36577. }
  36578. const charstrings = data.charstrings;
  36579. const type2Charstrings = this.getType2Charstrings(charstrings);
  36580. const subrs = this.getType2Subrs(data.subrs);
  36581. this.charstrings = charstrings;
  36582. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  36583. this.seacs = this.getSeacs(data.charstrings);
  36584. }
  36585. get numGlyphs() {
  36586. return this.charstrings.length + 1;
  36587. }
  36588. getCharset() {
  36589. const charset = [".notdef"];
  36590. const charstrings = this.charstrings;
  36591. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  36592. charset.push(charstrings[glyphId].glyphName);
  36593. }
  36594. return charset;
  36595. }
  36596. getGlyphMapping(properties) {
  36597. const charstrings = this.charstrings;
  36598. if (properties.composite) {
  36599. const charCodeToGlyphId = Object.create(null);
  36600. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  36601. const charCode = properties.cMap.charCodeOf(glyphId);
  36602. charCodeToGlyphId[charCode] = glyphId + 1;
  36603. }
  36604. return charCodeToGlyphId;
  36605. }
  36606. const glyphNames = [".notdef"];
  36607. let builtInEncoding, glyphId;
  36608. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  36609. glyphNames.push(charstrings[glyphId].glyphName);
  36610. }
  36611. const encoding = properties.builtInEncoding;
  36612. if (encoding) {
  36613. builtInEncoding = Object.create(null);
  36614. for (const charCode in encoding) {
  36615. glyphId = glyphNames.indexOf(encoding[charCode]);
  36616. if (glyphId >= 0) {
  36617. builtInEncoding[charCode] = glyphId;
  36618. }
  36619. }
  36620. }
  36621. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  36622. }
  36623. hasGlyphId(id) {
  36624. if (id < 0 || id >= this.numGlyphs) {
  36625. return false;
  36626. }
  36627. if (id === 0) {
  36628. return true;
  36629. }
  36630. const glyph = this.charstrings[id - 1];
  36631. return glyph.charstring.length > 0;
  36632. }
  36633. getSeacs(charstrings) {
  36634. const seacMap = [];
  36635. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  36636. const charstring = charstrings[i];
  36637. if (charstring.seac) {
  36638. seacMap[i + 1] = charstring.seac;
  36639. }
  36640. }
  36641. return seacMap;
  36642. }
  36643. getType2Charstrings(type1Charstrings) {
  36644. const type2Charstrings = [];
  36645. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  36646. type2Charstrings.push(type1Charstrings[i].charstring);
  36647. }
  36648. return type2Charstrings;
  36649. }
  36650. getType2Subrs(type1Subrs) {
  36651. let bias = 0;
  36652. const count = type1Subrs.length;
  36653. if (count < 1133) {
  36654. bias = 107;
  36655. } else if (count < 33769) {
  36656. bias = 1131;
  36657. } else {
  36658. bias = 32768;
  36659. }
  36660. const type2Subrs = [];
  36661. let i;
  36662. for (i = 0; i < bias; i++) {
  36663. type2Subrs.push([0x0b]);
  36664. }
  36665. for (i = 0; i < count; i++) {
  36666. type2Subrs.push(type1Subrs[i]);
  36667. }
  36668. return type2Subrs;
  36669. }
  36670. wrap(name, glyphs, charstrings, subrs, properties) {
  36671. const cff = new _cff_parser.CFF();
  36672. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  36673. cff.names = [name];
  36674. const topDict = new _cff_parser.CFFTopDict();
  36675. topDict.setByName("version", 391);
  36676. topDict.setByName("Notice", 392);
  36677. topDict.setByName("FullName", 393);
  36678. topDict.setByName("FamilyName", 394);
  36679. topDict.setByName("Weight", 395);
  36680. topDict.setByName("Encoding", null);
  36681. topDict.setByName("FontMatrix", properties.fontMatrix);
  36682. topDict.setByName("FontBBox", properties.bbox);
  36683. topDict.setByName("charset", null);
  36684. topDict.setByName("CharStrings", null);
  36685. topDict.setByName("Private", null);
  36686. cff.topDict = topDict;
  36687. const strings = new _cff_parser.CFFStrings();
  36688. strings.add("Version 0.11");
  36689. strings.add("See original notice");
  36690. strings.add(name);
  36691. strings.add(name);
  36692. strings.add("Medium");
  36693. cff.strings = strings;
  36694. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  36695. const count = glyphs.length;
  36696. const charsetArray = [".notdef"];
  36697. let i, ii;
  36698. for (i = 0; i < count; i++) {
  36699. const glyphName = charstrings[i].glyphName;
  36700. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  36701. if (index === -1) {
  36702. strings.add(glyphName);
  36703. }
  36704. charsetArray.push(glyphName);
  36705. }
  36706. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  36707. const charStringsIndex = new _cff_parser.CFFIndex();
  36708. charStringsIndex.add([0x8b, 0x0e]);
  36709. for (i = 0; i < count; i++) {
  36710. charStringsIndex.add(glyphs[i]);
  36711. }
  36712. cff.charStrings = charStringsIndex;
  36713. const privateDict = new _cff_parser.CFFPrivateDict();
  36714. privateDict.setByName("Subrs", null);
  36715. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  36716. for (i = 0, ii = fields.length; i < ii; i++) {
  36717. const field = fields[i];
  36718. if (!(field in properties.privateData)) {
  36719. continue;
  36720. }
  36721. const value = properties.privateData[field];
  36722. if (Array.isArray(value)) {
  36723. for (let j = value.length - 1; j > 0; j--) {
  36724. value[j] -= value[j - 1];
  36725. }
  36726. }
  36727. privateDict.setByName(field, value);
  36728. }
  36729. cff.topDict.privateDict = privateDict;
  36730. const subrIndex = new _cff_parser.CFFIndex();
  36731. for (i = 0, ii = subrs.length; i < ii; i++) {
  36732. subrIndex.add(subrs[i]);
  36733. }
  36734. privateDict.subrsIndex = subrIndex;
  36735. const compiler = new _cff_parser.CFFCompiler(cff);
  36736. return compiler.compile();
  36737. }
  36738. }
  36739. exports.Type1Font = Type1Font;
  36740. /***/ }),
  36741. /* 47 */
  36742. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36743. Object.defineProperty(exports, "__esModule", ({
  36744. value: true
  36745. }));
  36746. exports.Type1Parser = void 0;
  36747. var _encodings = __w_pdfjs_require__(37);
  36748. var _core_utils = __w_pdfjs_require__(9);
  36749. var _stream = __w_pdfjs_require__(10);
  36750. var _util = __w_pdfjs_require__(2);
  36751. const HINTING_ENABLED = false;
  36752. const Type1CharString = function Type1CharStringClosure() {
  36753. const COMMAND_MAP = {
  36754. hstem: [1],
  36755. vstem: [3],
  36756. vmoveto: [4],
  36757. rlineto: [5],
  36758. hlineto: [6],
  36759. vlineto: [7],
  36760. rrcurveto: [8],
  36761. callsubr: [10],
  36762. flex: [12, 35],
  36763. drop: [12, 18],
  36764. endchar: [14],
  36765. rmoveto: [21],
  36766. hmoveto: [22],
  36767. vhcurveto: [30],
  36768. hvcurveto: [31]
  36769. };
  36770. class Type1CharString {
  36771. constructor() {
  36772. this.width = 0;
  36773. this.lsb = 0;
  36774. this.flexing = false;
  36775. this.output = [];
  36776. this.stack = [];
  36777. }
  36778. convert(encoded, subrs, seacAnalysisEnabled) {
  36779. const count = encoded.length;
  36780. let error = false;
  36781. let wx, sbx, subrNumber;
  36782. for (let i = 0; i < count; i++) {
  36783. let value = encoded[i];
  36784. if (value < 32) {
  36785. if (value === 12) {
  36786. value = (value << 8) + encoded[++i];
  36787. }
  36788. switch (value) {
  36789. case 1:
  36790. if (!HINTING_ENABLED) {
  36791. this.stack = [];
  36792. break;
  36793. }
  36794. error = this.executeCommand(2, COMMAND_MAP.hstem);
  36795. break;
  36796. case 3:
  36797. if (!HINTING_ENABLED) {
  36798. this.stack = [];
  36799. break;
  36800. }
  36801. error = this.executeCommand(2, COMMAND_MAP.vstem);
  36802. break;
  36803. case 4:
  36804. if (this.flexing) {
  36805. if (this.stack.length < 1) {
  36806. error = true;
  36807. break;
  36808. }
  36809. const dy = this.stack.pop();
  36810. this.stack.push(0, dy);
  36811. break;
  36812. }
  36813. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  36814. break;
  36815. case 5:
  36816. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  36817. break;
  36818. case 6:
  36819. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  36820. break;
  36821. case 7:
  36822. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  36823. break;
  36824. case 8:
  36825. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  36826. break;
  36827. case 9:
  36828. this.stack = [];
  36829. break;
  36830. case 10:
  36831. if (this.stack.length < 1) {
  36832. error = true;
  36833. break;
  36834. }
  36835. subrNumber = this.stack.pop();
  36836. if (!subrs[subrNumber]) {
  36837. error = true;
  36838. break;
  36839. }
  36840. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  36841. break;
  36842. case 11:
  36843. return error;
  36844. case 13:
  36845. if (this.stack.length < 2) {
  36846. error = true;
  36847. break;
  36848. }
  36849. wx = this.stack.pop();
  36850. sbx = this.stack.pop();
  36851. this.lsb = sbx;
  36852. this.width = wx;
  36853. this.stack.push(wx, sbx);
  36854. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  36855. break;
  36856. case 14:
  36857. this.output.push(COMMAND_MAP.endchar[0]);
  36858. break;
  36859. case 21:
  36860. if (this.flexing) {
  36861. break;
  36862. }
  36863. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  36864. break;
  36865. case 22:
  36866. if (this.flexing) {
  36867. this.stack.push(0);
  36868. break;
  36869. }
  36870. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  36871. break;
  36872. case 30:
  36873. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  36874. break;
  36875. case 31:
  36876. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  36877. break;
  36878. case (12 << 8) + 0:
  36879. this.stack = [];
  36880. break;
  36881. case (12 << 8) + 1:
  36882. if (!HINTING_ENABLED) {
  36883. this.stack = [];
  36884. break;
  36885. }
  36886. error = this.executeCommand(2, COMMAND_MAP.vstem);
  36887. break;
  36888. case (12 << 8) + 2:
  36889. if (!HINTING_ENABLED) {
  36890. this.stack = [];
  36891. break;
  36892. }
  36893. error = this.executeCommand(2, COMMAND_MAP.hstem);
  36894. break;
  36895. case (12 << 8) + 6:
  36896. if (seacAnalysisEnabled) {
  36897. const asb = this.stack[this.stack.length - 5];
  36898. this.seac = this.stack.splice(-4, 4);
  36899. this.seac[0] += this.lsb - asb;
  36900. error = this.executeCommand(0, COMMAND_MAP.endchar);
  36901. } else {
  36902. error = this.executeCommand(4, COMMAND_MAP.endchar);
  36903. }
  36904. break;
  36905. case (12 << 8) + 7:
  36906. if (this.stack.length < 4) {
  36907. error = true;
  36908. break;
  36909. }
  36910. this.stack.pop();
  36911. wx = this.stack.pop();
  36912. const sby = this.stack.pop();
  36913. sbx = this.stack.pop();
  36914. this.lsb = sbx;
  36915. this.width = wx;
  36916. this.stack.push(wx, sbx, sby);
  36917. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  36918. break;
  36919. case (12 << 8) + 12:
  36920. if (this.stack.length < 2) {
  36921. error = true;
  36922. break;
  36923. }
  36924. const num2 = this.stack.pop();
  36925. const num1 = this.stack.pop();
  36926. this.stack.push(num1 / num2);
  36927. break;
  36928. case (12 << 8) + 16:
  36929. if (this.stack.length < 2) {
  36930. error = true;
  36931. break;
  36932. }
  36933. subrNumber = this.stack.pop();
  36934. const numArgs = this.stack.pop();
  36935. if (subrNumber === 0 && numArgs === 3) {
  36936. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  36937. 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]);
  36938. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  36939. this.flexing = false;
  36940. this.stack.push(flexArgs[15], flexArgs[16]);
  36941. } else if (subrNumber === 1 && numArgs === 0) {
  36942. this.flexing = true;
  36943. }
  36944. break;
  36945. case (12 << 8) + 17:
  36946. break;
  36947. case (12 << 8) + 33:
  36948. this.stack = [];
  36949. break;
  36950. default:
  36951. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  36952. break;
  36953. }
  36954. if (error) {
  36955. break;
  36956. }
  36957. continue;
  36958. } else if (value <= 246) {
  36959. value = value - 139;
  36960. } else if (value <= 250) {
  36961. value = (value - 247) * 256 + encoded[++i] + 108;
  36962. } else if (value <= 254) {
  36963. value = -((value - 251) * 256) - encoded[++i] - 108;
  36964. } else {
  36965. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  36966. }
  36967. this.stack.push(value);
  36968. }
  36969. return error;
  36970. }
  36971. executeCommand(howManyArgs, command, keepStack) {
  36972. const stackLength = this.stack.length;
  36973. if (howManyArgs > stackLength) {
  36974. return true;
  36975. }
  36976. const start = stackLength - howManyArgs;
  36977. for (let i = start; i < stackLength; i++) {
  36978. let value = this.stack[i];
  36979. if (Number.isInteger(value)) {
  36980. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  36981. } else {
  36982. value = 65536 * value | 0;
  36983. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  36984. }
  36985. }
  36986. this.output.push.apply(this.output, command);
  36987. if (keepStack) {
  36988. this.stack.splice(start, howManyArgs);
  36989. } else {
  36990. this.stack.length = 0;
  36991. }
  36992. return false;
  36993. }
  36994. }
  36995. return Type1CharString;
  36996. }();
  36997. const Type1Parser = function Type1ParserClosure() {
  36998. const EEXEC_ENCRYPT_KEY = 55665;
  36999. const CHAR_STRS_ENCRYPT_KEY = 4330;
  37000. function isHexDigit(code) {
  37001. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  37002. }
  37003. function decrypt(data, key, discardNumber) {
  37004. if (discardNumber >= data.length) {
  37005. return new Uint8Array(0);
  37006. }
  37007. const c1 = 52845,
  37008. c2 = 22719;
  37009. let r = key | 0,
  37010. i,
  37011. j;
  37012. for (i = 0; i < discardNumber; i++) {
  37013. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  37014. }
  37015. const count = data.length - discardNumber;
  37016. const decrypted = new Uint8Array(count);
  37017. for (i = discardNumber, j = 0; j < count; i++, j++) {
  37018. const value = data[i];
  37019. decrypted[j] = value ^ r >> 8;
  37020. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  37021. }
  37022. return decrypted;
  37023. }
  37024. function decryptAscii(data, key, discardNumber) {
  37025. const c1 = 52845,
  37026. c2 = 22719;
  37027. let r = key | 0;
  37028. const count = data.length,
  37029. maybeLength = count >>> 1;
  37030. const decrypted = new Uint8Array(maybeLength);
  37031. let i, j;
  37032. for (i = 0, j = 0; i < count; i++) {
  37033. const digit1 = data[i];
  37034. if (!isHexDigit(digit1)) {
  37035. continue;
  37036. }
  37037. i++;
  37038. let digit2;
  37039. while (i < count && !isHexDigit(digit2 = data[i])) {
  37040. i++;
  37041. }
  37042. if (i < count) {
  37043. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  37044. decrypted[j++] = value ^ r >> 8;
  37045. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  37046. }
  37047. }
  37048. return decrypted.slice(discardNumber, j);
  37049. }
  37050. function isSpecial(c) {
  37051. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  37052. }
  37053. class Type1Parser {
  37054. constructor(stream, encrypted, seacAnalysisEnabled) {
  37055. if (encrypted) {
  37056. const data = stream.getBytes();
  37057. 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]));
  37058. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  37059. }
  37060. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  37061. this.stream = stream;
  37062. this.nextChar();
  37063. }
  37064. readNumberArray() {
  37065. this.getToken();
  37066. const array = [];
  37067. while (true) {
  37068. const token = this.getToken();
  37069. if (token === null || token === "]" || token === "}") {
  37070. break;
  37071. }
  37072. array.push(parseFloat(token || 0));
  37073. }
  37074. return array;
  37075. }
  37076. readNumber() {
  37077. const token = this.getToken();
  37078. return parseFloat(token || 0);
  37079. }
  37080. readInt() {
  37081. const token = this.getToken();
  37082. return parseInt(token || 0, 10) | 0;
  37083. }
  37084. readBoolean() {
  37085. const token = this.getToken();
  37086. return token === "true" ? 1 : 0;
  37087. }
  37088. nextChar() {
  37089. return this.currentChar = this.stream.getByte();
  37090. }
  37091. getToken() {
  37092. let comment = false;
  37093. let ch = this.currentChar;
  37094. while (true) {
  37095. if (ch === -1) {
  37096. return null;
  37097. }
  37098. if (comment) {
  37099. if (ch === 0x0a || ch === 0x0d) {
  37100. comment = false;
  37101. }
  37102. } else if (ch === 0x25) {
  37103. comment = true;
  37104. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  37105. break;
  37106. }
  37107. ch = this.nextChar();
  37108. }
  37109. if (isSpecial(ch)) {
  37110. this.nextChar();
  37111. return String.fromCharCode(ch);
  37112. }
  37113. let token = "";
  37114. do {
  37115. token += String.fromCharCode(ch);
  37116. ch = this.nextChar();
  37117. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  37118. return token;
  37119. }
  37120. readCharStrings(bytes, lenIV) {
  37121. if (lenIV === -1) {
  37122. return bytes;
  37123. }
  37124. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  37125. }
  37126. extractFontProgram(properties) {
  37127. const stream = this.stream;
  37128. const subrs = [],
  37129. charstrings = [];
  37130. const privateData = Object.create(null);
  37131. privateData.lenIV = 4;
  37132. const program = {
  37133. subrs: [],
  37134. charstrings: [],
  37135. properties: {
  37136. privateData
  37137. }
  37138. };
  37139. let token, length, data, lenIV, encoded;
  37140. while ((token = this.getToken()) !== null) {
  37141. if (token !== "/") {
  37142. continue;
  37143. }
  37144. token = this.getToken();
  37145. switch (token) {
  37146. case "CharStrings":
  37147. this.getToken();
  37148. this.getToken();
  37149. this.getToken();
  37150. this.getToken();
  37151. while (true) {
  37152. token = this.getToken();
  37153. if (token === null || token === "end") {
  37154. break;
  37155. }
  37156. if (token !== "/") {
  37157. continue;
  37158. }
  37159. const glyph = this.getToken();
  37160. length = this.readInt();
  37161. this.getToken();
  37162. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  37163. lenIV = program.properties.privateData.lenIV;
  37164. encoded = this.readCharStrings(data, lenIV);
  37165. this.nextChar();
  37166. token = this.getToken();
  37167. if (token === "noaccess") {
  37168. this.getToken();
  37169. }
  37170. charstrings.push({
  37171. glyph,
  37172. encoded
  37173. });
  37174. }
  37175. break;
  37176. case "Subrs":
  37177. this.readInt();
  37178. this.getToken();
  37179. while (this.getToken() === "dup") {
  37180. const index = this.readInt();
  37181. length = this.readInt();
  37182. this.getToken();
  37183. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  37184. lenIV = program.properties.privateData.lenIV;
  37185. encoded = this.readCharStrings(data, lenIV);
  37186. this.nextChar();
  37187. token = this.getToken();
  37188. if (token === "noaccess") {
  37189. this.getToken();
  37190. }
  37191. subrs[index] = encoded;
  37192. }
  37193. break;
  37194. case "BlueValues":
  37195. case "OtherBlues":
  37196. case "FamilyBlues":
  37197. case "FamilyOtherBlues":
  37198. const blueArray = this.readNumberArray();
  37199. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  37200. program.properties.privateData[token] = blueArray;
  37201. }
  37202. break;
  37203. case "StemSnapH":
  37204. case "StemSnapV":
  37205. program.properties.privateData[token] = this.readNumberArray();
  37206. break;
  37207. case "StdHW":
  37208. case "StdVW":
  37209. program.properties.privateData[token] = this.readNumberArray()[0];
  37210. break;
  37211. case "BlueShift":
  37212. case "lenIV":
  37213. case "BlueFuzz":
  37214. case "BlueScale":
  37215. case "LanguageGroup":
  37216. case "ExpansionFactor":
  37217. program.properties.privateData[token] = this.readNumber();
  37218. break;
  37219. case "ForceBold":
  37220. program.properties.privateData[token] = this.readBoolean();
  37221. break;
  37222. }
  37223. }
  37224. for (let i = 0; i < charstrings.length; i++) {
  37225. const glyph = charstrings[i].glyph;
  37226. encoded = charstrings[i].encoded;
  37227. const charString = new Type1CharString();
  37228. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  37229. let output = charString.output;
  37230. if (error) {
  37231. output = [14];
  37232. }
  37233. const charStringObject = {
  37234. glyphName: glyph,
  37235. charstring: output,
  37236. width: charString.width,
  37237. lsb: charString.lsb,
  37238. seac: charString.seac
  37239. };
  37240. if (glyph === ".notdef") {
  37241. program.charstrings.unshift(charStringObject);
  37242. } else {
  37243. program.charstrings.push(charStringObject);
  37244. }
  37245. if (properties.builtInEncoding) {
  37246. const index = properties.builtInEncoding.indexOf(glyph);
  37247. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  37248. properties.widths[index] = charString.width;
  37249. }
  37250. }
  37251. }
  37252. return program;
  37253. }
  37254. extractFontHeader(properties) {
  37255. let token;
  37256. while ((token = this.getToken()) !== null) {
  37257. if (token !== "/") {
  37258. continue;
  37259. }
  37260. token = this.getToken();
  37261. switch (token) {
  37262. case "FontMatrix":
  37263. const matrix = this.readNumberArray();
  37264. properties.fontMatrix = matrix;
  37265. break;
  37266. case "Encoding":
  37267. const encodingArg = this.getToken();
  37268. let encoding;
  37269. if (!/^\d+$/.test(encodingArg)) {
  37270. encoding = (0, _encodings.getEncoding)(encodingArg);
  37271. } else {
  37272. encoding = [];
  37273. const size = parseInt(encodingArg, 10) | 0;
  37274. this.getToken();
  37275. for (let j = 0; j < size; j++) {
  37276. token = this.getToken();
  37277. while (token !== "dup" && token !== "def") {
  37278. token = this.getToken();
  37279. if (token === null) {
  37280. return;
  37281. }
  37282. }
  37283. if (token === "def") {
  37284. break;
  37285. }
  37286. const index = this.readInt();
  37287. this.getToken();
  37288. const glyph = this.getToken();
  37289. encoding[index] = glyph;
  37290. this.getToken();
  37291. }
  37292. }
  37293. properties.builtInEncoding = encoding;
  37294. break;
  37295. case "FontBBox":
  37296. const fontBBox = this.readNumberArray();
  37297. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  37298. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  37299. properties.ascentScaled = true;
  37300. break;
  37301. }
  37302. }
  37303. }
  37304. }
  37305. return Type1Parser;
  37306. }();
  37307. exports.Type1Parser = Type1Parser;
  37308. /***/ }),
  37309. /* 48 */
  37310. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37311. Object.defineProperty(exports, "__esModule", ({
  37312. value: true
  37313. }));
  37314. exports.getTilingPatternIR = getTilingPatternIR;
  37315. exports.Pattern = void 0;
  37316. var _util = __w_pdfjs_require__(2);
  37317. var _colorspace = __w_pdfjs_require__(14);
  37318. var _primitives = __w_pdfjs_require__(5);
  37319. var _core_utils = __w_pdfjs_require__(9);
  37320. const ShadingType = {
  37321. FUNCTION_BASED: 1,
  37322. AXIAL: 2,
  37323. RADIAL: 3,
  37324. FREE_FORM_MESH: 4,
  37325. LATTICE_FORM_MESH: 5,
  37326. COONS_PATCH_MESH: 6,
  37327. TENSOR_PATCH_MESH: 7
  37328. };
  37329. class Pattern {
  37330. constructor() {
  37331. (0, _util.unreachable)("Cannot initialize Pattern.");
  37332. }
  37333. static parseShading(shading, matrix, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  37334. const dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  37335. const type = dict.get("ShadingType");
  37336. try {
  37337. switch (type) {
  37338. case ShadingType.AXIAL:
  37339. case ShadingType.RADIAL:
  37340. return new RadialAxialShading(dict, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  37341. case ShadingType.FREE_FORM_MESH:
  37342. case ShadingType.LATTICE_FORM_MESH:
  37343. case ShadingType.COONS_PATCH_MESH:
  37344. case ShadingType.TENSOR_PATCH_MESH:
  37345. return new MeshShading(shading, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  37346. default:
  37347. throw new _util.FormatError("Unsupported ShadingType: " + type);
  37348. }
  37349. } catch (ex) {
  37350. if (ex instanceof _core_utils.MissingDataException) {
  37351. throw ex;
  37352. }
  37353. handler.send("UnsupportedFeature", {
  37354. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  37355. });
  37356. (0, _util.warn)(ex);
  37357. return new DummyShading();
  37358. }
  37359. }
  37360. }
  37361. exports.Pattern = Pattern;
  37362. class BaseShading {
  37363. static get SMALL_NUMBER() {
  37364. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  37365. }
  37366. constructor() {
  37367. if (this.constructor === BaseShading) {
  37368. (0, _util.unreachable)("Cannot initialize BaseShading.");
  37369. }
  37370. }
  37371. getIR() {
  37372. (0, _util.unreachable)("Abstract method `getIR` called.");
  37373. }
  37374. }
  37375. class RadialAxialShading extends BaseShading {
  37376. constructor(dict, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  37377. super();
  37378. this.matrix = matrix;
  37379. this.coordsArr = dict.getArray("Coords");
  37380. this.shadingType = dict.get("ShadingType");
  37381. const cs = _colorspace.ColorSpace.parse({
  37382. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  37383. xref,
  37384. resources,
  37385. pdfFunctionFactory,
  37386. localColorSpaceCache
  37387. });
  37388. const bbox = dict.getArray("BBox");
  37389. if (Array.isArray(bbox) && bbox.length === 4) {
  37390. this.bbox = _util.Util.normalizeRect(bbox);
  37391. } else {
  37392. this.bbox = null;
  37393. }
  37394. let t0 = 0.0,
  37395. t1 = 1.0;
  37396. if (dict.has("Domain")) {
  37397. const domainArr = dict.getArray("Domain");
  37398. t0 = domainArr[0];
  37399. t1 = domainArr[1];
  37400. }
  37401. let extendStart = false,
  37402. extendEnd = false;
  37403. if (dict.has("Extend")) {
  37404. const extendArr = dict.getArray("Extend");
  37405. extendStart = extendArr[0];
  37406. extendEnd = extendArr[1];
  37407. }
  37408. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  37409. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  37410. const distance = Math.hypot(x1 - x2, y1 - y2);
  37411. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  37412. (0, _util.warn)("Unsupported radial gradient.");
  37413. }
  37414. }
  37415. this.extendStart = extendStart;
  37416. this.extendEnd = extendEnd;
  37417. const fnObj = dict.getRaw("Function");
  37418. const fn = pdfFunctionFactory.createFromArray(fnObj);
  37419. const NUMBER_OF_SAMPLES = 10;
  37420. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  37421. const colorStops = this.colorStops = [];
  37422. if (t0 >= t1 || step <= 0) {
  37423. (0, _util.info)("Bad shading domain.");
  37424. return;
  37425. }
  37426. const color = new Float32Array(cs.numComps),
  37427. ratio = new Float32Array(1);
  37428. let rgbColor;
  37429. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  37430. ratio[0] = t0 + i * step;
  37431. fn(ratio, 0, color, 0);
  37432. rgbColor = cs.getRgb(color, 0);
  37433. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  37434. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  37435. }
  37436. let background = "transparent";
  37437. if (dict.has("Background")) {
  37438. rgbColor = cs.getRgb(dict.get("Background"), 0);
  37439. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  37440. }
  37441. if (!extendStart) {
  37442. colorStops.unshift([0, background]);
  37443. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  37444. }
  37445. if (!extendEnd) {
  37446. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  37447. colorStops.push([1, background]);
  37448. }
  37449. this.colorStops = colorStops;
  37450. }
  37451. getIR() {
  37452. const coordsArr = this.coordsArr;
  37453. const shadingType = this.shadingType;
  37454. let type, p0, p1, r0, r1;
  37455. if (shadingType === ShadingType.AXIAL) {
  37456. p0 = [coordsArr[0], coordsArr[1]];
  37457. p1 = [coordsArr[2], coordsArr[3]];
  37458. r0 = null;
  37459. r1 = null;
  37460. type = "axial";
  37461. } else if (shadingType === ShadingType.RADIAL) {
  37462. p0 = [coordsArr[0], coordsArr[1]];
  37463. p1 = [coordsArr[3], coordsArr[4]];
  37464. r0 = coordsArr[2];
  37465. r1 = coordsArr[5];
  37466. type = "radial";
  37467. } else {
  37468. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  37469. }
  37470. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1, this.matrix];
  37471. }
  37472. }
  37473. class MeshStreamReader {
  37474. constructor(stream, context) {
  37475. this.stream = stream;
  37476. this.context = context;
  37477. this.buffer = 0;
  37478. this.bufferLength = 0;
  37479. const numComps = context.numComps;
  37480. this.tmpCompsBuf = new Float32Array(numComps);
  37481. const csNumComps = context.colorSpace.numComps;
  37482. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  37483. }
  37484. get hasData() {
  37485. if (this.stream.end) {
  37486. return this.stream.pos < this.stream.end;
  37487. }
  37488. if (this.bufferLength > 0) {
  37489. return true;
  37490. }
  37491. const nextByte = this.stream.getByte();
  37492. if (nextByte < 0) {
  37493. return false;
  37494. }
  37495. this.buffer = nextByte;
  37496. this.bufferLength = 8;
  37497. return true;
  37498. }
  37499. readBits(n) {
  37500. let buffer = this.buffer;
  37501. let bufferLength = this.bufferLength;
  37502. if (n === 32) {
  37503. if (bufferLength === 0) {
  37504. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  37505. }
  37506. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  37507. const nextByte = this.stream.getByte();
  37508. this.buffer = nextByte & (1 << bufferLength) - 1;
  37509. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  37510. }
  37511. if (n === 8 && bufferLength === 0) {
  37512. return this.stream.getByte();
  37513. }
  37514. while (bufferLength < n) {
  37515. buffer = buffer << 8 | this.stream.getByte();
  37516. bufferLength += 8;
  37517. }
  37518. bufferLength -= n;
  37519. this.bufferLength = bufferLength;
  37520. this.buffer = buffer & (1 << bufferLength) - 1;
  37521. return buffer >> bufferLength;
  37522. }
  37523. align() {
  37524. this.buffer = 0;
  37525. this.bufferLength = 0;
  37526. }
  37527. readFlag() {
  37528. return this.readBits(this.context.bitsPerFlag);
  37529. }
  37530. readCoordinate() {
  37531. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  37532. const xi = this.readBits(bitsPerCoordinate);
  37533. const yi = this.readBits(bitsPerCoordinate);
  37534. const decode = this.context.decode;
  37535. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  37536. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  37537. }
  37538. readComponents() {
  37539. const numComps = this.context.numComps;
  37540. const bitsPerComponent = this.context.bitsPerComponent;
  37541. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  37542. const decode = this.context.decode;
  37543. const components = this.tmpCompsBuf;
  37544. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  37545. const ci = this.readBits(bitsPerComponent);
  37546. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  37547. }
  37548. const color = this.tmpCsCompsBuf;
  37549. if (this.context.colorFn) {
  37550. this.context.colorFn(components, 0, color, 0);
  37551. }
  37552. return this.context.colorSpace.getRgb(color, 0);
  37553. }
  37554. }
  37555. const getB = function getBClosure() {
  37556. function buildB(count) {
  37557. const lut = [];
  37558. for (let i = 0; i <= count; i++) {
  37559. const t = i / count,
  37560. t_ = 1 - t;
  37561. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  37562. }
  37563. return lut;
  37564. }
  37565. const cache = [];
  37566. return function (count) {
  37567. if (!cache[count]) {
  37568. cache[count] = buildB(count);
  37569. }
  37570. return cache[count];
  37571. };
  37572. }();
  37573. class MeshShading extends BaseShading {
  37574. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  37575. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  37576. }
  37577. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  37578. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  37579. }
  37580. static get TRIANGLE_DENSITY() {
  37581. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  37582. }
  37583. constructor(stream, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  37584. super();
  37585. if (!(0, _primitives.isStream)(stream)) {
  37586. throw new _util.FormatError("Mesh data is not a stream");
  37587. }
  37588. const dict = stream.dict;
  37589. this.matrix = matrix;
  37590. this.shadingType = dict.get("ShadingType");
  37591. const bbox = dict.getArray("BBox");
  37592. if (Array.isArray(bbox) && bbox.length === 4) {
  37593. this.bbox = _util.Util.normalizeRect(bbox);
  37594. } else {
  37595. this.bbox = null;
  37596. }
  37597. const cs = _colorspace.ColorSpace.parse({
  37598. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  37599. xref,
  37600. resources,
  37601. pdfFunctionFactory,
  37602. localColorSpaceCache
  37603. });
  37604. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  37605. const fnObj = dict.getRaw("Function");
  37606. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  37607. this.coords = [];
  37608. this.colors = [];
  37609. this.figures = [];
  37610. const decodeContext = {
  37611. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  37612. bitsPerComponent: dict.get("BitsPerComponent"),
  37613. bitsPerFlag: dict.get("BitsPerFlag"),
  37614. decode: dict.getArray("Decode"),
  37615. colorFn: fn,
  37616. colorSpace: cs,
  37617. numComps: fn ? 1 : cs.numComps
  37618. };
  37619. const reader = new MeshStreamReader(stream, decodeContext);
  37620. let patchMesh = false;
  37621. switch (this.shadingType) {
  37622. case ShadingType.FREE_FORM_MESH:
  37623. this._decodeType4Shading(reader);
  37624. break;
  37625. case ShadingType.LATTICE_FORM_MESH:
  37626. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  37627. if (verticesPerRow < 2) {
  37628. throw new _util.FormatError("Invalid VerticesPerRow");
  37629. }
  37630. this._decodeType5Shading(reader, verticesPerRow);
  37631. break;
  37632. case ShadingType.COONS_PATCH_MESH:
  37633. this._decodeType6Shading(reader);
  37634. patchMesh = true;
  37635. break;
  37636. case ShadingType.TENSOR_PATCH_MESH:
  37637. this._decodeType7Shading(reader);
  37638. patchMesh = true;
  37639. break;
  37640. default:
  37641. (0, _util.unreachable)("Unsupported mesh type.");
  37642. break;
  37643. }
  37644. if (patchMesh) {
  37645. this._updateBounds();
  37646. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  37647. this._buildFigureFromPatch(i);
  37648. }
  37649. }
  37650. this._updateBounds();
  37651. this._packData();
  37652. }
  37653. _decodeType4Shading(reader) {
  37654. const coords = this.coords;
  37655. const colors = this.colors;
  37656. const operators = [];
  37657. const ps = [];
  37658. let verticesLeft = 0;
  37659. while (reader.hasData) {
  37660. const f = reader.readFlag();
  37661. const coord = reader.readCoordinate();
  37662. const color = reader.readComponents();
  37663. if (verticesLeft === 0) {
  37664. if (!(0 <= f && f <= 2)) {
  37665. throw new _util.FormatError("Unknown type4 flag");
  37666. }
  37667. switch (f) {
  37668. case 0:
  37669. verticesLeft = 3;
  37670. break;
  37671. case 1:
  37672. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  37673. verticesLeft = 1;
  37674. break;
  37675. case 2:
  37676. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  37677. verticesLeft = 1;
  37678. break;
  37679. }
  37680. operators.push(f);
  37681. }
  37682. ps.push(coords.length);
  37683. coords.push(coord);
  37684. colors.push(color);
  37685. verticesLeft--;
  37686. reader.align();
  37687. }
  37688. this.figures.push({
  37689. type: "triangles",
  37690. coords: new Int32Array(ps),
  37691. colors: new Int32Array(ps)
  37692. });
  37693. }
  37694. _decodeType5Shading(reader, verticesPerRow) {
  37695. const coords = this.coords;
  37696. const colors = this.colors;
  37697. const ps = [];
  37698. while (reader.hasData) {
  37699. const coord = reader.readCoordinate();
  37700. const color = reader.readComponents();
  37701. ps.push(coords.length);
  37702. coords.push(coord);
  37703. colors.push(color);
  37704. }
  37705. this.figures.push({
  37706. type: "lattice",
  37707. coords: new Int32Array(ps),
  37708. colors: new Int32Array(ps),
  37709. verticesPerRow
  37710. });
  37711. }
  37712. _decodeType6Shading(reader) {
  37713. const coords = this.coords;
  37714. const colors = this.colors;
  37715. const ps = new Int32Array(16);
  37716. const cs = new Int32Array(4);
  37717. while (reader.hasData) {
  37718. const f = reader.readFlag();
  37719. if (!(0 <= f && f <= 3)) {
  37720. throw new _util.FormatError("Unknown type6 flag");
  37721. }
  37722. const pi = coords.length;
  37723. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  37724. coords.push(reader.readCoordinate());
  37725. }
  37726. const ci = colors.length;
  37727. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  37728. colors.push(reader.readComponents());
  37729. }
  37730. let tmp1, tmp2, tmp3, tmp4;
  37731. switch (f) {
  37732. case 0:
  37733. ps[12] = pi + 3;
  37734. ps[13] = pi + 4;
  37735. ps[14] = pi + 5;
  37736. ps[15] = pi + 6;
  37737. ps[8] = pi + 2;
  37738. ps[11] = pi + 7;
  37739. ps[4] = pi + 1;
  37740. ps[7] = pi + 8;
  37741. ps[0] = pi;
  37742. ps[1] = pi + 11;
  37743. ps[2] = pi + 10;
  37744. ps[3] = pi + 9;
  37745. cs[2] = ci + 1;
  37746. cs[3] = ci + 2;
  37747. cs[0] = ci;
  37748. cs[1] = ci + 3;
  37749. break;
  37750. case 1:
  37751. tmp1 = ps[12];
  37752. tmp2 = ps[13];
  37753. tmp3 = ps[14];
  37754. tmp4 = ps[15];
  37755. ps[12] = tmp4;
  37756. ps[13] = pi + 0;
  37757. ps[14] = pi + 1;
  37758. ps[15] = pi + 2;
  37759. ps[8] = tmp3;
  37760. ps[11] = pi + 3;
  37761. ps[4] = tmp2;
  37762. ps[7] = pi + 4;
  37763. ps[0] = tmp1;
  37764. ps[1] = pi + 7;
  37765. ps[2] = pi + 6;
  37766. ps[3] = pi + 5;
  37767. tmp1 = cs[2];
  37768. tmp2 = cs[3];
  37769. cs[2] = tmp2;
  37770. cs[3] = ci;
  37771. cs[0] = tmp1;
  37772. cs[1] = ci + 1;
  37773. break;
  37774. case 2:
  37775. tmp1 = ps[15];
  37776. tmp2 = ps[11];
  37777. ps[12] = ps[3];
  37778. ps[13] = pi + 0;
  37779. ps[14] = pi + 1;
  37780. ps[15] = pi + 2;
  37781. ps[8] = ps[7];
  37782. ps[11] = pi + 3;
  37783. ps[4] = tmp2;
  37784. ps[7] = pi + 4;
  37785. ps[0] = tmp1;
  37786. ps[1] = pi + 7;
  37787. ps[2] = pi + 6;
  37788. ps[3] = pi + 5;
  37789. tmp1 = cs[3];
  37790. cs[2] = cs[1];
  37791. cs[3] = ci;
  37792. cs[0] = tmp1;
  37793. cs[1] = ci + 1;
  37794. break;
  37795. case 3:
  37796. ps[12] = ps[0];
  37797. ps[13] = pi + 0;
  37798. ps[14] = pi + 1;
  37799. ps[15] = pi + 2;
  37800. ps[8] = ps[1];
  37801. ps[11] = pi + 3;
  37802. ps[4] = ps[2];
  37803. ps[7] = pi + 4;
  37804. ps[0] = ps[3];
  37805. ps[1] = pi + 7;
  37806. ps[2] = pi + 6;
  37807. ps[3] = pi + 5;
  37808. cs[2] = cs[0];
  37809. cs[3] = ci;
  37810. cs[0] = cs[1];
  37811. cs[1] = ci + 1;
  37812. break;
  37813. }
  37814. ps[5] = coords.length;
  37815. 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]);
  37816. ps[6] = coords.length;
  37817. 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]);
  37818. ps[9] = coords.length;
  37819. 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]);
  37820. ps[10] = coords.length;
  37821. 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]);
  37822. this.figures.push({
  37823. type: "patch",
  37824. coords: new Int32Array(ps),
  37825. colors: new Int32Array(cs)
  37826. });
  37827. }
  37828. }
  37829. _decodeType7Shading(reader) {
  37830. const coords = this.coords;
  37831. const colors = this.colors;
  37832. const ps = new Int32Array(16);
  37833. const cs = new Int32Array(4);
  37834. while (reader.hasData) {
  37835. const f = reader.readFlag();
  37836. if (!(0 <= f && f <= 3)) {
  37837. throw new _util.FormatError("Unknown type7 flag");
  37838. }
  37839. const pi = coords.length;
  37840. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  37841. coords.push(reader.readCoordinate());
  37842. }
  37843. const ci = colors.length;
  37844. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  37845. colors.push(reader.readComponents());
  37846. }
  37847. let tmp1, tmp2, tmp3, tmp4;
  37848. switch (f) {
  37849. case 0:
  37850. ps[12] = pi + 3;
  37851. ps[13] = pi + 4;
  37852. ps[14] = pi + 5;
  37853. ps[15] = pi + 6;
  37854. ps[8] = pi + 2;
  37855. ps[9] = pi + 13;
  37856. ps[10] = pi + 14;
  37857. ps[11] = pi + 7;
  37858. ps[4] = pi + 1;
  37859. ps[5] = pi + 12;
  37860. ps[6] = pi + 15;
  37861. ps[7] = pi + 8;
  37862. ps[0] = pi;
  37863. ps[1] = pi + 11;
  37864. ps[2] = pi + 10;
  37865. ps[3] = pi + 9;
  37866. cs[2] = ci + 1;
  37867. cs[3] = ci + 2;
  37868. cs[0] = ci;
  37869. cs[1] = ci + 3;
  37870. break;
  37871. case 1:
  37872. tmp1 = ps[12];
  37873. tmp2 = ps[13];
  37874. tmp3 = ps[14];
  37875. tmp4 = ps[15];
  37876. ps[12] = tmp4;
  37877. ps[13] = pi + 0;
  37878. ps[14] = pi + 1;
  37879. ps[15] = pi + 2;
  37880. ps[8] = tmp3;
  37881. ps[9] = pi + 9;
  37882. ps[10] = pi + 10;
  37883. ps[11] = pi + 3;
  37884. ps[4] = tmp2;
  37885. ps[5] = pi + 8;
  37886. ps[6] = pi + 11;
  37887. ps[7] = pi + 4;
  37888. ps[0] = tmp1;
  37889. ps[1] = pi + 7;
  37890. ps[2] = pi + 6;
  37891. ps[3] = pi + 5;
  37892. tmp1 = cs[2];
  37893. tmp2 = cs[3];
  37894. cs[2] = tmp2;
  37895. cs[3] = ci;
  37896. cs[0] = tmp1;
  37897. cs[1] = ci + 1;
  37898. break;
  37899. case 2:
  37900. tmp1 = ps[15];
  37901. tmp2 = ps[11];
  37902. ps[12] = ps[3];
  37903. ps[13] = pi + 0;
  37904. ps[14] = pi + 1;
  37905. ps[15] = pi + 2;
  37906. ps[8] = ps[7];
  37907. ps[9] = pi + 9;
  37908. ps[10] = pi + 10;
  37909. ps[11] = pi + 3;
  37910. ps[4] = tmp2;
  37911. ps[5] = pi + 8;
  37912. ps[6] = pi + 11;
  37913. ps[7] = pi + 4;
  37914. ps[0] = tmp1;
  37915. ps[1] = pi + 7;
  37916. ps[2] = pi + 6;
  37917. ps[3] = pi + 5;
  37918. tmp1 = cs[3];
  37919. cs[2] = cs[1];
  37920. cs[3] = ci;
  37921. cs[0] = tmp1;
  37922. cs[1] = ci + 1;
  37923. break;
  37924. case 3:
  37925. ps[12] = ps[0];
  37926. ps[13] = pi + 0;
  37927. ps[14] = pi + 1;
  37928. ps[15] = pi + 2;
  37929. ps[8] = ps[1];
  37930. ps[9] = pi + 9;
  37931. ps[10] = pi + 10;
  37932. ps[11] = pi + 3;
  37933. ps[4] = ps[2];
  37934. ps[5] = pi + 8;
  37935. ps[6] = pi + 11;
  37936. ps[7] = pi + 4;
  37937. ps[0] = ps[3];
  37938. ps[1] = pi + 7;
  37939. ps[2] = pi + 6;
  37940. ps[3] = pi + 5;
  37941. cs[2] = cs[0];
  37942. cs[3] = ci;
  37943. cs[0] = cs[1];
  37944. cs[1] = ci + 1;
  37945. break;
  37946. }
  37947. this.figures.push({
  37948. type: "patch",
  37949. coords: new Int32Array(ps),
  37950. colors: new Int32Array(cs)
  37951. });
  37952. }
  37953. }
  37954. _buildFigureFromPatch(index) {
  37955. const figure = this.figures[index];
  37956. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  37957. const coords = this.coords,
  37958. colors = this.colors;
  37959. const pi = figure.coords;
  37960. const ci = figure.colors;
  37961. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  37962. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  37963. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  37964. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  37965. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  37966. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  37967. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  37968. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  37969. const verticesPerRow = splitXBy + 1;
  37970. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  37971. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  37972. let k = 0;
  37973. const cl = new Uint8Array(3),
  37974. cr = new Uint8Array(3);
  37975. const c0 = colors[ci[0]],
  37976. c1 = colors[ci[1]],
  37977. c2 = colors[ci[2]],
  37978. c3 = colors[ci[3]];
  37979. const bRow = getB(splitYBy),
  37980. bCol = getB(splitXBy);
  37981. for (let row = 0; row <= splitYBy; row++) {
  37982. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  37983. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  37984. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  37985. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  37986. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  37987. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  37988. for (let col = 0; col <= splitXBy; col++, k++) {
  37989. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  37990. continue;
  37991. }
  37992. let x = 0,
  37993. y = 0;
  37994. let q = 0;
  37995. for (let i = 0; i <= 3; i++) {
  37996. for (let j = 0; j <= 3; j++, q++) {
  37997. const m = bRow[row][i] * bCol[col][j];
  37998. x += coords[pi[q]][0] * m;
  37999. y += coords[pi[q]][1] * m;
  38000. }
  38001. }
  38002. figureCoords[k] = coords.length;
  38003. coords.push([x, y]);
  38004. figureColors[k] = colors.length;
  38005. const newColor = new Uint8Array(3);
  38006. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  38007. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  38008. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  38009. colors.push(newColor);
  38010. }
  38011. }
  38012. figureCoords[0] = pi[0];
  38013. figureColors[0] = ci[0];
  38014. figureCoords[splitXBy] = pi[3];
  38015. figureColors[splitXBy] = ci[1];
  38016. figureCoords[verticesPerRow * splitYBy] = pi[12];
  38017. figureColors[verticesPerRow * splitYBy] = ci[2];
  38018. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  38019. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  38020. this.figures[index] = {
  38021. type: "lattice",
  38022. coords: figureCoords,
  38023. colors: figureColors,
  38024. verticesPerRow
  38025. };
  38026. }
  38027. _updateBounds() {
  38028. let minX = this.coords[0][0],
  38029. minY = this.coords[0][1],
  38030. maxX = minX,
  38031. maxY = minY;
  38032. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  38033. const x = this.coords[i][0],
  38034. y = this.coords[i][1];
  38035. minX = minX > x ? x : minX;
  38036. minY = minY > y ? y : minY;
  38037. maxX = maxX < x ? x : maxX;
  38038. maxY = maxY < y ? y : maxY;
  38039. }
  38040. this.bounds = [minX, minY, maxX, maxY];
  38041. }
  38042. _packData() {
  38043. let i, ii, j, jj;
  38044. const coords = this.coords;
  38045. const coordsPacked = new Float32Array(coords.length * 2);
  38046. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  38047. const xy = coords[i];
  38048. coordsPacked[j++] = xy[0];
  38049. coordsPacked[j++] = xy[1];
  38050. }
  38051. this.coords = coordsPacked;
  38052. const colors = this.colors;
  38053. const colorsPacked = new Uint8Array(colors.length * 3);
  38054. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  38055. const c = colors[i];
  38056. colorsPacked[j++] = c[0];
  38057. colorsPacked[j++] = c[1];
  38058. colorsPacked[j++] = c[2];
  38059. }
  38060. this.colors = colorsPacked;
  38061. const figures = this.figures;
  38062. for (i = 0, ii = figures.length; i < ii; i++) {
  38063. const figure = figures[i],
  38064. ps = figure.coords,
  38065. cs = figure.colors;
  38066. for (j = 0, jj = ps.length; j < jj; j++) {
  38067. ps[j] *= 2;
  38068. cs[j] *= 3;
  38069. }
  38070. }
  38071. }
  38072. getIR() {
  38073. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  38074. }
  38075. }
  38076. class DummyShading extends BaseShading {
  38077. getIR() {
  38078. return ["Dummy"];
  38079. }
  38080. }
  38081. function getTilingPatternIR(operatorList, dict, color) {
  38082. const matrix = dict.getArray("Matrix");
  38083. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  38084. const xstep = dict.get("XStep");
  38085. const ystep = dict.get("YStep");
  38086. const paintType = dict.get("PaintType");
  38087. const tilingType = dict.get("TilingType");
  38088. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  38089. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  38090. }
  38091. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  38092. }
  38093. /***/ }),
  38094. /* 49 */
  38095. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38096. Object.defineProperty(exports, "__esModule", ({
  38097. value: true
  38098. }));
  38099. exports.isPDFFunction = isPDFFunction;
  38100. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  38101. var _primitives = __w_pdfjs_require__(5);
  38102. var _util = __w_pdfjs_require__(2);
  38103. var _ps_parser = __w_pdfjs_require__(50);
  38104. var _image_utils = __w_pdfjs_require__(51);
  38105. class PDFFunctionFactory {
  38106. constructor({
  38107. xref,
  38108. isEvalSupported = true
  38109. }) {
  38110. this.xref = xref;
  38111. this.isEvalSupported = isEvalSupported !== false;
  38112. }
  38113. create(fn) {
  38114. const cachedFunction = this.getCached(fn);
  38115. if (cachedFunction) {
  38116. return cachedFunction;
  38117. }
  38118. const parsedFunction = PDFFunction.parse({
  38119. xref: this.xref,
  38120. isEvalSupported: this.isEvalSupported,
  38121. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  38122. });
  38123. this._cache(fn, parsedFunction);
  38124. return parsedFunction;
  38125. }
  38126. createFromArray(fnObj) {
  38127. const cachedFunction = this.getCached(fnObj);
  38128. if (cachedFunction) {
  38129. return cachedFunction;
  38130. }
  38131. const parsedFunction = PDFFunction.parseArray({
  38132. xref: this.xref,
  38133. isEvalSupported: this.isEvalSupported,
  38134. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  38135. });
  38136. this._cache(fnObj, parsedFunction);
  38137. return parsedFunction;
  38138. }
  38139. getCached(cacheKey) {
  38140. let fnRef;
  38141. if (cacheKey instanceof _primitives.Ref) {
  38142. fnRef = cacheKey;
  38143. } else if (cacheKey instanceof _primitives.Dict) {
  38144. fnRef = cacheKey.objId;
  38145. } else if ((0, _primitives.isStream)(cacheKey)) {
  38146. fnRef = cacheKey.dict && cacheKey.dict.objId;
  38147. }
  38148. if (fnRef) {
  38149. const localFunction = this._localFunctionCache.getByRef(fnRef);
  38150. if (localFunction) {
  38151. return localFunction;
  38152. }
  38153. }
  38154. return null;
  38155. }
  38156. _cache(cacheKey, parsedFunction) {
  38157. if (!parsedFunction) {
  38158. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  38159. }
  38160. let fnRef;
  38161. if (cacheKey instanceof _primitives.Ref) {
  38162. fnRef = cacheKey;
  38163. } else if (cacheKey instanceof _primitives.Dict) {
  38164. fnRef = cacheKey.objId;
  38165. } else if ((0, _primitives.isStream)(cacheKey)) {
  38166. fnRef = cacheKey.dict && cacheKey.dict.objId;
  38167. }
  38168. if (fnRef) {
  38169. this._localFunctionCache.set(null, fnRef, parsedFunction);
  38170. }
  38171. }
  38172. get _localFunctionCache() {
  38173. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  38174. }
  38175. }
  38176. exports.PDFFunctionFactory = PDFFunctionFactory;
  38177. function toNumberArray(arr) {
  38178. if (!Array.isArray(arr)) {
  38179. return null;
  38180. }
  38181. const length = arr.length;
  38182. for (let i = 0; i < length; i++) {
  38183. if (typeof arr[i] !== "number") {
  38184. const result = new Array(length);
  38185. for (let j = 0; j < length; j++) {
  38186. result[j] = +arr[j];
  38187. }
  38188. return result;
  38189. }
  38190. }
  38191. return arr;
  38192. }
  38193. const PDFFunction = function PDFFunctionClosure() {
  38194. const CONSTRUCT_SAMPLED = 0;
  38195. const CONSTRUCT_INTERPOLATED = 2;
  38196. const CONSTRUCT_STICHED = 3;
  38197. const CONSTRUCT_POSTSCRIPT = 4;
  38198. return {
  38199. getSampleArray(size, outputSize, bps, stream) {
  38200. let i, ii;
  38201. let length = 1;
  38202. for (i = 0, ii = size.length; i < ii; i++) {
  38203. length *= size[i];
  38204. }
  38205. length *= outputSize;
  38206. const array = new Array(length);
  38207. let codeSize = 0;
  38208. let codeBuf = 0;
  38209. const sampleMul = 1.0 / (2.0 ** bps - 1);
  38210. const strBytes = stream.getBytes((length * bps + 7) / 8);
  38211. let strIdx = 0;
  38212. for (i = 0; i < length; i++) {
  38213. while (codeSize < bps) {
  38214. codeBuf <<= 8;
  38215. codeBuf |= strBytes[strIdx++];
  38216. codeSize += 8;
  38217. }
  38218. codeSize -= bps;
  38219. array[i] = (codeBuf >> codeSize) * sampleMul;
  38220. codeBuf &= (1 << codeSize) - 1;
  38221. }
  38222. return array;
  38223. },
  38224. getIR({
  38225. xref,
  38226. isEvalSupported,
  38227. fn
  38228. }) {
  38229. let dict = fn.dict;
  38230. if (!dict) {
  38231. dict = fn;
  38232. }
  38233. const types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
  38234. const typeNum = dict.get("FunctionType");
  38235. const typeFn = types[typeNum];
  38236. if (!typeFn) {
  38237. throw new _util.FormatError("Unknown type of function");
  38238. }
  38239. return typeFn.call(this, {
  38240. xref,
  38241. isEvalSupported,
  38242. fn,
  38243. dict
  38244. });
  38245. },
  38246. fromIR({
  38247. xref,
  38248. isEvalSupported,
  38249. IR
  38250. }) {
  38251. const type = IR[0];
  38252. switch (type) {
  38253. case CONSTRUCT_SAMPLED:
  38254. return this.constructSampledFromIR({
  38255. xref,
  38256. isEvalSupported,
  38257. IR
  38258. });
  38259. case CONSTRUCT_INTERPOLATED:
  38260. return this.constructInterpolatedFromIR({
  38261. xref,
  38262. isEvalSupported,
  38263. IR
  38264. });
  38265. case CONSTRUCT_STICHED:
  38266. return this.constructStichedFromIR({
  38267. xref,
  38268. isEvalSupported,
  38269. IR
  38270. });
  38271. default:
  38272. return this.constructPostScriptFromIR({
  38273. xref,
  38274. isEvalSupported,
  38275. IR
  38276. });
  38277. }
  38278. },
  38279. parse({
  38280. xref,
  38281. isEvalSupported,
  38282. fn
  38283. }) {
  38284. const IR = this.getIR({
  38285. xref,
  38286. isEvalSupported,
  38287. fn
  38288. });
  38289. return this.fromIR({
  38290. xref,
  38291. isEvalSupported,
  38292. IR
  38293. });
  38294. },
  38295. parseArray({
  38296. xref,
  38297. isEvalSupported,
  38298. fnObj
  38299. }) {
  38300. if (!Array.isArray(fnObj)) {
  38301. return this.parse({
  38302. xref,
  38303. isEvalSupported,
  38304. fn: fnObj
  38305. });
  38306. }
  38307. const fnArray = [];
  38308. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  38309. fnArray.push(this.parse({
  38310. xref,
  38311. isEvalSupported,
  38312. fn: xref.fetchIfRef(fnObj[j])
  38313. }));
  38314. }
  38315. return function (src, srcOffset, dest, destOffset) {
  38316. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  38317. fnArray[i](src, srcOffset, dest, destOffset + i);
  38318. }
  38319. };
  38320. },
  38321. constructSampled({
  38322. xref,
  38323. isEvalSupported,
  38324. fn,
  38325. dict
  38326. }) {
  38327. function toMultiArray(arr) {
  38328. const inputLength = arr.length;
  38329. const out = [];
  38330. let index = 0;
  38331. for (let i = 0; i < inputLength; i += 2) {
  38332. out[index] = [arr[i], arr[i + 1]];
  38333. ++index;
  38334. }
  38335. return out;
  38336. }
  38337. let domain = toNumberArray(dict.getArray("Domain"));
  38338. let range = toNumberArray(dict.getArray("Range"));
  38339. if (!domain || !range) {
  38340. throw new _util.FormatError("No domain or range");
  38341. }
  38342. const inputSize = domain.length / 2;
  38343. const outputSize = range.length / 2;
  38344. domain = toMultiArray(domain);
  38345. range = toMultiArray(range);
  38346. const size = toNumberArray(dict.getArray("Size"));
  38347. const bps = dict.get("BitsPerSample");
  38348. const order = dict.get("Order") || 1;
  38349. if (order !== 1) {
  38350. (0, _util.info)("No support for cubic spline interpolation: " + order);
  38351. }
  38352. let encode = toNumberArray(dict.getArray("Encode"));
  38353. if (!encode) {
  38354. encode = [];
  38355. for (let i = 0; i < inputSize; ++i) {
  38356. encode.push([0, size[i] - 1]);
  38357. }
  38358. } else {
  38359. encode = toMultiArray(encode);
  38360. }
  38361. let decode = toNumberArray(dict.getArray("Decode"));
  38362. if (!decode) {
  38363. decode = range;
  38364. } else {
  38365. decode = toMultiArray(decode);
  38366. }
  38367. const samples = this.getSampleArray(size, outputSize, bps, fn);
  38368. return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
  38369. },
  38370. constructSampledFromIR({
  38371. xref,
  38372. isEvalSupported,
  38373. IR
  38374. }) {
  38375. function interpolate(x, xmin, xmax, ymin, ymax) {
  38376. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  38377. }
  38378. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  38379. const m = IR[1];
  38380. const domain = IR[2];
  38381. const encode = IR[3];
  38382. const decode = IR[4];
  38383. const samples = IR[5];
  38384. const size = IR[6];
  38385. const n = IR[7];
  38386. const range = IR[9];
  38387. const cubeVertices = 1 << m;
  38388. const cubeN = new Float64Array(cubeVertices);
  38389. const cubeVertex = new Uint32Array(cubeVertices);
  38390. let i, j;
  38391. for (j = 0; j < cubeVertices; j++) {
  38392. cubeN[j] = 1;
  38393. }
  38394. let k = n,
  38395. pos = 1;
  38396. for (i = 0; i < m; ++i) {
  38397. const domain_2i = domain[i][0];
  38398. const domain_2i_1 = domain[i][1];
  38399. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  38400. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  38401. const size_i = size[i];
  38402. e = Math.min(Math.max(e, 0), size_i - 1);
  38403. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  38404. const n0 = e0 + 1 - e;
  38405. const n1 = e - e0;
  38406. const offset0 = e0 * k;
  38407. const offset1 = offset0 + k;
  38408. for (j = 0; j < cubeVertices; j++) {
  38409. if (j & pos) {
  38410. cubeN[j] *= n1;
  38411. cubeVertex[j] += offset1;
  38412. } else {
  38413. cubeN[j] *= n0;
  38414. cubeVertex[j] += offset0;
  38415. }
  38416. }
  38417. k *= size_i;
  38418. pos <<= 1;
  38419. }
  38420. for (j = 0; j < n; ++j) {
  38421. let rj = 0;
  38422. for (i = 0; i < cubeVertices; i++) {
  38423. rj += samples[cubeVertex[i] + j] * cubeN[i];
  38424. }
  38425. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  38426. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  38427. }
  38428. };
  38429. },
  38430. constructInterpolated({
  38431. xref,
  38432. isEvalSupported,
  38433. fn,
  38434. dict
  38435. }) {
  38436. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  38437. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  38438. const n = dict.get("N");
  38439. const length = c0.length;
  38440. const diff = [];
  38441. for (let i = 0; i < length; ++i) {
  38442. diff.push(c1[i] - c0[i]);
  38443. }
  38444. return [CONSTRUCT_INTERPOLATED, c0, diff, n];
  38445. },
  38446. constructInterpolatedFromIR({
  38447. xref,
  38448. isEvalSupported,
  38449. IR
  38450. }) {
  38451. const c0 = IR[1];
  38452. const diff = IR[2];
  38453. const n = IR[3];
  38454. const length = diff.length;
  38455. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  38456. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  38457. for (let j = 0; j < length; ++j) {
  38458. dest[destOffset + j] = c0[j] + x * diff[j];
  38459. }
  38460. };
  38461. },
  38462. constructStiched({
  38463. xref,
  38464. isEvalSupported,
  38465. fn,
  38466. dict
  38467. }) {
  38468. const domain = toNumberArray(dict.getArray("Domain"));
  38469. if (!domain) {
  38470. throw new _util.FormatError("No domain");
  38471. }
  38472. const inputSize = domain.length / 2;
  38473. if (inputSize !== 1) {
  38474. throw new _util.FormatError("Bad domain for stiched function");
  38475. }
  38476. const fnRefs = dict.get("Functions");
  38477. const fns = [];
  38478. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  38479. fns.push(this.parse({
  38480. xref,
  38481. isEvalSupported,
  38482. fn: xref.fetchIfRef(fnRefs[i])
  38483. }));
  38484. }
  38485. const bounds = toNumberArray(dict.getArray("Bounds"));
  38486. const encode = toNumberArray(dict.getArray("Encode"));
  38487. return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
  38488. },
  38489. constructStichedFromIR({
  38490. xref,
  38491. isEvalSupported,
  38492. IR
  38493. }) {
  38494. const domain = IR[1];
  38495. const bounds = IR[2];
  38496. const encode = IR[3];
  38497. const fns = IR[4];
  38498. const tmpBuf = new Float32Array(1);
  38499. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  38500. const clip = function constructStichedFromIRClip(v, min, max) {
  38501. if (v > max) {
  38502. v = max;
  38503. } else if (v < min) {
  38504. v = min;
  38505. }
  38506. return v;
  38507. };
  38508. const v = clip(src[srcOffset], domain[0], domain[1]);
  38509. const length = bounds.length;
  38510. let i;
  38511. for (i = 0; i < length; ++i) {
  38512. if (v < bounds[i]) {
  38513. break;
  38514. }
  38515. }
  38516. let dmin = domain[0];
  38517. if (i > 0) {
  38518. dmin = bounds[i - 1];
  38519. }
  38520. let dmax = domain[1];
  38521. if (i < bounds.length) {
  38522. dmax = bounds[i];
  38523. }
  38524. const rmin = encode[2 * i];
  38525. const rmax = encode[2 * i + 1];
  38526. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  38527. fns[i](tmpBuf, 0, dest, destOffset);
  38528. };
  38529. },
  38530. constructPostScript({
  38531. xref,
  38532. isEvalSupported,
  38533. fn,
  38534. dict
  38535. }) {
  38536. const domain = toNumberArray(dict.getArray("Domain"));
  38537. const range = toNumberArray(dict.getArray("Range"));
  38538. if (!domain) {
  38539. throw new _util.FormatError("No domain.");
  38540. }
  38541. if (!range) {
  38542. throw new _util.FormatError("No range.");
  38543. }
  38544. const lexer = new _ps_parser.PostScriptLexer(fn);
  38545. const parser = new _ps_parser.PostScriptParser(lexer);
  38546. const code = parser.parse();
  38547. return [CONSTRUCT_POSTSCRIPT, domain, range, code];
  38548. },
  38549. constructPostScriptFromIR({
  38550. xref,
  38551. isEvalSupported,
  38552. IR
  38553. }) {
  38554. const domain = IR[1];
  38555. const range = IR[2];
  38556. const code = IR[3];
  38557. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  38558. const compiled = new PostScriptCompiler().compile(code, domain, range);
  38559. if (compiled) {
  38560. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  38561. }
  38562. }
  38563. (0, _util.info)("Unable to compile PS function");
  38564. const numOutputs = range.length >> 1;
  38565. const numInputs = domain.length >> 1;
  38566. const evaluator = new PostScriptEvaluator(code);
  38567. const cache = Object.create(null);
  38568. const MAX_CACHE_SIZE = 2048 * 4;
  38569. let cache_available = MAX_CACHE_SIZE;
  38570. const tmpBuf = new Float32Array(numInputs);
  38571. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  38572. let i, value;
  38573. let key = "";
  38574. const input = tmpBuf;
  38575. for (i = 0; i < numInputs; i++) {
  38576. value = src[srcOffset + i];
  38577. input[i] = value;
  38578. key += value + "_";
  38579. }
  38580. const cachedValue = cache[key];
  38581. if (cachedValue !== undefined) {
  38582. dest.set(cachedValue, destOffset);
  38583. return;
  38584. }
  38585. const output = new Float32Array(numOutputs);
  38586. const stack = evaluator.execute(input);
  38587. const stackIndex = stack.length - numOutputs;
  38588. for (i = 0; i < numOutputs; i++) {
  38589. value = stack[stackIndex + i];
  38590. let bound = range[i * 2];
  38591. if (value < bound) {
  38592. value = bound;
  38593. } else {
  38594. bound = range[i * 2 + 1];
  38595. if (value > bound) {
  38596. value = bound;
  38597. }
  38598. }
  38599. output[i] = value;
  38600. }
  38601. if (cache_available > 0) {
  38602. cache_available--;
  38603. cache[key] = output;
  38604. }
  38605. dest.set(output, destOffset);
  38606. };
  38607. }
  38608. };
  38609. }();
  38610. function isPDFFunction(v) {
  38611. let fnDict;
  38612. if (typeof v !== "object") {
  38613. return false;
  38614. } else if ((0, _primitives.isDict)(v)) {
  38615. fnDict = v;
  38616. } else if ((0, _primitives.isStream)(v)) {
  38617. fnDict = v.dict;
  38618. } else {
  38619. return false;
  38620. }
  38621. return fnDict.has("FunctionType");
  38622. }
  38623. const PostScriptStack = function PostScriptStackClosure() {
  38624. const MAX_STACK_SIZE = 100;
  38625. class PostScriptStack {
  38626. constructor(initialStack) {
  38627. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  38628. }
  38629. push(value) {
  38630. if (this.stack.length >= MAX_STACK_SIZE) {
  38631. throw new Error("PostScript function stack overflow.");
  38632. }
  38633. this.stack.push(value);
  38634. }
  38635. pop() {
  38636. if (this.stack.length <= 0) {
  38637. throw new Error("PostScript function stack underflow.");
  38638. }
  38639. return this.stack.pop();
  38640. }
  38641. copy(n) {
  38642. if (this.stack.length + n >= MAX_STACK_SIZE) {
  38643. throw new Error("PostScript function stack overflow.");
  38644. }
  38645. const stack = this.stack;
  38646. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  38647. stack.push(stack[i]);
  38648. }
  38649. }
  38650. index(n) {
  38651. this.push(this.stack[this.stack.length - n - 1]);
  38652. }
  38653. roll(n, p) {
  38654. const stack = this.stack;
  38655. const l = stack.length - n;
  38656. const r = stack.length - 1;
  38657. const c = l + (p - Math.floor(p / n) * n);
  38658. for (let i = l, j = r; i < j; i++, j--) {
  38659. const t = stack[i];
  38660. stack[i] = stack[j];
  38661. stack[j] = t;
  38662. }
  38663. for (let i = l, j = c - 1; i < j; i++, j--) {
  38664. const t = stack[i];
  38665. stack[i] = stack[j];
  38666. stack[j] = t;
  38667. }
  38668. for (let i = c, j = r; i < j; i++, j--) {
  38669. const t = stack[i];
  38670. stack[i] = stack[j];
  38671. stack[j] = t;
  38672. }
  38673. }
  38674. }
  38675. return PostScriptStack;
  38676. }();
  38677. class PostScriptEvaluator {
  38678. constructor(operators) {
  38679. this.operators = operators;
  38680. }
  38681. execute(initialStack) {
  38682. const stack = new PostScriptStack(initialStack);
  38683. let counter = 0;
  38684. const operators = this.operators;
  38685. const length = operators.length;
  38686. let operator, a, b;
  38687. while (counter < length) {
  38688. operator = operators[counter++];
  38689. if (typeof operator === "number") {
  38690. stack.push(operator);
  38691. continue;
  38692. }
  38693. switch (operator) {
  38694. case "jz":
  38695. b = stack.pop();
  38696. a = stack.pop();
  38697. if (!a) {
  38698. counter = b;
  38699. }
  38700. break;
  38701. case "j":
  38702. a = stack.pop();
  38703. counter = a;
  38704. break;
  38705. case "abs":
  38706. a = stack.pop();
  38707. stack.push(Math.abs(a));
  38708. break;
  38709. case "add":
  38710. b = stack.pop();
  38711. a = stack.pop();
  38712. stack.push(a + b);
  38713. break;
  38714. case "and":
  38715. b = stack.pop();
  38716. a = stack.pop();
  38717. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  38718. stack.push(a && b);
  38719. } else {
  38720. stack.push(a & b);
  38721. }
  38722. break;
  38723. case "atan":
  38724. a = stack.pop();
  38725. stack.push(Math.atan(a));
  38726. break;
  38727. case "bitshift":
  38728. b = stack.pop();
  38729. a = stack.pop();
  38730. if (a > 0) {
  38731. stack.push(a << b);
  38732. } else {
  38733. stack.push(a >> b);
  38734. }
  38735. break;
  38736. case "ceiling":
  38737. a = stack.pop();
  38738. stack.push(Math.ceil(a));
  38739. break;
  38740. case "copy":
  38741. a = stack.pop();
  38742. stack.copy(a);
  38743. break;
  38744. case "cos":
  38745. a = stack.pop();
  38746. stack.push(Math.cos(a));
  38747. break;
  38748. case "cvi":
  38749. a = stack.pop() | 0;
  38750. stack.push(a);
  38751. break;
  38752. case "cvr":
  38753. break;
  38754. case "div":
  38755. b = stack.pop();
  38756. a = stack.pop();
  38757. stack.push(a / b);
  38758. break;
  38759. case "dup":
  38760. stack.copy(1);
  38761. break;
  38762. case "eq":
  38763. b = stack.pop();
  38764. a = stack.pop();
  38765. stack.push(a === b);
  38766. break;
  38767. case "exch":
  38768. stack.roll(2, 1);
  38769. break;
  38770. case "exp":
  38771. b = stack.pop();
  38772. a = stack.pop();
  38773. stack.push(a ** b);
  38774. break;
  38775. case "false":
  38776. stack.push(false);
  38777. break;
  38778. case "floor":
  38779. a = stack.pop();
  38780. stack.push(Math.floor(a));
  38781. break;
  38782. case "ge":
  38783. b = stack.pop();
  38784. a = stack.pop();
  38785. stack.push(a >= b);
  38786. break;
  38787. case "gt":
  38788. b = stack.pop();
  38789. a = stack.pop();
  38790. stack.push(a > b);
  38791. break;
  38792. case "idiv":
  38793. b = stack.pop();
  38794. a = stack.pop();
  38795. stack.push(a / b | 0);
  38796. break;
  38797. case "index":
  38798. a = stack.pop();
  38799. stack.index(a);
  38800. break;
  38801. case "le":
  38802. b = stack.pop();
  38803. a = stack.pop();
  38804. stack.push(a <= b);
  38805. break;
  38806. case "ln":
  38807. a = stack.pop();
  38808. stack.push(Math.log(a));
  38809. break;
  38810. case "log":
  38811. a = stack.pop();
  38812. stack.push(Math.log(a) / Math.LN10);
  38813. break;
  38814. case "lt":
  38815. b = stack.pop();
  38816. a = stack.pop();
  38817. stack.push(a < b);
  38818. break;
  38819. case "mod":
  38820. b = stack.pop();
  38821. a = stack.pop();
  38822. stack.push(a % b);
  38823. break;
  38824. case "mul":
  38825. b = stack.pop();
  38826. a = stack.pop();
  38827. stack.push(a * b);
  38828. break;
  38829. case "ne":
  38830. b = stack.pop();
  38831. a = stack.pop();
  38832. stack.push(a !== b);
  38833. break;
  38834. case "neg":
  38835. a = stack.pop();
  38836. stack.push(-a);
  38837. break;
  38838. case "not":
  38839. a = stack.pop();
  38840. if ((0, _util.isBool)(a)) {
  38841. stack.push(!a);
  38842. } else {
  38843. stack.push(~a);
  38844. }
  38845. break;
  38846. case "or":
  38847. b = stack.pop();
  38848. a = stack.pop();
  38849. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  38850. stack.push(a || b);
  38851. } else {
  38852. stack.push(a | b);
  38853. }
  38854. break;
  38855. case "pop":
  38856. stack.pop();
  38857. break;
  38858. case "roll":
  38859. b = stack.pop();
  38860. a = stack.pop();
  38861. stack.roll(a, b);
  38862. break;
  38863. case "round":
  38864. a = stack.pop();
  38865. stack.push(Math.round(a));
  38866. break;
  38867. case "sin":
  38868. a = stack.pop();
  38869. stack.push(Math.sin(a));
  38870. break;
  38871. case "sqrt":
  38872. a = stack.pop();
  38873. stack.push(Math.sqrt(a));
  38874. break;
  38875. case "sub":
  38876. b = stack.pop();
  38877. a = stack.pop();
  38878. stack.push(a - b);
  38879. break;
  38880. case "true":
  38881. stack.push(true);
  38882. break;
  38883. case "truncate":
  38884. a = stack.pop();
  38885. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  38886. stack.push(a);
  38887. break;
  38888. case "xor":
  38889. b = stack.pop();
  38890. a = stack.pop();
  38891. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  38892. stack.push(a !== b);
  38893. } else {
  38894. stack.push(a ^ b);
  38895. }
  38896. break;
  38897. default:
  38898. throw new _util.FormatError(`Unknown operator ${operator}`);
  38899. }
  38900. }
  38901. return stack.stack;
  38902. }
  38903. }
  38904. exports.PostScriptEvaluator = PostScriptEvaluator;
  38905. const PostScriptCompiler = function PostScriptCompilerClosure() {
  38906. class AstNode {
  38907. constructor(type) {
  38908. this.type = type;
  38909. }
  38910. visit(visitor) {
  38911. (0, _util.unreachable)("abstract method");
  38912. }
  38913. }
  38914. class AstArgument extends AstNode {
  38915. constructor(index, min, max) {
  38916. super("args");
  38917. this.index = index;
  38918. this.min = min;
  38919. this.max = max;
  38920. }
  38921. visit(visitor) {
  38922. visitor.visitArgument(this);
  38923. }
  38924. }
  38925. class AstLiteral extends AstNode {
  38926. constructor(number) {
  38927. super("literal");
  38928. this.number = number;
  38929. this.min = number;
  38930. this.max = number;
  38931. }
  38932. visit(visitor) {
  38933. visitor.visitLiteral(this);
  38934. }
  38935. }
  38936. class AstBinaryOperation extends AstNode {
  38937. constructor(op, arg1, arg2, min, max) {
  38938. super("binary");
  38939. this.op = op;
  38940. this.arg1 = arg1;
  38941. this.arg2 = arg2;
  38942. this.min = min;
  38943. this.max = max;
  38944. }
  38945. visit(visitor) {
  38946. visitor.visitBinaryOperation(this);
  38947. }
  38948. }
  38949. class AstMin extends AstNode {
  38950. constructor(arg, max) {
  38951. super("max");
  38952. this.arg = arg;
  38953. this.min = arg.min;
  38954. this.max = max;
  38955. }
  38956. visit(visitor) {
  38957. visitor.visitMin(this);
  38958. }
  38959. }
  38960. class AstVariable extends AstNode {
  38961. constructor(index, min, max) {
  38962. super("var");
  38963. this.index = index;
  38964. this.min = min;
  38965. this.max = max;
  38966. }
  38967. visit(visitor) {
  38968. visitor.visitVariable(this);
  38969. }
  38970. }
  38971. class AstVariableDefinition extends AstNode {
  38972. constructor(variable, arg) {
  38973. super("definition");
  38974. this.variable = variable;
  38975. this.arg = arg;
  38976. }
  38977. visit(visitor) {
  38978. visitor.visitVariableDefinition(this);
  38979. }
  38980. }
  38981. class ExpressionBuilderVisitor {
  38982. constructor() {
  38983. this.parts = [];
  38984. }
  38985. visitArgument(arg) {
  38986. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  38987. }
  38988. visitVariable(variable) {
  38989. this.parts.push("v", variable.index);
  38990. }
  38991. visitLiteral(literal) {
  38992. this.parts.push(literal.number);
  38993. }
  38994. visitBinaryOperation(operation) {
  38995. this.parts.push("(");
  38996. operation.arg1.visit(this);
  38997. this.parts.push(" ", operation.op, " ");
  38998. operation.arg2.visit(this);
  38999. this.parts.push(")");
  39000. }
  39001. visitVariableDefinition(definition) {
  39002. this.parts.push("var ");
  39003. definition.variable.visit(this);
  39004. this.parts.push(" = ");
  39005. definition.arg.visit(this);
  39006. this.parts.push(";");
  39007. }
  39008. visitMin(max) {
  39009. this.parts.push("Math.min(");
  39010. max.arg.visit(this);
  39011. this.parts.push(", ", max.max, ")");
  39012. }
  39013. toString() {
  39014. return this.parts.join("");
  39015. }
  39016. }
  39017. function buildAddOperation(num1, num2) {
  39018. if (num2.type === "literal" && num2.number === 0) {
  39019. return num1;
  39020. }
  39021. if (num1.type === "literal" && num1.number === 0) {
  39022. return num2;
  39023. }
  39024. if (num2.type === "literal" && num1.type === "literal") {
  39025. return new AstLiteral(num1.number + num2.number);
  39026. }
  39027. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  39028. }
  39029. function buildMulOperation(num1, num2) {
  39030. if (num2.type === "literal") {
  39031. if (num2.number === 0) {
  39032. return new AstLiteral(0);
  39033. } else if (num2.number === 1) {
  39034. return num1;
  39035. } else if (num1.type === "literal") {
  39036. return new AstLiteral(num1.number * num2.number);
  39037. }
  39038. }
  39039. if (num1.type === "literal") {
  39040. if (num1.number === 0) {
  39041. return new AstLiteral(0);
  39042. } else if (num1.number === 1) {
  39043. return num2;
  39044. }
  39045. }
  39046. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  39047. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  39048. return new AstBinaryOperation("*", num1, num2, min, max);
  39049. }
  39050. function buildSubOperation(num1, num2) {
  39051. if (num2.type === "literal") {
  39052. if (num2.number === 0) {
  39053. return num1;
  39054. } else if (num1.type === "literal") {
  39055. return new AstLiteral(num1.number - num2.number);
  39056. }
  39057. }
  39058. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  39059. return num2.arg2;
  39060. }
  39061. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  39062. }
  39063. function buildMinOperation(num1, max) {
  39064. if (num1.min >= max) {
  39065. return new AstLiteral(max);
  39066. } else if (num1.max <= max) {
  39067. return num1;
  39068. }
  39069. return new AstMin(num1, max);
  39070. }
  39071. class PostScriptCompiler {
  39072. compile(code, domain, range) {
  39073. const stack = [];
  39074. const instructions = [];
  39075. const inputSize = domain.length >> 1,
  39076. outputSize = range.length >> 1;
  39077. let lastRegister = 0;
  39078. let n, j;
  39079. let num1, num2, ast1, ast2, tmpVar, item;
  39080. for (let i = 0; i < inputSize; i++) {
  39081. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  39082. }
  39083. for (let i = 0, ii = code.length; i < ii; i++) {
  39084. item = code[i];
  39085. if (typeof item === "number") {
  39086. stack.push(new AstLiteral(item));
  39087. continue;
  39088. }
  39089. switch (item) {
  39090. case "add":
  39091. if (stack.length < 2) {
  39092. return null;
  39093. }
  39094. num2 = stack.pop();
  39095. num1 = stack.pop();
  39096. stack.push(buildAddOperation(num1, num2));
  39097. break;
  39098. case "cvr":
  39099. if (stack.length < 1) {
  39100. return null;
  39101. }
  39102. break;
  39103. case "mul":
  39104. if (stack.length < 2) {
  39105. return null;
  39106. }
  39107. num2 = stack.pop();
  39108. num1 = stack.pop();
  39109. stack.push(buildMulOperation(num1, num2));
  39110. break;
  39111. case "sub":
  39112. if (stack.length < 2) {
  39113. return null;
  39114. }
  39115. num2 = stack.pop();
  39116. num1 = stack.pop();
  39117. stack.push(buildSubOperation(num1, num2));
  39118. break;
  39119. case "exch":
  39120. if (stack.length < 2) {
  39121. return null;
  39122. }
  39123. ast1 = stack.pop();
  39124. ast2 = stack.pop();
  39125. stack.push(ast1, ast2);
  39126. break;
  39127. case "pop":
  39128. if (stack.length < 1) {
  39129. return null;
  39130. }
  39131. stack.pop();
  39132. break;
  39133. case "index":
  39134. if (stack.length < 1) {
  39135. return null;
  39136. }
  39137. num1 = stack.pop();
  39138. if (num1.type !== "literal") {
  39139. return null;
  39140. }
  39141. n = num1.number;
  39142. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  39143. return null;
  39144. }
  39145. ast1 = stack[stack.length - n - 1];
  39146. if (ast1.type === "literal" || ast1.type === "var") {
  39147. stack.push(ast1);
  39148. break;
  39149. }
  39150. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  39151. stack[stack.length - n - 1] = tmpVar;
  39152. stack.push(tmpVar);
  39153. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  39154. break;
  39155. case "dup":
  39156. if (stack.length < 1) {
  39157. return null;
  39158. }
  39159. 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]) {
  39160. num1 = stack.pop();
  39161. stack.push(buildMinOperation(num1, code[i + 1]));
  39162. i += 6;
  39163. break;
  39164. }
  39165. ast1 = stack[stack.length - 1];
  39166. if (ast1.type === "literal" || ast1.type === "var") {
  39167. stack.push(ast1);
  39168. break;
  39169. }
  39170. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  39171. stack[stack.length - 1] = tmpVar;
  39172. stack.push(tmpVar);
  39173. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  39174. break;
  39175. case "roll":
  39176. if (stack.length < 2) {
  39177. return null;
  39178. }
  39179. num2 = stack.pop();
  39180. num1 = stack.pop();
  39181. if (num2.type !== "literal" || num1.type !== "literal") {
  39182. return null;
  39183. }
  39184. j = num2.number;
  39185. n = num1.number;
  39186. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  39187. return null;
  39188. }
  39189. j = (j % n + n) % n;
  39190. if (j === 0) {
  39191. break;
  39192. }
  39193. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  39194. break;
  39195. default:
  39196. return null;
  39197. }
  39198. }
  39199. if (stack.length !== outputSize) {
  39200. return null;
  39201. }
  39202. const result = [];
  39203. for (const instruction of instructions) {
  39204. const statementBuilder = new ExpressionBuilderVisitor();
  39205. instruction.visit(statementBuilder);
  39206. result.push(statementBuilder.toString());
  39207. }
  39208. for (let i = 0, ii = stack.length; i < ii; i++) {
  39209. const expr = stack[i],
  39210. statementBuilder = new ExpressionBuilderVisitor();
  39211. expr.visit(statementBuilder);
  39212. const min = range[i * 2],
  39213. max = range[i * 2 + 1];
  39214. const out = [statementBuilder.toString()];
  39215. if (min > expr.min) {
  39216. out.unshift("Math.max(", min, ", ");
  39217. out.push(")");
  39218. }
  39219. if (max < expr.max) {
  39220. out.unshift("Math.min(", max, ", ");
  39221. out.push(")");
  39222. }
  39223. out.unshift("dest[destOffset + ", i, "] = ");
  39224. out.push(";");
  39225. result.push(out.join(""));
  39226. }
  39227. return result.join("\n");
  39228. }
  39229. }
  39230. return PostScriptCompiler;
  39231. }();
  39232. exports.PostScriptCompiler = PostScriptCompiler;
  39233. /***/ }),
  39234. /* 50 */
  39235. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39236. Object.defineProperty(exports, "__esModule", ({
  39237. value: true
  39238. }));
  39239. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  39240. var _util = __w_pdfjs_require__(2);
  39241. var _primitives = __w_pdfjs_require__(5);
  39242. var _core_utils = __w_pdfjs_require__(9);
  39243. class PostScriptParser {
  39244. constructor(lexer) {
  39245. this.lexer = lexer;
  39246. this.operators = [];
  39247. this.token = null;
  39248. this.prev = null;
  39249. }
  39250. nextToken() {
  39251. this.prev = this.token;
  39252. this.token = this.lexer.getToken();
  39253. }
  39254. accept(type) {
  39255. if (this.token.type === type) {
  39256. this.nextToken();
  39257. return true;
  39258. }
  39259. return false;
  39260. }
  39261. expect(type) {
  39262. if (this.accept(type)) {
  39263. return true;
  39264. }
  39265. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  39266. }
  39267. parse() {
  39268. this.nextToken();
  39269. this.expect(PostScriptTokenTypes.LBRACE);
  39270. this.parseBlock();
  39271. this.expect(PostScriptTokenTypes.RBRACE);
  39272. return this.operators;
  39273. }
  39274. parseBlock() {
  39275. while (true) {
  39276. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  39277. this.operators.push(this.prev.value);
  39278. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  39279. this.operators.push(this.prev.value);
  39280. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  39281. this.parseCondition();
  39282. } else {
  39283. return;
  39284. }
  39285. }
  39286. }
  39287. parseCondition() {
  39288. const conditionLocation = this.operators.length;
  39289. this.operators.push(null, null);
  39290. this.parseBlock();
  39291. this.expect(PostScriptTokenTypes.RBRACE);
  39292. if (this.accept(PostScriptTokenTypes.IF)) {
  39293. this.operators[conditionLocation] = this.operators.length;
  39294. this.operators[conditionLocation + 1] = "jz";
  39295. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  39296. const jumpLocation = this.operators.length;
  39297. this.operators.push(null, null);
  39298. const endOfTrue = this.operators.length;
  39299. this.parseBlock();
  39300. this.expect(PostScriptTokenTypes.RBRACE);
  39301. this.expect(PostScriptTokenTypes.IFELSE);
  39302. this.operators[jumpLocation] = this.operators.length;
  39303. this.operators[jumpLocation + 1] = "j";
  39304. this.operators[conditionLocation] = endOfTrue;
  39305. this.operators[conditionLocation + 1] = "jz";
  39306. } else {
  39307. throw new _util.FormatError("PS Function: error parsing conditional.");
  39308. }
  39309. }
  39310. }
  39311. exports.PostScriptParser = PostScriptParser;
  39312. const PostScriptTokenTypes = {
  39313. LBRACE: 0,
  39314. RBRACE: 1,
  39315. NUMBER: 2,
  39316. OPERATOR: 3,
  39317. IF: 4,
  39318. IFELSE: 5
  39319. };
  39320. const PostScriptToken = function PostScriptTokenClosure() {
  39321. const opCache = Object.create(null);
  39322. class PostScriptToken {
  39323. constructor(type, value) {
  39324. this.type = type;
  39325. this.value = value;
  39326. }
  39327. static getOperator(op) {
  39328. const opValue = opCache[op];
  39329. if (opValue) {
  39330. return opValue;
  39331. }
  39332. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  39333. }
  39334. static get LBRACE() {
  39335. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  39336. }
  39337. static get RBRACE() {
  39338. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  39339. }
  39340. static get IF() {
  39341. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  39342. }
  39343. static get IFELSE() {
  39344. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  39345. }
  39346. }
  39347. return PostScriptToken;
  39348. }();
  39349. class PostScriptLexer {
  39350. constructor(stream) {
  39351. this.stream = stream;
  39352. this.nextChar();
  39353. this.strBuf = [];
  39354. }
  39355. nextChar() {
  39356. return this.currentChar = this.stream.getByte();
  39357. }
  39358. getToken() {
  39359. let comment = false;
  39360. let ch = this.currentChar;
  39361. while (true) {
  39362. if (ch < 0) {
  39363. return _primitives.EOF;
  39364. }
  39365. if (comment) {
  39366. if (ch === 0x0a || ch === 0x0d) {
  39367. comment = false;
  39368. }
  39369. } else if (ch === 0x25) {
  39370. comment = true;
  39371. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  39372. break;
  39373. }
  39374. ch = this.nextChar();
  39375. }
  39376. switch (ch | 0) {
  39377. case 0x30:
  39378. case 0x31:
  39379. case 0x32:
  39380. case 0x33:
  39381. case 0x34:
  39382. case 0x35:
  39383. case 0x36:
  39384. case 0x37:
  39385. case 0x38:
  39386. case 0x39:
  39387. case 0x2b:
  39388. case 0x2d:
  39389. case 0x2e:
  39390. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  39391. case 0x7b:
  39392. this.nextChar();
  39393. return PostScriptToken.LBRACE;
  39394. case 0x7d:
  39395. this.nextChar();
  39396. return PostScriptToken.RBRACE;
  39397. }
  39398. const strBuf = this.strBuf;
  39399. strBuf.length = 0;
  39400. strBuf[0] = String.fromCharCode(ch);
  39401. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  39402. strBuf.push(String.fromCharCode(ch));
  39403. }
  39404. const str = strBuf.join("");
  39405. switch (str.toLowerCase()) {
  39406. case "if":
  39407. return PostScriptToken.IF;
  39408. case "ifelse":
  39409. return PostScriptToken.IFELSE;
  39410. default:
  39411. return PostScriptToken.getOperator(str);
  39412. }
  39413. }
  39414. getNumber() {
  39415. let ch = this.currentChar;
  39416. const strBuf = this.strBuf;
  39417. strBuf.length = 0;
  39418. strBuf[0] = String.fromCharCode(ch);
  39419. while ((ch = this.nextChar()) >= 0) {
  39420. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  39421. strBuf.push(String.fromCharCode(ch));
  39422. } else {
  39423. break;
  39424. }
  39425. }
  39426. const value = parseFloat(strBuf.join(""));
  39427. if (isNaN(value)) {
  39428. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  39429. }
  39430. return value;
  39431. }
  39432. }
  39433. exports.PostScriptLexer = PostScriptLexer;
  39434. /***/ }),
  39435. /* 51 */
  39436. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39437. Object.defineProperty(exports, "__esModule", ({
  39438. value: true
  39439. }));
  39440. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  39441. var _util = __w_pdfjs_require__(2);
  39442. var _primitives = __w_pdfjs_require__(5);
  39443. class BaseLocalCache {
  39444. constructor(options) {
  39445. if (this.constructor === BaseLocalCache) {
  39446. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  39447. }
  39448. if (!options || !options.onlyRefs) {
  39449. this._nameRefMap = new Map();
  39450. this._imageMap = new Map();
  39451. }
  39452. this._imageCache = new _primitives.RefSetCache();
  39453. }
  39454. getByName(name) {
  39455. const ref = this._nameRefMap.get(name);
  39456. if (ref) {
  39457. return this.getByRef(ref);
  39458. }
  39459. return this._imageMap.get(name) || null;
  39460. }
  39461. getByRef(ref) {
  39462. return this._imageCache.get(ref) || null;
  39463. }
  39464. set(name, ref, data) {
  39465. (0, _util.unreachable)("Abstract method `set` called.");
  39466. }
  39467. }
  39468. class LocalImageCache extends BaseLocalCache {
  39469. set(name, ref = null, data) {
  39470. if (!name) {
  39471. throw new Error('LocalImageCache.set - expected "name" argument.');
  39472. }
  39473. if (ref) {
  39474. if (this._imageCache.has(ref)) {
  39475. return;
  39476. }
  39477. this._nameRefMap.set(name, ref);
  39478. this._imageCache.put(ref, data);
  39479. return;
  39480. }
  39481. if (this._imageMap.has(name)) {
  39482. return;
  39483. }
  39484. this._imageMap.set(name, data);
  39485. }
  39486. }
  39487. exports.LocalImageCache = LocalImageCache;
  39488. class LocalColorSpaceCache extends BaseLocalCache {
  39489. set(name = null, ref = null, data) {
  39490. if (!name && !ref) {
  39491. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  39492. }
  39493. if (ref) {
  39494. if (this._imageCache.has(ref)) {
  39495. return;
  39496. }
  39497. if (name) {
  39498. this._nameRefMap.set(name, ref);
  39499. }
  39500. this._imageCache.put(ref, data);
  39501. return;
  39502. }
  39503. if (this._imageMap.has(name)) {
  39504. return;
  39505. }
  39506. this._imageMap.set(name, data);
  39507. }
  39508. }
  39509. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  39510. class LocalFunctionCache extends BaseLocalCache {
  39511. constructor(options) {
  39512. super({
  39513. onlyRefs: true
  39514. });
  39515. }
  39516. getByName(name) {
  39517. (0, _util.unreachable)("Should not call `getByName` method.");
  39518. }
  39519. set(name = null, ref, data) {
  39520. if (!ref) {
  39521. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  39522. }
  39523. if (this._imageCache.has(ref)) {
  39524. return;
  39525. }
  39526. this._imageCache.put(ref, data);
  39527. }
  39528. }
  39529. exports.LocalFunctionCache = LocalFunctionCache;
  39530. class LocalGStateCache extends BaseLocalCache {
  39531. set(name, ref = null, data) {
  39532. if (!name) {
  39533. throw new Error('LocalGStateCache.set - expected "name" argument.');
  39534. }
  39535. if (ref) {
  39536. if (this._imageCache.has(ref)) {
  39537. return;
  39538. }
  39539. this._nameRefMap.set(name, ref);
  39540. this._imageCache.put(ref, data);
  39541. return;
  39542. }
  39543. if (this._imageMap.has(name)) {
  39544. return;
  39545. }
  39546. this._imageMap.set(name, data);
  39547. }
  39548. }
  39549. exports.LocalGStateCache = LocalGStateCache;
  39550. class LocalTilingPatternCache extends BaseLocalCache {
  39551. set(name, ref = null, data) {
  39552. if (!name) {
  39553. throw new Error('LocalTilingPatternCache.set - expected "name" argument.');
  39554. }
  39555. if (ref) {
  39556. if (this._imageCache.has(ref)) {
  39557. return;
  39558. }
  39559. this._nameRefMap.set(name, ref);
  39560. this._imageCache.put(ref, data);
  39561. return;
  39562. }
  39563. if (this._imageMap.has(name)) {
  39564. return;
  39565. }
  39566. this._imageMap.set(name, data);
  39567. }
  39568. }
  39569. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  39570. class GlobalImageCache {
  39571. static get NUM_PAGES_THRESHOLD() {
  39572. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  39573. }
  39574. static get MIN_IMAGES_TO_CACHE() {
  39575. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  39576. }
  39577. static get MAX_BYTE_SIZE() {
  39578. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  39579. }
  39580. constructor() {
  39581. this._refCache = new _primitives.RefSetCache();
  39582. this._imageCache = new _primitives.RefSetCache();
  39583. }
  39584. get _byteSize() {
  39585. let byteSize = 0;
  39586. this._imageCache.forEach(imageData => {
  39587. byteSize += imageData.byteSize;
  39588. });
  39589. return byteSize;
  39590. }
  39591. get _cacheLimitReached() {
  39592. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  39593. return false;
  39594. }
  39595. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  39596. return false;
  39597. }
  39598. return true;
  39599. }
  39600. shouldCache(ref, pageIndex) {
  39601. const pageIndexSet = this._refCache.get(ref);
  39602. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  39603. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  39604. return false;
  39605. }
  39606. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  39607. return false;
  39608. }
  39609. return true;
  39610. }
  39611. addPageIndex(ref, pageIndex) {
  39612. let pageIndexSet = this._refCache.get(ref);
  39613. if (!pageIndexSet) {
  39614. pageIndexSet = new Set();
  39615. this._refCache.put(ref, pageIndexSet);
  39616. }
  39617. pageIndexSet.add(pageIndex);
  39618. }
  39619. addByteSize(ref, byteSize) {
  39620. const imageData = this._imageCache.get(ref);
  39621. if (!imageData) {
  39622. return;
  39623. }
  39624. if (imageData.byteSize) {
  39625. return;
  39626. }
  39627. imageData.byteSize = byteSize;
  39628. }
  39629. getData(ref, pageIndex) {
  39630. const pageIndexSet = this._refCache.get(ref);
  39631. if (!pageIndexSet) {
  39632. return null;
  39633. }
  39634. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  39635. return null;
  39636. }
  39637. const imageData = this._imageCache.get(ref);
  39638. if (!imageData) {
  39639. return null;
  39640. }
  39641. pageIndexSet.add(pageIndex);
  39642. return imageData;
  39643. }
  39644. setData(ref, data) {
  39645. if (!this._refCache.has(ref)) {
  39646. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  39647. }
  39648. if (this._imageCache.has(ref)) {
  39649. return;
  39650. }
  39651. if (this._cacheLimitReached) {
  39652. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  39653. return;
  39654. }
  39655. this._imageCache.put(ref, data);
  39656. }
  39657. clear(onlyData = false) {
  39658. if (!onlyData) {
  39659. this._refCache.clear();
  39660. }
  39661. this._imageCache.clear();
  39662. }
  39663. }
  39664. exports.GlobalImageCache = GlobalImageCache;
  39665. /***/ }),
  39666. /* 52 */
  39667. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39668. Object.defineProperty(exports, "__esModule", ({
  39669. value: true
  39670. }));
  39671. exports.bidi = bidi;
  39672. var _util = __w_pdfjs_require__(2);
  39673. 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"];
  39674. 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"];
  39675. function isOdd(i) {
  39676. return (i & 1) !== 0;
  39677. }
  39678. function isEven(i) {
  39679. return (i & 1) === 0;
  39680. }
  39681. function findUnequal(arr, start, value) {
  39682. let j, jj;
  39683. for (j = start, jj = arr.length; j < jj; ++j) {
  39684. if (arr[j] !== value) {
  39685. return j;
  39686. }
  39687. }
  39688. return j;
  39689. }
  39690. function setValues(arr, start, end, value) {
  39691. for (let j = start; j < end; ++j) {
  39692. arr[j] = value;
  39693. }
  39694. }
  39695. function reverseValues(arr, start, end) {
  39696. for (let i = start, j = end - 1; i < j; ++i, --j) {
  39697. const temp = arr[i];
  39698. arr[i] = arr[j];
  39699. arr[j] = temp;
  39700. }
  39701. }
  39702. function createBidiText(str, isLTR, vertical = false) {
  39703. let dir = "ltr";
  39704. if (vertical) {
  39705. dir = "ttb";
  39706. } else if (!isLTR) {
  39707. dir = "rtl";
  39708. }
  39709. return {
  39710. str,
  39711. dir
  39712. };
  39713. }
  39714. const chars = [];
  39715. const types = [];
  39716. function bidi(str, startLevel, vertical) {
  39717. let isLTR = true;
  39718. const strLength = str.length;
  39719. if (strLength === 0 || vertical) {
  39720. return createBidiText(str, isLTR, vertical);
  39721. }
  39722. chars.length = strLength;
  39723. types.length = strLength;
  39724. let numBidi = 0;
  39725. let i, ii;
  39726. for (i = 0; i < strLength; ++i) {
  39727. chars[i] = str.charAt(i);
  39728. const charCode = str.charCodeAt(i);
  39729. let charType = "L";
  39730. if (charCode <= 0x00ff) {
  39731. charType = baseTypes[charCode];
  39732. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  39733. charType = "R";
  39734. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  39735. charType = arabicTypes[charCode & 0xff];
  39736. if (!charType) {
  39737. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  39738. }
  39739. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  39740. charType = "AL";
  39741. }
  39742. if (charType === "R" || charType === "AL" || charType === "AN") {
  39743. numBidi++;
  39744. }
  39745. types[i] = charType;
  39746. }
  39747. if (numBidi === 0) {
  39748. isLTR = true;
  39749. return createBidiText(str, isLTR);
  39750. }
  39751. if (startLevel === -1) {
  39752. if (numBidi / strLength < 0.3) {
  39753. isLTR = true;
  39754. startLevel = 0;
  39755. } else {
  39756. isLTR = false;
  39757. startLevel = 1;
  39758. }
  39759. }
  39760. const levels = [];
  39761. for (i = 0; i < strLength; ++i) {
  39762. levels[i] = startLevel;
  39763. }
  39764. const e = isOdd(startLevel) ? "R" : "L";
  39765. const sor = e;
  39766. const eor = sor;
  39767. let lastType = sor;
  39768. for (i = 0; i < strLength; ++i) {
  39769. if (types[i] === "NSM") {
  39770. types[i] = lastType;
  39771. } else {
  39772. lastType = types[i];
  39773. }
  39774. }
  39775. lastType = sor;
  39776. let t;
  39777. for (i = 0; i < strLength; ++i) {
  39778. t = types[i];
  39779. if (t === "EN") {
  39780. types[i] = lastType === "AL" ? "AN" : "EN";
  39781. } else if (t === "R" || t === "L" || t === "AL") {
  39782. lastType = t;
  39783. }
  39784. }
  39785. for (i = 0; i < strLength; ++i) {
  39786. t = types[i];
  39787. if (t === "AL") {
  39788. types[i] = "R";
  39789. }
  39790. }
  39791. for (i = 1; i < strLength - 1; ++i) {
  39792. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  39793. types[i] = "EN";
  39794. }
  39795. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  39796. types[i] = types[i - 1];
  39797. }
  39798. }
  39799. for (i = 0; i < strLength; ++i) {
  39800. if (types[i] === "EN") {
  39801. for (let j = i - 1; j >= 0; --j) {
  39802. if (types[j] !== "ET") {
  39803. break;
  39804. }
  39805. types[j] = "EN";
  39806. }
  39807. for (let j = i + 1; j < strLength; ++j) {
  39808. if (types[j] !== "ET") {
  39809. break;
  39810. }
  39811. types[j] = "EN";
  39812. }
  39813. }
  39814. }
  39815. for (i = 0; i < strLength; ++i) {
  39816. t = types[i];
  39817. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  39818. types[i] = "ON";
  39819. }
  39820. }
  39821. lastType = sor;
  39822. for (i = 0; i < strLength; ++i) {
  39823. t = types[i];
  39824. if (t === "EN") {
  39825. types[i] = lastType === "L" ? "L" : "EN";
  39826. } else if (t === "R" || t === "L") {
  39827. lastType = t;
  39828. }
  39829. }
  39830. for (i = 0; i < strLength; ++i) {
  39831. if (types[i] === "ON") {
  39832. const end = findUnequal(types, i + 1, "ON");
  39833. let before = sor;
  39834. if (i > 0) {
  39835. before = types[i - 1];
  39836. }
  39837. let after = eor;
  39838. if (end + 1 < strLength) {
  39839. after = types[end + 1];
  39840. }
  39841. if (before !== "L") {
  39842. before = "R";
  39843. }
  39844. if (after !== "L") {
  39845. after = "R";
  39846. }
  39847. if (before === after) {
  39848. setValues(types, i, end, before);
  39849. }
  39850. i = end - 1;
  39851. }
  39852. }
  39853. for (i = 0; i < strLength; ++i) {
  39854. if (types[i] === "ON") {
  39855. types[i] = e;
  39856. }
  39857. }
  39858. for (i = 0; i < strLength; ++i) {
  39859. t = types[i];
  39860. if (isEven(levels[i])) {
  39861. if (t === "R") {
  39862. levels[i] += 1;
  39863. } else if (t === "AN" || t === "EN") {
  39864. levels[i] += 2;
  39865. }
  39866. } else {
  39867. if (t === "L" || t === "AN" || t === "EN") {
  39868. levels[i] += 1;
  39869. }
  39870. }
  39871. }
  39872. let highestLevel = -1;
  39873. let lowestOddLevel = 99;
  39874. let level;
  39875. for (i = 0, ii = levels.length; i < ii; ++i) {
  39876. level = levels[i];
  39877. if (highestLevel < level) {
  39878. highestLevel = level;
  39879. }
  39880. if (lowestOddLevel > level && isOdd(level)) {
  39881. lowestOddLevel = level;
  39882. }
  39883. }
  39884. for (level = highestLevel; level >= lowestOddLevel; --level) {
  39885. let start = -1;
  39886. for (i = 0, ii = levels.length; i < ii; ++i) {
  39887. if (levels[i] < level) {
  39888. if (start >= 0) {
  39889. reverseValues(chars, start, i);
  39890. start = -1;
  39891. }
  39892. } else if (start < 0) {
  39893. start = i;
  39894. }
  39895. }
  39896. if (start >= 0) {
  39897. reverseValues(chars, start, levels.length);
  39898. }
  39899. }
  39900. for (i = 0, ii = chars.length; i < ii; ++i) {
  39901. const ch = chars[i];
  39902. if (ch === "<" || ch === ">") {
  39903. chars[i] = "";
  39904. }
  39905. }
  39906. return createBidiText(chars.join(""), isLTR);
  39907. }
  39908. /***/ }),
  39909. /* 53 */
  39910. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39911. Object.defineProperty(exports, "__esModule", ({
  39912. value: true
  39913. }));
  39914. exports.getMetrics = void 0;
  39915. var _core_utils = __w_pdfjs_require__(9);
  39916. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  39917. t.Courier = 600;
  39918. t["Courier-Bold"] = 600;
  39919. t["Courier-BoldOblique"] = 600;
  39920. t["Courier-Oblique"] = 600;
  39921. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  39922. t.space = 278;
  39923. t.exclam = 278;
  39924. t.quotedbl = 355;
  39925. t.numbersign = 556;
  39926. t.dollar = 556;
  39927. t.percent = 889;
  39928. t.ampersand = 667;
  39929. t.quoteright = 222;
  39930. t.parenleft = 333;
  39931. t.parenright = 333;
  39932. t.asterisk = 389;
  39933. t.plus = 584;
  39934. t.comma = 278;
  39935. t.hyphen = 333;
  39936. t.period = 278;
  39937. t.slash = 278;
  39938. t.zero = 556;
  39939. t.one = 556;
  39940. t.two = 556;
  39941. t.three = 556;
  39942. t.four = 556;
  39943. t.five = 556;
  39944. t.six = 556;
  39945. t.seven = 556;
  39946. t.eight = 556;
  39947. t.nine = 556;
  39948. t.colon = 278;
  39949. t.semicolon = 278;
  39950. t.less = 584;
  39951. t.equal = 584;
  39952. t.greater = 584;
  39953. t.question = 556;
  39954. t.at = 1015;
  39955. t.A = 667;
  39956. t.B = 667;
  39957. t.C = 722;
  39958. t.D = 722;
  39959. t.E = 667;
  39960. t.F = 611;
  39961. t.G = 778;
  39962. t.H = 722;
  39963. t.I = 278;
  39964. t.J = 500;
  39965. t.K = 667;
  39966. t.L = 556;
  39967. t.M = 833;
  39968. t.N = 722;
  39969. t.O = 778;
  39970. t.P = 667;
  39971. t.Q = 778;
  39972. t.R = 722;
  39973. t.S = 667;
  39974. t.T = 611;
  39975. t.U = 722;
  39976. t.V = 667;
  39977. t.W = 944;
  39978. t.X = 667;
  39979. t.Y = 667;
  39980. t.Z = 611;
  39981. t.bracketleft = 278;
  39982. t.backslash = 278;
  39983. t.bracketright = 278;
  39984. t.asciicircum = 469;
  39985. t.underscore = 556;
  39986. t.quoteleft = 222;
  39987. t.a = 556;
  39988. t.b = 556;
  39989. t.c = 500;
  39990. t.d = 556;
  39991. t.e = 556;
  39992. t.f = 278;
  39993. t.g = 556;
  39994. t.h = 556;
  39995. t.i = 222;
  39996. t.j = 222;
  39997. t.k = 500;
  39998. t.l = 222;
  39999. t.m = 833;
  40000. t.n = 556;
  40001. t.o = 556;
  40002. t.p = 556;
  40003. t.q = 556;
  40004. t.r = 333;
  40005. t.s = 500;
  40006. t.t = 278;
  40007. t.u = 556;
  40008. t.v = 500;
  40009. t.w = 722;
  40010. t.x = 500;
  40011. t.y = 500;
  40012. t.z = 500;
  40013. t.braceleft = 334;
  40014. t.bar = 260;
  40015. t.braceright = 334;
  40016. t.asciitilde = 584;
  40017. t.exclamdown = 333;
  40018. t.cent = 556;
  40019. t.sterling = 556;
  40020. t.fraction = 167;
  40021. t.yen = 556;
  40022. t.florin = 556;
  40023. t.section = 556;
  40024. t.currency = 556;
  40025. t.quotesingle = 191;
  40026. t.quotedblleft = 333;
  40027. t.guillemotleft = 556;
  40028. t.guilsinglleft = 333;
  40029. t.guilsinglright = 333;
  40030. t.fi = 500;
  40031. t.fl = 500;
  40032. t.endash = 556;
  40033. t.dagger = 556;
  40034. t.daggerdbl = 556;
  40035. t.periodcentered = 278;
  40036. t.paragraph = 537;
  40037. t.bullet = 350;
  40038. t.quotesinglbase = 222;
  40039. t.quotedblbase = 333;
  40040. t.quotedblright = 333;
  40041. t.guillemotright = 556;
  40042. t.ellipsis = 1000;
  40043. t.perthousand = 1000;
  40044. t.questiondown = 611;
  40045. t.grave = 333;
  40046. t.acute = 333;
  40047. t.circumflex = 333;
  40048. t.tilde = 333;
  40049. t.macron = 333;
  40050. t.breve = 333;
  40051. t.dotaccent = 333;
  40052. t.dieresis = 333;
  40053. t.ring = 333;
  40054. t.cedilla = 333;
  40055. t.hungarumlaut = 333;
  40056. t.ogonek = 333;
  40057. t.caron = 333;
  40058. t.emdash = 1000;
  40059. t.AE = 1000;
  40060. t.ordfeminine = 370;
  40061. t.Lslash = 556;
  40062. t.Oslash = 778;
  40063. t.OE = 1000;
  40064. t.ordmasculine = 365;
  40065. t.ae = 889;
  40066. t.dotlessi = 278;
  40067. t.lslash = 222;
  40068. t.oslash = 611;
  40069. t.oe = 944;
  40070. t.germandbls = 611;
  40071. t.Idieresis = 278;
  40072. t.eacute = 556;
  40073. t.abreve = 556;
  40074. t.uhungarumlaut = 556;
  40075. t.ecaron = 556;
  40076. t.Ydieresis = 667;
  40077. t.divide = 584;
  40078. t.Yacute = 667;
  40079. t.Acircumflex = 667;
  40080. t.aacute = 556;
  40081. t.Ucircumflex = 722;
  40082. t.yacute = 500;
  40083. t.scommaaccent = 500;
  40084. t.ecircumflex = 556;
  40085. t.Uring = 722;
  40086. t.Udieresis = 722;
  40087. t.aogonek = 556;
  40088. t.Uacute = 722;
  40089. t.uogonek = 556;
  40090. t.Edieresis = 667;
  40091. t.Dcroat = 722;
  40092. t.commaaccent = 250;
  40093. t.copyright = 737;
  40094. t.Emacron = 667;
  40095. t.ccaron = 500;
  40096. t.aring = 556;
  40097. t.Ncommaaccent = 722;
  40098. t.lacute = 222;
  40099. t.agrave = 556;
  40100. t.Tcommaaccent = 611;
  40101. t.Cacute = 722;
  40102. t.atilde = 556;
  40103. t.Edotaccent = 667;
  40104. t.scaron = 500;
  40105. t.scedilla = 500;
  40106. t.iacute = 278;
  40107. t.lozenge = 471;
  40108. t.Rcaron = 722;
  40109. t.Gcommaaccent = 778;
  40110. t.ucircumflex = 556;
  40111. t.acircumflex = 556;
  40112. t.Amacron = 667;
  40113. t.rcaron = 333;
  40114. t.ccedilla = 500;
  40115. t.Zdotaccent = 611;
  40116. t.Thorn = 667;
  40117. t.Omacron = 778;
  40118. t.Racute = 722;
  40119. t.Sacute = 667;
  40120. t.dcaron = 643;
  40121. t.Umacron = 722;
  40122. t.uring = 556;
  40123. t.threesuperior = 333;
  40124. t.Ograve = 778;
  40125. t.Agrave = 667;
  40126. t.Abreve = 667;
  40127. t.multiply = 584;
  40128. t.uacute = 556;
  40129. t.Tcaron = 611;
  40130. t.partialdiff = 476;
  40131. t.ydieresis = 500;
  40132. t.Nacute = 722;
  40133. t.icircumflex = 278;
  40134. t.Ecircumflex = 667;
  40135. t.adieresis = 556;
  40136. t.edieresis = 556;
  40137. t.cacute = 500;
  40138. t.nacute = 556;
  40139. t.umacron = 556;
  40140. t.Ncaron = 722;
  40141. t.Iacute = 278;
  40142. t.plusminus = 584;
  40143. t.brokenbar = 260;
  40144. t.registered = 737;
  40145. t.Gbreve = 778;
  40146. t.Idotaccent = 278;
  40147. t.summation = 600;
  40148. t.Egrave = 667;
  40149. t.racute = 333;
  40150. t.omacron = 556;
  40151. t.Zacute = 611;
  40152. t.Zcaron = 611;
  40153. t.greaterequal = 549;
  40154. t.Eth = 722;
  40155. t.Ccedilla = 722;
  40156. t.lcommaaccent = 222;
  40157. t.tcaron = 317;
  40158. t.eogonek = 556;
  40159. t.Uogonek = 722;
  40160. t.Aacute = 667;
  40161. t.Adieresis = 667;
  40162. t.egrave = 556;
  40163. t.zacute = 500;
  40164. t.iogonek = 222;
  40165. t.Oacute = 778;
  40166. t.oacute = 556;
  40167. t.amacron = 556;
  40168. t.sacute = 500;
  40169. t.idieresis = 278;
  40170. t.Ocircumflex = 778;
  40171. t.Ugrave = 722;
  40172. t.Delta = 612;
  40173. t.thorn = 556;
  40174. t.twosuperior = 333;
  40175. t.Odieresis = 778;
  40176. t.mu = 556;
  40177. t.igrave = 278;
  40178. t.ohungarumlaut = 556;
  40179. t.Eogonek = 667;
  40180. t.dcroat = 556;
  40181. t.threequarters = 834;
  40182. t.Scedilla = 667;
  40183. t.lcaron = 299;
  40184. t.Kcommaaccent = 667;
  40185. t.Lacute = 556;
  40186. t.trademark = 1000;
  40187. t.edotaccent = 556;
  40188. t.Igrave = 278;
  40189. t.Imacron = 278;
  40190. t.Lcaron = 556;
  40191. t.onehalf = 834;
  40192. t.lessequal = 549;
  40193. t.ocircumflex = 556;
  40194. t.ntilde = 556;
  40195. t.Uhungarumlaut = 722;
  40196. t.Eacute = 667;
  40197. t.emacron = 556;
  40198. t.gbreve = 556;
  40199. t.onequarter = 834;
  40200. t.Scaron = 667;
  40201. t.Scommaaccent = 667;
  40202. t.Ohungarumlaut = 778;
  40203. t.degree = 400;
  40204. t.ograve = 556;
  40205. t.Ccaron = 722;
  40206. t.ugrave = 556;
  40207. t.radical = 453;
  40208. t.Dcaron = 722;
  40209. t.rcommaaccent = 333;
  40210. t.Ntilde = 722;
  40211. t.otilde = 556;
  40212. t.Rcommaaccent = 722;
  40213. t.Lcommaaccent = 556;
  40214. t.Atilde = 667;
  40215. t.Aogonek = 667;
  40216. t.Aring = 667;
  40217. t.Otilde = 778;
  40218. t.zdotaccent = 500;
  40219. t.Ecaron = 667;
  40220. t.Iogonek = 278;
  40221. t.kcommaaccent = 500;
  40222. t.minus = 584;
  40223. t.Icircumflex = 278;
  40224. t.ncaron = 556;
  40225. t.tcommaaccent = 278;
  40226. t.logicalnot = 584;
  40227. t.odieresis = 556;
  40228. t.udieresis = 556;
  40229. t.notequal = 549;
  40230. t.gcommaaccent = 556;
  40231. t.eth = 556;
  40232. t.zcaron = 500;
  40233. t.ncommaaccent = 556;
  40234. t.onesuperior = 333;
  40235. t.imacron = 278;
  40236. t.Euro = 556;
  40237. });
  40238. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40239. t.space = 278;
  40240. t.exclam = 333;
  40241. t.quotedbl = 474;
  40242. t.numbersign = 556;
  40243. t.dollar = 556;
  40244. t.percent = 889;
  40245. t.ampersand = 722;
  40246. t.quoteright = 278;
  40247. t.parenleft = 333;
  40248. t.parenright = 333;
  40249. t.asterisk = 389;
  40250. t.plus = 584;
  40251. t.comma = 278;
  40252. t.hyphen = 333;
  40253. t.period = 278;
  40254. t.slash = 278;
  40255. t.zero = 556;
  40256. t.one = 556;
  40257. t.two = 556;
  40258. t.three = 556;
  40259. t.four = 556;
  40260. t.five = 556;
  40261. t.six = 556;
  40262. t.seven = 556;
  40263. t.eight = 556;
  40264. t.nine = 556;
  40265. t.colon = 333;
  40266. t.semicolon = 333;
  40267. t.less = 584;
  40268. t.equal = 584;
  40269. t.greater = 584;
  40270. t.question = 611;
  40271. t.at = 975;
  40272. t.A = 722;
  40273. t.B = 722;
  40274. t.C = 722;
  40275. t.D = 722;
  40276. t.E = 667;
  40277. t.F = 611;
  40278. t.G = 778;
  40279. t.H = 722;
  40280. t.I = 278;
  40281. t.J = 556;
  40282. t.K = 722;
  40283. t.L = 611;
  40284. t.M = 833;
  40285. t.N = 722;
  40286. t.O = 778;
  40287. t.P = 667;
  40288. t.Q = 778;
  40289. t.R = 722;
  40290. t.S = 667;
  40291. t.T = 611;
  40292. t.U = 722;
  40293. t.V = 667;
  40294. t.W = 944;
  40295. t.X = 667;
  40296. t.Y = 667;
  40297. t.Z = 611;
  40298. t.bracketleft = 333;
  40299. t.backslash = 278;
  40300. t.bracketright = 333;
  40301. t.asciicircum = 584;
  40302. t.underscore = 556;
  40303. t.quoteleft = 278;
  40304. t.a = 556;
  40305. t.b = 611;
  40306. t.c = 556;
  40307. t.d = 611;
  40308. t.e = 556;
  40309. t.f = 333;
  40310. t.g = 611;
  40311. t.h = 611;
  40312. t.i = 278;
  40313. t.j = 278;
  40314. t.k = 556;
  40315. t.l = 278;
  40316. t.m = 889;
  40317. t.n = 611;
  40318. t.o = 611;
  40319. t.p = 611;
  40320. t.q = 611;
  40321. t.r = 389;
  40322. t.s = 556;
  40323. t.t = 333;
  40324. t.u = 611;
  40325. t.v = 556;
  40326. t.w = 778;
  40327. t.x = 556;
  40328. t.y = 556;
  40329. t.z = 500;
  40330. t.braceleft = 389;
  40331. t.bar = 280;
  40332. t.braceright = 389;
  40333. t.asciitilde = 584;
  40334. t.exclamdown = 333;
  40335. t.cent = 556;
  40336. t.sterling = 556;
  40337. t.fraction = 167;
  40338. t.yen = 556;
  40339. t.florin = 556;
  40340. t.section = 556;
  40341. t.currency = 556;
  40342. t.quotesingle = 238;
  40343. t.quotedblleft = 500;
  40344. t.guillemotleft = 556;
  40345. t.guilsinglleft = 333;
  40346. t.guilsinglright = 333;
  40347. t.fi = 611;
  40348. t.fl = 611;
  40349. t.endash = 556;
  40350. t.dagger = 556;
  40351. t.daggerdbl = 556;
  40352. t.periodcentered = 278;
  40353. t.paragraph = 556;
  40354. t.bullet = 350;
  40355. t.quotesinglbase = 278;
  40356. t.quotedblbase = 500;
  40357. t.quotedblright = 500;
  40358. t.guillemotright = 556;
  40359. t.ellipsis = 1000;
  40360. t.perthousand = 1000;
  40361. t.questiondown = 611;
  40362. t.grave = 333;
  40363. t.acute = 333;
  40364. t.circumflex = 333;
  40365. t.tilde = 333;
  40366. t.macron = 333;
  40367. t.breve = 333;
  40368. t.dotaccent = 333;
  40369. t.dieresis = 333;
  40370. t.ring = 333;
  40371. t.cedilla = 333;
  40372. t.hungarumlaut = 333;
  40373. t.ogonek = 333;
  40374. t.caron = 333;
  40375. t.emdash = 1000;
  40376. t.AE = 1000;
  40377. t.ordfeminine = 370;
  40378. t.Lslash = 611;
  40379. t.Oslash = 778;
  40380. t.OE = 1000;
  40381. t.ordmasculine = 365;
  40382. t.ae = 889;
  40383. t.dotlessi = 278;
  40384. t.lslash = 278;
  40385. t.oslash = 611;
  40386. t.oe = 944;
  40387. t.germandbls = 611;
  40388. t.Idieresis = 278;
  40389. t.eacute = 556;
  40390. t.abreve = 556;
  40391. t.uhungarumlaut = 611;
  40392. t.ecaron = 556;
  40393. t.Ydieresis = 667;
  40394. t.divide = 584;
  40395. t.Yacute = 667;
  40396. t.Acircumflex = 722;
  40397. t.aacute = 556;
  40398. t.Ucircumflex = 722;
  40399. t.yacute = 556;
  40400. t.scommaaccent = 556;
  40401. t.ecircumflex = 556;
  40402. t.Uring = 722;
  40403. t.Udieresis = 722;
  40404. t.aogonek = 556;
  40405. t.Uacute = 722;
  40406. t.uogonek = 611;
  40407. t.Edieresis = 667;
  40408. t.Dcroat = 722;
  40409. t.commaaccent = 250;
  40410. t.copyright = 737;
  40411. t.Emacron = 667;
  40412. t.ccaron = 556;
  40413. t.aring = 556;
  40414. t.Ncommaaccent = 722;
  40415. t.lacute = 278;
  40416. t.agrave = 556;
  40417. t.Tcommaaccent = 611;
  40418. t.Cacute = 722;
  40419. t.atilde = 556;
  40420. t.Edotaccent = 667;
  40421. t.scaron = 556;
  40422. t.scedilla = 556;
  40423. t.iacute = 278;
  40424. t.lozenge = 494;
  40425. t.Rcaron = 722;
  40426. t.Gcommaaccent = 778;
  40427. t.ucircumflex = 611;
  40428. t.acircumflex = 556;
  40429. t.Amacron = 722;
  40430. t.rcaron = 389;
  40431. t.ccedilla = 556;
  40432. t.Zdotaccent = 611;
  40433. t.Thorn = 667;
  40434. t.Omacron = 778;
  40435. t.Racute = 722;
  40436. t.Sacute = 667;
  40437. t.dcaron = 743;
  40438. t.Umacron = 722;
  40439. t.uring = 611;
  40440. t.threesuperior = 333;
  40441. t.Ograve = 778;
  40442. t.Agrave = 722;
  40443. t.Abreve = 722;
  40444. t.multiply = 584;
  40445. t.uacute = 611;
  40446. t.Tcaron = 611;
  40447. t.partialdiff = 494;
  40448. t.ydieresis = 556;
  40449. t.Nacute = 722;
  40450. t.icircumflex = 278;
  40451. t.Ecircumflex = 667;
  40452. t.adieresis = 556;
  40453. t.edieresis = 556;
  40454. t.cacute = 556;
  40455. t.nacute = 611;
  40456. t.umacron = 611;
  40457. t.Ncaron = 722;
  40458. t.Iacute = 278;
  40459. t.plusminus = 584;
  40460. t.brokenbar = 280;
  40461. t.registered = 737;
  40462. t.Gbreve = 778;
  40463. t.Idotaccent = 278;
  40464. t.summation = 600;
  40465. t.Egrave = 667;
  40466. t.racute = 389;
  40467. t.omacron = 611;
  40468. t.Zacute = 611;
  40469. t.Zcaron = 611;
  40470. t.greaterequal = 549;
  40471. t.Eth = 722;
  40472. t.Ccedilla = 722;
  40473. t.lcommaaccent = 278;
  40474. t.tcaron = 389;
  40475. t.eogonek = 556;
  40476. t.Uogonek = 722;
  40477. t.Aacute = 722;
  40478. t.Adieresis = 722;
  40479. t.egrave = 556;
  40480. t.zacute = 500;
  40481. t.iogonek = 278;
  40482. t.Oacute = 778;
  40483. t.oacute = 611;
  40484. t.amacron = 556;
  40485. t.sacute = 556;
  40486. t.idieresis = 278;
  40487. t.Ocircumflex = 778;
  40488. t.Ugrave = 722;
  40489. t.Delta = 612;
  40490. t.thorn = 611;
  40491. t.twosuperior = 333;
  40492. t.Odieresis = 778;
  40493. t.mu = 611;
  40494. t.igrave = 278;
  40495. t.ohungarumlaut = 611;
  40496. t.Eogonek = 667;
  40497. t.dcroat = 611;
  40498. t.threequarters = 834;
  40499. t.Scedilla = 667;
  40500. t.lcaron = 400;
  40501. t.Kcommaaccent = 722;
  40502. t.Lacute = 611;
  40503. t.trademark = 1000;
  40504. t.edotaccent = 556;
  40505. t.Igrave = 278;
  40506. t.Imacron = 278;
  40507. t.Lcaron = 611;
  40508. t.onehalf = 834;
  40509. t.lessequal = 549;
  40510. t.ocircumflex = 611;
  40511. t.ntilde = 611;
  40512. t.Uhungarumlaut = 722;
  40513. t.Eacute = 667;
  40514. t.emacron = 556;
  40515. t.gbreve = 611;
  40516. t.onequarter = 834;
  40517. t.Scaron = 667;
  40518. t.Scommaaccent = 667;
  40519. t.Ohungarumlaut = 778;
  40520. t.degree = 400;
  40521. t.ograve = 611;
  40522. t.Ccaron = 722;
  40523. t.ugrave = 611;
  40524. t.radical = 549;
  40525. t.Dcaron = 722;
  40526. t.rcommaaccent = 389;
  40527. t.Ntilde = 722;
  40528. t.otilde = 611;
  40529. t.Rcommaaccent = 722;
  40530. t.Lcommaaccent = 611;
  40531. t.Atilde = 722;
  40532. t.Aogonek = 722;
  40533. t.Aring = 722;
  40534. t.Otilde = 778;
  40535. t.zdotaccent = 500;
  40536. t.Ecaron = 667;
  40537. t.Iogonek = 278;
  40538. t.kcommaaccent = 556;
  40539. t.minus = 584;
  40540. t.Icircumflex = 278;
  40541. t.ncaron = 611;
  40542. t.tcommaaccent = 333;
  40543. t.logicalnot = 584;
  40544. t.odieresis = 611;
  40545. t.udieresis = 611;
  40546. t.notequal = 549;
  40547. t.gcommaaccent = 611;
  40548. t.eth = 611;
  40549. t.zcaron = 500;
  40550. t.ncommaaccent = 611;
  40551. t.onesuperior = 333;
  40552. t.imacron = 278;
  40553. t.Euro = 556;
  40554. });
  40555. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40556. t.space = 278;
  40557. t.exclam = 333;
  40558. t.quotedbl = 474;
  40559. t.numbersign = 556;
  40560. t.dollar = 556;
  40561. t.percent = 889;
  40562. t.ampersand = 722;
  40563. t.quoteright = 278;
  40564. t.parenleft = 333;
  40565. t.parenright = 333;
  40566. t.asterisk = 389;
  40567. t.plus = 584;
  40568. t.comma = 278;
  40569. t.hyphen = 333;
  40570. t.period = 278;
  40571. t.slash = 278;
  40572. t.zero = 556;
  40573. t.one = 556;
  40574. t.two = 556;
  40575. t.three = 556;
  40576. t.four = 556;
  40577. t.five = 556;
  40578. t.six = 556;
  40579. t.seven = 556;
  40580. t.eight = 556;
  40581. t.nine = 556;
  40582. t.colon = 333;
  40583. t.semicolon = 333;
  40584. t.less = 584;
  40585. t.equal = 584;
  40586. t.greater = 584;
  40587. t.question = 611;
  40588. t.at = 975;
  40589. t.A = 722;
  40590. t.B = 722;
  40591. t.C = 722;
  40592. t.D = 722;
  40593. t.E = 667;
  40594. t.F = 611;
  40595. t.G = 778;
  40596. t.H = 722;
  40597. t.I = 278;
  40598. t.J = 556;
  40599. t.K = 722;
  40600. t.L = 611;
  40601. t.M = 833;
  40602. t.N = 722;
  40603. t.O = 778;
  40604. t.P = 667;
  40605. t.Q = 778;
  40606. t.R = 722;
  40607. t.S = 667;
  40608. t.T = 611;
  40609. t.U = 722;
  40610. t.V = 667;
  40611. t.W = 944;
  40612. t.X = 667;
  40613. t.Y = 667;
  40614. t.Z = 611;
  40615. t.bracketleft = 333;
  40616. t.backslash = 278;
  40617. t.bracketright = 333;
  40618. t.asciicircum = 584;
  40619. t.underscore = 556;
  40620. t.quoteleft = 278;
  40621. t.a = 556;
  40622. t.b = 611;
  40623. t.c = 556;
  40624. t.d = 611;
  40625. t.e = 556;
  40626. t.f = 333;
  40627. t.g = 611;
  40628. t.h = 611;
  40629. t.i = 278;
  40630. t.j = 278;
  40631. t.k = 556;
  40632. t.l = 278;
  40633. t.m = 889;
  40634. t.n = 611;
  40635. t.o = 611;
  40636. t.p = 611;
  40637. t.q = 611;
  40638. t.r = 389;
  40639. t.s = 556;
  40640. t.t = 333;
  40641. t.u = 611;
  40642. t.v = 556;
  40643. t.w = 778;
  40644. t.x = 556;
  40645. t.y = 556;
  40646. t.z = 500;
  40647. t.braceleft = 389;
  40648. t.bar = 280;
  40649. t.braceright = 389;
  40650. t.asciitilde = 584;
  40651. t.exclamdown = 333;
  40652. t.cent = 556;
  40653. t.sterling = 556;
  40654. t.fraction = 167;
  40655. t.yen = 556;
  40656. t.florin = 556;
  40657. t.section = 556;
  40658. t.currency = 556;
  40659. t.quotesingle = 238;
  40660. t.quotedblleft = 500;
  40661. t.guillemotleft = 556;
  40662. t.guilsinglleft = 333;
  40663. t.guilsinglright = 333;
  40664. t.fi = 611;
  40665. t.fl = 611;
  40666. t.endash = 556;
  40667. t.dagger = 556;
  40668. t.daggerdbl = 556;
  40669. t.periodcentered = 278;
  40670. t.paragraph = 556;
  40671. t.bullet = 350;
  40672. t.quotesinglbase = 278;
  40673. t.quotedblbase = 500;
  40674. t.quotedblright = 500;
  40675. t.guillemotright = 556;
  40676. t.ellipsis = 1000;
  40677. t.perthousand = 1000;
  40678. t.questiondown = 611;
  40679. t.grave = 333;
  40680. t.acute = 333;
  40681. t.circumflex = 333;
  40682. t.tilde = 333;
  40683. t.macron = 333;
  40684. t.breve = 333;
  40685. t.dotaccent = 333;
  40686. t.dieresis = 333;
  40687. t.ring = 333;
  40688. t.cedilla = 333;
  40689. t.hungarumlaut = 333;
  40690. t.ogonek = 333;
  40691. t.caron = 333;
  40692. t.emdash = 1000;
  40693. t.AE = 1000;
  40694. t.ordfeminine = 370;
  40695. t.Lslash = 611;
  40696. t.Oslash = 778;
  40697. t.OE = 1000;
  40698. t.ordmasculine = 365;
  40699. t.ae = 889;
  40700. t.dotlessi = 278;
  40701. t.lslash = 278;
  40702. t.oslash = 611;
  40703. t.oe = 944;
  40704. t.germandbls = 611;
  40705. t.Idieresis = 278;
  40706. t.eacute = 556;
  40707. t.abreve = 556;
  40708. t.uhungarumlaut = 611;
  40709. t.ecaron = 556;
  40710. t.Ydieresis = 667;
  40711. t.divide = 584;
  40712. t.Yacute = 667;
  40713. t.Acircumflex = 722;
  40714. t.aacute = 556;
  40715. t.Ucircumflex = 722;
  40716. t.yacute = 556;
  40717. t.scommaaccent = 556;
  40718. t.ecircumflex = 556;
  40719. t.Uring = 722;
  40720. t.Udieresis = 722;
  40721. t.aogonek = 556;
  40722. t.Uacute = 722;
  40723. t.uogonek = 611;
  40724. t.Edieresis = 667;
  40725. t.Dcroat = 722;
  40726. t.commaaccent = 250;
  40727. t.copyright = 737;
  40728. t.Emacron = 667;
  40729. t.ccaron = 556;
  40730. t.aring = 556;
  40731. t.Ncommaaccent = 722;
  40732. t.lacute = 278;
  40733. t.agrave = 556;
  40734. t.Tcommaaccent = 611;
  40735. t.Cacute = 722;
  40736. t.atilde = 556;
  40737. t.Edotaccent = 667;
  40738. t.scaron = 556;
  40739. t.scedilla = 556;
  40740. t.iacute = 278;
  40741. t.lozenge = 494;
  40742. t.Rcaron = 722;
  40743. t.Gcommaaccent = 778;
  40744. t.ucircumflex = 611;
  40745. t.acircumflex = 556;
  40746. t.Amacron = 722;
  40747. t.rcaron = 389;
  40748. t.ccedilla = 556;
  40749. t.Zdotaccent = 611;
  40750. t.Thorn = 667;
  40751. t.Omacron = 778;
  40752. t.Racute = 722;
  40753. t.Sacute = 667;
  40754. t.dcaron = 743;
  40755. t.Umacron = 722;
  40756. t.uring = 611;
  40757. t.threesuperior = 333;
  40758. t.Ograve = 778;
  40759. t.Agrave = 722;
  40760. t.Abreve = 722;
  40761. t.multiply = 584;
  40762. t.uacute = 611;
  40763. t.Tcaron = 611;
  40764. t.partialdiff = 494;
  40765. t.ydieresis = 556;
  40766. t.Nacute = 722;
  40767. t.icircumflex = 278;
  40768. t.Ecircumflex = 667;
  40769. t.adieresis = 556;
  40770. t.edieresis = 556;
  40771. t.cacute = 556;
  40772. t.nacute = 611;
  40773. t.umacron = 611;
  40774. t.Ncaron = 722;
  40775. t.Iacute = 278;
  40776. t.plusminus = 584;
  40777. t.brokenbar = 280;
  40778. t.registered = 737;
  40779. t.Gbreve = 778;
  40780. t.Idotaccent = 278;
  40781. t.summation = 600;
  40782. t.Egrave = 667;
  40783. t.racute = 389;
  40784. t.omacron = 611;
  40785. t.Zacute = 611;
  40786. t.Zcaron = 611;
  40787. t.greaterequal = 549;
  40788. t.Eth = 722;
  40789. t.Ccedilla = 722;
  40790. t.lcommaaccent = 278;
  40791. t.tcaron = 389;
  40792. t.eogonek = 556;
  40793. t.Uogonek = 722;
  40794. t.Aacute = 722;
  40795. t.Adieresis = 722;
  40796. t.egrave = 556;
  40797. t.zacute = 500;
  40798. t.iogonek = 278;
  40799. t.Oacute = 778;
  40800. t.oacute = 611;
  40801. t.amacron = 556;
  40802. t.sacute = 556;
  40803. t.idieresis = 278;
  40804. t.Ocircumflex = 778;
  40805. t.Ugrave = 722;
  40806. t.Delta = 612;
  40807. t.thorn = 611;
  40808. t.twosuperior = 333;
  40809. t.Odieresis = 778;
  40810. t.mu = 611;
  40811. t.igrave = 278;
  40812. t.ohungarumlaut = 611;
  40813. t.Eogonek = 667;
  40814. t.dcroat = 611;
  40815. t.threequarters = 834;
  40816. t.Scedilla = 667;
  40817. t.lcaron = 400;
  40818. t.Kcommaaccent = 722;
  40819. t.Lacute = 611;
  40820. t.trademark = 1000;
  40821. t.edotaccent = 556;
  40822. t.Igrave = 278;
  40823. t.Imacron = 278;
  40824. t.Lcaron = 611;
  40825. t.onehalf = 834;
  40826. t.lessequal = 549;
  40827. t.ocircumflex = 611;
  40828. t.ntilde = 611;
  40829. t.Uhungarumlaut = 722;
  40830. t.Eacute = 667;
  40831. t.emacron = 556;
  40832. t.gbreve = 611;
  40833. t.onequarter = 834;
  40834. t.Scaron = 667;
  40835. t.Scommaaccent = 667;
  40836. t.Ohungarumlaut = 778;
  40837. t.degree = 400;
  40838. t.ograve = 611;
  40839. t.Ccaron = 722;
  40840. t.ugrave = 611;
  40841. t.radical = 549;
  40842. t.Dcaron = 722;
  40843. t.rcommaaccent = 389;
  40844. t.Ntilde = 722;
  40845. t.otilde = 611;
  40846. t.Rcommaaccent = 722;
  40847. t.Lcommaaccent = 611;
  40848. t.Atilde = 722;
  40849. t.Aogonek = 722;
  40850. t.Aring = 722;
  40851. t.Otilde = 778;
  40852. t.zdotaccent = 500;
  40853. t.Ecaron = 667;
  40854. t.Iogonek = 278;
  40855. t.kcommaaccent = 556;
  40856. t.minus = 584;
  40857. t.Icircumflex = 278;
  40858. t.ncaron = 611;
  40859. t.tcommaaccent = 333;
  40860. t.logicalnot = 584;
  40861. t.odieresis = 611;
  40862. t.udieresis = 611;
  40863. t.notequal = 549;
  40864. t.gcommaaccent = 611;
  40865. t.eth = 611;
  40866. t.zcaron = 500;
  40867. t.ncommaaccent = 611;
  40868. t.onesuperior = 333;
  40869. t.imacron = 278;
  40870. t.Euro = 556;
  40871. });
  40872. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40873. t.space = 278;
  40874. t.exclam = 278;
  40875. t.quotedbl = 355;
  40876. t.numbersign = 556;
  40877. t.dollar = 556;
  40878. t.percent = 889;
  40879. t.ampersand = 667;
  40880. t.quoteright = 222;
  40881. t.parenleft = 333;
  40882. t.parenright = 333;
  40883. t.asterisk = 389;
  40884. t.plus = 584;
  40885. t.comma = 278;
  40886. t.hyphen = 333;
  40887. t.period = 278;
  40888. t.slash = 278;
  40889. t.zero = 556;
  40890. t.one = 556;
  40891. t.two = 556;
  40892. t.three = 556;
  40893. t.four = 556;
  40894. t.five = 556;
  40895. t.six = 556;
  40896. t.seven = 556;
  40897. t.eight = 556;
  40898. t.nine = 556;
  40899. t.colon = 278;
  40900. t.semicolon = 278;
  40901. t.less = 584;
  40902. t.equal = 584;
  40903. t.greater = 584;
  40904. t.question = 556;
  40905. t.at = 1015;
  40906. t.A = 667;
  40907. t.B = 667;
  40908. t.C = 722;
  40909. t.D = 722;
  40910. t.E = 667;
  40911. t.F = 611;
  40912. t.G = 778;
  40913. t.H = 722;
  40914. t.I = 278;
  40915. t.J = 500;
  40916. t.K = 667;
  40917. t.L = 556;
  40918. t.M = 833;
  40919. t.N = 722;
  40920. t.O = 778;
  40921. t.P = 667;
  40922. t.Q = 778;
  40923. t.R = 722;
  40924. t.S = 667;
  40925. t.T = 611;
  40926. t.U = 722;
  40927. t.V = 667;
  40928. t.W = 944;
  40929. t.X = 667;
  40930. t.Y = 667;
  40931. t.Z = 611;
  40932. t.bracketleft = 278;
  40933. t.backslash = 278;
  40934. t.bracketright = 278;
  40935. t.asciicircum = 469;
  40936. t.underscore = 556;
  40937. t.quoteleft = 222;
  40938. t.a = 556;
  40939. t.b = 556;
  40940. t.c = 500;
  40941. t.d = 556;
  40942. t.e = 556;
  40943. t.f = 278;
  40944. t.g = 556;
  40945. t.h = 556;
  40946. t.i = 222;
  40947. t.j = 222;
  40948. t.k = 500;
  40949. t.l = 222;
  40950. t.m = 833;
  40951. t.n = 556;
  40952. t.o = 556;
  40953. t.p = 556;
  40954. t.q = 556;
  40955. t.r = 333;
  40956. t.s = 500;
  40957. t.t = 278;
  40958. t.u = 556;
  40959. t.v = 500;
  40960. t.w = 722;
  40961. t.x = 500;
  40962. t.y = 500;
  40963. t.z = 500;
  40964. t.braceleft = 334;
  40965. t.bar = 260;
  40966. t.braceright = 334;
  40967. t.asciitilde = 584;
  40968. t.exclamdown = 333;
  40969. t.cent = 556;
  40970. t.sterling = 556;
  40971. t.fraction = 167;
  40972. t.yen = 556;
  40973. t.florin = 556;
  40974. t.section = 556;
  40975. t.currency = 556;
  40976. t.quotesingle = 191;
  40977. t.quotedblleft = 333;
  40978. t.guillemotleft = 556;
  40979. t.guilsinglleft = 333;
  40980. t.guilsinglright = 333;
  40981. t.fi = 500;
  40982. t.fl = 500;
  40983. t.endash = 556;
  40984. t.dagger = 556;
  40985. t.daggerdbl = 556;
  40986. t.periodcentered = 278;
  40987. t.paragraph = 537;
  40988. t.bullet = 350;
  40989. t.quotesinglbase = 222;
  40990. t.quotedblbase = 333;
  40991. t.quotedblright = 333;
  40992. t.guillemotright = 556;
  40993. t.ellipsis = 1000;
  40994. t.perthousand = 1000;
  40995. t.questiondown = 611;
  40996. t.grave = 333;
  40997. t.acute = 333;
  40998. t.circumflex = 333;
  40999. t.tilde = 333;
  41000. t.macron = 333;
  41001. t.breve = 333;
  41002. t.dotaccent = 333;
  41003. t.dieresis = 333;
  41004. t.ring = 333;
  41005. t.cedilla = 333;
  41006. t.hungarumlaut = 333;
  41007. t.ogonek = 333;
  41008. t.caron = 333;
  41009. t.emdash = 1000;
  41010. t.AE = 1000;
  41011. t.ordfeminine = 370;
  41012. t.Lslash = 556;
  41013. t.Oslash = 778;
  41014. t.OE = 1000;
  41015. t.ordmasculine = 365;
  41016. t.ae = 889;
  41017. t.dotlessi = 278;
  41018. t.lslash = 222;
  41019. t.oslash = 611;
  41020. t.oe = 944;
  41021. t.germandbls = 611;
  41022. t.Idieresis = 278;
  41023. t.eacute = 556;
  41024. t.abreve = 556;
  41025. t.uhungarumlaut = 556;
  41026. t.ecaron = 556;
  41027. t.Ydieresis = 667;
  41028. t.divide = 584;
  41029. t.Yacute = 667;
  41030. t.Acircumflex = 667;
  41031. t.aacute = 556;
  41032. t.Ucircumflex = 722;
  41033. t.yacute = 500;
  41034. t.scommaaccent = 500;
  41035. t.ecircumflex = 556;
  41036. t.Uring = 722;
  41037. t.Udieresis = 722;
  41038. t.aogonek = 556;
  41039. t.Uacute = 722;
  41040. t.uogonek = 556;
  41041. t.Edieresis = 667;
  41042. t.Dcroat = 722;
  41043. t.commaaccent = 250;
  41044. t.copyright = 737;
  41045. t.Emacron = 667;
  41046. t.ccaron = 500;
  41047. t.aring = 556;
  41048. t.Ncommaaccent = 722;
  41049. t.lacute = 222;
  41050. t.agrave = 556;
  41051. t.Tcommaaccent = 611;
  41052. t.Cacute = 722;
  41053. t.atilde = 556;
  41054. t.Edotaccent = 667;
  41055. t.scaron = 500;
  41056. t.scedilla = 500;
  41057. t.iacute = 278;
  41058. t.lozenge = 471;
  41059. t.Rcaron = 722;
  41060. t.Gcommaaccent = 778;
  41061. t.ucircumflex = 556;
  41062. t.acircumflex = 556;
  41063. t.Amacron = 667;
  41064. t.rcaron = 333;
  41065. t.ccedilla = 500;
  41066. t.Zdotaccent = 611;
  41067. t.Thorn = 667;
  41068. t.Omacron = 778;
  41069. t.Racute = 722;
  41070. t.Sacute = 667;
  41071. t.dcaron = 643;
  41072. t.Umacron = 722;
  41073. t.uring = 556;
  41074. t.threesuperior = 333;
  41075. t.Ograve = 778;
  41076. t.Agrave = 667;
  41077. t.Abreve = 667;
  41078. t.multiply = 584;
  41079. t.uacute = 556;
  41080. t.Tcaron = 611;
  41081. t.partialdiff = 476;
  41082. t.ydieresis = 500;
  41083. t.Nacute = 722;
  41084. t.icircumflex = 278;
  41085. t.Ecircumflex = 667;
  41086. t.adieresis = 556;
  41087. t.edieresis = 556;
  41088. t.cacute = 500;
  41089. t.nacute = 556;
  41090. t.umacron = 556;
  41091. t.Ncaron = 722;
  41092. t.Iacute = 278;
  41093. t.plusminus = 584;
  41094. t.brokenbar = 260;
  41095. t.registered = 737;
  41096. t.Gbreve = 778;
  41097. t.Idotaccent = 278;
  41098. t.summation = 600;
  41099. t.Egrave = 667;
  41100. t.racute = 333;
  41101. t.omacron = 556;
  41102. t.Zacute = 611;
  41103. t.Zcaron = 611;
  41104. t.greaterequal = 549;
  41105. t.Eth = 722;
  41106. t.Ccedilla = 722;
  41107. t.lcommaaccent = 222;
  41108. t.tcaron = 317;
  41109. t.eogonek = 556;
  41110. t.Uogonek = 722;
  41111. t.Aacute = 667;
  41112. t.Adieresis = 667;
  41113. t.egrave = 556;
  41114. t.zacute = 500;
  41115. t.iogonek = 222;
  41116. t.Oacute = 778;
  41117. t.oacute = 556;
  41118. t.amacron = 556;
  41119. t.sacute = 500;
  41120. t.idieresis = 278;
  41121. t.Ocircumflex = 778;
  41122. t.Ugrave = 722;
  41123. t.Delta = 612;
  41124. t.thorn = 556;
  41125. t.twosuperior = 333;
  41126. t.Odieresis = 778;
  41127. t.mu = 556;
  41128. t.igrave = 278;
  41129. t.ohungarumlaut = 556;
  41130. t.Eogonek = 667;
  41131. t.dcroat = 556;
  41132. t.threequarters = 834;
  41133. t.Scedilla = 667;
  41134. t.lcaron = 299;
  41135. t.Kcommaaccent = 667;
  41136. t.Lacute = 556;
  41137. t.trademark = 1000;
  41138. t.edotaccent = 556;
  41139. t.Igrave = 278;
  41140. t.Imacron = 278;
  41141. t.Lcaron = 556;
  41142. t.onehalf = 834;
  41143. t.lessequal = 549;
  41144. t.ocircumflex = 556;
  41145. t.ntilde = 556;
  41146. t.Uhungarumlaut = 722;
  41147. t.Eacute = 667;
  41148. t.emacron = 556;
  41149. t.gbreve = 556;
  41150. t.onequarter = 834;
  41151. t.Scaron = 667;
  41152. t.Scommaaccent = 667;
  41153. t.Ohungarumlaut = 778;
  41154. t.degree = 400;
  41155. t.ograve = 556;
  41156. t.Ccaron = 722;
  41157. t.ugrave = 556;
  41158. t.radical = 453;
  41159. t.Dcaron = 722;
  41160. t.rcommaaccent = 333;
  41161. t.Ntilde = 722;
  41162. t.otilde = 556;
  41163. t.Rcommaaccent = 722;
  41164. t.Lcommaaccent = 556;
  41165. t.Atilde = 667;
  41166. t.Aogonek = 667;
  41167. t.Aring = 667;
  41168. t.Otilde = 778;
  41169. t.zdotaccent = 500;
  41170. t.Ecaron = 667;
  41171. t.Iogonek = 278;
  41172. t.kcommaaccent = 500;
  41173. t.minus = 584;
  41174. t.Icircumflex = 278;
  41175. t.ncaron = 556;
  41176. t.tcommaaccent = 278;
  41177. t.logicalnot = 584;
  41178. t.odieresis = 556;
  41179. t.udieresis = 556;
  41180. t.notequal = 549;
  41181. t.gcommaaccent = 556;
  41182. t.eth = 556;
  41183. t.zcaron = 500;
  41184. t.ncommaaccent = 556;
  41185. t.onesuperior = 333;
  41186. t.imacron = 278;
  41187. t.Euro = 556;
  41188. });
  41189. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  41190. t.space = 250;
  41191. t.exclam = 333;
  41192. t.universal = 713;
  41193. t.numbersign = 500;
  41194. t.existential = 549;
  41195. t.percent = 833;
  41196. t.ampersand = 778;
  41197. t.suchthat = 439;
  41198. t.parenleft = 333;
  41199. t.parenright = 333;
  41200. t.asteriskmath = 500;
  41201. t.plus = 549;
  41202. t.comma = 250;
  41203. t.minus = 549;
  41204. t.period = 250;
  41205. t.slash = 278;
  41206. t.zero = 500;
  41207. t.one = 500;
  41208. t.two = 500;
  41209. t.three = 500;
  41210. t.four = 500;
  41211. t.five = 500;
  41212. t.six = 500;
  41213. t.seven = 500;
  41214. t.eight = 500;
  41215. t.nine = 500;
  41216. t.colon = 278;
  41217. t.semicolon = 278;
  41218. t.less = 549;
  41219. t.equal = 549;
  41220. t.greater = 549;
  41221. t.question = 444;
  41222. t.congruent = 549;
  41223. t.Alpha = 722;
  41224. t.Beta = 667;
  41225. t.Chi = 722;
  41226. t.Delta = 612;
  41227. t.Epsilon = 611;
  41228. t.Phi = 763;
  41229. t.Gamma = 603;
  41230. t.Eta = 722;
  41231. t.Iota = 333;
  41232. t.theta1 = 631;
  41233. t.Kappa = 722;
  41234. t.Lambda = 686;
  41235. t.Mu = 889;
  41236. t.Nu = 722;
  41237. t.Omicron = 722;
  41238. t.Pi = 768;
  41239. t.Theta = 741;
  41240. t.Rho = 556;
  41241. t.Sigma = 592;
  41242. t.Tau = 611;
  41243. t.Upsilon = 690;
  41244. t.sigma1 = 439;
  41245. t.Omega = 768;
  41246. t.Xi = 645;
  41247. t.Psi = 795;
  41248. t.Zeta = 611;
  41249. t.bracketleft = 333;
  41250. t.therefore = 863;
  41251. t.bracketright = 333;
  41252. t.perpendicular = 658;
  41253. t.underscore = 500;
  41254. t.radicalex = 500;
  41255. t.alpha = 631;
  41256. t.beta = 549;
  41257. t.chi = 549;
  41258. t.delta = 494;
  41259. t.epsilon = 439;
  41260. t.phi = 521;
  41261. t.gamma = 411;
  41262. t.eta = 603;
  41263. t.iota = 329;
  41264. t.phi1 = 603;
  41265. t.kappa = 549;
  41266. t.lambda = 549;
  41267. t.mu = 576;
  41268. t.nu = 521;
  41269. t.omicron = 549;
  41270. t.pi = 549;
  41271. t.theta = 521;
  41272. t.rho = 549;
  41273. t.sigma = 603;
  41274. t.tau = 439;
  41275. t.upsilon = 576;
  41276. t.omega1 = 713;
  41277. t.omega = 686;
  41278. t.xi = 493;
  41279. t.psi = 686;
  41280. t.zeta = 494;
  41281. t.braceleft = 480;
  41282. t.bar = 200;
  41283. t.braceright = 480;
  41284. t.similar = 549;
  41285. t.Euro = 750;
  41286. t.Upsilon1 = 620;
  41287. t.minute = 247;
  41288. t.lessequal = 549;
  41289. t.fraction = 167;
  41290. t.infinity = 713;
  41291. t.florin = 500;
  41292. t.club = 753;
  41293. t.diamond = 753;
  41294. t.heart = 753;
  41295. t.spade = 753;
  41296. t.arrowboth = 1042;
  41297. t.arrowleft = 987;
  41298. t.arrowup = 603;
  41299. t.arrowright = 987;
  41300. t.arrowdown = 603;
  41301. t.degree = 400;
  41302. t.plusminus = 549;
  41303. t.second = 411;
  41304. t.greaterequal = 549;
  41305. t.multiply = 549;
  41306. t.proportional = 713;
  41307. t.partialdiff = 494;
  41308. t.bullet = 460;
  41309. t.divide = 549;
  41310. t.notequal = 549;
  41311. t.equivalence = 549;
  41312. t.approxequal = 549;
  41313. t.ellipsis = 1000;
  41314. t.arrowvertex = 603;
  41315. t.arrowhorizex = 1000;
  41316. t.carriagereturn = 658;
  41317. t.aleph = 823;
  41318. t.Ifraktur = 686;
  41319. t.Rfraktur = 795;
  41320. t.weierstrass = 987;
  41321. t.circlemultiply = 768;
  41322. t.circleplus = 768;
  41323. t.emptyset = 823;
  41324. t.intersection = 768;
  41325. t.union = 768;
  41326. t.propersuperset = 713;
  41327. t.reflexsuperset = 713;
  41328. t.notsubset = 713;
  41329. t.propersubset = 713;
  41330. t.reflexsubset = 713;
  41331. t.element = 713;
  41332. t.notelement = 713;
  41333. t.angle = 768;
  41334. t.gradient = 713;
  41335. t.registerserif = 790;
  41336. t.copyrightserif = 790;
  41337. t.trademarkserif = 890;
  41338. t.product = 823;
  41339. t.radical = 549;
  41340. t.dotmath = 250;
  41341. t.logicalnot = 713;
  41342. t.logicaland = 603;
  41343. t.logicalor = 603;
  41344. t.arrowdblboth = 1042;
  41345. t.arrowdblleft = 987;
  41346. t.arrowdblup = 603;
  41347. t.arrowdblright = 987;
  41348. t.arrowdbldown = 603;
  41349. t.lozenge = 494;
  41350. t.angleleft = 329;
  41351. t.registersans = 790;
  41352. t.copyrightsans = 790;
  41353. t.trademarksans = 786;
  41354. t.summation = 713;
  41355. t.parenlefttp = 384;
  41356. t.parenleftex = 384;
  41357. t.parenleftbt = 384;
  41358. t.bracketlefttp = 384;
  41359. t.bracketleftex = 384;
  41360. t.bracketleftbt = 384;
  41361. t.bracelefttp = 494;
  41362. t.braceleftmid = 494;
  41363. t.braceleftbt = 494;
  41364. t.braceex = 494;
  41365. t.angleright = 329;
  41366. t.integral = 274;
  41367. t.integraltp = 686;
  41368. t.integralex = 686;
  41369. t.integralbt = 686;
  41370. t.parenrighttp = 384;
  41371. t.parenrightex = 384;
  41372. t.parenrightbt = 384;
  41373. t.bracketrighttp = 384;
  41374. t.bracketrightex = 384;
  41375. t.bracketrightbt = 384;
  41376. t.bracerighttp = 494;
  41377. t.bracerightmid = 494;
  41378. t.bracerightbt = 494;
  41379. t.apple = 790;
  41380. });
  41381. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41382. t.space = 250;
  41383. t.exclam = 333;
  41384. t.quotedbl = 408;
  41385. t.numbersign = 500;
  41386. t.dollar = 500;
  41387. t.percent = 833;
  41388. t.ampersand = 778;
  41389. t.quoteright = 333;
  41390. t.parenleft = 333;
  41391. t.parenright = 333;
  41392. t.asterisk = 500;
  41393. t.plus = 564;
  41394. t.comma = 250;
  41395. t.hyphen = 333;
  41396. t.period = 250;
  41397. t.slash = 278;
  41398. t.zero = 500;
  41399. t.one = 500;
  41400. t.two = 500;
  41401. t.three = 500;
  41402. t.four = 500;
  41403. t.five = 500;
  41404. t.six = 500;
  41405. t.seven = 500;
  41406. t.eight = 500;
  41407. t.nine = 500;
  41408. t.colon = 278;
  41409. t.semicolon = 278;
  41410. t.less = 564;
  41411. t.equal = 564;
  41412. t.greater = 564;
  41413. t.question = 444;
  41414. t.at = 921;
  41415. t.A = 722;
  41416. t.B = 667;
  41417. t.C = 667;
  41418. t.D = 722;
  41419. t.E = 611;
  41420. t.F = 556;
  41421. t.G = 722;
  41422. t.H = 722;
  41423. t.I = 333;
  41424. t.J = 389;
  41425. t.K = 722;
  41426. t.L = 611;
  41427. t.M = 889;
  41428. t.N = 722;
  41429. t.O = 722;
  41430. t.P = 556;
  41431. t.Q = 722;
  41432. t.R = 667;
  41433. t.S = 556;
  41434. t.T = 611;
  41435. t.U = 722;
  41436. t.V = 722;
  41437. t.W = 944;
  41438. t.X = 722;
  41439. t.Y = 722;
  41440. t.Z = 611;
  41441. t.bracketleft = 333;
  41442. t.backslash = 278;
  41443. t.bracketright = 333;
  41444. t.asciicircum = 469;
  41445. t.underscore = 500;
  41446. t.quoteleft = 333;
  41447. t.a = 444;
  41448. t.b = 500;
  41449. t.c = 444;
  41450. t.d = 500;
  41451. t.e = 444;
  41452. t.f = 333;
  41453. t.g = 500;
  41454. t.h = 500;
  41455. t.i = 278;
  41456. t.j = 278;
  41457. t.k = 500;
  41458. t.l = 278;
  41459. t.m = 778;
  41460. t.n = 500;
  41461. t.o = 500;
  41462. t.p = 500;
  41463. t.q = 500;
  41464. t.r = 333;
  41465. t.s = 389;
  41466. t.t = 278;
  41467. t.u = 500;
  41468. t.v = 500;
  41469. t.w = 722;
  41470. t.x = 500;
  41471. t.y = 500;
  41472. t.z = 444;
  41473. t.braceleft = 480;
  41474. t.bar = 200;
  41475. t.braceright = 480;
  41476. t.asciitilde = 541;
  41477. t.exclamdown = 333;
  41478. t.cent = 500;
  41479. t.sterling = 500;
  41480. t.fraction = 167;
  41481. t.yen = 500;
  41482. t.florin = 500;
  41483. t.section = 500;
  41484. t.currency = 500;
  41485. t.quotesingle = 180;
  41486. t.quotedblleft = 444;
  41487. t.guillemotleft = 500;
  41488. t.guilsinglleft = 333;
  41489. t.guilsinglright = 333;
  41490. t.fi = 556;
  41491. t.fl = 556;
  41492. t.endash = 500;
  41493. t.dagger = 500;
  41494. t.daggerdbl = 500;
  41495. t.periodcentered = 250;
  41496. t.paragraph = 453;
  41497. t.bullet = 350;
  41498. t.quotesinglbase = 333;
  41499. t.quotedblbase = 444;
  41500. t.quotedblright = 444;
  41501. t.guillemotright = 500;
  41502. t.ellipsis = 1000;
  41503. t.perthousand = 1000;
  41504. t.questiondown = 444;
  41505. t.grave = 333;
  41506. t.acute = 333;
  41507. t.circumflex = 333;
  41508. t.tilde = 333;
  41509. t.macron = 333;
  41510. t.breve = 333;
  41511. t.dotaccent = 333;
  41512. t.dieresis = 333;
  41513. t.ring = 333;
  41514. t.cedilla = 333;
  41515. t.hungarumlaut = 333;
  41516. t.ogonek = 333;
  41517. t.caron = 333;
  41518. t.emdash = 1000;
  41519. t.AE = 889;
  41520. t.ordfeminine = 276;
  41521. t.Lslash = 611;
  41522. t.Oslash = 722;
  41523. t.OE = 889;
  41524. t.ordmasculine = 310;
  41525. t.ae = 667;
  41526. t.dotlessi = 278;
  41527. t.lslash = 278;
  41528. t.oslash = 500;
  41529. t.oe = 722;
  41530. t.germandbls = 500;
  41531. t.Idieresis = 333;
  41532. t.eacute = 444;
  41533. t.abreve = 444;
  41534. t.uhungarumlaut = 500;
  41535. t.ecaron = 444;
  41536. t.Ydieresis = 722;
  41537. t.divide = 564;
  41538. t.Yacute = 722;
  41539. t.Acircumflex = 722;
  41540. t.aacute = 444;
  41541. t.Ucircumflex = 722;
  41542. t.yacute = 500;
  41543. t.scommaaccent = 389;
  41544. t.ecircumflex = 444;
  41545. t.Uring = 722;
  41546. t.Udieresis = 722;
  41547. t.aogonek = 444;
  41548. t.Uacute = 722;
  41549. t.uogonek = 500;
  41550. t.Edieresis = 611;
  41551. t.Dcroat = 722;
  41552. t.commaaccent = 250;
  41553. t.copyright = 760;
  41554. t.Emacron = 611;
  41555. t.ccaron = 444;
  41556. t.aring = 444;
  41557. t.Ncommaaccent = 722;
  41558. t.lacute = 278;
  41559. t.agrave = 444;
  41560. t.Tcommaaccent = 611;
  41561. t.Cacute = 667;
  41562. t.atilde = 444;
  41563. t.Edotaccent = 611;
  41564. t.scaron = 389;
  41565. t.scedilla = 389;
  41566. t.iacute = 278;
  41567. t.lozenge = 471;
  41568. t.Rcaron = 667;
  41569. t.Gcommaaccent = 722;
  41570. t.ucircumflex = 500;
  41571. t.acircumflex = 444;
  41572. t.Amacron = 722;
  41573. t.rcaron = 333;
  41574. t.ccedilla = 444;
  41575. t.Zdotaccent = 611;
  41576. t.Thorn = 556;
  41577. t.Omacron = 722;
  41578. t.Racute = 667;
  41579. t.Sacute = 556;
  41580. t.dcaron = 588;
  41581. t.Umacron = 722;
  41582. t.uring = 500;
  41583. t.threesuperior = 300;
  41584. t.Ograve = 722;
  41585. t.Agrave = 722;
  41586. t.Abreve = 722;
  41587. t.multiply = 564;
  41588. t.uacute = 500;
  41589. t.Tcaron = 611;
  41590. t.partialdiff = 476;
  41591. t.ydieresis = 500;
  41592. t.Nacute = 722;
  41593. t.icircumflex = 278;
  41594. t.Ecircumflex = 611;
  41595. t.adieresis = 444;
  41596. t.edieresis = 444;
  41597. t.cacute = 444;
  41598. t.nacute = 500;
  41599. t.umacron = 500;
  41600. t.Ncaron = 722;
  41601. t.Iacute = 333;
  41602. t.plusminus = 564;
  41603. t.brokenbar = 200;
  41604. t.registered = 760;
  41605. t.Gbreve = 722;
  41606. t.Idotaccent = 333;
  41607. t.summation = 600;
  41608. t.Egrave = 611;
  41609. t.racute = 333;
  41610. t.omacron = 500;
  41611. t.Zacute = 611;
  41612. t.Zcaron = 611;
  41613. t.greaterequal = 549;
  41614. t.Eth = 722;
  41615. t.Ccedilla = 667;
  41616. t.lcommaaccent = 278;
  41617. t.tcaron = 326;
  41618. t.eogonek = 444;
  41619. t.Uogonek = 722;
  41620. t.Aacute = 722;
  41621. t.Adieresis = 722;
  41622. t.egrave = 444;
  41623. t.zacute = 444;
  41624. t.iogonek = 278;
  41625. t.Oacute = 722;
  41626. t.oacute = 500;
  41627. t.amacron = 444;
  41628. t.sacute = 389;
  41629. t.idieresis = 278;
  41630. t.Ocircumflex = 722;
  41631. t.Ugrave = 722;
  41632. t.Delta = 612;
  41633. t.thorn = 500;
  41634. t.twosuperior = 300;
  41635. t.Odieresis = 722;
  41636. t.mu = 500;
  41637. t.igrave = 278;
  41638. t.ohungarumlaut = 500;
  41639. t.Eogonek = 611;
  41640. t.dcroat = 500;
  41641. t.threequarters = 750;
  41642. t.Scedilla = 556;
  41643. t.lcaron = 344;
  41644. t.Kcommaaccent = 722;
  41645. t.Lacute = 611;
  41646. t.trademark = 980;
  41647. t.edotaccent = 444;
  41648. t.Igrave = 333;
  41649. t.Imacron = 333;
  41650. t.Lcaron = 611;
  41651. t.onehalf = 750;
  41652. t.lessequal = 549;
  41653. t.ocircumflex = 500;
  41654. t.ntilde = 500;
  41655. t.Uhungarumlaut = 722;
  41656. t.Eacute = 611;
  41657. t.emacron = 444;
  41658. t.gbreve = 500;
  41659. t.onequarter = 750;
  41660. t.Scaron = 556;
  41661. t.Scommaaccent = 556;
  41662. t.Ohungarumlaut = 722;
  41663. t.degree = 400;
  41664. t.ograve = 500;
  41665. t.Ccaron = 667;
  41666. t.ugrave = 500;
  41667. t.radical = 453;
  41668. t.Dcaron = 722;
  41669. t.rcommaaccent = 333;
  41670. t.Ntilde = 722;
  41671. t.otilde = 500;
  41672. t.Rcommaaccent = 667;
  41673. t.Lcommaaccent = 611;
  41674. t.Atilde = 722;
  41675. t.Aogonek = 722;
  41676. t.Aring = 722;
  41677. t.Otilde = 722;
  41678. t.zdotaccent = 444;
  41679. t.Ecaron = 611;
  41680. t.Iogonek = 333;
  41681. t.kcommaaccent = 500;
  41682. t.minus = 564;
  41683. t.Icircumflex = 333;
  41684. t.ncaron = 500;
  41685. t.tcommaaccent = 278;
  41686. t.logicalnot = 564;
  41687. t.odieresis = 500;
  41688. t.udieresis = 500;
  41689. t.notequal = 549;
  41690. t.gcommaaccent = 500;
  41691. t.eth = 500;
  41692. t.zcaron = 444;
  41693. t.ncommaaccent = 500;
  41694. t.onesuperior = 300;
  41695. t.imacron = 278;
  41696. t.Euro = 500;
  41697. });
  41698. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41699. t.space = 250;
  41700. t.exclam = 333;
  41701. t.quotedbl = 555;
  41702. t.numbersign = 500;
  41703. t.dollar = 500;
  41704. t.percent = 1000;
  41705. t.ampersand = 833;
  41706. t.quoteright = 333;
  41707. t.parenleft = 333;
  41708. t.parenright = 333;
  41709. t.asterisk = 500;
  41710. t.plus = 570;
  41711. t.comma = 250;
  41712. t.hyphen = 333;
  41713. t.period = 250;
  41714. t.slash = 278;
  41715. t.zero = 500;
  41716. t.one = 500;
  41717. t.two = 500;
  41718. t.three = 500;
  41719. t.four = 500;
  41720. t.five = 500;
  41721. t.six = 500;
  41722. t.seven = 500;
  41723. t.eight = 500;
  41724. t.nine = 500;
  41725. t.colon = 333;
  41726. t.semicolon = 333;
  41727. t.less = 570;
  41728. t.equal = 570;
  41729. t.greater = 570;
  41730. t.question = 500;
  41731. t.at = 930;
  41732. t.A = 722;
  41733. t.B = 667;
  41734. t.C = 722;
  41735. t.D = 722;
  41736. t.E = 667;
  41737. t.F = 611;
  41738. t.G = 778;
  41739. t.H = 778;
  41740. t.I = 389;
  41741. t.J = 500;
  41742. t.K = 778;
  41743. t.L = 667;
  41744. t.M = 944;
  41745. t.N = 722;
  41746. t.O = 778;
  41747. t.P = 611;
  41748. t.Q = 778;
  41749. t.R = 722;
  41750. t.S = 556;
  41751. t.T = 667;
  41752. t.U = 722;
  41753. t.V = 722;
  41754. t.W = 1000;
  41755. t.X = 722;
  41756. t.Y = 722;
  41757. t.Z = 667;
  41758. t.bracketleft = 333;
  41759. t.backslash = 278;
  41760. t.bracketright = 333;
  41761. t.asciicircum = 581;
  41762. t.underscore = 500;
  41763. t.quoteleft = 333;
  41764. t.a = 500;
  41765. t.b = 556;
  41766. t.c = 444;
  41767. t.d = 556;
  41768. t.e = 444;
  41769. t.f = 333;
  41770. t.g = 500;
  41771. t.h = 556;
  41772. t.i = 278;
  41773. t.j = 333;
  41774. t.k = 556;
  41775. t.l = 278;
  41776. t.m = 833;
  41777. t.n = 556;
  41778. t.o = 500;
  41779. t.p = 556;
  41780. t.q = 556;
  41781. t.r = 444;
  41782. t.s = 389;
  41783. t.t = 333;
  41784. t.u = 556;
  41785. t.v = 500;
  41786. t.w = 722;
  41787. t.x = 500;
  41788. t.y = 500;
  41789. t.z = 444;
  41790. t.braceleft = 394;
  41791. t.bar = 220;
  41792. t.braceright = 394;
  41793. t.asciitilde = 520;
  41794. t.exclamdown = 333;
  41795. t.cent = 500;
  41796. t.sterling = 500;
  41797. t.fraction = 167;
  41798. t.yen = 500;
  41799. t.florin = 500;
  41800. t.section = 500;
  41801. t.currency = 500;
  41802. t.quotesingle = 278;
  41803. t.quotedblleft = 500;
  41804. t.guillemotleft = 500;
  41805. t.guilsinglleft = 333;
  41806. t.guilsinglright = 333;
  41807. t.fi = 556;
  41808. t.fl = 556;
  41809. t.endash = 500;
  41810. t.dagger = 500;
  41811. t.daggerdbl = 500;
  41812. t.periodcentered = 250;
  41813. t.paragraph = 540;
  41814. t.bullet = 350;
  41815. t.quotesinglbase = 333;
  41816. t.quotedblbase = 500;
  41817. t.quotedblright = 500;
  41818. t.guillemotright = 500;
  41819. t.ellipsis = 1000;
  41820. t.perthousand = 1000;
  41821. t.questiondown = 500;
  41822. t.grave = 333;
  41823. t.acute = 333;
  41824. t.circumflex = 333;
  41825. t.tilde = 333;
  41826. t.macron = 333;
  41827. t.breve = 333;
  41828. t.dotaccent = 333;
  41829. t.dieresis = 333;
  41830. t.ring = 333;
  41831. t.cedilla = 333;
  41832. t.hungarumlaut = 333;
  41833. t.ogonek = 333;
  41834. t.caron = 333;
  41835. t.emdash = 1000;
  41836. t.AE = 1000;
  41837. t.ordfeminine = 300;
  41838. t.Lslash = 667;
  41839. t.Oslash = 778;
  41840. t.OE = 1000;
  41841. t.ordmasculine = 330;
  41842. t.ae = 722;
  41843. t.dotlessi = 278;
  41844. t.lslash = 278;
  41845. t.oslash = 500;
  41846. t.oe = 722;
  41847. t.germandbls = 556;
  41848. t.Idieresis = 389;
  41849. t.eacute = 444;
  41850. t.abreve = 500;
  41851. t.uhungarumlaut = 556;
  41852. t.ecaron = 444;
  41853. t.Ydieresis = 722;
  41854. t.divide = 570;
  41855. t.Yacute = 722;
  41856. t.Acircumflex = 722;
  41857. t.aacute = 500;
  41858. t.Ucircumflex = 722;
  41859. t.yacute = 500;
  41860. t.scommaaccent = 389;
  41861. t.ecircumflex = 444;
  41862. t.Uring = 722;
  41863. t.Udieresis = 722;
  41864. t.aogonek = 500;
  41865. t.Uacute = 722;
  41866. t.uogonek = 556;
  41867. t.Edieresis = 667;
  41868. t.Dcroat = 722;
  41869. t.commaaccent = 250;
  41870. t.copyright = 747;
  41871. t.Emacron = 667;
  41872. t.ccaron = 444;
  41873. t.aring = 500;
  41874. t.Ncommaaccent = 722;
  41875. t.lacute = 278;
  41876. t.agrave = 500;
  41877. t.Tcommaaccent = 667;
  41878. t.Cacute = 722;
  41879. t.atilde = 500;
  41880. t.Edotaccent = 667;
  41881. t.scaron = 389;
  41882. t.scedilla = 389;
  41883. t.iacute = 278;
  41884. t.lozenge = 494;
  41885. t.Rcaron = 722;
  41886. t.Gcommaaccent = 778;
  41887. t.ucircumflex = 556;
  41888. t.acircumflex = 500;
  41889. t.Amacron = 722;
  41890. t.rcaron = 444;
  41891. t.ccedilla = 444;
  41892. t.Zdotaccent = 667;
  41893. t.Thorn = 611;
  41894. t.Omacron = 778;
  41895. t.Racute = 722;
  41896. t.Sacute = 556;
  41897. t.dcaron = 672;
  41898. t.Umacron = 722;
  41899. t.uring = 556;
  41900. t.threesuperior = 300;
  41901. t.Ograve = 778;
  41902. t.Agrave = 722;
  41903. t.Abreve = 722;
  41904. t.multiply = 570;
  41905. t.uacute = 556;
  41906. t.Tcaron = 667;
  41907. t.partialdiff = 494;
  41908. t.ydieresis = 500;
  41909. t.Nacute = 722;
  41910. t.icircumflex = 278;
  41911. t.Ecircumflex = 667;
  41912. t.adieresis = 500;
  41913. t.edieresis = 444;
  41914. t.cacute = 444;
  41915. t.nacute = 556;
  41916. t.umacron = 556;
  41917. t.Ncaron = 722;
  41918. t.Iacute = 389;
  41919. t.plusminus = 570;
  41920. t.brokenbar = 220;
  41921. t.registered = 747;
  41922. t.Gbreve = 778;
  41923. t.Idotaccent = 389;
  41924. t.summation = 600;
  41925. t.Egrave = 667;
  41926. t.racute = 444;
  41927. t.omacron = 500;
  41928. t.Zacute = 667;
  41929. t.Zcaron = 667;
  41930. t.greaterequal = 549;
  41931. t.Eth = 722;
  41932. t.Ccedilla = 722;
  41933. t.lcommaaccent = 278;
  41934. t.tcaron = 416;
  41935. t.eogonek = 444;
  41936. t.Uogonek = 722;
  41937. t.Aacute = 722;
  41938. t.Adieresis = 722;
  41939. t.egrave = 444;
  41940. t.zacute = 444;
  41941. t.iogonek = 278;
  41942. t.Oacute = 778;
  41943. t.oacute = 500;
  41944. t.amacron = 500;
  41945. t.sacute = 389;
  41946. t.idieresis = 278;
  41947. t.Ocircumflex = 778;
  41948. t.Ugrave = 722;
  41949. t.Delta = 612;
  41950. t.thorn = 556;
  41951. t.twosuperior = 300;
  41952. t.Odieresis = 778;
  41953. t.mu = 556;
  41954. t.igrave = 278;
  41955. t.ohungarumlaut = 500;
  41956. t.Eogonek = 667;
  41957. t.dcroat = 556;
  41958. t.threequarters = 750;
  41959. t.Scedilla = 556;
  41960. t.lcaron = 394;
  41961. t.Kcommaaccent = 778;
  41962. t.Lacute = 667;
  41963. t.trademark = 1000;
  41964. t.edotaccent = 444;
  41965. t.Igrave = 389;
  41966. t.Imacron = 389;
  41967. t.Lcaron = 667;
  41968. t.onehalf = 750;
  41969. t.lessequal = 549;
  41970. t.ocircumflex = 500;
  41971. t.ntilde = 556;
  41972. t.Uhungarumlaut = 722;
  41973. t.Eacute = 667;
  41974. t.emacron = 444;
  41975. t.gbreve = 500;
  41976. t.onequarter = 750;
  41977. t.Scaron = 556;
  41978. t.Scommaaccent = 556;
  41979. t.Ohungarumlaut = 778;
  41980. t.degree = 400;
  41981. t.ograve = 500;
  41982. t.Ccaron = 722;
  41983. t.ugrave = 556;
  41984. t.radical = 549;
  41985. t.Dcaron = 722;
  41986. t.rcommaaccent = 444;
  41987. t.Ntilde = 722;
  41988. t.otilde = 500;
  41989. t.Rcommaaccent = 722;
  41990. t.Lcommaaccent = 667;
  41991. t.Atilde = 722;
  41992. t.Aogonek = 722;
  41993. t.Aring = 722;
  41994. t.Otilde = 778;
  41995. t.zdotaccent = 444;
  41996. t.Ecaron = 667;
  41997. t.Iogonek = 389;
  41998. t.kcommaaccent = 556;
  41999. t.minus = 570;
  42000. t.Icircumflex = 389;
  42001. t.ncaron = 556;
  42002. t.tcommaaccent = 333;
  42003. t.logicalnot = 570;
  42004. t.odieresis = 500;
  42005. t.udieresis = 556;
  42006. t.notequal = 549;
  42007. t.gcommaaccent = 500;
  42008. t.eth = 500;
  42009. t.zcaron = 444;
  42010. t.ncommaaccent = 556;
  42011. t.onesuperior = 300;
  42012. t.imacron = 278;
  42013. t.Euro = 500;
  42014. });
  42015. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42016. t.space = 250;
  42017. t.exclam = 389;
  42018. t.quotedbl = 555;
  42019. t.numbersign = 500;
  42020. t.dollar = 500;
  42021. t.percent = 833;
  42022. t.ampersand = 778;
  42023. t.quoteright = 333;
  42024. t.parenleft = 333;
  42025. t.parenright = 333;
  42026. t.asterisk = 500;
  42027. t.plus = 570;
  42028. t.comma = 250;
  42029. t.hyphen = 333;
  42030. t.period = 250;
  42031. t.slash = 278;
  42032. t.zero = 500;
  42033. t.one = 500;
  42034. t.two = 500;
  42035. t.three = 500;
  42036. t.four = 500;
  42037. t.five = 500;
  42038. t.six = 500;
  42039. t.seven = 500;
  42040. t.eight = 500;
  42041. t.nine = 500;
  42042. t.colon = 333;
  42043. t.semicolon = 333;
  42044. t.less = 570;
  42045. t.equal = 570;
  42046. t.greater = 570;
  42047. t.question = 500;
  42048. t.at = 832;
  42049. t.A = 667;
  42050. t.B = 667;
  42051. t.C = 667;
  42052. t.D = 722;
  42053. t.E = 667;
  42054. t.F = 667;
  42055. t.G = 722;
  42056. t.H = 778;
  42057. t.I = 389;
  42058. t.J = 500;
  42059. t.K = 667;
  42060. t.L = 611;
  42061. t.M = 889;
  42062. t.N = 722;
  42063. t.O = 722;
  42064. t.P = 611;
  42065. t.Q = 722;
  42066. t.R = 667;
  42067. t.S = 556;
  42068. t.T = 611;
  42069. t.U = 722;
  42070. t.V = 667;
  42071. t.W = 889;
  42072. t.X = 667;
  42073. t.Y = 611;
  42074. t.Z = 611;
  42075. t.bracketleft = 333;
  42076. t.backslash = 278;
  42077. t.bracketright = 333;
  42078. t.asciicircum = 570;
  42079. t.underscore = 500;
  42080. t.quoteleft = 333;
  42081. t.a = 500;
  42082. t.b = 500;
  42083. t.c = 444;
  42084. t.d = 500;
  42085. t.e = 444;
  42086. t.f = 333;
  42087. t.g = 500;
  42088. t.h = 556;
  42089. t.i = 278;
  42090. t.j = 278;
  42091. t.k = 500;
  42092. t.l = 278;
  42093. t.m = 778;
  42094. t.n = 556;
  42095. t.o = 500;
  42096. t.p = 500;
  42097. t.q = 500;
  42098. t.r = 389;
  42099. t.s = 389;
  42100. t.t = 278;
  42101. t.u = 556;
  42102. t.v = 444;
  42103. t.w = 667;
  42104. t.x = 500;
  42105. t.y = 444;
  42106. t.z = 389;
  42107. t.braceleft = 348;
  42108. t.bar = 220;
  42109. t.braceright = 348;
  42110. t.asciitilde = 570;
  42111. t.exclamdown = 389;
  42112. t.cent = 500;
  42113. t.sterling = 500;
  42114. t.fraction = 167;
  42115. t.yen = 500;
  42116. t.florin = 500;
  42117. t.section = 500;
  42118. t.currency = 500;
  42119. t.quotesingle = 278;
  42120. t.quotedblleft = 500;
  42121. t.guillemotleft = 500;
  42122. t.guilsinglleft = 333;
  42123. t.guilsinglright = 333;
  42124. t.fi = 556;
  42125. t.fl = 556;
  42126. t.endash = 500;
  42127. t.dagger = 500;
  42128. t.daggerdbl = 500;
  42129. t.periodcentered = 250;
  42130. t.paragraph = 500;
  42131. t.bullet = 350;
  42132. t.quotesinglbase = 333;
  42133. t.quotedblbase = 500;
  42134. t.quotedblright = 500;
  42135. t.guillemotright = 500;
  42136. t.ellipsis = 1000;
  42137. t.perthousand = 1000;
  42138. t.questiondown = 500;
  42139. t.grave = 333;
  42140. t.acute = 333;
  42141. t.circumflex = 333;
  42142. t.tilde = 333;
  42143. t.macron = 333;
  42144. t.breve = 333;
  42145. t.dotaccent = 333;
  42146. t.dieresis = 333;
  42147. t.ring = 333;
  42148. t.cedilla = 333;
  42149. t.hungarumlaut = 333;
  42150. t.ogonek = 333;
  42151. t.caron = 333;
  42152. t.emdash = 1000;
  42153. t.AE = 944;
  42154. t.ordfeminine = 266;
  42155. t.Lslash = 611;
  42156. t.Oslash = 722;
  42157. t.OE = 944;
  42158. t.ordmasculine = 300;
  42159. t.ae = 722;
  42160. t.dotlessi = 278;
  42161. t.lslash = 278;
  42162. t.oslash = 500;
  42163. t.oe = 722;
  42164. t.germandbls = 500;
  42165. t.Idieresis = 389;
  42166. t.eacute = 444;
  42167. t.abreve = 500;
  42168. t.uhungarumlaut = 556;
  42169. t.ecaron = 444;
  42170. t.Ydieresis = 611;
  42171. t.divide = 570;
  42172. t.Yacute = 611;
  42173. t.Acircumflex = 667;
  42174. t.aacute = 500;
  42175. t.Ucircumflex = 722;
  42176. t.yacute = 444;
  42177. t.scommaaccent = 389;
  42178. t.ecircumflex = 444;
  42179. t.Uring = 722;
  42180. t.Udieresis = 722;
  42181. t.aogonek = 500;
  42182. t.Uacute = 722;
  42183. t.uogonek = 556;
  42184. t.Edieresis = 667;
  42185. t.Dcroat = 722;
  42186. t.commaaccent = 250;
  42187. t.copyright = 747;
  42188. t.Emacron = 667;
  42189. t.ccaron = 444;
  42190. t.aring = 500;
  42191. t.Ncommaaccent = 722;
  42192. t.lacute = 278;
  42193. t.agrave = 500;
  42194. t.Tcommaaccent = 611;
  42195. t.Cacute = 667;
  42196. t.atilde = 500;
  42197. t.Edotaccent = 667;
  42198. t.scaron = 389;
  42199. t.scedilla = 389;
  42200. t.iacute = 278;
  42201. t.lozenge = 494;
  42202. t.Rcaron = 667;
  42203. t.Gcommaaccent = 722;
  42204. t.ucircumflex = 556;
  42205. t.acircumflex = 500;
  42206. t.Amacron = 667;
  42207. t.rcaron = 389;
  42208. t.ccedilla = 444;
  42209. t.Zdotaccent = 611;
  42210. t.Thorn = 611;
  42211. t.Omacron = 722;
  42212. t.Racute = 667;
  42213. t.Sacute = 556;
  42214. t.dcaron = 608;
  42215. t.Umacron = 722;
  42216. t.uring = 556;
  42217. t.threesuperior = 300;
  42218. t.Ograve = 722;
  42219. t.Agrave = 667;
  42220. t.Abreve = 667;
  42221. t.multiply = 570;
  42222. t.uacute = 556;
  42223. t.Tcaron = 611;
  42224. t.partialdiff = 494;
  42225. t.ydieresis = 444;
  42226. t.Nacute = 722;
  42227. t.icircumflex = 278;
  42228. t.Ecircumflex = 667;
  42229. t.adieresis = 500;
  42230. t.edieresis = 444;
  42231. t.cacute = 444;
  42232. t.nacute = 556;
  42233. t.umacron = 556;
  42234. t.Ncaron = 722;
  42235. t.Iacute = 389;
  42236. t.plusminus = 570;
  42237. t.brokenbar = 220;
  42238. t.registered = 747;
  42239. t.Gbreve = 722;
  42240. t.Idotaccent = 389;
  42241. t.summation = 600;
  42242. t.Egrave = 667;
  42243. t.racute = 389;
  42244. t.omacron = 500;
  42245. t.Zacute = 611;
  42246. t.Zcaron = 611;
  42247. t.greaterequal = 549;
  42248. t.Eth = 722;
  42249. t.Ccedilla = 667;
  42250. t.lcommaaccent = 278;
  42251. t.tcaron = 366;
  42252. t.eogonek = 444;
  42253. t.Uogonek = 722;
  42254. t.Aacute = 667;
  42255. t.Adieresis = 667;
  42256. t.egrave = 444;
  42257. t.zacute = 389;
  42258. t.iogonek = 278;
  42259. t.Oacute = 722;
  42260. t.oacute = 500;
  42261. t.amacron = 500;
  42262. t.sacute = 389;
  42263. t.idieresis = 278;
  42264. t.Ocircumflex = 722;
  42265. t.Ugrave = 722;
  42266. t.Delta = 612;
  42267. t.thorn = 500;
  42268. t.twosuperior = 300;
  42269. t.Odieresis = 722;
  42270. t.mu = 576;
  42271. t.igrave = 278;
  42272. t.ohungarumlaut = 500;
  42273. t.Eogonek = 667;
  42274. t.dcroat = 500;
  42275. t.threequarters = 750;
  42276. t.Scedilla = 556;
  42277. t.lcaron = 382;
  42278. t.Kcommaaccent = 667;
  42279. t.Lacute = 611;
  42280. t.trademark = 1000;
  42281. t.edotaccent = 444;
  42282. t.Igrave = 389;
  42283. t.Imacron = 389;
  42284. t.Lcaron = 611;
  42285. t.onehalf = 750;
  42286. t.lessequal = 549;
  42287. t.ocircumflex = 500;
  42288. t.ntilde = 556;
  42289. t.Uhungarumlaut = 722;
  42290. t.Eacute = 667;
  42291. t.emacron = 444;
  42292. t.gbreve = 500;
  42293. t.onequarter = 750;
  42294. t.Scaron = 556;
  42295. t.Scommaaccent = 556;
  42296. t.Ohungarumlaut = 722;
  42297. t.degree = 400;
  42298. t.ograve = 500;
  42299. t.Ccaron = 667;
  42300. t.ugrave = 556;
  42301. t.radical = 549;
  42302. t.Dcaron = 722;
  42303. t.rcommaaccent = 389;
  42304. t.Ntilde = 722;
  42305. t.otilde = 500;
  42306. t.Rcommaaccent = 667;
  42307. t.Lcommaaccent = 611;
  42308. t.Atilde = 667;
  42309. t.Aogonek = 667;
  42310. t.Aring = 667;
  42311. t.Otilde = 722;
  42312. t.zdotaccent = 389;
  42313. t.Ecaron = 667;
  42314. t.Iogonek = 389;
  42315. t.kcommaaccent = 500;
  42316. t.minus = 606;
  42317. t.Icircumflex = 389;
  42318. t.ncaron = 556;
  42319. t.tcommaaccent = 278;
  42320. t.logicalnot = 606;
  42321. t.odieresis = 500;
  42322. t.udieresis = 556;
  42323. t.notequal = 549;
  42324. t.gcommaaccent = 500;
  42325. t.eth = 500;
  42326. t.zcaron = 389;
  42327. t.ncommaaccent = 556;
  42328. t.onesuperior = 300;
  42329. t.imacron = 278;
  42330. t.Euro = 500;
  42331. });
  42332. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42333. t.space = 250;
  42334. t.exclam = 333;
  42335. t.quotedbl = 420;
  42336. t.numbersign = 500;
  42337. t.dollar = 500;
  42338. t.percent = 833;
  42339. t.ampersand = 778;
  42340. t.quoteright = 333;
  42341. t.parenleft = 333;
  42342. t.parenright = 333;
  42343. t.asterisk = 500;
  42344. t.plus = 675;
  42345. t.comma = 250;
  42346. t.hyphen = 333;
  42347. t.period = 250;
  42348. t.slash = 278;
  42349. t.zero = 500;
  42350. t.one = 500;
  42351. t.two = 500;
  42352. t.three = 500;
  42353. t.four = 500;
  42354. t.five = 500;
  42355. t.six = 500;
  42356. t.seven = 500;
  42357. t.eight = 500;
  42358. t.nine = 500;
  42359. t.colon = 333;
  42360. t.semicolon = 333;
  42361. t.less = 675;
  42362. t.equal = 675;
  42363. t.greater = 675;
  42364. t.question = 500;
  42365. t.at = 920;
  42366. t.A = 611;
  42367. t.B = 611;
  42368. t.C = 667;
  42369. t.D = 722;
  42370. t.E = 611;
  42371. t.F = 611;
  42372. t.G = 722;
  42373. t.H = 722;
  42374. t.I = 333;
  42375. t.J = 444;
  42376. t.K = 667;
  42377. t.L = 556;
  42378. t.M = 833;
  42379. t.N = 667;
  42380. t.O = 722;
  42381. t.P = 611;
  42382. t.Q = 722;
  42383. t.R = 611;
  42384. t.S = 500;
  42385. t.T = 556;
  42386. t.U = 722;
  42387. t.V = 611;
  42388. t.W = 833;
  42389. t.X = 611;
  42390. t.Y = 556;
  42391. t.Z = 556;
  42392. t.bracketleft = 389;
  42393. t.backslash = 278;
  42394. t.bracketright = 389;
  42395. t.asciicircum = 422;
  42396. t.underscore = 500;
  42397. t.quoteleft = 333;
  42398. t.a = 500;
  42399. t.b = 500;
  42400. t.c = 444;
  42401. t.d = 500;
  42402. t.e = 444;
  42403. t.f = 278;
  42404. t.g = 500;
  42405. t.h = 500;
  42406. t.i = 278;
  42407. t.j = 278;
  42408. t.k = 444;
  42409. t.l = 278;
  42410. t.m = 722;
  42411. t.n = 500;
  42412. t.o = 500;
  42413. t.p = 500;
  42414. t.q = 500;
  42415. t.r = 389;
  42416. t.s = 389;
  42417. t.t = 278;
  42418. t.u = 500;
  42419. t.v = 444;
  42420. t.w = 667;
  42421. t.x = 444;
  42422. t.y = 444;
  42423. t.z = 389;
  42424. t.braceleft = 400;
  42425. t.bar = 275;
  42426. t.braceright = 400;
  42427. t.asciitilde = 541;
  42428. t.exclamdown = 389;
  42429. t.cent = 500;
  42430. t.sterling = 500;
  42431. t.fraction = 167;
  42432. t.yen = 500;
  42433. t.florin = 500;
  42434. t.section = 500;
  42435. t.currency = 500;
  42436. t.quotesingle = 214;
  42437. t.quotedblleft = 556;
  42438. t.guillemotleft = 500;
  42439. t.guilsinglleft = 333;
  42440. t.guilsinglright = 333;
  42441. t.fi = 500;
  42442. t.fl = 500;
  42443. t.endash = 500;
  42444. t.dagger = 500;
  42445. t.daggerdbl = 500;
  42446. t.periodcentered = 250;
  42447. t.paragraph = 523;
  42448. t.bullet = 350;
  42449. t.quotesinglbase = 333;
  42450. t.quotedblbase = 556;
  42451. t.quotedblright = 556;
  42452. t.guillemotright = 500;
  42453. t.ellipsis = 889;
  42454. t.perthousand = 1000;
  42455. t.questiondown = 500;
  42456. t.grave = 333;
  42457. t.acute = 333;
  42458. t.circumflex = 333;
  42459. t.tilde = 333;
  42460. t.macron = 333;
  42461. t.breve = 333;
  42462. t.dotaccent = 333;
  42463. t.dieresis = 333;
  42464. t.ring = 333;
  42465. t.cedilla = 333;
  42466. t.hungarumlaut = 333;
  42467. t.ogonek = 333;
  42468. t.caron = 333;
  42469. t.emdash = 889;
  42470. t.AE = 889;
  42471. t.ordfeminine = 276;
  42472. t.Lslash = 556;
  42473. t.Oslash = 722;
  42474. t.OE = 944;
  42475. t.ordmasculine = 310;
  42476. t.ae = 667;
  42477. t.dotlessi = 278;
  42478. t.lslash = 278;
  42479. t.oslash = 500;
  42480. t.oe = 667;
  42481. t.germandbls = 500;
  42482. t.Idieresis = 333;
  42483. t.eacute = 444;
  42484. t.abreve = 500;
  42485. t.uhungarumlaut = 500;
  42486. t.ecaron = 444;
  42487. t.Ydieresis = 556;
  42488. t.divide = 675;
  42489. t.Yacute = 556;
  42490. t.Acircumflex = 611;
  42491. t.aacute = 500;
  42492. t.Ucircumflex = 722;
  42493. t.yacute = 444;
  42494. t.scommaaccent = 389;
  42495. t.ecircumflex = 444;
  42496. t.Uring = 722;
  42497. t.Udieresis = 722;
  42498. t.aogonek = 500;
  42499. t.Uacute = 722;
  42500. t.uogonek = 500;
  42501. t.Edieresis = 611;
  42502. t.Dcroat = 722;
  42503. t.commaaccent = 250;
  42504. t.copyright = 760;
  42505. t.Emacron = 611;
  42506. t.ccaron = 444;
  42507. t.aring = 500;
  42508. t.Ncommaaccent = 667;
  42509. t.lacute = 278;
  42510. t.agrave = 500;
  42511. t.Tcommaaccent = 556;
  42512. t.Cacute = 667;
  42513. t.atilde = 500;
  42514. t.Edotaccent = 611;
  42515. t.scaron = 389;
  42516. t.scedilla = 389;
  42517. t.iacute = 278;
  42518. t.lozenge = 471;
  42519. t.Rcaron = 611;
  42520. t.Gcommaaccent = 722;
  42521. t.ucircumflex = 500;
  42522. t.acircumflex = 500;
  42523. t.Amacron = 611;
  42524. t.rcaron = 389;
  42525. t.ccedilla = 444;
  42526. t.Zdotaccent = 556;
  42527. t.Thorn = 611;
  42528. t.Omacron = 722;
  42529. t.Racute = 611;
  42530. t.Sacute = 500;
  42531. t.dcaron = 544;
  42532. t.Umacron = 722;
  42533. t.uring = 500;
  42534. t.threesuperior = 300;
  42535. t.Ograve = 722;
  42536. t.Agrave = 611;
  42537. t.Abreve = 611;
  42538. t.multiply = 675;
  42539. t.uacute = 500;
  42540. t.Tcaron = 556;
  42541. t.partialdiff = 476;
  42542. t.ydieresis = 444;
  42543. t.Nacute = 667;
  42544. t.icircumflex = 278;
  42545. t.Ecircumflex = 611;
  42546. t.adieresis = 500;
  42547. t.edieresis = 444;
  42548. t.cacute = 444;
  42549. t.nacute = 500;
  42550. t.umacron = 500;
  42551. t.Ncaron = 667;
  42552. t.Iacute = 333;
  42553. t.plusminus = 675;
  42554. t.brokenbar = 275;
  42555. t.registered = 760;
  42556. t.Gbreve = 722;
  42557. t.Idotaccent = 333;
  42558. t.summation = 600;
  42559. t.Egrave = 611;
  42560. t.racute = 389;
  42561. t.omacron = 500;
  42562. t.Zacute = 556;
  42563. t.Zcaron = 556;
  42564. t.greaterequal = 549;
  42565. t.Eth = 722;
  42566. t.Ccedilla = 667;
  42567. t.lcommaaccent = 278;
  42568. t.tcaron = 300;
  42569. t.eogonek = 444;
  42570. t.Uogonek = 722;
  42571. t.Aacute = 611;
  42572. t.Adieresis = 611;
  42573. t.egrave = 444;
  42574. t.zacute = 389;
  42575. t.iogonek = 278;
  42576. t.Oacute = 722;
  42577. t.oacute = 500;
  42578. t.amacron = 500;
  42579. t.sacute = 389;
  42580. t.idieresis = 278;
  42581. t.Ocircumflex = 722;
  42582. t.Ugrave = 722;
  42583. t.Delta = 612;
  42584. t.thorn = 500;
  42585. t.twosuperior = 300;
  42586. t.Odieresis = 722;
  42587. t.mu = 500;
  42588. t.igrave = 278;
  42589. t.ohungarumlaut = 500;
  42590. t.Eogonek = 611;
  42591. t.dcroat = 500;
  42592. t.threequarters = 750;
  42593. t.Scedilla = 500;
  42594. t.lcaron = 300;
  42595. t.Kcommaaccent = 667;
  42596. t.Lacute = 556;
  42597. t.trademark = 980;
  42598. t.edotaccent = 444;
  42599. t.Igrave = 333;
  42600. t.Imacron = 333;
  42601. t.Lcaron = 611;
  42602. t.onehalf = 750;
  42603. t.lessequal = 549;
  42604. t.ocircumflex = 500;
  42605. t.ntilde = 500;
  42606. t.Uhungarumlaut = 722;
  42607. t.Eacute = 611;
  42608. t.emacron = 444;
  42609. t.gbreve = 500;
  42610. t.onequarter = 750;
  42611. t.Scaron = 500;
  42612. t.Scommaaccent = 500;
  42613. t.Ohungarumlaut = 722;
  42614. t.degree = 400;
  42615. t.ograve = 500;
  42616. t.Ccaron = 667;
  42617. t.ugrave = 500;
  42618. t.radical = 453;
  42619. t.Dcaron = 722;
  42620. t.rcommaaccent = 389;
  42621. t.Ntilde = 667;
  42622. t.otilde = 500;
  42623. t.Rcommaaccent = 611;
  42624. t.Lcommaaccent = 556;
  42625. t.Atilde = 611;
  42626. t.Aogonek = 611;
  42627. t.Aring = 611;
  42628. t.Otilde = 722;
  42629. t.zdotaccent = 389;
  42630. t.Ecaron = 611;
  42631. t.Iogonek = 333;
  42632. t.kcommaaccent = 444;
  42633. t.minus = 675;
  42634. t.Icircumflex = 333;
  42635. t.ncaron = 500;
  42636. t.tcommaaccent = 278;
  42637. t.logicalnot = 675;
  42638. t.odieresis = 500;
  42639. t.udieresis = 500;
  42640. t.notequal = 549;
  42641. t.gcommaaccent = 500;
  42642. t.eth = 500;
  42643. t.zcaron = 389;
  42644. t.ncommaaccent = 500;
  42645. t.onesuperior = 300;
  42646. t.imacron = 278;
  42647. t.Euro = 500;
  42648. });
  42649. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  42650. t.space = 278;
  42651. t.a1 = 974;
  42652. t.a2 = 961;
  42653. t.a202 = 974;
  42654. t.a3 = 980;
  42655. t.a4 = 719;
  42656. t.a5 = 789;
  42657. t.a119 = 790;
  42658. t.a118 = 791;
  42659. t.a117 = 690;
  42660. t.a11 = 960;
  42661. t.a12 = 939;
  42662. t.a13 = 549;
  42663. t.a14 = 855;
  42664. t.a15 = 911;
  42665. t.a16 = 933;
  42666. t.a105 = 911;
  42667. t.a17 = 945;
  42668. t.a18 = 974;
  42669. t.a19 = 755;
  42670. t.a20 = 846;
  42671. t.a21 = 762;
  42672. t.a22 = 761;
  42673. t.a23 = 571;
  42674. t.a24 = 677;
  42675. t.a25 = 763;
  42676. t.a26 = 760;
  42677. t.a27 = 759;
  42678. t.a28 = 754;
  42679. t.a6 = 494;
  42680. t.a7 = 552;
  42681. t.a8 = 537;
  42682. t.a9 = 577;
  42683. t.a10 = 692;
  42684. t.a29 = 786;
  42685. t.a30 = 788;
  42686. t.a31 = 788;
  42687. t.a32 = 790;
  42688. t.a33 = 793;
  42689. t.a34 = 794;
  42690. t.a35 = 816;
  42691. t.a36 = 823;
  42692. t.a37 = 789;
  42693. t.a38 = 841;
  42694. t.a39 = 823;
  42695. t.a40 = 833;
  42696. t.a41 = 816;
  42697. t.a42 = 831;
  42698. t.a43 = 923;
  42699. t.a44 = 744;
  42700. t.a45 = 723;
  42701. t.a46 = 749;
  42702. t.a47 = 790;
  42703. t.a48 = 792;
  42704. t.a49 = 695;
  42705. t.a50 = 776;
  42706. t.a51 = 768;
  42707. t.a52 = 792;
  42708. t.a53 = 759;
  42709. t.a54 = 707;
  42710. t.a55 = 708;
  42711. t.a56 = 682;
  42712. t.a57 = 701;
  42713. t.a58 = 826;
  42714. t.a59 = 815;
  42715. t.a60 = 789;
  42716. t.a61 = 789;
  42717. t.a62 = 707;
  42718. t.a63 = 687;
  42719. t.a64 = 696;
  42720. t.a65 = 689;
  42721. t.a66 = 786;
  42722. t.a67 = 787;
  42723. t.a68 = 713;
  42724. t.a69 = 791;
  42725. t.a70 = 785;
  42726. t.a71 = 791;
  42727. t.a72 = 873;
  42728. t.a73 = 761;
  42729. t.a74 = 762;
  42730. t.a203 = 762;
  42731. t.a75 = 759;
  42732. t.a204 = 759;
  42733. t.a76 = 892;
  42734. t.a77 = 892;
  42735. t.a78 = 788;
  42736. t.a79 = 784;
  42737. t.a81 = 438;
  42738. t.a82 = 138;
  42739. t.a83 = 277;
  42740. t.a84 = 415;
  42741. t.a97 = 392;
  42742. t.a98 = 392;
  42743. t.a99 = 668;
  42744. t.a100 = 668;
  42745. t.a89 = 390;
  42746. t.a90 = 390;
  42747. t.a93 = 317;
  42748. t.a94 = 317;
  42749. t.a91 = 276;
  42750. t.a92 = 276;
  42751. t.a205 = 509;
  42752. t.a85 = 509;
  42753. t.a206 = 410;
  42754. t.a86 = 410;
  42755. t.a87 = 234;
  42756. t.a88 = 234;
  42757. t.a95 = 334;
  42758. t.a96 = 334;
  42759. t.a101 = 732;
  42760. t.a102 = 544;
  42761. t.a103 = 544;
  42762. t.a104 = 910;
  42763. t.a106 = 667;
  42764. t.a107 = 760;
  42765. t.a108 = 760;
  42766. t.a112 = 776;
  42767. t.a111 = 595;
  42768. t.a110 = 694;
  42769. t.a109 = 626;
  42770. t.a120 = 788;
  42771. t.a121 = 788;
  42772. t.a122 = 788;
  42773. t.a123 = 788;
  42774. t.a124 = 788;
  42775. t.a125 = 788;
  42776. t.a126 = 788;
  42777. t.a127 = 788;
  42778. t.a128 = 788;
  42779. t.a129 = 788;
  42780. t.a130 = 788;
  42781. t.a131 = 788;
  42782. t.a132 = 788;
  42783. t.a133 = 788;
  42784. t.a134 = 788;
  42785. t.a135 = 788;
  42786. t.a136 = 788;
  42787. t.a137 = 788;
  42788. t.a138 = 788;
  42789. t.a139 = 788;
  42790. t.a140 = 788;
  42791. t.a141 = 788;
  42792. t.a142 = 788;
  42793. t.a143 = 788;
  42794. t.a144 = 788;
  42795. t.a145 = 788;
  42796. t.a146 = 788;
  42797. t.a147 = 788;
  42798. t.a148 = 788;
  42799. t.a149 = 788;
  42800. t.a150 = 788;
  42801. t.a151 = 788;
  42802. t.a152 = 788;
  42803. t.a153 = 788;
  42804. t.a154 = 788;
  42805. t.a155 = 788;
  42806. t.a156 = 788;
  42807. t.a157 = 788;
  42808. t.a158 = 788;
  42809. t.a159 = 788;
  42810. t.a160 = 894;
  42811. t.a161 = 838;
  42812. t.a163 = 1016;
  42813. t.a164 = 458;
  42814. t.a196 = 748;
  42815. t.a165 = 924;
  42816. t.a192 = 748;
  42817. t.a166 = 918;
  42818. t.a167 = 927;
  42819. t.a168 = 928;
  42820. t.a169 = 928;
  42821. t.a170 = 834;
  42822. t.a171 = 873;
  42823. t.a172 = 828;
  42824. t.a173 = 924;
  42825. t.a162 = 924;
  42826. t.a174 = 917;
  42827. t.a175 = 930;
  42828. t.a176 = 931;
  42829. t.a177 = 463;
  42830. t.a178 = 883;
  42831. t.a179 = 836;
  42832. t.a193 = 836;
  42833. t.a180 = 867;
  42834. t.a199 = 867;
  42835. t.a181 = 696;
  42836. t.a200 = 696;
  42837. t.a182 = 874;
  42838. t.a201 = 874;
  42839. t.a183 = 760;
  42840. t.a184 = 946;
  42841. t.a197 = 771;
  42842. t.a185 = 865;
  42843. t.a194 = 771;
  42844. t.a198 = 888;
  42845. t.a186 = 967;
  42846. t.a195 = 888;
  42847. t.a187 = 831;
  42848. t.a188 = 873;
  42849. t.a189 = 927;
  42850. t.a190 = 970;
  42851. t.a191 = 918;
  42852. });
  42853. });
  42854. exports.getMetrics = getMetrics;
  42855. /***/ }),
  42856. /* 54 */
  42857. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42858. Object.defineProperty(exports, "__esModule", ({
  42859. value: true
  42860. }));
  42861. exports.MurmurHash3_64 = void 0;
  42862. var _util = __w_pdfjs_require__(2);
  42863. const SEED = 0xc3d2e1f0;
  42864. const MASK_HIGH = 0xffff0000;
  42865. const MASK_LOW = 0xffff;
  42866. class MurmurHash3_64 {
  42867. constructor(seed) {
  42868. this.h1 = seed ? seed & 0xffffffff : SEED;
  42869. this.h2 = seed ? seed & 0xffffffff : SEED;
  42870. }
  42871. update(input) {
  42872. let data, length;
  42873. if ((0, _util.isString)(input)) {
  42874. data = new Uint8Array(input.length * 2);
  42875. length = 0;
  42876. for (let i = 0, ii = input.length; i < ii; i++) {
  42877. const code = input.charCodeAt(i);
  42878. if (code <= 0xff) {
  42879. data[length++] = code;
  42880. } else {
  42881. data[length++] = code >>> 8;
  42882. data[length++] = code & 0xff;
  42883. }
  42884. }
  42885. } else if ((0, _util.isArrayBuffer)(input)) {
  42886. data = input.slice();
  42887. length = data.byteLength;
  42888. } else {
  42889. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  42890. }
  42891. const blockCounts = length >> 2;
  42892. const tailLength = length - blockCounts * 4;
  42893. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  42894. let k1 = 0,
  42895. k2 = 0;
  42896. let h1 = this.h1,
  42897. h2 = this.h2;
  42898. const C1 = 0xcc9e2d51,
  42899. C2 = 0x1b873593;
  42900. const C1_LOW = C1 & MASK_LOW,
  42901. C2_LOW = C2 & MASK_LOW;
  42902. for (let i = 0; i < blockCounts; i++) {
  42903. if (i & 1) {
  42904. k1 = dataUint32[i];
  42905. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  42906. k1 = k1 << 15 | k1 >>> 17;
  42907. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  42908. h1 ^= k1;
  42909. h1 = h1 << 13 | h1 >>> 19;
  42910. h1 = h1 * 5 + 0xe6546b64;
  42911. } else {
  42912. k2 = dataUint32[i];
  42913. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  42914. k2 = k2 << 15 | k2 >>> 17;
  42915. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  42916. h2 ^= k2;
  42917. h2 = h2 << 13 | h2 >>> 19;
  42918. h2 = h2 * 5 + 0xe6546b64;
  42919. }
  42920. }
  42921. k1 = 0;
  42922. switch (tailLength) {
  42923. case 3:
  42924. k1 ^= data[blockCounts * 4 + 2] << 16;
  42925. case 2:
  42926. k1 ^= data[blockCounts * 4 + 1] << 8;
  42927. case 1:
  42928. k1 ^= data[blockCounts * 4];
  42929. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  42930. k1 = k1 << 15 | k1 >>> 17;
  42931. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  42932. if (blockCounts & 1) {
  42933. h1 ^= k1;
  42934. } else {
  42935. h2 ^= k1;
  42936. }
  42937. }
  42938. this.h1 = h1;
  42939. this.h2 = h2;
  42940. }
  42941. hexdigest() {
  42942. let h1 = this.h1,
  42943. h2 = this.h2;
  42944. h1 ^= h2 >>> 1;
  42945. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  42946. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  42947. h1 ^= h2 >>> 1;
  42948. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  42949. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  42950. h1 ^= h2 >>> 1;
  42951. const hex1 = (h1 >>> 0).toString(16),
  42952. hex2 = (h2 >>> 0).toString(16);
  42953. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  42954. }
  42955. }
  42956. exports.MurmurHash3_64 = MurmurHash3_64;
  42957. /***/ }),
  42958. /* 55 */
  42959. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42960. Object.defineProperty(exports, "__esModule", ({
  42961. value: true
  42962. }));
  42963. exports.OperatorList = void 0;
  42964. var _util = __w_pdfjs_require__(2);
  42965. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  42966. let state = parentState;
  42967. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  42968. const item = pattern[i];
  42969. state = state[item] || (state[item] = []);
  42970. }
  42971. state[pattern[pattern.length - 1]] = {
  42972. checkFn,
  42973. iterateFn,
  42974. processFn
  42975. };
  42976. }
  42977. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  42978. const iFirstPIMXO = iFirstSave + 2;
  42979. let i;
  42980. for (i = 0; i < count; i++) {
  42981. const arg = argsArray[iFirstPIMXO + 4 * i];
  42982. const imageMask = arg.length === 1 && arg[0];
  42983. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  42984. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  42985. continue;
  42986. }
  42987. break;
  42988. }
  42989. return count - i;
  42990. }
  42991. const InitialState = [];
  42992. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  42993. const fnArray = context.fnArray;
  42994. const iFirstSave = context.iCurr - 3;
  42995. const pos = (i - iFirstSave) % 4;
  42996. switch (pos) {
  42997. case 0:
  42998. return fnArray[i] === _util.OPS.save;
  42999. case 1:
  43000. return fnArray[i] === _util.OPS.transform;
  43001. case 2:
  43002. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  43003. case 3:
  43004. return fnArray[i] === _util.OPS.restore;
  43005. }
  43006. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  43007. }, function foundInlineImageGroup(context, i) {
  43008. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  43009. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  43010. const MAX_WIDTH = 1000;
  43011. const IMAGE_PADDING = 1;
  43012. const fnArray = context.fnArray,
  43013. argsArray = context.argsArray;
  43014. const curr = context.iCurr;
  43015. const iFirstSave = curr - 3;
  43016. const iFirstTransform = curr - 2;
  43017. const iFirstPIIXO = curr - 1;
  43018. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  43019. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  43020. return i - (i - iFirstSave) % 4;
  43021. }
  43022. let maxX = 0;
  43023. const map = [];
  43024. let maxLineHeight = 0;
  43025. let currentX = IMAGE_PADDING,
  43026. currentY = IMAGE_PADDING;
  43027. for (let q = 0; q < count; q++) {
  43028. const transform = argsArray[iFirstTransform + (q << 2)];
  43029. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  43030. if (currentX + img.width > MAX_WIDTH) {
  43031. maxX = Math.max(maxX, currentX);
  43032. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  43033. currentX = 0;
  43034. maxLineHeight = 0;
  43035. }
  43036. map.push({
  43037. transform,
  43038. x: currentX,
  43039. y: currentY,
  43040. w: img.width,
  43041. h: img.height
  43042. });
  43043. currentX += img.width + 2 * IMAGE_PADDING;
  43044. maxLineHeight = Math.max(maxLineHeight, img.height);
  43045. }
  43046. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  43047. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  43048. const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  43049. const imgRowSize = imgWidth << 2;
  43050. for (let q = 0; q < count; q++) {
  43051. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  43052. const rowSize = map[q].w << 2;
  43053. let dataOffset = 0;
  43054. let offset = map[q].x + map[q].y * imgWidth << 2;
  43055. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  43056. for (let k = 0, kk = map[q].h; k < kk; k++) {
  43057. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  43058. dataOffset += rowSize;
  43059. offset += imgRowSize;
  43060. }
  43061. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  43062. while (offset >= 0) {
  43063. data[offset - 4] = data[offset];
  43064. data[offset - 3] = data[offset + 1];
  43065. data[offset - 2] = data[offset + 2];
  43066. data[offset - 1] = data[offset + 3];
  43067. data[offset + rowSize] = data[offset + rowSize - 4];
  43068. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  43069. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  43070. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  43071. offset -= imgRowSize;
  43072. }
  43073. }
  43074. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  43075. argsArray.splice(iFirstSave, count * 4, [{
  43076. width: imgWidth,
  43077. height: imgHeight,
  43078. kind: _util.ImageKind.RGBA_32BPP,
  43079. data: imgData
  43080. }, map]);
  43081. return iFirstSave + 1;
  43082. });
  43083. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  43084. const fnArray = context.fnArray;
  43085. const iFirstSave = context.iCurr - 3;
  43086. const pos = (i - iFirstSave) % 4;
  43087. switch (pos) {
  43088. case 0:
  43089. return fnArray[i] === _util.OPS.save;
  43090. case 1:
  43091. return fnArray[i] === _util.OPS.transform;
  43092. case 2:
  43093. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  43094. case 3:
  43095. return fnArray[i] === _util.OPS.restore;
  43096. }
  43097. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  43098. }, function foundImageMaskGroup(context, i) {
  43099. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  43100. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  43101. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  43102. const fnArray = context.fnArray,
  43103. argsArray = context.argsArray;
  43104. const curr = context.iCurr;
  43105. const iFirstSave = curr - 3;
  43106. const iFirstTransform = curr - 2;
  43107. const iFirstPIMXO = curr - 1;
  43108. let count = Math.floor((i - iFirstSave) / 4);
  43109. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  43110. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  43111. return i - (i - iFirstSave) % 4;
  43112. }
  43113. let isSameImage = false;
  43114. let iTransform, transformArgs;
  43115. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  43116. const firstTransformArg0 = argsArray[iFirstTransform][0],
  43117. firstTransformArg1 = argsArray[iFirstTransform][1],
  43118. firstTransformArg2 = argsArray[iFirstTransform][2],
  43119. firstTransformArg3 = argsArray[iFirstTransform][3];
  43120. if (firstTransformArg1 === firstTransformArg2) {
  43121. isSameImage = true;
  43122. iTransform = iFirstTransform + 4;
  43123. let iPIMXO = iFirstPIMXO + 4;
  43124. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  43125. transformArgs = argsArray[iTransform];
  43126. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  43127. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  43128. isSameImage = false;
  43129. } else {
  43130. count = q;
  43131. }
  43132. break;
  43133. }
  43134. }
  43135. }
  43136. if (isSameImage) {
  43137. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  43138. const positions = new Float32Array(count * 2);
  43139. iTransform = iFirstTransform;
  43140. for (let q = 0; q < count; q++, iTransform += 4) {
  43141. transformArgs = argsArray[iTransform];
  43142. positions[q << 1] = transformArgs[4];
  43143. positions[(q << 1) + 1] = transformArgs[5];
  43144. }
  43145. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  43146. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  43147. } else {
  43148. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  43149. const images = [];
  43150. for (let q = 0; q < count; q++) {
  43151. transformArgs = argsArray[iFirstTransform + (q << 2)];
  43152. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  43153. images.push({
  43154. data: maskParams.data,
  43155. width: maskParams.width,
  43156. height: maskParams.height,
  43157. transform: transformArgs
  43158. });
  43159. }
  43160. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  43161. argsArray.splice(iFirstSave, count * 4, [images]);
  43162. }
  43163. return iFirstSave + 1;
  43164. });
  43165. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  43166. const argsArray = context.argsArray;
  43167. const iFirstTransform = context.iCurr - 2;
  43168. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  43169. }, function iterateImageGroup(context, i) {
  43170. const fnArray = context.fnArray,
  43171. argsArray = context.argsArray;
  43172. const iFirstSave = context.iCurr - 3;
  43173. const pos = (i - iFirstSave) % 4;
  43174. switch (pos) {
  43175. case 0:
  43176. return fnArray[i] === _util.OPS.save;
  43177. case 1:
  43178. if (fnArray[i] !== _util.OPS.transform) {
  43179. return false;
  43180. }
  43181. const iFirstTransform = context.iCurr - 2;
  43182. const firstTransformArg0 = argsArray[iFirstTransform][0];
  43183. const firstTransformArg3 = argsArray[iFirstTransform][3];
  43184. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  43185. return false;
  43186. }
  43187. return true;
  43188. case 2:
  43189. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  43190. return false;
  43191. }
  43192. const iFirstPIXO = context.iCurr - 1;
  43193. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  43194. if (argsArray[i][0] !== firstPIXOArg0) {
  43195. return false;
  43196. }
  43197. return true;
  43198. case 3:
  43199. return fnArray[i] === _util.OPS.restore;
  43200. }
  43201. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  43202. }, function (context, i) {
  43203. const MIN_IMAGES_IN_BLOCK = 3;
  43204. const MAX_IMAGES_IN_BLOCK = 1000;
  43205. const fnArray = context.fnArray,
  43206. argsArray = context.argsArray;
  43207. const curr = context.iCurr;
  43208. const iFirstSave = curr - 3;
  43209. const iFirstTransform = curr - 2;
  43210. const iFirstPIXO = curr - 1;
  43211. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  43212. const firstTransformArg0 = argsArray[iFirstTransform][0];
  43213. const firstTransformArg3 = argsArray[iFirstTransform][3];
  43214. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  43215. if (count < MIN_IMAGES_IN_BLOCK) {
  43216. return i - (i - iFirstSave) % 4;
  43217. }
  43218. const positions = new Float32Array(count * 2);
  43219. let iTransform = iFirstTransform;
  43220. for (let q = 0; q < count; q++, iTransform += 4) {
  43221. const transformArgs = argsArray[iTransform];
  43222. positions[q << 1] = transformArgs[4];
  43223. positions[(q << 1) + 1] = transformArgs[5];
  43224. }
  43225. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  43226. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  43227. argsArray.splice(iFirstSave, count * 4, args);
  43228. return iFirstSave + 1;
  43229. });
  43230. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  43231. const fnArray = context.fnArray,
  43232. argsArray = context.argsArray;
  43233. const iFirstSave = context.iCurr - 4;
  43234. const pos = (i - iFirstSave) % 5;
  43235. switch (pos) {
  43236. case 0:
  43237. return fnArray[i] === _util.OPS.beginText;
  43238. case 1:
  43239. return fnArray[i] === _util.OPS.setFont;
  43240. case 2:
  43241. return fnArray[i] === _util.OPS.setTextMatrix;
  43242. case 3:
  43243. if (fnArray[i] !== _util.OPS.showText) {
  43244. return false;
  43245. }
  43246. const iFirstSetFont = context.iCurr - 3;
  43247. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  43248. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  43249. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  43250. return false;
  43251. }
  43252. return true;
  43253. case 4:
  43254. return fnArray[i] === _util.OPS.endText;
  43255. }
  43256. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  43257. }, function (context, i) {
  43258. const MIN_CHARS_IN_BLOCK = 3;
  43259. const MAX_CHARS_IN_BLOCK = 1000;
  43260. const fnArray = context.fnArray,
  43261. argsArray = context.argsArray;
  43262. const curr = context.iCurr;
  43263. const iFirstBeginText = curr - 4;
  43264. const iFirstSetFont = curr - 3;
  43265. const iFirstSetTextMatrix = curr - 2;
  43266. const iFirstShowText = curr - 1;
  43267. const iFirstEndText = curr;
  43268. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  43269. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  43270. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  43271. if (count < MIN_CHARS_IN_BLOCK) {
  43272. return i - (i - iFirstBeginText) % 5;
  43273. }
  43274. let iFirst = iFirstBeginText;
  43275. 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) {
  43276. count++;
  43277. iFirst -= 5;
  43278. }
  43279. let iEndText = iFirst + 4;
  43280. for (let q = 1; q < count; q++) {
  43281. fnArray.splice(iEndText, 3);
  43282. argsArray.splice(iEndText, 3);
  43283. iEndText += 2;
  43284. }
  43285. return iEndText + 1;
  43286. });
  43287. class NullOptimizer {
  43288. constructor(queue) {
  43289. this.queue = queue;
  43290. }
  43291. _optimize() {}
  43292. push(fn, args) {
  43293. this.queue.fnArray.push(fn);
  43294. this.queue.argsArray.push(args);
  43295. this._optimize();
  43296. }
  43297. flush() {}
  43298. reset() {}
  43299. }
  43300. class QueueOptimizer extends NullOptimizer {
  43301. constructor(queue) {
  43302. super(queue);
  43303. this.state = null;
  43304. this.context = {
  43305. iCurr: 0,
  43306. fnArray: queue.fnArray,
  43307. argsArray: queue.argsArray
  43308. };
  43309. this.match = null;
  43310. this.lastProcessed = 0;
  43311. }
  43312. _optimize() {
  43313. const fnArray = this.queue.fnArray;
  43314. let i = this.lastProcessed,
  43315. ii = fnArray.length;
  43316. let state = this.state;
  43317. let match = this.match;
  43318. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  43319. this.lastProcessed = ii;
  43320. return;
  43321. }
  43322. const context = this.context;
  43323. while (i < ii) {
  43324. if (match) {
  43325. const iterate = (0, match.iterateFn)(context, i);
  43326. if (iterate) {
  43327. i++;
  43328. continue;
  43329. }
  43330. i = (0, match.processFn)(context, i + 1);
  43331. ii = fnArray.length;
  43332. match = null;
  43333. state = null;
  43334. if (i >= ii) {
  43335. break;
  43336. }
  43337. }
  43338. state = (state || InitialState)[fnArray[i]];
  43339. if (!state || Array.isArray(state)) {
  43340. i++;
  43341. continue;
  43342. }
  43343. context.iCurr = i;
  43344. i++;
  43345. if (state.checkFn && !(0, state.checkFn)(context)) {
  43346. state = null;
  43347. continue;
  43348. }
  43349. match = state;
  43350. state = null;
  43351. }
  43352. this.state = state;
  43353. this.match = match;
  43354. this.lastProcessed = i;
  43355. }
  43356. flush() {
  43357. while (this.match) {
  43358. const length = this.queue.fnArray.length;
  43359. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  43360. this.match = null;
  43361. this.state = null;
  43362. this._optimize();
  43363. }
  43364. }
  43365. reset() {
  43366. this.state = null;
  43367. this.match = null;
  43368. this.lastProcessed = 0;
  43369. }
  43370. }
  43371. class OperatorList {
  43372. static get CHUNK_SIZE() {
  43373. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  43374. }
  43375. static get CHUNK_SIZE_ABOUT() {
  43376. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", OperatorList.CHUNK_SIZE - 5);
  43377. }
  43378. constructor(intent, streamSink) {
  43379. this._streamSink = streamSink;
  43380. this.fnArray = [];
  43381. this.argsArray = [];
  43382. if (streamSink && intent !== "oplist") {
  43383. this.optimizer = new QueueOptimizer(this);
  43384. } else {
  43385. this.optimizer = new NullOptimizer(this);
  43386. }
  43387. this.dependencies = new Set();
  43388. this._totalLength = 0;
  43389. this.weight = 0;
  43390. this._resolved = streamSink ? null : Promise.resolve();
  43391. }
  43392. get length() {
  43393. return this.argsArray.length;
  43394. }
  43395. get ready() {
  43396. return this._resolved || this._streamSink.ready;
  43397. }
  43398. get totalLength() {
  43399. return this._totalLength + this.length;
  43400. }
  43401. addOp(fn, args) {
  43402. this.optimizer.push(fn, args);
  43403. this.weight++;
  43404. if (this._streamSink) {
  43405. if (this.weight >= OperatorList.CHUNK_SIZE) {
  43406. this.flush();
  43407. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  43408. this.flush();
  43409. }
  43410. }
  43411. }
  43412. addDependency(dependency) {
  43413. if (this.dependencies.has(dependency)) {
  43414. return;
  43415. }
  43416. this.dependencies.add(dependency);
  43417. this.addOp(_util.OPS.dependency, [dependency]);
  43418. }
  43419. addDependencies(dependencies) {
  43420. for (const dependency of dependencies) {
  43421. this.addDependency(dependency);
  43422. }
  43423. }
  43424. addOpList(opList) {
  43425. if (!(opList instanceof OperatorList)) {
  43426. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  43427. return;
  43428. }
  43429. for (const dependency of opList.dependencies) {
  43430. this.dependencies.add(dependency);
  43431. }
  43432. for (let i = 0, ii = opList.length; i < ii; i++) {
  43433. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  43434. }
  43435. }
  43436. getIR() {
  43437. return {
  43438. fnArray: this.fnArray,
  43439. argsArray: this.argsArray,
  43440. length: this.length
  43441. };
  43442. }
  43443. get _transfers() {
  43444. const transfers = [];
  43445. const {
  43446. fnArray,
  43447. argsArray,
  43448. length
  43449. } = this;
  43450. for (let i = 0; i < length; i++) {
  43451. switch (fnArray[i]) {
  43452. case _util.OPS.paintInlineImageXObject:
  43453. case _util.OPS.paintInlineImageXObjectGroup:
  43454. case _util.OPS.paintImageMaskXObject:
  43455. const arg = argsArray[i][0];
  43456. ;
  43457. if (!arg.cached) {
  43458. transfers.push(arg.data.buffer);
  43459. }
  43460. break;
  43461. }
  43462. }
  43463. return transfers;
  43464. }
  43465. flush(lastChunk = false) {
  43466. this.optimizer.flush();
  43467. const length = this.length;
  43468. this._totalLength += length;
  43469. this._streamSink.enqueue({
  43470. fnArray: this.fnArray,
  43471. argsArray: this.argsArray,
  43472. lastChunk,
  43473. length
  43474. }, 1, this._transfers);
  43475. this.dependencies.clear();
  43476. this.fnArray.length = 0;
  43477. this.argsArray.length = 0;
  43478. this.weight = 0;
  43479. this.optimizer.reset();
  43480. }
  43481. }
  43482. exports.OperatorList = OperatorList;
  43483. /***/ }),
  43484. /* 56 */
  43485. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43486. Object.defineProperty(exports, "__esModule", ({
  43487. value: true
  43488. }));
  43489. exports.PDFImage = void 0;
  43490. var _util = __w_pdfjs_require__(2);
  43491. var _primitives = __w_pdfjs_require__(5);
  43492. var _colorspace = __w_pdfjs_require__(14);
  43493. var _decode_stream = __w_pdfjs_require__(19);
  43494. var _jpeg_stream = __w_pdfjs_require__(27);
  43495. var _jpx = __w_pdfjs_require__(30);
  43496. function decodeAndClamp(value, addend, coefficient, max) {
  43497. value = addend + value * coefficient;
  43498. if (value < 0) {
  43499. value = 0;
  43500. } else if (value > max) {
  43501. value = max;
  43502. }
  43503. return value;
  43504. }
  43505. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  43506. const length = w2 * h2;
  43507. let dest;
  43508. if (bpc <= 8) {
  43509. dest = new Uint8Array(length);
  43510. } else if (bpc <= 16) {
  43511. dest = new Uint16Array(length);
  43512. } else {
  43513. dest = new Uint32Array(length);
  43514. }
  43515. const xRatio = w1 / w2;
  43516. const yRatio = h1 / h2;
  43517. let i,
  43518. j,
  43519. py,
  43520. newIndex = 0,
  43521. oldIndex;
  43522. const xScaled = new Uint16Array(w2);
  43523. const w1Scanline = w1;
  43524. for (i = 0; i < w2; i++) {
  43525. xScaled[i] = Math.floor(i * xRatio);
  43526. }
  43527. for (i = 0; i < h2; i++) {
  43528. py = Math.floor(i * yRatio) * w1Scanline;
  43529. for (j = 0; j < w2; j++) {
  43530. oldIndex = py + xScaled[j];
  43531. dest[newIndex++] = src[oldIndex];
  43532. }
  43533. }
  43534. return dest;
  43535. }
  43536. class PDFImage {
  43537. constructor({
  43538. xref,
  43539. res,
  43540. image,
  43541. isInline = false,
  43542. smask = null,
  43543. mask = null,
  43544. isMask = false,
  43545. pdfFunctionFactory,
  43546. localColorSpaceCache
  43547. }) {
  43548. this.image = image;
  43549. const dict = image.dict;
  43550. const filter = dict.get("Filter");
  43551. if ((0, _primitives.isName)(filter)) {
  43552. switch (filter.name) {
  43553. case "JPXDecode":
  43554. const jpxImage = new _jpx.JpxImage();
  43555. jpxImage.parseImageProperties(image.stream);
  43556. image.stream.reset();
  43557. image.width = jpxImage.width;
  43558. image.height = jpxImage.height;
  43559. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43560. image.numComps = jpxImage.componentsCount;
  43561. break;
  43562. case "JBIG2Decode":
  43563. image.bitsPerComponent = 1;
  43564. image.numComps = 1;
  43565. break;
  43566. }
  43567. }
  43568. let width = dict.get("Width", "W");
  43569. let height = dict.get("Height", "H");
  43570. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  43571. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  43572. width = image.width;
  43573. height = image.height;
  43574. }
  43575. if (width < 1 || height < 1) {
  43576. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  43577. }
  43578. this.width = width;
  43579. this.height = height;
  43580. this.interpolate = dict.get("Interpolate", "I") || false;
  43581. this.imageMask = dict.get("ImageMask", "IM") || false;
  43582. this.matte = dict.get("Matte") || false;
  43583. let bitsPerComponent = image.bitsPerComponent;
  43584. if (!bitsPerComponent) {
  43585. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  43586. if (!bitsPerComponent) {
  43587. if (this.imageMask) {
  43588. bitsPerComponent = 1;
  43589. } else {
  43590. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  43591. }
  43592. }
  43593. }
  43594. this.bpc = bitsPerComponent;
  43595. if (!this.imageMask) {
  43596. let colorSpace = dict.getRaw("ColorSpace") || dict.getRaw("CS");
  43597. if (!colorSpace) {
  43598. (0, _util.info)("JPX images (which do not require color spaces)");
  43599. switch (image.numComps) {
  43600. case 1:
  43601. colorSpace = _primitives.Name.get("DeviceGray");
  43602. break;
  43603. case 3:
  43604. colorSpace = _primitives.Name.get("DeviceRGB");
  43605. break;
  43606. case 4:
  43607. colorSpace = _primitives.Name.get("DeviceCMYK");
  43608. break;
  43609. default:
  43610. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  43611. }
  43612. }
  43613. this.colorSpace = _colorspace.ColorSpace.parse({
  43614. cs: colorSpace,
  43615. xref,
  43616. resources: isInline ? res : null,
  43617. pdfFunctionFactory,
  43618. localColorSpaceCache
  43619. });
  43620. this.numComps = this.colorSpace.numComps;
  43621. }
  43622. this.decode = dict.getArray("Decode", "D");
  43623. this.needsDecode = false;
  43624. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  43625. this.needsDecode = true;
  43626. const max = (1 << bitsPerComponent) - 1;
  43627. this.decodeCoefficients = [];
  43628. this.decodeAddends = [];
  43629. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  43630. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43631. const dmin = this.decode[i];
  43632. const dmax = this.decode[i + 1];
  43633. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  43634. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  43635. }
  43636. }
  43637. if (smask) {
  43638. this.smask = new PDFImage({
  43639. xref,
  43640. res,
  43641. image: smask,
  43642. isInline,
  43643. pdfFunctionFactory,
  43644. localColorSpaceCache
  43645. });
  43646. } else if (mask) {
  43647. if ((0, _primitives.isStream)(mask)) {
  43648. const maskDict = mask.dict,
  43649. imageMask = maskDict.get("ImageMask", "IM");
  43650. if (!imageMask) {
  43651. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  43652. } else {
  43653. this.mask = new PDFImage({
  43654. xref,
  43655. res,
  43656. image: mask,
  43657. isInline,
  43658. isMask: true,
  43659. pdfFunctionFactory,
  43660. localColorSpaceCache
  43661. });
  43662. }
  43663. } else {
  43664. this.mask = mask;
  43665. }
  43666. }
  43667. }
  43668. static async buildImage({
  43669. xref,
  43670. res,
  43671. image,
  43672. isInline = false,
  43673. pdfFunctionFactory,
  43674. localColorSpaceCache
  43675. }) {
  43676. const imageData = image;
  43677. let smaskData = null;
  43678. let maskData = null;
  43679. const smask = image.dict.get("SMask");
  43680. const mask = image.dict.get("Mask");
  43681. if (smask) {
  43682. smaskData = smask;
  43683. } else if (mask) {
  43684. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  43685. maskData = mask;
  43686. } else {
  43687. (0, _util.warn)("Unsupported mask format.");
  43688. }
  43689. }
  43690. return new PDFImage({
  43691. xref,
  43692. res,
  43693. image: imageData,
  43694. isInline,
  43695. smask: smaskData,
  43696. mask: maskData,
  43697. pdfFunctionFactory,
  43698. localColorSpaceCache
  43699. });
  43700. }
  43701. static createMask({
  43702. imgArray,
  43703. width,
  43704. height,
  43705. imageIsFromDecodeStream,
  43706. inverseDecode
  43707. }) {
  43708. const computedLength = (width + 7 >> 3) * height;
  43709. const actualLength = imgArray.byteLength;
  43710. const haveFullData = computedLength === actualLength;
  43711. let data, i;
  43712. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43713. data = imgArray;
  43714. } else if (!inverseDecode) {
  43715. data = new Uint8ClampedArray(actualLength);
  43716. data.set(imgArray);
  43717. } else {
  43718. data = new Uint8ClampedArray(computedLength);
  43719. data.set(imgArray);
  43720. for (i = actualLength; i < computedLength; i++) {
  43721. data[i] = 0xff;
  43722. }
  43723. }
  43724. if (inverseDecode) {
  43725. for (i = 0; i < actualLength; i++) {
  43726. data[i] ^= 0xff;
  43727. }
  43728. }
  43729. return {
  43730. data,
  43731. width,
  43732. height
  43733. };
  43734. }
  43735. get drawWidth() {
  43736. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43737. }
  43738. get drawHeight() {
  43739. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43740. }
  43741. decodeBuffer(buffer) {
  43742. const bpc = this.bpc;
  43743. const numComps = this.numComps;
  43744. const decodeAddends = this.decodeAddends;
  43745. const decodeCoefficients = this.decodeCoefficients;
  43746. const max = (1 << bpc) - 1;
  43747. let i, ii;
  43748. if (bpc === 1) {
  43749. for (i = 0, ii = buffer.length; i < ii; i++) {
  43750. buffer[i] = +!buffer[i];
  43751. }
  43752. return;
  43753. }
  43754. let index = 0;
  43755. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43756. for (let j = 0; j < numComps; j++) {
  43757. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43758. index++;
  43759. }
  43760. }
  43761. }
  43762. getComponents(buffer) {
  43763. const bpc = this.bpc;
  43764. if (bpc === 8) {
  43765. return buffer;
  43766. }
  43767. const width = this.width;
  43768. const height = this.height;
  43769. const numComps = this.numComps;
  43770. const length = width * height * numComps;
  43771. let bufferPos = 0;
  43772. let output;
  43773. if (bpc <= 8) {
  43774. output = new Uint8Array(length);
  43775. } else if (bpc <= 16) {
  43776. output = new Uint16Array(length);
  43777. } else {
  43778. output = new Uint32Array(length);
  43779. }
  43780. const rowComps = width * numComps;
  43781. const max = (1 << bpc) - 1;
  43782. let i = 0,
  43783. ii,
  43784. buf;
  43785. if (bpc === 1) {
  43786. let mask, loop1End, loop2End;
  43787. for (let j = 0; j < height; j++) {
  43788. loop1End = i + (rowComps & ~7);
  43789. loop2End = i + rowComps;
  43790. while (i < loop1End) {
  43791. buf = buffer[bufferPos++];
  43792. output[i] = buf >> 7 & 1;
  43793. output[i + 1] = buf >> 6 & 1;
  43794. output[i + 2] = buf >> 5 & 1;
  43795. output[i + 3] = buf >> 4 & 1;
  43796. output[i + 4] = buf >> 3 & 1;
  43797. output[i + 5] = buf >> 2 & 1;
  43798. output[i + 6] = buf >> 1 & 1;
  43799. output[i + 7] = buf & 1;
  43800. i += 8;
  43801. }
  43802. if (i < loop2End) {
  43803. buf = buffer[bufferPos++];
  43804. mask = 128;
  43805. while (i < loop2End) {
  43806. output[i++] = +!!(buf & mask);
  43807. mask >>= 1;
  43808. }
  43809. }
  43810. }
  43811. } else {
  43812. let bits = 0;
  43813. buf = 0;
  43814. for (i = 0, ii = length; i < ii; ++i) {
  43815. if (i % rowComps === 0) {
  43816. buf = 0;
  43817. bits = 0;
  43818. }
  43819. while (bits < bpc) {
  43820. buf = buf << 8 | buffer[bufferPos++];
  43821. bits += 8;
  43822. }
  43823. const remainingBits = bits - bpc;
  43824. let value = buf >> remainingBits;
  43825. if (value < 0) {
  43826. value = 0;
  43827. } else if (value > max) {
  43828. value = max;
  43829. }
  43830. output[i] = value;
  43831. buf = buf & (1 << remainingBits) - 1;
  43832. bits = remainingBits;
  43833. }
  43834. }
  43835. return output;
  43836. }
  43837. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43838. const smask = this.smask;
  43839. const mask = this.mask;
  43840. let alphaBuf, sw, sh, i, ii, j;
  43841. if (smask) {
  43842. sw = smask.width;
  43843. sh = smask.height;
  43844. alphaBuf = new Uint8ClampedArray(sw * sh);
  43845. smask.fillGrayBuffer(alphaBuf);
  43846. if (sw !== width || sh !== height) {
  43847. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43848. }
  43849. } else if (mask) {
  43850. if (mask instanceof PDFImage) {
  43851. sw = mask.width;
  43852. sh = mask.height;
  43853. alphaBuf = new Uint8ClampedArray(sw * sh);
  43854. mask.numComps = 1;
  43855. mask.fillGrayBuffer(alphaBuf);
  43856. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43857. alphaBuf[i] = 255 - alphaBuf[i];
  43858. }
  43859. if (sw !== width || sh !== height) {
  43860. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43861. }
  43862. } else if (Array.isArray(mask)) {
  43863. alphaBuf = new Uint8ClampedArray(width * height);
  43864. const numComps = this.numComps;
  43865. for (i = 0, ii = width * height; i < ii; ++i) {
  43866. let opacity = 0;
  43867. const imageOffset = i * numComps;
  43868. for (j = 0; j < numComps; ++j) {
  43869. const color = image[imageOffset + j];
  43870. const maskOffset = j * 2;
  43871. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43872. opacity = 255;
  43873. break;
  43874. }
  43875. }
  43876. alphaBuf[i] = opacity;
  43877. }
  43878. } else {
  43879. throw new _util.FormatError("Unknown mask format.");
  43880. }
  43881. }
  43882. if (alphaBuf) {
  43883. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43884. rgbaBuf[j] = alphaBuf[i];
  43885. }
  43886. } else {
  43887. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43888. rgbaBuf[j] = 255;
  43889. }
  43890. }
  43891. }
  43892. undoPreblend(buffer, width, height) {
  43893. const matte = this.smask && this.smask.matte;
  43894. if (!matte) {
  43895. return;
  43896. }
  43897. const matteRgb = this.colorSpace.getRgb(matte, 0);
  43898. const matteR = matteRgb[0];
  43899. const matteG = matteRgb[1];
  43900. const matteB = matteRgb[2];
  43901. const length = width * height * 4;
  43902. for (let i = 0; i < length; i += 4) {
  43903. const alpha = buffer[i + 3];
  43904. if (alpha === 0) {
  43905. buffer[i] = 255;
  43906. buffer[i + 1] = 255;
  43907. buffer[i + 2] = 255;
  43908. continue;
  43909. }
  43910. const k = 255 / alpha;
  43911. buffer[i] = (buffer[i] - matteR) * k + matteR;
  43912. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  43913. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  43914. }
  43915. }
  43916. createImageData(forceRGBA = false) {
  43917. const drawWidth = this.drawWidth;
  43918. const drawHeight = this.drawHeight;
  43919. const imgData = {
  43920. width: drawWidth,
  43921. height: drawHeight,
  43922. kind: 0,
  43923. data: null
  43924. };
  43925. const numComps = this.numComps;
  43926. const originalWidth = this.width;
  43927. const originalHeight = this.height;
  43928. const bpc = this.bpc;
  43929. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43930. let imgArray;
  43931. if (!forceRGBA) {
  43932. let kind;
  43933. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  43934. kind = _util.ImageKind.GRAYSCALE_1BPP;
  43935. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  43936. kind = _util.ImageKind.RGB_24BPP;
  43937. }
  43938. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43939. imgData.kind = kind;
  43940. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43941. if (this.image instanceof _decode_stream.DecodeStream) {
  43942. imgData.data = imgArray;
  43943. } else {
  43944. const newArray = new Uint8ClampedArray(imgArray.length);
  43945. newArray.set(imgArray);
  43946. imgData.data = newArray;
  43947. }
  43948. if (this.needsDecode) {
  43949. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  43950. const buffer = imgData.data;
  43951. for (let i = 0, ii = buffer.length; i < ii; i++) {
  43952. buffer[i] ^= 0xff;
  43953. }
  43954. }
  43955. return imgData;
  43956. }
  43957. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  43958. let imageLength = originalHeight * rowBytes;
  43959. switch (this.colorSpace.name) {
  43960. case "DeviceGray":
  43961. imageLength *= 3;
  43962. case "DeviceRGB":
  43963. case "DeviceCMYK":
  43964. imgData.kind = _util.ImageKind.RGB_24BPP;
  43965. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  43966. return imgData;
  43967. }
  43968. }
  43969. }
  43970. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43971. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43972. const comps = this.getComponents(imgArray);
  43973. let alpha01, maybeUndoPreblend;
  43974. if (!forceRGBA && !this.smask && !this.mask) {
  43975. imgData.kind = _util.ImageKind.RGB_24BPP;
  43976. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  43977. alpha01 = 0;
  43978. maybeUndoPreblend = false;
  43979. } else {
  43980. imgData.kind = _util.ImageKind.RGBA_32BPP;
  43981. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  43982. alpha01 = 1;
  43983. maybeUndoPreblend = true;
  43984. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43985. }
  43986. if (this.needsDecode) {
  43987. this.decodeBuffer(comps);
  43988. }
  43989. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43990. if (maybeUndoPreblend) {
  43991. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43992. }
  43993. return imgData;
  43994. }
  43995. fillGrayBuffer(buffer) {
  43996. const numComps = this.numComps;
  43997. if (numComps !== 1) {
  43998. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  43999. }
  44000. const width = this.width;
  44001. const height = this.height;
  44002. const bpc = this.bpc;
  44003. const rowBytes = width * numComps * bpc + 7 >> 3;
  44004. const imgArray = this.getImageBytes(height * rowBytes);
  44005. const comps = this.getComponents(imgArray);
  44006. let i, length;
  44007. if (bpc === 1) {
  44008. length = width * height;
  44009. if (this.needsDecode) {
  44010. for (i = 0; i < length; ++i) {
  44011. buffer[i] = comps[i] - 1 & 255;
  44012. }
  44013. } else {
  44014. for (i = 0; i < length; ++i) {
  44015. buffer[i] = -comps[i] & 255;
  44016. }
  44017. }
  44018. return;
  44019. }
  44020. if (this.needsDecode) {
  44021. this.decodeBuffer(comps);
  44022. }
  44023. length = width * height;
  44024. const scale = 255 / ((1 << bpc) - 1);
  44025. for (i = 0; i < length; ++i) {
  44026. buffer[i] = scale * comps[i];
  44027. }
  44028. }
  44029. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  44030. this.image.reset();
  44031. this.image.drawWidth = drawWidth || this.width;
  44032. this.image.drawHeight = drawHeight || this.height;
  44033. this.image.forceRGB = !!forceRGB;
  44034. return this.image.getBytes(length, true);
  44035. }
  44036. }
  44037. exports.PDFImage = PDFImage;
  44038. /***/ }),
  44039. /* 57 */
  44040. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44041. Object.defineProperty(exports, "__esModule", ({
  44042. value: true
  44043. }));
  44044. exports.Catalog = void 0;
  44045. var _primitives = __w_pdfjs_require__(5);
  44046. var _core_utils = __w_pdfjs_require__(9);
  44047. var _util = __w_pdfjs_require__(2);
  44048. var _name_number_tree = __w_pdfjs_require__(58);
  44049. var _colorspace = __w_pdfjs_require__(14);
  44050. var _file_spec = __w_pdfjs_require__(59);
  44051. var _image_utils = __w_pdfjs_require__(51);
  44052. var _metadata_parser = __w_pdfjs_require__(60);
  44053. var _struct_tree = __w_pdfjs_require__(62);
  44054. function fetchDestination(dest) {
  44055. if (dest instanceof _primitives.Dict) {
  44056. dest = dest.get("D");
  44057. }
  44058. return Array.isArray(dest) ? dest : null;
  44059. }
  44060. class Catalog {
  44061. constructor(pdfManager, xref) {
  44062. this.pdfManager = pdfManager;
  44063. this.xref = xref;
  44064. this._catDict = xref.getCatalogObj();
  44065. if (!(0, _primitives.isDict)(this._catDict)) {
  44066. throw new _util.FormatError("Catalog object is not a dictionary.");
  44067. }
  44068. this.fontCache = new _primitives.RefSetCache();
  44069. this.builtInCMapCache = new Map();
  44070. this.globalImageCache = new _image_utils.GlobalImageCache();
  44071. this.pageKidsCountCache = new _primitives.RefSetCache();
  44072. this.pageIndexCache = new _primitives.RefSetCache();
  44073. this.nonBlendModesSet = new _primitives.RefSet();
  44074. }
  44075. get version() {
  44076. const version = this._catDict.get("Version");
  44077. if (!(0, _primitives.isName)(version)) {
  44078. return (0, _util.shadow)(this, "version", null);
  44079. }
  44080. return (0, _util.shadow)(this, "version", version.name);
  44081. }
  44082. get collection() {
  44083. let collection = null;
  44084. try {
  44085. const obj = this._catDict.get("Collection");
  44086. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  44087. collection = obj;
  44088. }
  44089. } catch (ex) {
  44090. if (ex instanceof _core_utils.MissingDataException) {
  44091. throw ex;
  44092. }
  44093. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  44094. }
  44095. return (0, _util.shadow)(this, "collection", collection);
  44096. }
  44097. get acroForm() {
  44098. let acroForm = null;
  44099. try {
  44100. const obj = this._catDict.get("AcroForm");
  44101. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  44102. acroForm = obj;
  44103. }
  44104. } catch (ex) {
  44105. if (ex instanceof _core_utils.MissingDataException) {
  44106. throw ex;
  44107. }
  44108. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  44109. }
  44110. return (0, _util.shadow)(this, "acroForm", acroForm);
  44111. }
  44112. get metadata() {
  44113. const streamRef = this._catDict.getRaw("Metadata");
  44114. if (!(0, _primitives.isRef)(streamRef)) {
  44115. return (0, _util.shadow)(this, "metadata", null);
  44116. }
  44117. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  44118. const stream = this.xref.fetch(streamRef, suppressEncryption);
  44119. let metadata = null;
  44120. if ((0, _primitives.isStream)(stream) && (0, _primitives.isDict)(stream.dict)) {
  44121. const type = stream.dict.get("Type");
  44122. const subtype = stream.dict.get("Subtype");
  44123. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  44124. try {
  44125. const data = (0, _util.stringToUTF8String)(stream.getString());
  44126. if (data) {
  44127. metadata = new _metadata_parser.MetadataParser(data).serializable;
  44128. }
  44129. } catch (e) {
  44130. if (e instanceof _core_utils.MissingDataException) {
  44131. throw e;
  44132. }
  44133. (0, _util.info)("Skipping invalid metadata.");
  44134. }
  44135. }
  44136. }
  44137. return (0, _util.shadow)(this, "metadata", metadata);
  44138. }
  44139. get markInfo() {
  44140. let markInfo = null;
  44141. try {
  44142. markInfo = this._readMarkInfo();
  44143. } catch (ex) {
  44144. if (ex instanceof _core_utils.MissingDataException) {
  44145. throw ex;
  44146. }
  44147. (0, _util.warn)("Unable to read mark info.");
  44148. }
  44149. return (0, _util.shadow)(this, "markInfo", markInfo);
  44150. }
  44151. _readMarkInfo() {
  44152. const obj = this._catDict.get("MarkInfo");
  44153. if (!(0, _primitives.isDict)(obj)) {
  44154. return null;
  44155. }
  44156. const markInfo = Object.assign(Object.create(null), {
  44157. Marked: false,
  44158. UserProperties: false,
  44159. Suspects: false
  44160. });
  44161. for (const key in markInfo) {
  44162. if (!obj.has(key)) {
  44163. continue;
  44164. }
  44165. const value = obj.get(key);
  44166. if (!(0, _util.isBool)(value)) {
  44167. continue;
  44168. }
  44169. markInfo[key] = value;
  44170. }
  44171. return markInfo;
  44172. }
  44173. get structTreeRoot() {
  44174. let structTree = null;
  44175. try {
  44176. structTree = this._readStructTreeRoot();
  44177. } catch (ex) {
  44178. if (ex instanceof _core_utils.MissingDataException) {
  44179. throw ex;
  44180. }
  44181. (0, _util.warn)("Unable read to structTreeRoot info.");
  44182. }
  44183. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  44184. }
  44185. _readStructTreeRoot() {
  44186. const obj = this._catDict.get("StructTreeRoot");
  44187. if (!(0, _primitives.isDict)(obj)) {
  44188. return null;
  44189. }
  44190. const root = new _struct_tree.StructTreeRoot(obj);
  44191. root.init();
  44192. return root;
  44193. }
  44194. get toplevelPagesDict() {
  44195. const pagesObj = this._catDict.get("Pages");
  44196. if (!(0, _primitives.isDict)(pagesObj)) {
  44197. throw new _util.FormatError("Invalid top-level pages dictionary.");
  44198. }
  44199. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  44200. }
  44201. get documentOutline() {
  44202. let obj = null;
  44203. try {
  44204. obj = this._readDocumentOutline();
  44205. } catch (ex) {
  44206. if (ex instanceof _core_utils.MissingDataException) {
  44207. throw ex;
  44208. }
  44209. (0, _util.warn)("Unable to read document outline.");
  44210. }
  44211. return (0, _util.shadow)(this, "documentOutline", obj);
  44212. }
  44213. _readDocumentOutline() {
  44214. let obj = this._catDict.get("Outlines");
  44215. if (!(0, _primitives.isDict)(obj)) {
  44216. return null;
  44217. }
  44218. obj = obj.getRaw("First");
  44219. if (!(0, _primitives.isRef)(obj)) {
  44220. return null;
  44221. }
  44222. const root = {
  44223. items: []
  44224. };
  44225. const queue = [{
  44226. obj,
  44227. parent: root
  44228. }];
  44229. const processed = new _primitives.RefSet();
  44230. processed.put(obj);
  44231. const xref = this.xref,
  44232. blackColor = new Uint8ClampedArray(3);
  44233. while (queue.length > 0) {
  44234. const i = queue.shift();
  44235. const outlineDict = xref.fetchIfRef(i.obj);
  44236. if (outlineDict === null) {
  44237. continue;
  44238. }
  44239. if (!outlineDict.has("Title")) {
  44240. throw new _util.FormatError("Invalid outline item encountered.");
  44241. }
  44242. const data = {
  44243. url: null,
  44244. dest: null
  44245. };
  44246. Catalog.parseDestDictionary({
  44247. destDict: outlineDict,
  44248. resultObj: data,
  44249. docBaseUrl: this.pdfManager.docBaseUrl
  44250. });
  44251. const title = outlineDict.get("Title");
  44252. const flags = outlineDict.get("F") || 0;
  44253. const color = outlineDict.getArray("C");
  44254. const count = outlineDict.get("Count");
  44255. let rgbColor = blackColor;
  44256. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  44257. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  44258. }
  44259. const outlineItem = {
  44260. dest: data.dest,
  44261. url: data.url,
  44262. unsafeUrl: data.unsafeUrl,
  44263. newWindow: data.newWindow,
  44264. title: (0, _util.stringToPDFString)(title),
  44265. color: rgbColor,
  44266. count: Number.isInteger(count) ? count : undefined,
  44267. bold: !!(flags & 2),
  44268. italic: !!(flags & 1),
  44269. items: []
  44270. };
  44271. i.parent.items.push(outlineItem);
  44272. obj = outlineDict.getRaw("First");
  44273. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  44274. queue.push({
  44275. obj,
  44276. parent: outlineItem
  44277. });
  44278. processed.put(obj);
  44279. }
  44280. obj = outlineDict.getRaw("Next");
  44281. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  44282. queue.push({
  44283. obj,
  44284. parent: i.parent
  44285. });
  44286. processed.put(obj);
  44287. }
  44288. }
  44289. return root.items.length > 0 ? root.items : null;
  44290. }
  44291. get permissions() {
  44292. let permissions = null;
  44293. try {
  44294. permissions = this._readPermissions();
  44295. } catch (ex) {
  44296. if (ex instanceof _core_utils.MissingDataException) {
  44297. throw ex;
  44298. }
  44299. (0, _util.warn)("Unable to read permissions.");
  44300. }
  44301. return (0, _util.shadow)(this, "permissions", permissions);
  44302. }
  44303. _readPermissions() {
  44304. const encrypt = this.xref.trailer.get("Encrypt");
  44305. if (!(0, _primitives.isDict)(encrypt)) {
  44306. return null;
  44307. }
  44308. let flags = encrypt.get("P");
  44309. if (!(0, _util.isNum)(flags)) {
  44310. return null;
  44311. }
  44312. flags += 2 ** 32;
  44313. const permissions = [];
  44314. for (const key in _util.PermissionFlag) {
  44315. const value = _util.PermissionFlag[key];
  44316. if (flags & value) {
  44317. permissions.push(value);
  44318. }
  44319. }
  44320. return permissions;
  44321. }
  44322. get optionalContentConfig() {
  44323. let config = null;
  44324. try {
  44325. const properties = this._catDict.get("OCProperties");
  44326. if (!properties) {
  44327. return (0, _util.shadow)(this, "optionalContentConfig", null);
  44328. }
  44329. const defaultConfig = properties.get("D");
  44330. if (!defaultConfig) {
  44331. return (0, _util.shadow)(this, "optionalContentConfig", null);
  44332. }
  44333. const groupsData = properties.get("OCGs");
  44334. if (!Array.isArray(groupsData)) {
  44335. return (0, _util.shadow)(this, "optionalContentConfig", null);
  44336. }
  44337. const groups = [];
  44338. const groupRefs = [];
  44339. for (const groupRef of groupsData) {
  44340. if (!(0, _primitives.isRef)(groupRef)) {
  44341. continue;
  44342. }
  44343. groupRefs.push(groupRef);
  44344. const group = this.xref.fetchIfRef(groupRef);
  44345. groups.push({
  44346. id: groupRef.toString(),
  44347. name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  44348. intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  44349. });
  44350. }
  44351. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  44352. config.groups = groups;
  44353. } catch (ex) {
  44354. if (ex instanceof _core_utils.MissingDataException) {
  44355. throw ex;
  44356. }
  44357. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  44358. }
  44359. return (0, _util.shadow)(this, "optionalContentConfig", config);
  44360. }
  44361. _readOptionalContentConfig(config, contentGroupRefs) {
  44362. function parseOnOff(refs) {
  44363. const onParsed = [];
  44364. if (Array.isArray(refs)) {
  44365. for (const value of refs) {
  44366. if (!(0, _primitives.isRef)(value)) {
  44367. continue;
  44368. }
  44369. if (contentGroupRefs.includes(value)) {
  44370. onParsed.push(value.toString());
  44371. }
  44372. }
  44373. }
  44374. return onParsed;
  44375. }
  44376. function parseOrder(refs, nestedLevels = 0) {
  44377. if (!Array.isArray(refs)) {
  44378. return null;
  44379. }
  44380. const order = [];
  44381. for (const value of refs) {
  44382. if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) {
  44383. parsedOrderRefs.put(value);
  44384. order.push(value.toString());
  44385. continue;
  44386. }
  44387. const nestedOrder = parseNestedOrder(value, nestedLevels);
  44388. if (nestedOrder) {
  44389. order.push(nestedOrder);
  44390. }
  44391. }
  44392. if (nestedLevels > 0) {
  44393. return order;
  44394. }
  44395. const hiddenGroups = [];
  44396. for (const groupRef of contentGroupRefs) {
  44397. if (parsedOrderRefs.has(groupRef)) {
  44398. continue;
  44399. }
  44400. hiddenGroups.push(groupRef.toString());
  44401. }
  44402. if (hiddenGroups.length) {
  44403. order.push({
  44404. name: null,
  44405. order: hiddenGroups
  44406. });
  44407. }
  44408. return order;
  44409. }
  44410. function parseNestedOrder(ref, nestedLevels) {
  44411. if (++nestedLevels > MAX_NESTED_LEVELS) {
  44412. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  44413. return null;
  44414. }
  44415. const value = xref.fetchIfRef(ref);
  44416. if (!Array.isArray(value)) {
  44417. return null;
  44418. }
  44419. const nestedName = xref.fetchIfRef(value[0]);
  44420. if (typeof nestedName !== "string") {
  44421. return null;
  44422. }
  44423. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  44424. if (!nestedOrder || !nestedOrder.length) {
  44425. return null;
  44426. }
  44427. return {
  44428. name: (0, _util.stringToPDFString)(nestedName),
  44429. order: nestedOrder
  44430. };
  44431. }
  44432. const xref = this.xref,
  44433. parsedOrderRefs = new _primitives.RefSet(),
  44434. MAX_NESTED_LEVELS = 10;
  44435. return {
  44436. name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  44437. creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  44438. baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null,
  44439. on: parseOnOff(config.get("ON")),
  44440. off: parseOnOff(config.get("OFF")),
  44441. order: parseOrder(config.get("Order")),
  44442. groups: null
  44443. };
  44444. }
  44445. get numPages() {
  44446. const obj = this.toplevelPagesDict.get("Count");
  44447. if (!Number.isInteger(obj)) {
  44448. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  44449. }
  44450. return (0, _util.shadow)(this, "numPages", obj);
  44451. }
  44452. get destinations() {
  44453. const obj = this._readDests(),
  44454. dests = Object.create(null);
  44455. if (obj instanceof _name_number_tree.NameTree) {
  44456. for (const [key, value] of obj.getAll()) {
  44457. const dest = fetchDestination(value);
  44458. if (dest) {
  44459. dests[key] = dest;
  44460. }
  44461. }
  44462. } else if (obj instanceof _primitives.Dict) {
  44463. obj.forEach(function (key, value) {
  44464. const dest = fetchDestination(value);
  44465. if (dest) {
  44466. dests[key] = dest;
  44467. }
  44468. });
  44469. }
  44470. return (0, _util.shadow)(this, "destinations", dests);
  44471. }
  44472. getDestination(id) {
  44473. const obj = this._readDests();
  44474. if (obj instanceof _name_number_tree.NameTree) {
  44475. const dest = fetchDestination(obj.get(id));
  44476. if (dest) {
  44477. return dest;
  44478. }
  44479. const allDest = this.destinations[id];
  44480. if (allDest) {
  44481. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  44482. return allDest;
  44483. }
  44484. } else if (obj instanceof _primitives.Dict) {
  44485. const dest = fetchDestination(obj.get(id));
  44486. if (dest) {
  44487. return dest;
  44488. }
  44489. }
  44490. return null;
  44491. }
  44492. _readDests() {
  44493. const obj = this._catDict.get("Names");
  44494. if (obj && obj.has("Dests")) {
  44495. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  44496. } else if (this._catDict.has("Dests")) {
  44497. return this._catDict.get("Dests");
  44498. }
  44499. return undefined;
  44500. }
  44501. get pageLabels() {
  44502. let obj = null;
  44503. try {
  44504. obj = this._readPageLabels();
  44505. } catch (ex) {
  44506. if (ex instanceof _core_utils.MissingDataException) {
  44507. throw ex;
  44508. }
  44509. (0, _util.warn)("Unable to read page labels.");
  44510. }
  44511. return (0, _util.shadow)(this, "pageLabels", obj);
  44512. }
  44513. _readPageLabels() {
  44514. const obj = this._catDict.getRaw("PageLabels");
  44515. if (!obj) {
  44516. return null;
  44517. }
  44518. const pageLabels = new Array(this.numPages);
  44519. let style = null,
  44520. prefix = "";
  44521. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  44522. const nums = numberTree.getAll();
  44523. let currentLabel = "",
  44524. currentIndex = 1;
  44525. for (let i = 0, ii = this.numPages; i < ii; i++) {
  44526. const labelDict = nums.get(i);
  44527. if (labelDict !== undefined) {
  44528. if (!(0, _primitives.isDict)(labelDict)) {
  44529. throw new _util.FormatError("PageLabel is not a dictionary.");
  44530. }
  44531. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  44532. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  44533. }
  44534. if (labelDict.has("S")) {
  44535. const s = labelDict.get("S");
  44536. if (!(0, _primitives.isName)(s)) {
  44537. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  44538. }
  44539. style = s.name;
  44540. } else {
  44541. style = null;
  44542. }
  44543. if (labelDict.has("P")) {
  44544. const p = labelDict.get("P");
  44545. if (!(0, _util.isString)(p)) {
  44546. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  44547. }
  44548. prefix = (0, _util.stringToPDFString)(p);
  44549. } else {
  44550. prefix = "";
  44551. }
  44552. if (labelDict.has("St")) {
  44553. const st = labelDict.get("St");
  44554. if (!(Number.isInteger(st) && st >= 1)) {
  44555. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  44556. }
  44557. currentIndex = st;
  44558. } else {
  44559. currentIndex = 1;
  44560. }
  44561. }
  44562. switch (style) {
  44563. case "D":
  44564. currentLabel = currentIndex;
  44565. break;
  44566. case "R":
  44567. case "r":
  44568. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  44569. break;
  44570. case "A":
  44571. case "a":
  44572. const LIMIT = 26;
  44573. const A_UPPER_CASE = 0x41,
  44574. A_LOWER_CASE = 0x61;
  44575. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  44576. const letterIndex = currentIndex - 1;
  44577. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  44578. const charBuf = [];
  44579. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  44580. charBuf.push(character);
  44581. }
  44582. currentLabel = charBuf.join("");
  44583. break;
  44584. default:
  44585. if (style) {
  44586. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  44587. }
  44588. currentLabel = "";
  44589. }
  44590. pageLabels[i] = prefix + currentLabel;
  44591. currentIndex++;
  44592. }
  44593. return pageLabels;
  44594. }
  44595. get pageLayout() {
  44596. const obj = this._catDict.get("PageLayout");
  44597. let pageLayout = "";
  44598. if ((0, _primitives.isName)(obj)) {
  44599. switch (obj.name) {
  44600. case "SinglePage":
  44601. case "OneColumn":
  44602. case "TwoColumnLeft":
  44603. case "TwoColumnRight":
  44604. case "TwoPageLeft":
  44605. case "TwoPageRight":
  44606. pageLayout = obj.name;
  44607. }
  44608. }
  44609. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  44610. }
  44611. get pageMode() {
  44612. const obj = this._catDict.get("PageMode");
  44613. let pageMode = "UseNone";
  44614. if ((0, _primitives.isName)(obj)) {
  44615. switch (obj.name) {
  44616. case "UseNone":
  44617. case "UseOutlines":
  44618. case "UseThumbs":
  44619. case "FullScreen":
  44620. case "UseOC":
  44621. case "UseAttachments":
  44622. pageMode = obj.name;
  44623. }
  44624. }
  44625. return (0, _util.shadow)(this, "pageMode", pageMode);
  44626. }
  44627. get viewerPreferences() {
  44628. const ViewerPreferencesValidators = {
  44629. HideToolbar: _util.isBool,
  44630. HideMenubar: _util.isBool,
  44631. HideWindowUI: _util.isBool,
  44632. FitWindow: _util.isBool,
  44633. CenterWindow: _util.isBool,
  44634. DisplayDocTitle: _util.isBool,
  44635. NonFullScreenPageMode: _primitives.isName,
  44636. Direction: _primitives.isName,
  44637. ViewArea: _primitives.isName,
  44638. ViewClip: _primitives.isName,
  44639. PrintArea: _primitives.isName,
  44640. PrintClip: _primitives.isName,
  44641. PrintScaling: _primitives.isName,
  44642. Duplex: _primitives.isName,
  44643. PickTrayByPDFSize: _util.isBool,
  44644. PrintPageRange: Array.isArray,
  44645. NumCopies: Number.isInteger
  44646. };
  44647. const obj = this._catDict.get("ViewerPreferences");
  44648. let prefs = null;
  44649. if ((0, _primitives.isDict)(obj)) {
  44650. for (const key in ViewerPreferencesValidators) {
  44651. if (!obj.has(key)) {
  44652. continue;
  44653. }
  44654. const value = obj.get(key);
  44655. if (!ViewerPreferencesValidators[key](value)) {
  44656. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  44657. continue;
  44658. }
  44659. let prefValue;
  44660. switch (key) {
  44661. case "NonFullScreenPageMode":
  44662. switch (value.name) {
  44663. case "UseNone":
  44664. case "UseOutlines":
  44665. case "UseThumbs":
  44666. case "UseOC":
  44667. prefValue = value.name;
  44668. break;
  44669. default:
  44670. prefValue = "UseNone";
  44671. }
  44672. break;
  44673. case "Direction":
  44674. switch (value.name) {
  44675. case "L2R":
  44676. case "R2L":
  44677. prefValue = value.name;
  44678. break;
  44679. default:
  44680. prefValue = "L2R";
  44681. }
  44682. break;
  44683. case "ViewArea":
  44684. case "ViewClip":
  44685. case "PrintArea":
  44686. case "PrintClip":
  44687. switch (value.name) {
  44688. case "MediaBox":
  44689. case "CropBox":
  44690. case "BleedBox":
  44691. case "TrimBox":
  44692. case "ArtBox":
  44693. prefValue = value.name;
  44694. break;
  44695. default:
  44696. prefValue = "CropBox";
  44697. }
  44698. break;
  44699. case "PrintScaling":
  44700. switch (value.name) {
  44701. case "None":
  44702. case "AppDefault":
  44703. prefValue = value.name;
  44704. break;
  44705. default:
  44706. prefValue = "AppDefault";
  44707. }
  44708. break;
  44709. case "Duplex":
  44710. switch (value.name) {
  44711. case "Simplex":
  44712. case "DuplexFlipShortEdge":
  44713. case "DuplexFlipLongEdge":
  44714. prefValue = value.name;
  44715. break;
  44716. default:
  44717. prefValue = "None";
  44718. }
  44719. break;
  44720. case "PrintPageRange":
  44721. const length = value.length;
  44722. if (length % 2 !== 0) {
  44723. break;
  44724. }
  44725. const isValid = value.every((page, i, arr) => {
  44726. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  44727. });
  44728. if (isValid) {
  44729. prefValue = value;
  44730. }
  44731. break;
  44732. case "NumCopies":
  44733. if (value > 0) {
  44734. prefValue = value;
  44735. }
  44736. break;
  44737. default:
  44738. if (typeof value !== "boolean") {
  44739. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  44740. }
  44741. prefValue = value;
  44742. }
  44743. if (prefValue !== undefined) {
  44744. if (!prefs) {
  44745. prefs = Object.create(null);
  44746. }
  44747. prefs[key] = prefValue;
  44748. } else {
  44749. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  44750. }
  44751. }
  44752. }
  44753. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  44754. }
  44755. get openAction() {
  44756. const obj = this._catDict.get("OpenAction");
  44757. const openAction = Object.create(null);
  44758. if ((0, _primitives.isDict)(obj)) {
  44759. const destDict = new _primitives.Dict(this.xref);
  44760. destDict.set("A", obj);
  44761. const resultObj = {
  44762. url: null,
  44763. dest: null,
  44764. action: null
  44765. };
  44766. Catalog.parseDestDictionary({
  44767. destDict,
  44768. resultObj
  44769. });
  44770. if (Array.isArray(resultObj.dest)) {
  44771. openAction.dest = resultObj.dest;
  44772. } else if (resultObj.action) {
  44773. openAction.action = resultObj.action;
  44774. }
  44775. } else if (Array.isArray(obj)) {
  44776. openAction.dest = obj;
  44777. }
  44778. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  44779. }
  44780. get attachments() {
  44781. const obj = this._catDict.get("Names");
  44782. let attachments = null;
  44783. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  44784. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  44785. for (const [key, value] of nameTree.getAll()) {
  44786. const fs = new _file_spec.FileSpec(value, this.xref);
  44787. if (!attachments) {
  44788. attachments = Object.create(null);
  44789. }
  44790. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  44791. }
  44792. }
  44793. return (0, _util.shadow)(this, "attachments", attachments);
  44794. }
  44795. _collectJavaScript() {
  44796. const obj = this._catDict.get("Names");
  44797. let javaScript = null;
  44798. function appendIfJavaScriptDict(name, jsDict) {
  44799. if (!(jsDict instanceof _primitives.Dict)) {
  44800. return;
  44801. }
  44802. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  44803. return;
  44804. }
  44805. let js = jsDict.get("JS");
  44806. if ((0, _primitives.isStream)(js)) {
  44807. js = js.getString();
  44808. } else if (typeof js !== "string") {
  44809. return;
  44810. }
  44811. if (javaScript === null) {
  44812. javaScript = new Map();
  44813. }
  44814. javaScript.set(name, (0, _util.stringToPDFString)(js));
  44815. }
  44816. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  44817. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  44818. for (const [key, value] of nameTree.getAll()) {
  44819. appendIfJavaScriptDict(key, value);
  44820. }
  44821. }
  44822. const openAction = this._catDict.get("OpenAction");
  44823. if (openAction) {
  44824. appendIfJavaScriptDict("OpenAction", openAction);
  44825. }
  44826. return javaScript;
  44827. }
  44828. get javaScript() {
  44829. const javaScript = this._collectJavaScript();
  44830. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  44831. }
  44832. get jsActions() {
  44833. const javaScript = this._collectJavaScript();
  44834. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  44835. if (javaScript) {
  44836. if (!actions) {
  44837. actions = Object.create(null);
  44838. }
  44839. for (const [key, val] of javaScript) {
  44840. if (key in actions) {
  44841. actions[key].push(val);
  44842. } else {
  44843. actions[key] = [val];
  44844. }
  44845. }
  44846. }
  44847. return (0, _util.shadow)(this, "jsActions", actions);
  44848. }
  44849. fontFallback(id, handler) {
  44850. const promises = [];
  44851. this.fontCache.forEach(function (promise) {
  44852. promises.push(promise);
  44853. });
  44854. return Promise.all(promises).then(translatedFonts => {
  44855. for (const translatedFont of translatedFonts) {
  44856. if (translatedFont.loadedName === id) {
  44857. translatedFont.fallback(handler);
  44858. return;
  44859. }
  44860. }
  44861. });
  44862. }
  44863. cleanup(manuallyTriggered = false) {
  44864. (0, _primitives.clearPrimitiveCaches)();
  44865. this.globalImageCache.clear(manuallyTriggered);
  44866. this.pageKidsCountCache.clear();
  44867. this.pageIndexCache.clear();
  44868. this.nonBlendModesSet.clear();
  44869. const promises = [];
  44870. this.fontCache.forEach(function (promise) {
  44871. promises.push(promise);
  44872. });
  44873. return Promise.all(promises).then(translatedFonts => {
  44874. for (const {
  44875. dict
  44876. } of translatedFonts) {
  44877. delete dict.cacheKey;
  44878. }
  44879. this.fontCache.clear();
  44880. this.builtInCMapCache.clear();
  44881. });
  44882. }
  44883. getPageDict(pageIndex) {
  44884. const capability = (0, _util.createPromiseCapability)();
  44885. const nodesToVisit = [this._catDict.getRaw("Pages")];
  44886. const visitedNodes = new _primitives.RefSet();
  44887. const xref = this.xref,
  44888. pageKidsCountCache = this.pageKidsCountCache;
  44889. let count,
  44890. currentPageIndex = 0;
  44891. function next() {
  44892. while (nodesToVisit.length) {
  44893. const currentNode = nodesToVisit.pop();
  44894. if ((0, _primitives.isRef)(currentNode)) {
  44895. count = pageKidsCountCache.get(currentNode);
  44896. if (count > 0 && currentPageIndex + count < pageIndex) {
  44897. currentPageIndex += count;
  44898. continue;
  44899. }
  44900. if (visitedNodes.has(currentNode)) {
  44901. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  44902. return;
  44903. }
  44904. visitedNodes.put(currentNode);
  44905. xref.fetchAsync(currentNode).then(function (obj) {
  44906. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  44907. if (pageIndex === currentPageIndex) {
  44908. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  44909. pageKidsCountCache.put(currentNode, 1);
  44910. }
  44911. capability.resolve([obj, currentNode]);
  44912. } else {
  44913. currentPageIndex++;
  44914. next();
  44915. }
  44916. return;
  44917. }
  44918. nodesToVisit.push(obj);
  44919. next();
  44920. }, capability.reject);
  44921. return;
  44922. }
  44923. if (!(0, _primitives.isDict)(currentNode)) {
  44924. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  44925. return;
  44926. }
  44927. count = currentNode.get("Count");
  44928. if (Number.isInteger(count) && count >= 0) {
  44929. const objId = currentNode.objId;
  44930. if (objId && !pageKidsCountCache.has(objId)) {
  44931. pageKidsCountCache.put(objId, count);
  44932. }
  44933. if (currentPageIndex + count <= pageIndex) {
  44934. currentPageIndex += count;
  44935. continue;
  44936. }
  44937. }
  44938. const kids = currentNode.get("Kids");
  44939. if (!Array.isArray(kids)) {
  44940. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  44941. if (currentPageIndex === pageIndex) {
  44942. capability.resolve([currentNode, null]);
  44943. return;
  44944. }
  44945. currentPageIndex++;
  44946. continue;
  44947. }
  44948. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  44949. return;
  44950. }
  44951. for (let last = kids.length - 1; last >= 0; last--) {
  44952. nodesToVisit.push(kids[last]);
  44953. }
  44954. }
  44955. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  44956. }
  44957. next();
  44958. return capability.promise;
  44959. }
  44960. getPageIndex(pageRef) {
  44961. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  44962. if (cachedPageIndex !== undefined) {
  44963. return Promise.resolve(cachedPageIndex);
  44964. }
  44965. const xref = this.xref;
  44966. function pagesBeforeRef(kidRef) {
  44967. let total = 0,
  44968. parentRef;
  44969. return xref.fetchAsync(kidRef).then(function (node) {
  44970. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  44971. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  44972. }
  44973. if (!node) {
  44974. return null;
  44975. }
  44976. if (!(0, _primitives.isDict)(node)) {
  44977. throw new _util.FormatError("Node must be a dictionary.");
  44978. }
  44979. parentRef = node.getRaw("Parent");
  44980. return node.getAsync("Parent");
  44981. }).then(function (parent) {
  44982. if (!parent) {
  44983. return null;
  44984. }
  44985. if (!(0, _primitives.isDict)(parent)) {
  44986. throw new _util.FormatError("Parent must be a dictionary.");
  44987. }
  44988. return parent.getAsync("Kids");
  44989. }).then(function (kids) {
  44990. if (!kids) {
  44991. return null;
  44992. }
  44993. const kidPromises = [];
  44994. let found = false;
  44995. for (let i = 0, ii = kids.length; i < ii; i++) {
  44996. const kid = kids[i];
  44997. if (!(0, _primitives.isRef)(kid)) {
  44998. throw new _util.FormatError("Kid must be a reference.");
  44999. }
  45000. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  45001. found = true;
  45002. break;
  45003. }
  45004. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  45005. if (!(0, _primitives.isDict)(obj)) {
  45006. throw new _util.FormatError("Kid node must be a dictionary.");
  45007. }
  45008. if (obj.has("Count")) {
  45009. total += obj.get("Count");
  45010. } else {
  45011. total++;
  45012. }
  45013. }));
  45014. }
  45015. if (!found) {
  45016. throw new _util.FormatError("Kid reference not found in parent's kids.");
  45017. }
  45018. return Promise.all(kidPromises).then(function () {
  45019. return [total, parentRef];
  45020. });
  45021. });
  45022. }
  45023. let total = 0;
  45024. const next = ref => pagesBeforeRef(ref).then(args => {
  45025. if (!args) {
  45026. this.pageIndexCache.put(pageRef, total);
  45027. return total;
  45028. }
  45029. const [count, parentRef] = args;
  45030. total += count;
  45031. return next(parentRef);
  45032. });
  45033. return next(pageRef);
  45034. }
  45035. static parseDestDictionary(params) {
  45036. function addDefaultProtocolToUrl(url) {
  45037. return url.startsWith("www.") ? `http://${url}` : url;
  45038. }
  45039. function tryConvertUrlEncoding(url) {
  45040. try {
  45041. return (0, _util.stringToUTF8String)(url);
  45042. } catch (e) {
  45043. return url;
  45044. }
  45045. }
  45046. const destDict = params.destDict;
  45047. if (!(0, _primitives.isDict)(destDict)) {
  45048. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  45049. return;
  45050. }
  45051. const resultObj = params.resultObj;
  45052. if (typeof resultObj !== "object") {
  45053. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  45054. return;
  45055. }
  45056. const docBaseUrl = params.docBaseUrl || null;
  45057. let action = destDict.get("A"),
  45058. url,
  45059. dest;
  45060. if (!(0, _primitives.isDict)(action)) {
  45061. if (destDict.has("Dest")) {
  45062. action = destDict.get("Dest");
  45063. } else {
  45064. action = destDict.get("AA");
  45065. if ((0, _primitives.isDict)(action)) {
  45066. if (action.has("D")) {
  45067. action = action.get("D");
  45068. } else if (action.has("U")) {
  45069. action = action.get("U");
  45070. }
  45071. }
  45072. }
  45073. }
  45074. if ((0, _primitives.isDict)(action)) {
  45075. const actionType = action.get("S");
  45076. if (!(0, _primitives.isName)(actionType)) {
  45077. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  45078. return;
  45079. }
  45080. const actionName = actionType.name;
  45081. switch (actionName) {
  45082. case "URI":
  45083. url = action.get("URI");
  45084. if ((0, _primitives.isName)(url)) {
  45085. url = "/" + url.name;
  45086. } else if ((0, _util.isString)(url)) {
  45087. url = addDefaultProtocolToUrl(url);
  45088. }
  45089. break;
  45090. case "GoTo":
  45091. dest = action.get("D");
  45092. break;
  45093. case "Launch":
  45094. case "GoToR":
  45095. const urlDict = action.get("F");
  45096. if ((0, _primitives.isDict)(urlDict)) {
  45097. url = urlDict.get("F") || null;
  45098. } else if ((0, _util.isString)(urlDict)) {
  45099. url = urlDict;
  45100. }
  45101. let remoteDest = action.get("D");
  45102. if (remoteDest) {
  45103. if ((0, _primitives.isName)(remoteDest)) {
  45104. remoteDest = remoteDest.name;
  45105. }
  45106. if ((0, _util.isString)(url)) {
  45107. const baseUrl = url.split("#")[0];
  45108. if ((0, _util.isString)(remoteDest)) {
  45109. url = baseUrl + "#" + remoteDest;
  45110. } else if (Array.isArray(remoteDest)) {
  45111. url = baseUrl + "#" + JSON.stringify(remoteDest);
  45112. }
  45113. }
  45114. }
  45115. const newWindow = action.get("NewWindow");
  45116. if ((0, _util.isBool)(newWindow)) {
  45117. resultObj.newWindow = newWindow;
  45118. }
  45119. break;
  45120. case "Named":
  45121. const namedAction = action.get("N");
  45122. if ((0, _primitives.isName)(namedAction)) {
  45123. resultObj.action = namedAction.name;
  45124. }
  45125. break;
  45126. case "JavaScript":
  45127. const jsAction = action.get("JS");
  45128. let js;
  45129. if ((0, _primitives.isStream)(jsAction)) {
  45130. js = jsAction.getString();
  45131. } else if ((0, _util.isString)(jsAction)) {
  45132. js = jsAction;
  45133. }
  45134. if (js) {
  45135. const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
  45136. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  45137. const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  45138. if (jsUrl && jsUrl[2]) {
  45139. url = jsUrl[2];
  45140. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  45141. resultObj.newWindow = true;
  45142. }
  45143. break;
  45144. }
  45145. }
  45146. default:
  45147. if (actionName === "JavaScript" || actionName === "ResetForm" || actionName === "SubmitForm") {
  45148. break;
  45149. }
  45150. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  45151. break;
  45152. }
  45153. } else if (destDict.has("Dest")) {
  45154. dest = destDict.get("Dest");
  45155. }
  45156. if ((0, _util.isString)(url)) {
  45157. url = tryConvertUrlEncoding(url);
  45158. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  45159. if (absoluteUrl) {
  45160. resultObj.url = absoluteUrl.href;
  45161. }
  45162. resultObj.unsafeUrl = url;
  45163. }
  45164. if (dest) {
  45165. if ((0, _primitives.isName)(dest)) {
  45166. dest = dest.name;
  45167. }
  45168. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  45169. resultObj.dest = dest;
  45170. }
  45171. }
  45172. }
  45173. }
  45174. exports.Catalog = Catalog;
  45175. /***/ }),
  45176. /* 58 */
  45177. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45178. Object.defineProperty(exports, "__esModule", ({
  45179. value: true
  45180. }));
  45181. exports.NumberTree = exports.NameTree = void 0;
  45182. var _util = __w_pdfjs_require__(2);
  45183. var _primitives = __w_pdfjs_require__(5);
  45184. class NameOrNumberTree {
  45185. constructor(root, xref, type) {
  45186. if (this.constructor === NameOrNumberTree) {
  45187. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  45188. }
  45189. this.root = root;
  45190. this.xref = xref;
  45191. this._type = type;
  45192. }
  45193. getAll() {
  45194. const map = new Map();
  45195. if (!this.root) {
  45196. return map;
  45197. }
  45198. const xref = this.xref;
  45199. const processed = new _primitives.RefSet();
  45200. processed.put(this.root);
  45201. const queue = [this.root];
  45202. while (queue.length > 0) {
  45203. const obj = xref.fetchIfRef(queue.shift());
  45204. if (!(0, _primitives.isDict)(obj)) {
  45205. continue;
  45206. }
  45207. if (obj.has("Kids")) {
  45208. const kids = obj.get("Kids");
  45209. for (let i = 0, ii = kids.length; i < ii; i++) {
  45210. const kid = kids[i];
  45211. if (processed.has(kid)) {
  45212. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  45213. }
  45214. queue.push(kid);
  45215. processed.put(kid);
  45216. }
  45217. continue;
  45218. }
  45219. const entries = obj.get(this._type);
  45220. if (!Array.isArray(entries)) {
  45221. continue;
  45222. }
  45223. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  45224. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  45225. }
  45226. }
  45227. return map;
  45228. }
  45229. get(key) {
  45230. if (!this.root) {
  45231. return null;
  45232. }
  45233. const xref = this.xref;
  45234. let kidsOrEntries = xref.fetchIfRef(this.root);
  45235. let loopCount = 0;
  45236. const MAX_LEVELS = 10;
  45237. while (kidsOrEntries.has("Kids")) {
  45238. if (++loopCount > MAX_LEVELS) {
  45239. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  45240. return null;
  45241. }
  45242. const kids = kidsOrEntries.get("Kids");
  45243. if (!Array.isArray(kids)) {
  45244. return null;
  45245. }
  45246. let l = 0,
  45247. r = kids.length - 1;
  45248. while (l <= r) {
  45249. const m = l + r >> 1;
  45250. const kid = xref.fetchIfRef(kids[m]);
  45251. const limits = kid.get("Limits");
  45252. if (key < xref.fetchIfRef(limits[0])) {
  45253. r = m - 1;
  45254. } else if (key > xref.fetchIfRef(limits[1])) {
  45255. l = m + 1;
  45256. } else {
  45257. kidsOrEntries = xref.fetchIfRef(kids[m]);
  45258. break;
  45259. }
  45260. }
  45261. if (l > r) {
  45262. return null;
  45263. }
  45264. }
  45265. const entries = kidsOrEntries.get(this._type);
  45266. if (Array.isArray(entries)) {
  45267. let l = 0,
  45268. r = entries.length - 2;
  45269. while (l <= r) {
  45270. const tmp = l + r >> 1,
  45271. m = tmp + (tmp & 1);
  45272. const currentKey = xref.fetchIfRef(entries[m]);
  45273. if (key < currentKey) {
  45274. r = m - 2;
  45275. } else if (key > currentKey) {
  45276. l = m + 2;
  45277. } else {
  45278. return xref.fetchIfRef(entries[m + 1]);
  45279. }
  45280. }
  45281. }
  45282. return null;
  45283. }
  45284. }
  45285. class NameTree extends NameOrNumberTree {
  45286. constructor(root, xref) {
  45287. super(root, xref, "Names");
  45288. }
  45289. }
  45290. exports.NameTree = NameTree;
  45291. class NumberTree extends NameOrNumberTree {
  45292. constructor(root, xref) {
  45293. super(root, xref, "Nums");
  45294. }
  45295. }
  45296. exports.NumberTree = NumberTree;
  45297. /***/ }),
  45298. /* 59 */
  45299. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45300. Object.defineProperty(exports, "__esModule", ({
  45301. value: true
  45302. }));
  45303. exports.FileSpec = void 0;
  45304. var _primitives = __w_pdfjs_require__(5);
  45305. var _util = __w_pdfjs_require__(2);
  45306. function pickPlatformItem(dict) {
  45307. if (dict.has("UF")) {
  45308. return dict.get("UF");
  45309. } else if (dict.has("F")) {
  45310. return dict.get("F");
  45311. } else if (dict.has("Unix")) {
  45312. return dict.get("Unix");
  45313. } else if (dict.has("Mac")) {
  45314. return dict.get("Mac");
  45315. } else if (dict.has("DOS")) {
  45316. return dict.get("DOS");
  45317. }
  45318. return null;
  45319. }
  45320. class FileSpec {
  45321. constructor(root, xref) {
  45322. if (!root || !(0, _primitives.isDict)(root)) {
  45323. return;
  45324. }
  45325. this.xref = xref;
  45326. this.root = root;
  45327. if (root.has("FS")) {
  45328. this.fs = root.get("FS");
  45329. }
  45330. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  45331. if (root.has("RF")) {
  45332. (0, _util.warn)("Related file specifications are not supported");
  45333. }
  45334. this.contentAvailable = true;
  45335. if (!root.has("EF")) {
  45336. this.contentAvailable = false;
  45337. (0, _util.warn)("Non-embedded file specifications are not supported");
  45338. }
  45339. }
  45340. get filename() {
  45341. if (!this._filename && this.root) {
  45342. const filename = pickPlatformItem(this.root) || "unnamed";
  45343. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  45344. }
  45345. return this._filename;
  45346. }
  45347. get content() {
  45348. if (!this.contentAvailable) {
  45349. return null;
  45350. }
  45351. if (!this.contentRef && this.root) {
  45352. this.contentRef = pickPlatformItem(this.root.get("EF"));
  45353. }
  45354. let content = null;
  45355. if (this.contentRef) {
  45356. const fileObj = this.xref.fetchIfRef(this.contentRef);
  45357. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  45358. content = fileObj.getBytes();
  45359. } else {
  45360. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  45361. }
  45362. } else {
  45363. (0, _util.warn)("Embedded file specification does not have a content");
  45364. }
  45365. return content;
  45366. }
  45367. get serializable() {
  45368. return {
  45369. filename: this.filename,
  45370. content: this.content
  45371. };
  45372. }
  45373. }
  45374. exports.FileSpec = FileSpec;
  45375. /***/ }),
  45376. /* 60 */
  45377. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45378. Object.defineProperty(exports, "__esModule", ({
  45379. value: true
  45380. }));
  45381. exports.MetadataParser = void 0;
  45382. var _xml_parser = __w_pdfjs_require__(61);
  45383. class MetadataParser {
  45384. constructor(data) {
  45385. data = this._repair(data);
  45386. const parser = new _xml_parser.SimpleXMLParser({
  45387. lowerCaseName: true
  45388. });
  45389. const xmlDocument = parser.parseFromString(data);
  45390. this._metadataMap = new Map();
  45391. this._data = data;
  45392. if (xmlDocument) {
  45393. this._parse(xmlDocument);
  45394. }
  45395. }
  45396. _repair(data) {
  45397. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  45398. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  45399. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  45400. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  45401. switch (name) {
  45402. case "amp":
  45403. return "&";
  45404. case "apos":
  45405. return "'";
  45406. case "gt":
  45407. return ">";
  45408. case "lt":
  45409. return "<";
  45410. case "quot":
  45411. return '"';
  45412. }
  45413. throw new Error(`_repair: ${name} isn't defined.`);
  45414. });
  45415. const charBuf = [];
  45416. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  45417. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  45418. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  45419. charBuf.push(String.fromCharCode(code));
  45420. } else {
  45421. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  45422. }
  45423. }
  45424. return ">" + charBuf.join("");
  45425. });
  45426. }
  45427. _getSequence(entry) {
  45428. const name = entry.nodeName;
  45429. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  45430. return null;
  45431. }
  45432. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  45433. }
  45434. _parseArray(entry) {
  45435. if (!entry.hasChildNodes()) {
  45436. return;
  45437. }
  45438. const [seqNode] = entry.childNodes;
  45439. const sequence = this._getSequence(seqNode) || [];
  45440. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  45441. }
  45442. _parse(xmlDocument) {
  45443. let rdf = xmlDocument.documentElement;
  45444. if (rdf.nodeName !== "rdf:rdf") {
  45445. rdf = rdf.firstChild;
  45446. while (rdf && rdf.nodeName !== "rdf:rdf") {
  45447. rdf = rdf.nextSibling;
  45448. }
  45449. }
  45450. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  45451. return;
  45452. }
  45453. for (const desc of rdf.childNodes) {
  45454. if (desc.nodeName !== "rdf:description") {
  45455. continue;
  45456. }
  45457. for (const entry of desc.childNodes) {
  45458. const name = entry.nodeName;
  45459. switch (name) {
  45460. case "#text":
  45461. continue;
  45462. case "dc:creator":
  45463. case "dc:subject":
  45464. this._parseArray(entry);
  45465. continue;
  45466. }
  45467. this._metadataMap.set(name, entry.textContent.trim());
  45468. }
  45469. }
  45470. }
  45471. get serializable() {
  45472. return {
  45473. parsedData: this._metadataMap,
  45474. rawData: this._data
  45475. };
  45476. }
  45477. }
  45478. exports.MetadataParser = MetadataParser;
  45479. /***/ }),
  45480. /* 61 */
  45481. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45482. Object.defineProperty(exports, "__esModule", ({
  45483. value: true
  45484. }));
  45485. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  45486. var _core_utils = __w_pdfjs_require__(9);
  45487. const XMLParserErrorCode = {
  45488. NoError: 0,
  45489. EndOfDocument: -1,
  45490. UnterminatedCdat: -2,
  45491. UnterminatedXmlDeclaration: -3,
  45492. UnterminatedDoctypeDeclaration: -4,
  45493. UnterminatedComment: -5,
  45494. MalformedElement: -6,
  45495. OutOfMemory: -7,
  45496. UnterminatedAttributeValue: -8,
  45497. UnterminatedElement: -9,
  45498. ElementNeverBegun: -10
  45499. };
  45500. exports.XMLParserErrorCode = XMLParserErrorCode;
  45501. function isWhitespace(s, index) {
  45502. const ch = s[index];
  45503. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  45504. }
  45505. function isWhitespaceString(s) {
  45506. for (let i = 0, ii = s.length; i < ii; i++) {
  45507. if (!isWhitespace(s, i)) {
  45508. return false;
  45509. }
  45510. }
  45511. return true;
  45512. }
  45513. class XMLParserBase {
  45514. _resolveEntities(s) {
  45515. return s.replace(/&([^;]+);/g, (all, entity) => {
  45516. if (entity.substring(0, 2) === "#x") {
  45517. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  45518. } else if (entity.substring(0, 1) === "#") {
  45519. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  45520. }
  45521. switch (entity) {
  45522. case "lt":
  45523. return "<";
  45524. case "gt":
  45525. return ">";
  45526. case "amp":
  45527. return "&";
  45528. case "quot":
  45529. return '"';
  45530. case "apos":
  45531. return "'";
  45532. }
  45533. return this.onResolveEntity(entity);
  45534. });
  45535. }
  45536. _parseContent(s, start) {
  45537. const attributes = [];
  45538. let pos = start;
  45539. function skipWs() {
  45540. while (pos < s.length && isWhitespace(s, pos)) {
  45541. ++pos;
  45542. }
  45543. }
  45544. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  45545. ++pos;
  45546. }
  45547. const name = s.substring(start, pos);
  45548. skipWs();
  45549. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  45550. skipWs();
  45551. let attrName = "",
  45552. attrValue = "";
  45553. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  45554. attrName += s[pos];
  45555. ++pos;
  45556. }
  45557. skipWs();
  45558. if (s[pos] !== "=") {
  45559. return null;
  45560. }
  45561. ++pos;
  45562. skipWs();
  45563. const attrEndChar = s[pos];
  45564. if (attrEndChar !== '"' && attrEndChar !== "'") {
  45565. return null;
  45566. }
  45567. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  45568. if (attrEndIndex < 0) {
  45569. return null;
  45570. }
  45571. attrValue = s.substring(pos, attrEndIndex);
  45572. attributes.push({
  45573. name: attrName,
  45574. value: this._resolveEntities(attrValue)
  45575. });
  45576. pos = attrEndIndex + 1;
  45577. skipWs();
  45578. }
  45579. return {
  45580. name,
  45581. attributes,
  45582. parsed: pos - start
  45583. };
  45584. }
  45585. _parseProcessingInstruction(s, start) {
  45586. let pos = start;
  45587. function skipWs() {
  45588. while (pos < s.length && isWhitespace(s, pos)) {
  45589. ++pos;
  45590. }
  45591. }
  45592. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  45593. ++pos;
  45594. }
  45595. const name = s.substring(start, pos);
  45596. skipWs();
  45597. const attrStart = pos;
  45598. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  45599. ++pos;
  45600. }
  45601. const value = s.substring(attrStart, pos);
  45602. return {
  45603. name,
  45604. value,
  45605. parsed: pos - start
  45606. };
  45607. }
  45608. parseXml(s) {
  45609. let i = 0;
  45610. while (i < s.length) {
  45611. const ch = s[i];
  45612. let j = i;
  45613. if (ch === "<") {
  45614. ++j;
  45615. const ch2 = s[j];
  45616. let q;
  45617. switch (ch2) {
  45618. case "/":
  45619. ++j;
  45620. q = s.indexOf(">", j);
  45621. if (q < 0) {
  45622. this.onError(XMLParserErrorCode.UnterminatedElement);
  45623. return;
  45624. }
  45625. this.onEndElement(s.substring(j, q));
  45626. j = q + 1;
  45627. break;
  45628. case "?":
  45629. ++j;
  45630. const pi = this._parseProcessingInstruction(s, j);
  45631. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  45632. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  45633. return;
  45634. }
  45635. this.onPi(pi.name, pi.value);
  45636. j += pi.parsed + 2;
  45637. break;
  45638. case "!":
  45639. if (s.substring(j + 1, j + 3) === "--") {
  45640. q = s.indexOf("-->", j + 3);
  45641. if (q < 0) {
  45642. this.onError(XMLParserErrorCode.UnterminatedComment);
  45643. return;
  45644. }
  45645. this.onComment(s.substring(j + 3, q));
  45646. j = q + 3;
  45647. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  45648. q = s.indexOf("]]>", j + 8);
  45649. if (q < 0) {
  45650. this.onError(XMLParserErrorCode.UnterminatedCdat);
  45651. return;
  45652. }
  45653. this.onCdata(s.substring(j + 8, q));
  45654. j = q + 3;
  45655. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  45656. const q2 = s.indexOf("[", j + 8);
  45657. let complexDoctype = false;
  45658. q = s.indexOf(">", j + 8);
  45659. if (q < 0) {
  45660. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  45661. return;
  45662. }
  45663. if (q2 > 0 && q > q2) {
  45664. q = s.indexOf("]>", j + 8);
  45665. if (q < 0) {
  45666. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  45667. return;
  45668. }
  45669. complexDoctype = true;
  45670. }
  45671. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  45672. this.onDoctype(doctypeContent);
  45673. j = q + (complexDoctype ? 2 : 1);
  45674. } else {
  45675. this.onError(XMLParserErrorCode.MalformedElement);
  45676. return;
  45677. }
  45678. break;
  45679. default:
  45680. const content = this._parseContent(s, j);
  45681. if (content === null) {
  45682. this.onError(XMLParserErrorCode.MalformedElement);
  45683. return;
  45684. }
  45685. let isClosed = false;
  45686. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  45687. isClosed = true;
  45688. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  45689. this.onError(XMLParserErrorCode.UnterminatedElement);
  45690. return;
  45691. }
  45692. this.onBeginElement(content.name, content.attributes, isClosed);
  45693. j += content.parsed + (isClosed ? 2 : 1);
  45694. break;
  45695. }
  45696. } else {
  45697. while (j < s.length && s[j] !== "<") {
  45698. j++;
  45699. }
  45700. const text = s.substring(i, j);
  45701. this.onText(this._resolveEntities(text));
  45702. }
  45703. i = j;
  45704. }
  45705. }
  45706. onResolveEntity(name) {
  45707. return `&${name};`;
  45708. }
  45709. onPi(name, value) {}
  45710. onComment(text) {}
  45711. onCdata(text) {}
  45712. onDoctype(doctypeContent) {}
  45713. onText(text) {}
  45714. onBeginElement(name, attributes, isEmpty) {}
  45715. onEndElement(name) {}
  45716. onError(code) {}
  45717. }
  45718. exports.XMLParserBase = XMLParserBase;
  45719. class SimpleDOMNode {
  45720. constructor(nodeName, nodeValue) {
  45721. this.nodeName = nodeName;
  45722. this.nodeValue = nodeValue;
  45723. Object.defineProperty(this, "parentNode", {
  45724. value: null,
  45725. writable: true
  45726. });
  45727. }
  45728. get firstChild() {
  45729. return this.childNodes && this.childNodes[0];
  45730. }
  45731. get nextSibling() {
  45732. const childNodes = this.parentNode.childNodes;
  45733. if (!childNodes) {
  45734. return undefined;
  45735. }
  45736. const index = childNodes.indexOf(this);
  45737. if (index === -1) {
  45738. return undefined;
  45739. }
  45740. return childNodes[index + 1];
  45741. }
  45742. get textContent() {
  45743. if (!this.childNodes) {
  45744. return this.nodeValue || "";
  45745. }
  45746. return this.childNodes.map(function (child) {
  45747. return child.textContent;
  45748. }).join("");
  45749. }
  45750. hasChildNodes() {
  45751. return this.childNodes && this.childNodes.length > 0;
  45752. }
  45753. searchNode(paths, pos) {
  45754. if (pos >= paths.length) {
  45755. return this;
  45756. }
  45757. const component = paths[pos];
  45758. const stack = [];
  45759. let node = this;
  45760. while (true) {
  45761. if (component.name === node.nodeName) {
  45762. if (component.pos === 0) {
  45763. const res = node.searchNode(paths, pos + 1);
  45764. if (res !== null) {
  45765. return res;
  45766. }
  45767. } else if (stack.length === 0) {
  45768. return null;
  45769. } else {
  45770. const [parent] = stack.pop();
  45771. let siblingPos = 0;
  45772. for (const child of parent.childNodes) {
  45773. if (component.name === child.nodeName) {
  45774. if (siblingPos === component.pos) {
  45775. return child.searchNode(paths, pos + 1);
  45776. }
  45777. siblingPos++;
  45778. }
  45779. }
  45780. return node.searchNode(paths, pos + 1);
  45781. }
  45782. }
  45783. if (node.childNodes && node.childNodes.length !== 0) {
  45784. stack.push([node, 0]);
  45785. node = node.childNodes[0];
  45786. } else if (stack.length === 0) {
  45787. return null;
  45788. } else {
  45789. while (stack.length !== 0) {
  45790. const [parent, currentPos] = stack.pop();
  45791. const newPos = currentPos + 1;
  45792. if (newPos < parent.childNodes.length) {
  45793. stack.push([parent, newPos]);
  45794. node = parent.childNodes[newPos];
  45795. break;
  45796. }
  45797. }
  45798. if (stack.length === 0) {
  45799. return null;
  45800. }
  45801. }
  45802. }
  45803. }
  45804. dump(buffer) {
  45805. if (this.nodeName === "#text") {
  45806. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  45807. return;
  45808. }
  45809. buffer.push(`<${this.nodeName}`);
  45810. if (this.attributes) {
  45811. for (const attribute of this.attributes) {
  45812. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  45813. }
  45814. }
  45815. if (this.hasChildNodes()) {
  45816. buffer.push(">");
  45817. for (const child of this.childNodes) {
  45818. child.dump(buffer);
  45819. }
  45820. buffer.push(`</${this.nodeName}>`);
  45821. } else if (this.nodeValue) {
  45822. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  45823. } else {
  45824. buffer.push("/>");
  45825. }
  45826. }
  45827. }
  45828. exports.SimpleDOMNode = SimpleDOMNode;
  45829. class SimpleXMLParser extends XMLParserBase {
  45830. constructor({
  45831. hasAttributes = false,
  45832. lowerCaseName = false
  45833. }) {
  45834. super();
  45835. this._currentFragment = null;
  45836. this._stack = null;
  45837. this._errorCode = XMLParserErrorCode.NoError;
  45838. this._hasAttributes = hasAttributes;
  45839. this._lowerCaseName = lowerCaseName;
  45840. }
  45841. parseFromString(data) {
  45842. this._currentFragment = [];
  45843. this._stack = [];
  45844. this._errorCode = XMLParserErrorCode.NoError;
  45845. this.parseXml(data);
  45846. if (this._errorCode !== XMLParserErrorCode.NoError) {
  45847. return undefined;
  45848. }
  45849. const [documentElement] = this._currentFragment;
  45850. if (!documentElement) {
  45851. return undefined;
  45852. }
  45853. return {
  45854. documentElement
  45855. };
  45856. }
  45857. onText(text) {
  45858. if (isWhitespaceString(text)) {
  45859. return;
  45860. }
  45861. const node = new SimpleDOMNode("#text", text);
  45862. this._currentFragment.push(node);
  45863. }
  45864. onCdata(text) {
  45865. const node = new SimpleDOMNode("#text", text);
  45866. this._currentFragment.push(node);
  45867. }
  45868. onBeginElement(name, attributes, isEmpty) {
  45869. if (this._lowerCaseName) {
  45870. name = name.toLowerCase();
  45871. }
  45872. const node = new SimpleDOMNode(name);
  45873. node.childNodes = [];
  45874. if (this._hasAttributes) {
  45875. node.attributes = attributes;
  45876. }
  45877. this._currentFragment.push(node);
  45878. if (isEmpty) {
  45879. return;
  45880. }
  45881. this._stack.push(this._currentFragment);
  45882. this._currentFragment = node.childNodes;
  45883. }
  45884. onEndElement(name) {
  45885. this._currentFragment = this._stack.pop() || [];
  45886. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  45887. if (!lastElement) {
  45888. return;
  45889. }
  45890. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  45891. lastElement.childNodes[i].parentNode = lastElement;
  45892. }
  45893. }
  45894. onError(code) {
  45895. this._errorCode = code;
  45896. }
  45897. }
  45898. exports.SimpleXMLParser = SimpleXMLParser;
  45899. /***/ }),
  45900. /* 62 */
  45901. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45902. Object.defineProperty(exports, "__esModule", ({
  45903. value: true
  45904. }));
  45905. exports.StructTreeRoot = exports.StructTreePage = void 0;
  45906. var _primitives = __w_pdfjs_require__(5);
  45907. var _util = __w_pdfjs_require__(2);
  45908. var _name_number_tree = __w_pdfjs_require__(58);
  45909. const MAX_DEPTH = 40;
  45910. const StructElementType = {
  45911. PAGE_CONTENT: "PAGE_CONTENT",
  45912. STREAM_CONTENT: "STREAM_CONTENT",
  45913. OBJECT: "OBJECT",
  45914. ELEMENT: "ELEMENT"
  45915. };
  45916. class StructTreeRoot {
  45917. constructor(rootDict) {
  45918. this.dict = rootDict;
  45919. this.roleMap = new Map();
  45920. }
  45921. init() {
  45922. this.readRoleMap();
  45923. }
  45924. readRoleMap() {
  45925. const roleMapDict = this.dict.get("RoleMap");
  45926. if (!(0, _primitives.isDict)(roleMapDict)) {
  45927. return;
  45928. }
  45929. roleMapDict.forEach((key, value) => {
  45930. if (!(0, _primitives.isName)(value)) {
  45931. return;
  45932. }
  45933. this.roleMap.set(key, value.name);
  45934. });
  45935. }
  45936. }
  45937. exports.StructTreeRoot = StructTreeRoot;
  45938. class StructElementNode {
  45939. constructor(tree, dict) {
  45940. this.tree = tree;
  45941. this.dict = dict;
  45942. this.kids = [];
  45943. this.parseKids();
  45944. }
  45945. get role() {
  45946. const nameObj = this.dict.get("S");
  45947. const name = (0, _primitives.isName)(nameObj) ? nameObj.name : "";
  45948. const {
  45949. root
  45950. } = this.tree;
  45951. if (root.roleMap.has(name)) {
  45952. return root.roleMap.get(name);
  45953. }
  45954. return name;
  45955. }
  45956. parseKids() {
  45957. let pageObjId = null;
  45958. const objRef = this.dict.getRaw("Pg");
  45959. if ((0, _primitives.isRef)(objRef)) {
  45960. pageObjId = objRef.toString();
  45961. }
  45962. const kids = this.dict.get("K");
  45963. if (Array.isArray(kids)) {
  45964. for (const kid of kids) {
  45965. const element = this.parseKid(pageObjId, kid);
  45966. if (element) {
  45967. this.kids.push(element);
  45968. }
  45969. }
  45970. } else {
  45971. const element = this.parseKid(pageObjId, kids);
  45972. if (element) {
  45973. this.kids.push(element);
  45974. }
  45975. }
  45976. }
  45977. parseKid(pageObjId, kid) {
  45978. if (Number.isInteger(kid)) {
  45979. if (this.tree.pageDict.objId !== pageObjId) {
  45980. return null;
  45981. }
  45982. return new StructElement({
  45983. type: StructElementType.PAGE_CONTENT,
  45984. mcid: kid,
  45985. pageObjId
  45986. });
  45987. }
  45988. let kidDict = null;
  45989. if ((0, _primitives.isRef)(kid)) {
  45990. kidDict = this.dict.xref.fetch(kid);
  45991. } else if ((0, _primitives.isDict)(kid)) {
  45992. kidDict = kid;
  45993. }
  45994. if (!kidDict) {
  45995. return null;
  45996. }
  45997. const pageRef = kidDict.getRaw("Pg");
  45998. if ((0, _primitives.isRef)(pageRef)) {
  45999. pageObjId = pageRef.toString();
  46000. }
  46001. const type = (0, _primitives.isName)(kidDict.get("Type")) ? kidDict.get("Type").name : null;
  46002. if (type === "MCR") {
  46003. if (this.tree.pageDict.objId !== pageObjId) {
  46004. return null;
  46005. }
  46006. return new StructElement({
  46007. type: StructElementType.STREAM_CONTENT,
  46008. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Stm")) ? kidDict.getRaw("Stm").toString() : null,
  46009. pageObjId,
  46010. mcid: kidDict.get("MCID")
  46011. });
  46012. }
  46013. if (type === "OBJR") {
  46014. if (this.tree.pageDict.objId !== pageObjId) {
  46015. return null;
  46016. }
  46017. return new StructElement({
  46018. type: StructElementType.OBJECT,
  46019. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Obj")) ? kidDict.getRaw("Obj").toString() : null,
  46020. pageObjId
  46021. });
  46022. }
  46023. return new StructElement({
  46024. type: StructElementType.ELEMENT,
  46025. dict: kidDict
  46026. });
  46027. }
  46028. }
  46029. class StructElement {
  46030. constructor({
  46031. type,
  46032. dict = null,
  46033. mcid = null,
  46034. pageObjId = null,
  46035. refObjId = null
  46036. }) {
  46037. this.type = type;
  46038. this.dict = dict;
  46039. this.mcid = mcid;
  46040. this.pageObjId = pageObjId;
  46041. this.refObjId = refObjId;
  46042. this.parentNode = null;
  46043. }
  46044. }
  46045. class StructTreePage {
  46046. constructor(structTreeRoot, pageDict) {
  46047. this.root = structTreeRoot;
  46048. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  46049. this.pageDict = pageDict;
  46050. this.nodes = [];
  46051. }
  46052. parse() {
  46053. if (!this.root || !this.rootDict) {
  46054. return;
  46055. }
  46056. const parentTree = this.rootDict.get("ParentTree");
  46057. if (!parentTree) {
  46058. return;
  46059. }
  46060. const id = this.pageDict.get("StructParents");
  46061. if (!Number.isInteger(id)) {
  46062. return;
  46063. }
  46064. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  46065. const parentArray = numberTree.get(id);
  46066. if (!Array.isArray(parentArray)) {
  46067. return;
  46068. }
  46069. const map = new Map();
  46070. for (const ref of parentArray) {
  46071. if ((0, _primitives.isRef)(ref)) {
  46072. this.addNode(this.rootDict.xref.fetch(ref), map);
  46073. }
  46074. }
  46075. }
  46076. addNode(dict, map, level = 0) {
  46077. if (level > MAX_DEPTH) {
  46078. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  46079. return null;
  46080. }
  46081. if (map.has(dict)) {
  46082. return map.get(dict);
  46083. }
  46084. const element = new StructElementNode(this, dict);
  46085. map.set(dict, element);
  46086. const parent = dict.get("P");
  46087. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  46088. if (!this.addTopLevelNode(dict, element)) {
  46089. map.delete(dict);
  46090. }
  46091. return element;
  46092. }
  46093. const parentNode = this.addNode(parent, map, level + 1);
  46094. if (!parentNode) {
  46095. return element;
  46096. }
  46097. let save = false;
  46098. for (const kid of parentNode.kids) {
  46099. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  46100. kid.parentNode = element;
  46101. save = true;
  46102. }
  46103. }
  46104. if (!save) {
  46105. map.delete(dict);
  46106. }
  46107. return element;
  46108. }
  46109. addTopLevelNode(dict, element) {
  46110. const obj = this.rootDict.get("K");
  46111. if (!obj) {
  46112. return false;
  46113. }
  46114. if ((0, _primitives.isDict)(obj)) {
  46115. if (obj.objId !== dict.objId) {
  46116. return false;
  46117. }
  46118. this.nodes[0] = element;
  46119. return true;
  46120. }
  46121. if (!Array.isArray(obj)) {
  46122. return true;
  46123. }
  46124. let save = false;
  46125. for (let i = 0; i < obj.length; i++) {
  46126. const kidRef = obj[i];
  46127. if (kidRef && kidRef.toString() === dict.objId) {
  46128. this.nodes[i] = element;
  46129. save = true;
  46130. }
  46131. }
  46132. return save;
  46133. }
  46134. get serializable() {
  46135. function nodeToSerializable(node, parent, level = 0) {
  46136. if (level > MAX_DEPTH) {
  46137. (0, _util.warn)("StructTree too deep to be fully serialized.");
  46138. return;
  46139. }
  46140. const obj = Object.create(null);
  46141. obj.role = node.role;
  46142. obj.children = [];
  46143. parent.children.push(obj);
  46144. const alt = node.dict.get("Alt");
  46145. if ((0, _util.isString)(alt)) {
  46146. obj.alt = (0, _util.stringToPDFString)(alt);
  46147. }
  46148. for (const kid of node.kids) {
  46149. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  46150. if (kidElement) {
  46151. nodeToSerializable(kidElement, obj, level + 1);
  46152. continue;
  46153. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  46154. obj.children.push({
  46155. type: "content",
  46156. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  46157. });
  46158. } else if (kid.type === StructElementType.OBJECT) {
  46159. obj.children.push({
  46160. type: "object",
  46161. id: kid.refObjId
  46162. });
  46163. }
  46164. }
  46165. }
  46166. const root = Object.create(null);
  46167. root.children = [];
  46168. root.role = "Root";
  46169. for (const child of this.nodes) {
  46170. if (!child) {
  46171. continue;
  46172. }
  46173. nodeToSerializable(child, root);
  46174. }
  46175. return root;
  46176. }
  46177. }
  46178. exports.StructTreePage = StructTreePage;
  46179. /***/ }),
  46180. /* 63 */
  46181. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46182. Object.defineProperty(exports, "__esModule", ({
  46183. value: true
  46184. }));
  46185. exports.ObjectLoader = void 0;
  46186. var _primitives = __w_pdfjs_require__(5);
  46187. var _core_utils = __w_pdfjs_require__(9);
  46188. var _util = __w_pdfjs_require__(2);
  46189. function mayHaveChildren(value) {
  46190. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  46191. }
  46192. function addChildren(node, nodesToVisit) {
  46193. if (node instanceof _primitives.Dict) {
  46194. node = node.getRawValues();
  46195. } else if ((0, _primitives.isStream)(node)) {
  46196. node = node.dict.getRawValues();
  46197. } else if (!Array.isArray(node)) {
  46198. return;
  46199. }
  46200. for (const rawValue of node) {
  46201. if (mayHaveChildren(rawValue)) {
  46202. nodesToVisit.push(rawValue);
  46203. }
  46204. }
  46205. }
  46206. class ObjectLoader {
  46207. constructor(dict, keys, xref) {
  46208. this.dict = dict;
  46209. this.keys = keys;
  46210. this.xref = xref;
  46211. this.refSet = null;
  46212. }
  46213. async load() {
  46214. if (this.xref.stream.isDataLoaded) {
  46215. return undefined;
  46216. }
  46217. const {
  46218. keys,
  46219. dict
  46220. } = this;
  46221. this.refSet = new _primitives.RefSet();
  46222. const nodesToVisit = [];
  46223. for (let i = 0, ii = keys.length; i < ii; i++) {
  46224. const rawValue = dict.getRaw(keys[i]);
  46225. if (rawValue !== undefined) {
  46226. nodesToVisit.push(rawValue);
  46227. }
  46228. }
  46229. return this._walk(nodesToVisit);
  46230. }
  46231. async _walk(nodesToVisit) {
  46232. const nodesToRevisit = [];
  46233. const pendingRequests = [];
  46234. while (nodesToVisit.length) {
  46235. let currentNode = nodesToVisit.pop();
  46236. if (currentNode instanceof _primitives.Ref) {
  46237. if (this.refSet.has(currentNode)) {
  46238. continue;
  46239. }
  46240. try {
  46241. this.refSet.put(currentNode);
  46242. currentNode = this.xref.fetch(currentNode);
  46243. } catch (ex) {
  46244. if (!(ex instanceof _core_utils.MissingDataException)) {
  46245. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  46246. this.refSet = null;
  46247. const {
  46248. manager
  46249. } = this.xref.stream;
  46250. return manager.requestAllChunks();
  46251. }
  46252. nodesToRevisit.push(currentNode);
  46253. pendingRequests.push({
  46254. begin: ex.begin,
  46255. end: ex.end
  46256. });
  46257. }
  46258. }
  46259. if ((0, _primitives.isStream)(currentNode)) {
  46260. const baseStreams = currentNode.getBaseStreams();
  46261. if (baseStreams) {
  46262. let foundMissingData = false;
  46263. for (const stream of baseStreams) {
  46264. if (stream.isDataLoaded) {
  46265. continue;
  46266. }
  46267. foundMissingData = true;
  46268. pendingRequests.push({
  46269. begin: stream.start,
  46270. end: stream.end
  46271. });
  46272. }
  46273. if (foundMissingData) {
  46274. nodesToRevisit.push(currentNode);
  46275. }
  46276. }
  46277. }
  46278. addChildren(currentNode, nodesToVisit);
  46279. }
  46280. if (pendingRequests.length) {
  46281. await this.xref.stream.manager.requestRanges(pendingRequests);
  46282. for (const node of nodesToRevisit) {
  46283. if (node instanceof _primitives.Ref) {
  46284. this.refSet.remove(node);
  46285. }
  46286. }
  46287. return this._walk(nodesToRevisit);
  46288. }
  46289. this.refSet = null;
  46290. return undefined;
  46291. }
  46292. }
  46293. exports.ObjectLoader = ObjectLoader;
  46294. /***/ }),
  46295. /* 64 */
  46296. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46297. Object.defineProperty(exports, "__esModule", ({
  46298. value: true
  46299. }));
  46300. exports.incrementalUpdate = incrementalUpdate;
  46301. exports.writeDict = writeDict;
  46302. var _util = __w_pdfjs_require__(2);
  46303. var _primitives = __w_pdfjs_require__(5);
  46304. var _core_utils = __w_pdfjs_require__(9);
  46305. var _xml_parser = __w_pdfjs_require__(61);
  46306. var _crypto = __w_pdfjs_require__(65);
  46307. function writeDict(dict, buffer, transform) {
  46308. buffer.push("<<");
  46309. for (const key of dict.getKeys()) {
  46310. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  46311. writeValue(dict.getRaw(key), buffer, transform);
  46312. }
  46313. buffer.push(">>");
  46314. }
  46315. function writeStream(stream, buffer, transform) {
  46316. writeDict(stream.dict, buffer, transform);
  46317. buffer.push(" stream\n");
  46318. let string = stream.getString();
  46319. if (transform !== null) {
  46320. string = transform.encryptString(string);
  46321. }
  46322. buffer.push(string, "\nendstream\n");
  46323. }
  46324. function writeArray(array, buffer, transform) {
  46325. buffer.push("[");
  46326. let first = true;
  46327. for (const val of array) {
  46328. if (!first) {
  46329. buffer.push(" ");
  46330. } else {
  46331. first = false;
  46332. }
  46333. writeValue(val, buffer, transform);
  46334. }
  46335. buffer.push("]");
  46336. }
  46337. function numberToString(value) {
  46338. if (Number.isInteger(value)) {
  46339. return value.toString();
  46340. }
  46341. const roundedValue = Math.round(value * 100);
  46342. if (roundedValue % 100 === 0) {
  46343. return (roundedValue / 100).toString();
  46344. }
  46345. if (roundedValue % 10 === 0) {
  46346. return value.toFixed(1);
  46347. }
  46348. return value.toFixed(2);
  46349. }
  46350. function writeValue(value, buffer, transform) {
  46351. if ((0, _primitives.isName)(value)) {
  46352. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  46353. } else if ((0, _primitives.isRef)(value)) {
  46354. buffer.push(`${value.num} ${value.gen} R`);
  46355. } else if (Array.isArray(value)) {
  46356. writeArray(value, buffer, transform);
  46357. } else if (typeof value === "string") {
  46358. if (transform !== null) {
  46359. value = transform.encryptString(value);
  46360. }
  46361. buffer.push(`(${(0, _util.escapeString)(value)})`);
  46362. } else if (typeof value === "number") {
  46363. buffer.push(numberToString(value));
  46364. } else if ((0, _primitives.isDict)(value)) {
  46365. writeDict(value, buffer, transform);
  46366. } else if ((0, _primitives.isStream)(value)) {
  46367. writeStream(value, buffer, transform);
  46368. }
  46369. }
  46370. function writeInt(number, size, offset, buffer) {
  46371. for (let i = size + offset - 1; i > offset - 1; i--) {
  46372. buffer[i] = number & 0xff;
  46373. number >>= 8;
  46374. }
  46375. return offset + size;
  46376. }
  46377. function writeString(string, offset, buffer) {
  46378. for (let i = 0, len = string.length; i < len; i++) {
  46379. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  46380. }
  46381. }
  46382. function computeMD5(filesize, xrefInfo) {
  46383. const time = Math.floor(Date.now() / 1000);
  46384. const filename = xrefInfo.filename || "";
  46385. const md5Buffer = [time.toString(), filename, filesize.toString()];
  46386. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  46387. for (const value of Object.values(xrefInfo.info)) {
  46388. md5Buffer.push(value);
  46389. md5BufferLen += value.length;
  46390. }
  46391. const array = new Uint8Array(md5BufferLen);
  46392. let offset = 0;
  46393. for (const str of md5Buffer) {
  46394. writeString(str, offset, array);
  46395. offset += str.length;
  46396. }
  46397. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  46398. }
  46399. function updateXFA(datasetsRef, newRefs, xref) {
  46400. if (datasetsRef === null || xref === null) {
  46401. return;
  46402. }
  46403. const datasets = xref.fetchIfRef(datasetsRef);
  46404. const str = datasets.getString();
  46405. const xml = new _xml_parser.SimpleXMLParser({
  46406. hasAttributes: true
  46407. }).parseFromString(str);
  46408. for (const {
  46409. xfa
  46410. } of newRefs) {
  46411. if (!xfa) {
  46412. continue;
  46413. }
  46414. const {
  46415. path,
  46416. value
  46417. } = xfa;
  46418. if (!path) {
  46419. continue;
  46420. }
  46421. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  46422. if (node) {
  46423. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  46424. } else {
  46425. (0, _util.warn)(`Node not found for path: ${path}`);
  46426. }
  46427. }
  46428. const buffer = [];
  46429. xml.documentElement.dump(buffer);
  46430. let updatedXml = buffer.join("");
  46431. const encrypt = xref.encrypt;
  46432. if (encrypt) {
  46433. const transform = encrypt.createCipherTransform(datasetsRef.num, datasetsRef.gen);
  46434. updatedXml = transform.encryptString(updatedXml);
  46435. }
  46436. const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${updatedXml.length}>>\nstream\n` + updatedXml + "\nendstream\nendobj\n";
  46437. newRefs.push({
  46438. ref: datasetsRef,
  46439. data
  46440. });
  46441. }
  46442. function incrementalUpdate({
  46443. originalData,
  46444. xrefInfo,
  46445. newRefs,
  46446. xref = null,
  46447. datasetsRef = null
  46448. }) {
  46449. updateXFA(datasetsRef, newRefs, xref);
  46450. const newXref = new _primitives.Dict(null);
  46451. const refForXrefTable = xrefInfo.newRef;
  46452. let buffer, baseOffset;
  46453. const lastByte = originalData[originalData.length - 1];
  46454. if (lastByte === 0x0a || lastByte === 0x0d) {
  46455. buffer = [];
  46456. baseOffset = originalData.length;
  46457. } else {
  46458. buffer = ["\n"];
  46459. baseOffset = originalData.length + 1;
  46460. }
  46461. newXref.set("Size", refForXrefTable.num + 1);
  46462. newXref.set("Prev", xrefInfo.startXRef);
  46463. newXref.set("Type", _primitives.Name.get("XRef"));
  46464. if (xrefInfo.rootRef !== null) {
  46465. newXref.set("Root", xrefInfo.rootRef);
  46466. }
  46467. if (xrefInfo.infoRef !== null) {
  46468. newXref.set("Info", xrefInfo.infoRef);
  46469. }
  46470. if (xrefInfo.encryptRef !== null) {
  46471. newXref.set("Encrypt", xrefInfo.encryptRef);
  46472. }
  46473. newRefs.push({
  46474. ref: refForXrefTable,
  46475. data: ""
  46476. });
  46477. newRefs = newRefs.sort((a, b) => {
  46478. return a.ref.num - b.ref.num;
  46479. });
  46480. const xrefTableData = [[0, 1, 0xffff]];
  46481. const indexes = [0, 1];
  46482. let maxOffset = 0;
  46483. for (const {
  46484. ref,
  46485. data
  46486. } of newRefs) {
  46487. maxOffset = Math.max(maxOffset, baseOffset);
  46488. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  46489. baseOffset += data.length;
  46490. indexes.push(ref.num, 1);
  46491. buffer.push(data);
  46492. }
  46493. newXref.set("Index", indexes);
  46494. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  46495. const md5 = computeMD5(baseOffset, xrefInfo);
  46496. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  46497. }
  46498. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  46499. const sizes = [1, offsetSize, 2];
  46500. const structSize = sizes[0] + sizes[1] + sizes[2];
  46501. const tableLength = structSize * xrefTableData.length;
  46502. newXref.set("W", sizes);
  46503. newXref.set("Length", tableLength);
  46504. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  46505. writeDict(newXref, buffer, null);
  46506. buffer.push(" stream\n");
  46507. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  46508. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  46509. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  46510. array.set(originalData);
  46511. let offset = originalData.length;
  46512. for (const str of buffer) {
  46513. writeString(str, offset, array);
  46514. offset += str.length;
  46515. }
  46516. for (const [type, objOffset, gen] of xrefTableData) {
  46517. offset = writeInt(type, sizes[0], offset, array);
  46518. offset = writeInt(objOffset, sizes[1], offset, array);
  46519. offset = writeInt(gen, sizes[2], offset, array);
  46520. }
  46521. writeString(footer, offset, array);
  46522. return array;
  46523. }
  46524. /***/ }),
  46525. /* 65 */
  46526. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46527. Object.defineProperty(exports, "__esModule", ({
  46528. value: true
  46529. }));
  46530. exports.calculateSHA384 = calculateSHA384;
  46531. exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.calculateSHA512 = exports.calculateSHA256 = exports.calculateMD5 = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  46532. var _util = __w_pdfjs_require__(2);
  46533. var _primitives = __w_pdfjs_require__(5);
  46534. var _decrypt_stream = __w_pdfjs_require__(66);
  46535. class ARCFourCipher {
  46536. constructor(key) {
  46537. this.a = 0;
  46538. this.b = 0;
  46539. const s = new Uint8Array(256);
  46540. const keyLength = key.length;
  46541. for (let i = 0; i < 256; ++i) {
  46542. s[i] = i;
  46543. }
  46544. for (let i = 0, j = 0; i < 256; ++i) {
  46545. const tmp = s[i];
  46546. j = j + tmp + key[i % keyLength] & 0xff;
  46547. s[i] = s[j];
  46548. s[j] = tmp;
  46549. }
  46550. this.s = s;
  46551. }
  46552. encryptBlock(data) {
  46553. let a = this.a,
  46554. b = this.b;
  46555. const s = this.s;
  46556. const n = data.length;
  46557. const output = new Uint8Array(n);
  46558. for (let i = 0; i < n; ++i) {
  46559. a = a + 1 & 0xff;
  46560. const tmp = s[a];
  46561. b = b + tmp & 0xff;
  46562. const tmp2 = s[b];
  46563. s[a] = tmp2;
  46564. s[b] = tmp;
  46565. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  46566. }
  46567. this.a = a;
  46568. this.b = b;
  46569. return output;
  46570. }
  46571. decryptBlock(data) {
  46572. return this.encryptBlock(data);
  46573. }
  46574. encrypt(data) {
  46575. return this.encryptBlock(data);
  46576. }
  46577. }
  46578. exports.ARCFourCipher = ARCFourCipher;
  46579. const calculateMD5 = function calculateMD5Closure() {
  46580. 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]);
  46581. 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]);
  46582. function hash(data, offset, length) {
  46583. let h0 = 1732584193,
  46584. h1 = -271733879,
  46585. h2 = -1732584194,
  46586. h3 = 271733878;
  46587. const paddedLength = length + 72 & ~63;
  46588. const padded = new Uint8Array(paddedLength);
  46589. let i, j;
  46590. for (i = 0; i < length; ++i) {
  46591. padded[i] = data[offset++];
  46592. }
  46593. padded[i++] = 0x80;
  46594. const n = paddedLength - 8;
  46595. while (i < n) {
  46596. padded[i++] = 0;
  46597. }
  46598. padded[i++] = length << 3 & 0xff;
  46599. padded[i++] = length >> 5 & 0xff;
  46600. padded[i++] = length >> 13 & 0xff;
  46601. padded[i++] = length >> 21 & 0xff;
  46602. padded[i++] = length >>> 29 & 0xff;
  46603. padded[i++] = 0;
  46604. padded[i++] = 0;
  46605. padded[i++] = 0;
  46606. const w = new Int32Array(16);
  46607. for (i = 0; i < paddedLength;) {
  46608. for (j = 0; j < 16; ++j, i += 4) {
  46609. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  46610. }
  46611. let a = h0,
  46612. b = h1,
  46613. c = h2,
  46614. d = h3,
  46615. f,
  46616. g;
  46617. for (j = 0; j < 64; ++j) {
  46618. if (j < 16) {
  46619. f = b & c | ~b & d;
  46620. g = j;
  46621. } else if (j < 32) {
  46622. f = d & b | ~d & c;
  46623. g = 5 * j + 1 & 15;
  46624. } else if (j < 48) {
  46625. f = b ^ c ^ d;
  46626. g = 3 * j + 5 & 15;
  46627. } else {
  46628. f = c ^ (b | ~d);
  46629. g = 7 * j & 15;
  46630. }
  46631. const tmp = d,
  46632. rotateArg = a + f + k[j] + w[g] | 0,
  46633. rotate = r[j];
  46634. d = c;
  46635. c = b;
  46636. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  46637. a = tmp;
  46638. }
  46639. h0 = h0 + a | 0;
  46640. h1 = h1 + b | 0;
  46641. h2 = h2 + c | 0;
  46642. h3 = h3 + d | 0;
  46643. }
  46644. 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]);
  46645. }
  46646. return hash;
  46647. }();
  46648. exports.calculateMD5 = calculateMD5;
  46649. class Word64 {
  46650. constructor(highInteger, lowInteger) {
  46651. this.high = highInteger | 0;
  46652. this.low = lowInteger | 0;
  46653. }
  46654. and(word) {
  46655. this.high &= word.high;
  46656. this.low &= word.low;
  46657. }
  46658. xor(word) {
  46659. this.high ^= word.high;
  46660. this.low ^= word.low;
  46661. }
  46662. or(word) {
  46663. this.high |= word.high;
  46664. this.low |= word.low;
  46665. }
  46666. shiftRight(places) {
  46667. if (places >= 32) {
  46668. this.low = this.high >>> places - 32 | 0;
  46669. this.high = 0;
  46670. } else {
  46671. this.low = this.low >>> places | this.high << 32 - places;
  46672. this.high = this.high >>> places | 0;
  46673. }
  46674. }
  46675. shiftLeft(places) {
  46676. if (places >= 32) {
  46677. this.high = this.low << places - 32;
  46678. this.low = 0;
  46679. } else {
  46680. this.high = this.high << places | this.low >>> 32 - places;
  46681. this.low = this.low << places;
  46682. }
  46683. }
  46684. rotateRight(places) {
  46685. let low, high;
  46686. if (places & 32) {
  46687. high = this.low;
  46688. low = this.high;
  46689. } else {
  46690. low = this.low;
  46691. high = this.high;
  46692. }
  46693. places &= 31;
  46694. this.low = low >>> places | high << 32 - places;
  46695. this.high = high >>> places | low << 32 - places;
  46696. }
  46697. not() {
  46698. this.high = ~this.high;
  46699. this.low = ~this.low;
  46700. }
  46701. add(word) {
  46702. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  46703. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  46704. if (lowAdd > 0xffffffff) {
  46705. highAdd += 1;
  46706. }
  46707. this.low = lowAdd | 0;
  46708. this.high = highAdd | 0;
  46709. }
  46710. copyTo(bytes, offset) {
  46711. bytes[offset] = this.high >>> 24 & 0xff;
  46712. bytes[offset + 1] = this.high >> 16 & 0xff;
  46713. bytes[offset + 2] = this.high >> 8 & 0xff;
  46714. bytes[offset + 3] = this.high & 0xff;
  46715. bytes[offset + 4] = this.low >>> 24 & 0xff;
  46716. bytes[offset + 5] = this.low >> 16 & 0xff;
  46717. bytes[offset + 6] = this.low >> 8 & 0xff;
  46718. bytes[offset + 7] = this.low & 0xff;
  46719. }
  46720. assign(word) {
  46721. this.high = word.high;
  46722. this.low = word.low;
  46723. }
  46724. }
  46725. const calculateSHA256 = function calculateSHA256Closure() {
  46726. function rotr(x, n) {
  46727. return x >>> n | x << 32 - n;
  46728. }
  46729. function ch(x, y, z) {
  46730. return x & y ^ ~x & z;
  46731. }
  46732. function maj(x, y, z) {
  46733. return x & y ^ x & z ^ y & z;
  46734. }
  46735. function sigma(x) {
  46736. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  46737. }
  46738. function sigmaPrime(x) {
  46739. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  46740. }
  46741. function littleSigma(x) {
  46742. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  46743. }
  46744. function littleSigmaPrime(x) {
  46745. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  46746. }
  46747. 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];
  46748. function hash(data, offset, length) {
  46749. let h0 = 0x6a09e667,
  46750. h1 = 0xbb67ae85,
  46751. h2 = 0x3c6ef372,
  46752. h3 = 0xa54ff53a,
  46753. h4 = 0x510e527f,
  46754. h5 = 0x9b05688c,
  46755. h6 = 0x1f83d9ab,
  46756. h7 = 0x5be0cd19;
  46757. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  46758. const padded = new Uint8Array(paddedLength);
  46759. let i, j;
  46760. for (i = 0; i < length; ++i) {
  46761. padded[i] = data[offset++];
  46762. }
  46763. padded[i++] = 0x80;
  46764. const n = paddedLength - 8;
  46765. while (i < n) {
  46766. padded[i++] = 0;
  46767. }
  46768. padded[i++] = 0;
  46769. padded[i++] = 0;
  46770. padded[i++] = 0;
  46771. padded[i++] = length >>> 29 & 0xff;
  46772. padded[i++] = length >> 21 & 0xff;
  46773. padded[i++] = length >> 13 & 0xff;
  46774. padded[i++] = length >> 5 & 0xff;
  46775. padded[i++] = length << 3 & 0xff;
  46776. const w = new Uint32Array(64);
  46777. for (i = 0; i < paddedLength;) {
  46778. for (j = 0; j < 16; ++j) {
  46779. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  46780. i += 4;
  46781. }
  46782. for (j = 16; j < 64; ++j) {
  46783. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  46784. }
  46785. let a = h0,
  46786. b = h1,
  46787. c = h2,
  46788. d = h3,
  46789. e = h4,
  46790. f = h5,
  46791. g = h6,
  46792. h = h7,
  46793. t1,
  46794. t2;
  46795. for (j = 0; j < 64; ++j) {
  46796. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  46797. t2 = sigma(a) + maj(a, b, c);
  46798. h = g;
  46799. g = f;
  46800. f = e;
  46801. e = d + t1 | 0;
  46802. d = c;
  46803. c = b;
  46804. b = a;
  46805. a = t1 + t2 | 0;
  46806. }
  46807. h0 = h0 + a | 0;
  46808. h1 = h1 + b | 0;
  46809. h2 = h2 + c | 0;
  46810. h3 = h3 + d | 0;
  46811. h4 = h4 + e | 0;
  46812. h5 = h5 + f | 0;
  46813. h6 = h6 + g | 0;
  46814. h7 = h7 + h | 0;
  46815. }
  46816. 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]);
  46817. }
  46818. return hash;
  46819. }();
  46820. exports.calculateSHA256 = calculateSHA256;
  46821. const calculateSHA512 = function calculateSHA512Closure() {
  46822. function ch(result, x, y, z, tmp) {
  46823. result.assign(x);
  46824. result.and(y);
  46825. tmp.assign(x);
  46826. tmp.not();
  46827. tmp.and(z);
  46828. result.xor(tmp);
  46829. }
  46830. function maj(result, x, y, z, tmp) {
  46831. result.assign(x);
  46832. result.and(y);
  46833. tmp.assign(x);
  46834. tmp.and(z);
  46835. result.xor(tmp);
  46836. tmp.assign(y);
  46837. tmp.and(z);
  46838. result.xor(tmp);
  46839. }
  46840. function sigma(result, x, tmp) {
  46841. result.assign(x);
  46842. result.rotateRight(28);
  46843. tmp.assign(x);
  46844. tmp.rotateRight(34);
  46845. result.xor(tmp);
  46846. tmp.assign(x);
  46847. tmp.rotateRight(39);
  46848. result.xor(tmp);
  46849. }
  46850. function sigmaPrime(result, x, tmp) {
  46851. result.assign(x);
  46852. result.rotateRight(14);
  46853. tmp.assign(x);
  46854. tmp.rotateRight(18);
  46855. result.xor(tmp);
  46856. tmp.assign(x);
  46857. tmp.rotateRight(41);
  46858. result.xor(tmp);
  46859. }
  46860. function littleSigma(result, x, tmp) {
  46861. result.assign(x);
  46862. result.rotateRight(1);
  46863. tmp.assign(x);
  46864. tmp.rotateRight(8);
  46865. result.xor(tmp);
  46866. tmp.assign(x);
  46867. tmp.shiftRight(7);
  46868. result.xor(tmp);
  46869. }
  46870. function littleSigmaPrime(result, x, tmp) {
  46871. result.assign(x);
  46872. result.rotateRight(19);
  46873. tmp.assign(x);
  46874. tmp.rotateRight(61);
  46875. result.xor(tmp);
  46876. tmp.assign(x);
  46877. tmp.shiftRight(6);
  46878. result.xor(tmp);
  46879. }
  46880. 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)];
  46881. function hash(data, offset, length, mode384 = false) {
  46882. let h0, h1, h2, h3, h4, h5, h6, h7;
  46883. if (!mode384) {
  46884. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  46885. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  46886. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  46887. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  46888. h4 = new Word64(0x510e527f, 0xade682d1);
  46889. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  46890. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  46891. h7 = new Word64(0x5be0cd19, 0x137e2179);
  46892. } else {
  46893. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  46894. h1 = new Word64(0x629a292a, 0x367cd507);
  46895. h2 = new Word64(0x9159015a, 0x3070dd17);
  46896. h3 = new Word64(0x152fecd8, 0xf70e5939);
  46897. h4 = new Word64(0x67332667, 0xffc00b31);
  46898. h5 = new Word64(0x8eb44a87, 0x68581511);
  46899. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  46900. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  46901. }
  46902. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  46903. const padded = new Uint8Array(paddedLength);
  46904. let i, j;
  46905. for (i = 0; i < length; ++i) {
  46906. padded[i] = data[offset++];
  46907. }
  46908. padded[i++] = 0x80;
  46909. const n = paddedLength - 16;
  46910. while (i < n) {
  46911. padded[i++] = 0;
  46912. }
  46913. padded[i++] = 0;
  46914. padded[i++] = 0;
  46915. padded[i++] = 0;
  46916. padded[i++] = 0;
  46917. padded[i++] = 0;
  46918. padded[i++] = 0;
  46919. padded[i++] = 0;
  46920. padded[i++] = 0;
  46921. padded[i++] = 0;
  46922. padded[i++] = 0;
  46923. padded[i++] = 0;
  46924. padded[i++] = length >>> 29 & 0xff;
  46925. padded[i++] = length >> 21 & 0xff;
  46926. padded[i++] = length >> 13 & 0xff;
  46927. padded[i++] = length >> 5 & 0xff;
  46928. padded[i++] = length << 3 & 0xff;
  46929. const w = new Array(80);
  46930. for (i = 0; i < 80; i++) {
  46931. w[i] = new Word64(0, 0);
  46932. }
  46933. let a = new Word64(0, 0),
  46934. b = new Word64(0, 0),
  46935. c = new Word64(0, 0);
  46936. let d = new Word64(0, 0),
  46937. e = new Word64(0, 0),
  46938. f = new Word64(0, 0);
  46939. let g = new Word64(0, 0),
  46940. h = new Word64(0, 0);
  46941. const t1 = new Word64(0, 0),
  46942. t2 = new Word64(0, 0);
  46943. const tmp1 = new Word64(0, 0),
  46944. tmp2 = new Word64(0, 0);
  46945. let tmp3;
  46946. for (i = 0; i < paddedLength;) {
  46947. for (j = 0; j < 16; ++j) {
  46948. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  46949. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  46950. i += 8;
  46951. }
  46952. for (j = 16; j < 80; ++j) {
  46953. tmp3 = w[j];
  46954. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  46955. tmp3.add(w[j - 7]);
  46956. littleSigma(tmp1, w[j - 15], tmp2);
  46957. tmp3.add(tmp1);
  46958. tmp3.add(w[j - 16]);
  46959. }
  46960. a.assign(h0);
  46961. b.assign(h1);
  46962. c.assign(h2);
  46963. d.assign(h3);
  46964. e.assign(h4);
  46965. f.assign(h5);
  46966. g.assign(h6);
  46967. h.assign(h7);
  46968. for (j = 0; j < 80; ++j) {
  46969. t1.assign(h);
  46970. sigmaPrime(tmp1, e, tmp2);
  46971. t1.add(tmp1);
  46972. ch(tmp1, e, f, g, tmp2);
  46973. t1.add(tmp1);
  46974. t1.add(k[j]);
  46975. t1.add(w[j]);
  46976. sigma(t2, a, tmp2);
  46977. maj(tmp1, a, b, c, tmp2);
  46978. t2.add(tmp1);
  46979. tmp3 = h;
  46980. h = g;
  46981. g = f;
  46982. f = e;
  46983. d.add(t1);
  46984. e = d;
  46985. d = c;
  46986. c = b;
  46987. b = a;
  46988. tmp3.assign(t1);
  46989. tmp3.add(t2);
  46990. a = tmp3;
  46991. }
  46992. h0.add(a);
  46993. h1.add(b);
  46994. h2.add(c);
  46995. h3.add(d);
  46996. h4.add(e);
  46997. h5.add(f);
  46998. h6.add(g);
  46999. h7.add(h);
  47000. }
  47001. let result;
  47002. if (!mode384) {
  47003. result = new Uint8Array(64);
  47004. h0.copyTo(result, 0);
  47005. h1.copyTo(result, 8);
  47006. h2.copyTo(result, 16);
  47007. h3.copyTo(result, 24);
  47008. h4.copyTo(result, 32);
  47009. h5.copyTo(result, 40);
  47010. h6.copyTo(result, 48);
  47011. h7.copyTo(result, 56);
  47012. } else {
  47013. result = new Uint8Array(48);
  47014. h0.copyTo(result, 0);
  47015. h1.copyTo(result, 8);
  47016. h2.copyTo(result, 16);
  47017. h3.copyTo(result, 24);
  47018. h4.copyTo(result, 32);
  47019. h5.copyTo(result, 40);
  47020. }
  47021. return result;
  47022. }
  47023. return hash;
  47024. }();
  47025. exports.calculateSHA512 = calculateSHA512;
  47026. function calculateSHA384(data, offset, length) {
  47027. return calculateSHA512(data, offset, length, true);
  47028. }
  47029. class NullCipher {
  47030. decryptBlock(data) {
  47031. return data;
  47032. }
  47033. encrypt(data) {
  47034. return data;
  47035. }
  47036. }
  47037. class AESBaseCipher {
  47038. constructor() {
  47039. if (this.constructor === AESBaseCipher) {
  47040. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  47041. }
  47042. 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]);
  47043. 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]);
  47044. 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]);
  47045. this._mixCol = new Uint8Array(256);
  47046. for (let i = 0; i < 256; i++) {
  47047. if (i < 128) {
  47048. this._mixCol[i] = i << 1;
  47049. } else {
  47050. this._mixCol[i] = i << 1 ^ 0x1b;
  47051. }
  47052. }
  47053. this.buffer = new Uint8Array(16);
  47054. this.bufferPosition = 0;
  47055. }
  47056. _expandKey(cipherKey) {
  47057. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  47058. }
  47059. _decrypt(input, key) {
  47060. let t, u, v;
  47061. const state = new Uint8Array(16);
  47062. state.set(input);
  47063. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  47064. state[j] ^= key[k];
  47065. }
  47066. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  47067. t = state[13];
  47068. state[13] = state[9];
  47069. state[9] = state[5];
  47070. state[5] = state[1];
  47071. state[1] = t;
  47072. t = state[14];
  47073. u = state[10];
  47074. state[14] = state[6];
  47075. state[10] = state[2];
  47076. state[6] = t;
  47077. state[2] = u;
  47078. t = state[15];
  47079. u = state[11];
  47080. v = state[7];
  47081. state[15] = state[3];
  47082. state[11] = t;
  47083. state[7] = u;
  47084. state[3] = v;
  47085. for (let j = 0; j < 16; ++j) {
  47086. state[j] = this._inv_s[state[j]];
  47087. }
  47088. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  47089. state[j] ^= key[k];
  47090. }
  47091. for (let j = 0; j < 16; j += 4) {
  47092. const s0 = this._mix[state[j]];
  47093. const s1 = this._mix[state[j + 1]];
  47094. const s2 = this._mix[state[j + 2]];
  47095. const s3 = this._mix[state[j + 3]];
  47096. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  47097. state[j] = t >>> 24 & 0xff;
  47098. state[j + 1] = t >> 16 & 0xff;
  47099. state[j + 2] = t >> 8 & 0xff;
  47100. state[j + 3] = t & 0xff;
  47101. }
  47102. }
  47103. t = state[13];
  47104. state[13] = state[9];
  47105. state[9] = state[5];
  47106. state[5] = state[1];
  47107. state[1] = t;
  47108. t = state[14];
  47109. u = state[10];
  47110. state[14] = state[6];
  47111. state[10] = state[2];
  47112. state[6] = t;
  47113. state[2] = u;
  47114. t = state[15];
  47115. u = state[11];
  47116. v = state[7];
  47117. state[15] = state[3];
  47118. state[11] = t;
  47119. state[7] = u;
  47120. state[3] = v;
  47121. for (let j = 0; j < 16; ++j) {
  47122. state[j] = this._inv_s[state[j]];
  47123. state[j] ^= key[j];
  47124. }
  47125. return state;
  47126. }
  47127. _encrypt(input, key) {
  47128. const s = this._s;
  47129. let t, u, v;
  47130. const state = new Uint8Array(16);
  47131. state.set(input);
  47132. for (let j = 0; j < 16; ++j) {
  47133. state[j] ^= key[j];
  47134. }
  47135. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  47136. for (let j = 0; j < 16; ++j) {
  47137. state[j] = s[state[j]];
  47138. }
  47139. v = state[1];
  47140. state[1] = state[5];
  47141. state[5] = state[9];
  47142. state[9] = state[13];
  47143. state[13] = v;
  47144. v = state[2];
  47145. u = state[6];
  47146. state[2] = state[10];
  47147. state[6] = state[14];
  47148. state[10] = v;
  47149. state[14] = u;
  47150. v = state[3];
  47151. u = state[7];
  47152. t = state[11];
  47153. state[3] = state[15];
  47154. state[7] = v;
  47155. state[11] = u;
  47156. state[15] = t;
  47157. for (let j = 0; j < 16; j += 4) {
  47158. const s0 = state[j + 0];
  47159. const s1 = state[j + 1];
  47160. const s2 = state[j + 2];
  47161. const s3 = state[j + 3];
  47162. t = s0 ^ s1 ^ s2 ^ s3;
  47163. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  47164. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  47165. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  47166. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  47167. }
  47168. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  47169. state[j] ^= key[k];
  47170. }
  47171. }
  47172. for (let j = 0; j < 16; ++j) {
  47173. state[j] = s[state[j]];
  47174. }
  47175. v = state[1];
  47176. state[1] = state[5];
  47177. state[5] = state[9];
  47178. state[9] = state[13];
  47179. state[13] = v;
  47180. v = state[2];
  47181. u = state[6];
  47182. state[2] = state[10];
  47183. state[6] = state[14];
  47184. state[10] = v;
  47185. state[14] = u;
  47186. v = state[3];
  47187. u = state[7];
  47188. t = state[11];
  47189. state[3] = state[15];
  47190. state[7] = v;
  47191. state[11] = u;
  47192. state[15] = t;
  47193. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  47194. state[j] ^= key[k];
  47195. }
  47196. return state;
  47197. }
  47198. _decryptBlock2(data, finalize) {
  47199. const sourceLength = data.length;
  47200. let buffer = this.buffer,
  47201. bufferLength = this.bufferPosition;
  47202. const result = [];
  47203. let iv = this.iv;
  47204. for (let i = 0; i < sourceLength; ++i) {
  47205. buffer[bufferLength] = data[i];
  47206. ++bufferLength;
  47207. if (bufferLength < 16) {
  47208. continue;
  47209. }
  47210. const plain = this._decrypt(buffer, this._key);
  47211. for (let j = 0; j < 16; ++j) {
  47212. plain[j] ^= iv[j];
  47213. }
  47214. iv = buffer;
  47215. result.push(plain);
  47216. buffer = new Uint8Array(16);
  47217. bufferLength = 0;
  47218. }
  47219. this.buffer = buffer;
  47220. this.bufferLength = bufferLength;
  47221. this.iv = iv;
  47222. if (result.length === 0) {
  47223. return new Uint8Array(0);
  47224. }
  47225. let outputLength = 16 * result.length;
  47226. if (finalize) {
  47227. const lastBlock = result[result.length - 1];
  47228. let psLen = lastBlock[15];
  47229. if (psLen <= 16) {
  47230. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  47231. if (lastBlock[i] !== psLen) {
  47232. psLen = 0;
  47233. break;
  47234. }
  47235. }
  47236. outputLength -= psLen;
  47237. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  47238. }
  47239. }
  47240. const output = new Uint8Array(outputLength);
  47241. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  47242. output.set(result[i], j);
  47243. }
  47244. return output;
  47245. }
  47246. decryptBlock(data, finalize, iv = null) {
  47247. const sourceLength = data.length;
  47248. const buffer = this.buffer;
  47249. let bufferLength = this.bufferPosition;
  47250. if (iv) {
  47251. this.iv = iv;
  47252. } else {
  47253. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  47254. buffer[bufferLength] = data[i];
  47255. }
  47256. if (bufferLength < 16) {
  47257. this.bufferLength = bufferLength;
  47258. return new Uint8Array(0);
  47259. }
  47260. this.iv = buffer;
  47261. data = data.subarray(16);
  47262. }
  47263. this.buffer = new Uint8Array(16);
  47264. this.bufferLength = 0;
  47265. this.decryptBlock = this._decryptBlock2;
  47266. return this.decryptBlock(data, finalize);
  47267. }
  47268. encrypt(data, iv) {
  47269. const sourceLength = data.length;
  47270. let buffer = this.buffer,
  47271. bufferLength = this.bufferPosition;
  47272. const result = [];
  47273. if (!iv) {
  47274. iv = new Uint8Array(16);
  47275. }
  47276. for (let i = 0; i < sourceLength; ++i) {
  47277. buffer[bufferLength] = data[i];
  47278. ++bufferLength;
  47279. if (bufferLength < 16) {
  47280. continue;
  47281. }
  47282. for (let j = 0; j < 16; ++j) {
  47283. buffer[j] ^= iv[j];
  47284. }
  47285. const cipher = this._encrypt(buffer, this._key);
  47286. iv = cipher;
  47287. result.push(cipher);
  47288. buffer = new Uint8Array(16);
  47289. bufferLength = 0;
  47290. }
  47291. this.buffer = buffer;
  47292. this.bufferLength = bufferLength;
  47293. this.iv = iv;
  47294. if (result.length === 0) {
  47295. return new Uint8Array(0);
  47296. }
  47297. const outputLength = 16 * result.length;
  47298. const output = new Uint8Array(outputLength);
  47299. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  47300. output.set(result[i], j);
  47301. }
  47302. return output;
  47303. }
  47304. }
  47305. class AES128Cipher extends AESBaseCipher {
  47306. constructor(key) {
  47307. super();
  47308. this._cyclesOfRepetition = 10;
  47309. this._keySize = 160;
  47310. 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]);
  47311. this._key = this._expandKey(key);
  47312. }
  47313. _expandKey(cipherKey) {
  47314. const b = 176;
  47315. const s = this._s;
  47316. const rcon = this._rcon;
  47317. const result = new Uint8Array(b);
  47318. result.set(cipherKey);
  47319. for (let j = 16, i = 1; j < b; ++i) {
  47320. let t1 = result[j - 3];
  47321. let t2 = result[j - 2];
  47322. let t3 = result[j - 1];
  47323. let t4 = result[j - 4];
  47324. t1 = s[t1];
  47325. t2 = s[t2];
  47326. t3 = s[t3];
  47327. t4 = s[t4];
  47328. t1 = t1 ^ rcon[i];
  47329. for (let n = 0; n < 4; ++n) {
  47330. result[j] = t1 ^= result[j - 16];
  47331. j++;
  47332. result[j] = t2 ^= result[j - 16];
  47333. j++;
  47334. result[j] = t3 ^= result[j - 16];
  47335. j++;
  47336. result[j] = t4 ^= result[j - 16];
  47337. j++;
  47338. }
  47339. }
  47340. return result;
  47341. }
  47342. }
  47343. exports.AES128Cipher = AES128Cipher;
  47344. class AES256Cipher extends AESBaseCipher {
  47345. constructor(key) {
  47346. super();
  47347. this._cyclesOfRepetition = 14;
  47348. this._keySize = 224;
  47349. this._key = this._expandKey(key);
  47350. }
  47351. _expandKey(cipherKey) {
  47352. const b = 240;
  47353. const s = this._s;
  47354. const result = new Uint8Array(b);
  47355. result.set(cipherKey);
  47356. let r = 1;
  47357. let t1, t2, t3, t4;
  47358. for (let j = 32, i = 1; j < b; ++i) {
  47359. if (j % 32 === 16) {
  47360. t1 = s[t1];
  47361. t2 = s[t2];
  47362. t3 = s[t3];
  47363. t4 = s[t4];
  47364. } else if (j % 32 === 0) {
  47365. t1 = result[j - 3];
  47366. t2 = result[j - 2];
  47367. t3 = result[j - 1];
  47368. t4 = result[j - 4];
  47369. t1 = s[t1];
  47370. t2 = s[t2];
  47371. t3 = s[t3];
  47372. t4 = s[t4];
  47373. t1 = t1 ^ r;
  47374. if ((r <<= 1) >= 256) {
  47375. r = (r ^ 0x1b) & 0xff;
  47376. }
  47377. }
  47378. for (let n = 0; n < 4; ++n) {
  47379. result[j] = t1 ^= result[j - 32];
  47380. j++;
  47381. result[j] = t2 ^= result[j - 32];
  47382. j++;
  47383. result[j] = t3 ^= result[j - 32];
  47384. j++;
  47385. result[j] = t4 ^= result[j - 32];
  47386. j++;
  47387. }
  47388. }
  47389. return result;
  47390. }
  47391. }
  47392. exports.AES256Cipher = AES256Cipher;
  47393. class PDF17 {
  47394. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  47395. const hashData = new Uint8Array(password.length + 56);
  47396. hashData.set(password, 0);
  47397. hashData.set(ownerValidationSalt, password.length);
  47398. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  47399. const result = calculateSHA256(hashData, 0, hashData.length);
  47400. return (0, _util.isArrayEqual)(result, ownerPassword);
  47401. }
  47402. checkUserPassword(password, userValidationSalt, userPassword) {
  47403. const hashData = new Uint8Array(password.length + 8);
  47404. hashData.set(password, 0);
  47405. hashData.set(userValidationSalt, password.length);
  47406. const result = calculateSHA256(hashData, 0, hashData.length);
  47407. return (0, _util.isArrayEqual)(result, userPassword);
  47408. }
  47409. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  47410. const hashData = new Uint8Array(password.length + 56);
  47411. hashData.set(password, 0);
  47412. hashData.set(ownerKeySalt, password.length);
  47413. hashData.set(userBytes, password.length + ownerKeySalt.length);
  47414. const key = calculateSHA256(hashData, 0, hashData.length);
  47415. const cipher = new AES256Cipher(key);
  47416. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  47417. }
  47418. getUserKey(password, userKeySalt, userEncryption) {
  47419. const hashData = new Uint8Array(password.length + 8);
  47420. hashData.set(password, 0);
  47421. hashData.set(userKeySalt, password.length);
  47422. const key = calculateSHA256(hashData, 0, hashData.length);
  47423. const cipher = new AES256Cipher(key);
  47424. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  47425. }
  47426. }
  47427. exports.PDF17 = PDF17;
  47428. const PDF20 = function PDF20Closure() {
  47429. function calculatePDF20Hash(password, input, userBytes) {
  47430. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  47431. let e = [0];
  47432. let i = 0;
  47433. while (i < 64 || e[e.length - 1] > i - 32) {
  47434. const combinedLength = password.length + k.length + userBytes.length,
  47435. combinedArray = new Uint8Array(combinedLength);
  47436. let writeOffset = 0;
  47437. combinedArray.set(password, writeOffset);
  47438. writeOffset += password.length;
  47439. combinedArray.set(k, writeOffset);
  47440. writeOffset += k.length;
  47441. combinedArray.set(userBytes, writeOffset);
  47442. const k1 = new Uint8Array(combinedLength * 64);
  47443. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  47444. k1.set(combinedArray, pos);
  47445. }
  47446. const cipher = new AES128Cipher(k.subarray(0, 16));
  47447. e = cipher.encrypt(k1, k.subarray(16, 32));
  47448. let remainder = 0;
  47449. for (let z = 0; z < 16; z++) {
  47450. remainder *= 256 % 3;
  47451. remainder %= 3;
  47452. remainder += (e[z] >>> 0) % 3;
  47453. remainder %= 3;
  47454. }
  47455. if (remainder === 0) {
  47456. k = calculateSHA256(e, 0, e.length);
  47457. } else if (remainder === 1) {
  47458. k = calculateSHA384(e, 0, e.length);
  47459. } else if (remainder === 2) {
  47460. k = calculateSHA512(e, 0, e.length);
  47461. }
  47462. i++;
  47463. }
  47464. return k.subarray(0, 32);
  47465. }
  47466. class PDF20 {
  47467. hash(password, concatBytes, userBytes) {
  47468. return calculatePDF20Hash(password, concatBytes, userBytes);
  47469. }
  47470. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  47471. const hashData = new Uint8Array(password.length + 56);
  47472. hashData.set(password, 0);
  47473. hashData.set(ownerValidationSalt, password.length);
  47474. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  47475. const result = calculatePDF20Hash(password, hashData, userBytes);
  47476. return (0, _util.isArrayEqual)(result, ownerPassword);
  47477. }
  47478. checkUserPassword(password, userValidationSalt, userPassword) {
  47479. const hashData = new Uint8Array(password.length + 8);
  47480. hashData.set(password, 0);
  47481. hashData.set(userValidationSalt, password.length);
  47482. const result = calculatePDF20Hash(password, hashData, []);
  47483. return (0, _util.isArrayEqual)(result, userPassword);
  47484. }
  47485. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  47486. const hashData = new Uint8Array(password.length + 56);
  47487. hashData.set(password, 0);
  47488. hashData.set(ownerKeySalt, password.length);
  47489. hashData.set(userBytes, password.length + ownerKeySalt.length);
  47490. const key = calculatePDF20Hash(password, hashData, userBytes);
  47491. const cipher = new AES256Cipher(key);
  47492. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  47493. }
  47494. getUserKey(password, userKeySalt, userEncryption) {
  47495. const hashData = new Uint8Array(password.length + 8);
  47496. hashData.set(password, 0);
  47497. hashData.set(userKeySalt, password.length);
  47498. const key = calculatePDF20Hash(password, hashData, []);
  47499. const cipher = new AES256Cipher(key);
  47500. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  47501. }
  47502. }
  47503. return PDF20;
  47504. }();
  47505. exports.PDF20 = PDF20;
  47506. class CipherTransform {
  47507. constructor(stringCipherConstructor, streamCipherConstructor) {
  47508. this.StringCipherConstructor = stringCipherConstructor;
  47509. this.StreamCipherConstructor = streamCipherConstructor;
  47510. }
  47511. createStream(stream, length) {
  47512. const cipher = new this.StreamCipherConstructor();
  47513. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  47514. return cipher.decryptBlock(data, finalize);
  47515. });
  47516. }
  47517. decryptString(s) {
  47518. const cipher = new this.StringCipherConstructor();
  47519. let data = (0, _util.stringToBytes)(s);
  47520. data = cipher.decryptBlock(data, true);
  47521. return (0, _util.bytesToString)(data);
  47522. }
  47523. encryptString(s) {
  47524. const cipher = new this.StringCipherConstructor();
  47525. if (cipher instanceof AESBaseCipher) {
  47526. const strLen = s.length;
  47527. const pad = 16 - strLen % 16;
  47528. if (pad !== 16) {
  47529. s = s.padEnd(16 * Math.ceil(strLen / 16), String.fromCharCode(pad));
  47530. }
  47531. const iv = new Uint8Array(16);
  47532. if (typeof crypto !== "undefined") {
  47533. crypto.getRandomValues(iv);
  47534. } else {
  47535. for (let i = 0; i < 16; i++) {
  47536. iv[i] = Math.floor(256 * Math.random());
  47537. }
  47538. }
  47539. let data = (0, _util.stringToBytes)(s);
  47540. data = cipher.encrypt(data, iv);
  47541. const buf = new Uint8Array(16 + data.length);
  47542. buf.set(iv);
  47543. buf.set(data, 16);
  47544. return (0, _util.bytesToString)(buf);
  47545. }
  47546. let data = (0, _util.stringToBytes)(s);
  47547. data = cipher.encrypt(data);
  47548. return (0, _util.bytesToString)(data);
  47549. }
  47550. }
  47551. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  47552. 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]);
  47553. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  47554. if (password) {
  47555. const passwordLength = Math.min(127, password.length);
  47556. password = password.subarray(0, passwordLength);
  47557. } else {
  47558. password = [];
  47559. }
  47560. let pdfAlgorithm;
  47561. if (revision === 6) {
  47562. pdfAlgorithm = new PDF20();
  47563. } else {
  47564. pdfAlgorithm = new PDF17();
  47565. }
  47566. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  47567. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  47568. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  47569. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  47570. }
  47571. return null;
  47572. }
  47573. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  47574. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  47575. const hashData = new Uint8Array(hashDataSize);
  47576. let i = 0,
  47577. j,
  47578. n;
  47579. if (password) {
  47580. n = Math.min(32, password.length);
  47581. for (; i < n; ++i) {
  47582. hashData[i] = password[i];
  47583. }
  47584. }
  47585. j = 0;
  47586. while (i < 32) {
  47587. hashData[i++] = defaultPasswordBytes[j++];
  47588. }
  47589. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  47590. hashData[i++] = ownerPassword[j];
  47591. }
  47592. hashData[i++] = flags & 0xff;
  47593. hashData[i++] = flags >> 8 & 0xff;
  47594. hashData[i++] = flags >> 16 & 0xff;
  47595. hashData[i++] = flags >>> 24 & 0xff;
  47596. for (j = 0, n = fileId.length; j < n; ++j) {
  47597. hashData[i++] = fileId[j];
  47598. }
  47599. if (revision >= 4 && !encryptMetadata) {
  47600. hashData[i++] = 0xff;
  47601. hashData[i++] = 0xff;
  47602. hashData[i++] = 0xff;
  47603. hashData[i++] = 0xff;
  47604. }
  47605. let hash = calculateMD5(hashData, 0, i);
  47606. const keyLengthInBytes = keyLength >> 3;
  47607. if (revision >= 3) {
  47608. for (j = 0; j < 50; ++j) {
  47609. hash = calculateMD5(hash, 0, keyLengthInBytes);
  47610. }
  47611. }
  47612. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  47613. let cipher, checkData;
  47614. if (revision >= 3) {
  47615. for (i = 0; i < 32; ++i) {
  47616. hashData[i] = defaultPasswordBytes[i];
  47617. }
  47618. for (j = 0, n = fileId.length; j < n; ++j) {
  47619. hashData[i++] = fileId[j];
  47620. }
  47621. cipher = new ARCFourCipher(encryptionKey);
  47622. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  47623. n = encryptionKey.length;
  47624. const derivedKey = new Uint8Array(n);
  47625. for (j = 1; j <= 19; ++j) {
  47626. for (let k = 0; k < n; ++k) {
  47627. derivedKey[k] = encryptionKey[k] ^ j;
  47628. }
  47629. cipher = new ARCFourCipher(derivedKey);
  47630. checkData = cipher.encryptBlock(checkData);
  47631. }
  47632. for (j = 0, n = checkData.length; j < n; ++j) {
  47633. if (userPassword[j] !== checkData[j]) {
  47634. return null;
  47635. }
  47636. }
  47637. } else {
  47638. cipher = new ARCFourCipher(encryptionKey);
  47639. checkData = cipher.encryptBlock(defaultPasswordBytes);
  47640. for (j = 0, n = checkData.length; j < n; ++j) {
  47641. if (userPassword[j] !== checkData[j]) {
  47642. return null;
  47643. }
  47644. }
  47645. }
  47646. return encryptionKey;
  47647. }
  47648. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  47649. const hashData = new Uint8Array(32);
  47650. let i = 0;
  47651. const n = Math.min(32, password.length);
  47652. for (; i < n; ++i) {
  47653. hashData[i] = password[i];
  47654. }
  47655. let j = 0;
  47656. while (i < 32) {
  47657. hashData[i++] = defaultPasswordBytes[j++];
  47658. }
  47659. let hash = calculateMD5(hashData, 0, i);
  47660. const keyLengthInBytes = keyLength >> 3;
  47661. if (revision >= 3) {
  47662. for (j = 0; j < 50; ++j) {
  47663. hash = calculateMD5(hash, 0, hash.length);
  47664. }
  47665. }
  47666. let cipher, userPassword;
  47667. if (revision >= 3) {
  47668. userPassword = ownerPassword;
  47669. const derivedKey = new Uint8Array(keyLengthInBytes);
  47670. for (j = 19; j >= 0; j--) {
  47671. for (let k = 0; k < keyLengthInBytes; ++k) {
  47672. derivedKey[k] = hash[k] ^ j;
  47673. }
  47674. cipher = new ARCFourCipher(derivedKey);
  47675. userPassword = cipher.encryptBlock(userPassword);
  47676. }
  47677. } else {
  47678. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  47679. userPassword = cipher.encryptBlock(ownerPassword);
  47680. }
  47681. return userPassword;
  47682. }
  47683. const identityName = _primitives.Name.get("Identity");
  47684. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  47685. const key = new Uint8Array(encryptionKey.length + 9);
  47686. const n = encryptionKey.length;
  47687. let i;
  47688. for (i = 0; i < n; ++i) {
  47689. key[i] = encryptionKey[i];
  47690. }
  47691. key[i++] = num & 0xff;
  47692. key[i++] = num >> 8 & 0xff;
  47693. key[i++] = num >> 16 & 0xff;
  47694. key[i++] = gen & 0xff;
  47695. key[i++] = gen >> 8 & 0xff;
  47696. if (isAes) {
  47697. key[i++] = 0x73;
  47698. key[i++] = 0x41;
  47699. key[i++] = 0x6c;
  47700. key[i++] = 0x54;
  47701. }
  47702. const hash = calculateMD5(key, 0, i);
  47703. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  47704. }
  47705. function buildCipherConstructor(cf, name, num, gen, key) {
  47706. if (!(0, _primitives.isName)(name)) {
  47707. throw new _util.FormatError("Invalid crypt filter name.");
  47708. }
  47709. const cryptFilter = cf.get(name.name);
  47710. let cfm;
  47711. if (cryptFilter !== null && cryptFilter !== undefined) {
  47712. cfm = cryptFilter.get("CFM");
  47713. }
  47714. if (!cfm || cfm.name === "None") {
  47715. return function cipherTransformFactoryBuildCipherConstructorNone() {
  47716. return new NullCipher();
  47717. };
  47718. }
  47719. if (cfm.name === "V2") {
  47720. return function cipherTransformFactoryBuildCipherConstructorV2() {
  47721. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  47722. };
  47723. }
  47724. if (cfm.name === "AESV2") {
  47725. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  47726. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  47727. };
  47728. }
  47729. if (cfm.name === "AESV3") {
  47730. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  47731. return new AES256Cipher(key);
  47732. };
  47733. }
  47734. throw new _util.FormatError("Unknown crypto method");
  47735. }
  47736. class CipherTransformFactory {
  47737. constructor(dict, fileId, password) {
  47738. const filter = dict.get("Filter");
  47739. if (!(0, _primitives.isName)(filter, "Standard")) {
  47740. throw new _util.FormatError("unknown encryption method");
  47741. }
  47742. this.dict = dict;
  47743. const algorithm = dict.get("V");
  47744. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  47745. throw new _util.FormatError("unsupported encryption algorithm");
  47746. }
  47747. this.algorithm = algorithm;
  47748. let keyLength = dict.get("Length");
  47749. if (!keyLength) {
  47750. if (algorithm <= 3) {
  47751. keyLength = 40;
  47752. } else {
  47753. const cfDict = dict.get("CF");
  47754. const streamCryptoName = dict.get("StmF");
  47755. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  47756. cfDict.suppressEncryption = true;
  47757. const handlerDict = cfDict.get(streamCryptoName.name);
  47758. keyLength = handlerDict && handlerDict.get("Length") || 128;
  47759. if (keyLength < 40) {
  47760. keyLength <<= 3;
  47761. }
  47762. }
  47763. }
  47764. }
  47765. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  47766. throw new _util.FormatError("invalid key length");
  47767. }
  47768. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  47769. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  47770. const flags = dict.get("P");
  47771. const revision = dict.get("R");
  47772. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  47773. this.encryptMetadata = encryptMetadata;
  47774. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  47775. let passwordBytes;
  47776. if (password) {
  47777. if (revision === 6) {
  47778. try {
  47779. password = (0, _util.utf8StringToString)(password);
  47780. } catch (ex) {
  47781. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  47782. }
  47783. }
  47784. passwordBytes = (0, _util.stringToBytes)(password);
  47785. }
  47786. let encryptionKey;
  47787. if (algorithm !== 5) {
  47788. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  47789. } else {
  47790. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  47791. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  47792. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  47793. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  47794. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  47795. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  47796. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  47797. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  47798. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  47799. }
  47800. if (!encryptionKey && !password) {
  47801. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  47802. } else if (!encryptionKey && password) {
  47803. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  47804. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  47805. }
  47806. if (!encryptionKey) {
  47807. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  47808. }
  47809. this.encryptionKey = encryptionKey;
  47810. if (algorithm >= 4) {
  47811. const cf = dict.get("CF");
  47812. if ((0, _primitives.isDict)(cf)) {
  47813. cf.suppressEncryption = true;
  47814. }
  47815. this.cf = cf;
  47816. this.stmf = dict.get("StmF") || identityName;
  47817. this.strf = dict.get("StrF") || identityName;
  47818. this.eff = dict.get("EFF") || this.stmf;
  47819. }
  47820. }
  47821. createCipherTransform(num, gen) {
  47822. if (this.algorithm === 4 || this.algorithm === 5) {
  47823. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  47824. }
  47825. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  47826. const cipherConstructor = function buildCipherCipherConstructor() {
  47827. return new ARCFourCipher(key);
  47828. };
  47829. return new CipherTransform(cipherConstructor, cipherConstructor);
  47830. }
  47831. }
  47832. return CipherTransformFactory;
  47833. }();
  47834. exports.CipherTransformFactory = CipherTransformFactory;
  47835. /***/ }),
  47836. /* 66 */
  47837. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47838. Object.defineProperty(exports, "__esModule", ({
  47839. value: true
  47840. }));
  47841. exports.DecryptStream = void 0;
  47842. var _decode_stream = __w_pdfjs_require__(19);
  47843. const chunkSize = 512;
  47844. class DecryptStream extends _decode_stream.DecodeStream {
  47845. constructor(str, maybeLength, decrypt) {
  47846. super(maybeLength);
  47847. this.str = str;
  47848. this.dict = str.dict;
  47849. this.decrypt = decrypt;
  47850. this.nextChunk = null;
  47851. this.initialized = false;
  47852. }
  47853. readBlock() {
  47854. let chunk;
  47855. if (this.initialized) {
  47856. chunk = this.nextChunk;
  47857. } else {
  47858. chunk = this.str.getBytes(chunkSize);
  47859. this.initialized = true;
  47860. }
  47861. if (!chunk || chunk.length === 0) {
  47862. this.eof = true;
  47863. return;
  47864. }
  47865. this.nextChunk = this.str.getBytes(chunkSize);
  47866. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  47867. const decrypt = this.decrypt;
  47868. chunk = decrypt(chunk, !hasMoreData);
  47869. let bufferLength = this.bufferLength;
  47870. const n = chunk.length,
  47871. buffer = this.ensureBuffer(bufferLength + n);
  47872. for (let i = 0; i < n; i++) {
  47873. buffer[bufferLength++] = chunk[i];
  47874. }
  47875. this.bufferLength = bufferLength;
  47876. }
  47877. }
  47878. exports.DecryptStream = DecryptStream;
  47879. /***/ }),
  47880. /* 67 */
  47881. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47882. Object.defineProperty(exports, "__esModule", ({
  47883. value: true
  47884. }));
  47885. exports.XFAFactory = void 0;
  47886. var _xfa_object = __w_pdfjs_require__(68);
  47887. var _bind = __w_pdfjs_require__(71);
  47888. var _parser = __w_pdfjs_require__(76);
  47889. class XFAFactory {
  47890. constructor(data) {
  47891. try {
  47892. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  47893. this.form = new _bind.Binder(this.root).bind();
  47894. this.pages = this.form[_xfa_object.$toHTML]();
  47895. } catch (e) {
  47896. console.log(e);
  47897. }
  47898. }
  47899. getPage(pageIndex) {
  47900. return this.pages.children[pageIndex];
  47901. }
  47902. get numberPages() {
  47903. return this.pages.children.length;
  47904. }
  47905. static _createDocument(data) {
  47906. if (!data["/xdp:xdp"]) {
  47907. return data["xdp:xdp"];
  47908. }
  47909. return Object.values(data).join("");
  47910. }
  47911. }
  47912. exports.XFAFactory = XFAFactory;
  47913. /***/ }),
  47914. /* 68 */
  47915. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47916. Object.defineProperty(exports, "__esModule", ({
  47917. value: true
  47918. }));
  47919. 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.$toHTML = exports.$text = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$resolvePrototypes = exports.$removeChild = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isTransparent = exports.$isDescendent = exports.$isDataValue = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$hasItem = exports.$global = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getDataValue = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$clean = exports.$childrenToHTML = exports.$break = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0;
  47920. var _utils = __w_pdfjs_require__(69);
  47921. var _util = __w_pdfjs_require__(2);
  47922. var _namespaces = __w_pdfjs_require__(70);
  47923. const $acceptWhitespace = Symbol();
  47924. exports.$acceptWhitespace = $acceptWhitespace;
  47925. const $addHTML = Symbol();
  47926. exports.$addHTML = $addHTML;
  47927. const $appendChild = Symbol();
  47928. exports.$appendChild = $appendChild;
  47929. const $break = Symbol();
  47930. exports.$break = $break;
  47931. const $childrenToHTML = Symbol();
  47932. exports.$childrenToHTML = $childrenToHTML;
  47933. const $clean = Symbol();
  47934. exports.$clean = $clean;
  47935. const $cleanup = Symbol();
  47936. exports.$cleanup = $cleanup;
  47937. const $clone = Symbol();
  47938. exports.$clone = $clone;
  47939. const $consumed = Symbol();
  47940. exports.$consumed = $consumed;
  47941. const $content = Symbol("content");
  47942. exports.$content = $content;
  47943. const $data = Symbol("data");
  47944. exports.$data = $data;
  47945. const $dump = Symbol();
  47946. exports.$dump = $dump;
  47947. const $extra = Symbol("extra");
  47948. exports.$extra = $extra;
  47949. const $finalize = Symbol();
  47950. exports.$finalize = $finalize;
  47951. const $flushHTML = Symbol();
  47952. exports.$flushHTML = $flushHTML;
  47953. const $getAttributeIt = Symbol();
  47954. exports.$getAttributeIt = $getAttributeIt;
  47955. const $getAvailableSpace = Symbol();
  47956. exports.$getAvailableSpace = $getAvailableSpace;
  47957. const $getChildrenByClass = Symbol();
  47958. exports.$getChildrenByClass = $getChildrenByClass;
  47959. const $getChildrenByName = Symbol();
  47960. exports.$getChildrenByName = $getChildrenByName;
  47961. const $getChildrenByNameIt = Symbol();
  47962. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  47963. const $getDataValue = Symbol();
  47964. exports.$getDataValue = $getDataValue;
  47965. const $getRealChildrenByNameIt = Symbol();
  47966. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  47967. const $getChildren = Symbol();
  47968. exports.$getChildren = $getChildren;
  47969. const $getNextPage = Symbol();
  47970. exports.$getNextPage = $getNextPage;
  47971. const $getParent = Symbol();
  47972. exports.$getParent = $getParent;
  47973. const $global = Symbol();
  47974. exports.$global = $global;
  47975. const $hasItem = Symbol();
  47976. exports.$hasItem = $hasItem;
  47977. const $hasSettableValue = Symbol();
  47978. exports.$hasSettableValue = $hasSettableValue;
  47979. const $ids = Symbol();
  47980. exports.$ids = $ids;
  47981. const $indexOf = Symbol();
  47982. exports.$indexOf = $indexOf;
  47983. const $insertAt = Symbol();
  47984. exports.$insertAt = $insertAt;
  47985. const $isDataValue = Symbol();
  47986. exports.$isDataValue = $isDataValue;
  47987. const $isDescendent = Symbol();
  47988. exports.$isDescendent = $isDescendent;
  47989. const $isTransparent = Symbol();
  47990. exports.$isTransparent = $isTransparent;
  47991. const $lastAttribute = Symbol();
  47992. const $namespaceId = Symbol("namespaceId");
  47993. exports.$namespaceId = $namespaceId;
  47994. const $nodeName = Symbol("nodeName");
  47995. exports.$nodeName = $nodeName;
  47996. const $nsAttributes = Symbol();
  47997. exports.$nsAttributes = $nsAttributes;
  47998. const $onChild = Symbol();
  47999. exports.$onChild = $onChild;
  48000. const $onChildCheck = Symbol();
  48001. exports.$onChildCheck = $onChildCheck;
  48002. const $onText = Symbol();
  48003. exports.$onText = $onText;
  48004. const $removeChild = Symbol();
  48005. exports.$removeChild = $removeChild;
  48006. const $resolvePrototypes = Symbol();
  48007. exports.$resolvePrototypes = $resolvePrototypes;
  48008. const $searchNode = Symbol();
  48009. exports.$searchNode = $searchNode;
  48010. const $setId = Symbol();
  48011. exports.$setId = $setId;
  48012. const $setSetAttributes = Symbol();
  48013. exports.$setSetAttributes = $setSetAttributes;
  48014. const $setValue = Symbol();
  48015. exports.$setValue = $setValue;
  48016. const $text = Symbol();
  48017. exports.$text = $text;
  48018. const $toHTML = Symbol();
  48019. exports.$toHTML = $toHTML;
  48020. const $toStyle = Symbol();
  48021. exports.$toStyle = $toStyle;
  48022. const $uid = Symbol("uid");
  48023. exports.$uid = $uid;
  48024. const _applyPrototype = Symbol();
  48025. const _attributes = Symbol();
  48026. const _attributeNames = Symbol();
  48027. const _children = Symbol("_children");
  48028. const _cloneAttribute = Symbol();
  48029. const _dataValue = Symbol();
  48030. const _defaultValue = Symbol();
  48031. const _filteredChildrenGenerator = Symbol();
  48032. const _getPrototype = Symbol();
  48033. const _getUnsetAttributes = Symbol();
  48034. const _hasChildren = Symbol();
  48035. const _max = Symbol();
  48036. const _options = Symbol();
  48037. const _parent = Symbol("parent");
  48038. const _setAttributes = Symbol();
  48039. const _validator = Symbol();
  48040. let uid = 0;
  48041. class XFAObject {
  48042. constructor(nsId, name, hasChildren = false) {
  48043. this[$namespaceId] = nsId;
  48044. this[$nodeName] = name;
  48045. this[_hasChildren] = hasChildren;
  48046. this[_parent] = null;
  48047. this[_children] = [];
  48048. this[$uid] = `${name}${uid++}`;
  48049. }
  48050. [$onChild](child) {
  48051. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  48052. return false;
  48053. }
  48054. const name = child[$nodeName];
  48055. const node = this[name];
  48056. if (node instanceof XFAObjectArray) {
  48057. if (node.push(child)) {
  48058. this[$appendChild](child);
  48059. return true;
  48060. }
  48061. } else {
  48062. if (node !== null) {
  48063. this[$removeChild](node);
  48064. }
  48065. this[name] = child;
  48066. this[$appendChild](child);
  48067. return true;
  48068. }
  48069. let id = "";
  48070. if (this.id) {
  48071. id = ` (id: ${this.id})`;
  48072. } else if (this.name) {
  48073. id = ` (name: ${this.name} ${this.h.value})`;
  48074. }
  48075. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  48076. return false;
  48077. }
  48078. [$onChildCheck](child) {
  48079. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  48080. }
  48081. [$acceptWhitespace]() {
  48082. return false;
  48083. }
  48084. [$setId](ids) {
  48085. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  48086. ids.set(this.id, this);
  48087. }
  48088. }
  48089. [$appendChild](child) {
  48090. child[_parent] = this;
  48091. this[_children].push(child);
  48092. }
  48093. [$removeChild](child) {
  48094. const i = this[_children].indexOf(child);
  48095. this[_children].splice(i, 1);
  48096. }
  48097. [$hasSettableValue]() {
  48098. return this.hasOwnProperty("value");
  48099. }
  48100. [$setValue](_) {}
  48101. [$onText](_) {}
  48102. [$finalize]() {}
  48103. [$clean](builder) {
  48104. delete this[_hasChildren];
  48105. if (this[$cleanup]) {
  48106. builder.clean(this[$cleanup]);
  48107. delete this[$cleanup];
  48108. }
  48109. }
  48110. [$hasItem]() {
  48111. return false;
  48112. }
  48113. [$indexOf](child) {
  48114. return this[_children].indexOf(child);
  48115. }
  48116. [$insertAt](i, child) {
  48117. child[_parent] = this;
  48118. this[_children].splice(i, 0, child);
  48119. }
  48120. [$isTransparent]() {
  48121. return this.name === "";
  48122. }
  48123. [$lastAttribute]() {
  48124. return "";
  48125. }
  48126. [$text]() {
  48127. if (this[_children].length === 0) {
  48128. return this[$content];
  48129. }
  48130. return this[_children].map(c => c[$text]()).join("");
  48131. }
  48132. get [_attributeNames]() {
  48133. const proto = Object.getPrototypeOf(this);
  48134. if (!proto._attributes) {
  48135. const attributes = proto._attributes = new Set();
  48136. for (const name of Object.getOwnPropertyNames(this)) {
  48137. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  48138. break;
  48139. }
  48140. attributes.add(name);
  48141. }
  48142. }
  48143. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  48144. }
  48145. [$isDescendent](parent) {
  48146. let node = this;
  48147. while (node) {
  48148. if (node === parent) {
  48149. return true;
  48150. }
  48151. node = node[$getParent]();
  48152. }
  48153. return false;
  48154. }
  48155. [$getParent]() {
  48156. return this[_parent];
  48157. }
  48158. [$getChildren](name = null) {
  48159. if (!name) {
  48160. return this[_children];
  48161. }
  48162. return this[name];
  48163. }
  48164. [$dump]() {
  48165. const dumped = Object.create(null);
  48166. if (this[$content]) {
  48167. dumped.$content = this[$content];
  48168. }
  48169. for (const name of Object.getOwnPropertyNames(this)) {
  48170. const value = this[name];
  48171. if (value === null) {
  48172. continue;
  48173. }
  48174. if (value instanceof XFAObject) {
  48175. dumped[name] = value[$dump]();
  48176. } else if (value instanceof XFAObjectArray) {
  48177. if (!value.isEmpty()) {
  48178. dumped[name] = value.dump();
  48179. }
  48180. } else {
  48181. dumped[name] = value;
  48182. }
  48183. }
  48184. return dumped;
  48185. }
  48186. [$toStyle]() {
  48187. return null;
  48188. }
  48189. [$toHTML]() {
  48190. return _utils.HTMLResult.EMPTY;
  48191. }
  48192. *[_filteredChildrenGenerator](filter, include) {
  48193. for (const node of this[$getChildren]()) {
  48194. if (!filter || include === filter.has(node[$nodeName])) {
  48195. const availableSpace = this[$getAvailableSpace]();
  48196. const res = node[$toHTML](availableSpace);
  48197. if (!res.success) {
  48198. this[$extra].failingNode = node;
  48199. }
  48200. yield res;
  48201. }
  48202. }
  48203. }
  48204. [$flushHTML]() {
  48205. return null;
  48206. }
  48207. [$addHTML](html, bbox) {
  48208. this[$extra].children.push(html);
  48209. }
  48210. [$getAvailableSpace]() {}
  48211. [$childrenToHTML]({
  48212. filter = null,
  48213. include = true
  48214. }) {
  48215. if (!this[$extra].generator) {
  48216. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  48217. } else {
  48218. const availableSpace = this[$getAvailableSpace]();
  48219. const res = this[$extra].failingNode[$toHTML](availableSpace);
  48220. if (!res.success) {
  48221. return false;
  48222. }
  48223. if (res.html) {
  48224. this[$addHTML](res.html, res.bbox);
  48225. }
  48226. delete this[$extra].failingNode;
  48227. }
  48228. while (true) {
  48229. const gen = this[$extra].generator.next();
  48230. if (gen.done) {
  48231. break;
  48232. }
  48233. const res = gen.value;
  48234. if (!res.success) {
  48235. return false;
  48236. }
  48237. if (res.html) {
  48238. this[$addHTML](res.html, res.bbox);
  48239. }
  48240. }
  48241. this[$extra].generator = null;
  48242. return true;
  48243. }
  48244. [$setSetAttributes](attributes) {
  48245. if (attributes.use || attributes.id) {
  48246. this[_setAttributes] = new Set(Object.keys(attributes));
  48247. }
  48248. }
  48249. [_getUnsetAttributes](protoAttributes) {
  48250. const allAttr = this[_attributeNames];
  48251. const setAttr = this[_setAttributes];
  48252. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  48253. }
  48254. [$resolvePrototypes](ids, ancestors = new Set()) {
  48255. for (const child of this[_children]) {
  48256. const proto = child[_getPrototype](ids, ancestors);
  48257. if (proto) {
  48258. child[_applyPrototype](proto, ids, ancestors);
  48259. } else {
  48260. child[$resolvePrototypes](ids, ancestors);
  48261. }
  48262. }
  48263. }
  48264. [_getPrototype](ids, ancestors) {
  48265. const {
  48266. use
  48267. } = this;
  48268. if (use && use.startsWith("#")) {
  48269. const id = use.slice(1);
  48270. const proto = ids.get(id);
  48271. this.use = "";
  48272. if (!proto) {
  48273. (0, _util.warn)(`XFA - Invalid prototype id: ${id}.`);
  48274. return null;
  48275. }
  48276. if (proto[$nodeName] !== this[$nodeName]) {
  48277. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  48278. return null;
  48279. }
  48280. if (ancestors.has(proto)) {
  48281. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  48282. return null;
  48283. }
  48284. ancestors.add(proto);
  48285. const protoProto = proto[_getPrototype](ids, ancestors);
  48286. if (!protoProto) {
  48287. ancestors.delete(proto);
  48288. return proto;
  48289. }
  48290. proto[_applyPrototype](protoProto, ids, ancestors);
  48291. ancestors.delete(proto);
  48292. return proto;
  48293. }
  48294. return null;
  48295. }
  48296. [_applyPrototype](proto, ids, ancestors) {
  48297. if (ancestors.has(proto)) {
  48298. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  48299. return;
  48300. }
  48301. if (!this[$content] && proto[$content]) {
  48302. this[$content] = proto[$content];
  48303. }
  48304. const newAncestors = new Set(ancestors);
  48305. newAncestors.add(proto);
  48306. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  48307. this[unsetAttrName] = proto[unsetAttrName];
  48308. if (this[_setAttributes]) {
  48309. this[_setAttributes].add(unsetAttrName);
  48310. }
  48311. }
  48312. for (const name of Object.getOwnPropertyNames(this)) {
  48313. if (this[_attributeNames].has(name)) {
  48314. continue;
  48315. }
  48316. const value = this[name];
  48317. const protoValue = proto[name];
  48318. if (value instanceof XFAObjectArray) {
  48319. for (const child of value[_children]) {
  48320. child[$resolvePrototypes](ids, ancestors);
  48321. }
  48322. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  48323. const child = proto[_children][i][$clone]();
  48324. if (value.push(child)) {
  48325. child[_parent] = this;
  48326. this[_children].push(child);
  48327. child[$resolvePrototypes](ids, newAncestors);
  48328. } else {
  48329. break;
  48330. }
  48331. }
  48332. continue;
  48333. }
  48334. if (value !== null) {
  48335. value[$resolvePrototypes](ids, ancestors);
  48336. continue;
  48337. }
  48338. if (protoValue !== null) {
  48339. const child = protoValue[$clone]();
  48340. child[_parent] = this;
  48341. this[name] = child;
  48342. this[_children].push(child);
  48343. child[$resolvePrototypes](ids, newAncestors);
  48344. }
  48345. }
  48346. }
  48347. static [_cloneAttribute](obj) {
  48348. if (Array.isArray(obj)) {
  48349. return obj.map(x => XFAObject[_cloneAttribute](x));
  48350. }
  48351. if (obj instanceof Object) {
  48352. return Object.assign({}, obj);
  48353. }
  48354. return obj;
  48355. }
  48356. [$clone]() {
  48357. const clone = Object.create(Object.getPrototypeOf(this));
  48358. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  48359. try {
  48360. clone[$symbol] = this[$symbol];
  48361. } catch (_) {
  48362. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  48363. }
  48364. }
  48365. clone[_children] = [];
  48366. for (const name of Object.getOwnPropertyNames(this)) {
  48367. if (this[_attributeNames].has(name)) {
  48368. clone[name] = XFAObject[_cloneAttribute](this[name]);
  48369. continue;
  48370. }
  48371. const value = this[name];
  48372. if (value instanceof XFAObjectArray) {
  48373. clone[name] = new XFAObjectArray(value[_max]);
  48374. } else {
  48375. clone[name] = null;
  48376. }
  48377. }
  48378. for (const child of this[_children]) {
  48379. const name = child[$nodeName];
  48380. const clonedChild = child[$clone]();
  48381. clone[_children].push(clonedChild);
  48382. clonedChild[_parent] = clone;
  48383. if (clone[name] === null) {
  48384. clone[name] = clonedChild;
  48385. } else {
  48386. clone[name][_children].push(clonedChild);
  48387. }
  48388. }
  48389. return clone;
  48390. }
  48391. [$getChildren](name = null) {
  48392. if (!name) {
  48393. return this[_children];
  48394. }
  48395. return this[_children].filter(c => c[$nodeName] === name);
  48396. }
  48397. [$getChildrenByClass](name) {
  48398. return this[name];
  48399. }
  48400. [$getChildrenByName](name, allTransparent, first = true) {
  48401. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  48402. }
  48403. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  48404. if (name === "parent") {
  48405. yield this[_parent];
  48406. return;
  48407. }
  48408. for (const child of this[_children]) {
  48409. if (child[$nodeName] === name) {
  48410. yield child;
  48411. }
  48412. if (child.name === name) {
  48413. yield child;
  48414. }
  48415. if (allTransparent || child[$isTransparent]()) {
  48416. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  48417. }
  48418. }
  48419. if (first && this[_attributeNames].has(name)) {
  48420. yield new XFAAttribute(this, name, this[name]);
  48421. }
  48422. }
  48423. }
  48424. exports.XFAObject = XFAObject;
  48425. class XFAObjectArray {
  48426. constructor(max = Infinity) {
  48427. this[_max] = max;
  48428. this[_children] = [];
  48429. }
  48430. push(child) {
  48431. const len = this[_children].length;
  48432. if (len <= this[_max]) {
  48433. this[_children].push(child);
  48434. return true;
  48435. }
  48436. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  48437. return false;
  48438. }
  48439. isEmpty() {
  48440. return this[_children].length === 0;
  48441. }
  48442. dump() {
  48443. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  48444. }
  48445. [$clone]() {
  48446. const clone = new XFAObjectArray(this[_max]);
  48447. clone[_children] = this[_children].map(c => c[$clone]());
  48448. return clone;
  48449. }
  48450. get children() {
  48451. return this[_children];
  48452. }
  48453. clear() {
  48454. this[_children].length = 0;
  48455. }
  48456. }
  48457. exports.XFAObjectArray = XFAObjectArray;
  48458. class XFAAttribute {
  48459. constructor(node, name, value) {
  48460. this[_parent] = node;
  48461. this[$nodeName] = name;
  48462. this[$content] = value;
  48463. this[$consumed] = false;
  48464. }
  48465. [$getParent]() {
  48466. return this[_parent];
  48467. }
  48468. [$isDataValue]() {
  48469. return true;
  48470. }
  48471. [$text]() {
  48472. return this[$content];
  48473. }
  48474. [$isDescendent](parent) {
  48475. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  48476. }
  48477. }
  48478. exports.XFAAttribute = XFAAttribute;
  48479. class XmlObject extends XFAObject {
  48480. constructor(nsId, name, attributes = {}) {
  48481. super(nsId, name);
  48482. this[$content] = "";
  48483. this[_dataValue] = null;
  48484. if (name !== "#text") {
  48485. const map = new Map();
  48486. this[_attributes] = map;
  48487. for (const [attrName, value] of Object.entries(attributes)) {
  48488. map.set(attrName, new XFAAttribute(this, attrName, value));
  48489. }
  48490. if (attributes.hasOwnProperty($nsAttributes)) {
  48491. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  48492. if (dataNode !== undefined) {
  48493. if (dataNode === "dataGroup") {
  48494. this[_dataValue] = false;
  48495. } else if (dataNode === "dataValue") {
  48496. this[_dataValue] = true;
  48497. }
  48498. }
  48499. }
  48500. }
  48501. this[$consumed] = false;
  48502. }
  48503. [$onChild](child) {
  48504. if (this[$content]) {
  48505. const node = new XmlObject(this[$namespaceId], "#text");
  48506. this[$appendChild](node);
  48507. node[$content] = this[$content];
  48508. this[$content] = "";
  48509. }
  48510. this[$appendChild](child);
  48511. return true;
  48512. }
  48513. [$onText](str) {
  48514. this[$content] += str;
  48515. }
  48516. [$finalize]() {
  48517. if (this[$content] && this[_children].length > 0) {
  48518. const node = new XmlObject(this[$namespaceId], "#text");
  48519. this[$appendChild](node);
  48520. node[$content] = this[$content];
  48521. delete this[$content];
  48522. }
  48523. }
  48524. [$toHTML]() {
  48525. if (this[$nodeName] === "#text") {
  48526. return _utils.HTMLResult.success({
  48527. name: "#text",
  48528. value: this[$content]
  48529. });
  48530. }
  48531. return _utils.HTMLResult.EMPTY;
  48532. }
  48533. [$getChildren](name = null) {
  48534. if (!name) {
  48535. return this[_children];
  48536. }
  48537. return this[_children].filter(c => c[$nodeName] === name);
  48538. }
  48539. [$getChildrenByClass](name) {
  48540. const value = this[_attributes].get(name);
  48541. if (value !== undefined) {
  48542. return value;
  48543. }
  48544. return this[$getChildren](name);
  48545. }
  48546. *[$getChildrenByNameIt](name, allTransparent) {
  48547. const value = this[_attributes].get(name);
  48548. if (value) {
  48549. yield value;
  48550. }
  48551. for (const child of this[_children]) {
  48552. if (child[$nodeName] === name) {
  48553. yield child;
  48554. }
  48555. if (allTransparent) {
  48556. yield* child[$getChildrenByNameIt](name, allTransparent);
  48557. }
  48558. }
  48559. }
  48560. *[$getAttributeIt](name, skipConsumed) {
  48561. const value = this[_attributes].get(name);
  48562. if (value && (!skipConsumed || !value[$consumed])) {
  48563. yield value;
  48564. }
  48565. for (const child of this[_children]) {
  48566. yield* child[$getAttributeIt](name, skipConsumed);
  48567. }
  48568. }
  48569. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  48570. for (const child of this[_children]) {
  48571. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  48572. yield child;
  48573. }
  48574. if (allTransparent) {
  48575. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  48576. }
  48577. }
  48578. }
  48579. [$isDataValue]() {
  48580. if (this[_dataValue] === null) {
  48581. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  48582. }
  48583. return this[_dataValue];
  48584. }
  48585. [$getDataValue]() {
  48586. if (this[_dataValue] === null) {
  48587. if (this[_children].length === 0) {
  48588. return this[$content].trim();
  48589. }
  48590. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  48591. return this[_children][0][$text]().trim();
  48592. }
  48593. return null;
  48594. }
  48595. return this[$content].trim();
  48596. }
  48597. [$dump]() {
  48598. const dumped = Object.create(null);
  48599. if (this[$content]) {
  48600. dumped.$content = this[$content];
  48601. }
  48602. dumped.$name = this[$nodeName];
  48603. dumped.children = [];
  48604. for (const child of this[_children]) {
  48605. dumped.children.push(child[$dump]());
  48606. }
  48607. dumped.attributes = Object.create(null);
  48608. for (const [name, value] of this[_attributes]) {
  48609. dumped.attributes[name] = value[$content];
  48610. }
  48611. return dumped;
  48612. }
  48613. }
  48614. exports.XmlObject = XmlObject;
  48615. class ContentObject extends XFAObject {
  48616. constructor(nsId, name) {
  48617. super(nsId, name);
  48618. this[$content] = "";
  48619. }
  48620. [$onText](text) {
  48621. this[$content] += text;
  48622. }
  48623. [$finalize]() {}
  48624. }
  48625. exports.ContentObject = ContentObject;
  48626. class OptionObject extends ContentObject {
  48627. constructor(nsId, name, options) {
  48628. super(nsId, name);
  48629. this[_options] = options;
  48630. }
  48631. [$finalize]() {
  48632. this[$content] = (0, _utils.getKeyword)({
  48633. data: this[$content],
  48634. defaultValue: this[_options][0],
  48635. validate: k => this[_options].includes(k)
  48636. });
  48637. }
  48638. [$clean](builder) {
  48639. super[$clean](builder);
  48640. delete this[_options];
  48641. }
  48642. }
  48643. exports.OptionObject = OptionObject;
  48644. class StringObject extends ContentObject {
  48645. [$finalize]() {
  48646. this[$content] = this[$content].trim();
  48647. }
  48648. }
  48649. exports.StringObject = StringObject;
  48650. class IntegerObject extends ContentObject {
  48651. constructor(nsId, name, defaultValue, validator) {
  48652. super(nsId, name);
  48653. this[_defaultValue] = defaultValue;
  48654. this[_validator] = validator;
  48655. }
  48656. [$finalize]() {
  48657. this[$content] = (0, _utils.getInteger)({
  48658. data: this[$content],
  48659. defaultValue: this[_defaultValue],
  48660. validate: this[_validator]
  48661. });
  48662. }
  48663. [$clean](builder) {
  48664. super[$clean](builder);
  48665. delete this[_defaultValue];
  48666. delete this[_validator];
  48667. }
  48668. }
  48669. exports.IntegerObject = IntegerObject;
  48670. class Option01 extends IntegerObject {
  48671. constructor(nsId, name) {
  48672. super(nsId, name, 0, n => n === 1);
  48673. }
  48674. }
  48675. exports.Option01 = Option01;
  48676. class Option10 extends IntegerObject {
  48677. constructor(nsId, name) {
  48678. super(nsId, name, 1, n => n === 0);
  48679. }
  48680. }
  48681. exports.Option10 = Option10;
  48682. /***/ }),
  48683. /* 69 */
  48684. /***/ ((__unused_webpack_module, exports) => {
  48685. Object.defineProperty(exports, "__esModule", ({
  48686. value: true
  48687. }));
  48688. exports.getBBox = getBBox;
  48689. exports.getColor = getColor;
  48690. exports.getFloat = getFloat;
  48691. exports.getInteger = getInteger;
  48692. exports.getKeyword = getKeyword;
  48693. exports.getMeasurement = getMeasurement;
  48694. exports.getRatio = getRatio;
  48695. exports.getRelevant = getRelevant;
  48696. exports.getStringOption = getStringOption;
  48697. exports.HTMLResult = void 0;
  48698. const dimConverters = {
  48699. pt: x => x,
  48700. cm: x => x / 2.54 * 72,
  48701. mm: x => x / (10 * 2.54) * 72,
  48702. in: x => x * 72,
  48703. px: x => x
  48704. };
  48705. const measurementPattern = /([+-]?[0-9]+\.?[0-9]*)(.*)/;
  48706. function getInteger({
  48707. data,
  48708. defaultValue,
  48709. validate
  48710. }) {
  48711. if (!data) {
  48712. return defaultValue;
  48713. }
  48714. data = data.trim();
  48715. const n = parseInt(data, 10);
  48716. if (!isNaN(n) && validate(n)) {
  48717. return n;
  48718. }
  48719. return defaultValue;
  48720. }
  48721. function getFloat({
  48722. data,
  48723. defaultValue,
  48724. validate
  48725. }) {
  48726. if (!data) {
  48727. return defaultValue;
  48728. }
  48729. data = data.trim();
  48730. const n = parseFloat(data);
  48731. if (!isNaN(n) && validate(n)) {
  48732. return n;
  48733. }
  48734. return defaultValue;
  48735. }
  48736. function getKeyword({
  48737. data,
  48738. defaultValue,
  48739. validate
  48740. }) {
  48741. if (!data) {
  48742. return defaultValue;
  48743. }
  48744. data = data.trim();
  48745. if (validate(data)) {
  48746. return data;
  48747. }
  48748. return defaultValue;
  48749. }
  48750. function getStringOption(data, options) {
  48751. return getKeyword({
  48752. data,
  48753. defaultValue: options[0],
  48754. validate: k => options.includes(k)
  48755. });
  48756. }
  48757. function getMeasurement(str, def = "0") {
  48758. def = def || "0";
  48759. if (!str) {
  48760. return getMeasurement(def);
  48761. }
  48762. const match = str.trim().match(measurementPattern);
  48763. if (!match) {
  48764. return getMeasurement(def);
  48765. }
  48766. const [, valueStr, unit] = match;
  48767. const value = parseFloat(valueStr);
  48768. if (isNaN(value)) {
  48769. return getMeasurement(def);
  48770. }
  48771. if (value === 0) {
  48772. return 0;
  48773. }
  48774. const conv = dimConverters[unit];
  48775. if (conv) {
  48776. return conv(value);
  48777. }
  48778. return value;
  48779. }
  48780. function getRatio(data) {
  48781. if (!data) {
  48782. return {
  48783. num: 1,
  48784. den: 1
  48785. };
  48786. }
  48787. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  48788. if (ratio.length === 1) {
  48789. ratio.push(1);
  48790. }
  48791. if (ratio.length === 0) {
  48792. return {
  48793. num: 1,
  48794. den: 1
  48795. };
  48796. }
  48797. const [num, den] = ratio;
  48798. return {
  48799. num,
  48800. den
  48801. };
  48802. }
  48803. function getRelevant(data) {
  48804. if (!data) {
  48805. return [];
  48806. }
  48807. return data.trim().split(/\s+/).map(e => {
  48808. return {
  48809. excluded: e[0] === "-",
  48810. viewname: e.substring(1)
  48811. };
  48812. });
  48813. }
  48814. function getColor(data, def = [0, 0, 0]) {
  48815. let [r, g, b] = def;
  48816. if (!data) {
  48817. return {
  48818. r,
  48819. g,
  48820. b
  48821. };
  48822. }
  48823. 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);
  48824. if (color.length < 3) {
  48825. return {
  48826. r,
  48827. g,
  48828. b
  48829. };
  48830. }
  48831. [r, g, b] = color;
  48832. return {
  48833. r,
  48834. g,
  48835. b
  48836. };
  48837. }
  48838. function getBBox(data) {
  48839. const def = -1;
  48840. if (!data) {
  48841. return {
  48842. x: def,
  48843. y: def,
  48844. width: def,
  48845. height: def
  48846. };
  48847. }
  48848. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  48849. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  48850. return {
  48851. x: def,
  48852. y: def,
  48853. width: def,
  48854. height: def
  48855. };
  48856. }
  48857. const [x, y, width, height] = bbox;
  48858. return {
  48859. x,
  48860. y,
  48861. width,
  48862. height
  48863. };
  48864. }
  48865. class HTMLResult {
  48866. constructor(success, html, bbox) {
  48867. this.success = success;
  48868. this.html = html;
  48869. this.bbox = bbox;
  48870. }
  48871. static success(html, bbox = null) {
  48872. return new HTMLResult(true, html, bbox);
  48873. }
  48874. }
  48875. exports.HTMLResult = HTMLResult;
  48876. HTMLResult.FAILURE = new HTMLResult(false, null, null);
  48877. HTMLResult.EMPTY = new HTMLResult(true, null, null);
  48878. /***/ }),
  48879. /* 70 */
  48880. /***/ ((__unused_webpack_module, exports) => {
  48881. Object.defineProperty(exports, "__esModule", ({
  48882. value: true
  48883. }));
  48884. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  48885. const $buildXFAObject = Symbol();
  48886. exports.$buildXFAObject = $buildXFAObject;
  48887. const NamespaceIds = {
  48888. config: {
  48889. id: 0,
  48890. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  48891. },
  48892. connectionSet: {
  48893. id: 1,
  48894. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  48895. },
  48896. datasets: {
  48897. id: 2,
  48898. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  48899. },
  48900. form: {
  48901. id: 3,
  48902. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  48903. },
  48904. localeSet: {
  48905. id: 4,
  48906. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  48907. },
  48908. pdf: {
  48909. id: 5,
  48910. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  48911. },
  48912. signature: {
  48913. id: 6,
  48914. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  48915. },
  48916. sourceSet: {
  48917. id: 7,
  48918. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  48919. },
  48920. stylesheet: {
  48921. id: 8,
  48922. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  48923. },
  48924. template: {
  48925. id: 9,
  48926. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  48927. },
  48928. xdc: {
  48929. id: 10,
  48930. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  48931. },
  48932. xdp: {
  48933. id: 11,
  48934. check: ns => ns === "http://ns.adobe.com/xdp/"
  48935. },
  48936. xfdf: {
  48937. id: 12,
  48938. check: ns => ns === "http://ns.adobe.com/xfdf/"
  48939. },
  48940. xhtml: {
  48941. id: 13,
  48942. check: ns => ns === "http://www.w3.org/1999/xhtml"
  48943. },
  48944. xmpmeta: {
  48945. id: 14,
  48946. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  48947. }
  48948. };
  48949. exports.NamespaceIds = NamespaceIds;
  48950. /***/ }),
  48951. /* 71 */
  48952. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48953. Object.defineProperty(exports, "__esModule", ({
  48954. value: true
  48955. }));
  48956. exports.Binder = void 0;
  48957. var _xfa_object = __w_pdfjs_require__(68);
  48958. var _template = __w_pdfjs_require__(72);
  48959. var _som = __w_pdfjs_require__(75);
  48960. var _namespaces = __w_pdfjs_require__(70);
  48961. var _util = __w_pdfjs_require__(2);
  48962. function createText(content) {
  48963. const node = new _template.Text({});
  48964. node[_xfa_object.$content] = content;
  48965. return node;
  48966. }
  48967. class Binder {
  48968. constructor(root) {
  48969. this.root = root;
  48970. this.datasets = root.datasets;
  48971. if (root.datasets && root.datasets.data) {
  48972. this.emptyMerge = false;
  48973. this.data = root.datasets.data;
  48974. } else {
  48975. this.emptyMerge = true;
  48976. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  48977. }
  48978. this.root.form = this.form = root.template[_xfa_object.$clone]();
  48979. }
  48980. _isConsumeData() {
  48981. return !this.emptyMerge && this._mergeMode;
  48982. }
  48983. _isMatchTemplate() {
  48984. return !this._isConsumeData();
  48985. }
  48986. bind() {
  48987. this._bindElement(this.form, this.data);
  48988. return this.form;
  48989. }
  48990. getData() {
  48991. return this.data;
  48992. }
  48993. _bindValue(formNode, data, picture) {
  48994. if (formNode[_xfa_object.$hasSettableValue]()) {
  48995. if (data[_xfa_object.$isDataValue]()) {
  48996. const value = data[_xfa_object.$getDataValue]();
  48997. formNode[_xfa_object.$setValue](createText(value));
  48998. formNode[_xfa_object.$data] = data;
  48999. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  49000. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  49001. formNode[_xfa_object.$setValue](createText(value));
  49002. formNode[_xfa_object.$data] = data;
  49003. } else if (this._isConsumeData()) {
  49004. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  49005. }
  49006. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  49007. this._bindElement(formNode, data);
  49008. formNode[_xfa_object.$data] = data;
  49009. } else {
  49010. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  49011. }
  49012. }
  49013. _findDataByNameToConsume(name, isValue, dataNode, global) {
  49014. if (!name) {
  49015. return null;
  49016. }
  49017. let generator, match;
  49018. for (let i = 0; i < 3; i++) {
  49019. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  49020. while (true) {
  49021. match = generator.next().value;
  49022. if (!match) {
  49023. break;
  49024. }
  49025. if (isValue === match[_xfa_object.$isDataValue]()) {
  49026. return match;
  49027. }
  49028. }
  49029. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  49030. break;
  49031. }
  49032. dataNode = dataNode[_xfa_object.$getParent]();
  49033. }
  49034. if (!global) {
  49035. return null;
  49036. }
  49037. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, false, false);
  49038. while (true) {
  49039. match = generator.next().value;
  49040. if (!match) {
  49041. break;
  49042. }
  49043. if (match[_xfa_object.$global]) {
  49044. return match;
  49045. }
  49046. }
  49047. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  49048. match = generator.next().value;
  49049. if (match && match[_xfa_object.$isDataValue]()) {
  49050. return match;
  49051. }
  49052. return null;
  49053. }
  49054. _setProperties(formNode, dataNode) {
  49055. if (!formNode.hasOwnProperty("setProperty")) {
  49056. return;
  49057. }
  49058. for (const {
  49059. ref,
  49060. target,
  49061. connection
  49062. } of formNode.setProperty.children) {
  49063. if (connection) {
  49064. continue;
  49065. }
  49066. if (!ref) {
  49067. continue;
  49068. }
  49069. const [node] = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  49070. if (!node) {
  49071. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  49072. continue;
  49073. }
  49074. if (!node[_xfa_object.$isDescendent](this.data)) {
  49075. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  49076. continue;
  49077. }
  49078. const [targetNode] = (0, _som.searchNode)(this.root, formNode, target, false, false);
  49079. if (!targetNode) {
  49080. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  49081. continue;
  49082. }
  49083. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  49084. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  49085. continue;
  49086. }
  49087. const targetParent = targetNode[_xfa_object.$getParent]();
  49088. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  49089. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  49090. continue;
  49091. }
  49092. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  49093. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  49094. continue;
  49095. }
  49096. const content = node[_xfa_object.$text]();
  49097. const name = targetNode[_xfa_object.$nodeName];
  49098. if (targetNode instanceof _xfa_object.XFAAttribute) {
  49099. const attrs = Object.create(null);
  49100. attrs[name] = content;
  49101. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  49102. targetParent[name] = obj[name];
  49103. continue;
  49104. }
  49105. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  49106. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  49107. continue;
  49108. }
  49109. targetNode[_xfa_object.$data] = node;
  49110. targetNode[_xfa_object.$content] = content;
  49111. targetNode[_xfa_object.$finalize]();
  49112. }
  49113. }
  49114. _bindItems(formNode, dataNode) {
  49115. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  49116. return;
  49117. }
  49118. for (const item of formNode.items.children) {
  49119. formNode[_xfa_object.$removeChild](item);
  49120. }
  49121. formNode.items.clear();
  49122. const labels = new _template.Items({});
  49123. const values = new _template.Items({});
  49124. formNode[_xfa_object.$appendChild](labels);
  49125. formNode.items.push(labels);
  49126. formNode[_xfa_object.$appendChild](values);
  49127. formNode.items.push(values);
  49128. for (const {
  49129. ref,
  49130. labelRef,
  49131. valueRef,
  49132. connection
  49133. } of formNode.bindItems.children) {
  49134. if (connection) {
  49135. continue;
  49136. }
  49137. if (!ref) {
  49138. continue;
  49139. }
  49140. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  49141. if (!nodes) {
  49142. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  49143. continue;
  49144. }
  49145. for (const node of nodes) {
  49146. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  49147. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  49148. continue;
  49149. }
  49150. const [labelNode] = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  49151. if (!labelNode) {
  49152. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  49153. continue;
  49154. }
  49155. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  49156. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  49157. continue;
  49158. }
  49159. const [valueNode] = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  49160. if (!valueNode) {
  49161. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  49162. continue;
  49163. }
  49164. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  49165. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  49166. continue;
  49167. }
  49168. const label = createText(labelNode[_xfa_object.$text]());
  49169. const value = createText(valueNode[_xfa_object.$text]());
  49170. labels[_xfa_object.$appendChild](label);
  49171. labels.text.push(label);
  49172. values[_xfa_object.$appendChild](value);
  49173. values.text.push(value);
  49174. }
  49175. }
  49176. }
  49177. _bindOccurrences(formNode, matches, picture) {
  49178. let baseClone;
  49179. if (matches.length > 1) {
  49180. baseClone = formNode[_xfa_object.$clone]();
  49181. }
  49182. this._bindValue(formNode, matches[0], picture);
  49183. this._setProperties(formNode, matches[0]);
  49184. this._bindItems(formNode, matches[0]);
  49185. if (matches.length === 1) {
  49186. return;
  49187. }
  49188. const parent = formNode[_xfa_object.$getParent]();
  49189. const name = formNode[_xfa_object.$nodeName];
  49190. const pos = parent[_xfa_object.$indexOf](formNode);
  49191. for (let i = 1, ii = matches.length; i < ii; i++) {
  49192. const match = matches[i];
  49193. const clone = baseClone[_xfa_object.$clone]();
  49194. clone.occur.min = 1;
  49195. clone.occur.max = 1;
  49196. clone.occur.initial = 1;
  49197. parent[name].push(clone);
  49198. parent[_xfa_object.$insertAt](pos + i, clone);
  49199. this._bindValue(clone, match, picture);
  49200. this._setProperties(clone, match);
  49201. this._bindItems(clone, match);
  49202. }
  49203. }
  49204. _createOccurrences(formNode) {
  49205. if (!this.emptyMerge) {
  49206. return;
  49207. }
  49208. const {
  49209. occur
  49210. } = formNode;
  49211. if (!occur || occur.initial <= 1) {
  49212. return;
  49213. }
  49214. const parent = formNode[_xfa_object.$getParent]();
  49215. const name = formNode[_xfa_object.$nodeName];
  49216. for (let i = 0, ii = occur.initial; i < ii; i++) {
  49217. const clone = formNode[_xfa_object.$clone]();
  49218. clone.occur.min = 1;
  49219. clone.occur.max = 1;
  49220. clone.occur.initial = 1;
  49221. parent[name].push(clone);
  49222. parent[_xfa_object.$appendChild](clone);
  49223. }
  49224. }
  49225. _getOccurInfo(formNode) {
  49226. const {
  49227. occur
  49228. } = formNode;
  49229. const dataName = formNode.name;
  49230. if (!occur || !dataName) {
  49231. return [1, 1];
  49232. }
  49233. const max = occur.max === -1 ? Infinity : occur.max;
  49234. return [occur.min, max];
  49235. }
  49236. _bindElement(formNode, dataNode) {
  49237. const uselessNodes = [];
  49238. this._createOccurrences(formNode);
  49239. for (const child of formNode[_xfa_object.$getChildren]()) {
  49240. if (child[_xfa_object.$data]) {
  49241. continue;
  49242. }
  49243. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  49244. this._mergeMode = child.mergeMode === "consumeData";
  49245. }
  49246. let global = false;
  49247. let picture = null;
  49248. let ref = null;
  49249. let match = null;
  49250. if (child.bind) {
  49251. switch (child.bind.match) {
  49252. case "none":
  49253. this._bindElement(child, dataNode);
  49254. continue;
  49255. case "global":
  49256. global = true;
  49257. break;
  49258. case "dataRef":
  49259. if (!child.bind.ref) {
  49260. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  49261. this._bindElement(child, dataNode);
  49262. continue;
  49263. }
  49264. ref = child.bind.ref;
  49265. break;
  49266. default:
  49267. break;
  49268. }
  49269. if (child.bind.picture) {
  49270. picture = child.bind.picture[_xfa_object.$content];
  49271. }
  49272. }
  49273. const [min, max] = this._getOccurInfo(child);
  49274. if (ref) {
  49275. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  49276. if (match === null) {
  49277. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  49278. if (this._isConsumeData()) {
  49279. match[_xfa_object.$consumed] = true;
  49280. }
  49281. match = [match];
  49282. } else {
  49283. if (this._isConsumeData()) {
  49284. match = match.filter(node => !node[_xfa_object.$consumed]);
  49285. }
  49286. if (match.length > max) {
  49287. match = match.slice(0, max);
  49288. } else if (match.length === 0) {
  49289. match = null;
  49290. }
  49291. if (match && this._isConsumeData()) {
  49292. match.forEach(node => {
  49293. node[_xfa_object.$consumed] = true;
  49294. });
  49295. }
  49296. }
  49297. } else {
  49298. if (!child.name) {
  49299. this._bindElement(child, dataNode);
  49300. continue;
  49301. }
  49302. if (this._isConsumeData()) {
  49303. const matches = [];
  49304. while (matches.length < max) {
  49305. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  49306. if (!found) {
  49307. break;
  49308. }
  49309. found[_xfa_object.$consumed] = true;
  49310. matches.push(found);
  49311. }
  49312. match = matches.length > 0 ? matches : null;
  49313. } else {
  49314. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, false).next().value;
  49315. if (!match) {
  49316. match = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name);
  49317. dataNode[_xfa_object.$appendChild](match);
  49318. }
  49319. match = [match];
  49320. }
  49321. }
  49322. if (match) {
  49323. if (match.length < min) {
  49324. (0, _util.warn)(`XFA - Must have at least ${min} occurrences: ${formNode[_xfa_object.$nodeName]}.`);
  49325. continue;
  49326. }
  49327. this._bindOccurrences(child, match, picture);
  49328. } else if (min > 0) {
  49329. this._setProperties(child, dataNode);
  49330. this._bindItems(child, dataNode);
  49331. this._bindElement(child, dataNode);
  49332. } else {
  49333. uselessNodes.push(child);
  49334. }
  49335. }
  49336. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  49337. }
  49338. }
  49339. exports.Binder = Binder;
  49340. /***/ }),
  49341. /* 72 */
  49342. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49343. Object.defineProperty(exports, "__esModule", ({
  49344. value: true
  49345. }));
  49346. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  49347. var _xfa_object = __w_pdfjs_require__(68);
  49348. var _namespaces = __w_pdfjs_require__(70);
  49349. var _html_utils = __w_pdfjs_require__(73);
  49350. var _layout = __w_pdfjs_require__(74);
  49351. var _utils = __w_pdfjs_require__(69);
  49352. var _util = __w_pdfjs_require__(2);
  49353. var _som = __w_pdfjs_require__(75);
  49354. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  49355. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  49356. function _setValue(templateNode, value) {
  49357. if (!templateNode.value) {
  49358. const nodeValue = new Value({});
  49359. templateNode[_xfa_object.$appendChild](nodeValue);
  49360. templateNode.value = nodeValue;
  49361. }
  49362. templateNode.value[_xfa_object.$setValue](value);
  49363. }
  49364. function getRoot(node) {
  49365. let parent = node[_xfa_object.$getParent]();
  49366. while (!(parent instanceof Template)) {
  49367. parent = parent[_xfa_object.$getParent]();
  49368. }
  49369. return parent;
  49370. }
  49371. const NOTHING = 0;
  49372. const NOSPACE = 1;
  49373. const VALID = 2;
  49374. function checkDimensions(node, space) {
  49375. if (node.w !== "" && Math.round(node.w + node.x - space.width) > 1) {
  49376. const area = getRoot(node)[_xfa_object.$extra].currentContentArea;
  49377. if (node.w + node.x > area.w) {
  49378. return NOTHING;
  49379. }
  49380. return NOSPACE;
  49381. }
  49382. if (node.h !== "" && Math.round(node.h + node.y - space.height) > 1) {
  49383. const area = getRoot(node)[_xfa_object.$extra].currentContentArea;
  49384. if (node.h + node.y > area.h) {
  49385. return NOTHING;
  49386. }
  49387. return NOSPACE;
  49388. }
  49389. return VALID;
  49390. }
  49391. class AppearanceFilter extends _xfa_object.StringObject {
  49392. constructor(attributes) {
  49393. super(TEMPLATE_NS_ID, "appearanceFilter");
  49394. this.id = attributes.id || "";
  49395. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  49396. this.use = attributes.use || "";
  49397. this.usehref = attributes.usehref || "";
  49398. }
  49399. }
  49400. class Arc extends _xfa_object.XFAObject {
  49401. constructor(attributes) {
  49402. super(TEMPLATE_NS_ID, "arc", true);
  49403. this.circular = (0, _utils.getInteger)({
  49404. data: attributes.circular,
  49405. defaultValue: 0,
  49406. validate: x => x === 1
  49407. });
  49408. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  49409. this.id = attributes.id || "";
  49410. this.startAngle = (0, _utils.getFloat)({
  49411. data: attributes.startAngle,
  49412. defaultValue: 0,
  49413. validate: x => true
  49414. });
  49415. this.sweepAngle = (0, _utils.getFloat)({
  49416. data: attributes.sweepAngle,
  49417. defaultValue: 360,
  49418. validate: x => true
  49419. });
  49420. this.use = attributes.use || "";
  49421. this.usehref = attributes.usehref || "";
  49422. this.edge = null;
  49423. this.fill = null;
  49424. }
  49425. }
  49426. class Area extends _xfa_object.XFAObject {
  49427. constructor(attributes) {
  49428. super(TEMPLATE_NS_ID, "area", true);
  49429. this.colSpan = (0, _utils.getInteger)({
  49430. data: attributes.colSpan,
  49431. defaultValue: 1,
  49432. validate: n => n >= 1 || n === -1
  49433. });
  49434. this.id = attributes.id || "";
  49435. this.name = attributes.name || "";
  49436. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  49437. this.use = attributes.use || "";
  49438. this.usehref = attributes.usehref || "";
  49439. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  49440. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  49441. this.desc = null;
  49442. this.extras = null;
  49443. this.area = new _xfa_object.XFAObjectArray();
  49444. this.draw = new _xfa_object.XFAObjectArray();
  49445. this.exObject = new _xfa_object.XFAObjectArray();
  49446. this.exclGroup = new _xfa_object.XFAObjectArray();
  49447. this.field = new _xfa_object.XFAObjectArray();
  49448. this.subform = new _xfa_object.XFAObjectArray();
  49449. this.subformSet = new _xfa_object.XFAObjectArray();
  49450. }
  49451. [_xfa_object.$isTransparent]() {
  49452. return true;
  49453. }
  49454. [_xfa_object.$addHTML](html, bbox) {
  49455. const [x, y, w, h] = bbox;
  49456. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  49457. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  49458. this[_xfa_object.$extra].children.push(html);
  49459. }
  49460. [_xfa_object.$getAvailableSpace]() {
  49461. return this[_xfa_object.$extra].availableSpace;
  49462. }
  49463. [_xfa_object.$toHTML](availableSpace) {
  49464. const style = (0, _html_utils.toStyle)(this, "position");
  49465. const attributes = {
  49466. style,
  49467. id: this[_xfa_object.$uid],
  49468. class: "xfaArea"
  49469. };
  49470. if (this.name) {
  49471. attributes.xfaName = this.name;
  49472. }
  49473. const children = [];
  49474. this[_xfa_object.$extra] = {
  49475. children,
  49476. width: 0,
  49477. height: 0,
  49478. availableSpace
  49479. };
  49480. if (!this[_xfa_object.$childrenToHTML]({
  49481. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  49482. include: true
  49483. })) {
  49484. delete this[_xfa_object.$extra];
  49485. return _utils.HTMLResult.empty;
  49486. }
  49487. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  49488. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  49489. const html = {
  49490. name: "div",
  49491. attributes,
  49492. children
  49493. };
  49494. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  49495. delete this[_xfa_object.$extra];
  49496. return _utils.HTMLResult.success(html, bbox);
  49497. }
  49498. }
  49499. class Assist extends _xfa_object.XFAObject {
  49500. constructor(attributes) {
  49501. super(TEMPLATE_NS_ID, "assist", true);
  49502. this.id = attributes.id || "";
  49503. this.role = attributes.role || "";
  49504. this.use = attributes.use || "";
  49505. this.usehref = attributes.usehref || "";
  49506. this.speak = null;
  49507. this.toolTip = null;
  49508. }
  49509. }
  49510. class Barcode extends _xfa_object.XFAObject {
  49511. constructor(attributes) {
  49512. super(TEMPLATE_NS_ID, "barcode", true);
  49513. this.charEncoding = (0, _utils.getKeyword)({
  49514. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  49515. defaultValue: "",
  49516. 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}/)
  49517. });
  49518. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  49519. this.dataColumnCount = (0, _utils.getInteger)({
  49520. data: attributes.dataColumnCount,
  49521. defaultValue: -1,
  49522. validate: x => x >= 0
  49523. });
  49524. this.dataLength = (0, _utils.getInteger)({
  49525. data: attributes.dataLength,
  49526. defaultValue: -1,
  49527. validate: x => x >= 0
  49528. });
  49529. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  49530. this.dataRowCount = (0, _utils.getInteger)({
  49531. data: attributes.dataRowCount,
  49532. defaultValue: -1,
  49533. validate: x => x >= 0
  49534. });
  49535. this.endChar = attributes.endChar || "";
  49536. this.errorCorrectionLevel = (0, _utils.getInteger)({
  49537. data: attributes.errorCorrectionLevel,
  49538. defaultValue: -1,
  49539. validate: x => x >= 0 && x <= 8
  49540. });
  49541. this.id = attributes.id || "";
  49542. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  49543. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  49544. this.printCheckDigit = (0, _utils.getInteger)({
  49545. data: attributes.printCheckDigit,
  49546. defaultValue: 0,
  49547. validate: x => x === 1
  49548. });
  49549. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  49550. this.startChar = attributes.startChar || "";
  49551. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  49552. this.truncate = (0, _utils.getInteger)({
  49553. data: attributes.truncate,
  49554. defaultValue: 0,
  49555. validate: x => x === 1
  49556. });
  49557. 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"]);
  49558. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  49559. this.use = attributes.use || "";
  49560. this.usehref = attributes.usehref || "";
  49561. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  49562. this.encrypt = null;
  49563. this.extras = null;
  49564. }
  49565. }
  49566. class Bind extends _xfa_object.XFAObject {
  49567. constructor(attributes) {
  49568. super(TEMPLATE_NS_ID, "bind", true);
  49569. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  49570. this.ref = attributes.ref || "";
  49571. this.picture = null;
  49572. }
  49573. }
  49574. class BindItems extends _xfa_object.XFAObject {
  49575. constructor(attributes) {
  49576. super(TEMPLATE_NS_ID, "bindItems");
  49577. this.connection = attributes.connection || "";
  49578. this.labelRef = attributes.labelRef || "";
  49579. this.ref = attributes.ref || "";
  49580. this.valueRef = attributes.valueRef || "";
  49581. }
  49582. }
  49583. exports.BindItems = BindItems;
  49584. class Bookend extends _xfa_object.XFAObject {
  49585. constructor(attributes) {
  49586. super(TEMPLATE_NS_ID, "bookend");
  49587. this.id = attributes.id || "";
  49588. this.leader = attributes.leader || "";
  49589. this.trailer = attributes.trailer || "";
  49590. this.use = attributes.use || "";
  49591. this.usehref = attributes.usehref || "";
  49592. }
  49593. }
  49594. class BooleanElement extends _xfa_object.Option01 {
  49595. constructor(attributes) {
  49596. super(TEMPLATE_NS_ID, "boolean");
  49597. this.id = attributes.id || "";
  49598. this.name = attributes.name || "";
  49599. this.use = attributes.use || "";
  49600. this.usehref = attributes.usehref || "";
  49601. }
  49602. [_xfa_object.$toHTML](availableSpace) {
  49603. return _utils.HTMLResult.success(this[_xfa_object.$content] === 1);
  49604. }
  49605. }
  49606. class Border extends _xfa_object.XFAObject {
  49607. constructor(attributes) {
  49608. super(TEMPLATE_NS_ID, "border", true);
  49609. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  49610. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  49611. this.id = attributes.id || "";
  49612. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49613. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  49614. this.use = attributes.use || "";
  49615. this.usehref = attributes.usehref || "";
  49616. this.corner = new _xfa_object.XFAObjectArray(4);
  49617. this.edge = new _xfa_object.XFAObjectArray(4);
  49618. this.extras = null;
  49619. this.fill = null;
  49620. this.margin = null;
  49621. }
  49622. [_xfa_object.$toStyle](widths, margins) {
  49623. const edges = this.edge.children.slice();
  49624. if (edges.length < 4) {
  49625. const defaultEdge = edges[edges.length - 1] || new Edge({});
  49626. for (let i = edges.length; i < 4; i++) {
  49627. edges.push(defaultEdge);
  49628. }
  49629. }
  49630. widths = widths || [0, 0, 0, 0];
  49631. for (let i = 0; i < 4; i++) {
  49632. widths[i] = edges[i].thickness;
  49633. }
  49634. margins = margins || [0, 0, 0, 0];
  49635. const edgeStyles = edges.map(node => {
  49636. const style = node[_xfa_object.$toStyle]();
  49637. style.color = style.color || "#000000";
  49638. return style;
  49639. });
  49640. let style;
  49641. if (this.margin) {
  49642. style = this.margin[_xfa_object.$toStyle]();
  49643. margins[0] = this.margin.topInset;
  49644. margins[1] = this.margin.rightInset;
  49645. margins[2] = this.margin.bottomInset;
  49646. margins[3] = this.margin.leftInset;
  49647. } else {
  49648. style = Object.create(null);
  49649. }
  49650. let isForUi = false;
  49651. const parent = this[_xfa_object.$getParent]();
  49652. const grandParent = parent ? parent[_xfa_object.$getParent]() : null;
  49653. if (grandParent instanceof Ui) {
  49654. isForUi = true;
  49655. }
  49656. if (this.fill) {
  49657. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  49658. }
  49659. let hasRadius = false;
  49660. if (this.corner.children.some(node => node.radius !== 0)) {
  49661. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  49662. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  49663. const last = cornerStyles[cornerStyles.length - 1];
  49664. for (let i = cornerStyles.length; i < 4; i++) {
  49665. cornerStyles.push(last);
  49666. }
  49667. }
  49668. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  49669. hasRadius = true;
  49670. }
  49671. const firstEdge = edgeStyles[0];
  49672. if (!hasRadius && (this.edge.children.length <= 1 || edgeStyles.every(x => x.style === firstEdge.style && x.width === firstEdge.width && x.color === firstEdge.color) && margins.every(x => x === margins[0]))) {
  49673. let borderStyle;
  49674. switch (this.presence) {
  49675. case "invisible":
  49676. case "hidden":
  49677. borderStyle = "";
  49678. break;
  49679. case "inactive":
  49680. borderStyle = "none";
  49681. break;
  49682. default:
  49683. borderStyle = firstEdge.style;
  49684. break;
  49685. }
  49686. style.outline = `${firstEdge.width} ${firstEdge.color} ${borderStyle}`;
  49687. const offset = edges[0].thickness + margins[0];
  49688. style.outlineOffset = `-${(0, _html_utils.measureToString)(offset)}`;
  49689. if (isForUi) {
  49690. style.padding = `${(0, _html_utils.measureToString)(offset + 1)}`;
  49691. }
  49692. } else {
  49693. switch (this.presence) {
  49694. case "invisible":
  49695. case "hidden":
  49696. style.borderStyle = "";
  49697. break;
  49698. case "inactive":
  49699. style.borderStyle = "none";
  49700. break;
  49701. default:
  49702. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  49703. break;
  49704. }
  49705. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  49706. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  49707. }
  49708. return style;
  49709. }
  49710. }
  49711. class Break extends _xfa_object.XFAObject {
  49712. constructor(attributes) {
  49713. super(TEMPLATE_NS_ID, "break", true);
  49714. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49715. this.afterTarget = attributes.afterTarget || "";
  49716. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49717. this.beforeTarget = attributes.beforeTarget || "";
  49718. this.bookendLeader = attributes.bookendLeader || "";
  49719. this.bookendTrailer = attributes.bookendTrailer || "";
  49720. this.id = attributes.id || "";
  49721. this.overflowLeader = attributes.overflowLeader || "";
  49722. this.overflowTarget = attributes.overflowTarget || "";
  49723. this.overflowTrailer = attributes.overflowTrailer || "";
  49724. this.startNew = (0, _utils.getInteger)({
  49725. data: attributes.startNew,
  49726. defaultValue: 0,
  49727. validate: x => x === 1
  49728. });
  49729. this.use = attributes.use || "";
  49730. this.usehref = attributes.usehref || "";
  49731. this.extras = null;
  49732. }
  49733. }
  49734. class BreakAfter extends _xfa_object.XFAObject {
  49735. constructor(attributes) {
  49736. super(TEMPLATE_NS_ID, "breakAfter", true);
  49737. this.id = attributes.id || "";
  49738. this.leader = attributes.leader || "";
  49739. this.startNew = (0, _utils.getInteger)({
  49740. data: attributes.startNew,
  49741. defaultValue: 0,
  49742. validate: x => x === 1
  49743. });
  49744. this.target = attributes.target || "";
  49745. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49746. this.trailer = attributes.trailer || "";
  49747. this.use = attributes.use || "";
  49748. this.usehref = attributes.usehref || "";
  49749. this.script = null;
  49750. }
  49751. }
  49752. class BreakBefore extends _xfa_object.XFAObject {
  49753. constructor(attributes) {
  49754. super(TEMPLATE_NS_ID, "breakBefore", true);
  49755. this.id = attributes.id || "";
  49756. this.leader = attributes.leader || "";
  49757. this.startNew = (0, _utils.getInteger)({
  49758. data: attributes.startNew,
  49759. defaultValue: 0,
  49760. validate: x => x === 1
  49761. });
  49762. this.target = attributes.target || "";
  49763. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49764. this.trailer = attributes.trailer || "";
  49765. this.use = attributes.use || "";
  49766. this.usehref = attributes.usehref || "";
  49767. this.script = null;
  49768. }
  49769. [_xfa_object.$toHTML](availableSpace) {
  49770. this[_xfa_object.$extra] = {};
  49771. return _utils.HTMLResult.FAILURE;
  49772. }
  49773. }
  49774. class Button extends _xfa_object.XFAObject {
  49775. constructor(attributes) {
  49776. super(TEMPLATE_NS_ID, "button", true);
  49777. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  49778. this.id = attributes.id || "";
  49779. this.use = attributes.use || "";
  49780. this.usehref = attributes.usehref || "";
  49781. this.extras = null;
  49782. }
  49783. [_xfa_object.$toHTML](availableSpace) {
  49784. return _utils.HTMLResult.success({
  49785. name: "button",
  49786. attributes: {
  49787. class: "xfaButton",
  49788. style: {}
  49789. },
  49790. children: []
  49791. });
  49792. }
  49793. }
  49794. class Calculate extends _xfa_object.XFAObject {
  49795. constructor(attributes) {
  49796. super(TEMPLATE_NS_ID, "calculate", true);
  49797. this.id = attributes.id || "";
  49798. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  49799. this.use = attributes.use || "";
  49800. this.usehref = attributes.usehref || "";
  49801. this.extras = null;
  49802. this.message = null;
  49803. this.script = null;
  49804. }
  49805. }
  49806. class Caption extends _xfa_object.XFAObject {
  49807. constructor(attributes) {
  49808. super(TEMPLATE_NS_ID, "caption", true);
  49809. this.id = attributes.id || "";
  49810. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  49811. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49812. this.reserve = (0, _utils.getMeasurement)(attributes.reserve);
  49813. this.use = attributes.use || "";
  49814. this.usehref = attributes.usehref || "";
  49815. this.extras = null;
  49816. this.font = null;
  49817. this.margin = null;
  49818. this.para = null;
  49819. this.value = null;
  49820. }
  49821. [_xfa_object.$setValue](value) {
  49822. _setValue(this, value);
  49823. }
  49824. [_xfa_object.$toHTML](availableSpace) {
  49825. if (!this.value) {
  49826. return _utils.HTMLResult.EMPTY;
  49827. }
  49828. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  49829. if (!value) {
  49830. return _utils.HTMLResult.EMPTY;
  49831. }
  49832. const children = [];
  49833. if (typeof value === "string") {
  49834. children.push({
  49835. name: "#text",
  49836. value
  49837. });
  49838. } else {
  49839. children.push(value);
  49840. }
  49841. const style = (0, _html_utils.toStyle)(this, "font", "margin", "para", "visibility");
  49842. switch (this.placement) {
  49843. case "left":
  49844. case "right":
  49845. if (this.reserve > 0) {
  49846. style.width = (0, _html_utils.measureToString)(this.reserve);
  49847. } else {
  49848. style.minWidth = (0, _html_utils.measureToString)(this.reserve);
  49849. }
  49850. break;
  49851. case "top":
  49852. case "bottom":
  49853. if (this.reserve > 0) {
  49854. style.height = (0, _html_utils.measureToString)(this.reserve);
  49855. } else {
  49856. style.minHeight = (0, _html_utils.measureToString)(this.reserve);
  49857. }
  49858. break;
  49859. }
  49860. return _utils.HTMLResult.success({
  49861. name: "div",
  49862. attributes: {
  49863. style,
  49864. class: "xfaCaption"
  49865. },
  49866. children
  49867. });
  49868. }
  49869. }
  49870. class Certificate extends _xfa_object.StringObject {
  49871. constructor(attributes) {
  49872. super(TEMPLATE_NS_ID, "certificate");
  49873. this.id = attributes.id || "";
  49874. this.name = attributes.name || "";
  49875. this.use = attributes.use || "";
  49876. this.usehref = attributes.usehref || "";
  49877. }
  49878. }
  49879. class Certificates extends _xfa_object.XFAObject {
  49880. constructor(attributes) {
  49881. super(TEMPLATE_NS_ID, "certificates", true);
  49882. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  49883. this.id = attributes.id || "";
  49884. this.url = attributes.url || "";
  49885. this.urlPolicy = attributes.urlPolicy || "";
  49886. this.use = attributes.use || "";
  49887. this.usehref = attributes.usehref || "";
  49888. this.encryption = null;
  49889. this.issuers = null;
  49890. this.keyUsage = null;
  49891. this.oids = null;
  49892. this.signing = null;
  49893. this.subjectDNs = null;
  49894. }
  49895. }
  49896. class CheckButton extends _xfa_object.XFAObject {
  49897. constructor(attributes) {
  49898. super(TEMPLATE_NS_ID, "checkButton", true);
  49899. this.id = attributes.id || "";
  49900. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  49901. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  49902. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  49903. this.use = attributes.use || "";
  49904. this.usehref = attributes.usehref || "";
  49905. this.border = null;
  49906. this.extras = null;
  49907. this.margin = null;
  49908. }
  49909. [_xfa_object.$toHTML](availableSpace) {
  49910. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  49911. const size = (0, _html_utils.measureToString)(this.size);
  49912. style.width = style.height = size;
  49913. let mark, radius;
  49914. if (this.shape === "square") {
  49915. mark = "▪";
  49916. radius = "10%";
  49917. } else {
  49918. mark = "●";
  49919. radius = "50%";
  49920. }
  49921. if (!style.borderRadius) {
  49922. style.borderRadius = radius;
  49923. }
  49924. if (this.mark !== "default") {
  49925. switch (this.mark) {
  49926. case "check":
  49927. mark = "✓";
  49928. break;
  49929. case "circle":
  49930. mark = "●";
  49931. break;
  49932. case "cross":
  49933. mark = "✕";
  49934. break;
  49935. case "diamond":
  49936. mark = "♦";
  49937. break;
  49938. case "square":
  49939. mark = "▪";
  49940. break;
  49941. case "star":
  49942. mark = "★";
  49943. break;
  49944. }
  49945. }
  49946. if (size !== "10px") {
  49947. style.fontSize = size;
  49948. style.lineHeight = size;
  49949. style.width = size;
  49950. style.height = size;
  49951. }
  49952. const fieldId = this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid];
  49953. const input = {
  49954. name: "input",
  49955. attributes: {
  49956. class: "xfaCheckbox",
  49957. fieldId,
  49958. type: "radio",
  49959. id: `${fieldId}-radio`
  49960. }
  49961. };
  49962. const container = this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  49963. if (container instanceof ExclGroup) {
  49964. input.attributes.name = container[_xfa_object.$uid];
  49965. }
  49966. return _utils.HTMLResult.success({
  49967. name: "label",
  49968. attributes: {
  49969. class: "xfaLabel"
  49970. },
  49971. children: [input, {
  49972. name: "span",
  49973. attributes: {
  49974. class: "xfaCheckboxMark",
  49975. mark,
  49976. style
  49977. }
  49978. }]
  49979. });
  49980. }
  49981. }
  49982. class ChoiceList extends _xfa_object.XFAObject {
  49983. constructor(attributes) {
  49984. super(TEMPLATE_NS_ID, "choiceList", true);
  49985. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  49986. this.id = attributes.id || "";
  49987. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  49988. this.textEntry = (0, _utils.getInteger)({
  49989. data: attributes.textEntry,
  49990. defaultValue: 0,
  49991. validate: x => x === 1
  49992. });
  49993. this.use = attributes.use || "";
  49994. this.usehref = attributes.usehref || "";
  49995. this.border = null;
  49996. this.extras = null;
  49997. this.margin = null;
  49998. }
  49999. [_xfa_object.$toHTML](availableSpace) {
  50000. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  50001. const ui = this[_xfa_object.$getParent]();
  50002. const field = ui[_xfa_object.$getParent]();
  50003. const children = [];
  50004. if (field.items.children.length > 0) {
  50005. const displayed = field.items.children[0][_xfa_object.$toHTML]().html;
  50006. const values = field.items.children[1] ? field.items.children[1][_xfa_object.$toHTML]().html : [];
  50007. for (let i = 0, ii = displayed.length; i < ii; i++) {
  50008. children.push({
  50009. name: "option",
  50010. attributes: {
  50011. value: values[i] || displayed[i]
  50012. },
  50013. value: displayed[i]
  50014. });
  50015. }
  50016. }
  50017. const selectAttributes = {
  50018. class: "xfaSelect",
  50019. fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid],
  50020. style
  50021. };
  50022. if (this.open === "multiSelect") {
  50023. selectAttributes.multiple = true;
  50024. }
  50025. return _utils.HTMLResult.success({
  50026. name: "label",
  50027. attributes: {
  50028. class: "xfaLabel"
  50029. },
  50030. children: [{
  50031. name: "select",
  50032. children,
  50033. attributes: selectAttributes
  50034. }]
  50035. });
  50036. }
  50037. }
  50038. class Color extends _xfa_object.XFAObject {
  50039. constructor(attributes) {
  50040. super(TEMPLATE_NS_ID, "color", true);
  50041. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  50042. this.id = attributes.id || "";
  50043. this.use = attributes.use || "";
  50044. this.usehref = attributes.usehref || "";
  50045. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  50046. this.extras = null;
  50047. }
  50048. [_xfa_object.$hasSettableValue]() {
  50049. return false;
  50050. }
  50051. [_xfa_object.$toStyle]() {
  50052. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  50053. }
  50054. }
  50055. class Comb extends _xfa_object.XFAObject {
  50056. constructor(attributes) {
  50057. super(TEMPLATE_NS_ID, "comb");
  50058. this.id = attributes.id || "";
  50059. this.numberOfCells = (0, _utils.getInteger)({
  50060. data: attributes.numberOfCells,
  50061. defaultValue: 0,
  50062. validate: x => x >= 0
  50063. });
  50064. this.use = attributes.use || "";
  50065. this.usehref = attributes.usehref || "";
  50066. }
  50067. }
  50068. class Connect extends _xfa_object.XFAObject {
  50069. constructor(attributes) {
  50070. super(TEMPLATE_NS_ID, "connect", true);
  50071. this.connection = attributes.connection || "";
  50072. this.id = attributes.id || "";
  50073. this.ref = attributes.ref || "";
  50074. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  50075. this.use = attributes.use || "";
  50076. this.usehref = attributes.usehref || "";
  50077. this.picture = null;
  50078. }
  50079. }
  50080. class ContentArea extends _xfa_object.XFAObject {
  50081. constructor(attributes) {
  50082. super(TEMPLATE_NS_ID, "contentArea", true);
  50083. this.h = (0, _utils.getMeasurement)(attributes.h);
  50084. this.id = attributes.id || "";
  50085. this.name = attributes.name || "";
  50086. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50087. this.use = attributes.use || "";
  50088. this.usehref = attributes.usehref || "";
  50089. this.w = (0, _utils.getMeasurement)(attributes.w);
  50090. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  50091. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  50092. this.desc = null;
  50093. this.extras = null;
  50094. }
  50095. [_xfa_object.$toHTML](availableSpace) {
  50096. const left = (0, _html_utils.measureToString)(this.x);
  50097. const top = (0, _html_utils.measureToString)(this.y);
  50098. const style = {
  50099. position: "absolute",
  50100. left,
  50101. top,
  50102. width: (0, _html_utils.measureToString)(this.w),
  50103. height: (0, _html_utils.measureToString)(this.h)
  50104. };
  50105. return _utils.HTMLResult.success({
  50106. name: "div",
  50107. children: [],
  50108. attributes: {
  50109. style,
  50110. class: "xfaContentarea",
  50111. id: this[_xfa_object.$uid]
  50112. }
  50113. });
  50114. }
  50115. }
  50116. class Corner extends _xfa_object.XFAObject {
  50117. constructor(attributes) {
  50118. super(TEMPLATE_NS_ID, "corner", true);
  50119. this.id = attributes.id || "";
  50120. this.inverted = (0, _utils.getInteger)({
  50121. data: attributes.inverted,
  50122. defaultValue: 0,
  50123. validate: x => x === 1
  50124. });
  50125. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  50126. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50127. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  50128. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  50129. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  50130. this.use = attributes.use || "";
  50131. this.usehref = attributes.usehref || "";
  50132. this.color = null;
  50133. this.extras = null;
  50134. }
  50135. [_xfa_object.$toStyle]() {
  50136. const style = (0, _html_utils.toStyle)(this, "visibility");
  50137. style.radius = (0, _html_utils.measureToString)(this.radius);
  50138. return style;
  50139. }
  50140. }
  50141. class DateElement extends _xfa_object.ContentObject {
  50142. constructor(attributes) {
  50143. super(TEMPLATE_NS_ID, "date");
  50144. this.id = attributes.id || "";
  50145. this.name = attributes.name || "";
  50146. this.use = attributes.use || "";
  50147. this.usehref = attributes.usehref || "";
  50148. }
  50149. [_xfa_object.$finalize]() {
  50150. this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim());
  50151. }
  50152. [_xfa_object.$toHTML](availableSpace) {
  50153. return _utils.HTMLResult.success(this[_xfa_object.$content].toString());
  50154. }
  50155. }
  50156. class DateTime extends _xfa_object.ContentObject {
  50157. constructor(attributes) {
  50158. super(TEMPLATE_NS_ID, "dateTime");
  50159. this.id = attributes.id || "";
  50160. this.name = attributes.name || "";
  50161. this.use = attributes.use || "";
  50162. this.usehref = attributes.usehref || "";
  50163. }
  50164. [_xfa_object.$finalize]() {
  50165. this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim());
  50166. }
  50167. [_xfa_object.$toHTML](availableSpace) {
  50168. return _utils.HTMLResult.success(this[_xfa_object.$content].toString());
  50169. }
  50170. }
  50171. class DateTimeEdit extends _xfa_object.XFAObject {
  50172. constructor(attributes) {
  50173. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  50174. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  50175. this.id = attributes.id || "";
  50176. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  50177. this.use = attributes.use || "";
  50178. this.usehref = attributes.usehref || "";
  50179. this.border = null;
  50180. this.comb = null;
  50181. this.extras = null;
  50182. this.margin = null;
  50183. }
  50184. [_xfa_object.$toHTML](availableSpace) {
  50185. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  50186. const html = {
  50187. name: "input",
  50188. attributes: {
  50189. type: "text",
  50190. fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid],
  50191. class: "xfaTextfield",
  50192. style
  50193. }
  50194. };
  50195. return _utils.HTMLResult.success({
  50196. name: "label",
  50197. attributes: {
  50198. class: "xfaLabel"
  50199. },
  50200. children: [html]
  50201. });
  50202. }
  50203. }
  50204. class Decimal extends _xfa_object.ContentObject {
  50205. constructor(attributes) {
  50206. super(TEMPLATE_NS_ID, "decimal");
  50207. this.fracDigits = (0, _utils.getInteger)({
  50208. data: attributes.fracDigits,
  50209. defaultValue: 2,
  50210. validate: x => true
  50211. });
  50212. this.id = attributes.id || "";
  50213. this.leadDigits = (0, _utils.getInteger)({
  50214. data: attributes.leadDigits,
  50215. defaultValue: -1,
  50216. validate: x => true
  50217. });
  50218. this.name = attributes.name || "";
  50219. this.use = attributes.use || "";
  50220. this.usehref = attributes.usehref || "";
  50221. }
  50222. [_xfa_object.$finalize]() {
  50223. const number = parseFloat(this[_xfa_object.$content].trim());
  50224. this[_xfa_object.$content] = isNaN(number) ? null : number;
  50225. }
  50226. [_xfa_object.$toHTML](availableSpace) {
  50227. return _utils.HTMLResult.success(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  50228. }
  50229. }
  50230. class DefaultUi extends _xfa_object.XFAObject {
  50231. constructor(attributes) {
  50232. super(TEMPLATE_NS_ID, "defaultUi", true);
  50233. this.id = attributes.id || "";
  50234. this.use = attributes.use || "";
  50235. this.usehref = attributes.usehref || "";
  50236. this.extras = null;
  50237. }
  50238. }
  50239. class Desc extends _xfa_object.XFAObject {
  50240. constructor(attributes) {
  50241. super(TEMPLATE_NS_ID, "desc", true);
  50242. this.id = attributes.id || "";
  50243. this.use = attributes.use || "";
  50244. this.usehref = attributes.usehref || "";
  50245. this.boolean = new _xfa_object.XFAObjectArray();
  50246. this.date = new _xfa_object.XFAObjectArray();
  50247. this.dateTime = new _xfa_object.XFAObjectArray();
  50248. this.decimal = new _xfa_object.XFAObjectArray();
  50249. this.exData = new _xfa_object.XFAObjectArray();
  50250. this.float = new _xfa_object.XFAObjectArray();
  50251. this.image = new _xfa_object.XFAObjectArray();
  50252. this.integer = new _xfa_object.XFAObjectArray();
  50253. this.text = new _xfa_object.XFAObjectArray();
  50254. this.time = new _xfa_object.XFAObjectArray();
  50255. }
  50256. }
  50257. class DigestMethod extends _xfa_object.OptionObject {
  50258. constructor(attributes) {
  50259. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  50260. this.id = attributes.id || "";
  50261. this.use = attributes.use || "";
  50262. this.usehref = attributes.usehref || "";
  50263. }
  50264. }
  50265. class DigestMethods extends _xfa_object.XFAObject {
  50266. constructor(attributes) {
  50267. super(TEMPLATE_NS_ID, "digestMethods", true);
  50268. this.id = attributes.id || "";
  50269. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50270. this.use = attributes.use || "";
  50271. this.usehref = attributes.usehref || "";
  50272. this.digestMethod = new _xfa_object.XFAObjectArray();
  50273. }
  50274. }
  50275. class Draw extends _xfa_object.XFAObject {
  50276. constructor(attributes) {
  50277. super(TEMPLATE_NS_ID, "draw", true);
  50278. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  50279. this.colSpan = (0, _utils.getInteger)({
  50280. data: attributes.colSpan,
  50281. defaultValue: 1,
  50282. validate: n => n >= 1 || n === -1
  50283. });
  50284. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  50285. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  50286. this.id = attributes.id || "";
  50287. this.locale = attributes.locale || "";
  50288. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  50289. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  50290. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  50291. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  50292. this.name = attributes.name || "";
  50293. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50294. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50295. this.rotate = (0, _utils.getInteger)({
  50296. data: attributes.rotate,
  50297. defaultValue: 0,
  50298. validate: x => x % 90 === 0
  50299. });
  50300. this.use = attributes.use || "";
  50301. this.usehref = attributes.usehref || "";
  50302. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  50303. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  50304. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  50305. this.assist = null;
  50306. this.border = null;
  50307. this.caption = null;
  50308. this.desc = null;
  50309. this.extras = null;
  50310. this.font = null;
  50311. this.keep = null;
  50312. this.margin = null;
  50313. this.para = null;
  50314. this.traversal = null;
  50315. this.ui = null;
  50316. this.value = null;
  50317. this.setProperty = new _xfa_object.XFAObjectArray();
  50318. }
  50319. [_xfa_object.$setValue](value) {
  50320. _setValue(this, value);
  50321. }
  50322. [_xfa_object.$toHTML](availableSpace) {
  50323. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  50324. return _utils.HTMLResult.EMPTY;
  50325. }
  50326. (0, _html_utils.fixDimensions)(this);
  50327. if (this.w !== "" && this.h === "" && this.value) {
  50328. const text = this.value[_xfa_object.$text]();
  50329. if (text) {
  50330. const {
  50331. height
  50332. } = (0, _html_utils.layoutText)(text, this.font.size, {
  50333. width: this.w,
  50334. height: Infinity
  50335. });
  50336. this.h = height || "";
  50337. }
  50338. }
  50339. switch (checkDimensions(this, availableSpace)) {
  50340. case NOTHING:
  50341. return _utils.HTMLResult.EMPTY;
  50342. case NOSPACE:
  50343. return _utils.HTMLResult.FAILURE;
  50344. default:
  50345. break;
  50346. }
  50347. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "borderMarginPadding");
  50348. const classNames = ["xfaDraw"];
  50349. if (this.font) {
  50350. classNames.push("xfaFont");
  50351. }
  50352. const attributes = {
  50353. style,
  50354. id: this[_xfa_object.$uid],
  50355. class: classNames.join(" ")
  50356. };
  50357. if (this.name) {
  50358. attributes.xfaName = this.name;
  50359. }
  50360. const html = {
  50361. name: "div",
  50362. attributes,
  50363. children: []
  50364. };
  50365. const extra = (0, _html_utils.addExtraDivForBorder)(html);
  50366. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  50367. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  50368. if (value === null) {
  50369. return _utils.HTMLResult.success(extra, bbox);
  50370. }
  50371. html.children.push(value);
  50372. if (value.attributes.class === "xfaRich") {
  50373. if (this.h === "") {
  50374. style.height = "auto";
  50375. }
  50376. if (this.w === "") {
  50377. style.width = "auto";
  50378. }
  50379. if (this.para) {
  50380. attributes.style.display = "flex";
  50381. attributes.style.flexDirection = "column";
  50382. switch (this.para.vAlign) {
  50383. case "top":
  50384. attributes.style.justifyContent = "start";
  50385. break;
  50386. case "bottom":
  50387. attributes.style.justifyContent = "end";
  50388. break;
  50389. case "middle":
  50390. attributes.style.justifyContent = "center";
  50391. break;
  50392. }
  50393. const paraStyle = this.para[_xfa_object.$toStyle]();
  50394. if (!value.attributes.style) {
  50395. value.attributes.style = paraStyle;
  50396. } else {
  50397. for (const [key, val] of Object.entries(paraStyle)) {
  50398. if (!(key in value.attributes.style)) {
  50399. value.attributes.style[key] = val;
  50400. }
  50401. }
  50402. }
  50403. }
  50404. }
  50405. return _utils.HTMLResult.success(extra, bbox);
  50406. }
  50407. }
  50408. class Edge extends _xfa_object.XFAObject {
  50409. constructor(attributes) {
  50410. super(TEMPLATE_NS_ID, "edge", true);
  50411. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  50412. this.id = attributes.id || "";
  50413. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50414. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  50415. this.thickness = Math.max(1, Math.round((0, _utils.getMeasurement)(attributes.thickness, "0.5pt")));
  50416. this.use = attributes.use || "";
  50417. this.usehref = attributes.usehref || "";
  50418. this.color = null;
  50419. this.extras = null;
  50420. }
  50421. [_xfa_object.$toStyle]() {
  50422. const style = (0, _html_utils.toStyle)(this, "visibility");
  50423. Object.assign(style, {
  50424. linecap: this.cap,
  50425. width: (0, _html_utils.measureToString)(Math.max(1, Math.round(this.thickness))),
  50426. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  50427. style: ""
  50428. });
  50429. if (this.presence !== "visible") {
  50430. style.style = "none";
  50431. } else {
  50432. switch (this.stroke) {
  50433. case "solid":
  50434. style.style = "solid";
  50435. break;
  50436. case "dashDot":
  50437. style.style = "dashed";
  50438. break;
  50439. case "dashDotDot":
  50440. style.style = "dashed";
  50441. break;
  50442. case "dashed":
  50443. style.style = "dashed";
  50444. break;
  50445. case "dotted":
  50446. style.style = "dotted";
  50447. break;
  50448. case "embossed":
  50449. style.style = "ridge";
  50450. break;
  50451. case "etched":
  50452. style.style = "groove";
  50453. break;
  50454. case "lowered":
  50455. style.style = "inset";
  50456. break;
  50457. case "raised":
  50458. style.style = "outset";
  50459. break;
  50460. }
  50461. }
  50462. return style;
  50463. }
  50464. }
  50465. class Encoding extends _xfa_object.OptionObject {
  50466. constructor(attributes) {
  50467. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  50468. this.id = attributes.id || "";
  50469. this.use = attributes.use || "";
  50470. this.usehref = attributes.usehref || "";
  50471. }
  50472. }
  50473. class Encodings extends _xfa_object.XFAObject {
  50474. constructor(attributes) {
  50475. super(TEMPLATE_NS_ID, "encodings", true);
  50476. this.id = attributes.id || "";
  50477. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50478. this.use = attributes.use || "";
  50479. this.usehref = attributes.usehref || "";
  50480. this.encoding = new _xfa_object.XFAObjectArray();
  50481. }
  50482. }
  50483. class Encrypt extends _xfa_object.XFAObject {
  50484. constructor(attributes) {
  50485. super(TEMPLATE_NS_ID, "encrypt", true);
  50486. this.id = attributes.id || "";
  50487. this.use = attributes.use || "";
  50488. this.usehref = attributes.usehref || "";
  50489. this.certificate = null;
  50490. }
  50491. }
  50492. class EncryptData extends _xfa_object.XFAObject {
  50493. constructor(attributes) {
  50494. super(TEMPLATE_NS_ID, "encryptData", true);
  50495. this.id = attributes.id || "";
  50496. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  50497. this.target = attributes.target || "";
  50498. this.use = attributes.use || "";
  50499. this.usehref = attributes.usehref || "";
  50500. this.filter = null;
  50501. this.manifest = null;
  50502. }
  50503. }
  50504. class Encryption extends _xfa_object.XFAObject {
  50505. constructor(attributes) {
  50506. super(TEMPLATE_NS_ID, "encryption", true);
  50507. this.id = attributes.id || "";
  50508. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50509. this.use = attributes.use || "";
  50510. this.usehref = attributes.usehref || "";
  50511. this.certificate = new _xfa_object.XFAObjectArray();
  50512. }
  50513. }
  50514. class EncryptionMethod extends _xfa_object.OptionObject {
  50515. constructor(attributes) {
  50516. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  50517. this.id = attributes.id || "";
  50518. this.use = attributes.use || "";
  50519. this.usehref = attributes.usehref || "";
  50520. }
  50521. }
  50522. class EncryptionMethods extends _xfa_object.XFAObject {
  50523. constructor(attributes) {
  50524. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  50525. this.id = attributes.id || "";
  50526. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50527. this.use = attributes.use || "";
  50528. this.usehref = attributes.usehref || "";
  50529. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  50530. }
  50531. }
  50532. class Event extends _xfa_object.XFAObject {
  50533. constructor(attributes) {
  50534. super(TEMPLATE_NS_ID, "event", true);
  50535. 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"]);
  50536. this.id = attributes.id || "";
  50537. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  50538. this.name = attributes.name || "";
  50539. this.ref = attributes.ref || "";
  50540. this.use = attributes.use || "";
  50541. this.usehref = attributes.usehref || "";
  50542. this.extras = null;
  50543. this.encryptData = null;
  50544. this.execute = null;
  50545. this.script = null;
  50546. this.signData = null;
  50547. this.submit = null;
  50548. }
  50549. }
  50550. class ExData extends _xfa_object.ContentObject {
  50551. constructor(attributes) {
  50552. super(TEMPLATE_NS_ID, "exData");
  50553. this.contentType = attributes.contentType || "";
  50554. this.href = attributes.href || "";
  50555. this.id = attributes.id || "";
  50556. this.maxLength = (0, _utils.getInteger)({
  50557. data: attributes.maxLength,
  50558. defaultValue: -1,
  50559. validate: x => x >= -1
  50560. });
  50561. this.name = attributes.name || "";
  50562. this.rid = attributes.rid || "";
  50563. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  50564. this.use = attributes.use || "";
  50565. this.usehref = attributes.usehref || "";
  50566. }
  50567. [_xfa_object.$onChild](child) {
  50568. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  50569. this[_xfa_object.$content] = child;
  50570. return true;
  50571. }
  50572. if (this.contentType === "text/xml") {
  50573. this[_xfa_object.$content] = child;
  50574. return true;
  50575. }
  50576. return false;
  50577. }
  50578. [_xfa_object.$toHTML](availableSpace) {
  50579. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  50580. return _utils.HTMLResult.EMPTY;
  50581. }
  50582. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  50583. }
  50584. }
  50585. class ExObject extends _xfa_object.XFAObject {
  50586. constructor(attributes) {
  50587. super(TEMPLATE_NS_ID, "exObject", true);
  50588. this.archive = attributes.archive || "";
  50589. this.classId = attributes.classId || "";
  50590. this.codeBase = attributes.codeBase || "";
  50591. this.codeType = attributes.codeType || "";
  50592. this.id = attributes.id || "";
  50593. this.name = attributes.name || "";
  50594. this.use = attributes.use || "";
  50595. this.usehref = attributes.usehref || "";
  50596. this.extras = null;
  50597. this.boolean = new _xfa_object.XFAObjectArray();
  50598. this.date = new _xfa_object.XFAObjectArray();
  50599. this.dateTime = new _xfa_object.XFAObjectArray();
  50600. this.decimal = new _xfa_object.XFAObjectArray();
  50601. this.exData = new _xfa_object.XFAObjectArray();
  50602. this.exObject = new _xfa_object.XFAObjectArray();
  50603. this.float = new _xfa_object.XFAObjectArray();
  50604. this.image = new _xfa_object.XFAObjectArray();
  50605. this.integer = new _xfa_object.XFAObjectArray();
  50606. this.text = new _xfa_object.XFAObjectArray();
  50607. this.time = new _xfa_object.XFAObjectArray();
  50608. }
  50609. }
  50610. class ExclGroup extends _xfa_object.XFAObject {
  50611. constructor(attributes) {
  50612. super(TEMPLATE_NS_ID, "exclGroup", true);
  50613. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  50614. this.accessKey = attributes.accessKey || "";
  50615. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  50616. this.colSpan = (0, _utils.getInteger)({
  50617. data: attributes.colSpan,
  50618. defaultValue: 1,
  50619. validate: n => n >= 1 || n === -1
  50620. });
  50621. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  50622. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  50623. this.id = attributes.id || "";
  50624. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  50625. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  50626. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  50627. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  50628. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  50629. this.name = attributes.name || "";
  50630. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50631. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50632. this.use = attributes.use || "";
  50633. this.usehref = attributes.usehref || "";
  50634. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  50635. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  50636. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  50637. this.assist = null;
  50638. this.bind = null;
  50639. this.border = null;
  50640. this.calculate = null;
  50641. this.caption = null;
  50642. this.desc = null;
  50643. this.extras = null;
  50644. this.margin = null;
  50645. this.para = null;
  50646. this.traversal = null;
  50647. this.validate = null;
  50648. this.connect = new _xfa_object.XFAObjectArray();
  50649. this.event = new _xfa_object.XFAObjectArray();
  50650. this.field = new _xfa_object.XFAObjectArray();
  50651. this.setProperty = new _xfa_object.XFAObjectArray();
  50652. }
  50653. [_xfa_object.$hasSettableValue]() {
  50654. return true;
  50655. }
  50656. [_xfa_object.$setValue](value) {
  50657. for (const field of this.field.children) {
  50658. if (!field.value) {
  50659. const nodeValue = new Value({});
  50660. field[_xfa_object.$appendChild](nodeValue);
  50661. field.value = nodeValue;
  50662. }
  50663. const nodeBoolean = new BooleanElement({});
  50664. nodeBoolean[_xfa_object.$content] = 0;
  50665. for (const item of field.items.children) {
  50666. if (item[_xfa_object.$hasItem](value)) {
  50667. nodeBoolean[_xfa_object.$content] = 1;
  50668. break;
  50669. }
  50670. }
  50671. field.value[_xfa_object.$setValue](nodeBoolean);
  50672. }
  50673. }
  50674. [_xfa_object.$flushHTML]() {
  50675. return (0, _layout.flushHTML)(this);
  50676. }
  50677. [_xfa_object.$addHTML](html, bbox) {
  50678. (0, _layout.addHTML)(this, html, bbox);
  50679. }
  50680. [_xfa_object.$getAvailableSpace]() {
  50681. return (0, _layout.getAvailableSpace)(this);
  50682. }
  50683. [_xfa_object.$toHTML](availableSpace) {
  50684. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  50685. return _utils.HTMLResult.EMPTY;
  50686. }
  50687. (0, _html_utils.fixDimensions)(this);
  50688. const children = [];
  50689. const attributes = {
  50690. id: this[_xfa_object.$uid]
  50691. };
  50692. if (!this[_xfa_object.$extra]) {
  50693. this[_xfa_object.$extra] = Object.create(null);
  50694. }
  50695. Object.assign(this[_xfa_object.$extra], {
  50696. children,
  50697. attributes,
  50698. attempt: 0,
  50699. availableSpace,
  50700. width: 0,
  50701. height: 0,
  50702. prevHeight: 0,
  50703. currentWidth: 0
  50704. });
  50705. switch (checkDimensions(this, availableSpace)) {
  50706. case NOTHING:
  50707. return _utils.HTMLResult.EMPTY;
  50708. case NOSPACE:
  50709. return _utils.HTMLResult.FAILURE;
  50710. default:
  50711. break;
  50712. }
  50713. availableSpace = {
  50714. width: this.w === "" ? availableSpace.width : this.w,
  50715. height: this.h === "" ? availableSpace.height : this.h
  50716. };
  50717. const filter = new Set(["field"]);
  50718. if (this.layout === "row") {
  50719. const columnWidths = this[_xfa_object.$getParent]().columnWidths;
  50720. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  50721. this[_xfa_object.$extra].columnWidths = columnWidths;
  50722. this[_xfa_object.$extra].currentColumn = 0;
  50723. }
  50724. }
  50725. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "borderMarginPadding", "hAlign");
  50726. const classNames = ["xfaExclgroup"];
  50727. const cl = (0, _html_utils.layoutClass)(this);
  50728. if (cl) {
  50729. classNames.push(cl);
  50730. }
  50731. attributes.style = style;
  50732. attributes.class = classNames.join(" ");
  50733. if (this.name) {
  50734. attributes.xfaName = this.name;
  50735. }
  50736. let failure;
  50737. if (this.layout === "lr-tb" || this.layout === "rl-tb") {
  50738. for (; this[_xfa_object.$extra].attempt < MAX_ATTEMPTS_FOR_LRTB_LAYOUT; this[_xfa_object.$extra].attempt++) {
  50739. if (this[_xfa_object.$childrenToHTML]({
  50740. filter,
  50741. include: true
  50742. })) {
  50743. break;
  50744. }
  50745. }
  50746. failure = this[_xfa_object.$extra].attempt === 2;
  50747. } else {
  50748. failure = !this[_xfa_object.$childrenToHTML]({
  50749. filter,
  50750. include: true
  50751. });
  50752. }
  50753. if (failure) {
  50754. return _utils.HTMLResult.FAILURE;
  50755. }
  50756. let marginH = 0;
  50757. let marginV = 0;
  50758. if (this.margin) {
  50759. marginH = this.margin.leftInset + this.margin.rightInset;
  50760. marginV = this.margin.topInset + this.margin.bottomInset;
  50761. }
  50762. if (this.w === "") {
  50763. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width + marginH);
  50764. }
  50765. if (this.h === "") {
  50766. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height + marginV);
  50767. }
  50768. let html = {
  50769. name: "div",
  50770. attributes,
  50771. children
  50772. };
  50773. html = (0, _html_utils.addExtraDivForBorder)(html);
  50774. let bbox;
  50775. if (this.w !== "" && this.h !== "") {
  50776. bbox = [this.x, this.y, this.w, this.h];
  50777. } else {
  50778. const width = this.w === "" ? marginH + this[_xfa_object.$extra].width : this.w;
  50779. const height = this.h === "" ? marginV + this[_xfa_object.$extra].height : this.h;
  50780. bbox = [this.x, this.y, width, height];
  50781. }
  50782. delete this[_xfa_object.$extra];
  50783. return _utils.HTMLResult.success(html, bbox);
  50784. }
  50785. }
  50786. class Execute extends _xfa_object.XFAObject {
  50787. constructor(attributes) {
  50788. super(TEMPLATE_NS_ID, "execute");
  50789. this.connection = attributes.connection || "";
  50790. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  50791. this.id = attributes.id || "";
  50792. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  50793. this.use = attributes.use || "";
  50794. this.usehref = attributes.usehref || "";
  50795. }
  50796. }
  50797. class Extras extends _xfa_object.XFAObject {
  50798. constructor(attributes) {
  50799. super(TEMPLATE_NS_ID, "extras", true);
  50800. this.id = attributes.id || "";
  50801. this.name = attributes.name || "";
  50802. this.use = attributes.use || "";
  50803. this.usehref = attributes.usehref || "";
  50804. this.boolean = new _xfa_object.XFAObjectArray();
  50805. this.date = new _xfa_object.XFAObjectArray();
  50806. this.dateTime = new _xfa_object.XFAObjectArray();
  50807. this.decimal = new _xfa_object.XFAObjectArray();
  50808. this.exData = new _xfa_object.XFAObjectArray();
  50809. this.extras = new _xfa_object.XFAObjectArray();
  50810. this.float = new _xfa_object.XFAObjectArray();
  50811. this.image = new _xfa_object.XFAObjectArray();
  50812. this.integer = new _xfa_object.XFAObjectArray();
  50813. this.text = new _xfa_object.XFAObjectArray();
  50814. this.time = new _xfa_object.XFAObjectArray();
  50815. }
  50816. }
  50817. class Field extends _xfa_object.XFAObject {
  50818. constructor(attributes) {
  50819. super(TEMPLATE_NS_ID, "field", true);
  50820. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  50821. this.accessKey = attributes.accessKey || "";
  50822. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  50823. this.colSpan = (0, _utils.getInteger)({
  50824. data: attributes.colSpan,
  50825. defaultValue: 1,
  50826. validate: n => n >= 1 || n === -1
  50827. });
  50828. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  50829. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  50830. this.id = attributes.id || "";
  50831. this.locale = attributes.locale || "";
  50832. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  50833. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  50834. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  50835. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  50836. this.name = attributes.name || "";
  50837. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50838. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50839. this.rotate = (0, _utils.getInteger)({
  50840. data: attributes.rotate,
  50841. defaultValue: 0,
  50842. validate: x => x % 90 === 0
  50843. });
  50844. this.use = attributes.use || "";
  50845. this.usehref = attributes.usehref || "";
  50846. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  50847. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  50848. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  50849. this.assist = null;
  50850. this.bind = null;
  50851. this.border = null;
  50852. this.calculate = null;
  50853. this.caption = null;
  50854. this.desc = null;
  50855. this.extras = null;
  50856. this.font = null;
  50857. this.format = null;
  50858. this.items = new _xfa_object.XFAObjectArray(2);
  50859. this.keep = null;
  50860. this.margin = null;
  50861. this.para = null;
  50862. this.traversal = null;
  50863. this.ui = null;
  50864. this.validate = null;
  50865. this.value = null;
  50866. this.bindItems = new _xfa_object.XFAObjectArray();
  50867. this.connect = new _xfa_object.XFAObjectArray();
  50868. this.event = new _xfa_object.XFAObjectArray();
  50869. this.setProperty = new _xfa_object.XFAObjectArray();
  50870. }
  50871. [_xfa_object.$setValue](value) {
  50872. _setValue(this, value);
  50873. }
  50874. [_xfa_object.$toHTML](availableSpace) {
  50875. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  50876. return _utils.HTMLResult.EMPTY;
  50877. }
  50878. (0, _html_utils.fixDimensions)(this);
  50879. switch (checkDimensions(this, availableSpace)) {
  50880. case NOTHING:
  50881. return _utils.HTMLResult.EMPTY;
  50882. case NOSPACE:
  50883. return _utils.HTMLResult.FAILURE;
  50884. default:
  50885. break;
  50886. }
  50887. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "borderMarginPadding", "hAlign");
  50888. const classNames = ["xfaField"];
  50889. if (this.font) {
  50890. classNames.push("xfaFont");
  50891. }
  50892. const attributes = {
  50893. style,
  50894. id: this[_xfa_object.$uid],
  50895. class: classNames.join(" ")
  50896. };
  50897. if (this.name) {
  50898. attributes.xfaName = this.name;
  50899. }
  50900. const children = [];
  50901. let html = {
  50902. name: "div",
  50903. attributes,
  50904. children
  50905. };
  50906. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  50907. html = (0, _html_utils.addExtraDivForBorder)(html);
  50908. const ui = this.ui ? this.ui[_xfa_object.$toHTML]().html : null;
  50909. if (!ui) {
  50910. return _utils.HTMLResult.success(html, bbox);
  50911. }
  50912. if (!ui.attributes.style) {
  50913. ui.attributes.style = Object.create(null);
  50914. }
  50915. children.push(ui);
  50916. if (this.value) {
  50917. if (this.ui.imageEdit) {
  50918. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  50919. } else if (ui.name !== "button") {
  50920. const value = this.value[_xfa_object.$toHTML]().html;
  50921. if (value) {
  50922. if (ui.children[0].name === "textarea") {
  50923. ui.children[0].attributes.textContent = value.value;
  50924. } else {
  50925. ui.children[0].attributes.value = value.value;
  50926. }
  50927. }
  50928. }
  50929. }
  50930. const caption = this.caption ? this.caption[_xfa_object.$toHTML]().html : null;
  50931. if (!caption) {
  50932. return _utils.HTMLResult.success(html, bbox);
  50933. }
  50934. if (ui.name === "button") {
  50935. ui.attributes.style.background = style.background;
  50936. delete style.background;
  50937. if (caption.name === "div") {
  50938. caption.name = "span";
  50939. }
  50940. ui.children.push(caption);
  50941. return _utils.HTMLResult.success(html, bbox);
  50942. }
  50943. ui.children.splice(0, 0, caption);
  50944. switch (this.caption.placement) {
  50945. case "left":
  50946. ui.attributes.style.flexDirection = "row";
  50947. break;
  50948. case "right":
  50949. ui.attributes.style.flexDirection = "row-reverse";
  50950. break;
  50951. case "top":
  50952. ui.attributes.style.alignItems = "start";
  50953. ui.attributes.style.flexDirection = "column";
  50954. break;
  50955. case "bottom":
  50956. ui.attributes.style.alignItems = "start";
  50957. ui.attributes.style.flexDirection = "column-reverse";
  50958. break;
  50959. case "inline":
  50960. delete ui.attributes.class;
  50961. caption.attributes.style.float = "left";
  50962. break;
  50963. }
  50964. return _utils.HTMLResult.success(html, bbox);
  50965. }
  50966. }
  50967. exports.Field = Field;
  50968. class Fill extends _xfa_object.XFAObject {
  50969. constructor(attributes) {
  50970. super(TEMPLATE_NS_ID, "fill", true);
  50971. this.id = attributes.id || "";
  50972. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50973. this.use = attributes.use || "";
  50974. this.usehref = attributes.usehref || "";
  50975. this.color = null;
  50976. this.extras = null;
  50977. this.linear = null;
  50978. this.pattern = null;
  50979. this.radial = null;
  50980. this.solid = null;
  50981. this.stipple = null;
  50982. }
  50983. [_xfa_object.$toStyle]() {
  50984. const parent = this[_xfa_object.$getParent]();
  50985. let propName = "color";
  50986. if (parent instanceof Border) {
  50987. propName = "background";
  50988. }
  50989. const style = Object.create(null);
  50990. for (const name of Object.getOwnPropertyNames(this)) {
  50991. if (name === "extras" || name === "color") {
  50992. continue;
  50993. }
  50994. const obj = this[name];
  50995. if (!(obj instanceof _xfa_object.XFAObject)) {
  50996. continue;
  50997. }
  50998. style[propName] = obj[_xfa_object.$toStyle](this.color);
  50999. return style;
  51000. }
  51001. if (this.color) {
  51002. style[propName] = this.color[_xfa_object.$toStyle]();
  51003. }
  51004. return style;
  51005. }
  51006. }
  51007. class Filter extends _xfa_object.XFAObject {
  51008. constructor(attributes) {
  51009. super(TEMPLATE_NS_ID, "filter", true);
  51010. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  51011. this.id = attributes.id || "";
  51012. this.name = attributes.name || "";
  51013. this.use = attributes.use || "";
  51014. this.usehref = attributes.usehref || "";
  51015. this.version = (0, _utils.getInteger)({
  51016. data: this.version,
  51017. defaultValue: 5,
  51018. validate: x => x >= 1 && x <= 5
  51019. });
  51020. this.appearanceFilter = null;
  51021. this.certificates = null;
  51022. this.digestMethods = null;
  51023. this.encodings = null;
  51024. this.encryptionMethods = null;
  51025. this.handler = null;
  51026. this.lockDocument = null;
  51027. this.mdp = null;
  51028. this.reasons = null;
  51029. this.timeStamp = null;
  51030. }
  51031. }
  51032. class Float extends _xfa_object.ContentObject {
  51033. constructor(attributes) {
  51034. super(TEMPLATE_NS_ID, "float");
  51035. this.id = attributes.id || "";
  51036. this.name = attributes.name || "";
  51037. this.use = attributes.use || "";
  51038. this.usehref = attributes.usehref || "";
  51039. }
  51040. [_xfa_object.$finalize]() {
  51041. const number = parseFloat(this[_xfa_object.$content].trim());
  51042. this[_xfa_object.$content] = isNaN(number) ? null : number;
  51043. }
  51044. [_xfa_object.$toHTML](availableSpace) {
  51045. return _utils.HTMLResult.success(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  51046. }
  51047. }
  51048. class Font extends _xfa_object.XFAObject {
  51049. constructor(attributes) {
  51050. super(TEMPLATE_NS_ID, "font", true);
  51051. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  51052. this.fontHorizontalScale = (0, _utils.getFloat)({
  51053. data: attributes.fontHorizontalScale,
  51054. defaultValue: 100,
  51055. validate: x => x >= 0
  51056. });
  51057. this.fontVerticalScale = (0, _utils.getFloat)({
  51058. data: attributes.fontVerticalScale,
  51059. defaultValue: 100,
  51060. validate: x => x >= 0
  51061. });
  51062. this.id = attributes.id || "";
  51063. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  51064. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  51065. this.lineThrough = (0, _utils.getInteger)({
  51066. data: attributes.lineThrough,
  51067. defaultValue: 0,
  51068. validate: x => x === 1 || x === 2
  51069. });
  51070. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  51071. this.overline = (0, _utils.getInteger)({
  51072. data: attributes.overline,
  51073. defaultValue: 0,
  51074. validate: x => x === 1 || x === 2
  51075. });
  51076. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  51077. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  51078. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  51079. this.typeface = attributes.typeface || "";
  51080. this.underline = (0, _utils.getInteger)({
  51081. data: attributes.underline,
  51082. defaultValue: 0,
  51083. validate: x => x === 1 || x === 2
  51084. });
  51085. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  51086. this.use = attributes.use || "";
  51087. this.usehref = attributes.usehref || "";
  51088. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  51089. this.extras = null;
  51090. this.fill = null;
  51091. }
  51092. [_xfa_object.$toStyle]() {
  51093. const style = (0, _html_utils.toStyle)(this, "fill");
  51094. const color = style.color;
  51095. if (color) {
  51096. if (color === "#000000") {
  51097. delete style.color;
  51098. } else if (!color.startsWith("#")) {
  51099. style.background = color;
  51100. style.backgroundClip = "text";
  51101. style.color = "transparent";
  51102. }
  51103. }
  51104. if (this.baselineShift) {
  51105. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  51106. }
  51107. if (this.kerningMode !== "none") {
  51108. style.fontKerning = "normal";
  51109. }
  51110. if (this.letterSpacing) {
  51111. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  51112. }
  51113. if (this.lineThrough !== 0) {
  51114. style.textDecoration = "line-through";
  51115. if (this.lineThrough === 2) {
  51116. style.textDecorationStyle = "double";
  51117. }
  51118. }
  51119. if (this.overline !== 0) {
  51120. style.textDecoration = "overline";
  51121. if (this.overline === 2) {
  51122. style.textDecorationStyle = "double";
  51123. }
  51124. }
  51125. if (this.posture !== "normal") {
  51126. style.fontStyle = this.posture;
  51127. }
  51128. const fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  51129. if (fontSize !== "10px") {
  51130. style.fontSize = fontSize;
  51131. }
  51132. style.fontFamily = (0, _html_utils.getFonts)(this.typeface);
  51133. if (this.underline !== 0) {
  51134. style.textDecoration = "underline";
  51135. if (this.underline === 2) {
  51136. style.textDecorationStyle = "double";
  51137. }
  51138. }
  51139. if (this.weight !== "normal") {
  51140. style.fontWeight = this.weight;
  51141. }
  51142. return style;
  51143. }
  51144. }
  51145. class Format extends _xfa_object.XFAObject {
  51146. constructor(attributes) {
  51147. super(TEMPLATE_NS_ID, "format", true);
  51148. this.id = attributes.id || "";
  51149. this.use = attributes.use || "";
  51150. this.usehref = attributes.usehref || "";
  51151. this.extras = null;
  51152. this.picture = null;
  51153. }
  51154. }
  51155. class Handler extends _xfa_object.StringObject {
  51156. constructor(attributes) {
  51157. super(TEMPLATE_NS_ID, "handler");
  51158. this.id = attributes.id || "";
  51159. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51160. this.use = attributes.use || "";
  51161. this.usehref = attributes.usehref || "";
  51162. }
  51163. }
  51164. class Hyphenation extends _xfa_object.XFAObject {
  51165. constructor(attributes) {
  51166. super(TEMPLATE_NS_ID, "hyphenation");
  51167. this.excludeAllCaps = (0, _utils.getInteger)({
  51168. data: attributes.excludeAllCaps,
  51169. defaultValue: 0,
  51170. validate: x => x === 1
  51171. });
  51172. this.excludeInitialCap = (0, _utils.getInteger)({
  51173. data: attributes.excludeInitialCap,
  51174. defaultValue: 0,
  51175. validate: x => x === 1
  51176. });
  51177. this.hyphenate = (0, _utils.getInteger)({
  51178. data: attributes.hyphenate,
  51179. defaultValue: 0,
  51180. validate: x => x === 1
  51181. });
  51182. this.id = attributes.id || "";
  51183. this.pushCharacterCount = (0, _utils.getInteger)({
  51184. data: attributes.pushCharacterCount,
  51185. defaultValue: 3,
  51186. validate: x => x >= 0
  51187. });
  51188. this.remainCharacterCount = (0, _utils.getInteger)({
  51189. data: attributes.remainCharacterCount,
  51190. defaultValue: 3,
  51191. validate: x => x >= 0
  51192. });
  51193. this.use = attributes.use || "";
  51194. this.usehref = attributes.usehref || "";
  51195. this.wordCharacterCount = (0, _utils.getInteger)({
  51196. data: attributes.wordCharacterCount,
  51197. defaultValue: 7,
  51198. validate: x => x >= 0
  51199. });
  51200. }
  51201. }
  51202. class Image extends _xfa_object.StringObject {
  51203. constructor(attributes) {
  51204. super(TEMPLATE_NS_ID, "image");
  51205. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  51206. this.contentType = attributes.contentType || "";
  51207. this.href = attributes.href || "";
  51208. this.id = attributes.id || "";
  51209. this.name = attributes.name || "";
  51210. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  51211. this.use = attributes.use || "";
  51212. this.usehref = attributes.usehref || "";
  51213. }
  51214. [_xfa_object.$toHTML]() {
  51215. if (this.href || !this[_xfa_object.$content]) {
  51216. return _utils.HTMLResult.EMPTY;
  51217. }
  51218. if (this.transferEncoding === "base64") {
  51219. const buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  51220. const blob = new Blob([buffer], {
  51221. type: this.contentType
  51222. });
  51223. return _utils.HTMLResult.success({
  51224. name: "img",
  51225. attributes: {
  51226. class: "xfaImage",
  51227. style: {},
  51228. src: URL.createObjectURL(blob)
  51229. }
  51230. });
  51231. }
  51232. return _utils.HTMLResult.EMPTY;
  51233. }
  51234. }
  51235. class ImageEdit extends _xfa_object.XFAObject {
  51236. constructor(attributes) {
  51237. super(TEMPLATE_NS_ID, "imageEdit", true);
  51238. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  51239. this.id = attributes.id || "";
  51240. this.use = attributes.use || "";
  51241. this.usehref = attributes.usehref || "";
  51242. this.border = null;
  51243. this.extras = null;
  51244. this.margin = null;
  51245. }
  51246. [_xfa_object.$toHTML](availableSpace) {
  51247. if (this.data === "embed") {
  51248. return _utils.HTMLResult.success({
  51249. name: "div",
  51250. children: [],
  51251. attributes: {}
  51252. });
  51253. }
  51254. return _utils.HTMLResult.EMPTY;
  51255. }
  51256. }
  51257. class Integer extends _xfa_object.ContentObject {
  51258. constructor(attributes) {
  51259. super(TEMPLATE_NS_ID, "integer");
  51260. this.id = attributes.id || "";
  51261. this.name = attributes.name || "";
  51262. this.use = attributes.use || "";
  51263. this.usehref = attributes.usehref || "";
  51264. }
  51265. [_xfa_object.$finalize]() {
  51266. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  51267. this[_xfa_object.$content] = isNaN(number) ? null : number;
  51268. }
  51269. [_xfa_object.$toHTML](availableSpace) {
  51270. return _utils.HTMLResult.success(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  51271. }
  51272. }
  51273. class Issuers extends _xfa_object.XFAObject {
  51274. constructor(attributes) {
  51275. super(TEMPLATE_NS_ID, "issuers", true);
  51276. this.id = attributes.id || "";
  51277. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51278. this.use = attributes.use || "";
  51279. this.usehref = attributes.usehref || "";
  51280. this.certificate = new _xfa_object.XFAObjectArray();
  51281. }
  51282. }
  51283. class Items extends _xfa_object.XFAObject {
  51284. constructor(attributes) {
  51285. super(TEMPLATE_NS_ID, "items", true);
  51286. this.id = attributes.id || "";
  51287. this.name = attributes.name || "";
  51288. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  51289. this.ref = attributes.ref || "";
  51290. this.save = (0, _utils.getInteger)({
  51291. data: attributes.save,
  51292. defaultValue: 0,
  51293. validate: x => x === 1
  51294. });
  51295. this.use = attributes.use || "";
  51296. this.usehref = attributes.usehref || "";
  51297. this.boolean = new _xfa_object.XFAObjectArray();
  51298. this.date = new _xfa_object.XFAObjectArray();
  51299. this.dateTime = new _xfa_object.XFAObjectArray();
  51300. this.decimal = new _xfa_object.XFAObjectArray();
  51301. this.exData = new _xfa_object.XFAObjectArray();
  51302. this.float = new _xfa_object.XFAObjectArray();
  51303. this.image = new _xfa_object.XFAObjectArray();
  51304. this.integer = new _xfa_object.XFAObjectArray();
  51305. this.text = new _xfa_object.XFAObjectArray();
  51306. this.time = new _xfa_object.XFAObjectArray();
  51307. }
  51308. [_xfa_object.$hasItem](value) {
  51309. return this.hasOwnProperty(value[_xfa_object.$nodeName]) && this[value[_xfa_object.$nodeName]].children.some(node => node[_xfa_object.$content] === value[_xfa_object.$content]);
  51310. }
  51311. [_xfa_object.$toHTML]() {
  51312. const output = [];
  51313. for (const child of this[_xfa_object.$getChildren]()) {
  51314. output.push(child[_xfa_object.$text]());
  51315. }
  51316. return _utils.HTMLResult.success(output);
  51317. }
  51318. }
  51319. exports.Items = Items;
  51320. class Keep extends _xfa_object.XFAObject {
  51321. constructor(attributes) {
  51322. super(TEMPLATE_NS_ID, "keep", true);
  51323. this.id = attributes.id || "";
  51324. const options = ["none", "contentArea", "pageArea"];
  51325. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  51326. this.next = (0, _utils.getStringOption)(attributes.next, options);
  51327. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  51328. this.use = attributes.use || "";
  51329. this.usehref = attributes.usehref || "";
  51330. this.extras = null;
  51331. }
  51332. }
  51333. class KeyUsage extends _xfa_object.XFAObject {
  51334. constructor(attributes) {
  51335. super(TEMPLATE_NS_ID, "keyUsage");
  51336. const options = ["", "yes", "no"];
  51337. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  51338. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  51339. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  51340. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  51341. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  51342. this.id = attributes.id || "";
  51343. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  51344. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  51345. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  51346. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  51347. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51348. this.use = attributes.use || "";
  51349. this.usehref = attributes.usehref || "";
  51350. }
  51351. }
  51352. class Line extends _xfa_object.XFAObject {
  51353. constructor(attributes) {
  51354. super(TEMPLATE_NS_ID, "line", true);
  51355. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  51356. this.id = attributes.id || "";
  51357. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  51358. this.use = attributes.use || "";
  51359. this.usehref = attributes.usehref || "";
  51360. this.edge = null;
  51361. }
  51362. }
  51363. class Linear extends _xfa_object.XFAObject {
  51364. constructor(attributes) {
  51365. super(TEMPLATE_NS_ID, "linear", true);
  51366. this.id = attributes.id || "";
  51367. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  51368. this.use = attributes.use || "";
  51369. this.usehref = attributes.usehref || "";
  51370. this.color = null;
  51371. this.extras = null;
  51372. }
  51373. [_xfa_object.$toStyle](startColor) {
  51374. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  51375. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  51376. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  51377. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  51378. }
  51379. }
  51380. class LockDocument extends _xfa_object.ContentObject {
  51381. constructor(attributes) {
  51382. super(TEMPLATE_NS_ID, "lockDocument");
  51383. this.id = attributes.id || "";
  51384. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51385. this.use = attributes.use || "";
  51386. this.usehref = attributes.usehref || "";
  51387. }
  51388. [_xfa_object.$finalize]() {
  51389. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  51390. }
  51391. }
  51392. class Manifest extends _xfa_object.XFAObject {
  51393. constructor(attributes) {
  51394. super(TEMPLATE_NS_ID, "manifest", true);
  51395. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  51396. this.id = attributes.id || "";
  51397. this.name = attributes.name || "";
  51398. this.use = attributes.use || "";
  51399. this.usehref = attributes.usehref || "";
  51400. this.extras = null;
  51401. this.ref = new _xfa_object.XFAObjectArray();
  51402. }
  51403. }
  51404. class Margin extends _xfa_object.XFAObject {
  51405. constructor(attributes) {
  51406. super(TEMPLATE_NS_ID, "margin", true);
  51407. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  51408. this.id = attributes.id || "";
  51409. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  51410. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  51411. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  51412. this.use = attributes.use || "";
  51413. this.usehref = attributes.usehref || "";
  51414. this.extras = null;
  51415. }
  51416. [_xfa_object.$toStyle]() {
  51417. return {
  51418. 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)
  51419. };
  51420. }
  51421. }
  51422. class Mdp extends _xfa_object.XFAObject {
  51423. constructor(attributes) {
  51424. super(TEMPLATE_NS_ID, "mdp");
  51425. this.id = attributes.id || "";
  51426. this.permissions = (0, _utils.getInteger)({
  51427. data: attributes.permissions,
  51428. defaultValue: 2,
  51429. validate: x => x === 1 || x === 3
  51430. });
  51431. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  51432. this.use = attributes.use || "";
  51433. this.usehref = attributes.usehref || "";
  51434. }
  51435. }
  51436. class Medium extends _xfa_object.XFAObject {
  51437. constructor(attributes) {
  51438. super(TEMPLATE_NS_ID, "medium");
  51439. this.id = attributes.id || "";
  51440. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  51441. this.long = (0, _utils.getMeasurement)(attributes.long);
  51442. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  51443. this.short = (0, _utils.getMeasurement)(attributes.short);
  51444. this.stock = attributes.stock || "";
  51445. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  51446. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  51447. this.use = attributes.use || "";
  51448. this.usehref = attributes.usehref || "";
  51449. }
  51450. }
  51451. class Message extends _xfa_object.XFAObject {
  51452. constructor(attributes) {
  51453. super(TEMPLATE_NS_ID, "message", true);
  51454. this.id = attributes.id || "";
  51455. this.use = attributes.use || "";
  51456. this.usehref = attributes.usehref || "";
  51457. this.text = new _xfa_object.XFAObjectArray();
  51458. }
  51459. }
  51460. class NumericEdit extends _xfa_object.XFAObject {
  51461. constructor(attributes) {
  51462. super(TEMPLATE_NS_ID, "numericEdit", true);
  51463. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  51464. this.id = attributes.id || "";
  51465. this.use = attributes.use || "";
  51466. this.usehref = attributes.usehref || "";
  51467. this.border = null;
  51468. this.comb = null;
  51469. this.extras = null;
  51470. this.margin = null;
  51471. }
  51472. [_xfa_object.$toHTML](availableSpace) {
  51473. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  51474. const html = {
  51475. name: "input",
  51476. attributes: {
  51477. type: "text",
  51478. fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid],
  51479. class: "xfaTextfield",
  51480. style
  51481. }
  51482. };
  51483. return _utils.HTMLResult.success({
  51484. name: "label",
  51485. attributes: {
  51486. class: "xfaLabel"
  51487. },
  51488. children: [html]
  51489. });
  51490. }
  51491. }
  51492. class Occur extends _xfa_object.XFAObject {
  51493. constructor(attributes) {
  51494. super(TEMPLATE_NS_ID, "occur", true);
  51495. this.id = attributes.id || "";
  51496. this.initial = (0, _utils.getInteger)({
  51497. data: attributes.initial,
  51498. defaultValue: 1,
  51499. validate: x => true
  51500. });
  51501. this.max = (0, _utils.getInteger)({
  51502. data: attributes.max,
  51503. defaultValue: 1,
  51504. validate: x => true
  51505. });
  51506. this.min = (0, _utils.getInteger)({
  51507. data: attributes.min,
  51508. defaultValue: 1,
  51509. validate: x => true
  51510. });
  51511. this.use = attributes.use || "";
  51512. this.usehref = attributes.usehref || "";
  51513. this.extras = null;
  51514. }
  51515. }
  51516. class Oid extends _xfa_object.StringObject {
  51517. constructor(attributes) {
  51518. super(TEMPLATE_NS_ID, "oid");
  51519. this.id = attributes.id || "";
  51520. this.name = attributes.name || "";
  51521. this.use = attributes.use || "";
  51522. this.usehref = attributes.usehref || "";
  51523. }
  51524. }
  51525. class Oids extends _xfa_object.XFAObject {
  51526. constructor(attributes) {
  51527. super(TEMPLATE_NS_ID, "oids", true);
  51528. this.id = attributes.id || "";
  51529. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51530. this.use = attributes.use || "";
  51531. this.usehref = attributes.usehref || "";
  51532. this.oid = new _xfa_object.XFAObjectArray();
  51533. }
  51534. }
  51535. class Overflow extends _xfa_object.XFAObject {
  51536. constructor(attributes) {
  51537. super(TEMPLATE_NS_ID, "overflow");
  51538. this.id = attributes.id || "";
  51539. this.leader = attributes.leader || "";
  51540. this.target = attributes.target || "";
  51541. this.trailer = attributes.trailer || "";
  51542. this.use = attributes.use || "";
  51543. this.usehref = attributes.usehref || "";
  51544. }
  51545. }
  51546. class PageArea extends _xfa_object.XFAObject {
  51547. constructor(attributes) {
  51548. super(TEMPLATE_NS_ID, "pageArea", true);
  51549. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  51550. this.id = attributes.id || "";
  51551. this.initialNumber = (0, _utils.getInteger)({
  51552. data: attributes.initialNumber,
  51553. defaultValue: 1,
  51554. validate: x => true
  51555. });
  51556. this.name = attributes.name || "";
  51557. this.numbered = (0, _utils.getInteger)({
  51558. data: attributes.numbered,
  51559. defaultValue: 1,
  51560. validate: x => true
  51561. });
  51562. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  51563. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  51564. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51565. this.use = attributes.use || "";
  51566. this.usehref = attributes.usehref || "";
  51567. this.desc = null;
  51568. this.extras = null;
  51569. this.medium = null;
  51570. this.occur = null;
  51571. this.area = new _xfa_object.XFAObjectArray();
  51572. this.contentArea = new _xfa_object.XFAObjectArray();
  51573. this.draw = new _xfa_object.XFAObjectArray();
  51574. this.exclGroup = new _xfa_object.XFAObjectArray();
  51575. this.field = new _xfa_object.XFAObjectArray();
  51576. this.subform = new _xfa_object.XFAObjectArray();
  51577. }
  51578. [_xfa_object.$getNextPage]() {
  51579. if (!this[_xfa_object.$extra]) {
  51580. this[_xfa_object.$extra] = {
  51581. numberOfUse: 1
  51582. };
  51583. }
  51584. const parent = this[_xfa_object.$getParent]();
  51585. if (parent.relation === "orderedOccurrence") {
  51586. if (this.occur && (this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max)) {
  51587. this[_xfa_object.$extra].numberOfUse += 1;
  51588. return this;
  51589. }
  51590. }
  51591. delete this[_xfa_object.$extra];
  51592. return parent[_xfa_object.$getNextPage]();
  51593. }
  51594. [_xfa_object.$getAvailableSpace]() {
  51595. return {
  51596. width: Infinity,
  51597. height: Infinity
  51598. };
  51599. }
  51600. [_xfa_object.$toHTML]() {
  51601. if (!this[_xfa_object.$extra]) {
  51602. this[_xfa_object.$extra] = {
  51603. numberOfUse: 1
  51604. };
  51605. }
  51606. const children = [];
  51607. this[_xfa_object.$extra].children = children;
  51608. const style = Object.create(null);
  51609. if (this.medium && this.medium.short && this.medium.long) {
  51610. style.width = (0, _html_utils.measureToString)(this.medium.short);
  51611. style.height = (0, _html_utils.measureToString)(this.medium.long);
  51612. if (this.medium.orientation === "landscape") {
  51613. const x = style.width;
  51614. style.width = style.height;
  51615. style.height = x;
  51616. }
  51617. } else {
  51618. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  51619. }
  51620. this[_xfa_object.$childrenToHTML]({
  51621. filter: new Set(["area", "draw", "field", "subform", "contentArea"]),
  51622. include: true
  51623. });
  51624. return _utils.HTMLResult.success({
  51625. name: "div",
  51626. children,
  51627. attributes: {
  51628. id: this[_xfa_object.$uid],
  51629. style
  51630. }
  51631. });
  51632. }
  51633. }
  51634. class PageSet extends _xfa_object.XFAObject {
  51635. constructor(attributes) {
  51636. super(TEMPLATE_NS_ID, "pageSet", true);
  51637. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  51638. this.id = attributes.id || "";
  51639. this.name = attributes.name || "";
  51640. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  51641. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51642. this.use = attributes.use || "";
  51643. this.usehref = attributes.usehref || "";
  51644. this.extras = null;
  51645. this.occur = null;
  51646. this.pageArea = new _xfa_object.XFAObjectArray();
  51647. this.pageSet = new _xfa_object.XFAObjectArray();
  51648. }
  51649. [_xfa_object.$getNextPage]() {
  51650. if (!this[_xfa_object.$extra]) {
  51651. this[_xfa_object.$extra] = {
  51652. numberOfUse: 1,
  51653. currentIndex: -1
  51654. };
  51655. }
  51656. if (this.relation === "orderedOccurrence") {
  51657. if (this[_xfa_object.$extra].currentIndex + 1 < this.pageArea.children.length) {
  51658. this[_xfa_object.$extra].currentIndex += 1;
  51659. return this.pageArea.children[this[_xfa_object.$extra].currentIndex];
  51660. }
  51661. if (this[_xfa_object.$extra].currentIndex + 1 < this.pageSet.children.length) {
  51662. this[_xfa_object.$extra].currentIndex += 1;
  51663. return this.pageSet.children[this[_xfa_object.$extra].currentIndex];
  51664. }
  51665. if (this.occur && (this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max)) {
  51666. this[_xfa_object.$extra].numberOfUse += 1;
  51667. this[_xfa_object.$extra].currentIndex = 0;
  51668. if (this.pageArea.children.length > 0) {
  51669. return this.pageArea.children[0];
  51670. }
  51671. return this.pageSet.children[0][_xfa_object.$getNextPage]();
  51672. }
  51673. delete this[_xfa_object.$extra];
  51674. const parent = this[_xfa_object.$getParent]();
  51675. if (parent instanceof PageSet) {
  51676. return parent[_xfa_object.$getNextPage]();
  51677. }
  51678. return this[_xfa_object.$getNextPage]();
  51679. }
  51680. const pageNumber = getRoot(this)[_xfa_object.$extra].pageNumber;
  51681. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  51682. const position = pageNumber === 0 ? "first" : "rest";
  51683. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  51684. if (page) {
  51685. return page;
  51686. }
  51687. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  51688. if (page) {
  51689. return page;
  51690. }
  51691. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  51692. if (page) {
  51693. return page;
  51694. }
  51695. return this.pageArea.children[0];
  51696. }
  51697. }
  51698. class Para extends _xfa_object.XFAObject {
  51699. constructor(attributes) {
  51700. super(TEMPLATE_NS_ID, "para", true);
  51701. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  51702. this.id = attributes.id || "";
  51703. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  51704. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  51705. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  51706. this.orphans = (0, _utils.getInteger)({
  51707. data: attributes.orphans,
  51708. defaultValue: 0,
  51709. validate: x => x >= 0
  51710. });
  51711. this.preserve = attributes.preserve || "";
  51712. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  51713. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  51714. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  51715. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  51716. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  51717. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  51718. this.use = attributes.use || "";
  51719. this.usehref = attributes.usehref || "";
  51720. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  51721. this.widows = (0, _utils.getInteger)({
  51722. data: attributes.widows,
  51723. defaultValue: 0,
  51724. validate: x => x >= 0
  51725. });
  51726. this.hyphenation = null;
  51727. }
  51728. [_xfa_object.$toStyle]() {
  51729. const style = (0, _html_utils.toStyle)(this, "hAlign");
  51730. if (this.marginLeft !== "") {
  51731. style.marginLeft = (0, _html_utils.measureToString)(this.marginLeft);
  51732. }
  51733. if (this.marginRight !== "") {
  51734. style.marginRight = (0, _html_utils.measureToString)(this.marginRight);
  51735. }
  51736. if (this.spaceAbove !== "") {
  51737. style.marginTop = (0, _html_utils.measureToString)(this.spaceAbove);
  51738. }
  51739. if (this.spaceBelow !== "") {
  51740. style.marginBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  51741. }
  51742. if (this.textIndent !== "") {
  51743. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  51744. (0, _html_utils.fixTextIndent)(style);
  51745. }
  51746. if (this.lineHeight > 0) {
  51747. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  51748. }
  51749. if (this.tabDefault !== "") {
  51750. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  51751. }
  51752. if (this.tabStops.length > 0) {}
  51753. if (this.hyphenatation) {
  51754. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  51755. }
  51756. return style;
  51757. }
  51758. }
  51759. class PasswordEdit extends _xfa_object.XFAObject {
  51760. constructor(attributes) {
  51761. super(TEMPLATE_NS_ID, "passwordEdit", true);
  51762. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  51763. this.id = attributes.id || "";
  51764. this.passwordChar = attributes.passwordChar || "*";
  51765. this.use = attributes.use || "";
  51766. this.usehref = attributes.usehref || "";
  51767. this.border = null;
  51768. this.extras = null;
  51769. this.margin = null;
  51770. }
  51771. }
  51772. class Pattern extends _xfa_object.XFAObject {
  51773. constructor(attributes) {
  51774. super(TEMPLATE_NS_ID, "pattern", true);
  51775. this.id = attributes.id || "";
  51776. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  51777. this.use = attributes.use || "";
  51778. this.usehref = attributes.usehref || "";
  51779. this.color = null;
  51780. this.extras = null;
  51781. }
  51782. [_xfa_object.$toStyle](startColor) {
  51783. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  51784. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  51785. const width = 5;
  51786. const cmd = "repeating-linear-gradient";
  51787. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  51788. switch (this.type) {
  51789. case "crossHatch":
  51790. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  51791. case "crossDiagonal":
  51792. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  51793. case "diagonalLeft":
  51794. return `${cmd}(45deg,${colors})`;
  51795. case "diagonalRight":
  51796. return `${cmd}(-45deg,${colors})`;
  51797. case "horizontal":
  51798. return `${cmd}(to top,${colors})`;
  51799. case "vertical":
  51800. return `${cmd}(to right,${colors})`;
  51801. }
  51802. return "";
  51803. }
  51804. }
  51805. class Picture extends _xfa_object.StringObject {
  51806. constructor(attributes) {
  51807. super(TEMPLATE_NS_ID, "picture");
  51808. this.id = attributes.id || "";
  51809. this.use = attributes.use || "";
  51810. this.usehref = attributes.usehref || "";
  51811. }
  51812. }
  51813. class Proto extends _xfa_object.XFAObject {
  51814. constructor(attributes) {
  51815. super(TEMPLATE_NS_ID, "proto", true);
  51816. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  51817. this.arc = new _xfa_object.XFAObjectArray();
  51818. this.area = new _xfa_object.XFAObjectArray();
  51819. this.assist = new _xfa_object.XFAObjectArray();
  51820. this.barcode = new _xfa_object.XFAObjectArray();
  51821. this.bindItems = new _xfa_object.XFAObjectArray();
  51822. this.bookend = new _xfa_object.XFAObjectArray();
  51823. this.boolean = new _xfa_object.XFAObjectArray();
  51824. this.border = new _xfa_object.XFAObjectArray();
  51825. this.break = new _xfa_object.XFAObjectArray();
  51826. this.breakAfter = new _xfa_object.XFAObjectArray();
  51827. this.breakBefore = new _xfa_object.XFAObjectArray();
  51828. this.button = new _xfa_object.XFAObjectArray();
  51829. this.calculate = new _xfa_object.XFAObjectArray();
  51830. this.caption = new _xfa_object.XFAObjectArray();
  51831. this.certificate = new _xfa_object.XFAObjectArray();
  51832. this.certificates = new _xfa_object.XFAObjectArray();
  51833. this.checkButton = new _xfa_object.XFAObjectArray();
  51834. this.choiceList = new _xfa_object.XFAObjectArray();
  51835. this.color = new _xfa_object.XFAObjectArray();
  51836. this.comb = new _xfa_object.XFAObjectArray();
  51837. this.connect = new _xfa_object.XFAObjectArray();
  51838. this.contentArea = new _xfa_object.XFAObjectArray();
  51839. this.corner = new _xfa_object.XFAObjectArray();
  51840. this.date = new _xfa_object.XFAObjectArray();
  51841. this.dateTime = new _xfa_object.XFAObjectArray();
  51842. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  51843. this.decimal = new _xfa_object.XFAObjectArray();
  51844. this.defaultUi = new _xfa_object.XFAObjectArray();
  51845. this.desc = new _xfa_object.XFAObjectArray();
  51846. this.digestMethod = new _xfa_object.XFAObjectArray();
  51847. this.digestMethods = new _xfa_object.XFAObjectArray();
  51848. this.draw = new _xfa_object.XFAObjectArray();
  51849. this.edge = new _xfa_object.XFAObjectArray();
  51850. this.encoding = new _xfa_object.XFAObjectArray();
  51851. this.encodings = new _xfa_object.XFAObjectArray();
  51852. this.encrypt = new _xfa_object.XFAObjectArray();
  51853. this.encryptData = new _xfa_object.XFAObjectArray();
  51854. this.encryption = new _xfa_object.XFAObjectArray();
  51855. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  51856. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  51857. this.event = new _xfa_object.XFAObjectArray();
  51858. this.exData = new _xfa_object.XFAObjectArray();
  51859. this.exObject = new _xfa_object.XFAObjectArray();
  51860. this.exclGroup = new _xfa_object.XFAObjectArray();
  51861. this.execute = new _xfa_object.XFAObjectArray();
  51862. this.extras = new _xfa_object.XFAObjectArray();
  51863. this.field = new _xfa_object.XFAObjectArray();
  51864. this.fill = new _xfa_object.XFAObjectArray();
  51865. this.filter = new _xfa_object.XFAObjectArray();
  51866. this.float = new _xfa_object.XFAObjectArray();
  51867. this.font = new _xfa_object.XFAObjectArray();
  51868. this.format = new _xfa_object.XFAObjectArray();
  51869. this.handler = new _xfa_object.XFAObjectArray();
  51870. this.hyphenation = new _xfa_object.XFAObjectArray();
  51871. this.image = new _xfa_object.XFAObjectArray();
  51872. this.imageEdit = new _xfa_object.XFAObjectArray();
  51873. this.integer = new _xfa_object.XFAObjectArray();
  51874. this.issuers = new _xfa_object.XFAObjectArray();
  51875. this.items = new _xfa_object.XFAObjectArray();
  51876. this.keep = new _xfa_object.XFAObjectArray();
  51877. this.keyUsage = new _xfa_object.XFAObjectArray();
  51878. this.line = new _xfa_object.XFAObjectArray();
  51879. this.linear = new _xfa_object.XFAObjectArray();
  51880. this.lockDocument = new _xfa_object.XFAObjectArray();
  51881. this.manifest = new _xfa_object.XFAObjectArray();
  51882. this.margin = new _xfa_object.XFAObjectArray();
  51883. this.mdp = new _xfa_object.XFAObjectArray();
  51884. this.medium = new _xfa_object.XFAObjectArray();
  51885. this.message = new _xfa_object.XFAObjectArray();
  51886. this.numericEdit = new _xfa_object.XFAObjectArray();
  51887. this.occur = new _xfa_object.XFAObjectArray();
  51888. this.oid = new _xfa_object.XFAObjectArray();
  51889. this.oids = new _xfa_object.XFAObjectArray();
  51890. this.overflow = new _xfa_object.XFAObjectArray();
  51891. this.pageArea = new _xfa_object.XFAObjectArray();
  51892. this.pageSet = new _xfa_object.XFAObjectArray();
  51893. this.para = new _xfa_object.XFAObjectArray();
  51894. this.passwordEdit = new _xfa_object.XFAObjectArray();
  51895. this.pattern = new _xfa_object.XFAObjectArray();
  51896. this.picture = new _xfa_object.XFAObjectArray();
  51897. this.radial = new _xfa_object.XFAObjectArray();
  51898. this.reason = new _xfa_object.XFAObjectArray();
  51899. this.reasons = new _xfa_object.XFAObjectArray();
  51900. this.rectangle = new _xfa_object.XFAObjectArray();
  51901. this.ref = new _xfa_object.XFAObjectArray();
  51902. this.script = new _xfa_object.XFAObjectArray();
  51903. this.setProperty = new _xfa_object.XFAObjectArray();
  51904. this.signData = new _xfa_object.XFAObjectArray();
  51905. this.signature = new _xfa_object.XFAObjectArray();
  51906. this.signing = new _xfa_object.XFAObjectArray();
  51907. this.solid = new _xfa_object.XFAObjectArray();
  51908. this.speak = new _xfa_object.XFAObjectArray();
  51909. this.stipple = new _xfa_object.XFAObjectArray();
  51910. this.subform = new _xfa_object.XFAObjectArray();
  51911. this.subformSet = new _xfa_object.XFAObjectArray();
  51912. this.subjectDN = new _xfa_object.XFAObjectArray();
  51913. this.subjectDNs = new _xfa_object.XFAObjectArray();
  51914. this.submit = new _xfa_object.XFAObjectArray();
  51915. this.text = new _xfa_object.XFAObjectArray();
  51916. this.textEdit = new _xfa_object.XFAObjectArray();
  51917. this.time = new _xfa_object.XFAObjectArray();
  51918. this.timeStamp = new _xfa_object.XFAObjectArray();
  51919. this.toolTip = new _xfa_object.XFAObjectArray();
  51920. this.traversal = new _xfa_object.XFAObjectArray();
  51921. this.traverse = new _xfa_object.XFAObjectArray();
  51922. this.ui = new _xfa_object.XFAObjectArray();
  51923. this.validate = new _xfa_object.XFAObjectArray();
  51924. this.value = new _xfa_object.XFAObjectArray();
  51925. this.variables = new _xfa_object.XFAObjectArray();
  51926. }
  51927. }
  51928. class Radial extends _xfa_object.XFAObject {
  51929. constructor(attributes) {
  51930. super(TEMPLATE_NS_ID, "radial", true);
  51931. this.id = attributes.id || "";
  51932. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  51933. this.use = attributes.use || "";
  51934. this.usehref = attributes.usehref || "";
  51935. this.color = null;
  51936. this.extras = null;
  51937. }
  51938. [_xfa_object.$toStyle](startColor) {
  51939. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  51940. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  51941. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  51942. return `radial-gradient(circle to center, ${colors})`;
  51943. }
  51944. }
  51945. class Reason extends _xfa_object.StringObject {
  51946. constructor(attributes) {
  51947. super(TEMPLATE_NS_ID, "reason");
  51948. this.id = attributes.id || "";
  51949. this.name = attributes.name || "";
  51950. this.use = attributes.use || "";
  51951. this.usehref = attributes.usehref || "";
  51952. }
  51953. }
  51954. class Reasons extends _xfa_object.XFAObject {
  51955. constructor(attributes) {
  51956. super(TEMPLATE_NS_ID, "reasons", true);
  51957. this.id = attributes.id || "";
  51958. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51959. this.use = attributes.use || "";
  51960. this.usehref = attributes.usehref || "";
  51961. this.reason = new _xfa_object.XFAObjectArray();
  51962. }
  51963. }
  51964. class Rectangle extends _xfa_object.XFAObject {
  51965. constructor(attributes) {
  51966. super(TEMPLATE_NS_ID, "rectangle", true);
  51967. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  51968. this.id = attributes.id || "";
  51969. this.use = attributes.use || "";
  51970. this.usehref = attributes.usehref || "";
  51971. this.corner = new _xfa_object.XFAObjectArray(4);
  51972. this.edge = new _xfa_object.XFAObjectArray(4);
  51973. this.fill = null;
  51974. }
  51975. }
  51976. class RefElement extends _xfa_object.StringObject {
  51977. constructor(attributes) {
  51978. super(TEMPLATE_NS_ID, "ref");
  51979. this.id = attributes.id || "";
  51980. this.use = attributes.use || "";
  51981. this.usehref = attributes.usehref || "";
  51982. }
  51983. }
  51984. class Script extends _xfa_object.StringObject {
  51985. constructor(attributes) {
  51986. super(TEMPLATE_NS_ID, "script");
  51987. this.binding = attributes.binding || "";
  51988. this.contentType = attributes.contentType || "";
  51989. this.id = attributes.id || "";
  51990. this.name = attributes.name || "";
  51991. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  51992. this.use = attributes.use || "";
  51993. this.usehref = attributes.usehref || "";
  51994. }
  51995. }
  51996. class SetProperty extends _xfa_object.XFAObject {
  51997. constructor(attributes) {
  51998. super(TEMPLATE_NS_ID, "setProperty");
  51999. this.connection = attributes.connection || "";
  52000. this.ref = attributes.ref || "";
  52001. this.target = attributes.target || "";
  52002. }
  52003. }
  52004. exports.SetProperty = SetProperty;
  52005. class SignData extends _xfa_object.XFAObject {
  52006. constructor(attributes) {
  52007. super(TEMPLATE_NS_ID, "signData", true);
  52008. this.id = attributes.id || "";
  52009. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  52010. this.ref = attributes.ref || "";
  52011. this.target = attributes.target || "";
  52012. this.use = attributes.use || "";
  52013. this.usehref = attributes.usehref || "";
  52014. this.filter = null;
  52015. this.manifest = null;
  52016. }
  52017. }
  52018. class Signature extends _xfa_object.XFAObject {
  52019. constructor(attributes) {
  52020. super(TEMPLATE_NS_ID, "signature", true);
  52021. this.id = attributes.id || "";
  52022. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  52023. this.use = attributes.use || "";
  52024. this.usehref = attributes.usehref || "";
  52025. this.border = null;
  52026. this.extras = null;
  52027. this.filter = null;
  52028. this.manifest = null;
  52029. this.margin = null;
  52030. }
  52031. }
  52032. class Signing extends _xfa_object.XFAObject {
  52033. constructor(attributes) {
  52034. super(TEMPLATE_NS_ID, "signing", true);
  52035. this.id = attributes.id || "";
  52036. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52037. this.use = attributes.use || "";
  52038. this.usehref = attributes.usehref || "";
  52039. this.certificate = new _xfa_object.XFAObjectArray();
  52040. }
  52041. }
  52042. class Solid extends _xfa_object.XFAObject {
  52043. constructor(attributes) {
  52044. super(TEMPLATE_NS_ID, "solid", true);
  52045. this.id = attributes.id || "";
  52046. this.use = attributes.use || "";
  52047. this.usehref = attributes.usehref || "";
  52048. this.extras = null;
  52049. }
  52050. [_xfa_object.$toStyle](startColor) {
  52051. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  52052. }
  52053. }
  52054. class Speak extends _xfa_object.StringObject {
  52055. constructor(attributes) {
  52056. super(TEMPLATE_NS_ID, "speak");
  52057. this.disable = (0, _utils.getInteger)({
  52058. data: attributes.disable,
  52059. defaultValue: 0,
  52060. validate: x => x === 1
  52061. });
  52062. this.id = attributes.id || "";
  52063. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  52064. this.rid = attributes.rid || "";
  52065. this.use = attributes.use || "";
  52066. this.usehref = attributes.usehref || "";
  52067. }
  52068. }
  52069. class Stipple extends _xfa_object.XFAObject {
  52070. constructor(attributes) {
  52071. super(TEMPLATE_NS_ID, "stipple", true);
  52072. this.id = attributes.id || "";
  52073. this.rate = (0, _utils.getInteger)({
  52074. data: attributes.rate,
  52075. defaultValue: 50,
  52076. validate: x => x >= 0 && x <= 100
  52077. });
  52078. this.use = attributes.use || "";
  52079. this.usehref = attributes.usehref || "";
  52080. this.color = null;
  52081. this.extras = null;
  52082. }
  52083. [_xfa_object.$toStyle](bgColor) {
  52084. const alpha = this.rate / 100;
  52085. 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));
  52086. }
  52087. }
  52088. class Subform extends _xfa_object.XFAObject {
  52089. constructor(attributes) {
  52090. super(TEMPLATE_NS_ID, "subform", true);
  52091. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  52092. this.allowMacro = (0, _utils.getInteger)({
  52093. data: attributes.allowMacro,
  52094. defaultValue: 0,
  52095. validate: x => x === 1
  52096. });
  52097. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  52098. this.colSpan = (0, _utils.getInteger)({
  52099. data: attributes.colSpan,
  52100. defaultValue: 1,
  52101. validate: n => n >= 1 || n === -1
  52102. });
  52103. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  52104. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  52105. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  52106. this.id = attributes.id || "";
  52107. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  52108. this.locale = attributes.locale || "";
  52109. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  52110. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  52111. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  52112. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  52113. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  52114. this.name = attributes.name || "";
  52115. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52116. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52117. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  52118. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  52119. this.use = attributes.use || "";
  52120. this.usehref = attributes.usehref || "";
  52121. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  52122. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52123. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52124. this.assist = null;
  52125. this.bind = null;
  52126. this.bookend = null;
  52127. this.border = null;
  52128. this.break = null;
  52129. this.calculate = null;
  52130. this.desc = null;
  52131. this.extras = null;
  52132. this.keep = null;
  52133. this.margin = null;
  52134. this.occur = null;
  52135. this.overflow = null;
  52136. this.pageSet = null;
  52137. this.para = null;
  52138. this.traversal = null;
  52139. this.validate = null;
  52140. this.variables = null;
  52141. this.area = new _xfa_object.XFAObjectArray();
  52142. this.breakAfter = new _xfa_object.XFAObjectArray();
  52143. this.breakBefore = new _xfa_object.XFAObjectArray();
  52144. this.connect = new _xfa_object.XFAObjectArray();
  52145. this.draw = new _xfa_object.XFAObjectArray();
  52146. this.event = new _xfa_object.XFAObjectArray();
  52147. this.exObject = new _xfa_object.XFAObjectArray();
  52148. this.exclGroup = new _xfa_object.XFAObjectArray();
  52149. this.field = new _xfa_object.XFAObjectArray();
  52150. this.proto = new _xfa_object.XFAObjectArray();
  52151. this.setProperty = new _xfa_object.XFAObjectArray();
  52152. this.subform = new _xfa_object.XFAObjectArray();
  52153. this.subformSet = new _xfa_object.XFAObjectArray();
  52154. }
  52155. [_xfa_object.$flushHTML]() {
  52156. return (0, _layout.flushHTML)(this);
  52157. }
  52158. [_xfa_object.$addHTML](html, bbox) {
  52159. (0, _layout.addHTML)(this, html, bbox);
  52160. }
  52161. [_xfa_object.$getAvailableSpace]() {
  52162. return (0, _layout.getAvailableSpace)(this);
  52163. }
  52164. [_xfa_object.$toHTML](availableSpace) {
  52165. if (this.name === "helpText") {
  52166. return _utils.HTMLResult.EMPTY;
  52167. }
  52168. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  52169. const ret = this[_xfa_object.$extra].afterBreakAfter;
  52170. delete this[_xfa_object.$extra];
  52171. return ret;
  52172. }
  52173. if (this.presence === "hidden" || this.presence === "inactive") {
  52174. return _utils.HTMLResult.EMPTY;
  52175. }
  52176. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  52177. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  52178. }
  52179. (0, _html_utils.fixDimensions)(this);
  52180. const children = [];
  52181. const attributes = {
  52182. id: this[_xfa_object.$uid]
  52183. };
  52184. if (!this[_xfa_object.$extra]) {
  52185. this[_xfa_object.$extra] = Object.create(null);
  52186. }
  52187. Object.assign(this[_xfa_object.$extra], {
  52188. children,
  52189. attributes,
  52190. attempt: 0,
  52191. availableSpace,
  52192. width: 0,
  52193. height: 0,
  52194. prevHeight: 0,
  52195. currentWidth: 0
  52196. });
  52197. if (this.breakBefore.children.length >= 1) {
  52198. const breakBefore = this.breakBefore.children[0];
  52199. if (!breakBefore[_xfa_object.$extra]) {
  52200. breakBefore[_xfa_object.$extra] = true;
  52201. getRoot(this)[_xfa_object.$break](breakBefore);
  52202. return _utils.HTMLResult.FAILURE;
  52203. }
  52204. }
  52205. switch (checkDimensions(this, availableSpace)) {
  52206. case NOTHING:
  52207. return _utils.HTMLResult.EMPTY;
  52208. case NOSPACE:
  52209. return _utils.HTMLResult.FAILURE;
  52210. default:
  52211. break;
  52212. }
  52213. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  52214. if (this.layout.includes("row")) {
  52215. const columnWidths = this[_xfa_object.$getParent]().columnWidths;
  52216. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  52217. this[_xfa_object.$extra].columnWidths = columnWidths;
  52218. this[_xfa_object.$extra].currentColumn = 0;
  52219. }
  52220. }
  52221. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "borderMarginPadding", "hAlign");
  52222. const classNames = ["xfaSubform"];
  52223. const cl = (0, _html_utils.layoutClass)(this);
  52224. if (cl) {
  52225. classNames.push(cl);
  52226. }
  52227. attributes.style = style;
  52228. attributes.class = classNames.join(" ");
  52229. if (this.name) {
  52230. attributes.xfaName = this.name;
  52231. }
  52232. let failure;
  52233. if (this.layout === "lr-tb" || this.layout === "rl-tb") {
  52234. for (; this[_xfa_object.$extra].attempt < MAX_ATTEMPTS_FOR_LRTB_LAYOUT; this[_xfa_object.$extra].attempt++) {
  52235. if (this[_xfa_object.$childrenToHTML]({
  52236. filter,
  52237. include: true
  52238. })) {
  52239. break;
  52240. }
  52241. }
  52242. failure = this[_xfa_object.$extra].attempt === 2;
  52243. } else {
  52244. failure = !this[_xfa_object.$childrenToHTML]({
  52245. filter,
  52246. include: true
  52247. });
  52248. }
  52249. if (failure) {
  52250. return _utils.HTMLResult.FAILURE;
  52251. }
  52252. let marginH = 0;
  52253. let marginV = 0;
  52254. if (this.margin) {
  52255. marginH = this.margin.leftInset + this.margin.rightInset;
  52256. marginV = this.margin.topInset + this.margin.bottomInset;
  52257. }
  52258. if (this.w === "") {
  52259. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width + marginH);
  52260. }
  52261. if (this.h === "") {
  52262. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height + marginV);
  52263. }
  52264. let html = {
  52265. name: "div",
  52266. attributes,
  52267. children
  52268. };
  52269. html = (0, _html_utils.addExtraDivForBorder)(html);
  52270. let bbox;
  52271. if (this.w !== "" && this.h !== "") {
  52272. bbox = [this.x, this.y, this.w, this.h];
  52273. } else {
  52274. const width = this.w === "" ? marginH + this[_xfa_object.$extra].width : this.w;
  52275. const height = this.h === "" ? marginV + this[_xfa_object.$extra].height : this.h;
  52276. bbox = [this.x, this.y, width, height];
  52277. }
  52278. if (this.breakAfter.children.length >= 1) {
  52279. const breakAfter = this.breakAfter.children[0];
  52280. getRoot(this)[_xfa_object.$break](breakAfter);
  52281. this[_xfa_object.$extra].afterBreakAfter = _utils.HTMLResult.success(html, bbox);
  52282. return _utils.HTMLResult.FAILURE;
  52283. }
  52284. delete this[_xfa_object.$extra];
  52285. return _utils.HTMLResult.success(html, bbox);
  52286. }
  52287. }
  52288. class SubformSet extends _xfa_object.XFAObject {
  52289. constructor(attributes) {
  52290. super(TEMPLATE_NS_ID, "subformSet", true);
  52291. this.id = attributes.id || "";
  52292. this.name = attributes.name || "";
  52293. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  52294. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52295. this.use = attributes.use || "";
  52296. this.usehref = attributes.usehref || "";
  52297. this.bookend = null;
  52298. this.break = null;
  52299. this.desc = null;
  52300. this.extras = null;
  52301. this.occur = null;
  52302. this.overflow = null;
  52303. this.breakAfter = new _xfa_object.XFAObjectArray();
  52304. this.breakBefore = new _xfa_object.XFAObjectArray();
  52305. this.subform = new _xfa_object.XFAObjectArray();
  52306. this.subformSet = new _xfa_object.XFAObjectArray();
  52307. }
  52308. [_xfa_object.$toHTML]() {
  52309. const children = [];
  52310. if (!this[_xfa_object.$extra]) {
  52311. this[_xfa_object.$extra] = Object.create(null);
  52312. }
  52313. this[_xfa_object.$extra].children = children;
  52314. this[_xfa_object.$childrenToHTML]({
  52315. filter: new Set(["subform", "subformSet"]),
  52316. include: true
  52317. });
  52318. return _utils.HTMLResult.success({
  52319. name: "div",
  52320. children,
  52321. attributes: {
  52322. id: this[_xfa_object.$uid]
  52323. }
  52324. });
  52325. }
  52326. }
  52327. class SubjectDN extends _xfa_object.ContentObject {
  52328. constructor(attributes) {
  52329. super(TEMPLATE_NS_ID, "subjectDN");
  52330. this.delimiter = attributes.delimiter || ",";
  52331. this.id = attributes.id || "";
  52332. this.name = attributes.name || "";
  52333. this.use = attributes.use || "";
  52334. this.usehref = attributes.usehref || "";
  52335. }
  52336. [_xfa_object.$finalize]() {
  52337. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  52338. kv = kv.split("=", 2);
  52339. kv[0] = kv[0].trim();
  52340. return kv;
  52341. }));
  52342. }
  52343. }
  52344. class SubjectDNs extends _xfa_object.XFAObject {
  52345. constructor(attributes) {
  52346. super(TEMPLATE_NS_ID, "subjectDNs", true);
  52347. this.id = attributes.id || "";
  52348. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52349. this.use = attributes.use || "";
  52350. this.usehref = attributes.usehref || "";
  52351. this.subjectDN = new _xfa_object.XFAObjectArray();
  52352. }
  52353. }
  52354. class Submit extends _xfa_object.XFAObject {
  52355. constructor(attributes) {
  52356. super(TEMPLATE_NS_ID, "submit", true);
  52357. this.embedPDF = (0, _utils.getInteger)({
  52358. data: attributes.embedPDF,
  52359. defaultValue: 0,
  52360. validate: x => x === 1
  52361. });
  52362. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  52363. this.id = attributes.id || "";
  52364. this.target = attributes.target || "";
  52365. this.textEncoding = (0, _utils.getKeyword)({
  52366. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  52367. defaultValue: "",
  52368. 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}/)
  52369. });
  52370. this.use = attributes.use || "";
  52371. this.usehref = attributes.usehref || "";
  52372. this.xdpContent = attributes.xdpContent || "";
  52373. this.encrypt = null;
  52374. this.encryptData = new _xfa_object.XFAObjectArray();
  52375. this.signData = new _xfa_object.XFAObjectArray();
  52376. }
  52377. }
  52378. class Template extends _xfa_object.XFAObject {
  52379. constructor(attributes) {
  52380. super(TEMPLATE_NS_ID, "template", true);
  52381. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  52382. this.extras = null;
  52383. this.subform = new _xfa_object.XFAObjectArray();
  52384. }
  52385. [_xfa_object.$finalize]() {
  52386. if (this.subform.children.length === 0) {
  52387. (0, _util.warn)("XFA - No subforms in template node.");
  52388. }
  52389. if (this.subform.children.length >= 2) {
  52390. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  52391. }
  52392. }
  52393. [_xfa_object.$break](node) {
  52394. this[_xfa_object.$extra].breakingNode = node;
  52395. }
  52396. [_xfa_object.$searchNode](expr, container) {
  52397. if (expr.startsWith("#")) {
  52398. return [this[_xfa_object.$ids].get(expr.slice(1))];
  52399. }
  52400. return (0, _som.searchNode)(this, container, expr, true, true);
  52401. }
  52402. [_xfa_object.$toHTML]() {
  52403. if (!this.subform.children.length) {
  52404. return _utils.HTMLResult.success({
  52405. name: "div",
  52406. children: []
  52407. });
  52408. }
  52409. this[_xfa_object.$extra] = {
  52410. breakingNode: null,
  52411. pageNumber: 1,
  52412. pagePosition: "first",
  52413. oddOrEven: "odd",
  52414. blankOrNotBlank: "nonBlank"
  52415. };
  52416. const root = this.subform.children[0];
  52417. const pageAreas = root.pageSet.pageArea.children;
  52418. const mainHtml = {
  52419. name: "div",
  52420. children: []
  52421. };
  52422. let pageArea = null;
  52423. let breakBefore = null;
  52424. let breakBeforeTarget = null;
  52425. if (root.breakBefore.children.length >= 1) {
  52426. breakBefore = root.breakBefore.children[0];
  52427. breakBeforeTarget = breakBefore.target;
  52428. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  52429. breakBefore = root.subform.children[0].breakBefore.children[0];
  52430. breakBeforeTarget = breakBefore.target;
  52431. } else if (root.break && root.break.beforeTarget) {
  52432. breakBefore = root.break;
  52433. breakBeforeTarget = breakBefore.beforeTarget;
  52434. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  52435. breakBefore = root.subform.children[0].break;
  52436. breakBeforeTarget = breakBefore.beforeTarget;
  52437. }
  52438. if (breakBefore) {
  52439. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  52440. if (target instanceof PageArea) {
  52441. pageArea = target;
  52442. breakBefore[_xfa_object.$extra] = {};
  52443. }
  52444. }
  52445. if (!pageArea) {
  52446. pageArea = pageAreas[0];
  52447. }
  52448. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  52449. pageAreaParent[_xfa_object.$extra] = {
  52450. numberOfUse: 1,
  52451. currentIndex: pageAreaParent.pageArea.children.indexOf(pageArea)
  52452. };
  52453. let targetPageArea;
  52454. let leader = null;
  52455. let trailer = null;
  52456. while (true) {
  52457. targetPageArea = null;
  52458. const page = pageArea[_xfa_object.$toHTML]().html;
  52459. mainHtml.children.push(page);
  52460. if (leader) {
  52461. page.children.push(leader[_xfa_object.$toHTML](page[_xfa_object.$extra].space).html);
  52462. leader = null;
  52463. }
  52464. if (trailer) {
  52465. page.children.push(trailer[_xfa_object.$toHTML](page[_xfa_object.$extra].space).html);
  52466. trailer = null;
  52467. }
  52468. const contentAreas = pageArea.contentArea.children;
  52469. const htmlContentAreas = page.children.filter(node => node.attributes.class === "xfaContentarea");
  52470. for (let i = 0, ii = contentAreas.length; i < ii; i++) {
  52471. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  52472. const space = {
  52473. width: contentArea.w,
  52474. height: contentArea.h
  52475. };
  52476. if (leader) {
  52477. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  52478. leader = null;
  52479. }
  52480. if (trailer) {
  52481. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  52482. trailer = null;
  52483. }
  52484. let html = root[_xfa_object.$toHTML](space);
  52485. if (html.success) {
  52486. if (html.html) {
  52487. htmlContentAreas[i].children.push(html.html);
  52488. }
  52489. return mainHtml;
  52490. }
  52491. let mustBreak = false;
  52492. if (this[_xfa_object.$extra].breakingNode) {
  52493. const node = this[_xfa_object.$extra].breakingNode;
  52494. this[_xfa_object.$extra].breakingNode = null;
  52495. if (node.targetType === "auto") {
  52496. i--;
  52497. continue;
  52498. }
  52499. const startNew = node.startNew === 1;
  52500. if (node.leader) {
  52501. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  52502. leader = leader ? leader[0] : null;
  52503. }
  52504. if (node.trailer) {
  52505. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  52506. trailer = trailer ? trailer[0] : null;
  52507. }
  52508. let target = null;
  52509. if (node.target) {
  52510. target = this[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  52511. target = target ? target[0] : target;
  52512. }
  52513. if (node.targetType === "pageArea") {
  52514. if (startNew) {
  52515. mustBreak = true;
  52516. } else if (target === pageArea || !(target instanceof PageArea)) {
  52517. i--;
  52518. continue;
  52519. } else {
  52520. targetPageArea = target;
  52521. mustBreak = true;
  52522. }
  52523. } else if (target === "contentArea" || !(target instanceof ContentArea)) {
  52524. i--;
  52525. continue;
  52526. }
  52527. }
  52528. html = root[_xfa_object.$flushHTML]();
  52529. if (html) {
  52530. htmlContentAreas[i].children.push(html);
  52531. }
  52532. if (mustBreak) {
  52533. break;
  52534. }
  52535. }
  52536. this[_xfa_object.$extra].pageNumber += 1;
  52537. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  52538. }
  52539. }
  52540. }
  52541. exports.Template = Template;
  52542. class Text extends _xfa_object.ContentObject {
  52543. constructor(attributes) {
  52544. super(TEMPLATE_NS_ID, "text");
  52545. this.id = attributes.id || "";
  52546. this.maxChars = (0, _utils.getInteger)({
  52547. data: attributes.maxChars,
  52548. defaultValue: 0,
  52549. validate: x => x >= 0
  52550. });
  52551. this.name = attributes.name || "";
  52552. this.rid = attributes.rid || "";
  52553. this.use = attributes.use || "";
  52554. this.usehref = attributes.usehref || "";
  52555. }
  52556. [_xfa_object.$onChild](child) {
  52557. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52558. this[_xfa_object.$content] = child;
  52559. return true;
  52560. }
  52561. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  52562. return false;
  52563. }
  52564. [_xfa_object.$toHTML](availableSpace) {
  52565. if (typeof this[_xfa_object.$content] === "string") {
  52566. const html = {
  52567. name: "span",
  52568. attributes: {
  52569. class: "xfaRich",
  52570. style: {}
  52571. },
  52572. value: this[_xfa_object.$content]
  52573. };
  52574. if (this[_xfa_object.$content].includes("\u2029")) {
  52575. html.name = "div";
  52576. html.children = [];
  52577. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  52578. acc.push({
  52579. name: "span",
  52580. value: line
  52581. }, {
  52582. name: "br"
  52583. });
  52584. return acc;
  52585. }, [])).forEach(lines => {
  52586. html.children.push({
  52587. name: "p",
  52588. children: lines
  52589. });
  52590. });
  52591. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  52592. html.name = "div";
  52593. html.children = [];
  52594. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  52595. html.children.push({
  52596. name: "span",
  52597. value: line
  52598. }, {
  52599. name: "br"
  52600. });
  52601. });
  52602. }
  52603. return _utils.HTMLResult.success(html);
  52604. }
  52605. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  52606. }
  52607. }
  52608. exports.Text = Text;
  52609. class TextEdit extends _xfa_object.XFAObject {
  52610. constructor(attributes) {
  52611. super(TEMPLATE_NS_ID, "textEdit", true);
  52612. this.allowRichText = (0, _utils.getInteger)({
  52613. data: attributes.allowRichText,
  52614. defaultValue: 0,
  52615. validate: x => x === 1
  52616. });
  52617. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  52618. this.id = attributes.id || "";
  52619. this.multiLine = (0, _utils.getInteger)({
  52620. data: attributes.multiLine,
  52621. defaultValue: 1,
  52622. validate: x => x === 0
  52623. });
  52624. this.use = attributes.use || "";
  52625. this.usehref = attributes.usehref || "";
  52626. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  52627. this.border = null;
  52628. this.comb = null;
  52629. this.extras = null;
  52630. this.margin = null;
  52631. }
  52632. [_xfa_object.$toHTML](availableSpace) {
  52633. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  52634. let html;
  52635. if (this.multiLine === 1) {
  52636. html = {
  52637. name: "textarea",
  52638. attributes: {
  52639. fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid],
  52640. class: "xfaTextfield",
  52641. style
  52642. }
  52643. };
  52644. } else {
  52645. html = {
  52646. name: "input",
  52647. attributes: {
  52648. type: "text",
  52649. fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid],
  52650. class: "xfaTextfield",
  52651. style
  52652. }
  52653. };
  52654. }
  52655. return _utils.HTMLResult.success({
  52656. name: "label",
  52657. attributes: {
  52658. class: "xfaLabel"
  52659. },
  52660. children: [html]
  52661. });
  52662. }
  52663. }
  52664. class Time extends _xfa_object.StringObject {
  52665. constructor(attributes) {
  52666. super(TEMPLATE_NS_ID, "time");
  52667. this.id = attributes.id || "";
  52668. this.name = attributes.name || "";
  52669. this.use = attributes.use || "";
  52670. this.usehref = attributes.usehref || "";
  52671. }
  52672. [_xfa_object.$finalize]() {
  52673. this[_xfa_object.$content] = new Date(this[_xfa_object.$content]);
  52674. }
  52675. [_xfa_object.$toHTML](availableSpace) {
  52676. return _utils.HTMLResult.success(this[_xfa_object.$content].toString());
  52677. }
  52678. }
  52679. class TimeStamp extends _xfa_object.XFAObject {
  52680. constructor(attributes) {
  52681. super(TEMPLATE_NS_ID, "timeStamp");
  52682. this.id = attributes.id || "";
  52683. this.server = attributes.server || "";
  52684. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52685. this.use = attributes.use || "";
  52686. this.usehref = attributes.usehref || "";
  52687. }
  52688. }
  52689. class ToolTip extends _xfa_object.StringObject {
  52690. constructor(attributes) {
  52691. super(TEMPLATE_NS_ID, "toolTip");
  52692. this.id = attributes.id || "";
  52693. this.rid = attributes.rid || "";
  52694. this.use = attributes.use || "";
  52695. this.usehref = attributes.usehref || "";
  52696. }
  52697. }
  52698. class Traversal extends _xfa_object.XFAObject {
  52699. constructor(attributes) {
  52700. super(TEMPLATE_NS_ID, "traversal", true);
  52701. this.id = attributes.id || "";
  52702. this.use = attributes.use || "";
  52703. this.usehref = attributes.usehref || "";
  52704. this.extras = null;
  52705. this.traverse = new _xfa_object.XFAObjectArray();
  52706. }
  52707. }
  52708. class Traverse extends _xfa_object.XFAObject {
  52709. constructor(attributes) {
  52710. super(TEMPLATE_NS_ID, "traverse", true);
  52711. this.id = attributes.id || "";
  52712. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  52713. this.ref = attributes.ref || "";
  52714. this.use = attributes.use || "";
  52715. this.usehref = attributes.usehref || "";
  52716. this.extras = null;
  52717. this.script = null;
  52718. }
  52719. get name() {
  52720. return this.operation;
  52721. }
  52722. [_xfa_object.$isTransparent]() {
  52723. return false;
  52724. }
  52725. }
  52726. class Ui extends _xfa_object.XFAObject {
  52727. constructor(attributes) {
  52728. super(TEMPLATE_NS_ID, "ui", true);
  52729. this.id = attributes.id || "";
  52730. this.use = attributes.use || "";
  52731. this.usehref = attributes.usehref || "";
  52732. this.extras = null;
  52733. this.picture = null;
  52734. this.barcode = null;
  52735. this.button = null;
  52736. this.checkButton = null;
  52737. this.choiceList = null;
  52738. this.dateTimeEdit = null;
  52739. this.defaultUi = null;
  52740. this.imageEdit = null;
  52741. this.numericEdit = null;
  52742. this.passwordEdit = null;
  52743. this.signature = null;
  52744. this.textEdit = null;
  52745. }
  52746. [_xfa_object.$toHTML](availableSpace) {
  52747. for (const name of Object.getOwnPropertyNames(this)) {
  52748. if (name === "extras" || name === "picture") {
  52749. continue;
  52750. }
  52751. const obj = this[name];
  52752. if (!(obj instanceof _xfa_object.XFAObject)) {
  52753. continue;
  52754. }
  52755. return obj[_xfa_object.$toHTML](availableSpace);
  52756. }
  52757. return _utils.HTMLResult.EMPTY;
  52758. }
  52759. }
  52760. class Validate extends _xfa_object.XFAObject {
  52761. constructor(attributes) {
  52762. super(TEMPLATE_NS_ID, "validate", true);
  52763. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  52764. this.id = attributes.id || "";
  52765. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  52766. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  52767. this.use = attributes.use || "";
  52768. this.usehref = attributes.usehref || "";
  52769. this.extras = null;
  52770. this.message = null;
  52771. this.picture = null;
  52772. this.script = null;
  52773. }
  52774. }
  52775. class Value extends _xfa_object.XFAObject {
  52776. constructor(attributes) {
  52777. super(TEMPLATE_NS_ID, "value", true);
  52778. this.id = attributes.id || "";
  52779. this.override = (0, _utils.getInteger)({
  52780. data: attributes.override,
  52781. defaultValue: 0,
  52782. validate: x => x === 1
  52783. });
  52784. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52785. this.use = attributes.use || "";
  52786. this.usehref = attributes.usehref || "";
  52787. this.arc = null;
  52788. this.boolean = null;
  52789. this.date = null;
  52790. this.dateTime = null;
  52791. this.decimal = null;
  52792. this.exData = null;
  52793. this.float = null;
  52794. this.image = null;
  52795. this.integer = null;
  52796. this.line = null;
  52797. this.rectangle = null;
  52798. this.text = null;
  52799. this.time = null;
  52800. }
  52801. [_xfa_object.$setValue](value) {
  52802. const parent = this[_xfa_object.$getParent]();
  52803. if (parent instanceof Field) {
  52804. if (parent.ui && parent.ui.imageEdit) {
  52805. if (!this.image) {
  52806. this.image = new Image({});
  52807. }
  52808. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  52809. return;
  52810. }
  52811. }
  52812. const valueName = value[_xfa_object.$nodeName];
  52813. if (this[valueName] !== null) {
  52814. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  52815. return;
  52816. }
  52817. for (const name of Object.getOwnPropertyNames(this)) {
  52818. const obj = this[name];
  52819. if (obj instanceof _xfa_object.XFAObject) {
  52820. this[name] = null;
  52821. this[_xfa_object.$removeChild](obj);
  52822. }
  52823. }
  52824. this[value[_xfa_object.$nodeName]] = value;
  52825. this[_xfa_object.$appendChild](value);
  52826. }
  52827. [_xfa_object.$text]() {
  52828. if (this.exData) {
  52829. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  52830. }
  52831. for (const name of Object.getOwnPropertyNames(this)) {
  52832. if (name === "image") {
  52833. continue;
  52834. }
  52835. const obj = this[name];
  52836. if (obj instanceof _xfa_object.XFAObject) {
  52837. return (obj[_xfa_object.$content] || "").toString().trim();
  52838. }
  52839. }
  52840. return null;
  52841. }
  52842. [_xfa_object.$toHTML](availableSpace) {
  52843. for (const name of Object.getOwnPropertyNames(this)) {
  52844. const obj = this[name];
  52845. if (!(obj instanceof _xfa_object.XFAObject)) {
  52846. continue;
  52847. }
  52848. return obj[_xfa_object.$toHTML](availableSpace);
  52849. }
  52850. return _utils.HTMLResult.EMPTY;
  52851. }
  52852. }
  52853. exports.Value = Value;
  52854. class Variables extends _xfa_object.XFAObject {
  52855. constructor(attributes) {
  52856. super(TEMPLATE_NS_ID, "variables", true);
  52857. this.id = attributes.id || "";
  52858. this.use = attributes.use || "";
  52859. this.usehref = attributes.usehref || "";
  52860. this.boolean = new _xfa_object.XFAObjectArray();
  52861. this.date = new _xfa_object.XFAObjectArray();
  52862. this.dateTime = new _xfa_object.XFAObjectArray();
  52863. this.decimal = new _xfa_object.XFAObjectArray();
  52864. this.exData = new _xfa_object.XFAObjectArray();
  52865. this.float = new _xfa_object.XFAObjectArray();
  52866. this.image = new _xfa_object.XFAObjectArray();
  52867. this.integer = new _xfa_object.XFAObjectArray();
  52868. this.manifest = new _xfa_object.XFAObjectArray();
  52869. this.script = new _xfa_object.XFAObjectArray();
  52870. this.text = new _xfa_object.XFAObjectArray();
  52871. this.time = new _xfa_object.XFAObjectArray();
  52872. }
  52873. [_xfa_object.$isTransparent]() {
  52874. return true;
  52875. }
  52876. }
  52877. class TemplateNamespace {
  52878. static [_namespaces.$buildXFAObject](name, attributes) {
  52879. if (TemplateNamespace.hasOwnProperty(name)) {
  52880. const node = TemplateNamespace[name](attributes);
  52881. node[_xfa_object.$setSetAttributes](attributes);
  52882. return node;
  52883. }
  52884. return undefined;
  52885. }
  52886. static appearanceFilter(attrs) {
  52887. return new AppearanceFilter(attrs);
  52888. }
  52889. static arc(attrs) {
  52890. return new Arc(attrs);
  52891. }
  52892. static area(attrs) {
  52893. return new Area(attrs);
  52894. }
  52895. static assist(attrs) {
  52896. return new Assist(attrs);
  52897. }
  52898. static barcode(attrs) {
  52899. return new Barcode(attrs);
  52900. }
  52901. static bind(attrs) {
  52902. return new Bind(attrs);
  52903. }
  52904. static bindItems(attrs) {
  52905. return new BindItems(attrs);
  52906. }
  52907. static bookend(attrs) {
  52908. return new Bookend(attrs);
  52909. }
  52910. static boolean(attrs) {
  52911. return new BooleanElement(attrs);
  52912. }
  52913. static border(attrs) {
  52914. return new Border(attrs);
  52915. }
  52916. static break(attrs) {
  52917. return new Break(attrs);
  52918. }
  52919. static breakAfter(attrs) {
  52920. return new BreakAfter(attrs);
  52921. }
  52922. static breakBefore(attrs) {
  52923. return new BreakBefore(attrs);
  52924. }
  52925. static button(attrs) {
  52926. return new Button(attrs);
  52927. }
  52928. static calculate(attrs) {
  52929. return new Calculate(attrs);
  52930. }
  52931. static caption(attrs) {
  52932. return new Caption(attrs);
  52933. }
  52934. static certificate(attrs) {
  52935. return new Certificate(attrs);
  52936. }
  52937. static certificates(attrs) {
  52938. return new Certificates(attrs);
  52939. }
  52940. static checkButton(attrs) {
  52941. return new CheckButton(attrs);
  52942. }
  52943. static choiceList(attrs) {
  52944. return new ChoiceList(attrs);
  52945. }
  52946. static color(attrs) {
  52947. return new Color(attrs);
  52948. }
  52949. static comb(attrs) {
  52950. return new Comb(attrs);
  52951. }
  52952. static connect(attrs) {
  52953. return new Connect(attrs);
  52954. }
  52955. static contentArea(attrs) {
  52956. return new ContentArea(attrs);
  52957. }
  52958. static corner(attrs) {
  52959. return new Corner(attrs);
  52960. }
  52961. static date(attrs) {
  52962. return new DateElement(attrs);
  52963. }
  52964. static dateTime(attrs) {
  52965. return new DateTime(attrs);
  52966. }
  52967. static dateTimeEdit(attrs) {
  52968. return new DateTimeEdit(attrs);
  52969. }
  52970. static decimal(attrs) {
  52971. return new Decimal(attrs);
  52972. }
  52973. static defaultUi(attrs) {
  52974. return new DefaultUi(attrs);
  52975. }
  52976. static desc(attrs) {
  52977. return new Desc(attrs);
  52978. }
  52979. static digestMethod(attrs) {
  52980. return new DigestMethod(attrs);
  52981. }
  52982. static digestMethods(attrs) {
  52983. return new DigestMethods(attrs);
  52984. }
  52985. static draw(attrs) {
  52986. return new Draw(attrs);
  52987. }
  52988. static edge(attrs) {
  52989. return new Edge(attrs);
  52990. }
  52991. static encoding(attrs) {
  52992. return new Encoding(attrs);
  52993. }
  52994. static encodings(attrs) {
  52995. return new Encodings(attrs);
  52996. }
  52997. static encrypt(attrs) {
  52998. return new Encrypt(attrs);
  52999. }
  53000. static encryptData(attrs) {
  53001. return new EncryptData(attrs);
  53002. }
  53003. static encryption(attrs) {
  53004. return new Encryption(attrs);
  53005. }
  53006. static encryptionMethod(attrs) {
  53007. return new EncryptionMethod(attrs);
  53008. }
  53009. static encryptionMethods(attrs) {
  53010. return new EncryptionMethods(attrs);
  53011. }
  53012. static event(attrs) {
  53013. return new Event(attrs);
  53014. }
  53015. static exData(attrs) {
  53016. return new ExData(attrs);
  53017. }
  53018. static exObject(attrs) {
  53019. return new ExObject(attrs);
  53020. }
  53021. static exclGroup(attrs) {
  53022. return new ExclGroup(attrs);
  53023. }
  53024. static execute(attrs) {
  53025. return new Execute(attrs);
  53026. }
  53027. static extras(attrs) {
  53028. return new Extras(attrs);
  53029. }
  53030. static field(attrs) {
  53031. return new Field(attrs);
  53032. }
  53033. static fill(attrs) {
  53034. return new Fill(attrs);
  53035. }
  53036. static filter(attrs) {
  53037. return new Filter(attrs);
  53038. }
  53039. static float(attrs) {
  53040. return new Float(attrs);
  53041. }
  53042. static font(attrs) {
  53043. return new Font(attrs);
  53044. }
  53045. static format(attrs) {
  53046. return new Format(attrs);
  53047. }
  53048. static handler(attrs) {
  53049. return new Handler(attrs);
  53050. }
  53051. static hyphenation(attrs) {
  53052. return new Hyphenation(attrs);
  53053. }
  53054. static image(attrs) {
  53055. return new Image(attrs);
  53056. }
  53057. static imageEdit(attrs) {
  53058. return new ImageEdit(attrs);
  53059. }
  53060. static integer(attrs) {
  53061. return new Integer(attrs);
  53062. }
  53063. static issuers(attrs) {
  53064. return new Issuers(attrs);
  53065. }
  53066. static items(attrs) {
  53067. return new Items(attrs);
  53068. }
  53069. static keep(attrs) {
  53070. return new Keep(attrs);
  53071. }
  53072. static keyUsage(attrs) {
  53073. return new KeyUsage(attrs);
  53074. }
  53075. static line(attrs) {
  53076. return new Line(attrs);
  53077. }
  53078. static linear(attrs) {
  53079. return new Linear(attrs);
  53080. }
  53081. static lockDocument(attrs) {
  53082. return new LockDocument(attrs);
  53083. }
  53084. static manifest(attrs) {
  53085. return new Manifest(attrs);
  53086. }
  53087. static margin(attrs) {
  53088. return new Margin(attrs);
  53089. }
  53090. static mdp(attrs) {
  53091. return new Mdp(attrs);
  53092. }
  53093. static medium(attrs) {
  53094. return new Medium(attrs);
  53095. }
  53096. static message(attrs) {
  53097. return new Message(attrs);
  53098. }
  53099. static numericEdit(attrs) {
  53100. return new NumericEdit(attrs);
  53101. }
  53102. static occur(attrs) {
  53103. return new Occur(attrs);
  53104. }
  53105. static oid(attrs) {
  53106. return new Oid(attrs);
  53107. }
  53108. static oids(attrs) {
  53109. return new Oids(attrs);
  53110. }
  53111. static overflow(attrs) {
  53112. return new Overflow(attrs);
  53113. }
  53114. static pageArea(attrs) {
  53115. return new PageArea(attrs);
  53116. }
  53117. static pageSet(attrs) {
  53118. return new PageSet(attrs);
  53119. }
  53120. static para(attrs) {
  53121. return new Para(attrs);
  53122. }
  53123. static passwordEdit(attrs) {
  53124. return new PasswordEdit(attrs);
  53125. }
  53126. static pattern(attrs) {
  53127. return new Pattern(attrs);
  53128. }
  53129. static picture(attrs) {
  53130. return new Picture(attrs);
  53131. }
  53132. static proto(attrs) {
  53133. return new Proto(attrs);
  53134. }
  53135. static radial(attrs) {
  53136. return new Radial(attrs);
  53137. }
  53138. static reason(attrs) {
  53139. return new Reason(attrs);
  53140. }
  53141. static reasons(attrs) {
  53142. return new Reasons(attrs);
  53143. }
  53144. static rectangle(attrs) {
  53145. return new Rectangle(attrs);
  53146. }
  53147. static ref(attrs) {
  53148. return new RefElement(attrs);
  53149. }
  53150. static script(attrs) {
  53151. return new Script(attrs);
  53152. }
  53153. static setProperty(attrs) {
  53154. return new SetProperty(attrs);
  53155. }
  53156. static signData(attrs) {
  53157. return new SignData(attrs);
  53158. }
  53159. static signature(attrs) {
  53160. return new Signature(attrs);
  53161. }
  53162. static signing(attrs) {
  53163. return new Signing(attrs);
  53164. }
  53165. static solid(attrs) {
  53166. return new Solid(attrs);
  53167. }
  53168. static speak(attrs) {
  53169. return new Speak(attrs);
  53170. }
  53171. static stipple(attrs) {
  53172. return new Stipple(attrs);
  53173. }
  53174. static subform(attrs) {
  53175. return new Subform(attrs);
  53176. }
  53177. static subformSet(attrs) {
  53178. return new SubformSet(attrs);
  53179. }
  53180. static subjectDN(attrs) {
  53181. return new SubjectDN(attrs);
  53182. }
  53183. static subjectDNs(attrs) {
  53184. return new SubjectDNs(attrs);
  53185. }
  53186. static submit(attrs) {
  53187. return new Submit(attrs);
  53188. }
  53189. static template(attrs) {
  53190. return new Template(attrs);
  53191. }
  53192. static text(attrs) {
  53193. return new Text(attrs);
  53194. }
  53195. static textEdit(attrs) {
  53196. return new TextEdit(attrs);
  53197. }
  53198. static time(attrs) {
  53199. return new Time(attrs);
  53200. }
  53201. static timeStamp(attrs) {
  53202. return new TimeStamp(attrs);
  53203. }
  53204. static toolTip(attrs) {
  53205. return new ToolTip(attrs);
  53206. }
  53207. static traversal(attrs) {
  53208. return new Traversal(attrs);
  53209. }
  53210. static traverse(attrs) {
  53211. return new Traverse(attrs);
  53212. }
  53213. static ui(attrs) {
  53214. return new Ui(attrs);
  53215. }
  53216. static validate(attrs) {
  53217. return new Validate(attrs);
  53218. }
  53219. static value(attrs) {
  53220. return new Value(attrs);
  53221. }
  53222. static variables(attrs) {
  53223. return new Variables(attrs);
  53224. }
  53225. }
  53226. exports.TemplateNamespace = TemplateNamespace;
  53227. /***/ }),
  53228. /* 73 */
  53229. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53230. Object.defineProperty(exports, "__esModule", ({
  53231. value: true
  53232. }));
  53233. exports.addExtraDivForBorder = addExtraDivForBorder;
  53234. exports.computeBbox = computeBbox;
  53235. exports.fixDimensions = fixDimensions;
  53236. exports.fixTextIndent = fixTextIndent;
  53237. exports.getFonts = getFonts;
  53238. exports.layoutClass = layoutClass;
  53239. exports.layoutText = layoutText;
  53240. exports.measureToString = measureToString;
  53241. exports.toStyle = toStyle;
  53242. var _xfa_object = __w_pdfjs_require__(68);
  53243. var _utils = __w_pdfjs_require__(69);
  53244. var _util = __w_pdfjs_require__(2);
  53245. const wordNonWordRegex = new RegExp("([\\p{N}\\p{L}\\p{M}]+)|([^\\p{N}\\p{L}\\p{M}]+)", "gu");
  53246. const wordFirstRegex = new RegExp("^[\\p{N}\\p{L}\\p{M}]", "u");
  53247. function measureToString(m) {
  53248. if (typeof m === "string") {
  53249. return "0px";
  53250. }
  53251. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  53252. }
  53253. const converters = {
  53254. anchorType(node, style) {
  53255. const parent = node[_xfa_object.$getParent]();
  53256. if (!parent || parent.layout && parent.layout !== "position") {
  53257. return;
  53258. }
  53259. if (!("transform" in style)) {
  53260. style.transform = "";
  53261. }
  53262. switch (node.anchorType) {
  53263. case "bottomCenter":
  53264. style.transform += "translate(-50%, -100%)";
  53265. break;
  53266. case "bottomLeft":
  53267. style.transform += "translate(0,-100%)";
  53268. break;
  53269. case "bottomRight":
  53270. style.transform += "translate(-100%,-100%)";
  53271. break;
  53272. case "middleCenter":
  53273. style.transform += "translate(-50%,-50%)";
  53274. break;
  53275. case "middleLeft":
  53276. style.transform += "translate(0,-50%)";
  53277. break;
  53278. case "middleRight":
  53279. style.transform += "translate(-100%,-50%)";
  53280. break;
  53281. case "topCenter":
  53282. style.transform += "translate(-50%,0)";
  53283. break;
  53284. case "topRight":
  53285. style.transform += "translate(-100%,0)";
  53286. break;
  53287. }
  53288. },
  53289. dimensions(node, style) {
  53290. const parent = node[_xfa_object.$getParent]();
  53291. let width = node.w;
  53292. const height = node.h;
  53293. if (parent.layout && parent.layout.includes("row")) {
  53294. const extra = parent[_xfa_object.$extra];
  53295. const colSpan = node.colSpan;
  53296. let w;
  53297. if (colSpan === -1) {
  53298. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  53299. extra.currentColumn = 0;
  53300. } else {
  53301. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  53302. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  53303. }
  53304. if (!isNaN(w)) {
  53305. width = node.w = w;
  53306. }
  53307. }
  53308. if (width !== "") {
  53309. style.width = measureToString(width);
  53310. } else {
  53311. style.width = "auto";
  53312. if (node.maxW > 0) {
  53313. style.maxWidth = measureToString(node.maxW);
  53314. }
  53315. if (parent.layout === "position") {
  53316. style.minWidth = measureToString(node.minW);
  53317. }
  53318. }
  53319. if (height !== "") {
  53320. style.height = measureToString(height);
  53321. } else {
  53322. style.height = "auto";
  53323. if (node.maxH > 0) {
  53324. style.maxHeight = measureToString(node.maxH);
  53325. }
  53326. if (parent.layout === "position") {
  53327. style.minHeight = measureToString(node.minH);
  53328. }
  53329. }
  53330. },
  53331. position(node, style) {
  53332. const parent = node[_xfa_object.$getParent]();
  53333. if (parent && parent.layout && parent.layout !== "position") {
  53334. return;
  53335. }
  53336. style.position = "absolute";
  53337. style.left = measureToString(node.x);
  53338. style.top = measureToString(node.y);
  53339. },
  53340. rotate(node, style) {
  53341. if (node.rotate) {
  53342. if (!("transform" in style)) {
  53343. style.transform = "";
  53344. }
  53345. style.transform += `rotate(-${node.rotate}deg)`;
  53346. style.transformOrigin = "top left";
  53347. }
  53348. },
  53349. presence(node, style) {
  53350. switch (node.presence) {
  53351. case "invisible":
  53352. style.visibility = "hidden";
  53353. break;
  53354. case "hidden":
  53355. case "inactive":
  53356. style.display = "none";
  53357. break;
  53358. }
  53359. },
  53360. hAlign(node, style) {
  53361. if (node[_xfa_object.$nodeName] === "para") {
  53362. switch (node.hAlign) {
  53363. case "justifyAll":
  53364. style.textAlign = "justify-all";
  53365. break;
  53366. case "radix":
  53367. style.textAlign = "left";
  53368. break;
  53369. default:
  53370. style.textAlign = node.hAlign;
  53371. }
  53372. } else {
  53373. switch (node.hAlign) {
  53374. case "right":
  53375. case "center":
  53376. style.justifyContent = node.hAlign;
  53377. break;
  53378. }
  53379. }
  53380. },
  53381. borderMarginPadding(node, style) {
  53382. const borderWidths = [0, 0, 0, 0];
  53383. const borderInsets = [0, 0, 0, 0];
  53384. const marginNode = node.margin ? [node.margin.topInset, node.margin.rightInset, node.margin.bottomInset, node.margin.leftInset] : [0, 0, 0, 0];
  53385. let borderMargin;
  53386. if (node.border) {
  53387. Object.assign(style, node.border[_xfa_object.$toStyle](borderWidths, borderInsets));
  53388. borderMargin = style.margin;
  53389. delete style.margin;
  53390. }
  53391. if (borderWidths.every(x => x === 0)) {
  53392. if (marginNode.every(x => x === 0)) {
  53393. return;
  53394. }
  53395. Object.assign(style, node.margin[_xfa_object.$toStyle]());
  53396. style.padding = style.margin;
  53397. delete style.margin;
  53398. delete style.outline;
  53399. delete style.outlineOffset;
  53400. return;
  53401. }
  53402. if (node.margin) {
  53403. Object.assign(style, node.margin[_xfa_object.$toStyle]());
  53404. style.padding = style.margin;
  53405. delete style.margin;
  53406. }
  53407. if (!style.borderWidth) {
  53408. return;
  53409. }
  53410. style.borderData = {
  53411. borderWidth: style.borderWidth,
  53412. borderColor: style.borderColor,
  53413. borderStyle: style.borderStyle,
  53414. margin: borderMargin
  53415. };
  53416. delete style.borderWidth;
  53417. delete style.borderColor;
  53418. delete style.borderStyle;
  53419. }
  53420. };
  53421. function layoutText(text, fontSize, space) {
  53422. let width = 0;
  53423. let height = 0;
  53424. let totalWidth = 0;
  53425. const lineHeight = fontSize * 1.5;
  53426. const averageCharSize = fontSize * 0.4;
  53427. const maxCharOnLine = Math.floor(space.width / averageCharSize);
  53428. const chunks = text.match(wordNonWordRegex);
  53429. let treatedChars = 0;
  53430. let i = 0;
  53431. let chunk = chunks[0];
  53432. while (chunk) {
  53433. const w = chunk.length * averageCharSize;
  53434. if (width + w <= space.width) {
  53435. width += w;
  53436. treatedChars += chunk.length;
  53437. chunk = chunks[i++];
  53438. continue;
  53439. }
  53440. if (!wordFirstRegex.test(chunk) || chunk.length > maxCharOnLine) {
  53441. const numOfCharOnLine = Math.floor((space.width - width) / averageCharSize);
  53442. chunk = chunk.slice(numOfCharOnLine);
  53443. treatedChars += numOfCharOnLine;
  53444. if (height + lineHeight > space.height) {
  53445. return {
  53446. width: 0,
  53447. height: 0,
  53448. splitPos: treatedChars
  53449. };
  53450. }
  53451. totalWidth = Math.max(width, totalWidth);
  53452. width = 0;
  53453. height += lineHeight;
  53454. continue;
  53455. }
  53456. if (height + lineHeight > space.height) {
  53457. return {
  53458. width: 0,
  53459. height: 0,
  53460. splitPos: treatedChars
  53461. };
  53462. }
  53463. totalWidth = Math.max(width, totalWidth);
  53464. width = w;
  53465. height += lineHeight;
  53466. chunk = chunks[i++];
  53467. }
  53468. if (totalWidth === 0) {
  53469. totalWidth = width;
  53470. }
  53471. if (totalWidth !== 0) {
  53472. height += lineHeight;
  53473. }
  53474. return {
  53475. width: totalWidth,
  53476. height,
  53477. splitPos: -1
  53478. };
  53479. }
  53480. function computeBbox(node, html, availableSpace) {
  53481. let bbox;
  53482. if (node.w !== "" && node.h !== "") {
  53483. bbox = [node.x, node.y, node.w, node.h];
  53484. } else {
  53485. if (!availableSpace) {
  53486. return null;
  53487. }
  53488. let width = node.w;
  53489. if (width === "") {
  53490. if (node.maxW === 0) {
  53491. const parent = node[_xfa_object.$getParent]();
  53492. if (parent.layout === "position" && parent.w !== "") {
  53493. width = 0;
  53494. } else {
  53495. width = node.minW;
  53496. }
  53497. } else {
  53498. width = Math.min(node.maxW, availableSpace.width);
  53499. }
  53500. html.attributes.style.width = measureToString(width);
  53501. }
  53502. let height = node.h;
  53503. if (height === "") {
  53504. if (node.maxH === 0) {
  53505. const parent = node[_xfa_object.$getParent]();
  53506. if (parent.layout === "position" && parent.h !== "") {
  53507. height = 0;
  53508. } else {
  53509. height = node.minH;
  53510. }
  53511. } else {
  53512. height = Math.min(node.maxH, availableSpace.height);
  53513. }
  53514. html.attributes.style.height = measureToString(height);
  53515. }
  53516. bbox = [node.x, node.y, width, height];
  53517. }
  53518. return bbox;
  53519. }
  53520. function fixDimensions(node) {
  53521. const parent = node[_xfa_object.$getParent]();
  53522. if (parent.layout && parent.layout.includes("row")) {
  53523. const extra = parent[_xfa_object.$extra];
  53524. const colSpan = node.colSpan;
  53525. let width;
  53526. if (colSpan === -1) {
  53527. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  53528. } else {
  53529. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  53530. }
  53531. if (!isNaN(width)) {
  53532. node.w = width;
  53533. }
  53534. }
  53535. if (parent.w && node.w) {
  53536. node.w = Math.min(parent.w, node.w);
  53537. }
  53538. if (parent.h && node.h) {
  53539. node.h = Math.min(parent.h, node.h);
  53540. }
  53541. if (parent.layout && parent.layout !== "position") {
  53542. node.x = node.y = 0;
  53543. if (parent.layout === "tb") {
  53544. if (parent.w !== "" && (node.w === "" || node.w === 0 || node.w > parent.w)) {
  53545. node.w = parent.w;
  53546. }
  53547. }
  53548. }
  53549. if (node.layout === "position") {
  53550. node.minW = node.minH = 0;
  53551. node.maxW = node.maxH = Infinity;
  53552. } else {
  53553. if (node.layout === "table") {
  53554. if (node.w === "" && Array.isArray(node.columnWidths)) {
  53555. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  53556. }
  53557. }
  53558. }
  53559. }
  53560. function layoutClass(node) {
  53561. switch (node.layout) {
  53562. case "position":
  53563. return "xfaPosition";
  53564. case "lr-tb":
  53565. return "xfaLrTb";
  53566. case "rl-row":
  53567. return "xfaRlRow";
  53568. case "rl-tb":
  53569. return "xfaRlTb";
  53570. case "row":
  53571. return "xfaRow";
  53572. case "table":
  53573. return "xfaTable";
  53574. case "tb":
  53575. return "xfaTb";
  53576. default:
  53577. return "xfaPosition";
  53578. }
  53579. }
  53580. function toStyle(node, ...names) {
  53581. const style = Object.create(null);
  53582. for (const name of names) {
  53583. const value = node[name];
  53584. if (value === null) {
  53585. continue;
  53586. }
  53587. if (value instanceof _xfa_object.XFAObject) {
  53588. const newStyle = value[_xfa_object.$toStyle]();
  53589. if (newStyle) {
  53590. Object.assign(style, newStyle);
  53591. } else {
  53592. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  53593. }
  53594. continue;
  53595. }
  53596. if (converters.hasOwnProperty(name)) {
  53597. converters[name](node, style);
  53598. }
  53599. }
  53600. return style;
  53601. }
  53602. function addExtraDivForBorder(html) {
  53603. const style = html.attributes.style;
  53604. const data = style.borderData;
  53605. const children = [];
  53606. const attributes = {
  53607. class: "xfaWrapper",
  53608. style: Object.create(null)
  53609. };
  53610. for (const key of ["top", "left"]) {
  53611. if (style[key] !== undefined) {
  53612. attributes.style[key] = style[key];
  53613. }
  53614. }
  53615. delete style.top;
  53616. delete style.left;
  53617. if (style.position === "absolute") {
  53618. attributes.style.position = "absolute";
  53619. } else {
  53620. attributes.style.position = "relative";
  53621. }
  53622. delete style.position;
  53623. if (style.justifyContent) {
  53624. attributes.style.justifyContent = style.justifyContent;
  53625. delete style.justifyContent;
  53626. }
  53627. if (data) {
  53628. delete style.borderData;
  53629. let insets;
  53630. if (data.margin) {
  53631. insets = data.margin.split(" ");
  53632. delete data.margin;
  53633. } else {
  53634. insets = ["0px", "0px", "0px", "0px"];
  53635. }
  53636. let width = "100%";
  53637. let height = width;
  53638. if (insets[1] !== "0px" || insets[3] !== "0px") {
  53639. width = `calc(100% - ${parseInt(insets[1]) + parseInt(insets[3])}px`;
  53640. }
  53641. if (insets[0] !== "0px" || insets[2] !== "0px") {
  53642. height = `calc(100% - ${parseInt(insets[0]) + parseInt(insets[2])}px`;
  53643. }
  53644. const borderStyle = {
  53645. top: insets[0],
  53646. left: insets[3],
  53647. width,
  53648. height
  53649. };
  53650. for (const [k, v] of Object.entries(data)) {
  53651. borderStyle[k] = v;
  53652. }
  53653. if (style.transform) {
  53654. borderStyle.transform = style.transform;
  53655. }
  53656. const borderDiv = {
  53657. name: "div",
  53658. attributes: {
  53659. class: "xfaBorderDiv",
  53660. style: borderStyle
  53661. }
  53662. };
  53663. children.push(borderDiv);
  53664. }
  53665. children.push(html);
  53666. return {
  53667. name: "div",
  53668. attributes,
  53669. children
  53670. };
  53671. }
  53672. function fixTextIndent(styles) {
  53673. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  53674. if (indent >= 0) {
  53675. return;
  53676. }
  53677. const align = styles.textAlign || "left";
  53678. if (align === "left" || align === "right") {
  53679. const name = "margin" + (align === "left" ? "Left" : "Right");
  53680. const margin = (0, _utils.getMeasurement)(styles[name], "0px");
  53681. styles[name] = `${margin - indent}pt`;
  53682. }
  53683. }
  53684. function getFonts(family) {
  53685. if (family.startsWith("'")) {
  53686. family = `"${family.slice(1, family.length - 1)}"`;
  53687. } else if (family.includes(" ") && !family.startsWith('"')) {
  53688. family = `"${family}"`;
  53689. }
  53690. const fonts = [family];
  53691. switch (family) {
  53692. case `"Myriad Pro"`:
  53693. fonts.push(`"Roboto Condensed"`, `"Ubuntu Condensed"`, `"Microsoft Sans Serif"`, `"Apple Symbols"`, "Helvetica", `"sans serif"`);
  53694. break;
  53695. case "Arial":
  53696. fonts.push("Helvetica", `"Liberation Sans"`, "Arimo", `"sans serif"`);
  53697. break;
  53698. }
  53699. return fonts.join(",");
  53700. }
  53701. /***/ }),
  53702. /* 74 */
  53703. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53704. Object.defineProperty(exports, "__esModule", ({
  53705. value: true
  53706. }));
  53707. exports.addHTML = addHTML;
  53708. exports.flushHTML = flushHTML;
  53709. exports.getAvailableSpace = getAvailableSpace;
  53710. var _xfa_object = __w_pdfjs_require__(68);
  53711. var _html_utils = __w_pdfjs_require__(73);
  53712. function flushHTML(node) {
  53713. const attributes = node[_xfa_object.$extra].attributes;
  53714. const html = {
  53715. name: "div",
  53716. attributes,
  53717. children: node[_xfa_object.$extra].children
  53718. };
  53719. if (node[_xfa_object.$extra].failingNode) {
  53720. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  53721. if (htmlFromFailing) {
  53722. html.children.push(htmlFromFailing);
  53723. }
  53724. }
  53725. if (html.children.length === 0) {
  53726. return null;
  53727. }
  53728. node[_xfa_object.$extra].children = [];
  53729. delete node[_xfa_object.$extra].line;
  53730. return html;
  53731. }
  53732. function addHTML(node, html, bbox) {
  53733. const extra = node[_xfa_object.$extra];
  53734. const availableSpace = extra.availableSpace;
  53735. switch (node.layout) {
  53736. case "position":
  53737. {
  53738. const [x, y, w, h] = bbox;
  53739. extra.width = Math.max(extra.width, x + w);
  53740. extra.height = Math.max(extra.height, y + h);
  53741. extra.children.push(html);
  53742. break;
  53743. }
  53744. case "lr-tb":
  53745. case "rl-tb":
  53746. if (!extra.line || extra.attempt === 1) {
  53747. extra.line = {
  53748. name: "div",
  53749. attributes: {
  53750. class: node.layout === "lr-tb" ? "xfaLr" : "xfaRl"
  53751. },
  53752. children: []
  53753. };
  53754. extra.children.push(extra.line);
  53755. }
  53756. extra.line.children.push(html);
  53757. if (extra.attempt === 0) {
  53758. const [,, w, h] = bbox;
  53759. extra.currentWidth += w;
  53760. extra.height = Math.max(extra.height, extra.prevHeight + h);
  53761. } else {
  53762. const [,, w, h] = bbox;
  53763. extra.width = Math.max(extra.width, extra.currentWidth);
  53764. extra.currentWidth = w;
  53765. extra.prevHeight = extra.height;
  53766. extra.height += h;
  53767. extra.attempt = 0;
  53768. }
  53769. break;
  53770. case "rl-row":
  53771. case "row":
  53772. {
  53773. extra.children.push(html);
  53774. const [,, w, h] = bbox;
  53775. extra.width += w;
  53776. extra.height = Math.max(extra.height, h);
  53777. const height = (0, _html_utils.measureToString)(extra.height);
  53778. for (const child of extra.children) {
  53779. if (child.attributes.class === "xfaWrapper") {
  53780. child.children[child.children.length - 1].attributes.style.height = height;
  53781. } else {
  53782. child.attributes.style.height = height;
  53783. }
  53784. }
  53785. break;
  53786. }
  53787. case "table":
  53788. {
  53789. const [,, w, h] = bbox;
  53790. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  53791. extra.height += h;
  53792. extra.children.push(html);
  53793. break;
  53794. }
  53795. case "tb":
  53796. {
  53797. const [,,, h] = bbox;
  53798. extra.width = availableSpace.width;
  53799. extra.height += h;
  53800. extra.children.push(html);
  53801. break;
  53802. }
  53803. }
  53804. }
  53805. function getAvailableSpace(node) {
  53806. const availableSpace = node[_xfa_object.$extra].availableSpace;
  53807. switch (node.layout) {
  53808. case "lr-tb":
  53809. case "rl-tb":
  53810. switch (node[_xfa_object.$extra].attempt) {
  53811. case 0:
  53812. return {
  53813. width: availableSpace.width - node[_xfa_object.$extra].currentWidth,
  53814. height: availableSpace.height - node[_xfa_object.$extra].prevHeight
  53815. };
  53816. case 1:
  53817. return {
  53818. width: availableSpace.width,
  53819. height: availableSpace.height - node[_xfa_object.$extra].height
  53820. };
  53821. default:
  53822. return {
  53823. width: Infinity,
  53824. height: availableSpace.height - node[_xfa_object.$extra].prevHeight
  53825. };
  53826. }
  53827. case "rl-row":
  53828. case "row":
  53829. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  53830. return {
  53831. width,
  53832. height: availableSpace.height
  53833. };
  53834. case "table":
  53835. case "tb":
  53836. return {
  53837. width: availableSpace.width,
  53838. height: availableSpace.height - node[_xfa_object.$extra].height
  53839. };
  53840. case "position":
  53841. default:
  53842. return availableSpace;
  53843. }
  53844. }
  53845. /***/ }),
  53846. /* 75 */
  53847. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53848. Object.defineProperty(exports, "__esModule", ({
  53849. value: true
  53850. }));
  53851. exports.createDataNode = createDataNode;
  53852. exports.searchNode = searchNode;
  53853. var _xfa_object = __w_pdfjs_require__(68);
  53854. var _util = __w_pdfjs_require__(2);
  53855. const namePattern = /^[^.[]+/;
  53856. const indexPattern = /^[^\]]+/;
  53857. const operators = {
  53858. dot: 0,
  53859. dotDot: 1,
  53860. dotHash: 2,
  53861. dotBracket: 3,
  53862. dotParen: 4
  53863. };
  53864. 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]]);
  53865. const somCache = new WeakMap();
  53866. function parseIndex(index) {
  53867. index = index.trim();
  53868. if (index === "*") {
  53869. return Infinity;
  53870. }
  53871. return parseInt(index, 10) || 0;
  53872. }
  53873. function parseExpression(expr, dotDotAllowed) {
  53874. let match = expr.match(namePattern);
  53875. if (!match) {
  53876. return null;
  53877. }
  53878. let [name] = match;
  53879. const parsed = [{
  53880. name,
  53881. cacheName: "." + name,
  53882. index: 0,
  53883. js: null,
  53884. formCalc: null,
  53885. operator: operators.dot
  53886. }];
  53887. let pos = name.length;
  53888. while (pos < expr.length) {
  53889. const spos = pos;
  53890. const char = expr.charAt(pos++);
  53891. if (char === "[") {
  53892. match = expr.slice(pos).match(indexPattern);
  53893. if (!match) {
  53894. (0, _util.warn)("XFA - Invalid index in SOM expression");
  53895. return null;
  53896. }
  53897. parsed[parsed.length - 1].index = parseIndex(match[0]);
  53898. pos += match[0].length + 1;
  53899. continue;
  53900. }
  53901. let operator;
  53902. switch (expr.charAt(pos)) {
  53903. case ".":
  53904. if (!dotDotAllowed) {
  53905. return null;
  53906. }
  53907. pos++;
  53908. operator = operators.dotDot;
  53909. break;
  53910. case "#":
  53911. pos++;
  53912. operator = operators.dotHash;
  53913. break;
  53914. case "[":
  53915. operator = operators.dotBracket;
  53916. break;
  53917. case "(":
  53918. operator = operators.dotParen;
  53919. break;
  53920. default:
  53921. operator = operators.dot;
  53922. break;
  53923. }
  53924. match = expr.slice(pos).match(namePattern);
  53925. if (!match) {
  53926. break;
  53927. }
  53928. [name] = match;
  53929. pos += name.length;
  53930. parsed.push({
  53931. name,
  53932. cacheName: expr.slice(spos, pos),
  53933. operator,
  53934. index: 0,
  53935. js: null,
  53936. formCalc: null
  53937. });
  53938. }
  53939. return parsed;
  53940. }
  53941. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  53942. const parsed = parseExpression(expr, dotDotAllowed);
  53943. if (!parsed) {
  53944. return null;
  53945. }
  53946. const fn = shortcuts.get(parsed[0].name);
  53947. let i = 0;
  53948. let isQualified;
  53949. if (fn) {
  53950. isQualified = true;
  53951. root = [fn(root, container)];
  53952. i = 1;
  53953. } else {
  53954. isQualified = container === null;
  53955. root = [container || root];
  53956. }
  53957. for (let ii = parsed.length; i < ii; i++) {
  53958. const {
  53959. name,
  53960. cacheName,
  53961. operator,
  53962. index
  53963. } = parsed[i];
  53964. const nodes = [];
  53965. for (const node of root) {
  53966. if (!(node instanceof _xfa_object.XFAObject)) {
  53967. continue;
  53968. }
  53969. let children, cached;
  53970. if (useCache) {
  53971. cached = somCache.get(node);
  53972. if (!cached) {
  53973. cached = new Map();
  53974. somCache.set(node, cached);
  53975. }
  53976. children = cached.get(cacheName);
  53977. }
  53978. if (!children) {
  53979. switch (operator) {
  53980. case operators.dot:
  53981. children = node[_xfa_object.$getChildrenByName](name, false);
  53982. break;
  53983. case operators.dotDot:
  53984. children = node[_xfa_object.$getChildrenByName](name, true);
  53985. break;
  53986. case operators.dotHash:
  53987. children = node[_xfa_object.$getChildrenByClass](name);
  53988. if (children instanceof _xfa_object.XFAObjectArray) {
  53989. children = children.children;
  53990. } else {
  53991. children = [children];
  53992. }
  53993. break;
  53994. default:
  53995. break;
  53996. }
  53997. if (useCache) {
  53998. cached.set(cacheName, children);
  53999. }
  54000. }
  54001. if (children.length > 0) {
  54002. nodes.push(children);
  54003. }
  54004. }
  54005. if (nodes.length === 0 && !isQualified && i === 0) {
  54006. const parent = container[_xfa_object.$getParent]();
  54007. container = parent;
  54008. if (!container) {
  54009. return null;
  54010. }
  54011. i = -1;
  54012. root = [container];
  54013. continue;
  54014. }
  54015. if (isFinite(index)) {
  54016. root = nodes.filter(node => index < node.length).map(node => node[index]);
  54017. } else {
  54018. root = nodes.reduce((acc, node) => acc.concat(node), []);
  54019. }
  54020. }
  54021. if (root.length === 0) {
  54022. return null;
  54023. }
  54024. return root;
  54025. }
  54026. function createNodes(root, path) {
  54027. let node = null;
  54028. for (const {
  54029. name,
  54030. index
  54031. } of path) {
  54032. for (let i = 0; i <= index; i++) {
  54033. node = new _xfa_object.XmlObject(root[_xfa_object.$namespaceId], name);
  54034. root[_xfa_object.$appendChild](node);
  54035. }
  54036. root = node;
  54037. }
  54038. return node;
  54039. }
  54040. function createDataNode(root, container, expr) {
  54041. const parsed = parseExpression(expr);
  54042. if (!parsed) {
  54043. return null;
  54044. }
  54045. if (parsed.some(x => x.operator === operators.dotDot)) {
  54046. return null;
  54047. }
  54048. const fn = shortcuts.get(parsed[0].name);
  54049. let i = 0;
  54050. if (fn) {
  54051. root = fn(root, container);
  54052. i = 1;
  54053. } else {
  54054. root = container || root;
  54055. }
  54056. for (let ii = parsed.length; i < ii; i++) {
  54057. const {
  54058. name,
  54059. operator,
  54060. index
  54061. } = parsed[i];
  54062. if (!isFinite(index)) {
  54063. parsed[i].index = 0;
  54064. return createNodes(root, parsed.slice(i));
  54065. }
  54066. let children;
  54067. switch (operator) {
  54068. case operators.dot:
  54069. children = root[_xfa_object.$getChildrenByName](name, false);
  54070. break;
  54071. case operators.dotDot:
  54072. children = root[_xfa_object.$getChildrenByName](name, true);
  54073. break;
  54074. case operators.dotHash:
  54075. children = root[_xfa_object.$getChildrenByClass](name);
  54076. if (children instanceof _xfa_object.XFAObjectArray) {
  54077. children = children.children;
  54078. } else {
  54079. children = [children];
  54080. }
  54081. break;
  54082. default:
  54083. break;
  54084. }
  54085. if (children.length === 0) {
  54086. return createNodes(root, parsed.slice(i));
  54087. }
  54088. if (index < children.length) {
  54089. const child = children[index];
  54090. if (!(child instanceof _xfa_object.XFAObject)) {
  54091. (0, _util.warn)(`XFA - Cannot create a node.`);
  54092. return null;
  54093. }
  54094. root = child;
  54095. } else {
  54096. parsed[i].index = children.length - index;
  54097. return createNodes(root, parsed.slice(i));
  54098. }
  54099. }
  54100. return null;
  54101. }
  54102. /***/ }),
  54103. /* 76 */
  54104. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54105. Object.defineProperty(exports, "__esModule", ({
  54106. value: true
  54107. }));
  54108. exports.XFAParser = void 0;
  54109. var _xfa_object = __w_pdfjs_require__(68);
  54110. var _xml_parser = __w_pdfjs_require__(61);
  54111. var _builder = __w_pdfjs_require__(77);
  54112. var _util = __w_pdfjs_require__(2);
  54113. class XFAParser extends _xml_parser.XMLParserBase {
  54114. constructor() {
  54115. super();
  54116. this._builder = new _builder.Builder();
  54117. this._stack = [];
  54118. this._ids = new Map();
  54119. this._current = this._builder.buildRoot(this._ids);
  54120. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  54121. this._whiteRegex = /^\s+$/;
  54122. this._nbsps = /\xa0+/g;
  54123. }
  54124. parse(data) {
  54125. this.parseXml(data);
  54126. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  54127. return undefined;
  54128. }
  54129. this._current[_xfa_object.$finalize]();
  54130. return this._current.element;
  54131. }
  54132. onText(text) {
  54133. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  54134. if (this._current[_xfa_object.$acceptWhitespace]()) {
  54135. this._current[_xfa_object.$onText](text);
  54136. return;
  54137. }
  54138. if (this._whiteRegex.test(text)) {
  54139. return;
  54140. }
  54141. this._current[_xfa_object.$onText](text.trim());
  54142. }
  54143. onCdata(text) {
  54144. this._current[_xfa_object.$onText](text);
  54145. }
  54146. _mkAttributes(attributes, tagName) {
  54147. let namespace = null;
  54148. let prefixes = null;
  54149. const attributeObj = Object.create({});
  54150. for (const {
  54151. name,
  54152. value
  54153. } of attributes) {
  54154. if (name === "xmlns") {
  54155. if (!namespace) {
  54156. namespace = value;
  54157. } else {
  54158. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  54159. }
  54160. } else if (name.startsWith("xmlns:")) {
  54161. const prefix = name.substring("xmlns:".length);
  54162. if (!prefixes) {
  54163. prefixes = [];
  54164. }
  54165. prefixes.push({
  54166. prefix,
  54167. value
  54168. });
  54169. } else {
  54170. const i = name.indexOf(":");
  54171. if (i === -1) {
  54172. attributeObj[name] = value;
  54173. } else {
  54174. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  54175. if (!nsAttrs) {
  54176. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  54177. }
  54178. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  54179. let attrs = nsAttrs[ns];
  54180. if (!attrs) {
  54181. attrs = nsAttrs[ns] = Object.create(null);
  54182. }
  54183. attrs[attrName] = value;
  54184. }
  54185. }
  54186. }
  54187. return [namespace, prefixes, attributeObj];
  54188. }
  54189. _getNameAndPrefix(name) {
  54190. const i = name.indexOf(":");
  54191. if (i === -1) {
  54192. return [name, null];
  54193. }
  54194. return [name.substring(i + 1), name.substring(0, i)];
  54195. }
  54196. onBeginElement(tagName, attributes, isEmpty) {
  54197. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  54198. const [name, nsPrefix] = this._getNameAndPrefix(tagName);
  54199. const node = this._builder.build({
  54200. nsPrefix,
  54201. name,
  54202. attributes: attributesObj,
  54203. namespace,
  54204. prefixes
  54205. });
  54206. if (isEmpty) {
  54207. node[_xfa_object.$finalize]();
  54208. if (this._current[_xfa_object.$onChild](node)) {
  54209. node[_xfa_object.$setId](this._ids);
  54210. }
  54211. node[_xfa_object.$clean](this._builder);
  54212. return;
  54213. }
  54214. this._stack.push(this._current);
  54215. this._current = node;
  54216. }
  54217. onEndElement(name) {
  54218. const node = this._current;
  54219. node[_xfa_object.$finalize]();
  54220. this._current = this._stack.pop();
  54221. if (this._current[_xfa_object.$onChild](node)) {
  54222. node[_xfa_object.$setId](this._ids);
  54223. }
  54224. node[_xfa_object.$clean](this._builder);
  54225. }
  54226. onError(code) {
  54227. this._errorCode = code;
  54228. }
  54229. }
  54230. exports.XFAParser = XFAParser;
  54231. /***/ }),
  54232. /* 77 */
  54233. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54234. Object.defineProperty(exports, "__esModule", ({
  54235. value: true
  54236. }));
  54237. exports.Builder = void 0;
  54238. var _namespaces = __w_pdfjs_require__(70);
  54239. var _xfa_object = __w_pdfjs_require__(68);
  54240. var _setup = __w_pdfjs_require__(78);
  54241. var _template = __w_pdfjs_require__(72);
  54242. var _unknown = __w_pdfjs_require__(87);
  54243. var _util = __w_pdfjs_require__(2);
  54244. class Root extends _xfa_object.XFAObject {
  54245. constructor(ids) {
  54246. super(-1, "root", Object.create(null));
  54247. this.element = null;
  54248. this[_xfa_object.$ids] = ids;
  54249. }
  54250. [_xfa_object.$onChild](child) {
  54251. this.element = child;
  54252. return true;
  54253. }
  54254. [_xfa_object.$finalize]() {
  54255. super[_xfa_object.$finalize]();
  54256. if (this.element.template instanceof _template.Template) {
  54257. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  54258. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  54259. }
  54260. }
  54261. }
  54262. class Empty extends _xfa_object.XFAObject {
  54263. constructor() {
  54264. super(-1, "", Object.create(null));
  54265. }
  54266. [_xfa_object.$onChild](_) {
  54267. return false;
  54268. }
  54269. }
  54270. class Builder {
  54271. constructor() {
  54272. this._namespaceStack = [];
  54273. this._namespacePrefixes = new Map();
  54274. this._namespaces = new Map();
  54275. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  54276. id
  54277. }) => id));
  54278. this._currentNamespace = new _unknown.UnknownNamespace(++this._nextNsId);
  54279. }
  54280. buildRoot(ids) {
  54281. return new Root(ids);
  54282. }
  54283. build({
  54284. nsPrefix,
  54285. name,
  54286. attributes,
  54287. namespace,
  54288. prefixes
  54289. }) {
  54290. const hasNamespaceDef = namespace !== null;
  54291. if (hasNamespaceDef) {
  54292. this._namespaceStack.push(this._currentNamespace);
  54293. this._currentNamespace = this._searchNamespace(namespace);
  54294. }
  54295. if (prefixes) {
  54296. this._addNamespacePrefix(prefixes);
  54297. }
  54298. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  54299. const dataTemplate = _setup.NamespaceSetUp.datasets;
  54300. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  54301. let xfaAttrs = null;
  54302. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  54303. const nsToUse = this._getNamespaceToUse(ns);
  54304. if (nsToUse === dataTemplate) {
  54305. xfaAttrs = {
  54306. xfa: attrs
  54307. };
  54308. break;
  54309. }
  54310. }
  54311. if (xfaAttrs) {
  54312. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  54313. } else {
  54314. delete attributes[_xfa_object.$nsAttributes];
  54315. }
  54316. }
  54317. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  54318. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  54319. if (hasNamespaceDef || prefixes) {
  54320. node[_xfa_object.$cleanup] = {
  54321. hasNamespace: hasNamespaceDef,
  54322. prefixes
  54323. };
  54324. }
  54325. return node;
  54326. }
  54327. _searchNamespace(nsName) {
  54328. let ns = this._namespaces.get(nsName);
  54329. if (ns) {
  54330. return ns;
  54331. }
  54332. for (const [name, {
  54333. check
  54334. }] of Object.entries(_namespaces.NamespaceIds)) {
  54335. if (check(nsName)) {
  54336. ns = _setup.NamespaceSetUp[name];
  54337. if (ns) {
  54338. this._namespaces.set(nsName, ns);
  54339. return ns;
  54340. }
  54341. break;
  54342. }
  54343. }
  54344. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  54345. this._namespaces.set(nsName, ns);
  54346. return ns;
  54347. }
  54348. _addNamespacePrefix(prefixes) {
  54349. for (const {
  54350. prefix,
  54351. value
  54352. } of prefixes) {
  54353. const namespace = this._searchNamespace(value);
  54354. let prefixStack = this._namespacePrefixes.get(prefix);
  54355. if (!prefixStack) {
  54356. prefixStack = [];
  54357. this._namespacePrefixes.set(prefix, prefixStack);
  54358. }
  54359. prefixStack.push(namespace);
  54360. }
  54361. }
  54362. _getNamespaceToUse(prefix) {
  54363. if (!prefix) {
  54364. return this._currentNamespace;
  54365. }
  54366. const prefixStack = this._namespacePrefixes.get(prefix);
  54367. if (prefixStack && prefixStack.length > 0) {
  54368. return prefixStack[prefixStack.length - 1];
  54369. }
  54370. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  54371. return null;
  54372. }
  54373. clean(data) {
  54374. const {
  54375. hasNamespace,
  54376. prefixes
  54377. } = data;
  54378. if (hasNamespace) {
  54379. this._currentNamespace = this._namespaceStack.pop();
  54380. }
  54381. if (prefixes) {
  54382. prefixes.forEach(({
  54383. prefix
  54384. }) => {
  54385. this._namespacePrefixes.get(prefix).pop();
  54386. });
  54387. }
  54388. }
  54389. }
  54390. exports.Builder = Builder;
  54391. /***/ }),
  54392. /* 78 */
  54393. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54394. Object.defineProperty(exports, "__esModule", ({
  54395. value: true
  54396. }));
  54397. exports.NamespaceSetUp = void 0;
  54398. var _config = __w_pdfjs_require__(79);
  54399. var _connection_set = __w_pdfjs_require__(80);
  54400. var _datasets = __w_pdfjs_require__(81);
  54401. var _locale_set = __w_pdfjs_require__(82);
  54402. var _signature = __w_pdfjs_require__(83);
  54403. var _stylesheet = __w_pdfjs_require__(84);
  54404. var _template = __w_pdfjs_require__(72);
  54405. var _xdp = __w_pdfjs_require__(85);
  54406. var _xhtml = __w_pdfjs_require__(86);
  54407. const NamespaceSetUp = {
  54408. config: _config.ConfigNamespace,
  54409. connection: _connection_set.ConnectionSetNamespace,
  54410. datasets: _datasets.DatasetsNamespace,
  54411. localeSet: _locale_set.LocaleSetNamespace,
  54412. signature: _signature.SignatureNamespace,
  54413. stylesheet: _stylesheet.StylesheetNamespace,
  54414. template: _template.TemplateNamespace,
  54415. xdp: _xdp.XdpNamespace,
  54416. xhtml: _xhtml.XhtmlNamespace
  54417. };
  54418. exports.NamespaceSetUp = NamespaceSetUp;
  54419. /***/ }),
  54420. /* 79 */
  54421. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54422. Object.defineProperty(exports, "__esModule", ({
  54423. value: true
  54424. }));
  54425. exports.ConfigNamespace = void 0;
  54426. var _namespaces = __w_pdfjs_require__(70);
  54427. var _xfa_object = __w_pdfjs_require__(68);
  54428. var _utils = __w_pdfjs_require__(69);
  54429. var _util = __w_pdfjs_require__(2);
  54430. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  54431. class Acrobat extends _xfa_object.XFAObject {
  54432. constructor(attributes) {
  54433. super(CONFIG_NS_ID, "acrobat", true);
  54434. this.acrobat7 = null;
  54435. this.autoSave = null;
  54436. this.common = null;
  54437. this.validate = null;
  54438. this.validateApprovalSignatures = null;
  54439. this.submitUrl = new _xfa_object.XFAObjectArray();
  54440. }
  54441. }
  54442. class Acrobat7 extends _xfa_object.XFAObject {
  54443. constructor(attributes) {
  54444. super(CONFIG_NS_ID, "acrobat7", true);
  54445. this.dynamicRender = null;
  54446. }
  54447. }
  54448. class ADBE_JSConsole extends _xfa_object.OptionObject {
  54449. constructor(attributes) {
  54450. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  54451. }
  54452. }
  54453. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  54454. constructor(attributes) {
  54455. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  54456. }
  54457. }
  54458. class AddSilentPrint extends _xfa_object.Option01 {
  54459. constructor(attributes) {
  54460. super(CONFIG_NS_ID, "addSilentPrint");
  54461. }
  54462. }
  54463. class AddViewerPreferences extends _xfa_object.Option01 {
  54464. constructor(attributes) {
  54465. super(CONFIG_NS_ID, "addViewerPreferences");
  54466. }
  54467. }
  54468. class AdjustData extends _xfa_object.Option10 {
  54469. constructor(attributes) {
  54470. super(CONFIG_NS_ID, "adjustData");
  54471. }
  54472. }
  54473. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  54474. constructor(attributes) {
  54475. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  54476. }
  54477. }
  54478. class Agent extends _xfa_object.XFAObject {
  54479. constructor(attributes) {
  54480. super(CONFIG_NS_ID, "agent", true);
  54481. this.name = attributes.name ? attributes.name.trim() : "";
  54482. this.common = new _xfa_object.XFAObjectArray();
  54483. }
  54484. }
  54485. class AlwaysEmbed extends _xfa_object.ContentObject {
  54486. constructor(attributes) {
  54487. super(CONFIG_NS_ID, "alwaysEmbed");
  54488. }
  54489. }
  54490. class Amd extends _xfa_object.StringObject {
  54491. constructor(attributes) {
  54492. super(CONFIG_NS_ID, "amd");
  54493. }
  54494. }
  54495. class Area extends _xfa_object.XFAObject {
  54496. constructor(attributes) {
  54497. super(CONFIG_NS_ID, "area");
  54498. this.level = (0, _utils.getInteger)({
  54499. data: attributes.level,
  54500. defaultValue: 0,
  54501. validate: n => n >= 1 && n <= 3
  54502. });
  54503. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  54504. }
  54505. }
  54506. class Attributes extends _xfa_object.OptionObject {
  54507. constructor(attributes) {
  54508. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  54509. }
  54510. }
  54511. class AutoSave extends _xfa_object.OptionObject {
  54512. constructor(attributes) {
  54513. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  54514. }
  54515. }
  54516. class Base extends _xfa_object.StringObject {
  54517. constructor(attributes) {
  54518. super(CONFIG_NS_ID, "base");
  54519. }
  54520. }
  54521. class BatchOutput extends _xfa_object.XFAObject {
  54522. constructor(attributes) {
  54523. super(CONFIG_NS_ID, "batchOutput");
  54524. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  54525. }
  54526. }
  54527. class BehaviorOverride extends _xfa_object.ContentObject {
  54528. constructor(attributes) {
  54529. super(CONFIG_NS_ID, "behaviorOverride");
  54530. }
  54531. [_xfa_object.$finalize]() {
  54532. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => !!x && x.include(":")).map(x => x.split(":", 2)));
  54533. }
  54534. }
  54535. class Cache extends _xfa_object.XFAObject {
  54536. constructor(attributes) {
  54537. super(CONFIG_NS_ID, "cache", true);
  54538. this.templateCache = null;
  54539. }
  54540. }
  54541. class Change extends _xfa_object.Option01 {
  54542. constructor(attributes) {
  54543. super(CONFIG_NS_ID, "change");
  54544. }
  54545. }
  54546. class Common extends _xfa_object.XFAObject {
  54547. constructor(attributes) {
  54548. super(CONFIG_NS_ID, "common", true);
  54549. this.data = null;
  54550. this.locale = null;
  54551. this.localeSet = null;
  54552. this.messaging = null;
  54553. this.suppressBanner = null;
  54554. this.template = null;
  54555. this.validationMessaging = null;
  54556. this.versionControl = null;
  54557. this.log = new _xfa_object.XFAObjectArray();
  54558. }
  54559. }
  54560. class Compress extends _xfa_object.XFAObject {
  54561. constructor(attributes) {
  54562. super(CONFIG_NS_ID, "compress");
  54563. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  54564. }
  54565. }
  54566. class CompressLogicalStructure extends _xfa_object.Option01 {
  54567. constructor(attributes) {
  54568. super(CONFIG_NS_ID, "compressLogicalStructure");
  54569. }
  54570. }
  54571. class CompressObjectStream extends _xfa_object.Option10 {
  54572. constructor(attributes) {
  54573. super(CONFIG_NS_ID, "compressObjectStream");
  54574. }
  54575. }
  54576. class Compression extends _xfa_object.XFAObject {
  54577. constructor(attributes) {
  54578. super(CONFIG_NS_ID, "compression", true);
  54579. this.compressLogicalStructure = null;
  54580. this.compressObjectStream = null;
  54581. this.level = null;
  54582. this.type = null;
  54583. }
  54584. }
  54585. class Config extends _xfa_object.XFAObject {
  54586. constructor(attributes) {
  54587. super(CONFIG_NS_ID, "config", true);
  54588. this.acrobat = null;
  54589. this.present = null;
  54590. this.trace = null;
  54591. this.agent = new _xfa_object.XFAObjectArray();
  54592. }
  54593. }
  54594. class Conformance extends _xfa_object.OptionObject {
  54595. constructor(attributes) {
  54596. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  54597. }
  54598. }
  54599. class ContentCopy extends _xfa_object.Option01 {
  54600. constructor(attributes) {
  54601. super(CONFIG_NS_ID, "contentCopy");
  54602. }
  54603. }
  54604. class Copies extends _xfa_object.IntegerObject {
  54605. constructor(attributes) {
  54606. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  54607. }
  54608. }
  54609. class Creator extends _xfa_object.StringObject {
  54610. constructor(attributes) {
  54611. super(CONFIG_NS_ID, "creator");
  54612. }
  54613. }
  54614. class CurrentPage extends _xfa_object.IntegerObject {
  54615. constructor(attributes) {
  54616. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  54617. }
  54618. }
  54619. class Data extends _xfa_object.XFAObject {
  54620. constructor(attributes) {
  54621. super(CONFIG_NS_ID, "data", true);
  54622. this.adjustData = null;
  54623. this.attributes = null;
  54624. this.incrementalLoad = null;
  54625. this.outputXSL = null;
  54626. this.range = null;
  54627. this.record = null;
  54628. this.startNode = null;
  54629. this.uri = null;
  54630. this.window = null;
  54631. this.xsl = null;
  54632. this.excludeNS = new _xfa_object.XFAObjectArray();
  54633. this.transform = new _xfa_object.XFAObjectArray();
  54634. }
  54635. }
  54636. class Debug extends _xfa_object.XFAObject {
  54637. constructor(attributes) {
  54638. super(CONFIG_NS_ID, "debug", true);
  54639. this.uri = null;
  54640. }
  54641. }
  54642. class DefaultTypeface extends _xfa_object.ContentObject {
  54643. constructor(attributes) {
  54644. super(CONFIG_NS_ID, "defaultTypeface");
  54645. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  54646. }
  54647. }
  54648. class Destination extends _xfa_object.OptionObject {
  54649. constructor(attributes) {
  54650. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  54651. }
  54652. }
  54653. class DocumentAssembly extends _xfa_object.Option01 {
  54654. constructor(attributes) {
  54655. super(CONFIG_NS_ID, "documentAssembly");
  54656. }
  54657. }
  54658. class Driver extends _xfa_object.XFAObject {
  54659. constructor(attributes) {
  54660. super(CONFIG_NS_ID, "driver", true);
  54661. this.name = attributes.name ? attributes.name.trim() : "";
  54662. this.fontInfo = null;
  54663. this.xdc = null;
  54664. }
  54665. }
  54666. class DuplexOption extends _xfa_object.OptionObject {
  54667. constructor(attributes) {
  54668. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  54669. }
  54670. }
  54671. class DynamicRender extends _xfa_object.OptionObject {
  54672. constructor(attributes) {
  54673. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  54674. }
  54675. }
  54676. class Embed extends _xfa_object.Option01 {
  54677. constructor(attributes) {
  54678. super(CONFIG_NS_ID, "embed");
  54679. }
  54680. }
  54681. class Encrypt extends _xfa_object.Option01 {
  54682. constructor(attributes) {
  54683. super(CONFIG_NS_ID, "encrypt");
  54684. }
  54685. }
  54686. class Encryption extends _xfa_object.XFAObject {
  54687. constructor(attributes) {
  54688. super(CONFIG_NS_ID, "encryption", true);
  54689. this.encrypt = null;
  54690. this.encryptionLevel = null;
  54691. this.permissions = null;
  54692. }
  54693. }
  54694. class EncryptionLevel extends _xfa_object.OptionObject {
  54695. constructor(attributes) {
  54696. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  54697. }
  54698. }
  54699. class Enforce extends _xfa_object.StringObject {
  54700. constructor(attributes) {
  54701. super(CONFIG_NS_ID, "enforce");
  54702. }
  54703. }
  54704. class Equate extends _xfa_object.XFAObject {
  54705. constructor(attributes) {
  54706. super(CONFIG_NS_ID, "equate");
  54707. this.force = (0, _utils.getInteger)({
  54708. data: attributes.force,
  54709. defaultValue: 1,
  54710. validate: n => n === 0
  54711. });
  54712. this.from = attributes.from || "";
  54713. this.to = attributes.to || "";
  54714. }
  54715. }
  54716. class EquateRange extends _xfa_object.XFAObject {
  54717. constructor(attributes) {
  54718. super(CONFIG_NS_ID, "equateRange");
  54719. this.from = attributes.from || "";
  54720. this.to = attributes.to || "";
  54721. this._unicodeRange = attributes.unicodeRange || "";
  54722. }
  54723. get unicodeRange() {
  54724. const ranges = [];
  54725. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  54726. const unicodeRange = this._unicodeRange;
  54727. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  54728. range = range.split("-", 2).map(x => {
  54729. const found = x.match(unicodeRegex);
  54730. if (!found) {
  54731. return 0;
  54732. }
  54733. return parseInt(found[1], 16);
  54734. });
  54735. if (range.length === 1) {
  54736. range.push(range[0]);
  54737. }
  54738. ranges.push(range);
  54739. }
  54740. return (0, _util.shadow)(this, "unicodeRange", ranges);
  54741. }
  54742. }
  54743. class Exclude extends _xfa_object.ContentObject {
  54744. constructor(attributes) {
  54745. super(CONFIG_NS_ID, "exclude");
  54746. }
  54747. [_xfa_object.$finalize]() {
  54748. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  54749. }
  54750. }
  54751. class ExcludeNS extends _xfa_object.StringObject {
  54752. constructor(attributes) {
  54753. super(CONFIG_NS_ID, "excludeNS");
  54754. }
  54755. }
  54756. class FlipLabel extends _xfa_object.OptionObject {
  54757. constructor(attributes) {
  54758. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  54759. }
  54760. }
  54761. class FontInfo extends _xfa_object.XFAObject {
  54762. constructor(attributes) {
  54763. super(CONFIG_NS_ID, "fontInfo", true);
  54764. this.embed = null;
  54765. this.map = null;
  54766. this.subsetBelow = null;
  54767. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  54768. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  54769. this.neverEmbed = new _xfa_object.XFAObjectArray();
  54770. }
  54771. }
  54772. class FormFieldFilling extends _xfa_object.Option01 {
  54773. constructor(attributes) {
  54774. super(CONFIG_NS_ID, "formFieldFilling");
  54775. }
  54776. }
  54777. class GroupParent extends _xfa_object.StringObject {
  54778. constructor(attributes) {
  54779. super(CONFIG_NS_ID, "groupParent");
  54780. }
  54781. }
  54782. class IfEmpty extends _xfa_object.OptionObject {
  54783. constructor(attributes) {
  54784. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  54785. }
  54786. }
  54787. class IncludeXDPContent extends _xfa_object.StringObject {
  54788. constructor(attributes) {
  54789. super(CONFIG_NS_ID, "includeXDPContent");
  54790. }
  54791. }
  54792. class IncrementalLoad extends _xfa_object.OptionObject {
  54793. constructor(attributes) {
  54794. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  54795. }
  54796. }
  54797. class IncrementalMerge extends _xfa_object.Option01 {
  54798. constructor(attributes) {
  54799. super(CONFIG_NS_ID, "incrementalMerge");
  54800. }
  54801. }
  54802. class Interactive extends _xfa_object.Option01 {
  54803. constructor(attributes) {
  54804. super(CONFIG_NS_ID, "interactive");
  54805. }
  54806. }
  54807. class Jog extends _xfa_object.OptionObject {
  54808. constructor(attributes) {
  54809. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  54810. }
  54811. }
  54812. class LabelPrinter extends _xfa_object.XFAObject {
  54813. constructor(attributes) {
  54814. super(CONFIG_NS_ID, "labelPrinter", true);
  54815. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  54816. this.batchOutput = null;
  54817. this.flipLabel = null;
  54818. this.fontInfo = null;
  54819. this.xdc = null;
  54820. }
  54821. }
  54822. class Layout extends _xfa_object.OptionObject {
  54823. constructor(attributes) {
  54824. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  54825. }
  54826. }
  54827. class Level extends _xfa_object.IntegerObject {
  54828. constructor(attributes) {
  54829. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  54830. }
  54831. }
  54832. class Linearized extends _xfa_object.Option01 {
  54833. constructor(attributes) {
  54834. super(CONFIG_NS_ID, "linearized");
  54835. }
  54836. }
  54837. class Locale extends _xfa_object.StringObject {
  54838. constructor(attributes) {
  54839. super(CONFIG_NS_ID, "locale");
  54840. }
  54841. }
  54842. class LocaleSet extends _xfa_object.StringObject {
  54843. constructor(attributes) {
  54844. super(CONFIG_NS_ID, "localeSet");
  54845. }
  54846. }
  54847. class Log extends _xfa_object.XFAObject {
  54848. constructor(attributes) {
  54849. super(CONFIG_NS_ID, "log", true);
  54850. this.mode = null;
  54851. this.threshold = null;
  54852. this.to = null;
  54853. this.uri = null;
  54854. }
  54855. }
  54856. class MapElement extends _xfa_object.XFAObject {
  54857. constructor(attributes) {
  54858. super(CONFIG_NS_ID, "map", true);
  54859. this.equate = new _xfa_object.XFAObjectArray();
  54860. this.equateRange = new _xfa_object.XFAObjectArray();
  54861. }
  54862. }
  54863. class MediumInfo extends _xfa_object.XFAObject {
  54864. constructor(attributes) {
  54865. super(CONFIG_NS_ID, "mediumInfo", true);
  54866. this.map = null;
  54867. }
  54868. }
  54869. class Message extends _xfa_object.XFAObject {
  54870. constructor(attributes) {
  54871. super(CONFIG_NS_ID, "message", true);
  54872. this.msgId = null;
  54873. this.severity = null;
  54874. }
  54875. }
  54876. class Messaging extends _xfa_object.XFAObject {
  54877. constructor(attributes) {
  54878. super(CONFIG_NS_ID, "messaging", true);
  54879. this.message = new _xfa_object.XFAObjectArray();
  54880. }
  54881. }
  54882. class Mode extends _xfa_object.OptionObject {
  54883. constructor(attributes) {
  54884. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  54885. }
  54886. }
  54887. class ModifyAnnots extends _xfa_object.Option01 {
  54888. constructor(attributes) {
  54889. super(CONFIG_NS_ID, "modifyAnnots");
  54890. }
  54891. }
  54892. class MsgId extends _xfa_object.IntegerObject {
  54893. constructor(attributes) {
  54894. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  54895. }
  54896. }
  54897. class NameAttr extends _xfa_object.StringObject {
  54898. constructor(attributes) {
  54899. super(CONFIG_NS_ID, "nameAttr");
  54900. }
  54901. }
  54902. class NeverEmbed extends _xfa_object.ContentObject {
  54903. constructor(attributes) {
  54904. super(CONFIG_NS_ID, "neverEmbed");
  54905. }
  54906. }
  54907. class NumberOfCopies extends _xfa_object.IntegerObject {
  54908. constructor(attributes) {
  54909. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  54910. }
  54911. }
  54912. class OpenAction extends _xfa_object.XFAObject {
  54913. constructor(attributes) {
  54914. super(CONFIG_NS_ID, "openAction", true);
  54915. this.destination = null;
  54916. }
  54917. }
  54918. class Output extends _xfa_object.XFAObject {
  54919. constructor(attributes) {
  54920. super(CONFIG_NS_ID, "output", true);
  54921. this.to = null;
  54922. this.type = null;
  54923. this.uri = null;
  54924. }
  54925. }
  54926. class OutputBin extends _xfa_object.StringObject {
  54927. constructor(attributes) {
  54928. super(CONFIG_NS_ID, "outputBin");
  54929. }
  54930. }
  54931. class OutputXSL extends _xfa_object.XFAObject {
  54932. constructor(attributes) {
  54933. super(CONFIG_NS_ID, "outputXSL", true);
  54934. this.uri = null;
  54935. }
  54936. }
  54937. class Overprint extends _xfa_object.OptionObject {
  54938. constructor(attributes) {
  54939. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  54940. }
  54941. }
  54942. class Packets extends _xfa_object.StringObject {
  54943. constructor(attributes) {
  54944. super(CONFIG_NS_ID, "packets");
  54945. }
  54946. [_xfa_object.$finalize]() {
  54947. if (this[_xfa_object.$content] === "*") {
  54948. return;
  54949. }
  54950. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  54951. }
  54952. }
  54953. class PageOffset extends _xfa_object.XFAObject {
  54954. constructor(attributes) {
  54955. super(CONFIG_NS_ID, "pageOffset");
  54956. this.x = (0, _utils.getInteger)({
  54957. data: attributes.x,
  54958. defaultValue: "useXDCSetting",
  54959. validate: n => true
  54960. });
  54961. this.y = (0, _utils.getInteger)({
  54962. data: attributes.y,
  54963. defaultValue: "useXDCSetting",
  54964. validate: n => true
  54965. });
  54966. }
  54967. }
  54968. class PageRange extends _xfa_object.StringObject {
  54969. constructor(attributes) {
  54970. super(CONFIG_NS_ID, "pageRange");
  54971. }
  54972. [_xfa_object.$finalize]() {
  54973. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  54974. const ranges = [];
  54975. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  54976. ranges.push(numbers.slice(i, i + 2));
  54977. }
  54978. this[_xfa_object.$content] = ranges;
  54979. }
  54980. }
  54981. class Pagination extends _xfa_object.OptionObject {
  54982. constructor(attributes) {
  54983. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  54984. }
  54985. }
  54986. class PaginationOverride extends _xfa_object.OptionObject {
  54987. constructor(attributes) {
  54988. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  54989. }
  54990. }
  54991. class Part extends _xfa_object.IntegerObject {
  54992. constructor(attributes) {
  54993. super(CONFIG_NS_ID, "part", 1, n => false);
  54994. }
  54995. }
  54996. class Pcl extends _xfa_object.XFAObject {
  54997. constructor(attributes) {
  54998. super(CONFIG_NS_ID, "pcl", true);
  54999. this.name = attributes.name || "";
  55000. this.batchOutput = null;
  55001. this.fontInfo = null;
  55002. this.jog = null;
  55003. this.mediumInfo = null;
  55004. this.outputBin = null;
  55005. this.pageOffset = null;
  55006. this.staple = null;
  55007. this.xdc = null;
  55008. }
  55009. }
  55010. class Pdf extends _xfa_object.XFAObject {
  55011. constructor(attributes) {
  55012. super(CONFIG_NS_ID, "pdf", true);
  55013. this.name = attributes.name || "";
  55014. this.adobeExtensionLevel = null;
  55015. this.batchOutput = null;
  55016. this.compression = null;
  55017. this.creator = null;
  55018. this.encryption = null;
  55019. this.fontInfo = null;
  55020. this.interactive = null;
  55021. this.linearized = null;
  55022. this.openAction = null;
  55023. this.pdfa = null;
  55024. this.producer = null;
  55025. this.renderPolicy = null;
  55026. this.scriptModel = null;
  55027. this.silentPrint = null;
  55028. this.submitFormat = null;
  55029. this.tagged = null;
  55030. this.version = null;
  55031. this.viewerPreferences = null;
  55032. this.xdc = null;
  55033. }
  55034. }
  55035. class Pdfa extends _xfa_object.XFAObject {
  55036. constructor(attributes) {
  55037. super(CONFIG_NS_ID, "pdfa", true);
  55038. this.amd = null;
  55039. this.conformance = null;
  55040. this.includeXDPContent = null;
  55041. this.part = null;
  55042. }
  55043. }
  55044. class Permissions extends _xfa_object.XFAObject {
  55045. constructor(attributes) {
  55046. super(CONFIG_NS_ID, "permissions", true);
  55047. this.accessibleContent = null;
  55048. this.change = null;
  55049. this.contentCopy = null;
  55050. this.documentAssembly = null;
  55051. this.formFieldFilling = null;
  55052. this.modifyAnnots = null;
  55053. this.plaintextMetadata = null;
  55054. this.print = null;
  55055. this.printHighQuality = null;
  55056. }
  55057. }
  55058. class PickTrayByPDFSize extends _xfa_object.Option01 {
  55059. constructor(attributes) {
  55060. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  55061. }
  55062. }
  55063. class Picture extends _xfa_object.StringObject {
  55064. constructor(attributes) {
  55065. super(CONFIG_NS_ID, "picture");
  55066. }
  55067. }
  55068. class PlaintextMetadata extends _xfa_object.Option01 {
  55069. constructor(attributes) {
  55070. super(CONFIG_NS_ID, "plaintextMetadata");
  55071. }
  55072. }
  55073. class Presence extends _xfa_object.OptionObject {
  55074. constructor(attributes) {
  55075. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  55076. }
  55077. }
  55078. class Present extends _xfa_object.XFAObject {
  55079. constructor(attributes) {
  55080. super(CONFIG_NS_ID, "present", true);
  55081. this.behaviorOverride = null;
  55082. this.cache = null;
  55083. this.common = null;
  55084. this.copies = null;
  55085. this.destination = null;
  55086. this.incrementalMerge = null;
  55087. this.layout = null;
  55088. this.output = null;
  55089. this.overprint = null;
  55090. this.pagination = null;
  55091. this.paginationOverride = null;
  55092. this.script = null;
  55093. this.validate = null;
  55094. this.xdp = null;
  55095. this.driver = new _xfa_object.XFAObjectArray();
  55096. this.labelPrinter = new _xfa_object.XFAObjectArray();
  55097. this.pcl = new _xfa_object.XFAObjectArray();
  55098. this.pdf = new _xfa_object.XFAObjectArray();
  55099. this.ps = new _xfa_object.XFAObjectArray();
  55100. this.submitUrl = new _xfa_object.XFAObjectArray();
  55101. this.webClient = new _xfa_object.XFAObjectArray();
  55102. this.zpl = new _xfa_object.XFAObjectArray();
  55103. }
  55104. }
  55105. class Print extends _xfa_object.Option01 {
  55106. constructor(attributes) {
  55107. super(CONFIG_NS_ID, "print");
  55108. }
  55109. }
  55110. class PrintHighQuality extends _xfa_object.Option01 {
  55111. constructor(attributes) {
  55112. super(CONFIG_NS_ID, "printHighQuality");
  55113. }
  55114. }
  55115. class PrintScaling extends _xfa_object.OptionObject {
  55116. constructor(attributes) {
  55117. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  55118. }
  55119. }
  55120. class PrinterName extends _xfa_object.StringObject {
  55121. constructor(attributes) {
  55122. super(CONFIG_NS_ID, "printerName");
  55123. }
  55124. }
  55125. class Producer extends _xfa_object.StringObject {
  55126. constructor(attributes) {
  55127. super(CONFIG_NS_ID, "producer");
  55128. }
  55129. }
  55130. class Ps extends _xfa_object.XFAObject {
  55131. constructor(attributes) {
  55132. super(CONFIG_NS_ID, "ps", true);
  55133. this.name = attributes.name || "";
  55134. this.batchOutput = null;
  55135. this.fontInfo = null;
  55136. this.jog = null;
  55137. this.mediumInfo = null;
  55138. this.outputBin = null;
  55139. this.staple = null;
  55140. this.xdc = null;
  55141. }
  55142. }
  55143. class Range extends _xfa_object.ContentObject {
  55144. constructor(attributes) {
  55145. super(CONFIG_NS_ID, "range");
  55146. }
  55147. [_xfa_object.$finalize]() {
  55148. 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 => {
  55149. if (range.length === 1) {
  55150. range.push(range[0]);
  55151. }
  55152. return range;
  55153. });
  55154. }
  55155. }
  55156. class Record extends _xfa_object.ContentObject {
  55157. constructor(attributes) {
  55158. super(CONFIG_NS_ID, "record");
  55159. }
  55160. [_xfa_object.$finalize]() {
  55161. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  55162. const n = parseInt(this[_xfa_object.$content], 10);
  55163. if (!isNaN(n) && n >= 0) {
  55164. this[_xfa_object.$content] = n;
  55165. }
  55166. }
  55167. }
  55168. class Relevant extends _xfa_object.ContentObject {
  55169. constructor(attributes) {
  55170. super(CONFIG_NS_ID, "relevant");
  55171. }
  55172. [_xfa_object.$finalize]() {
  55173. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  55174. }
  55175. }
  55176. class Rename extends _xfa_object.ContentObject {
  55177. constructor(attributes) {
  55178. super(CONFIG_NS_ID, "rename");
  55179. }
  55180. [_xfa_object.$finalize]() {
  55181. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  55182. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  55183. (0, _util.warn)("XFA - Rename: invalid XFA name");
  55184. }
  55185. }
  55186. }
  55187. class RenderPolicy extends _xfa_object.OptionObject {
  55188. constructor(attributes) {
  55189. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  55190. }
  55191. }
  55192. class RunScripts extends _xfa_object.OptionObject {
  55193. constructor(attributes) {
  55194. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  55195. }
  55196. }
  55197. class Script extends _xfa_object.XFAObject {
  55198. constructor(attributes) {
  55199. super(CONFIG_NS_ID, "script", true);
  55200. this.currentPage = null;
  55201. this.exclude = null;
  55202. this.runScripts = null;
  55203. }
  55204. }
  55205. class ScriptModel extends _xfa_object.OptionObject {
  55206. constructor(attributes) {
  55207. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  55208. }
  55209. }
  55210. class Severity extends _xfa_object.OptionObject {
  55211. constructor(attributes) {
  55212. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  55213. }
  55214. }
  55215. class SilentPrint extends _xfa_object.XFAObject {
  55216. constructor(attributes) {
  55217. super(CONFIG_NS_ID, "silentPrint", true);
  55218. this.addSilentPrint = null;
  55219. this.printerName = null;
  55220. }
  55221. }
  55222. class Staple extends _xfa_object.XFAObject {
  55223. constructor(attributes) {
  55224. super(CONFIG_NS_ID, "staple");
  55225. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  55226. }
  55227. }
  55228. class StartNode extends _xfa_object.StringObject {
  55229. constructor(attributes) {
  55230. super(CONFIG_NS_ID, "startNode");
  55231. }
  55232. }
  55233. class StartPage extends _xfa_object.IntegerObject {
  55234. constructor(attributes) {
  55235. super(CONFIG_NS_ID, "startPage", 0, n => true);
  55236. }
  55237. }
  55238. class SubmitFormat extends _xfa_object.OptionObject {
  55239. constructor(attributes) {
  55240. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  55241. }
  55242. }
  55243. class SubmitUrl extends _xfa_object.StringObject {
  55244. constructor(attributes) {
  55245. super(CONFIG_NS_ID, "submitUrl");
  55246. }
  55247. }
  55248. class SubsetBelow extends _xfa_object.IntegerObject {
  55249. constructor(attributes) {
  55250. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  55251. }
  55252. }
  55253. class SuppressBanner extends _xfa_object.Option01 {
  55254. constructor(attributes) {
  55255. super(CONFIG_NS_ID, "suppressBanner");
  55256. }
  55257. }
  55258. class Tagged extends _xfa_object.Option01 {
  55259. constructor(attributes) {
  55260. super(CONFIG_NS_ID, "tagged");
  55261. }
  55262. }
  55263. class Template extends _xfa_object.XFAObject {
  55264. constructor(attributes) {
  55265. super(CONFIG_NS_ID, "template", true);
  55266. this.base = null;
  55267. this.relevant = null;
  55268. this.startPage = null;
  55269. this.uri = null;
  55270. this.xsl = null;
  55271. }
  55272. }
  55273. class Threshold extends _xfa_object.OptionObject {
  55274. constructor(attributes) {
  55275. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  55276. }
  55277. }
  55278. class To extends _xfa_object.OptionObject {
  55279. constructor(attributes) {
  55280. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  55281. }
  55282. }
  55283. class TemplateCache extends _xfa_object.XFAObject {
  55284. constructor(attributes) {
  55285. super(CONFIG_NS_ID, "templateCache");
  55286. this.maxEntries = (0, _utils.getInteger)({
  55287. data: attributes.maxEntries,
  55288. defaultValue: 5,
  55289. validate: n => n >= 0
  55290. });
  55291. }
  55292. }
  55293. class Trace extends _xfa_object.XFAObject {
  55294. constructor(attributes) {
  55295. super(CONFIG_NS_ID, "trace", true);
  55296. this.area = new _xfa_object.XFAObjectArray();
  55297. }
  55298. }
  55299. class Transform extends _xfa_object.XFAObject {
  55300. constructor(attributes) {
  55301. super(CONFIG_NS_ID, "transform", true);
  55302. this.groupParent = null;
  55303. this.ifEmpty = null;
  55304. this.nameAttr = null;
  55305. this.picture = null;
  55306. this.presence = null;
  55307. this.rename = null;
  55308. this.whitespace = null;
  55309. }
  55310. }
  55311. class Type extends _xfa_object.OptionObject {
  55312. constructor(attributes) {
  55313. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  55314. }
  55315. }
  55316. class Uri extends _xfa_object.StringObject {
  55317. constructor(attributes) {
  55318. super(CONFIG_NS_ID, "uri");
  55319. }
  55320. }
  55321. class Validate extends _xfa_object.OptionObject {
  55322. constructor(attributes) {
  55323. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  55324. }
  55325. }
  55326. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  55327. constructor(attributes) {
  55328. super(CONFIG_NS_ID, "validateApprovalSignatures");
  55329. }
  55330. [_xfa_object.$finalize]() {
  55331. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  55332. }
  55333. }
  55334. class ValidationMessaging extends _xfa_object.OptionObject {
  55335. constructor(attributes) {
  55336. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  55337. }
  55338. }
  55339. class Version extends _xfa_object.OptionObject {
  55340. constructor(attributes) {
  55341. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  55342. }
  55343. }
  55344. class VersionControl extends _xfa_object.XFAObject {
  55345. constructor(attributes) {
  55346. super(CONFIG_NS_ID, "VersionControl");
  55347. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  55348. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  55349. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  55350. }
  55351. }
  55352. class ViewerPreferences extends _xfa_object.XFAObject {
  55353. constructor(attributes) {
  55354. super(CONFIG_NS_ID, "viewerPreferences", true);
  55355. this.ADBE_JSConsole = null;
  55356. this.ADBE_JSDebugger = null;
  55357. this.addViewerPreferences = null;
  55358. this.duplexOption = null;
  55359. this.enforce = null;
  55360. this.numberOfCopies = null;
  55361. this.pageRange = null;
  55362. this.pickTrayByPDFSize = null;
  55363. this.printScaling = null;
  55364. }
  55365. }
  55366. class WebClient extends _xfa_object.XFAObject {
  55367. constructor(attributes) {
  55368. super(CONFIG_NS_ID, "webClient", true);
  55369. this.name = attributes.name ? attributes.name.trim() : "";
  55370. this.fontInfo = null;
  55371. this.xdc = null;
  55372. }
  55373. }
  55374. class Whitespace extends _xfa_object.OptionObject {
  55375. constructor(attributes) {
  55376. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  55377. }
  55378. }
  55379. class Window extends _xfa_object.ContentObject {
  55380. constructor(attributes) {
  55381. super(CONFIG_NS_ID, "window");
  55382. }
  55383. [_xfa_object.$finalize]() {
  55384. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  55385. if (pair.some(x => isNaN(x))) {
  55386. this[_xfa_object.$content] = [0, 0];
  55387. return;
  55388. }
  55389. if (pair.length === 1) {
  55390. pair.push(pair[0]);
  55391. }
  55392. this[_xfa_object.$content] = pair;
  55393. }
  55394. }
  55395. class Xdc extends _xfa_object.XFAObject {
  55396. constructor(attributes) {
  55397. super(CONFIG_NS_ID, "xdc", true);
  55398. this.uri = new _xfa_object.XFAObjectArray();
  55399. this.xsl = new _xfa_object.XFAObjectArray();
  55400. }
  55401. }
  55402. class Xdp extends _xfa_object.XFAObject {
  55403. constructor(attributes) {
  55404. super(CONFIG_NS_ID, "xdp", true);
  55405. this.packets = null;
  55406. }
  55407. }
  55408. class Xsl extends _xfa_object.XFAObject {
  55409. constructor(attributes) {
  55410. super(CONFIG_NS_ID, "xsl", true);
  55411. this.debug = null;
  55412. this.uri = null;
  55413. }
  55414. }
  55415. class Zpl extends _xfa_object.XFAObject {
  55416. constructor(attributes) {
  55417. super(CONFIG_NS_ID, "zpl", true);
  55418. this.name = attributes.name ? attributes.name.trim() : "";
  55419. this.batchOutput = null;
  55420. this.flipLabel = null;
  55421. this.fontInfo = null;
  55422. this.xdc = null;
  55423. }
  55424. }
  55425. class ConfigNamespace {
  55426. static [_namespaces.$buildXFAObject](name, attributes) {
  55427. if (ConfigNamespace.hasOwnProperty(name)) {
  55428. return ConfigNamespace[name](attributes);
  55429. }
  55430. return undefined;
  55431. }
  55432. static acrobat(attrs) {
  55433. return new Acrobat(attrs);
  55434. }
  55435. static acrobat7(attrs) {
  55436. return new Acrobat7(attrs);
  55437. }
  55438. static ADBE_JSConsole(attrs) {
  55439. return new ADBE_JSConsole(attrs);
  55440. }
  55441. static ADBE_JSDebugger(attrs) {
  55442. return new ADBE_JSDebugger(attrs);
  55443. }
  55444. static addSilentPrint(attrs) {
  55445. return new AddSilentPrint(attrs);
  55446. }
  55447. static addViewerPreferences(attrs) {
  55448. return new AddViewerPreferences(attrs);
  55449. }
  55450. static adjustData(attrs) {
  55451. return new AdjustData(attrs);
  55452. }
  55453. static adobeExtensionLevel(attrs) {
  55454. return new AdobeExtensionLevel(attrs);
  55455. }
  55456. static agent(attrs) {
  55457. return new Agent(attrs);
  55458. }
  55459. static alwaysEmbed(attrs) {
  55460. return new AlwaysEmbed(attrs);
  55461. }
  55462. static amd(attrs) {
  55463. return new Amd(attrs);
  55464. }
  55465. static area(attrs) {
  55466. return new Area(attrs);
  55467. }
  55468. static attributes(attrs) {
  55469. return new Attributes(attrs);
  55470. }
  55471. static autoSave(attrs) {
  55472. return new AutoSave(attrs);
  55473. }
  55474. static base(attrs) {
  55475. return new Base(attrs);
  55476. }
  55477. static batchOutput(attrs) {
  55478. return new BatchOutput(attrs);
  55479. }
  55480. static behaviorOverride(attrs) {
  55481. return new BehaviorOverride(attrs);
  55482. }
  55483. static cache(attrs) {
  55484. return new Cache(attrs);
  55485. }
  55486. static change(attrs) {
  55487. return new Change(attrs);
  55488. }
  55489. static common(attrs) {
  55490. return new Common(attrs);
  55491. }
  55492. static compress(attrs) {
  55493. return new Compress(attrs);
  55494. }
  55495. static compressLogicalStructure(attrs) {
  55496. return new CompressLogicalStructure(attrs);
  55497. }
  55498. static compressObjectStream(attrs) {
  55499. return new CompressObjectStream(attrs);
  55500. }
  55501. static compression(attrs) {
  55502. return new Compression(attrs);
  55503. }
  55504. static config(attrs) {
  55505. return new Config(attrs);
  55506. }
  55507. static conformance(attrs) {
  55508. return new Conformance(attrs);
  55509. }
  55510. static contentCopy(attrs) {
  55511. return new ContentCopy(attrs);
  55512. }
  55513. static copies(attrs) {
  55514. return new Copies(attrs);
  55515. }
  55516. static creator(attrs) {
  55517. return new Creator(attrs);
  55518. }
  55519. static currentPage(attrs) {
  55520. return new CurrentPage(attrs);
  55521. }
  55522. static data(attrs) {
  55523. return new Data(attrs);
  55524. }
  55525. static debug(attrs) {
  55526. return new Debug(attrs);
  55527. }
  55528. static defaultTypeface(attrs) {
  55529. return new DefaultTypeface(attrs);
  55530. }
  55531. static destination(attrs) {
  55532. return new Destination(attrs);
  55533. }
  55534. static documentAssembly(attrs) {
  55535. return new DocumentAssembly(attrs);
  55536. }
  55537. static driver(attrs) {
  55538. return new Driver(attrs);
  55539. }
  55540. static duplexOption(attrs) {
  55541. return new DuplexOption(attrs);
  55542. }
  55543. static dynamicRender(attrs) {
  55544. return new DynamicRender(attrs);
  55545. }
  55546. static embed(attrs) {
  55547. return new Embed(attrs);
  55548. }
  55549. static encrypt(attrs) {
  55550. return new Encrypt(attrs);
  55551. }
  55552. static encryption(attrs) {
  55553. return new Encryption(attrs);
  55554. }
  55555. static encryptionLevel(attrs) {
  55556. return new EncryptionLevel(attrs);
  55557. }
  55558. static enforce(attrs) {
  55559. return new Enforce(attrs);
  55560. }
  55561. static equate(attrs) {
  55562. return new Equate(attrs);
  55563. }
  55564. static equateRange(attrs) {
  55565. return new EquateRange(attrs);
  55566. }
  55567. static exclude(attrs) {
  55568. return new Exclude(attrs);
  55569. }
  55570. static excludeNS(attrs) {
  55571. return new ExcludeNS(attrs);
  55572. }
  55573. static flipLabel(attrs) {
  55574. return new FlipLabel(attrs);
  55575. }
  55576. static fontInfo(attrs) {
  55577. return new FontInfo(attrs);
  55578. }
  55579. static formFieldFilling(attrs) {
  55580. return new FormFieldFilling(attrs);
  55581. }
  55582. static groupParent(attrs) {
  55583. return new GroupParent(attrs);
  55584. }
  55585. static ifEmpty(attrs) {
  55586. return new IfEmpty(attrs);
  55587. }
  55588. static includeXDPContent(attrs) {
  55589. return new IncludeXDPContent(attrs);
  55590. }
  55591. static incrementalLoad(attrs) {
  55592. return new IncrementalLoad(attrs);
  55593. }
  55594. static incrementalMerge(attrs) {
  55595. return new IncrementalMerge(attrs);
  55596. }
  55597. static interactive(attrs) {
  55598. return new Interactive(attrs);
  55599. }
  55600. static jog(attrs) {
  55601. return new Jog(attrs);
  55602. }
  55603. static labelPrinter(attrs) {
  55604. return new LabelPrinter(attrs);
  55605. }
  55606. static layout(attrs) {
  55607. return new Layout(attrs);
  55608. }
  55609. static level(attrs) {
  55610. return new Level(attrs);
  55611. }
  55612. static linearized(attrs) {
  55613. return new Linearized(attrs);
  55614. }
  55615. static locale(attrs) {
  55616. return new Locale(attrs);
  55617. }
  55618. static localeSet(attrs) {
  55619. return new LocaleSet(attrs);
  55620. }
  55621. static log(attrs) {
  55622. return new Log(attrs);
  55623. }
  55624. static map(attrs) {
  55625. return new MapElement(attrs);
  55626. }
  55627. static mediumInfo(attrs) {
  55628. return new MediumInfo(attrs);
  55629. }
  55630. static message(attrs) {
  55631. return new Message(attrs);
  55632. }
  55633. static messaging(attrs) {
  55634. return new Messaging(attrs);
  55635. }
  55636. static mode(attrs) {
  55637. return new Mode(attrs);
  55638. }
  55639. static modifyAnnots(attrs) {
  55640. return new ModifyAnnots(attrs);
  55641. }
  55642. static msgId(attrs) {
  55643. return new MsgId(attrs);
  55644. }
  55645. static nameAttr(attrs) {
  55646. return new NameAttr(attrs);
  55647. }
  55648. static neverEmbed(attrs) {
  55649. return new NeverEmbed(attrs);
  55650. }
  55651. static numberOfCopies(attrs) {
  55652. return new NumberOfCopies(attrs);
  55653. }
  55654. static openAction(attrs) {
  55655. return new OpenAction(attrs);
  55656. }
  55657. static output(attrs) {
  55658. return new Output(attrs);
  55659. }
  55660. static outputBin(attrs) {
  55661. return new OutputBin(attrs);
  55662. }
  55663. static outputXSL(attrs) {
  55664. return new OutputXSL(attrs);
  55665. }
  55666. static overprint(attrs) {
  55667. return new Overprint(attrs);
  55668. }
  55669. static packets(attrs) {
  55670. return new Packets(attrs);
  55671. }
  55672. static pageOffset(attrs) {
  55673. return new PageOffset(attrs);
  55674. }
  55675. static pageRange(attrs) {
  55676. return new PageRange(attrs);
  55677. }
  55678. static pagination(attrs) {
  55679. return new Pagination(attrs);
  55680. }
  55681. static paginationOverride(attrs) {
  55682. return new PaginationOverride(attrs);
  55683. }
  55684. static part(attrs) {
  55685. return new Part(attrs);
  55686. }
  55687. static pcl(attrs) {
  55688. return new Pcl(attrs);
  55689. }
  55690. static pdf(attrs) {
  55691. return new Pdf(attrs);
  55692. }
  55693. static pdfa(attrs) {
  55694. return new Pdfa(attrs);
  55695. }
  55696. static permissions(attrs) {
  55697. return new Permissions(attrs);
  55698. }
  55699. static pickTrayByPDFSize(attrs) {
  55700. return new PickTrayByPDFSize(attrs);
  55701. }
  55702. static picture(attrs) {
  55703. return new Picture(attrs);
  55704. }
  55705. static plaintextMetadata(attrs) {
  55706. return new PlaintextMetadata(attrs);
  55707. }
  55708. static presence(attrs) {
  55709. return new Presence(attrs);
  55710. }
  55711. static present(attrs) {
  55712. return new Present(attrs);
  55713. }
  55714. static print(attrs) {
  55715. return new Print(attrs);
  55716. }
  55717. static printHighQuality(attrs) {
  55718. return new PrintHighQuality(attrs);
  55719. }
  55720. static printScaling(attrs) {
  55721. return new PrintScaling(attrs);
  55722. }
  55723. static printerName(attrs) {
  55724. return new PrinterName(attrs);
  55725. }
  55726. static producer(attrs) {
  55727. return new Producer(attrs);
  55728. }
  55729. static ps(attrs) {
  55730. return new Ps(attrs);
  55731. }
  55732. static range(attrs) {
  55733. return new Range(attrs);
  55734. }
  55735. static record(attrs) {
  55736. return new Record(attrs);
  55737. }
  55738. static relevant(attrs) {
  55739. return new Relevant(attrs);
  55740. }
  55741. static rename(attrs) {
  55742. return new Rename(attrs);
  55743. }
  55744. static renderPolicy(attrs) {
  55745. return new RenderPolicy(attrs);
  55746. }
  55747. static runScripts(attrs) {
  55748. return new RunScripts(attrs);
  55749. }
  55750. static script(attrs) {
  55751. return new Script(attrs);
  55752. }
  55753. static scriptModel(attrs) {
  55754. return new ScriptModel(attrs);
  55755. }
  55756. static severity(attrs) {
  55757. return new Severity(attrs);
  55758. }
  55759. static silentPrint(attrs) {
  55760. return new SilentPrint(attrs);
  55761. }
  55762. static staple(attrs) {
  55763. return new Staple(attrs);
  55764. }
  55765. static startNode(attrs) {
  55766. return new StartNode(attrs);
  55767. }
  55768. static startPage(attrs) {
  55769. return new StartPage(attrs);
  55770. }
  55771. static submitFormat(attrs) {
  55772. return new SubmitFormat(attrs);
  55773. }
  55774. static submitUrl(attrs) {
  55775. return new SubmitUrl(attrs);
  55776. }
  55777. static subsetBelow(attrs) {
  55778. return new SubsetBelow(attrs);
  55779. }
  55780. static suppressBanner(attrs) {
  55781. return new SuppressBanner(attrs);
  55782. }
  55783. static tagged(attrs) {
  55784. return new Tagged(attrs);
  55785. }
  55786. static template(attrs) {
  55787. return new Template(attrs);
  55788. }
  55789. static templateCache(attrs) {
  55790. return new TemplateCache(attrs);
  55791. }
  55792. static threshold(attrs) {
  55793. return new Threshold(attrs);
  55794. }
  55795. static to(attrs) {
  55796. return new To(attrs);
  55797. }
  55798. static trace(attrs) {
  55799. return new Trace(attrs);
  55800. }
  55801. static transform(attrs) {
  55802. return new Transform(attrs);
  55803. }
  55804. static type(attrs) {
  55805. return new Type(attrs);
  55806. }
  55807. static uri(attrs) {
  55808. return new Uri(attrs);
  55809. }
  55810. static validate(attrs) {
  55811. return new Validate(attrs);
  55812. }
  55813. static validateApprovalSignatures(attrs) {
  55814. return new ValidateApprovalSignatures(attrs);
  55815. }
  55816. static validationMessaging(attrs) {
  55817. return new ValidationMessaging(attrs);
  55818. }
  55819. static version(attrs) {
  55820. return new Version(attrs);
  55821. }
  55822. static versionControl(attrs) {
  55823. return new VersionControl(attrs);
  55824. }
  55825. static viewerPreferences(attrs) {
  55826. return new ViewerPreferences(attrs);
  55827. }
  55828. static webClient(attrs) {
  55829. return new WebClient(attrs);
  55830. }
  55831. static whitespace(attrs) {
  55832. return new Whitespace(attrs);
  55833. }
  55834. static window(attrs) {
  55835. return new Window(attrs);
  55836. }
  55837. static xdc(attrs) {
  55838. return new Xdc(attrs);
  55839. }
  55840. static xdp(attrs) {
  55841. return new Xdp(attrs);
  55842. }
  55843. static xsl(attrs) {
  55844. return new Xsl(attrs);
  55845. }
  55846. static zpl(attrs) {
  55847. return new Zpl(attrs);
  55848. }
  55849. }
  55850. exports.ConfigNamespace = ConfigNamespace;
  55851. /***/ }),
  55852. /* 80 */
  55853. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55854. Object.defineProperty(exports, "__esModule", ({
  55855. value: true
  55856. }));
  55857. exports.ConnectionSetNamespace = void 0;
  55858. var _namespaces = __w_pdfjs_require__(70);
  55859. var _xfa_object = __w_pdfjs_require__(68);
  55860. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  55861. class ConnectionSet extends _xfa_object.XFAObject {
  55862. constructor(attributes) {
  55863. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  55864. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  55865. this.xmlConnection = new _xfa_object.XFAObjectArray();
  55866. this.xsdConnection = new _xfa_object.XFAObjectArray();
  55867. }
  55868. }
  55869. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  55870. constructor(attributes) {
  55871. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  55872. this.id = attributes.id || "";
  55873. this.name = attributes.name || "";
  55874. this.use = attributes.use || "";
  55875. this.usehref = attributes.usehref || "";
  55876. }
  55877. }
  55878. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  55879. constructor(attributes) {
  55880. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  55881. this.id = attributes.id || "";
  55882. this.name = attributes.name || "";
  55883. this.use = attributes.use || "";
  55884. this.usehref = attributes.usehref || "";
  55885. }
  55886. }
  55887. class Operation extends _xfa_object.StringObject {
  55888. constructor(attributes) {
  55889. super(CONNECTION_SET_NS_ID, "operation");
  55890. this.id = attributes.id || "";
  55891. this.input = attributes.input || "";
  55892. this.name = attributes.name || "";
  55893. this.output = attributes.output || "";
  55894. this.use = attributes.use || "";
  55895. this.usehref = attributes.usehref || "";
  55896. }
  55897. }
  55898. class RootElement extends _xfa_object.StringObject {
  55899. constructor(attributes) {
  55900. super(CONNECTION_SET_NS_ID, "rootElement");
  55901. this.id = attributes.id || "";
  55902. this.name = attributes.name || "";
  55903. this.use = attributes.use || "";
  55904. this.usehref = attributes.usehref || "";
  55905. }
  55906. }
  55907. class SoapAction extends _xfa_object.StringObject {
  55908. constructor(attributes) {
  55909. super(CONNECTION_SET_NS_ID, "soapAction");
  55910. this.id = attributes.id || "";
  55911. this.name = attributes.name || "";
  55912. this.use = attributes.use || "";
  55913. this.usehref = attributes.usehref || "";
  55914. }
  55915. }
  55916. class SoapAddress extends _xfa_object.StringObject {
  55917. constructor(attributes) {
  55918. super(CONNECTION_SET_NS_ID, "soapAddress");
  55919. this.id = attributes.id || "";
  55920. this.name = attributes.name || "";
  55921. this.use = attributes.use || "";
  55922. this.usehref = attributes.usehref || "";
  55923. }
  55924. }
  55925. class Uri extends _xfa_object.StringObject {
  55926. constructor(attributes) {
  55927. super(CONNECTION_SET_NS_ID, "uri");
  55928. this.id = attributes.id || "";
  55929. this.name = attributes.name || "";
  55930. this.use = attributes.use || "";
  55931. this.usehref = attributes.usehref || "";
  55932. }
  55933. }
  55934. class WsdlAddress extends _xfa_object.StringObject {
  55935. constructor(attributes) {
  55936. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  55937. this.id = attributes.id || "";
  55938. this.name = attributes.name || "";
  55939. this.use = attributes.use || "";
  55940. this.usehref = attributes.usehref || "";
  55941. }
  55942. }
  55943. class WsdlConnection extends _xfa_object.XFAObject {
  55944. constructor(attributes) {
  55945. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  55946. this.dataDescription = attributes.dataDescription || "";
  55947. this.name = attributes.name || "";
  55948. this.effectiveInputPolicy = null;
  55949. this.effectiveOutputPolicy = null;
  55950. this.operation = null;
  55951. this.soapAction = null;
  55952. this.soapAddress = null;
  55953. this.wsdlAddress = null;
  55954. }
  55955. }
  55956. class XmlConnection extends _xfa_object.XFAObject {
  55957. constructor(attributes) {
  55958. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  55959. this.dataDescription = attributes.dataDescription || "";
  55960. this.name = attributes.name || "";
  55961. this.uri = null;
  55962. }
  55963. }
  55964. class XsdConnection extends _xfa_object.XFAObject {
  55965. constructor(attributes) {
  55966. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  55967. this.dataDescription = attributes.dataDescription || "";
  55968. this.name = attributes.name || "";
  55969. this.rootElement = null;
  55970. this.uri = null;
  55971. }
  55972. }
  55973. class ConnectionSetNamespace {
  55974. static [_namespaces.$buildXFAObject](name, attributes) {
  55975. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  55976. return ConnectionSetNamespace[name](attributes);
  55977. }
  55978. return undefined;
  55979. }
  55980. static connectionSet(attrs) {
  55981. return new ConnectionSet(attrs);
  55982. }
  55983. static effectiveInputPolicy(attrs) {
  55984. return new EffectiveInputPolicy(attrs);
  55985. }
  55986. static effectiveOutputPolicy(attrs) {
  55987. return new EffectiveOutputPolicy(attrs);
  55988. }
  55989. static operation(attrs) {
  55990. return new Operation(attrs);
  55991. }
  55992. static rootElement(attrs) {
  55993. return new RootElement(attrs);
  55994. }
  55995. static soapAction(attrs) {
  55996. return new SoapAction(attrs);
  55997. }
  55998. static soapAddress(attrs) {
  55999. return new SoapAddress(attrs);
  56000. }
  56001. static uri(attrs) {
  56002. return new Uri(attrs);
  56003. }
  56004. static wsdlAddress(attrs) {
  56005. return new WsdlAddress(attrs);
  56006. }
  56007. static wsdlConnection(attrs) {
  56008. return new WsdlConnection(attrs);
  56009. }
  56010. static xmlConnection(attrs) {
  56011. return new XmlConnection(attrs);
  56012. }
  56013. static xsdConnection(attrs) {
  56014. return new XsdConnection(attrs);
  56015. }
  56016. }
  56017. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  56018. /***/ }),
  56019. /* 81 */
  56020. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56021. Object.defineProperty(exports, "__esModule", ({
  56022. value: true
  56023. }));
  56024. exports.DatasetsNamespace = void 0;
  56025. var _xfa_object = __w_pdfjs_require__(68);
  56026. var _namespaces = __w_pdfjs_require__(70);
  56027. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  56028. class Data extends _xfa_object.XmlObject {
  56029. constructor(attributes) {
  56030. super(DATASETS_NS_ID, "data", attributes);
  56031. }
  56032. }
  56033. class Datasets extends _xfa_object.XFAObject {
  56034. constructor(attributes) {
  56035. super(DATASETS_NS_ID, "datasets", true);
  56036. this.data = null;
  56037. this.Signature = null;
  56038. }
  56039. [_xfa_object.$onChild](child) {
  56040. const name = child[_xfa_object.$nodeName];
  56041. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  56042. this[name] = child;
  56043. } else {
  56044. child[_xfa_object.$global] = true;
  56045. }
  56046. this[_xfa_object.$appendChild](child);
  56047. }
  56048. }
  56049. class DatasetsNamespace {
  56050. static [_namespaces.$buildXFAObject](name, attributes) {
  56051. if (DatasetsNamespace.hasOwnProperty(name)) {
  56052. return DatasetsNamespace[name](attributes);
  56053. }
  56054. return undefined;
  56055. }
  56056. static datasets(attributes) {
  56057. return new Datasets(attributes);
  56058. }
  56059. static data(attributes) {
  56060. return new Data(attributes);
  56061. }
  56062. }
  56063. exports.DatasetsNamespace = DatasetsNamespace;
  56064. /***/ }),
  56065. /* 82 */
  56066. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56067. Object.defineProperty(exports, "__esModule", ({
  56068. value: true
  56069. }));
  56070. exports.LocaleSetNamespace = void 0;
  56071. var _namespaces = __w_pdfjs_require__(70);
  56072. var _xfa_object = __w_pdfjs_require__(68);
  56073. var _utils = __w_pdfjs_require__(69);
  56074. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  56075. class CalendarSymbols extends _xfa_object.XFAObject {
  56076. constructor(attributes) {
  56077. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  56078. this.name = "gregorian";
  56079. this.dayNames = new _xfa_object.XFAObjectArray(2);
  56080. this.eraNames = null;
  56081. this.meridiemNames = null;
  56082. this.monthNames = new _xfa_object.XFAObjectArray(2);
  56083. }
  56084. }
  56085. class CurrencySymbol extends _xfa_object.StringObject {
  56086. constructor(attributes) {
  56087. super(LOCALE_SET_NS_ID, "currencySymbol");
  56088. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  56089. }
  56090. }
  56091. class CurrencySymbols extends _xfa_object.XFAObject {
  56092. constructor(attributes) {
  56093. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  56094. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  56095. }
  56096. }
  56097. class DatePattern extends _xfa_object.StringObject {
  56098. constructor(attributes) {
  56099. super(LOCALE_SET_NS_ID, "datePattern");
  56100. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  56101. }
  56102. }
  56103. class DatePatterns extends _xfa_object.XFAObject {
  56104. constructor(attributes) {
  56105. super(LOCALE_SET_NS_ID, "datePatterns", true);
  56106. this.datePattern = new _xfa_object.XFAObjectArray(4);
  56107. }
  56108. }
  56109. class DateTimeSymbols extends _xfa_object.ContentObject {
  56110. constructor(attributes) {
  56111. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  56112. }
  56113. }
  56114. class Day extends _xfa_object.StringObject {
  56115. constructor(attributes) {
  56116. super(LOCALE_SET_NS_ID, "day");
  56117. }
  56118. }
  56119. class DayNames extends _xfa_object.XFAObject {
  56120. constructor(attributes) {
  56121. super(LOCALE_SET_NS_ID, "dayNames", true);
  56122. this.abbr = (0, _utils.getInteger)({
  56123. data: attributes.abbr,
  56124. defaultValue: 0,
  56125. validate: x => x === 1
  56126. });
  56127. this.day = new _xfa_object.XFAObjectArray(7);
  56128. }
  56129. }
  56130. class Era extends _xfa_object.StringObject {
  56131. constructor(attributes) {
  56132. super(LOCALE_SET_NS_ID, "era");
  56133. }
  56134. }
  56135. class EraNames extends _xfa_object.XFAObject {
  56136. constructor(attributes) {
  56137. super(LOCALE_SET_NS_ID, "eraNames", true);
  56138. this.era = new _xfa_object.XFAObjectArray(2);
  56139. }
  56140. }
  56141. class Locale extends _xfa_object.XFAObject {
  56142. constructor(attributes) {
  56143. super(LOCALE_SET_NS_ID, "locale", true);
  56144. this.desc = attributes.desc || "";
  56145. this.name = "isoname";
  56146. this.calendarSymbols = null;
  56147. this.currencySymbols = null;
  56148. this.datePatterns = null;
  56149. this.dateTimeSymbols = null;
  56150. this.numberPatterns = null;
  56151. this.numberSymbols = null;
  56152. this.timePatterns = null;
  56153. this.typeFaces = null;
  56154. }
  56155. }
  56156. class LocaleSet extends _xfa_object.XFAObject {
  56157. constructor(attributes) {
  56158. super(LOCALE_SET_NS_ID, "localeSet", true);
  56159. this.locale = new _xfa_object.XFAObjectArray();
  56160. }
  56161. }
  56162. class Meridiem extends _xfa_object.StringObject {
  56163. constructor(attributes) {
  56164. super(LOCALE_SET_NS_ID, "meridiem");
  56165. }
  56166. }
  56167. class MeridiemNames extends _xfa_object.XFAObject {
  56168. constructor(attributes) {
  56169. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  56170. this.meridiem = new _xfa_object.XFAObjectArray(2);
  56171. }
  56172. }
  56173. class Month extends _xfa_object.StringObject {
  56174. constructor(attributes) {
  56175. super(LOCALE_SET_NS_ID, "month");
  56176. }
  56177. }
  56178. class MonthNames extends _xfa_object.XFAObject {
  56179. constructor(attributes) {
  56180. super(LOCALE_SET_NS_ID, "monthNames", true);
  56181. this.abbr = (0, _utils.getInteger)({
  56182. data: attributes.abbr,
  56183. defaultValue: 0,
  56184. validate: x => x === 1
  56185. });
  56186. this.month = new _xfa_object.XFAObjectArray(12);
  56187. }
  56188. }
  56189. class NumberPattern extends _xfa_object.StringObject {
  56190. constructor(attributes) {
  56191. super(LOCALE_SET_NS_ID, "numberPattern");
  56192. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  56193. }
  56194. }
  56195. class NumberPatterns extends _xfa_object.XFAObject {
  56196. constructor(attributes) {
  56197. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  56198. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  56199. }
  56200. }
  56201. class NumberSymbol extends _xfa_object.StringObject {
  56202. constructor(attributes) {
  56203. super(LOCALE_SET_NS_ID, "numberSymbol");
  56204. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  56205. }
  56206. }
  56207. class NumberSymbols extends _xfa_object.XFAObject {
  56208. constructor(attributes) {
  56209. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  56210. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  56211. }
  56212. }
  56213. class TimePattern extends _xfa_object.StringObject {
  56214. constructor(attributes) {
  56215. super(LOCALE_SET_NS_ID, "timePattern");
  56216. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  56217. }
  56218. }
  56219. class TimePatterns extends _xfa_object.XFAObject {
  56220. constructor(attributes) {
  56221. super(LOCALE_SET_NS_ID, "timePatterns", true);
  56222. this.timePattern = new _xfa_object.XFAObjectArray(4);
  56223. }
  56224. }
  56225. class TypeFace extends _xfa_object.XFAObject {
  56226. constructor(attributes) {
  56227. super(LOCALE_SET_NS_ID, "typeFace", true);
  56228. this.name = attributes.name | "";
  56229. }
  56230. }
  56231. class TypeFaces extends _xfa_object.XFAObject {
  56232. constructor(attributes) {
  56233. super(LOCALE_SET_NS_ID, "typeFaces", true);
  56234. this.typeFace = new _xfa_object.XFAObjectArray();
  56235. }
  56236. }
  56237. class LocaleSetNamespace {
  56238. static [_namespaces.$buildXFAObject](name, attributes) {
  56239. if (LocaleSetNamespace.hasOwnProperty(name)) {
  56240. return LocaleSetNamespace[name](attributes);
  56241. }
  56242. return undefined;
  56243. }
  56244. static calendarSymbols(attrs) {
  56245. return new CalendarSymbols(attrs);
  56246. }
  56247. static currencySymbol(attrs) {
  56248. return new CurrencySymbol(attrs);
  56249. }
  56250. static currencySymbols(attrs) {
  56251. return new CurrencySymbols(attrs);
  56252. }
  56253. static datePattern(attrs) {
  56254. return new DatePattern(attrs);
  56255. }
  56256. static datePatterns(attrs) {
  56257. return new DatePatterns(attrs);
  56258. }
  56259. static dateTimeSymbols(attrs) {
  56260. return new DateTimeSymbols(attrs);
  56261. }
  56262. static day(attrs) {
  56263. return new Day(attrs);
  56264. }
  56265. static dayNames(attrs) {
  56266. return new DayNames(attrs);
  56267. }
  56268. static era(attrs) {
  56269. return new Era(attrs);
  56270. }
  56271. static eraNames(attrs) {
  56272. return new EraNames(attrs);
  56273. }
  56274. static locale(attrs) {
  56275. return new Locale(attrs);
  56276. }
  56277. static localeSet(attrs) {
  56278. return new LocaleSet(attrs);
  56279. }
  56280. static meridiem(attrs) {
  56281. return new Meridiem(attrs);
  56282. }
  56283. static meridiemNames(attrs) {
  56284. return new MeridiemNames(attrs);
  56285. }
  56286. static month(attrs) {
  56287. return new Month(attrs);
  56288. }
  56289. static monthNames(attrs) {
  56290. return new MonthNames(attrs);
  56291. }
  56292. static numberPattern(attrs) {
  56293. return new NumberPattern(attrs);
  56294. }
  56295. static numberPatterns(attrs) {
  56296. return new NumberPatterns(attrs);
  56297. }
  56298. static numberSymbol(attrs) {
  56299. return new NumberSymbol(attrs);
  56300. }
  56301. static numberSymbols(attrs) {
  56302. return new NumberSymbols(attrs);
  56303. }
  56304. static timePattern(attrs) {
  56305. return new TimePattern(attrs);
  56306. }
  56307. static timePatterns(attrs) {
  56308. return new TimePatterns(attrs);
  56309. }
  56310. static typeFace(attrs) {
  56311. return new TypeFace(attrs);
  56312. }
  56313. static typeFaces(attrs) {
  56314. return new TypeFaces(attrs);
  56315. }
  56316. }
  56317. exports.LocaleSetNamespace = LocaleSetNamespace;
  56318. /***/ }),
  56319. /* 83 */
  56320. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56321. Object.defineProperty(exports, "__esModule", ({
  56322. value: true
  56323. }));
  56324. exports.SignatureNamespace = void 0;
  56325. var _namespaces = __w_pdfjs_require__(70);
  56326. var _xfa_object = __w_pdfjs_require__(68);
  56327. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  56328. class Signature extends _xfa_object.XFAObject {
  56329. constructor(attributes) {
  56330. super(SIGNATURE_NS_ID, "signature", true);
  56331. }
  56332. }
  56333. class SignatureNamespace {
  56334. static [_namespaces.$buildXFAObject](name, attributes) {
  56335. if (SignatureNamespace.hasOwnProperty(name)) {
  56336. return SignatureNamespace[name](attributes);
  56337. }
  56338. return undefined;
  56339. }
  56340. static signature(attributes) {
  56341. return new Signature(attributes);
  56342. }
  56343. }
  56344. exports.SignatureNamespace = SignatureNamespace;
  56345. /***/ }),
  56346. /* 84 */
  56347. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56348. Object.defineProperty(exports, "__esModule", ({
  56349. value: true
  56350. }));
  56351. exports.StylesheetNamespace = void 0;
  56352. var _namespaces = __w_pdfjs_require__(70);
  56353. var _xfa_object = __w_pdfjs_require__(68);
  56354. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  56355. class Stylesheet extends _xfa_object.XFAObject {
  56356. constructor(attributes) {
  56357. super(STYLESHEET_NS_ID, "stylesheet", true);
  56358. }
  56359. }
  56360. class StylesheetNamespace {
  56361. static [_namespaces.$buildXFAObject](name, attributes) {
  56362. if (StylesheetNamespace.hasOwnProperty(name)) {
  56363. return StylesheetNamespace[name](attributes);
  56364. }
  56365. return undefined;
  56366. }
  56367. static stylesheet(attributes) {
  56368. return new Stylesheet(attributes);
  56369. }
  56370. }
  56371. exports.StylesheetNamespace = StylesheetNamespace;
  56372. /***/ }),
  56373. /* 85 */
  56374. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56375. Object.defineProperty(exports, "__esModule", ({
  56376. value: true
  56377. }));
  56378. exports.XdpNamespace = void 0;
  56379. var _namespaces = __w_pdfjs_require__(70);
  56380. var _xfa_object = __w_pdfjs_require__(68);
  56381. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  56382. class Xdp extends _xfa_object.XFAObject {
  56383. constructor(attributes) {
  56384. super(XDP_NS_ID, "xdp", true);
  56385. this.uuid = attributes.uuid || "";
  56386. this.timeStamp = attributes.timeStamp || "";
  56387. this.config = null;
  56388. this.connectionSet = null;
  56389. this.datasets = null;
  56390. this.localeSet = null;
  56391. this.stylesheet = new _xfa_object.XFAObjectArray();
  56392. this.template = null;
  56393. }
  56394. [_xfa_object.$onChildCheck](child) {
  56395. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  56396. return ns && child[_xfa_object.$namespaceId] === ns.id;
  56397. }
  56398. }
  56399. class XdpNamespace {
  56400. static [_namespaces.$buildXFAObject](name, attributes) {
  56401. if (XdpNamespace.hasOwnProperty(name)) {
  56402. return XdpNamespace[name](attributes);
  56403. }
  56404. return undefined;
  56405. }
  56406. static xdp(attributes) {
  56407. return new Xdp(attributes);
  56408. }
  56409. }
  56410. exports.XdpNamespace = XdpNamespace;
  56411. /***/ }),
  56412. /* 86 */
  56413. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56414. Object.defineProperty(exports, "__esModule", ({
  56415. value: true
  56416. }));
  56417. exports.XhtmlNamespace = void 0;
  56418. var _xfa_object = __w_pdfjs_require__(68);
  56419. var _namespaces = __w_pdfjs_require__(70);
  56420. var _html_utils = __w_pdfjs_require__(73);
  56421. var _utils = __w_pdfjs_require__(69);
  56422. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  56423. 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"]);
  56424. 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 => (0, _html_utils.measureToString)(1 * (0, _utils.getMeasurement)(value))], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)(0.99 * (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 => (0, _html_utils.getFonts)(value)]]);
  56425. const spacesRegExp = /\s+/g;
  56426. const crlfRegExp = /[\r\n]+/g;
  56427. function mapStyle(styleStr) {
  56428. const style = Object.create(null);
  56429. if (!styleStr) {
  56430. return style;
  56431. }
  56432. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  56433. const mapping = StyleMapping.get(key);
  56434. if (mapping === "") {
  56435. continue;
  56436. }
  56437. let newValue = value;
  56438. if (mapping) {
  56439. if (typeof mapping === "string") {
  56440. newValue = mapping;
  56441. } else {
  56442. newValue = mapping(value);
  56443. }
  56444. }
  56445. if (key.endsWith("scale")) {
  56446. if (style.transform) {
  56447. style.transform = `${style[key]} ${newValue}`;
  56448. } else {
  56449. style.transform = newValue;
  56450. }
  56451. } else {
  56452. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  56453. }
  56454. }
  56455. (0, _html_utils.fixTextIndent)(style);
  56456. return style;
  56457. }
  56458. function checkStyle(style) {
  56459. if (!style) {
  56460. return "";
  56461. }
  56462. return style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key]) => VALID_STYLES.has(key)).map(kv => kv.join(":")).join(";");
  56463. }
  56464. const NoWhites = new Set(["body", "html"]);
  56465. class XhtmlObject extends _xfa_object.XmlObject {
  56466. constructor(attributes, name) {
  56467. super(XHTML_NS_ID, name);
  56468. this.style = checkStyle(attributes.style);
  56469. }
  56470. [_xfa_object.$acceptWhitespace]() {
  56471. return !NoWhites.has(this[_xfa_object.$nodeName]);
  56472. }
  56473. [_xfa_object.$onText](str) {
  56474. str = str.replace(crlfRegExp, "");
  56475. if (!this.style.includes("xfa-spacerun:yes")) {
  56476. str = str.replace(spacesRegExp, " ");
  56477. }
  56478. if (str) {
  56479. this[_xfa_object.$content] += str;
  56480. }
  56481. }
  56482. [_xfa_object.$toHTML](availableSpace) {
  56483. const children = [];
  56484. this[_xfa_object.$extra] = {
  56485. children
  56486. };
  56487. this[_xfa_object.$childrenToHTML]({});
  56488. if (children.length === 0 && !this[_xfa_object.$content]) {
  56489. return _utils.HTMLResult.EMPTY;
  56490. }
  56491. return _utils.HTMLResult.success({
  56492. name: this[_xfa_object.$nodeName],
  56493. attributes: {
  56494. href: this.href,
  56495. style: mapStyle(this.style)
  56496. },
  56497. children,
  56498. value: this[_xfa_object.$content] || ""
  56499. });
  56500. }
  56501. }
  56502. class A extends XhtmlObject {
  56503. constructor(attributes) {
  56504. super(attributes, "a");
  56505. this.href = attributes.href || "";
  56506. }
  56507. }
  56508. class B extends XhtmlObject {
  56509. constructor(attributes) {
  56510. super(attributes, "b");
  56511. }
  56512. }
  56513. class Body extends XhtmlObject {
  56514. constructor(attributes) {
  56515. super(attributes, "body");
  56516. }
  56517. [_xfa_object.$toHTML](availableSpace) {
  56518. const res = super[_xfa_object.$toHTML](availableSpace);
  56519. const {
  56520. html
  56521. } = res;
  56522. if (!html) {
  56523. return _utils.HTMLResult.EMPTY;
  56524. }
  56525. html.name = "div";
  56526. html.attributes.class = "xfaRich";
  56527. return res;
  56528. }
  56529. }
  56530. class Br extends XhtmlObject {
  56531. constructor(attributes) {
  56532. super(attributes, "br");
  56533. }
  56534. [_xfa_object.$text]() {
  56535. return "\n";
  56536. }
  56537. [_xfa_object.$toHTML](availableSpace) {
  56538. return _utils.HTMLResult.success({
  56539. name: "br"
  56540. });
  56541. }
  56542. }
  56543. class Html extends XhtmlObject {
  56544. constructor(attributes) {
  56545. super(attributes, "html");
  56546. }
  56547. [_xfa_object.$toHTML](availableSpace) {
  56548. const children = [];
  56549. this[_xfa_object.$extra] = {
  56550. children
  56551. };
  56552. this[_xfa_object.$childrenToHTML]({});
  56553. if (children.length === 0) {
  56554. return _utils.HTMLResult.success({
  56555. name: "div",
  56556. attributes: {
  56557. class: "xfaRich",
  56558. style: {}
  56559. },
  56560. value: this[_xfa_object.$content] || ""
  56561. });
  56562. }
  56563. if (children.length === 1) {
  56564. const child = children[0];
  56565. if (child.attributes && child.attributes.class === "xfaRich") {
  56566. return _utils.HTMLResult.success(child);
  56567. }
  56568. }
  56569. return _utils.HTMLResult.success({
  56570. name: "div",
  56571. attributes: {
  56572. class: "xfaRich",
  56573. style: {}
  56574. },
  56575. children
  56576. });
  56577. }
  56578. }
  56579. class I extends XhtmlObject {
  56580. constructor(attributes) {
  56581. super(attributes, "i");
  56582. }
  56583. }
  56584. class Li extends XhtmlObject {
  56585. constructor(attributes) {
  56586. super(attributes, "li");
  56587. }
  56588. }
  56589. class Ol extends XhtmlObject {
  56590. constructor(attributes) {
  56591. super(attributes, "ol");
  56592. }
  56593. }
  56594. class P extends XhtmlObject {
  56595. constructor(attributes) {
  56596. super(attributes, "p");
  56597. }
  56598. [_xfa_object.$text]() {
  56599. return super[_xfa_object.$text]() + "\n";
  56600. }
  56601. }
  56602. class Span extends XhtmlObject {
  56603. constructor(attributes) {
  56604. super(attributes, "span");
  56605. }
  56606. }
  56607. class Sub extends XhtmlObject {
  56608. constructor(attributes) {
  56609. super(attributes, "sub");
  56610. }
  56611. }
  56612. class Sup extends XhtmlObject {
  56613. constructor(attributes) {
  56614. super(attributes, "sup");
  56615. }
  56616. }
  56617. class Ul extends XhtmlObject {
  56618. constructor(attributes) {
  56619. super(attributes, "ul");
  56620. }
  56621. }
  56622. class XhtmlNamespace {
  56623. static [_namespaces.$buildXFAObject](name, attributes) {
  56624. if (XhtmlNamespace.hasOwnProperty(name)) {
  56625. return XhtmlNamespace[name](attributes);
  56626. }
  56627. return undefined;
  56628. }
  56629. static a(attributes) {
  56630. return new A(attributes);
  56631. }
  56632. static b(attributes) {
  56633. return new B(attributes);
  56634. }
  56635. static body(attributes) {
  56636. return new Body(attributes);
  56637. }
  56638. static br(attributes) {
  56639. return new Br(attributes);
  56640. }
  56641. static html(attributes) {
  56642. return new Html(attributes);
  56643. }
  56644. static i(attributes) {
  56645. return new I(attributes);
  56646. }
  56647. static li(attributes) {
  56648. return new Li(attributes);
  56649. }
  56650. static ol(attributes) {
  56651. return new Ol(attributes);
  56652. }
  56653. static p(attributes) {
  56654. return new P(attributes);
  56655. }
  56656. static span(attributes) {
  56657. return new Span(attributes);
  56658. }
  56659. static sub(attributes) {
  56660. return new Sub(attributes);
  56661. }
  56662. static sup(attributes) {
  56663. return new Sup(attributes);
  56664. }
  56665. static ul(attributes) {
  56666. return new Ul(attributes);
  56667. }
  56668. }
  56669. exports.XhtmlNamespace = XhtmlNamespace;
  56670. /***/ }),
  56671. /* 87 */
  56672. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56673. Object.defineProperty(exports, "__esModule", ({
  56674. value: true
  56675. }));
  56676. exports.UnknownNamespace = void 0;
  56677. var _namespaces = __w_pdfjs_require__(70);
  56678. var _xfa_object = __w_pdfjs_require__(68);
  56679. class UnknownNamespace {
  56680. constructor(nsId) {
  56681. this.namespaceId = nsId;
  56682. }
  56683. [_namespaces.$buildXFAObject](name, attributes) {
  56684. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  56685. }
  56686. }
  56687. exports.UnknownNamespace = UnknownNamespace;
  56688. /***/ }),
  56689. /* 88 */
  56690. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56691. Object.defineProperty(exports, "__esModule", ({
  56692. value: true
  56693. }));
  56694. exports.XRef = void 0;
  56695. var _util = __w_pdfjs_require__(2);
  56696. var _primitives = __w_pdfjs_require__(5);
  56697. var _parser = __w_pdfjs_require__(17);
  56698. var _core_utils = __w_pdfjs_require__(9);
  56699. var _crypto = __w_pdfjs_require__(65);
  56700. class XRef {
  56701. constructor(stream, pdfManager) {
  56702. this.stream = stream;
  56703. this.pdfManager = pdfManager;
  56704. this.entries = [];
  56705. this.xrefstms = Object.create(null);
  56706. this._cacheMap = new Map();
  56707. this.stats = {
  56708. streamTypes: Object.create(null),
  56709. fontTypes: Object.create(null)
  56710. };
  56711. this._newRefNum = null;
  56712. }
  56713. getNewRef() {
  56714. if (this._newRefNum === null) {
  56715. this._newRefNum = this.entries.length;
  56716. }
  56717. return _primitives.Ref.get(this._newRefNum++, 0);
  56718. }
  56719. resetNewRef() {
  56720. this._newRefNum = null;
  56721. }
  56722. setStartXRef(startXRef) {
  56723. this.startXRefQueue = [startXRef];
  56724. }
  56725. parse(recoveryMode = false) {
  56726. let trailerDict;
  56727. if (!recoveryMode) {
  56728. trailerDict = this.readXRef();
  56729. } else {
  56730. (0, _util.warn)("Indexing all PDF objects");
  56731. trailerDict = this.indexObjects();
  56732. }
  56733. trailerDict.assignXref(this);
  56734. this.trailer = trailerDict;
  56735. let encrypt;
  56736. try {
  56737. encrypt = trailerDict.get("Encrypt");
  56738. } catch (ex) {
  56739. if (ex instanceof _core_utils.MissingDataException) {
  56740. throw ex;
  56741. }
  56742. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  56743. }
  56744. if ((0, _primitives.isDict)(encrypt)) {
  56745. const ids = trailerDict.get("ID");
  56746. const fileId = ids && ids.length ? ids[0] : "";
  56747. encrypt.suppressEncryption = true;
  56748. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  56749. }
  56750. let root;
  56751. try {
  56752. root = trailerDict.get("Root");
  56753. } catch (ex) {
  56754. if (ex instanceof _core_utils.MissingDataException) {
  56755. throw ex;
  56756. }
  56757. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  56758. }
  56759. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  56760. this.root = root;
  56761. } else {
  56762. if (!recoveryMode) {
  56763. throw new _core_utils.XRefParseException();
  56764. }
  56765. throw new _util.FormatError("Invalid root reference");
  56766. }
  56767. }
  56768. processXRefTable(parser) {
  56769. if (!("tableState" in this)) {
  56770. this.tableState = {
  56771. entryNum: 0,
  56772. streamPos: parser.lexer.stream.pos,
  56773. parserBuf1: parser.buf1,
  56774. parserBuf2: parser.buf2
  56775. };
  56776. }
  56777. const obj = this.readXRefTable(parser);
  56778. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  56779. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  56780. }
  56781. let dict = parser.getObj();
  56782. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  56783. dict = dict.dict;
  56784. }
  56785. if (!(0, _primitives.isDict)(dict)) {
  56786. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  56787. }
  56788. delete this.tableState;
  56789. return dict;
  56790. }
  56791. readXRefTable(parser) {
  56792. const stream = parser.lexer.stream;
  56793. const tableState = this.tableState;
  56794. stream.pos = tableState.streamPos;
  56795. parser.buf1 = tableState.parserBuf1;
  56796. parser.buf2 = tableState.parserBuf2;
  56797. let obj;
  56798. while (true) {
  56799. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  56800. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  56801. break;
  56802. }
  56803. tableState.firstEntryNum = obj;
  56804. tableState.entryCount = parser.getObj();
  56805. }
  56806. let first = tableState.firstEntryNum;
  56807. const count = tableState.entryCount;
  56808. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  56809. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  56810. }
  56811. for (let i = tableState.entryNum; i < count; i++) {
  56812. tableState.streamPos = stream.pos;
  56813. tableState.entryNum = i;
  56814. tableState.parserBuf1 = parser.buf1;
  56815. tableState.parserBuf2 = parser.buf2;
  56816. const entry = {};
  56817. entry.offset = parser.getObj();
  56818. entry.gen = parser.getObj();
  56819. const type = parser.getObj();
  56820. if (type instanceof _primitives.Cmd) {
  56821. switch (type.cmd) {
  56822. case "f":
  56823. entry.free = true;
  56824. break;
  56825. case "n":
  56826. entry.uncompressed = true;
  56827. break;
  56828. }
  56829. }
  56830. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  56831. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  56832. }
  56833. if (i === 0 && entry.free && first === 1) {
  56834. first = 0;
  56835. }
  56836. if (!this.entries[i + first]) {
  56837. this.entries[i + first] = entry;
  56838. }
  56839. }
  56840. tableState.entryNum = 0;
  56841. tableState.streamPos = stream.pos;
  56842. tableState.parserBuf1 = parser.buf1;
  56843. tableState.parserBuf2 = parser.buf2;
  56844. delete tableState.firstEntryNum;
  56845. delete tableState.entryCount;
  56846. }
  56847. if (this.entries[0] && !this.entries[0].free) {
  56848. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  56849. }
  56850. return obj;
  56851. }
  56852. processXRefStream(stream) {
  56853. if (!("streamState" in this)) {
  56854. const streamParameters = stream.dict;
  56855. const byteWidths = streamParameters.get("W");
  56856. let range = streamParameters.get("Index");
  56857. if (!range) {
  56858. range = [0, streamParameters.get("Size")];
  56859. }
  56860. this.streamState = {
  56861. entryRanges: range,
  56862. byteWidths,
  56863. entryNum: 0,
  56864. streamPos: stream.pos
  56865. };
  56866. }
  56867. this.readXRefStream(stream);
  56868. delete this.streamState;
  56869. return stream.dict;
  56870. }
  56871. readXRefStream(stream) {
  56872. let i, j;
  56873. const streamState = this.streamState;
  56874. stream.pos = streamState.streamPos;
  56875. const byteWidths = streamState.byteWidths;
  56876. const typeFieldWidth = byteWidths[0];
  56877. const offsetFieldWidth = byteWidths[1];
  56878. const generationFieldWidth = byteWidths[2];
  56879. const entryRanges = streamState.entryRanges;
  56880. while (entryRanges.length > 0) {
  56881. const first = entryRanges[0];
  56882. const n = entryRanges[1];
  56883. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  56884. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  56885. }
  56886. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  56887. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  56888. }
  56889. for (i = streamState.entryNum; i < n; ++i) {
  56890. streamState.entryNum = i;
  56891. streamState.streamPos = stream.pos;
  56892. let type = 0,
  56893. offset = 0,
  56894. generation = 0;
  56895. for (j = 0; j < typeFieldWidth; ++j) {
  56896. type = type << 8 | stream.getByte();
  56897. }
  56898. if (typeFieldWidth === 0) {
  56899. type = 1;
  56900. }
  56901. for (j = 0; j < offsetFieldWidth; ++j) {
  56902. offset = offset << 8 | stream.getByte();
  56903. }
  56904. for (j = 0; j < generationFieldWidth; ++j) {
  56905. generation = generation << 8 | stream.getByte();
  56906. }
  56907. const entry = {};
  56908. entry.offset = offset;
  56909. entry.gen = generation;
  56910. switch (type) {
  56911. case 0:
  56912. entry.free = true;
  56913. break;
  56914. case 1:
  56915. entry.uncompressed = true;
  56916. break;
  56917. case 2:
  56918. break;
  56919. default:
  56920. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  56921. }
  56922. if (!this.entries[first + i]) {
  56923. this.entries[first + i] = entry;
  56924. }
  56925. }
  56926. streamState.entryNum = 0;
  56927. streamState.streamPos = stream.pos;
  56928. entryRanges.splice(0, 2);
  56929. }
  56930. }
  56931. indexObjects() {
  56932. const TAB = 0x9,
  56933. LF = 0xa,
  56934. CR = 0xd,
  56935. SPACE = 0x20;
  56936. const PERCENT = 0x25,
  56937. LT = 0x3c;
  56938. function readToken(data, offset) {
  56939. let token = "",
  56940. ch = data[offset];
  56941. while (ch !== LF && ch !== CR && ch !== LT) {
  56942. if (++offset >= data.length) {
  56943. break;
  56944. }
  56945. token += String.fromCharCode(ch);
  56946. ch = data[offset];
  56947. }
  56948. return token;
  56949. }
  56950. function skipUntil(data, offset, what) {
  56951. const length = what.length,
  56952. dataLength = data.length;
  56953. let skipped = 0;
  56954. while (offset < dataLength) {
  56955. let i = 0;
  56956. while (i < length && data[offset + i] === what[i]) {
  56957. ++i;
  56958. }
  56959. if (i >= length) {
  56960. break;
  56961. }
  56962. offset++;
  56963. skipped++;
  56964. }
  56965. return skipped;
  56966. }
  56967. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  56968. const endobjRegExp = /\bendobj[\b\s]$/;
  56969. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  56970. const CHECK_CONTENT_LENGTH = 25;
  56971. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  56972. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  56973. const objBytes = new Uint8Array([111, 98, 106]);
  56974. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  56975. this.entries.length = 0;
  56976. const stream = this.stream;
  56977. stream.pos = 0;
  56978. const buffer = stream.getBytes(),
  56979. length = buffer.length;
  56980. let position = stream.start;
  56981. const trailers = [],
  56982. xrefStms = [];
  56983. while (position < length) {
  56984. let ch = buffer[position];
  56985. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  56986. ++position;
  56987. continue;
  56988. }
  56989. if (ch === PERCENT) {
  56990. do {
  56991. ++position;
  56992. if (position >= length) {
  56993. break;
  56994. }
  56995. ch = buffer[position];
  56996. } while (ch !== LF && ch !== CR);
  56997. continue;
  56998. }
  56999. const token = readToken(buffer, position);
  57000. let m;
  57001. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  57002. position += skipUntil(buffer, position, trailerBytes);
  57003. trailers.push(position);
  57004. position += skipUntil(buffer, position, startxrefBytes);
  57005. } else if (m = objRegExp.exec(token)) {
  57006. const num = m[1] | 0,
  57007. gen = m[2] | 0;
  57008. if (!this.entries[num] || this.entries[num].gen === gen) {
  57009. this.entries[num] = {
  57010. offset: position - stream.start,
  57011. gen,
  57012. uncompressed: true
  57013. };
  57014. }
  57015. let contentLength,
  57016. startPos = position + token.length;
  57017. while (startPos < buffer.length) {
  57018. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  57019. contentLength = endPos - position;
  57020. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  57021. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  57022. if (endobjRegExp.test(tokenStr)) {
  57023. break;
  57024. } else {
  57025. const objToken = nestedObjRegExp.exec(tokenStr);
  57026. if (objToken && objToken[1]) {
  57027. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  57028. contentLength -= objToken[1].length;
  57029. break;
  57030. }
  57031. }
  57032. startPos = endPos;
  57033. }
  57034. const content = buffer.subarray(position, position + contentLength);
  57035. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  57036. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  57037. xrefStms.push(position - stream.start);
  57038. this.xrefstms[position - stream.start] = 1;
  57039. }
  57040. position += contentLength;
  57041. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  57042. trailers.push(position);
  57043. position += skipUntil(buffer, position, startxrefBytes);
  57044. } else {
  57045. position += token.length + 1;
  57046. }
  57047. }
  57048. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  57049. this.startXRefQueue.push(xrefStms[i]);
  57050. this.readXRef(true);
  57051. }
  57052. let trailerDict;
  57053. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  57054. stream.pos = trailers[i];
  57055. const parser = new _parser.Parser({
  57056. lexer: new _parser.Lexer(stream),
  57057. xref: this,
  57058. allowStreams: true,
  57059. recoveryMode: true
  57060. });
  57061. const obj = parser.getObj();
  57062. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  57063. continue;
  57064. }
  57065. const dict = parser.getObj();
  57066. if (!(0, _primitives.isDict)(dict)) {
  57067. continue;
  57068. }
  57069. try {
  57070. const rootDict = dict.get("Root");
  57071. if (!(rootDict instanceof _primitives.Dict)) {
  57072. continue;
  57073. }
  57074. const pagesDict = rootDict.get("Pages");
  57075. if (!(pagesDict instanceof _primitives.Dict)) {
  57076. continue;
  57077. }
  57078. const pagesCount = pagesDict.get("Count");
  57079. if (!Number.isInteger(pagesCount)) {
  57080. continue;
  57081. }
  57082. } catch (ex) {
  57083. continue;
  57084. }
  57085. if (dict.has("ID")) {
  57086. return dict;
  57087. }
  57088. trailerDict = dict;
  57089. }
  57090. if (trailerDict) {
  57091. return trailerDict;
  57092. }
  57093. throw new _util.InvalidPDFException("Invalid PDF structure.");
  57094. }
  57095. readXRef(recoveryMode = false) {
  57096. const stream = this.stream;
  57097. const startXRefParsedCache = new Set();
  57098. try {
  57099. while (this.startXRefQueue.length) {
  57100. const startXRef = this.startXRefQueue[0];
  57101. if (startXRefParsedCache.has(startXRef)) {
  57102. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  57103. this.startXRefQueue.shift();
  57104. continue;
  57105. }
  57106. startXRefParsedCache.add(startXRef);
  57107. stream.pos = startXRef + stream.start;
  57108. const parser = new _parser.Parser({
  57109. lexer: new _parser.Lexer(stream),
  57110. xref: this,
  57111. allowStreams: true
  57112. });
  57113. let obj = parser.getObj();
  57114. let dict;
  57115. if ((0, _primitives.isCmd)(obj, "xref")) {
  57116. dict = this.processXRefTable(parser);
  57117. if (!this.topDict) {
  57118. this.topDict = dict;
  57119. }
  57120. obj = dict.get("XRefStm");
  57121. if (Number.isInteger(obj)) {
  57122. const pos = obj;
  57123. if (!(pos in this.xrefstms)) {
  57124. this.xrefstms[pos] = 1;
  57125. this.startXRefQueue.push(pos);
  57126. }
  57127. }
  57128. } else if (Number.isInteger(obj)) {
  57129. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  57130. throw new _util.FormatError("Invalid XRef stream");
  57131. }
  57132. dict = this.processXRefStream(obj);
  57133. if (!this.topDict) {
  57134. this.topDict = dict;
  57135. }
  57136. if (!dict) {
  57137. throw new _util.FormatError("Failed to read XRef stream");
  57138. }
  57139. } else {
  57140. throw new _util.FormatError("Invalid XRef stream header");
  57141. }
  57142. obj = dict.get("Prev");
  57143. if (Number.isInteger(obj)) {
  57144. this.startXRefQueue.push(obj);
  57145. } else if ((0, _primitives.isRef)(obj)) {
  57146. this.startXRefQueue.push(obj.num);
  57147. }
  57148. this.startXRefQueue.shift();
  57149. }
  57150. return this.topDict;
  57151. } catch (e) {
  57152. if (e instanceof _core_utils.MissingDataException) {
  57153. throw e;
  57154. }
  57155. (0, _util.info)("(while reading XRef): " + e);
  57156. }
  57157. if (recoveryMode) {
  57158. return undefined;
  57159. }
  57160. throw new _core_utils.XRefParseException();
  57161. }
  57162. getEntry(i) {
  57163. const xrefEntry = this.entries[i];
  57164. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  57165. return xrefEntry;
  57166. }
  57167. return null;
  57168. }
  57169. fetchIfRef(obj, suppressEncryption = false) {
  57170. if (obj instanceof _primitives.Ref) {
  57171. return this.fetch(obj, suppressEncryption);
  57172. }
  57173. return obj;
  57174. }
  57175. fetch(ref, suppressEncryption = false) {
  57176. if (!(ref instanceof _primitives.Ref)) {
  57177. throw new Error("ref object is not a reference");
  57178. }
  57179. const num = ref.num;
  57180. const cacheEntry = this._cacheMap.get(num);
  57181. if (cacheEntry !== undefined) {
  57182. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  57183. cacheEntry.objId = ref.toString();
  57184. }
  57185. return cacheEntry;
  57186. }
  57187. let xrefEntry = this.getEntry(num);
  57188. if (xrefEntry === null) {
  57189. this._cacheMap.set(num, xrefEntry);
  57190. return xrefEntry;
  57191. }
  57192. if (xrefEntry.uncompressed) {
  57193. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  57194. } else {
  57195. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  57196. }
  57197. if ((0, _primitives.isDict)(xrefEntry)) {
  57198. xrefEntry.objId = ref.toString();
  57199. } else if ((0, _primitives.isStream)(xrefEntry)) {
  57200. xrefEntry.dict.objId = ref.toString();
  57201. }
  57202. return xrefEntry;
  57203. }
  57204. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  57205. const gen = ref.gen;
  57206. let num = ref.num;
  57207. if (xrefEntry.gen !== gen) {
  57208. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  57209. }
  57210. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  57211. const parser = new _parser.Parser({
  57212. lexer: new _parser.Lexer(stream),
  57213. xref: this,
  57214. allowStreams: true
  57215. });
  57216. const obj1 = parser.getObj();
  57217. const obj2 = parser.getObj();
  57218. const obj3 = parser.getObj();
  57219. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  57220. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  57221. }
  57222. if (obj3.cmd !== "obj") {
  57223. if (obj3.cmd.startsWith("obj")) {
  57224. num = parseInt(obj3.cmd.substring(3), 10);
  57225. if (!Number.isNaN(num)) {
  57226. return num;
  57227. }
  57228. }
  57229. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  57230. }
  57231. if (this.encrypt && !suppressEncryption) {
  57232. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  57233. } else {
  57234. xrefEntry = parser.getObj();
  57235. }
  57236. if (!(0, _primitives.isStream)(xrefEntry)) {
  57237. this._cacheMap.set(num, xrefEntry);
  57238. }
  57239. return xrefEntry;
  57240. }
  57241. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  57242. const tableOffset = xrefEntry.offset;
  57243. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  57244. if (!(0, _primitives.isStream)(stream)) {
  57245. throw new _util.FormatError("bad ObjStm stream");
  57246. }
  57247. const first = stream.dict.get("First");
  57248. const n = stream.dict.get("N");
  57249. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  57250. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  57251. }
  57252. let parser = new _parser.Parser({
  57253. lexer: new _parser.Lexer(stream),
  57254. xref: this,
  57255. allowStreams: true
  57256. });
  57257. const nums = new Array(n);
  57258. const offsets = new Array(n);
  57259. for (let i = 0; i < n; ++i) {
  57260. const num = parser.getObj();
  57261. if (!Number.isInteger(num)) {
  57262. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  57263. }
  57264. const offset = parser.getObj();
  57265. if (!Number.isInteger(offset)) {
  57266. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  57267. }
  57268. nums[i] = num;
  57269. offsets[i] = offset;
  57270. }
  57271. const start = (stream.start || 0) + first;
  57272. const entries = new Array(n);
  57273. for (let i = 0; i < n; ++i) {
  57274. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  57275. if (length < 0) {
  57276. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  57277. }
  57278. parser = new _parser.Parser({
  57279. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  57280. xref: this,
  57281. allowStreams: true
  57282. });
  57283. const obj = parser.getObj();
  57284. entries[i] = obj;
  57285. if ((0, _primitives.isStream)(obj)) {
  57286. continue;
  57287. }
  57288. const num = nums[i],
  57289. entry = this.entries[num];
  57290. if (entry && entry.offset === tableOffset && entry.gen === i) {
  57291. this._cacheMap.set(num, obj);
  57292. }
  57293. }
  57294. xrefEntry = entries[xrefEntry.gen];
  57295. if (xrefEntry === undefined) {
  57296. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  57297. }
  57298. return xrefEntry;
  57299. }
  57300. async fetchIfRefAsync(obj, suppressEncryption) {
  57301. if (obj instanceof _primitives.Ref) {
  57302. return this.fetchAsync(obj, suppressEncryption);
  57303. }
  57304. return obj;
  57305. }
  57306. async fetchAsync(ref, suppressEncryption) {
  57307. try {
  57308. return this.fetch(ref, suppressEncryption);
  57309. } catch (ex) {
  57310. if (!(ex instanceof _core_utils.MissingDataException)) {
  57311. throw ex;
  57312. }
  57313. await this.pdfManager.requestRange(ex.begin, ex.end);
  57314. return this.fetchAsync(ref, suppressEncryption);
  57315. }
  57316. }
  57317. getCatalogObj() {
  57318. return this.root;
  57319. }
  57320. }
  57321. exports.XRef = XRef;
  57322. /***/ }),
  57323. /* 89 */
  57324. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57325. Object.defineProperty(exports, "__esModule", ({
  57326. value: true
  57327. }));
  57328. exports.MessageHandler = void 0;
  57329. var _util = __w_pdfjs_require__(2);
  57330. const CallbackKind = {
  57331. UNKNOWN: 0,
  57332. DATA: 1,
  57333. ERROR: 2
  57334. };
  57335. const StreamKind = {
  57336. UNKNOWN: 0,
  57337. CANCEL: 1,
  57338. CANCEL_COMPLETE: 2,
  57339. CLOSE: 3,
  57340. ENQUEUE: 4,
  57341. ERROR: 5,
  57342. PULL: 6,
  57343. PULL_COMPLETE: 7,
  57344. START_COMPLETE: 8
  57345. };
  57346. function wrapReason(reason) {
  57347. if (typeof reason !== "object" || reason === null) {
  57348. return reason;
  57349. }
  57350. switch (reason.name) {
  57351. case "AbortException":
  57352. return new _util.AbortException(reason.message);
  57353. case "MissingPDFException":
  57354. return new _util.MissingPDFException(reason.message);
  57355. case "UnexpectedResponseException":
  57356. return new _util.UnexpectedResponseException(reason.message, reason.status);
  57357. case "UnknownErrorException":
  57358. return new _util.UnknownErrorException(reason.message, reason.details);
  57359. default:
  57360. return new _util.UnknownErrorException(reason.message, reason.toString());
  57361. }
  57362. }
  57363. class MessageHandler {
  57364. constructor(sourceName, targetName, comObj) {
  57365. this.sourceName = sourceName;
  57366. this.targetName = targetName;
  57367. this.comObj = comObj;
  57368. this.callbackId = 1;
  57369. this.streamId = 1;
  57370. this.postMessageTransfers = true;
  57371. this.streamSinks = Object.create(null);
  57372. this.streamControllers = Object.create(null);
  57373. this.callbackCapabilities = Object.create(null);
  57374. this.actionHandler = Object.create(null);
  57375. this._onComObjOnMessage = event => {
  57376. const data = event.data;
  57377. if (data.targetName !== this.sourceName) {
  57378. return;
  57379. }
  57380. if (data.stream) {
  57381. this._processStreamMessage(data);
  57382. return;
  57383. }
  57384. if (data.callback) {
  57385. const callbackId = data.callbackId;
  57386. const capability = this.callbackCapabilities[callbackId];
  57387. if (!capability) {
  57388. throw new Error(`Cannot resolve callback ${callbackId}`);
  57389. }
  57390. delete this.callbackCapabilities[callbackId];
  57391. if (data.callback === CallbackKind.DATA) {
  57392. capability.resolve(data.data);
  57393. } else if (data.callback === CallbackKind.ERROR) {
  57394. capability.reject(wrapReason(data.reason));
  57395. } else {
  57396. throw new Error("Unexpected callback case");
  57397. }
  57398. return;
  57399. }
  57400. const action = this.actionHandler[data.action];
  57401. if (!action) {
  57402. throw new Error(`Unknown action from worker: ${data.action}`);
  57403. }
  57404. if (data.callbackId) {
  57405. const cbSourceName = this.sourceName;
  57406. const cbTargetName = data.sourceName;
  57407. new Promise(function (resolve) {
  57408. resolve(action(data.data));
  57409. }).then(function (result) {
  57410. comObj.postMessage({
  57411. sourceName: cbSourceName,
  57412. targetName: cbTargetName,
  57413. callback: CallbackKind.DATA,
  57414. callbackId: data.callbackId,
  57415. data: result
  57416. });
  57417. }, function (reason) {
  57418. comObj.postMessage({
  57419. sourceName: cbSourceName,
  57420. targetName: cbTargetName,
  57421. callback: CallbackKind.ERROR,
  57422. callbackId: data.callbackId,
  57423. reason: wrapReason(reason)
  57424. });
  57425. });
  57426. return;
  57427. }
  57428. if (data.streamId) {
  57429. this._createStreamSink(data);
  57430. return;
  57431. }
  57432. action(data.data);
  57433. };
  57434. comObj.addEventListener("message", this._onComObjOnMessage);
  57435. }
  57436. on(actionName, handler) {
  57437. const ah = this.actionHandler;
  57438. if (ah[actionName]) {
  57439. throw new Error(`There is already an actionName called "${actionName}"`);
  57440. }
  57441. ah[actionName] = handler;
  57442. }
  57443. send(actionName, data, transfers) {
  57444. this._postMessage({
  57445. sourceName: this.sourceName,
  57446. targetName: this.targetName,
  57447. action: actionName,
  57448. data
  57449. }, transfers);
  57450. }
  57451. sendWithPromise(actionName, data, transfers) {
  57452. const callbackId = this.callbackId++;
  57453. const capability = (0, _util.createPromiseCapability)();
  57454. this.callbackCapabilities[callbackId] = capability;
  57455. try {
  57456. this._postMessage({
  57457. sourceName: this.sourceName,
  57458. targetName: this.targetName,
  57459. action: actionName,
  57460. callbackId,
  57461. data
  57462. }, transfers);
  57463. } catch (ex) {
  57464. capability.reject(ex);
  57465. }
  57466. return capability.promise;
  57467. }
  57468. sendWithStream(actionName, data, queueingStrategy, transfers) {
  57469. const streamId = this.streamId++;
  57470. const sourceName = this.sourceName;
  57471. const targetName = this.targetName;
  57472. const comObj = this.comObj;
  57473. return new ReadableStream({
  57474. start: controller => {
  57475. const startCapability = (0, _util.createPromiseCapability)();
  57476. this.streamControllers[streamId] = {
  57477. controller,
  57478. startCall: startCapability,
  57479. pullCall: null,
  57480. cancelCall: null,
  57481. isClosed: false
  57482. };
  57483. this._postMessage({
  57484. sourceName,
  57485. targetName,
  57486. action: actionName,
  57487. streamId,
  57488. data,
  57489. desiredSize: controller.desiredSize
  57490. }, transfers);
  57491. return startCapability.promise;
  57492. },
  57493. pull: controller => {
  57494. const pullCapability = (0, _util.createPromiseCapability)();
  57495. this.streamControllers[streamId].pullCall = pullCapability;
  57496. comObj.postMessage({
  57497. sourceName,
  57498. targetName,
  57499. stream: StreamKind.PULL,
  57500. streamId,
  57501. desiredSize: controller.desiredSize
  57502. });
  57503. return pullCapability.promise;
  57504. },
  57505. cancel: reason => {
  57506. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  57507. const cancelCapability = (0, _util.createPromiseCapability)();
  57508. this.streamControllers[streamId].cancelCall = cancelCapability;
  57509. this.streamControllers[streamId].isClosed = true;
  57510. comObj.postMessage({
  57511. sourceName,
  57512. targetName,
  57513. stream: StreamKind.CANCEL,
  57514. streamId,
  57515. reason: wrapReason(reason)
  57516. });
  57517. return cancelCapability.promise;
  57518. }
  57519. }, queueingStrategy);
  57520. }
  57521. _createStreamSink(data) {
  57522. const self = this;
  57523. const action = this.actionHandler[data.action];
  57524. const streamId = data.streamId;
  57525. const sourceName = this.sourceName;
  57526. const targetName = data.sourceName;
  57527. const comObj = this.comObj;
  57528. const streamSink = {
  57529. enqueue(chunk, size = 1, transfers) {
  57530. if (this.isCancelled) {
  57531. return;
  57532. }
  57533. const lastDesiredSize = this.desiredSize;
  57534. this.desiredSize -= size;
  57535. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  57536. this.sinkCapability = (0, _util.createPromiseCapability)();
  57537. this.ready = this.sinkCapability.promise;
  57538. }
  57539. self._postMessage({
  57540. sourceName,
  57541. targetName,
  57542. stream: StreamKind.ENQUEUE,
  57543. streamId,
  57544. chunk
  57545. }, transfers);
  57546. },
  57547. close() {
  57548. if (this.isCancelled) {
  57549. return;
  57550. }
  57551. this.isCancelled = true;
  57552. comObj.postMessage({
  57553. sourceName,
  57554. targetName,
  57555. stream: StreamKind.CLOSE,
  57556. streamId
  57557. });
  57558. delete self.streamSinks[streamId];
  57559. },
  57560. error(reason) {
  57561. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  57562. if (this.isCancelled) {
  57563. return;
  57564. }
  57565. this.isCancelled = true;
  57566. comObj.postMessage({
  57567. sourceName,
  57568. targetName,
  57569. stream: StreamKind.ERROR,
  57570. streamId,
  57571. reason: wrapReason(reason)
  57572. });
  57573. },
  57574. sinkCapability: (0, _util.createPromiseCapability)(),
  57575. onPull: null,
  57576. onCancel: null,
  57577. isCancelled: false,
  57578. desiredSize: data.desiredSize,
  57579. ready: null
  57580. };
  57581. streamSink.sinkCapability.resolve();
  57582. streamSink.ready = streamSink.sinkCapability.promise;
  57583. this.streamSinks[streamId] = streamSink;
  57584. new Promise(function (resolve) {
  57585. resolve(action(data.data, streamSink));
  57586. }).then(function () {
  57587. comObj.postMessage({
  57588. sourceName,
  57589. targetName,
  57590. stream: StreamKind.START_COMPLETE,
  57591. streamId,
  57592. success: true
  57593. });
  57594. }, function (reason) {
  57595. comObj.postMessage({
  57596. sourceName,
  57597. targetName,
  57598. stream: StreamKind.START_COMPLETE,
  57599. streamId,
  57600. reason: wrapReason(reason)
  57601. });
  57602. });
  57603. }
  57604. _processStreamMessage(data) {
  57605. const streamId = data.streamId;
  57606. const sourceName = this.sourceName;
  57607. const targetName = data.sourceName;
  57608. const comObj = this.comObj;
  57609. switch (data.stream) {
  57610. case StreamKind.START_COMPLETE:
  57611. if (data.success) {
  57612. this.streamControllers[streamId].startCall.resolve();
  57613. } else {
  57614. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  57615. }
  57616. break;
  57617. case StreamKind.PULL_COMPLETE:
  57618. if (data.success) {
  57619. this.streamControllers[streamId].pullCall.resolve();
  57620. } else {
  57621. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  57622. }
  57623. break;
  57624. case StreamKind.PULL:
  57625. if (!this.streamSinks[streamId]) {
  57626. comObj.postMessage({
  57627. sourceName,
  57628. targetName,
  57629. stream: StreamKind.PULL_COMPLETE,
  57630. streamId,
  57631. success: true
  57632. });
  57633. break;
  57634. }
  57635. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  57636. this.streamSinks[streamId].sinkCapability.resolve();
  57637. }
  57638. this.streamSinks[streamId].desiredSize = data.desiredSize;
  57639. const {
  57640. onPull
  57641. } = this.streamSinks[data.streamId];
  57642. new Promise(function (resolve) {
  57643. resolve(onPull && onPull());
  57644. }).then(function () {
  57645. comObj.postMessage({
  57646. sourceName,
  57647. targetName,
  57648. stream: StreamKind.PULL_COMPLETE,
  57649. streamId,
  57650. success: true
  57651. });
  57652. }, function (reason) {
  57653. comObj.postMessage({
  57654. sourceName,
  57655. targetName,
  57656. stream: StreamKind.PULL_COMPLETE,
  57657. streamId,
  57658. reason: wrapReason(reason)
  57659. });
  57660. });
  57661. break;
  57662. case StreamKind.ENQUEUE:
  57663. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  57664. if (this.streamControllers[streamId].isClosed) {
  57665. break;
  57666. }
  57667. this.streamControllers[streamId].controller.enqueue(data.chunk);
  57668. break;
  57669. case StreamKind.CLOSE:
  57670. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  57671. if (this.streamControllers[streamId].isClosed) {
  57672. break;
  57673. }
  57674. this.streamControllers[streamId].isClosed = true;
  57675. this.streamControllers[streamId].controller.close();
  57676. this._deleteStreamController(streamId);
  57677. break;
  57678. case StreamKind.ERROR:
  57679. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  57680. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  57681. this._deleteStreamController(streamId);
  57682. break;
  57683. case StreamKind.CANCEL_COMPLETE:
  57684. if (data.success) {
  57685. this.streamControllers[streamId].cancelCall.resolve();
  57686. } else {
  57687. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  57688. }
  57689. this._deleteStreamController(streamId);
  57690. break;
  57691. case StreamKind.CANCEL:
  57692. if (!this.streamSinks[streamId]) {
  57693. break;
  57694. }
  57695. const {
  57696. onCancel
  57697. } = this.streamSinks[data.streamId];
  57698. new Promise(function (resolve) {
  57699. resolve(onCancel && onCancel(wrapReason(data.reason)));
  57700. }).then(function () {
  57701. comObj.postMessage({
  57702. sourceName,
  57703. targetName,
  57704. stream: StreamKind.CANCEL_COMPLETE,
  57705. streamId,
  57706. success: true
  57707. });
  57708. }, function (reason) {
  57709. comObj.postMessage({
  57710. sourceName,
  57711. targetName,
  57712. stream: StreamKind.CANCEL_COMPLETE,
  57713. streamId,
  57714. reason: wrapReason(reason)
  57715. });
  57716. });
  57717. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  57718. this.streamSinks[streamId].isCancelled = true;
  57719. delete this.streamSinks[streamId];
  57720. break;
  57721. default:
  57722. throw new Error("Unexpected stream case");
  57723. }
  57724. }
  57725. async _deleteStreamController(streamId) {
  57726. await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  57727. return capability && capability.promise;
  57728. }));
  57729. delete this.streamControllers[streamId];
  57730. }
  57731. _postMessage(message, transfers) {
  57732. if (transfers && this.postMessageTransfers) {
  57733. this.comObj.postMessage(message, transfers);
  57734. } else {
  57735. this.comObj.postMessage(message);
  57736. }
  57737. }
  57738. destroy() {
  57739. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  57740. }
  57741. }
  57742. exports.MessageHandler = MessageHandler;
  57743. /***/ }),
  57744. /* 90 */
  57745. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57746. Object.defineProperty(exports, "__esModule", ({
  57747. value: true
  57748. }));
  57749. exports.PDFWorkerStream = void 0;
  57750. var _util = __w_pdfjs_require__(2);
  57751. class PDFWorkerStream {
  57752. constructor(msgHandler) {
  57753. this._msgHandler = msgHandler;
  57754. this._contentLength = null;
  57755. this._fullRequestReader = null;
  57756. this._rangeRequestReaders = [];
  57757. }
  57758. getFullReader() {
  57759. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  57760. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  57761. return this._fullRequestReader;
  57762. }
  57763. getRangeReader(begin, end) {
  57764. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  57765. this._rangeRequestReaders.push(reader);
  57766. return reader;
  57767. }
  57768. cancelAllRequests(reason) {
  57769. if (this._fullRequestReader) {
  57770. this._fullRequestReader.cancel(reason);
  57771. }
  57772. for (const reader of this._rangeRequestReaders.slice(0)) {
  57773. reader.cancel(reason);
  57774. }
  57775. }
  57776. }
  57777. exports.PDFWorkerStream = PDFWorkerStream;
  57778. class PDFWorkerStreamReader {
  57779. constructor(msgHandler) {
  57780. this._msgHandler = msgHandler;
  57781. this.onProgress = null;
  57782. this._contentLength = null;
  57783. this._isRangeSupported = false;
  57784. this._isStreamingSupported = false;
  57785. const readableStream = this._msgHandler.sendWithStream("GetReader");
  57786. this._reader = readableStream.getReader();
  57787. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  57788. this._isStreamingSupported = data.isStreamingSupported;
  57789. this._isRangeSupported = data.isRangeSupported;
  57790. this._contentLength = data.contentLength;
  57791. });
  57792. }
  57793. get headersReady() {
  57794. return this._headersReady;
  57795. }
  57796. get contentLength() {
  57797. return this._contentLength;
  57798. }
  57799. get isStreamingSupported() {
  57800. return this._isStreamingSupported;
  57801. }
  57802. get isRangeSupported() {
  57803. return this._isRangeSupported;
  57804. }
  57805. async read() {
  57806. const {
  57807. value,
  57808. done
  57809. } = await this._reader.read();
  57810. if (done) {
  57811. return {
  57812. value: undefined,
  57813. done: true
  57814. };
  57815. }
  57816. return {
  57817. value: value.buffer,
  57818. done: false
  57819. };
  57820. }
  57821. cancel(reason) {
  57822. this._reader.cancel(reason);
  57823. }
  57824. }
  57825. class PDFWorkerStreamRangeReader {
  57826. constructor(begin, end, msgHandler) {
  57827. this._msgHandler = msgHandler;
  57828. this.onProgress = null;
  57829. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  57830. begin,
  57831. end
  57832. });
  57833. this._reader = readableStream.getReader();
  57834. }
  57835. get isStreamingSupported() {
  57836. return false;
  57837. }
  57838. async read() {
  57839. const {
  57840. value,
  57841. done
  57842. } = await this._reader.read();
  57843. if (done) {
  57844. return {
  57845. value: undefined,
  57846. done: true
  57847. };
  57848. }
  57849. return {
  57850. value: value.buffer,
  57851. done: false
  57852. };
  57853. }
  57854. cancel(reason) {
  57855. this._reader.cancel(reason);
  57856. }
  57857. }
  57858. /***/ })
  57859. /******/ ]);
  57860. /************************************************************************/
  57861. /******/ // The module cache
  57862. /******/ var __webpack_module_cache__ = {};
  57863. /******/
  57864. /******/ // The require function
  57865. /******/ function __w_pdfjs_require__(moduleId) {
  57866. /******/ // Check if module is in cache
  57867. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  57868. /******/ if (cachedModule !== undefined) {
  57869. /******/ return cachedModule.exports;
  57870. /******/ }
  57871. /******/ // Create a new module (and put it into the cache)
  57872. /******/ var module = __webpack_module_cache__[moduleId] = {
  57873. /******/ // no module.id needed
  57874. /******/ // no module.loaded needed
  57875. /******/ exports: {}
  57876. /******/ };
  57877. /******/
  57878. /******/ // Execute the module function
  57879. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  57880. /******/
  57881. /******/ // Return the exports of the module
  57882. /******/ return module.exports;
  57883. /******/ }
  57884. /******/
  57885. /************************************************************************/
  57886. /******/ /* webpack/runtime/define property getters */
  57887. /******/ (() => {
  57888. /******/ // define getter functions for harmony exports
  57889. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  57890. /******/ for(var key in definition) {
  57891. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  57892. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  57893. /******/ }
  57894. /******/ }
  57895. /******/ };
  57896. /******/ })();
  57897. /******/
  57898. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  57899. /******/ (() => {
  57900. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  57901. /******/ })();
  57902. /******/
  57903. /******/ /* webpack/runtime/make namespace object */
  57904. /******/ (() => {
  57905. /******/ // define __esModule on exports
  57906. /******/ __w_pdfjs_require__.r = (exports) => {
  57907. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  57908. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57909. /******/ }
  57910. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  57911. /******/ };
  57912. /******/ })();
  57913. /******/
  57914. /************************************************************************/
  57915. var __webpack_exports__ = {};
  57916. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  57917. (() => {
  57918. var exports = __webpack_exports__;
  57919. Object.defineProperty(exports, "__esModule", ({
  57920. value: true
  57921. }));
  57922. Object.defineProperty(exports, "WorkerMessageHandler", ({
  57923. enumerable: true,
  57924. get: function () {
  57925. return _worker.WorkerMessageHandler;
  57926. }
  57927. }));
  57928. var _worker = __w_pdfjs_require__(1);
  57929. const pdfjsVersion = '2.9.359';
  57930. const pdfjsBuild = 'e667c8cbc';
  57931. })();
  57932. /******/ return __webpack_exports__;
  57933. /******/ })()
  57934. ;
  57935. });
  57936. //# sourceMappingURL=pdf.worker.js.map